@uniswap/router-sdk 1.23.0 → 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 +29 -14
- 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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,183 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Route as V2RouteSDK, Pair } from '@uniswap/v2-sdk';
|
|
2
|
+
import { Route as V3RouteSDK, Pool as V3Pool } from '@uniswap/v3-sdk';
|
|
3
|
+
import { Route as V4RouteSDK, Pool as V4Pool } from '@uniswap/v4-sdk';
|
|
4
|
+
import { Protocol } from './protocol';
|
|
5
|
+
import { Currency, Price, Token } from '@uniswap/sdk-core';
|
|
6
|
+
import { MixedRouteSDK } from './mixedRoute/route';
|
|
7
|
+
export declare function getPathToken(currency: Currency, pool: Pair | V3Pool): Token;
|
|
8
|
+
export interface IRoute<TInput extends Currency, TOutput extends Currency, TPool extends Pair | V3Pool | V4Pool> {
|
|
9
|
+
protocol: Protocol;
|
|
10
|
+
pools: TPool[];
|
|
11
|
+
path: Currency[];
|
|
12
|
+
midPrice: Price<TInput, TOutput>;
|
|
13
|
+
input: TInput;
|
|
14
|
+
output: TOutput;
|
|
15
|
+
pathInput: Currency;
|
|
16
|
+
pathOutput: Currency;
|
|
17
|
+
}
|
|
18
|
+
export declare class RouteV2<TInput extends Currency, TOutput extends Currency> extends V2RouteSDK<TInput, TOutput> implements IRoute<TInput, TOutput, Pair> {
|
|
19
|
+
readonly protocol: Protocol;
|
|
20
|
+
readonly pools: Pair[];
|
|
21
|
+
pathInput: Currency;
|
|
22
|
+
pathOutput: Currency;
|
|
23
|
+
constructor(v2Route: V2RouteSDK<TInput, TOutput>);
|
|
24
|
+
}
|
|
25
|
+
export declare class RouteV3<TInput extends Currency, TOutput extends Currency> extends V3RouteSDK<TInput, TOutput> implements IRoute<TInput, TOutput, V3Pool> {
|
|
26
|
+
readonly protocol: Protocol;
|
|
27
|
+
readonly path: Token[];
|
|
28
|
+
pathInput: Currency;
|
|
29
|
+
pathOutput: Currency;
|
|
30
|
+
constructor(v3Route: V3RouteSDK<TInput, TOutput>);
|
|
31
|
+
}
|
|
32
|
+
export declare class RouteV4<TInput extends Currency, TOutput extends Currency> extends V4RouteSDK<TInput, TOutput> implements IRoute<TInput, TOutput, V4Pool> {
|
|
33
|
+
readonly protocol: Protocol;
|
|
34
|
+
readonly path: Currency[];
|
|
35
|
+
constructor(v4Route: V4RouteSDK<TInput, TOutput>);
|
|
36
|
+
}
|
|
37
|
+
export declare class MixedRoute<TInput extends Currency, TOutput extends Currency> extends MixedRouteSDK<TInput, TOutput> implements IRoute<TInput, TOutput, Pair | V3Pool | V4Pool> {
|
|
38
|
+
readonly protocol: Protocol;
|
|
39
|
+
constructor(mixedRoute: MixedRouteSDK<TInput, TOutput>);
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './constants';
|
|
2
|
+
export * from './approveAndCall';
|
|
3
|
+
export * from './multicallExtended';
|
|
4
|
+
export * from './paymentsExtended';
|
|
5
|
+
export * from './swapRouter';
|
|
6
|
+
export * from './entities/trade';
|
|
7
|
+
export * from './entities/protocol';
|
|
8
|
+
export * from './entities/route';
|
|
9
|
+
export * from './entities/mixedRoute/route';
|
|
10
|
+
export * from './entities/mixedRoute/trade';
|
|
11
|
+
export * from './utils/encodeMixedRouteToPath';
|
|
12
|
+
export * from './utils/TPool';
|
|
13
|
+
export * from './utils/pathCurrency';
|
|
14
|
+
export * from './utils';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Interface } from '@ethersproject/abi';
|
|
2
|
+
import { BigintIsh } from '@uniswap/sdk-core';
|
|
3
|
+
export type Validation = BigintIsh | string;
|
|
4
|
+
export declare abstract class MulticallExtended {
|
|
5
|
+
static INTERFACE: Interface;
|
|
6
|
+
/**
|
|
7
|
+
* Cannot be constructed.
|
|
8
|
+
*/
|
|
9
|
+
private constructor();
|
|
10
|
+
static encodeMulticall(calldatas: string | string[], validation?: Validation): string;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Interface } from '@ethersproject/abi';
|
|
2
|
+
import { Token } from '@uniswap/sdk-core';
|
|
3
|
+
import { FeeOptions } from '@uniswap/v3-sdk';
|
|
4
|
+
import JSBI from 'jsbi';
|
|
5
|
+
export declare abstract class PaymentsExtended {
|
|
6
|
+
static INTERFACE: Interface;
|
|
7
|
+
/**
|
|
8
|
+
* Cannot be constructed.
|
|
9
|
+
*/
|
|
10
|
+
private constructor();
|
|
11
|
+
static encodeUnwrapWETH9(amountMinimum: JSBI, recipient?: string, feeOptions?: FeeOptions): string;
|
|
12
|
+
static encodeSweepToken(token: Token, amountMinimum: JSBI, recipient?: string, feeOptions?: FeeOptions): string;
|
|
13
|
+
static encodePull(token: Token, amount: JSBI): string;
|
|
14
|
+
static encodeWrapETH(amount: JSBI): string;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { Interface } from '@ethersproject/abi';
|
|
2
|
+
import { Currency, Percent, TradeType } from '@uniswap/sdk-core';
|
|
3
|
+
import { Trade as V2Trade } from '@uniswap/v2-sdk';
|
|
4
|
+
import { FeeOptions, MethodParameters, PermitOptions, Position, Trade as V3Trade } from '@uniswap/v3-sdk';
|
|
5
|
+
import { ApprovalTypes, CondensedAddLiquidityOptions } from './approveAndCall';
|
|
6
|
+
import { Trade } from './entities/trade';
|
|
7
|
+
import { Validation } from './multicallExtended';
|
|
8
|
+
import { MixedRouteTrade } from './entities/mixedRoute/trade';
|
|
9
|
+
/**
|
|
10
|
+
* Options for producing the arguments to send calls to the router.
|
|
11
|
+
*/
|
|
12
|
+
export interface SwapOptions {
|
|
13
|
+
/**
|
|
14
|
+
* How much the execution price is allowed to move unfavorably from the trade execution price.
|
|
15
|
+
*/
|
|
16
|
+
slippageTolerance: Percent;
|
|
17
|
+
/**
|
|
18
|
+
* The account that should receive the output. If omitted, output is sent to msg.sender.
|
|
19
|
+
*/
|
|
20
|
+
recipient?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Either deadline (when the transaction expires, in epoch seconds), or previousBlockhash.
|
|
23
|
+
*/
|
|
24
|
+
deadlineOrPreviousBlockhash?: Validation;
|
|
25
|
+
/**
|
|
26
|
+
* The optional permit parameters for spending the input.
|
|
27
|
+
*/
|
|
28
|
+
inputTokenPermit?: PermitOptions;
|
|
29
|
+
/**
|
|
30
|
+
* Optional information for taking a fee on output.
|
|
31
|
+
*/
|
|
32
|
+
fee?: FeeOptions;
|
|
33
|
+
}
|
|
34
|
+
export interface SwapAndAddOptions extends SwapOptions {
|
|
35
|
+
/**
|
|
36
|
+
* The optional permit parameters for pulling in remaining output token.
|
|
37
|
+
*/
|
|
38
|
+
outputTokenPermit?: PermitOptions;
|
|
39
|
+
}
|
|
40
|
+
type AnyTradeType = Trade<Currency, Currency, TradeType> | V2Trade<Currency, Currency, TradeType> | V3Trade<Currency, Currency, TradeType> | MixedRouteTrade<Currency, Currency, TradeType> | (V2Trade<Currency, Currency, TradeType> | V3Trade<Currency, Currency, TradeType> | MixedRouteTrade<Currency, Currency, TradeType>)[];
|
|
41
|
+
/**
|
|
42
|
+
* Represents the Uniswap V2 + V3 SwapRouter02, and has static methods for helping execute trades.
|
|
43
|
+
*/
|
|
44
|
+
export declare abstract class SwapRouter {
|
|
45
|
+
static INTERFACE: Interface;
|
|
46
|
+
/**
|
|
47
|
+
* Cannot be constructed.
|
|
48
|
+
*/
|
|
49
|
+
private constructor();
|
|
50
|
+
/**
|
|
51
|
+
* @notice Generates the calldata for a Swap with a V2 Route.
|
|
52
|
+
* @param trade The V2Trade to encode.
|
|
53
|
+
* @param options SwapOptions to use for the trade.
|
|
54
|
+
* @param routerMustCustody Flag for whether funds should be sent to the router
|
|
55
|
+
* @param performAggregatedSlippageCheck Flag for whether we want to perform an aggregated slippage check
|
|
56
|
+
* @returns A string array of calldatas for the trade.
|
|
57
|
+
*/
|
|
58
|
+
private static encodeV2Swap;
|
|
59
|
+
/**
|
|
60
|
+
* @notice Generates the calldata for a Swap with a V3 Route.
|
|
61
|
+
* @param trade The V3Trade to encode.
|
|
62
|
+
* @param options SwapOptions to use for the trade.
|
|
63
|
+
* @param routerMustCustody Flag for whether funds should be sent to the router
|
|
64
|
+
* @param performAggregatedSlippageCheck Flag for whether we want to perform an aggregated slippage check
|
|
65
|
+
* @returns A string array of calldatas for the trade.
|
|
66
|
+
*/
|
|
67
|
+
private static encodeV3Swap;
|
|
68
|
+
/**
|
|
69
|
+
* @notice Generates the calldata for a MixedRouteSwap. Since single hop routes are not MixedRoutes, we will instead generate
|
|
70
|
+
* them via the existing encodeV3Swap and encodeV2Swap methods.
|
|
71
|
+
* @param trade The MixedRouteTrade to encode.
|
|
72
|
+
* @param options SwapOptions to use for the trade.
|
|
73
|
+
* @param routerMustCustody Flag for whether funds should be sent to the router
|
|
74
|
+
* @param performAggregatedSlippageCheck Flag for whether we want to perform an aggregated slippage check
|
|
75
|
+
* @returns A string array of calldatas for the trade.
|
|
76
|
+
*/
|
|
77
|
+
private static encodeMixedRouteSwap;
|
|
78
|
+
private static encodeSwaps;
|
|
79
|
+
/**
|
|
80
|
+
* Produces the on-chain method name to call and the hex encoded parameters to pass as arguments for a given trade.
|
|
81
|
+
* @param trades to produce call parameters for
|
|
82
|
+
* @param options options for the call parameters
|
|
83
|
+
*/
|
|
84
|
+
static swapCallParameters(trades: Trade<Currency, Currency, TradeType> | V2Trade<Currency, Currency, TradeType> | V3Trade<Currency, Currency, TradeType> | MixedRouteTrade<Currency, Currency, TradeType> | (V2Trade<Currency, Currency, TradeType> | V3Trade<Currency, Currency, TradeType> | MixedRouteTrade<Currency, Currency, TradeType>)[], options: SwapOptions): MethodParameters;
|
|
85
|
+
/**
|
|
86
|
+
* Produces the on-chain method name to call and the hex encoded parameters to pass as arguments for a given trade.
|
|
87
|
+
* @param trades to produce call parameters for
|
|
88
|
+
* @param options options for the call parameters
|
|
89
|
+
*/
|
|
90
|
+
static swapAndAddCallParameters(trades: AnyTradeType, options: SwapAndAddOptions, position: Position, addLiquidityOptions: CondensedAddLiquidityOptions, tokenInApprovalType: ApprovalTypes, tokenOutApprovalType: ApprovalTypes): MethodParameters;
|
|
91
|
+
private static riskOfPartialFill;
|
|
92
|
+
private static v3TradeWithHighPriceImpact;
|
|
93
|
+
private static getPositionAmounts;
|
|
94
|
+
}
|
|
95
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Currency } from '@uniswap/sdk-core';
|
|
2
|
+
import { MixedRouteSDK } from '../entities/mixedRoute/route';
|
|
3
|
+
/**
|
|
4
|
+
* Converts a route to a hex encoded path
|
|
5
|
+
* @notice only supports exactIn route encodings
|
|
6
|
+
* @param route the mixed path to convert to an encoded path
|
|
7
|
+
* @returns the exactIn encoded path
|
|
8
|
+
*/
|
|
9
|
+
export declare function encodeMixedRouteToPath(route: MixedRouteSDK<Currency, Currency>): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Currency } from '@uniswap/sdk-core';
|
|
2
|
+
import { MixedRouteSDK } from '../entities/mixedRoute/route';
|
|
3
|
+
import { TPool } from './TPool';
|
|
4
|
+
/**
|
|
5
|
+
* Utility function to return each consecutive section of Pools or Pairs in a MixedRoute
|
|
6
|
+
* @param route
|
|
7
|
+
* @returns a nested array of Pools or Pairs in the order of the route
|
|
8
|
+
*/
|
|
9
|
+
export declare const partitionMixedRouteByProtocol: (route: MixedRouteSDK<Currency, Currency>) => TPool[][];
|
|
10
|
+
/**
|
|
11
|
+
* Simple utility function to get the output of an array of Pools or Pairs
|
|
12
|
+
* @param pools
|
|
13
|
+
* @param firstInputToken
|
|
14
|
+
* @returns the output token of the last pool in the array
|
|
15
|
+
*/
|
|
16
|
+
export declare const getOutputOfPools: (pools: TPool[], firstInputToken: Currency) => Currency;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Currency, CurrencyAmount } from '@uniswap/sdk-core';
|
|
2
|
+
import { TPool } from './TPool';
|
|
3
|
+
export declare function amountWithPathCurrency(amount: CurrencyAmount<Currency>, pool: TPool): CurrencyAmount<Currency>;
|
|
4
|
+
export declare function getPathCurrency(currency: Currency, pool: TPool): Currency;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -7,17 +7,22 @@
|
|
|
7
7
|
"ethereum"
|
|
8
8
|
],
|
|
9
9
|
"license": "MIT",
|
|
10
|
-
"main": "dist/index.js",
|
|
11
|
-
"
|
|
10
|
+
"main": "./dist/cjs/src/index.js",
|
|
11
|
+
"module": "./dist/esm/src/index.js",
|
|
12
|
+
"types": "./dist/types/src/index.d.ts",
|
|
12
13
|
"files": [
|
|
13
14
|
"dist"
|
|
14
15
|
],
|
|
15
16
|
"scripts": {
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
17
|
+
"clean": "rm -rf dist",
|
|
18
|
+
"build": "yarn clean && yarn build:cjs && yarn build:esm && yarn build:types",
|
|
19
|
+
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
20
|
+
"build:esm": "tsc -p tsconfig.esm.json",
|
|
21
|
+
"build:types": "tsc -p tsconfig.types.json",
|
|
22
|
+
"lint": "eslint src --ext .ts",
|
|
23
|
+
"lint:fix": "eslint src --ext .ts --fix",
|
|
24
|
+
"test": "jest",
|
|
25
|
+
"release": "semantic-release"
|
|
21
26
|
},
|
|
22
27
|
"dependencies": {
|
|
23
28
|
"@ethersproject/abi": "^5.5.0",
|
|
@@ -29,18 +34,28 @@
|
|
|
29
34
|
},
|
|
30
35
|
"devDependencies": {
|
|
31
36
|
"@types/jest": "^24.0.25",
|
|
37
|
+
"@typescript-eslint/eslint-plugin": "^5.62",
|
|
38
|
+
"@typescript-eslint/parser": "^5.62",
|
|
39
|
+
"eslint": "^7.8.0",
|
|
40
|
+
"eslint-config-prettier": "^6.11.0",
|
|
41
|
+
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
42
|
+
"eslint-plugin-functional": "^3.0.2",
|
|
43
|
+
"eslint-plugin-import": "^2.22.0",
|
|
44
|
+
"jest": "25.5.0",
|
|
32
45
|
"prettier": "^2.4.1",
|
|
33
|
-
"
|
|
34
|
-
},
|
|
35
|
-
"prettier": {
|
|
36
|
-
"printWidth": 120,
|
|
37
|
-
"semi": false,
|
|
38
|
-
"singleQuote": true
|
|
46
|
+
"typescript": "^4.3.3"
|
|
39
47
|
},
|
|
40
48
|
"publishConfig": {
|
|
41
49
|
"access": "public",
|
|
42
50
|
"provenance": true
|
|
43
51
|
},
|
|
52
|
+
"exports": {
|
|
53
|
+
".": {
|
|
54
|
+
"types": "./dist/types/src/index.d.ts",
|
|
55
|
+
"import": "./dist/esm/src/index.js",
|
|
56
|
+
"require": "./dist/cjs/src/index.js"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
44
59
|
"release": {
|
|
45
60
|
"extends": "semantic-release-monorepo",
|
|
46
61
|
"branches": [
|
|
@@ -70,5 +85,5 @@
|
|
|
70
85
|
]
|
|
71
86
|
]
|
|
72
87
|
},
|
|
73
|
-
"version": "
|
|
88
|
+
"version": "2.0.0"
|
|
74
89
|
}
|