UNPKG

eulith-web3js

Version:

Official Eulith Typescript client library

72 lines (71 loc) 2.43 kB
import * as Eulith from "./index"; /** * Specify which swap aggregator to route through * In our experience, zero ex has historically been much more gas efficient */ export declare enum Provider { ZERO_EX = "zero_ex", ONE_INCH = "one_inch" } /** * Eulith services support many venues for your swap transaction * Use this enum to specify where you'd like to run the swap */ export declare enum LiquiditySource { UNISWAP_V1 = "uniswap_v1", UNISWAP_V2 = "uniswap_v2", UNISWAP_V3 = "uniswap_v3", BALANCER_V1 = "balancer_v1", BALANCER_V2 = "balancer_v2", CURVE_V1 = "curve_v1", CURVE_V2 = "curve_v2", COMPOUND = "compound", PANCAKE = "pancake", AAVE_V1 = "aave_v1", AAVE_V2 = "aave_v2", DODO_V1 = "dodo_v1", DODO_V2 = "dodo_v2", SUSHI = "sushi", KYBER = "kyber", BANCOR_V1 = "bancor_v1", BANCOR_V3 = "bancor_v3", LIDO = "lido", MAKER_PSM = "maker_psm", MSTABLE = "mstable", SADDLE = "saddle", SHELL = "shell", SHIBA = "shiba", SYNAPSE = "synapse", SYNTHETIX = "synthetix" } /** * Swap request object, designating exchange tokens, amounts, recipient, etc */ export declare class Request { /** The sell token as an ERC20 token object */ sellToken: Eulith.Contracts.ERC20TokenContract; /** The buy token as an ERC20 token object */ buyToken: Eulith.Contracts.ERC20TokenContract; /** The sell amount in whole units (i.e. 1 == 1 USDC) */ sellAmount: number; /** Where the swapped funds should end up */ recipient?: string; /** Which swap aggregator you prefer */ routeThrough?: Provider; /** The decimal value representing your slippage tolerance (i.e 0.01 == 1% max slippage) */ slippageTolerance?: number; /** Which venue you would like to take liquidity from */ liquiditySource?: LiquiditySource; /** The originating wallet, NOTE: ONLY necessary if NOT executing through an atomic tx */ fromAddress?: string; constructor({ sellToken, buyToken, sellAmount, recipient, routeThrough, slippageTolerance, liquiditySource, fromAddress }: { sellToken: Eulith.Contracts.ERC20TokenContract; buyToken: Eulith.Contracts.ERC20TokenContract; sellAmount: number; recipient?: string; routeThrough?: Provider; slippageTolerance?: number; liquiditySource?: LiquiditySource; fromAddress?: string; }); }