Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LuckySwap
interface
Commits
9cacd577
Unverified
Commit
9cacd577
authored
Oct 20, 2021
by
Zach Pomerantz
Committed by
GitHub
Oct 20, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: restrict @davatar usage to avoid 3p fetches (#2649)
parent
5e8d725e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
index.tsx
src/components/Identicon/index.tsx
+13
-3
No files found.
src/components/Identicon/index.tsx
View file @
9cacd577
import
Davatar
from
'
@davatar/react
'
import
Davatar
,
{
Image
}
from
'
@davatar/react
'
import
{
useMemo
}
from
'
react
'
import
styled
from
'
styled-components/macro
'
import
styled
from
'
styled-components/macro
'
import
{
useActiveWeb3React
}
from
'
../../hooks/web3
'
import
{
useActiveWeb3React
}
from
'
../../hooks/web3
'
...
@@ -13,10 +14,19 @@ const StyledIdenticonContainer = styled.div`
...
@@ -13,10 +14,19 @@ const StyledIdenticonContainer = styled.div`
export
default
function
Identicon
()
{
export
default
function
Identicon
()
{
const
{
account
,
library
}
=
useActiveWeb3React
()
const
{
account
,
library
}
=
useActiveWeb3React
()
// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/30451
// restrict usage of Davatar until it stops sending 3p requests
// see https://github.com/metaphor-xyz/davatar-helpers/issues/18
const
supportsENS
=
useMemo
(()
=>
{
return
([
1
,
3
,
4
,
5
]
as
Array
<
number
|
undefined
>
).
includes
(
library
?.
network
.
chainId
)
},
[
library
])
return
(
return
(
<
StyledIdenticonContainer
>
<
StyledIdenticonContainer
>
{
account
&&
library
?.
provider
&&
<
Davatar
address=
{
account
}
size=
{
16
}
provider=
{
library
.
provider
}
/>
}
{
account
&&
supportsENS
?
(
<
Davatar
address=
{
account
}
size=
{
16
}
provider=
{
library
}
/>
)
:
(
<
Image
address=
{
account
}
size=
{
16
}
/>
)
}
</
StyledIdenticonContainer
>
</
StyledIdenticonContainer
>
)
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment