mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Merge pull request #2413 from danjm/NewUI-flat-fix-addtoken-search
[NewUI-flat] Fixes add token search.
This commit is contained in:
commit
511339a969
@ -7,7 +7,9 @@ const Fuse = require('fuse.js')
|
|||||||
const contractMap = require('eth-contract-metadata')
|
const contractMap = require('eth-contract-metadata')
|
||||||
const TokenBalance = require('./components/token-balance')
|
const TokenBalance = require('./components/token-balance')
|
||||||
const Identicon = require('./components/identicon')
|
const Identicon = require('./components/identicon')
|
||||||
const contractList = Object.entries(contractMap).map(([ _, tokenData]) => tokenData)
|
const contractList = Object.entries(contractMap)
|
||||||
|
.map(([ _, tokenData]) => tokenData)
|
||||||
|
.filter(tokenData => Boolean(tokenData.erc20))
|
||||||
const fuse = new Fuse(contractList, {
|
const fuse = new Fuse(contractList, {
|
||||||
shouldSort: true,
|
shouldSort: true,
|
||||||
threshold: 0.45,
|
threshold: 0.45,
|
||||||
@ -105,6 +107,7 @@ AddTokenScreen.prototype.tokenAddressDidChange = function (e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AddTokenScreen.prototype.checkExistingAddresses = function (address) {
|
AddTokenScreen.prototype.checkExistingAddresses = function (address) {
|
||||||
|
if (!address) return false
|
||||||
const tokensList = this.props.tokens
|
const tokensList = this.props.tokens
|
||||||
const matchesAddress = existingToken => {
|
const matchesAddress = existingToken => {
|
||||||
return existingToken.address.toLowerCase() === address.toLowerCase()
|
return existingToken.address.toLowerCase() === address.toLowerCase()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user