import { Currency, CurrencyAmount, Percent, Price, TradeType } from '@uniswap/sdk-core'; import { Pair, Route as V2RouteSDK } from '@uniswap/v2-sdk'; import { Pool as V3Pool, Route as V3RouteSDK } from '@uniswap/v3-sdk'; import { Pool as V4Pool, Route as V4RouteSDK } from '@uniswap/v4-sdk'; import { MixedRouteSDK } from './mixedRoute/route'; import { IRoute } from './route'; export declare class Trade { readonly routes: IRoute[]; readonly tradeType: TTradeType; private _outputAmount; private _inputAmount; private _nativeInputRoutes; private _wethInputRoutes; /** * The swaps of the trade, i.e. which routes and how much is swapped in each that * make up the trade. May consist of swaps in v2 or v3. */ readonly swaps: { route: IRoute; inputAmount: CurrencyAmount; outputAmount: CurrencyAmount; maxHopSlippage?: bigint[]; }[]; constructor({ v2Routes, v3Routes, v4Routes, mixedRoutes, tradeType, }: { v2Routes?: { routev2: V2RouteSDK; inputAmount: CurrencyAmount; outputAmount: CurrencyAmount; maxHopSlippage?: bigint[]; }[]; v3Routes?: { routev3: V3RouteSDK; inputAmount: CurrencyAmount; outputAmount: CurrencyAmount; maxHopSlippage?: bigint[]; }[]; v4Routes?: { routev4: V4RouteSDK; inputAmount: CurrencyAmount; outputAmount: CurrencyAmount; maxHopSlippage?: bigint[]; }[]; mixedRoutes?: { mixedRoute: MixedRouteSDK; inputAmount: CurrencyAmount; outputAmount: CurrencyAmount; maxHopSlippage?: bigint[]; }[]; tradeType: TTradeType; }); get inputAmount(): CurrencyAmount; get outputAmount(): CurrencyAmount; /** * Returns the sum of all swaps within the trade * @returns * inputAmount: total input amount * inputAmountNative: total amount of native currency required for ETH input paths * - 0 if inputAmount is native but no native input paths * - undefined if inputAmount is not native * outputAmount: total output amount * outputAmountNative: total amount of native currency returned from ETH output paths * - 0 if outputAmount is native but no native output paths * - undefined if outputAmount is not native */ get amounts(): { inputAmount: CurrencyAmount; inputAmountNative: CurrencyAmount | undefined; outputAmount: CurrencyAmount; outputAmountNative: CurrencyAmount | undefined; }; get numberOfInputWraps(): number; get numberOfInputUnwraps(): number; get nativeInputRoutes(): IRoute[]; get wethInputRoutes(): IRoute[]; private _executionPrice; /** * The price expressed in terms of output amount/input amount. */ get executionPrice(): Price; /** * Returns the sell tax of the input token */ get inputTax(): Percent; /** * Returns the buy tax of the output token */ get outputTax(): Percent; private isWrappedNative; /** * The cached result of the price impact computation * @private */ private _priceImpact; /** * Returns the percent difference between the route's mid price and the expected execution price * In order to exclude token taxes from the price impact calculation, the spot price is calculated * using a ratio of values that go into the pools, which are the post-tax input amount and pre-tax output amount. */ get priceImpact(): Percent; /** * Get the minimum amount that must be received from this trade for the given slippage tolerance * @param slippageTolerance The tolerance of unfavorable slippage from the execution price of this trade * @returns The amount out */ minimumAmountOut(slippageTolerance: Percent, amountOut?: CurrencyAmount): CurrencyAmount; /** * Get the maximum amount in that can be spent via this trade for the given slippage tolerance * @param slippageTolerance The tolerance of unfavorable slippage from the execution price of this trade * @returns The amount in */ maximumAmountIn(slippageTolerance: Percent, amountIn?: CurrencyAmount): CurrencyAmount; /** * Return the execution price after accounting for slippage tolerance * @param slippageTolerance the allowed tolerated slippage * @returns The execution price */ worstExecutionPrice(slippageTolerance: Percent): Price; static fromRoutes(v2Routes: { routev2: V2RouteSDK; amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount : CurrencyAmount; maxHopSlippage?: bigint[]; }[], v3Routes: { routev3: V3RouteSDK; amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount : CurrencyAmount; maxHopSlippage?: bigint[]; }[], tradeType: TTradeType, mixedRoutes?: { mixedRoute: MixedRouteSDK; amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount : CurrencyAmount; maxHopSlippage?: bigint[]; }[], v4Routes?: { routev4: V4RouteSDK; amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount : CurrencyAmount; maxHopSlippage?: bigint[]; }[]): Promise>; static fromRoute(route: V2RouteSDK | V3RouteSDK | V4RouteSDK | MixedRouteSDK, amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount : CurrencyAmount, tradeType: TTradeType): Promise>; }