@meteora-ag/dlmm 1.4.3-rc.0 → 1.4.3-rc.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
@@ -5815,12 +5815,12 @@ declare class DLMM {
5815
5815
  static getPricePerLamport(tokenXDecimal: number, tokenYDecimal: number, price: number): string;
5816
5816
  static getBinIdFromPrice(price: string | number | Decimal, binStep: number, min: boolean): number;
5817
5817
  /**
5818
- * The function `getLbPairLockInfo` retrieves all pair positions that has locked liquidity.
5819
- * @param {number} [lockDurationOpt] - An optional value indicating the minimum position lock duration that the function should return.
5820
- * Depending on the lbPair activationType, the param should be a number of seconds or a number of slots.
5821
- * @returns The function `getLbPairLockInfo` returns a `Promise` that resolves to a `PairLockInfo`
5822
- * object. The `PairLockInfo` object contains an array of `PositionLockInfo` objects.
5823
- */
5818
+ * The function `getLbPairLockInfo` retrieves all pair positions that has locked liquidity.
5819
+ * @param {number} [lockDurationOpt] - An optional value indicating the minimum position lock duration that the function should return.
5820
+ * Depending on the lbPair activationType, the param should be a number of seconds or a number of slots.
5821
+ * @returns The function `getLbPairLockInfo` returns a `Promise` that resolves to a `PairLockInfo`
5822
+ * object. The `PairLockInfo` object contains an array of `PositionLockInfo` objects.
5823
+ */
5824
5824
  getLbPairLockInfo(lockDurationOpt?: number): Promise<PairLockInfo>;
5825
5825
  /** Public methods */
5826
5826
  static createPermissionLbPair(connection: Connection, binStep: BN, tokenX: PublicKey, tokenY: PublicKey, activeId: BN, baseKey: PublicKey, creatorKey: PublicKey, feeBps: BN, activationType: ActivationType, opt?: Opt): Promise<Transaction>;
@@ -6217,22 +6217,22 @@ declare class DLMM {
6217
6217
  */
6218
6218
  seedLiquidity(owner: PublicKey, seedAmount: BN, curvature: number, minPrice: number, maxPrice: number, base: PublicKey, payer: PublicKey, feeOwner: PublicKey, operator: PublicKey, lockReleasePoint: BN, shouldSeedPositionOwner?: boolean): Promise<SeedLiquidityResponse>;
6219
6219
  /**
6220
- * The `seedLiquidity` function create multiple grouped instructions. The grouped instructions will be either [initialize bin array + initialize position instructions] or [deposit instruction] combination.
6221
- * @param
6222
- * - `payer`: The public key of the tx payer.
6223
- * - `base`: Base key
6224
- * - `seedAmount`: Token X lamport amount to be seeded to the pool.
6225
- * - `price`: TokenX/TokenY Price in UI format
6226
- * - `roundingUp`: Whether to round up the price
6227
- * - `positionOwner`: The owner of the position
6228
- * - `feeOwner`: Position fee owner
6229
- * - `operator`: Operator of the position. Operator able to manage the position on behalf of the position owner. However, liquidity withdrawal issue by the operator can only send to the position owner.
6230
- * - `lockReleasePoint`: The lock release point of the position.
6231
- * - `shouldSeedPositionOwner` (optional): Whether to send 1 lamport amount of token X to the position owner to prove ownership.
6232
- *
6233
- * The returned instructions need to be executed sequentially if it was separated into multiple transactions.
6234
- * @returns {Promise<TransactionInstruction[]>}
6235
- */
6220
+ * The `seedLiquidity` function create multiple grouped instructions. The grouped instructions will be either [initialize bin array + initialize position instructions] or [deposit instruction] combination.
6221
+ * @param
6222
+ * - `payer`: The public key of the tx payer.
6223
+ * - `base`: Base key
6224
+ * - `seedAmount`: Token X lamport amount to be seeded to the pool.
6225
+ * - `price`: TokenX/TokenY Price in UI format
6226
+ * - `roundingUp`: Whether to round up the price
6227
+ * - `positionOwner`: The owner of the position
6228
+ * - `feeOwner`: Position fee owner
6229
+ * - `operator`: Operator of the position. Operator able to manage the position on behalf of the position owner. However, liquidity withdrawal issue by the operator can only send to the position owner.
6230
+ * - `lockReleasePoint`: The lock release point of the position.
6231
+ * - `shouldSeedPositionOwner` (optional): Whether to send 1 lamport amount of token X to the position owner to prove ownership.
6232
+ *
6233
+ * The returned instructions need to be executed sequentially if it was separated into multiple transactions.
6234
+ * @returns {Promise<TransactionInstruction[]>}
6235
+ */
6236
6236
  seedLiquiditySingleBin(payer: PublicKey, base: PublicKey, seedAmount: BN, price: number, roundingUp: boolean, positionOwner: PublicKey, feeOwner: PublicKey, operator: PublicKey, lockReleasePoint: BN, shouldSeedPositionOwner?: boolean): Promise<TransactionInstruction[]>;
6237
6237
  /**
6238
6238
  * Initializes bin arrays for the given bin array indexes if it wasn't initialized.
package/dist/index.js CHANGED
@@ -8381,12 +8381,12 @@ var DLMM = class {
8381
8381
  return (min ? binId.floor() : binId.ceil()).toNumber();
8382
8382
  }
8383
8383
  /**
8384
- * The function `getLbPairLockInfo` retrieves all pair positions that has locked liquidity.
8385
- * @param {number} [lockDurationOpt] - An optional value indicating the minimum position lock duration that the function should return.
8386
- * Depending on the lbPair activationType, the param should be a number of seconds or a number of slots.
8387
- * @returns The function `getLbPairLockInfo` returns a `Promise` that resolves to a `PairLockInfo`
8388
- * object. The `PairLockInfo` object contains an array of `PositionLockInfo` objects.
8389
- */
8384
+ * The function `getLbPairLockInfo` retrieves all pair positions that has locked liquidity.
8385
+ * @param {number} [lockDurationOpt] - An optional value indicating the minimum position lock duration that the function should return.
8386
+ * Depending on the lbPair activationType, the param should be a number of seconds or a number of slots.
8387
+ * @returns The function `getLbPairLockInfo` returns a `Promise` that resolves to a `PairLockInfo`
8388
+ * object. The `PairLockInfo` object contains an array of `PositionLockInfo` objects.
8389
+ */
8390
8390
  async getLbPairLockInfo(lockDurationOpt) {
8391
8391
  const lockDuration = lockDurationOpt | 0;
8392
8392
  const lbPairPositions = await this.program.account.positionV2.all([
@@ -8397,33 +8397,39 @@ var DLMM = class {
8397
8397
  }
8398
8398
  }
8399
8399
  ]);
8400
- const clockAccInfo = await this.program.provider.connection.getAccountInfo(_web3js.SYSVAR_CLOCK_PUBKEY);
8400
+ const clockAccInfo = await this.program.provider.connection.getAccountInfo(
8401
+ _web3js.SYSVAR_CLOCK_PUBKEY
8402
+ );
8401
8403
  const clock = ClockLayout.decode(clockAccInfo.data);
8402
8404
  const currentPoint = this.lbPair.activationType == 0 /* Slot */ ? clock.slot : clock.unixTimestamp;
8403
8405
  const minLockReleasePoint = currentPoint.add(new (0, _anchor.BN)(lockDuration));
8404
- const positionsWithLock = lbPairPositions.filter((p) => p.account.lockReleasePoint.gt(minLockReleasePoint));
8406
+ const positionsWithLock = lbPairPositions.filter(
8407
+ (p) => p.account.lockReleasePoint.gt(minLockReleasePoint)
8408
+ );
8405
8409
  if (positionsWithLock.length == 0) {
8406
8410
  return {
8407
8411
  positions: []
8408
8412
  };
8409
8413
  }
8410
8414
  const binArrayPubkeySetV2 = /* @__PURE__ */ new Set();
8411
- positionsWithLock.forEach(({ account: { upperBinId, lowerBinId, lbPair } }) => {
8412
- const lowerBinArrayIndex = binIdToBinArrayIndex(new (0, _anchor.BN)(lowerBinId));
8413
- const upperBinArrayIndex = binIdToBinArrayIndex(new (0, _anchor.BN)(upperBinId));
8414
- const [lowerBinArrayPubKey] = deriveBinArray(
8415
- this.pubkey,
8416
- lowerBinArrayIndex,
8417
- this.program.programId
8418
- );
8419
- const [upperBinArrayPubKey] = deriveBinArray(
8420
- this.pubkey,
8421
- upperBinArrayIndex,
8422
- this.program.programId
8423
- );
8424
- binArrayPubkeySetV2.add(lowerBinArrayPubKey.toBase58());
8425
- binArrayPubkeySetV2.add(upperBinArrayPubKey.toBase58());
8426
- });
8415
+ positionsWithLock.forEach(
8416
+ ({ account: { upperBinId, lowerBinId, lbPair } }) => {
8417
+ const lowerBinArrayIndex = binIdToBinArrayIndex(new (0, _anchor.BN)(lowerBinId));
8418
+ const upperBinArrayIndex = binIdToBinArrayIndex(new (0, _anchor.BN)(upperBinId));
8419
+ const [lowerBinArrayPubKey] = deriveBinArray(
8420
+ this.pubkey,
8421
+ lowerBinArrayIndex,
8422
+ this.program.programId
8423
+ );
8424
+ const [upperBinArrayPubKey] = deriveBinArray(
8425
+ this.pubkey,
8426
+ upperBinArrayIndex,
8427
+ this.program.programId
8428
+ );
8429
+ binArrayPubkeySetV2.add(lowerBinArrayPubKey.toBase58());
8430
+ binArrayPubkeySetV2.add(upperBinArrayPubKey.toBase58());
8431
+ }
8432
+ );
8427
8433
  const binArrayPubkeyArrayV2 = Array.from(binArrayPubkeySetV2).map(
8428
8434
  (pubkey) => new (0, _web3js.PublicKey)(pubkey)
8429
8435
  );
@@ -8576,6 +8582,7 @@ var DLMM = class {
8576
8582
  };
8577
8583
  const userTokenX = _spltoken.getAssociatedTokenAddressSync.call(void 0, tokenX, creatorKey);
8578
8584
  const userTokenY = _spltoken.getAssociatedTokenAddressSync.call(void 0, tokenY, creatorKey);
8585
+ console.log(program.methods);
8579
8586
  return program.methods.initializeCustomizablePermissionlessLbPair(ixData).accounts({
8580
8587
  lbPair,
8581
8588
  reserveX,
@@ -9047,11 +9054,7 @@ var DLMM = class {
9047
9054
  );
9048
9055
  const lbPairAndBinArrays = await chunkedGetMultipleAccountInfos(
9049
9056
  this.program.provider.connection,
9050
- [
9051
- this.pubkey,
9052
- _web3js.SYSVAR_CLOCK_PUBKEY,
9053
- ...binArrayPubkeyArrayV2
9054
- ]
9057
+ [this.pubkey, _web3js.SYSVAR_CLOCK_PUBKEY, ...binArrayPubkeyArrayV2]
9055
9058
  );
9056
9059
  const [lbPairAccInfo, clockAccInfo, ...binArraysAccInfo] = lbPairAndBinArrays;
9057
9060
  const positionBinArraysMapV2 = /* @__PURE__ */ new Map();
@@ -9188,9 +9191,13 @@ var DLMM = class {
9188
9191
  * - `version`: The version of the position (in this case, `Position.V2`)
9189
9192
  */
9190
9193
  async getPosition(positionPubKey) {
9191
- const positionAccountInfo = await this.program.account.positionV2.fetch(positionPubKey);
9194
+ const positionAccountInfo = await this.program.account.positionV2.fetch(
9195
+ positionPubKey
9196
+ );
9192
9197
  if (!positionAccountInfo) {
9193
- throw new Error(`Position account ${positionPubKey.toBase58()} not found`);
9198
+ throw new Error(
9199
+ `Position account ${positionPubKey.toBase58()} not found`
9200
+ );
9194
9201
  }
9195
9202
  const { lowerBinId, upperBinId, feeOwner } = positionAccountInfo;
9196
9203
  const lowerBinArrayIndex = binIdToBinArrayIndex(new (0, _anchor.BN)(lowerBinId));
@@ -9205,14 +9212,11 @@ var DLMM = class {
9205
9212
  upperBinArrayIndex,
9206
9213
  this.program.programId
9207
9214
  );
9208
- const [clockAccInfo, lowerBinArrayAccInfo, upperBinArrayAccInfo] = await chunkedGetMultipleAccountInfos(
9209
- this.program.provider.connection,
9210
- [
9211
- _web3js.SYSVAR_CLOCK_PUBKEY,
9212
- lowerBinArrayPubKey,
9213
- upperBinArrayPubKey
9214
- ]
9215
- );
9215
+ const [clockAccInfo, lowerBinArrayAccInfo, upperBinArrayAccInfo] = await chunkedGetMultipleAccountInfos(this.program.provider.connection, [
9216
+ _web3js.SYSVAR_CLOCK_PUBKEY,
9217
+ lowerBinArrayPubKey,
9218
+ upperBinArrayPubKey
9219
+ ]);
9216
9220
  if (!lowerBinArrayAccInfo || !upperBinArrayAccInfo) {
9217
9221
  return {
9218
9222
  publicKey: positionPubKey,
@@ -9987,7 +9991,13 @@ var DLMM = class {
9987
9991
  }) {
9988
9992
  const lowerBinIdToRemove = Math.min(...binIds);
9989
9993
  const upperBinIdToRemove = Math.max(...binIds);
9990
- const { lbPair, owner, feeOwner, lowerBinId: positionLowerBinId, liquidityShares } = await this.program.account.positionV2.fetch(position);
9994
+ const {
9995
+ lbPair,
9996
+ owner,
9997
+ feeOwner,
9998
+ lowerBinId: positionLowerBinId,
9999
+ liquidityShares
10000
+ } = await this.program.account.positionV2.fetch(position);
9991
10001
  if (liquidityShares.every((share) => share.isZero())) {
9992
10002
  throw new Error("No liquidity to remove");
9993
10003
  }
@@ -10109,7 +10119,11 @@ var DLMM = class {
10109
10119
  const maxBinArrayIndex = binIdToBinArrayIndex(new (0, _anchor.BN)(upperBinIdToRemove));
10110
10120
  const useExtension = isOverflowDefaultBinArrayBitmap(minBinArrayIndex) || isOverflowDefaultBinArrayBitmap(maxBinArrayIndex);
10111
10121
  const binArrayBitmapExtension = useExtension ? deriveBinArrayBitmapExtension(this.pubkey, this.program.programId)[0] : null;
10112
- const removeLiquidityTx = await this.program.methods.removeLiquidityByRange(lowerBinIdToRemove, upperBinIdToRemove, bps.toNumber()).accounts({
10122
+ const removeLiquidityTx = await this.program.methods.removeLiquidityByRange(
10123
+ lowerBinIdToRemove,
10124
+ upperBinIdToRemove,
10125
+ bps.toNumber()
10126
+ ).accounts({
10113
10127
  position,
10114
10128
  lbPair,
10115
10129
  userTokenX,
@@ -10225,7 +10239,10 @@ var DLMM = class {
10225
10239
  const currentTimestamp = Date.now() / 1e3;
10226
10240
  let outAmountLeft = outAmount;
10227
10241
  if (maxExtraBinArrays < 0 || maxExtraBinArrays > MAX_EXTRA_BIN_ARRAYS) {
10228
- throw new DlmmSdkError("INVALID_MAX_EXTRA_BIN_ARRAYS", `maxExtraBinArrays must be a value between 0 and ${MAX_EXTRA_BIN_ARRAYS}`);
10242
+ throw new DlmmSdkError(
10243
+ "INVALID_MAX_EXTRA_BIN_ARRAYS",
10244
+ `maxExtraBinArrays must be a value between 0 and ${MAX_EXTRA_BIN_ARRAYS}`
10245
+ );
10229
10246
  }
10230
10247
  let vParameterClone = Object.assign({}, this.lbPair.vParameters);
10231
10248
  let activeId = new (0, _anchor.BN)(this.lbPair.activeId);
@@ -10313,7 +10330,9 @@ var DLMM = class {
10313
10330
  if (binArrayAccountToSwap == null) {
10314
10331
  break;
10315
10332
  }
10316
- const binArrayAccountToSwapExisted = binArraysForSwap.has(binArrayAccountToSwap.publicKey);
10333
+ const binArrayAccountToSwapExisted = binArraysForSwap.has(
10334
+ binArrayAccountToSwap.publicKey
10335
+ );
10317
10336
  if (binArrayAccountToSwapExisted) {
10318
10337
  if (swapForY) {
10319
10338
  activeId = activeId.sub(new (0, _anchor.BN)(1));
@@ -10322,7 +10341,9 @@ var DLMM = class {
10322
10341
  }
10323
10342
  } else {
10324
10343
  extraBinArrays.push(binArrayAccountToSwap.publicKey);
10325
- const [lowerBinId, upperBinId] = getBinArrayLowerUpperBinId(binArrayAccountToSwap.account.index);
10344
+ const [lowerBinId, upperBinId] = getBinArrayLowerUpperBinId(
10345
+ binArrayAccountToSwap.account.index
10346
+ );
10326
10347
  if (swapForY) {
10327
10348
  activeId = lowerBinId.sub(new (0, _anchor.BN)(1));
10328
10349
  } else {
@@ -10368,7 +10389,10 @@ var DLMM = class {
10368
10389
  const currentTimestamp = Date.now() / 1e3;
10369
10390
  let inAmountLeft = inAmount;
10370
10391
  if (maxExtraBinArrays < 0 || maxExtraBinArrays > MAX_EXTRA_BIN_ARRAYS) {
10371
- throw new DlmmSdkError("INVALID_MAX_EXTRA_BIN_ARRAYS", `maxExtraBinArrays must be a value between 0 and ${MAX_EXTRA_BIN_ARRAYS}`);
10392
+ throw new DlmmSdkError(
10393
+ "INVALID_MAX_EXTRA_BIN_ARRAYS",
10394
+ `maxExtraBinArrays must be a value between 0 and ${MAX_EXTRA_BIN_ARRAYS}`
10395
+ );
10372
10396
  }
10373
10397
  let vParameterClone = Object.assign({}, this.lbPair.vParameters);
10374
10398
  let activeId = new (0, _anchor.BN)(this.lbPair.activeId);
@@ -10475,7 +10499,9 @@ var DLMM = class {
10475
10499
  if (binArrayAccountToSwap == null) {
10476
10500
  break;
10477
10501
  }
10478
- const binArrayAccountToSwapExisted = binArraysForSwap.has(binArrayAccountToSwap.publicKey);
10502
+ const binArrayAccountToSwapExisted = binArraysForSwap.has(
10503
+ binArrayAccountToSwap.publicKey
10504
+ );
10479
10505
  if (binArrayAccountToSwapExisted) {
10480
10506
  if (swapForY) {
10481
10507
  activeId = activeId.sub(new (0, _anchor.BN)(1));
@@ -10484,7 +10510,9 @@ var DLMM = class {
10484
10510
  }
10485
10511
  } else {
10486
10512
  extraBinArrays.push(binArrayAccountToSwap.publicKey);
10487
- const [lowerBinId, upperBinId] = getBinArrayLowerUpperBinId(binArrayAccountToSwap.account.index);
10513
+ const [lowerBinId, upperBinId] = getBinArrayLowerUpperBinId(
10514
+ binArrayAccountToSwap.account.index
10515
+ );
10488
10516
  if (swapForY) {
10489
10517
  activeId = lowerBinId.sub(new (0, _anchor.BN)(1));
10490
10518
  } else {
@@ -10863,12 +10891,10 @@ var DLMM = class {
10863
10891
  }
10864
10892
  async setPairStatus(enabled) {
10865
10893
  const pairStatus = enabled ? 0 : 1;
10866
- const tx = await this.program.methods.setPairStatus(pairStatus).accounts(
10867
- {
10868
- lbPair: this.pubkey,
10869
- admin: this.lbPair.creator
10870
- }
10871
- ).transaction();
10894
+ const tx = await this.program.methods.setPairStatus(pairStatus).accounts({
10895
+ lbPair: this.pubkey,
10896
+ admin: this.lbPair.creator
10897
+ }).transaction();
10872
10898
  const { blockhash, lastValidBlockHeight } = await this.program.provider.connection.getLatestBlockhash("confirmed");
10873
10899
  return new (0, _web3js.Transaction)({
10874
10900
  feePayer: this.lbPair.creator,
@@ -11127,12 +11153,7 @@ var DLMM = class {
11127
11153
  );
11128
11154
  sendPositionOwnerTokenProveIxs.push(initPositionOwnerTokenX);
11129
11155
  sendPositionOwnerTokenProveIxs.push(
11130
- _spltoken.createTransferInstruction.call(void 0,
11131
- seederTokenX,
11132
- ownerTokenX,
11133
- operator,
11134
- 1n
11135
- )
11156
+ _spltoken.createTransferInstruction.call(void 0, seederTokenX, ownerTokenX, operator, 1n)
11136
11157
  );
11137
11158
  }
11138
11159
  }
@@ -11280,22 +11301,22 @@ var DLMM = class {
11280
11301
  };
11281
11302
  }
11282
11303
  /**
11283
- * The `seedLiquidity` function create multiple grouped instructions. The grouped instructions will be either [initialize bin array + initialize position instructions] or [deposit instruction] combination.
11284
- * @param
11285
- * - `payer`: The public key of the tx payer.
11286
- * - `base`: Base key
11287
- * - `seedAmount`: Token X lamport amount to be seeded to the pool.
11288
- * - `price`: TokenX/TokenY Price in UI format
11289
- * - `roundingUp`: Whether to round up the price
11290
- * - `positionOwner`: The owner of the position
11291
- * - `feeOwner`: Position fee owner
11292
- * - `operator`: Operator of the position. Operator able to manage the position on behalf of the position owner. However, liquidity withdrawal issue by the operator can only send to the position owner.
11293
- * - `lockReleasePoint`: The lock release point of the position.
11294
- * - `shouldSeedPositionOwner` (optional): Whether to send 1 lamport amount of token X to the position owner to prove ownership.
11295
- *
11296
- * The returned instructions need to be executed sequentially if it was separated into multiple transactions.
11297
- * @returns {Promise<TransactionInstruction[]>}
11298
- */
11304
+ * The `seedLiquidity` function create multiple grouped instructions. The grouped instructions will be either [initialize bin array + initialize position instructions] or [deposit instruction] combination.
11305
+ * @param
11306
+ * - `payer`: The public key of the tx payer.
11307
+ * - `base`: Base key
11308
+ * - `seedAmount`: Token X lamport amount to be seeded to the pool.
11309
+ * - `price`: TokenX/TokenY Price in UI format
11310
+ * - `roundingUp`: Whether to round up the price
11311
+ * - `positionOwner`: The owner of the position
11312
+ * - `feeOwner`: Position fee owner
11313
+ * - `operator`: Operator of the position. Operator able to manage the position on behalf of the position owner. However, liquidity withdrawal issue by the operator can only send to the position owner.
11314
+ * - `lockReleasePoint`: The lock release point of the position.
11315
+ * - `shouldSeedPositionOwner` (optional): Whether to send 1 lamport amount of token X to the position owner to prove ownership.
11316
+ *
11317
+ * The returned instructions need to be executed sequentially if it was separated into multiple transactions.
11318
+ * @returns {Promise<TransactionInstruction[]>}
11319
+ */
11299
11320
  async seedLiquiditySingleBin(payer, base, seedAmount, price, roundingUp, positionOwner, feeOwner, operator, lockReleasePoint, shouldSeedPositionOwner = false) {
11300
11321
  const pricePerLamport = DLMM.getPricePerLamport(
11301
11322
  this.tokenX.decimal,
@@ -11310,9 +11331,23 @@ var DLMM = class {
11310
11331
  const binId = new (0, _anchor.BN)(binIdNumber);
11311
11332
  const lowerBinArrayIndex = binIdToBinArrayIndex(binId);
11312
11333
  const upperBinArrayIndex = lowerBinArrayIndex.add(new (0, _anchor.BN)(1));
11313
- const [lowerBinArray] = deriveBinArray(this.pubkey, lowerBinArrayIndex, this.program.programId);
11314
- const [upperBinArray] = deriveBinArray(this.pubkey, upperBinArrayIndex, this.program.programId);
11315
- const [positionPda] = derivePosition(this.pubkey, base, binId, new (0, _anchor.BN)(1), this.program.programId);
11334
+ const [lowerBinArray] = deriveBinArray(
11335
+ this.pubkey,
11336
+ lowerBinArrayIndex,
11337
+ this.program.programId
11338
+ );
11339
+ const [upperBinArray] = deriveBinArray(
11340
+ this.pubkey,
11341
+ upperBinArrayIndex,
11342
+ this.program.programId
11343
+ );
11344
+ const [positionPda] = derivePosition(
11345
+ this.pubkey,
11346
+ base,
11347
+ binId,
11348
+ new (0, _anchor.BN)(1),
11349
+ this.program.programId
11350
+ );
11316
11351
  const preInstructions = [];
11317
11352
  const [
11318
11353
  { ataPubKey: userTokenX, ix: createPayerTokenXIx },
@@ -11346,11 +11381,13 @@ var DLMM = class {
11346
11381
  if (isOverflowDefaultBinArrayBitmap(lowerBinArrayIndex)) {
11347
11382
  const bitmapExtensionAccount = accounts[3];
11348
11383
  if (!bitmapExtensionAccount) {
11349
- preInstructions.push(await this.program.methods.initializeBinArrayBitmapExtension().accounts({
11350
- binArrayBitmapExtension,
11351
- funder: payer,
11352
- lbPair: this.pubkey
11353
- }).instruction());
11384
+ preInstructions.push(
11385
+ await this.program.methods.initializeBinArrayBitmapExtension().accounts({
11386
+ binArrayBitmapExtension,
11387
+ funder: payer,
11388
+ lbPair: this.pubkey
11389
+ }).instruction()
11390
+ );
11354
11391
  }
11355
11392
  } else {
11356
11393
  binArrayBitmapExtension = this.program.programId;
@@ -11366,17 +11403,34 @@ var DLMM = class {
11366
11403
  true
11367
11404
  );
11368
11405
  if (shouldSeedPositionOwner) {
11369
- const positionOwnerTokenXAccount = await this.program.provider.connection.getAccountInfo(positionOwnerTokenX);
11406
+ const positionOwnerTokenXAccount = await this.program.provider.connection.getAccountInfo(
11407
+ positionOwnerTokenX
11408
+ );
11370
11409
  if (positionOwnerTokenXAccount) {
11371
11410
  const account = _spltoken.AccountLayout.decode(positionOwnerTokenXAccount.data);
11372
11411
  if (account.amount == BigInt(0)) {
11373
- const transferIx = _spltoken.createTransferInstruction.call(void 0, operatorTokenX, positionOwnerTokenX, payer, 1);
11412
+ const transferIx = _spltoken.createTransferInstruction.call(void 0,
11413
+ operatorTokenX,
11414
+ positionOwnerTokenX,
11415
+ payer,
11416
+ 1
11417
+ );
11374
11418
  preInstructions.push(transferIx);
11375
11419
  }
11376
11420
  } else {
11377
- const createPositionOwnerTokenXIx = _spltoken.createAssociatedTokenAccountInstruction.call(void 0, payer, positionOwnerTokenX, positionOwner, this.lbPair.tokenXMint);
11421
+ const createPositionOwnerTokenXIx = _spltoken.createAssociatedTokenAccountInstruction.call(void 0,
11422
+ payer,
11423
+ positionOwnerTokenX,
11424
+ positionOwner,
11425
+ this.lbPair.tokenXMint
11426
+ );
11378
11427
  preInstructions.push(createPositionOwnerTokenXIx);
11379
- const transferIx = _spltoken.createTransferInstruction.call(void 0, operatorTokenX, positionOwnerTokenX, payer, 1);
11428
+ const transferIx = _spltoken.createTransferInstruction.call(void 0,
11429
+ operatorTokenX,
11430
+ positionOwnerTokenX,
11431
+ payer,
11432
+ 1
11433
+ );
11380
11434
  preInstructions.push(transferIx);
11381
11435
  }
11382
11436
  }
@@ -12214,20 +12268,26 @@ var DLMM = class {
12214
12268
  ...fetchedBinArrays,
12215
12269
  ...hasCachedUpperBinArray && !isSingleBinArray ? [upperBinArray] : []
12216
12270
  ];
12217
- const binsById = new Map(binArrays.filter((x) => x != null).flatMap(({ bins, index }) => {
12218
- const [lowerBinId2] = getBinArrayLowerUpperBinId(index);
12219
- return bins.map((b, i) => [lowerBinId2.toNumber() + i, b]);
12220
- }));
12271
+ const binsById = new Map(
12272
+ binArrays.filter((x) => x != null).flatMap(({ bins, index }) => {
12273
+ const [lowerBinId2] = getBinArrayLowerUpperBinId(index);
12274
+ return bins.map(
12275
+ (b, i) => [lowerBinId2.toNumber() + i, b]
12276
+ );
12277
+ })
12278
+ );
12221
12279
  const version = _nullishCoalesce(_optionalChain([binArrays, 'access', _86 => _86.find, 'call', _87 => _87((binArray) => binArray != null), 'optionalAccess', _88 => _88.version]), () => ( 1));
12222
- return Array.from(enumerateBins(
12223
- binsById,
12224
- lowerBinId,
12225
- upperBinId,
12226
- this.lbPair.binStep,
12227
- baseTokenDecimal,
12228
- quoteTokenDecimal,
12229
- version
12230
- ));
12280
+ return Array.from(
12281
+ enumerateBins(
12282
+ binsById,
12283
+ lowerBinId,
12284
+ upperBinId,
12285
+ this.lbPair.binStep,
12286
+ baseTokenDecimal,
12287
+ quoteTokenDecimal,
12288
+ version
12289
+ )
12290
+ );
12231
12291
  }
12232
12292
  async binArraysToBeCreate(lowerBinArrayIndex, upperBinArrayIndex) {
12233
12293
  const binArrayIndexes = Array.from(