@meteora-ag/dlmm 1.4.3-rc.1 → 1.4.3-rc.2

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,39 +8397,33 @@ var DLMM = class {
8397
8397
  }
8398
8398
  }
8399
8399
  ]);
8400
- const clockAccInfo = await this.program.provider.connection.getAccountInfo(
8401
- _web3js.SYSVAR_CLOCK_PUBKEY
8402
- );
8400
+ const clockAccInfo = await this.program.provider.connection.getAccountInfo(_web3js.SYSVAR_CLOCK_PUBKEY);
8403
8401
  const clock = ClockLayout.decode(clockAccInfo.data);
8404
8402
  const currentPoint = this.lbPair.activationType == 0 /* Slot */ ? clock.slot : clock.unixTimestamp;
8405
8403
  const minLockReleasePoint = currentPoint.add(new (0, _anchor.BN)(lockDuration));
8406
- const positionsWithLock = lbPairPositions.filter(
8407
- (p) => p.account.lockReleasePoint.gt(minLockReleasePoint)
8408
- );
8404
+ const positionsWithLock = lbPairPositions.filter((p) => p.account.lockReleasePoint.gt(minLockReleasePoint));
8409
8405
  if (positionsWithLock.length == 0) {
8410
8406
  return {
8411
8407
  positions: []
8412
8408
  };
8413
8409
  }
8414
8410
  const binArrayPubkeySetV2 = /* @__PURE__ */ new Set();
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
- );
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
+ });
8433
8427
  const binArrayPubkeyArrayV2 = Array.from(binArrayPubkeySetV2).map(
8434
8428
  (pubkey) => new (0, _web3js.PublicKey)(pubkey)
8435
8429
  );
@@ -8582,7 +8576,6 @@ var DLMM = class {
8582
8576
  };
8583
8577
  const userTokenX = _spltoken.getAssociatedTokenAddressSync.call(void 0, tokenX, creatorKey);
8584
8578
  const userTokenY = _spltoken.getAssociatedTokenAddressSync.call(void 0, tokenY, creatorKey);
