@meteora-ag/dlmm 1.5.1 → 1.5.2-rc.0
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 +8 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -26
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8530,24 +8530,6 @@ function getPositionCount(minBinId, maxBinId) {
|
|
|
8530
8530
|
const positionCount = binDelta.div(MAX_BIN_PER_POSITION);
|
|
8531
8531
|
return positionCount.add(new (0, _anchor.BN)(1));
|
|
8532
8532
|
}
|
|
8533
|
-
function findOptimumDecompressMultiplier(binAmount, tokenDecimal) {
|
|
8534
|
-
let multiplier = new (0, _anchor.BN)(10).pow(tokenDecimal);
|
|
8535
|
-
while (!multiplier.isZero()) {
|
|
8536
|
-
let found = true;
|
|
8537
|
-
for (const [_binId, amount] of binAmount) {
|
|
8538
|
-
const compressedAmount = amount.div(multiplier);
|
|
8539
|
-
if (compressedAmount.isZero()) {
|
|
8540
|
-
multiplier = multiplier.div(new (0, _anchor.BN)(10));
|
|
8541
|
-
found = false;
|
|
8542
|
-
break;
|
|
8543
|
-
}
|
|
8544
|
-
}
|
|
8545
|
-
if (found) {
|
|
8546
|
-
return multiplier;
|
|
8547
|
-
}
|
|
8548
|
-
}
|
|
8549
|
-
throw "Couldn't find optimum multiplier";
|
|
8550
|
-
}
|
|
8551
8533
|
function compressBinAmount(binAmount, multiplier) {
|
|
8552
8534
|
const compressedBinAmount = /* @__PURE__ */ new Map();
|
|
8553
8535
|
let totalAmount = new (0, _anchor.BN)(0);
|
|
@@ -8584,9 +8566,6 @@ function generateAmountForBinRange(amount, binStep, tokenXDecimal, tokenYDecimal
|
|
|
8584
8566
|
maxPrice,
|
|
8585
8567
|
k
|
|
8586
8568
|
);
|
|
8587
|
-
if (binAmount.isZero()) {
|
|
8588
|
-
throw "bin amount is zero";
|
|
8589
|
-
}
|
|
8590
8569
|
binAmounts.set(i, binAmount);
|
|
8591
8570
|
}
|
|
8592
8571
|
return binAmounts;
|
|
@@ -10817,6 +10796,7 @@ var DLMM = class {
|
|
|
10817
10796
|
const positionsV2 = await program.account.positionV2.all([
|
|
10818
10797
|
positionOwnerFilter(userPubKey)
|
|
10819
10798
|
]);
|
|
10799
|
+
console.log("\u{1F680} ~ DLMM ~ positionsV2:", positionsV2);
|
|
10820
10800
|
const positionWrappers = [
|
|
10821
10801
|
...positionsV2.map((p) => new PositionV2Wrapper(p.publicKey, p.account))
|
|
10822
10802
|
];
|
|
@@ -10976,6 +10956,7 @@ var DLMM = class {
|
|
|
10976
10956
|
rewardMint1,
|
|
10977
10957
|
positionBinArraysMapV2
|
|
10978
10958
|
);
|
|
10959
|
+
console.log("\u{1F680} ~ DLMM ~ positionData:", positionData);
|
|
10979
10960
|
if (positionData) {
|
|
10980
10961
|
positionsMap.set(lbPair.toBase58(), {
|
|
10981
10962
|
publicKey: lbPair,
|
|
@@ -11875,6 +11856,10 @@ var DLMM = class {
|
|
|
11875
11856
|
const positions = [
|
|
11876
11857
|
...positionsV2.map((p) => new PositionV2Wrapper(p.publicKey, p.account))
|
|
11877
11858
|
];
|
|
11859
|
+
console.log(
|
|
11860
|
+
"\u{1F680} ~ DLMM ~ getPositionsByUserAndLbPair ~ positions:",
|
|
11861
|
+
positions
|
|
11862
|
+
);
|
|
11878
11863
|
if (!positions) {
|
|
11879
11864
|
throw new Error("Error fetching positions");
|
|
11880
11865
|
}
|
|
@@ -13940,10 +13925,7 @@ var DLMM = class {
|
|
|
13940
13925
|
maxBinId,
|
|
13941
13926
|
k
|
|
13942
13927
|
);
|
|
13943
|
-
const decompressMultiplier =
|
|
13944
|
-
binDepositAmount,
|
|
13945
|
-
new (0, _anchor.BN)(this.tokenX.mint.decimals)
|
|
13946
|
-
);
|
|
13928
|
+
const decompressMultiplier = new (0, _anchor.BN)(10 ** this.tokenX.mint.decimals);
|
|
13947
13929
|
let { compressedBinAmount, compressionLoss } = compressBinAmount(
|
|
13948
13930
|
binDepositAmount,
|
|
13949
13931
|
decompressMultiplier
|
|
@@ -14106,7 +14088,7 @@ var DLMM = class {
|
|
|
14106
14088
|
}).instruction()
|
|
14107
14089
|
);
|
|
14108
14090
|
}
|
|
14109
|
-
if (instructions.length >
|
|
14091
|
+
if (instructions.length > 1) {
|
|
14110
14092
|
initializeBinArraysAndPositionIxs.push(instructions);
|
|
14111
14093
|
instructions = [];
|
|
14112
14094
|
}
|