@uniswap/router-sdk 2.9.0 → 2.10.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.
@@ -19,32 +19,32 @@ export declare class Trade<TInput extends Currency, TOutput extends Currency, TT
19
19
  route: IRoute<TInput, TOutput, Pair | V3Pool | V4Pool>;
20
20
  inputAmount: CurrencyAmount<TInput>;
21
21
  outputAmount: CurrencyAmount<TOutput>;
22
- maxHopSlippage?: bigint[];
22
+ minHopPriceX36?: bigint[];
23
23
  }[];
24
24
  constructor({ v2Routes, v3Routes, v4Routes, mixedRoutes, tradeType, }: {
25
25
  v2Routes?: {
26
26
  routev2: V2RouteSDK<TInput, TOutput>;
27
27
  inputAmount: CurrencyAmount<TInput>;
28
28
  outputAmount: CurrencyAmount<TOutput>;
29
- maxHopSlippage?: bigint[];
29
+ minHopPriceX36?: bigint[];
30
30
  }[];
31
31
  v3Routes?: {
32
32
  routev3: V3RouteSDK<TInput, TOutput>;
33
33
  inputAmount: CurrencyAmount<TInput>;
34
34
  outputAmount: CurrencyAmount<TOutput>;
35
- maxHopSlippage?: bigint[];
35
+ minHopPriceX36?: bigint[];
36
36
  }[];
37
37
  v4Routes?: {
38
38
  routev4: V4RouteSDK<TInput, TOutput>;
39
39
  inputAmount: CurrencyAmount<TInput>;
40
40
  outputAmount: CurrencyAmount<TOutput>;
41
- maxHopSlippage?: bigint[];
41
+ minHopPriceX36?: bigint[];
42
42
  }[];
43
43
  mixedRoutes?: {
44
44
  mixedRoute: MixedRouteSDK<TInput, TOutput>;
45
45
  inputAmount: CurrencyAmount<TInput>;
46
46
  outputAmount: CurrencyAmount<TOutput>;
47
- maxHopSlippage?: bigint[];
47
+ minHopPriceX36?: bigint[];
48
48
  }[];
49
49
  tradeType: TTradeType;
50
50
  });
@@ -118,19 +118,19 @@ export declare class Trade<TInput extends Currency, TOutput extends Currency, TT
118
118
  static fromRoutes<TInput extends Currency, TOutput extends Currency, TTradeType extends TradeType>(v2Routes: {
119
119
  routev2: V2RouteSDK<TInput, TOutput>;
120
120
  amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>;
121
- maxHopSlippage?: bigint[];
121
+ minHopPriceX36?: bigint[];
122
122
  }[], v3Routes: {
123
123
  routev3: V3RouteSDK<TInput, TOutput>;
124
124
  amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>;
125
- maxHopSlippage?: bigint[];
125
+ minHopPriceX36?: bigint[];
126
126
  }[], tradeType: TTradeType, mixedRoutes?: {
127
127
  mixedRoute: MixedRouteSDK<TInput, TOutput>;
128
128
  amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>;
129
- maxHopSlippage?: bigint[];
129
+ minHopPriceX36?: bigint[];
130
130
  }[], v4Routes?: {
131
131
  routev4: V4RouteSDK<TInput, TOutput>;
132
132
  amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>;
133
- maxHopSlippage?: bigint[];
133
+ minHopPriceX36?: bigint[];
134
134
  }[]): Promise<Trade<TInput, TOutput, TTradeType>>;
135
135
  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>>;
136
136
  }
