@meteora-ag/dlmm 1.6.0-rc.27 → 1.6.0-rc.28

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.mjs CHANGED
@@ -15719,17 +15719,46 @@ var DLMM = class {
15719
15719
  }
15720
15720
  async quoteCreatePosition({ strategy }) {
15721
15721
  const { minBinId, maxBinId } = strategy;
15722
+ const binCount = maxBinId - minBinId + 1;
15723
+ const positionCount = Math.floor(binCount / MAX_BINS_PER_POSITION.toNumber()) + 1;
15724
+ let positionReallocCost = 0;
15725
+ for (let i = 0; i < positionCount; i++) {
15726
+ const lowerBinId = minBinId;
15727
+ const upperBinId = Math.min(
15728
+ maxBinId,
15729
+ lowerBinId + DEFAULT_BIN_PER_POSITION.toNumber() - 1
15730
+ );
15731
+ const maxUpperBinId = Math.min(
15732
+ maxBinId,
15733
+ upperBinId + MAX_BINS_PER_POSITION.toNumber() - 1
15734
+ );
15735
+ const binToExpand = maxUpperBinId - upperBinId;
15736
+ const { positionExtendCost } = await this.quoteExtendPosition(
15737
+ new BN21(lowerBinId),
15738
+ new BN21(upperBinId),
15739
+ new BN21(binToExpand)
15740
+ );
15741
+ positionReallocCost += positionExtendCost.toNumber();
15742
+ }
15722
15743
  const lowerBinArrayIndex = binIdToBinArrayIndex(new BN21(minBinId));
15723
15744
  const upperBinArrayIndex = BN21.max(
15724
15745
  binIdToBinArrayIndex(new BN21(maxBinId)),
15725
15746
  lowerBinArrayIndex.add(new BN21(1))
15726
15747
  );
15748
+ let bitmapExtensionCost = 0;
15749
+ if (isOverflowDefaultBinArrayBitmap(lowerBinArrayIndex) || isOverflowDefaultBinArrayBitmap(upperBinArrayIndex)) {
15750
+ bitmapExtensionCost = BIN_ARRAY_BITMAP_FEE;
15751
+ }
15727
15752
  const binArraysCount = (await this.binArraysToBeCreate(lowerBinArrayIndex, upperBinArrayIndex)).length;
15728
15753
  const transactionCount = Math.ceil(
15729
15754
  (maxBinId - minBinId + 1) / DEFAULT_BIN_PER_POSITION.toNumber()
15730
15755
  );
15731
15756
  const binArrayCost = binArraysCount * BIN_ARRAY_FEE;
15732
15757
  return {
15758
+ positionCount,
15759
+ positionCost: positionCount * POSITION_FEE,
15760
+ positionReallocCost,
15761
+ bitmapExtensionCost,
15733
15762
  binArraysCount,
15734
15763
  binArrayCost,
15735
15764
  transactionCount