@meteora-ag/dlmm 1.0.39-rc.3 → 1.0.39-rc.32
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/README.md +1 -0
- package/dist/index.d.ts +2 -7
- package/dist/index.js +20 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -22
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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,31 @@ var DLMM = class {
|
|
|
9904
9898
|
lastValidBlockHeight
|
|
9905
9899
|
}).add(syncWithMarketPriceTx);
|
|
9906
9900
|
}
|
|
9907
|
-
async
|
|
9908
|
-
const
|
|
9909
|
-
const
|
|
9910
|
-
|
|
9911
|
-
|
|
9912
|
-
|
|
9913
|
-
|
|
9901
|
+
async getMaxPrice(binArrayAccounts) {
|
|
9902
|
+
const binArrays = binArrayAccounts || await this.getBinArrayForSwap(false);
|
|
9903
|
+
const sortedBinArrays = binArrays.sort(
|
|
9904
|
+
({ account: { index: indexA } }, { account: { index: indexB } }) => indexA.toNumber() - indexB.toNumber()
|
|
9905
|
+
);
|
|
9906
|
+
let count = sortedBinArrays.length - 1;
|
|
9907
|
+
let binPriceWithLastLiquidity;
|
|
9908
|
+
while (count >= 0) {
|
|
9909
|
+
const binArray = sortedBinArrays[count];
|
|
9914
9910
|
if (binArray) {
|
|
9915
|
-
const bins = binArray.account.bins;
|
|
9916
|
-
if (bins
|
|
9917
|
-
count
|
|
9911
|
+
const bins = binArray.account.bins.reverse();
|
|
9912
|
+
if (bins.every(({ amountX }) => amountX.isZero())) {
|
|
9913
|
+
count--;
|
|
9918
9914
|
} else {
|
|
9919
|
-
const lastBinWithLiquidityIndex = bins.
|
|
9920
|
-
({
|
|
9915
|
+
const lastBinWithLiquidityIndex = bins.findLastIndex(
|
|
9916
|
+
({ amountX }) => !amountX.isZero()
|
|
9921
9917
|
);
|
|
9922
|
-
binPriceWithLastLiquidity = bins[lastBinWithLiquidityIndex
|
|
9923
|
-
count =
|
|
9918
|
+
binPriceWithLastLiquidity = bins[lastBinWithLiquidityIndex].price.toString();
|
|
9919
|
+
count = -1;
|
|
9924
9920
|
}
|
|
9925
9921
|
}
|
|
9926
9922
|
}
|
|
9927
|
-
return
|
|
9923
|
+
return this.fromPricePerLamport(
|
|
9924
|
+
Number(binPriceWithLastLiquidity) / (2 ** 64 - 1)
|
|
9925
|
+
);
|
|
9928
9926
|
}
|
|
9929
9927
|
/** Private static method */
|
|
9930
9928
|
static async getBinArrays(program, lbPairPubkey) {
|