From 70ad00ee61bdf919330551437859c3c2719a6eb4 Mon Sep 17 00:00:00 2001 From: TxCorpi0x <6095314+TxCorpi0x@users.noreply.github.com> Date: Sun, 17 Nov 2024 08:49:21 +0700 Subject: [PATCH] feat: add new changes --- swapapi/src/swap.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/swapapi/src/swap.ts b/swapapi/src/swap.ts index 157ac83..92e4fff 100644 --- a/swapapi/src/swap.ts +++ b/swapapi/src/swap.ts @@ -12,6 +12,13 @@ const { } = inch; +const chainList = [ + NetworkEnum.POLYGON, + NetworkEnum.OPTIMISM, + NetworkEnum.GNOSIS, + NetworkEnum.ARBITRUM, +]; + import Web3, { ERR_VALIDATION, errors } from "web3"; import { randomBytes } from 'node:crypto' @@ -20,7 +27,7 @@ async function sleep(ms: number): Promise { } // FIXME: env var -const privateKey = ""; +const privateKey = "0x"; const rpc = 'https://ethereum-rpc.publicnode.com' // FIXME: env var @@ -38,8 +45,8 @@ const sdk = new SDK({ }); export const swap = async function (srcToken: string, dstToken: string, amount: string) { - const srcNetwork = NetworkEnum.GNOSIS; - const dstNetwork = NetworkEnum.ARBITRUM; + const srcNetwork = chainList[0]; + const dstNetwork = chainList[1]; const srcTokenAddress = await getTokenByName(srcNetwork.toString(), srcToken); // "0xc2132d05d31c914a87c6611c10748aeb04b58e8f" const dstTokenAddress = await getTokenByName(dstNetwork.toString(), dstToken); // "0x94b008aa00579c1307b0ef2c499ad98a8ce58e58"