@uniswap/router-sdk 1.21.1 → 1.21.3

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.
@@ -701,8 +701,8 @@ var MixedRouteSDK = /*#__PURE__*/function () {
701
701
  var prevPool = pools[i - 1];
702
702
  var pool = pools[i];
703
703
  var inputToken = tokenPath[i];
704
- var outputToken = pool.token0.wrapped.equals(inputToken.wrapped) ? pool.token1 : pool.token0;
705
- !isValidTokenPath(prevPool, pool, inputToken) ? process.env.NODE_ENV !== "production" ? invariant(false, 'PATH') : invariant(false) : void 0;
704
+ var outputToken = pool instanceof Pool ? pool.token0.equals(inputToken) ? pool.token1 : pool.token0 : pool.token0.wrapped.equals(inputToken.wrapped) ? pool.token1 : pool.token0;
705
+ !isValidTokenPath(prevPool, pool, inputToken) ? process.env.NODE_ENV !== "production" ? invariant(false, "PATH") : invariant(false) : void 0;
706
706
  tokenPath.push(outputToken);
707
707
  }
708
708
  this.pools = pools;
@@ -1802,9 +1802,17 @@ function encodeMixedRouteToPath(route) {
1802
1802
  var pool = _step.value;
1803
1803
  var currencyOut = currencyIn.equals(pool.token0) ? pool.token1 : pool.token0;
1804
1804
  if (pool instanceof Pool) {
1805
- var v4Fee = pool.fee + MIXED_QUOTER_V2_V4_FEE_PATH_PLACEHOLDER;
1806
- path.push(v4Fee, pool.tickSpacing, pool.hooks, currencyOut.isNative ? ADDRESS_ZERO : currencyOut.wrapped.address);
1807
- types.push('uint24', 'uint24', 'address', 'address');
1805
+ // a tickSpacing of 0 indicates a "fake" v4 pool where the quote actually requires a wrap or unwrap
1806
+ // the fake v4 pool will always have native as token0 and wrapped native as token1
1807
+ if (pool.tickSpacing === 0) {
1808
+ var wrapOrUnwrapEncoding = 0;
1809
+ path.push(wrapOrUnwrapEncoding, currencyOut.isNative ? ADDRESS_ZERO : currencyOut.wrapped.address);
1810
+ types.push('uint8', 'address');
1811
+ } else {
1812
+ var v4Fee = pool.fee + MIXED_QUOTER_V2_V4_FEE_PATH_PLACEHOLDER;
1813
+ path.push(v4Fee, pool.tickSpacing, pool.hooks, currencyOut.isNative ? ADDRESS_ZERO : currencyOut.wrapped.address);
1814
+ types.push('uint24', 'uint24', 'address', 'address');
1815
+ }
1808
1816
  } else if (pool instanceof Pool$1) {
1809
1817
  var v3Fee = pool.fee + MIXED_QUOTER_V2_V3_FEE_PATH_PLACEHOLDER;
1810
1818
  path.push(v3Fee, currencyOut.wrapped.address);