import { Currency, CurrencyAmount, TradeType } from '@uniswap/sdk-core'; import { ethers } from 'ethers'; import { Config } from '../../../../Fct/Config'; import { UnionToIntersection } from '../../../../Fct/Fct'; import { ChainId, Protocol } from '../../../../Fct/generics'; import { Uniswap as UniswapPlugins } from '../../uniswap'; import { getMethodName } from './getMethodName'; import { Slippage } from './getSlippage'; import { InterfaceTrade, TradeState } from './types/types'; export declare const INVALID_TRADE: { state: TradeState; trade: undefined; }; interface BestTrade { INPUT: { currency: Currency | undefined; amount: CurrencyAmount | undefined; }; OUTPUT: { currency: Currency | undefined; amount: CurrencyAmount | undefined; }; trade: { trade: InterfaceTrade | undefined; state: TradeState; } | undefined; slippage: Slippage | undefined; type: UNISWAP_TYPE | undefined; } interface SwapAmounts { inputAmount: string | undefined; outputAmount: string | undefined; } export type SwapCallParamsOut = { amountOut: string; amountOutMin: undefined; amountInMax: string; path: string[]; to: string; }; export type SwapCallParamsIn = { amountIn: string; amountInMax: undefined; amountOutMin: string; path: string[]; to: string; }; export interface SwapCallParamsExactInputSingle { params_tuple: { tokenIn: string; tokenOut: string; fee: number; recipient: string; amountIn: string; amountOutMinimum: string; sqrtPriceLimitX96: string; }; } export interface SwapCallParamsExactInput { params_tuple: { path: string; recipient: string; amountIn: string; amountOutMinimum: string; }; } export interface SwapCallParamsExactOutputSingle { params_tuple: { tokenIn: string; tokenOut: string; fee: number; recipient: string; amountOut: string; amountInMaximum: string; sqrtPriceLimitX96: string; }; } export interface SwapCallParamsExactOutput { params_tuple: { path: string; recipient: string; amountOut: string; amountInMaximum: string; }; } export type SwapCallParams = SwapCallParamsOut | SwapCallParamsIn; type UniswapActionPlugin = UnionToIntersection<(typeof UniswapPlugins)['actions'][keyof (typeof UniswapPlugins)['actions']]>; export interface SwapValues extends SwapAmounts, BestTrade { protocol: Protocol; params?: { value?: string; methodParams: SwapCallParams | undefined; }; plugin?: UniswapActionPlugin; state?: 'VALID' | 'INVALID'; methodName?: ReturnType; } export declare enum UNISWAP_TYPE { EXACT_INPUT = "EXACT_INPUT", EXACT_OUTPUT = "EXACT_OUTPUT" } export interface SwapToken { address: string; decimals: number; } export interface NativeToken { address: 'NATIVE'; decimals: 18; } export interface SwapField { currency: SwapToken | NativeToken; amount?: string; } export type UniswapParams = { input: SwapField; output: SwapField; slippage?: number; }; export declare class Uniswap extends Config { MINIMUM_LIQUIDITY: number; private promiseReject; getSwapParams: ({ input, output, slippage }: UniswapParams) => Promise; getAmountParams: ({ input, output }: Omit) => Promise<{ state?: "VALID" | "INVALID" | undefined; inputAmount: string | undefined; outputAmount: string | undefined; methodName: 'getAmountsOut' | 'getAmountsIn'; protocol: Protocol; plugin?: ({ new (args: { chainId: ChainId; initParams?: Partial<{ to: string | import("../../corelibTypes").Variable | undefined; methodParams: unknown; }> | undefined; walletAddress?: string | undefined; vaultAddress?: string | undefined; provider?: ethers.providers.JsonRpcProvider | undefined; }): import("../../../../Fct/Fct").NewPluginType<"UNISWAP", "GETTER", "getAmountsIn", string | undefined, { input: { to: import("../../../../Fct/Fct").FctAddress; methodParams: { amountOut: import("../../../../Fct/Fct").FctValue; path: import("../../../../Fct/Fct").FctAddressList; }; }; output: { amountIn: import("../../../../Fct/Fct").FctValue; amountOut: import("../../../../Fct/Fct").FctValue; }; }, Partial<{ to: string | import("../../corelibTypes").Variable | undefined; methodParams: unknown; }>>; } & { new (args: { chainId: ChainId; initParams?: Partial<{ to: string | import("../../corelibTypes").Variable | undefined; methodParams: unknown; }> | undefined; walletAddress?: string | undefined; vaultAddress?: string | undefined; provider?: ethers.providers.JsonRpcProvider | undefined; }): import("../../../../Fct/Fct").NewPluginType<"UNISWAP", "GETTER", "getAmountsOut", string | undefined, { input: { to: import("../../../../Fct/Fct").FctAddress; methodParams: { amountIn: import("../../../../Fct/Fct").FctValue; path: import("../../../../Fct/Fct").FctAddressList; }; }; output: { amountIn: import("../../../../Fct/Fct").FctValue; amountOut: import("../../../../Fct/Fct").FctValue; }; }, Partial<{ to: string | import("../../corelibTypes").Variable | undefined; methodParams: unknown; }>>; } & { new (args: { chainId: ChainId; initParams?: Partial<{ to: string | import("../../corelibTypes").Variable | undefined; methodParams: unknown; }> | undefined; walletAddress?: string | undefined; vaultAddress?: string | undefined; provider?: ethers.providers.JsonRpcProvider | undefined; }): import("../../../../Fct/Fct").NewPluginType<"UNISWAP", "GETTER", "getReserves", string | undefined, { input: { to: import("../../../../Fct/Fct").FctAddress; methodParams: {}; }; output: { reserve0: import("../../../../Fct/Fct").FctUInt112; reserve1: import("../../../../Fct/Fct").FctUInt112; blockTimestamp: import("../../../../Fct/Fct").FctUinteger32; }; }, Partial<{ to: string | import("../../corelibTypes").Variable | undefined; methodParams: unknown; }>>; } & { new (args: { chainId: ChainId; initParams?: Partial<{ to: string | import("../../corelibTypes").Variable | undefined; methodParams: unknown; }> | undefined; walletAddress?: string | undefined; vaultAddress?: string | undefined; provider?: ethers.providers.JsonRpcProvider | undefined; }): import("../../../../Fct/Fct").NewPluginType<"UNISWAP", "GETTER", "getPair", string | undefined, { input: { to: import("../../../../Fct/Fct").FctAddress; methodParams: { tokenA: import("../../../../Fct/Fct").FctAddress; tokenB: import("../../../../Fct/Fct").FctAddress; }; }; output: { address: import("../../../../Fct/Fct").FctAddress; }; }, Partial<{ to: string | import("../../corelibTypes").Variable | undefined; methodParams: unknown; }>>; }) | undefined; params?: { methodParams: { path?: string[]; amountIn?: string; } | { path?: string[]; amountOut?: string; }; } | undefined; } | undefined>; getPairAddress: ({ token0, token1 }: { token0: string; token1: string; }) => string; isPairExist: ({ token0, token1 }: { token0: string; token1: string; }) => Promise; getTotalSupply: ({ token0, token1 }: { token0: string; token1: string; }) => Promise; getReserves: ({ token0, token1 }: { token0: string; token1: string; }) => Promise; getLPTokenBalance: ({ token0, token1, address, }: { token0: string; token1: string; address: string; }) => Promise; getToken1LiquidityRate: ({ token0, token1 }: { token0: string; token1: string; }) => Promise; estimateLiquidityOutputOnAddLiquidity: ({ token0, token1, amount0, amount1, }: { token0: string; token1: string; amount0: string; amount1: string; }) => Promise; estimateTokensAmountOnRemoveLiquidity: ({ token0, token1, liquidity, }: { token0: string; token1: string; liquidity: string; }) => Promise; getPathAmountOut: ({ amountIn, path }: { amountIn: string; path: string[]; }) => Promise; getPathAmountIn: ({ amountOut, path }: { amountOut: string; path: string[]; }) => Promise; private getToken; private getLastInputValuesV2; private getLastSwapParamsV2; private getSwapValuesV2; getSwapValuesV3: ({ input, output }: { input: SwapField; output: SwapField; }) => Promise; private getTradeState; private validateSwapInput; private getSwapValues; private getSwapInfo; /** * Returns the best v2+v3 trade for a desired swap. * @param tradeType whether the swap is an exact in/out * @param amountSpecified the exact amount to swap in/out * @param otherCurrency the desired output/payment currency */ private getBestTrade; } export {};