From c83d0b29836208d0dcb92a8610d19c44c4b3fc4d Mon Sep 17 00:00:00 2001 From: Elliot Winkler Date: Thu, 17 Nov 2022 15:13:28 -0700 Subject: [PATCH] Migrate to new controller packages `@metamask/controllers` is deprecated, and most of the controllers that lived here are now located in their own package ([1]). This commit replaces `@metamask/controllers` in `package.json` with references to these packages and updates `import` lines to match. [1]: https://github.com/MetaMask/controllers/pull/831 --- .gitignore | 3 + app/components/Base/RemoteImage/index.js | 8 +- app/components/Nav/Main/RootRPCMethodsUI.js | 10 +- app/components/Nav/Main/index.js | 4 +- app/components/UI/AccountList/index.js | 4 +- .../UI/ApproveTransactionReview/index.js | 5 +- app/components/UI/AssetSearch/index.tsx | 2 +- app/components/UI/DrawerView/index.js | 2 +- app/components/UI/EditGasFeeLegacy/index.js | 2 +- .../UI/EditGasFeeLegacyUpdate/index.tsx | 2 +- app/components/UI/NetworkInfo/index.tsx | 4 +- .../UI/NetworkMainAssetLogo/index.js | 2 +- .../TransactionNotification/index.js | 2 +- app/components/UI/PaymentRequest/index.js | 4 +- app/components/UI/PersonalSign/index.js | 5 +- app/components/UI/Swaps/QuotesView.js | 10 +- .../UI/Swaps/components/GasEditModal.js | 2 +- app/components/UI/TransactionEditor/index.js | 2 +- app/components/UI/TransactionElement/index.js | 7 +- app/components/UI/TransactionElement/utils.js | 3 +- .../TransactionReviewInformation/index.js | 2 +- app/components/UI/Transactions/index.js | 2 +- app/components/UI/UpdateEIP1559Tx/index.tsx | 7 +- app/components/Views/AddAsset/index.js | 4 +- app/components/Views/Approval/index.js | 2 +- .../Views/ApproveView/Approve/index.js | 5 +- app/components/Views/AssetDetails/index.tsx | 2 +- .../Views/DetectedTokens/components/Token.tsx | 2 +- app/components/Views/DetectedTokens/index.tsx | 2 +- .../Views/GasEducationCarousel/index.js | 2 +- app/components/Views/Send/index.js | 2 +- app/components/Views/SendFlow/Amount/index.js | 5 +- .../Views/SendFlow/Confirm/index.js | 11 +- app/components/Views/SendFlow/SendTo/index.js | 4 +- .../Views/Settings/AdvancedSettings/index.js | 4 +- .../ExperimentalSettings/index.test.tsx | 2 +- app/components/hooks/useTokenBalance.tsx | 2 +- app/core/BackgroundBridge/BackgroundBridge.js | 2 +- app/core/DeeplinkManager.js | 2 +- app/core/Engine.js | 36 ++- app/core/RPCMethods/RPCMethodMiddleware.ts | 2 +- app/core/RPCMethods/utils.ts | 4 +- .../RPCMethods/wallet_addEthereumChain.js | 2 +- app/core/SDKConnect.ts | 2 +- app/core/Vault.js | 2 +- app/core/WalletConnect.js | 2 +- app/reducers/collectibles/index.test.ts | 2 +- app/reducers/tokens/index.ts | 2 +- app/store/migrations.js | 2 +- app/util/address/index.js | 2 +- app/util/custom-gas/index.js | 3 +- app/util/networks/index.js | 4 +- app/util/number/index.js | 23 +- app/util/tokens/index.ts | 3 +- app/util/tokens/tokens.test.ts | 2 +- app/util/transactions/index.js | 9 +- app/util/transactions/index.test.ts | 12 +- package.json | 14 +- yarn.lock | 289 ++++++++++++++---- 59 files changed, 369 insertions(+), 195 deletions(-) diff --git a/.gitignore b/.gitignore index 60ccfef6687..59af5b55c71 100644 --- a/.gitignore +++ b/.gitignore @@ -85,3 +85,6 @@ tests # attributions licenseInfos.json + +# Allows access to preview versions of @metamask/* packages for testing +.npmrc diff --git a/app/components/Base/RemoteImage/index.js b/app/components/Base/RemoteImage/index.js index c7c5046380b..b7351db69bd 100644 --- a/app/components/Base/RemoteImage/index.js +++ b/app/components/Base/RemoteImage/index.js @@ -8,7 +8,7 @@ import { SvgUri } from 'react-native-svg'; import isUrl from 'is-url'; import ComponentErrorBoundary from '../../UI/ComponentErrorBoundary'; import useIpfsGateway from '../../hooks/useIpfsGateway'; -import { util } from '@metamask/controllers'; +import { getFormattedIpfsUrl } from '@metamask/assets-controllers'; import Identicon from '../../UI/Identicon'; const createStyles = () => @@ -29,11 +29,7 @@ const RemoteImage = (props) => { try { const url = new URL(props.source.uri); if (url.protocol !== 'ipfs:') return false; - const ipfsUrl = util.getFormattedIpfsUrl( - ipfsGateway, - props.source.uri, - false, - ); + const ipfsUrl = getFormattedIpfsUrl(ipfsGateway, props.source.uri, false); return ipfsUrl; } catch { return false; diff --git a/app/components/Nav/Main/RootRPCMethodsUI.js b/app/components/Nav/Main/RootRPCMethodsUI.js index 499c6192115..7cd02e1f739 100644 --- a/app/components/Nav/Main/RootRPCMethodsUI.js +++ b/app/components/Nav/Main/RootRPCMethodsUI.js @@ -44,7 +44,7 @@ import { toggleApproveModal, } from '../../../actions/modals'; import { swapsUtils } from '@metamask/swaps-controller'; -import { util } from '@metamask/controllers'; +import { query } from '@metamask/controller-utils'; import Analytics from '../../../core/Analytics/Analytics'; import { ANALYTICS_EVENT_OPTS } from '../../../util/analytics'; import BigNumber from 'bignumber.js'; @@ -138,25 +138,25 @@ const RootRPCMethodsUI = (props) => { TransactionController.state.transactions.find( ({ id }) => id === approvalTransactionMetaId, ); - const ethBalance = await util.query( + const ethBalance = await query( TransactionController.ethQuery, 'getBalance', [props.selectedAddress], ); - const receipt = await util.query( + const receipt = await query( TransactionController.ethQuery, 'getTransactionReceipt', [transactionMeta.transactionHash], ); - const currentBlock = await util.query( + const currentBlock = await query( TransactionController.ethQuery, 'getBlockByHash', [receipt.blockHash, false], ); let approvalReceipt; if (approvalTransaction?.transactionHash) { - approvalReceipt = await util.query( + approvalReceipt = await query( TransactionController.ethQuery, 'getTransactionReceipt', [approvalTransaction.transactionHash], diff --git a/app/components/Nav/Main/index.js b/app/components/Nav/Main/index.js index 725d3c44a15..23c55573b03 100644 --- a/app/components/Nav/Main/index.js +++ b/app/components/Nav/Main/index.js @@ -34,7 +34,7 @@ import { import ProtectYourWalletModal from '../../UI/ProtectYourWalletModal'; import MainNavigator from './MainNavigator'; import SkipAccountSecurityModal from '../../UI/SkipAccountSecurityModal'; -import { util } from '@metamask/controllers'; +import { query } from '@metamask/controller-utils'; import SwapsLiveness from '../../UI/Swaps/SwapsLiveness'; import { @@ -114,7 +114,7 @@ const Main = (props) => { if (props.providerType !== 'rpc') { try { const { TransactionController } = Engine.context; - await util.query(TransactionController.ethQuery, 'blockNumber', []); + await query(TransactionController.ethQuery, 'blockNumber', []); props.setInfuraAvailabilityNotBlocked(); } catch (e) { if (e.message === AppConstants.ERRORS.INFURA_BLOCKED_MESSAGE) { diff --git a/app/components/UI/AccountList/index.js b/app/components/UI/AccountList/index.js index ed7e6db3b6e..0f878869063 100644 --- a/app/components/UI/AccountList/index.js +++ b/app/components/UI/AccountList/index.js @@ -1,5 +1,5 @@ import React, { PureComponent } from 'react'; -import { KeyringTypes } from '@metamask/controllers'; +import { KeyringTypes } from '@metamask/keyring-controller'; import Engine from '../../../core/Engine'; import PropTypes from 'prop-types'; import { @@ -334,7 +334,7 @@ class AccountList extends PureComponent { getAccounts() { const { accounts, identities, selectedAddress, keyrings, getBalanceError } = this.props; - // This is a temporary fix until we can read the state from @metamask/controllers + // This is a temporary fix until we can read the state from @metamask/keyring-controller const allKeyrings = keyrings && keyrings.length ? keyrings diff --git a/app/components/UI/ApproveTransactionReview/index.js b/app/components/UI/ApproveTransactionReview/index.js index aef7d169437..af61755f696 100644 --- a/app/components/UI/ApproveTransactionReview/index.js +++ b/app/components/UI/ApproveTransactionReview/index.js @@ -18,7 +18,8 @@ import { import Engine from '../../../core/Engine'; import { strings } from '../../../../locales/i18n'; import { setTransactionObject } from '../../../actions/transaction'; -import { GAS_ESTIMATE_TYPES, util } from '@metamask/controllers'; +import { GAS_ESTIMATE_TYPES } from '@metamask/gas-fee-controller'; +import { hexToBN } from '@metamask/controller-utils'; import { fromTokenMinimalUnit } from '../../../util/number'; import EthereumAddress from '../EthereumAddress'; import { @@ -60,8 +61,6 @@ import { allowedToBuy } from '../FiatOrders'; import { MM_SDK_REMOTE_ORIGIN } from '../../../core/SDKConnect'; import createStyles from './styles'; -const { hexToBN } = util; - const { ORIGIN_DEEPLINK, ORIGIN_QR_CODE } = AppConstants.DEEPLINKS; /** diff --git a/app/components/UI/AssetSearch/index.tsx b/app/components/UI/AssetSearch/index.tsx index 9c4e98e64a7..38a4190e176 100644 --- a/app/components/UI/AssetSearch/index.tsx +++ b/app/components/UI/AssetSearch/index.tsx @@ -7,7 +7,7 @@ import Icon from 'react-native-vector-icons/FontAwesome'; import { toLowerCaseEquals } from '../../../util/general'; import { useSelector } from 'react-redux'; import { getTokenListArray } from '../../../reducers/tokens'; -import { TokenListToken } from '@metamask/controllers'; +import { TokenListToken } from '@metamask/assets-controllers'; import { useTheme } from '../../../util/theme'; const createStyles = (colors: any) => diff --git a/app/components/UI/DrawerView/index.js b/app/components/UI/DrawerView/index.js index 62d0491d0c5..09207577159 100644 --- a/app/components/UI/DrawerView/index.js +++ b/app/components/UI/DrawerView/index.js @@ -67,7 +67,7 @@ import { collectiblesSelector } from '../../../reducers/collectibles'; import { getCurrentRoute } from '../../../reducers/navigation'; import { ScrollView } from 'react-native-gesture-handler'; import { isZero } from '../../../util/lodash'; -import { KeyringTypes } from '@metamask/controllers'; +import { KeyringTypes } from '@metamask/keyring-controller'; import { ThemeContext, mockTheme } from '../../../util/theme'; import NetworkInfo from '../NetworkInfo'; import sanitizeUrl from '../../../util/sanitizeUrl'; diff --git a/app/components/UI/EditGasFeeLegacy/index.js b/app/components/UI/EditGasFeeLegacy/index.js index 111f4f9e4be..88defb3221b 100644 --- a/app/components/UI/EditGasFeeLegacy/index.js +++ b/app/components/UI/EditGasFeeLegacy/index.js @@ -8,7 +8,7 @@ import { TouchableWithoutFeedback, } from 'react-native'; import PropTypes from 'prop-types'; -import { GAS_ESTIMATE_TYPES } from '@metamask/controllers'; +import { GAS_ESTIMATE_TYPES } from '@metamask/gas-fee-controller'; import BigNumber from 'bignumber.js'; import Text from '../../Base/Text'; import StyledButton from '../StyledButton'; diff --git a/app/components/UI/EditGasFeeLegacyUpdate/index.tsx b/app/components/UI/EditGasFeeLegacyUpdate/index.tsx index 6c3fafad5b9..271abfe3173 100644 --- a/app/components/UI/EditGasFeeLegacyUpdate/index.tsx +++ b/app/components/UI/EditGasFeeLegacyUpdate/index.tsx @@ -6,7 +6,7 @@ import { ScrollView, TouchableWithoutFeedback, } from 'react-native'; -import { GAS_ESTIMATE_TYPES } from '@metamask/controllers'; +import { GAS_ESTIMATE_TYPES } from '@metamask/gas-fee-controller'; import BigNumber from 'bignumber.js'; import Text from '../../Base/Text'; import StyledButton from '../StyledButton'; diff --git a/app/components/UI/NetworkInfo/index.tsx b/app/components/UI/NetworkInfo/index.tsx index 045f624f23f..8134e3c18f0 100644 --- a/app/components/UI/NetworkInfo/index.tsx +++ b/app/components/UI/NetworkInfo/index.tsx @@ -13,7 +13,7 @@ import { NETWORK_EDUCATION_MODAL_NETWORK_NAME_ID, } from '../../../constants/test-ids'; import { fontStyles } from '../../../styles/common'; -import { util as controllerUtils } from '@metamask/controllers'; +import { isTokenDetectionSupportedForNetwork } from '@metamask/assets-controllers'; import { NETWORK_EDUCATION_MODAL_CLOSE_BUTTON } from '../../../../wdio/features/testIDs/Screens/NetworksScreen.testids.js'; const createStyles = (colors: { background: { default: string }; @@ -131,7 +131,7 @@ const NetworkInfo = (props: NetworkInfoProps) => { const { colors } = useTheme(); const styles = createStyles(colors); const isTokenDetectionSupported = - controllerUtils.isTokenDetectionSupportedForNetwork(chainId); + isTokenDetectionSupportedForNetwork(chainId); const isTokenDetectionEnabledForNetwork = useMemo(() => { if (isTokenDetectionSupported && isTokenDetectionEnabled) { diff --git a/app/components/UI/NetworkMainAssetLogo/index.js b/app/components/UI/NetworkMainAssetLogo/index.js index 730d0e31c76..1865d05428e 100644 --- a/app/components/UI/NetworkMainAssetLogo/index.js +++ b/app/components/UI/NetworkMainAssetLogo/index.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { NetworksChainId } from '@metamask/controllers'; +import { NetworksChainId } from '@metamask/controller-utils'; import { connect } from 'react-redux'; import TokenIcon from '../Swaps/components/TokenIcon'; diff --git a/app/components/UI/Notification/TransactionNotification/index.js b/app/components/UI/Notification/TransactionNotification/index.js index bc462255cf3..13bac5356cd 100644 --- a/app/components/UI/Notification/TransactionNotification/index.js +++ b/app/components/UI/Notification/TransactionNotification/index.js @@ -19,7 +19,7 @@ import TransactionDetails from '../../TransactionElement/TransactionDetails'; import BaseNotification from './../BaseNotification'; import Device from '../../../../util/device'; import ElevatedView from 'react-native-elevated-view'; -import { CANCEL_RATE, SPEED_UP_RATE } from '@metamask/controllers'; +import { CANCEL_RATE, SPEED_UP_RATE } from '@metamask/transaction-controller'; import BigNumber from 'bignumber.js'; import { collectibleContractsSelector } from '../../../../reducers/collectibles'; import { useTheme } from '../../../../util/theme'; diff --git a/app/components/UI/PaymentRequest/index.js b/app/components/UI/PaymentRequest/index.js index f2feab7c911..c3b5327a869 100644 --- a/app/components/UI/PaymentRequest/index.js +++ b/app/components/UI/PaymentRequest/index.js @@ -40,14 +40,14 @@ import { } from '../../../util/payment-link-generator'; import Device from '../../../util/device'; import currencySymbols from '../../../util/currency-symbols.json'; -import { NetworksChainId } from '@metamask/controllers'; +import { NetworksChainId } from '@metamask/controller-utils'; import { getTicker } from '../../../util/transactions'; import { toLowerCaseEquals } from '../../../util/general'; import { getTokenListArray } from '../../../reducers/tokens'; import { utils as ethersUtils } from 'ethers'; import { ThemeContext, mockTheme } from '../../../util/theme'; import { isTestNet } from '../../../util/networks'; -import { isTokenDetectionSupportedForNetwork } from '@metamask/controllers/dist/util'; +import { isTokenDetectionSupportedForNetwork } from '@metamask/assets-controllers'; const KEYBOARD_OFFSET = 120; const createStyles = (colors) => diff --git a/app/components/UI/PersonalSign/index.js b/app/components/UI/PersonalSign/index.js index 309905c639a..4dd173413a8 100644 --- a/app/components/UI/PersonalSign/index.js +++ b/app/components/UI/PersonalSign/index.js @@ -6,7 +6,7 @@ import { fontStyles } from '../../../styles/common'; import Engine from '../../../core/Engine'; import SignatureRequest from '../SignatureRequest'; import ExpandedMessage from '../SignatureRequest/ExpandedMessage'; -import { util } from '@metamask/controllers'; +import { hexToText } from '@metamask/controller-utils'; import NotificationManager from '../../../core/NotificationManager'; import { strings } from '../../../../locales/i18n'; import { WALLET_CONNECT_ORIGIN } from '../../../util/walletconnect'; @@ -191,8 +191,7 @@ class PersonalSign extends PureComponent { const { truncateMessage } = this.state; const styles = this.getStyles(); - const textChild = util - .hexToText(messageParams.data) + const textChild = hexToText(messageParams.data) .split('\n') .map((line, i) => ( { const { TransactionController } = Engine.context; - const blockNumber = await util.query( + const blockNumber = await query( TransactionController.ethQuery, 'blockNumber', [], ); - const currentBlock = await util.query( + const currentBlock = await query( TransactionController.ethQuery, 'getBlockByNumber', [blockNumber, false], diff --git a/app/components/UI/Swaps/components/GasEditModal.js b/app/components/UI/Swaps/components/GasEditModal.js index dec45a88d5f..4ee57cffcbc 100644 --- a/app/components/UI/Swaps/components/GasEditModal.js +++ b/app/components/UI/Swaps/components/GasEditModal.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import { StyleSheet, TouchableOpacity } from 'react-native'; import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view'; import Modal from 'react-native-modal'; -import { GAS_ESTIMATE_TYPES } from '@metamask/controllers'; +import { GAS_ESTIMATE_TYPES } from '@metamask/gas-fee-controller'; import MaterialCommunityIcon from 'react-native-vector-icons/MaterialCommunityIcons'; import { connect } from 'react-redux'; diff --git a/app/components/UI/TransactionEditor/index.js b/app/components/UI/TransactionEditor/index.js index 616e94c8cd4..5808cf39fe7 100644 --- a/app/components/UI/TransactionEditor/index.js +++ b/app/components/UI/TransactionEditor/index.js @@ -28,7 +28,7 @@ import { safeToChecksumAddress } from '../../../util/address'; import { shallowEqual } from '../../../util/general'; import EditGasFee1559 from '../EditGasFee1559'; import EditGasFeeLegacy from '../EditGasFeeLegacy'; -import { GAS_ESTIMATE_TYPES } from '@metamask/controllers'; +import { GAS_ESTIMATE_TYPES } from '@metamask/gas-fee-controller'; import AppConstants from '../../../core/AppConstants'; import { estimateGas, diff --git a/app/components/UI/TransactionElement/index.js b/app/components/UI/TransactionElement/index.js index 5ffd91f8d5a..b8948b20e2b 100644 --- a/app/components/UI/TransactionElement/index.js +++ b/app/components/UI/TransactionElement/index.js @@ -23,9 +23,12 @@ import ListItem from '../../Base/ListItem'; import StatusText from '../../Base/StatusText'; import DetailsModal from '../../Base/DetailsModal'; import { isMainNet } from '../../../util/networks'; -import { WalletDevice, util } from '@metamask/controllers/'; +import { weiHexToGweiDec } from '@metamask/controller-utils'; +import { + WalletDevice, + isEIP1559Transaction, +} from '@metamask/transaction-controller'; import { ThemeContext, mockTheme } from '../../../util/theme'; -const { weiHexToGweiDec, isEIP1559Transaction } = util; const createStyles = (colors) => StyleSheet.create({ diff --git a/app/components/UI/TransactionElement/utils.js b/app/components/UI/TransactionElement/utils.js index acfb871cc02..e6d2acf8015 100644 --- a/app/components/UI/TransactionElement/utils.js +++ b/app/components/UI/TransactionElement/utils.js @@ -30,8 +30,7 @@ import { swapsUtils } from '@metamask/swaps-controller'; import { isSwapsNativeAsset } from '../Swaps/utils'; import { toLowerCaseEquals } from '../../../util/general'; import Engine from '../../../core/Engine'; -import { util } from '@metamask/controllers'; -const { isEIP1559Transaction } = util; +import { isEIP1559Transaction } from '@metamask/transaction-controller'; const { getSwapsContractAddress } = swapsUtils; diff --git a/app/components/UI/TransactionReview/TransactionReviewInformation/index.js b/app/components/UI/TransactionReview/TransactionReviewInformation/index.js index 2fa39b31bb7..12e6a000917 100644 --- a/app/components/UI/TransactionReview/TransactionReviewInformation/index.js +++ b/app/components/UI/TransactionReview/TransactionReviewInformation/index.js @@ -34,7 +34,7 @@ import { getNetworkNonce, isTestNet } from '../../../../util/networks'; import CustomNonceModal from '../../../UI/CustomNonceModal'; import { setNonce, setProposedNonce } from '../../../../actions/transaction'; import TransactionReviewEIP1559 from '../TransactionReviewEIP1559'; -import { GAS_ESTIMATE_TYPES } from '@metamask/controllers'; +import { GAS_ESTIMATE_TYPES } from '@metamask/gas-fee-controller'; import CustomNonce from '../../../UI/CustomNonce'; import Logger from '../../../../util/Logger'; import { ThemeContext, mockTheme } from '../../../../util/theme'; diff --git a/app/components/UI/Transactions/index.js b/app/components/UI/Transactions/index.js index 6ed00cce63c..686e7a6469a 100644 --- a/app/components/UI/Transactions/index.js +++ b/app/components/UI/Transactions/index.js @@ -29,7 +29,7 @@ import TransactionElement from '../TransactionElement'; import Engine from '../../../core/Engine'; import { showAlert } from '../../../actions/alert'; import NotificationManager from '../../../core/NotificationManager'; -import { CANCEL_RATE, SPEED_UP_RATE } from '@metamask/controllers'; +import { CANCEL_RATE, SPEED_UP_RATE } from '@metamask/transaction-controller'; import { renderFromWei } from '../../../util/number'; import Device from '../../../util/device'; import { RPC, NO_RPC_BLOCK_EXPLORER } from '../../../constants/network'; diff --git a/app/components/UI/UpdateEIP1559Tx/index.tsx b/app/components/UI/UpdateEIP1559Tx/index.tsx index 973c72beba6..156f116b090 100644 --- a/app/components/UI/UpdateEIP1559Tx/index.tsx +++ b/app/components/UI/UpdateEIP1559Tx/index.tsx @@ -2,11 +2,8 @@ import React, { useState, useEffect, useCallback, useRef } from 'react'; import EditGasFee1559Update from '../EditGasFee1559Update'; import { connect } from 'react-redux'; -import { - CANCEL_RATE, - SPEED_UP_RATE, - GAS_ESTIMATE_TYPES, -} from '@metamask/controllers'; +import { CANCEL_RATE, SPEED_UP_RATE } from '@metamask/transaction-controller'; +import { GAS_ESTIMATE_TYPES } from '@metamask/gas-fee-controller'; import { hexToBN, fromWei, renderFromWei } from '../../../util/number'; import BigNumber from 'bignumber.js'; import { getTicker } from '../../../util/transactions'; diff --git a/app/components/Views/AddAsset/index.js b/app/components/Views/AddAsset/index.js index af3ed4386ae..4251385521c 100644 --- a/app/components/Views/AddAsset/index.js +++ b/app/components/Views/AddAsset/index.js @@ -12,7 +12,7 @@ import AddCustomCollectible from '../../UI/AddCustomCollectible'; import { getNetworkNavbarOptions } from '../../UI/Navbar'; import CollectibleDetectionModal from '../../UI/CollectibleDetectionModal'; import { isMainNet } from '../../../util/networks'; -import { util as controllerUtils } from '@metamask/controllers'; +import { isTokenDetectionSupportedForNetwork } from '@metamask/assets-controllers'; import { ThemeContext, mockTheme } from '../../../util/theme'; const createStyles = (colors) => @@ -127,7 +127,7 @@ class AddAsset extends PureComponent { } = this.props; const { dismissNftInfo } = this.state; const isTokenDetectionSupported = - controllerUtils.isTokenDetectionSupportedForNetwork(chainId); + isTokenDetectionSupportedForNetwork(chainId); const colors = this.context.colors || mockTheme.colors; const styles = createStyles(colors); diff --git a/app/components/Views/Approval/index.js b/app/components/Views/Approval/index.js index d7681d8555f..d9241ce719e 100644 --- a/app/components/Views/Approval/index.js +++ b/app/components/Views/Approval/index.js @@ -25,7 +25,7 @@ import { import { WALLET_CONNECT_ORIGIN } from '../../../util/walletconnect'; import Logger from '../../../util/Logger'; import AnalyticsV2 from '../../../util/analyticsV2'; -import { GAS_ESTIMATE_TYPES } from '@metamask/controllers'; +import { GAS_ESTIMATE_TYPES } from '@metamask/gas-fee-controller'; import { KEYSTONE_TX_CANCELED } from '../../../constants/error'; import { ThemeContext, mockTheme } from '../../../util/theme'; import { diff --git a/app/components/Views/ApproveView/Approve/index.js b/app/components/Views/ApproveView/Approve/index.js index 3d96747a8dd..c856a406e27 100644 --- a/app/components/Views/ApproveView/Approve/index.js +++ b/app/components/Views/ApproveView/Approve/index.js @@ -17,7 +17,8 @@ import AddNickname from '../../../UI/ApproveTransactionReview/AddNickname'; import Modal from 'react-native-modal'; import { strings } from '../../../../../locales/i18n'; import { setTransactionObject } from '../../../../actions/transaction'; -import { GAS_ESTIMATE_TYPES, util } from '@metamask/controllers'; +import { GAS_ESTIMATE_TYPES } from '@metamask/gas-fee-controller'; +import { BNToHex, hexToBN } from '@metamask/controller-utils'; import { addHexPrefix, fromWei, renderFromWei } from '../../../../util/number'; import { getNormalizedTxState, getTicker } from '../../../../util/transactions'; import { getGasLimit } from '../../../../util/custom-gas'; @@ -40,8 +41,6 @@ import { stopGasPolling, } from '../../../../core/GasPolling/GasPolling'; -const { BNToHex, hexToBN } = util; - const EDIT = 'edit'; const REVIEW = 'review'; diff --git a/app/components/Views/AssetDetails/index.tsx b/app/components/Views/AssetDetails/index.tsx index 13decd37de2..d0563106c58 100644 --- a/app/components/Views/AssetDetails/index.tsx +++ b/app/components/Views/AssetDetails/index.tsx @@ -22,7 +22,7 @@ import Engine from '../../../core/Engine'; import Logger from '../../../util/Logger'; import NotificationManager from '../../../core/NotificationManager'; import AppConstants from '../../../core/AppConstants'; -import { Token as TokenType } from '@metamask/controllers'; +import { Token as TokenType } from '@metamask/assets-controllers'; import { balanceToFiat, renderFromTokenMinimalUnit, diff --git a/app/components/Views/DetectedTokens/components/Token.tsx b/app/components/Views/DetectedTokens/components/Token.tsx index c81f43128f7..55eecd405f5 100644 --- a/app/components/Views/DetectedTokens/components/Token.tsx +++ b/app/components/Views/DetectedTokens/components/Token.tsx @@ -1,6 +1,6 @@ import React, { useState } from 'react'; import { View, Text, TouchableOpacity, StyleSheet } from 'react-native'; -import { Token as TokenType } from '@metamask/controllers'; +import { Token as TokenType } from '@metamask/assets-controllers'; import EthereumAddress from '../../../UI/EthereumAddress'; import Icon from 'react-native-vector-icons/Feather'; import CheckBox from '@react-native-community/checkbox'; diff --git a/app/components/Views/DetectedTokens/index.tsx b/app/components/Views/DetectedTokens/index.tsx index 880f569aab9..98efafca454 100644 --- a/app/components/Views/DetectedTokens/index.tsx +++ b/app/components/Views/DetectedTokens/index.tsx @@ -5,7 +5,7 @@ import { useSelector } from 'react-redux'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; import { fontStyles } from '../../../styles/common'; import StyledButton from '../../UI/StyledButton'; -import { Token as TokenType } from '@metamask/controllers'; +import { Token as TokenType } from '@metamask/assets-controllers'; import Token from './components/Token'; import Engine from '../../../core/Engine'; import { useNavigation } from '@react-navigation/native'; diff --git a/app/components/Views/GasEducationCarousel/index.js b/app/components/Views/GasEducationCarousel/index.js index e3225048f9e..b58594aebf7 100644 --- a/app/components/Views/GasEducationCarousel/index.js +++ b/app/components/Views/GasEducationCarousel/index.js @@ -19,7 +19,7 @@ import Text from '../../Base/Text'; import { connect } from 'react-redux'; import Device from '../../../util/device'; import { useTheme } from '../../../util/theme'; -import { GAS_ESTIMATE_TYPES } from '@metamask/controllers'; +import { GAS_ESTIMATE_TYPES } from '@metamask/gas-fee-controller'; import AppConstants from '../../../core/AppConstants'; import { decGWEIToHexWEI } from '../../../util/conversions'; import { BNToHex, hexToBN } from '../../../util/number'; diff --git a/app/components/Views/Send/index.js b/app/components/Views/Send/index.js index d6eea597cdb..600ef15d952 100644 --- a/app/components/Views/Send/index.js +++ b/app/components/Views/Send/index.js @@ -41,7 +41,7 @@ import { isENS } from '../../../util/address'; import TransactionTypes from '../../../core/TransactionTypes'; import { MAINNET } from '../../../constants/network'; import BigNumber from 'bignumber.js'; -import { WalletDevice } from '@metamask/controllers/'; +import { WalletDevice } from '@metamask/transaction-controller'; import { getTokenList } from '../../../reducers/tokens'; import AnalyticsV2 from '../../../util/analyticsV2'; import { KEYSTONE_TX_CANCELED } from '../../../constants/error'; diff --git a/app/components/Views/SendFlow/Amount/index.js b/app/components/Views/SendFlow/Amount/index.js index 4ec8a5398b7..5e3257211ef 100644 --- a/app/components/Views/SendFlow/Amount/index.js +++ b/app/components/Views/SendFlow/Amount/index.js @@ -48,7 +48,8 @@ import { getEther, calculateEIP1559GasFeeHexes, } from '../../../../util/transactions'; -import { GAS_ESTIMATE_TYPES, util } from '@metamask/controllers'; +import { GAS_ESTIMATE_TYPES } from '@metamask/gas-fee-controller'; +import { hexToBN, BNToHex } from '@metamask/controller-utils'; import ErrorMessage from '../ErrorMessage'; import { getGasLimit } from '../../../../util/custom-gas'; import Engine from '../../../../core/Engine'; @@ -73,8 +74,6 @@ import { import { gte } from '../../../../util/lodash'; import { ThemeContext, mockTheme } from '../../../../util/theme'; -const { hexToBN, BNToHex } = util; - const KEYBOARD_OFFSET = Device.isSmallDevice() ? 80 : 120; const createStyles = (colors) => diff --git a/app/components/Views/SendFlow/Confirm/index.js b/app/components/Views/SendFlow/Confirm/index.js index 465d8a61966..13902a8305a 100644 --- a/app/components/Views/SendFlow/Confirm/index.js +++ b/app/components/Views/SendFlow/Confirm/index.js @@ -28,12 +28,9 @@ import { getNormalizedTxState, } from '../../../../util/transactions'; import StyledButton from '../../../UI/StyledButton'; -import { - util, - WalletDevice, - NetworksChainId, - GAS_ESTIMATE_TYPES, -} from '@metamask/controllers'; +import { WalletDevice } from '@metamask/transaction-controller'; +import { hexToBN, BNToHex, NetworksChainId } from '@metamask/controller-utils'; +import { GAS_ESTIMATE_TYPES } from '@metamask/gas-fee-controller'; import { prepareTransaction, resetTransaction, @@ -96,8 +93,6 @@ const EDIT_NONCE = 'edit_nonce'; const EDIT_EIP1559 = 'edit_eip1559'; const REVIEW = 'review'; -const { hexToBN, BNToHex } = util; - /** * View that wraps the wraps the "Send" screen */ diff --git a/app/components/Views/SendFlow/SendTo/index.js b/app/components/Views/SendFlow/SendTo/index.js index a1af6fe9c5e..cd4a2e220e3 100644 --- a/app/components/Views/SendFlow/SendTo/index.js +++ b/app/components/Views/SendFlow/SendTo/index.js @@ -10,7 +10,7 @@ import { import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { toChecksumAddress } from 'ethereumjs-util'; -import { util } from '@metamask/controllers'; +import { hexToBN } from '@metamask/controller-utils'; import Modal from 'react-native-modal'; import { SafeAreaView } from 'react-native-safe-area-context'; import Icon from 'react-native-vector-icons/FontAwesome'; @@ -65,8 +65,6 @@ import { import { baseStyles } from '../../../../styles/common'; import createStyles from './styles'; -const { hexToBN } = util; - const dummy = () => true; /** diff --git a/app/components/Views/Settings/AdvancedSettings/index.js b/app/components/Views/Settings/AdvancedSettings/index.js index 1f8febad3d5..76c0d935176 100644 --- a/app/components/Views/Settings/AdvancedSettings/index.js +++ b/app/components/Views/Settings/AdvancedSettings/index.js @@ -10,7 +10,7 @@ import { } from 'react-native'; import { connect } from 'react-redux'; import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view'; -import { util as controllerUtils } from '@metamask/controllers'; +import { isTokenDetectionSupportedForNetwork } from '@metamask/assets-controllers'; import ActionModal from '../../../UI/ActionModal'; import Engine from '../../../../core/Engine'; import StyledButton from '../../../UI/StyledButton'; @@ -300,7 +300,7 @@ class AdvancedSettings extends PureComponent { renderTokenDetectionSection = () => { const { isTokenDetectionEnabled, chainId } = this.props; const { styles, colors } = this.getStyles(); - if (!controllerUtils.isTokenDetectionSupportedForNetwork(chainId)) { + if (!isTokenDetectionSupportedForNetwork(chainId)) { return null; } return ( diff --git a/app/components/Views/Settings/ExperimentalSettings/index.test.tsx b/app/components/Views/Settings/ExperimentalSettings/index.test.tsx index 28b97fdf465..6ff259ec706 100644 --- a/app/components/Views/Settings/ExperimentalSettings/index.test.tsx +++ b/app/components/Views/Settings/ExperimentalSettings/index.test.tsx @@ -4,7 +4,7 @@ import ExperimentalSettings from './'; import configureMockStore from 'redux-mock-store'; import { Provider } from 'react-redux'; import { MAINNET } from '../../../../constants/network'; -import { NetworksChainId } from '@metamask/controllers'; +import { NetworksChainId } from '@metamask/controller-utils'; const mockStore = configureMockStore(); const initialState = { diff --git a/app/components/hooks/useTokenBalance.tsx b/app/components/hooks/useTokenBalance.tsx index 18ca666e475..bb594f0ca54 100644 --- a/app/components/hooks/useTokenBalance.tsx +++ b/app/components/hooks/useTokenBalance.tsx @@ -1,6 +1,6 @@ import { useState, useEffect, Dispatch, SetStateAction } from 'react'; import Engine from '../../core/Engine'; -import { BN } from '@metamask/controllers'; +import { BN } from '@metamask/assets-controllers'; /** * Hook to handle the balance of ERC20 tokens diff --git a/app/core/BackgroundBridge/BackgroundBridge.js b/app/core/BackgroundBridge/BackgroundBridge.js index 975b5ad73a7..90e9cb25e63 100644 --- a/app/core/BackgroundBridge/BackgroundBridge.js +++ b/app/core/BackgroundBridge/BackgroundBridge.js @@ -1,6 +1,6 @@ /* eslint-disable import/no-commonjs */ import URL from 'url-parse'; -import { NetworksChainId } from '@metamask/controllers'; +import { NetworksChainId } from '@metamask/controller-utils'; import { JsonRpcEngine } from 'json-rpc-engine'; import MobilePortStream from '../MobilePortStream'; import { setupMultiplex } from '../../util/streams'; diff --git a/app/core/DeeplinkManager.js b/app/core/DeeplinkManager.js index b857740db35..1ab0be33dad 100644 --- a/app/core/DeeplinkManager.js +++ b/app/core/DeeplinkManager.js @@ -11,7 +11,7 @@ import { generateApproveData } from '../util/transactions'; import { NETWORK_ERROR_MISSING_NETWORK_ID } from '../constants/error'; import { strings } from '../../locales/i18n'; import { getNetworkTypeById, handleNetworkSwitch } from '../util/networks'; -import { WalletDevice } from '@metamask/controllers/'; +import { WalletDevice } from '@metamask/transaction-controller'; import { ACTIONS, ETH_ACTIONS, diff --git a/app/core/Engine.js b/app/core/Engine.js index 6d1e98df97a..02abf2d236e 100644 --- a/app/core/Engine.js +++ b/app/core/Engine.js @@ -1,30 +1,34 @@ import { AccountTrackerController, - AddressBookController, AssetsContractController, TokenListController, - ControllerMessenger, - ComposableController, CurrencyRateController, - KeyringController, - PersonalMessageManager, - MessageManager, - NetworkController, - PhishingController, - PreferencesController, TokenBalancesController, TokenRatesController, - Transaction, - TransactionController, - TypedMessageManager, - WalletDevice, - GasFeeController, TokensController, NftController, TokenDetectionController, NftDetectionController, - ApprovalController, -} from '@metamask/controllers'; +} from '@metamask/assets-controllers'; +import { AddressBookController } from '@metamask/address-book-controller'; +import { ControllerMessenger } from '@metamask/base-controller'; +import { ComposableController } from '@metamask/composable-controller'; +import { KeyringController } from '@metamask/keyring-controller'; +import { + PersonalMessageManager, + MessageManager, + TypedMessageManager, +} from '@metamask/message-manager'; +import { NetworkController } from '@metamask/network-controller'; +import { PhishingController } from '@metamask/phishing-controller'; +import { PreferencesController } from '@metamask/preferences-controller'; +import { + Transaction, + TransactionController, + WalletDevice, +} from '@metamask/transaction-controller'; +import { GasFeeController } from '@metamask/gas-fee-controller'; +import { ApprovalController } from '@metamask/approval-controller'; import SwapsController, { swapsUtils } from '@metamask/swaps-controller'; import AsyncStorage from '@react-native-async-storage/async-storage'; import { MetaMaskKeyring as QRHardwareKeyring } from '@keystonehq/metamask-airgapped-keyring'; diff --git a/app/core/RPCMethods/RPCMethodMiddleware.ts b/app/core/RPCMethods/RPCMethodMiddleware.ts index 6afa2f1cb05..632ca163e12 100644 --- a/app/core/RPCMethods/RPCMethodMiddleware.ts +++ b/app/core/RPCMethods/RPCMethodMiddleware.ts @@ -4,7 +4,7 @@ import { createAsyncMiddleware } from 'json-rpc-engine'; import { ethErrors } from 'eth-json-rpc-errors'; import RPCMethods from './index.js'; import { RPC } from '../../constants/network'; -import { NetworksChainId, NetworkType } from '@metamask/controllers'; +import { NetworksChainId, NetworkType } from '@metamask/controller-utils'; import Networks, { blockTagParamIndex, getAllNetworks, diff --git a/app/core/RPCMethods/utils.ts b/app/core/RPCMethods/utils.ts index 3749abf8199..bc792d7ddf9 100644 --- a/app/core/RPCMethods/utils.ts +++ b/app/core/RPCMethods/utils.ts @@ -1,9 +1,9 @@ -import { util } from '@metamask/controllers'; +import { query } from '@metamask/controller-utils'; import Engine from '../Engine'; export const polyfillGasPrice = async (method: string, params: any[] = []) => { const { TransactionController } = Engine.context; - const data = await util.query(TransactionController.ethQuery, method, params); + const data = await query(TransactionController.ethQuery, method, params); if (data?.maxFeePerGas && !data.gasPrice) { data.gasPrice = data.maxFeePerGas; diff --git a/app/core/RPCMethods/wallet_addEthereumChain.js b/app/core/RPCMethods/wallet_addEthereumChain.js index 848ce4bbb09..b4ce8eaa772 100644 --- a/app/core/RPCMethods/wallet_addEthereumChain.js +++ b/app/core/RPCMethods/wallet_addEthereumChain.js @@ -1,6 +1,6 @@ import { InteractionManager } from 'react-native'; import validUrl from 'valid-url'; -import { NetworksChainId } from '@metamask/controllers'; +import { NetworksChainId } from '@metamask/controller-utils'; import { jsonRpcRequest } from '../../util/jsonRpcRequest'; import Engine from '../Engine'; import { ethErrors } from 'eth-json-rpc-errors'; diff --git a/app/core/SDKConnect.ts b/app/core/SDKConnect.ts index 9068c385563..26fea16a26c 100644 --- a/app/core/SDKConnect.ts +++ b/app/core/SDKConnect.ts @@ -7,7 +7,7 @@ import AppConstants from './AppConstants'; import Minimizer from 'react-native-minimizer'; import BackgroundTimer from 'react-native-background-timer'; import Engine from './Engine'; -import { WalletDevice } from '@metamask/controllers'; +import { WalletDevice } from '@metamask/transaction-controller'; import DefaultPreference from 'react-native-default-preference'; import { diff --git a/app/core/Vault.js b/app/core/Vault.js index cf0462f0822..615b1bd0925 100644 --- a/app/core/Vault.js +++ b/app/core/Vault.js @@ -1,7 +1,7 @@ import Engine from './Engine'; import Logger from '../util/Logger'; import { syncPrefs, syncAccounts } from '../util/sync'; -import { KeyringTypes } from '@metamask/controllers'; +import { KeyringTypes } from '@metamask/keyring-controller'; /** * Returns current vault seed phrase diff --git a/app/core/WalletConnect.js b/app/core/WalletConnect.js index 86def743ecd..364a47f5e62 100644 --- a/app/core/WalletConnect.js +++ b/app/core/WalletConnect.js @@ -7,7 +7,7 @@ import { EventEmitter } from 'events'; import AsyncStorage from '@react-native-async-storage/async-storage'; import { CLIENT_OPTIONS, WALLET_CONNECT_ORIGIN } from '../util/walletconnect'; import { WALLETCONNECT_SESSIONS } from '../constants/storage'; -import { WalletDevice } from '@metamask/controllers/'; +import { WalletDevice } from '@metamask/transaction-controller'; import BackgroundBridge from './BackgroundBridge/BackgroundBridge'; import getRpcMethodMiddleware, { checkActiveAccountAndChainId, diff --git a/app/reducers/collectibles/index.test.ts b/app/reducers/collectibles/index.test.ts index 0313ab19b76..7c256c39ac0 100644 --- a/app/reducers/collectibles/index.test.ts +++ b/app/reducers/collectibles/index.test.ts @@ -1,4 +1,4 @@ -import { NetworksChainId } from '@metamask/controllers'; +import { NetworksChainId } from '@metamask/controller-utils'; import reducer, { ADD_FAVORITE_COLLECTIBLE, REMOVE_FAVORITE_COLLECTIBLE, diff --git a/app/reducers/tokens/index.ts b/app/reducers/tokens/index.ts index 626c8093e64..12b5da7620d 100644 --- a/app/reducers/tokens/index.ts +++ b/app/reducers/tokens/index.ts @@ -1,6 +1,6 @@ import { createSelector } from 'reselect'; import { tokenListToArray } from '../../util/tokens'; -import { TokenListMap } from '@metamask/controllers'; +import { TokenListMap } from '@metamask/assets-controllers'; const tokenListSelector = (state: any) => state.engine.backgroundState.TokenListController.tokenList as TokenListMap; diff --git a/app/store/migrations.js b/app/store/migrations.js index 2025025ae9a..81864b22a47 100644 --- a/app/store/migrations.js +++ b/app/store/migrations.js @@ -1,4 +1,4 @@ -import { NetworksChainId } from '@metamask/controllers'; +import { NetworksChainId } from '@metamask/controller-utils'; import AppConstants from '../core/AppConstants'; import { getAllNetworks, isSafeChainId } from '../util/networks'; import { toLowerCaseEquals } from '../util/general'; diff --git a/app/util/address/index.js b/app/util/address/index.js index a515aa0a008..ae7a971be74 100644 --- a/app/util/address/index.js +++ b/app/util/address/index.js @@ -7,7 +7,7 @@ import { } from 'ethereumjs-util'; import URL from 'url-parse'; import punycode from 'punycode/punycode'; -import { KeyringTypes } from '@metamask/controllers'; +import { KeyringTypes } from '@metamask/keyring-controller'; import Engine from '../../core/Engine'; import { strings } from '../../../locales/i18n'; import { tlc } from '../general'; diff --git a/app/util/custom-gas/index.js b/app/util/custom-gas/index.js index 6b9b2285dc6..62c779a3192 100644 --- a/app/util/custom-gas/index.js +++ b/app/util/custom-gas/index.js @@ -3,8 +3,7 @@ import { renderFromWei, weiToFiat, toWei, conversionUtil } from '../number'; import { strings } from '../../../locales/i18n'; import TransactionTypes from '../../core/TransactionTypes'; import Engine from '../../core/Engine'; -import { util } from '@metamask/controllers'; -const { hexToBN } = util; +import { hexToBN } from '@metamask/controller-utils'; export const ETH = 'ETH'; export const GWEI = 'GWEI'; diff --git a/app/util/networks/index.js b/app/util/networks/index.js index 2b871c47e7b..de740660f09 100644 --- a/app/util/networks/index.js +++ b/app/util/networks/index.js @@ -9,7 +9,7 @@ import { RPC, } from '../../../app/constants/network'; import { NetworkSwitchErrorType } from '../../../app/constants/error'; -import { util } from '@metamask/controllers'; +import { query } from '@metamask/controller-utils'; import Engine from '../../core/Engine'; import { toLowerCaseEquals } from './../general'; import { fastSplit } from '../../util/number'; @@ -244,7 +244,7 @@ export function isPrefixedFormattedHexString(value) { export const getNetworkNonce = async ({ from }) => { const { TransactionController } = Engine.context; - const networkNonce = await util.query( + const networkNonce = await query( TransactionController.ethQuery, 'getTransactionCount', [from, 'pending'], diff --git a/app/util/number/index.js b/app/util/number/index.js index 878656d9304..6f63053549f 100644 --- a/app/util/number/index.js +++ b/app/util/number/index.js @@ -4,11 +4,13 @@ import { BN, stripHexPrefix } from 'ethereumjs-util'; import { utils as ethersUtils } from 'ethers'; import convert from 'ethjs-unit'; -import { util } from '@metamask/controllers'; +import { BNToHex, hexToBN } from '@metamask/controller-utils'; import numberToBN from 'number-to-bn'; import currencySymbols from '../currency-symbols.json'; import BigNumber from 'bignumber.js'; +export { BNToHex, hexToBN }; + // Big Number Constants const BIG_NUMBER_WEI_MULTIPLIER = new BigNumber('1000000000000000000'); const BIG_NUMBER_GWEI_MULTIPLIER = new BigNumber('1000000000'); @@ -38,15 +40,6 @@ const baseChange = { dec: (n) => new BigNumber(n).toString(10), BN: (n) => new BN(n.toString(16)), }; -/** - * Converts a BN object to a hex string with a '0x' prefix - * - * @param {Object} value - BN instance to convert to a hex string - * @returns {string} - '0x'-prefixed hex string - */ -export function BNToHex(value) { - return util.BNToHex(value); -} /** * Prefixes a hex string with '0x' or '-0x' and returns it. Idempotent. @@ -309,16 +302,6 @@ export function calcTokenValueToSend(value, decimals) { return value ? (value * Math.pow(10, decimals)).toString(16) : 0; } -/** - * Converts a hex string to a BN object - * - * @param {string} value - Number represented as a hex string - * @returns {Object} - A BN instance - */ -export function hexToBN(value) { - return util.hexToBN(value); -} - /** * Checks if a value is a BN instance * diff --git a/app/util/tokens/index.ts b/app/util/tokens/index.ts index b99e7b313a1..b7da51c4d05 100644 --- a/app/util/tokens/index.ts +++ b/app/util/tokens/index.ts @@ -1,5 +1,4 @@ -/* eslint-disable import/prefer-default-export */ -import { TokenListMap } from '@metamask/controllers'; +import { TokenListMap } from '@metamask/assets-controllers'; /** * Convert token list object to token list array diff --git a/app/util/tokens/tokens.test.ts b/app/util/tokens/tokens.test.ts index e3b49981e62..095b726fecc 100644 --- a/app/util/tokens/tokens.test.ts +++ b/app/util/tokens/tokens.test.ts @@ -1,5 +1,5 @@ import { tokenListToArray } from './'; -import { TokenListToken } from '@metamask/controllers'; +import { TokenListToken } from '@metamask/assets-controllers'; const token: TokenListToken = { address: '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', diff --git a/app/util/transactions/index.js b/app/util/transactions/index.js index 77d53e46351..687a9fb3c82 100644 --- a/app/util/transactions/index.js +++ b/app/util/transactions/index.js @@ -2,7 +2,8 @@ import { addHexPrefix, toChecksumAddress, BN } from 'ethereumjs-util'; import { rawEncode, rawDecode } from 'ethereumjs-abi'; import BigNumber from 'bignumber.js'; import humanizeDuration from 'humanize-duration'; -import { util } from '@metamask/controllers'; +import { query, isSmartContractCode } from '@metamask/controller-utils'; +import { isEIP1559Transaction } from '@metamask/transaction-controller'; import { swapsUtils } from '@metamask/swaps-controller'; import Engine from '../../core/Engine'; import I18n, { strings } from '../../../locales/i18n'; @@ -293,9 +294,9 @@ export async function isSmartContractAddress(address, chainId) { } const { TransactionController } = Engine.context; const code = address - ? await util.query(TransactionController.ethQuery, 'getCode', [address]) + ? await query(TransactionController.ethQuery, 'getCode', [address]) : undefined; - const isSmartContract = util.isSmartContractCode(code); + const isSmartContract = isSmartContractCode(code); return isSmartContract; } @@ -1296,7 +1297,7 @@ export function validateTransactionActionBalance(transaction, rate, accounts) { let gasPrice = transaction.transaction.gasPrice; const transactionToCheck = transaction.transaction; - if (util.isEIP1559Transaction(transactionToCheck)) { + if (isEIP1559Transaction(transactionToCheck)) { gasPrice = transactionToCheck.maxFeePerGas; } diff --git a/app/util/transactions/index.test.ts b/app/util/transactions/index.test.ts index fcf1f6ab29e..514dccb7c2d 100644 --- a/app/util/transactions/index.test.ts +++ b/app/util/transactions/index.test.ts @@ -1,5 +1,6 @@ import { swapsUtils } from '@metamask/swaps-controller'; -import { util } from '@metamask/controllers'; +/* eslint-disable-next-line import/no-namespace */ +import * as controllerUtilsModule from '@metamask/controller-utils'; import { BNToHex } from '../number'; import { UINT256_BN_MAX_VALUE } from '../../constants/transaction'; import { NEGATIVE_TOKEN_DECIMALS } from '../../constants/error'; @@ -19,6 +20,10 @@ import { import Engine from '../../core/Engine'; import { strings } from '../../../locales/i18n'; +jest.mock('@metamask/controller-utils', () => ({ + ...jest.requireActual('@metamask/controller-utils'), + query: jest.fn(), +})); jest.mock('../../core/Engine'); const ENGINE_MOCK = Engine as jest.MockedClass; @@ -37,14 +42,13 @@ const UNI_ADDRESS = '0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984'; const MOCK_CHAIN_ID = '1'; -const spyOnQueryMethod = (returnValue: string | undefined) => { - jest.spyOn(util, 'query').mockImplementation( +const spyOnQueryMethod = (returnValue: string | undefined) => + jest.spyOn(controllerUtilsModule, 'query').mockImplementation( () => new Promise((resolve) => { resolve(returnValue); }), ); -}; describe('Transactions utils :: generateTransferData', () => { it('generateTransferData should throw if undefined values', () => { diff --git a/package.json b/package.json index 8aba9067c3a..f8bc8b74078 100644 --- a/package.json +++ b/package.json @@ -131,12 +131,24 @@ "@keystonehq/bc-ur-registry-eth": "^0.7.7", "@keystonehq/metamask-airgapped-keyring": "^0.3.0", "@keystonehq/ur-decoder": "^0.6.1", + "@metamask/address-book-controller": "1.0.0-78f9eea", + "@metamask/approval-controller": "1.0.0-78f9eea", + "@metamask/assets-controllers": "1.0.0-78f9eea", + "@metamask/base-controller": "1.0.0-78f9eea", + "@metamask/composable-controller": "1.0.0-78f9eea", "@metamask/contract-metadata": "^1.35.0", - "@metamask/controllers": "^33.0.0", + "@metamask/controller-utils": "1.0.0-78f9eea", "@metamask/design-tokens": "^1.9.0", "@metamask/etherscan-link": "^2.0.0", + "@metamask/gas-fee-controller": "1.0.0-78f9eea", + "@metamask/keyring-controller": "1.0.0-78f9eea", + "@metamask/message-manager": "1.0.0-78f9eea", + "@metamask/network-controller": "1.0.0-78f9eea", + "@metamask/phishing-controller": "1.0.0-78f9eea", + "@metamask/preferences-controller": "1.0.0-78f9eea", "@metamask/sdk-communication-layer": "^0.0.1-beta.3", "@metamask/swaps-controller": "^6.6.0", + "@metamask/transaction-controller": "1.0.0-78f9eea", "@ngraveio/bc-ur": "^1.1.6", "@react-native-async-storage/async-storage": "1.17.10", "@react-native-clipboard/clipboard": "^1.8.4", diff --git a/yarn.lock b/yarn.lock index 696d4dcc9c8..e2e60b64d4f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3725,6 +3725,72 @@ semver "^7.3.5" tar "^6.1.11" +"@metamask/address-book-controller@1.0.0-78f9eea": + version "1.0.0-78f9eea" + resolved "https://npm.pkg.github.com/download/@metamask/address-book-controller/1.0.0-78f9eea/9402bea8d7f720e61717906484da788ae13ea881#9402bea8d7f720e61717906484da788ae13ea881" + integrity sha512-ijcByes6Q1SWhllK1apR1MnSkSHu4dUeKzd2Bf4GgdVQEU6D8r26toFieffPfYLriBakrlj0whmxsRF6VC7CZQ== + dependencies: + "@metamask/base-controller" "~1.0.0-78f9eea" + "@metamask/controller-utils" "~1.0.0-78f9eea" + +"@metamask/approval-controller@1.0.0-78f9eea": + version "1.0.0-78f9eea" + resolved "https://npm.pkg.github.com/download/@metamask/approval-controller/1.0.0-78f9eea/d087f874817f35cd6347f1b16de67159565c8012#d087f874817f35cd6347f1b16de67159565c8012" + integrity sha512-4k4hli02BUP9Sn0DjWZa25hX8fahcIFquyFxESv1GUD7dsXSoaaQrsPjzvCDvjgo2MBgiai8j/jrb4OJpj0WhQ== + dependencies: + "@metamask/base-controller" "~1.0.0-78f9eea" + eth-rpc-errors "^4.0.0" + immer "^9.0.6" + nanoid "^3.1.31" + +"@metamask/assets-controllers@1.0.0-78f9eea": + version "1.0.0-78f9eea" + resolved "https://npm.pkg.github.com/download/@metamask/assets-controllers/1.0.0-78f9eea/e5232b0d0901ef5a5f07271d7bf86374247d995b#e5232b0d0901ef5a5f07271d7bf86374247d995b" + integrity sha512-dN0LGSleWw+XEKZOw+hvGvLPhLyvStMm1yVa2o9tH7sVd8htxtbjV3tCe5WO3W4BZ1PeGnZhtPJuhkDLRStZzg== + dependencies: + "@ethersproject/abi" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/contracts" "^5.7.0" + "@ethersproject/providers" "^5.7.0" + "@metamask/base-controller" "~1.0.0-78f9eea" + "@metamask/contract-metadata" "^1.35.0" + "@metamask/controller-utils" "~1.0.0-78f9eea" + "@metamask/metamask-eth-abis" "3.0.0" + "@metamask/network-controller" "~1.0.0-78f9eea" + "@metamask/preferences-controller" "~1.0.0-78f9eea" + "@types/uuid" "^8.3.0" + abort-controller "^3.0.0" + async-mutex "^0.2.6" + babel-runtime "^6.26.0" + eth-query "^2.1.2" + eth-rpc-errors "^4.0.0" + ethereumjs-util "^7.0.10" + immer "^9.0.6" + multiformats "^9.5.2" + single-call-balance-checker-abi "^1.0.0" + uuid "^8.3.2" + +"@metamask/base-controller@1.0.0-78f9eea": + version "1.0.0-78f9eea" + resolved "https://npm.pkg.github.com/download/@metamask/base-controller/1.0.0-78f9eea/090c49206cfd30c77a45d5ecfe848ed7be0ecfce#090c49206cfd30c77a45d5ecfe848ed7be0ecfce" + integrity sha512-41ejIuuisMSan3/eeapG39rLkwQCgFWOvRev14mu2mZU+VXVsoGrxEcSdXTFXbRy3Za3FDamDwKYm6Scl9OpNg== + dependencies: + immer "^9.0.6" + +"@metamask/base-controller@~1.0.0-78f9eea": + version "1.0.0-92257c46" + resolved "https://npm.pkg.github.com/download/@metamask/base-controller/1.0.0-92257c46/fd272ed2af9d45beda9df68be09dbd521828accb#fd272ed2af9d45beda9df68be09dbd521828accb" + integrity sha512-1/5GXCSnUk+79Y5YivytEKFWkkPxPpYeN1h5pc2aLwqevhStBiq00zVXTcZn1grXkYrw53/6Ms0Losjv+ZD67w== + dependencies: + immer "^9.0.6" + +"@metamask/base-controller@~1.0.0-f2fa748": + version "1.0.0-f2fa748" + resolved "https://npm.pkg.github.com/download/@metamask/base-controller/1.0.0-f2fa748/fdc834e7b8d22e2bbcf3a88a0d273f4eef9d383e#fdc834e7b8d22e2bbcf3a88a0d273f4eef9d383e" + integrity sha512-GUXMcQSChVDXIaZQC8X0GKoIgTTAKWPtZazt890SLuCMVKNB4/80I2b//P+Tkw5D3jG6X9Ska2jV5e92GwWN3Q== + dependencies: + immer "^9.0.6" + "@metamask/bip39@^4.0.0": version "4.0.0" resolved "https://registry.yarnpkg.com/@metamask/bip39/-/bip39-4.0.0.tgz#1cb867a8454e3d45d065107b4e070d58bdb64aac" @@ -3735,63 +3801,52 @@ pbkdf2 "^3.0.9" randombytes "^2.0.1" +"@metamask/composable-controller@1.0.0-78f9eea": + version "1.0.0-78f9eea" + resolved "https://npm.pkg.github.com/download/@metamask/composable-controller/1.0.0-78f9eea/eb3896183a5f8a9a92f39945ad98ad3d8eeed2b2#eb3896183a5f8a9a92f39945ad98ad3d8eeed2b2" + integrity sha512-zqssyl4rdYQwp6HPXLoJ7VYOQ3wMM/2chFotpH2sBPemz/23c6Ci16zoaO94rwOGhAbtg2DGWMiGnIaZmHGKSQ== + dependencies: + "@metamask/base-controller" "~1.0.0-78f9eea" + "@metamask/contract-metadata@^1.30.0", "@metamask/contract-metadata@^1.31.0", "@metamask/contract-metadata@^1.35.0": version "1.35.0" resolved "https://registry.yarnpkg.com/@metamask/contract-metadata/-/contract-metadata-1.35.0.tgz#2bf2b8f2b6fdbd5132f0bcfa594b6c02dc71c42e" integrity sha512-zfZKwLFOVrQS8vTFoeoNCG9JhqmK4oyembGiGVVpUAYD9BHVZnd9WpicGoUC07ROXLEyQuAK9AJZNBtqwwzfEQ== -"@metamask/controllers@^26.0.0": - version "26.0.0" - resolved "git+https://github.com/MetaMask/controllers.git#d4e9507d9612f2d36c3f848333b33330a19b811b" +"@metamask/controller-utils@1.0.0-78f9eea": + version "1.0.0-78f9eea" + resolved "https://npm.pkg.github.com/download/@metamask/controller-utils/1.0.0-78f9eea/2627f7172a55265a6dce6f2f0ec4bce7594ccf86#2627f7172a55265a6dce6f2f0ec4bce7594ccf86" + integrity sha512-9n/V00R2ElypbvExREz5Fkpl0ivd6JGIIRn4UWVwcDzS+G/fXdNWndDONwvEBdqs8Txp2DJ7Hm14yVZSUBB/kA== dependencies: - "@ethereumjs/common" "^2.3.1" - "@ethereumjs/tx" "^3.2.1" - "@keystonehq/metamask-airgapped-keyring" "^0.2.2" - "@metamask/contract-metadata" "^1.31.0" - "@metamask/metamask-eth-abis" "3.0.0" - "@metamask/types" "^1.1.0" - "@types/uuid" "^8.3.0" - abort-controller "^3.0.0" - async-mutex "^0.2.6" - babel-runtime "^6.26.0" - deep-freeze-strict "^1.1.1" + "@metamask/base-controller" "~1.0.0-78f9eea" + eth-ens-namehash "^2.0.8" + eth-rpc-errors "^4.0.0" + ethereumjs-util "^7.0.10" + ethjs-unit "^0.1.6" + fast-deep-equal "^3.1.3" + isomorphic-fetch "^3.0.0" + +"@metamask/controller-utils@~1.0.0-78f9eea", "@metamask/controller-utils@~1.0.0-f2fa748": + version "1.0.0-f2fa748" + resolved "https://npm.pkg.github.com/download/@metamask/controller-utils/1.0.0-f2fa748/b640be6603f26eed3cdd9ef568afc41d03599369#b640be6603f26eed3cdd9ef568afc41d03599369" + integrity sha512-k6/zC4jJLdLlLNK8FgNgVVKW0i4HS++2WfT0dUEgKc6jGEanWG3cKzxB4ryfjxF/3ThWUeNZ4ZJczkuovRr82w== + dependencies: + "@metamask/base-controller" "~1.0.0-f2fa748" eth-ens-namehash "^2.0.8" - eth-json-rpc-infura "^5.1.0" - eth-keyring-controller "^6.2.1" - eth-method-registry "1.1.0" - eth-phishing-detect "^1.1.14" - eth-query "^2.1.2" eth-rpc-errors "^4.0.0" - eth-sig-util "^3.0.0" ethereumjs-util "^7.0.10" - ethereumjs-wallet "^1.0.1" - ethers "^5.4.1" ethjs-unit "^0.1.6" fast-deep-equal "^3.1.3" - immer "^9.0.6" isomorphic-fetch "^3.0.0" - json-rpc-engine "^6.1.0" - jsonschema "^1.2.4" - multiformats "^9.5.2" - nanoid "^3.1.31" - punycode "^2.1.1" - single-call-balance-checker-abi "^1.0.0" - uuid "^8.3.2" - web3 "^0.20.7" - web3-provider-engine "^16.0.3" -"@metamask/controllers@^33.0.0": - version "33.0.0" - resolved "https://registry.yarnpkg.com/@metamask/controllers/-/controllers-33.0.0.tgz#908c05f6bee741c0beecd9d85d50c304afa38f2b" - integrity sha512-ImnoLztyyE9qswPAv6zk7d40d5FTMPiJYqAjjnJz+hEYhhGPGYI87+2OF/i+kVLv3gatyBQzNxvE1qtQSDWJsg== +"@metamask/controllers@^26.0.0": + version "26.0.0" + resolved "git+https://github.com/MetaMask/controllers.git#d4e9507d9612f2d36c3f848333b33330a19b811b" dependencies: "@ethereumjs/common" "^2.3.1" "@ethereumjs/tx" "^3.2.1" - "@ethersproject/abi" "^5.7.0" - "@ethersproject/contracts" "^5.7.0" - "@ethersproject/providers" "^5.7.0" - "@keystonehq/metamask-airgapped-keyring" "^0.6.1" - "@metamask/contract-metadata" "^1.35.0" + "@keystonehq/metamask-airgapped-keyring" "^0.2.2" + "@metamask/contract-metadata" "^1.31.0" "@metamask/metamask-eth-abis" "3.0.0" "@metamask/types" "^1.1.0" "@types/uuid" "^8.3.0" @@ -3801,14 +3856,15 @@ deep-freeze-strict "^1.1.1" eth-ens-namehash "^2.0.8" eth-json-rpc-infura "^5.1.0" - eth-keyring-controller "^7.0.2" + eth-keyring-controller "^6.2.1" eth-method-registry "1.1.0" - eth-phishing-detect "^1.2.0" + eth-phishing-detect "^1.1.14" eth-query "^2.1.2" eth-rpc-errors "^4.0.0" eth-sig-util "^3.0.0" ethereumjs-util "^7.0.10" ethereumjs-wallet "^1.0.1" + ethers "^5.4.1" ethjs-unit "^0.1.6" fast-deep-equal "^3.1.3" immer "^9.0.6" @@ -3865,6 +3921,64 @@ resolved "https://registry.yarnpkg.com/@metamask/etherscan-link/-/etherscan-link-2.1.0.tgz#c0be8e68445b7b83cf85bcc03a56cdf8e256c973" integrity sha512-ADuWlTUkFfN2vXlz81Bg/0BA+XRor+CdK1055p6k7H6BLIPoDKn9SBOFld9haQFuR9cKh/JYHcnlSIv5R4fUEw== +"@metamask/gas-fee-controller@1.0.0-78f9eea": + version "1.0.0-78f9eea" + resolved "https://npm.pkg.github.com/download/@metamask/gas-fee-controller/1.0.0-78f9eea/a9aa937d89ce308c28c681a34e828e2fe677bb45#a9aa937d89ce308c28c681a34e828e2fe677bb45" + integrity sha512-2x/gpe1P4d3XoHu1ZZ/TXaSEiuML8R+wC33uQkfMH3C2NJfWHmociffnEtl8ESX4xfjq5Hz2y57l18cZFrNNNg== + dependencies: + "@metamask/base-controller" "~1.0.0-78f9eea" + "@metamask/controller-utils" "~1.0.0-78f9eea" + "@metamask/network-controller" "~1.0.0-78f9eea" + "@types/uuid" "^8.3.0" + babel-runtime "^6.26.0" + eth-query "^2.1.2" + ethereumjs-util "^7.0.10" + ethjs-unit "^0.1.6" + immer "^9.0.6" + uuid "^8.3.2" + +"@metamask/keyring-controller@1.0.0-78f9eea": + version "1.0.0-78f9eea" + resolved "https://npm.pkg.github.com/download/@metamask/keyring-controller/1.0.0-78f9eea/f0037c9ca5b9b8efb9ac6b35e35faf60e8812b31#f0037c9ca5b9b8efb9ac6b35e35faf60e8812b31" + integrity sha512-roZWkKp/E0xNz8jBlTJy7HarDRI1C75cWql8qCnCPcYCYVcVMigaEiI8ixKY2jnNJkQ/wvNQOIrc6sMcTL39HA== + dependencies: + "@keystonehq/metamask-airgapped-keyring" "^0.6.1" + "@metamask/base-controller" "~1.0.0-78f9eea" + "@metamask/controller-utils" "~1.0.0-78f9eea" + "@metamask/message-manager" "~1.0.0-78f9eea" + "@metamask/preferences-controller" "~1.0.0-78f9eea" + async-mutex "^0.2.6" + eth-keyring-controller "^7.0.2" + eth-sig-util "^3.0.0" + ethereumjs-util "^7.0.10" + ethereumjs-wallet "^1.0.1" + +"@metamask/message-manager@1.0.0-78f9eea": + version "1.0.0-78f9eea" + resolved "https://npm.pkg.github.com/download/@metamask/message-manager/1.0.0-78f9eea/7839bb78f5b16b3bf4c1e9d8cfa75e94807af1db#7839bb78f5b16b3bf4c1e9d8cfa75e94807af1db" + integrity sha512-udi9U05ywIMXOKDWgL5+EpcWP31yjz2O6DDivJfiE9S84WriYp6y3Kir+aTGikCJImb8UvgC5lTTZ35S77+r5w== + dependencies: + "@metamask/base-controller" "~1.0.0-78f9eea" + "@metamask/controller-utils" "~1.0.0-78f9eea" + "@types/uuid" "^8.3.0" + eth-sig-util "^3.0.0" + ethereumjs-util "^7.0.10" + jsonschema "^1.2.4" + uuid "^8.3.2" + +"@metamask/message-manager@~1.0.0-78f9eea": + version "1.0.0-f2fa748" + resolved "https://npm.pkg.github.com/download/@metamask/message-manager/1.0.0-f2fa748/3ee60a8ef3ffbbdec1e346dff26403c11a2d4772#3ee60a8ef3ffbbdec1e346dff26403c11a2d4772" + integrity sha512-CiIqxyGotly0JOQ/e0rb/2K7Q0VslAut8ImqQZ8YhgkhxmVt31kMhrG1bj9Rw5T/xthAP6NOObGuQ/OYnDODVQ== + dependencies: + "@metamask/base-controller" "~1.0.0-f2fa748" + "@metamask/controller-utils" "~1.0.0-f2fa748" + "@types/uuid" "^8.3.0" + eth-sig-util "^3.0.0" + ethereumjs-util "^7.0.10" + jsonschema "^1.2.4" + uuid "^8.3.2" + "@metamask/metamask-eth-abis@3.0.0": version "3.0.0" resolved "https://registry.yarnpkg.com/@metamask/metamask-eth-abis/-/metamask-eth-abis-3.0.0.tgz#eccc0746b3ab1ab63000444403819c16e88b5272" @@ -3875,6 +3989,34 @@ resolved "https://registry.yarnpkg.com/@metamask/mobile-provider/-/mobile-provider-2.1.0.tgz#685b2f6a55d24197af3f26de4dd0bb78e10ac83e" integrity sha512-VuVUIZ5jEQmLaU8SJC8692crxtNncsxyR9q5j1J6epyMHUU75WTtQdq7VSsu1ghkmP9NXNAz3inlWOGsbT8lLA== +"@metamask/network-controller@1.0.0-78f9eea": + version "1.0.0-78f9eea" + resolved "https://npm.pkg.github.com/download/@metamask/network-controller/1.0.0-78f9eea/7d33b5da975be4ef6be7da52a55b046beb511c94#7d33b5da975be4ef6be7da52a55b046beb511c94" + integrity sha512-fJV16Hqg00NaDQL0QMP2EEhJsuWAnRvSL9am6k7fLjo697vEJ0rmb17ooJhg8TwoxqJRUYaaSFDOuGZb60Nj+w== + dependencies: + "@metamask/base-controller" "~1.0.0-78f9eea" + "@metamask/controller-utils" "~1.0.0-78f9eea" + async-mutex "^0.2.6" + babel-runtime "^6.26.0" + eth-json-rpc-infura "^5.1.0" + eth-query "^2.1.2" + immer "^9.0.6" + web3-provider-engine "^16.0.3" + +"@metamask/network-controller@~1.0.0-78f9eea": + version "1.0.0-f2fa748" + resolved "https://npm.pkg.github.com/download/@metamask/network-controller/1.0.0-f2fa748/6e9bfbf3ed93308195ff42c5829856875a045472#6e9bfbf3ed93308195ff42c5829856875a045472" + integrity sha512-UImJQR0ZcBVE9/ZsjSgx/FTS3LZXFt4viv11hUUwuW6OHnwmlNxVK6huoWJDVh5nmyK9XYviOLGzImaiZwwzJA== + dependencies: + "@metamask/base-controller" "~1.0.0-f2fa748" + "@metamask/controller-utils" "~1.0.0-f2fa748" + async-mutex "^0.2.6" + babel-runtime "^6.26.0" + eth-json-rpc-infura "^5.1.0" + eth-query "^2.1.2" + immer "^9.0.6" + web3-provider-engine "^16.0.3" + "@metamask/obs-store@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@metamask/obs-store/-/obs-store-7.0.0.tgz#6cae5f28306bb3e83a381bc9ae22682316095bd3" @@ -3883,6 +4025,34 @@ "@metamask/safe-event-emitter" "^2.0.0" through2 "^2.0.3" +"@metamask/phishing-controller@1.0.0-78f9eea": + version "1.0.0-78f9eea" + resolved "https://npm.pkg.github.com/download/@metamask/phishing-controller/1.0.0-78f9eea/806454b7f3092a8e51034a4d7d86d01ba9a310f3#806454b7f3092a8e51034a4d7d86d01ba9a310f3" + integrity sha512-7YErZnL9NLan0200RpRhctA7pvumZIVv9uASmjSO9O6TgOQIjgG1mfpEk9/uNm5yry4U3dVTdn1oakmhKRdRyw== + dependencies: + "@metamask/base-controller" "~1.0.0-78f9eea" + "@metamask/controller-utils" "~1.0.0-78f9eea" + "@types/punycode" "^2.1.0" + eth-phishing-detect "^1.2.0" + isomorphic-fetch "^3.0.0" + punycode "^2.1.1" + +"@metamask/preferences-controller@1.0.0-78f9eea": + version "1.0.0-78f9eea" + resolved "https://npm.pkg.github.com/download/@metamask/preferences-controller/1.0.0-78f9eea/c1a4b21ee99181798336dfed0d1307e210e077a7#c1a4b21ee99181798336dfed0d1307e210e077a7" + integrity sha512-KaazsEUNPRqvIf+na0jZfu0b7hZKZjraVj6fhbkk0ZhBJhxUxDYkz83eBDxdmkpJmOGU7P4yi9bA1OxNr5+haQ== + dependencies: + "@metamask/base-controller" "~1.0.0-78f9eea" + "@metamask/controller-utils" "~1.0.0-78f9eea" + +"@metamask/preferences-controller@~1.0.0-78f9eea": + version "1.0.0-f2fa748" + resolved "https://npm.pkg.github.com/download/@metamask/preferences-controller/1.0.0-f2fa748/a6a5e32ded8342ff9511ecaca20f0f1f0fd9d97b#a6a5e32ded8342ff9511ecaca20f0f1f0fd9d97b" + integrity sha512-pCr5wQx/1Z+n7K2sTH1z63N/4Si3oEDYOcBIGbtWaFmFbvpyksGSmL20961CPfExa8bfayrC9gcAR+5QOY+o+Q== + dependencies: + "@metamask/base-controller" "~1.0.0-f2fa748" + "@metamask/controller-utils" "~1.0.0-f2fa748" + "@metamask/safe-event-emitter@^2.0.0": version "2.0.0" resolved "https://registry.yarnpkg.com/@metamask/safe-event-emitter/-/safe-event-emitter-2.0.0.tgz#af577b477c683fad17c619a78208cede06f9605c" @@ -3912,6 +4082,24 @@ human-standard-token-abi "^2.0.0" web3 "^0.20.7" +"@metamask/transaction-controller@1.0.0-78f9eea": + version "1.0.0-78f9eea" + resolved "https://npm.pkg.github.com/download/@metamask/transaction-controller/1.0.0-78f9eea/5f90efa11566587b17edaa6f657cbbfd32e7ed05#5f90efa11566587b17edaa6f657cbbfd32e7ed05" + integrity sha512-Gki04Ul5jF/ICxzUuH+Q4M5UVcrdwMMYOfhWuS2HBqqtEMKDW1XNJXxQm1YNcg4UMtF3VA02rNwe4fxNKNVMpg== + dependencies: + "@ethereumjs/common" "^2.3.1" + "@ethereumjs/tx" "^3.2.1" + "@metamask/base-controller" "~1.0.0-78f9eea" + "@metamask/controller-utils" "~1.0.0-78f9eea" + "@metamask/network-controller" "~1.0.0-78f9eea" + async-mutex "^0.2.6" + babel-runtime "^6.26.0" + eth-method-registry "1.1.0" + eth-query "^2.1.2" + eth-rpc-errors "^4.0.0" + ethereumjs-util "^7.0.10" + uuid "^8.3.2" + "@metamask/types@^1.1.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@metamask/types/-/types-1.1.0.tgz#9bd14b33427932833c50c9187298804a18c2e025" @@ -5286,6 +5474,11 @@ resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.4.tgz#fcf7205c25dff795ee79af1e30da2c9790808f11" integrity sha512-rZ5drC/jWjrArrS8BR6SIr4cWpW09RNTYt9AMZo3Jwwif+iacXAqgVjm0B0Bv/S1jhDXKHqRVNCbACkJ89RAnQ== +"@types/punycode@^2.1.0": + version "2.1.0" + resolved "https://registry.yarnpkg.com/@types/punycode/-/punycode-2.1.0.tgz#89e4f3d09b3f92e87a80505af19be7e0c31d4e83" + integrity sha512-PG5aLpW6PJOeV2fHRslP4IOMWn+G+Uq8CfnyJ+PDS8ndCbU+soO+fB3NKCKo0p/Jh2Y4aPaiQZsrOXFdzpcA6g== + "@types/puppeteer-core@^5.4.0": version "5.4.0" resolved "https://registry.yarnpkg.com/@types/puppeteer-core/-/puppeteer-core-5.4.0.tgz#880a7917b4ede95cbfe2d5e81a558cfcb072c0fb" @@ -11446,15 +11639,7 @@ ethereumjs-abi@0.6.6: bn.js "^4.10.0" ethereumjs-util "^5.0.0" -ethereumjs-abi@^0.6.8: - version "0.6.8" - resolved "https://registry.yarnpkg.com/ethereumjs-abi/-/ethereumjs-abi-0.6.8.tgz#71bc152db099f70e62f108b7cdfca1b362c6fcae" - integrity sha512-Tx0r/iXI6r+lRsdvkFDlut0N08jWMnKRZ6Gkq+Nmw75lZe4e6o3EkSnkaBP5NF6+m5PTGAr9JP43N3LyeoglsA== - dependencies: - bn.js "^4.11.8" - ethereumjs-util "^6.0.0" - -"ethereumjs-abi@git+https://github.com/ethereumjs/ethereumjs-abi.git": +ethereumjs-abi@^0.6.8, "ethereumjs-abi@git+https://github.com/ethereumjs/ethereumjs-abi.git": version "0.6.8" resolved "git+https://github.com/ethereumjs/ethereumjs-abi.git#ee3994657fa7a427238e6ba92a84d0b529bbcde0" dependencies: