import "mocha"; import { expect } from "chai"; import { SmartRouter } from "./SmartRouter"; import { EOA } from "../wallet"; import { ChainId } from "../constants"; import TestWalletInfo from "../../tests/data/WalletInfoData"; import BigNumber from "bignumber.js"; import { Token } from "../Tokens"; const TOKENS = [ "0x00400FcbF0816bebB94654259de7273f4A05c762", "0x00Be915B9dCf56a3CBE739D9B9c202ca692409EC", "0x46c9757C5497c5B1f2eb73aE79b6B67D119B0B58", "0x471EcE3750Da237f93B8E339c536989b8978a438", "0x73a210637f6F6B7005512677Ba6B3C96bb4AA44B", "0xD8763CBa276a3738E6DE85b4b3bF5FDed6D6cA73", "0xef4229c8c3250C675F21BCefa42f58EfbfF6002a", ]; describe("Smart router", () => { const apikey = ""; const wallet = new EOA( undefined, ChainId.Celo, TestWalletInfo.wallets[0].eoa ); before(async () => { await wallet._loadWallet({ mnemonic: TestWalletInfo.wallets[0].mnemonic }); }); TOKENS.forEach((t1, i) => TOKENS.forEach((t2, j) => { if (i === j) return; it(`Fetches the route for ${t1} -> ${t2}`, async () => { const router = new SmartRouter(undefined, wallet); const result = await router.getRouteBase( t1, t2, new BigNumber(10).pow(10) ); }).timeout(5 * 1000); it(`Fetches the route for ${t1} -> ${t2} with t1 being a token object`, async () => { const router = new SmartRouter(undefined, wallet); const result = await router.getRouteBase( new Token(ChainId.Celo, t1), t2, new BigNumber(10).pow(10) ); }).timeout(5 * 1000); it(`Fetches the route for ${t1} -> ${t2} with t2 being a token object`, async () => { const router = new SmartRouter(undefined, wallet); const result = await router.getRouteBase( t1, new Token(ChainId.Celo, t2), new BigNumber(10).pow(10) ); }).timeout(5 * 1000); it(`Fetches the route for ${t1} -> ${t2} with both being a token object`, async () => { const router = new SmartRouter(undefined, wallet); const result = await router.getRouteBase( new Token(ChainId.Celo, t1), new Token(ChainId.Celo, t2), new BigNumber(10).pow(10) ); }).timeout(5 * 1000); }) ); });