fix: AccountsApiBalanceFetcher stricter zero out conditions cp-13.20.0#40411
Merged
Prithpal-Sooriya merged 1 commit intomainfrom Feb 25, 2026
Merged
Conversation
Contributor
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
Comment on lines
+10
to
+13
| + const isChainIncludedInRequest = chainIds.includes(chainId); | ||
| + const isChainSupported = this.supports(chainId); | ||
| + const shouldZeroOutBalance = !existingBalance && isChainIncludedInRequest && isChainSupported; | ||
| + if (shouldZeroOutBalance) { |
Contributor
Author
There was a problem hiding this comment.
Same as proposed fix in core:
MetaMask/core#8044
Comment on lines
+22
to
+25
| + const isChainIncludedInRequest = chainIds.includes(chainId); | ||
| + const isChainSupported = this.supports(chainId); | ||
| + const shouldZeroOutBalance = !existingBalance && isChainIncludedInRequest && isChainSupported; | ||
| + if (isERC && shouldZeroOutBalance) { |
Contributor
Author
There was a problem hiding this comment.
Same as proposed fix in core:
MetaMask/core#8044
Contributor
Builds ready [f277a1c]
⚡ Performance Benchmarks (1476 ± 127 ms)
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs
|
salimtb
approved these changes
Feb 25, 2026
|
sahar-fehri
approved these changes
Feb 25, 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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.



Description
Patch for the core fix: MetaMask/core#8044
Changelog
CHANGELOG entry: fix: AccountsApiBalanceFetcher stricter zero out conditions
Related issues
Fixes: #40324
Manual testing steps
Screenshots/Recordings
Before
After
Core fix: https://www.loom.com/share/0cd294c9f2bb4732a7ec9ad56d9dbd4a
Extension Demo: https://www.loom.com/share/5bfe5543fc6c4e3db819c3586ffad297
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Touches balance calculation logic (risk of missing/incorrect balance display) and changes dependency resolution via Yarn patching, but the code change is small and tightly scoped.
Overview
Fixes a balance-fetching edge case in
@metamask/assets-controllersby only synthesizing zero native/ERC-20 balances when the chain was explicitly requested (chainIds.includes(chainId)) and is supported, avoiding unintended zeroing for other chains.Wires the extension to consume this fix via a Yarn patch for
@metamask/assets-controllers@100.0.2, updatingpackage.jsonresolutions andyarn.lockto ensure the patched package is used across multiple semver ranges.Written by Cursor Bugbot for commit f277a1c. This will update automatically on new commits. Configure here.