UNPKG

@swapnet-xyz/sdk

Version:
66 lines (65 loc) 1.8 kB
import type { LiquiditySourceUname } from "./unames.js"; export interface LiquidityInfoBase { source: LiquiditySourceUname; address: string; } export interface LimitOrderInfo extends LiquidityInfoBase { maker: string; makerToken: string; takerToken: string; makerAmount: bigint; takerAmount: bigint; nonce: bigint; deadline: bigint; signature: string; } export interface UniswapV3Info extends LiquidityInfoBase { fee: bigint; } export interface UniswapV4Info extends LiquidityInfoBase { fee: bigint; tickSpacing: bigint; isToken0Native: boolean; } export interface UniswapV2Info extends LiquidityInfoBase { feeInBps: bigint; } export interface RingswapV2Info extends LiquidityInfoBase { fromFewWrappedTokenAddress: string; toFewWrappedTokenAddress: string; } export interface AerodromeV3Info extends LiquidityInfoBase { tickSpacing: bigint; } export interface BebopLimitOrderInfo extends LiquidityInfoBase { isSingleOrder: boolean; calldata: string; partialFillOffset: number; } export type LiquidityInfo = LiquidityInfoBase | LimitOrderInfo | UniswapV2Info | UniswapV3Info | UniswapV4Info | AerodromeV3Info | RingswapV2Info | BebopLimitOrderInfo; export interface Swap { fromTokenOp: TokenOperation; toTokenOp: TokenOperation; amountIn: bigint; amountOut: bigint; liquidityInfo: LiquidityInfo; } export interface TokenOperation { tokenInfo: { address: string; name: string; symbol: string; decimals: number; usdPrice?: number; }; fromSwaps: Swap[]; toSwaps: Swap[]; } export interface IRoutingPlan { tokenOps: TokenOperation[]; swaps: Swap[]; fromToken: string; toToken: string; amountIn: bigint; amountOut: bigint; }