/** * MetricAMM SDK - Swap Router Functions * Functions for building, encoding and sending swaps. */ import type { Address, PublicClient, Hex } from "viem"; export interface PreparedSwapTransaction { data: Hex; value?: bigint; } export type SwapExactInputArgs = readonly [ Address, Address, boolean, bigint, bigint, bigint, bigint ]; export type SwapExactInputParams = { pool: Address; recipient: Address; zeroForOne: boolean; amountIn: bigint; priceLimitX64: bigint; minAmountOut: bigint; deadline: bigint; }; export type SwapExactOutputArgs = readonly [ Address, Address, boolean, bigint, bigint, bigint, bigint ]; export type SwapExactOutputParams = { pool: Address; recipient: Address; zeroForOne: boolean; amountOut: bigint; priceLimitX64: bigint; maxAmountIn: bigint; deadline: bigint; }; export interface BuildSwapPrices { bidPriceX64: bigint; askPriceX64: bigint; } export interface BuildSwapExactInputParams { publicClient: PublicClient; routerAddress: Address; pool: Address; recipient: Address; zeroForOne: boolean; amountIn: bigint; slippagePercent: number; prices?: BuildSwapPrices; priceLimitX64?: bigint; deadline: bigint; } export interface BuildSwapExactOutputParams { publicClient: PublicClient; routerAddress: Address; pool: Address; recipient: Address; zeroForOne: boolean; amountOut: bigint; slippagePercent: number; prices?: BuildSwapPrices; priceLimitX64?: bigint; deadline: bigint; } export type QuoteExpectedAmountsForSwapExactInputParams = Omit; export type QuoteExpectedAmountsForSwapExactOutputParams = Omit; export declare function buildArgsForSwapExactInput(params: BuildSwapExactInputParams): Promise; export declare function buildArgsAndExpectedAmountsForSwapExactInput(params: BuildSwapExactInputParams): Promise<{ args: SwapExactInputArgs; expectedInput: bigint; expectedOutput: bigint; }>; export type QuoteSwapParams = { publicClient: PublicClient; routerAddress: Address; pool: Address; zeroForOne: boolean; amountSpecified: bigint; priceLimitX64?: bigint; prices?: BuildSwapPrices; }; export type QuoteSwapResult = { amount0Delta: bigint; amount1Delta: bigint; amountIn: bigint; amountOut: bigint; }; export declare function quoteSwap(params: QuoteSwapParams): Promise; export declare function quoteExpectedAmountsForSwapExactInput(params: QuoteExpectedAmountsForSwapExactInputParams): Promise<{ expectedInput: bigint; expectedOutput: bigint; }>; export declare function buildArgsForSwapExactOutput(params: BuildSwapExactOutputParams): Promise; export declare function buildArgsAndExpectedAmountsForSwapExactOutput(params: BuildSwapExactOutputParams): Promise<{ args: SwapExactOutputArgs; expectedInput: bigint; expectedOutput: bigint; }>; export declare function quoteExpectedAmountsForSwapExactOutput(params: QuoteExpectedAmountsForSwapExactOutputParams): Promise<{ expectedInput: bigint; expectedOutput: bigint; }>; export declare function encodeSwapExactInputCalldata(argsOrParams: SwapExactInputArgs | SwapExactInputParams): `0x${string}`; export declare const prepareSwapExactInputCalldata: typeof encodeSwapExactInputCalldata; export declare function encodeSwapExactOutputCalldata(argsOrParams: SwapExactOutputArgs | SwapExactOutputParams): `0x${string}`; export declare const prepareSwapExactOutputCalldata: typeof encodeSwapExactOutputCalldata; export declare function encodeSwapExactInputNativeForTokensCalldata(params: SwapExactInputParams): PreparedSwapTransaction; export declare const prepareSwapExactInputNativeForTokensCalldata: typeof encodeSwapExactInputNativeForTokensCalldata; //# sourceMappingURL=swap.d.ts.map