@meteora-ag/dlmm 1.0.39-rc.11 → 1.0.39-rc.13
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.js +10 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9906,9 +9906,9 @@ var DLMM = class {
|
|
|
9906
9906
|
}
|
|
9907
9907
|
async getLastPrice(minPrice) {
|
|
9908
9908
|
const binArrays = await this.getBinArrays();
|
|
9909
|
-
let count =
|
|
9909
|
+
let count = binArrays.length - 1;
|
|
9910
9910
|
let binPriceWithLastLiquidity = minPrice;
|
|
9911
|
-
while (count
|
|
9911
|
+
while (count >= 0) {
|
|
9912
9912
|
const binArray = binArrays[count];
|
|
9913
9913
|
if (binArray) {
|
|
9914
9914
|
const bins = binArray.account.bins;
|
|
@@ -9919,18 +9919,18 @@ var DLMM = class {
|
|
|
9919
9919
|
amountY: amountY.toString()
|
|
9920
9920
|
}))
|
|
9921
9921
|
);
|
|
9922
|
-
if (bins
|
|
9923
|
-
count
|
|
9922
|
+
if (bins.every(({ liquiditySupply }) => liquiditySupply.isZero())) {
|
|
9923
|
+
count--;
|
|
9924
9924
|
} else {
|
|
9925
|
-
const lastBinWithLiquidityIndex = bins.
|
|
9926
|
-
({ liquiditySupply }) => liquiditySupply.isZero()
|
|
9925
|
+
const lastBinWithLiquidityIndex = bins.findLastIndex(
|
|
9926
|
+
({ liquiditySupply }) => !liquiditySupply.isZero()
|
|
9927
9927
|
);
|
|
9928
9928
|
console.log(
|
|
9929
|
-
bins[lastBinWithLiquidityIndex
|
|
9930
|
-
bins[lastBinWithLiquidityIndex
|
|
9929
|
+
bins[lastBinWithLiquidityIndex].amountX.toString(),
|
|
9930
|
+
bins[lastBinWithLiquidityIndex].amountY.toString()
|
|
9931
9931
|
);
|
|
9932
|
-
binPriceWithLastLiquidity = bins[lastBinWithLiquidityIndex
|
|
9933
|
-
count =
|
|
9932
|
+
binPriceWithLastLiquidity = bins[lastBinWithLiquidityIndex].price.toString();
|
|
9933
|
+
count = -1;
|
|
9934
9934
|
}
|
|
9935
9935
|
}
|
|
9936
9936
|
}
|