Skip to content

feat(assets-controller): add RPC vs Accounts API balance reconciliation - #9910

Open
salimtb wants to merge 2 commits into
mainfrom
feat/assets-controller-rpc-balance-reconciliation
Open

feat(assets-controller): add RPC vs Accounts API balance reconciliation#9910
salimtb wants to merge 2 commits into
mainfrom
feat/assets-controller-rpc-balance-reconciliation

Conversation

@salimtb

@salimtb salimtb commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add refreshAccountChainBalancesFromRpc(accountId, assetId) to fetch a single asset balance via Accounts API (forceUpdate) and RPC, compare the two sources against each other and against current state, and report Sentry issues when Accounts API ≠ RPC or state ≠ Accounts API.
  • Merge the RPC balance into controller state when RPC returns a value.
  • No-op when basic functionality is disabled (RPC-only mode).

Test plan

  • yarn workspace @metamask/assets-controller run jest --no-coverage src/AssetsController.test.ts -t "refreshAccountChainBalancesFromRpc" (15 tests)
  • yarn workspace @metamask/assets-controller run build

Made with Cursor

Add refreshAccountChainBalancesFromRpc to compare a fresh Accounts API
snapshot and on-chain RPC balance, report mismatches to Sentry, and merge
RPC into state. Includes unit tests and changelog entry.

Co-authored-by: Cursor <cursoragent@cursor.com>
@salimtb
salimtb requested review from a team as code owners August 19, 2026 15:25
@salimtb
salimtb deployed to default-branch August 19, 2026 15:25 — with GitHub Actions Active

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Fix All in Cursor

❌ 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 286bd3d. Configure here.

Comment thread packages/assets-controller/src/AssetsController.ts
Comment thread packages/assets-controller/src/AssetsController.ts Outdated
Comment thread packages/assets-controller/src/AssetsController.ts
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