fix: the approval screen names the address a swap's output is paid to (closes #594)
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:
@@ -53,7 +53,14 @@ function unwrapData() {
|
||||
}
|
||||
|
||||
function detail(data, label, sources) {
|
||||
const decoded = uniswap.decode(data, ROUTER, "0x1", sources || {});
|
||||
// Sent by the address the swap pays, so the output is the user's.
|
||||
const decoded = uniswap.decode(
|
||||
data,
|
||||
ROUTER,
|
||||
"0x1",
|
||||
sources || {},
|
||||
RECIPIENT,
|
||||
);
|
||||
return decoded.details.find((d) => d.label === label);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user