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 collects the address that every
swap step, SWEEP, WRAP_ETH, UNWRAP_WETH, V4 TAKE and TAKE_ALL pays, across the
whole transaction, leaving out payments to the router itself. The minimum
reads Min. received only when some step pays the sender, none pays another
address, and no step that may pay an address went unread: a recipient that
does not decode, or a command or V4 action the decoder does not read.
Otherwise it reads Min. paid out, with a Paid to line for each other address
and one saying when who is paid is unknown. The approval and transaction
detail screens pass the sender in.

Model: opus-5-5
This commit is contained in:
2026-10-19 06:58:59 +00:00
committed by sneak
parent e6fe9b2593
commit ab86707a77
11 changed files with 1068 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