UNPKG

@pancakeswap/v2-sdk

Version:
62 lines 2.09 kB
import { Currency, Percent, TradeType } from '@pancakeswap/swap-sdk-core'; import { Hex } from 'viem'; import { Trade } from './entities'; /** * Options for producing the arguments to send call to the router. */ export interface TradeOptions { /** * How much the execution price is allowed to move unfavorably from the trade execution price. */ allowedSlippage: Percent; /** * How long the swap is valid until it expires, in seconds. * This will be used to produce a `deadline` parameter which is computed from when the swap call parameters * are generated. */ ttl: number; /** * The account that should receive the output of the swap. */ recipient: string; /** * Whether any of the tokens in the path are fee on transfer tokens, which should be handled with special methods */ feeOnTransfer?: boolean; } export interface TradeOptionsDeadline extends Omit<TradeOptions, 'ttl'> { /** * When the transaction expires. * This is an atlernate to specifying the ttl, for when you do not want to use local time. */ deadline: number; } /** * The parameters to use in the call to the Pancake Router to execute a trade. */ export interface SwapParameters { /** * The method to call on the Pancake Router. */ methodName: string; /** * The arguments to pass to the method, all hex encoded. */ args: Array<Hex | Hex[] | unknown>; /** * The amount of wei to send in hex. */ value: Hex; } /** * Represents the Pancake Router, and has static methods for helping execute trades. */ export declare abstract class Router { /** * Produces the on-chain method name to call and the hex encoded parameters to pass as arguments for a given trade. * @param trade to produce call parameters for * @param options options for the call parameters */ static swapCallParameters(trade: Trade<Currency, Currency, TradeType>, options: TradeOptions | TradeOptionsDeadline): SwapParameters; } //# sourceMappingURL=router.d.ts.map