@@ -17,46 +17,46 @@ class Trade {
17
17
  this.swaps = [];
18
18
  this.routes = [];
19
19
  // wrap v2 routes
20
- for (const { routev2, inputAmount, outputAmount, maxHopSlippage } of v2Routes) {
20
+ for (const { routev2, inputAmount, outputAmount, minHopPriceX36 } of v2Routes) {
21
21
  const route = new route_2.RouteV2(routev2);
22
22
  this.routes.push(route);
23
23
  this.swaps.push({
24
24
  route,
25
25
  inputAmount,
26
26
  outputAmount,
27
- maxHopSlippage,
27
+ minHopPriceX36,
28
28
  });
29
29
  }
30
30
  // wrap v3 routes
31
- for (const { routev3, inputAmount, outputAmount, maxHopSlippage } of v3Routes) {
31
+ for (const { routev3, inputAmount, outputAmount, minHopPriceX36 } of v3Routes) {
32
32
  const route = new route_2.RouteV3(routev3);
33
33
  this.routes.push(route);
34
34
  this.swaps.push({
35
35
  route,
36
36
  inputAmount,
37
37
  outputAmount,
38
- maxHopSlippage,
38
+ minHopPriceX36,
39
39
  });
40
40
  }
41
41
  // wrap v4 routes
42
- for (const { routev4, inputAmount, outputAmount, maxHopSlippage } of v4Routes) {
42
+ for (const { routev4, inputAmount, outputAmount, minHopPriceX36 } of v4Routes) {
43
43
  const route = new route_2.RouteV4(routev4);
44
44
  this.routes.push(route);
45
45
  this.swaps.push({
46
46
  route,
47
47
  inputAmount,
48
48
  outputAmount,
49
- maxHopSlippage,
49
+ minHopPriceX36,
50
50
  });
51
51
  }
52
- for (const { mixedRoute, inputAmount, outputAmount, maxHopSlippage } of mixedRoutes) {
52
+ for (const { mixedRoute, inputAmount, outputAmount, minHopPriceX36 } of mixedRoutes) {
53
53
  const route = new route_2.MixedRoute(mixedRoute);
54
54
  this.routes.push(route);
55
55
  this.swaps.push({
56
56
  route,
57
57
  inputAmount,
58
58
  outputAmount,
59
- maxHopSlippage,
59
+ minHopPriceX36,
60
60
  });
61
61
  }
62
62
  if (this.swaps.length === 0) {
@@ -277,47 +277,47 @@ class Trade {
277
277
  const populatedV3Routes = [];
278
278
  const populatedV4Routes = [];
279
279
  const populatedMixedRoutes = [];
280
- for (const { routev2, amount, maxHopSlippage } of v2Routes) {
280
+ for (const { routev2, amount, minHopPriceX36 } of v2Routes) {
281
281
  const v2Trade = new v2_sdk_1.Trade(routev2, amount, tradeType);
282
282
  const { inputAmount, outputAmount } = v2Trade;
283
283
  populatedV2Routes.push({
284
284
  routev2,
285
285
  inputAmount,
286
286
  outputAmount,
287
- maxHopSlippage,
287
+ minHopPriceX36,
288
288
  });
289
289
  }
290
- for (const { routev3, amount, maxHopSlippage } of v3Routes) {
290
+ for (const { routev3, amount, minHopPriceX36 } of v3Routes) {
291
291
  const v3Trade = await v3_sdk_1.Trade.fromRoute(routev3, amount, tradeType);
292
292
  const { inputAmount, outputAmount } = v3Trade;
293
293
  populatedV3Routes.push({
294
294
  routev3,
295
295
  inputAmount,
296
296
  outputAmount,
297
- maxHopSlippage,
297
+ minHopPriceX36,
298
298
  });
299
299
  }
300
300
  if (v4Routes) {
301
- for (const { routev4, amount, maxHopSlippage } of v4Routes) {
301
+ for (const { routev4, amount, minHopPriceX36 } of v4Routes) {
302
302
  const v4Trade = await v4_sdk_1.Trade.fromRoute(routev4, amount, tradeType);
303
303
  const { inputAmount, outputAmount } = v4Trade;
304
304
  populatedV4Routes.push({
305
305
  routev4,
306
306
  inputAmount,
307
307
  outputAmount,
308
- maxHopSlippage,
308
+ minHopPriceX36,
309
309
  });
310
310
  }
311
311
  }
312
312
  if (mixedRoutes) {
313
- for (const { mixedRoute, amount, maxHopSlippage } of mixedRoutes) {
313
+ for (const { mixedRoute, amount, minHopPriceX36 } of mixedRoutes) {
314
314
  const mixedRouteTrade = await trade_1.MixedRouteTrade.fromRoute(mixedRoute, amount, tradeType);
315
315
  const { inputAmount, outputAmount } = mixedRouteTrade;
316
316
  populatedMixedRoutes.push({
317
317
  mixedRoute,
318
318
  inputAmount,
319
319
  outputAmount,
320
- maxHopSlippage,
320
+ minHopPriceX36,
321
321
  });
322
322
  }
323
323
  }
@@ -19,32 +19,32 @@ export declare class Trade<TInput extends Currency, TOutput extends Currency, TT
19
19
  route: IRoute<TInput, TOutput, Pair | V3Pool | V4Pool>;
20
20
  inputAmount: CurrencyAmount<TInput>;
21
21
  outputAmount: CurrencyAmount<TOutput>;
22
- maxHopSlippage?: bigint[];
22
+ minHopPriceX36?: bigint[];
23
23
  }[];
24
24
  constructor({ v2Routes, v3Routes, v4Routes, mixedRoutes, tradeType, }: {
25
25
  v2Routes?: {
26
26
  routev2: V2RouteSDK<TInput, TOutput>;
27
27
  inputAmount: CurrencyAmount<TInput>;
28
28
  outputAmount: CurrencyAmount<TOutput>;
29
- maxHopSlippage?: bigint[];
29
+ minHopPriceX36?: bigint[];
30
30
  }[];
31
31
  v3Routes?: {
32
32
  routev3: V3RouteSDK<TInput, TOutput>;
33
33
  inputAmount: CurrencyAmount<TInput>;
34
34
  outputAmount: CurrencyAmount<TOutput>;
35
- maxHopSlippage?: bigint[];
35
+ minHopPriceX36?: bigint[];
36
36
  }[];
37
37
  v4Routes?: {
38
38
  routev4: V4RouteSDK<TInput, TOutput>;
39
39
  inputAmount: CurrencyAmount<TInput>;
40
40
  outputAmount: CurrencyAmount<TOutput>;
41
- maxHopSlippage?: bigint[];
41
+ minHopPriceX36?: bigint[];
42
42
  }[];
43
43
  mixedRoutes?: {
44
44
  mixedRoute: MixedRouteSDK<TInput, TOutput>;
45
45
  inputAmount: CurrencyAmount<TInput>;
46
46
  outputAmount: CurrencyAmount<TOutput>;
47
- maxHopSlippage?: bigint[];
47
+ minHopPriceX36?: bigint[];
48
48
  }[];
49
49
  tradeType: TTradeType;
50
50
  });
@@ -118,19 +118,19 @@ export declare class Trade<TInput extends Currency, TOutput extends Currency, TT
118
118
  static fromRoutes<TInput extends Currency, TOutput extends Currency, TTradeType extends TradeType>(v2Routes: {
119
119
  routev2: V2RouteSDK<TInput, TOutput>;
120
120
  amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>;
121
- maxHopSlippage?: bigint[];
121
+ minHopPriceX36?: bigint[];
122
122
  }[], v3Routes: {
123
123
  routev3: V3RouteSDK<TInput, TOutput>;
124
124
  amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>;
125
- maxHopSlippage?: bigint[];
125
+ minHopPriceX36?: bigint[];
126
126
  }[], tradeType: TTradeType, mixedRoutes?: {
127
127
  mixedRoute: MixedRouteSDK<TInput, TOutput>;
128
128
  amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>;
129
- maxHopSlippage?: bigint[];
129
+ minHopPriceX36?: bigint[];
130
130
  }[], v4Routes?: {
131
131
  routev4: V4RouteSDK<TInput, TOutput>;
132
132
  amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>;
133
- maxHopSlippage?: bigint[];
133
+ minHopPriceX36?: bigint[];
134
134
  }[]): Promise<Trade<TInput, TOutput, TTradeType>>;
135
135
  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>>;
136
136
  }
@@ -13,46 +13,46 @@ export class Trade {
13
13
  this.swaps = [];
14
14
  this.routes = [];
15
15
  // wrap v2 routes
16
- for (const { routev2, inputAmount, outputAmount, maxHopSlippage } of v2Routes) {
16
+ for (const { routev2, inputAmount, outputAmount, minHopPriceX36 } of v2Routes) {
17
17
  const route = new RouteV2(routev2);
18
18
  this.routes.push(route);
19
19
  this.swaps.push({
20
20
  route,
21
21
  inputAmount,
22
22
  outputAmount,
23
- maxHopSlippage,
23
+ minHopPriceX36,
24
24
  });
25
25
  }
26
26
  // wrap v3 routes
27
- for (const { routev3, inputAmount, outputAmount, maxHopSlippage } of v3Routes) {
27
+ for (const { routev3, inputAmount, outputAmount, minHopPriceX36 } of v3Routes) {
28
28
  const route = new RouteV3(routev3);
29
29
  this.routes.push(route);
30
30
  this.swaps.push({
31
31
  route,
32
32
  inputAmount,
33
33
  outputAmount,
34
- maxHopSlippage,
34
+ minHopPriceX36,
35
35
  });
36
36
  }
37
37
  // wrap v4 routes
38
- for (const { routev4, inputAmount, outputAmount, maxHopSlippage } of v4Routes) {
38
+ for (const { routev4, inputAmount, outputAmount, minHopPriceX36 } of v4Routes) {
39
39
  const route = new RouteV4(routev4);
40
40
  this.routes.push(route);
41
41
  this.swaps.push({
42
42
  route,
43
43
  inputAmount,
44
44
  outputAmount,
45
- maxHopSlippage,
45
+ minHopPriceX36,
46
46
  });
47
47
  }
48
- for (const { mixedRoute, inputAmount, outputAmount, maxHopSlippage } of mixedRoutes) {
48
+ for (const { mixedRoute, inputAmount, outputAmount, minHopPriceX36 } of mixedRoutes) {
49
49
  const route = new MixedRoute(mixedRoute);
50
50
  this.routes.push(route);
51
51
  this.swaps.push({
52
52
  route,
53
53
  inputAmount,
54
54
  outputAmount,
55
- maxHopSlippage,
55
+ minHopPriceX36,
56
56
  });
57
57
  }
58
58
  if (this.swaps.length === 0) {
@@ -273,47 +273,47 @@ export class Trade {
273
273
  const populatedV3Routes = [];
274
274
  const populatedV4Routes = [];
275
275
  const populatedMixedRoutes = [];
276
- for (const { routev2, amount, maxHopSlippage } of v2Routes) {
276
+ for (const { routev2, amount, minHopPriceX36 } of v2Routes) {
277
277
  const v2Trade = new V2TradeSDK(routev2, amount, tradeType);
278
278
  const { inputAmount, outputAmount } = v2Trade;
279
279
  populatedV2Routes.push({
280
280
  routev2,
281
281
  inputAmount,
282
282
  outputAmount,
283
- maxHopSlippage,
283
+ minHopPriceX36,
284
284
  });
285
285
  }
286
- for (const { routev3, amount, maxHopSlippage } of v3Routes) {
286
+ for (const { routev3, amount, minHopPriceX36 } of v3Routes) {
287
287
  const v3Trade = await V3TradeSDK.fromRoute(routev3, amount, tradeType);
288
288
  const { inputAmount, outputAmount } = v3Trade;
289
289
  populatedV3Routes.push({
290
290
  routev3,
291
291
  inputAmount,
292
292
  outputAmount,
293
- maxHopSlippage,
293
+ minHopPriceX36,
294
294
  });
295
295
  }
296
296
  if (v4Routes) {
297
- for (const { routev4, amount, maxHopSlippage } of v4Routes) {
297
+ for (const { routev4, amount, minHopPriceX36 } of v4Routes) {
298
298
  const v4Trade = await V4TradeSDK.fromRoute(routev4, amount, tradeType);
299
299
  const { inputAmount, outputAmount } = v4Trade;
300
300
  populatedV4Routes.push({
301
301
  routev4,
302
302
  inputAmount,
303
303
  outputAmount,
304
- maxHopSlippage,
304
+ minHopPriceX36,
305
305
  });
306
306
  }
307
307
  }
308
308
  if (mixedRoutes) {
309
- for (const { mixedRoute, amount, maxHopSlippage } of mixedRoutes) {
309
+ for (const { mixedRoute, amount, minHopPriceX36 } of mixedRoutes) {
310
310
  const mixedRouteTrade = await MixedRouteTradeSDK.fromRoute(mixedRoute, amount, tradeType);
311
311
  const { inputAmount, outputAmount } = mixedRouteTrade;
312
312
  populatedMixedRoutes.push({
313
313
  mixedRoute,
314
314
  inputAmount,
315
315
  outputAmount,
316
- maxHopSlippage,
316
+ minHopPriceX36,
317
317
  });
318
318
  }
319
319
  }
@@ -19,32 +19,32 @@ export declare class Trade<TInput extends Currency, TOutput extends Currency, TT
19
19
  route: IRoute<TInput, TOutput, Pair | V3Pool | V4Pool>;
20
20
  inputAmount: CurrencyAmount<TInput>;
21
21
  outputAmount: CurrencyAmount<TOutput>;
22
- maxHopSlippage?: bigint[];
22
+ minHopPriceX36?: bigint[];
23
23
  }[];
24
24
  constructor({ v2Routes, v3Routes, v4Routes, mixedRoutes, tradeType, }: {
25
25
  v2Routes?: {
26
26
  routev2: V2RouteSDK<TInput, TOutput>;
27
27
  inputAmount: CurrencyAmount<TInput>;
28
28
  outputAmount: CurrencyAmount<TOutput>;
29
- maxHopSlippage?: bigint[];
29
+ minHopPriceX36?: bigint[];
30
30
  }[];
31
31
  v3Routes?: {
32
32
  routev3: V3RouteSDK<TInput, TOutput>;
33
33
  inputAmount: CurrencyAmount<TInput>;
34
34
  outputAmount: CurrencyAmount<TOutput>;
35
- maxHopSlippage?: bigint[];
35
+ minHopPriceX36?: bigint[];
36
36
  }[];
37
37
  v4Routes?: {
38
38
  routev4: V4RouteSDK<TInput, TOutput>;
39
39
  inputAmount: CurrencyAmount<TInput>;
40
40
  outputAmount: CurrencyAmount<TOutput>;
41
- maxHopSlippage?: bigint[];
41
+ minHopPriceX36?: bigint[];
42
42
  }[];
43
43
  mixedRoutes?: {
44
44
  mixedRoute: MixedRouteSDK<TInput, TOutput>;
45
45
  inputAmount: CurrencyAmount<TInput>;
46
46
  outputAmount: CurrencyAmount<TOutput>;
47
- maxHopSlippage?: bigint[];
47
+ minHopPriceX36?: bigint[];
48
48
  }[];
49
49
  tradeType: TTradeType;
50
50
  });
@@ -118,19 +118,19 @@ export declare class Trade<TInput extends Currency, TOutput extends Currency, TT
118
118
  static fromRoutes<TInput extends Currency, TOutput extends Currency, TTradeType extends TradeType>(v2Routes: {
119
119
  routev2: V2RouteSDK<TInput, TOutput>;
120
120
  amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>;
121
- maxHopSlippage?: bigint[];
121
+ minHopPriceX36?: bigint[];
122
122
  }[], v3Routes: {
123
123
  routev3: V3RouteSDK<TInput, TOutput>;
124
124
  amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>;
125
- maxHopSlippage?: bigint[];
125
+ minHopPriceX36?: bigint[];
126
126
  }[], tradeType: TTradeType, mixedRoutes?: {
127
127
  mixedRoute: MixedRouteSDK<TInput, TOutput>;
128
128
  amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>;
129
- maxHopSlippage?: bigint[];
129
+ minHopPriceX36?: bigint[];
130
130
  }[], v4Routes?: {
131
131
  routev4: V4RouteSDK<TInput, TOutput>;
132
132
  amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>;
133
- maxHopSlippage?: bigint[];
133
+ minHopPriceX36?: bigint[];
134
134
  }[]): Promise<Trade<TInput, TOutput, TTradeType>>;
135
135
  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>>;
136
136
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniswap/router-sdk",
3
- "version": "2.9.0",
3
+ "version": "2.10.0",
4
4
  "description": "An sdk for routing swaps using Uniswap v2 and Uniswap v3.",
5
5
  "repository": "https://github.com/Uniswap/sdks.git",
6
6
  "keywords": [
@@ -39,7 +39,7 @@
39
39
  "@uniswap/swap-router-contracts": "^1.3.0",
40
40
  "@uniswap/v2-sdk": "^4.20.0",
41
41
  "@uniswap/v3-sdk": "^3.30.0",
42
- "@uniswap/v4-sdk": "^2.0.0",
42
+ "@uniswap/v4-sdk": "^2.1.0",
43
43
  "jsbi": "^3.1.4",
44
44
  "tiny-invariant": "^1.1.0",
45
45
  "tslib": "^2.3.0"