[pull] main from MetaMask:main#285
Merged
Merged
Conversation
## Explanation This PR adds an init function to the network-enablement controllers, initializing them from the network configuration. It also listens for the transaction:submitted event and enables the relevant network so users can immediately see the submitted transaction and their assets. <!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? * Are there any changes whose purpose might not obvious to those unfamiliar with the domain? * If your primary goal was to update one package but you found you had to update another one along the way, why did you do so? * If you had to upgrade a dependency, why did you do so? --> ## References <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes #12345 * Related to #67890 --> ## 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 communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [ ] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes
## Explanation **What is the current state of things and why does it need to change?** An alignment mechanism didn't exist for multichain account groups. It needs to be added because we can have multiple scenarios where misalignment occurs: 1. State 1 -> State 2 - We will have to align existing account groups when they are created. 2. New protocols added - Existing groups will have to have an account associated with the new provider (chain). 3. Basic functionality toggle - With basic functionality off, we can have a scenario where only an EVM account is created when a group is created. 4. Discovery - When importing an SRP, the discovery process might not necessarily yield a discovered account for every provider and we have to align the group in those scenarios. **What is the solution your changes offer and how does it work?** It adds an alignment mechanism at the group level and it runs through the list of providers and checks to see if any accounts exist for that particular group, if there aren't any, then it calls `provider.createAccounts` with the associated entropy id and group index. Alignment methods were added at the wallet level where a wallet would call align on all of its existing groups and similarly at the service level where it can call align on all of its wallets. Singular methods were also added at the wallet and service level where a particular group associated with a wallet can be aligned and a particular wallet can be aligned by the service. Note: I also refactored the `withCreateAccount` in `SnapAccountProvider` to be a bit more readable and easier to understand. ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.3)
Can you help keep this open source service alive? 💖 Please sponsor : )