Skip to content

Exclude disabled tokens from Total Balance - #6320

Open
j0ntz wants to merge 1 commit into
developfrom
jon/fix-usds-total-balance
Open

j0ntz wants to merge 1 commit into
developfrom
jon/fix-usds-total-balance

Conversation

@j0ntz

@j0ntz j0ntz commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Description

Asana task

Total Balance summed every entry in wallet.balanceMap. The core keeps a disabled token's last balance in that map, and the account cache seeds it back at login. A disabled token therefore kept counting toward the total, and relogging did not clear it.

getTotalFiatAmountFromExchangeRates now skips any token that is not in wallet.enabledTokenIds. The mainnet asset (tokenId == null) still counts. The other caller, RecoveryReminderActions, gets the same corrected total.

The size of the bad number in the report comes from a separate defect: the builtin USDS entry in edge-currency-accountbased lists 6 decimals instead of 18. That fix is in its own PR and reaches the app through a dependency bump. This PR passes standalone and does not depend on it.

Keys-only wallets counting toward the total is a separate task and is not changed here.

Simulator results, Home Total Balance on the agent account holding 11.978 USDS:

Plugin Total code USDS state Total
Fixed decimals develop disabled $195.57 (still counted)
Fixed decimals this PR enabled $195.71
Fixed decimals this PR disabled, no relaunch $183.72
Shipped develop disabled, in account cache $11,974,044,020,051.41
Shipped develop disabled, account cache removed $183.29
Shipped this PR disabled, in account cache $183.28

Repeating the toggle in one flow read $195.60, $183.66, $195.63, $183.55 for enabled, disabled, enabled, disabled.

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Requirements

If you have made any visual changes to the GUI. Make sure you have:

  • Tested on iOS device
  • Tested on Android device
  • Tested on small-screen device (iPod Touch)
  • Tested on large-screen device (tablet)

Test evidence

c74a656
Exclude disabled tokens from Total Balance
2026-11-02

4. total balance with usds enabled

5. total balance after disabling usds

6. control develop code counts disabled usds

7. develop code inflated with usds disabled and cached

8. develop code correct with account cache removed

9. fix correct with usds disabled and cached

10. flow total with usds enabled

11. flow total after disabling usds

12. flow total after re enabling usds

13. flow total after disabling usds again

The core keeps a disabled token's last balance in wallet.balanceMap, and
the total summed every entry in that map. Disabling a token therefore
left its value in the Total Balance, which BalanceCard and the recovery
reminder both read.

Skip token ids missing from wallet.enabledTokenIds.
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.

1 participant