@uniswap/universal-router-sdk 2.2.3 → 2.2.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.
@@ -414,12 +414,12 @@ function addV2Swap(planner, _ref, tradeType, options, payerIsUser, routerMustCus
414
414
  if (tradeType == sdkCore.TradeType.EXACT_INPUT) {
415
415
  planner.addCommand(exports.CommandType.V2_SWAP_EXACT_IN, [
416
416
  // if native, we have to unwrap so keep in the router for now
417
- routerMustCustody ? ROUTER_AS_RECIPIENT : options.recipient, trade.maximumAmountIn(options.slippageTolerance).quotient.toString(), trade.minimumAmountOut(options.slippageTolerance).quotient.toString(), route.path.map(function (pool) {
418
- return pool.address;
417
+ routerMustCustody ? ROUTER_AS_RECIPIENT : options.recipient, trade.maximumAmountIn(options.slippageTolerance).quotient.toString(), trade.minimumAmountOut(options.slippageTolerance).quotient.toString(), route.path.map(function (token) {
418
+ return token.wrapped.address;
419
419
  }), payerIsUser]);
420
420
  } else if (tradeType == sdkCore.TradeType.EXACT_OUTPUT) {
421
- planner.addCommand(exports.CommandType.V2_SWAP_EXACT_OUT, [routerMustCustody ? ROUTER_AS_RECIPIENT : options.recipient, trade.minimumAmountOut(options.slippageTolerance).quotient.toString(), trade.maximumAmountIn(options.slippageTolerance).quotient.toString(), route.path.map(function (pool) {
422
- return pool.address;
421
+ planner.addCommand(exports.CommandType.V2_SWAP_EXACT_OUT, [routerMustCustody ? ROUTER_AS_RECIPIENT : options.recipient, trade.minimumAmountOut(options.slippageTolerance).quotient.toString(), trade.maximumAmountIn(options.slippageTolerance).quotient.toString(), route.path.map(function (token) {
422
+ return token.wrapped.address;
423
423
  }), payerIsUser]);
424
424
  }
425
425
  }
@@ -480,7 +480,7 @@ function addMixedSwap(planner, swap, tradeType, options, payerIsUser, routerMust
480
480
  var newRouteOriginal = new routerSdk.MixedRouteSDK([].concat(section), section[0].token0.equals(inputToken) ? section[0].token0 : section[0].token1, outputToken);
481
481
  var newRoute = new routerSdk.MixedRoute(newRouteOriginal);
482
482
  /// Previous output is now input
483
- inputToken = outputToken;
483
+ inputToken = outputToken.wrapped;
484
484
  var mixedRouteIsAllV3 = function mixedRouteIsAllV3(route) {
485
485
  return route.pools.every(function (pool) {
486
486
  return pool instanceof v3Sdk.Pool;
@@ -493,8 +493,8 @@ function addMixedSwap(planner, swap, tradeType, options, payerIsUser, routerMust
493
493
  // note: because of the partitioning function we can be sure that the next section is v2
494
494
  isLastSectionInRoute(i) ? tradeRecipient : sections[i + 1][0].liquidityToken.address, i == 0 ? amountIn : CONTRACT_BALANCE, !isLastSectionInRoute(i) ? 0 : amountOut, path, payerIsUser && i === 0]);
495
495
  } else {
496
- planner.addCommand(exports.CommandType.V2_SWAP_EXACT_IN, [isLastSectionInRoute(i) ? tradeRecipient : ROUTER_AS_RECIPIENT, i === 0 ? amountIn : CONTRACT_BALANCE, !isLastSectionInRoute(i) ? 0 : amountOut, newRoute.path.map(function (pool) {
497
- return pool.address;
496
+ planner.addCommand(exports.CommandType.V2_SWAP_EXACT_IN, [isLastSectionInRoute(i) ? tradeRecipient : ROUTER_AS_RECIPIENT, i === 0 ? amountIn : CONTRACT_BALANCE, !isLastSectionInRoute(i) ? 0 : amountOut, newRoute.path.map(function (token) {
497
+ return token.wrapped.address;
498
498
  }), payerIsUser && i === 0]);
499
499
  }
500
500
  }
@@ -10654,6 +10654,8 @@ var RouterTradeAdapter = /*#__PURE__*/function () {
10654
10654
  outputAmount: route.outputAmount
10655
10655
  };
10656
10656
  }),
10657
+ // TODO: ROUTE-219 - Support v4 trade in universal-router sdk
10658
+ v4Routes: [],
10657
10659
  mixedRoutes: typedRoutes.filter(function (route) {
10658
10660
  return route.mixedRoute;
10659
10661
  }).map(function (route) {