@uniswap/router-sdk 2.0.1 → 2.0.2

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.
Files changed (176) hide show
  1. package/dist/{cjs/src/approveAndCall.d.ts → approveAndCall.d.ts} +33 -33
  2. package/dist/{types/src/constants.d.ts → constants.d.ts} +13 -13
  3. package/dist/{types/src/entities → entities}/mixedRoute/route.d.ts +29 -29
  4. package/dist/{esm/src/entities → entities}/mixedRoute/trade.d.ts +183 -183
  5. package/dist/{cjs/src/entities → entities}/protocol.d.ts +6 -6
  6. package/dist/{esm/src/entities → entities}/route.d.ts +40 -40
  7. package/dist/{esm/src/entities → entities}/trade.d.ts +127 -127
  8. package/dist/{cjs/src/index.d.ts → index.d.ts} +14 -14
  9. package/dist/index.js +8 -0
  10. package/dist/{cjs/src/multicallExtended.d.ts → multicallExtended.d.ts} +11 -11
  11. package/dist/{types/src/paymentsExtended.d.ts → paymentsExtended.d.ts} +15 -15
  12. package/dist/router-sdk.cjs.development.js +2460 -0
  13. package/dist/router-sdk.cjs.development.js.map +1 -0
  14. package/dist/router-sdk.cjs.production.min.js +2 -0
  15. package/dist/router-sdk.cjs.production.min.js.map +1 -0
  16. package/dist/router-sdk.esm.js +2427 -0
  17. package/dist/router-sdk.esm.js.map +1 -0
  18. package/dist/{cjs/src/swapRouter.d.ts → swapRouter.d.ts} +95 -95
  19. package/dist/{cjs/src/utils → utils}/TPool.d.ts +4 -4
  20. package/dist/{cjs/src/utils → utils}/encodeMixedRouteToPath.d.ts +9 -9
  21. package/dist/{types/src/utils → utils}/index.d.ts +16 -16
  22. package/dist/{cjs/src/utils → utils}/pathCurrency.d.ts +4 -4
  23. package/package.json +18 -33
  24. package/dist/cjs/src/approveAndCall.js +0 -111
  25. package/dist/cjs/src/approveAndCall.js.map +0 -1
  26. package/dist/cjs/src/constants.d.ts +0 -13
  27. package/dist/cjs/src/constants.js +0 -22
  28. package/dist/cjs/src/constants.js.map +0 -1
  29. package/dist/cjs/src/entities/mixedRoute/route.d.ts +0 -29
  30. package/dist/cjs/src/entities/mixedRoute/route.js +0 -119
  31. package/dist/cjs/src/entities/mixedRoute/route.js.map +0 -1
  32. package/dist/cjs/src/entities/mixedRoute/route.test.d.ts +0 -1
  33. package/dist/cjs/src/entities/mixedRoute/route.test.js +0 -469
  34. package/dist/cjs/src/entities/mixedRoute/route.test.js.map +0 -1
  35. package/dist/cjs/src/entities/mixedRoute/trade.d.ts +0 -183
  36. package/dist/cjs/src/entities/mixedRoute/trade.js +0 -357
  37. package/dist/cjs/src/entities/mixedRoute/trade.js.map +0 -1
  38. package/dist/cjs/src/entities/mixedRoute/trade.test.d.ts +0 -1
  39. package/dist/cjs/src/entities/mixedRoute/trade.test.js +0 -1010
  40. package/dist/cjs/src/entities/mixedRoute/trade.test.js.map +0 -1
  41. package/dist/cjs/src/entities/protocol.js +0 -11
  42. package/dist/cjs/src/entities/protocol.js.map +0 -1
  43. package/dist/cjs/src/entities/route.d.ts +0 -40
  44. package/dist/cjs/src/entities/route.js +0 -63
  45. package/dist/cjs/src/entities/route.js.map +0 -1
  46. package/dist/cjs/src/entities/route.test.d.ts +0 -1
  47. package/dist/cjs/src/entities/route.test.js +0 -192
  48. package/dist/cjs/src/entities/route.test.js.map +0 -1
  49. package/dist/cjs/src/entities/trade.d.ts +0 -127
  50. package/dist/cjs/src/entities/trade.js +0 -366
  51. package/dist/cjs/src/entities/trade.js.map +0 -1
  52. package/dist/cjs/src/entities/trade.test.d.ts +0 -1
  53. package/dist/cjs/src/entities/trade.test.js +0 -1267
  54. package/dist/cjs/src/entities/trade.test.js.map +0 -1
  55. package/dist/cjs/src/index.js +0 -18
  56. package/dist/cjs/src/index.js.map +0 -1
  57. package/dist/cjs/src/multicallExtended.js +0 -43
  58. package/dist/cjs/src/multicallExtended.js.map +0 -1
  59. package/dist/cjs/src/multicallExtended.test.d.ts +0 -1
  60. package/dist/cjs/src/multicallExtended.test.js +0 -22
  61. package/dist/cjs/src/multicallExtended.test.js.map +0 -1
  62. package/dist/cjs/src/paymentsExtended.d.ts +0 -15
  63. package/dist/cjs/src/paymentsExtended.js +0 -65
  64. package/dist/cjs/src/paymentsExtended.js.map +0 -1
  65. package/dist/cjs/src/paymentsExtended.test.d.ts +0 -1
  66. package/dist/cjs/src/paymentsExtended.test.js +0 -60
  67. package/dist/cjs/src/paymentsExtended.test.js.map +0 -1
  68. package/dist/cjs/src/swapRouter.js +0 -439
  69. package/dist/cjs/src/swapRouter.js.map +0 -1
  70. package/dist/cjs/src/swapRouter.test.d.ts +0 -1
  71. package/dist/cjs/src/swapRouter.test.js +0 -1161
  72. package/dist/cjs/src/swapRouter.test.js.map +0 -1
  73. package/dist/cjs/src/utils/TPool.js +0 -3
  74. package/dist/cjs/src/utils/TPool.js.map +0 -1
  75. package/dist/cjs/src/utils/encodeMixedRouteToPath.js +0 -90
  76. package/dist/cjs/src/utils/encodeMixedRouteToPath.js.map +0 -1
  77. package/dist/cjs/src/utils/encodeMixedRouteToPath.test.d.ts +0 -1
  78. package/dist/cjs/src/utils/encodeMixedRouteToPath.test.js +0 -136
  79. package/dist/cjs/src/utils/encodeMixedRouteToPath.test.js.map +0 -1
  80. package/dist/cjs/src/utils/index.d.ts +0 -16
  81. package/dist/cjs/src/utils/index.js +0 -51
  82. package/dist/cjs/src/utils/index.js.map +0 -1
  83. package/dist/cjs/src/utils/pathCurrency.js +0 -35
  84. package/dist/cjs/src/utils/pathCurrency.js.map +0 -1
  85. package/dist/cjs/src/utils/pathCurrency.test.d.ts +0 -1
  86. package/dist/cjs/src/utils/pathCurrency.test.js +0 -17
  87. package/dist/cjs/src/utils/pathCurrency.test.js.map +0 -1
  88. package/dist/esm/src/approveAndCall.d.ts +0 -33
  89. package/dist/esm/src/approveAndCall.js +0 -105
  90. package/dist/esm/src/approveAndCall.js.map +0 -1
  91. package/dist/esm/src/constants.d.ts +0 -13
  92. package/dist/esm/src/constants.js +0 -18
  93. package/dist/esm/src/constants.js.map +0 -1
  94. package/dist/esm/src/entities/mixedRoute/route.d.ts +0 -29
  95. package/dist/esm/src/entities/mixedRoute/route.js +0 -114
  96. package/dist/esm/src/entities/mixedRoute/route.js.map +0 -1
  97. package/dist/esm/src/entities/mixedRoute/route.test.d.ts +0 -1
  98. package/dist/esm/src/entities/mixedRoute/route.test.js +0 -467
  99. package/dist/esm/src/entities/mixedRoute/route.test.js.map +0 -1
  100. package/dist/esm/src/entities/mixedRoute/trade.js +0 -352
  101. package/dist/esm/src/entities/mixedRoute/trade.js.map +0 -1
  102. package/dist/esm/src/entities/mixedRoute/trade.test.d.ts +0 -1
  103. package/dist/esm/src/entities/mixedRoute/trade.test.js +0 -1008
  104. package/dist/esm/src/entities/mixedRoute/trade.test.js.map +0 -1
  105. package/dist/esm/src/entities/protocol.d.ts +0 -6
  106. package/dist/esm/src/entities/protocol.js +0 -8
  107. package/dist/esm/src/entities/protocol.js.map +0 -1
  108. package/dist/esm/src/entities/route.js +0 -55
  109. package/dist/esm/src/entities/route.js.map +0 -1
  110. package/dist/esm/src/entities/route.test.d.ts +0 -1
  111. package/dist/esm/src/entities/route.test.js +0 -190
  112. package/dist/esm/src/entities/route.test.js.map +0 -1
  113. package/dist/esm/src/entities/trade.js +0 -362
  114. package/dist/esm/src/entities/trade.js.map +0 -1
  115. package/dist/esm/src/entities/trade.test.d.ts +0 -1
  116. package/dist/esm/src/entities/trade.test.js +0 -1265
  117. package/dist/esm/src/entities/trade.test.js.map +0 -1
  118. package/dist/esm/src/index.d.ts +0 -14
  119. package/dist/esm/src/index.js +0 -15
  120. package/dist/esm/src/index.js.map +0 -1
  121. package/dist/esm/src/multicallExtended.d.ts +0 -11
  122. package/dist/esm/src/multicallExtended.js +0 -39
  123. package/dist/esm/src/multicallExtended.js.map +0 -1
  124. package/dist/esm/src/multicallExtended.test.d.ts +0 -1
  125. package/dist/esm/src/multicallExtended.test.js +0 -20
  126. package/dist/esm/src/multicallExtended.test.js.map +0 -1
  127. package/dist/esm/src/paymentsExtended.d.ts +0 -15
  128. package/dist/esm/src/paymentsExtended.js +0 -61
  129. package/dist/esm/src/paymentsExtended.js.map +0 -1
  130. package/dist/esm/src/paymentsExtended.test.d.ts +0 -1
  131. package/dist/esm/src/paymentsExtended.test.js +0 -57
  132. package/dist/esm/src/paymentsExtended.test.js.map +0 -1
  133. package/dist/esm/src/swapRouter.d.ts +0 -95
  134. package/dist/esm/src/swapRouter.js +0 -434
  135. package/dist/esm/src/swapRouter.js.map +0 -1
  136. package/dist/esm/src/swapRouter.test.d.ts +0 -1
  137. package/dist/esm/src/swapRouter.test.js +0 -1159
  138. package/dist/esm/src/swapRouter.test.js.map +0 -1
  139. package/dist/esm/src/utils/TPool.d.ts +0 -4
  140. package/dist/esm/src/utils/TPool.js +0 -2
  141. package/dist/esm/src/utils/TPool.js.map +0 -1
  142. package/dist/esm/src/utils/encodeMixedRouteToPath.d.ts +0 -9
  143. package/dist/esm/src/utils/encodeMixedRouteToPath.js +0 -86
  144. package/dist/esm/src/utils/encodeMixedRouteToPath.js.map +0 -1
  145. package/dist/esm/src/utils/encodeMixedRouteToPath.test.d.ts +0 -1
  146. package/dist/esm/src/utils/encodeMixedRouteToPath.test.js +0 -134
  147. package/dist/esm/src/utils/encodeMixedRouteToPath.test.js.map +0 -1
  148. package/dist/esm/src/utils/index.d.ts +0 -16
  149. package/dist/esm/src/utils/index.js +0 -46
  150. package/dist/esm/src/utils/index.js.map +0 -1
  151. package/dist/esm/src/utils/pathCurrency.d.ts +0 -4
  152. package/dist/esm/src/utils/pathCurrency.js +0 -30
  153. package/dist/esm/src/utils/pathCurrency.js.map +0 -1
  154. package/dist/esm/src/utils/pathCurrency.test.d.ts +0 -1
  155. package/dist/esm/src/utils/pathCurrency.test.js +0 -15
  156. package/dist/esm/src/utils/pathCurrency.test.js.map +0 -1
  157. package/dist/types/src/approveAndCall.d.ts +0 -33
  158. package/dist/types/src/entities/mixedRoute/route.test.d.ts +0 -1
  159. package/dist/types/src/entities/mixedRoute/trade.d.ts +0 -183
  160. package/dist/types/src/entities/mixedRoute/trade.test.d.ts +0 -1
  161. package/dist/types/src/entities/protocol.d.ts +0 -6
  162. package/dist/types/src/entities/route.d.ts +0 -40
  163. package/dist/types/src/entities/route.test.d.ts +0 -1
  164. package/dist/types/src/entities/trade.d.ts +0 -127
  165. package/dist/types/src/entities/trade.test.d.ts +0 -1
  166. package/dist/types/src/index.d.ts +0 -14
  167. package/dist/types/src/multicallExtended.d.ts +0 -11
  168. package/dist/types/src/multicallExtended.test.d.ts +0 -1
  169. package/dist/types/src/paymentsExtended.test.d.ts +0 -1
  170. package/dist/types/src/swapRouter.d.ts +0 -95
  171. package/dist/types/src/swapRouter.test.d.ts +0 -1
  172. package/dist/types/src/utils/TPool.d.ts +0 -4
  173. package/dist/types/src/utils/encodeMixedRouteToPath.d.ts +0 -9
  174. package/dist/types/src/utils/encodeMixedRouteToPath.test.d.ts +0 -1
  175. package/dist/types/src/utils/pathCurrency.d.ts +0 -4
  176. package/dist/types/src/utils/pathCurrency.test.d.ts +0 -1
