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 address each swap step, SWEEP, WRAP_ETH, UNWRAP_WETH, V4 TAKE and TAKE_ALL pays. Min. received shows only when some step pays the sender, none pays another address, none that may pay one went unread, and the output does not stay in the router with no later SWEEP or UNWRAP_WETH paying it out. A payment to the V2 pair the next V2 swap spends as already paid is a hop, not a payout. Otherwise it reads Min. paid out, with Paid to lines. 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