@ring-protocol/router-sdk 0.1.21 → 0.1.23

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,31 +1076,43 @@ 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
1080
1079
  // currency could be native so we check against the wrapped version as they don't support native ETH in path
1081
1080
  function getPathToken(currency, pool) {
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;
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
+ }
1092
1097
  } else {
1093
- throw new Error("Expected fewToken " + currency.symbol + " to be either " + pool.token0.symbol + " or " + pool.token1.symbol);
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
+ }
1094
1110
  }
1095
1111
  } else {
1096
1112
  if (pool.token0.wrapped.equals(currency.wrapped)) {
1097
1113
  return pool.token0;
1098
1114
  } else if (pool.token1.wrapped.equals(currency.wrapped)) {
1099
1115
  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;
1104
1116
  } else {
1105
1117
  throw new Error("Expected token " + currency.symbol + " to be either " + pool.token0.symbol + " or " + pool.token1.symbol);
1106
1118
  }