chore: deprecate TokenBalancesController#9327
Open
Prithpal-Sooriya wants to merge 3 commits into
Open
Conversation
…oints When isDeprecated() returns true, skip startPolling, updateChainPollingConfigs, and TransactionController:transactionConfirmed handlers while clearing stale tokenBalances. Adds unit tests for the runtime-toggle behavior on these entry points. Ticket: ASSETS-3335 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>
juanmigdr
reviewed
Jul 1, 2026
| }); | ||
| }; | ||
|
|
||
| readonly #onTransactionConfirmed = (transactionMeta: { |
Member
There was a problem hiding this comment.
Why did we move this to a separate function instead of keeping it inline as it was?
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
TokenBalancesControlleralready supports an optionalisDeprecatedconstructor callback (added in #9033) so hosts can disable it whenAssetsControllersupersedes legacy balance state under theassets-unify-statefeature flag.This PR completes deprecation coverage on the remaining entry points that could still start polling or schedule balance fetches after the flag toggles at runtime:
startPolling/_startPollingupdateChainPollingConfigsTransactionController:transactionConfirmedWhen
isDeprecated()returnstrue, these paths now call#enforceDisabledState()and return early, matching the behavior ofupdateBalances,_executePoll, and the other messenger-driven handlers.References
Manual testing steps
N/A — behavior-preserving unless
isDeprecated()returnstrue.Screenshots/Recordings
N/A
Changed files
packages/assets-controllers/src/TokenBalancesController.ts_startPolling,updateChainPollingConfigs, and#onTransactionConfirmedwithisDeprecatedpackages/assets-controllers/src/TokenBalancesController.test.tsyarn workspace @metamask/assets-controllers run jest --no-coverage src/TokenBalancesController.test.ts -t "isDeprecated"packages/assets-controllers/CHANGELOG.mdisDeprecatedentry pointsyarn validate:changelogChecklist