diff --git a/app/scripts/lib/createMetamaskMiddleware.js b/app/scripts/lib/createMetamaskMiddleware.js index c0114dd2323c..27675b65fe59 100644 --- a/app/scripts/lib/createMetamaskMiddleware.js +++ b/app/scripts/lib/createMetamaskMiddleware.js @@ -1,4 +1,7 @@ -import { createScaffoldMiddleware, mergeMiddleware } from 'json-rpc-engine'; +import { + createScaffoldMiddleware, + mergeMiddleware, +} from '@metamask/json-rpc-engine'; import { createWalletMiddleware } from '@metamask/eth-json-rpc-middleware'; import { createPendingNonceMiddleware, diff --git a/app/scripts/lib/middleware/pending.js b/app/scripts/lib/middleware/pending.js index 9e01d11ffcb2..0c9d3445a01e 100644 --- a/app/scripts/lib/middleware/pending.js +++ b/app/scripts/lib/middleware/pending.js @@ -1,4 +1,4 @@ -import { createAsyncMiddleware } from 'json-rpc-engine'; +import { createAsyncMiddleware } from '@metamask/json-rpc-engine'; import { formatTxMetaForRpcResult } from '../util'; export function createPendingNonceMiddleware({ getPendingNonce }) { diff --git a/app/scripts/lib/rpc-method-middleware/handlers/eth-accounts.js b/app/scripts/lib/rpc-method-middleware/handlers/eth-accounts.js index ab603e7de021..b576159a5f3e 100644 --- a/app/scripts/lib/rpc-method-middleware/handlers/eth-accounts.js +++ b/app/scripts/lib/rpc-method-middleware/handlers/eth-accounts.js @@ -21,8 +21,8 @@ export default requestEthereumAccounts; /** * - * @param {import('json-rpc-engine').JsonRpcRequest} _req - The JSON-RPC request object. - * @param {import('json-rpc-engine').JsonRpcResponse} res - The JSON-RPC response object. + * @param {import('@metamask/json-rpc-engine').JsonRpcRequest} _req - The JSON-RPC request object. + * @param {import('@metamask/json-rpc-engine').JsonRpcResponse} res - The JSON-RPC response object. * @param {Function} _next - The json-rpc-engine 'next' callback. * @param {Function} end - The json-rpc-engine 'end' callback. * @param {EthAccountsOptions} options - The RPC method hooks. diff --git a/app/scripts/lib/rpc-method-middleware/handlers/get-provider-state.js b/app/scripts/lib/rpc-method-middleware/handlers/get-provider-state.js index 70dbb7b16cfa..c21699fd72e1 100644 --- a/app/scripts/lib/rpc-method-middleware/handlers/get-provider-state.js +++ b/app/scripts/lib/rpc-method-middleware/handlers/get-provider-state.js @@ -29,8 +29,8 @@ export default getProviderState; */ /** - * @param {import('json-rpc-engine').JsonRpcRequest<[]>} req - The JSON-RPC request object. - * @param {import('json-rpc-engine').JsonRpcResponse} res - The JSON-RPC response object. + * @param {import('@metamask/json-rpc-engine').JsonRpcRequest<[]>} req - The JSON-RPC request object. + * @param {import('@metamask/json-rpc-engine').JsonRpcResponse} res - The JSON-RPC response object. * @param {Function} _next - The json-rpc-engine 'next' callback. * @param {Function} end - The json-rpc-engine 'end' callback. * @param {ProviderStateHandlerOptions} options diff --git a/app/scripts/lib/rpc-method-middleware/handlers/institutional/mmi-authenticate.js b/app/scripts/lib/rpc-method-middleware/handlers/institutional/mmi-authenticate.js index 48014a6d66fa..57d9e8e53c52 100644 --- a/app/scripts/lib/rpc-method-middleware/handlers/institutional/mmi-authenticate.js +++ b/app/scripts/lib/rpc-method-middleware/handlers/institutional/mmi-authenticate.js @@ -21,8 +21,8 @@ export default mmiAuthenticate; */ /** - * @param {import('json-rpc-engine').JsonRpcRequest} req - The JSON-RPC request object. - * @param {import('json-rpc-engine').JsonRpcResponse} res - The JSON-RPC response object. + * @param {import('@metamask/json-rpc-engine').JsonRpcRequest} req - The JSON-RPC request object. + * @param {import('@metamask/json-rpc-engine').JsonRpcResponse} res - The JSON-RPC response object. * @param {Function} _next - The json-rpc-engine 'next' callback. * @param {Function} end - The json-rpc-engine 'end' callback. * @param {WatchAssetOptions} options diff --git a/app/scripts/lib/rpc-method-middleware/handlers/institutional/mmi-check-if-token-is-present.js b/app/scripts/lib/rpc-method-middleware/handlers/institutional/mmi-check-if-token-is-present.js index 1e05251a25c4..f45772d6ad7d 100644 --- a/app/scripts/lib/rpc-method-middleware/handlers/institutional/mmi-check-if-token-is-present.js +++ b/app/scripts/lib/rpc-method-middleware/handlers/institutional/mmi-check-if-token-is-present.js @@ -23,8 +23,8 @@ export default mmiAuthenticate; */ /** - * @param {import('json-rpc-engine').JsonRpcRequest} req - The JSON-RPC request object. - * @param {import('json-rpc-engine').JsonRpcResponse} res - The JSON-RPC response object. + * @param {import('@metamask/json-rpc-engine').JsonRpcRequest} req - The JSON-RPC request object. + * @param {import('@metamask/json-rpc-engine').JsonRpcResponse} res - The JSON-RPC response object. * @param {Function} _next - The json-rpc-engine 'next' callback. * @param {Function} end - The json-rpc-engine 'end' callback. * @param options0 diff --git a/app/scripts/lib/rpc-method-middleware/handlers/institutional/mmi-open-add-hardware-wallet.js b/app/scripts/lib/rpc-method-middleware/handlers/institutional/mmi-open-add-hardware-wallet.js index 2518a326a9ef..bd687bcfa0b7 100644 --- a/app/scripts/lib/rpc-method-middleware/handlers/institutional/mmi-open-add-hardware-wallet.js +++ b/app/scripts/lib/rpc-method-middleware/handlers/institutional/mmi-open-add-hardware-wallet.js @@ -16,8 +16,8 @@ export default mmiOpenAddHardwareWallet; */ /** - * @param {import('json-rpc-engine').JsonRpcRequest} req - The JSON-RPC request object. - * @param {import('json-rpc-engine').JsonRpcResponse} res - The JSON-RPC response object. + * @param {import('@metamask/json-rpc-engine').JsonRpcRequest} req - The JSON-RPC request object. + * @param {import('@metamask/json-rpc-engine').JsonRpcResponse} res - The JSON-RPC response object. * @param {Function} _next - The json-rpc-engine 'next' callback. * @param {Function} end - The json-rpc-engine 'end' callback. * @param {WatchAssetOptions} options diff --git a/app/scripts/lib/rpc-method-middleware/handlers/institutional/mmi-portfolio.js b/app/scripts/lib/rpc-method-middleware/handlers/institutional/mmi-portfolio.js index e52599ee9736..d92b3f048546 100644 --- a/app/scripts/lib/rpc-method-middleware/handlers/institutional/mmi-portfolio.js +++ b/app/scripts/lib/rpc-method-middleware/handlers/institutional/mmi-portfolio.js @@ -22,8 +22,8 @@ export default mmiPortfolio; */ /** - * @param {import('json-rpc-engine').JsonRpcRequest} req - The JSON-RPC request object. - * @param {import('json-rpc-engine').JsonRpcResponse} res - The JSON-RPC response object. + * @param {import('@metamask/json-rpc-engine').JsonRpcRequest} req - The JSON-RPC request object. + * @param {import('@metamask/json-rpc-engine').JsonRpcResponse} res - The JSON-RPC response object. * @param {Function} _next - The json-rpc-engine 'next' callback. * @param {Function} end - The json-rpc-engine 'end' callback. * @param {WatchAssetOptions} options diff --git a/app/scripts/lib/rpc-method-middleware/handlers/institutional/mmi-set-account-and-network.js b/app/scripts/lib/rpc-method-middleware/handlers/institutional/mmi-set-account-and-network.js index 70e01cf374a5..56bcf95269eb 100644 --- a/app/scripts/lib/rpc-method-middleware/handlers/institutional/mmi-set-account-and-network.js +++ b/app/scripts/lib/rpc-method-middleware/handlers/institutional/mmi-set-account-and-network.js @@ -23,8 +23,8 @@ export default mmiSetAccountAndNetwork; */ /** - * @param {import('json-rpc-engine').JsonRpcRequest} req - The JSON-RPC request object. - * @param {import('json-rpc-engine').JsonRpcResponse} res - The JSON-RPC response object. + * @param {import('@metamask/json-rpc-engine').JsonRpcRequest} req - The JSON-RPC request object. + * @param {import('@metamask/json-rpc-engine').JsonRpcResponse} res - The JSON-RPC response object. * @param {Function} _next - The json-rpc-engine 'next' callback. * @param {Function} end - The json-rpc-engine 'end' callback. * @param {WatchAssetOptions} options diff --git a/app/scripts/lib/rpc-method-middleware/handlers/institutional/mmi-supported.js b/app/scripts/lib/rpc-method-middleware/handlers/institutional/mmi-supported.js index 5aa987ed880f..a0d87cd7341d 100644 --- a/app/scripts/lib/rpc-method-middleware/handlers/institutional/mmi-supported.js +++ b/app/scripts/lib/rpc-method-middleware/handlers/institutional/mmi-supported.js @@ -19,8 +19,8 @@ export default mmiSupported; */ /** - * @param {import('json-rpc-engine').JsonRpcRequest} _req - The JSON-RPC request object. - * @param {import('json-rpc-engine').JsonRpcResponse} res - The JSON-RPC response object. + * @param {import('@metamask/json-rpc-engine').JsonRpcRequest} _req - The JSON-RPC request object. + * @param {import('@metamask/json-rpc-engine').JsonRpcResponse} res - The JSON-RPC response object. * @param {Function} _next - The json-rpc-engine 'next' callback. * @param {Function} end - The json-rpc-engine 'end' callback. */ diff --git a/app/scripts/lib/rpc-method-middleware/handlers/log-web3-shim-usage.js b/app/scripts/lib/rpc-method-middleware/handlers/log-web3-shim-usage.js index e7957192cd56..ea07a15599c2 100644 --- a/app/scripts/lib/rpc-method-middleware/handlers/log-web3-shim-usage.js +++ b/app/scripts/lib/rpc-method-middleware/handlers/log-web3-shim-usage.js @@ -25,8 +25,8 @@ export default logWeb3ShimUsage; */ /** - * @param {import('json-rpc-engine').JsonRpcRequest} req - The JSON-RPC request object. - * @param {import('json-rpc-engine').JsonRpcResponse} res - The JSON-RPC response object. + * @param {import('@metamask/json-rpc-engine').JsonRpcRequest} req - The JSON-RPC request object. + * @param {import('@metamask/json-rpc-engine').JsonRpcResponse} res - The JSON-RPC response object. * @param {Function} _next - The json-rpc-engine 'next' callback. * @param {Function} end - The json-rpc-engine 'end' callback. * @param {LogWeb3ShimUsageOptions} options diff --git a/app/scripts/lib/rpc-method-middleware/handlers/request-accounts.js b/app/scripts/lib/rpc-method-middleware/handlers/request-accounts.js index 2c17f84a6906..8ef5f08e265a 100644 --- a/app/scripts/lib/rpc-method-middleware/handlers/request-accounts.js +++ b/app/scripts/lib/rpc-method-middleware/handlers/request-accounts.js @@ -47,8 +47,8 @@ const locks = new Set(); /** * - * @param {import('json-rpc-engine').JsonRpcRequest} _req - The JSON-RPC request object. - * @param {import('json-rpc-engine').JsonRpcResponse} res - The JSON-RPC response object. + * @param {import('@metamask/json-rpc-engine').JsonRpcRequest} _req - The JSON-RPC request object. + * @param {import('@metamask/json-rpc-engine').JsonRpcResponse} res - The JSON-RPC response object. * @param {Function} _next - The json-rpc-engine 'next' callback. * @param {Function} end - The json-rpc-engine 'end' callback. * @param {RequestEthereumAccountsOptions} options - The RPC method hooks. diff --git a/app/scripts/lib/rpc-method-middleware/handlers/send-metadata.js b/app/scripts/lib/rpc-method-middleware/handlers/send-metadata.js index 35ec117a1f63..03253f6dc7b0 100644 --- a/app/scripts/lib/rpc-method-middleware/handlers/send-metadata.js +++ b/app/scripts/lib/rpc-method-middleware/handlers/send-metadata.js @@ -25,8 +25,8 @@ export default sendMetadata; */ /** - * @param {import('json-rpc-engine').JsonRpcRequest} req - The JSON-RPC request object. - * @param {import('json-rpc-engine').JsonRpcResponse} res - The JSON-RPC response object. + * @param {import('@metamask/json-rpc-engine').JsonRpcRequest} req - The JSON-RPC request object. + * @param {import('@metamask/json-rpc-engine').JsonRpcResponse} res - The JSON-RPC response object. * @param {Function} _next - The json-rpc-engine 'next' callback. * @param {Function} end - The json-rpc-engine 'end' callback. * @param {SendMetadataOptions} options diff --git a/app/scripts/lib/rpc-method-middleware/handlers/watch-asset.js b/app/scripts/lib/rpc-method-middleware/handlers/watch-asset.js index fdfacb373c77..129005dacf33 100644 --- a/app/scripts/lib/rpc-method-middleware/handlers/watch-asset.js +++ b/app/scripts/lib/rpc-method-middleware/handlers/watch-asset.js @@ -23,8 +23,8 @@ export default watchAsset; */ /** - * @param {import('json-rpc-engine').JsonRpcRequest} req - The JSON-RPC request object. - * @param {import('json-rpc-engine').JsonRpcResponse} res - The JSON-RPC response object. + * @param {import('@metamask/json-rpc-engine').JsonRpcRequest} req - The JSON-RPC request object. + * @param {import('@metamask/json-rpc-engine').JsonRpcResponse} res - The JSON-RPC response object. * @param {Function} _next - The json-rpc-engine 'next' callback. * @param {Function} end - The json-rpc-engine 'end' callback. * @param {WatchAssetOptions} options diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index c9c3a13073f8..c006dc0f3396 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -10,9 +10,9 @@ import { TokensController, CodefiTokenPricesServiceV2, } from '@metamask/assets-controllers'; +import { JsonRpcEngine } from '@metamask/json-rpc-engine'; import { ObservableStore } from '@metamask/obs-store'; import { storeAsStream } from '@metamask/obs-store/dist/asStream'; -import { JsonRpcEngine } from 'json-rpc-engine'; import { createEngineStream } from 'json-rpc-middleware-stream'; import { providerAsMiddleware } from '@metamask/eth-json-rpc-middleware'; import { diff --git a/lavamoat/browserify/beta/policy.json b/lavamoat/browserify/beta/policy.json index 2defd65d967a..b5c42987b2ed 100644 --- a/lavamoat/browserify/beta/policy.json +++ b/lavamoat/browserify/beta/policy.json @@ -929,8 +929,8 @@ }, "packages": { "@metamask/eth-json-rpc-middleware>safe-stable-stringify": true, + "@metamask/json-rpc-engine": true, "@metamask/message-manager>@metamask/eth-sig-util": true, - "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/rpc-errors": true, "@metamask/utils": true, "pify": true, @@ -1389,6 +1389,21 @@ "jest-canvas-mock>moo-color>color-name": true } }, + "@metamask/json-rpc-engine": { + "packages": { + "@metamask/json-rpc-engine>@metamask/safe-event-emitter": true, + "@metamask/rpc-errors": true, + "@metamask/utils": true + } + }, + "@metamask/json-rpc-engine>@metamask/safe-event-emitter": { + "globals": { + "setTimeout": true + }, + "packages": { + "webpack>events": true + } + }, "@metamask/keyring-api": { "packages": { "@metamask/keyring-api>uuid": true, @@ -1559,10 +1574,10 @@ "@metamask/eth-json-rpc-middleware": true, "@metamask/eth-query": true, "@metamask/eth-token-tracker>eth-block-tracker": true, + "@metamask/json-rpc-engine": true, "@metamask/network-controller>@metamask/eth-json-rpc-infura": true, "@metamask/network-controller>@metamask/eth-json-rpc-provider": true, "@metamask/network-controller>@metamask/swappable-obj-proxy": true, - "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/rpc-errors": true, "@metamask/utils": true, "browserify>assert": true, @@ -1574,8 +1589,8 @@ "setTimeout": true }, "packages": { + "@metamask/json-rpc-engine": true, "@metamask/network-controller>@metamask/eth-json-rpc-provider": true, - "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/rpc-errors": true, "@metamask/utils": true, "node-fetch": true @@ -1583,8 +1598,8 @@ }, "@metamask/network-controller>@metamask/eth-json-rpc-provider": { "packages": { - "@metamask/network-controller>@metamask/eth-json-rpc-provider>@metamask/safe-event-emitter": true, - "@metamask/providers>@metamask/json-rpc-engine": true + "@metamask/json-rpc-engine": true, + "@metamask/network-controller>@metamask/eth-json-rpc-provider>@metamask/safe-event-emitter": true } }, "@metamask/network-controller>@metamask/eth-json-rpc-provider>@metamask/safe-event-emitter": { @@ -1622,8 +1637,8 @@ "packages": { "@metamask/base-controller": true, "@metamask/controller-utils": true, + "@metamask/json-rpc-engine": true, "@metamask/permission-controller>nanoid": true, - "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/rpc-errors": true, "@metamask/utils": true, "deep-freeze-strict": true, @@ -1696,26 +1711,11 @@ "ethereumjs-util>ethereum-cryptography>hash.js": true } }, - "@metamask/providers>@metamask/json-rpc-engine": { - "packages": { - "@metamask/providers>@metamask/json-rpc-engine>@metamask/safe-event-emitter": true, - "@metamask/rpc-errors": true, - "@metamask/utils": true - } - }, - "@metamask/providers>@metamask/json-rpc-engine>@metamask/safe-event-emitter": { - "globals": { - "setTimeout": true - }, - "packages": { - "webpack>events": true - } - }, "@metamask/queued-request-controller": { "packages": { "@metamask/base-controller": true, "@metamask/controller-utils": true, - "@metamask/providers>@metamask/json-rpc-engine": true, + "@metamask/json-rpc-engine": true, "@metamask/rpc-errors": true, "@metamask/selected-network-controller": true } @@ -2033,7 +2033,7 @@ "@metamask/controller-utils": true, "@metamask/eth-query": true, "@metamask/gas-fee-controller": true, - "@metamask/providers>@metamask/rpc-errors": true, + "@metamask/rpc-errors": true, "@metamask/transaction-controller": true, "@metamask/user-operation-controller>@metamask/polling-controller": true, "@metamask/utils": true, @@ -2897,7 +2897,7 @@ "@metamask/safe-event-emitter": true, "eth-json-rpc-filters>async-mutex": true, "eth-json-rpc-filters>eth-query": true, - "json-rpc-engine": true, + "eth-json-rpc-filters>json-rpc-engine": true, "pify": true } }, @@ -2916,6 +2916,17 @@ "watchify>xtend": true } }, + "eth-json-rpc-filters>json-rpc-engine": { + "packages": { + "@metamask/safe-event-emitter": true, + "eth-json-rpc-filters>json-rpc-engine>eth-rpc-errors": true + } + }, + "eth-json-rpc-filters>json-rpc-engine>eth-rpc-errors": { + "packages": { + "@metamask/rpc-errors>fast-safe-stringify": true + } + }, "eth-keyring-controller>@metamask/browser-passworder": { "globals": { "crypto": true @@ -3430,17 +3441,6 @@ "string.prototype.matchall>has-symbols": true } }, - "json-rpc-engine": { - "packages": { - "@metamask/safe-event-emitter": true, - "json-rpc-engine>eth-rpc-errors": true - } - }, - "json-rpc-engine>eth-rpc-errors": { - "packages": { - "@metamask/rpc-errors>fast-safe-stringify": true - } - }, "json-rpc-middleware-stream": { "globals": { "console.warn": true, diff --git a/lavamoat/browserify/desktop/policy.json b/lavamoat/browserify/desktop/policy.json index 4cf946cfa95a..42c6a26a0a90 100644 --- a/lavamoat/browserify/desktop/policy.json +++ b/lavamoat/browserify/desktop/policy.json @@ -1006,8 +1006,8 @@ }, "packages": { "@metamask/eth-json-rpc-middleware>safe-stable-stringify": true, + "@metamask/json-rpc-engine": true, "@metamask/message-manager>@metamask/eth-sig-util": true, - "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/rpc-errors": true, "@metamask/utils": true, "pify": true, @@ -1466,6 +1466,21 @@ "jest-canvas-mock>moo-color>color-name": true } }, + "@metamask/json-rpc-engine": { + "packages": { + "@metamask/json-rpc-engine>@metamask/safe-event-emitter": true, + "@metamask/rpc-errors": true, + "@metamask/utils": true + } + }, + "@metamask/json-rpc-engine>@metamask/safe-event-emitter": { + "globals": { + "setTimeout": true + }, + "packages": { + "webpack>events": true + } + }, "@metamask/keyring-api": { "packages": { "@metamask/keyring-api>uuid": true, @@ -1636,10 +1651,10 @@ "@metamask/eth-json-rpc-middleware": true, "@metamask/eth-query": true, "@metamask/eth-token-tracker>eth-block-tracker": true, + "@metamask/json-rpc-engine": true, "@metamask/network-controller>@metamask/eth-json-rpc-infura": true, "@metamask/network-controller>@metamask/eth-json-rpc-provider": true, "@metamask/network-controller>@metamask/swappable-obj-proxy": true, - "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/rpc-errors": true, "@metamask/utils": true, "browserify>assert": true, @@ -1651,8 +1666,8 @@ "setTimeout": true }, "packages": { + "@metamask/json-rpc-engine": true, "@metamask/network-controller>@metamask/eth-json-rpc-provider": true, - "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/rpc-errors": true, "@metamask/utils": true, "node-fetch": true @@ -1660,8 +1675,8 @@ }, "@metamask/network-controller>@metamask/eth-json-rpc-provider": { "packages": { - "@metamask/network-controller>@metamask/eth-json-rpc-provider>@metamask/safe-event-emitter": true, - "@metamask/providers>@metamask/json-rpc-engine": true + "@metamask/json-rpc-engine": true, + "@metamask/network-controller>@metamask/eth-json-rpc-provider>@metamask/safe-event-emitter": true } }, "@metamask/network-controller>@metamask/eth-json-rpc-provider>@metamask/safe-event-emitter": { @@ -1726,8 +1741,8 @@ "packages": { "@metamask/base-controller": true, "@metamask/controller-utils": true, + "@metamask/json-rpc-engine": true, "@metamask/permission-controller>nanoid": true, - "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/rpc-errors": true, "@metamask/utils": true, "deep-freeze-strict": true, @@ -1827,21 +1842,6 @@ "ethereumjs-util>ethereum-cryptography>hash.js": true } }, - "@metamask/providers>@metamask/json-rpc-engine": { - "packages": { - "@metamask/providers>@metamask/json-rpc-engine>@metamask/safe-event-emitter": true, - "@metamask/rpc-errors": true, - "@metamask/utils": true - } - }, - "@metamask/providers>@metamask/json-rpc-engine>@metamask/safe-event-emitter": { - "globals": { - "setTimeout": true - }, - "packages": { - "webpack>events": true - } - }, "@metamask/providers>@metamask/object-multiplex": { "globals": { "console.warn": true @@ -1866,7 +1866,7 @@ "packages": { "@metamask/base-controller": true, "@metamask/controller-utils": true, - "@metamask/providers>@metamask/json-rpc-engine": true, + "@metamask/json-rpc-engine": true, "@metamask/rpc-errors": true, "@metamask/selected-network-controller": true } @@ -1876,16 +1876,8 @@ "setTimeout": true }, "packages": { - "@metamask/rate-limit-controller>@metamask/base-controller": true, - "json-rpc-engine>eth-rpc-errors": true - } - }, - "@metamask/rate-limit-controller>@metamask/base-controller": { - "globals": { - "setTimeout": true - }, - "packages": { - "immer": true + "@metamask/base-controller": true, + "@metamask/rpc-errors": true } }, "@metamask/rpc-errors": { @@ -2018,9 +2010,9 @@ }, "packages": { "@metamask/base-controller": true, + "@metamask/json-rpc-engine": true, "@metamask/permission-controller": true, "@metamask/post-message-stream": true, - "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/providers>@metamask/object-multiplex": true, "@metamask/rpc-errors": true, "@metamask/snaps-controllers>@xstate/fsm": true, @@ -2313,7 +2305,7 @@ "@metamask/controller-utils": true, "@metamask/eth-query": true, "@metamask/gas-fee-controller": true, - "@metamask/providers>@metamask/rpc-errors": true, + "@metamask/rpc-errors": true, "@metamask/transaction-controller": true, "@metamask/user-operation-controller>@metamask/polling-controller": true, "@metamask/utils": true, @@ -3187,7 +3179,7 @@ "@metamask/safe-event-emitter": true, "eth-json-rpc-filters>async-mutex": true, "eth-json-rpc-filters>eth-query": true, - "json-rpc-engine": true, + "eth-json-rpc-filters>json-rpc-engine": true, "pify": true } }, @@ -3206,6 +3198,17 @@ "watchify>xtend": true } }, + "eth-json-rpc-filters>json-rpc-engine": { + "packages": { + "@metamask/safe-event-emitter": true, + "eth-json-rpc-filters>json-rpc-engine>eth-rpc-errors": true + } + }, + "eth-json-rpc-filters>json-rpc-engine>eth-rpc-errors": { + "packages": { + "@metamask/rpc-errors>fast-safe-stringify": true + } + }, "eth-keyring-controller>@metamask/browser-passworder": { "globals": { "crypto": true @@ -3720,17 +3723,6 @@ "string.prototype.matchall>has-symbols": true } }, - "json-rpc-engine": { - "packages": { - "@metamask/safe-event-emitter": true, - "json-rpc-engine>eth-rpc-errors": true - } - }, - "json-rpc-engine>eth-rpc-errors": { - "packages": { - "@metamask/rpc-errors>fast-safe-stringify": true - } - }, "json-rpc-middleware-stream": { "globals": { "console.warn": true, diff --git a/lavamoat/browserify/flask/policy.json b/lavamoat/browserify/flask/policy.json index b888c806fd77..85fced42159c 100644 --- a/lavamoat/browserify/flask/policy.json +++ b/lavamoat/browserify/flask/policy.json @@ -1006,8 +1006,8 @@ }, "packages": { "@metamask/eth-json-rpc-middleware>safe-stable-stringify": true, + "@metamask/json-rpc-engine": true, "@metamask/message-manager>@metamask/eth-sig-util": true, - "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/rpc-errors": true, "@metamask/utils": true, "pify": true, @@ -1466,6 +1466,21 @@ "jest-canvas-mock>moo-color>color-name": true } }, + "@metamask/json-rpc-engine": { + "packages": { + "@metamask/json-rpc-engine>@metamask/safe-event-emitter": true, + "@metamask/rpc-errors": true, + "@metamask/utils": true + } + }, + "@metamask/json-rpc-engine>@metamask/safe-event-emitter": { + "globals": { + "setTimeout": true + }, + "packages": { + "webpack>events": true + } + }, "@metamask/keyring-api": { "packages": { "@metamask/keyring-api>uuid": true, @@ -1636,10 +1651,10 @@ "@metamask/eth-json-rpc-middleware": true, "@metamask/eth-query": true, "@metamask/eth-token-tracker>eth-block-tracker": true, + "@metamask/json-rpc-engine": true, "@metamask/network-controller>@metamask/eth-json-rpc-infura": true, "@metamask/network-controller>@metamask/eth-json-rpc-provider": true, "@metamask/network-controller>@metamask/swappable-obj-proxy": true, - "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/rpc-errors": true, "@metamask/utils": true, "browserify>assert": true, @@ -1651,8 +1666,8 @@ "setTimeout": true }, "packages": { + "@metamask/json-rpc-engine": true, "@metamask/network-controller>@metamask/eth-json-rpc-provider": true, - "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/rpc-errors": true, "@metamask/utils": true, "node-fetch": true @@ -1660,8 +1675,8 @@ }, "@metamask/network-controller>@metamask/eth-json-rpc-provider": { "packages": { - "@metamask/network-controller>@metamask/eth-json-rpc-provider>@metamask/safe-event-emitter": true, - "@metamask/providers>@metamask/json-rpc-engine": true + "@metamask/json-rpc-engine": true, + "@metamask/network-controller>@metamask/eth-json-rpc-provider>@metamask/safe-event-emitter": true } }, "@metamask/network-controller>@metamask/eth-json-rpc-provider>@metamask/safe-event-emitter": { @@ -1726,8 +1741,8 @@ "packages": { "@metamask/base-controller": true, "@metamask/controller-utils": true, + "@metamask/json-rpc-engine": true, "@metamask/permission-controller>nanoid": true, - "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/rpc-errors": true, "@metamask/utils": true, "deep-freeze-strict": true, @@ -1861,21 +1876,6 @@ "ethereumjs-util>ethereum-cryptography>hash.js": true } }, - "@metamask/providers>@metamask/json-rpc-engine": { - "packages": { - "@metamask/providers>@metamask/json-rpc-engine>@metamask/safe-event-emitter": true, - "@metamask/rpc-errors": true, - "@metamask/utils": true - } - }, - "@metamask/providers>@metamask/json-rpc-engine>@metamask/safe-event-emitter": { - "globals": { - "setTimeout": true - }, - "packages": { - "webpack>events": true - } - }, "@metamask/providers>@metamask/object-multiplex": { "globals": { "console.warn": true @@ -1900,7 +1900,7 @@ "packages": { "@metamask/base-controller": true, "@metamask/controller-utils": true, - "@metamask/providers>@metamask/json-rpc-engine": true, + "@metamask/json-rpc-engine": true, "@metamask/rpc-errors": true, "@metamask/selected-network-controller": true } @@ -1910,16 +1910,8 @@ "setTimeout": true }, "packages": { - "@metamask/rate-limit-controller>@metamask/base-controller": true, - "json-rpc-engine>eth-rpc-errors": true - } - }, - "@metamask/rate-limit-controller>@metamask/base-controller": { - "globals": { - "setTimeout": true - }, - "packages": { - "immer": true + "@metamask/base-controller": true, + "@metamask/rpc-errors": true } }, "@metamask/rpc-errors": { @@ -2052,9 +2044,9 @@ }, "packages": { "@metamask/base-controller": true, + "@metamask/json-rpc-engine": true, "@metamask/permission-controller": true, "@metamask/post-message-stream": true, - "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/providers>@metamask/object-multiplex": true, "@metamask/rpc-errors": true, "@metamask/snaps-controllers>@xstate/fsm": true, @@ -2347,7 +2339,7 @@ "@metamask/controller-utils": true, "@metamask/eth-query": true, "@metamask/gas-fee-controller": true, - "@metamask/providers>@metamask/rpc-errors": true, + "@metamask/rpc-errors": true, "@metamask/transaction-controller": true, "@metamask/user-operation-controller>@metamask/polling-controller": true, "@metamask/utils": true, @@ -3221,7 +3213,7 @@ "@metamask/safe-event-emitter": true, "eth-json-rpc-filters>async-mutex": true, "eth-json-rpc-filters>eth-query": true, - "json-rpc-engine": true, + "eth-json-rpc-filters>json-rpc-engine": true, "pify": true } }, @@ -3240,6 +3232,17 @@ "watchify>xtend": true } }, + "eth-json-rpc-filters>json-rpc-engine": { + "packages": { + "@metamask/safe-event-emitter": true, + "eth-json-rpc-filters>json-rpc-engine>eth-rpc-errors": true + } + }, + "eth-json-rpc-filters>json-rpc-engine>eth-rpc-errors": { + "packages": { + "@metamask/rpc-errors>fast-safe-stringify": true + } + }, "eth-keyring-controller>@metamask/browser-passworder": { "globals": { "crypto": true @@ -3754,17 +3757,6 @@ "string.prototype.matchall>has-symbols": true } }, - "json-rpc-engine": { - "packages": { - "@metamask/safe-event-emitter": true, - "json-rpc-engine>eth-rpc-errors": true - } - }, - "json-rpc-engine>eth-rpc-errors": { - "packages": { - "@metamask/rpc-errors>fast-safe-stringify": true - } - }, "json-rpc-middleware-stream": { "globals": { "console.warn": true, diff --git a/lavamoat/browserify/main/policy.json b/lavamoat/browserify/main/policy.json index 58ae8438cecc..ac2c3f754f0b 100644 --- a/lavamoat/browserify/main/policy.json +++ b/lavamoat/browserify/main/policy.json @@ -929,8 +929,8 @@ }, "packages": { "@metamask/eth-json-rpc-middleware>safe-stable-stringify": true, + "@metamask/json-rpc-engine": true, "@metamask/message-manager>@metamask/eth-sig-util": true, - "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/rpc-errors": true, "@metamask/utils": true, "pify": true, @@ -1389,6 +1389,21 @@ "jest-canvas-mock>moo-color>color-name": true } }, + "@metamask/json-rpc-engine": { + "packages": { + "@metamask/json-rpc-engine>@metamask/safe-event-emitter": true, + "@metamask/rpc-errors": true, + "@metamask/utils": true + } + }, + "@metamask/json-rpc-engine>@metamask/safe-event-emitter": { + "globals": { + "setTimeout": true + }, + "packages": { + "webpack>events": true + } + }, "@metamask/keyring-api": { "packages": { "@metamask/keyring-api>uuid": true, @@ -1559,10 +1574,10 @@ "@metamask/eth-json-rpc-middleware": true, "@metamask/eth-query": true, "@metamask/eth-token-tracker>eth-block-tracker": true, + "@metamask/json-rpc-engine": true, "@metamask/network-controller>@metamask/eth-json-rpc-infura": true, "@metamask/network-controller>@metamask/eth-json-rpc-provider": true, "@metamask/network-controller>@metamask/swappable-obj-proxy": true, - "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/rpc-errors": true, "@metamask/utils": true, "browserify>assert": true, @@ -1574,8 +1589,8 @@ "setTimeout": true }, "packages": { + "@metamask/json-rpc-engine": true, "@metamask/network-controller>@metamask/eth-json-rpc-provider": true, - "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/rpc-errors": true, "@metamask/utils": true, "node-fetch": true @@ -1583,8 +1598,8 @@ }, "@metamask/network-controller>@metamask/eth-json-rpc-provider": { "packages": { - "@metamask/network-controller>@metamask/eth-json-rpc-provider>@metamask/safe-event-emitter": true, - "@metamask/providers>@metamask/json-rpc-engine": true + "@metamask/json-rpc-engine": true, + "@metamask/network-controller>@metamask/eth-json-rpc-provider>@metamask/safe-event-emitter": true } }, "@metamask/network-controller>@metamask/eth-json-rpc-provider>@metamask/safe-event-emitter": { @@ -1649,8 +1664,8 @@ "packages": { "@metamask/base-controller": true, "@metamask/controller-utils": true, + "@metamask/json-rpc-engine": true, "@metamask/permission-controller>nanoid": true, - "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/rpc-errors": true, "@metamask/utils": true, "deep-freeze-strict": true, @@ -1784,21 +1799,6 @@ "ethereumjs-util>ethereum-cryptography>hash.js": true } }, - "@metamask/providers>@metamask/json-rpc-engine": { - "packages": { - "@metamask/providers>@metamask/json-rpc-engine>@metamask/safe-event-emitter": true, - "@metamask/rpc-errors": true, - "@metamask/utils": true - } - }, - "@metamask/providers>@metamask/json-rpc-engine>@metamask/safe-event-emitter": { - "globals": { - "setTimeout": true - }, - "packages": { - "webpack>events": true - } - }, "@metamask/providers>@metamask/object-multiplex": { "globals": { "console.warn": true @@ -1823,7 +1823,7 @@ "packages": { "@metamask/base-controller": true, "@metamask/controller-utils": true, - "@metamask/providers>@metamask/json-rpc-engine": true, + "@metamask/json-rpc-engine": true, "@metamask/rpc-errors": true, "@metamask/selected-network-controller": true } @@ -1833,16 +1833,8 @@ "setTimeout": true }, "packages": { - "@metamask/rate-limit-controller>@metamask/base-controller": true, - "json-rpc-engine>eth-rpc-errors": true - } - }, - "@metamask/rate-limit-controller>@metamask/base-controller": { - "globals": { - "setTimeout": true - }, - "packages": { - "immer": true + "@metamask/base-controller": true, + "@metamask/rpc-errors": true } }, "@metamask/rpc-errors": { @@ -1975,9 +1967,9 @@ }, "packages": { "@metamask/base-controller": true, + "@metamask/json-rpc-engine": true, "@metamask/permission-controller": true, "@metamask/post-message-stream": true, - "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/providers>@metamask/object-multiplex": true, "@metamask/rpc-errors": true, "@metamask/snaps-controllers>@xstate/fsm": true, @@ -2270,7 +2262,7 @@ "@metamask/controller-utils": true, "@metamask/eth-query": true, "@metamask/gas-fee-controller": true, - "@metamask/providers>@metamask/rpc-errors": true, + "@metamask/rpc-errors": true, "@metamask/transaction-controller": true, "@metamask/user-operation-controller>@metamask/polling-controller": true, "@metamask/utils": true, @@ -3144,7 +3136,7 @@ "@metamask/safe-event-emitter": true, "eth-json-rpc-filters>async-mutex": true, "eth-json-rpc-filters>eth-query": true, - "json-rpc-engine": true, + "eth-json-rpc-filters>json-rpc-engine": true, "pify": true } }, @@ -3163,6 +3155,17 @@ "watchify>xtend": true } }, + "eth-json-rpc-filters>json-rpc-engine": { + "packages": { + "@metamask/safe-event-emitter": true, + "eth-json-rpc-filters>json-rpc-engine>eth-rpc-errors": true + } + }, + "eth-json-rpc-filters>json-rpc-engine>eth-rpc-errors": { + "packages": { + "@metamask/rpc-errors>fast-safe-stringify": true + } + }, "eth-keyring-controller>@metamask/browser-passworder": { "globals": { "crypto": true @@ -3677,17 +3680,6 @@ "string.prototype.matchall>has-symbols": true } }, - "json-rpc-engine": { - "packages": { - "@metamask/safe-event-emitter": true, - "json-rpc-engine>eth-rpc-errors": true - } - }, - "json-rpc-engine>eth-rpc-errors": { - "packages": { - "@metamask/rpc-errors>fast-safe-stringify": true - } - }, "json-rpc-middleware-stream": { "globals": { "console.warn": true, diff --git a/lavamoat/browserify/mmi/policy.json b/lavamoat/browserify/mmi/policy.json index 5bed0e87f47f..eae7f6cdb3ce 100644 --- a/lavamoat/browserify/mmi/policy.json +++ b/lavamoat/browserify/mmi/policy.json @@ -1061,8 +1061,8 @@ }, "packages": { "@metamask/eth-json-rpc-middleware>safe-stable-stringify": true, + "@metamask/json-rpc-engine": true, "@metamask/message-manager>@metamask/eth-sig-util": true, - "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/rpc-errors": true, "@metamask/utils": true, "pify": true, @@ -1521,6 +1521,21 @@ "jest-canvas-mock>moo-color>color-name": true } }, + "@metamask/json-rpc-engine": { + "packages": { + "@metamask/json-rpc-engine>@metamask/safe-event-emitter": true, + "@metamask/rpc-errors": true, + "@metamask/utils": true + } + }, + "@metamask/json-rpc-engine>@metamask/safe-event-emitter": { + "globals": { + "setTimeout": true + }, + "packages": { + "webpack>events": true + } + }, "@metamask/keyring-api": { "packages": { "@metamask/keyring-api>uuid": true, @@ -1691,10 +1706,10 @@ "@metamask/eth-json-rpc-middleware": true, "@metamask/eth-query": true, "@metamask/eth-token-tracker>eth-block-tracker": true, + "@metamask/json-rpc-engine": true, "@metamask/network-controller>@metamask/eth-json-rpc-infura": true, "@metamask/network-controller>@metamask/eth-json-rpc-provider": true, "@metamask/network-controller>@metamask/swappable-obj-proxy": true, - "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/rpc-errors": true, "@metamask/utils": true, "browserify>assert": true, @@ -1706,8 +1721,8 @@ "setTimeout": true }, "packages": { + "@metamask/json-rpc-engine": true, "@metamask/network-controller>@metamask/eth-json-rpc-provider": true, - "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/rpc-errors": true, "@metamask/utils": true, "node-fetch": true @@ -1715,8 +1730,8 @@ }, "@metamask/network-controller>@metamask/eth-json-rpc-provider": { "packages": { - "@metamask/network-controller>@metamask/eth-json-rpc-provider>@metamask/safe-event-emitter": true, - "@metamask/providers>@metamask/json-rpc-engine": true + "@metamask/json-rpc-engine": true, + "@metamask/network-controller>@metamask/eth-json-rpc-provider>@metamask/safe-event-emitter": true } }, "@metamask/network-controller>@metamask/eth-json-rpc-provider>@metamask/safe-event-emitter": { @@ -1781,8 +1796,8 @@ "packages": { "@metamask/base-controller": true, "@metamask/controller-utils": true, + "@metamask/json-rpc-engine": true, "@metamask/permission-controller>nanoid": true, - "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/rpc-errors": true, "@metamask/utils": true, "deep-freeze-strict": true, @@ -1882,21 +1897,6 @@ "ethereumjs-util>ethereum-cryptography>hash.js": true } }, - "@metamask/providers>@metamask/json-rpc-engine": { - "packages": { - "@metamask/providers>@metamask/json-rpc-engine>@metamask/safe-event-emitter": true, - "@metamask/rpc-errors": true, - "@metamask/utils": true - } - }, - "@metamask/providers>@metamask/json-rpc-engine>@metamask/safe-event-emitter": { - "globals": { - "setTimeout": true - }, - "packages": { - "webpack>events": true - } - }, "@metamask/providers>@metamask/object-multiplex": { "globals": { "console.warn": true @@ -1921,7 +1921,7 @@ "packages": { "@metamask/base-controller": true, "@metamask/controller-utils": true, - "@metamask/providers>@metamask/json-rpc-engine": true, + "@metamask/json-rpc-engine": true, "@metamask/rpc-errors": true, "@metamask/selected-network-controller": true } @@ -1931,16 +1931,8 @@ "setTimeout": true }, "packages": { - "@metamask/rate-limit-controller>@metamask/base-controller": true, - "json-rpc-engine>eth-rpc-errors": true - } - }, - "@metamask/rate-limit-controller>@metamask/base-controller": { - "globals": { - "setTimeout": true - }, - "packages": { - "immer": true + "@metamask/base-controller": true, + "@metamask/rpc-errors": true } }, "@metamask/rpc-errors": { @@ -2073,9 +2065,9 @@ }, "packages": { "@metamask/base-controller": true, + "@metamask/json-rpc-engine": true, "@metamask/permission-controller": true, "@metamask/post-message-stream": true, - "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/providers>@metamask/object-multiplex": true, "@metamask/rpc-errors": true, "@metamask/snaps-controllers>@xstate/fsm": true, @@ -2368,7 +2360,7 @@ "@metamask/controller-utils": true, "@metamask/eth-query": true, "@metamask/gas-fee-controller": true, - "@metamask/providers>@metamask/rpc-errors": true, + "@metamask/rpc-errors": true, "@metamask/transaction-controller": true, "@metamask/user-operation-controller>@metamask/polling-controller": true, "@metamask/utils": true, @@ -3242,7 +3234,7 @@ "@metamask/safe-event-emitter": true, "eth-json-rpc-filters>async-mutex": true, "eth-json-rpc-filters>eth-query": true, - "json-rpc-engine": true, + "eth-json-rpc-filters>json-rpc-engine": true, "pify": true } }, @@ -3261,6 +3253,17 @@ "watchify>xtend": true } }, + "eth-json-rpc-filters>json-rpc-engine": { + "packages": { + "@metamask/safe-event-emitter": true, + "eth-json-rpc-filters>json-rpc-engine>eth-rpc-errors": true + } + }, + "eth-json-rpc-filters>json-rpc-engine>eth-rpc-errors": { + "packages": { + "@metamask/rpc-errors>fast-safe-stringify": true + } + }, "eth-keyring-controller>@metamask/browser-passworder": { "globals": { "crypto": true @@ -3775,17 +3778,6 @@ "string.prototype.matchall>has-symbols": true } }, - "json-rpc-engine": { - "packages": { - "@metamask/safe-event-emitter": true, - "json-rpc-engine>eth-rpc-errors": true - } - }, - "json-rpc-engine>eth-rpc-errors": { - "packages": { - "@metamask/rpc-errors>fast-safe-stringify": true - } - }, "json-rpc-middleware-stream": { "globals": { "console.warn": true, diff --git a/package.json b/package.json index f9f690abecfd..57d5857c6082 100644 --- a/package.json +++ b/package.json @@ -269,6 +269,7 @@ "@metamask/ethjs-query": "^0.7.1", "@metamask/gas-fee-controller": "^13.0.0", "@metamask/jazzicon": "^2.0.0", + "@metamask/json-rpc-engine": "^7.3.2", "@metamask/keyring-api": "^3.0.0", "@metamask/keyring-controller": "patch:@metamask/keyring-controller@npm%3A12.2.0#~/.yarn/patches/@metamask-keyring-controller-npm-12.2.0-2b196324d1.patch", "@metamask/logging-controller": "^2.0.2", @@ -340,7 +341,6 @@ "immer": "^9.0.6", "is-retry-allowed": "^2.2.0", "jest-junit": "^14.0.1", - "json-rpc-engine": "^6.1.0", "json-rpc-middleware-stream": "^5.0.1", "labeled-stream-splicer": "^2.0.2", "localforage": "^1.9.0", diff --git a/test/stub/provider.js b/test/stub/provider.js index e070d55fa6b0..f86762218adf 100644 --- a/test/stub/provider.js +++ b/test/stub/provider.js @@ -1,4 +1,7 @@ -import { JsonRpcEngine, createScaffoldMiddleware } from 'json-rpc-engine'; +import { + JsonRpcEngine, + createScaffoldMiddleware, +} from '@metamask/json-rpc-engine'; import { providerAsMiddleware } from '@metamask/eth-json-rpc-middleware'; import Ganache from 'ganache'; diff --git a/yarn.lock b/yarn.lock index 4fcbdaca78af..5b96db9ac707 100644 --- a/yarn.lock +++ b/yarn.lock @@ -24835,6 +24835,7 @@ __metadata: "@metamask/forwarder": "npm:^1.1.0" "@metamask/gas-fee-controller": "npm:^13.0.0" "@metamask/jazzicon": "npm:^2.0.0" + "@metamask/json-rpc-engine": "npm:^7.3.2" "@metamask/keyring-api": "npm:^3.0.0" "@metamask/keyring-controller": "patch:@metamask/keyring-controller@npm%3A12.2.0#~/.yarn/patches/@metamask-keyring-controller-npm-12.2.0-2b196324d1.patch" "@metamask/logging-controller": "npm:^2.0.2" @@ -25029,7 +25030,6 @@ __metadata: jest-junit: "npm:^14.0.1" js-yaml: "npm:^4.1.0" jsdom: "npm:^16.7.0" - json-rpc-engine: "npm:^6.1.0" json-rpc-middleware-stream: "npm:^5.0.1" koa: "npm:^2.7.0" labeled-stream-splicer: "npm:^2.0.2"