The balances of tokens the user tracks are read only from Blockscout, never from the RPC endpoint #669

Closed
opened 2026-10-21 12:13:25 +02:00 by clawbot · 1 comment
Collaborator

Severity: major (it blocks #668: with Blockscout off by default, every tracked token would read quantity unknown).

Where

refreshBalances() in src/shared/balances.js reads ETH balances through the RPC endpoint, but every ERC-20 balance comes from fetchTokenBalances(), one Blockscout request per address. Nothing reads a token's balanceOf through the RPC endpoint.

What happens

The tokens a user tracks on the active network have a balance only while Blockscout answers. When it fails, or once it is turned off under #668, Home, AddressDetail and AddressToken have no figure for them, although the RPC endpoint the user chose can answer balanceOf for each.

What should happen

Each refresh (popup and background, both through refreshBalances()) reads the balance of every token tracked on the active network, for every address, with balanceOf through the RPC endpoint, at the decimals the tracked token records. ethers sends these as one batched request. Blockscout's answer, while it is used, only adds tokens the user has not tracked, with their holder counts for the low-holder rule; for a tracked token the RPC figure stands. A balanceOf that fails leaves that token's previous figure as it is, as a failed ETH balance does, and is logged.

Package: src/shared/balances.js (its header: balance fetching via RPC and Blockscout); no new file.

Definition of done

  • With Blockscout failing, a tracked token shows its balance read through the RPC endpoint; a test that fails on next.
  • A tracked token that Blockscout also reports shows the RPC figure; an untracked one Blockscout reports is admitted exactly as on next.
  • README.md says where token balances come from.

Model: opus-5-5

Severity: major (it blocks https://git.eeqj.de/sneak/AutistMask/issues/668: with Blockscout off by default, every tracked token would read `quantity unknown`). ## Where `refreshBalances()` in `src/shared/balances.js` reads ETH balances through the RPC endpoint, but every ERC-20 balance comes from `fetchTokenBalances()`, one Blockscout request per address. Nothing reads a token's `balanceOf` through the RPC endpoint. ## What happens The tokens a user tracks on the active network have a balance only while Blockscout answers. When it fails, or once it is turned off under https://git.eeqj.de/sneak/AutistMask/issues/668, Home, AddressDetail and AddressToken have no figure for them, although the RPC endpoint the user chose can answer `balanceOf` for each. ## What should happen Each refresh (popup and background, both through `refreshBalances()`) reads the balance of every token tracked on the active network, for every address, with `balanceOf` through the RPC endpoint, at the decimals the tracked token records. ethers sends these as one batched request. Blockscout's answer, while it is used, only adds tokens the user has not tracked, with their holder counts for the low-holder rule; for a tracked token the RPC figure stands. A `balanceOf` that fails leaves that token's previous figure as it is, as a failed ETH balance does, and is logged. Package: `src/shared/balances.js` (its header: balance fetching via RPC and Blockscout); no new file. ## Definition of done - [ ] With Blockscout failing, a tracked token shows its balance read through the RPC endpoint; a test that fails on `next`. - [ ] A tracked token that Blockscout also reports shows the RPC figure; an untracked one Blockscout reports is admitted exactly as on `next`. - [ ] `README.md` says where token balances come from. Model: opus-5-5
Author
Collaborator

Built in #670: each refresh reads every tracked token's balance at every address with balanceOf through the RPC endpoint, and Blockscout adds only the tokens the user has not tracked. The PR body lists the judgement call and the behaviour change.

Model: opus-5-5

Built in https://git.eeqj.de/sneak/AutistMask/pulls/670: each refresh reads every tracked token's balance at every address with `balanceOf` through the RPC endpoint, and Blockscout adds only the tokens the user has not tracked. The PR body lists the judgement call and the behaviour change. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/AutistMask#669