fix: transaction screens name a token from the tokens of the transaction's network (closes #629) #630

Merged
clawbot merged 1 commits from issue-629-tokens-of-tx-network into next 2026-10-20 04:16:04 +02:00
Collaborator

Fixes #629.

decodeCalldata() looked a token's symbol and decimals up in state.trackedTokens and the wallets' balances, which hold the active network's tokens only. With mainnet active, a Sepolia token transfer on TransactionDetail, or a Sepolia transaction on TxApproval, showed the token by address only and its amount in base units.

tokenSourcesByChainId() in src/popup/views/helpers.js, beside endpointsByChainId(), gives what the wallet knows of the tokens on the network a chain id names: the active network's tracked tokens and balances, or for another network the list applyChainSwitchFields() keeps for it in state.networkTrackedTokens, and no balances. decodeCalldata() uses it, so the swap decoder is handed the same tokens; src/shared/uniswap.js is unchanged. tokenLabel() takes an optional chain id and uses it too.

Same cause, fixed the same way: TxApproval's Contract and decoded Token labels and the token symbol it hands the wait, success and error screens, and SuccessTx's decoded Token label (src/popup/views/txStatus.js). README's paragraph on where a token's scale is looked up says this now.

Tests: TransactionDetail in tests/tokenTransferDetail.test.js, SuccessTx in tests/txStatus.test.js, TxApproval in the new tests/approvalTokenNetwork.test.js.

  • Judgement call: a chain id that names no network gets no tracked tokens and no balances; no chain id at all means the active network, as explorerUrl() does.
  • Judgement call: TxApproval's own token labels are fixed here, since the issue names TxApproval's gap; the signature screen's permit labels are untouched.

Model: opus-5-5

Fixes https://git.eeqj.de/sneak/AutistMask/issues/629. `decodeCalldata()` looked a token's symbol and decimals up in `state.trackedTokens` and the wallets' balances, which hold the active network's tokens only. With mainnet active, a Sepolia token transfer on TransactionDetail, or a Sepolia transaction on TxApproval, showed the token by address only and its amount in base units. `tokenSourcesByChainId()` in `src/popup/views/helpers.js`, beside `endpointsByChainId()`, gives what the wallet knows of the tokens on the network a chain id names: the active network's tracked tokens and balances, or for another network the list `applyChainSwitchFields()` keeps for it in `state.networkTrackedTokens`, and no balances. `decodeCalldata()` uses it, so the swap decoder is handed the same tokens; `src/shared/uniswap.js` is unchanged. `tokenLabel()` takes an optional chain id and uses it too. Same cause, fixed the same way: TxApproval's Contract and decoded Token labels and the token symbol it hands the wait, success and error screens, and SuccessTx's decoded Token label (`src/popup/views/txStatus.js`). README's paragraph on where a token's scale is looked up says this now. Tests: TransactionDetail in `tests/tokenTransferDetail.test.js`, SuccessTx in `tests/txStatus.test.js`, TxApproval in the new `tests/approvalTokenNetwork.test.js`. - Judgement call: a chain id that names no network gets no tracked tokens and no balances; no chain id at all means the active network, as `explorerUrl()` does. - Judgement call: TxApproval's own token labels are fixed here, since the issue names TxApproval's gap; the signature screen's permit labels are untouched. Model: opus-5-5
clawbot added the needs-review label 2026-10-20 03:49:08 +02:00
clawbot self-assigned this 2026-10-20 03:49:08 +02:00
clawbot added 1 commit 2026-10-20 03:49:08 +02:00
fix: transaction screens name a token from the tokens of the transaction's network (closes #629)
check / check (push) Waiting to run
e2e / e2e-chrome (push) Waiting to run
e2e / e2e-firefox (push) Waiting to run
7c4f2e5525
decodeCalldata() looked a token's symbol and decimals up in the active
network's tracked tokens and balances, whatever chain id it was given, so
TransactionDetail and TxApproval showed a token tracked on another network
by address only, with its amount in base units. The lookup now uses what the
wallet knows of the tokens on the transaction's network: the active
network's tracked tokens and balances, or for another network the tokens
tracked on it and no balances. TxApproval's token labels, the symbol it
hands the wait, success and error screens, and SuccessTx's decoded token
label use the same lookup.

Model: opus-5-5
Author
Collaborator

Review: PASS

Model: opus-5-5

**Review: PASS** Model: opus-5-5
clawbot merged commit ca9cd438d9 into next 2026-10-20 04:16:04 +02:00
clawbot deleted branch issue-629-tokens-of-tx-network 2026-10-20 04:16:05 +02:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/AutistMask#630