@uniswap/router-sdk 1.22.3 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{approveAndCall.d.ts → cjs/src/approveAndCall.d.ts} +33 -33
- package/dist/cjs/src/approveAndCall.js +111 -0
- package/dist/cjs/src/approveAndCall.js.map +1 -0
- package/dist/{constants.d.ts → cjs/src/constants.d.ts} +13 -13
- package/dist/cjs/src/constants.js +22 -0
- package/dist/cjs/src/constants.js.map +1 -0
- package/dist/{entities → cjs/src/entities}/mixedRoute/route.d.ts +29 -29
- package/dist/cjs/src/entities/mixedRoute/route.js +119 -0
- package/dist/cjs/src/entities/mixedRoute/route.js.map +1 -0
- package/dist/cjs/src/entities/mixedRoute/route.test.d.ts +1 -0
- package/dist/cjs/src/entities/mixedRoute/route.test.js +469 -0
- package/dist/cjs/src/entities/mixedRoute/route.test.js.map +1 -0
- package/dist/{entities → cjs/src/entities}/mixedRoute/trade.d.ts +183 -183
- package/dist/cjs/src/entities/mixedRoute/trade.js +357 -0
- package/dist/cjs/src/entities/mixedRoute/trade.js.map +1 -0
- package/dist/cjs/src/entities/mixedRoute/trade.test.d.ts +1 -0
- package/dist/cjs/src/entities/mixedRoute/trade.test.js +1010 -0
- package/dist/cjs/src/entities/mixedRoute/trade.test.js.map +1 -0
- package/dist/{entities → cjs/src/entities}/protocol.d.ts +6 -6
- package/dist/cjs/src/entities/protocol.js +11 -0
- package/dist/cjs/src/entities/protocol.js.map +1 -0
- package/dist/{entities → cjs/src/entities}/route.d.ts +40 -40
- package/dist/cjs/src/entities/route.js +63 -0
- package/dist/cjs/src/entities/route.js.map +1 -0
- package/dist/cjs/src/entities/route.test.d.ts +1 -0
- package/dist/cjs/src/entities/route.test.js +192 -0
- package/dist/cjs/src/entities/route.test.js.map +1 -0
- package/dist/{entities → cjs/src/entities}/trade.d.ts +127 -127
- package/dist/cjs/src/entities/trade.js +366 -0
- package/dist/cjs/src/entities/trade.js.map +1 -0
- package/dist/cjs/src/entities/trade.test.d.ts +1 -0
- package/dist/cjs/src/entities/trade.test.js +1267 -0
- package/dist/cjs/src/entities/trade.test.js.map +1 -0
- package/dist/{index.d.ts → cjs/src/index.d.ts} +14 -14
- package/dist/cjs/src/index.js +18 -0
- package/dist/cjs/src/index.js.map +1 -0
- package/dist/{multicallExtended.d.ts → cjs/src/multicallExtended.d.ts} +11 -11
- package/dist/cjs/src/multicallExtended.js +43 -0
- package/dist/cjs/src/multicallExtended.js.map +1 -0
- package/dist/cjs/src/multicallExtended.test.d.ts +1 -0
- package/dist/cjs/src/multicallExtended.test.js +22 -0
- package/dist/cjs/src/multicallExtended.test.js.map +1 -0
- package/dist/{paymentsExtended.d.ts → cjs/src/paymentsExtended.d.ts} +15 -15
- package/dist/cjs/src/paymentsExtended.js +65 -0
- package/dist/cjs/src/paymentsExtended.js.map +1 -0
- package/dist/cjs/src/paymentsExtended.test.d.ts +1 -0
- package/dist/cjs/src/paymentsExtended.test.js +60 -0
- package/dist/cjs/src/paymentsExtended.test.js.map +1 -0
- package/dist/{swapRouter.d.ts → cjs/src/swapRouter.d.ts} +95 -95
- package/dist/cjs/src/swapRouter.js +439 -0
- package/dist/cjs/src/swapRouter.js.map +1 -0
- package/dist/cjs/src/swapRouter.test.d.ts +1 -0
- package/dist/cjs/src/swapRouter.test.js +1161 -0
- package/dist/cjs/src/swapRouter.test.js.map +1 -0
- package/dist/{utils → cjs/src/utils}/TPool.d.ts +4 -4
- package/dist/cjs/src/utils/TPool.js +3 -0
- package/dist/cjs/src/utils/TPool.js.map +1 -0
- package/dist/{utils → cjs/src/utils}/encodeMixedRouteToPath.d.ts +9 -9
- package/dist/cjs/src/utils/encodeMixedRouteToPath.js +90 -0
- package/dist/cjs/src/utils/encodeMixedRouteToPath.js.map +1 -0
- package/dist/cjs/src/utils/encodeMixedRouteToPath.test.d.ts +1 -0
- package/dist/cjs/src/utils/encodeMixedRouteToPath.test.js +136 -0
- package/dist/cjs/src/utils/encodeMixedRouteToPath.test.js.map +1 -0
- package/dist/{utils → cjs/src/utils}/index.d.ts +16 -16
- package/dist/cjs/src/utils/index.js +51 -0
- package/dist/cjs/src/utils/index.js.map +1 -0
- package/dist/{utils → cjs/src/utils}/pathCurrency.d.ts +4 -4
- package/dist/cjs/src/utils/pathCurrency.js +35 -0
- package/dist/cjs/src/utils/pathCurrency.js.map +1 -0
- package/dist/cjs/src/utils/pathCurrency.test.d.ts +1 -0
- package/dist/cjs/src/utils/pathCurrency.test.js +17 -0
- package/dist/cjs/src/utils/pathCurrency.test.js.map +1 -0
- package/dist/esm/src/approveAndCall.d.ts +33 -0
- package/dist/esm/src/approveAndCall.js +105 -0
- package/dist/esm/src/approveAndCall.js.map +1 -0
- package/dist/esm/src/constants.d.ts +13 -0
- package/dist/esm/src/constants.js +18 -0
- package/dist/esm/src/constants.js.map +1 -0
- package/dist/esm/src/entities/mixedRoute/route.d.ts +29 -0
- package/dist/esm/src/entities/mixedRoute/route.js +114 -0
- package/dist/esm/src/entities/mixedRoute/route.js.map +1 -0
- package/dist/esm/src/entities/mixedRoute/route.test.d.ts +1 -0
- package/dist/esm/src/entities/mixedRoute/route.test.js +467 -0
- package/dist/esm/src/entities/mixedRoute/route.test.js.map +1 -0
- package/dist/esm/src/entities/mixedRoute/trade.d.ts +183 -0
- package/dist/esm/src/entities/mixedRoute/trade.js +352 -0
- package/dist/esm/src/entities/mixedRoute/trade.js.map +1 -0
- package/dist/esm/src/entities/mixedRoute/trade.test.d.ts +1 -0
- package/dist/esm/src/entities/mixedRoute/trade.test.js +1008 -0
- package/dist/esm/src/entities/mixedRoute/trade.test.js.map +1 -0
- package/dist/esm/src/entities/protocol.d.ts +6 -0
- package/dist/esm/src/entities/protocol.js +8 -0
- package/dist/esm/src/entities/protocol.js.map +1 -0
- package/dist/esm/src/entities/route.d.ts +40 -0
- package/dist/esm/src/entities/route.js +55 -0
- package/dist/esm/src/entities/route.js.map +1 -0
- package/dist/esm/src/entities/route.test.d.ts +1 -0
- package/dist/esm/src/entities/route.test.js +190 -0
- package/dist/esm/src/entities/route.test.js.map +1 -0
- package/dist/esm/src/entities/trade.d.ts +127 -0
- package/dist/esm/src/entities/trade.js +362 -0
- package/dist/esm/src/entities/trade.js.map +1 -0
- package/dist/esm/src/entities/trade.test.d.ts +1 -0
- package/dist/esm/src/entities/trade.test.js +1265 -0
- package/dist/esm/src/entities/trade.test.js.map +1 -0
- package/dist/esm/src/index.d.ts +14 -0
- package/dist/esm/src/index.js +15 -0
- package/dist/esm/src/index.js.map +1 -0
- package/dist/esm/src/multicallExtended.d.ts +11 -0
- package/dist/esm/src/multicallExtended.js +39 -0
- package/dist/esm/src/multicallExtended.js.map +1 -0
- package/dist/esm/src/multicallExtended.test.d.ts +1 -0
- package/dist/esm/src/multicallExtended.test.js +20 -0
- package/dist/esm/src/multicallExtended.test.js.map +1 -0
- package/dist/esm/src/paymentsExtended.d.ts +15 -0
- package/dist/esm/src/paymentsExtended.js +61 -0
- package/dist/esm/src/paymentsExtended.js.map +1 -0
- package/dist/esm/src/paymentsExtended.test.d.ts +1 -0
- package/dist/esm/src/paymentsExtended.test.js +57 -0
- package/dist/esm/src/paymentsExtended.test.js.map +1 -0
- package/dist/esm/src/swapRouter.d.ts +95 -0
- package/dist/esm/src/swapRouter.js +434 -0
- package/dist/esm/src/swapRouter.js.map +1 -0
- package/dist/esm/src/swapRouter.test.d.ts +1 -0
- package/dist/esm/src/swapRouter.test.js +1159 -0
- package/dist/esm/src/swapRouter.test.js.map +1 -0
- package/dist/esm/src/utils/TPool.d.ts +4 -0
- package/dist/esm/src/utils/TPool.js +2 -0
- package/dist/esm/src/utils/TPool.js.map +1 -0
- package/dist/esm/src/utils/encodeMixedRouteToPath.d.ts +9 -0
- package/dist/esm/src/utils/encodeMixedRouteToPath.js +86 -0
- package/dist/esm/src/utils/encodeMixedRouteToPath.js.map +1 -0
- package/dist/esm/src/utils/encodeMixedRouteToPath.test.d.ts +1 -0
- package/dist/esm/src/utils/encodeMixedRouteToPath.test.js +134 -0
- package/dist/esm/src/utils/encodeMixedRouteToPath.test.js.map +1 -0
- package/dist/esm/src/utils/index.d.ts +16 -0
- package/dist/esm/src/utils/index.js +46 -0
- package/dist/esm/src/utils/index.js.map +1 -0
- package/dist/esm/src/utils/pathCurrency.d.ts +4 -0
- package/dist/esm/src/utils/pathCurrency.js +30 -0
- package/dist/esm/src/utils/pathCurrency.js.map +1 -0
- package/dist/esm/src/utils/pathCurrency.test.d.ts +1 -0
- package/dist/esm/src/utils/pathCurrency.test.js +15 -0
- package/dist/esm/src/utils/pathCurrency.test.js.map +1 -0
- package/dist/types/src/approveAndCall.d.ts +33 -0
- package/dist/types/src/constants.d.ts +13 -0
- package/dist/types/src/entities/mixedRoute/route.d.ts +29 -0
- package/dist/types/src/entities/mixedRoute/route.test.d.ts +1 -0
- package/dist/types/src/entities/mixedRoute/trade.d.ts +183 -0
- package/dist/types/src/entities/mixedRoute/trade.test.d.ts +1 -0
- package/dist/types/src/entities/protocol.d.ts +6 -0
- package/dist/types/src/entities/route.d.ts +40 -0
- package/dist/types/src/entities/route.test.d.ts +1 -0
- package/dist/types/src/entities/trade.d.ts +127 -0
- package/dist/types/src/entities/trade.test.d.ts +1 -0
- package/dist/types/src/index.d.ts +14 -0
- package/dist/types/src/multicallExtended.d.ts +11 -0
- package/dist/types/src/multicallExtended.test.d.ts +1 -0
- package/dist/types/src/paymentsExtended.d.ts +15 -0
- package/dist/types/src/paymentsExtended.test.d.ts +1 -0
- package/dist/types/src/swapRouter.d.ts +95 -0
- package/dist/types/src/swapRouter.test.d.ts +1 -0
- package/dist/types/src/utils/TPool.d.ts +4 -0
- package/dist/types/src/utils/encodeMixedRouteToPath.d.ts +9 -0
- package/dist/types/src/utils/encodeMixedRouteToPath.test.d.ts +1 -0
- package/dist/types/src/utils/index.d.ts +16 -0
- package/dist/types/src/utils/pathCurrency.d.ts +4 -0
- package/dist/types/src/utils/pathCurrency.test.d.ts +1 -0
- package/package.json +33 -18
- package/dist/index.js +0 -8
- package/dist/router-sdk.cjs.development.js +0 -2485
- package/dist/router-sdk.cjs.development.js.map +0 -1
- package/dist/router-sdk.cjs.production.min.js +0 -2
- package/dist/router-sdk.cjs.production.min.js.map +0 -1
- package/dist/router-sdk.esm.js +0 -2452
- package/dist/router-sdk.esm.js.map +0 -1
|
@@ -1,127 +1,127 @@
|
|
|
1
|
-
import { Currency, CurrencyAmount, Percent, Price, TradeType } from '@uniswap/sdk-core';
|
|
2
|
-
import { Pair, Route as V2RouteSDK } from '@uniswap/v2-sdk';
|
|
3
|
-
import { Pool as V3Pool, Route as V3RouteSDK } from '@uniswap/v3-sdk';
|
|
4
|
-
import { Pool as V4Pool, Route as V4RouteSDK } from '@uniswap/v4-sdk';
|
|
5
|
-
import { MixedRouteSDK } from './mixedRoute/route';
|
|
6
|
-
import { IRoute } from './route';
|
|
7
|
-
export declare class Trade<TInput extends Currency, TOutput extends Currency, TTradeType extends TradeType> {
|
|
8
|
-
readonly routes: IRoute<TInput, TOutput, Pair | V3Pool | V4Pool>[];
|
|
9
|
-
readonly tradeType: TTradeType;
|
|
10
|
-
private _outputAmount;
|
|
11
|
-
private _inputAmount;
|
|
12
|
-
private _nativeInputRoutes;
|
|
13
|
-
private _wethInputRoutes;
|
|
14
|
-
/**
|
|
15
|
-
* The swaps of the trade, i.e. which routes and how much is swapped in each that
|
|
16
|
-
* make up the trade. May consist of swaps in v2 or v3.
|
|
17
|
-
*/
|
|
18
|
-
readonly swaps: {
|
|
19
|
-
route: IRoute<TInput, TOutput, Pair | V3Pool | V4Pool>;
|
|
20
|
-
inputAmount: CurrencyAmount<TInput>;
|
|
21
|
-
outputAmount: CurrencyAmount<TOutput>;
|
|
22
|
-
}[];
|
|
23
|
-
constructor({ v2Routes, v3Routes, v4Routes, mixedRoutes, tradeType, }: {
|
|
24
|
-
v2Routes?: {
|
|
25
|
-
routev2: V2RouteSDK<TInput, TOutput>;
|
|
26
|
-
inputAmount: CurrencyAmount<TInput>;
|
|
27
|
-
outputAmount: CurrencyAmount<TOutput>;
|
|
28
|
-
}[];
|
|
29
|
-
v3Routes?: {
|
|
30
|
-
routev3: V3RouteSDK<TInput, TOutput>;
|
|
31
|
-
inputAmount: CurrencyAmount<TInput>;
|
|
32
|
-
outputAmount: CurrencyAmount<TOutput>;
|
|
33
|
-
}[];
|
|
34
|
-
v4Routes?: {
|
|
35
|
-
routev4: V4RouteSDK<TInput, TOutput>;
|
|
36
|
-
inputAmount: CurrencyAmount<TInput>;
|
|
37
|
-
outputAmount: CurrencyAmount<TOutput>;
|
|
38
|
-
}[];
|
|
39
|
-
mixedRoutes?: {
|
|
40
|
-
mixedRoute: MixedRouteSDK<TInput, TOutput>;
|
|
41
|
-
inputAmount: CurrencyAmount<TInput>;
|
|
42
|
-
outputAmount: CurrencyAmount<TOutput>;
|
|
43
|
-
}[];
|
|
44
|
-
tradeType: TTradeType;
|
|
45
|
-
});
|
|
46
|
-
get inputAmount(): CurrencyAmount<TInput>;
|
|
47
|
-
get outputAmount(): CurrencyAmount<TOutput>;
|
|
48
|
-
/**
|
|
49
|
-
* Returns the sum of all swaps within the trade
|
|
50
|
-
* @returns
|
|
51
|
-
* inputAmount: total input amount
|
|
52
|
-
* inputAmountNative: total amount of native currency required for ETH input paths
|
|
53
|
-
* - 0 if inputAmount is native but no native input paths
|
|
54
|
-
* - undefined if inputAmount is not native
|
|
55
|
-
* outputAmount: total output amount
|
|
56
|
-
* outputAmountNative: total amount of native currency returned from ETH output paths
|
|
57
|
-
* - 0 if outputAmount is native but no native output paths
|
|
58
|
-
* - undefined if outputAmount is not native
|
|
59
|
-
*/
|
|
60
|
-
get amounts(): {
|
|
61
|
-
inputAmount: CurrencyAmount<TInput>;
|
|
62
|
-
inputAmountNative: CurrencyAmount<TInput> | undefined;
|
|
63
|
-
outputAmount: CurrencyAmount<TOutput>;
|
|
64
|
-
outputAmountNative: CurrencyAmount<TOutput> | undefined;
|
|
65
|
-
};
|
|
66
|
-
get numberOfInputWraps(): number;
|
|
67
|
-
get numberOfInputUnwraps(): number;
|
|
68
|
-
get nativeInputRoutes(): IRoute<TInput, TOutput, Pair | V3Pool | V4Pool>[];
|
|
69
|
-
get wethInputRoutes(): IRoute<TInput, TOutput, Pair | V3Pool | V4Pool>[];
|
|
70
|
-
private _executionPrice;
|
|
71
|
-
/**
|
|
72
|
-
* The price expressed in terms of output amount/input amount.
|
|
73
|
-
*/
|
|
74
|
-
get executionPrice(): Price<TInput, TOutput>;
|
|
75
|
-
/**
|
|
76
|
-
* Returns the sell tax of the input token
|
|
77
|
-
*/
|
|
78
|
-
get inputTax(): Percent;
|
|
79
|
-
/**
|
|
80
|
-
* Returns the buy tax of the output token
|
|
81
|
-
*/
|
|
82
|
-
get outputTax(): Percent;
|
|
83
|
-
private isWrappedNative;
|
|
84
|
-
/**
|
|
85
|
-
* The cached result of the price impact computation
|
|
86
|
-
* @private
|
|
87
|
-
*/
|
|
88
|
-
private _priceImpact;
|
|
89
|
-
/**
|
|
90
|
-
* Returns the percent difference between the route's mid price and the expected execution price
|
|
91
|
-
* In order to exclude token taxes from the price impact calculation, the spot price is calculated
|
|
92
|
-
* using a ratio of values that go into the pools, which are the post-tax input amount and pre-tax output amount.
|
|
93
|
-
*/
|
|
94
|
-
get priceImpact(): Percent;
|
|
95
|
-
/**
|
|
96
|
-
* Get the minimum amount that must be received from this trade for the given slippage tolerance
|
|
97
|
-
* @param slippageTolerance The tolerance of unfavorable slippage from the execution price of this trade
|
|
98
|
-
* @returns The amount out
|
|
99
|
-
*/
|
|
100
|
-
minimumAmountOut(slippageTolerance: Percent, amountOut?: CurrencyAmount<TOutput>): CurrencyAmount<TOutput>;
|
|
101
|
-
/**
|
|
102
|
-
* Get the maximum amount in that can be spent via this trade for the given slippage tolerance
|
|
103
|
-
* @param slippageTolerance The tolerance of unfavorable slippage from the execution price of this trade
|
|
104
|
-
* @returns The amount in
|
|
105
|
-
*/
|
|
106
|
-
maximumAmountIn(slippageTolerance: Percent, amountIn?: CurrencyAmount<TInput>): CurrencyAmount<TInput>;
|
|
107
|
-
/**
|
|
108
|
-
* Return the execution price after accounting for slippage tolerance
|
|
109
|
-
* @param slippageTolerance the allowed tolerated slippage
|
|
110
|
-
* @returns The execution price
|
|
111
|
-
*/
|
|
112
|
-
worstExecutionPrice(slippageTolerance: Percent): Price<TInput, TOutput>;
|
|
113
|
-
static fromRoutes<TInput extends Currency, TOutput extends Currency, TTradeType extends TradeType>(v2Routes: {
|
|
114
|
-
routev2: V2RouteSDK<TInput, TOutput>;
|
|
115
|
-
amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>;
|
|
116
|
-
}[], v3Routes: {
|
|
117
|
-
routev3: V3RouteSDK<TInput, TOutput>;
|
|
118
|
-
amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>;
|
|
119
|
-
}[], tradeType: TTradeType, mixedRoutes?: {
|
|
120
|
-
mixedRoute: MixedRouteSDK<TInput, TOutput>;
|
|
121
|
-
amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>;
|
|
122
|
-
}[], v4Routes?: {
|
|
123
|
-
routev4: V4RouteSDK<TInput, TOutput>;
|
|
124
|
-
amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>;
|
|
125
|
-
}[]): Promise<Trade<TInput, TOutput, TTradeType>>;
|
|
126
|
-
static fromRoute<TInput extends Currency, TOutput extends Currency, TTradeType extends TradeType>(route: V2RouteSDK<TInput, TOutput> | V3RouteSDK<TInput, TOutput> | V4RouteSDK<TInput, TOutput> | MixedRouteSDK<TInput, TOutput>, amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>, tradeType: TTradeType): Promise<Trade<TInput, TOutput, TTradeType>>;
|
|
127
|
-
}
|
|
1
|
+
import { Currency, CurrencyAmount, Percent, Price, TradeType } from '@uniswap/sdk-core';
|
|
2
|
+
import { Pair, Route as V2RouteSDK } from '@uniswap/v2-sdk';
|
|
3
|
+
import { Pool as V3Pool, Route as V3RouteSDK } from '@uniswap/v3-sdk';
|
|
4
|
+
import { Pool as V4Pool, Route as V4RouteSDK } from '@uniswap/v4-sdk';
|
|
5
|
+
import { MixedRouteSDK } from './mixedRoute/route';
|
|
6
|
+
import { IRoute } from './route';
|
|
7
|
+
export declare class Trade<TInput extends Currency, TOutput extends Currency, TTradeType extends TradeType> {
|
|
8
|
+
readonly routes: IRoute<TInput, TOutput, Pair | V3Pool | V4Pool>[];
|
|
9
|
+
readonly tradeType: TTradeType;
|
|
10
|
+
private _outputAmount;
|
|
11
|
+
private _inputAmount;
|
|
12
|
+
private _nativeInputRoutes;
|
|
13
|
+
private _wethInputRoutes;
|
|
14
|
+
/**
|
|
15
|
+
* The swaps of the trade, i.e. which routes and how much is swapped in each that
|
|
16
|
+
* make up the trade. May consist of swaps in v2 or v3.
|
|
17
|
+
*/
|
|
18
|
+
readonly swaps: {
|
|
19
|
+
route: IRoute<TInput, TOutput, Pair | V3Pool | V4Pool>;
|
|
20
|
+
inputAmount: CurrencyAmount<TInput>;
|
|
21
|
+
outputAmount: CurrencyAmount<TOutput>;
|
|
22
|
+
}[];
|
|
23
|
+
constructor({ v2Routes, v3Routes, v4Routes, mixedRoutes, tradeType, }: {
|
|
24
|
+
v2Routes?: {
|
|
25
|
+
routev2: V2RouteSDK<TInput, TOutput>;
|
|
26
|
+
inputAmount: CurrencyAmount<TInput>;
|
|
27
|
+
outputAmount: CurrencyAmount<TOutput>;
|
|
28
|
+
}[];
|
|
29
|
+
v3Routes?: {
|
|
30
|
+
routev3: V3RouteSDK<TInput, TOutput>;
|
|
31
|
+
inputAmount: CurrencyAmount<TInput>;
|
|
32
|
+
outputAmount: CurrencyAmount<TOutput>;
|
|
33
|
+
}[];
|
|
34
|
+
v4Routes?: {
|
|
35
|
+
routev4: V4RouteSDK<TInput, TOutput>;
|
|
36
|
+
inputAmount: CurrencyAmount<TInput>;
|
|
37
|
+
outputAmount: CurrencyAmount<TOutput>;
|
|
38
|
+
}[];
|
|
39
|
+
mixedRoutes?: {
|
|
40
|
+
mixedRoute: MixedRouteSDK<TInput, TOutput>;
|
|
41
|
+
inputAmount: CurrencyAmount<TInput>;
|
|
42
|
+
outputAmount: CurrencyAmount<TOutput>;
|
|
43
|
+
}[];
|
|
44
|
+
tradeType: TTradeType;
|
|
45
|
+
});
|
|
46
|
+
get inputAmount(): CurrencyAmount<TInput>;
|
|
47
|
+
get outputAmount(): CurrencyAmount<TOutput>;
|
|
48
|
+
/**
|
|
49
|
+
* Returns the sum of all swaps within the trade
|
|
50
|
+
* @returns
|
|
51
|
+
* inputAmount: total input amount
|
|
52
|
+
* inputAmountNative: total amount of native currency required for ETH input paths
|
|
53
|
+
* - 0 if inputAmount is native but no native input paths
|
|
54
|
+
* - undefined if inputAmount is not native
|
|
55
|
+
* outputAmount: total output amount
|
|
56
|
+
* outputAmountNative: total amount of native currency returned from ETH output paths
|
|
57
|
+
* - 0 if outputAmount is native but no native output paths
|
|
58
|
+
* - undefined if outputAmount is not native
|
|
59
|
+
*/
|
|
60
|
+
get amounts(): {
|
|
61
|
+
inputAmount: CurrencyAmount<TInput>;
|
|
62
|
+
inputAmountNative: CurrencyAmount<TInput> | undefined;
|
|
63
|
+
outputAmount: CurrencyAmount<TOutput>;
|
|
64
|
+
outputAmountNative: CurrencyAmount<TOutput> | undefined;
|
|
65
|
+
};
|
|
66
|
+
get numberOfInputWraps(): number;
|
|
67
|
+
get numberOfInputUnwraps(): number;
|
|
68
|
+
get nativeInputRoutes(): IRoute<TInput, TOutput, Pair | V3Pool | V4Pool>[];
|
|
69
|
+
get wethInputRoutes(): IRoute<TInput, TOutput, Pair | V3Pool | V4Pool>[];
|
|
70
|
+
private _executionPrice;
|
|
71
|
+
/**
|
|
72
|
+
* The price expressed in terms of output amount/input amount.
|
|
73
|
+
*/
|
|
74
|
+
get executionPrice(): Price<TInput, TOutput>;
|
|
75
|
+
/**
|
|
76
|
+
* Returns the sell tax of the input token
|
|
77
|
+
*/
|
|
78
|
+
get inputTax(): Percent;
|
|
79
|
+
/**
|
|
80
|
+
* Returns the buy tax of the output token
|
|
81
|
+
*/
|
|
82
|
+
get outputTax(): Percent;
|
|
83
|
+
private isWrappedNative;
|
|
84
|
+
/**
|
|
85
|
+
* The cached result of the price impact computation
|
|
86
|
+
* @private
|
|
87
|
+
*/
|
|
88
|
+
private _priceImpact;
|
|
89
|
+
/**
|
|
90
|
+
* Returns the percent difference between the route's mid price and the expected execution price
|
|
91
|
+
* In order to exclude token taxes from the price impact calculation, the spot price is calculated
|
|
92
|
+
* using a ratio of values that go into the pools, which are the post-tax input amount and pre-tax output amount.
|
|
93
|
+
*/
|
|
94
|
+
get priceImpact(): Percent;
|
|
95
|
+
/**
|
|
96
|
+
* Get the minimum amount that must be received from this trade for the given slippage tolerance
|
|
97
|
+
* @param slippageTolerance The tolerance of unfavorable slippage from the execution price of this trade
|
|
98
|
+
* @returns The amount out
|
|
99
|
+
*/
|
|
100
|
+
minimumAmountOut(slippageTolerance: Percent, amountOut?: CurrencyAmount<TOutput>): CurrencyAmount<TOutput>;
|
|
101
|
+
/**
|
|
102
|
+
* Get the maximum amount in that can be spent via this trade for the given slippage tolerance
|
|
103
|
+
* @param slippageTolerance The tolerance of unfavorable slippage from the execution price of this trade
|
|
104
|
+
* @returns The amount in
|
|
105
|
+
*/
|
|
106
|
+
maximumAmountIn(slippageTolerance: Percent, amountIn?: CurrencyAmount<TInput>): CurrencyAmount<TInput>;
|
|
107
|
+
/**
|
|
108
|
+
* Return the execution price after accounting for slippage tolerance
|
|
109
|
+
* @param slippageTolerance the allowed tolerated slippage
|
|
110
|
+
* @returns The execution price
|
|
111
|
+
*/
|
|
112
|
+
worstExecutionPrice(slippageTolerance: Percent): Price<TInput, TOutput>;
|
|
113
|
+
static fromRoutes<TInput extends Currency, TOutput extends Currency, TTradeType extends TradeType>(v2Routes: {
|
|
114
|
+
routev2: V2RouteSDK<TInput, TOutput>;
|
|
115
|
+
amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>;
|
|
116
|
+
}[], v3Routes: {
|
|
117
|
+
routev3: V3RouteSDK<TInput, TOutput>;
|
|
118
|
+
amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>;
|
|
119
|
+
}[], tradeType: TTradeType, mixedRoutes?: {
|
|
120
|
+
mixedRoute: MixedRouteSDK<TInput, TOutput>;
|
|
121
|
+
amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>;
|
|
122
|
+
}[], v4Routes?: {
|
|
123
|
+
routev4: V4RouteSDK<TInput, TOutput>;
|
|
124
|
+
amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>;
|
|
125
|
+
}[]): Promise<Trade<TInput, TOutput, TTradeType>>;
|
|
126
|
+
static fromRoute<TInput extends Currency, TOutput extends Currency, TTradeType extends TradeType>(route: V2RouteSDK<TInput, TOutput> | V3RouteSDK<TInput, TOutput> | V4RouteSDK<TInput, TOutput> | MixedRouteSDK<TInput, TOutput>, amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>, tradeType: TTradeType): Promise<Trade<TInput, TOutput, TTradeType>>;
|
|
127
|
+
}
|
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Trade = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const sdk_core_1 = require("@uniswap/sdk-core");
|
|
6
|
+
const v2_sdk_1 = require("@uniswap/v2-sdk");
|
|
7
|
+
const v3_sdk_1 = require("@uniswap/v3-sdk");
|
|
8
|
+
const v4_sdk_1 = require("@uniswap/v4-sdk");
|
|
9
|
+
const tiny_invariant_1 = tslib_1.__importDefault(require("tiny-invariant"));
|
|
10
|
+
const constants_1 = require("../constants");
|
|
11
|
+
const route_1 = require("./mixedRoute/route");
|
|
12
|
+
const trade_1 = require("./mixedRoute/trade");
|
|
13
|
+
const route_2 = require("./route");
|
|
14
|
+
class Trade {
|
|
15
|
+
// construct a trade across v2 and v3 routes from pre-computed amounts
|
|
16
|
+
constructor({ v2Routes = [], v3Routes = [], v4Routes = [], mixedRoutes = [], tradeType, }) {
|
|
17
|
+
this.swaps = [];
|
|
18
|
+
this.routes = [];
|
|
19
|
+
// wrap v2 routes
|
|
20
|
+
for (const { routev2, inputAmount, outputAmount } of v2Routes) {
|
|
21
|
+
const route = new route_2.RouteV2(routev2);
|
|
22
|
+
this.routes.push(route);
|
|
23
|
+
this.swaps.push({
|
|
24
|
+
route,
|
|
25
|
+
inputAmount,
|
|
26
|
+
outputAmount,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
// wrap v3 routes
|
|
30
|
+
for (const { routev3, inputAmount, outputAmount } of v3Routes) {
|
|
31
|
+
const route = new route_2.RouteV3(routev3);
|
|
32
|
+
this.routes.push(route);
|
|
33
|
+
this.swaps.push({
|
|
34
|
+
route,
|
|
35
|
+
inputAmount,
|
|
36
|
+
outputAmount,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
// wrap v4 routes
|
|
40
|
+
for (const { routev4, inputAmount, outputAmount } of v4Routes) {
|
|
41
|
+
const route = new route_2.RouteV4(routev4);
|
|
42
|
+
this.routes.push(route);
|
|
43
|
+
this.swaps.push({
|
|
44
|
+
route,
|
|
45
|
+
inputAmount,
|
|
46
|
+
outputAmount,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
for (const { mixedRoute, inputAmount, outputAmount } of mixedRoutes) {
|
|
50
|
+
const route = new route_2.MixedRoute(mixedRoute);
|
|
51
|
+
this.routes.push(route);
|
|
52
|
+
this.swaps.push({
|
|
53
|
+
route,
|
|
54
|
+
inputAmount,
|
|
55
|
+
outputAmount,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
if (this.swaps.length === 0) {
|
|
59
|
+
throw new Error('No routes provided when calling Trade constructor');
|
|
60
|
+
}
|
|
61
|
+
this.tradeType = tradeType;
|
|
62
|
+
// each route must have the same input and output currency
|
|
63
|
+
const inputCurrency = this.swaps[0].inputAmount.currency;
|
|
64
|
+
const outputCurrency = this.swaps[0].outputAmount.currency;
|
|
65
|
+
(0, tiny_invariant_1.default)(this.swaps.every(({ route }) => inputCurrency.wrapped.equals(route.input.wrapped)), 'INPUT_CURRENCY_MATCH');
|
|
66
|
+
(0, tiny_invariant_1.default)(this.swaps.every(({ route }) => outputCurrency.wrapped.equals(route.output.wrapped)), 'OUTPUT_CURRENCY_MATCH');
|
|
67
|
+
// pools must be unique inter protocols
|
|
68
|
+
const numPools = this.swaps.map(({ route }) => route.pools.length).reduce((total, cur) => total + cur, 0);
|
|
69
|
+
const poolIdentifierSet = new Set();
|
|
70
|
+
for (const { route } of this.swaps) {
|
|
71
|
+
for (const pool of route.pools) {
|
|
72
|
+
if (pool instanceof v4_sdk_1.Pool) {
|
|
73
|
+
poolIdentifierSet.add(pool.poolId);
|
|
74
|
+
}
|
|
75
|
+
else if (pool instanceof v3_sdk_1.Pool) {
|
|
76
|
+
poolIdentifierSet.add(v3_sdk_1.Pool.getAddress(pool.token0, pool.token1, pool.fee));
|
|
77
|
+
}
|
|
78
|
+
else if (pool instanceof v2_sdk_1.Pair) {
|
|
79
|
+
const pair = pool;
|
|
80
|
+
poolIdentifierSet.add(v2_sdk_1.Pair.getAddress(pair.token0, pair.token1));
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
throw new Error('Unexpected pool type in route when constructing trade object');
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
(0, tiny_invariant_1.default)(numPools === poolIdentifierSet.size, 'POOLS_DUPLICATED');
|
|
88
|
+
}
|
|
89
|
+
get inputAmount() {
|
|
90
|
+
if (this._inputAmount) {
|
|
91
|
+
return this._inputAmount;
|
|
92
|
+
}
|
|
93
|
+
const inputAmountCurrency = this.swaps[0].inputAmount.currency;
|
|
94
|
+
const totalInputFromRoutes = this.swaps
|
|
95
|
+
.map(({ inputAmount: routeInputAmount }) => routeInputAmount)
|
|
96
|
+
.reduce((total, cur) => total.add(cur), sdk_core_1.CurrencyAmount.fromRawAmount(inputAmountCurrency, 0));
|
|
97
|
+
this._inputAmount = totalInputFromRoutes;
|
|
98
|
+
return this._inputAmount;
|
|
99
|
+
}
|
|
100
|
+
get outputAmount() {
|
|
101
|
+
if (this._outputAmount) {
|
|
102
|
+
return this._outputAmount;
|
|
103
|
+
}
|
|
104
|
+
const outputCurrency = this.swaps[0].outputAmount.currency;
|
|
105
|
+
const totalOutputFromRoutes = this.swaps
|
|
106
|
+
.map(({ outputAmount: routeOutputAmount }) => routeOutputAmount)
|
|
107
|
+
.reduce((total, cur) => total.add(cur), sdk_core_1.CurrencyAmount.fromRawAmount(outputCurrency, 0));
|
|
108
|
+
this._outputAmount = totalOutputFromRoutes;
|
|
109
|
+
return this._outputAmount;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Returns the sum of all swaps within the trade
|
|
113
|
+
* @returns
|
|
114
|
+
* inputAmount: total input amount
|
|
115
|
+
* inputAmountNative: total amount of native currency required for ETH input paths
|
|
116
|
+
* - 0 if inputAmount is native but no native input paths
|
|
117
|
+
* - undefined if inputAmount is not native
|
|
118
|
+
* outputAmount: total output amount
|
|
119
|
+
* outputAmountNative: total amount of native currency returned from ETH output paths
|
|
120
|
+
* - 0 if outputAmount is native but no native output paths
|
|
121
|
+
* - undefined if outputAmount is not native
|
|
122
|
+
*/
|
|
123
|
+
get amounts() {
|
|
124
|
+
var _a, _b;
|
|
125
|
+
// Find native currencies for reduce below
|
|
126
|
+
const inputNativeCurrency = (_a = this.swaps.find(({ inputAmount }) => inputAmount.currency.isNative)) === null || _a === void 0 ? void 0 : _a.inputAmount.currency;
|
|
127
|
+
const outputNativeCurrency = (_b = this.swaps.find(({ outputAmount }) => outputAmount.currency.isNative)) === null || _b === void 0 ? void 0 : _b.outputAmount.currency;
|
|
128
|
+
return {
|
|
129
|
+
inputAmount: this.inputAmount,
|
|
130
|
+
inputAmountNative: inputNativeCurrency
|
|
131
|
+
? this.swaps.reduce((total, swap) => {
|
|
132
|
+
return swap.route.pathInput.isNative ? total.add(swap.inputAmount) : total;
|
|
133
|
+
}, sdk_core_1.CurrencyAmount.fromRawAmount(inputNativeCurrency, 0))
|
|
134
|
+
: undefined,
|
|
135
|
+
outputAmount: this.outputAmount,
|
|
136
|
+
outputAmountNative: outputNativeCurrency
|
|
137
|
+
? this.swaps.reduce((total, swap) => {
|
|
138
|
+
return swap.route.pathOutput.isNative ? total.add(swap.outputAmount) : total;
|
|
139
|
+
}, sdk_core_1.CurrencyAmount.fromRawAmount(outputNativeCurrency, 0))
|
|
140
|
+
: undefined,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
get numberOfInputWraps() {
|
|
144
|
+
// if the trade's input is eth it may require a wrap
|
|
145
|
+
if (this.inputAmount.currency.isNative) {
|
|
146
|
+
return this.wethInputRoutes.length;
|
|
147
|
+
}
|
|
148
|
+
else
|
|
149
|
+
return 0;
|
|
150
|
+
}
|
|
151
|
+
get numberOfInputUnwraps() {
|
|
152
|
+
// if the trade's input is weth, it may require an unwrap
|
|
153
|
+
if (this.isWrappedNative(this.inputAmount.currency)) {
|
|
154
|
+
return this.nativeInputRoutes.length;
|
|
155
|
+
}
|
|
156
|
+
else
|
|
157
|
+
return 0;
|
|
158
|
+
}
|
|
159
|
+
get nativeInputRoutes() {
|
|
160
|
+
if (this._nativeInputRoutes) {
|
|
161
|
+
return this._nativeInputRoutes;
|
|
162
|
+
}
|
|
163
|
+
this._nativeInputRoutes = this.routes.filter((route) => route.pathInput.isNative);
|
|
164
|
+
return this._nativeInputRoutes;
|
|
165
|
+
}
|
|
166
|
+
get wethInputRoutes() {
|
|
167
|
+
if (this._wethInputRoutes) {
|
|
168
|
+
return this._wethInputRoutes;
|
|
169
|
+
}
|
|
170
|
+
this._wethInputRoutes = this.routes.filter((route) => this.isWrappedNative(route.pathInput));
|
|
171
|
+
return this._wethInputRoutes;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* The price expressed in terms of output amount/input amount.
|
|
175
|
+
*/
|
|
176
|
+
get executionPrice() {
|
|
177
|
+
var _a;
|
|
178
|
+
return ((_a = this._executionPrice) !== null && _a !== void 0 ? _a : (this._executionPrice = new sdk_core_1.Price(this.inputAmount.currency, this.outputAmount.currency, this.inputAmount.quotient, this.outputAmount.quotient)));
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Returns the sell tax of the input token
|
|
182
|
+
*/
|
|
183
|
+
get inputTax() {
|
|
184
|
+
const inputCurrency = this.inputAmount.currency;
|
|
185
|
+
if (inputCurrency.isNative || !inputCurrency.wrapped.sellFeeBps)
|
|
186
|
+
return constants_1.ZERO_PERCENT;
|
|
187
|
+
return new sdk_core_1.Percent(inputCurrency.wrapped.sellFeeBps.toNumber(), 10000);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Returns the buy tax of the output token
|
|
191
|
+
*/
|
|
192
|
+
get outputTax() {
|
|
193
|
+
const outputCurrency = this.outputAmount.currency;
|
|
194
|
+
if (outputCurrency.isNative || !outputCurrency.wrapped.buyFeeBps)
|
|
195
|
+
return constants_1.ZERO_PERCENT;
|
|
196
|
+
return new sdk_core_1.Percent(outputCurrency.wrapped.buyFeeBps.toNumber(), 10000);
|
|
197
|
+
}
|
|
198
|
+
isWrappedNative(currency) {
|
|
199
|
+
const chainId = currency.chainId;
|
|
200
|
+
return currency.equals(sdk_core_1.Ether.onChain(chainId).wrapped);
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Returns the percent difference between the route's mid price and the expected execution price
|
|
204
|
+
* In order to exclude token taxes from the price impact calculation, the spot price is calculated
|
|
205
|
+
* using a ratio of values that go into the pools, which are the post-tax input amount and pre-tax output amount.
|
|
206
|
+
*/
|
|
207
|
+
get priceImpact() {
|
|
208
|
+
if (this._priceImpact) {
|
|
209
|
+
return this._priceImpact;
|
|
210
|
+
}
|
|
211
|
+
// returns 0% price impact even though this may be inaccurate as a swap may have occured.
|
|
212
|
+
// because we're unable to derive the pre-buy-tax amount, use 0% as a placeholder.
|
|
213
|
+
if (this.outputTax.equalTo(constants_1.ONE_HUNDRED_PERCENT))
|
|
214
|
+
return constants_1.ZERO_PERCENT;
|
|
215
|
+
let spotOutputAmount = sdk_core_1.CurrencyAmount.fromRawAmount(this.outputAmount.currency, 0);
|
|
216
|
+
for (const { route, inputAmount } of this.swaps) {
|
|
217
|
+
const midPrice = route.midPrice;
|
|
218
|
+
const postTaxInputAmount = inputAmount.multiply(new sdk_core_1.Fraction(constants_1.ONE).subtract(this.inputTax));
|
|
219
|
+
spotOutputAmount = spotOutputAmount.add(midPrice.quote(postTaxInputAmount));
|
|
220
|
+
}
|
|
221
|
+
// if the total output of this trade is 0, then most likely the post-tax input was also 0, and therefore this swap
|
|
222
|
+
// does not move the pools' market price
|
|
223
|
+
if (spotOutputAmount.equalTo(constants_1.ZERO))
|
|
224
|
+
return constants_1.ZERO_PERCENT;
|
|
225
|
+
const preTaxOutputAmount = this.outputAmount.divide(new sdk_core_1.Fraction(constants_1.ONE).subtract(this.outputTax));
|
|
226
|
+
const priceImpact = spotOutputAmount.subtract(preTaxOutputAmount).divide(spotOutputAmount);
|
|
227
|
+
this._priceImpact = new sdk_core_1.Percent(priceImpact.numerator, priceImpact.denominator);
|
|
228
|
+
return this._priceImpact;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Get the minimum amount that must be received from this trade for the given slippage tolerance
|
|
232
|
+
* @param slippageTolerance The tolerance of unfavorable slippage from the execution price of this trade
|
|
233
|
+
* @returns The amount out
|
|
234
|
+
*/
|
|
235
|
+
minimumAmountOut(slippageTolerance, amountOut = this.outputAmount) {
|
|
236
|
+
(0, tiny_invariant_1.default)(!slippageTolerance.lessThan(constants_1.ZERO), 'SLIPPAGE_TOLERANCE');
|
|
237
|
+
if (this.tradeType === sdk_core_1.TradeType.EXACT_OUTPUT) {
|
|
238
|
+
return amountOut;
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
const slippageAdjustedAmountOut = new sdk_core_1.Fraction(constants_1.ONE)
|
|
242
|
+
.add(slippageTolerance)
|
|
243
|
+
.invert()
|
|
244
|
+
.multiply(amountOut.quotient).quotient;
|
|
245
|
+
return sdk_core_1.CurrencyAmount.fromRawAmount(amountOut.currency, slippageAdjustedAmountOut);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Get the maximum amount in that can be spent via this trade for the given slippage tolerance
|
|
250
|
+
* @param slippageTolerance The tolerance of unfavorable slippage from the execution price of this trade
|
|
251
|
+
* @returns The amount in
|
|
252
|
+
*/
|
|
253
|
+
maximumAmountIn(slippageTolerance, amountIn = this.inputAmount) {
|
|
254
|
+
(0, tiny_invariant_1.default)(!slippageTolerance.lessThan(constants_1.ZERO), 'SLIPPAGE_TOLERANCE');
|
|
255
|
+
if (this.tradeType === sdk_core_1.TradeType.EXACT_INPUT) {
|
|
256
|
+
return amountIn;
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
const slippageAdjustedAmountIn = new sdk_core_1.Fraction(constants_1.ONE).add(slippageTolerance).multiply(amountIn.quotient).quotient;
|
|
260
|
+
return sdk_core_1.CurrencyAmount.fromRawAmount(amountIn.currency, slippageAdjustedAmountIn);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Return the execution price after accounting for slippage tolerance
|
|
265
|
+
* @param slippageTolerance the allowed tolerated slippage
|
|
266
|
+
* @returns The execution price
|
|
267
|
+
*/
|
|
268
|
+
worstExecutionPrice(slippageTolerance) {
|
|
269
|
+
return new sdk_core_1.Price(this.inputAmount.currency, this.outputAmount.currency, this.maximumAmountIn(slippageTolerance).quotient, this.minimumAmountOut(slippageTolerance).quotient);
|
|
270
|
+
}
|
|
271
|
+
static fromRoutes(v2Routes, v3Routes, tradeType, mixedRoutes, v4Routes) {
|
|
272
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
273
|
+
const populatedV2Routes = [];
|
|
274
|
+
const populatedV3Routes = [];
|
|
275
|
+
const populatedV4Routes = [];
|
|
276
|
+
const populatedMixedRoutes = [];
|
|
277
|
+
for (const { routev2, amount } of v2Routes) {
|
|
278
|
+
const v2Trade = new v2_sdk_1.Trade(routev2, amount, tradeType);
|
|
279
|
+
const { inputAmount, outputAmount } = v2Trade;
|
|
280
|
+
populatedV2Routes.push({
|
|
281
|
+
routev2,
|
|
282
|
+
inputAmount,
|
|
283
|
+
outputAmount,
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
for (const { routev3, amount } of v3Routes) {
|
|
287
|
+
const v3Trade = yield v3_sdk_1.Trade.fromRoute(routev3, amount, tradeType);
|
|
288
|
+
const { inputAmount, outputAmount } = v3Trade;
|
|
289
|
+
populatedV3Routes.push({
|
|
290
|
+
routev3,
|
|
291
|
+
inputAmount,
|
|
292
|
+
outputAmount,
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
if (v4Routes) {
|
|
296
|
+
for (const { routev4, amount } of v4Routes) {
|
|
297
|
+
const v4Trade = yield v4_sdk_1.Trade.fromRoute(routev4, amount, tradeType);
|
|
298
|
+
const { inputAmount, outputAmount } = v4Trade;
|
|
299
|
+
populatedV4Routes.push({
|
|
300
|
+
routev4,
|
|
301
|
+
inputAmount,
|
|
302
|
+
outputAmount,
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
if (mixedRoutes) {
|
|
307
|
+
for (const { mixedRoute, amount } of mixedRoutes) {
|
|
308
|
+
const mixedRouteTrade = yield trade_1.MixedRouteTrade.fromRoute(mixedRoute, amount, tradeType);
|
|
309
|
+
const { inputAmount, outputAmount } = mixedRouteTrade;
|
|
310
|
+
populatedMixedRoutes.push({
|
|
311
|
+
mixedRoute,
|
|
312
|
+
inputAmount,
|
|
313
|
+
outputAmount,
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
return new Trade({
|
|
318
|
+
v2Routes: populatedV2Routes,
|
|
319
|
+
v3Routes: populatedV3Routes,
|
|
320
|
+
v4Routes: populatedV4Routes,
|
|
321
|
+
mixedRoutes: populatedMixedRoutes,
|
|
322
|
+
tradeType,
|
|
323
|
+
});
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
static fromRoute(route, amount, tradeType) {
|
|
327
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
328
|
+
let v2Routes = [];
|
|
329
|
+
let v3Routes = [];
|
|
330
|
+
let v4Routes = [];
|
|
331
|
+
let mixedRoutes = [];
|
|
332
|
+
if (route instanceof v2_sdk_1.Route) {
|
|
333
|
+
const v2Trade = new v2_sdk_1.Trade(route, amount, tradeType);
|
|
334
|
+
const { inputAmount, outputAmount } = v2Trade;
|
|
335
|
+
v2Routes = [{ routev2: route, inputAmount, outputAmount }];
|
|
336
|
+
}
|
|
337
|
+
else if (route instanceof v3_sdk_1.Route) {
|
|
338
|
+
const v3Trade = yield v3_sdk_1.Trade.fromRoute(route, amount, tradeType);
|
|
339
|
+
const { inputAmount, outputAmount } = v3Trade;
|
|
340
|
+
v3Routes = [{ routev3: route, inputAmount, outputAmount }];
|
|
341
|
+
}
|
|
342
|
+
else if (route instanceof v4_sdk_1.Route) {
|
|
343
|
+
const v4Trade = yield v4_sdk_1.Trade.fromRoute(route, amount, tradeType);
|
|
344
|
+
const { inputAmount, outputAmount } = v4Trade;
|
|
345
|
+
v4Routes = [{ routev4: route, inputAmount, outputAmount }];
|
|
346
|
+
}
|
|
347
|
+
else if (route instanceof route_1.MixedRouteSDK) {
|
|
348
|
+
const mixedRouteTrade = yield trade_1.MixedRouteTrade.fromRoute(route, amount, tradeType);
|
|
349
|
+
const { inputAmount, outputAmount } = mixedRouteTrade;
|
|
350
|
+
mixedRoutes = [{ mixedRoute: route, inputAmount, outputAmount }];
|
|
351
|
+
}
|
|
352
|
+
else {
|
|
353
|
+
throw new Error('Invalid route type');
|
|
354
|
+
}
|
|
355
|
+
return new Trade({
|
|
356
|
+
v2Routes,
|
|
357
|
+
v3Routes,
|
|
358
|
+
v4Routes,
|
|
359
|
+
mixedRoutes,
|
|
360
|
+
tradeType,
|
|
361
|
+
});
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
exports.Trade = Trade;
|
|
366
|
+
//# sourceMappingURL=trade.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trade.js","sourceRoot":"","sources":["../../../../src/entities/trade.ts"],"names":[],"mappings":";;;;AAAA,gDAAwG;AACxG,4CAAgF;AAChF,4CAA0F;AAC1F,4CAA0F;AAC1F,4EAAsC;AACtC,4CAA2E;AAC3E,8CAAkD;AAClD,8CAA0E;AAC1E,mCAAuE;AAEvE,MAAa,KAAK;IAkBhB,uEAAuE;IACvE,YAAmB,EACjB,QAAQ,GAAG,EAAE,EACb,QAAQ,GAAG,EAAE,EACb,QAAQ,GAAG,EAAE,EACb,WAAW,GAAG,EAAE,EAChB,SAAS,GAuBV;QACC,IAAI,CAAC,KAAK,GAAG,EAAE,CAAA;QACf,IAAI,CAAC,MAAM,GAAG,EAAE,CAAA;QAChB,iBAAiB;QACjB,KAAK,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,IAAI,QAAQ,EAAE;YAC7D,MAAM,KAAK,GAAG,IAAI,eAAO,CAAC,OAAO,CAAC,CAAA;YAClC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YACvB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;gBACd,KAAK;gBACL,WAA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