import { Currency, CurrencyAmount, Percent, Price, TradeType } from '@etcswapv2/sdk-core'; import { Pool } from './pool'; import { Route } from './route'; /** * Trades are made up of multiple routes */ export interface Swap { route: Route; inputAmount: CurrencyAmount; outputAmount: CurrencyAmount; } /** * Represents a trade executed against a set of routes */ export declare class Trade { /** * The route of the trade */ readonly swaps: Swap[]; /** * The type of the trade */ readonly tradeType: TTradeType; private _inputAmount; private _outputAmount; private _executionPrice; private _priceImpact; /** * Constructs a trade by simulating swaps through the given routes * @param routes The routes to take for this trade * @param tradeType The type of the trade */ private constructor(); /** * The input amount for the trade */ get inputAmount(): CurrencyAmount; /** * The output amount for the trade */ get outputAmount(): CurrencyAmount; /** * The price expressed in terms of output amount/input amount */ get executionPrice(): Price; /** * Returns the percent difference between the route's mid price and the price impact */ get priceImpact(): Percent; /** * Constructs an exact in trade with the given amount in and route * @param route The route of the exact in trade * @param amountIn The amount being passed in * @returns The exact in trade */ static exactIn(route: Route, amountIn: CurrencyAmount): Promise>; /** * Constructs an exact out trade with the given amount out and route * @param route The route of the exact out trade * @param amountOut The amount returned by the trade * @returns The exact out trade */ static exactOut(route: Route, amountOut: CurrencyAmount): Promise>; /** * Constructs a trade from a route and amount * @param route The route of the trade * @param amount The amount specified, either input or output, depending on tradeType * @param tradeType The type of the trade, either exact in or exact out * @returns The trade */ static fromRoute(route: Route, amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount : CurrencyAmount, tradeType: TTradeType): Promise>; /** * Constructs a trade from routes * @param routes The routes to take for the trade * @param tradeType The type of the trade * @returns The trade */ static fromRoutes(routes: { amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount : CurrencyAmount; route: Route; }[], tradeType: TTradeType): Promise>; /** * 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): CurrencyAmount; /** * Get the maximum amount that should be spent on 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): CurrencyAmount; /** * Return the execution price after accounting for slippage tolerance * @param slippageTolerance the allowed tolerated slippage * @returns The execution price */ worstExecutionPrice(slippageTolerance: Percent): Price; /** * Given a list of pools and a fixed amount in, returns the top `maxNumResults` trades that go from an input token * to an output token, making at most `maxHops` hops. * @param pools the pools to consider * @param currencyAmountIn exact amount of input currency to spend * @param currencyOut the desired currency out * @param options options for maximum hops and results * @returns The trades */ static bestTradeExactIn(pools: Pool[], currencyAmountIn: CurrencyAmount, currencyOut: TOutput, { maxNumResults, maxHops }?: { maxNumResults?: number; maxHops?: number; }, currentPools?: Pool[], nextAmountIn?: CurrencyAmount, bestTrades?: Trade[]): Promise[]>; /** * Given a list of pools and a fixed amount out, returns the top `maxNumResults` trades that go from an input token * to an output token amount, making at most `maxHops` hops. * @param pools the pools to consider * @param currencyIn the currency to spend * @param currencyAmountOut the desired currency amount out * @param options options for maximum hops and results * @returns The trades */ static bestTradeExactOut(pools: Pool[], currencyIn: TInput, currencyAmountOut: CurrencyAmount, { maxNumResults, maxHops }?: { maxNumResults?: number; maxHops?: number; }, currentPools?: Pool[], nextAmountOut?: CurrencyAmount, bestTrades?: Trade[]): Promise[]>; } /** * Comparator function to sort trades */ export declare function tradeComparator(a: Trade, b: Trade): number; //# sourceMappingURL=trade.d.ts.map