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

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<number>;
5319
+ getMaxPrice(minPrice: string, binArrays?: BinArrayAccount[]): Promise<number>;
5320
5320
  /** Private static method */
5321
5321
  private static getBinArrays;
5322
5322
  private static getClaimableLMReward;
package/dist/index.js CHANGED
@@ -9904,21 +9904,12 @@ var DLMM = class {
9904
9904
  lastValidBlockHeight
9905
9905
  }).add(syncWithMarketPriceTx);
9906
9906
  }
9907
- async getLastPrice(minPrice) {
9908
- const binArrays = await this.getBinArrays();
9909
- console.log(
9910
- "\u{1F680} ~ DLMM ~ getLastPrice ~ bins:",
9911
- binArrays.flatMap(
9912
- ({ account: { bins } }) => bins.map(({ amountX, amountY }) => ({
9913
- amountX: amountX.toString(),
9914
- amountY: amountY.toString()
9915
- }))
9916
- )
9917
- );
9918
- let count = binArrays.length - 1;
9907
+ async getMaxPrice(minPrice, binArrays) {
9908
+ const _binArrays = binArrays || await this.getBinArrays();
9909
+ let count = _binArrays.length - 1;
9919
9910
  let binPriceWithLastLiquidity = minPrice;
9920
9911
  while (count >= 0) {
9921
- const binArray = binArrays[count];
9912
+ const binArray = _binArrays[count];
9922
9913
  if (binArray) {
9923
9914
  const bins = binArray.account.bins;
9924
9915
  if (bins.every(({ amountX }) => amountX.isZero())) {
@@ -9927,10 +9918,6 @@ var DLMM = class {
9927
9918
  const lastBinWithLiquidityIndex = bins.findLastIndex(
9928
9919
  ({ amountX }) => !amountX.isZero()
9929
9920
  );
9930
- console.log(
9931
- bins[lastBinWithLiquidityIndex].amountX.toString(),
9932
- bins[lastBinWithLiquidityIndex].amountY.toString()
9933
- );
9934
9921
  binPriceWithLastLiquidity = bins[lastBinWithLiquidityIndex].price.toString();
9935
9922
  count = -1;
9936
9923
  }