Skip to content
This repository has been archived by the owner on Nov 18, 2024. It is now read-only.

Commit

Permalink
feat: add new changes
Browse files Browse the repository at this point in the history
  • Loading branch information
TxCorpi0x authored and taiyangc committed Nov 18, 2024
1 parent 965fd06 commit a418edf
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions swapapi/src/swap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -20,7 +27,7 @@ async function sleep(ms: number): Promise<void> {
}

// FIXME: env var
const privateKey = "";
const privateKey = "0x";
const rpc = 'https://ethereum-rpc.publicnode.com'

// FIXME: env var
Expand All @@ -40,8 +47,8 @@ const sdk = new SDK({
const supportedNetworks = [NetworkEnum.ARBITRUM, NetworkEnum.BASE, NetworkEnum.GNOSIS, NetworkEnum.POLYGON];

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"

Expand Down

0 comments on commit a418edf

Please sign in to comment.