@meteora-ag/dlmm 1.6.0-rc.29 → 1.6.0-rc.30

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
@@ -13901,6 +13901,28 @@ async function chunkDepositWithRebalanceEndpoint(dlmm, strategy, slippagePercent
13901
13901
  addLiquidityIxs.push(...wrapSOLIx);
13902
13902
  }
13903
13903
  addLiquidityIxs.push(rebalanceIx);
13904
+ if (dlmm.tokenX.publicKey.equals(_spltoken.NATIVE_MINT) && !totalXAmount.isZero()) {
13905
+ addLiquidityIxs.push(
13906
+ _spltoken.createCloseAccountInstruction.call(void 0,
13907
+ userTokenX,
13908
+ owner,
13909
+ owner,
13910
+ [],
13911
+ _spltoken.TOKEN_PROGRAM_ID
13912
+ )
13913
+ );
13914
+ }
13915
+ if (dlmm.tokenY.publicKey.equals(_spltoken.NATIVE_MINT) && !totalYAmount.isZero()) {
13916
+ addLiquidityIxs.push(
13917
+ _spltoken.createCloseAccountInstruction.call(void 0,
13918
+ userTokenY,
13919
+ owner,
13920
+ owner,
13921
+ [],
13922
+ _spltoken.TOKEN_PROGRAM_ID
13923
+ )
13924
+ );
13925
+ }
13904
13926
  if (simulateCU) {
13905
13927
  const cuIx = await getEstimatedComputeUnitIxWithBuffer(
13906
13928
  dlmm.program.provider.connection,
@@ -15722,8 +15744,9 @@ var DLMM = class {
15722
15744
  const binCount = maxBinId - minBinId + 1;
15723
15745
  const positionCount = Math.floor(binCount / MAX_BINS_PER_POSITION.toNumber()) + 1;
15724
15746
  let positionReallocCost = 0;
15747
+ let lastUpperBinId = minBinId;
15725
15748
  for (let i = 0; i < positionCount; i++) {
15726
- const lowerBinId = minBinId;
15749
+ const lowerBinId = lastUpperBinId;
15727
15750
  const upperBinId = Math.min(
15728
15751
  maxBinId,
15729
15752
  lowerBinId + DEFAULT_BIN_PER_POSITION.toNumber() - 1
@@ -15739,6 +15762,7 @@ var DLMM = class {
15739
15762
  new (0, _anchor.BN)(binToExpand)
15740
15763
  );
15741
15764
  positionReallocCost += positionExtendCost.toNumber();
15765
+ lastUpperBinId = upperBinId;
15742
15766
  }
15743
15767
  const lowerBinArrayIndex = binIdToBinArrayIndex(new (0, _anchor.BN)(minBinId));
15744
15768
  const upperBinArrayIndex = _anchor.BN.max(
@@ -15988,7 +16012,8 @@ var DLMM = class {
15988
16012
  const latestBlockhashInfo = await this.program.provider.connection.getLatestBlockhash();
15989
16013
  return chunkedAddLiquidityIx.map((ixs) => {
15990
16014
  return new (0, _web3js.Transaction)({
15991
- ...latestBlockhashInfo
16015
+ ...latestBlockhashInfo,
16016
+ feePayer: user
15992
16017
  }).add(...ixs);
15993
16018
  });
15994
16019
  }