diff --git a/app/components/UI/Transactions/index.js b/app/components/UI/Transactions/index.js index 19d25f14e24..258ab24e89e 100644 --- a/app/components/UI/Transactions/index.js +++ b/app/components/UI/Transactions/index.js @@ -52,7 +52,7 @@ import RetryModal from './RetryModal'; import PriceChartContext, { PriceChartProvider, } from '../AssetOverview/PriceChart/PriceChart.context'; -import { ethErrors } from 'eth-rpc-errors'; +import { providerErrors } from '@metamask/rpc-errors'; import { selectConversionRate, selectCurrentCurrency, @@ -578,7 +578,7 @@ class Transactions extends PureComponent { cancelUnsignedQRTransaction = async (tx) => { await Engine.context.ApprovalController.reject( tx.id, - ethErrors.provider.userRejectedRequest(), + providerErrors.userRejectedRequest(), ); }; diff --git a/app/components/Views/confirmations/Approval/index.js b/app/components/Views/confirmations/Approval/index.js index 03a7ef623a4..7df6611a41f 100644 --- a/app/components/Views/confirmations/Approval/index.js +++ b/app/components/Views/confirmations/Approval/index.js @@ -41,7 +41,7 @@ import { selectProviderType, } from '../../../../selectors/networkController'; import { selectSelectedAddress } from '../../../../selectors/preferencesController'; -import { ethErrors } from 'eth-rpc-errors'; +import { providerErrors } from '@metamask/rpc-errors'; import { getLedgerKeyring } from '../../../../core/Ledger/Ledger'; import ExtendedKeyringTypes from '../../../../constants/keyringTypes'; import { getBlockaidMetricsParams } from '../../../../util/blockaid'; @@ -153,7 +153,7 @@ class Approval extends PureComponent { } else { Engine.rejectPendingApproval( transaction?.id, - ethErrors.provider.userRejectedRequest(), + providerErrors.userRejectedRequest(), { ignoreMissing: true, logErrors: false, @@ -197,7 +197,7 @@ class Approval extends PureComponent { if (transaction?.id && this.isTxStatusCancellable(currentTransaction)) { Engine.rejectPendingApproval( transaction.id, - ethErrors.provider.userRejectedRequest(), + providerErrors.userRejectedRequest(), { ignoreMissing: true, logErrors: false, diff --git a/app/components/Views/confirmations/ApproveView/Approve/index.js b/app/components/Views/confirmations/ApproveView/Approve/index.js index 879b5bc5266..702a5159c3f 100644 --- a/app/components/Views/confirmations/ApproveView/Approve/index.js +++ b/app/components/Views/confirmations/ApproveView/Approve/index.js @@ -69,7 +69,7 @@ import { } from '../../../../../selectors/accountTrackerController'; import ShowBlockExplorer from '../../components/ApproveTransactionReview/ShowBlockExplorer'; import createStyles from './styles'; -import { ethErrors } from 'eth-rpc-errors'; +import { providerErrors } from '@metamask/rpc-errors'; import { getLedgerKeyring } from '../../../../../core/Ledger/Ledger'; import ExtendedKeyringTypes from '../../../../../constants/keyringTypes'; import { updateTransaction } from '../../../../../util/transaction-controller'; @@ -337,7 +337,7 @@ class Approve extends PureComponent { if (!approved) Engine.rejectPendingApproval( transaction.id, - ethErrors.provider.userRejectedRequest(), + providerErrors.userRejectedRequest(), { ignoreMissing: true, logErrors: false, @@ -351,7 +351,7 @@ class Approve extends PureComponent { const { transaction } = this.props; Engine.rejectPendingApproval( transaction?.id, - ethErrors.provider.userRejectedRequest(), + providerErrors.userRejectedRequest(), { ignoreMissing: true, logErrors: false, @@ -594,7 +594,7 @@ class Approve extends PureComponent { const { metrics, hideModal } = this.props; Engine.rejectPendingApproval( this.props.transaction.id, - ethErrors.provider.userRejectedRequest(), + providerErrors.userRejectedRequest(), { ignoreMissing: true, logErrors: false, diff --git a/app/components/Views/confirmations/Send/index.js b/app/components/Views/confirmations/Send/index.js index 01f584c1496..97664147a49 100644 --- a/app/components/Views/confirmations/Send/index.js +++ b/app/components/Views/confirmations/Send/index.js @@ -60,7 +60,7 @@ import { selectIdentities, selectSelectedAddress, } from '../../../../selectors/preferencesController'; -import { ethErrors } from 'eth-rpc-errors'; +import { providerErrors } from '@metamask/rpc-errors'; import { withMetricsAwareness } from '../../../../components/hooks/useMetrics'; const REVIEW = 'review'; @@ -520,7 +520,7 @@ class Send extends PureComponent { onCancel = (id) => { Engine.context.ApprovalController.reject( id, - ethErrors.provider.userRejectedRequest(), + providerErrors.userRejectedRequest(), ); this.props.navigation.pop(); this.unmountHandled = true; diff --git a/app/components/Views/confirmations/hooks/useApprovalRequest.test.ts b/app/components/Views/confirmations/hooks/useApprovalRequest.test.ts index fd0e559cc4c..f7e459f9530 100644 --- a/app/components/Views/confirmations/hooks/useApprovalRequest.test.ts +++ b/app/components/Views/confirmations/hooks/useApprovalRequest.test.ts @@ -2,7 +2,7 @@ import { ApprovalControllerState } from '@metamask/approval-controller'; import { useSelector } from 'react-redux'; import useApprovalRequest from './useApprovalRequest'; import Engine from '../../../../core/Engine'; -import { ethErrors } from 'eth-rpc-errors'; +import { providerErrors } from '@metamask/rpc-errors'; jest.mock('react-redux', () => ({ ...jest.requireActual('react-redux'), @@ -143,7 +143,7 @@ describe('useApprovalRequest', () => { expect(Engine.rejectPendingApproval).toHaveBeenCalledTimes(1); expect(Engine.rejectPendingApproval).toHaveBeenCalledWith( APPROVAL_REQUEST.id, - ethErrors.provider.userRejectedRequest(), + providerErrors.userRejectedRequest(), ); }); diff --git a/app/components/Views/confirmations/hooks/useApprovalRequest.ts b/app/components/Views/confirmations/hooks/useApprovalRequest.ts index 05957991b86..c65f23ee86d 100644 --- a/app/components/Views/confirmations/hooks/useApprovalRequest.ts +++ b/app/components/Views/confirmations/hooks/useApprovalRequest.ts @@ -1,6 +1,6 @@ import Engine from '../../../../core/Engine'; import { useCallback } from 'react'; -import { ethErrors } from 'eth-rpc-errors'; +import { providerErrors } from '@metamask/rpc-errors'; import { useSelector } from 'react-redux'; import { selectPendingApprovals } from '../../../../selectors/approvalController'; import { cloneDeep, isEqual } from 'lodash'; @@ -36,7 +36,7 @@ const useApprovalRequest = () => { Engine.rejectPendingApproval( approvalRequest.id, - ethErrors.provider.userRejectedRequest(), + providerErrors.userRejectedRequest(), ); }, [approvalRequest]); diff --git a/app/core/BackgroundBridge/BackgroundBridge.js b/app/core/BackgroundBridge/BackgroundBridge.js index 79945ce0a24..95d0bf1d41a 100644 --- a/app/core/BackgroundBridge/BackgroundBridge.js +++ b/app/core/BackgroundBridge/BackgroundBridge.js @@ -1,7 +1,7 @@ /* eslint-disable import/no-commonjs */ import URL from 'url-parse'; import { ChainId } from '@metamask/controller-utils'; -import { JsonRpcEngine } from 'json-rpc-engine'; +import { JsonRpcEngine } from '@metamask/json-rpc-engine'; import MobilePortStream from '../MobilePortStream'; import { setupMultiplex } from '../../util/streams'; import { @@ -27,8 +27,8 @@ import snapMethodMiddlewareBuilder from '../Snaps/SnapsMethodMiddleware'; import { SubjectType } from '@metamask/permission-controller'; ///: END:ONLY_INCLUDE_IF -const createFilterMiddleware = require('eth-json-rpc-filters'); -const createSubscriptionManager = require('eth-json-rpc-filters/subscriptionManager'); +const createFilterMiddleware = require('@metamask/eth-json-rpc-filters'); +const createSubscriptionManager = require('@metamask/eth-json-rpc-filters/subscriptionManager'); const providerAsMiddleware = require('eth-json-rpc-middleware/providerAsMiddleware'); const pump = require('pump'); // eslint-disable-next-line import/no-nodejs-modules diff --git a/app/core/Engine.ts b/app/core/Engine.ts index 1445c99d9ed..1415d6d5ab9 100644 --- a/app/core/Engine.ts +++ b/app/core/Engine.ts @@ -171,7 +171,7 @@ import { import { hasProperty, Json } from '@metamask/utils'; // TODO: Export this type from the package directly import { SwapsState } from '@metamask/swaps-controller/dist/SwapsController'; -import { ethErrors } from 'eth-rpc-errors'; +import { providerErrors } from '@metamask/rpc-errors'; import { PPOM, ppomInit } from '../lib/ppom/PPOMView'; import RNFSStorageBackend from '../lib/ppom/ppom-storage-backend'; @@ -1539,7 +1539,7 @@ class Engine { rejectPendingApproval( id: string, - reason: Error = ethErrors.provider.userRejectedRequest(), + reason: Error = providerErrors.userRejectedRequest(), opts: { ignoreMissing?: boolean; logErrors?: boolean } = {}, ) { const { ApprovalController } = this.context; diff --git a/app/core/Permissions/index.ts b/app/core/Permissions/index.ts index 14d68e87632..13ebf1f85e3 100644 --- a/app/core/Permissions/index.ts +++ b/app/core/Permissions/index.ts @@ -1,4 +1,4 @@ -import { errorCodes as rpcErrorCodes } from 'eth-rpc-errors'; +import { errorCodes as rpcErrorCodes } from '@metamask/rpc-errors'; import { orderBy } from 'lodash'; import { RestrictedMethods, CaveatTypes } from './constants'; import ImportedEngine from '../Engine'; diff --git a/app/core/RPCMethods/RPCMethodMiddleware.test.ts b/app/core/RPCMethods/RPCMethodMiddleware.test.ts index eca083b4c70..e2b7fe96db4 100644 --- a/app/core/RPCMethods/RPCMethodMiddleware.test.ts +++ b/app/core/RPCMethods/RPCMethodMiddleware.test.ts @@ -5,10 +5,10 @@ import { JsonRpcRequest, JsonRpcResponse, JsonRpcSuccess, -} from 'json-rpc-engine'; +} from '@metamask/json-rpc-engine'; import type { Transaction } from '@metamask/transaction-controller'; import type { ProviderConfig } from '@metamask/network-controller'; -import { ethErrors } from 'eth-rpc-errors'; +import { providerErrors, rpcErrors } from '@metamask/rpc-errors'; import Engine from '../Engine'; import { store } from '../../store'; import { getPermittedAccounts } from '../Permissions'; @@ -572,7 +572,7 @@ describe('getRpcMethodMiddleware', () => { method: 'eth_sendTransaction', params: [mockTransactionParameters], }; - const expectedError = ethErrors.provider.userRejectedRequest(); + const expectedError = providerErrors.userRejectedRequest(); const response = await callMiddleware({ middleware, request }); @@ -611,7 +611,7 @@ describe('getRpcMethodMiddleware', () => { method: 'eth_sendTransaction', params: [mockTransactionParameters], }; - const expectedError = ethErrors.rpc.invalidParams({ + const expectedError = rpcErrors.invalidParams({ message: `Invalid parameters: must provide an Ethereum address.`, }); @@ -684,7 +684,7 @@ describe('getRpcMethodMiddleware', () => { method: 'eth_sendTransaction', params: [mockTransactionParameters], }; - const expectedError = ethErrors.rpc.invalidParams({ + const expectedError = rpcErrors.invalidParams({ message: `Invalid parameters: must provide an Ethereum address.`, }); @@ -759,7 +759,7 @@ describe('getRpcMethodMiddleware', () => { method: 'eth_sendTransaction', params: [mockTransactionParameters], }; - const expectedError = ethErrors.rpc.invalidParams({ + const expectedError = rpcErrors.invalidParams({ message: `Invalid parameters: must provide an Ethereum address.`, }); @@ -845,7 +845,7 @@ describe('getRpcMethodMiddleware', () => { method: 'eth_sendTransaction', params: [mockTransactionParameters], }; - const expectedError = ethErrors.rpc.internal('Failed to add transaction'); + const expectedError = rpcErrors.internal('Failed to add transaction'); const response = await callMiddleware({ middleware, request }); @@ -874,9 +874,7 @@ describe('getRpcMethodMiddleware', () => { method: 'eth_sendTransaction', params: [mockTransactionParameters], }; - const expectedError = ethErrors.rpc.internal( - 'Failed to process transaction', - ); + const expectedError = rpcErrors.internal('Failed to process transaction'); const response = await callMiddleware({ middleware, request }); @@ -949,9 +947,7 @@ describe('getRpcMethodMiddleware', () => { method: 'personal_ecRecover', params: [helloWorldMessage], }; - const expectedError = ethErrors.rpc.internal( - 'Missing signature parameter', - ); + const expectedError = rpcErrors.internal('Missing signature parameter'); const response = await callMiddleware({ middleware, request }); @@ -972,7 +968,7 @@ describe('getRpcMethodMiddleware', () => { method: 'personal_ecRecover', params: [undefined, helloWorldSignature], }; - const expectedError = ethErrors.rpc.internal('Missing data parameter'); + const expectedError = rpcErrors.internal('Missing data parameter'); const response = await callMiddleware({ middleware, request }); diff --git a/app/core/RPCMethods/RPCMethodMiddleware.ts b/app/core/RPCMethods/RPCMethodMiddleware.ts index 9ff5444a3a7..ebbbae26794 100644 --- a/app/core/RPCMethods/RPCMethodMiddleware.ts +++ b/app/core/RPCMethods/RPCMethodMiddleware.ts @@ -3,8 +3,8 @@ import { getVersion } from 'react-native-device-info'; import { createAsyncMiddleware, JsonRpcEngineCallbackError, -} from 'json-rpc-engine'; -import { ethErrors } from 'eth-rpc-errors'; +} from '@metamask/json-rpc-engine'; +import { providerErrors, rpcErrors } from '@metamask/rpc-errors'; import { EndFlowOptions, StartFlowOptions, @@ -146,14 +146,14 @@ export const checkActiveAccountAndChainId = async ({ isInvalidAccount = true; if (accounts.length > 0) { // Permissions issue --- requesting incorrect address - throw ethErrors.rpc.invalidParams({ + throw rpcErrors.invalidParams({ message: `Invalid parameters: must provide a permitted Ethereum address.`, }); } } if (isInvalidAccount) { - throw ethErrors.rpc.invalidParams({ + throw rpcErrors.invalidParams({ message: `Invalid parameters: must provide an Ethereum address.`, }); } @@ -190,7 +190,7 @@ export const checkActiveAccountAndChainId = async ({ Alert.alert( `Active chainId is ${activeChainId} but received ${chainIdRequest}`, ); - throw ethErrors.rpc.invalidParams({ + throw rpcErrors.invalidParams({ message: `Invalid parameters: active chainId is different than the one provided.`, }); } @@ -302,7 +302,7 @@ export const getRpcMethodMiddleware = ({ if (!tabId) return true; const { browser } = store.getState(); if (tabId !== browser.activeTab) - throw ethErrors.provider.userRejectedRequest(); + throw providerErrors.userRejectedRequest(); }; const getSource = () => { @@ -315,7 +315,7 @@ export const getRpcMethodMiddleware = ({ const startApprovalFlow = (opts: StartFlowOptions) => { checkTabActive(); Engine.context.ApprovalController.clear( - ethErrors.provider.userRejectedRequest(), + providerErrors.userRejectedRequest(), ); return Engine.context.ApprovalController.startFlow(opts); @@ -333,7 +333,7 @@ export const getRpcMethodMiddleware = ({ const requestUserApproval = async ({ type = '', requestData = {} }) => { checkTabActive(); await Engine.context.ApprovalController.clear( - ethErrors.provider.userRejectedRequest(), + providerErrors.userRejectedRequest(), ); const responseData = await Engine.context.ApprovalController.add({ @@ -513,7 +513,7 @@ export const getRpcMethodMiddleware = ({ } catch (error) { DevLogger.log(`eth_requestAccounts error`, error); if (error) { - throw ethErrors.provider.userRejectedRequest( + throw providerErrors.userRejectedRequest( 'User denied account authorization.', ); } @@ -561,7 +561,7 @@ export const getRpcMethodMiddleware = ({ eth_signTransaction: async () => { // This is implemented later in our middleware stack – specifically, in // eth-json-rpc-middleware – but our UI does not support it. - throw ethErrors.rpc.methodNotSupported(); + throw rpcErrors.methodNotSupported(); }, eth_sign: async () => { const { SignatureController, PreferencesController } = Engine.context; @@ -569,7 +569,7 @@ export const getRpcMethodMiddleware = ({ const { eth_sign } = disabledRpcMethodPreferences; if (!eth_sign) { - throw ethErrors.rpc.methodNotFound( + throw rpcErrors.methodNotFound( 'eth_sign has been disabled. You must enable it in the advanced settings', ); } @@ -605,7 +605,7 @@ export const getRpcMethodMiddleware = ({ res.result = rawSig; } else { res.result = AppConstants.ETH_SIGN_ERROR; - throw ethErrors.rpc.invalidParams(AppConstants.ETH_SIGN_ERROR); + throw rpcErrors.invalidParams(AppConstants.ETH_SIGN_ERROR); } }, @@ -782,7 +782,7 @@ export const getRpcMethodMiddleware = ({ resolve(); }, onScanError: (e: { toString: () => any }) => { - throw ethErrors.rpc.internal(e.toString()); + throw rpcErrors.internal(e.toString()); }, }); }), @@ -793,7 +793,7 @@ export const getRpcMethodMiddleware = ({ metamask_removeFavorite: async () => { checkTabActive(); if (!isHomepage()) { - throw ethErrors.provider.unauthorized('Forbidden.'); + throw providerErrors.unauthorized('Forbidden.'); } const { bookmarks } = store.getState(); @@ -836,7 +836,7 @@ export const getRpcMethodMiddleware = ({ metamask_showTutorial: async () => { checkTabActive(); if (!isHomepage()) { - throw ethErrors.provider.unauthorized('Forbidden.'); + throw providerErrors.unauthorized('Forbidden.'); } wizardScrollAdjusted.current = false; @@ -850,7 +850,7 @@ export const getRpcMethodMiddleware = ({ metamask_showAutocomplete: async () => { checkTabActive(); if (!isHomepage()) { - throw ethErrors.provider.unauthorized('Forbidden.'); + throw providerErrors.unauthorized('Forbidden.'); } fromHomepage.current = true; toggleUrlModal(true); diff --git a/app/core/RPCMethods/eth_sendTransaction.test.ts b/app/core/RPCMethods/eth_sendTransaction.test.ts index 60d652109b0..8ee94d8da09 100644 --- a/app/core/RPCMethods/eth_sendTransaction.test.ts +++ b/app/core/RPCMethods/eth_sendTransaction.test.ts @@ -1,6 +1,9 @@ // eslint-disable-next-line import/no-nodejs-modules import { inspect } from 'util'; -import type { JsonRpcRequest, PendingJsonRpcResponse } from 'json-rpc-engine'; +import type { + JsonRpcRequest, + PendingJsonRpcResponse, +} from '@metamask/json-rpc-engine'; import type { Transaction, TransactionController, diff --git a/app/core/RPCMethods/eth_sendTransaction.ts b/app/core/RPCMethods/eth_sendTransaction.ts index dfabf0c1662..003e38016db 100644 --- a/app/core/RPCMethods/eth_sendTransaction.ts +++ b/app/core/RPCMethods/eth_sendTransaction.ts @@ -1,9 +1,12 @@ -import type { JsonRpcRequest, PendingJsonRpcResponse } from 'json-rpc-engine'; +import type { + JsonRpcRequest, + PendingJsonRpcResponse, +} from '@metamask/json-rpc-engine'; import { TransactionController, WalletDevice, } from '@metamask/transaction-controller'; -import { ethErrors } from 'eth-rpc-errors'; +import { rpcErrors } from '@metamask/rpc-errors'; import ppomUtil from '../../lib/ppom/ppom-util'; /** @@ -78,13 +81,13 @@ async function eth_sendTransaction({ !Array.isArray(req.params) && !(isObject(req.params) && hasProperty(req.params, 0)) ) { - throw ethErrors.rpc.invalidParams({ + throw rpcErrors.invalidParams({ message: `Invalid parameters: expected an array`, }); } const transactionParameters = req.params[0]; if (!isObject(transactionParameters)) { - throw ethErrors.rpc.invalidParams({ + throw rpcErrors.invalidParams({ message: `Invalid parameters: expected the first parameter to be an object`, }); } diff --git a/app/core/RPCMethods/wallet_addEthereumChain.js b/app/core/RPCMethods/wallet_addEthereumChain.js index f5f6d6a5bcb..8177a94b80e 100644 --- a/app/core/RPCMethods/wallet_addEthereumChain.js +++ b/app/core/RPCMethods/wallet_addEthereumChain.js @@ -3,7 +3,7 @@ import validUrl from 'valid-url'; import { ChainId, isSafeChainId } from '@metamask/controller-utils'; import { jsonRpcRequest } from '../../util/jsonRpcRequest'; import Engine from '../Engine'; -import { ethErrors } from 'eth-rpc-errors'; +import { providerErrors, rpcErrors } from '@metamask/rpc-errors'; import { getDecimalChainId, isPrefixedFormattedHexString, @@ -37,7 +37,7 @@ const wallet_addEthereumChain = async ({ Engine.context; if (!req.params?.[0] || typeof req.params[0] !== 'object') { - throw ethErrors.rpc.invalidParams({ + throw rpcErrors.invalidParams({ message: `Expected single, object parameter. Received:\n${JSON.stringify( req.params, )}`, @@ -65,7 +65,7 @@ const wallet_addEthereumChain = async ({ const extraKeys = Object.keys(params).filter((key) => !allowedKeys[key]); if (extraKeys.length) { - throw ethErrors.rpc.invalidParams( + throw rpcErrors.invalidParams( `Received unexpected keys on object parameter. Unsupported keys:\n${extraKeys}`, ); } @@ -87,13 +87,13 @@ const wallet_addEthereumChain = async ({ : null; if (!firstValidRPCUrl) { - throw ethErrors.rpc.invalidParams( + throw rpcErrors.invalidParams( `Expected an array with at least one valid string HTTPS url 'rpcUrls', Received:\n${rpcUrls}`, ); } if (blockExplorerUrls !== null && !firstValidBlockExplorerUrl) { - throw ethErrors.rpc.invalidParams( + throw rpcErrors.invalidParams( `Expected null or array with at least one valid string HTTPS URL 'blockExplorerUrl'. Received: ${blockExplorerUrls}`, ); } @@ -101,21 +101,19 @@ const wallet_addEthereumChain = async ({ const _chainId = typeof chainId === 'string' && chainId.toLowerCase(); if (!isPrefixedFormattedHexString(_chainId)) { - throw ethErrors.rpc.invalidParams( + throw rpcErrors.invalidParams( `Expected 0x-prefixed, unpadded, non-zero hexadecimal string 'chainId'. Received:\n${chainId}`, ); } if (!isSafeChainId(_chainId)) { - throw ethErrors.rpc.invalidParams( + throw rpcErrors.invalidParams( `Invalid chain ID "${_chainId}": numerical value greater than max safe value. Received:\n${chainId}`, ); } if (Object.values(ChainId).find((value) => value === _chainId)) { - throw ethErrors.rpc.invalidParams( - `May not specify default MetaMask chain.`, - ); + throw rpcErrors.invalidParams(`May not specify default MetaMask chain.`); } const networkConfigurations = selectNetworkConfigurations(store.getState()); @@ -154,7 +152,7 @@ const wallet_addEthereumChain = async ({ MetaMetricsEvents.NETWORK_REQUEST_REJECTED, analyticsParams, ); - throw ethErrors.provider.userRejectedRequest(); + throw providerErrors.userRejectedRequest(); } CurrencyRateController.setNativeCurrency(networkConfiguration.ticker); @@ -174,21 +172,21 @@ const wallet_addEthereumChain = async ({ try { endpointChainId = await jsonRpcRequest(firstValidRPCUrl, 'eth_chainId'); } catch (err) { - throw ethErrors.rpc.internal({ + throw rpcErrors.internal({ message: `Request for method 'eth_chainId on ${firstValidRPCUrl} failed`, data: { networkErr: err }, }); } if (_chainId !== endpointChainId) { - throw ethErrors.rpc.invalidParams({ + throw rpcErrors.invalidParams({ message: `Chain ID returned by RPC URL ${firstValidRPCUrl} does not match ${_chainId}`, data: { chainId: endpointChainId }, }); } if (typeof rawChainName !== 'string' || !rawChainName) { - throw ethErrors.rpc.invalidParams({ + throw rpcErrors.invalidParams({ message: `Expected non-empty string 'chainName'. Received:\n${rawChainName}`, }); } @@ -197,18 +195,18 @@ const wallet_addEthereumChain = async ({ if (nativeCurrency !== null) { if (typeof nativeCurrency !== 'object' || Array.isArray(nativeCurrency)) { - throw ethErrors.rpc.invalidParams({ + throw rpcErrors.invalidParams({ message: `Expected null or object 'nativeCurrency'. Received:\n${nativeCurrency}`, }); } if (nativeCurrency.decimals !== EVM_NATIVE_TOKEN_DECIMALS) { - throw ethErrors.rpc.invalidParams({ + throw rpcErrors.invalidParams({ message: `Expected the number 18 for 'nativeCurrency.decimals' when 'nativeCurrency' is provided. Received: ${nativeCurrency.decimals}`, }); } if (!nativeCurrency.symbol || typeof nativeCurrency.symbol !== 'string') { - throw ethErrors.rpc.invalidParams({ + throw rpcErrors.invalidParams({ message: `Expected a string 'nativeCurrency.symbol'. Received: ${nativeCurrency.symbol}`, }); } @@ -216,7 +214,7 @@ const wallet_addEthereumChain = async ({ const ticker = nativeCurrency?.symbol || 'ETH'; if (typeof ticker !== 'string' || ticker.length < 2 || ticker.length > 6) { - throw ethErrors.rpc.invalidParams({ + throw rpcErrors.invalidParams({ message: `Expected 2-6 character string 'nativeCurrency.symbol'. Received:\n${ticker}`, }); } @@ -251,7 +249,7 @@ const wallet_addEthereumChain = async ({ ); // Remove all existing approvals, including other add network requests. - ApprovalController.clear(ethErrors.provider.userRejectedRequest()); + ApprovalController.clear(providerErrors.userRejectedRequest()); // If existing approval request was an add network request, wait for // it to be rejected and for the corresponding approval flow to be ended. @@ -270,7 +268,7 @@ const wallet_addEthereumChain = async ({ MetaMetricsEvents.NETWORK_REQUEST_REJECTED, analyticsParamsAdd, ); - throw ethErrors.provider.userRejectedRequest(); + throw providerErrors.userRejectedRequest(); } const networkConfigurationId = await NetworkController.upsertNetworkConfiguration( diff --git a/app/core/RPCMethods/wallet_addEthereumChain.test.js b/app/core/RPCMethods/wallet_addEthereumChain.test.js index 6b49dcc582a..62e0c60a76a 100644 --- a/app/core/RPCMethods/wallet_addEthereumChain.test.js +++ b/app/core/RPCMethods/wallet_addEthereumChain.test.js @@ -1,5 +1,5 @@ import { InteractionManager } from 'react-native'; -import { ethErrors } from 'eth-rpc-errors'; +import { providerErrors } from '@metamask/rpc-errors'; import wallet_addEthereumChain from './wallet_addEthereumChain'; import Engine from '../Engine'; @@ -284,7 +284,7 @@ describe('RPC Method - wallet_addEthereumChain', () => { ...otherOptions, requestUserApproval: jest.fn(() => Promise.reject()), }), - ).rejects.toThrow(ethErrors.provider.userRejectedRequest()); + ).rejects.toThrow(providerErrors.userRejectedRequest()); expect(otherOptions.startApprovalFlow).toBeCalledTimes(1); expect(otherOptions.endApprovalFlow).toBeCalledTimes(1); diff --git a/app/core/RPCMethods/wallet_switchEthereumChain.js b/app/core/RPCMethods/wallet_switchEthereumChain.js index e3b607a735f..9b8d91f927a 100644 --- a/app/core/RPCMethods/wallet_switchEthereumChain.js +++ b/app/core/RPCMethods/wallet_switchEthereumChain.js @@ -1,5 +1,5 @@ import Engine from '../Engine'; -import { ethErrors } from 'eth-rpc-errors'; +import { providerErrors, rpcErrors } from '@metamask/rpc-errors'; import { getDecimalChainId, getDefaultNetworkByChainId, @@ -23,7 +23,7 @@ const wallet_switchEthereumChain = async ({ const params = req.params?.[0]; if (!params || typeof params !== 'object') { - throw ethErrors.rpc.invalidParams({ + throw rpcErrors.invalidParams({ message: `Expected single, object parameter. Received:\n${JSON.stringify( req.params, )}`, @@ -38,7 +38,7 @@ const wallet_switchEthereumChain = async ({ const extraKeys = Object.keys(params).filter((key) => !allowedKeys[key]); if (extraKeys.length) { - throw ethErrors.rpc.invalidParams( + throw rpcErrors.invalidParams( `Received unexpected keys on object parameter. Unsupported keys:\n${extraKeys}`, ); } @@ -46,13 +46,13 @@ const wallet_switchEthereumChain = async ({ const _chainId = typeof chainId === 'string' && chainId.toLowerCase(); if (!isPrefixedFormattedHexString(_chainId)) { - throw ethErrors.rpc.invalidParams( + throw rpcErrors.invalidParams( `Expected 0x-prefixed, unpadded, non-zero hexadecimal string 'chainId'. Received:\n${chainId}`, ); } if (!isSafeChainId(_chainId)) { - throw ethErrors.rpc.invalidParams( + throw rpcErrors.invalidParams( `Invalid chain ID "${_chainId}": numerical value greater than max safe value. Received:\n${chainId}`, ); } @@ -125,7 +125,7 @@ const wallet_switchEthereumChain = async ({ return; } - throw ethErrors.provider.custom({ + throw providerErrors.custom({ code: 4902, // To-be-standardized "unrecognized chain ID" error message: `Unrecognized chain ID "${_chainId}". Try adding the chain using wallet_addEthereumChain first.`, }); diff --git a/app/core/RPCMethods/wallet_watchAsset.ts b/app/core/RPCMethods/wallet_watchAsset.ts index 16065dd050e..3a78dd9c024 100644 --- a/app/core/RPCMethods/wallet_watchAsset.ts +++ b/app/core/RPCMethods/wallet_watchAsset.ts @@ -11,7 +11,10 @@ import { } from '../../constants/error'; import { selectChainId } from '../../selectors/networkController'; import { isValidAddress } from 'ethereumjs-util'; -import { JsonRpcRequest, PendingJsonRpcResponse } from 'json-rpc-engine'; +import { + JsonRpcRequest, + PendingJsonRpcResponse, +} from '@metamask/json-rpc-engine'; const wallet_watchAsset = async ({ req, diff --git a/app/core/SDKConnect/handlers/handleConnectionReady.ts b/app/core/SDKConnect/handlers/handleConnectionReady.ts index d9bc19bac9f..a268c932235 100644 --- a/app/core/SDKConnect/handlers/handleConnectionReady.ts +++ b/app/core/SDKConnect/handlers/handleConnectionReady.ts @@ -7,7 +7,7 @@ import DevLogger from '../utils/DevLogger'; import checkPermissions from './checkPermissions'; import handleSendMessage from './handleSendMessage'; -import { ethErrors } from 'eth-rpc-errors'; +import { providerErrors } from '@metamask/rpc-errors'; import Engine from '../../Engine'; import { approveHostProps } from '../SDKConnect'; import generateOTP from '../utils/generateOTP.util'; @@ -48,7 +48,7 @@ export const handleConnectionReady = async ({ if (approvalController.get(connection.channelId)) { approvalController.reject( connection.channelId, - ethErrors.provider.userRejectedRequest(), + providerErrors.userRejectedRequest(), ); } @@ -125,7 +125,7 @@ export const handleConnectionReady = async ({ // cleaning previous pending approval approvalController.reject( connection.channelId, - ethErrors.provider.userRejectedRequest(), + providerErrors.userRejectedRequest(), ); } connection.approvalPromise = undefined; diff --git a/app/core/SanitizationMiddleware.ts b/app/core/SanitizationMiddleware.ts index 85cfba8f2cb..e3b08c61685 100644 --- a/app/core/SanitizationMiddleware.ts +++ b/app/core/SanitizationMiddleware.ts @@ -1,4 +1,4 @@ -import { JsonRpcMiddleware, JsonRpcRequest } from 'json-rpc-engine'; +import { JsonRpcMiddleware, JsonRpcRequest } from '@metamask/json-rpc-engine'; import { addHexPrefix } from 'ethereumjs-util'; // We use this to clean any custom params from the txParams diff --git a/app/core/Snaps/SnapBridge.ts b/app/core/Snaps/SnapBridge.ts index 9a24ef65062..2f328c1e402 100644 --- a/app/core/Snaps/SnapBridge.ts +++ b/app/core/Snaps/SnapBridge.ts @@ -10,7 +10,7 @@ import { createSwappableProxy, createEventEmitterProxy, } from '@metamask/swappable-obj-proxy'; -import { JsonRpcEngine } from 'json-rpc-engine'; +import { JsonRpcEngine } from '@metamask/json-rpc-engine'; import { createEngineStream } from 'json-rpc-middleware-stream'; import { NetworksChainId } from '@metamask/controller-utils'; @@ -22,8 +22,8 @@ import snapMethodMiddlewareBuilder from './SnapsMethodMiddleware'; import { SubjectType } from '@metamask/permission-controller'; const ObjectMultiplex = require('@metamask/object-multiplex'); -const createFilterMiddleware = require('eth-json-rpc-filters'); -const createSubscriptionManager = require('eth-json-rpc-filters/subscriptionManager'); +const createFilterMiddleware = require('@metamask/eth-json-rpc-filters'); +const createSubscriptionManager = require('@metamask/eth-json-rpc-filters/subscriptionManager'); const providerAsMiddleware = require('eth-json-rpc-middleware/providerAsMiddleware'); const pump = require('pump'); diff --git a/app/core/WalletConnect/extractApprovedAccounts.ts b/app/core/WalletConnect/extractApprovedAccounts.ts index 53b616eaee9..16a03bf9a2e 100644 --- a/app/core/WalletConnect/extractApprovedAccounts.ts +++ b/app/core/WalletConnect/extractApprovedAccounts.ts @@ -1,5 +1,5 @@ import { Caveat, ValidPermission } from '@metamask/permission-controller'; -import { Json } from 'json-rpc-engine'; +import { Json } from '@metamask/json-rpc-engine'; export const extractApprovedAccounts = ( accountPermission: diff --git a/app/store/migrations/029.ts b/app/store/migrations/029.ts index 7c0fe7aa3c8..eb2b907d8f1 100644 --- a/app/store/migrations/029.ts +++ b/app/store/migrations/029.ts @@ -5,7 +5,7 @@ import { regex } from '../../../app/util/regex'; //@ts-expect-error - This error is expected, but ethereumjs-util exports this function import { isHexString } from 'ethereumjs-util'; import { NetworkState } from '@metamask/network-controller'; -import { Transaction } from '@metamask/transaction-controller'; +import { TransactionParams } from '@metamask/transaction-controller'; import { captureException } from '@sentry/react-native'; import { AddressBookEntry, @@ -32,7 +32,7 @@ import { * NftController allNfts, allNftsContracts chain Id now is on hexadecimal format * Transaction Controller transactions object chain id property to hexadecimal * decided here https://github.com/MetaMask/core/pull/1367 - * @param {any} state - Redux state. + * @param {Promise} stateAsync - Redux state. * @returns Migrated Redux state. */ export default async function migrate(stateAsync: unknown) { @@ -449,7 +449,7 @@ export default async function migrate(stateAsync: unknown) { // Transaction Controller transactions object chain id property to hexadecimal if (Array.isArray(transactionControllerState.transactions)) { transactionControllerState.transactions.forEach( - (transaction: Transaction, index: number) => { + (transaction: TransactionParams, index: number) => { if (transaction && !isHexString(transaction.chainId)) { if ( Array.isArray(transactionControllerState.transactions) && diff --git a/package.json b/package.json index 7c4c54c8053..307e69b9180 100644 --- a/package.json +++ b/package.json @@ -144,9 +144,11 @@ "@metamask/contract-metadata": "^2.1.0", "@metamask/controller-utils": "^5.0.0", "@metamask/design-tokens": "^2.0.0", + "@metamask/eth-json-rpc-filters": "^7.0.0", "@metamask/eth-sig-util": "^4.0.1", "@metamask/etherscan-link": "^2.0.0", "@metamask/gas-fee-controller": "^7.0.0", + "@metamask/json-rpc-engine": "^7.1.0", "@metamask/key-tree": "^9.0.0", "@metamask/keyring-api": "^4.0.0", "@metamask/keyring-controller": "^8.1.0", @@ -158,6 +160,7 @@ "@metamask/ppom-validator": "0.29.0", "@metamask/preferences-controller": "^4.0.0", "@metamask/react-native-button": "^3.0.0", + "@metamask/rpc-errors": "^6.2.1", "@metamask/scure-bip39": "^2.1.0", "@metamask/sdk-communication-layer": "^0.18.1", "@metamask/signature-controller": "6.0.0", @@ -168,7 +171,7 @@ "@metamask/snaps-utils": "^6.0.0", "@metamask/swappable-obj-proxy": "^2.1.0", "@metamask/swaps-controller": "^6.9.3", - "@metamask/transaction-controller": "8.0.1", + "@metamask/transaction-controller": "^12.0.0", "@metamask/utils": "^8.1.0", "@ngraveio/bc-ur": "^1.1.6", "@notifee/react-native": "^7.8.2", @@ -213,10 +216,7 @@ "eciesjs": "^0.3.15", "eth-block-tracker": "^7.0.1", "eth-ens-namehash": "2.0.8", - "eth-json-rpc-filters": "4.2.2", - "eth-json-rpc-infura": "5.1.0", "eth-json-rpc-middleware": "4.3.0", - "eth-rpc-errors": "^4.0.3", "eth-url-parser": "1.0.4", "ethereumjs-abi": "0.6.6", "ethereumjs-util": "6.1.0", @@ -232,7 +232,6 @@ "human-standard-token-abi": "^2.0.0", "humanize-duration": "^3.27.2", "is-url": "^1.2.4", - "json-rpc-engine": "^6.1.0", "json-rpc-middleware-stream": "3.0.0", "lodash": "^4.17.21", "lottie-ios": "3.4.1", diff --git a/yarn.lock b/yarn.lock index 1306b21d031..7037511b2a0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1501,6 +1501,30 @@ resolved "https://registry.yarnpkg.com/@cucumber/tag-expressions/-/tag-expressions-4.1.0.tgz#9a91b0e0dd2f2ba703e3038c52b49b9ac06c2c6f" integrity sha512-chTnjxV3vryL75N90wJIMdMafXmZoO2JgNJLYpsfcALL2/IQrRiny3vM9DgD5RDCSt1LNloMtb7rGey9YWxCsA== +"@cypress/request@^3.0.0": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@cypress/request/-/request-3.0.1.tgz#72d7d5425236a2413bd3d8bb66d02d9dc3168960" + integrity sha512-TWivJlJi8ZDx2wGOw1dbLuHJKUYX7bWySw377nlnGOW3hP9/MUKIsEdXT/YngWxVdgNCHRBmFlBipE+5/2ZZlQ== + dependencies: + aws-sign2 "~0.7.0" + aws4 "^1.8.0" + caseless "~0.12.0" + combined-stream "~1.0.6" + extend "~3.0.2" + forever-agent "~0.6.1" + form-data "~2.3.2" + http-signature "~1.3.6" + is-typedarray "~1.0.0" + isstream "~0.1.2" + json-stringify-safe "~5.0.1" + mime-types "~2.1.19" + performance-now "^2.1.0" + qs "6.10.4" + safe-buffer "^5.1.2" + tough-cookie "^4.1.3" + tunnel-agent "^0.6.0" + uuid "^8.3.2" + "@dabh/colors@^1.4.0": version "1.4.0" resolved "https://registry.yarnpkg.com/@dabh/colors/-/colors-1.4.0.tgz#02a6c3ae56d9d67bab18eba313a872ea2fb83e01" @@ -3589,7 +3613,7 @@ immer "^9.0.6" nanoid "^3.1.31" -"@metamask/approval-controller@^3.5.0", "@metamask/approval-controller@^3.5.1", "@metamask/approval-controller@^3.5.2": +"@metamask/approval-controller@^3.5.1", "@metamask/approval-controller@^3.5.2": version "3.5.2" resolved "https://registry.yarnpkg.com/@metamask/approval-controller/-/approval-controller-3.5.2.tgz#c8ca4578f053d719bff82b0c9fa1939d21978d46" integrity sha512-5jYMtPexeeNL8m+5Mzhayr1l367MbbBs0Wf+FBeL/xLv6nSNqvvNs/CXfvkqxLDZJKIgBCBPKg7eIu1U6MJ6ag== @@ -3681,29 +3705,29 @@ resolved "https://registry.yarnpkg.com/@metamask/contract-metadata/-/contract-metadata-2.2.0.tgz#277764d0d56e37180ae7644a9d11eb96295b36fc" integrity sha512-SM6A4C7vXNbVpgMTX67kfW8QWvu3eSXxMZlY5PqZBTkvri1s9zgQ0uwRkK5r2VXNEoVmXCDnnEX/tX5EzzgNUQ== -"@metamask/controller-utils@^4.3.1", "@metamask/controller-utils@^5.0.0", "@metamask/controller-utils@^5.0.1", "@metamask/controller-utils@^5.0.2": - version "5.0.2" - resolved "https://registry.yarnpkg.com/@metamask/controller-utils/-/controller-utils-5.0.2.tgz#f6e848d9b80aca7943e1edae927324982305d1f8" - integrity sha512-bHgyPL+Ah6OBOkjWykA1NpTZdpRhoJjCrvuFf8mFxBJLvXE9m/rw9DYp2Rw9WXonMWK17NxwQv/7bKzsGZnjVQ== +"@metamask/controller-utils@^4.3.2": + version "4.3.2" + resolved "https://registry.yarnpkg.com/@metamask/controller-utils/-/controller-utils-4.3.2.tgz#e11fda4b2d38b96925891410665b57efcf41e07d" + integrity sha512-QlBUfUbexB+7IXHtZzFVYqKUvQEvktCHoDrzkXN8pjCbjm4sZtB6Lh47O0QSyoPR3dT77mphTz3GktjmfzskbA== dependencies: "@metamask/eth-query" "^3.0.1" - "@metamask/utils" "^8.1.0" + "@metamask/utils" "^6.2.0" "@spruceid/siwe-parser" "1.1.3" eth-ens-namehash "^2.0.8" + eth-rpc-errors "^4.0.2" ethereumjs-util "^7.0.10" ethjs-unit "^0.1.6" fast-deep-equal "^3.1.3" -"@metamask/controller-utils@^4.3.2": - version "4.3.2" - resolved "https://registry.yarnpkg.com/@metamask/controller-utils/-/controller-utils-4.3.2.tgz#e11fda4b2d38b96925891410665b57efcf41e07d" - integrity sha512-QlBUfUbexB+7IXHtZzFVYqKUvQEvktCHoDrzkXN8pjCbjm4sZtB6Lh47O0QSyoPR3dT77mphTz3GktjmfzskbA== +"@metamask/controller-utils@^5.0.0", "@metamask/controller-utils@^5.0.1", "@metamask/controller-utils@^5.0.2": + version "5.0.2" + resolved "https://registry.yarnpkg.com/@metamask/controller-utils/-/controller-utils-5.0.2.tgz#f6e848d9b80aca7943e1edae927324982305d1f8" + integrity sha512-bHgyPL+Ah6OBOkjWykA1NpTZdpRhoJjCrvuFf8mFxBJLvXE9m/rw9DYp2Rw9WXonMWK17NxwQv/7bKzsGZnjVQ== dependencies: "@metamask/eth-query" "^3.0.1" - "@metamask/utils" "^6.2.0" + "@metamask/utils" "^8.1.0" "@spruceid/siwe-parser" "1.1.3" eth-ens-namehash "^2.0.8" - eth-rpc-errors "^4.0.2" ethereumjs-util "^7.0.10" ethjs-unit "^0.1.6" fast-deep-equal "^3.1.3" @@ -3799,6 +3823,17 @@ "@metamask/scure-bip39" "^2.0.3" ethereum-cryptography "^1.1.2" +"@metamask/eth-json-rpc-filters@^7.0.0": + version "7.0.0" + resolved "https://registry.npmjs.org/@metamask/eth-json-rpc-filters/-/eth-json-rpc-filters-7.0.0.tgz#af0394838859ee9c673eb0cc01db785ec7161cd8" + integrity sha512-b4iJ44BFi6qeH/UPT8lUXpeYX6ydhx1j58vNQBNbpjMkK+r157Fp1lkXxWqx6xTz51Dz2sxc+I+jziuP+Wn8Wg== + dependencies: + "@metamask/eth-query" "^3.0.1" + "@metamask/json-rpc-engine" "^7.1.0" + "@metamask/safe-event-emitter" "^3.0.0" + async-mutex "^0.2.6" + pify "^5.0.0" + "@metamask/eth-json-rpc-infura@^8.1.1": version "8.1.1" resolved "https://registry.yarnpkg.com/@metamask/eth-json-rpc-infura/-/eth-json-rpc-infura-8.1.1.tgz#e877284634fb0727b347575115c74dc9ddd4400c" @@ -3811,15 +3846,15 @@ node-fetch "^2.6.7" "@metamask/eth-json-rpc-infura@^9.0.0": - version "9.0.0" - resolved "https://registry.yarnpkg.com/@metamask/eth-json-rpc-infura/-/eth-json-rpc-infura-9.0.0.tgz#0d2001d3fce38adb528ae572e50bc28217022b94" - integrity sha512-9VSqEE/TrdctipzUOdGOcxtZcY1laVdVV/7f1NPK41o5tLVqTcjmxvYhWSrRR+VoeXVkUCzer/U033prF4TWWA== + version "9.1.0" + resolved "https://registry.npmjs.org/@metamask/eth-json-rpc-infura/-/eth-json-rpc-infura-9.1.0.tgz#8e09588ed58f49058615cab7040dcbce4682a292" + integrity sha512-47x7evivl5XUsTsRoF9t27guCXgmfsbQq+pjHHFf87WoISGsgua6wVr91b1iVCv8MzQqupJBewtnG8AzWpwEEQ== dependencies: "@metamask/eth-json-rpc-provider" "^2.1.0" "@metamask/json-rpc-engine" "^7.1.1" "@metamask/rpc-errors" "^6.0.0" "@metamask/utils" "^8.1.0" - node-fetch "^2.6.7" + node-fetch "^2.7.0" "@metamask/eth-json-rpc-middleware@^11.0.2": version "11.0.2" @@ -4009,7 +4044,7 @@ immer "^9.0.6" uuid "^8.3.2" -"@metamask/json-rpc-engine@^7.0.0", "@metamask/json-rpc-engine@^7.1.1", "@metamask/json-rpc-engine@^7.2.0", "@metamask/json-rpc-engine@^7.3.0", "@metamask/json-rpc-engine@^7.3.1", "@metamask/json-rpc-engine@^7.3.2": +"@metamask/json-rpc-engine@^7.0.0", "@metamask/json-rpc-engine@^7.1.0", "@metamask/json-rpc-engine@^7.1.1", "@metamask/json-rpc-engine@^7.2.0", "@metamask/json-rpc-engine@^7.3.0", "@metamask/json-rpc-engine@^7.3.1", "@metamask/json-rpc-engine@^7.3.2": version "7.3.3" resolved "https://registry.yarnpkg.com/@metamask/json-rpc-engine/-/json-rpc-engine-7.3.3.tgz#f2b30a2164558014bfcca45db10f5af291d989af" integrity sha512-dwZPq8wx9yV3IX2caLi9q9xZBw2XeIoYqdyihDDDpuHVCEiqadJLwqM3zy+uwf6F1QYQ65A8aOMQg1Uw7LMLNg== @@ -4097,32 +4132,17 @@ resolved "https://registry.yarnpkg.com/@metamask/metamask-eth-abis/-/metamask-eth-abis-3.0.0.tgz#eccc0746b3ab1ab63000444403819c16e88b5272" integrity sha512-YtIl4e1VzqwwHGafuLIVPqbcWWWqQ0Ezo8/Ci5m5OGllqE2oTTx9iVHdUmXNkgCVD37SBfwn/fm/S1IGkM8BQA== +"@metamask/metamask-eth-abis@^3.0.0": + version "3.1.1" + resolved "https://registry.yarnpkg.com/@metamask/metamask-eth-abis/-/metamask-eth-abis-3.1.1.tgz#3de904511115c488809ddee25c470332c03db531" + integrity sha512-lRUyWN/GrIFQlT0wq/9gB+4wIV2i0N6yAQlJhfLCT6bVfK5GI5IUDxvCyLTDvxQxaLpNgtBFFzbuY1iVj3UWLA== + "@metamask/mobile-provider@^3.0.0": version "3.0.0" resolved "https://registry.yarnpkg.com/@metamask/mobile-provider/-/mobile-provider-3.0.0.tgz#8a6a5a0874c8cbe4b468f63dfc57117d207f9595" integrity sha512-XwFJk0rd9lAZR5xS3VC7ypEhD7DvZR2gi2Ch6PHnODIqeS9Te3OdVKK5+jHI4his8v/zs6LWdFdlRtx5/jL96w== -"@metamask/network-controller@^12.0.0": - version "12.2.0" - resolved "https://registry.yarnpkg.com/@metamask/network-controller/-/network-controller-12.2.0.tgz#679d81e009cfd2b9fdaf884267d7a11b535f1922" - integrity sha512-MBsEOy8htQtN46s/pbmEPsfe+UyOe3aUGTeswG0Iy0qGKyqu+uEx/nhydaLpMHFlOLbboPWtUmnPRLFE9pQDEA== - dependencies: - "@metamask/base-controller" "^3.2.1" - "@metamask/controller-utils" "^4.3.2" - "@metamask/eth-json-rpc-infura" "^8.1.1" - "@metamask/eth-json-rpc-middleware" "^11.0.2" - "@metamask/eth-json-rpc-provider" "^1.0.0" - "@metamask/eth-query" "^3.0.1" - "@metamask/swappable-obj-proxy" "^2.1.0" - "@metamask/utils" "^6.2.0" - async-mutex "^0.2.6" - eth-block-tracker "^7.0.1" - eth-rpc-errors "^4.0.2" - immer "^9.0.6" - json-rpc-engine "^6.1.0" - uuid "^8.3.2" - -"@metamask/network-controller@^13.0.1": +"@metamask/network-controller@^13.0.0", "@metamask/network-controller@^13.0.1": version "13.0.1" resolved "https://registry.yarnpkg.com/@metamask/network-controller/-/network-controller-13.0.1.tgz#b8d3cd4abe8e03a8d030409588da6f05461955c5" integrity sha512-stoS3Dj4b3B8M6dCFs0uE7Zz1Y535yeSUJxJQ12v2t1OlB4JfV5mNL67SJR8h+efR+t336H3EujxevEiW32CVA== @@ -4571,23 +4591,27 @@ resolved "https://registry.yarnpkg.com/@metamask/test-dapp/-/test-dapp-8.0.0.tgz#72f64b18a6157400ef3a3901c35819883524a048" integrity sha512-yy1eZ9fZfJSEJIUjqcigBehFv6vdPGmDkVnzpBpEJqxiMPZGnbR5dypMfo0XsPdp5Lvmawx47Kamuy4Ocsy+iw== -"@metamask/transaction-controller@8.0.1": - version "8.0.1" - resolved "https://registry.yarnpkg.com/@metamask/transaction-controller/-/transaction-controller-8.0.1.tgz#fa56023d8f8ab65806343cf1cfcd8feeb0dfd6bc" - integrity sha512-vTshHPkuEGKBh9mmNSu1wadd9F2BTMIIANUAdK6IPl52f+4vtC1cJ4ele23CiJAAuLHdmnEZsVIDq7/HoCt7gA== +"@metamask/transaction-controller@^12.0.0": + version "12.0.0" + resolved "https://registry.yarnpkg.com/@metamask/transaction-controller/-/transaction-controller-12.0.0.tgz#5d3705d2e1da74bd00b491b2a094d47a896d5a21" + integrity sha512-WugO0TOl9o3Pa40oO8zNduc+d5vhCaVUzpGbLXUECLXzCoiPesrEkuNngejwyo15zCg0WKhsQ8LNxiqKi09UVA== dependencies: "@ethereumjs/common" "^3.2.0" "@ethereumjs/tx" "^4.2.0" - "@metamask/approval-controller" "^3.5.0" - "@metamask/base-controller" "^3.2.0" - "@metamask/controller-utils" "^4.3.1" + "@ethersproject/abi" "^5.7.0" + "@metamask/approval-controller" "^3.5.1" + "@metamask/base-controller" "^3.2.1" + "@metamask/controller-utils" "^5.0.0" "@metamask/eth-query" "^3.0.1" - "@metamask/network-controller" "^12.0.0" + "@metamask/metamask-eth-abis" "^3.0.0" + "@metamask/network-controller" "^13.0.0" "@metamask/utils" "^6.2.0" async-mutex "^0.2.6" eth-method-registry "1.1.0" eth-rpc-errors "^4.0.2" ethereumjs-util "^7.0.10" + fast-json-patch "^3.1.1" + lodash "^4.17.21" nonce-tracker "^1.1.0" uuid "^8.3.2" @@ -15558,7 +15582,7 @@ eth-json-rpc-errors@^1.0.1: dependencies: fast-safe-stringify "^2.0.6" -eth-json-rpc-filters@4.2.2, eth-json-rpc-filters@^4.2.1: +eth-json-rpc-filters@^4.2.1: version "4.2.2" resolved "https://registry.yarnpkg.com/eth-json-rpc-filters/-/eth-json-rpc-filters-4.2.2.tgz#eb35e1dfe9357ace8a8908e7daee80b2cd60a10d" integrity sha512-DGtqpLU7bBg63wPMWg1sCpkKCf57dJ+hj/k3zF26anXMzkmtSBDExL8IhUu7LUd34f0Zsce3PYNO2vV2GaTzaw== @@ -15570,7 +15594,7 @@ eth-json-rpc-filters@4.2.2, eth-json-rpc-filters@^4.2.1: json-rpc-engine "^6.1.0" pify "^5.0.0" -eth-json-rpc-infura@5.1.0, eth-json-rpc-infura@^5.1.0: +eth-json-rpc-infura@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/eth-json-rpc-infura/-/eth-json-rpc-infura-5.1.0.tgz#e6da7dc47402ce64c54e7018170d89433c4e8fb6" integrity sha512-THzLye3PHUSGn1EXMhg6WTLW9uim7LQZKeKaeYsS9+wOBcamRiCQVGHa6D2/4P0oS0vSaxsBnU/J6qvn0MPdow== @@ -16470,6 +16494,11 @@ fast-glob@^3.2.11, fast-glob@^3.2.9: merge2 "^1.3.0" micromatch "^4.0.4" +fast-json-patch@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/fast-json-patch/-/fast-json-patch-3.1.1.tgz#85064ea1b1ebf97a3f7ad01e23f9337e72c66947" + integrity sha512-vf6IHUX2SBcA+5/+4883dsIjpBTqmfBjmYiWK1savxQmFk4JfBMLa7ynTYOs1Rolp/T1betJxHiGD3g1Mn8lUQ== + fast-json-stable-stringify@^2.0.0, fast-json-stable-stringify@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" @@ -17906,6 +17935,15 @@ http-signature@~1.2.0: jsprim "^1.2.2" sshpk "^1.7.0" +http-signature@~1.3.6: + version "1.3.6" + resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.3.6.tgz#cb6fbfdf86d1c974f343be94e87f7fc128662cf9" + integrity sha512-3adrsD6zqo4GsTqtO7FyrejHNv+NgiIfAfv68+jVlFmSr9OGy7zrxONceFRLKvnnZA5jbxQBX1u9PpB6Wi32Gw== + dependencies: + assert-plus "^1.0.0" + jsprim "^2.0.2" + sshpk "^1.14.1" + http-status-codes@^1.3.0: version "1.4.0" resolved "https://registry.yarnpkg.com/http-status-codes/-/http-status-codes-1.4.0.tgz#6e4c15d16ff3a9e2df03b89f3a55e1aae05fb477" @@ -19700,6 +19738,16 @@ jsprim@^1.2.2: json-schema "0.2.3" verror "1.10.0" +jsprim@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-2.0.2.tgz#77ca23dbcd4135cd364800d22ff82c2185803d4d" + integrity sha512-gqXddjPqQ6G40VdnI6T6yObEC+pDNvyP95wdQhkWkg7crHH3km5qP1FsOXEkzEQwnz6gz5qGTn1c2Y52wP3OyQ== + dependencies: + assert-plus "1.0.0" + extsprintf "1.3.0" + json-schema "0.4.0" + verror "1.10.0" + jsx-ast-utils@^2.2.1: version "2.4.1" resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-2.4.1.tgz#1114a4c1209481db06c690c2b4f488cc665f657e" @@ -21660,7 +21708,7 @@ node-fetch-native@^1.4.0, node-fetch-native@^1.4.1: resolved "https://registry.yarnpkg.com/node-fetch-native/-/node-fetch-native-1.6.1.tgz#f95c74917d3cebc794cdae0cd2a9c7594aad0cb4" integrity sha512-bW9T/uJDPAJB2YNYEpWzE54U5O3MQidXsOyTfnbKYtTtFexRvGzb1waphBN4ZwP6EcIvYYEOwW0b72BpAqydTw== -node-fetch@2.6.7, node-fetch@^2.0.0, node-fetch@^2.2.0, node-fetch@^2.6.0, node-fetch@^2.6.1, node-fetch@^2.6.12, node-fetch@^2.6.7, node-fetch@~1.7.1: +node-fetch@2.6.7, node-fetch@^2.0.0, node-fetch@^2.2.0, node-fetch@^2.6.0, node-fetch@^2.6.1, node-fetch@^2.6.12, node-fetch@^2.6.7, node-fetch@^2.7.0, node-fetch@~1.7.1: version "2.6.7" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ== @@ -23523,6 +23571,13 @@ qrcode@^1.2.0: pngjs "^3.3.0" yargs "^13.2.4" +qs@6.10.4: + version "6.10.4" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.10.4.tgz#6a3003755add91c0ec9eacdc5f878b034e73f9e7" + integrity sha512-OQiU+C+Ds5qiH91qh/mg0w+8nwQuLjM4F4M/PbmhDOoYehPh+Fb0bDjtR1sOvy7YKxvj28Y/M0PhP5uVX0kB+g== + dependencies: + side-channel "^1.0.4" + qs@6.11.0: version "6.11.0" resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.0.tgz#fd0d963446f7a65e1367e01abd85429453f0c37a" @@ -25028,7 +25083,7 @@ request-promise@^4.2.2: stealthy-require "^1.1.1" tough-cookie "^2.3.3" -request@^2.72.0, request@^2.83.0, request@^2.85.0: +request@^2.72.0, request@^2.83.0: version "2.88.2" resolved "https://registry.yarnpkg.com/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3" integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw== @@ -26145,10 +26200,10 @@ sprintf-js@~1.0.2: resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= -sshpk@^1.7.0: - version "1.16.1" - resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.16.1.tgz#fb661c0bef29b39db40769ee39fa70093d6f6877" - integrity sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg== +sshpk@^1.14.1, sshpk@^1.7.0: + version "1.18.0" + resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.18.0.tgz#1663e55cddf4d688b86a46b77f0d5fe363aba028" + integrity sha512-2p2KJZTSqQ/I3+HX42EpYOa2l3f8Erv8MWKsy2I9uf4wA7yFIkXRffYdsx86y6z4vHtV8u7g+pPlr8/4ouAxsQ== dependencies: asn1 "~0.2.3" assert-plus "^1.0.0" @@ -27063,7 +27118,7 @@ toposort@^2.0.2: resolved "https://registry.yarnpkg.com/toposort/-/toposort-2.0.2.tgz#ae21768175d1559d48bef35420b2f4962f09c330" integrity sha512-0a5EOkAUp8D4moMi2W8ZF8jcga7BgZd91O/yabJCFY8az+XSzeGyTKs0Aoo897iV1Nj6guFq8orWDS96z91oGg== -tough-cookie@4.1.3, tough-cookie@^2.3.3, tough-cookie@~2.5.0: +tough-cookie@4.1.3, tough-cookie@^2.3.3, tough-cookie@^4.1.3, tough-cookie@~2.5.0: version "4.1.3" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.3.tgz#97b9adb0728b42280aa3d814b6b999b2ff0318bf" integrity sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw== @@ -27918,10 +27973,11 @@ weak@^1.0.0: nan "^2.0.5" web3-provider-engine@^16.0.3: - version "16.0.5" - resolved "https://registry.yarnpkg.com/web3-provider-engine/-/web3-provider-engine-16.0.5.tgz#28a0eaf6c33bc60b3cb7de1b961bea6b5cf06b78" - integrity sha512-fvoMm8Tehf3efaqv9pSd2VKLjgzcYNsJaiby87nPrktlnIc9S3G/9udnuJQn32FAt19yzOvNk3B513jhBKOgEg== + version "16.0.7" + resolved "https://registry.yarnpkg.com/web3-provider-engine/-/web3-provider-engine-16.0.7.tgz#f1ff65af9422da558c39891c948f321d67f06605" + integrity sha512-I/3809UDA0LpGlBGGulalrKO4zFWPQIgOMwgt717sXlKVXW4cRPZZgO8gPbnOq9PotOuV89dYDse0ClLqw+kcA== dependencies: + "@cypress/request" "^3.0.0" "@ethereumjs/tx" "^3.3.0" async "^2.5.0" backoff "^2.5.0" @@ -27938,9 +27994,8 @@ web3-provider-engine@^16.0.3: json-stable-stringify "^1.0.1" promise-to-callback "^1.0.0" readable-stream "^2.2.9" - request "^2.85.0" semaphore "^1.0.3" - ws "^5.1.1" + ws "^7.5.9" xhr "^2.2.0" xtend "^4.0.1" @@ -28507,13 +28562,6 @@ ws@8.5.0: resolved "https://registry.yarnpkg.com/ws/-/ws-8.5.0.tgz#bfb4be96600757fe5382de12c670dab984a1ed4f" integrity sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg== -ws@^5.1.1: - version "5.2.3" - resolved "https://registry.yarnpkg.com/ws/-/ws-5.2.3.tgz#05541053414921bc29c63bee14b8b0dd50b07b3d" - integrity sha512-jZArVERrMsKUatIdnLzqvcfydI85dvd/Fp1u/VOpfdDWQ4c9qWXe+VIeAbQ5FrDwciAkr+lzofXLz3Kuf26AOA== - dependencies: - async-limiter "~1.0.0" - ws@^6.2.2: version "6.2.2" resolved "https://registry.yarnpkg.com/ws/-/ws-6.2.2.tgz#dd5cdbd57a9979916097652d78f1cc5faea0c32e" @@ -28521,7 +28569,7 @@ ws@^6.2.2: dependencies: async-limiter "~1.0.0" -ws@^7, ws@^7.0.0, ws@^7.2.3, ws@^7.5.1: +ws@^7, ws@^7.0.0, ws@^7.2.3, ws@^7.5.1, ws@^7.5.9: version "7.5.9" resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.9.tgz#54fa7db29f4c7cec68b1ddd3a89de099942bb591" integrity sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==