@meteora-ag/dlmm 1.4.1 → 1.4.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.d.ts +1 -0
- package/dist/index.js +59 -39
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -6643,7 +6643,7 @@ function derivePosition(lbPair, base, lowerBinId, width, programId) {
|
|
|
6643
6643
|
lbPair.toBuffer(),
|
|
6644
6644
|
base.toBuffer(),
|
|
6645
6645
|
lowerBinIdBytes,
|
|
6646
|
-
new Uint8Array(width.
|
|
6646
|
+
new Uint8Array(width.toArrayLike(Buffer, "le", 4))
|
|
6647
6647
|
],
|
|
6648
6648
|
programId
|
|
6649
6649
|
);
|
|
@@ -7889,6 +7889,32 @@ var DLMM = class {
|
|
|
7889
7889
|
return null;
|
|
7890
7890
|
}
|
|
7891
7891
|
}
|
|
7892
|
+
static async getCustomizablePermissionlessLbPairIfExists(connection, tokenX, tokenY, opt) {
|
|
7893
|
+
const cluster = opt?.cluster || "mainnet-beta";
|
|
7894
|
+
const provider = new AnchorProvider2(
|
|
7895
|
+
connection,
|
|
7896
|
+
{},
|
|
7897
|
+
AnchorProvider2.defaultOptions()
|
|
7898
|
+
);
|
|
7899
|
+
const program = new Program3(
|
|
7900
|
+
IDL,
|
|
7901
|
+
opt?.programId ?? LBCLMM_PROGRAM_IDS[cluster],
|
|
7902
|
+
provider
|
|
7903
|
+
);
|
|
7904
|
+
try {
|
|
7905
|
+
const [lpPair] = deriveCustomizablePermissionlessLbPair(
|
|
7906
|
+
tokenX,
|
|
7907
|
+
tokenY,
|
|
7908
|
+
program.programId
|
|
7909
|
+
);
|
|
7910
|
+
const account = await program.account.lbPair.fetchNullable(lpPair);
|
|
7911
|
+
if (account)
|
|
7912
|
+
return lpPair;
|
|
7913
|
+
return null;
|
|
7914
|
+
} catch (error) {
|
|
7915
|
+
return null;
|
|
7916
|
+
}
|
|
7917
|
+
}
|
|
7892
7918
|
/**
|
|
7893
7919
|
* The `create` function is a static method that creates a new instance of the `DLMM` class
|
|
7894
7920
|
* @param {Connection} connection - The `connection` parameter is an instance of the `Connection`
|
|
@@ -8686,7 +8712,8 @@ var DLMM = class {
|
|
|
8686
8712
|
* @returns a Promise that resolves to the transaction.
|
|
8687
8713
|
*/
|
|
8688
8714
|
async setPairStatusPermissionless(enable, creator) {
|
|
8689
|
-
const
|
|
8715
|
+
const status = enable ? 0 : 1;
|
|
8716
|
+
const tx = await this.program.methods.setPairStatusPermissionless(status).accounts({
|
|
8690
8717
|
lbPair: this.pubkey,
|
|
8691
8718
|
creator
|
|
8692
8719
|
}).transaction();
|
|
@@ -11181,13 +11208,6 @@ var DLMM = class {
|
|
|
11181
11208
|
);
|
|
11182
11209
|
}
|
|
11183
11210
|
if (instructions.length > 1) {
|
|
11184
|
-
instructions.push(
|
|
11185
|
-
await getEstimatedComputeUnitIxWithBuffer(
|
|
11186
|
-
this.program.provider.connection,
|
|
11187
|
-
instructions,
|
|
11188
|
-
payer
|
|
11189
|
-
)
|
|
11190
|
-
);
|
|
11191
11211
|
initializeBinArraysAndPositionIxs.push(instructions);
|
|
11192
11212
|
instructions = [];
|
|
11193
11213
|
}
|