fix: with no Amount line, the user's takes the total adds up get lines of their own (closes #659)
When a step this decoder cannot read, an unreadable permit, or a take of Token In with an unknown amount held back the Amount line, the amount the step that sets the input side states, and each later take of Token In added to it, appeared on no line, while other takes kept their own Moved from the sender lines. Those takes now get the same lines, first. The first step's amount gets them only when the user pays that step (a V2 or V3 step with payerIsUser true, a V4 step the user pays some of its input token, or a WRAP_ETH): one paid from the router takes nothing from the wallet. Routes with an Amount line read as before. Model: opus-5-5
This commit is contained in:
@@ -1439,8 +1439,17 @@ describe("any token left in the router is not received", () => {
|
||||
"Token In",
|
||||
// A later step whose SETTLE or SETTLE_ALL the decoder cannot read
|
||||
// may take anything from the sender: one line says so, in place
|
||||
// of the Amount line (https://git.eeqj.de/sneak/AutistMask/issues/625).
|
||||
unread ? "Moved from the sender" : "Amount",
|
||||
// of the Amount line (https://git.eeqj.de/sneak/AutistMask/issues/625),
|
||||
// after the lines the WRAP_ETH's 1 ETH then gets
|
||||
// (https://git.eeqj.de/sneak/AutistMask/issues/659).
|
||||
...(unread
|
||||
? [
|
||||
"Moved from the sender",
|
||||
"Token moved",
|
||||
"Moved to",
|
||||
"Moved from the sender",
|
||||
]
|
||||
: ["Amount"]),
|
||||
// A later swap step the user pays for spends `spent` of a token
|
||||
// other than Token In.
|
||||
...(spent
|
||||
@@ -1457,9 +1466,11 @@ describe("any token left in the router is not received", () => {
|
||||
expect(detail(result, "Moved from the sender").value).toBe(spent);
|
||||
}
|
||||
if (unread) {
|
||||
expect(detail(result, "Moved from the sender").value).toBe(
|
||||
UNDECODED,
|
||||
);
|
||||
expect(
|
||||
result.details
|
||||
.filter((d) => d.label === "Moved from the sender")
|
||||
.map((d) => d.value),
|
||||
).toEqual(["1.0000 ETH", UNDECODED]);
|
||||
}
|
||||
expect(paidTo(result)).toEqual([STAYS_IN_ROUTER]);
|
||||
expect(detail(result, "Token moved into the router")).toEqual(left);
|
||||
|
||||
Reference in New Issue
Block a user