@meteora-ag/dlmm 1.0.39-rc.6 → 1.0.39-rc.8

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
@@ -5316,7 +5316,7 @@ declare class DLMM {
5316
5316
  * @returns {Promise<Transaction>}
5317
5317
  */
5318
5318
  syncWithMarketPrice(marketPrice: number, owner: PublicKey): Promise<Transaction>;
5319
- getLastPrice(minPrice: string): Promise<string>;
5319
+ getLastPrice(minPrice: string): Promise<number>;
5320
5320
  /** Private static method */
5321
5321
  private static getBinArrays;
5322
5322
  private static getClaimableLMReward;
package/dist/index.js CHANGED
@@ -9909,25 +9909,25 @@ var DLMM = class {
9909
9909
  let count = 0;
9910
9910
  let binPriceWithLastLiquidity = minPrice;
9911
9911
  while (count <= binArrays.length - 1) {
9912
- const binArray = binArrays[count];
9912
+ const binArray = binArrays.reverse()[count];
9913
9913
  if (binArray) {
9914
9914
  const bins = binArray.account.bins;
9915
- if (bins[bins.length - 1].liquiditySupply.gt(new (0, _anchor.BN)(0))) {
9915
+ if (bins.every(({ liquiditySupply }) => liquiditySupply.isZero())) {
9916
9916
  count++;
9917
9917
  } else {
9918
9918
  const lastBinWithLiquidityIndex = bins.findIndex(
9919
- ({ liquiditySupply }) => liquiditySupply.isZero()
9919
+ ({ liquiditySupply }) => !liquiditySupply.isZero()
9920
9920
  );
9921
9921
  console.log(
9922
- bins[lastBinWithLiquidityIndex - 1].amountX.toString(),
9923
- bins[lastBinWithLiquidityIndex - 1].amountY.toString()
9922
+ bins[lastBinWithLiquidityIndex].amountX.toString(),
9923
+ bins[lastBinWithLiquidityIndex].amountY.toString()
9924
9924
  );
9925
- binPriceWithLastLiquidity = bins[lastBinWithLiquidityIndex - 1].price.toString();
9925
+ binPriceWithLastLiquidity = bins[lastBinWithLiquidityIndex].price.toString();
9926
9926
  count = binArrays.length;
9927
9927
  }
9928
9928
  }
9929
9929
  }
9930
- return binPriceWithLastLiquidity;
9930
+ return Number(binPriceWithLastLiquidity) / (2 ** 64 - 1);
9931
9931
  }
9932
9932
  /** Private static method */
9933
9933
  static async getBinArrays(program, lbPairPubkey) {