fix: resolve token symbols from multiple sources (closes #51) #52

Merged
sneak merged 2 commits from fix/usdc-symbol-display into main 2026-02-28 20:40:43 +01:00
Collaborator

Closes #51

When tokenBalances doesn't contain an entry for a token (e.g. before balances are fetched), the symbol fell back to ? in addressToken and send views.

Adds resolveSymbol() helper in tokenList.js that checks:

  1. tokenBalances array (live balance data)
  2. TOKEN_BY_ADDRESS (511 known tokens)
  3. state.trackedTokens (user-added tokens)
  4. Truncated address as last resort

Applied in both addressToken.js and send.js.

make check passes.

Closes #51 When `tokenBalances` doesn't contain an entry for a token (e.g. before balances are fetched), the symbol fell back to `?` in addressToken and send views. Adds `resolveSymbol()` helper in `tokenList.js` that checks: 1. `tokenBalances` array (live balance data) 2. `TOKEN_BY_ADDRESS` (511 known tokens) 3. `state.trackedTokens` (user-added tokens) 4. Truncated address as last resort Applied in both `addressToken.js` and `send.js`. `make check` passes.
sneak was assigned by clawbot 2026-02-28 17:35:43 +01:00
clawbot added 1 commit 2026-02-28 17:35:43 +01:00
fix: resolve token symbols from multiple sources (closes #51)
All checks were successful
check / check (push) Successful in 20s
4545a42ba0
When tokenBalances doesn't contain an entry for a token (e.g. before
balances are fetched), the symbol fell back to '?' in addressToken
and send views.

Add resolveSymbol() helper that checks tokenBalances → TOKEN_BY_ADDRESS
(known tokens) → trackedTokens → truncated address as last resort.

Fixes USDC and other known tokens showing '?' when balance data
hasn't loaded yet.
Author
Collaborator

Review

make check passes (tests + prettier). Code looks good overall.

One nit: TOKEN_BY_ADDRESS is imported in send.js (line 15) but never used directly — only resolveSymbol and KNOWN_SYMBOLS are referenced. Could remove that unused import.

Otherwise clean — resolveSymbol() has a sensible fallback chain and is applied consistently in both views. Ready to merge after the unused import is cleaned up (or as-is if you prefer).

## Review `make check` passes (tests + prettier). Code looks good overall. **One nit:** `TOKEN_BY_ADDRESS` is imported in `send.js` (line 15) but never used directly — only `resolveSymbol` and `KNOWN_SYMBOLS` are referenced. Could remove that unused import. Otherwise clean — `resolveSymbol()` has a sensible fallback chain and is applied consistently in both views. Ready to merge after the unused import is cleaned up (or as-is if you prefer).
clawbot added the
needs-review
label 2026-02-28 17:47:52 +01:00
Owner

@clawbot needs conflict resolution and please fix the review comment above

@clawbot needs conflict resolution and please fix the review comment above
sneak removed their assignment 2026-02-28 20:31:33 +01:00
clawbot was assigned by sneak 2026-02-28 20:31:33 +01:00
clawbot force-pushed fix/usdc-symbol-display from 4545a42ba0 to 59bec07987 2026-02-28 20:33:54 +01:00 Compare
clawbot reviewed 2026-02-28 20:34:02 +01:00
clawbot left a comment
Author
Collaborator

Rebased onto main and resolved all merge conflicts. Changes:

  1. Resolved conflicts in addressToken.js and send.js — kept the resolveSymbol() approach from this PR instead of the inline resolution from #54
  2. Removed unused TOKEN_BY_ADDRESS import from send.js per review feedback
  3. make check passes (15 tests, lint, fmt all green)

This PR still adds value over #54 by extracting the repeated symbol-resolution logic into a shared resolveSymbol() helper in tokenList.js, reducing code duplication across addressToken.js and send.js.

Rebased onto main and resolved all merge conflicts. Changes: 1. Resolved conflicts in `addressToken.js` and `send.js` — kept the `resolveSymbol()` approach from this PR instead of the inline resolution from #54 2. Removed unused `TOKEN_BY_ADDRESS` import from `send.js` per review feedback 3. `make check` passes (15 tests, lint, fmt all green) This PR still adds value over #54 by extracting the repeated symbol-resolution logic into a shared `resolveSymbol()` helper in `tokenList.js`, reducing code duplication across `addressToken.js` and `send.js`.
clawbot requested review from sneak 2026-02-28 20:34:13 +01:00
clawbot force-pushed fix/usdc-symbol-display from 59bec07987 to 9a7aa1f4fc 2026-02-28 20:38:26 +01:00 Compare
Author
Collaborator

Rebased onto current main — conflict resolved. The previously noted unused TOKEN_BY_ADDRESS import in send.js was already not present (the import line only pulls KNOWN_SYMBOLS and resolveSymbol, both of which are used). docker build . passes. Spawning review agent.

Rebased onto current `main` — conflict resolved. The previously noted unused `TOKEN_BY_ADDRESS` import in `send.js` was already not present (the import line only pulls `KNOWN_SYMBOLS` and `resolveSymbol`, both of which are used). `docker build .` passes. Spawning review agent.
sneak added 1 commit 2026-02-28 20:40:13 +01:00
Merge branch 'main' into fix/usdc-symbol-display
All checks were successful
check / check (push) Successful in 22s
34c66d19c4
sneak merged commit 24464ffe33 into main 2026-02-28 20:40:43 +01:00
sneak deleted branch fix/usdc-symbol-display 2026-02-28 20:40:43 +01:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sneak/AutistMask#52
No description provided.