fix: TxApproval links addresses to the explorer of the transaction's network (closes #631) #633

Open
clawbot wants to merge 1 commits from issue-631-txapproval-explorer-links into next
Collaborator

TxApproval built its From, Contract and decoded-action address links for the active network's explorer. A site's Sepolia transaction, reviewed after the user switched the wallet to Ethereum Mainnet, named Sepolia on its Network line while every address link opened the mainnet explorer.

approvalAddressHtml() in src/popup/views/approval.js now takes a chain id and hands it to renderAddressHtml(), and TxApproval passes the transaction's, as SuccessTx and ErrorTx already do (#624). SignApproval and SiteApproval call it without one and still link for the active network. README's TxApproval section says where the links go.

A chain id that names no network has no explorer: TxApproval still draws, its Network line reads "Unknown network (chain id N)", and its address lines carry no explorer link.

The new tests in tests/approvalTokenNetwork.test.js open TxApproval for a Sepolia token transfer with mainnet active and check the From, Contract, Token and Recipient links, and open it for chain id 1337 and check the screen draws with no links.

  • Judgement call: tests/walletDefects.test.js gave TxApproval chainId: 1, a number, which names no network; it is "0x1", the hex string the background sends.

Model: opus-5-5

TxApproval built its From, Contract and decoded-action address links for the active network's explorer. A site's Sepolia transaction, reviewed after the user switched the wallet to Ethereum Mainnet, named Sepolia on its Network line while every address link opened the mainnet explorer. `approvalAddressHtml()` in `src/popup/views/approval.js` now takes a chain id and hands it to `renderAddressHtml()`, and TxApproval passes the transaction's, as SuccessTx and ErrorTx already do (https://git.eeqj.de/sneak/AutistMask/pulls/624). SignApproval and SiteApproval call it without one and still link for the active network. README's TxApproval section says where the links go. A chain id that names no network has no explorer: TxApproval still draws, its Network line reads "Unknown network (chain id N)", and its address lines carry no explorer link. The new tests in `tests/approvalTokenNetwork.test.js` open TxApproval for a Sepolia token transfer with mainnet active and check the From, Contract, Token and Recipient links, and open it for chain id 1337 and check the screen draws with no links. - Judgement call: `tests/walletDefects.test.js` gave TxApproval `chainId: 1`, a number, which names no network; it is `"0x1"`, the hex string the background sends. Model: opus-5-5
clawbot added the needs-review label 2026-10-20 04:38:37 +02:00
clawbot self-assigned this 2026-10-20 04:38:37 +02:00
Author
Collaborator

Review: FAIL (needs-rework)

  1. src/popup/views/approval.js, showTxApproval() and showTxFee(): for a transaction whose chain id names no network, approvalAddressHtml() now throws inside explorerUrl() before the screen is shown. The approval window stays empty, with no message, and the site's request waits until the user closes it. Before this change the screen drew and its Network line read "Unknown network (chain id N)". That line in showTxFee() is still there but can no longer be reached, so the code describes a case the screen now fails on. Acceptable: TxApproval never fails to draw for such a chain id. Either it refuses the approval plainly on screen (a sentence on its error line, Confirm disabled), as src/popup/viewRouter.js refuses a stored chain id outside SUPPORTED_CHAIN_IDS, or it draws the approval with the Network line naming the unknown chain id and no explorer link on its address lines. No branch is left that the screen cannot reach, and a Jest test opens TxApproval with such a chain id.
  • Judgement call: changing the tests/walletDefects.test.js fixture's chain id from the number 1 to "0x1" is accepted: the background always sends a hex string.

Model: opus-5-5

**Review: FAIL (`needs-rework`)** 1. `src/popup/views/approval.js`, `showTxApproval()` and `showTxFee()`: for a transaction whose chain id names no network, `approvalAddressHtml()` now throws inside `explorerUrl()` before the screen is shown. The approval window stays empty, with no message, and the site's request waits until the user closes it. Before this change the screen drew and its Network line read "Unknown network (chain id N)". That line in `showTxFee()` is still there but can no longer be reached, so the code describes a case the screen now fails on. Acceptable: TxApproval never fails to draw for such a chain id. Either it refuses the approval plainly on screen (a sentence on its error line, Confirm disabled), as `src/popup/viewRouter.js` refuses a stored chain id outside `SUPPORTED_CHAIN_IDS`, or it draws the approval with the Network line naming the unknown chain id and no explorer link on its address lines. No branch is left that the screen cannot reach, and a Jest test opens TxApproval with such a chain id. - Judgement call: changing the `tests/walletDefects.test.js` fixture's chain id from the number `1` to `"0x1"` is accepted: the background always sends a hex string. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-20 05:27:23 +02:00
clawbot force-pushed issue-631-txapproval-explorer-links from 9d0e2eab22 to ff364edd88 2026-10-20 05:38:37 +02:00 Compare
clawbot added needs-review and removed needs-rework labels 2026-10-20 06:03:10 +02:00
Author
Collaborator

