@meteora-ag/dlmm 1.6.0 → 1.6.1

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.d.ts CHANGED
@@ -9416,6 +9416,7 @@ interface InitializeMultiplePositionAndAddLiquidityByStrategyResponse {
9416
9416
  instructionsByPositions: {
9417
9417
  positionKeypair: Keypair;
9418
9418
  initializePositionIx: TransactionInstruction;
9419
+ initializeAtaIxs: TransactionInstruction[];
9419
9420
  addLiquidityIxs: TransactionInstruction[][];
9420
9421
  }[];
9421
9422
  }
package/dist/index.js CHANGED
@@ -13891,26 +13891,23 @@ async function chunkDepositWithRebalanceEndpoint(dlmm, strategy, slippagePercent
13891
13891
  ]).instruction();
13892
13892
  calculatedAddLiquidityCU += DEFAULT_ADD_LIQUIDITY_CU;
13893
13893
  const addLiquidityIxs = [];
13894
- addLiquidityIxs.push(
13895
- ...initBitmapIxs,
13896
- ...initBinArrayIxs,
13897
- createUserTokenXIx,
13898
- createUserTokenYIx
13899
- );
13900
- if (dlmm.tokenX.publicKey.equals(_spltoken.NATIVE_MINT) && !totalXAmount.isZero()) {
13894
+ addLiquidityIxs.push(...initBitmapIxs, ...initBinArrayIxs);
13895
+ if (dlmm.tokenX.publicKey.equals(_spltoken.NATIVE_MINT)) {
13901
13896
  const wrapSOLIx = wrapSOLInstruction(
13902
13897
  owner,
13903
13898
  userTokenX,
13904
13899
  BigInt(totalXAmount.toString())
13905
13900
  );
13901
+ addLiquidityIxs.push(createUserTokenXIx);
13906
13902
  addLiquidityIxs.push(...wrapSOLIx);
13907
13903
  }
13908
- if (dlmm.tokenY.publicKey.equals(_spltoken.NATIVE_MINT) && !totalYAmount.isZero()) {
13904
+ if (dlmm.tokenY.publicKey.equals(_spltoken.NATIVE_MINT)) {
13909
13905
  const wrapSOLIx = wrapSOLInstruction(
13910
13906
  owner,
13911
13907
  userTokenY,
13912
13908
  BigInt(totalYAmount.toString())
13913
13909
  );
13910
+ addLiquidityIxs.push(createUserTokenYIx);
13914
13911
  addLiquidityIxs.push(...wrapSOLIx);
13915
13912
  }
13916
13913
  addLiquidityIxs.push(rebalanceIx);
@@ -15934,6 +15931,41 @@ var DLMM = class {
15934
15931
  );
15935
15932
  const instructionsByPositions = [];
15936
15933
  let startBinId = minBinId;
15934
+ const initializeAtaIxs = [];
15935
+ if (!this.tokenX.publicKey.equals(_spltoken.NATIVE_MINT)) {
15936
+ const ownerAtaX = _spltoken.getAssociatedTokenAddressSync.call(void 0,
15937
+ this.tokenX.publicKey,
15938
+ owner,
15939
+ true,
15940
+ this.tokenX.owner
15941
+ );
15942
+ initializeAtaIxs.push(
15943
+ _spltoken.createAssociatedTokenAccountIdempotentInstruction.call(void 0,
15944
+ owner,
15945
+ ownerAtaX,
15946
+ owner,
15947
+ this.tokenX.publicKey,
15948
+ this.tokenX.owner
15949
+ )
15950
+ );
15951
+ }
15952
+ if (!this.tokenY.publicKey.equals(_spltoken.NATIVE_MINT)) {
15953
+ const ownerAtaY = _spltoken.getAssociatedTokenAddressSync.call(void 0,
15954
+ this.tokenY.publicKey,
15955
+ owner,
15956
+ true,
15957
+ this.tokenY.owner
15958
+ );
15959
+ initializeAtaIxs.push(
15960
+ _spltoken.createAssociatedTokenAccountIdempotentInstruction.call(void 0,
15961
+ owner,
15962
+ ownerAtaY,
15963
+ owner,
15964
+ this.tokenY.publicKey,
15965
+ this.tokenY.owner
15966
+ )
15967
+ );
15968
+ }
15937
15969
  for (const position of positionKeypairs) {
15938
15970
  const endBinId = Math.min(
15939
15971
  startBinId + MAX_BINS_PER_POSITION.toNumber() - 1,
@@ -15966,6 +15998,7 @@ var DLMM = class {
15966
15998
  instructionsByPositions.push({
15967
15999
  positionKeypair: position,
15968
16000
  initializePositionIx: initPositionIx,
16001
+ initializeAtaIxs,
15969
16002
  addLiquidityIxs: chunkedAddLiquidityIx
15970
16003
  });
15971
16004
  startBinId = endBinId + 1;