feat(snap-account-service): forward selected account group accounts#8763
Merged
ccharly merged 21 commits intoMay 11, 2026
Conversation
…+ forward to Snap keyring
Contributor
Author
|
@metamaskbot publish-preview |
Contributor
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
Contributor
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
hmalik88
reviewed
May 11, 2026
Comment on lines
+272
to
+277
| handleKeyringSnapMessage?: jest.MockedFunction< | ||
| SnapKeyring['handleKeyringSnapMessage'] | ||
| >; | ||
| setSelectedAccounts?: jest.MockedFunction< | ||
| SnapKeyring['setSelectedAccounts'] | ||
| >; |
Contributor
There was a problem hiding this comment.
why are these optional now?
Contributor
Author
There was a problem hiding this comment.
That depends on the test. We sometimes need to mock or the other
hmalik88
previously approved these changes
May 11, 2026
…o cc/feat/snap-account-service-selected-account-group
Base automatically changed from
cc/feat/snap-account-service-snap-keyring-messages
to
main
May 11, 2026 21:52
hmalik88
approved these changes
May 11, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Explanation
We used to have have this logic on the clients directly, but now it's the responsibility of this service to forward the selected accounts to the Snap keyring (and in the future, to each Snap keyring v2 instances).
References
N/A
Checklist
Note
Medium Risk
Moderate risk because it adds event-driven behavior that forwards selected accounts into the Snap keyring on group changes/unlock, which could affect account selection state and error handling in keyring interactions.
Overview
Moves selected-account forwarding into
@metamask/snap-account-service: it now subscribes toAccountTreeController:selectedAccountGroupChangeandKeyringController:unlock, looks up the selectedAccountGroupObject, and callssnapKeyring.setSelectedAccounts()for that group.Adds local mirrored
AccountTreeControlleraction/event types (src/types.ts) and updates build refs to avoid a TS project-reference cycle, plus adds dependencies and tests covering no-op and error paths; changelog and dependency graph are updated accordingly.Reviewed by Cursor Bugbot for commit cb54cae. Bugbot is set up for automated code reviews on this repo. Configure here.