-
-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add MultichainNetworkController
to handle both EVM and non-EVM network and account switching
#5215
base: main
Are you sure you want to change the base?
Conversation
… to update nonEvmNetwork state variable to false; added unit tests for setActiveNetwork and both new setters
This looks amazing! Lets align today with the review made on the PR #5209 |
…script documentation, and solve most of the review comments
…Mask/core into feat/handle-multichain-network-and-account-switching
…Mask/core into feat/handle-multichain-network-and-account-switching
MultichainNetworkController
to handle both EVM and non-EVM network and account switching
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello! I left some comments. I'm still trying to understand the changes introduced here. I know more changes are coming, but I am still curious why some things are being introduced here without being explicitly used, when they could be introduced later. Other than that I had some improvements we could make to the types, and some naming adjustments.
packages/multichain-network-controller/src/MultichainNetworkController.ts
Outdated
Show resolved
Hide resolved
packages/multichain-network-controller/src/MultichainNetworkController.ts
Outdated
Show resolved
Hide resolved
packages/multichain-network-controller/src/MultichainNetworkController.ts
Outdated
Show resolved
Hide resolved
packages/multichain-network-controller/src/MultichainNetworkController.ts
Outdated
Show resolved
Hide resolved
packages/multichain-network-controller/src/MultichainNetworkController.ts
Outdated
Show resolved
Hide resolved
packages/multichain-network-controller/src/MultichainNetworkController.ts
Outdated
Show resolved
Hide resolved
@Cal-L Can you run |
…f github.com:MetaMask/core into feat/handle-multichain-network-and-account-switching
Co-authored-by: Elliot Winkler <[email protected]>
…ntroller.ts Co-authored-by: Elliot Winkler <[email protected]>
Co-authored-by: Elliot Winkler <[email protected]>
…f github.com:MetaMask/core into feat/handle-multichain-network-and-account-switching
…ichain-network-and-account-switching
Explanation
This PR updates both the MultichainNetworkController and AccountsController to handle network switching as well as account switching. The logic handles the following logic:
References
Fixes https://github.com/MetaMask/accounts-planning/issues/804
Changelog
@metamask/accounts-controller
MultichainNetworkSetActiveNetworkEvent
to allowed events. This is used to subscribe to thesetActiveNetwork
event from theMultichainNetworkController
and is responsible for updating selected account based on network changes (both EVM and non-EVM).@metamask/multichain-network-controller
NetworkControllerGetStateAction
|NetworkControllerSetActiveNetworkAction
. TheMultichainNetworkController
acts as a proxy for theNetworkController
and will update it based on EVM network changes.AccountsControllerSelectedAccountChangeEvent
to allowed events. This is used to subscribe to theselectedAccountChange
event from theAccountsController
and is responsible for updating active network based on account changes (both EVM and non-EVM).Checklist