feat(assets-controllers): add isDeprecated to MultichainAssetsController#9310
Merged
Prithpal-Sooriya merged 6 commits intoJul 21, 2026
Merged
Conversation
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
marked this pull request as ready for review
June 30, 2026 13:28
Prithpal-Sooriya
temporarily deployed
to
default-branch
June 30, 2026 13:29 — with
GitHub Actions
Inactive
Contributor
Author
|
@cursor fetch latest and resolve merge conflicts |
|
Done. I fetched the latest
|
…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', () => { |
Contributor
Author
There was a problem hiding this comment.
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>
juanmigdr
approved these changes
Jul 21, 2026
Prithpal-Sooriya
deleted the
cursor/deprecate-multichain-assets-controller-ace6
branch
July 21, 2026 08:10
4 tasks
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
MultichainAssetsControlleris being superseded by the unifiedAssetsController(feature flagassets-unify-state). To allow it to be turned off without tearing down the controller, this PR adds an optionalisDeprecatedconstructor callback, following the same pattern already introduced forTokenListController(#8945) and the sibling multichain controllersMultichainAssetsRatesController/MultichainBalancesController(#9044).When
isDeprecated()returnstrue:accountsAssets,assetsMetadata, andallIgnoredAssetsare reset to{}at construction and re-enforced at every entry point (addAssets,ignoreAssets,_executePoll, and theAccountsController:accountAdded/accountRemoved/accountAssetListUpdatedsubscriptions), 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 optionalisDeprecatedconstructor 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 anisDeprecateddescribe block (construction, runtime-toggle, and no-Snap-request guarantees) and threaded the option through thesetupControllerhelper. Verified viajest(59/59 passing).packages/assets-controllers/CHANGELOG.md— Added an entry underUnreleased > Added. Verified withyarn workspace @metamask/assets-controllers run changelog:validate.Checklist