@meteora-ag/dlmm 1.2.2-rc.1 → 1.2.3
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 +6 -34
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -34
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -2
package/dist/index.js
CHANGED
|
@@ -8925,20 +8925,10 @@ var DLMM = class {
|
|
|
8925
8925
|
}
|
|
8926
8926
|
async quoteCreatePosition({ strategy }) {
|
|
8927
8927
|
const { minBinId, maxBinId } = strategy;
|
|
8928
|
-
console.log(
|
|
8929
|
-
"\u{1F680} ~ DLMM ~ quoteCreatePosition ~ minBinId:",
|
|
8930
|
-
minBinId,
|
|
8931
|
-
maxBinId
|
|
8932
|
-
);
|
|
8933
8928
|
const lowerBinArrayIndex = binIdToBinArrayIndex(new (0, _anchor.BN)(minBinId));
|
|
8934
|
-
|
|
8935
|
-
|
|
8936
|
-
lowerBinArrayIndex.
|
|
8937
|
-
);
|
|
8938
|
-
const upperBinArrayIndex = binIdToBinArrayIndex(new (0, _anchor.BN)(maxBinId));
|
|
8939
|
-
console.log(
|
|
8940
|
-
"\u{1F680} ~ DLMM ~ quoteCreatePosition ~ upperBinArrayIndex:",
|
|
8941
|
-
upperBinArrayIndex.toString()
|
|
8929
|
+
const upperBinArrayIndex = _anchor.BN.max(
|
|
8930
|
+
binIdToBinArrayIndex(new (0, _anchor.BN)(maxBinId)),
|
|
8931
|
+
lowerBinArrayIndex.add(new (0, _anchor.BN)(1))
|
|
8942
8932
|
);
|
|
8943
8933
|
const binArraysCount = (await this.binArraysToBeCreate(lowerBinArrayIndex, upperBinArrayIndex)).length;
|
|
8944
8934
|
const positionCount = Math.ceil((maxBinId - minBinId + 1) / MAX_BIN_PER_TX);
|
|
@@ -9007,8 +8997,6 @@ var DLMM = class {
|
|
|
9007
8997
|
slippage
|
|
9008
8998
|
}) {
|
|
9009
8999
|
const { maxBinId, minBinId } = strategy;
|
|
9010
|
-
console.log("\u{1F680} ~ DLMM ~ minBinId:", minBinId);
|
|
9011
|
-
console.log("\u{1F680} ~ DLMM ~ maxBinId:", maxBinId);
|
|
9012
9000
|
const maxActiveBinSlippage = slippage ? Math.ceil(slippage / (this.lbPair.binStep / 100)) : MAX_ACTIVE_BIN_SLIPPAGE;
|
|
9013
9001
|
const setComputeUnitLimitIx = computeBudgetIx();
|
|
9014
9002
|
const preInstructions = [setComputeUnitLimitIx];
|
|
@@ -9020,10 +9008,6 @@ var DLMM = class {
|
|
|
9020
9008
|
}).instruction();
|
|
9021
9009
|
preInstructions.push(initializePositionIx);
|
|
9022
9010
|
const lowerBinArrayIndex = binIdToBinArrayIndex(new (0, _anchor.BN)(minBinId));
|
|
9023
|
-
console.log(
|
|
9024
|
-
"\u{1F680} ~ DLMM ~ lowerBinArrayIndex:",
|
|
9025
|
-
lowerBinArrayIndex.toString()
|
|
9026
|
-
);
|
|
9027
9011
|
const [binArrayLower] = deriveBinArray(
|
|
9028
9012
|
this.pubkey,
|
|
9029
9013
|
lowerBinArrayIndex,
|
|
@@ -9033,10 +9017,6 @@ var DLMM = class {
|
|
|
9033
9017
|
lowerBinArrayIndex.add(new (0, _anchor.BN)(1)),
|
|
9034
9018
|
binIdToBinArrayIndex(new (0, _anchor.BN)(maxBinId))
|
|
9035
9019
|
);
|
|
9036
|
-
console.log(
|
|
9037
|
-
"\u{1F680} ~ DLMM ~ upperBinArrayIndex:",
|
|
9038
|
-
upperBinArrayIndex.toString()
|
|
9039
|
-
);
|
|
9040
9020
|
const [binArrayUpper] = deriveBinArray(
|
|
9041
9021
|
this.pubkey,
|
|
9042
9022
|
upperBinArrayIndex,
|
|
@@ -9357,18 +9337,15 @@ var DLMM = class {
|
|
|
9357
9337
|
const maxBinArrayIndex = binIdToBinArrayIndex(new (0, _anchor.BN)(maxBinId));
|
|
9358
9338
|
const useExtension = isOverflowDefaultBinArrayBitmap(minBinArrayIndex) || isOverflowDefaultBinArrayBitmap(maxBinArrayIndex);
|
|
9359
9339
|
const binArrayBitmapExtension = useExtension ? deriveBinArrayBitmapExtension(this.pubkey, this.program.programId)[0] : null;
|
|
9360
|
-
const activeId = this.lbPair.activeId;
|
|
9361
9340
|
const strategyParameters = toStrategyParameters(strategy);
|
|
9362
|
-
const
|
|
9341
|
+
const positionAccount = await this.program.account.positionV2.fetch(positionPubKey);
|
|
9342
|
+
const lowerBinArrayIndex = binIdToBinArrayIndex(new (0, _anchor.BN)(positionAccount.lowerBinId));
|
|
9343
|
+
const upperBinArrayIndex = lowerBinArrayIndex.add(new (0, _anchor.BN)(1));
|
|
9363
9344
|
const [binArrayLower] = deriveBinArray(
|
|
9364
9345
|
this.pubkey,
|
|
9365
9346
|
lowerBinArrayIndex,
|
|
9366
9347
|
this.program.programId
|
|
9367
9348
|
);
|
|
9368
|
-
const upperBinArrayIndex = _anchor.BN.max(
|
|
9369
|
-
lowerBinArrayIndex.add(new (0, _anchor.BN)(1)),
|
|
9370
|
-
binIdToBinArrayIndex(new (0, _anchor.BN)(maxBinId))
|
|
9371
|
-
);
|
|
9372
9349
|
const [binArrayUpper] = deriveBinArray(
|
|
9373
9350
|
this.pubkey,
|
|
9374
9351
|
upperBinArrayIndex,
|
|
@@ -11610,11 +11587,6 @@ var DLMM = class {
|
|
|
11610
11587
|
binArrays.push(binArrayPubKey);
|
|
11611
11588
|
}
|
|
11612
11589
|
const binArrayAccounts = await this.program.provider.connection.getMultipleAccountsInfo(binArrays);
|
|
11613
|
-
console.log(
|
|
11614
|
-
binArrays.map((binArray, index) => ({
|
|
11615
|
-
[binArray.toBase58()]: binArrayAccounts[index]
|
|
11616
|
-
}))
|
|
11617
|
-
);
|
|
11618
11590
|
return binArrayAccounts.filter((binArray) => binArray === null).map((_, index) => binArrays[index]);
|
|
11619
11591
|
}
|
|
11620
11592
|
async createBinArraysIfNeeded(upperBinArrayIndex, lowerBinArrayIndex, funder) {
|