Uh oh!
There was an error while loading. Please reload this page.
refactor: migrate AccountTreeController to @metamask/messenger - #6380
Conversation
5562ae3 to
cf24808CompareAccountTreeController to @metamask/messengerAccountTreeController to @metamask/messengerUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
cf772f1 to
da25c0eCompare
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| AccountTreeControllerActions | AllowedActions, | ||
| AccountTreeControllerEvents | AllowedEvents | ||
| >; | ||
| messenger?: ReturnType<typeof getRootMessenger>; |
There was a problem hiding this comment.
Nit: Do we want to export a RootMessenger type from mockMessenger.ts?
| () => EMPTY_ACCOUNT_MOCK, | ||
| // Mock getSelectedAccount to return EMPTY_ACCOUNT_MOCK (id is '') BEFORE init | ||
| mockGetSelectedMultichainAccountActionHandler.mockReturnValue( | ||
| EMPTY_ACCOUNT_MOCK, |
There was a problem hiding this comment.
Bug: Mock Handler Not Registered
The mockGetSelectedMultichainAccountActionHandler is defined but not registered as the handler for AccountsController:getSelectedMultichainAccount. Tests attempt to configure its return value, but the action is actually handled by mocks.AccountsController.getSelectedMultichainAccount. This means the test mocks have no effect, leading to unexpected test behavior.
Uh oh!
There was an error while loading. Please reload this page.
Explanation
This PR migrates the
AccountTreeControllerclass to the new@metamask/messengercomm system, as opposed to the one exported from@metamask/base-controller.References
Checklist
Note
Migrates AccountTreeController and tests to the new @metamask/messenger API, updates state metadata and base-controller/next usage, and adds the messenger dependency.
@metamask/messenger(replacemessagingSystem/restricted messenger withmessenger; updatesubscribe/publish/calland action handler registration).@metamask/base-controller/next; change state metadata key fromanonymoustoincludeInDebugSnapshot.messengerthrough backup/sync context; construct rules (EntropyRule,SnapRule,KeyringRule) withmessenger.tests/mockMessengerto provide root and controller messengers; refactor all tests to use it; remove inline Messenger scaffolding and update spies/handlers accordingly.@metamask/messengerand reference it intsconfigfiles; update README dependency graph to includeaccount-tree-controller --> messenger.Messengerfrom@metamask/messengerinstead ofRestrictedMessengerfrom@metamask/base-controller.Written by Cursor Bugbot for commit a185851. This will update automatically on new commits. Configure here.