-
-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update controllers that rely on provider to listen to `NetworkControl…
…ler:networkDidChange` instead of `NetworkController:stateChange` (#3610) ## Explanation Listening to `NetworkController:stateChange` to catch network changes doesn't guarantee that the provider proxy has also been updated to point to the new network. `NetworkController:networkDidChange` does however. This PR updates several controllers that rely on the provider proxy to listen to `NetworkController:networkDidChange` rather than `NetworkController:stateChange`. GasFeeController and AssetsContractController are already listening to `NetworkController:networkDidChange` on the extension side despite their constructor param hook names still being `onNetworkStateChange` (which this PR also renames to be correct) ## References * See MetaMask/MetaMask-planning#1713 ## Changelog ### `@metamask/assets-controllers` - **BREAKING**: `TokensController` constructor params `onNetworkStateChange` replaced with `onNetworkDidChange` - **BREAKING**: `AssetsContractController` constructor params `onNetworkStateChange` replaced with `onNetworkDidChange` ### `@metamask/ens-controller` - **BREAKING**: `EnsController` constructor params `onNetworkStateChange` replaced with `onNetworkDidChange` ### `@metamask/gas-fee-controller` - **BREAKING**: `GasFeeController` will subscribe to `NetworkController:networkDidChange` now instead of `NetworkController:stateChange` using the passed in `messenger` param when `onNetworkDidChange` is not provided - **CHANGED**: `GasFeeController` constructor params optional `onNetworkStateChange` replaced with optional `onNetworkDidChange` ## Checklist - [ ] I've updated the test suite for new or updated code as appropriate - [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [ ] I've highlighted breaking changes using the "BREAKING" category above as appropriate --------- Co-authored-by: Alex Donesky <adonesky@gmail.com>
- Loading branch information
Showing
12 changed files
with
94 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.