@meteora-ag/dlmm 1.0.53 → 1.0.54

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
@@ -10993,7 +10993,7 @@ var DLMM = class {
10993
10993
  maxAmountIn = maxAmountIn.add(maxFee);
10994
10994
  if (amount0.gt(maxAmountIn)) {
10995
10995
  return {
10996
- withdrawAmount: maxAmountOut
10996
+ withdrawAmount: amount1.add(maxAmountOut)
10997
10997
  };
10998
10998
  }
10999
10999
  const fee = computeFeeFromAmount(
@@ -11005,7 +11005,7 @@ var DLMM = class {
11005
11005
  const amount0AfterFee = amount0.sub(fee);
11006
11006
  const amountOut = isWithdrawForY ? mulShr(price, amount0AfterFee, SCALE_OFFSET, 1 /* Down */) : shlDiv(amount0AfterFee, price, SCALE_OFFSET, 1 /* Down */);
11007
11007
  return {
11008
- withdrawAmount: amount1.add(amountOut.gt(maxAmountOut) ? maxAmountOut : amountOut)
11008
+ withdrawAmount: amount1.add(amountOut)
11009
11009
  };
11010
11010
  }
11011
11011
  async getWithdrawSingleSideAmount(positionPubkey, isWithdrawForY) {
@@ -11031,8 +11031,6 @@ var DLMM = class {
11031
11031
  lowerBinArrayPubKey,
11032
11032
  upperBinArrayPubKey
11033
11033
  ]);
11034
- if (!lowerBinArray || !upperBinArray)
11035
- throw new Error("BinArray not found");
11036
11034
  for (let idx = 0; idx < position.liquidityShares.length; idx++) {
11037
11035
  const shareToRemove = position.liquidityShares[idx];
11038
11036
  if (shareToRemove.eq(new (0, _anchor.BN)(0))) {
@@ -11041,6 +11039,9 @@ var DLMM = class {
11041
11039
  const binId = new (0, _anchor.BN)(position.lowerBinId).add(new (0, _anchor.BN)(idx));
11042
11040
  const binArrayIndex = binIdToBinArrayIndex(binId);
11043
11041
  const binArray = binArrayIndex.eq(lowerBinArrayIdx) ? lowerBinArray : upperBinArray;
11042
+ if (!binArray) {
11043
+ throw new Error("BinArray not found");
11044
+ }
11044
11045
  const bin = getBinFromBinArray(binId.toNumber(), binArray);
11045
11046
  if (isWithdrawForY) {
11046
11047
  if (binId.gt(new (0, _anchor.BN)(this.lbPair.activeId))) {