@meteora-ag/dlmm 1.0.39-rc.26 → 1.0.39-rc.28
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 +2 -2
- package/dist/index.js +18 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -31
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -9898,39 +9898,26 @@ var DLMM = class {
|
|
|
9898
9898
|
lastValidBlockHeight
|
|
9899
9899
|
}).add(syncWithMarketPriceTx);
|
|
9900
9900
|
}
|
|
9901
|
-
async getMaxPrice(
|
|
9902
|
-
const
|
|
9903
|
-
|
|
9904
|
-
|
|
9901
|
+
async getMaxPrice() {
|
|
9902
|
+
const binArrayIndex = findNextBinArrayIndexWithLiquidity(
|
|
9903
|
+
false,
|
|
9904
|
+
new BN9(this.lbPair.parameters.maxBinId),
|
|
9905
|
+
this.lbPair,
|
|
9906
|
+
this.binArrayBitmapExtension?.account ?? null
|
|
9905
9907
|
);
|
|
9906
|
-
|
|
9907
|
-
|
|
9908
|
-
|
|
9909
|
-
|
|
9910
|
-
amountX: amountX.toString(),
|
|
9911
|
-
amountY: amountY.toString(),
|
|
9912
|
-
price: this.fromPricePerLamport(Number(price) / (2 ** 64 - 1))
|
|
9913
|
-
}))
|
|
9914
|
-
)
|
|
9908
|
+
const [binArrayPubkey] = deriveBinArray(
|
|
9909
|
+
this.pubkey,
|
|
9910
|
+
binArrayIndex,
|
|
9911
|
+
this.program.programId
|
|
9915
9912
|
);
|
|
9916
|
-
|
|
9917
|
-
|
|
9918
|
-
|
|
9919
|
-
|
|
9920
|
-
|
|
9921
|
-
|
|
9922
|
-
|
|
9923
|
-
|
|
9924
|
-
} else {
|
|
9925
|
-
const lastBinWithLiquidityIndex = bins.findLastIndex(
|
|
9926
|
-
({ amountX }) => !amountX.isZero()
|
|
9927
|
-
);
|
|
9928
|
-
binPriceWithLastLiquidity = bins[lastBinWithLiquidityIndex].price.toString();
|
|
9929
|
-
count = -1;
|
|
9930
|
-
}
|
|
9931
|
-
}
|
|
9932
|
-
}
|
|
9933
|
-
console.log(binPriceWithLastLiquidity);
|
|
9913
|
+
const binArrayAccount = await this.program.account.binArray.fetch(
|
|
9914
|
+
binArrayPubkey
|
|
9915
|
+
);
|
|
9916
|
+
const { bins } = binArrayAccount;
|
|
9917
|
+
const lastBinWithLiquidityIndex = bins.findLastIndex(
|
|
9918
|
+
({ amountX }) => !amountX.isZero()
|
|
9919
|
+
);
|
|
9920
|
+
const binPriceWithLastLiquidity = bins[lastBinWithLiquidityIndex].price.toString();
|
|
9934
9921
|
return this.fromPricePerLamport(
|
|
9935
9922
|
Number(binPriceWithLastLiquidity) / (2 ** 64 - 1)
|
|
9936
9923
|
);
|