fix: Managed removed property from MultichainAssetsController:accountAssetListUpdated event body#8461
Open
gabrieledm wants to merge 27 commits intomainfrom
Open
fix: Managed removed property from MultichainAssetsController:accountAssetListUpdated event body#8461gabrieledm wants to merge 27 commits intomainfrom
removed property from MultichainAssetsController:accountAssetListUpdated event body#8461gabrieledm wants to merge 27 commits intomainfrom
Conversation
…untAssetListUpdated` event body to manage stale balances
…untAssetListUpdated` event body to manage stale balances
…tps://github.com/MetaMask/core into fix/NEB-892_usdt-balance-not-updating-after-swap
Signed-off-by: gabrieledm <gabriele.delmonte-ext@consensys.net>
Contributor
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
salimtb
reviewed
Apr 16, 2026
| const newAccountAssets = Object.entries(assets).map( | ||
| ([accountId, { added }]) => ({ | ||
| const updatedAccountAssets = Object.entries(assets).map( | ||
| ([accountId, { added, removed }]) => ({ |
Contributor
There was a problem hiding this comment.
should we have the same fix on the MultichainAssetsRatesController ?
Prithpal-Sooriya
previously approved these changes
Apr 16, 2026
…tps://github.com/MetaMask/core into fix/NEB-892_usdt-balance-not-updating-after-swap
…tps://github.com/MetaMask/core into fix/NEB-892_usdt-balance-not-updating-after-swap
…tps://github.com/MetaMask/core into fix/NEB-892_usdt-balance-not-updating-after-swap
Signed-off-by: gabrieledm <gabriele.delmonte-ext@consensys.net>
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 b2adaa5. Configure here.
Signed-off-by: gabrieledm <gabriele.delmonte-ext@consensys.net>
Prithpal-Sooriya
approved these changes
Apr 16, 2026
Contributor
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
FrederikBolding
approved these changes
Apr 17, 2026
matthewwalsh0
approved these changes
Apr 17, 2026
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
This PR fixes stale multichain asset balances in
MultichainBalancesControllerwhenMultichainAssetsController:accountAssetListUpdatedis emitted.Before this change, the controller only used the
addedassets from the event payload and ignoredremoved.As a result, balances for assets that were no longer present in the account asset list could remain cached in controller state and continue to appear as stale balances in the client.
Changes in
MultichainBalancesControlleraccountAssetListUpdatedhandler to use bothaddedandremovedremovedadded{ amount: '0', unit: '' }foraddedassets when the snap does not return a balance for themReferences
Checklist
Note
Medium Risk
Touches core cached multichain balances/rates reconciliation logic and deletes state entries based on event payload + global asset tracking checks, so regressions could surface as missing or incorrect balances/prices across accounts.
Overview
Updates
MultichainBalancesControllerto treatMultichainAssetsController:accountAssetListUpdatedas a per-account delta, deleting balances forremovedassets, fetching/merging balances foraddedassets, and writing explicit zero placeholders when snaps omit a balance.Updates
MultichainAssetsRatesControllerto similarly processadded/removeddeltas, purging staleconversionRatesandhistoricalPricesonly when an asset is no longer tracked by any account, and adds coverage for both deletion and “shared asset across accounts” cases.Also updates the assets-controllers changelog entry, trims related ESLint suppressions, and fixes
transaction-pay-controllerto importTransactionMetafrom the public@metamask/transaction-controllerpackage instead of a relative package path.Reviewed by Cursor Bugbot for commit 6195114. Bugbot is set up for automated code reviews on this repo. Configure here.