@@ -1,183 +0,0 @@
1
- import { Currency, Percent, Price, CurrencyAmount, TradeType } from '@uniswap/sdk-core';
2
- import { BestTradeOptions } from '@uniswap/v3-sdk';
3
- import { MixedRouteSDK } from './route';
4
- import { TPool } from '../../utils/TPool';
5
- /**
6
- * Trades comparator, an extension of the input output comparator that also considers other dimensions of the trade in ranking them
7
- * @template TInput The input token, either Ether or an ERC-20
8
- * @template TOutput The output token, either Ether or an ERC-20
9
- * @template TTradeType The trade type, either exact input or exact output
10
- * @param a The first trade to compare
11
- * @param b The second trade to compare
12
- * @returns A sorted ordering for two neighboring elements in a trade array
13
- */
14
- export declare function tradeComparator<TInput extends Currency, TOutput extends Currency, TTradeType extends TradeType>(a: MixedRouteTrade<TInput, TOutput, TTradeType>, b: MixedRouteTrade<TInput, TOutput, TTradeType>): number;
15
- /**
16
- * Represents a trade executed against a set of routes where some percentage of the input is
17
- * split across each route.
18
- *
19
- * Each route has its own set of pools. Pools can not be re-used across routes.
20
- *
21
- * Does not account for slippage, i.e., changes in price environment that can occur between
22
- * the time the trade is submitted and when it is executed.
23
- * @notice This class is functionally the same as the `Trade` class in the `@uniswap/v3-sdk` package, aside from typing and some input validation.
24
- * @template TInput The input token, either Ether or an ERC-20
25
- * @template TOutput The output token, either Ether or an ERC-20
26
- * @template TTradeType The trade type, either exact input or exact output
27
- */
28
- export declare class MixedRouteTrade<TInput extends Currency, TOutput extends Currency, TTradeType extends TradeType> {
29
- /**
30
- * @deprecated Deprecated in favor of 'swaps' property. If the trade consists of multiple routes
31
- * this will return an error.
32
- *
33
- * When the trade consists of just a single route, this returns the route of the trade,
34
- * i.e. which pools the trade goes through.
35
- */
36
- get route(): MixedRouteSDK<TInput, TOutput>;
37
- /**
38
- * The swaps of the trade, i.e. which routes and how much is swapped in each that
39
- * make up the trade.
40
- */
41
- readonly swaps: {
42
- route: MixedRouteSDK<TInput, TOutput>;
43
- inputAmount: CurrencyAmount<TInput>;
44
- outputAmount: CurrencyAmount<TOutput>;
45
- }[];
46
- /**
47
- * The type of the trade, either exact in or exact out.
48
- */
49
- readonly tradeType: TTradeType;
50
- /**
51
- * The cached result of the input amount computation
52
- * @private
53
- */
54
- private _inputAmount;
55
- /**
56
- * The input amount for the trade assuming no slippage.
57
- */
58
- get inputAmount(): CurrencyAmount<TInput>;
59
- /**
60
- * The cached result of the output amount computation
61
- * @private
62
- */
63
- private _outputAmount;
64
- /**
65
- * The output amount for the trade assuming no slippage.
66
- */
67
- get outputAmount(): CurrencyAmount<TOutput>;
68
- /**
69
- * The cached result of the computed execution price
70
- * @private
71
- */
72
- private _executionPrice;
73
- /**
74
- * The price expressed in terms of output amount/input amount.
75
- */
76
- get executionPrice(): Price<TInput, TOutput>;
77
- /**
78
- * The cached result of the price impact computation
79
- * @private
80
- */
81
- private _priceImpact;
82
- /**
83
- * Returns the percent difference between the route's mid price and the price impact
84
- */
85
- get priceImpact(): Percent;
86
- /**
87
- * Constructs a trade by simulating swaps through the given route
88
- * @template TInput The input token, either Ether or an ERC-20.
89
- * @template TOutput The output token, either Ether or an ERC-20.
90
- * @template TTradeType The type of the trade, either exact in or exact out.
91
- * @param route route to swap through
92
- * @param amount the amount specified, either input or output, depending on tradeType
93
- * @param tradeType whether the trade is an exact input or exact output swap
94
- * @returns The route
95
- */
96
- static fromRoute<TInput extends Currency, TOutput extends Currency, TTradeType extends TradeType>(route: MixedRouteSDK<TInput, TOutput>, amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>, tradeType: TTradeType): Promise<MixedRouteTrade<TInput, TOutput, TTradeType>>;
97
- /**
98
- * Constructs a trade from routes by simulating swaps
99
- *
100
- * @template TInput The input token, either Ether or an ERC-20.
101
- * @template TOutput The output token, either Ether or an ERC-20.
102
- * @template TTradeType The type of the trade, either exact in or exact out.
103
- * @param routes the routes to swap through and how much of the amount should be routed through each
104
- * @param tradeType whether the trade is an exact input or exact output swap
105
- * @returns The trade
106
- */
107
- static fromRoutes<TInput extends Currency, TOutput extends Currency, TTradeType extends TradeType>(routes: {
108
- amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>;
109
- route: MixedRouteSDK<TInput, TOutput>;
110
- }[], tradeType: TTradeType): Promise<MixedRouteTrade<TInput, TOutput, TTradeType>>;
111
- /**
112
- * Creates a trade without computing the result of swapping through the route. Useful when you have simulated the trade
113
- * elsewhere and do not have any tick data
114
- * @template TInput The input token, either Ether or an ERC-20
115
- * @template TOutput The output token, either Ether or an ERC-20
116
- * @template TTradeType The type of the trade, either exact in or exact out
117
- * @param constructorArguments The arguments passed to the trade constructor
118
- * @returns The unchecked trade
119
- */
120
- static createUncheckedTrade<TInput extends Currency, TOutput extends Currency, TTradeType extends TradeType>(constructorArguments: {
121
- route: MixedRouteSDK<TInput, TOutput>;
122
- inputAmount: CurrencyAmount<TInput>;
123
- outputAmount: CurrencyAmount<TOutput>;
124
- tradeType: TTradeType;
125
- }): MixedRouteTrade<TInput, TOutput, TTradeType>;
126
- /**
127
- * Creates a trade without computing the result of swapping through the routes. Useful when you have simulated the trade
128
- * elsewhere and do not have any tick data
129
- * @template TInput The input token, either Ether or an ERC-20
130
- * @template TOutput The output token, either Ether or an ERC-20
131
- * @template TTradeType The type of the trade, either exact in or exact out
132
- * @param constructorArguments The arguments passed to the trade constructor
133
- * @returns The unchecked trade
134
- */
135
- static createUncheckedTradeWithMultipleRoutes<TInput extends Currency, TOutput extends Currency, TTradeType extends TradeType>(constructorArguments: {
136
- routes: {
137
- route: MixedRouteSDK<TInput, TOutput>;
138
- inputAmount: CurrencyAmount<TInput>;
139
- outputAmount: CurrencyAmount<TOutput>;
140
- }[];
141
- tradeType: TTradeType;
142
- }): MixedRouteTrade<TInput, TOutput, TTradeType>;
143
- /**
144
- * Construct a trade by passing in the pre-computed property values
145
- * @param routes The routes through which the trade occurs
146
- * @param tradeType The type of trade, exact input or exact output
147
- */
148
- private constructor();
149
- /**
150
- * Get the minimum amount that must be received from this trade for the given slippage tolerance
151
- * @param slippageTolerance The tolerance of unfavorable slippage from the execution price of this trade
152
- * @returns The amount out
153
- */
154
- minimumAmountOut(slippageTolerance: Percent, amountOut?: CurrencyAmount<TOutput>): CurrencyAmount<TOutput>;
155
- /**
156
- * Get the maximum amount in that can be spent via this trade for the given slippage tolerance
157
- * @param slippageTolerance The tolerance of unfavorable slippage from the execution price of this trade
158
- * @returns The amount in
159
- */
160
- maximumAmountIn(slippageTolerance: Percent, amountIn?: CurrencyAmount<TInput>): CurrencyAmount<TInput>;
161
- /**
162
- * Return the execution price after accounting for slippage tolerance
163
- * @param slippageTolerance the allowed tolerated slippage
164
- * @returns The execution price
165
- */
166
- worstExecutionPrice(slippageTolerance: Percent): Price<TInput, TOutput>;
167
- /**
168
- * Given a list of pools, and a fixed amount in, returns the top `maxNumResults` trades that go from an input token
169
- * amount to an output token, making at most `maxHops` hops.
170
- * Note this does not consider aggregation, as routes are linear. It's possible a better route exists by splitting
171
- * the amount in among multiple routes.
172
- * @param pools the pools to consider in finding the best trade
173
- * @param nextAmountIn exact amount of input currency to spend
174
- * @param currencyOut the desired currency out
175
- * @param maxNumResults maximum number of results to return
176
- * @param maxHops maximum number of hops a returned trade can make, e.g. 1 hop goes through a single pool
177
- * @param currentPools used in recursion; the current list of pools
178
- * @param currencyAmountIn used in recursion; the original value of the currencyAmountIn parameter
179
- * @param bestTrades used in recursion; the current list of best trades
180
- * @returns The exact in trade
181
- */
182
- static bestTradeExactIn<TInput extends Currency, TOutput extends Currency>(pools: TPool[], currencyAmountIn: CurrencyAmount<TInput>, currencyOut: TOutput, { maxNumResults, maxHops }?: BestTradeOptions, currentPools?: TPool[], nextAmountIn?: CurrencyAmount<Currency>, bestTrades?: MixedRouteTrade<TInput, TOutput, TradeType.EXACT_INPUT>[]): Promise<MixedRouteTrade<TInput, TOutput, TradeType.EXACT_INPUT>[]>;
183
- }
@@ -1,357 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MixedRouteTrade = exports.tradeComparator = 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("./route");
12
- const pathCurrency_1 = require("../../utils/pathCurrency");
13
- /**
14
- * Trades comparator, an extension of the input output comparator that also considers other dimensions of the trade in ranking them
15
- * @template TInput The input token, either Ether or an ERC-20
16
- * @template TOutput The output token, either Ether or an ERC-20
17
- * @template TTradeType The trade type, either exact input or exact output
18
- * @param a The first trade to compare
19
- * @param b The second trade to compare
20
- * @returns A sorted ordering for two neighboring elements in a trade array
21
- */
22
- function tradeComparator(a, b) {
23
- // must have same input and output token for comparison
24
- (0, tiny_invariant_1.default)(a.inputAmount.currency.equals(b.inputAmount.currency), 'INPUT_CURRENCY');
25
- (0, tiny_invariant_1.default)(a.outputAmount.currency.equals(b.outputAmount.currency), 'OUTPUT_CURRENCY');
26
- if (a.outputAmount.equalTo(b.outputAmount)) {
27
- if (a.inputAmount.equalTo(b.inputAmount)) {
28
- // consider the number of hops since each hop costs gas
29
- const aHops = a.swaps.reduce((total, cur) => total + cur.route.path.length, 0);
30
- const bHops = b.swaps.reduce((total, cur) => total + cur.route.path.length, 0);
31
- return aHops - bHops;
32
- }
33
- // trade A requires less input than trade B, so A should come first
34
- if (a.inputAmount.lessThan(b.inputAmount)) {
35
- return -1;
36
- }
37
- else {
38
- return 1;
39
- }
40
- }
41
- else {
42
- // tradeA has less output than trade B, so should come second
43
- if (a.outputAmount.lessThan(b.outputAmount)) {
44
- return 1;
45
- }
46
- else {
47
- return -1;
48
- }
49
- }
50
- }
51
- exports.tradeComparator = tradeComparator;
52
- /**
53
- * Represents a trade executed against a set of routes where some percentage of the input is
54
- * split across each route.
55
- *
56
- * Each route has its own set of pools. Pools can not be re-used across routes.
57
- *
58
- * Does not account for slippage, i.e., changes in price environment that can occur between
59
- * the time the trade is submitted and when it is executed.
60
- * @notice This class is functionally the same as the `Trade` class in the `@uniswap/v3-sdk` package, aside from typing and some input validation.
61
- * @template TInput The input token, either Ether or an ERC-20
62
- * @template TOutput The output token, either Ether or an ERC-20
63
- * @template TTradeType The trade type, either exact input or exact output
64
- */
65
- class MixedRouteTrade {
66
- /**
67
- * @deprecated Deprecated in favor of 'swaps' property. If the trade consists of multiple routes
68
- * this will return an error.
69
- *
70
- * When the trade consists of just a single route, this returns the route of the trade,
71
- * i.e. which pools the trade goes through.
72
- */
73
- get route() {
74
- (0, tiny_invariant_1.default)(this.swaps.length === 1, 'MULTIPLE_ROUTES');
75
- return this.swaps[0].route;
76
- }
77
- /**
78
- * The input amount for the trade assuming no slippage.
79
- */
80
- get inputAmount() {
81
- if (this._inputAmount) {
82
- return this._inputAmount;
83
- }
84
- const inputCurrency = this.swaps[0].inputAmount.currency;
85
- const totalInputFromRoutes = this.swaps
86
- .map(({ inputAmount }) => inputAmount)
87
- .reduce((total, cur) => total.add(cur), sdk_core_1.CurrencyAmount.fromRawAmount(inputCurrency, 0));
88
- this._inputAmount = totalInputFromRoutes;
89
- return this._inputAmount;
90
- }
91
- /**
92
- * The output amount for the trade assuming no slippage.
93
- */
94
- get outputAmount() {
95
- if (this._outputAmount) {
96
- return this._outputAmount;
97
- }
98
- const outputCurrency = this.swaps[0].outputAmount.currency;
99
- const totalOutputFromRoutes = this.swaps
100
- .map(({ outputAmount }) => outputAmount)
101
- .reduce((total, cur) => total.add(cur), sdk_core_1.CurrencyAmount.fromRawAmount(outputCurrency, 0));
102
- this._outputAmount = totalOutputFromRoutes;
103
- return this._outputAmount;
104
- }
105
- /**
106
- * The price expressed in terms of output amount/input amount.
107
- */
108
- get executionPrice() {
109
- var _a;
110
- 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)));
111
- }
112
- /**
113
- * Returns the percent difference between the route's mid price and the price impact
114
- */
115
- get priceImpact() {
116
- if (this._priceImpact) {
117
- return this._priceImpact;
118
- }
119
- let spotOutputAmount = sdk_core_1.CurrencyAmount.fromRawAmount(this.outputAmount.currency, 0);
120
- for (const { route, inputAmount } of this.swaps) {
121
- const midPrice = route.midPrice;
122
- spotOutputAmount = spotOutputAmount.add(midPrice.quote(inputAmount));
123
- }
124
- const priceImpact = spotOutputAmount.subtract(this.outputAmount).divide(spotOutputAmount);
125
- this._priceImpact = new sdk_core_1.Percent(priceImpact.numerator, priceImpact.denominator);
126
- return this._priceImpact;
127
- }
128
- /**
129
- * Constructs a trade by simulating swaps through the given route
130
- * @template TInput The input token, either Ether or an ERC-20.
131
- * @template TOutput The output token, either Ether or an ERC-20.
132
- * @template TTradeType The type of the trade, either exact in or exact out.
133
- * @param route route to swap through
134
- * @param amount the amount specified, either input or output, depending on tradeType
135
- * @param tradeType whether the trade is an exact input or exact output swap
136
- * @returns The route
137
- */
138
- static fromRoute(route, amount, tradeType) {
139
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
140
- const amounts = new Array(route.path.length);
141
- let inputAmount;
142
- let outputAmount;
143
- (0, tiny_invariant_1.default)(tradeType === sdk_core_1.TradeType.EXACT_INPUT, 'TRADE_TYPE');
144
- (0, tiny_invariant_1.default)(amount.currency.equals(route.input), 'INPUT');
145
- amounts[0] = (0, pathCurrency_1.amountWithPathCurrency)(amount, route.pools[0]);
146
- for (let i = 0; i < route.path.length - 1; i++) {
147
- const pool = route.pools[i];
148
- const [outputAmount] = yield pool.getOutputAmount((0, pathCurrency_1.amountWithPathCurrency)(amounts[i], pool));
149
- amounts[i + 1] = outputAmount;
150
- }
151
- inputAmount = sdk_core_1.CurrencyAmount.fromFractionalAmount(route.input, amount.numerator, amount.denominator);
152
- outputAmount = sdk_core_1.CurrencyAmount.fromFractionalAmount(route.output, amounts[amounts.length - 1].numerator, amounts[amounts.length - 1].denominator);
153
- return new MixedRouteTrade({
154
- routes: [{ inputAmount, outputAmount, route }],
155
- tradeType,
156
- });
157
- });
158
- }
159
- /**
160
- * Constructs a trade from routes by simulating swaps
161
- *
162
- * @template TInput The input token, either Ether or an ERC-20.
163
- * @template TOutput The output token, either Ether or an ERC-20.
164
- * @template TTradeType The type of the trade, either exact in or exact out.
165
- * @param routes the routes to swap through and how much of the amount should be routed through each
166
- * @param tradeType whether the trade is an exact input or exact output swap
167
- * @returns The trade
168
- */
169
- static fromRoutes(routes, tradeType) {
170
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
171
- const populatedRoutes = [];
172
- (0, tiny_invariant_1.default)(tradeType === sdk_core_1.TradeType.EXACT_INPUT, 'TRADE_TYPE');
173
- for (const { route, amount } of routes) {
174
- const amounts = new Array(route.path.length);
175
- let inputAmount;
176
- let outputAmount;
177
- (0, tiny_invariant_1.default)(amount.currency.equals(route.input), 'INPUT');
178
- inputAmount = sdk_core_1.CurrencyAmount.fromFractionalAmount(route.input, amount.numerator, amount.denominator);
179
- amounts[0] = sdk_core_1.CurrencyAmount.fromFractionalAmount(route.pathInput, amount.numerator, amount.denominator);
180
- for (let i = 0; i < route.path.length - 1; i++) {
181
- const pool = route.pools[i];
182
- const [outputAmount] = yield pool.getOutputAmount((0, pathCurrency_1.amountWithPathCurrency)(amounts[i], pool));
183
- amounts[i + 1] = outputAmount;
184
- }
185
- outputAmount = sdk_core_1.CurrencyAmount.fromFractionalAmount(route.output, amounts[amounts.length - 1].numerator, amounts[amounts.length - 1].denominator);
186
- populatedRoutes.push({ route, inputAmount, outputAmount });
187
- }
188
- return new MixedRouteTrade({
189
- routes: populatedRoutes,
190
- tradeType,
191
- });
192
- });
193
- }
194
- /**
195
- * Creates a trade without computing the result of swapping through the route. Useful when you have simulated the trade
196
- * elsewhere and do not have any tick data
197
- * @template TInput The input token, either Ether or an ERC-20
198
- * @template TOutput The output token, either Ether or an ERC-20
199
- * @template TTradeType The type of the trade, either exact in or exact out
200
- * @param constructorArguments The arguments passed to the trade constructor
201
- * @returns The unchecked trade
202
- */
203
- static createUncheckedTrade(constructorArguments) {
204
- return new MixedRouteTrade(Object.assign(Object.assign({}, constructorArguments), { routes: [
205
- {
206
- inputAmount: constructorArguments.inputAmount,
207
- outputAmount: constructorArguments.outputAmount,
208
- route: constructorArguments.route,
209
- },
210
- ] }));
211
- }
212
- /**
213
- * Creates a trade without computing the result of swapping through the routes. Useful when you have simulated the trade
214
- * elsewhere and do not have any tick data
215
- * @template TInput The input token, either Ether or an ERC-20
216
- * @template TOutput The output token, either Ether or an ERC-20
217
- * @template TTradeType The type of the trade, either exact in or exact out
218
- * @param constructorArguments The arguments passed to the trade constructor
219
- * @returns The unchecked trade
220
- */
221
- static createUncheckedTradeWithMultipleRoutes(constructorArguments) {
222
- return new MixedRouteTrade(constructorArguments);
223
- }
224
- /**
225
- * Construct a trade by passing in the pre-computed property values
226
- * @param routes The routes through which the trade occurs
227
- * @param tradeType The type of trade, exact input or exact output
228
- */
229
- constructor({ routes, tradeType, }) {
230
- const inputCurrency = routes[0].inputAmount.currency;
231
- const outputCurrency = routes[0].outputAmount.currency;
232
- (0, tiny_invariant_1.default)(routes.every(({ route }) => inputCurrency.wrapped.equals(route.input.wrapped)), 'INPUT_CURRENCY_MATCH');
233
- (0, tiny_invariant_1.default)(routes.every(({ route }) => outputCurrency.wrapped.equals(route.output.wrapped)), 'OUTPUT_CURRENCY_MATCH');
234
- const numPools = routes.map(({ route }) => route.pools.length).reduce((total, cur) => total + cur, 0);
235
- const poolIdentifierSet = new Set();
236
- for (const { route } of routes) {
237
- for (const pool of route.pools) {
238
- if (pool instanceof v4_sdk_1.Pool) {
239
- poolIdentifierSet.add(pool.poolId);
240
- }
241
- else if (pool instanceof v3_sdk_1.Pool) {
242
- poolIdentifierSet.add(v3_sdk_1.Pool.getAddress(pool.token0, pool.token1, pool.fee));
243
- }
244
- else if (pool instanceof v2_sdk_1.Pair) {
245
- const pair = pool;
246
- poolIdentifierSet.add(v2_sdk_1.Pair.getAddress(pair.token0, pair.token1));
247
- }
248
- else {
249
- throw new Error('Unexpected pool type in route when constructing trade object');
250
- }
251
- }
252
- }
253
- (0, tiny_invariant_1.default)(numPools === poolIdentifierSet.size, 'POOLS_DUPLICATED');
254
- (0, tiny_invariant_1.default)(tradeType === sdk_core_1.TradeType.EXACT_INPUT, 'TRADE_TYPE');
255
- this.swaps = routes;
256
- this.tradeType = tradeType;
257
- }
258
- /**
259
- * Get the minimum amount that must be received from this trade for the given slippage tolerance
260
- * @param slippageTolerance The tolerance of unfavorable slippage from the execution price of this trade
261
- * @returns The amount out
262
- */
263
- minimumAmountOut(slippageTolerance, amountOut = this.outputAmount) {
264
- (0, tiny_invariant_1.default)(!slippageTolerance.lessThan(constants_1.ZERO), 'SLIPPAGE_TOLERANCE');
265
- /// does not support exactOutput, as enforced in the constructor
266
- const slippageAdjustedAmountOut = new sdk_core_1.Fraction(constants_1.ONE)
267
- .add(slippageTolerance)
268
- .invert()
269
- .multiply(amountOut.quotient).quotient;
270
- return sdk_core_1.CurrencyAmount.fromRawAmount(amountOut.currency, slippageAdjustedAmountOut);
271
- }
272
- /**
273
- * Get the maximum amount in that can be spent via this trade for the given slippage tolerance
274
- * @param slippageTolerance The tolerance of unfavorable slippage from the execution price of this trade
275
- * @returns The amount in
276
- */
277
- maximumAmountIn(slippageTolerance, amountIn = this.inputAmount) {
278
- (0, tiny_invariant_1.default)(!slippageTolerance.lessThan(constants_1.ZERO), 'SLIPPAGE_TOLERANCE');
279
- return amountIn;
280
- /// does not support exactOutput
281
- }
282
- /**
283
- * Return the execution price after accounting for slippage tolerance
284
- * @param slippageTolerance the allowed tolerated slippage
285
- * @returns The execution price
286
- */
287
- worstExecutionPrice(slippageTolerance) {
288
- return new sdk_core_1.Price(this.inputAmount.currency, this.outputAmount.currency, this.maximumAmountIn(slippageTolerance).quotient, this.minimumAmountOut(slippageTolerance).quotient);
289
- }
290
- /**
291
- * Given a list of pools, and a fixed amount in, returns the top `maxNumResults` trades that go from an input token
292
- * amount to an output token, making at most `maxHops` hops.
293
- * Note this does not consider aggregation, as routes are linear. It's possible a better route exists by splitting
294
- * the amount in among multiple routes.
295
- * @param pools the pools to consider in finding the best trade
296
- * @param nextAmountIn exact amount of input currency to spend
297
- * @param currencyOut the desired currency out
298
- * @param maxNumResults maximum number of results to return
299
- * @param maxHops maximum number of hops a returned trade can make, e.g. 1 hop goes through a single pool
300
- * @param currentPools used in recursion; the current list of pools
301
- * @param currencyAmountIn used in recursion; the original value of the currencyAmountIn parameter
302
- * @param bestTrades used in recursion; the current list of best trades
303
- * @returns The exact in trade
304
- */
305
- static bestTradeExactIn(pools, currencyAmountIn, currencyOut, { maxNumResults = 3, maxHops = 3 } = {},
306
- // used in recursion.
307
- currentPools = [], nextAmountIn = currencyAmountIn, bestTrades = []) {
308
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
309
- (0, tiny_invariant_1.default)(pools.length > 0, 'POOLS');
310
- (0, tiny_invariant_1.default)(maxHops > 0, 'MAX_HOPS');
311
- (0, tiny_invariant_1.default)(currencyAmountIn === nextAmountIn || currentPools.length > 0, 'INVALID_RECURSION');
312
- const amountIn = nextAmountIn;
313
- for (let i = 0; i < pools.length; i++) {
314
- const pool = pools[i];
315
- const amountInAdjusted = pool instanceof v4_sdk_1.Pool ? amountIn : amountIn.wrapped;
316
- // pool irrelevant
317
- if (!pool.token0.equals(amountInAdjusted.currency) && !pool.token1.equals(amountInAdjusted.currency))
318
- continue;
319
- if (pool instanceof v2_sdk_1.Pair) {
320
- if (pool.reserve0.equalTo(constants_1.ZERO) || pool.reserve1.equalTo(constants_1.ZERO))
321
- continue;
322
- }
323
- let amountOut;
324
- try {
325
- ;
326
- [amountOut] =
327
- pool instanceof v4_sdk_1.Pool
328
- ? yield pool.getOutputAmount(amountInAdjusted)
329
- : yield pool.getOutputAmount(amountInAdjusted.wrapped);
330
- }
331
- catch (error) {
332
- // input too low
333
- // @ts-ignore[2571] error is unknown
334
- if (error.isInsufficientInputAmountError) {
335
- continue;
336
- }
337
- throw error;
338
- }
339
- // we have arrived at the output token, so this is the final trade of one of the paths
340
- if (amountOut.currency.wrapped.equals(currencyOut.wrapped)) {
341
- (0, sdk_core_1.sortedInsert)(bestTrades, yield MixedRouteTrade.fromRoute(new route_1.MixedRouteSDK([...currentPools, pool], currencyAmountIn.currency, currencyOut), currencyAmountIn, sdk_core_1.TradeType.EXACT_INPUT), maxNumResults, tradeComparator);
342
- }
343
- else if (maxHops > 1 && pools.length > 1) {
344
- const poolsExcludingThisPool = pools.slice(0, i).concat(pools.slice(i + 1, pools.length));
345
- // otherwise, consider all the other paths that lead from this token as long as we have not exceeded maxHops
346
- yield MixedRouteTrade.bestTradeExactIn(poolsExcludingThisPool, currencyAmountIn, currencyOut, {
347
- maxNumResults,
348
- maxHops: maxHops - 1,
349
- }, [...currentPools, pool], amountOut, bestTrades);
350
- }
351
- }
352
- return bestTrades;
353
- });
354
- }
355
- }
356
- exports.MixedRouteTrade = MixedRouteTrade;
357
- //# sourceMappingURL=trade.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"trade.js","sourceRoot":"","sources":["../../../../../src/entities/mixedRoute/trade.ts"],"names":[],"mappings":";;;;AAAA,gDAAsH;AACtH,4CAAsC;AACtC,4CAAkE;AAClE,4CAAgD;AAChD,4EAAsC;AACtC,+CAA2C;AAC3C,mCAAuC;AACvC,2DAAiE;AAGjE;;;;;;;;GAQG;AACH,SAAgB,eAAe,CAC7B,CAA+C,EAC/C,CAA+C;IAE/C,uDAAuD;IACvD,IAAA,wBAAS,EAAC,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,gBAAgB,CAAC,CAAA;IAClF,IAAA,wBAAS,EAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,iBAAiB,CAAC,CAAA;IACrF,IAAI,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,EAAE;QAC1C,IAAI,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE;YACxC,uDAAuD;YACvD,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;YAC9E,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC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