@meteora-ag/dlmm 1.0.39-rc.18 → 1.0.39-rc.19

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.js CHANGED
@@ -9906,10 +9906,13 @@ var DLMM = class {
9906
9906
  }
9907
9907
  async getMaxPrice(minPrice, binArrays) {
9908
9908
  const _binArrays = binArrays || await this.getBinArrays();
9909
- let count = _binArrays.length - 1;
9909
+ const sortedBinArrays = _binArrays.sort(
9910
+ ({ account: { index: indexA } }, { account: { index: indexB } }) => indexA.toNumber() - indexB.toNumber()
9911
+ );
9912
+ let count = sortedBinArrays.length - 1;
9910
9913
  let binPriceWithLastLiquidity = minPrice;
9911
9914
  while (count >= 0) {
9912
- const binArray = _binArrays[count];
9915
+ const binArray = sortedBinArrays[count];
9913
9916
  if (binArray) {
9914
9917
  const bins = binArray.account.bins;
9915
9918
  if (bins.every(({ amountX }) => amountX.isZero())) {