From 1276cf43939d441d0b4ad60b8691f0c1891b5243 Mon Sep 17 00:00:00 2001 From: Anirudha Bose Date: Sat, 8 May 2021 01:02:15 +0530 Subject: [PATCH] chore: update ERC-20 token list The package eth-contract-metadata has been deprecated, and replaced with @metamask/contract-metadata. Fixes brave/brave-browser#15688. --- app/scripts/controllers/detect-tokens.js | 4 ++-- app/scripts/metamask-controller.js | 2 +- development/build/static.js | 2 +- package.json | 2 +- test/unit/app/controllers/detect-tokens-test.js | 2 +- ui/app/components/ui/identicon/identicon.component.js | 2 +- ui/app/helpers/utils/token-util.js | 2 +- .../pages/add-token/token-search/token-search.component.js | 2 +- .../confirm-transaction-base.container.js | 2 +- .../pages/send/send-content/add-recipient/add-recipient.js | 2 +- ui/lib/icon-factory.js | 2 +- yarn.lock | 7 ++++++- 12 files changed, 18 insertions(+), 13 deletions(-) diff --git a/app/scripts/controllers/detect-tokens.js b/app/scripts/controllers/detect-tokens.js index 6b7424f98f..7d1757f679 100644 --- a/app/scripts/controllers/detect-tokens.js +++ b/app/scripts/controllers/detect-tokens.js @@ -1,5 +1,5 @@ import Web3 from 'web3' -import contracts from 'eth-contract-metadata' +import contracts from '@metamask/contract-metadata' import { warn } from 'loglevel' import { MAINNET } from './network/enums' // By default, poll every 3 minutes @@ -25,7 +25,7 @@ export default class DetectTokensController { } /** - * For each token in eth-contract-metadata, find check selectedAddress balance. + * For each token in @metamask/contract-metadata, find check selectedAddress balance. */ async detectNewTokens () { if (!this.isActive) { diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 0db7d2e4c9..fead800488 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -57,7 +57,7 @@ import TrezorKeyring from 'eth-trezor-keyring' import LedgerBridgeKeyring from '@metamask/eth-ledger-bridge-keyring' import EthQuery from 'eth-query' import nanoid from 'nanoid' -import contractMap from 'eth-contract-metadata' +import contractMap from '@metamask/contract-metadata' import { AddressBookController, diff --git a/development/build/static.js b/development/build/static.js index 62dbeaa623..d597aade44 100644 --- a/development/build/static.js +++ b/development/build/static.js @@ -20,7 +20,7 @@ const copyTargets = [ dest: `images`, }, { - src: `./node_modules/eth-contract-metadata/images/`, + src: `./node_modules/@metamask/contract-metadata/images/`, dest: `images/contract`, }, { diff --git a/package.json b/package.json index 1e51467e7f..be246e2da9 100644 --- a/package.json +++ b/package.json @@ -83,6 +83,7 @@ "@formatjs/intl-relativetimeformat": "^5.2.6", "@fortawesome/fontawesome-free": "^5.13.0", "@material-ui/core": "^4.11.0", + "@metamask/contract-metadata": "^1.25.0", "@metamask/controllers": "^2.0.5", "@metamask/eth-ledger-bridge-keyring": "^0.2.6", "@metamask/etherscan-link": "^1.1.0", @@ -110,7 +111,6 @@ "dnode": "^1.2.2", "end-of-stream": "^1.4.4", "eth-block-tracker": "^4.4.2", - "eth-contract-metadata": "^1.16.0", "eth-ens-namehash": "^2.0.8", "eth-json-rpc-errors": "^2.0.2", "eth-json-rpc-filters": "^4.1.1", diff --git a/test/unit/app/controllers/detect-tokens-test.js b/test/unit/app/controllers/detect-tokens-test.js index ee2418856c..d40c9fa098 100644 --- a/test/unit/app/controllers/detect-tokens-test.js +++ b/test/unit/app/controllers/detect-tokens-test.js @@ -2,7 +2,7 @@ import assert from 'assert' import nock from 'nock' import sinon from 'sinon' import ObservableStore from 'obs-store' -import contracts from 'eth-contract-metadata' +import contracts from '@metamask/contract-metadata' import BigNumber from 'bignumber.js' import DetectTokensController from '../../../../app/scripts/controllers/detect-tokens' diff --git a/ui/app/components/ui/identicon/identicon.component.js b/ui/app/components/ui/identicon/identicon.component.js index 60886063d7..9b55cb889e 100644 --- a/ui/app/components/ui/identicon/identicon.component.js +++ b/ui/app/components/ui/identicon/identicon.component.js @@ -1,7 +1,7 @@ import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import classnames from 'classnames' -import contractMap from 'eth-contract-metadata' +import contractMap from '@metamask/contract-metadata' import BlockieIdenticon from './blockieIdenticon' import { checksumAddress } from '../../../helpers/utils/util' diff --git a/ui/app/helpers/utils/token-util.js b/ui/app/helpers/utils/token-util.js index eb427fe0bf..a2e103c61a 100644 --- a/ui/app/helpers/utils/token-util.js +++ b/ui/app/helpers/utils/token-util.js @@ -1,7 +1,7 @@ import log from 'loglevel' import * as util from './util' import BigNumber from 'bignumber.js' -import contractMap from 'eth-contract-metadata' +import contractMap from '@metamask/contract-metadata' import { conversionUtil, multiplyCurrencies } from './conversion-util' import { formatCurrency } from './confirm-tx.util' diff --git a/ui/app/pages/add-token/token-search/token-search.component.js b/ui/app/pages/add-token/token-search/token-search.component.js index 82aaae3fc9..8c62e29f15 100644 --- a/ui/app/pages/add-token/token-search/token-search.component.js +++ b/ui/app/pages/add-token/token-search/token-search.component.js @@ -1,6 +1,6 @@ import React, { Component } from 'react' import PropTypes from 'prop-types' -import contractMap from 'eth-contract-metadata' +import contractMap from '@metamask/contract-metadata' import Fuse from 'fuse.js' import InputAdornment from '@material-ui/core/InputAdornment' import TextField from '../../../components/ui/text-field' diff --git a/ui/app/pages/confirm-transaction-base/confirm-transaction-base.container.js b/ui/app/pages/confirm-transaction-base/confirm-transaction-base.container.js index 096593792c..0dfa5c41ea 100644 --- a/ui/app/pages/confirm-transaction-base/confirm-transaction-base.container.js +++ b/ui/app/pages/confirm-transaction-base/confirm-transaction-base.container.js @@ -1,7 +1,7 @@ import { connect } from 'react-redux' import { compose } from 'redux' import { withRouter } from 'react-router-dom' -import contractMap from 'eth-contract-metadata' +import contractMap from '@metamask/contract-metadata' import ConfirmTransactionBase from './confirm-transaction-base.component' import { clearConfirmTransaction, diff --git a/ui/app/pages/send/send-content/add-recipient/add-recipient.js b/ui/app/pages/send/send-content/add-recipient/add-recipient.js index a5407ece02..5e5558abe1 100644 --- a/ui/app/pages/send/send-content/add-recipient/add-recipient.js +++ b/ui/app/pages/send/send-content/add-recipient/add-recipient.js @@ -7,7 +7,7 @@ import { import { isValidAddress, isEthNetwork, checkExistingAddresses } from '../../../../helpers/utils/util' import ethUtil from 'ethereumjs-util' -import contractMap from 'eth-contract-metadata' +import contractMap from '@metamask/contract-metadata' export function getToErrorObject (to, hasHexData = false, network) { let toError = null diff --git a/ui/lib/icon-factory.js b/ui/lib/icon-factory.js index 0776041955..0cc9cf7b77 100644 --- a/ui/lib/icon-factory.js +++ b/ui/lib/icon-factory.js @@ -1,7 +1,7 @@ let iconFactory import { isValidAddress } from 'ethereumjs-util' import { checksumAddress } from '../app/helpers/utils/util' -import contractMap from 'eth-contract-metadata' +import contractMap from '@metamask/contract-metadata' export default function iconFactoryGenerator (jazzicon) { if (!iconFactory) { diff --git a/yarn.lock b/yarn.lock index ff13998141..ce34ed4d97 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1451,6 +1451,11 @@ resolved "https://registry.yarnpkg.com/@metamask/contract-metadata/-/contract-metadata-1.22.0.tgz#55cc84756c703c433176b484b1d34f0e03d16d1e" integrity sha512-t4ijbU+4OH9UAlrPkfLPFo6KmkRTRZJHB+Vly4ajF8oZMnota5YjVVl/SmltsoRC9xvJtRn9DUVf3YMHMIdofw== +"@metamask/contract-metadata@^1.25.0": + version "1.25.0" + resolved "https://registry.yarnpkg.com/@metamask/contract-metadata/-/contract-metadata-1.25.0.tgz#442ace91fb40165310764b68d8096d0017bb0492" + integrity sha512-yhmYB9CQPv0dckNcPoWDcgtrdUp0OgK0uvkRE5QIBv4b3qENI1/03BztvK2ijbTuMlORUpjPq7/1MQDUPoRPVw== + "@metamask/controllers@^2.0.5": version "2.0.5" resolved "https://registry.yarnpkg.com/@metamask/controllers/-/controllers-2.0.5.tgz#302dbae0595b269f2660253ee40c4c7f9bce069e" @@ -9083,7 +9088,7 @@ eth-block-tracker@^4.4.2: pify "^3.0.0" safe-event-emitter "^1.0.1" -eth-contract-metadata@^1.11.0, eth-contract-metadata@^1.16.0: +eth-contract-metadata@^1.11.0: version "1.17.0" resolved "https://registry.yarnpkg.com/eth-contract-metadata/-/eth-contract-metadata-1.17.0.tgz#96d4b056ac9a7175eeba091dbabd0713cfd4c703" integrity sha512-vlw4OiW3+9J3kJfEtPCyiSW9fhdWTqrAhXcvdMY2CevGxbhvOd5Lz59DeWerSTV3IoSXttghDurPA76dAeTV+A==