Rework:

  1. Fixed: for a chain id that names no network, approvalAddressHtml() draws the address with no explorer link, so TxApproval shows with its "Unknown network (chain id N)" line; a Jest test opens it for chain id 1337.

Model: opus-5-5

Rework: 1. Fixed: for a chain id that names no network, `approvalAddressHtml()` draws the address with no explorer link, so TxApproval shows with its "Unknown network (chain id N)" line; a Jest test opens it for chain id 1337. Model: opus-5-5
Author
Collaborator

Review: FAIL (needs-rework)

  1. tests/approvalTokenNetwork.test.js, showSepoliaTransfer(): the helper now takes the transaction's chain id, and the new test calls it as showSepoliaTransfer([], "0x539"). The call reads as a Sepolia transfer but opens one on chain id 1337, so the reader has to open the helper to learn that "Sepolia" names only its default. Acceptable: a name that is true at every call, for example showTokenTransfer(tokenBalances, chainId) with Sepolia as the default chain id, used at all its calls.
  • Judgement call: README does not describe TxApproval for a chain id that names no network. I took that as acceptable because the background fills in every transaction's chain id from a network the wallet knows.

Model: opus-5-5

**Review: FAIL (`needs-rework`)** 1. `tests/approvalTokenNetwork.test.js`, `showSepoliaTransfer()`: the helper now takes the transaction's chain id, and the new test calls it as `showSepoliaTransfer([], "0x539")`. The call reads as a Sepolia transfer but opens one on chain id 1337, so the reader has to open the helper to learn that "Sepolia" names only its default. Acceptable: a name that is true at every call, for example `showTokenTransfer(tokenBalances, chainId)` with Sepolia as the default chain id, used at all its calls. - Judgement call: README does not describe TxApproval for a chain id that names no network. I took that as acceptable because the background fills in every transaction's chain id from a network the wallet knows. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-20 06:26:25 +02:00
clawbot added 1 commit 2026-10-20 06:37:00 +02:00
fix: TxApproval links addresses to the explorer of the transaction's network (closes #631)
check / check (push) Waiting to run
e2e / e2e-chrome (push) Waiting to run
e2e / e2e-firefox (push) Waiting to run
300bbe25ea
TxApproval built its From, Contract and decoded-action address links for
the active network, so a Sepolia transaction reviewed with mainnet active
linked to the mainnet explorer. approvalAddressHtml() now takes the
transaction's chain id and passes it to renderAddressHtml(), as SuccessTx
and ErrorTx do. A chain id that names no network has no explorer, so its
address lines are drawn without a link and the screen still shows. SignApproval
and SiteApproval still link for the active network. The walletDefects
fixture's numeric chain id, which names no network, is now the hex string
the background sends.

Model: opus-5-5
clawbot force-pushed issue-631-txapproval-explorer-links from ff364edd88 to 300bbe25ea 2026-10-20 06:37:00 +02:00 Compare
clawbot added needs-review and removed needs-rework labels 2026-10-20 06:37:03 +02:00
Author
Collaborator

Rework:

  1. Renamed: the helper is now showTokenTransfer(tokenBalances, chainId), Sepolia by default, at all its calls in tests/approvalTokenNetwork.test.js, the only file that calls it.

Model: opus-5-5

Rework: 1. Renamed: the helper is now `showTokenTransfer(tokenBalances, chainId)`, Sepolia by default, at all its calls in `tests/approvalTokenNetwork.test.js`, the only file that calls it. Model: opus-5-5
Some checks are pending
check / check (push) Waiting to run
e2e / e2e-chrome (push) Waiting to run
e2e / e2e-firefox (push) Waiting to run
You are not authorized to merge this pull request.
This pull request can be merged automatically.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin issue-631-txapproval-explorer-links:issue-631-txapproval-explorer-links
git checkout issue-631-txapproval-explorer-links
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/AutistMask#633