@ring-protocol/router-sdk 0.1.23 → 0.1.25

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.
@@ -1076,43 +1076,31 @@ var MixedRouteTrade = /*#__PURE__*/function () {
1076
1076
  Protocol["MIXED"] = "MIXED";
1077
1077
  })(exports.Protocol || (exports.Protocol = {}));
1078
1078
 
1079
+ // Helper function to get the pathInput and pathOutput for a V2 / V3 route
1079
1080
  // currency could be native so we check against the wrapped version as they don't support native ETH in path
1080
1081
  function getPathToken(currency, pool) {
1081
- var isSupportFewV2 = currency.chainId !== sdkCore.ChainId.POLYGON;
1082
- if (isSupportFewV2) {
1083
- console.log('isSupportFewV2 16', isSupportFewV2, currency.chainId);
1084
- var fewToken = fewV2Sdk.getFewTokenFromOriginalToken(currency.wrapped, currency.chainId);
1085
- if (pool instanceof fewV2Sdk.Pair || pool instanceof v2Sdk.Pair) {
1086
- if (pool.token0.wrapped.equals(fewToken)) {
1087
- return pool.token0;
1088
- } else if (pool.token1.wrapped.equals(fewToken)) {
1089
- return pool.token1;
1090
- } else if (pool.token0.wrapped.equals(currency.wrapped)) {
1091
- return pool.token0;
1092
- } else if (pool.token1.wrapped.equals(currency.wrapped)) {
1093
- return pool.token1;
1094
- } else {
1095
- throw new Error("Expected fewToken " + currency.symbol + " to be either " + pool.token0.symbol + " or " + pool.token1.symbol);
1096
- }
1082
+ var fewToken = fewV2Sdk.getFewTokenFromOriginalToken(currency.wrapped, currency.chainId);
1083
+ if (pool instanceof fewV2Sdk.Pair || pool instanceof v2Sdk.Pair) {
1084
+ if (pool.token0.wrapped.equals(fewToken)) {
1085
+ return pool.token0;
1086
+ } else if (pool.token1.wrapped.equals(fewToken)) {
1087
+ return pool.token1;
1088
+ } else if (pool.token0.wrapped.equals(currency.wrapped)) {
1089
+ return pool.token0;
1090
+ } else if (pool.token1.wrapped.equals(currency.wrapped)) {
1091
+ return pool.token1;
1097
1092
  } else {
1098
- console.log('isSupportFewV2 33', isSupportFewV2, currency.chainId);
1099
- if (pool.token0.wrapped.equals(currency.wrapped)) {
1100
- return pool.token0;
1101
- } else if (pool.token1.wrapped.equals(currency.wrapped)) {
1102
- return pool.token1;
1103
- } else if (pool.token0.wrapped.equals(fewToken)) {
1104
- return pool.token0;
1105
- } else if (pool.token1.wrapped.equals(fewToken)) {
1106
- return pool.token1;
1107
- } else {
1108
- throw new Error("Expected token " + currency.symbol + " to be either " + pool.token0.symbol + " or " + pool.token1.symbol);
1109
- }
1093
+ throw new Error("Expected fewToken " + currency.symbol + " to be either " + pool.token0.symbol + " or " + pool.token1.symbol);
1110
1094
  }
1111
1095
  } else {
1112
1096
  if (pool.token0.wrapped.equals(currency.wrapped)) {
1113
1097
  return pool.token0;
1114
1098
  } else if (pool.token1.wrapped.equals(currency.wrapped)) {
1115
1099
  return pool.token1;
1100
+ } else if (pool.token0.wrapped.equals(fewToken)) {
1101
+ return pool.token0;
1102
+ } else if (pool.token1.wrapped.equals(fewToken)) {
1103
+ return pool.token1;
1116
1104
  } else {
1117
1105
  throw new Error("Expected token " + currency.symbol + " to be either " + pool.token0.symbol + " or " + pool.token1.symbol);
1118
1106
  }
@@ -1332,7 +1320,7 @@ var Trade = /*#__PURE__*/function () {
1332
1320
  if (amountOut === void 0) {
1333
1321
  amountOut = this.outputAmount;
1334
1322
  }
1335
- !!slippageTolerance.lessThan(ZERO) ? invariant(false, 'SLIPPAGE_TOLERANCE') : void 0;
1323
+ !!slippageTolerance.lessThan(0) ? invariant(false, 'SLIPPAGE_TOLERANCE') : void 0;
1336
1324
  if (this.tradeType === sdkCore.TradeType.EXACT_OUTPUT) {
1337
1325
  return amountOut;
1338
1326
  } else {
@@ -1349,7 +1337,7 @@ var Trade = /*#__PURE__*/function () {
1349
1337
  if (amountIn === void 0) {
1350
1338
  amountIn = this.inputAmount;
1351
1339
  }
1352
- !!slippageTolerance.lessThan(ZERO) ? invariant(false, 'SLIPPAGE_TOLERANCE') : void 0;
1340
+ !!slippageTolerance.lessThan(0) ? invariant(false, 'SLIPPAGE_TOLERANCE') : void 0;
1353
1341
  if (this.tradeType === sdkCore.TradeType.EXACT_INPUT) {
1354
1342
  return amountIn;
1355
1343
  } else {