@uniswap/v4-sdk
Version:
⚒️ An SDK for building applications on top of Uniswap V4
71 lines (70 loc) • 2.06 kB
TypeScript
import { BigNumber } from 'ethers';
import { Currency, Percent, TradeType } from '@uniswap/sdk-core';
import { Trade } from '../entities/trade';
/**
* Actions
* @description Constants that define what action to perform
* Not all actions are supported yet.
* @enum {number}
*/
/**
* UniversalRouter version
* @description Version of the UniversalRouter contract
* @enum {string}
*/
export declare enum URVersion {
V2_0 = "2.0",
V2_1_1 = "2.1.1",
V2_2_0 = "2.2.0"
}
export declare function isAtLeastV2_1_1(version?: string): boolean;
export declare enum Actions {
INCREASE_LIQUIDITY = 0,
DECREASE_LIQUIDITY = 1,
MINT_POSITION = 2,
BURN_POSITION = 3,
SWAP_EXACT_IN_SINGLE = 6,
SWAP_EXACT_IN = 7,
SWAP_EXACT_OUT_SINGLE = 8,
SWAP_EXACT_OUT = 9,
SETTLE = 11,
SETTLE_ALL = 12,
SETTLE_PAIR = 13,
TAKE = 14,
TAKE_ALL = 15,
TAKE_PORTION = 16,
TAKE_PAIR = 17,
CLOSE_CURRENCY = 18,
SWEEP = 20,
UNWRAP = 22
}
export declare enum Subparser {
V4SwapExactInSingle = 0,
V4SwapExactIn = 1,
V4SwapExactOutSingle = 2,
V4SwapExactOut = 3,
PoolKey = 4
}
export type ParamType = {
readonly name: string;
readonly type: string;
readonly subparser?: Subparser;
};
export declare const V4_BASE_ACTIONS_ABI_DEFINITION: {
[key in Actions]: readonly ParamType[];
};
export declare const V4_SWAP_ACTIONS_V2_1_1: {
[key: number]: readonly ParamType[];
};
export declare class V4Planner {
actions: string;
params: string[];
constructor();
addAction(type: Actions, parameters: any[], urVersion?: URVersion): V4Planner;
addTrade(trade: Trade<Currency, Currency, TradeType>, slippageTolerance?: Percent, minHopPriceX36?: BigNumber[], urVersion?: URVersion): V4Planner;
addSettle(currency: Currency, payerIsUser: boolean, amount?: BigNumber): V4Planner;
addTake(currency: Currency, recipient: string, amount?: BigNumber): V4Planner;
addUnwrap(amount: BigNumber): V4Planner;
finalize(): string;
private addSwapAction;
}