UNPKG

fsl-js-sdk

Version:
47 lines (46 loc) 2.92 kB
import { Chains, TOKEN_NAME } from '../constants/index'; import BigNumber from 'bignumber.js'; import { ethers, BytesLike } from 'ethers'; declare enum DEVICE_TYPE { IOS = "ios", ANDROID = "android", PC = "PC" } declare const getUserAgent: () => DEVICE_TYPE; declare const terminalType: DEVICE_TYPE; declare const loadScript: (url: string, params: Record<string, any>) => Promise<unknown>; declare const toast: (msg: any) => void; declare const addNotifyFunction: (target: any, name: any, descriptor: any) => any; export declare const formatMnemonic: (input: string) => string; export declare const formatSolTokensNumOut: (num: number, tokenName: TOKEN_NAME) => string; export declare const numberFixed: (num: number | string, pos?: number) => number; export declare const formatSolTokensNumIn: (num: number, tokenName: TOKEN_NAME) => bigint; export declare const getAmountIn: (amount: string, tokenName: TOKEN_NAME, chain?: Chains) => ethers.BigNumber; export declare const getAmountOut: (amount: any, tokenName: TOKEN_NAME, chain?: Chains) => string; export declare const getTokenContracts: (chain: Chains, tokenName: TOKEN_NAME.GGT | TOKEN_NAME.GST | TOKEN_NAME.GMT | TOKEN_NAME.USDT | TOKEN_NAME.USDC | TOKEN_NAME.SUT) => string; export declare const convertObjToAst: (obj: Record<string, any>) => Record<string, any>; export declare function getPairAddress(tokenA: string, tokenB: string, chain: Exclude<Chains, Chains.solana>, provider: ethers.providers.JsonRpcProvider, isUniswap?: boolean): Promise<any>; export declare const getUnitPrice: (fromPrice: string, toPrice: string) => string; export declare function getSwapPoolAmount(chain: Exclude<Chains, Chains.solana>, fromTokenAddress: string, toTokenAddress: string): Promise<{ x: BigNumber; y: BigNumber; }>; export declare function getUniswapPoolAmount(chain: Exclude<Chains, Chains.solana>, fromTokenAddress: string, toTokenAddress: string): Promise<{ x: BigNumber; y: BigNumber; }>; export declare const calculatePriceImpact: (chain: Exclude<Chains, Chains.solana>, fromTokenName: TOKEN_NAME, toTokenName: TOKEN_NAME, amount: string, isUniswap?: boolean) => Promise<number>; export declare const getSolanaTokenImpact: (fromTokenName: TOKEN_NAME, toTokenName: TOKEN_NAME, amount: string) => Promise<number>; export declare function getBytes(value: BytesLike, copy?: boolean): BytesLike; export declare const getTokenName: (address: string) => TOKEN_NAME | "UNKNOWN"; export declare const getAdapter: (address: string) => "GGUSD" | "" | "DOOAR" | "Quickswap" | "UNIV4" | "UNIV3"; export declare const detectAssetChange: (contractAddress: string, address: string, calldata: string, chain: Chains) => Promise<{ assetType: string; symbol: any; name: any; from: any; changeType: string; to: any; amount: any; } | null>; export { getUserAgent, loadScript, toast, addNotifyFunction, terminalType, DEVICE_TYPE, };