Skip to content

Account balance zeroing#8095

Open
Prithpal-Sooriya wants to merge 4 commits intomainfrom
cursor/account-balance-zeroing-7ca5
Open

Account balance zeroing#8095
Prithpal-Sooriya wants to merge 4 commits intomainfrom
cursor/account-balance-zeroing-7ca5

Conversation

@Prithpal-Sooriya
Copy link
Contributor

Explanation

  • What is the current state of things and why does it need to change?
    The AccountsApiBalanceFetcher was incorrectly zeroing out ERC-20 token balances for accounts that were not part of the current balance fetch request. This could lead to incorrect balance displays, particularly when fetching balances for a single selected account while other accounts had existing (but not requested) balances.

  • What is the solution your changes offer and how does it work?
    This PR introduces a new condition, isAccountIncludedInRequest, to the shouldZeroOutBalance logic. This ensures that ERC-20 balances are only zeroed out if the account being processed is explicitly part of the current balance fetch request (either the selectedAccount or one of the allAccounts if queryAllAccounts is true).

  • Are there any changes whose purpose might not obvious to those unfamiliar with the domain?
    The addition of isAccountIncludedInRequest and its integration into the shouldZeroOutBalance condition is crucial to prevent unintended zeroing of balances for accounts not in the scope of the current query.

References

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 

@cursor
Copy link

cursor bot commented Mar 3, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

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 March 3, 2026 16:02
@Prithpal-Sooriya Prithpal-Sooriya requested review from a team as code owners March 3, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Fiat balance not displayed for accounts with asset balance in accounts list dropdown, possibly related to accounts with only mUSD balance

1 participant