@meteora-ag/dlmm 1.0.52-rc.9 → 1.0.53

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
@@ -11005,33 +11005,33 @@ 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 > maxAmountOut ? maxAmountOut : amountOut)
11008
+ withdrawAmount: amount1.add(amountOut.gt(maxAmountOut) ? maxAmountOut : amountOut)
11009
11009
  };
11010
11010
  }
11011
11011
  async getWithdrawSingleSideAmount(positionPubkey, isWithdrawForY) {
11012
11012
  let totalWithdrawAmount = new (0, _anchor.BN)(0);
11013
- let _lowerBinArray;
11014
- let _upperBinArray;
11013
+ let lowerBinArray;
11014
+ let upperBinArray;
11015
11015
  const position = await this.program.account.positionV2.fetch(
11016
11016
  positionPubkey
11017
11017
  );
11018
11018
  const lowerBinArrayIdx = binIdToBinArrayIndex(new (0, _anchor.BN)(position.lowerBinId));
11019
- const [lowerBinArray] = deriveBinArray(
11019
+ const [lowerBinArrayPubKey] = deriveBinArray(
11020
11020
  position.lbPair,
11021
11021
  lowerBinArrayIdx,
11022
11022
  this.program.programId
11023
11023
  );
11024
11024
  const upperBinArrayIdx = lowerBinArrayIdx.add(new (0, _anchor.BN)(1));
11025
- const [upperBinArray] = deriveBinArray(
11025
+ const [upperBinArrayPubKey] = deriveBinArray(
11026
11026
  position.lbPair,
11027
11027
  upperBinArrayIdx,
11028
11028
  this.program.programId
11029
11029
  );
11030
- [_lowerBinArray, _upperBinArray] = await this.program.account.binArray.fetchMultiple([
11031
- lowerBinArray,
11032
- upperBinArray
11030
+ [lowerBinArray, upperBinArray] = await this.program.account.binArray.fetchMultiple([
11031
+ lowerBinArrayPubKey,
11032
+ upperBinArrayPubKey
11033
11033
  ]);
11034
- if (!_lowerBinArray || !_upperBinArray)
11034
+ if (!lowerBinArray || !upperBinArray)
11035
11035
  throw new Error("BinArray not found");
11036
11036
  for (let idx = 0; idx < position.liquidityShares.length; idx++) {
11037
11037
  const shareToRemove = position.liquidityShares[idx];
@@ -11040,7 +11040,7 @@ var DLMM = class {
11040
11040
  }
11041
11041
  const binId = new (0, _anchor.BN)(position.lowerBinId).add(new (0, _anchor.BN)(idx));
11042
11042
  const binArrayIndex = binIdToBinArrayIndex(binId);
11043
- const binArray = binArrayIndex.eq(lowerBinArrayIdx) ? _lowerBinArray : _upperBinArray;
11043
+ const binArray = binArrayIndex.eq(lowerBinArrayIdx) ? lowerBinArray : upperBinArray;
11044
11044
  const bin = getBinFromBinArray(binId.toNumber(), binArray);
11045
11045
  if (isWithdrawForY) {
11046
11046
  if (binId.gt(new (0, _anchor.BN)(this.lbPair.activeId))) {