diff --git a/.yarn/patches/@metamask-network-controller-npm-18.0.1-c4d0cfaecd.patch b/.yarn/patches/@metamask-network-controller-npm-18.0.1-c4d0cfaecd.patch index 6b27f32635bb..9469548a639d 100644 --- a/.yarn/patches/@metamask-network-controller-npm-18.0.1-c4d0cfaecd.patch +++ b/.yarn/patches/@metamask-network-controller-npm-18.0.1-c4d0cfaecd.patch @@ -1,55 +1,24 @@ diff --git a/dist/chunk-VNCJZRDU.js b/dist/chunk-VNCJZRDU.js -index 78251fc9517438d90261ed53172d2a4133d3a5fd..d9fa7bc4b4fdc7d2cc9687cf9ad34c2e65cf809e 100644 +index 78251fc9517438d90261ed53172d2a4133d3a5fd..3ecc0c2838ac12c0ff5b5521a82b08955287956b 100644 --- a/dist/chunk-VNCJZRDU.js +++ b/dist/chunk-VNCJZRDU.js -@@ -320,10 +320,14 @@ var NetworkController = class extends _basecontroller.BaseController { - * Populates the network clients and establishes the initial network based on - * the provider configuration in state. - */ -- async initializeProvider() { -+ async initializeProvider(lookup) { +@@ -323,7 +323,6 @@ var NetworkController = class extends _basecontroller.BaseController { + async initializeProvider() { _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _ensureAutoManagedNetworkClientRegistryPopulated, ensureAutoManagedNetworkClientRegistryPopulated_fn).call(this); _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _applyNetworkSelection, applyNetworkSelection_fn).call(this); - await this.lookupNetwork(); -+ -+ lookup = lookup !== undefined ? lookup : true; -+ if (lookup) { -+ await this.lookupNetwork(); -+ } } /** * Refreshes the network meta with EIP-1559 support and the network status diff --git a/dist/chunk-XWP6GXMK.mjs b/dist/chunk-XWP6GXMK.mjs -index fb7e30d27367a38e8a357ff9e744894a4505b5a5..670117818e9634c360eeef632e7b614bbc6df9ea 100644 +index fb7e30d27367a38e8a357ff9e744894a4505b5a5..884bb1d124934a613847d7fd398fbc6cb02cade8 100644 --- a/dist/chunk-XWP6GXMK.mjs +++ b/dist/chunk-XWP6GXMK.mjs -@@ -320,10 +320,14 @@ var NetworkController = class extends BaseController { - * Populates the network clients and establishes the initial network based on - * the provider configuration in state. - */ -- async initializeProvider() { -+ async initializeProvider(lookup) { +@@ -323,7 +323,6 @@ var NetworkController = class extends BaseController { + async initializeProvider() { __privateMethod(this, _ensureAutoManagedNetworkClientRegistryPopulated, ensureAutoManagedNetworkClientRegistryPopulated_fn).call(this); __privateMethod(this, _applyNetworkSelection, applyNetworkSelection_fn).call(this); - await this.lookupNetwork(); -+ -+ lookup = lookup !== undefined ? lookup : true; -+ if (lookup) { -+ await this.lookupNetwork(); -+ } } /** * Refreshes the network meta with EIP-1559 support and the network status -diff --git a/dist/types/NetworkController.d.ts b/dist/types/NetworkController.d.ts -index f1e1e49de2461d7606374d6a1a406abd54581bf7..a06f3c627bf1e31a2ca3ef351a74c3615474fea2 100644 ---- a/dist/types/NetworkController.d.ts -+++ b/dist/types/NetworkController.d.ts -@@ -272,7 +272,7 @@ export declare class NetworkController extends BaseController; -+ initializeProvider(lookup: Boolean): Promise; - /** - * Refreshes the network meta with EIP-1559 support and the network status - * based on the given network client ID. diff --git a/.yarn/patches/PATCH.txt b/.yarn/patches/PATCH.txt new file mode 100644 index 000000000000..cc75703faaa6 --- /dev/null +++ b/.yarn/patches/PATCH.txt @@ -0,0 +1,6 @@ +@metamask-network-controller-npm-18.0.1-c4d0cfaecd.patch + +We remove lookupNetwork from initializeProvider in the network controller to prevent network requests before user onboarding is completed. +The network lookup is done after onboarding is completed, and when the extension reloads if onboarding has been completed. +This patch is part of a temporary fix that will be reverted soon to make way for a more permanent solution. https://github.com/MetaMask/metamask-extension/pull/23005 +You can see the changes before compilation on this branch: https://github.com/MetaMask/core/compare/pnf/ext-23622-review?expand=1 \ No newline at end of file diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 73b175f059bb..e0895451ee92 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -483,7 +483,7 @@ export default class MetamaskController extends EventEmitter { trackMetaMetricsEvent: (...args) => this.metaMetricsController.trackEvent(...args), }); - this.networkController.initializeProvider(false); + this.networkController.initializeProvider(); this.provider = this.networkController.getProviderAndBlockTracker().provider; this.blockTracker = diff --git a/yarn.lock b/yarn.lock index 29aa31de0433..620d820f6e8c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4901,7 +4901,7 @@ __metadata: "@metamask/network-controller@patch:@metamask/network-controller@npm%3A18.0.1#~/.yarn/patches/@metamask-network-controller-npm-18.0.1-c4d0cfaecd.patch": version: 18.0.1 - resolution: "@metamask/network-controller@patch:@metamask/network-controller@npm%3A18.0.1#~/.yarn/patches/@metamask-network-controller-npm-18.0.1-c4d0cfaecd.patch::version=18.0.1&hash=621add" + resolution: "@metamask/network-controller@patch:@metamask/network-controller@npm%3A18.0.1#~/.yarn/patches/@metamask-network-controller-npm-18.0.1-c4d0cfaecd.patch::version=18.0.1&hash=be87e4" dependencies: "@metamask/base-controller": "npm:^5.0.1" "@metamask/controller-utils": "npm:^9.0.1" @@ -4917,7 +4917,7 @@ __metadata: eth-block-tracker: "npm:^8.0.0" immer: "npm:^9.0.6" uuid: "npm:^8.3.2" - checksum: fe4aafe65964a85a7e9828b8a797334839d6a8d93471b3a3f8e7402cdc4891e89133d526077a8fc9a97e20443cd3e48eed8049754513b11eb626f162d4a882f0 + checksum: 348114ad32db34d4a197422f57f0f394442d1b7a2c79249768b6b061ce64ea0cf6a39d23b743075ef6b8d5778243545061f11aa74d839ec58c14f0386ed96598 languageName: node linkType: hard