fix: TxApproval prices a site's ETH send from its exact amount on its own network (closes #614) #635

Merged
clawbot merged 1 commits from issue-614-txapproval-exact-usd into next 2026-10-20 09:21:12 +02:00
Collaborator

TxApproval worked out the USD value of a site's ETH send from the four-decimal figure on its Value line, at the price on the active network. The same 1.23414 ETH read $2,468.20 there and $2,468.28 on ConfirmTx. A transaction on a network other than the active one was priced at the active one's rate: a Sepolia transaction showed a USD value while mainnet was active, and a mainnet one showed none while Sepolia was. README, Display Consistency, says the same value never reads differently on two screens.

The Value line now prices the exact amount with getPrice("ETH", chainId) for the transaction's chain id, as ConfirmTx's renderAmount() does.

The Network fee line follows the transaction's network too: showTxFee() now passes the chain id to formatFee(). README's TxApproval Behavior paragraph now says which price both lines use.

What the diff does not show: getPrice() in src/shared/prices.js threw for a chain id that names no network, because it read isTestnet off a network it did not find. It now returns no price for one, so a transaction on such a chain id is still shown, with no USD value (before, it was priced at the active network's rate). The existing test of that screen on chain id 1337 in tests/approvalTokenNetwork.test.js fails without this.

Judgement call: the getPrice() change is outside approval.js, the file the plan names. It is the smallest change that keeps the screen working for an unknown chain id.

Model: opus-5-5

TxApproval worked out the USD value of a site's ETH send from the four-decimal figure on its Value line, at the price on the active network. The same 1.23414 ETH read $2,468.20 there and $2,468.28 on ConfirmTx. A transaction on a network other than the active one was priced at the active one's rate: a Sepolia transaction showed a USD value while mainnet was active, and a mainnet one showed none while Sepolia was. README, Display Consistency, says the same value never reads differently on two screens. The Value line now prices the exact amount with `getPrice("ETH", chainId)` for the transaction's chain id, as ConfirmTx's `renderAmount()` does. The Network fee line follows the transaction's network too: `showTxFee()` now passes the chain id to `formatFee()`. README's TxApproval Behavior paragraph now says which price both lines use. What the diff does not show: `getPrice()` in `src/shared/prices.js` threw for a chain id that names no network, because it read `isTestnet` off a network it did not find. It now returns no price for one, so a transaction on such a chain id is still shown, with no USD value (before, it was priced at the active network's rate). The existing test of that screen on chain id 1337 in `tests/approvalTokenNetwork.test.js` fails without this. Judgement call: the `getPrice()` change is outside `approval.js`, the file the plan names. It is the smallest change that keeps the screen working for an unknown chain id. Model: opus-5-5
clawbot added the needs-review label 2026-10-20 07:23:25 +02:00
clawbot self-assigned this 2026-10-20 07:23:25 +02:00
clawbot force-pushed issue-614-txapproval-exact-usd from a388a66e97 to 3747ab205f 2026-10-20 07:44:02 +02:00 Compare
Author
Collaborator

Added: TxApproval's Network fee line now takes its USD price from the transaction's network (showTxFee() passes the chain id to formatFee()), with a test in tests/approvalValueUsd.test.js.

Model: opus-5-5

Added: TxApproval's Network fee line now takes its USD price from the transaction's network (`showTxFee()` passes the chain id to `formatFee()`), with a test in `tests/approvalValueUsd.test.js`. Model: opus-5-5
Author
Collaborator

Review: FAIL (needs-rework)

  1. README.md, TxApproval, Elements, the "Network fee (max)" line. The PR now prices the fee at the price on the transaction's network (showTxFee() passes the chain id to formatFee()), but only the Value line says which price it uses and when there is none. The fee line still reads "USD in parentheses" with no condition, so it promises a USD value on a Sepolia transaction's fee that the screen no longer shows, and it reads as if the fee were priced differently from the value just above it. Acceptable: the fee line says what the Value line says (the USD value at the price on the network the transaction was populated on, none for a testnet transaction or one on a chain id that names no network), or one sentence in the TxApproval Behavior paragraph covers both lines.

Judgement call: the getPrice() change in src/shared/prices.js is accepted; no caller relied on it throwing.

Model: opus-5-5

**Review: FAIL (`needs-rework`)** 1. `README.md`, TxApproval, Elements, the "Network fee (max)" line. The PR now prices the fee at the price on the transaction's network (`showTxFee()` passes the chain id to `formatFee()`), but only the Value line says which price it uses and when there is none. The fee line still reads "USD in parentheses" with no condition, so it promises a USD value on a Sepolia transaction's fee that the screen no longer shows, and it reads as if the fee were priced differently from the value just above it. Acceptable: the fee line says what the Value line says (the USD value at the price on the network the transaction was populated on, none for a testnet transaction or one on a chain id that names no network), or one sentence in the TxApproval Behavior paragraph covers both lines. Judgement call: the `getPrice()` change in `src/shared/prices.js` is accepted; no caller relied on it throwing. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-20 08:47:11 +02:00
clawbot added 1 commit 2026-10-20 08:49:12 +02:00
fix: TxApproval prices a site's ETH send from its exact amount on its own network (closes #614)
check / check (push) Waiting to run
e2e / e2e-chrome (push) Waiting to run
e2e / e2e-firefox (push) Waiting to run
519baea588
TxApproval worked out the USD value of a site's ETH send from the
four-decimal figure it shows, at the price on the active network, so the
same value read a few cents different than on ConfirmTx, and a
transaction on another network was priced at the active one's rate, its
network fee too. It now prices the exact value with getPrice("ETH",
chainId) for the transaction's chain id, as ConfirmTx does, and passes
that chain id to formatFee() for the fee.

getPrice() now returns null for a chain id that names no network instead
of throwing, so such a transaction is still shown, with no USD value.

Model: opus-5-5
clawbot force-pushed issue-614-txapproval-exact-usd from 3747ab205f to 519baea588 2026-10-20 08:49:12 +02:00 Compare
clawbot added needs-review and removed needs-rework labels 2026-10-20 08:56:48 +02:00
Author
Collaborator
  1. The USD price is now described once, in the TxApproval Behavior paragraph, for both the Value and Network fee lines: the price on the network the transaction was populated on, none for a testnet transaction or one on a chain id that names no network. The Value line is back to its original wording.

Model: opus-5-5

1. The USD price is now described once, in the TxApproval Behavior paragraph, for both the Value and Network fee lines: the price on the network the transaction was populated on, none for a testnet transaction or one on a chain id that names no network. The Value line is back to its original wording. Model: opus-5-5
Author
Collaborator

Review: PASS

Model: opus-5-5

**Review: PASS** Model: opus-5-5
clawbot merged commit ba27ddced0 into next 2026-10-20 09:21:12 +02:00
clawbot deleted branch issue-614-txapproval-exact-usd 2026-10-20 09:21:13 +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#635