@meteora-ag/dlmm 1.0.39-rc.3 → 1.0.39-rc.30

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
@@ -1231,11 +1231,6 @@ var IDL = {
1231
1231
  isMut: true,
1232
1232
  isSigner: false
1233
1233
  },
1234
- {
1235
- name: "feeOwner",
1236
- isMut: false,
1237
- isSigner: true
1238
- },
1239
1234
  {
1240
1235
  name: "tokenXProgram",
1241
1236
  isMut: false,
@@ -9087,10 +9082,9 @@ var DLMM = class {
9087
9082
  swapForY,
9088
9083
  activeId,
9089
9084
  this.lbPair,
9090
- this.binArrayBitmapExtension?.account,
9085
+ this.binArrayBitmapExtension?.account ?? null,
9091
9086
  binArrays
9092
9087
  );
9093
- console.log("\u{1F680} ~ DLMM ~ binArrayAccountToSwap:", binArrayAccountToSwap);
9094
9088
  if (binArrayAccountToSwap == null) {
9095
9089
  throw new Error("Insufficient liquidity");
9096
9090
  }
@@ -9904,27 +9898,15 @@ var DLMM = class {
9904
9898
  lastValidBlockHeight
9905
9899
  }).add(syncWithMarketPriceTx);
9906
9900
  }
9907
- async getLastPrice() {
9908
- const { price } = await this.getActiveBin();
9909
- const binArrays = await this.getBinArrays();
9910
- let count = 0;
9911
- let binPriceWithLastLiquidity = price;
9912
- while (count <= binArrays.length - 1) {
9913
- const binArray = binArrays[count];
9914
- if (binArray) {
9915
- const bins = binArray.account.bins;
9916
- if (bins[bins.length - 1].liquiditySupply.gt(new BN9(0))) {
9917
- count++;
9918
- } else {
9919
- const lastBinWithLiquidityIndex = bins.findIndex(
9920
- ({ liquiditySupply }) => liquiditySupply.isZero()
9921
- );
9922
- binPriceWithLastLiquidity = bins[lastBinWithLiquidityIndex - 1].price.toString();
9923
- count = binArrays.length;
9924
- }
9925
- }
9926
- }
9927
- return binPriceWithLastLiquidity;
9901
+ async getMaxPrice(binArrayAccount) {
9902
+ const { bins } = binArrayAccount;
9903
+ const lastBinWithLiquidityIndex = bins.findLastIndex(
9904
+ ({ amountX }) => !amountX.isZero()
9905
+ );
9906
+ const binPriceWithLastLiquidity = bins[lastBinWithLiquidityIndex].price.toString();
9907
+ return this.fromPricePerLamport(
9908
+ Number(binPriceWithLastLiquidity) / (2 ** 64 - 1)
9909
+ );
9928
9910
  }
9929
9911
  /** Private static method */
9930
9912
  static async getBinArrays(program, lbPairPubkey) {