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 reads the recipient of every swap step, SWEEP, UNWRAP_WETH, V4 TAKE and TAKE_ALL, reads the router's placeholders as the router does (address(1) is the sender, address(2) the router, which holds the output until a later SWEEP or UNWRAP_WETH pays it out), and compares the result with the transaction's sender. When the output goes anywhere else, a Paid to line names each address it is paid to and the minimum reads Min. paid out. The approval and transaction detail screens pass the sender in. Model: opus-5-5
This commit is contained in:
@@ -68,10 +68,13 @@ function swapData(amountIn, amountOutMin) {
|
||||
}
|
||||
|
||||
function swapDetail(amountIn, amountOutMin, label) {
|
||||
// Sent by the address the swap pays, so the output is the user's.
|
||||
const decoded = uniswap.decode(
|
||||
swapData(amountIn, amountOutMin),
|
||||
ROUTER,
|
||||
"0x1",
|
||||
{},
|
||||
RECIPIENT,
|
||||
);
|
||||
return decoded.details.find((d) => d.label === label);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user