fix: the approval screen names the address a swap's output is paid to (closes #594)
check / check (push) Canceled after 0s
e2e / e2e-chrome (push) Canceled after 0s
e2e / e2e-firefox (push) Canceled after 0s

The swap decoder read no recipient, so a swap paying its output to another
address still showed Min. received. It now reads the address that every swap
step, SWEEP, WRAP_ETH, UNWRAP_WETH, V4 TAKE and TAKE_ALL pays. The minimum
reads Min. received only when some step pays the sender, none pays another
address, none that may pay one went unread, and the output is not left in the
router: an output paid to the router needs a later SWEEP of that token, or
UNWRAP_WETH of WETH, paying it out. A payment that the next V2 swap spends as
already paid is a hop, not a payout. Otherwise it reads Min. paid out, with
Paid to lines saying who is paid.

Model: opus-5-5
This commit is contained in:
2026-10-19 08:01:45 +00:00
parent 5e4b8ff3b0
commit 05f2eea033
11 changed files with 1278 additions and 98 deletions
+6 -4
View File
@@ -79,10 +79,10 @@ function tokenAmountText(rawAmount, decimals, symbol) {
};
}
// Try to decode calldata sent to `toAddress` on the network with chain id
// `chainId`, using known ABIs.
// Try to decode calldata sent from `fromAddress` to `toAddress` on the network
// with chain id `chainId`, using known ABIs.
// Returns { name, description, details } or null.
function decodeCalldata(data, toAddress, chainId) {
function decodeCalldata(data, toAddress, chainId, fromAddress) {
if (!data || data === "0x" || data.length < 10) return null;
// Where a token's scale is looked for, for every decoder below: the ERC-20
@@ -191,6 +191,7 @@ function decodeCalldata(data, toAddress, chainId) {
toAddress,
chainId,
decimalsSources,
fromAddress,
);
if (routerResult) return routerResult;
@@ -277,11 +278,12 @@ function showTxApproval(details) {
// If this is an ERC-20 call, try to extract the real recipient and amount.
// Decoded for the network the transaction is for, which the Network line
// names.
// names, and the address the From line names.
const decoded = decodeCalldata(
approvedTx.data,
toAddr || "",
approvedTx.chainId,
details.approvedFrom,
);
if (decoded && decoded.details) {
// The asset the status summary is counted in: an ERC-20 call's Token
+3 -1
View File
@@ -316,11 +316,13 @@ async function loadFullTxDetails(txHash, chainId) {
// Decoded against the address the transaction was sent to, as the
// explorer reports it, not the history entry's `to`: for a token
// transfer that is the transfer's recipient, not the token contract.
// On the active network, the one whose explorer was just asked.
// On the active network, the one whose explorer was just asked, and
// from the sender it reports.
const decoded = decodeCalldata(
inputData,
txData.to?.hash || "",
currentNetwork().chainId,
txData.from?.hash || "",
);
if (decoded) {
// Render decoded calldata matching approval view style