Skip to content

Commit

Permalink
test: add test for metatxsettler on mantle
Browse files Browse the repository at this point in the history
  • Loading branch information
hzhu committed Dec 8, 2024
1 parent 9e797f6 commit dbf43d0
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
mainnet,
arbitrum,
optimism,
mantle,
} from "viem/chains";
import { test, expect } from "vitest";
import { parseSwap } from "../index";
Expand Down Expand Up @@ -1113,6 +1114,36 @@ test("parse a swap on Mantle (WETH for mETH) with execute", async () => {
});
});

// https://mantlescan.xyz/tx/0x504118136b57d7a1ef7b3674505c32bf9d8d3df9c7991a9ee627f9883257dc38
test("parse a swap on Mode (USDC for MNT) with SettlerMetaTxn", async () => {
const publicClient = createPublicClient({
chain: mantle,
transport: http(
`https://mantle-mainnet.g.alchemy.com/v2/${process.env.ALCHEMY_API_KEY}`
),
});

const transactionHash = `0x504118136b57d7a1ef7b3674505c32bf9d8d3df9c7991a9ee627f9883257dc38`;

const result = await parseSwap({
publicClient,
transactionHash,
});

expect(result).toEqual({
tokenIn: {
symbol: "USDC",
amount: "2",
address: "0x09Bc4E0D864854c6aFB6eB9A9cdF58aC190D0dF9",
},
tokenOut: {
symbol: "MNT",
amount: "1.737346835463007796",
address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
},
});
});

// https://explorer.mode.network/tx/0xd84a08f6d48b5c34cde908452602088cdb42beceef29074b8a8d5c7e45f2a3dc
test("parse a swap on Mode (ETH for BEAST) with Settler", async () => {
const publicClient = createPublicClient({
Expand Down

0 comments on commit dbf43d0

Please sign in to comment.