@meteora-ag/dlmm 1.0.39-rc.30 → 1.0.39-rc.33
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 +1 -1
- package/dist/index.js +20 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -9898,12 +9898,27 @@ var DLMM = class {
|
|
|
9898
9898
|
lastValidBlockHeight
|
|
9899
9899
|
}).add(syncWithMarketPriceTx);
|
|
9900
9900
|
}
|
|
9901
|
-
async
|
|
9902
|
-
const
|
|
9903
|
-
|
|
9904
|
-
({ amountX }) => !amountX.isZero()
|
|
9901
|
+
async getMaxPriceInBinArrays(binArrayAccounts) {
|
|
9902
|
+
const sortedBinArrays = binArrayAccounts.sort(
|
|
9903
|
+
({ account: { index: indexA } }, { account: { index: indexB } }) => indexA.toNumber() - indexB.toNumber()
|
|
9905
9904
|
);
|
|
9906
|
-
|
|
9905
|
+
let count = sortedBinArrays.length - 1;
|
|
9906
|
+
let binPriceWithLastLiquidity;
|
|
9907
|
+
while (count >= 0) {
|
|
9908
|
+
const binArray = sortedBinArrays[count];
|
|
9909
|
+
if (binArray) {
|
|
9910
|
+
const bins = binArray.account.bins.reverse();
|
|
9911
|
+
if (bins.every(({ amountX }) => amountX.isZero())) {
|
|
9912
|
+
count--;
|
|
9913
|
+
} else {
|
|
9914
|
+
const lastBinWithLiquidityIndex = bins.findLastIndex(
|
|
9915
|
+
({ amountX }) => !amountX.isZero()
|
|
9916
|
+
);
|
|
9917
|
+
binPriceWithLastLiquidity = bins[lastBinWithLiquidityIndex].price.toString();
|
|
9918
|
+
count = -1;
|
|
9919
|
+
}
|
|
9920
|
+
}
|
|
9921
|
+
}
|
|
9907
9922
|
return this.fromPricePerLamport(
|
|
9908
9923
|
Number(binPriceWithLastLiquidity) / (2 ** 64 - 1)
|
|
9909
9924
|
);
|