When a token's balance entry is missing or incomplete (e.g. not yet fetched from Blockscout), the address-token view and send view now fall back to the built-in known token list for symbol, name, and decimals instead of showing ?.
Also includes token name in the balance object returned by fetchTokenBalances so the contract info well can display it.
When a token's balance entry is missing or incomplete (e.g. not yet fetched from Blockscout), the address-token view and send view now fall back to the built-in known token list for symbol, name, and decimals instead of showing `?`.
Also includes token `name` in the balance object returned by `fetchTokenBalances` so the contract info well can display it.
Fixes #51
When a token's balance entry is missing or incomplete (e.g. not yet
fetched from Blockscout), the address-token view and send view now
fall back to the built-in known token list for symbol, name, and
decimals instead of showing '?'.
Also includes token name in the balance object returned by
fetchTokenBalances so the contract info well can display it.
Fixes#51
Yes — if a user adds a token by contract address that is neither in TOKEN_BY_ADDRESS (the known token list) nor returns symbol/name from the Blockscout API, it will still show ?. The fallback chain is:
So ? only appears when both sources have no data. For most real ERC-20 tokens, Blockscout will return the symbol even if it's not in our known list. The ? case would mainly hit proxy contracts or very obscure tokens where Blockscout has no metadata.
Yes — if a user adds a token by contract address that is neither in `TOKEN_BY_ADDRESS` (the known token list) nor returns symbol/name from the Blockscout API, it will still show `?`. The fallback chain is:
```
(tb && tb.symbol) || (knownToken && knownToken.symbol) || "?"
```
So `?` only appears when *both* sources have no data. For most real ERC-20 tokens, Blockscout will return the symbol even if it's not in our known list. The `?` case would mainly hit proxy contracts or very obscure tokens where Blockscout has no metadata.
You're right — this is a band-aid, not a fix. The known token list fallback only helps tokens we've hardcoded. The real bug is: why is tb.symbol empty/missing for USDC in the first place? Blockscout should be returning that metadata.
I'll dig into fetchTokenBalances in balances.js to see if we're dropping the symbol during parsing, or if the Blockscout API response genuinely lacks it. That's the actual root cause.
You're right — this is a band-aid, not a fix. The known token list fallback only helps tokens we've hardcoded. The real bug is: why is `tb.symbol` empty/missing for USDC in the first place? Blockscout should be returning that metadata.
I'll dig into `fetchTokenBalances` in `balances.js` to see if we're dropping the symbol during parsing, or if the Blockscout API response genuinely lacks it. That's the actual root cause.
fetchTokenBalances drops zero-balance tokens (if (bal === "0.0") continue at line 79 of balances.js). So if a user tracks USDC but has 0 balance, it's excluded from addr.tokenBalances entirely.
The UI looks up metadata only from addr.tokenBalances, which is now empty for that token → tb is undefined → shows ?.
The known-token-list fallback in this PR only helps hardcoded tokens. A user who adds a custom token by contract address will still see ? if their balance is zero or if Blockscout hasn't indexed it yet.
Proper fix: When tb is missing, fall back to state.trackedTokens (which already stores name, symbol, decimals from the lookupTokenInfo call at add time). This covers all user-added tokens regardless of whether they're in the known list.
I'll rework this PR.
Found the root cause. Two problems:
1. **`fetchTokenBalances` drops zero-balance tokens** (`if (bal === "0.0") continue` at line 79 of `balances.js`). So if a user tracks USDC but has 0 balance, it's excluded from `addr.tokenBalances` entirely.
2. **The UI looks up metadata only from `addr.tokenBalances`**, which is now empty for that token → `tb` is `undefined` → shows `?`.
The known-token-list fallback in this PR only helps hardcoded tokens. A user who adds a custom token by contract address will still see `?` if their balance is zero or if Blockscout hasn't indexed it yet.
**Proper fix:** When `tb` is missing, fall back to `state.trackedTokens` (which already stores `name`, `symbol`, `decimals` from the `lookupTokenInfo` call at add time). This covers all user-added tokens regardless of whether they're in the known list.
I'll rework this PR.
Extends the fallback chain to: tb → state.trackedTokens → TOKEN_BY_ADDRESS → '?'
This ensures user-added custom tokens (not just hardcoded known tokens)
display correct symbol, name, and decimals even when Blockscout hasn't
returned balance data (e.g. zero-balance tracked tokens).
Added state.trackedTokens fallback for symbol/name/decimals resolution.
Fallback chain is now:tb (Blockscout balance) → trackedTokens (user-added tokens from state) → TOKEN_BY_ADDRESS (hardcoded known tokens) → "?"
Files changed:
src/popup/views/addressToken.js — symbol resolution in show() + all fields in contract info section (name, symbol, decimals)
src/popup/views/send.js — symbol resolution in updateSendBalance() + review button handler
This ensures custom tokens added by the user display correctly even when Blockscout drops them (zero balance). make check and docker build both pass.
Added `state.trackedTokens` fallback for symbol/name/decimals resolution.
**Fallback chain is now:** `tb` (Blockscout balance) → `trackedTokens` (user-added tokens from state) → `TOKEN_BY_ADDRESS` (hardcoded known tokens) → `"?"`
**Files changed:**
- `src/popup/views/addressToken.js` — symbol resolution in show() + all fields in contract info section (name, symbol, decimals)
- `src/popup/views/send.js` — symbol resolution in updateSendBalance() + review button handler
This ensures custom tokens added by the user display correctly even when Blockscout drops them (zero balance). `make check` and `docker build` both pass.
sneak
merged commit 4d9a8a49b9 into main2026-02-28 18:04:04 +01:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
When a token's balance entry is missing or incomplete (e.g. not yet fetched from Blockscout), the address-token view and send view now fall back to the built-in known token list for symbol, name, and decimals instead of showing
?.Also includes token
namein the balance object returned byfetchTokenBalancesso the contract info well can display it.Fixes #51
make checkpasses (tests, lint, format all clean). Mergeable, no conflicts. Cannot self-review — assigning to @sneak for review.@clawbot will this show ? for zero-balance not-known tokens added by the user by contract address?
Yes — if a user adds a token by contract address that is neither in
TOKEN_BY_ADDRESS(the known token list) nor returns symbol/name from the Blockscout API, it will still show?. The fallback chain is:So
?only appears when both sources have no data. For most real ERC-20 tokens, Blockscout will return the symbol even if it's not in our known list. The?case would mainly hit proxy contracts or very obscure tokens where Blockscout has no metadata.You're right — this is a band-aid, not a fix. The known token list fallback only helps tokens we've hardcoded. The real bug is: why is
tb.symbolempty/missing for USDC in the first place? Blockscout should be returning that metadata.I'll dig into
fetchTokenBalancesinbalances.jsto see if we're dropping the symbol during parsing, or if the Blockscout API response genuinely lacks it. That's the actual root cause.Found the root cause. Two problems:
fetchTokenBalancesdrops zero-balance tokens (if (bal === "0.0") continueat line 79 ofbalances.js). So if a user tracks USDC but has 0 balance, it's excluded fromaddr.tokenBalancesentirely.The UI looks up metadata only from
addr.tokenBalances, which is now empty for that token →tbisundefined→ shows?.The known-token-list fallback in this PR only helps hardcoded tokens. A user who adds a custom token by contract address will still see
?if their balance is zero or if Blockscout hasn't indexed it yet.Proper fix: When
tbis missing, fall back tostate.trackedTokens(which already storesname,symbol,decimalsfrom thelookupTokenInfocall at add time). This covers all user-added tokens regardless of whether they're in the known list.I'll rework this PR.
Added
state.trackedTokensfallback for symbol/name/decimals resolution.Fallback chain is now:
tb(Blockscout balance) →trackedTokens(user-added tokens from state) →TOKEN_BY_ADDRESS(hardcoded known tokens) →"?"Files changed:
src/popup/views/addressToken.js— symbol resolution in show() + all fields in contract info section (name, symbol, decimals)src/popup/views/send.js— symbol resolution in updateSendBalance() + review button handlerThis ensures custom tokens added by the user display correctly even when Blockscout drops them (zero balance).
make checkanddocker buildboth pass.