@synthra-swap/smart-order-router 3.15.3 → 3.15.5

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.
@@ -81,7 +81,7 @@ export const USDC_MOONBEAM = new Token(ChainId.MOONBEAM, '0x818ec0A7Fe18Ff942699
81
81
  export const WGLMR_MOONBEAM = new Token(ChainId.MOONBEAM, '0xAcc15dC74880C9944775448304B263D191c6077F', 18, 'WGLMR', 'Wrapped GLMR');
82
82
  export const DAI_MOONBEAM = new Token(ChainId.MOONBEAM, '0x818ec0A7Fe18Ff94269904fCED6AE3DaE6d6dC0b', 6, 'DAI', 'Dai on moonbeam bridged using Multichain');
83
83
  export const WBTC_MOONBEAM = new Token(ChainId.MOONBEAM, '0x922D641a426DcFFaeF11680e5358F34d97d112E1', 8, 'WBTC', 'Wrapped BTC bridged using Multichain');
84
- export const USDC_UOMI = new Token(ChainId.UOMI, '0xF1815bd50389c46847f0Bda824eC8da914045D14', 18, 'USDC', 'USDC');
84
+ export const USDC_UOMI = new Token(ChainId.UOMI, '0xAA9C4829415BCe70c434b7349b628017C59EC2b1', 18, 'USDC', 'USDC');
85
85
 
86
86
  export class TokenProvider {
87
87
  constructor(chainId, multicall2Provider) {
@@ -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.3",
3
+ "version": "3.15.5",
4
4
  "description": "Uniswap Smart Order Router",
5
5
  "main": "build/main/index.js",
6
6
  "typings": "build/main/index.d.ts",