Skip to content

Commit 404a1d3

Browse files
committed
Change identicon seed algo to match Metamask
1 parent 8c4096d commit 404a1d3

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/components/Identicon.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import jazzicon from '@metamask/jazzicon'
2-
import { BigNumber } from 'ethers'
32
import { PureComponent } from 'react'
43
import { Styles } from 'src/styles/types'
54
import { isValidAddress, normalizeAddress } from 'src/utils/addresses'
@@ -10,8 +9,10 @@ type Props = {
109
styles?: Styles
1110
}
1211

12+
// This should match metamask: https://github.com/MetaMask/metamask-extension/blob/master/ui/helpers/utils/icon-factory.js#L84
1313
function addressToSeed(address: string) {
14-
return BigNumber.from(normalizeAddress(address).slice(0, 8)).toNumber()
14+
const addrStub = normalizeAddress(address).slice(2, 10)
15+
return parseInt(addrStub, 16)
1516
}
1617

1718
export class Identicon extends PureComponent<Props> {

0 commit comments

Comments
 (0)