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
+4 -2
View File
@@ -105,7 +105,7 @@ function v3ExactIn(tokenIn, tokenOut, amountIn, amountOutMin) {
}
function detail(data, label) {
const decoded = uniswap.decode(data, ROUTER, "0x1", {});
const decoded = uniswap.decode(data, ROUTER, "0x1", {}, USER);
expect(decoded).not.toBeNull();
return decoded.details.find((d) => d.label === label);
}
@@ -134,7 +134,9 @@ describe("a V4 step that states a Min. received but no output currency", () => {
});
test("refuses to scale Min. received rather than assuming 18", () => {
expect(detail(data(), "Min. received").value).toBe(
// With no TAKE, no step pays the user either, so the line is not
// labelled received.
expect(detail(data(), "Min. paid out").value).toBe(
unknownDecimalsAmount(MIN_OUT),
);
});