@meteora-ag/dlmm 1.0.39-rc.15 → 1.0.39-rc.16

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
@@ -9915,24 +9915,24 @@ var DLMM = class {
9915
9915
  }))
9916
9916
  )
9917
9917
  );
9918
- let count = binArrays.length - 1;
9918
+ let count = 0;
9919
9919
  let binPriceWithLastLiquidity = minPrice;
9920
- while (count >= 0) {
9920
+ while (count <= binArrays.length - 1) {
9921
9921
  const binArray = binArrays[count];
9922
9922
  if (binArray) {
9923
9923
  const bins = binArray.account.bins;
9924
- if (bins.every(({ liquiditySupply }) => liquiditySupply.isZero())) {
9924
+ if (bins.every(({ amountX }) => !amountX.isZero())) {
9925
9925
  count--;
9926
9926
  } else {
9927
9927
  const lastBinWithLiquidityIndex = bins.findIndex(
9928
- ({ liquiditySupply }) => !liquiditySupply.isZero()
9928
+ ({ liquiditySupply }) => liquiditySupply.isZero()
9929
9929
  );
9930
9930
  console.log(
9931
- bins[lastBinWithLiquidityIndex].amountX.toString(),
9932
- bins[lastBinWithLiquidityIndex].amountY.toString()
9931
+ bins[lastBinWithLiquidityIndex - 1].amountX.toString(),
9932
+ bins[lastBinWithLiquidityIndex - 1].amountY.toString()
9933
9933
  );
9934
- binPriceWithLastLiquidity = bins[lastBinWithLiquidityIndex].price.toString();
9935
- count = -1;
9934
+ binPriceWithLastLiquidity = bins[lastBinWithLiquidityIndex - 1].price.toString();
9935
+ count = binArrays.length;
9936
9936
  }
9937
9937
  }
9938
9938
  }