Skip to content

Commit a36e334

Browse files
authored
cherry pick metamask-mobile/pull/11718 (#11726)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Cherry picks #11718 to release 32 ## **Related issues** ## **Manual testing steps** ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
1 parent ecf8d71 commit a36e334

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

app/core/Engine.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ class Engine {
700700
// @ts-expect-error TODO: Resolve mismatch between base-controller versions.
701701
messenger: this.controllerMessenger.getRestricted({
702702
name: 'TokenListController',
703-
allowedActions: [],
703+
allowedActions: [`${networkController.name}:getNetworkClientById`],
704704
allowedEvents: [`${networkController.name}:stateChange`],
705705
}),
706706
});

patches/@metamask+assets-controllers+30.0.0.patch

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,28 @@ index 542e3f6..af49a85 100644
1515
});
1616
}
1717
});
18+
diff --git a/node_modules/@metamask/assets-controllers/dist/chunk-5F5EQAX5.js b/node_modules/@metamask/assets-controllers/dist/chunk-5F5EQAX5.js
19+
index 6d1492c..2ac3275 100644
20+
--- a/node_modules/@metamask/assets-controllers/dist/chunk-5F5EQAX5.js
21+
+++ b/node_modules/@metamask/assets-controllers/dist/chunk-5F5EQAX5.js
22+
@@ -247,10 +247,15 @@ var TokenListController = class extends _pollingcontroller.StaticIntervalPolling
23+
};
24+
_onNetworkControllerStateChange = new WeakSet();
25+
onNetworkControllerStateChange_fn = async function(networkControllerState) {
26+
- if (this.chainId !== networkControllerState.providerConfig.chainId) {
27+
+ const selectedNetworkClient = this.messagingSystem.call(
28+
+ "NetworkController:getNetworkClientById",
29+
+ networkControllerState.selectedNetworkClientId
30+
+ );
31+
+ const { chainId } = selectedNetworkClient.configuration;
32+
+ if (this.chainId !== chainId) {
33+
this.abortController.abort();
34+
this.abortController = new AbortController();
35+
- this.chainId = networkControllerState.providerConfig.chainId;
36+
+ this.chainId = chainId;
37+
if (this.state.preventPollingOnNetworkRestart) {
38+
this.clearingTokenListData();
39+
} else {
1840
diff --git a/node_modules/@metamask/assets-controllers/dist/chunk-6W5EQ3JQ.js b/node_modules/@metamask/assets-controllers/dist/chunk-6W5EQ3JQ.js
1941
index 0dc70ec..461a210 100644
2042
--- a/node_modules/@metamask/assets-controllers/dist/chunk-6W5EQ3JQ.js

0 commit comments

Comments
 (0)