feat: add clearSate to accounts-controller - #9799
Merged
Merged
Conversation
Member
Author
|
@metamaskbot publish-preview |
gantunesr
marked this pull request as ready for review
August 7, 2026 14:45
gantunesr
temporarily deployed
to
default-branch
August 7, 2026 14:45 — with
GitHub Actions
Inactive
gantunesr
commented
Aug 7, 2026
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 1f2cff7. Configure here.
ccharly
previously approved these changes
Aug 7, 2026
gantunesr
enabled auto-merge
August 7, 2026 15:03
ccharly
disabled auto-merge
August 7, 2026 15:06
ccharly
approved these changes
Aug 7, 2026
gantunesr
enabled auto-merge
August 7, 2026 15:14
pull Bot
pushed a commit
to Reality2byte/core
that referenced
this pull request
Aug 7, 2026
## Explanation <!-- 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? --> Minor release of: - `@metamask/accounts-controller` ## 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/processes/updating-changelogs.md) - [ ] I've introduced [breaking changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md) in this PR and have prepared draft pull requests for clients and consumer packages to resolve them <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Release-only dependency alignment for a minor accounts-controller add (`clearState`); wide touch surface but no behavioral changes introduced in this PR’s diff. > > **Overview** > **Monorepo release 1183.0.0** that ships **`@metamask/accounts-controller` 39.1.0** and aligns dependents on `^39.1.0`. > > The accounts-controller minor release (documented in its changelog for this bump) adds **`clearState`** / **`AccountsController:clearState`** to reset internal account state to defaults and exports **`getDefaultAccountsControllerState`** ([MetaMask#9799](MetaMask#9799)). This PR itself is version, changelog, `package.json`, and **`yarn.lock`** updates across packages such as `wallet`, `assets-controller`, `transaction-controller`, bridge controllers, and multichain packages—no new controller logic in the diff. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 89eecf4. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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
Add a
clearStatemethod to theaccounts-controllerallowing callers to delete the current state and reset it to the default one.References
Related to https://consensyssoftware.atlassian.net/browse/MUL-2050
Checklist
Note
Medium Risk
Clearing account controller state removes all accounts and selection until keyring/sync repopulates it; misuse or missing coordination with other controllers could briefly break account UX.
Overview
Adds
clearStateonAccountsControllerso callers can wipe in-memory account state (empty accounts, no selection, emptyaccountIdByAddress) back to defaults—same idea asAccountTreeController:clearState, for flows like full wallet reset (MUL-2050).The former private
defaultStateis replaced by an exportedgetDefaultAccountsControllerState()used by the constructor andclearState. The method is registered on the messenger asAccountsController:clearState, with types and package exports updated. Tests cover direct calls, idempotent empty state, and messenger invocation.Reviewed by Cursor Bugbot for commit 84e410a. Bugbot is set up for automated code reviews on this repo. Configure here.