Skip to content

feat(assets-controllers): add isDeprecated to MultichainAssetsController#9310

Merged
Prithpal-Sooriya merged 6 commits into
mainfrom
cursor/deprecate-multichain-assets-controller-ace6
Jul 21, 2026
Merged

feat(assets-controllers): add isDeprecated to MultichainAssetsController#9310
Prithpal-Sooriya merged 6 commits into
mainfrom
cursor/deprecate-multichain-assets-controller-ace6

Conversation

@Prithpal-Sooriya

Copy link
Copy Markdown
Contributor

Explanation

MultichainAssetsController is being superseded by the unified AssetsController (feature flag assets-unify-state). To allow it to be turned off without tearing down the controller, this PR adds an optional isDeprecated constructor callback, following the same pattern already introduced for TokenListController (#8945) and the sibling multichain controllers MultichainAssetsRatesController / MultichainBalancesController (#9044).

When isDeprecated() returns true:

  • No Snap requests are issued.
  • accountsAssets, assetsMetadata, and allIgnoredAssets are reset to {} at construction and re-enforced at every entry point (addAssets, ignoreAssets, _executePoll, and the AccountsController:accountAdded / accountRemoved / accountAssetListUpdated subscriptions), so no stale asset data remains in state.

The callback is re-evaluated on each entry point, so deprecation can be toggled at runtime without reconstructing the controller. The default (() => false) preserves existing behavior, so this is a non-breaking, additive change.

References

Manual testing steps

N/A — behavior-preserving by default (the new option defaults to disabled). New behavior is covered by unit tests.

Changed files

  • packages/assets-controllers/src/MultichainAssetsController/MultichainAssetsController.ts — Added the optional isDeprecated constructor option, a private #enforceDisabledState() helper that clears the three state maps, and guards at every entry point. Verified with lint (eslint, clean), typecheck (yarn build, clean), and unit tests.
  • packages/assets-controllers/src/MultichainAssetsController/MultichainAssetsController.test.ts — Added an isDeprecated describe block (construction, runtime-toggle, and no-Snap-request guarantees) and threaded the option through the setupController helper. Verified via jest (59/59 passing).
  • packages/assets-controllers/CHANGELOG.md — Added an entry under Unreleased > Added. Verified with yarn workspace @metamask/assets-controllers run changelog:validate.

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
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them
Open in Web Open in Cursor 

cursoragent and others added 2 commits June 30, 2026 08:56
Adds the optional `isDeprecated` constructor callback to MultichainAssetsController, following the same pattern introduced in #9044 for MultichainAssetsRatesController and MultichainBalancesController and #8945 for TokenListController.

When isDeprecated() returns true, no Snap requests are issued and accountsAssets, assetsMetadata, and allIgnoredAssets are reset to {} at construction and at every entry point (addAssets, ignoreAssets, _executePoll, AccountsController:accountAdded, AccountsController:accountRemoved, and AccountsController:accountAssetListUpdated). The callback is re-evaluated on each entry point so deprecation can be toggled at runtime.

Co-authored-by: Prithpal Sooriya <prithpal.sooriya@gmail.com>
Co-authored-by: Prithpal Sooriya <prithpal.sooriya@gmail.com>
@Prithpal-Sooriya
Prithpal-Sooriya marked this pull request as ready for review June 30, 2026 13:28
@Prithpal-Sooriya
Prithpal-Sooriya requested review from a team as code owners June 30, 2026 13:28
@Prithpal-Sooriya

Copy link
Copy Markdown
Contributor Author

@cursor fetch latest and resolve merge conflicts

@cursor

cursor Bot commented Jul 20, 2026

Copy link
Copy Markdown

Done. I fetched the latest origin/main and resolved the merge conflict.

  • Conflict: Only packages/assets-controllers/CHANGELOG.md conflicted (both main and this branch added entries under Unreleased > Added). I kept my isDeprecated entry at the top of Added and preserved all of main's new entries (Robinhood chain support, getAssetId, the Changed/Removed/Fixed items, and the released-version sections). All other files auto-merged cleanly.
  • Verified after merge: reinstalled dependencies (the merge updated lockfile/manifests), changelog validation passes, and the MultichainAssetsController test suite is green (59/59).
  • Pushed: merge commit 37e709e is on cursor/deprecate-multichain-assets-controller-ace6, so PR feat(assets-controllers): add isDeprecated to MultichainAssetsController #9310 is now up to date with main and conflict-free.
Open in Web Open in Cursor 

cursoragent and others added 3 commits July 20, 2026 20:58
…ichain-assets-controller-ace6

# Conflicts:
#	packages/assets-controllers/CHANGELOG.md

Co-authored-by: Prithpal Sooriya <prithpal.sooriya@gmail.com>
Co-authored-by: Prithpal Sooriya <prithpal.sooriya@gmail.com>
Co-authored-by: Prithpal Sooriya <prithpal.sooriya@gmail.com>
});
});

describe('isDeprecated', () => {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slop generated UTs... This is fine since we are deprecating. Otherwise I'd do a quick cleanup.

… to use bare return

Co-authored-by: Prithpal Sooriya <prithpal.sooriya@gmail.com>
@Prithpal-Sooriya
Prithpal-Sooriya added this pull request to the merge queue Jul 21, 2026
Merged via the queue into main with commit 57e7f3a Jul 21, 2026
427 checks passed
@Prithpal-Sooriya
Prithpal-Sooriya deleted the cursor/deprecate-multichain-assets-controller-ace6 branch July 21, 2026 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants