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