@synthra-swap/smart-order-router 3.15.4 → 3.15.6

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.
@@ -1,4 +1,4 @@
1
- import { MixedRouteSDK, Protocol, SwapRouter as SwapRouter02, Trade, } from '@uniswap/router-sdk';
1
+ import { MixedRouteSDK, Protocol, SwapRouter as SwapRouter02, Trade } from '@uniswap/router-sdk';
2
2
  import { Route as V2RouteRaw } from '@uniswap/v2-sdk';
3
3
  import { Route as V3RouteRaw } from '@uniswap/v3-sdk';
4
4
  import { TradeType } from '@synthra-swap/sdk-core';
@@ -6,12 +6,20 @@ import { SwapRouter as UniveralRouter, UNIVERSAL_ROUTER_ADDRESS, } from '@synthr
6
6
  import _ from 'lodash';
7
7
  import { CurrencyAmount, SwapType, SWAP_ROUTER_02_ADDRESSES, } from '..';
8
8
  export function buildTrade(tokenInCurrency, tokenOutCurrency, tradeType, routeAmounts) {
9
+ console.log("entrato in buildTrade inputs:", tokenInCurrency, tokenOutCurrency, tradeType, routeAmounts);
9
10
  /// Removed partition because of new mixedRoutes
10
11
  const v3RouteAmounts = _.filter(routeAmounts, (routeAmount) => routeAmount.protocol === Protocol.V3);
11
12
  const v2RouteAmounts = _.filter(routeAmounts, (routeAmount) => routeAmount.protocol === Protocol.V2);
12
13
  const mixedRouteAmounts = _.filter(routeAmounts, (routeAmount) => routeAmount.protocol === Protocol.MIXED);
14
+ console.log("v3RouteAmounts", v3RouteAmounts);
15
+ console.log("v2RouteAmounts", v2RouteAmounts);
16
+ console.log("mixedRouteAmounts", mixedRouteAmounts);
13
17
  const v3Routes = _.map(v3RouteAmounts, (routeAmount) => {
14
18
  const { route, amount, quote } = routeAmount;
19
+ console.log("routeAmount", routeAmount);
20
+ console.log("route", route);
21
+ console.log("amount", amount);
22
+ console.log("quote", quote);
15
23
  // The route, amount and quote are all in terms of wrapped tokens.
16
24
  // When constructing the Trade object the inputAmount/outputAmount must
17
25
  // use native currencies if specified by the user. This is so that the Trade knows to wrap/unwrap.
@@ -19,6 +27,9 @@ export function buildTrade(tokenInCurrency, tokenOutCurrency, tradeType, routeAm
19
27
  const amountCurrency = CurrencyAmount.fromFractionalAmount(tokenInCurrency, amount.numerator, amount.denominator);
20
28
  const quoteCurrency = CurrencyAmount.fromFractionalAmount(tokenOutCurrency, quote.numerator, quote.denominator);
21
29
  const routeRaw = new V3RouteRaw(route.pools, amountCurrency.currency, quoteCurrency.currency);
30
+ console.log("routeRaw", routeRaw);
31
+ console.log("amountCurrency", amountCurrency);
32
+ console.log("quoteCurrency", quoteCurrency);
22
33
  return {
23
34
  routev3: routeRaw,
24
35
  inputAmount: amountCurrency,
@@ -29,6 +40,9 @@ export function buildTrade(tokenInCurrency, tokenOutCurrency, tradeType, routeAm
29
40
  const quoteCurrency = CurrencyAmount.fromFractionalAmount(tokenInCurrency, quote.numerator, quote.denominator);
30
41
  const amountCurrency = CurrencyAmount.fromFractionalAmount(tokenOutCurrency, amount.numerator, amount.denominator);
31
42
  const routeCurrency = new V3RouteRaw(route.pools, quoteCurrency.currency, amountCurrency.currency);
43
+ console.log("routeCurrency", routeCurrency);
44
+ console.log("quoteCurrency", quoteCurrency);
45
+ console.log("amountCurrency", amountCurrency);
32
46
  return {
33
47
  routev3: routeCurrency,
34
48
  inputAmount: quoteCurrency,
@@ -62,8 +76,15 @@ export function buildTrade(tokenInCurrency, tokenOutCurrency, tradeType, routeAm
62
76
  };
63
77
  }
64
78
  });
79
+
80
+ console.log("v3Routes", v3Routes);
81
+ console.log("v2Routes", v2Routes);
65
82
  const mixedRoutes = _.map(mixedRouteAmounts, (routeAmount) => {
66
83
  const { route, amount, quote } = routeAmount;
84
+ console.log("routeAmount", routeAmount);
85
+ console.log("route", route);
86
+ console.log("amount", amount);
87
+ console.log("quote", quote);
67
88
  if (tradeType != TradeType.EXACT_INPUT) {
68
89
  throw new Error('Mixed routes are only supported for exact input trades');
69
90
  }
@@ -73,6 +94,9 @@ export function buildTrade(tokenInCurrency, tokenOutCurrency, tradeType, routeAm
73
94
  const amountCurrency = CurrencyAmount.fromFractionalAmount(tokenInCurrency, amount.numerator, amount.denominator);
74
95
  const quoteCurrency = CurrencyAmount.fromFractionalAmount(tokenOutCurrency, quote.numerator, quote.denominator);
75
96
  const routeRaw = new MixedRouteSDK(route.pools, amountCurrency.currency, quoteCurrency.currency);
97
+ console.log("routeRaw", routeRaw);
98
+ console.log("amountCurrency", amountCurrency);
99
+ console.log("quoteCurrency", quoteCurrency);
76
100
  return {
77
101
  mixedRoute: routeRaw,
78
102
  inputAmount: amountCurrency,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synthra-swap/smart-order-router",
3
- "version": "3.15.4",
3
+ "version": "3.15.6",
4
4
  "description": "Uniswap Smart Order Router",
5
5
  "main": "build/main/index.js",
6
6
  "typings": "build/main/index.d.ts",
@@ -32,7 +32,7 @@
32
32
  "@synthra-swap/v3-sdk": "^3.11.0",
33
33
  "@uniswap/default-token-list": "^11.2.0",
34
34
  "@uniswap/permit2-sdk": "^1.2.0",
35
- "@uniswap/router-sdk": "^1.6.0",
35
+ "@uniswap/router-sdk": "1.6.0",
36
36
  "@uniswap/sdk-core": "^4.0.6",
37
37
  "@uniswap/swap-router-contracts": "^1.3.0",
38
38
  "@uniswap/token-lists": "^1.0.0-beta.31",
@@ -116,4 +116,4 @@
116
116
  "oclif": {
117
117
  "commands": "./cli/commands"
118
118
  }
119
- }
119
+ }