fix: the swap summary is shown only for a transaction sent to a Universal Router (closes #520)
check / check (push) Waiting to run
e2e / e2e-chrome (push) Waiting to run
e2e / e2e-firefox (push) Waiting to run

The Universal Router decoder recognised execute() by its selector alone, so
the same calldata sent to any address was described as a swap through the
router. It now keeps the router deployments Uniswap publishes for Ethereum
Mainnet and Sepolia, and decodes only a transaction sent to one of them on
its network, ignoring address case. TxApproval passes the transaction's
chain id, TransactionDetail the active network's.

Model: opus-5-5
This commit was merged in pull request #579.
This commit is contained in:
2026-10-19 04:40:55 +02:00
parent 85fa864db4
commit 8b6c2b4df9
12 changed files with 445 additions and 70 deletions
+5 -3
View File
@@ -105,7 +105,7 @@ function v3ExactIn(tokenIn, tokenOut, amountIn, amountOutMin) {
}
function detail(data, label) {
const decoded = uniswap.decode(data, ROUTER, {});
const decoded = uniswap.decode(data, ROUTER, "0x1", {});
expect(decoded).not.toBeNull();
return decoded.details.find((d) => d.label === label);
}
@@ -140,7 +140,7 @@ describe("a V4 step that states a Min. received but no output currency", () => {
});
test("does not name ETH in the swap title either", () => {
const decoded = uniswap.decode(data(), ROUTER, {});
const decoded = uniswap.decode(data(), ROUTER, "0x1", {});
expect(decoded.name).toBe("Uniswap Swap");
});
});
@@ -206,6 +206,8 @@ describe("native ETH out, which V4 spells as the zero address", () => {
test("is still named ETH and still scaled at 18 decimals", () => {
expect(detail(data(), "Token Out").value).toBe("ETH");
expect(detail(data(), "Min. received").value).toBe("0.5000 ETH");
expect(uniswap.decode(data(), ROUTER, {}).name).toBe("Swap USDT → ETH");
expect(uniswap.decode(data(), ROUTER, "0x1", {}).name).toBe(
"Swap USDT → ETH",
);
});
});