From 5b62796552248a15e6252d8fb79ef6ab2487816a Mon Sep 17 00:00:00 2001 From: Elliot Winkler Date: Tue, 10 Jan 2023 11:34:42 -0700 Subject: [PATCH] Migrate to new controller packages (#5270) * 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 * Setup CI to download from GitHub Packages registry (#5274) CI now supports fetching packages from the GitHub Packages registry on draft PRs. This is meant to support the use of "preview" builds of controller packages, to more easily test controller changes before they are released. --- .github/workflows/ci.yml | 12 + .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 +- .../TransactionDetails/index.js | 4 +- 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 | 22 +- 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 | 13 +- package.json | 14 +- ... @metamask+keyring-controller+1.0.0.patch} | 14 +- yarn.lock | 236 ++++++++++++++---- 62 files changed, 337 insertions(+), 204 deletions(-) rename patches/{@metamask+controllers+33.0.0.patch => @metamask+keyring-controller+1.0.0.patch} (70%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 121e162181f..1b87c145549 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,6 +25,18 @@ jobs: with: path: ${{ steps.yarn-cache-dir.outputs.YARN_CACHE_DIR }} key: yarn-cache-${{ runner.os }}-${{ steps.yarn-version.outputs.YARN_VERSION }}-${{ hashFiles('yarn.lock') }} + - name: Determine whether the current PR is a draft + id: set-is-draft + if: github.event_name == 'pull_request' && github.event.pull_request.number + run: echo "IS_DRAFT=$(gh pr view --json isDraft --jq '.isDraft' "${PR_NUMBER}")" >> "$GITHUB_OUTPUT" + env: + PR_NUMBER: ${{ github.event.pull_request.number }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Setup registry config for using package previews on draft PRs + if: github.event_name == 'pull_request' && steps.set-is-draft.outputs.IS_DRAFT == 'true' + run: printf '%s\n\n%s' '@metamask:registry=https://npm.pkg.github.com' "//npm.pkg.github.com/:_authToken=${PACKAGE_READ_TOKEN}" > .npmrc + env: + PACKAGE_READ_TOKEN: ${{ secrets.PACKAGE_READ_TOKEN }} - run: yarn setup - uses: actions/cache@v3 id: restore-build 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 b5fad11eb5d..c7415a9ee9c 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 BigNumber from 'bignumber.js'; import { getTokenList } from '../../../reducers/tokens'; @@ -139,25 +139,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 5e73ccbe01d..aab57e32c27 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 { @@ -119,7 +119,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 19754dc27f3..2cb01e218f0 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 { @@ -336,7 +336,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 9fc6029cdb1..8252243bee4 100644 --- a/app/components/UI/ApproveTransactionReview/index.js +++ b/app/components/UI/ApproveTransactionReview/index.js @@ -19,7 +19,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 { @@ -66,8 +67,6 @@ import { allowedToBuy } from '../FiatOnRampAggregator'; import { MM_SDK_REMOTE_ORIGIN } from '../../../core/SDKConnect'; import createStyles from './styles'; -const { hexToBN } = util; - const { ORIGIN_DEEPLINK, ORIGIN_QR_CODE } = AppConstants.DEEPLINKS; const POLLING_INTERVAL_ESTIMATED_L1_FEE = 30000; diff --git a/app/components/UI/AssetSearch/index.tsx b/app/components/UI/AssetSearch/index.tsx index 43f68984b95..320baf3afad 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'; import generateTestId from '../../../../wdio/utils/generateTestId'; import { TOKEN_INPUT_BOX_ID } from '../../../../wdio/features/testIDs/Screens/AssetSearch.testIds'; diff --git a/app/components/UI/DrawerView/index.js b/app/components/UI/DrawerView/index.js index 108d9e85c98..add85487376 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 e7b58926bd9..206415def01 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 5ff60dc37a0..d46ba357716 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 a70d61ef18f..0842c1786ba 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 '../../../../wdio/features/testIDs/Components/NetworkEducationModalTestIds'; import { fontStyles } from '../../../styles/common'; -import { util as controllerUtils } from '@metamask/controllers'; +import { isTokenDetectionSupportedForNetwork } from '@metamask/assets-controllers/dist/assetsUtil'; import { NETWORK_EDUCATION_MODAL_CLOSE_BUTTON } from '../../../../wdio/features/testIDs/Screens/NetworksScreen.testids.js'; import { isMainnetByChainId } from '../../../util/networks'; @@ -133,7 +133,7 @@ const NetworkInfo = (props: NetworkInfoProps) => { const { colors } = useTheme(); const styles = createStyles(colors); const isTokenDetectionSupported = - controllerUtils.isTokenDetectionSupportedForNetwork(chainId); + isTokenDetectionSupportedForNetwork(chainId); const isMainnet = isMainnetByChainId(chainId); const isTokenDetectionEnabledForNetwork = useMemo(() => { 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..8bb9b96b627 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/dist/assetsUtil'; const KEYBOARD_OFFSET = 120; const createStyles = (colors) => diff --git a/app/components/UI/PersonalSign/index.js b/app/components/UI/PersonalSign/index.js index 7f5b42c1197..12a54b62884 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'; @@ -192,8 +192,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 6909b541b92..26f93655618 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/TransactionDetails/index.js b/app/components/UI/TransactionElement/TransactionDetails/index.js index 9f20e064779..f7b028a3b4b 100644 --- a/app/components/UI/TransactionElement/TransactionDetails/index.js +++ b/app/components/UI/TransactionElement/TransactionDetails/index.js @@ -1,7 +1,7 @@ import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { TouchableOpacity, StyleSheet, View } from 'react-native'; -import { util } from '@metamask/controllers'; +import { query } from '@metamask/controller-utils'; import { connect } from 'react-redux'; import URL from 'url-parse'; @@ -125,7 +125,7 @@ class TransactionDetails extends PureComponent { fetchTxReceipt = async (transactionHash) => { const { TransactionController } = Engine.context; - return await util.query( + return await query( TransactionController.ethQuery, 'getTransactionReceipt', [transactionHash], 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 6782f7ad881..3dfcf8b6e8c 100644 --- a/app/components/UI/TransactionElement/utils.js +++ b/app/components/UI/TransactionElement/utils.js @@ -33,8 +33,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 559a100f157..8fc1fb1d0ae 100644 --- a/app/components/UI/TransactionReview/TransactionReviewInformation/index.js +++ b/app/components/UI/TransactionReview/TransactionReviewInformation/index.js @@ -35,7 +35,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 618fa7c9764..9efb557649f 100644 --- a/app/components/Views/AddAsset/index.js +++ b/app/components/Views/AddAsset/index.js @@ -11,7 +11,7 @@ import { strings } from '../../../../locales/i18n'; import AddCustomCollectible from '../../UI/AddCustomCollectible'; import { getNetworkNavbarOptions } from '../../UI/Navbar'; import CollectibleDetectionModal from '../../UI/CollectibleDetectionModal'; -import { util as controllerUtils } from '@metamask/controllers'; +import { isTokenDetectionSupportedForNetwork } from '@metamask/assets-controllers/dist/assetsUtil'; import { ThemeContext, mockTheme } from '../../../util/theme'; import { MAINNET } from '../../../constants/network'; @@ -132,7 +132,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 23bd1a26837..f22b2c4993d 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 2b4b3369eeb..df41382ac79 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 fcb8648e81b..84e3090b263 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 bb374702cb8..f55b5ea82a0 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 a488655ed53..6e17839d795 100644 --- a/app/components/Views/Send/index.js +++ b/app/components/Views/Send/index.js @@ -41,7 +41,7 @@ import { isENS, isValidHexAddress } 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'; diff --git a/app/components/Views/SendFlow/Amount/index.js b/app/components/Views/SendFlow/Amount/index.js index 47cfdd2a3e8..b2e7b1f6931 100644 --- a/app/components/Views/SendFlow/Amount/index.js +++ b/app/components/Views/SendFlow/Amount/index.js @@ -49,7 +49,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'; @@ -79,8 +80,6 @@ import { } from '../../../../../wdio/features/testIDs/Screens/AmountScreen.testIds.js'; import generateTestId from '../../../../../wdio/utils/generateTestId'; -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 b4ec86d8732..6cf875a5893 100644 --- a/app/components/Views/SendFlow/Confirm/index.js +++ b/app/components/Views/SendFlow/Confirm/index.js @@ -29,12 +29,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, @@ -100,8 +97,6 @@ const EDIT_EIP1559 = 'edit_eip1559'; const REVIEW = 'review'; const POLLING_INTERVAL_ESTIMATED_L1_FEE = 30000; -const { hexToBN, BNToHex } = util; - let intervalIdForEstimatedL1Fee; /** diff --git a/app/components/Views/SendFlow/SendTo/index.js b/app/components/Views/SendFlow/SendTo/index.js index ffcc31a10e1..8bdc21a2482 100644 --- a/app/components/Views/SendFlow/SendTo/index.js +++ b/app/components/Views/SendFlow/SendTo/index.js @@ -11,7 +11,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'; @@ -68,8 +68,6 @@ import { ADD_ADDRESS_BUTTON } from '../../../../../wdio/features/testIDs/Screens import { ENTER_ALIAS_INPUT_BOX_ID } from '../../../../../wdio/features/testIDs/Screens/AddressBook.testids'; import generateTestId from '../../../../../wdio/utils/generateTestId'; -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..e246d256de7 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/dist/assetsUtil'; 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 d93ea112037..58b22e9a998 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 29d3eaf5c75..ff77bd042e6 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 55381d66fad..d5a840957f5 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 4e6f45cc017..bd63b0b561b 100644 --- a/app/util/address/index.js +++ b/app/util/address/index.js @@ -8,7 +8,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 87557aa9b5a..d35de12ca80 100644 --- a/app/util/networks/index.js +++ b/app/util/networks/index.js @@ -3,7 +3,6 @@ import { utils } from 'ethers'; import EthContract from 'ethjs-contract'; import { getContractFactory } from '@eth-optimism/contracts/dist/contract-defs'; import { predeploys } from '@eth-optimism/contracts/dist/predeploys'; -import { util } from '@metamask/controllers'; import AppConstants from '../../core/AppConstants'; import { @@ -16,6 +15,7 @@ import { NETWORKS_CHAIN_ID, } from '../../../app/constants/network'; import { NetworkSwitchErrorType } from '../../../app/constants/error'; +import { query } from '@metamask/controller-utils'; import Engine from '../../core/Engine'; import { toLowerCaseEquals } from './../general'; import { fastSplit } from '../../util/number'; @@ -253,7 +253,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 b19764062a6..2397d7ad375 100644 --- a/app/util/number/index.js +++ b/app/util/number/index.js @@ -4,11 +4,12 @@ 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 BigNumber from 'bignumber.js'; import currencySymbols from '../currency-symbols.json'; +export { BNToHex, hexToBN }; // Big Number Constants const BIG_NUMBER_WEI_MULTIPLIER = new BigNumber('1000000000000000000'); @@ -39,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. @@ -324,16 +316,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 e758f4a2496..59e00879a55 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'; @@ -294,9 +295,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; } @@ -1303,7 +1304,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 3b0ebeba8d6..7994cf55fb5 100644 --- a/app/util/transactions/index.test.ts +++ b/app/util/transactions/index.test.ts @@ -1,7 +1,9 @@ import { swapsUtils } from '@metamask/swaps-controller'; -import { util } from '@metamask/controllers'; import { BN } from 'ethereumjs-util'; +/* 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'; @@ -21,6 +23,10 @@ import { buildUnserializedTransaction } from './optimismTransaction'; 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; @@ -39,14 +45,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 dbe27de725a..203717a8541 100644 --- a/package.json +++ b/package.json @@ -134,12 +134,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.1", + "@metamask/approval-controller": "^1.0.1", + "@metamask/assets-controllers": "^1.0.0", + "@metamask/base-controller": "^1.1.1", + "@metamask/composable-controller": "^1.0.1", "@metamask/contract-metadata": "^2.1.0", - "@metamask/controllers": "^33.0.0", + "@metamask/controller-utils": "^1.0.0", "@metamask/design-tokens": "^1.9.0", "@metamask/etherscan-link": "^2.0.0", + "@metamask/gas-fee-controller": "^1.0.0", + "@metamask/keyring-controller": "^1.0.1", + "@metamask/message-manager": "^1.0.1", + "@metamask/network-controller": "^1.0.0", + "@metamask/phishing-controller": "^1.1.0", + "@metamask/preferences-controller": "^1.0.1", "@metamask/sdk-communication-layer": "^0.1.0", "@metamask/swaps-controller": "^6.8.0", + "@metamask/transaction-controller": "^1.0.0", "@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/patches/@metamask+controllers+33.0.0.patch b/patches/@metamask+keyring-controller+1.0.0.patch similarity index 70% rename from patches/@metamask+controllers+33.0.0.patch rename to patches/@metamask+keyring-controller+1.0.0.patch index cf2fbc1bc68..772f8f70dd9 100644 --- a/patches/@metamask+controllers+33.0.0.patch +++ b/patches/@metamask+keyring-controller+1.0.0.patch @@ -1,8 +1,8 @@ -diff --git a/node_modules/@metamask/controllers/dist/keyring/KeyringController.js b/node_modules/@metamask/controllers/dist/keyring/KeyringController.js -index 906985d..6984571 100644 ---- a/node_modules/@metamask/controllers/dist/keyring/KeyringController.js -+++ b/node_modules/@metamask/controllers/dist/keyring/KeyringController.js -@@ -125,6 +125,7 @@ class KeyringController extends BaseController_1.BaseController { +diff --git a/node_modules/@metamask/keyring-controller/dist/KeyringController.js b/node_modules/@metamask/keyring-controller/dist/KeyringController.js +index a5e5af1..5ebd437 100644 +--- a/node_modules/@metamask/keyring-controller/dist/KeyringController.js ++++ b/node_modules/@metamask/keyring-controller/dist/KeyringController.js +@@ -125,6 +125,7 @@ class KeyringController extends base_controller_1.BaseController { } /** * Adds a new account to the default (first) HD seed phrase keyring. @@ -10,7 +10,7 @@ index 906985d..6984571 100644 * * @returns Promise resolving to current state when the account is added. */ -@@ -140,12 +141,13 @@ class KeyringController extends BaseController_1.BaseController { +@@ -140,12 +141,13 @@ class KeyringController extends base_controller_1.BaseController { const newAccounts = yield __classPrivateFieldGet(this, _KeyringController_keyring, "f").getAccounts(); yield this.verifySeedPhrase(); this.updateIdentities(newAccounts); @@ -26,7 +26,7 @@ index 906985d..6984571 100644 }); } /** -@@ -313,8 +315,8 @@ class KeyringController extends BaseController_1.BaseController { +@@ -313,8 +315,8 @@ class KeyringController extends base_controller_1.BaseController { const accounts = yield newKeyring.getAccounts(); const allAccounts = yield __classPrivateFieldGet(this, _KeyringController_keyring, "f").getAccounts(); this.updateIdentities(allAccounts); diff --git a/yarn.lock b/yarn.lock index 79afef21d66..fd2fb24ee17 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3886,6 +3886,68 @@ semver "^7.3.5" tar "^6.1.11" +"@metamask/address-book-controller@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@metamask/address-book-controller/-/address-book-controller-1.0.1.tgz#74edc9949910fc69dcda560b552dae793536e46e" + integrity sha512-sME+RkxgymWyjRMjoQ71DdRrAjh9WCIDFQySnRXpVdRx/Pp4EoM8tzqrz/arRsk/xDCQv1hw6n0JcnrXovIR7w== + dependencies: + "@metamask/base-controller" "^1.1.1" + "@metamask/controller-utils" "^1.0.0" + +"@metamask/approval-controller@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@metamask/approval-controller/-/approval-controller-1.0.1.tgz#903e44e762b209c95d0fc7aed8cb3870d0baead0" + integrity sha512-QpIE5z+3wRZyt2cHJ8kbG7xxI+VBLBbo5qUi56/XPTtKn8lo6dpP3oznMVSjdEe926tShLPSR0mHLVaE0saX5w== + dependencies: + "@metamask/base-controller" "^1.1.1" + "@metamask/controller-utils" "^1.0.0" + eth-rpc-errors "^4.0.0" + immer "^9.0.6" + nanoid "^3.1.31" + +"@metamask/assets-controllers@^1.0.0": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@metamask/assets-controllers/-/assets-controllers-1.0.1.tgz#b9268628590617c34d86dd25e8e619c0a7443a7e" + integrity sha512-Bh7JXzCNKb2QdVTanv5YGZmr69sH8xKml0Y9M/xNkrLZburJDHn7ybAVmOZYh68Tm2gmw1AiO4s+uwPCktonVw== + 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.1.0" + "@metamask/contract-metadata" "^1.35.0" + "@metamask/controller-utils" "~1.0.0" + "@metamask/metamask-eth-abis" "3.0.0" + "@metamask/network-controller" "~1.0.0" + "@metamask/preferences-controller" "~1.0.0" + "@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.1.1", "@metamask/base-controller@~1.1.0": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@metamask/base-controller/-/base-controller-1.1.1.tgz#34c2db471328b92a3a46f9c2547bbb9d37803258" + integrity sha512-erDfd+OcHnixSZObPNHuDn2G3rRT2B9J/JaOmjjQN64o9RqDYid87Zb0z03wK8cbJ/pEHhhDIBn6t2gMWcdwrQ== + dependencies: + "@metamask/controller-utils" "^1.0.0" + immer "^9.0.6" + +"@metamask/base-controller@~1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@metamask/base-controller/-/base-controller-1.0.0.tgz#9de86efafdf88b46f6d3710f8708a9515fd8ecf6" + integrity sha512-bZnv/P3Zb247vVS4HT3lvlNdi0JNT5mt3dWBtWj6c9C/AVR9LDeTUz7nIPxzvm9lwDZktYgp+GXDDr/LfDKkAQ== + dependencies: + "@metamask/controller-utils" "~1.0.0" + 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" @@ -3896,63 +3958,38 @@ pbkdf2 "^3.0.9" randombytes "^2.0.1" +"@metamask/composable-controller@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@metamask/composable-controller/-/composable-controller-1.0.1.tgz#552cadb92a4bd302063b8c90b0d55cd02dd5f75b" + integrity sha512-UHsikxSqnOK9fih7eEYwADqp8RgLVMRjzlc9MO7wEEzJFHsLLgwsk3vGkc3optnFc2GCdbHsmDBRQJSBWXmjog== + dependencies: + "@metamask/base-controller" "^1.1.1" + "@metamask/contract-metadata@^1.31.0", "@metamask/contract-metadata@^1.35.0", "@metamask/contract-metadata@^2.1.0": version "2.1.0" resolved "https://registry.yarnpkg.com/@metamask/contract-metadata/-/contract-metadata-2.1.0.tgz#78f9e32afea61548922e57ef57ee6eb99abf35be" integrity sha512-jPeoNmEonnmtzSIsBGAshy9SCFMkLfURB7d7pkEY1lmRtrhPYv3DTkMpffJciikaCPjyJ62eLWX/6Kme4CPvNg== -"@metamask/controllers@^26.0.0": - version "26.0.0" - resolved "git+https://github.com/MetaMask/controllers.git#d4e9507d9612f2d36c3f848333b33330a19b811b" +"@metamask/controller-utils@^1.0.0", "@metamask/controller-utils@~1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@metamask/controller-utils/-/controller-utils-1.0.0.tgz#2e2261b65c3f38ba0c5b893743fca8cce764339c" + integrity sha512-LXIpnmF/C5/vCBX0u2DiUWA55utZy54guUV+A8qUYmz8PvZrXfK7mdq1zlk8z0aq+aO0rHHfSVbTNacEE3TlAQ== 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" 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" @@ -3962,14 +3999,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" @@ -4026,6 +4064,51 @@ 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": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@metamask/gas-fee-controller/-/gas-fee-controller-1.0.0.tgz#d0922ce83c69ac7adaf1b5957d206190283efba7" + integrity sha512-qzpS4lCzBDhWWwq+YmDXwGQdhNrXvsX3ltQYPI5RGPn5x3WYgyhvULdaP+nzk/wxH2sshPNNyyUmP6DhE+aYHQ== + dependencies: + "@metamask/base-controller" "~1.0.0" + "@metamask/controller-utils" "~1.0.0" + "@metamask/network-controller" "~1.0.0" + "@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.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@metamask/keyring-controller/-/keyring-controller-1.0.1.tgz#c2836bbafaab8c2d1300f4e56aad3b32b3dd90c0" + integrity sha512-D7+GbSvE5B0DqPyfeTypkShoj8tATUM64a/Nb9FmqYW20slZ4TMUAdbMOHi6KqZnaZcKu8oOUTxEiRe+MsRGAw== + dependencies: + "@keystonehq/metamask-airgapped-keyring" "^0.6.1" + "@metamask/base-controller" "^1.1.1" + "@metamask/controller-utils" "^1.0.0" + "@metamask/message-manager" "^1.0.1" + "@metamask/preferences-controller" "^1.0.1" + 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.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@metamask/message-manager/-/message-manager-1.0.1.tgz#5834fb5ed14a844f35f796268966745a966847ed" + integrity sha512-8IvTS6T4gZm7mL8+xUwWHOMGuXaMF3OZJB5g34taASp0p5pXHoLNEXL+qBaw0RkgDxbFsuij02Gs3Mx/jQ6U6A== + dependencies: + "@metamask/base-controller" "^1.1.1" + "@metamask/controller-utils" "^1.0.0" + "@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" @@ -4036,6 +4119,20 @@ resolved "https://registry.yarnpkg.com/@metamask/mobile-provider/-/mobile-provider-2.1.0.tgz#685b2f6a55d24197af3f26de4dd0bb78e10ac83e" integrity sha512-VuVUIZ5jEQmLaU8SJC8692crxtNncsxyR9q5j1J6epyMHUU75WTtQdq7VSsu1ghkmP9NXNAz3inlWOGsbT8lLA== +"@metamask/network-controller@^1.0.0", "@metamask/network-controller@~1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@metamask/network-controller/-/network-controller-1.0.0.tgz#35180bdc56c918719eaa1e00455faa55ecf87824" + integrity sha512-i/7IMqFqbnfZZY8jVs/ptG0aaU8Po01/7kQ5aZgWR+sk7FxdOzs6rYD78qm5f6bU2PNBDSTN3TyN29n50ksmIA== + dependencies: + "@metamask/base-controller" "~1.0.0" + "@metamask/controller-utils" "~1.0.0" + 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" @@ -4044,6 +4141,26 @@ "@metamask/safe-event-emitter" "^2.0.0" through2 "^2.0.3" +"@metamask/phishing-controller@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@metamask/phishing-controller/-/phishing-controller-1.1.0.tgz#39c1ef109b9a7927d7758c127c6f1a26799fa273" + integrity sha512-Ehl2CDlvi2kYuBuYcL7YOxfrHQvX7Pkny8RQ2VhvIS7UBx2uKnfEmNCgdwS319eYqRKaxmd5a7ZDi96uFp1NSg== + dependencies: + "@metamask/base-controller" "^1.1.1" + "@metamask/controller-utils" "^1.0.0" + "@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.1", "@metamask/preferences-controller@~1.0.0": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@metamask/preferences-controller/-/preferences-controller-1.0.1.tgz#20f2187be103a1e7f49df4021e39afb12ee422a0" + integrity sha512-6fAruDd9sag/hwJGKIP0eSdYC92J/wkDnigQo7ONpu7n94giot7vvsR5+4zNjC32tLa5GpHG50PynZaHfYzK0Q== + dependencies: + "@metamask/base-controller" "^1.1.1" + "@metamask/controller-utils" "^1.0.0" + "@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" @@ -4073,6 +4190,24 @@ human-standard-token-abi "^2.0.0" web3 "^0.20.7" +"@metamask/transaction-controller@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@metamask/transaction-controller/-/transaction-controller-1.0.0.tgz#0109c4348be85a4ae92f76e222e0dc3218b6c399" + integrity sha512-+9txZtGCR+0GRb6FYkVijc6IIj3pSDmanWnJSYr8L9R0FPP2har+x4JJy6OXPNxrPNDZKKpGiqCT/RNvLYDF/A== + dependencies: + "@ethereumjs/common" "^2.3.1" + "@ethereumjs/tx" "^3.2.1" + "@metamask/base-controller" "~1.0.0" + "@metamask/controller-utils" "~1.0.0" + "@metamask/network-controller" "~1.0.0" + 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" @@ -5447,6 +5582,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" @@ -11652,15 +11792,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: