@uniswap/router-sdk 1.21.2 → 1.21.4

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.
@@ -688,7 +688,7 @@ var MixedRouteSDK = /*#__PURE__*/function () {
688
688
  !pools[0].involvesToken(this.pathInput) ? process.env.NODE_ENV !== "production" ? invariant(false, 'INPUT') : invariant(false) : void 0;
689
689
  var lastPool = pools[pools.length - 1];
690
690
  if (lastPool instanceof Pool) {
691
- !(lastPool.involvesToken(output) || lastPool.involvesToken(output.wrapped)) ? process.env.NODE_ENV !== "production" ? invariant(false, 'OUTPUT') : invariant(false) : void 0;
691
+ !(lastPool.v4InvolvesToken(output) || lastPool.v4InvolvesToken(output.wrapped)) ? process.env.NODE_ENV !== "production" ? invariant(false, 'OUTPUT') : invariant(false) : void 0;
692
692
  } else {
693
693
  !lastPool.involvesToken(output.wrapped) ? process.env.NODE_ENV !== "production" ? invariant(false, 'OUTPUT') : invariant(false) : void 0;
694
694
  }
@@ -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);