diff --git a/app/scripts/contentscript.js b/app/scripts/contentscript.js index 9cc350d6d..0cbc3a607 100644 --- a/app/scripts/contentscript.js +++ b/app/scripts/contentscript.js @@ -358,12 +358,15 @@ function blockedDomainCheck() { /** * Redirects the current page to a phishing information page + * + * @param data */ -function redirectToPhishingWarning() { +function redirectToPhishingWarning(data = {}) { console.debug('MetaMask: Routing to Phishing Warning page.'); const baseUrl = process.env.PHISHING_WARNING_PAGE_URL; window.location.href = `${baseUrl}#${querystring.stringify({ hostname: window.location.hostname, href: window.location.href, + newIssueUrl: data.newIssueUrl, })}`; } diff --git a/app/scripts/controllers/detect-tokens.test.js b/app/scripts/controllers/detect-tokens.test.js index 4fd5605b0..5161cf44b 100644 --- a/app/scripts/controllers/detect-tokens.test.js +++ b/app/scripts/controllers/detect-tokens.test.js @@ -8,12 +8,19 @@ import { TokenListController, TokensController, } from '@metamask/controllers'; -import { MAINNET, ROPSTEN } from '../../../shared/constants/network'; +import { + MAINNET, + MAINNET_NETWORK_ID, + ROPSTEN, +} from '../../../shared/constants/network'; import { toChecksumHexAddress } from '../../../shared/modules/hexstring-utils'; import DetectTokensController from './detect-tokens'; import NetworkController from './network'; import PreferencesController from './preferences'; +const tokenIconsApiBaseUrl = + 'https://static.metaswap.codefi.network/api/v1/tokenIcons'; + describe('DetectTokensController', function () { let tokenListController; const sandbox = sinon.createSandbox(); @@ -127,7 +134,6 @@ describe('DetectTokensController', function () { }); tokenListController = new TokenListController({ chainId: '1', - useStaticTokenList: false, onNetworkStateChange: sinon.spy(), onPreferencesStateChange: sinon.spy(), messenger: tokenListMessenger, @@ -179,7 +185,6 @@ describe('DetectTokensController', function () { }); tokenListController = new TokenListController({ chainId: '3', - useStaticTokenList: false, onNetworkStateChange: sinon.spy(), onPreferencesStateChange: sinon.spy(), messenger: tokenListMessengerRopsten, @@ -241,7 +246,7 @@ describe('DetectTokensController', function () { ), ); - await tokensController.removeAndIgnoreToken(tokenAddressToSkip); + await tokensController.ignoreTokens([tokenAddressToSkip]); await controller.detectNewTokens(); assert.deepEqual(tokensController.state.tokens, [ @@ -249,7 +254,8 @@ describe('DetectTokensController', function () { address: toChecksumHexAddress(existingTokenAddress), decimals: existingToken.decimals, symbol: existingToken.symbol, - image: undefined, + aggregators: [], + image: `${tokenIconsApiBaseUrl}/${MAINNET_NETWORK_ID}/${existingTokenAddress}.png`, isERC721: false, }, ]); @@ -303,14 +309,16 @@ describe('DetectTokensController', function () { decimals: existingToken.decimals, symbol: existingToken.symbol, isERC721: false, - image: undefined, + aggregators: [], + image: `${tokenIconsApiBaseUrl}/${MAINNET_NETWORK_ID}/${existingTokenAddress}.png`, }, { address: toChecksumHexAddress(tokenAddressToAdd), decimals: tokenToAdd.decimals, symbol: tokenToAdd.symbol, - image: undefined, isERC721: false, + aggregators: [], + image: `${tokenIconsApiBaseUrl}/${MAINNET_NETWORK_ID}/${tokenAddressToAdd}.png`, }, ]); }); @@ -363,15 +371,17 @@ describe('DetectTokensController', function () { address: toChecksumHexAddress(existingTokenAddress), decimals: existingToken.decimals, symbol: existingToken.symbol, - image: undefined, + image: `${tokenIconsApiBaseUrl}/${MAINNET_NETWORK_ID}/${existingTokenAddress}.png`, isERC721: false, + aggregators: [], }, { address: toChecksumHexAddress(tokenAddressToAdd), decimals: tokenToAdd.decimals, symbol: tokenToAdd.symbol, - image: undefined, + image: `${tokenIconsApiBaseUrl}/${MAINNET_NETWORK_ID}/${tokenAddressToAdd}.png`, isERC721: false, + aggregators: [], }, ]); }); diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 7f25613d6..a87cc6b13 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -54,9 +54,11 @@ import { ///: END:ONLY_INCLUDE_IN import { + ASSET_TYPES, TRANSACTION_STATUSES, TRANSACTION_TYPES, } from '../../shared/constants/transaction'; +import { PHISHING_NEW_ISSUE_URLS } from '../../shared/constants/phishing'; import { GAS_API_BASE_URL, GAS_DEV_API_BASE_URL, @@ -85,7 +87,7 @@ import { POLLING_TOKEN_ENVIRONMENT_TYPES, SUBJECT_TYPES, } from '../../shared/constants/app'; -import { EVENT } from '../../shared/constants/metametrics'; +import { EVENT, EVENT_NAMES } from '../../shared/constants/metametrics'; import { hexToDecimal } from '../../ui/helpers/utils/conversions.util'; import { getTokenValueParam } from '../../ui/helpers/utils/token-util'; @@ -245,35 +247,28 @@ export default class MetamaskController extends EventEmitter { config: { provider: this.provider }, state: initState.TokensController, }); - process.env.TOKEN_DETECTION_V2 - ? (this.assetsContractController = new AssetsContractController({ - onPreferencesStateChange: (listener) => - this.preferencesController.store.subscribe(listener), - onNetworkStateChange: (cb) => - this.networkController.store.subscribe((networkState) => { - const modifiedNetworkState = { - ...networkState, - provider: { - ...networkState.provider, - chainId: hexToDecimal(networkState.provider.chainId), - }, - }; - return cb(modifiedNetworkState); - }), - config: { - provider: this.provider, - }, - state: initState.AssetsContractController, - })) - : (this.assetsContractController = new AssetsContractController( - { - onPreferencesStateChange: (listener) => - this.preferencesController.store.subscribe(listener), - }, - { - provider: this.provider, - }, - )); + + this.assetsContractController = new AssetsContractController( + { + onPreferencesStateChange: (listener) => + this.preferencesController.store.subscribe(listener), + onNetworkStateChange: (cb) => + this.networkController.store.subscribe((networkState) => { + const modifiedNetworkState = { + ...networkState, + provider: { + ...networkState.provider, + chainId: hexToDecimal(networkState.provider.chainId), + }, + }; + return cb(modifiedNetworkState); + }), + }, + { + provider: this.provider, + }, + initState.AssetsContractController, + ); this.collectiblesController = new CollectiblesController( { @@ -301,6 +296,21 @@ export default class MetamaskController extends EventEmitter { getERC1155TokenURI: this.assetsContractController.getERC1155TokenURI.bind( this.assetsContractController, ), + onCollectibleAdded: ({ address, symbol, tokenId, standard, source }) => + this.metaMetricsController.trackEvent({ + event: EVENT_NAMES.NFT_ADDED, + category: EVENT.CATEGORIES.WALLET, + properties: { + token_contract_address: address, + token_symbol: symbol, + asset_type: ASSET_TYPES.COLLECTIBLE, + token_standard: standard, + source, + }, + sensitiveProperties: { + tokenId, + }, + }), }, {}, initState.CollectiblesController, @@ -417,50 +427,23 @@ export default class MetamaskController extends EventEmitter { const tokenListMessenger = this.controllerMessenger.getRestricted({ name: 'TokenListController', }); - process.env.TOKEN_DETECTION_V2 - ? (this.tokenListController = new TokenListController({ - chainId: hexToDecimal(this.networkController.getCurrentChainId()), - onNetworkStateChange: (cb) => - this.networkController.store.subscribe((networkState) => { - const modifiedNetworkState = { - ...networkState, - provider: { - ...networkState.provider, - chainId: hexToDecimal(networkState.provider.chainId), - }, - }; - return cb(modifiedNetworkState); - }), - messenger: tokenListMessenger, - state: initState.TokenListController, - })) - : (this.tokenListController = new TokenListController({ - chainId: hexToDecimal(this.networkController.getCurrentChainId()), - useStaticTokenList: !this.preferencesController.store.getState() - .useTokenDetection, - onNetworkStateChange: (cb) => - this.networkController.store.subscribe((networkState) => { - const modifiedNetworkState = { - ...networkState, - provider: { - ...networkState.provider, - chainId: hexToDecimal(networkState.provider.chainId), - }, - }; - return cb(modifiedNetworkState); - }), - onPreferencesStateChange: (cb) => - this.preferencesController.store.subscribe((preferencesState) => { - const modifiedPreferencesState = { - ...preferencesState, - useStaticTokenList: !this.preferencesController.store.getState() - .useTokenDetection, - }; - return cb(modifiedPreferencesState); - }), - messenger: tokenListMessenger, - state: initState.TokenListController, - })); + + this.tokenListController = new TokenListController({ + chainId: hexToDecimal(this.networkController.getCurrentChainId()), + onNetworkStateChange: (cb) => + this.networkController.store.subscribe((networkState) => { + const modifiedNetworkState = { + ...networkState, + provider: { + ...networkState.provider, + chainId: hexToDecimal(networkState.provider.chainId), + }, + }; + return cb(modifiedNetworkState); + }), + messenger: tokenListMessenger, + state: initState.TokenListController, + }); this.phishingController = new PhishingController(); @@ -1586,7 +1569,6 @@ export default class MetamaskController extends EventEmitter { tokensController, ), updateTokenType: tokensController.updateTokenType.bind(tokensController), - removeToken: tokensController.removeAndIgnoreToken.bind(tokensController), setAccountLabel: preferencesController.setAccountLabel.bind( preferencesController, ), @@ -1960,20 +1942,14 @@ export default class MetamaskController extends EventEmitter { : null, /** Token Detection V2 */ - addDetectedTokens: process.env.TOKEN_DETECTION_V2 - ? tokensController.addDetectedTokens.bind(tokensController) - : null, - importTokens: process.env.TOKEN_DETECTION_V2 - ? tokensController.importTokens.bind(tokensController) - : null, - ignoreTokens: process.env.TOKEN_DETECTION_V2 - ? tokensController.ignoreTokens.bind(tokensController) - : null, - getBalancesInSingleCall: process.env.TOKEN_DETECTION_V2 - ? assetsContractController.getBalancesInSingleCall.bind( - assetsContractController, - ) - : null, + addDetectedTokens: tokensController.addDetectedTokens.bind( + tokensController, + ), + addImportedTokens: tokensController.addTokens.bind(tokensController), + ignoreTokens: tokensController.ignoreTokens.bind(tokensController), + getBalancesInSingleCall: assetsContractController.getBalancesInSingleCall.bind( + assetsContractController, + ), }; } @@ -3342,9 +3318,13 @@ export default class MetamaskController extends EventEmitter { if (sender.url) { const { hostname } = new URL(sender.url); // Check if new connection is blocked if phishing detection is on - if (usePhishDetect && this.phishingController.test(hostname)) { - log.debug('MetaMask - sending phishing warning for', hostname); - this.sendPhishingWarning(connectionStream, hostname); + const phishingTestResponse = this.phishingController.test(hostname); + if (usePhishDetect && phishingTestResponse?.result) { + this.sendPhishingWarning( + connectionStream, + hostname, + phishingTestResponse, + ); return; } } @@ -3422,11 +3402,15 @@ export default class MetamaskController extends EventEmitter { * @param {*} connectionStream - The duplex stream to the per-page script, * for sending the reload attempt to. * @param {string} hostname - The hostname that triggered the suspicion. + * @param {object} phishingTestResponse - Result of calling `phishingController.test`, + * which is the result of calling eth-phishing-detects detector.check method https://github.com/MetaMask/eth-phishing-detect/blob/master/src/detector.js#L55-L112 */ - sendPhishingWarning(connectionStream, hostname) { + sendPhishingWarning(connectionStream, hostname, phishingTestResponse) { + const newIssueUrl = PHISHING_NEW_ISSUE_URLS[phishingTestResponse?.name]; + const mux = setupMultiplex(connectionStream); const phishingStream = mux.createStream('phishing'); - phishingStream.write({ hostname }); + phishingStream.write({ hostname, newIssueUrl }); } /** diff --git a/lavamoat/browserify/beta/policy.json b/lavamoat/browserify/beta/policy.json index 7b6c8c22c..64e2cd302 100644 --- a/lavamoat/browserify/beta/policy.json +++ b/lavamoat/browserify/beta/policy.json @@ -3217,147 +3217,13 @@ }, "@metamask/rpc-methods": { "packages": { - "@metamask/rpc-methods>@metamask/controllers": true, + "@metamask/controllers": true, "@metamask/rpc-methods>@metamask/key-tree": true, "@metamask/rpc-methods>@metamask/utils": true, "@metamask/snap-controllers": true, "eth-rpc-errors": true } }, - "@metamask/rpc-methods>@metamask/controllers": { - "globals": { - "Headers": true, - "URL": true, - "clearInterval": true, - "clearTimeout": true, - "console.error": true, - "console.log": true, - "fetch": true, - "setInterval": true, - "setTimeout": true - }, - "packages": { - "@ethereumjs/common": true, - "@ethereumjs/tx": true, - "@metamask/contract-metadata": true, - "@metamask/controllers>abort-controller": true, - "@metamask/controllers>async-mutex": true, - "@metamask/controllers>eth-phishing-detect": true, - "@metamask/controllers>isomorphic-fetch": true, - "@metamask/controllers>multiformats": true, - "@metamask/controllers>web3-provider-engine": true, - "@metamask/metamask-eth-abis": true, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry": true, - "@metamask/rpc-methods>@metamask/controllers>ethereumjs-wallet": true, - "@metamask/rpc-methods>@metamask/controllers>nanoid": true, - "@storybook/api>fast-deep-equal": true, - "browserify>buffer": true, - "browserify>events": true, - "deep-freeze-strict": true, - "eth-ens-namehash": true, - "eth-json-rpc-infura": true, - "eth-keyring-controller": true, - "eth-query": true, - "eth-rpc-errors": true, - "eth-sig-util": true, - "ethereumjs-util": true, - "ethers": true, - "ethjs>ethjs-unit": true, - "immer": true, - "json-rpc-engine": true, - "jsonschema": true, - "punycode": true, - "single-call-balance-checker-abi": true, - "uuid": true, - "web3": true - } - }, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry": { - "packages": { - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs": true - } - }, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs": { - "globals": { - "clearInterval": true, - "setInterval": true - }, - "packages": { - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>bn.js": true, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>ethjs-abi": true, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract": true, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>ethjs-query": true, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "browserify>buffer": true, - "ethjs>ethjs-filter": true, - "ethjs>ethjs-provider-http": true, - "ethjs>ethjs-unit": true, - "ethjs>ethjs-util": true, - "ethjs>number-to-bn": true - } - }, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>ethjs-abi": { - "packages": { - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>bn.js": true, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "browserify>buffer": true, - "ethjs>number-to-bn": true - } - }, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract": { - "packages": { - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract>ethjs-abi": true, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "ethjs-query>babel-runtime": true, - "ethjs>ethjs-filter": true, - "ethjs>ethjs-util": true, - "promise-to-callback": true - } - }, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract>ethjs-abi": { - "packages": { - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>bn.js": true, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "browserify>buffer": true, - "ethjs>number-to-bn": true - } - }, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>ethjs-query": { - "globals": { - "console": true - }, - "packages": { - "ethjs-query>babel-runtime": true, - "ethjs-query>ethjs-format": true, - "ethjs-query>ethjs-rpc": true, - "promise-to-callback": true - } - }, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>js-sha3": { - "packages": { - "browserify>process": true - } - }, - "@metamask/rpc-methods>@metamask/controllers>ethereumjs-wallet": { - "packages": { - "@metamask/rpc-methods>@metamask/controllers>ethereumjs-wallet>uuid": true, - "@truffle/codec>utf8": true, - "browserify>buffer": true, - "browserify>crypto-browserify": true, - "ethereumjs-util": true, - "ethereumjs-util>ethereum-cryptography": true, - "ethereumjs-wallet>aes-js": true, - "ethereumjs-wallet>bs58check": true, - "ethereumjs-wallet>randombytes": true, - "ethers>@ethersproject/json-wallets>scrypt-js": true - } - }, - "@metamask/rpc-methods>@metamask/controllers>ethereumjs-wallet>uuid": { - "globals": { - "crypto": true, - "msCrypto": true - } - }, "@metamask/rpc-methods>@metamask/key-tree": { "packages": { "@metamask/rpc-methods>@metamask/key-tree>@noble/ed25519": true, @@ -3418,148 +3284,14 @@ "setInterval": true }, "packages": { + "@metamask/controllers": true, "@metamask/controllers>isomorphic-fetch": true, - "@metamask/smart-transactions-controller>@metamask/controllers": true, "@metamask/smart-transactions-controller>bignumber.js": true, "@metamask/smart-transactions-controller>fast-json-patch": true, "ethers": true, "lodash": true } }, - "@metamask/smart-transactions-controller>@metamask/controllers": { - "globals": { - "Headers": true, - "URL": true, - "clearInterval": true, - "clearTimeout": true, - "console.error": true, - "console.log": true, - "fetch": true, - "setInterval": true, - "setTimeout": true - }, - "packages": { - "@ethereumjs/common": true, - "@ethereumjs/tx": true, - "@metamask/contract-metadata": true, - "@metamask/controllers>abort-controller": true, - "@metamask/controllers>async-mutex": true, - "@metamask/controllers>eth-phishing-detect": true, - "@metamask/controllers>isomorphic-fetch": true, - "@metamask/controllers>multiformats": true, - "@metamask/controllers>web3-provider-engine": true, - "@metamask/metamask-eth-abis": true, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry": true, - "@metamask/smart-transactions-controller>@metamask/controllers>ethereumjs-wallet": true, - "@metamask/smart-transactions-controller>@metamask/controllers>nanoid": true, - "@storybook/api>fast-deep-equal": true, - "browserify>buffer": true, - "browserify>events": true, - "deep-freeze-strict": true, - "eth-ens-namehash": true, - "eth-json-rpc-infura": true, - "eth-keyring-controller": true, - "eth-query": true, - "eth-rpc-errors": true, - "eth-sig-util": true, - "ethereumjs-util": true, - "ethers": true, - "ethjs>ethjs-unit": true, - "immer": true, - "json-rpc-engine": true, - "jsonschema": true, - "punycode": true, - "single-call-balance-checker-abi": true, - "uuid": true, - "web3": true - } - }, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry": { - "packages": { - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs": true - } - }, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs": { - "globals": { - "clearInterval": true, - "setInterval": true - }, - "packages": { - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>bn.js": true, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>ethjs-abi": true, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract": true, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>ethjs-query": true, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "browserify>buffer": true, - "ethjs>ethjs-filter": true, - "ethjs>ethjs-provider-http": true, - "ethjs>ethjs-unit": true, - "ethjs>ethjs-util": true, - "ethjs>number-to-bn": true - } - }, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>ethjs-abi": { - "packages": { - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>bn.js": true, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "browserify>buffer": true, - "ethjs>number-to-bn": true - } - }, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract": { - "packages": { - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract>ethjs-abi": true, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "ethjs-query>babel-runtime": true, - "ethjs>ethjs-filter": true, - "ethjs>ethjs-util": true, - "promise-to-callback": true - } - }, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract>ethjs-abi": { - "packages": { - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>bn.js": true, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "browserify>buffer": true, - "ethjs>number-to-bn": true - } - }, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>ethjs-query": { - "globals": { - "console": true - }, - "packages": { - "ethjs-query>babel-runtime": true, - "ethjs-query>ethjs-format": true, - "ethjs-query>ethjs-rpc": true, - "promise-to-callback": true - } - }, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>js-sha3": { - "packages": { - "browserify>process": true - } - }, - "@metamask/smart-transactions-controller>@metamask/controllers>ethereumjs-wallet": { - "packages": { - "@metamask/smart-transactions-controller>@metamask/controllers>ethereumjs-wallet>uuid": true, - "@truffle/codec>utf8": true, - "browserify>buffer": true, - "browserify>crypto-browserify": true, - "ethereumjs-util": true, - "ethereumjs-util>ethereum-cryptography": true, - "ethereumjs-wallet>aes-js": true, - "ethereumjs-wallet>bs58check": true, - "ethereumjs-wallet>randombytes": true, - "ethers>@ethersproject/json-wallets>scrypt-js": true - } - }, - "@metamask/smart-transactions-controller>@metamask/controllers>ethereumjs-wallet>uuid": { - "globals": { - "crypto": true, - "msCrypto": true - } - }, "@metamask/smart-transactions-controller>@metamask/controllers>nanoid": { "globals": { "crypto.getRandomValues": true @@ -3595,11 +3327,11 @@ "setTimeout": true }, "packages": { + "@metamask/controllers": true, "@metamask/post-message-stream": true, "@metamask/providers>@metamask/object-multiplex": true, "@metamask/rpc-methods>@metamask/utils": true, "@metamask/snap-controllers>@metamask/browser-passworder": true, - "@metamask/snap-controllers>@metamask/controllers": true, "@metamask/snap-controllers>@metamask/execution-environments": true, "@metamask/snap-controllers>@metamask/obs-store": true, "@metamask/snap-controllers>ajv": true, @@ -3632,140 +3364,6 @@ "browserify>buffer": true } }, - "@metamask/snap-controllers>@metamask/controllers": { - "globals": { - "Headers": true, - "URL": true, - "clearInterval": true, - "clearTimeout": true, - "console.error": true, - "console.log": true, - "fetch": true, - "setInterval": true, - "setTimeout": true - }, - "packages": { - "@ethereumjs/common": true, - "@ethereumjs/tx": true, - "@metamask/contract-metadata": true, - "@metamask/controllers>abort-controller": true, - "@metamask/controllers>async-mutex": true, - "@metamask/controllers>eth-phishing-detect": true, - "@metamask/controllers>isomorphic-fetch": true, - "@metamask/controllers>multiformats": true, - "@metamask/controllers>web3-provider-engine": true, - "@metamask/metamask-eth-abis": true, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry": true, - "@metamask/snap-controllers>@metamask/controllers>ethereumjs-wallet": true, - "@metamask/snap-controllers>nanoid": true, - "@storybook/api>fast-deep-equal": true, - "browserify>buffer": true, - "browserify>events": true, - "deep-freeze-strict": true, - "eth-ens-namehash": true, - "eth-json-rpc-infura": true, - "eth-keyring-controller": true, - "eth-query": true, - "eth-rpc-errors": true, - "eth-sig-util": true, - "ethereumjs-util": true, - "ethers": true, - "ethjs>ethjs-unit": true, - "immer": true, - "json-rpc-engine": true, - "jsonschema": true, - "punycode": true, - "single-call-balance-checker-abi": true, - "uuid": true, - "web3": true - } - }, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry": { - "packages": { - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs": true - } - }, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs": { - "globals": { - "clearInterval": true, - "setInterval": true - }, - "packages": { - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>bn.js": true, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-abi": true, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract": true, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-query": true, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "browserify>buffer": true, - "ethjs>ethjs-filter": true, - "ethjs>ethjs-provider-http": true, - "ethjs>ethjs-unit": true, - "ethjs>ethjs-util": true, - "ethjs>number-to-bn": true - } - }, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-abi": { - "packages": { - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>bn.js": true, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "browserify>buffer": true, - "ethjs>number-to-bn": true - } - }, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract": { - "packages": { - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract>ethjs-abi": true, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "ethjs-query>babel-runtime": true, - "ethjs>ethjs-filter": true, - "ethjs>ethjs-util": true, - "promise-to-callback": true - } - }, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract>ethjs-abi": { - "packages": { - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>bn.js": true, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "browserify>buffer": true, - "ethjs>number-to-bn": true - } - }, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-query": { - "globals": { - "console": true - }, - "packages": { - "ethjs-query>babel-runtime": true, - "ethjs-query>ethjs-format": true, - "ethjs-query>ethjs-rpc": true, - "promise-to-callback": true - } - }, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>js-sha3": { - "packages": { - "browserify>process": true - } - }, - "@metamask/snap-controllers>@metamask/controllers>ethereumjs-wallet": { - "packages": { - "@metamask/snap-controllers>@metamask/controllers>ethereumjs-wallet>uuid": true, - "@truffle/codec>utf8": true, - "browserify>buffer": true, - "browserify>crypto-browserify": true, - "ethereumjs-util": true, - "ethereumjs-util>ethereum-cryptography": true, - "ethereumjs-wallet>aes-js": true, - "ethereumjs-wallet>bs58check": true, - "ethereumjs-wallet>randombytes": true, - "ethers>@ethersproject/json-wallets>scrypt-js": true - } - }, - "@metamask/snap-controllers>@metamask/controllers>ethereumjs-wallet>uuid": { - "globals": { - "crypto": true, - "msCrypto": true - } - }, "@metamask/snap-controllers>@metamask/obs-store": { "packages": { "@metamask/snap-controllers>@metamask/obs-store>through2": true, diff --git a/lavamoat/browserify/flask/policy.json b/lavamoat/browserify/flask/policy.json index 7b6c8c22c..64e2cd302 100644 --- a/lavamoat/browserify/flask/policy.json +++ b/lavamoat/browserify/flask/policy.json @@ -3217,147 +3217,13 @@ }, "@metamask/rpc-methods": { "packages": { - "@metamask/rpc-methods>@metamask/controllers": true, + "@metamask/controllers": true, "@metamask/rpc-methods>@metamask/key-tree": true, "@metamask/rpc-methods>@metamask/utils": true, "@metamask/snap-controllers": true, "eth-rpc-errors": true } }, - "@metamask/rpc-methods>@metamask/controllers": { - "globals": { - "Headers": true, - "URL": true, - "clearInterval": true, - "clearTimeout": true, - "console.error": true, - "console.log": true, - "fetch": true, - "setInterval": true, - "setTimeout": true - }, - "packages": { - "@ethereumjs/common": true, - "@ethereumjs/tx": true, - "@metamask/contract-metadata": true, - "@metamask/controllers>abort-controller": true, - "@metamask/controllers>async-mutex": true, - "@metamask/controllers>eth-phishing-detect": true, - "@metamask/controllers>isomorphic-fetch": true, - "@metamask/controllers>multiformats": true, - "@metamask/controllers>web3-provider-engine": true, - "@metamask/metamask-eth-abis": true, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry": true, - "@metamask/rpc-methods>@metamask/controllers>ethereumjs-wallet": true, - "@metamask/rpc-methods>@metamask/controllers>nanoid": true, - "@storybook/api>fast-deep-equal": true, - "browserify>buffer": true, - "browserify>events": true, - "deep-freeze-strict": true, - "eth-ens-namehash": true, - "eth-json-rpc-infura": true, - "eth-keyring-controller": true, - "eth-query": true, - "eth-rpc-errors": true, - "eth-sig-util": true, - "ethereumjs-util": true, - "ethers": true, - "ethjs>ethjs-unit": true, - "immer": true, - "json-rpc-engine": true, - "jsonschema": true, - "punycode": true, - "single-call-balance-checker-abi": true, - "uuid": true, - "web3": true - } - }, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry": { - "packages": { - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs": true - } - }, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs": { - "globals": { - "clearInterval": true, - "setInterval": true - }, - "packages": { - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>bn.js": true, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>ethjs-abi": true, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract": true, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>ethjs-query": true, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "browserify>buffer": true, - "ethjs>ethjs-filter": true, - "ethjs>ethjs-provider-http": true, - "ethjs>ethjs-unit": true, - "ethjs>ethjs-util": true, - "ethjs>number-to-bn": true - } - }, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>ethjs-abi": { - "packages": { - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>bn.js": true, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "browserify>buffer": true, - "ethjs>number-to-bn": true - } - }, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract": { - "packages": { - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract>ethjs-abi": true, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "ethjs-query>babel-runtime": true, - "ethjs>ethjs-filter": true, - "ethjs>ethjs-util": true, - "promise-to-callback": true - } - }, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract>ethjs-abi": { - "packages": { - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>bn.js": true, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "browserify>buffer": true, - "ethjs>number-to-bn": true - } - }, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>ethjs-query": { - "globals": { - "console": true - }, - "packages": { - "ethjs-query>babel-runtime": true, - "ethjs-query>ethjs-format": true, - "ethjs-query>ethjs-rpc": true, - "promise-to-callback": true - } - }, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>js-sha3": { - "packages": { - "browserify>process": true - } - }, - "@metamask/rpc-methods>@metamask/controllers>ethereumjs-wallet": { - "packages": { - "@metamask/rpc-methods>@metamask/controllers>ethereumjs-wallet>uuid": true, - "@truffle/codec>utf8": true, - "browserify>buffer": true, - "browserify>crypto-browserify": true, - "ethereumjs-util": true, - "ethereumjs-util>ethereum-cryptography": true, - "ethereumjs-wallet>aes-js": true, - "ethereumjs-wallet>bs58check": true, - "ethereumjs-wallet>randombytes": true, - "ethers>@ethersproject/json-wallets>scrypt-js": true - } - }, - "@metamask/rpc-methods>@metamask/controllers>ethereumjs-wallet>uuid": { - "globals": { - "crypto": true, - "msCrypto": true - } - }, "@metamask/rpc-methods>@metamask/key-tree": { "packages": { "@metamask/rpc-methods>@metamask/key-tree>@noble/ed25519": true, @@ -3418,148 +3284,14 @@ "setInterval": true }, "packages": { + "@metamask/controllers": true, "@metamask/controllers>isomorphic-fetch": true, - "@metamask/smart-transactions-controller>@metamask/controllers": true, "@metamask/smart-transactions-controller>bignumber.js": true, "@metamask/smart-transactions-controller>fast-json-patch": true, "ethers": true, "lodash": true } }, - "@metamask/smart-transactions-controller>@metamask/controllers": { - "globals": { - "Headers": true, - "URL": true, - "clearInterval": true, - "clearTimeout": true, - "console.error": true, - "console.log": true, - "fetch": true, - "setInterval": true, - "setTimeout": true - }, - "packages": { - "@ethereumjs/common": true, - "@ethereumjs/tx": true, - "@metamask/contract-metadata": true, - "@metamask/controllers>abort-controller": true, - "@metamask/controllers>async-mutex": true, - "@metamask/controllers>eth-phishing-detect": true, - "@metamask/controllers>isomorphic-fetch": true, - "@metamask/controllers>multiformats": true, - "@metamask/controllers>web3-provider-engine": true, - "@metamask/metamask-eth-abis": true, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry": true, - "@metamask/smart-transactions-controller>@metamask/controllers>ethereumjs-wallet": true, - "@metamask/smart-transactions-controller>@metamask/controllers>nanoid": true, - "@storybook/api>fast-deep-equal": true, - "browserify>buffer": true, - "browserify>events": true, - "deep-freeze-strict": true, - "eth-ens-namehash": true, - "eth-json-rpc-infura": true, - "eth-keyring-controller": true, - "eth-query": true, - "eth-rpc-errors": true, - "eth-sig-util": true, - "ethereumjs-util": true, - "ethers": true, - "ethjs>ethjs-unit": true, - "immer": true, - "json-rpc-engine": true, - "jsonschema": true, - "punycode": true, - "single-call-balance-checker-abi": true, - "uuid": true, - "web3": true - } - }, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry": { - "packages": { - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs": true - } - }, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs": { - "globals": { - "clearInterval": true, - "setInterval": true - }, - "packages": { - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>bn.js": true, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>ethjs-abi": true, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract": true, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>ethjs-query": true, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "browserify>buffer": true, - "ethjs>ethjs-filter": true, - "ethjs>ethjs-provider-http": true, - "ethjs>ethjs-unit": true, - "ethjs>ethjs-util": true, - "ethjs>number-to-bn": true - } - }, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>ethjs-abi": { - "packages": { - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>bn.js": true, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "browserify>buffer": true, - "ethjs>number-to-bn": true - } - }, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract": { - "packages": { - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract>ethjs-abi": true, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "ethjs-query>babel-runtime": true, - "ethjs>ethjs-filter": true, - "ethjs>ethjs-util": true, - "promise-to-callback": true - } - }, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract>ethjs-abi": { - "packages": { - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>bn.js": true, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "browserify>buffer": true, - "ethjs>number-to-bn": true - } - }, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>ethjs-query": { - "globals": { - "console": true - }, - "packages": { - "ethjs-query>babel-runtime": true, - "ethjs-query>ethjs-format": true, - "ethjs-query>ethjs-rpc": true, - "promise-to-callback": true - } - }, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>js-sha3": { - "packages": { - "browserify>process": true - } - }, - "@metamask/smart-transactions-controller>@metamask/controllers>ethereumjs-wallet": { - "packages": { - "@metamask/smart-transactions-controller>@metamask/controllers>ethereumjs-wallet>uuid": true, - "@truffle/codec>utf8": true, - "browserify>buffer": true, - "browserify>crypto-browserify": true, - "ethereumjs-util": true, - "ethereumjs-util>ethereum-cryptography": true, - "ethereumjs-wallet>aes-js": true, - "ethereumjs-wallet>bs58check": true, - "ethereumjs-wallet>randombytes": true, - "ethers>@ethersproject/json-wallets>scrypt-js": true - } - }, - "@metamask/smart-transactions-controller>@metamask/controllers>ethereumjs-wallet>uuid": { - "globals": { - "crypto": true, - "msCrypto": true - } - }, "@metamask/smart-transactions-controller>@metamask/controllers>nanoid": { "globals": { "crypto.getRandomValues": true @@ -3595,11 +3327,11 @@ "setTimeout": true }, "packages": { + "@metamask/controllers": true, "@metamask/post-message-stream": true, "@metamask/providers>@metamask/object-multiplex": true, "@metamask/rpc-methods>@metamask/utils": true, "@metamask/snap-controllers>@metamask/browser-passworder": true, - "@metamask/snap-controllers>@metamask/controllers": true, "@metamask/snap-controllers>@metamask/execution-environments": true, "@metamask/snap-controllers>@metamask/obs-store": true, "@metamask/snap-controllers>ajv": true, @@ -3632,140 +3364,6 @@ "browserify>buffer": true } }, - "@metamask/snap-controllers>@metamask/controllers": { - "globals": { - "Headers": true, - "URL": true, - "clearInterval": true, - "clearTimeout": true, - "console.error": true, - "console.log": true, - "fetch": true, - "setInterval": true, - "setTimeout": true - }, - "packages": { - "@ethereumjs/common": true, - "@ethereumjs/tx": true, - "@metamask/contract-metadata": true, - "@metamask/controllers>abort-controller": true, - "@metamask/controllers>async-mutex": true, - "@metamask/controllers>eth-phishing-detect": true, - "@metamask/controllers>isomorphic-fetch": true, - "@metamask/controllers>multiformats": true, - "@metamask/controllers>web3-provider-engine": true, - "@metamask/metamask-eth-abis": true, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry": true, - "@metamask/snap-controllers>@metamask/controllers>ethereumjs-wallet": true, - "@metamask/snap-controllers>nanoid": true, - "@storybook/api>fast-deep-equal": true, - "browserify>buffer": true, - "browserify>events": true, - "deep-freeze-strict": true, - "eth-ens-namehash": true, - "eth-json-rpc-infura": true, - "eth-keyring-controller": true, - "eth-query": true, - "eth-rpc-errors": true, - "eth-sig-util": true, - "ethereumjs-util": true, - "ethers": true, - "ethjs>ethjs-unit": true, - "immer": true, - "json-rpc-engine": true, - "jsonschema": true, - "punycode": true, - "single-call-balance-checker-abi": true, - "uuid": true, - "web3": true - } - }, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry": { - "packages": { - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs": true - } - }, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs": { - "globals": { - "clearInterval": true, - "setInterval": true - }, - "packages": { - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>bn.js": true, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-abi": true, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract": true, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-query": true, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "browserify>buffer": true, - "ethjs>ethjs-filter": true, - "ethjs>ethjs-provider-http": true, - "ethjs>ethjs-unit": true, - "ethjs>ethjs-util": true, - "ethjs>number-to-bn": true - } - }, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-abi": { - "packages": { - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>bn.js": true, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "browserify>buffer": true, - "ethjs>number-to-bn": true - } - }, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract": { - "packages": { - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract>ethjs-abi": true, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "ethjs-query>babel-runtime": true, - "ethjs>ethjs-filter": true, - "ethjs>ethjs-util": true, - "promise-to-callback": true - } - }, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract>ethjs-abi": { - "packages": { - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>bn.js": true, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "browserify>buffer": true, - "ethjs>number-to-bn": true - } - }, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-query": { - "globals": { - "console": true - }, - "packages": { - "ethjs-query>babel-runtime": true, - "ethjs-query>ethjs-format": true, - "ethjs-query>ethjs-rpc": true, - "promise-to-callback": true - } - }, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>js-sha3": { - "packages": { - "browserify>process": true - } - }, - "@metamask/snap-controllers>@metamask/controllers>ethereumjs-wallet": { - "packages": { - "@metamask/snap-controllers>@metamask/controllers>ethereumjs-wallet>uuid": true, - "@truffle/codec>utf8": true, - "browserify>buffer": true, - "browserify>crypto-browserify": true, - "ethereumjs-util": true, - "ethereumjs-util>ethereum-cryptography": true, - "ethereumjs-wallet>aes-js": true, - "ethereumjs-wallet>bs58check": true, - "ethereumjs-wallet>randombytes": true, - "ethers>@ethersproject/json-wallets>scrypt-js": true - } - }, - "@metamask/snap-controllers>@metamask/controllers>ethereumjs-wallet>uuid": { - "globals": { - "crypto": true, - "msCrypto": true - } - }, "@metamask/snap-controllers>@metamask/obs-store": { "packages": { "@metamask/snap-controllers>@metamask/obs-store>through2": true, diff --git a/lavamoat/browserify/main/policy.json b/lavamoat/browserify/main/policy.json index 7b6c8c22c..64e2cd302 100644 --- a/lavamoat/browserify/main/policy.json +++ b/lavamoat/browserify/main/policy.json @@ -3217,147 +3217,13 @@ }, "@metamask/rpc-methods": { "packages": { - "@metamask/rpc-methods>@metamask/controllers": true, + "@metamask/controllers": true, "@metamask/rpc-methods>@metamask/key-tree": true, "@metamask/rpc-methods>@metamask/utils": true, "@metamask/snap-controllers": true, "eth-rpc-errors": true } }, - "@metamask/rpc-methods>@metamask/controllers": { - "globals": { - "Headers": true, - "URL": true, - "clearInterval": true, - "clearTimeout": true, - "console.error": true, - "console.log": true, - "fetch": true, - "setInterval": true, - "setTimeout": true - }, - "packages": { - "@ethereumjs/common": true, - "@ethereumjs/tx": true, - "@metamask/contract-metadata": true, - "@metamask/controllers>abort-controller": true, - "@metamask/controllers>async-mutex": true, - "@metamask/controllers>eth-phishing-detect": true, - "@metamask/controllers>isomorphic-fetch": true, - "@metamask/controllers>multiformats": true, - "@metamask/controllers>web3-provider-engine": true, - "@metamask/metamask-eth-abis": true, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry": true, - "@metamask/rpc-methods>@metamask/controllers>ethereumjs-wallet": true, - "@metamask/rpc-methods>@metamask/controllers>nanoid": true, - "@storybook/api>fast-deep-equal": true, - "browserify>buffer": true, - "browserify>events": true, - "deep-freeze-strict": true, - "eth-ens-namehash": true, - "eth-json-rpc-infura": true, - "eth-keyring-controller": true, - "eth-query": true, - "eth-rpc-errors": true, - "eth-sig-util": true, - "ethereumjs-util": true, - "ethers": true, - "ethjs>ethjs-unit": true, - "immer": true, - "json-rpc-engine": true, - "jsonschema": true, - "punycode": true, - "single-call-balance-checker-abi": true, - "uuid": true, - "web3": true - } - }, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry": { - "packages": { - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs": true - } - }, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs": { - "globals": { - "clearInterval": true, - "setInterval": true - }, - "packages": { - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>bn.js": true, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>ethjs-abi": true, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract": true, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>ethjs-query": true, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "browserify>buffer": true, - "ethjs>ethjs-filter": true, - "ethjs>ethjs-provider-http": true, - "ethjs>ethjs-unit": true, - "ethjs>ethjs-util": true, - "ethjs>number-to-bn": true - } - }, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>ethjs-abi": { - "packages": { - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>bn.js": true, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "browserify>buffer": true, - "ethjs>number-to-bn": true - } - }, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract": { - "packages": { - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract>ethjs-abi": true, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "ethjs-query>babel-runtime": true, - "ethjs>ethjs-filter": true, - "ethjs>ethjs-util": true, - "promise-to-callback": true - } - }, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract>ethjs-abi": { - "packages": { - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>bn.js": true, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "browserify>buffer": true, - "ethjs>number-to-bn": true - } - }, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>ethjs-query": { - "globals": { - "console": true - }, - "packages": { - "ethjs-query>babel-runtime": true, - "ethjs-query>ethjs-format": true, - "ethjs-query>ethjs-rpc": true, - "promise-to-callback": true - } - }, - "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs>js-sha3": { - "packages": { - "browserify>process": true - } - }, - "@metamask/rpc-methods>@metamask/controllers>ethereumjs-wallet": { - "packages": { - "@metamask/rpc-methods>@metamask/controllers>ethereumjs-wallet>uuid": true, - "@truffle/codec>utf8": true, - "browserify>buffer": true, - "browserify>crypto-browserify": true, - "ethereumjs-util": true, - "ethereumjs-util>ethereum-cryptography": true, - "ethereumjs-wallet>aes-js": true, - "ethereumjs-wallet>bs58check": true, - "ethereumjs-wallet>randombytes": true, - "ethers>@ethersproject/json-wallets>scrypt-js": true - } - }, - "@metamask/rpc-methods>@metamask/controllers>ethereumjs-wallet>uuid": { - "globals": { - "crypto": true, - "msCrypto": true - } - }, "@metamask/rpc-methods>@metamask/key-tree": { "packages": { "@metamask/rpc-methods>@metamask/key-tree>@noble/ed25519": true, @@ -3418,148 +3284,14 @@ "setInterval": true }, "packages": { + "@metamask/controllers": true, "@metamask/controllers>isomorphic-fetch": true, - "@metamask/smart-transactions-controller>@metamask/controllers": true, "@metamask/smart-transactions-controller>bignumber.js": true, "@metamask/smart-transactions-controller>fast-json-patch": true, "ethers": true, "lodash": true } }, - "@metamask/smart-transactions-controller>@metamask/controllers": { - "globals": { - "Headers": true, - "URL": true, - "clearInterval": true, - "clearTimeout": true, - "console.error": true, - "console.log": true, - "fetch": true, - "setInterval": true, - "setTimeout": true - }, - "packages": { - "@ethereumjs/common": true, - "@ethereumjs/tx": true, - "@metamask/contract-metadata": true, - "@metamask/controllers>abort-controller": true, - "@metamask/controllers>async-mutex": true, - "@metamask/controllers>eth-phishing-detect": true, - "@metamask/controllers>isomorphic-fetch": true, - "@metamask/controllers>multiformats": true, - "@metamask/controllers>web3-provider-engine": true, - "@metamask/metamask-eth-abis": true, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry": true, - "@metamask/smart-transactions-controller>@metamask/controllers>ethereumjs-wallet": true, - "@metamask/smart-transactions-controller>@metamask/controllers>nanoid": true, - "@storybook/api>fast-deep-equal": true, - "browserify>buffer": true, - "browserify>events": true, - "deep-freeze-strict": true, - "eth-ens-namehash": true, - "eth-json-rpc-infura": true, - "eth-keyring-controller": true, - "eth-query": true, - "eth-rpc-errors": true, - "eth-sig-util": true, - "ethereumjs-util": true, - "ethers": true, - "ethjs>ethjs-unit": true, - "immer": true, - "json-rpc-engine": true, - "jsonschema": true, - "punycode": true, - "single-call-balance-checker-abi": true, - "uuid": true, - "web3": true - } - }, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry": { - "packages": { - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs": true - } - }, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs": { - "globals": { - "clearInterval": true, - "setInterval": true - }, - "packages": { - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>bn.js": true, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>ethjs-abi": true, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract": true, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>ethjs-query": true, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "browserify>buffer": true, - "ethjs>ethjs-filter": true, - "ethjs>ethjs-provider-http": true, - "ethjs>ethjs-unit": true, - "ethjs>ethjs-util": true, - "ethjs>number-to-bn": true - } - }, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>ethjs-abi": { - "packages": { - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>bn.js": true, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "browserify>buffer": true, - "ethjs>number-to-bn": true - } - }, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract": { - "packages": { - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract>ethjs-abi": true, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "ethjs-query>babel-runtime": true, - "ethjs>ethjs-filter": true, - "ethjs>ethjs-util": true, - "promise-to-callback": true - } - }, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract>ethjs-abi": { - "packages": { - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>bn.js": true, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "browserify>buffer": true, - "ethjs>number-to-bn": true - } - }, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>ethjs-query": { - "globals": { - "console": true - }, - "packages": { - "ethjs-query>babel-runtime": true, - "ethjs-query>ethjs-format": true, - "ethjs-query>ethjs-rpc": true, - "promise-to-callback": true - } - }, - "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs>js-sha3": { - "packages": { - "browserify>process": true - } - }, - "@metamask/smart-transactions-controller>@metamask/controllers>ethereumjs-wallet": { - "packages": { - "@metamask/smart-transactions-controller>@metamask/controllers>ethereumjs-wallet>uuid": true, - "@truffle/codec>utf8": true, - "browserify>buffer": true, - "browserify>crypto-browserify": true, - "ethereumjs-util": true, - "ethereumjs-util>ethereum-cryptography": true, - "ethereumjs-wallet>aes-js": true, - "ethereumjs-wallet>bs58check": true, - "ethereumjs-wallet>randombytes": true, - "ethers>@ethersproject/json-wallets>scrypt-js": true - } - }, - "@metamask/smart-transactions-controller>@metamask/controllers>ethereumjs-wallet>uuid": { - "globals": { - "crypto": true, - "msCrypto": true - } - }, "@metamask/smart-transactions-controller>@metamask/controllers>nanoid": { "globals": { "crypto.getRandomValues": true @@ -3595,11 +3327,11 @@ "setTimeout": true }, "packages": { + "@metamask/controllers": true, "@metamask/post-message-stream": true, "@metamask/providers>@metamask/object-multiplex": true, "@metamask/rpc-methods>@metamask/utils": true, "@metamask/snap-controllers>@metamask/browser-passworder": true, - "@metamask/snap-controllers>@metamask/controllers": true, "@metamask/snap-controllers>@metamask/execution-environments": true, "@metamask/snap-controllers>@metamask/obs-store": true, "@metamask/snap-controllers>ajv": true, @@ -3632,140 +3364,6 @@ "browserify>buffer": true } }, - "@metamask/snap-controllers>@metamask/controllers": { - "globals": { - "Headers": true, - "URL": true, - "clearInterval": true, - "clearTimeout": true, - "console.error": true, - "console.log": true, - "fetch": true, - "setInterval": true, - "setTimeout": true - }, - "packages": { - "@ethereumjs/common": true, - "@ethereumjs/tx": true, - "@metamask/contract-metadata": true, - "@metamask/controllers>abort-controller": true, - "@metamask/controllers>async-mutex": true, - "@metamask/controllers>eth-phishing-detect": true, - "@metamask/controllers>isomorphic-fetch": true, - "@metamask/controllers>multiformats": true, - "@metamask/controllers>web3-provider-engine": true, - "@metamask/metamask-eth-abis": true, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry": true, - "@metamask/snap-controllers>@metamask/controllers>ethereumjs-wallet": true, - "@metamask/snap-controllers>nanoid": true, - "@storybook/api>fast-deep-equal": true, - "browserify>buffer": true, - "browserify>events": true, - "deep-freeze-strict": true, - "eth-ens-namehash": true, - "eth-json-rpc-infura": true, - "eth-keyring-controller": true, - "eth-query": true, - "eth-rpc-errors": true, - "eth-sig-util": true, - "ethereumjs-util": true, - "ethers": true, - "ethjs>ethjs-unit": true, - "immer": true, - "json-rpc-engine": true, - "jsonschema": true, - "punycode": true, - "single-call-balance-checker-abi": true, - "uuid": true, - "web3": true - } - }, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry": { - "packages": { - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs": true - } - }, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs": { - "globals": { - "clearInterval": true, - "setInterval": true - }, - "packages": { - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>bn.js": true, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-abi": true, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract": true, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-query": true, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "browserify>buffer": true, - "ethjs>ethjs-filter": true, - "ethjs>ethjs-provider-http": true, - "ethjs>ethjs-unit": true, - "ethjs>ethjs-util": true, - "ethjs>number-to-bn": true - } - }, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-abi": { - "packages": { - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>bn.js": true, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "browserify>buffer": true, - "ethjs>number-to-bn": true - } - }, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract": { - "packages": { - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract>ethjs-abi": true, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "ethjs-query>babel-runtime": true, - "ethjs>ethjs-filter": true, - "ethjs>ethjs-util": true, - "promise-to-callback": true - } - }, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract>ethjs-abi": { - "packages": { - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>bn.js": true, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>js-sha3": true, - "browserify>buffer": true, - "ethjs>number-to-bn": true - } - }, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-query": { - "globals": { - "console": true - }, - "packages": { - "ethjs-query>babel-runtime": true, - "ethjs-query>ethjs-format": true, - "ethjs-query>ethjs-rpc": true, - "promise-to-callback": true - } - }, - "@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>js-sha3": { - "packages": { - "browserify>process": true - } - }, - "@metamask/snap-controllers>@metamask/controllers>ethereumjs-wallet": { - "packages": { - "@metamask/snap-controllers>@metamask/controllers>ethereumjs-wallet>uuid": true, - "@truffle/codec>utf8": true, - "browserify>buffer": true, - "browserify>crypto-browserify": true, - "ethereumjs-util": true, - "ethereumjs-util>ethereum-cryptography": true, - "ethereumjs-wallet>aes-js": true, - "ethereumjs-wallet>bs58check": true, - "ethereumjs-wallet>randombytes": true, - "ethers>@ethersproject/json-wallets>scrypt-js": true - } - }, - "@metamask/snap-controllers>@metamask/controllers>ethereumjs-wallet>uuid": { - "globals": { - "crypto": true, - "msCrypto": true - } - }, "@metamask/snap-controllers>@metamask/obs-store": { "packages": { "@metamask/snap-controllers>@metamask/obs-store>through2": true, diff --git a/package.json b/package.json index cf0365eee..04eaf9905 100644 --- a/package.json +++ b/package.json @@ -117,7 +117,7 @@ "@keystonehq/metamask-airgapped-keyring": "0.2.1", "@material-ui/core": "^4.11.0", "@metamask/contract-metadata": "^1.31.0", - "@metamask/controllers": "^29.0.1", + "@metamask/controllers": "^30.0.2", "@metamask/design-tokens": "^1.6.5", "@metamask/eth-ledger-bridge-keyring": "^0.13.0", "@metamask/eth-token-tracker": "^4.0.0", @@ -251,7 +251,7 @@ "@metamask/eslint-config-nodejs": "^9.0.0", "@metamask/eslint-config-typescript": "^9.0.1", "@metamask/forwarder": "^1.1.0", - "@metamask/phishing-warning": "^1.1.0", + "@metamask/phishing-warning": "^1.2.1", "@metamask/test-dapp": "^5.1.1", "@sentry/cli": "^1.58.0", "@storybook/addon-a11y": "^6.3.12", diff --git a/patches/abort-controller+3.0.0.patch b/patches/abort-controller+3.0.0.patch index 2210446d2..c9a7f43aa 100644 --- a/patches/abort-controller+3.0.0.patch +++ b/patches/abort-controller+3.0.0.patch @@ -1,5 +1,5 @@ diff --git a/node_modules/abort-controller/browser.js b/node_modules/abort-controller/browser.js -index b0c5ec3..c8c8018 100644 +index b0c5ec3..b61071b 100644 --- a/node_modules/abort-controller/browser.js +++ b/node_modules/abort-controller/browser.js @@ -2,12 +2,7 @@ @@ -13,6 +13,7 @@ index b0c5ec3..c8c8018 100644 +const { AbortController } = globalThis; /*eslint-enable @mysticatea/prettier */ - module.exports = AbortController +-module.exports = AbortController -module.exports.AbortSignal = AbortSignal -module.exports.default = AbortController ++module.exports = { AbortController } diff --git a/shared/constants/metametrics.js b/shared/constants/metametrics.js index 2fe2a0457..8b85fb45f 100644 --- a/shared/constants/metametrics.js +++ b/shared/constants/metametrics.js @@ -283,6 +283,7 @@ export const EVENT_NAMES = { TOKEN_ADDED: 'Token Added', TOKEN_DETECTED: 'Token Detected', TOKEN_HIDDEN: 'Token Hidden', + NFT_ADDED: 'NFT Added', TOKEN_IMPORT_CANCELED: 'Token Import Canceled', TOKEN_IMPORT_CLICKED: 'Token Import Clicked', }; diff --git a/shared/constants/phishing.js b/shared/constants/phishing.js new file mode 100644 index 000000000..63dea3706 --- /dev/null +++ b/shared/constants/phishing.js @@ -0,0 +1,4 @@ +export const PHISHING_NEW_ISSUE_URLS = { + MetaMask: 'https://github.com/metamask/eth-phishing-detect/issues/new', + PhishFort: 'https://github.com/phishfort/phishfort-lists/issues/new', +}; diff --git a/test/e2e/mock-e2e.js b/test/e2e/mock-e2e.js index a6d5d6518..d4df2e853 100644 --- a/test/e2e/mock-e2e.js +++ b/test/e2e/mock-e2e.js @@ -154,6 +154,26 @@ async function setupMocking(server, testSpecificMock) { }; }); + await server + .forGet( + 'https://static.metaswap.codefi.network/api/v1/tokenIcons/1337/0x0d8775f648430679a709e98d2b0cb6250d2887ef.png', + ) + .thenCallback(() => { + return { + statusCode: 200, + }; + }); + + await server + .forGet( + 'https://static.metaswap.codefi.network/api/v1/tokenIcons/1337/0x2efa2cb29c2341d8e5ba7d3262c9e9d6f1bf3711.png', + ) + .thenCallback(() => { + return { + statusCode: 200, + }; + }); + testSpecificMock(server); } diff --git a/test/e2e/tests/add-hide-token.spec.js b/test/e2e/tests/add-hide-token.spec.js index 066bd8782..bb0655815 100644 --- a/test/e2e/tests/add-hide-token.spec.js +++ b/test/e2e/tests/add-hide-token.spec.js @@ -72,6 +72,9 @@ describe('Add existing token using search', function () { fixtures: 'imported-account', ganacheOptions, title: this.test.title, + driverOptions: { + timeOut: 20000, + }, }, async ({ driver }) => { await driver.navigate(); @@ -80,7 +83,10 @@ describe('Add existing token using search', function () { await driver.clickElement({ text: 'import tokens', tag: 'a' }); await driver.fill('#search-tokens', 'BAT'); - await driver.clickElement({ text: 'BAT', tag: 'span' }); + await driver.clickElement({ + text: 'BAT', + tag: 'span', + }); await driver.clickElement({ text: 'Next', tag: 'button' }); await driver.clickElement({ text: 'Import Tokens', tag: 'button' }); diff --git a/test/e2e/tests/phishing-detection.spec.js b/test/e2e/tests/phishing-detection.spec.js index d6ed9375a..ccad1dd4a 100644 --- a/test/e2e/tests/phishing-detection.spec.js +++ b/test/e2e/tests/phishing-detection.spec.js @@ -1,6 +1,9 @@ const { strict: assert } = require('assert'); const { convertToHexValue, withFixtures } = require('../helpers'); +const PHISHFORT_CDN_URL = + 'https://cdn.jsdelivr.net/gh/phishfort/phishfort-lists@master/blacklists/hotlist.json'; + describe('Phishing Detection', function () { async function mockPhishingDetection(mockServer) { await mockServer @@ -20,6 +23,14 @@ describe('Phishing Detection', function () { }; }); } + async function mockPhishfortPhishingDetection(mockServer) { + await mockServer.forGet(PHISHFORT_CDN_URL).thenCallback(() => { + return { + statusCode: 200, + json: ['127.0.0.1'], + }; + }); + } const ganacheOptions = { accounts: [ { @@ -127,4 +138,27 @@ describe('Phishing Detection', function () { }, ); }); + + it('should display the MetaMask Phishing Detection page with the correct new issue link if the issue was detected from the phishfort list', async function () { + await withFixtures( + { + fixtures: 'imported-account', + ganacheOptions, + title: this.test.title, + testSpecificMock: mockPhishfortPhishingDetection, + dapp: true, + failOnConsoleError: false, + }, + async ({ driver }) => { + await driver.navigate(); + await driver.fill('#password', 'correct horse battery staple'); + await driver.press('#password', driver.Key.ENTER); + await driver.openNewPage('http://127.0.0.1:8080'); + const newIssueLink = await driver.findElements( + "a[href='https://github.com/phishfort/phishfort-lists/issues/new?title=[Legitimate%20Site%20Blocked]%20127.0.0.1&body=http%3A%2F%2F127.0.0.1%3A8080%2F']", + ); + assert.equal(newIssueLink.length, 1); + }, + ); + }); }); diff --git a/test/e2e/tests/send-hex-address.spec.js b/test/e2e/tests/send-hex-address.spec.js index ed89901db..76f1a92be 100644 --- a/test/e2e/tests/send-hex-address.spec.js +++ b/test/e2e/tests/send-hex-address.spec.js @@ -119,6 +119,16 @@ describe('Send ETH to a 40 character hexadecimal address', function () { }); describe('Send ERC20 to a 40 character hexadecimal address', function () { + async function mockTstToken(server) { + await server + .forGet('https://token-api.metaswap.codefi.network/token/0x539') + .thenCallback(() => { + return { + statusCode: 200, + json: {}, + }; + }); + } const ganacheOptions = { accounts: [ { @@ -137,7 +147,8 @@ describe('Send ERC20 to a 40 character hexadecimal address', function () { title: this.test.title, failOnConsoleError: false, }, - async ({ driver }) => { + async ({ driver, mockServer }) => { + await mockTstToken(mockServer); await driver.navigate(); await driver.fill('#password', 'correct horse battery staple'); await driver.press('#password', driver.Key.ENTER); @@ -236,7 +247,8 @@ describe('Send ERC20 to a 40 character hexadecimal address', function () { title: this.test.title, failOnConsoleError: false, }, - async ({ driver }) => { + async ({ driver, mockServer }) => { + await mockTstToken(mockServer); await driver.navigate(); await driver.fill('#password', 'correct horse battery staple'); await driver.press('#password', driver.Key.ENTER); diff --git a/test/e2e/tests/swap-eth.spec.js b/test/e2e/tests/swap-eth.spec.js index 5e26b00e0..6ee374710 100644 --- a/test/e2e/tests/swap-eth.spec.js +++ b/test/e2e/tests/swap-eth.spec.js @@ -18,6 +18,9 @@ describe('Swap Eth for another Token', function () { ganacheOptions, title: this.test.title, failOnConsoleError: false, + driverOptions: { + timeOut: 20000, + }, }, async ({ driver }) => { await driver.navigate(); @@ -37,7 +40,6 @@ describe('Swap Eth for another Token', function () { '[class="dropdown-search-list__closed-primary-label dropdown-search-list__select-default"]', ); await driver.clickElement('[placeholder="Search for a token"]'); - await driver.clickElement('[placeholder="Search for a token"]'); await driver.fill('[placeholder="Search for a token"]', 'DAI'); await driver.waitForSelector( '[class="searchable-item-list__primary-label"]', diff --git a/test/e2e/webdriver/index.js b/test/e2e/webdriver/index.js index 73fa5186a..ebec9a002 100644 --- a/test/e2e/webdriver/index.js +++ b/test/e2e/webdriver/index.js @@ -3,7 +3,7 @@ const Driver = require('./driver'); const ChromeDriver = require('./chrome'); const FirefoxDriver = require('./firefox'); -async function buildWebDriver({ responsive, port } = {}) { +async function buildWebDriver({ responsive, port, timeOut } = {}) { const browser = process.env.SELENIUM_BROWSER; const { @@ -11,7 +11,7 @@ async function buildWebDriver({ responsive, port } = {}) { extensionId, extensionUrl, } = await buildBrowserWebDriver(browser, { responsive, port }); - const driver = new Driver(seleniumDriver, browser, extensionUrl); + const driver = new Driver(seleniumDriver, browser, extensionUrl, timeOut); return { driver, diff --git a/ui/components/app/collectibles-detection-notice/collectibles-detection-notice.js b/ui/components/app/collectibles-detection-notice/collectibles-detection-notice.js index 3cf95e716..00e512385 100644 --- a/ui/components/app/collectibles-detection-notice/collectibles-detection-notice.js +++ b/ui/components/app/collectibles-detection-notice/collectibles-detection-notice.js @@ -56,8 +56,9 @@ export default function CollectiblesDetectionNotice() {