8585
- console.log(program.methods);
8586
8579
  return program.methods.initializeCustomizablePermissionlessLbPair(ixData).accounts({
8587
8580
  lbPair,
8588
8581
  reserveX,
@@ -8783,10 +8776,12 @@ var DLMM = class {
8783
8776
  const accountsToFetch = Array.from(binArraysPubkey).map(
8784
8777
  (pubkey) => new (0, _web3js.PublicKey)(pubkey)
8785
8778
  );
8779
+ console.log("\u{1F680} ~ DLMM ~ accountsToFetch:", accountsToFetch.map((x) => x.toString()));
8786
8780
  const binArraysAccInfoBuffer = await chunkedGetMultipleAccountInfos(
8787
8781
  this.program.provider.connection,
8788
8782
  accountsToFetch
8789
8783
  );
8784
+ console.log("\u{1F680} ~ DLMM ~ binArraysAccInfoBuffer:", binArraysAccInfoBuffer);
8790
8785
  const binArrays = await Promise.all(
8791
8786
  binArraysAccInfoBuffer.map(async (accInfo, idx) => {
8792
8787
  const account = this.program.coder.accounts.decode(
@@ -9054,7 +9049,11 @@ var DLMM = class {
9054
9049
  );
9055
9050
  const lbPairAndBinArrays = await chunkedGetMultipleAccountInfos(
9056
9051
  this.program.provider.connection,
9057
- [this.pubkey, _web3js.SYSVAR_CLOCK_PUBKEY, ...binArrayPubkeyArrayV2]
9052
+ [
9053
+ this.pubkey,
9054
+ _web3js.SYSVAR_CLOCK_PUBKEY,
9055
+ ...binArrayPubkeyArrayV2
9056
+ ]
9058
9057
  );
9059
9058
  const [lbPairAccInfo, clockAccInfo, ...binArraysAccInfo] = lbPairAndBinArrays;
9060
9059
  const positionBinArraysMapV2 = /* @__PURE__ */ new Map();
@@ -9191,13 +9190,9 @@ var DLMM = class {
9191
9190
  * - `version`: The version of the position (in this case, `Position.V2`)
9192
9191
  */
9193
9192
  async getPosition(positionPubKey) {
9194
- const positionAccountInfo = await this.program.account.positionV2.fetch(
9195
- positionPubKey
9196
- );
9193
+ const positionAccountInfo = await this.program.account.positionV2.fetch(positionPubKey);
9197
9194
  if (!positionAccountInfo) {
9198
- throw new Error(
9199
- `Position account ${positionPubKey.toBase58()} not found`
9200
- );
9195
+ throw new Error(`Position account ${positionPubKey.toBase58()} not found`);
9201
9196
  }
9202
9197
  const { lowerBinId, upperBinId, feeOwner } = positionAccountInfo;
9203
9198
  const lowerBinArrayIndex = binIdToBinArrayIndex(new (0, _anchor.BN)(lowerBinId));
@@ -9212,11 +9207,14 @@ var DLMM = class {
9212
9207
  upperBinArrayIndex,
9213
9208
  this.program.programId
9214
9209
  );
9215
- const [clockAccInfo, lowerBinArrayAccInfo, upperBinArrayAccInfo] = await chunkedGetMultipleAccountInfos(this.program.provider.connection, [
9216
- _web3js.SYSVAR_CLOCK_PUBKEY,
9217
- lowerBinArrayPubKey,
9218
- upperBinArrayPubKey
9219
- ]);
9210
+ const [clockAccInfo, lowerBinArrayAccInfo, upperBinArrayAccInfo] = await chunkedGetMultipleAccountInfos(
9211
+ this.program.provider.connection,
9212
+ [
9213
+ _web3js.SYSVAR_CLOCK_PUBKEY,
9214
+ lowerBinArrayPubKey,
9215
+ upperBinArrayPubKey
9216
+ ]
9217
+ );
9220
9218
  if (!lowerBinArrayAccInfo || !upperBinArrayAccInfo) {
9221
9219
  return {
9222
9220
  publicKey: positionPubKey,
@@ -9991,13 +9989,7 @@ var DLMM = class {
9991
9989
  }) {
9992
9990
  const lowerBinIdToRemove = Math.min(...binIds);
9993
9991
  const upperBinIdToRemove = Math.max(...binIds);
9994
- const {
9995
- lbPair,
9996
- owner,
9997
- feeOwner,
9998
- lowerBinId: positionLowerBinId,
9999
- liquidityShares
10000
- } = await this.program.account.positionV2.fetch(position);
9992
+ const { lbPair, owner, feeOwner, lowerBinId: positionLowerBinId, liquidityShares } = await this.program.account.positionV2.fetch(position);
10001
9993
  if (liquidityShares.every((share) => share.isZero())) {
10002
9994
  throw new Error("No liquidity to remove");
10003
9995
  }
@@ -10119,11 +10111,7 @@ var DLMM = class {
10119
10111
  const maxBinArrayIndex = binIdToBinArrayIndex(new (0, _anchor.BN)(upperBinIdToRemove));
10120
10112
  const useExtension = isOverflowDefaultBinArrayBitmap(minBinArrayIndex) || isOverflowDefaultBinArrayBitmap(maxBinArrayIndex);
10121
10113
  const binArrayBitmapExtension = useExtension ? deriveBinArrayBitmapExtension(this.pubkey, this.program.programId)[0] : null;
10122
- const removeLiquidityTx = await this.program.methods.removeLiquidityByRange(
10123
- lowerBinIdToRemove,
10124
- upperBinIdToRemove,
10125
- bps.toNumber()
10126
- ).accounts({
10114
+ const removeLiquidityTx = await this.program.methods.removeLiquidityByRange(lowerBinIdToRemove, upperBinIdToRemove, bps.toNumber()).accounts({
10127
10115
  position,
10128
10116
  lbPair,
10129
10117
  userTokenX,
@@ -10239,10 +10227,7 @@ var DLMM = class {
10239
10227
  const currentTimestamp = Date.now() / 1e3;
10240
10228
  let outAmountLeft = outAmount;
10241
10229
  if (maxExtraBinArrays < 0 || maxExtraBinArrays > 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
- );
10230
+ throw new DlmmSdkError("INVALID_MAX_EXTRA_BIN_ARRAYS", `maxExtraBinArrays must be a value between 0 and ${MAX_EXTRA_BIN_ARRAYS}`);
10246
10231
  }
10247
10232
  let vParameterClone = Object.assign({}, this.lbPair.vParameters);
10248
10233
  let activeId = new (0, _anchor.BN)(this.lbPair.activeId);
@@ -10330,9 +10315,7 @@ var DLMM = class {
10330
10315
  if (binArrayAccountToSwap == null) {
10331
10316
  break;
10332
10317
  }
10333
- const binArrayAccountToSwapExisted = binArraysForSwap.has(
10334
- binArrayAccountToSwap.publicKey
10335
- );
10318
+ const binArrayAccountToSwapExisted = binArraysForSwap.has(binArrayAccountToSwap.publicKey);
10336
10319
  if (binArrayAccountToSwapExisted) {
10337
10320
  if (swapForY) {
10338
10321
  activeId = activeId.sub(new (0, _anchor.BN)(1));
@@ -10341,9 +10324,7 @@ var DLMM = class {
10341
10324
  }
10342
10325
  } else {
10343
10326
  extraBinArrays.push(binArrayAccountToSwap.publicKey);
10344
- const [lowerBinId, upperBinId] = getBinArrayLowerUpperBinId(
10345
- binArrayAccountToSwap.account.index
10346
- );
10327
+ const [lowerBinId, upperBinId] = getBinArrayLowerUpperBinId(binArrayAccountToSwap.account.index);
10347
10328
  if (swapForY) {
10348
10329
  activeId = lowerBinId.sub(new (0, _anchor.BN)(1));
10349
10330
  } else {
@@ -10389,10 +10370,7 @@ var DLMM = class {
10389
10370
  const currentTimestamp = Date.now() / 1e3;
10390
10371
  let inAmountLeft = inAmount;
10391
10372
  if (maxExtraBinArrays < 0 || maxExtraBinArrays > 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
- );
10373
+ throw new DlmmSdkError("INVALID_MAX_EXTRA_BIN_ARRAYS", `maxExtraBinArrays must be a value between 0 and ${MAX_EXTRA_BIN_ARRAYS}`);
10396
10374
  }
10397
10375
  let vParameterClone = Object.assign({}, this.lbPair.vParameters);
10398
10376
  let activeId = new (0, _anchor.BN)(this.lbPair.activeId);
@@ -10499,9 +10477,7 @@ var DLMM = class {
10499
10477
  if (binArrayAccountToSwap == null) {
10500
10478
  break;
10501
10479
  }
10502
- const binArrayAccountToSwapExisted = binArraysForSwap.has(
10503
- binArrayAccountToSwap.publicKey
10504
- );
10480
+ const binArrayAccountToSwapExisted = binArraysForSwap.has(binArrayAccountToSwap.publicKey);
10505
10481
  if (binArrayAccountToSwapExisted) {
10506
10482
  if (swapForY) {
10507
10483
  activeId = activeId.sub(new (0, _anchor.BN)(1));
@@ -10510,9 +10486,7 @@ var DLMM = class {
10510
10486
  }
10511
10487
  } else {
10512
10488
  extraBinArrays.push(binArrayAccountToSwap.publicKey);
10513
- const [lowerBinId, upperBinId] = getBinArrayLowerUpperBinId(
10514
- binArrayAccountToSwap.account.index
10515
- );
10489
+ const [lowerBinId, upperBinId] = getBinArrayLowerUpperBinId(binArrayAccountToSwap.account.index);
10516
10490
  if (swapForY) {
10517
10491
  activeId = lowerBinId.sub(new (0, _anchor.BN)(1));
10518
10492
  } else {
@@ -10891,10 +10865,12 @@ var DLMM = class {
10891
10865
  }
10892
10866
  async setPairStatus(enabled) {
10893
10867
  const pairStatus = enabled ? 0 : 1;
10894
- const tx = await this.program.methods.setPairStatus(pairStatus).accounts({
10895
- lbPair: this.pubkey,
10896
- admin: this.lbPair.creator
10897
- }).transaction();
10868
+ const tx = await this.program.methods.setPairStatus(pairStatus).accounts(
10869
+ {
10870
+ lbPair: this.pubkey,
10871
+ admin: this.lbPair.creator
10872
+ }
10873
+ ).transaction();
10898
10874
  const { blockhash, lastValidBlockHeight } = await this.program.provider.connection.getLatestBlockhash("confirmed");
10899
10875
  return new (0, _web3js.Transaction)({
10900
10876
  feePayer: this.lbPair.creator,
@@ -11153,7 +11129,12 @@ var DLMM = class {
11153
11129
  );
11154
11130
  sendPositionOwnerTokenProveIxs.push(initPositionOwnerTokenX);
11155
11131
  sendPositionOwnerTokenProveIxs.push(
11156
- _spltoken.createTransferInstruction.call(void 0, seederTokenX, ownerTokenX, operator, 1n)
11132
+ _spltoken.createTransferInstruction.call(void 0,
11133
+ seederTokenX,
11134
+ ownerTokenX,
11135
+ operator,
11136
+ 1n
11137
+ )
11157
11138
  );
11158
11139
  }
11159
11140
  }
@@ -11301,22 +11282,22 @@ var DLMM = class {
11301
11282
  };
11302
11283
  }
11303
11284
  /**
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
- */
11285
+ * The `seedLiquidity` function create multiple grouped instructions. The grouped instructions will be either [initialize bin array + initialize position instructions] or [deposit instruction] combination.
11286
+ * @param
11287
+ * - `payer`: The public key of the tx payer.
11288
+ * - `base`: Base key
11289
+ * - `seedAmount`: Token X lamport amount to be seeded to the pool.
11290
+ * - `price`: TokenX/TokenY Price in UI format
11291
+ * - `roundingUp`: Whether to round up the price
11292
+ * - `positionOwner`: The owner of the position
11293
+ * - `feeOwner`: Position fee owner
11294
+ * - `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.
11295
+ * - `lockReleasePoint`: The lock release point of the position.
11296
+ * - `shouldSeedPositionOwner` (optional): Whether to send 1 lamport amount of token X to the position owner to prove ownership.
11297
+ *
11298
+ * The returned instructions need to be executed sequentially if it was separated into multiple transactions.
11299
+ * @returns {Promise<TransactionInstruction[]>}
11300
+ */
11320
11301
  async seedLiquiditySingleBin(payer, base, seedAmount, price, roundingUp, positionOwner, feeOwner, operator, lockReleasePoint, shouldSeedPositionOwner = false) {
11321
11302
  const pricePerLamport = DLMM.getPricePerLamport(
11322
11303
  this.tokenX.decimal,
@@ -11331,23 +11312,9 @@ var DLMM = class {
11331
11312
  const binId = new (0, _anchor.BN)(binIdNumber);
11332
11313
  const lowerBinArrayIndex = binIdToBinArrayIndex(binId);
11333
11314
  const upperBinArrayIndex = lowerBinArrayIndex.add(new (0, _anchor.BN)(1));
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
- );
11315
+ const [lowerBinArray] = deriveBinArray(this.pubkey, lowerBinArrayIndex, this.program.programId);
11316
+ const [upperBinArray] = deriveBinArray(this.pubkey, upperBinArrayIndex, this.program.programId);
11317
+ const [positionPda] = derivePosition(this.pubkey, base, binId, new (0, _anchor.BN)(1), this.program.programId);
11351
11318
  const preInstructions = [];
11352
11319
  const [
11353
11320
  { ataPubKey: userTokenX, ix: createPayerTokenXIx },
@@ -11381,13 +11348,11 @@ var DLMM = class {
11381
11348
  if (isOverflowDefaultBinArrayBitmap(lowerBinArrayIndex)) {
11382
11349
  const bitmapExtensionAccount = accounts[3];
11383
11350
  if (!bitmapExtensionAccount) {
11384
- preInstructions.push(
11385
- await this.program.methods.initializeBinArrayBitmapExtension().accounts({
11386
- binArrayBitmapExtension,
11387
- funder: payer,
11388
- lbPair: this.pubkey
11389
- }).instruction()
11390
- );
11351
+ preInstructions.push(await this.program.methods.initializeBinArrayBitmapExtension().accounts({
11352
+ binArrayBitmapExtension,
11353
+ funder: payer,
11354
+ lbPair: this.pubkey
11355
+ }).instruction());
11391
11356
  }
11392
11357
  } else {
11393
11358
  binArrayBitmapExtension = this.program.programId;
@@ -11403,34 +11368,17 @@ var DLMM = class {
11403
11368
  true
11404
11369
  );
11405
11370
  if (shouldSeedPositionOwner) {
11406
- const positionOwnerTokenXAccount = await this.program.provider.connection.getAccountInfo(
11407
- positionOwnerTokenX
11408
- );
11371
+ const positionOwnerTokenXAccount = await this.program.provider.connection.getAccountInfo(positionOwnerTokenX);
11409
11372
  if (positionOwnerTokenXAccount) {
11410
11373
  const account = _spltoken.AccountLayout.decode(positionOwnerTokenXAccount.data);
11411
11374
  if (account.amount == BigInt(0)) {
11412
- const transferIx = _spltoken.createTransferInstruction.call(void 0,
11413
- operatorTokenX,
11414
- positionOwnerTokenX,
11415
- payer,
11416
- 1
11417
- );
11375
+ const transferIx = _spltoken.createTransferInstruction.call(void 0, operatorTokenX, positionOwnerTokenX, payer, 1);
11418
11376
  preInstructions.push(transferIx);
11419
11377
  }
11420
11378
  } else {
11421
- const createPositionOwnerTokenXIx = _spltoken.createAssociatedTokenAccountInstruction.call(void 0,
11422
- payer,
11423
- positionOwnerTokenX,
11424
- positionOwner,
11425
- this.lbPair.tokenXMint
11426
- );
11379
+ const createPositionOwnerTokenXIx = _spltoken.createAssociatedTokenAccountInstruction.call(void 0, payer, positionOwnerTokenX, positionOwner, this.lbPair.tokenXMint);
11427
11380
  preInstructions.push(createPositionOwnerTokenXIx);
11428
- const transferIx = _spltoken.createTransferInstruction.call(void 0,
11429
- operatorTokenX,
11430
- positionOwnerTokenX,
11431
- payer,
11432
- 1
11433
- );
11381
+ const transferIx = _spltoken.createTransferInstruction.call(void 0, operatorTokenX, positionOwnerTokenX, payer, 1);
11434
11382
  preInstructions.push(transferIx);
11435
11383
  }
11436
11384
  }
@@ -12268,26 +12216,20 @@ var DLMM = class {
12268
12216
  ...fetchedBinArrays,
12269
12217
  ...hasCachedUpperBinArray && !isSingleBinArray ? [upperBinArray] : []
12270
12218
  ];
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
- );
12219
+ const binsById = new Map(binArrays.filter((x) => x != null).flatMap(({ bins, index }) => {
12220
+ const [lowerBinId2] = getBinArrayLowerUpperBinId(index);
12221
+ return bins.map((b, i) => [lowerBinId2.toNumber() + i, b]);
12222
+ }));
12279
12223
  const version = _nullishCoalesce(_optionalChain([binArrays, 'access', _86 => _86.find, 'call', _87 => _87((binArray) => binArray != null), 'optionalAccess', _88 => _88.version]), () => ( 1));
12280
- return Array.from(
12281
- enumerateBins(
12282
- binsById,
12283
- lowerBinId,
12284
- upperBinId,
12285
- this.lbPair.binStep,
12286
- baseTokenDecimal,
12287
- quoteTokenDecimal,
12288
- version
12289
- )
12290
- );
12224
+ return Array.from(enumerateBins(
12225
+ binsById,
12226
+ lowerBinId,
12227
+ upperBinId,
12228
+ this.lbPair.binStep,
12229
+ baseTokenDecimal,
12230
+ quoteTokenDecimal,
12231
+ version
12232
+ ));
12291
12233
  }
12292
12234
  async binArraysToBeCreate(lowerBinArrayIndex, upperBinArrayIndex) {
12293
12235
  const binArrayIndexes = Array.from(