@sodax/dapp-kit 1.5.4-beta → 1.5.6-beta

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.
package/dist/index.js CHANGED
@@ -2303,24 +2303,29 @@ function createSupplyLiquidityParamsProps({
2303
2303
  const tickSpacing = poolData.tickSpacing;
2304
2304
  const tickLower = sdk.ClService.priceToTick(minPriceNum, token0, token1, tickSpacing);
2305
2305
  const tickUpper = sdk.ClService.priceToTick(maxPriceNum, token0, token1, tickSpacing);
2306
- const slippageMultiplier = BigInt(Math.floor((100 - slippage) * 100));
2307
- const amount0ForLiquidity = amount0BigInt * slippageMultiplier / 10000n;
2308
- const amount1ForLiquidity = amount1BigInt * slippageMultiplier / 10000n;
2309
2306
  const liquidity = sdk.ClService.calculateLiquidityFromAmounts(
2310
- amount0ForLiquidity,
2311
- amount1ForLiquidity,
2307
+ amount0BigInt,
2308
+ amount1BigInt,
2312
2309
  tickLower,
2313
2310
  tickUpper,
2314
2311
  BigInt(poolData.currentTick)
2315
2312
  );
2313
+ const { amount0Max, amount1Max } = sdk.ClService.calculateMaxAmountsForSlippage(
2314
+ liquidity,
2315
+ tickLower,
2316
+ tickUpper,
2317
+ BigInt(poolData.currentTick),
2318
+ poolData.sqrtPriceX96,
2319
+ slippage
2320
+ );
2316
2321
  const tokenId = positionId ? BigInt(positionId) : void 0;
2317
2322
  return {
2318
2323
  poolKey,
2319
2324
  tickLower,
2320
2325
  tickUpper,
2321
2326
  liquidity,
2322
- amount0Max: amount0BigInt,
2323
- amount1Max: amount1BigInt,
2327
+ amount0Max,
2328
+ amount1Max,
2324
2329
  sqrtPriceX96: poolData.sqrtPriceX96,
2325
2330
  positionId,
2326
2331
  isValidPosition,