@meteora-ag/dlmm 1.6.0 → 1.6.1-rc.1
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 +1 -0
- package/dist/index.js +42 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +42 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -13891,26 +13891,23 @@ async function chunkDepositWithRebalanceEndpoint(dlmm, strategy, slippagePercent
|
|
|
13891
13891
|
]).instruction();
|
|
13892
13892
|
calculatedAddLiquidityCU += DEFAULT_ADD_LIQUIDITY_CU;
|
|
13893
13893
|
const addLiquidityIxs = [];
|
|
13894
|
-
addLiquidityIxs.push(
|
|
13895
|
-
|
|
13896
|
-
...initBinArrayIxs,
|
|
13897
|
-
createUserTokenXIx,
|
|
13898
|
-
createUserTokenYIx
|
|
13899
|
-
);
|
|
13900
|
-
if (dlmm.tokenX.publicKey.equals(NATIVE_MINT) && !totalXAmount.isZero()) {
|
|
13894
|
+
addLiquidityIxs.push(...initBitmapIxs, ...initBinArrayIxs);
|
|
13895
|
+
if (dlmm.tokenX.publicKey.equals(NATIVE_MINT)) {
|
|
13901
13896
|
const wrapSOLIx = wrapSOLInstruction(
|
|
13902
13897
|
owner,
|
|
13903
13898
|
userTokenX,
|
|
13904
13899
|
BigInt(totalXAmount.toString())
|
|
13905
13900
|
);
|
|
13901
|
+
addLiquidityIxs.push(createUserTokenXIx);
|
|
13906
13902
|
addLiquidityIxs.push(...wrapSOLIx);
|
|
13907
13903
|
}
|
|
13908
|
-
if (dlmm.tokenY.publicKey.equals(NATIVE_MINT)
|
|
13904
|
+
if (dlmm.tokenY.publicKey.equals(NATIVE_MINT)) {
|
|
13909
13905
|
const wrapSOLIx = wrapSOLInstruction(
|
|
13910
13906
|
owner,
|
|
13911
13907
|
userTokenY,
|
|
13912
13908
|
BigInt(totalYAmount.toString())
|
|
13913
13909
|
);
|
|
13910
|
+
addLiquidityIxs.push(createUserTokenYIx);
|
|
13914
13911
|
addLiquidityIxs.push(...wrapSOLIx);
|
|
13915
13912
|
}
|
|
13916
13913
|
addLiquidityIxs.push(rebalanceIx);
|
|
@@ -15631,6 +15628,7 @@ var DLMM = class {
|
|
|
15631
15628
|
* - "userPositions" which is an array of Position objects.
|
|
15632
15629
|
*/
|
|
15633
15630
|
async getPositionsByUserAndLbPair(userPubKey) {
|
|
15631
|
+
console.log(this.program.provider.connection.commitment);
|
|
15634
15632
|
const promiseResults = await Promise.all([
|
|
15635
15633
|
this.getActiveBin(),
|
|
15636
15634
|
userPubKey && this.program.provider.connection.getProgramAccounts(
|
|
@@ -15934,6 +15932,41 @@ var DLMM = class {
|
|
|
15934
15932
|
);
|
|
15935
15933
|
const instructionsByPositions = [];
|
|
15936
15934
|
let startBinId = minBinId;
|
|
15935
|
+
const initializeAtaIxs = [];
|
|
15936
|
+
if (!this.tokenX.publicKey.equals(NATIVE_MINT2)) {
|
|
15937
|
+
const ownerAtaX = getAssociatedTokenAddressSync2(
|
|
15938
|
+
this.tokenX.publicKey,
|
|
15939
|
+
owner,
|
|
15940
|
+
true,
|
|
15941
|
+
this.tokenX.owner
|
|
15942
|
+
);
|
|
15943
|
+
initializeAtaIxs.push(
|
|
15944
|
+
createAssociatedTokenAccountIdempotentInstruction2(
|
|
15945
|
+
owner,
|
|
15946
|
+
ownerAtaX,
|
|
15947
|
+
owner,
|
|
15948
|
+
this.tokenX.publicKey,
|
|
15949
|
+
this.tokenX.owner
|
|
15950
|
+
)
|
|
15951
|
+
);
|
|
15952
|
+
}
|
|
15953
|
+
if (!this.tokenY.publicKey.equals(NATIVE_MINT2)) {
|
|
15954
|
+
const ownerAtaY = getAssociatedTokenAddressSync2(
|
|
15955
|
+
this.tokenY.publicKey,
|
|
15956
|
+
owner,
|
|
15957
|
+
true,
|
|
15958
|
+
this.tokenY.owner
|
|
15959
|
+
);
|
|
15960
|
+
initializeAtaIxs.push(
|
|
15961
|
+
createAssociatedTokenAccountIdempotentInstruction2(
|
|
15962
|
+
owner,
|
|
15963
|
+
ownerAtaY,
|
|
15964
|
+
owner,
|
|
15965
|
+
this.tokenY.publicKey,
|
|
15966
|
+
this.tokenY.owner
|
|
15967
|
+
)
|
|
15968
|
+
);
|
|
15969
|
+
}
|
|
15937
15970
|
for (const position of positionKeypairs) {
|
|
15938
15971
|
const endBinId = Math.min(
|
|
15939
15972
|
startBinId + MAX_BINS_PER_POSITION.toNumber() - 1,
|
|
@@ -15966,6 +15999,7 @@ var DLMM = class {
|
|
|
15966
15999
|
instructionsByPositions.push({
|
|
15967
16000
|
positionKeypair: position,
|
|
15968
16001
|
initializePositionIx: initPositionIx,
|
|
16002
|
+
initializeAtaIxs,
|
|
15969
16003
|
addLiquidityIxs: chunkedAddLiquidityIx
|
|
15970
16004
|
});
|
|
15971
16005
|
startBinId = endBinId + 1;
|