UNPKG

butterjs-sdk

Version:
102 lines (101 loc) 2.76 kB
import { Token } from '../entities'; import { BigNumber, Signer } from 'ethers'; import { KeyStore } from 'near-api-js/lib/key_stores'; import { BaseCurrency } from '../entities/BaseCurrency'; import { Provider } from '@ethersproject/abstract-provider'; import { Eth } from 'web3-eth'; import { NearProviderType } from './paramTypes'; export declare type BridgeRequestParam = { fromAddress: string; fromToken: BaseCurrency; fromChainId: string; toChainId: string; toAddress: string; amount: string; options: ButterTransactionOption; }; export declare type SwapRequestParam = { fromAddress: string; fromToken: BaseCurrency; toAddress: string; toToken: BaseCurrency; amountIn: string; swapRouteStr: string; slippage?: number; options: ButterTransactionOption; }; export interface ButterCrossChainRoute { srcChain: ButterSwapRoute[]; mapChain: ButterSwapRoute[]; targetChain: ButterSwapRoute[]; bridgeIn: any; bridgeOut: any; } export interface ButterSwapRoute { chainId: string; amountIn: string; amountOut: string; path: ButterPath[]; dexName: string; tokenIn: BaseCurrency; tokenOut: BaseCurrency; } export interface ButterPath { id: string; tokenIn: PathToken; tokenOut: PathToken; } export interface PathToken { address: string; icon?: string; symbol?: string; } export declare type ButterTransactionOption = { signerOrProvider?: Signer | Provider | Eth; nearProvider?: NearProviderType; gas?: string; gasPrice?: string; }; export declare type BridgeOptions = { signerOrProvider?: Signer | Provider | Eth; nearProvider?: NearProviderType; gas?: string; }; export declare type AddTokenPairParam = { srcToken: BaseCurrency; targetToken: BaseCurrency; feeRate: FeeRate; mapNetwork: 'map-devnet' | 'map-testnet' | 'map-mainnet'; mapSigner: Signer; nearConfig?: NearNetworkConfig; mapToken?: Token; srcSigner?: Signer; }; export declare class NearNetworkConfig { fromAccount: string; keyStore: KeyStore; nodeUrl: string; networkId: 'testnet' | 'mainnet'; constructor(fromAccount: string, keyStore: KeyStore, nodeUrl: string, networkId: 'testnet' | 'mainnet'); } export declare type TransactionOptions = { gas?: string; }; export declare type FeeRate = { bps: number; highest: BigNumber; lowest: BigNumber; }; export interface ButterCoreParam { amountInArr: string[]; paramsArr: string[]; routerIndex: string[]; inputOutAddre: [string, string]; } export declare type ButterRouterParam = { coreSwapData: ButterCoreParam; targetSwapData: string; amount: string; toChainId: string; toAddress: string; };