Commit 9cacd577 authored by Zach Pomerantz's avatar Zach Pomerantz Committed by GitHub

fix: restrict @davatar usage to avoid 3p fetches (#2649)

parent 5e8d725e
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>
) )
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment