UNPKG

@nekoproject/swap

Version:

Cross-chain Swap Token

93 lines (81 loc) 1.99 kB
/* eslint-disable @typescript-eslint/no-explicit-any */ import { Wallet } from '@nekoproject/wallets'; import { BaseToken, SPLToken } from '@nekoproject/tokens'; export type CreateOrder = { wallet_address: string; slippage: number; srcAmount: string; destAmount?: string; destToken: BaseToken; srcToken: BaseToken; }; export type SetApiParams = { createOrder: string; buildTransaction: string; }; // eslint-disable-next-line @typescript-eslint/ban-types export type SwapOrderRequest = {}; // eslint-disable-next-line @typescript-eslint/ban-types export type SPLCreateBuildSwap = CreateOrder & {}; export type SPLSwapTransaction = { setupTransaction?: string; swapTransaction: string; cleanupTransaction?: string; }; export type SPLBuildSwapTransaction = { inAmount: string; outAmount: string; transaction: SPLSwapTransaction; }; export type BSCSwapOrderRequest = SwapOrderRequest & { slippage?: number; id: string; src_token: string; src_amount: string; src_decimals: number; src_usd: string; dest_token: string; dest_amount: string; dest_decimals: number; dest_usd: string; gas_cost_usd: string; gas_cost: string; expired_at: string; updated_at: string; created_at: string; token_transfer_proxy: string; network: string; }; export type ETHSwapOrderRequest = BSCSwapOrderRequest; export type SPLSwapOrderRequest = BSCSwapOrderRequest & { transaction: SPLSwapTransaction; }; export type SwapConfig = { cluster: 'devnet' | 'testnet' | 'mainnet-beta'; fee: Fee; slippage?: number; }; export type Fee = { feeOwner: string; fee: number; }; export type SwapOrder = { inputToken: SPLToken; outputToken: SPLToken; amount: number; slippage?: number; }; export type AggParams = { user: Wallet; }; export type SwapRequest = { aggregator: any; routes: any; }; export type SwapResponse = { tx?: string; inputAddress?: string; outputAddress?: string; inputAmount?: number; outputAmount?: number; };