Skip to content

Commit 85599bb

Browse files
add test case for optimism
1 parent 1e29254 commit 85599bb

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

src/tests/index.test.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,6 +1456,7 @@ test("logs a warning for reverted transactions)", async () => {
14561456
warnSpy.mockRestore();
14571457
});
14581458

1459+
//https://etherscan.io/tx/0x7eea91c5c715ef4bb1e39ddf4c7832113693e87c18392740353d5ae669406a46
14591460
test("parse a swap on Ethereum (USDC for WMON) with SettlerIntent", async () => {
14601461
const transactionHash = "0x7eea91c5c715ef4bb1e39ddf4c7832113693e87c18392740353d5ae669406a46";
14611462

@@ -1476,4 +1477,35 @@ test("parse a swap on Ethereum (USDC for WMON) with SettlerIntent", async () =>
14761477
address: "0x6917037f8944201b2648198a89906edf863b9517",
14771478
},
14781479
});
1480+
});
1481+
1482+
// https://optimistic.etherscan.io/tx/0xdee6f4fea0250f297ed9663c4ca4479e8a253c62e16faa60759e25832cd1f34f
1483+
test("parse a swap on Optimism (wstETH for ETH) via Balancer pool", async () => {
1484+
const publicClient = createPublicClient({
1485+
chain: optimism,
1486+
transport: http(
1487+
`https://opt-mainnet.g.alchemy.com/v2/${process.env.ALCHEMY_API_KEY}`
1488+
),
1489+
}) as PublicClient<Transport, Chain>;
1490+
1491+
const transactionHash =
1492+
"0xdee6f4fea0250f297ed9663c4ca4479e8a253c62e16faa60759e25832cd1f34f";
1493+
1494+
const result = await parseSwap({
1495+
publicClient,
1496+
transactionHash,
1497+
});
1498+
1499+
expect(result).toEqual({
1500+
tokenIn: {
1501+
symbol: "wstETH",
1502+
amount: "0.008868",
1503+
address: "0x1f32b1c2345538c0c6f582fcb022739c4a194ebb",
1504+
},
1505+
tokenOut: {
1506+
symbol: "WETH",
1507+
amount: "0.010698199301849867",
1508+
address: "0x4200000000000000000000000000000000000006",
1509+
},
1510+
});
14791511
});

0 commit comments

Comments
 (0)