@meteora-ag/dlmm 1.0.41-rc.0 → 1.0.41

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
@@ -5838,15 +5838,15 @@ function extensionBitmapRange() {
5838
5838
  }
5839
5839
  function findSetBit(startIndex, endIndex, binArrayBitmapExtension) {
5840
5840
  const getBinArrayOffset = (binArrayIndex) => {
5841
- return binArrayIndex > 0 ? binArrayIndex % BIN_ARRAY_BITMAP_SIZE.toNumber() - 1 : Math.abs(binArrayIndex - 1) % BIN_ARRAY_BITMAP_SIZE.toNumber();
5841
+ return binArrayIndex.gt(new BN6(0)) ? binArrayIndex.mod(BIN_ARRAY_BITMAP_SIZE) : binArrayIndex.add(new BN6(1)).neg().mod(BIN_ARRAY_BITMAP_SIZE);
5842
5842
  };
5843
5843
  const getBitmapOffset = (binArrayIndex) => {
5844
- return binArrayIndex > 0 ? binArrayIndex / BIN_ARRAY_BITMAP_SIZE.toNumber() - 1 : -(binArrayIndex + 1) / BIN_ARRAY_BITMAP_SIZE.toNumber() - 1;
5844
+ return binArrayIndex.gt(new BN6(0)) ? binArrayIndex.div(BIN_ARRAY_BITMAP_SIZE).sub(new BN6(1)) : binArrayIndex.add(new BN6(1)).neg().div(BIN_ARRAY_BITMAP_SIZE).sub(new BN6(1));
5845
5845
  };
5846
5846
  if (startIndex <= endIndex) {
5847
5847
  for (let i = startIndex; i <= endIndex; i++) {
5848
- const binArrayOffset = getBinArrayOffset(i);
5849
- const bitmapOffset = getBitmapOffset(i);
5848
+ const binArrayOffset = getBinArrayOffset(new BN6(i)).toNumber();
5849
+ const bitmapOffset = getBitmapOffset(new BN6(i)).toNumber();
5850
5850
  const bitmapChunks = i > 0 ? binArrayBitmapExtension.positiveBinArrayBitmap[bitmapOffset] : binArrayBitmapExtension.negativeBinArrayBitmap[bitmapOffset];
5851
5851
  const bitmap = buildBitmapFromU64Arrays(bitmapChunks, 1 /* U512 */);
5852
5852
  if (bitmap.testn(binArrayOffset)) {
@@ -5855,8 +5855,8 @@ function findSetBit(startIndex, endIndex, binArrayBitmapExtension) {
5855
5855
  }
5856
5856
  } else {
5857
5857
  for (let i = startIndex; i >= endIndex; i--) {
5858
- const binArrayOffset = getBinArrayOffset(i);
5859
- const bitmapOffset = getBitmapOffset(i);
5858
+ const binArrayOffset = getBinArrayOffset(new BN6(i)).toNumber();
5859
+ const bitmapOffset = getBitmapOffset(new BN6(i)).toNumber();
5860
5860
  const bitmapChunks = i > 0 ? binArrayBitmapExtension.positiveBinArrayBitmap[bitmapOffset] : binArrayBitmapExtension.negativeBinArrayBitmap[bitmapOffset];
5861
5861
  const bitmap = buildBitmapFromU64Arrays(bitmapChunks, 1 /* U512 */);
5862
5862
  if (bitmap.testn(binArrayOffset)) {
@@ -9898,9 +9898,8 @@ var DLMM = class {
9898
9898
  lastValidBlockHeight
9899
9899
  }).add(syncWithMarketPriceTx);
9900
9900
  }
9901
- async getMaxPrice(binArrayAccounts) {
9902
- const binArrays = binArrayAccounts || await this.getBinArrayForSwap(false);
9903
- const sortedBinArrays = binArrays.sort(
9901
+ async getMaxPriceInBinArrays(binArrayAccounts) {
9902
+ const sortedBinArrays = binArrayAccounts.sort(
9904
9903
  ({ account: { index: indexA } }, { account: { index: indexB } }) => indexA.toNumber() - indexB.toNumber()
9905
9904
  );
9906
9905
  let count = sortedBinArrays.length - 1;