@meteora-ag/dlmm 1.9.1 → 1.9.2
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 +141 -48
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +97 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -17017,18 +17017,59 @@ var DLMM = class {
|
|
|
17017
17017
|
baseFeePowerFactor: baseFeePowerFactor.toNumber(),
|
|
17018
17018
|
padding: Array(63).fill(0)
|
|
17019
17019
|
};
|
|
17020
|
+
const preInstructions = [];
|
|
17020
17021
|
const userTokenX = getAssociatedTokenAddressSync2(
|
|
17021
17022
|
tokenX,
|
|
17022
17023
|
creatorKey,
|
|
17023
17024
|
true,
|
|
17024
17025
|
tokenXAccount.owner
|
|
17025
17026
|
);
|
|
17027
|
+
const createUserTokenXIx = createAssociatedTokenAccountIdempotentInstruction2(
|
|
17028
|
+
creatorKey,
|
|
17029
|
+
userTokenX,
|
|
17030
|
+
creatorKey,
|
|
17031
|
+
tokenX,
|
|
17032
|
+
tokenXAccount.owner
|
|
17033
|
+
);
|
|
17034
|
+
preInstructions.push(createUserTokenXIx);
|
|
17026
17035
|
const userTokenY = getAssociatedTokenAddressSync2(
|
|
17027
17036
|
tokenY,
|
|
17028
17037
|
creatorKey,
|
|
17029
17038
|
true,
|
|
17030
17039
|
tokenYAccount.owner
|
|
17031
17040
|
);
|
|
17041
|
+
const createUserTokenYIx = createAssociatedTokenAccountIdempotentInstruction2(
|
|
17042
|
+
creatorKey,
|
|
17043
|
+
userTokenY,
|
|
17044
|
+
creatorKey,
|
|
17045
|
+
tokenY,
|
|
17046
|
+
tokenYAccount.owner
|
|
17047
|
+
);
|
|
17048
|
+
preInstructions.push(createUserTokenYIx);
|
|
17049
|
+
const postInstructions = [];
|
|
17050
|
+
if ((tokenX.equals(NATIVE_MINT2) || tokenY.equals(NATIVE_MINT2)) && !opt?.skipSolWrappingOperation) {
|
|
17051
|
+
const wrapAmount = BigInt(1);
|
|
17052
|
+
if (tokenX.equals(NATIVE_MINT2)) {
|
|
17053
|
+
const wrapSOLIxX = wrapSOLInstruction(
|
|
17054
|
+
creatorKey,
|
|
17055
|
+
userTokenX,
|
|
17056
|
+
wrapAmount
|
|
17057
|
+
);
|
|
17058
|
+
preInstructions.push(...wrapSOLIxX);
|
|
17059
|
+
}
|
|
17060
|
+
if (tokenY.equals(NATIVE_MINT2)) {
|
|
17061
|
+
const wrapSOLIxY = wrapSOLInstruction(
|
|
17062
|
+
creatorKey,
|
|
17063
|
+
userTokenY,
|
|
17064
|
+
wrapAmount
|
|
17065
|
+
);
|
|
17066
|
+
preInstructions.push(...wrapSOLIxY);
|
|
17067
|
+
}
|
|
17068
|
+
const unwrapSOLIx = await unwrapSOLInstruction(creatorKey);
|
|
17069
|
+
if (unwrapSOLIx) {
|
|
17070
|
+
postInstructions.push(unwrapSOLIx);
|
|
17071
|
+
}
|
|
17072
|
+
}
|
|
17032
17073
|
return program.methods.initializeCustomizablePermissionlessLbPair2(ixData).accountsPartial({
|
|
17033
17074
|
tokenBadgeX: tokenBadgeXAccount ? tokenBadgeX : program.programId,
|
|
17034
17075
|
tokenBadgeY: tokenBadgeYAccount ? tokenBadgeY : program.programId,
|
|
@@ -17045,7 +17086,7 @@ var DLMM = class {
|
|
|
17045
17086
|
funder: creatorKey,
|
|
17046
17087
|
tokenProgramX: tokenXAccount.owner,
|
|
17047
17088
|
tokenProgramY: tokenYAccount.owner
|
|
17048
|
-
}).transaction();
|
|
17089
|
+
}).preInstructions(preInstructions).postInstructions(postInstructions).transaction();
|
|
17049
17090
|
}
|
|
17050
17091
|
/**
|
|
17051
17092
|
* Create a new customizable permissionless pair. Support only token program.
|
|
@@ -17069,6 +17110,7 @@ var DLMM = class {
|
|
|
17069
17110
|
tokenY,
|
|
17070
17111
|
program.programId
|
|
17071
17112
|
);
|
|
17113
|
+
const [tokenXAccount, tokenYAccount] = await connection.getMultipleAccountsInfo([tokenX, tokenY]);
|
|
17072
17114
|
const [reserveX] = deriveReserve(tokenX, lbPair, program.programId);
|
|
17073
17115
|
const [reserveY] = deriveReserve(tokenY, lbPair, program.programId);
|
|
17074
17116
|
const [oracle] = deriveOracle(lbPair, program.programId);
|
|
@@ -17095,8 +17137,59 @@ var DLMM = class {
|
|
|
17095
17137
|
creatorPoolOnOffControl: creatorPoolOnOffControl ? creatorPoolOnOffControl : false,
|
|
17096
17138
|
padding: Array(63).fill(0)
|
|
17097
17139
|
};
|
|
17098
|
-
const
|
|
17099
|
-
const
|
|
17140
|
+
const preInstructions = [];
|
|
17141
|
+
const userTokenX = getAssociatedTokenAddressSync2(
|
|
17142
|
+
tokenX,
|
|
17143
|
+
creatorKey,
|
|
17144
|
+
true,
|
|
17145
|
+
tokenXAccount.owner
|
|
17146
|
+
);
|
|
17147
|
+
const createUserTokenXIx = createAssociatedTokenAccountIdempotentInstruction2(
|
|
17148
|
+
creatorKey,
|
|
17149
|
+
userTokenX,
|
|
17150
|
+
creatorKey,
|
|
17151
|
+
tokenX,
|
|
17152
|
+
tokenXAccount.owner
|
|
17153
|
+
);
|
|
17154
|
+
preInstructions.push(createUserTokenXIx);
|
|
17155
|
+
const userTokenY = getAssociatedTokenAddressSync2(
|
|
17156
|
+
tokenY,
|
|
17157
|
+
creatorKey,
|
|
17158
|
+
true,
|
|
17159
|
+
tokenYAccount.owner
|
|
17160
|
+
);
|
|
17161
|
+
const createUserTokenYIx = createAssociatedTokenAccountIdempotentInstruction2(
|
|
17162
|
+
creatorKey,
|
|
17163
|
+
userTokenY,
|
|
17164
|
+
creatorKey,
|
|
17165
|
+
tokenY,
|
|
17166
|
+
tokenYAccount.owner
|
|
17167
|
+
);
|
|
17168
|
+
preInstructions.push(createUserTokenYIx);
|
|
17169
|
+
const postInstructions = [];
|
|
17170
|
+
if ((tokenX.equals(NATIVE_MINT2) || tokenY.equals(NATIVE_MINT2)) && !opt?.skipSolWrappingOperation) {
|
|
17171
|
+
const wrapAmount = BigInt(1);
|
|
17172
|
+
if (tokenX.equals(NATIVE_MINT2)) {
|
|
17173
|
+
const wrapSOLIxX = wrapSOLInstruction(
|
|
17174
|
+
creatorKey,
|
|
17175
|
+
userTokenX,
|
|
17176
|
+
wrapAmount
|
|
17177
|
+
);
|
|
17178
|
+
preInstructions.push(...wrapSOLIxX);
|
|
17179
|
+
}
|
|
17180
|
+
if (tokenY.equals(NATIVE_MINT2)) {
|
|
17181
|
+
const wrapSOLIxY = wrapSOLInstruction(
|
|
17182
|
+
creatorKey,
|
|
17183
|
+
userTokenY,
|
|
17184
|
+
wrapAmount
|
|
17185
|
+
);
|
|
17186
|
+
preInstructions.push(...wrapSOLIxY);
|
|
17187
|
+
}
|
|
17188
|
+
const unwrapSOLIx = await unwrapSOLInstruction(creatorKey);
|
|
17189
|
+
if (unwrapSOLIx) {
|
|
17190
|
+
postInstructions.push(unwrapSOLIx);
|
|
17191
|
+
}
|
|
17192
|
+
}
|
|
17100
17193
|
return program.methods.initializeCustomizablePermissionlessLbPair(ixData).accountsPartial({
|
|
17101
17194
|
lbPair,
|
|
17102
17195
|
reserveX,
|
|
@@ -17109,7 +17202,7 @@ var DLMM = class {
|
|
|
17109
17202
|
userTokenX,
|
|
17110
17203
|
userTokenY,
|
|
17111
17204
|
funder: creatorKey
|
|
17112
|
-
}).transaction();
|
|
17205
|
+
}).preInstructions(preInstructions).postInstructions(postInstructions).transaction();
|
|
17113
17206
|
}
|
|
17114
17207
|
/**
|
|
17115
17208
|
* Create a new liquidity pair. Support only token program.
|