Skip to content
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: Feat/handle multichain network and account switching #5215

Open
wants to merge 6 commits into
base: feat/multichain-networks-controller
Choose a base branch
from

Conversation

Cal-L
Copy link
Contributor

@Cal-L Cal-L commented Jan 30, 2025

Explanation

This PR updates both the MultichainNetworkController and AccountsController to handle network switching as well as account switching. The logic handles the following logic:

  • Switching accounts on AccountsController will notify MultichainNetworkController to update if the account belongs to evm vs non-evm network (MultichainNetworkController subscribes to AccountsController event)
  • Switching between networks on MultichainNetworkController will notify AccountsController to update accounts based on which network the account belongs to (AccountsController subscribes to MultichainNetworkController event)

References

Changelog

@metamask/accounts-controller

  • BREAKING: Added MultichainNetworkSetActiveNetworkEvent to allowed events

@metamask/multichain-network-controller

  • ADDED:
  • Allowed actions - NetworkControllerGetStateAction | NetworkControllerSetActiveNetworkAction
  • Allowed events - AccountsControllerSelectedAccountChangeEvent

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
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

@Cal-L Cal-L requested a review from a team as a code owner January 30, 2025 06:01
@tommasini
Copy link
Contributor

This looks amazing! Lets align today with the review made on the PR #5209

…Mask/core into feat/handle-multichain-network-and-account-switching
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants