From 9d4b8a4903e39ccc16c1122e31c429f89e9eba1a Mon Sep 17 00:00:00 2001 From: Erik Marks <25517051+rekmarks@users.noreply.github.com> Date: Tue, 1 Dec 2020 14:55:01 -0800 Subject: [PATCH] @metamask/contract-metadata (#9968) --- .github/dependabot.yml | 1 - app/scripts/controllers/detect-tokens.js | 4 ++-- app/scripts/metamask-controller.js | 2 +- development/build/static.js | 2 +- package.json | 2 +- shared/constants/tokens.js | 4 ++-- 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 +- ui/app/hooks/useTokensToSearch.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 ++++++- 15 files changed, 21 insertions(+), 17 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index d35290252..3c2610e72 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,5 +9,4 @@ updates: interval: "daily" allow: - dependency-name: "@metamask/*" - - dependency-name: "eth-contract-metadata" versioning-strategy: "lockfile-only" diff --git a/app/scripts/controllers/detect-tokens.js b/app/scripts/controllers/detect-tokens.js index 6c1c213a6..1fda6dccc 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 SINGLE_CALL_BALANCES_ABI from 'single-call-balance-checker-abi' import { MAINNET } from './network/enums' @@ -32,7 +32,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 e6678054d..5a4e69aaf 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -18,7 +18,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, CurrencyRateController, diff --git a/development/build/static.js b/development/build/static.js index 56f1afb32..142f290d1 100644 --- a/development/build/static.js +++ b/development/build/static.js @@ -19,7 +19,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 dab32252b..5305c17ac 100644 --- a/package.json +++ b/package.json @@ -76,6 +76,7 @@ "@formatjs/intl-relativetimeformat": "^5.2.6", "@fortawesome/fontawesome-free": "^5.13.0", "@material-ui/core": "^4.11.0", + "@metamask/contract-metadata": "^1.19.0", "@metamask/controllers": "^4.2.0", "@metamask/eth-ledger-bridge-keyring": "^0.2.6", "@metamask/eth-token-tracker": "^3.0.1", @@ -104,7 +105,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.2.1", diff --git a/shared/constants/tokens.js b/shared/constants/tokens.js index a31c1ec18..27b240f7b 100644 --- a/shared/constants/tokens.js +++ b/shared/constants/tokens.js @@ -1,8 +1,8 @@ -import contractMap from 'eth-contract-metadata' +import contractMap from '@metamask/contract-metadata' /** * A normalized list of addresses exported as part of the contractMap in - * eth-contract-metadata. Used primarily to validate if manually entered + * @metamask/contract-metadata. Used primarily to validate if manually entered * contract addresses do not match one of our listed tokens */ export const LISTED_CONTRACT_ADDRESSES = Object.keys( diff --git a/test/unit/app/controllers/detect-tokens-test.js b/test/unit/app/controllers/detect-tokens-test.js index 8f3a5a52c..82be8808a 100644 --- a/test/unit/app/controllers/detect-tokens-test.js +++ b/test/unit/app/controllers/detect-tokens-test.js @@ -1,7 +1,7 @@ import assert from 'assert' 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 79d7cf1b5..09a731eca 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 { checksumAddress } from '../../../helpers/utils/util' import Jazzicon from '../jazzicon' diff --git a/ui/app/helpers/utils/token-util.js b/ui/app/helpers/utils/token-util.js index fa581f910..e8965edb3 100644 --- a/ui/app/helpers/utils/token-util.js +++ b/ui/app/helpers/utils/token-util.js @@ -1,6 +1,6 @@ import log from 'loglevel' import BigNumber from 'bignumber.js' -import contractMap from 'eth-contract-metadata' +import contractMap from '@metamask/contract-metadata' import * as util from './util' import { conversionUtil, multiplyCurrencies } from './conversion-util' import { formatCurrency } from './confirm-tx.util' diff --git a/ui/app/hooks/useTokensToSearch.js b/ui/app/hooks/useTokensToSearch.js index 0d9485e1b..8df33e55e 100644 --- a/ui/app/hooks/useTokensToSearch.js +++ b/ui/app/hooks/useTokensToSearch.js @@ -1,6 +1,6 @@ import { useMemo } from 'react' import { useSelector } from 'react-redux' -import contractMap from 'eth-contract-metadata' +import contractMap from '@metamask/contract-metadata' import BigNumber from 'bignumber.js' import { isEqual, shuffle } from 'lodash' import { checksumAddress } from '../helpers/utils/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 8ef9d20af..8b889b057 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 245df89ec..09cece00e 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 { clearConfirmTransaction } from '../../ducks/confirm-transaction/confirm-transaction.duck' import { 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 dc6283b83..47b64f774 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 @@ -1,5 +1,5 @@ import ethUtil from 'ethereumjs-util' -import contractMap from 'eth-contract-metadata' +import contractMap from '@metamask/contract-metadata' import { REQUIRED_ERROR, INVALID_RECIPIENT_ADDRESS_ERROR, diff --git a/ui/lib/icon-factory.js b/ui/lib/icon-factory.js index 789d1c34b..fa3f2bbf3 100644 --- a/ui/lib/icon-factory.js +++ b/ui/lib/icon-factory.js @@ -1,5 +1,5 @@ import { isValidAddress } from 'ethereumjs-util' -import contractMap from 'eth-contract-metadata' +import contractMap from '@metamask/contract-metadata' import { checksumAddress } from '../app/helpers/utils/util' let iconFactory diff --git a/yarn.lock b/yarn.lock index fed504d5c..f20a183c9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2014,6 +2014,11 @@ prop-types "^15.7.2" react-is "^16.8.0" +"@metamask/contract-metadata@^1.19.0": + version "1.19.0" + resolved "https://registry.yarnpkg.com/@metamask/contract-metadata/-/contract-metadata-1.19.0.tgz#2f074bce7ab7ffd0d20e3905b1936da0749a0473" + integrity sha512-TklMuz7ZbFJ2Zc6C7I+9qL3J9J+4prs5Ok5MJzoxD/57Iq6espzArhpI275elVCFF9ci8IMvach1kH8+F04/hA== + "@metamask/controllers@^3.1.0": version "3.2.0" resolved "https://registry.yarnpkg.com/@metamask/controllers/-/controllers-3.2.0.tgz#8ad2e63f7953d294712d9b5bacaea1c5261ce588" @@ -9942,7 +9947,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==