diff --git a/README.md b/README.md index 24be19a..3dc8b47 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,9 @@ ## Blockchain Support -| arbitrum | avalanche | base | bnb chain | blast | ethereum | linea | optimism | polygon | scroll | -| :----------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------: | -| Arbitrum | Avalanche | Base | BNB Chain | Blast | Ethereum | Linea | Optimism | Polygon | Scroll | +| arbitrum | avalanche | base | bnb chain | blast | ethereum | linea | mantle | optimism | polygon | scroll | +| :----------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------: | +| Arbitrum | Avalanche | Base | BNB Chain | Blast | Ethereum | Linea | Mantle | Optimism | Polygon | Scroll | ## Overview diff --git a/src/constants.ts b/src/constants.ts index a71b1c7..a8a992b 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -4,6 +4,7 @@ import { blast, linea, scroll, + mantle, mainnet, polygon, arbitrum, @@ -50,6 +51,7 @@ export const NATIVE_SYMBOL_BY_CHAIN_ID: { [key in SupportedChainId]: string } = [blast.id]: blast.nativeCurrency.symbol, [linea.id]: linea.nativeCurrency.symbol, [scroll.id]: scroll.nativeCurrency.symbol, + [mantle.id]: mantle.nativeCurrency.symbol, [mainnet.id]: mainnet.nativeCurrency.symbol, [polygon.id]: polygon.nativeCurrency.symbol, [optimism.id]: optimism.nativeCurrency.symbol, diff --git a/src/tests/index.test.ts b/src/tests/index.test.ts index f556fcf..36d150c 100644 --- a/src/tests/index.test.ts +++ b/src/tests/index.test.ts @@ -1081,3 +1081,33 @@ test("parse a swap on Blast (ETH for ezETH) with execute", async () => { }, }); }); + +// https://mantlescan.xyz/tx/0xbd89bd8f580e5606c046feac8b0d72e321009cfed361c9919eb4845999ea79a4 +test("parse a swap on Mantle (WETH for mETH) with execute", async () => { + const publicClient = createPublicClient({ + chain: blast, + transport: http( + `https://mantle-mainnet.g.alchemy.com/v2/${process.env.ALCHEMY_API_KEY}` + ), + }) as PublicClient; + + const transactionHash = `0xbd89bd8f580e5606c046feac8b0d72e321009cfed361c9919eb4845999ea79a4`; + + const result = await parseSwap({ + publicClient, + transactionHash, + }); + + expect(result).toEqual({ + tokenIn: { + symbol: "WETH", + amount: "0.0001", + address: "0xdEAddEaDdeadDEadDEADDEAddEADDEAddead1111", + }, + tokenOut: { + symbol: "mETH", + amount: "0.000097870496599353", + address: "0xcDA86A272531e8640cD7F1a92c01839911B90bb0", + }, + }); +}); diff --git a/src/types.ts b/src/types.ts index 2bf2789..fcf7dea 100644 --- a/src/types.ts +++ b/src/types.ts @@ -4,6 +4,7 @@ import { blast, linea, scroll, + mantle, mainnet, polygon, arbitrum, @@ -27,6 +28,7 @@ export type SupportedChainId = | typeof blast.id | typeof linea.id | typeof scroll.id + | typeof mantle.id | typeof mainnet.id | typeof polygon.id | typeof arbitrum.id diff --git a/src/utils/index.ts b/src/utils/index.ts index 334fe67..faa1021 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -5,6 +5,7 @@ import { blast, linea, scroll, + mantle, mainnet, polygon, arbitrum, @@ -29,6 +30,7 @@ export function isChainIdSupported( blast.id, linea.id, scroll.id, + mantle.id, polygon.id, mainnet.id, arbitrum.id,