@meteora-ag/dlmm 1.9.8 → 1.9.10
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.d.ts +2 -1
- package/dist/index.js +43 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +50 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
package/dist/index.mjs
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
LAMPORTS_PER_SOL as LAMPORTS_PER_SOL2,
|
|
16
16
|
PublicKey as PublicKey10,
|
|
17
17
|
SYSVAR_CLOCK_PUBKEY as SYSVAR_CLOCK_PUBKEY2,
|
|
18
|
-
SYSVAR_RENT_PUBKEY,
|
|
18
|
+
SYSVAR_RENT_PUBKEY as SYSVAR_RENT_PUBKEY2,
|
|
19
19
|
SystemProgram as SystemProgram2,
|
|
20
20
|
Transaction
|
|
21
21
|
} from "@solana/web3.js";
|
|
@@ -10262,6 +10262,7 @@ import {
|
|
|
10262
10262
|
} from "@solana/spl-token";
|
|
10263
10263
|
import {
|
|
10264
10264
|
ComputeBudgetProgram as ComputeBudgetProgram2,
|
|
10265
|
+
SYSVAR_RENT_PUBKEY,
|
|
10265
10266
|
SystemProgram,
|
|
10266
10267
|
TransactionInstruction as TransactionInstruction3
|
|
10267
10268
|
} from "@solana/web3.js";
|
|
@@ -15354,7 +15355,8 @@ async function chunkDepositWithRebalanceEndpoint(dlmm, strategy, slippagePercent
|
|
|
15354
15355
|
const initBitmapIx = await dlmm.program.methods.initializeBinArrayBitmapExtension().accountsPartial({
|
|
15355
15356
|
binArrayBitmapExtension: bitmapPubkey,
|
|
15356
15357
|
lbPair: dlmm.pubkey,
|
|
15357
|
-
funder: payer
|
|
15358
|
+
funder: payer,
|
|
15359
|
+
rent: SYSVAR_RENT_PUBKEY
|
|
15358
15360
|
}).instruction();
|
|
15359
15361
|
initBitmapIxs.push(initBitmapIx);
|
|
15360
15362
|
binArrayOrBitmapInitTracking.add(bitmapPubkey.toBase58());
|
|
@@ -17131,7 +17133,7 @@ var DLMM = class {
|
|
|
17131
17133
|
return program.methods.initializeLbPair(activeId.toNumber(), binStep.toNumber()).accountsPartial({
|
|
17132
17134
|
funder,
|
|
17133
17135
|
lbPair,
|
|
17134
|
-
rent:
|
|
17136
|
+
rent: SYSVAR_RENT_PUBKEY2,
|
|
17135
17137
|
reserveX,
|
|
17136
17138
|
reserveY,
|
|
17137
17139
|
binArrayBitmapExtension,
|
|
@@ -18047,7 +18049,7 @@ var DLMM = class {
|
|
|
18047
18049
|
position: positionPubKey,
|
|
18048
18050
|
lbPair: this.pubkey,
|
|
18049
18051
|
owner: user,
|
|
18050
|
-
rent:
|
|
18052
|
+
rent: SYSVAR_RENT_PUBKEY2
|
|
18051
18053
|
}).instruction();
|
|
18052
18054
|
const binArrayIndexes = getBinArrayIndexesCoverage(
|
|
18053
18055
|
new BN24(minBinId),
|
|
@@ -18319,7 +18321,7 @@ var DLMM = class {
|
|
|
18319
18321
|
lbPair: this.pubkey,
|
|
18320
18322
|
owner,
|
|
18321
18323
|
payer,
|
|
18322
|
-
rent:
|
|
18324
|
+
rent: SYSVAR_RENT_PUBKEY2
|
|
18323
18325
|
}).instruction();
|
|
18324
18326
|
const chunkedAddLiquidityIx = await chunkDepositWithRebalanceEndpoint(
|
|
18325
18327
|
this,
|
|
@@ -18435,7 +18437,7 @@ var DLMM = class {
|
|
|
18435
18437
|
position: positionPubKey,
|
|
18436
18438
|
lbPair: this.pubkey,
|
|
18437
18439
|
owner: user,
|
|
18438
|
-
rent:
|
|
18440
|
+
rent: SYSVAR_RENT_PUBKEY2
|
|
18439
18441
|
}).instruction();
|
|
18440
18442
|
preInstructions.push(initializePositionIx);
|
|
18441
18443
|
const binArrayIndexes = getBinArrayIndexesCoverage(
|
|
@@ -18584,7 +18586,7 @@ var DLMM = class {
|
|
|
18584
18586
|
position: positionPubKey,
|
|
18585
18587
|
lbPair: this.pubkey,
|
|
18586
18588
|
owner: user,
|
|
18587
|
-
rent:
|
|
18589
|
+
rent: SYSVAR_RENT_PUBKEY2
|
|
18588
18590
|
}).instruction();
|
|
18589
18591
|
preInstructions.push(initializePositionIx);
|
|
18590
18592
|
const lowerBinArrayIndex = binIdToBinArrayIndex(new BN24(lowerBinId));
|
|
@@ -20731,7 +20733,8 @@ var DLMM = class {
|
|
|
20731
20733
|
await this.program.methods.initializeBinArrayBitmapExtension().accountsPartial({
|
|
20732
20734
|
binArrayBitmapExtension,
|
|
20733
20735
|
funder: payer,
|
|
20734
|
-
lbPair: this.pubkey
|
|
20736
|
+
lbPair: this.pubkey,
|
|
20737
|
+
rent: SYSVAR_RENT_PUBKEY2
|
|
20735
20738
|
}).instruction()
|
|
20736
20739
|
);
|
|
20737
20740
|
appendedInitBinArrayBitmap = true;
|
|
@@ -20930,7 +20933,8 @@ var DLMM = class {
|
|
|
20930
20933
|
await this.program.methods.initializeBinArrayBitmapExtension().accountsPartial({
|
|
20931
20934
|
binArrayBitmapExtension,
|
|
20932
20935
|
funder: payer,
|
|
20933
|
-
lbPair: this.pubkey
|
|
20936
|
+
lbPair: this.pubkey,
|
|
20937
|
+
rent: SYSVAR_RENT_PUBKEY2
|
|
20934
20938
|
}).instruction()
|
|
20935
20939
|
);
|
|
20936
20940
|
binArrayBitmapLamports = binArrayBitmapLamports.add(
|
|
@@ -21346,7 +21350,8 @@ var DLMM = class {
|
|
|
21346
21350
|
const initializeBitmapExtensionIx = await this.program.methods.initializeBinArrayBitmapExtension().accountsPartial({
|
|
21347
21351
|
binArrayBitmapExtension: binArrayBitMapExtensionPubkey,
|
|
21348
21352
|
funder: owner,
|
|
21349
|
-
lbPair: this.pubkey
|
|
21353
|
+
lbPair: this.pubkey,
|
|
21354
|
+
rent: SYSVAR_RENT_PUBKEY2
|
|
21350
21355
|
}).instruction();
|
|
21351
21356
|
preInstructions.push(initializeBitmapExtensionIx);
|
|
21352
21357
|
}
|
|
@@ -21754,7 +21759,8 @@ var DLMM = class {
|
|
|
21754
21759
|
const initBitmapExtensionIx = await this.program.methods.initializeBinArrayBitmapExtension().accountsPartial({
|
|
21755
21760
|
binArrayBitmapExtension: binArrayBitmap,
|
|
21756
21761
|
funder: owner,
|
|
21757
|
-
lbPair: this.pubkey
|
|
21762
|
+
lbPair: this.pubkey,
|
|
21763
|
+
rent: SYSVAR_RENT_PUBKEY2
|
|
21758
21764
|
}).preInstructions([
|
|
21759
21765
|
ComputeBudgetProgram3.setComputeUnitLimit({
|
|
21760
21766
|
units: DEFAULT_INIT_BIN_ARRAY_CU
|
|
@@ -21970,7 +21976,8 @@ var DLMM = class {
|
|
|
21970
21976
|
const initializeBitmapExtensionIx = await this.program.methods.initializeBinArrayBitmapExtension().accountsPartial({
|
|
21971
21977
|
binArrayBitmapExtension,
|
|
21972
21978
|
funder: owner,
|
|
21973
|
-
lbPair: this.pubkey
|
|
21979
|
+
lbPair: this.pubkey,
|
|
21980
|
+
rent: SYSVAR_RENT_PUBKEY2
|
|
21974
21981
|
}).instruction();
|
|
21975
21982
|
preInstructions.push(initializeBitmapExtensionIx);
|
|
21976
21983
|
}
|
|
@@ -22062,7 +22069,8 @@ var DLMM = class {
|
|
|
22062
22069
|
* - `limitOrderPubkey`: The public key of the limit-order account to cancel.
|
|
22063
22070
|
* - `owner`: The owner of the limit-order account and transaction fee payer.
|
|
22064
22071
|
* - `binIds`: Bin IDs to cancel from the limit order.
|
|
22065
|
-
* @returns {Promise<Transaction>} A transaction that cancels the limit order
|
|
22072
|
+
* @returns {Promise<Transaction>} A transaction that cancels the limit order, ensures owner ATAs for both pool
|
|
22073
|
+
* mints (including idempotent creates for non-SOL legs), and unwraps SOL when applicable.
|
|
22066
22074
|
*/
|
|
22067
22075
|
async cancelLimitOrder({
|
|
22068
22076
|
limitOrderPubkey,
|
|
@@ -22090,7 +22098,20 @@ var DLMM = class {
|
|
|
22090
22098
|
true,
|
|
22091
22099
|
this.tokenY.owner
|
|
22092
22100
|
);
|
|
22093
|
-
if (this.tokenX.mint.address.equals(NATIVE_MINT2)
|
|
22101
|
+
if (this.tokenX.mint.address.equals(NATIVE_MINT2)) {
|
|
22102
|
+
if (!this.opt?.skipSolWrappingOperation) {
|
|
22103
|
+
preInstructions.push(
|
|
22104
|
+
createAssociatedTokenAccountIdempotentInstruction2(
|
|
22105
|
+
owner,
|
|
22106
|
+
userTokenX,
|
|
22107
|
+
owner,
|
|
22108
|
+
this.tokenX.mint.address,
|
|
22109
|
+
this.tokenX.owner
|
|
22110
|
+
)
|
|
22111
|
+
);
|
|
22112
|
+
postInstructions.push(unwrapSOLInstruction(owner));
|
|
22113
|
+
}
|
|
22114
|
+
} else {
|
|
22094
22115
|
preInstructions.push(
|
|
22095
22116
|
createAssociatedTokenAccountIdempotentInstruction2(
|
|
22096
22117
|
owner,
|
|
@@ -22100,9 +22121,21 @@ var DLMM = class {
|
|
|
22100
22121
|
this.tokenX.owner
|
|
22101
22122
|
)
|
|
22102
22123
|
);
|
|
22103
|
-
postInstructions.push(unwrapSOLInstruction(owner));
|
|
22104
22124
|
}
|
|
22105
|
-
if (this.tokenY.mint.address.equals(NATIVE_MINT2)
|
|
22125
|
+
if (this.tokenY.mint.address.equals(NATIVE_MINT2)) {
|
|
22126
|
+
if (!this.opt?.skipSolWrappingOperation) {
|
|
22127
|
+
preInstructions.push(
|
|
22128
|
+
createAssociatedTokenAccountIdempotentInstruction2(
|
|
22129
|
+
owner,
|
|
22130
|
+
userTokenY,
|
|
22131
|
+
owner,
|
|
22132
|
+
this.tokenY.mint.address,
|
|
22133
|
+
this.tokenY.owner
|
|
22134
|
+
)
|
|
22135
|
+
);
|
|
22136
|
+
postInstructions.push(unwrapSOLInstruction(owner));
|
|
22137
|
+
}
|
|
22138
|
+
} else {
|
|
22106
22139
|
preInstructions.push(
|
|
22107
22140
|
createAssociatedTokenAccountIdempotentInstruction2(
|
|
22108
22141
|
owner,
|
|
@@ -22112,7 +22145,6 @@ var DLMM = class {
|
|
|
22112
22145
|
this.tokenY.owner
|
|
22113
22146
|
)
|
|
22114
22147
|
);
|
|
22115
|
-
postInstructions.push(unwrapSOLInstruction(owner));
|
|
22116
22148
|
}
|
|
22117
22149
|
const closeLimitOrderIx = await this.program.methods.closeLimitOrderIfEmpty().accountsPartial({
|
|
22118
22150
|
limitOrder: limitOrderPubkey,
|
|
@@ -22175,7 +22207,7 @@ var DLMM = class {
|
|
|
22175
22207
|
position,
|
|
22176
22208
|
lbPair: this.pubkey,
|
|
22177
22209
|
owner: user,
|
|
22178
|
-
rent:
|
|
22210
|
+
rent: SYSVAR_RENT_PUBKEY2
|
|
22179
22211
|
}).instruction();
|
|
22180
22212
|
const extendedBinCount = getExtendedPositionBinCount(
|
|
22181
22213
|
new BN24(lowerBinId),
|