Skip to content

Commit

Permalink
Update patch and add patch docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronfigueiredo committed Mar 25, 2024
1 parent 7e532de commit 63af236
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 40 deletions.
Original file line number Diff line number Diff line change
@@ -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<typeof name, Netwo
* Populates the network clients and establishes the initial network based on
* the provider configuration in state.
*/
- initializeProvider(): Promise<void>;
+ initializeProvider(lookup: Boolean): Promise<void>;
/**
* Refreshes the network meta with EIP-1559 support and the network status
* based on the given network client ID.
6 changes: 6 additions & 0 deletions .yarn/patches/PATCH.txt
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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

Expand Down

0 comments on commit 63af236

Please sign in to comment.