@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.
@@ -693,7 +693,7 @@ var MixedRouteSDK = /*#__PURE__*/function () {
693
693
  !pools[0].involvesToken(this.pathInput) ? invariant(false, 'INPUT') : void 0;
694
694
  var lastPool = pools[pools.length - 1];
695
695
  if (lastPool instanceof v4Sdk.Pool) {
696
- !(lastPool.involvesToken(output) || lastPool.involvesToken(output.wrapped)) ? invariant(false, 'OUTPUT') : void 0;
696
+ !(lastPool.v4InvolvesToken(output) || lastPool.v4InvolvesToken(output.wrapped)) ? invariant(false, 'OUTPUT') : void 0;
697
697
  } else {
698
698
  !lastPool.involvesToken(output.wrapped) ? invariant(false, 'OUTPUT') : void 0;
699
699
  }
@@ -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);