@meteora-ag/dlmm 1.0.39-rc.13 → 1.0.39-rc.15
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 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9906,23 +9906,25 @@ var DLMM = class {
|
|
|
9906
9906
|
}
|
|
9907
9907
|
async getLastPrice(minPrice) {
|
|
9908
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
|
+
);
|
|
9909
9918
|
let count = binArrays.length - 1;
|
|
9910
9919
|
let binPriceWithLastLiquidity = minPrice;
|
|
9911
9920
|
while (count >= 0) {
|
|
9912
9921
|
const binArray = binArrays[count];
|
|
9913
9922
|
if (binArray) {
|
|
9914
9923
|
const bins = binArray.account.bins;
|
|
9915
|
-
console.log(
|
|
9916
|
-
"\u{1F680} ~ DLMM ~ getLastPrice ~ bins:",
|
|
9917
|
-
bins.map(({ amountX, amountY }) => ({
|
|
9918
|
-
amountX: amountX.toString(),
|
|
9919
|
-
amountY: amountY.toString()
|
|
9920
|
-
}))
|
|
9921
|
-
);
|
|
9922
9924
|
if (bins.every(({ liquiditySupply }) => liquiditySupply.isZero())) {
|
|
9923
9925
|
count--;
|
|
9924
9926
|
} else {
|
|
9925
|
-
const lastBinWithLiquidityIndex = bins.
|
|
9927
|
+
const lastBinWithLiquidityIndex = bins.findIndex(
|
|
9926
9928
|
({ liquiditySupply }) => !liquiditySupply.isZero()
|
|
9927
9929
|
);
|
|
9928
9930
|
console.log(
|