@picon-finance/dlmm-sdk 2.0.2 → 2.0.4
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/entities/dlmm_program.d.ts +1 -1
- package/dist/entities/dlmm_program.d.ts.map +1 -1
- package/dist/entities/dlmm_program.js +2 -2
- package/dist/entities/pool.d.ts +1 -1
- package/dist/entities/pool.d.ts.map +1 -1
- package/dist/generated/instructions/acceptAdminAuthority.d.ts +12 -11
- package/dist/generated/instructions/acceptAdminAuthority.d.ts.map +1 -1
- package/dist/generated/instructions/acceptAdminAuthority.js +16 -4
- package/dist/generated/instructions/claimFee.d.ts +19 -18
- package/dist/generated/instructions/claimFee.d.ts.map +1 -1
- package/dist/generated/instructions/claimFee.js +52 -12
- package/dist/generated/instructions/claimProtocolFee.d.ts +30 -29
- package/dist/generated/instructions/claimProtocolFee.d.ts.map +1 -1
- package/dist/generated/instructions/claimProtocolFee.js +90 -20
- package/dist/generated/instructions/closePosition.d.ts +18 -17
- package/dist/generated/instructions/closePosition.d.ts.map +1 -1
- package/dist/generated/instructions/closePosition.js +38 -10
- package/dist/generated/instructions/createAdminConfig.d.ts +18 -17
- package/dist/generated/instructions/createAdminConfig.d.ts.map +1 -1
- package/dist/generated/instructions/createAdminConfig.js +54 -12
- package/dist/generated/instructions/createBinArray.d.ts +16 -15
- package/dist/generated/instructions/createBinArray.d.ts.map +1 -1
- package/dist/generated/instructions/createBinArray.js +28 -10
- package/dist/generated/instructions/createPool.d.ts +30 -29
- package/dist/generated/instructions/createPool.d.ts.map +1 -1
- package/dist/generated/instructions/createPool.js +98 -22
- package/dist/generated/instructions/deleteBinArray.d.ts +18 -17
- package/dist/generated/instructions/deleteBinArray.d.ts.map +1 -1
- package/dist/generated/instructions/deleteBinArray.js +54 -12
- package/dist/generated/instructions/depositByWeight.d.ts +19 -18
- package/dist/generated/instructions/depositByWeight.d.ts.map +1 -1
- package/dist/generated/instructions/depositByWeight.js +52 -12
- package/dist/generated/instructions/openPosition.d.ts +28 -27
- package/dist/generated/instructions/openPosition.d.ts.map +1 -1
- package/dist/generated/instructions/openPosition.js +64 -16
- package/dist/generated/instructions/resetAdminAuthority.d.ts +16 -15
- package/dist/generated/instructions/resetAdminAuthority.d.ts.map +1 -1
- package/dist/generated/instructions/resetAdminAuthority.js +44 -10
- package/dist/generated/instructions/setMetadataUpdateAuthority.d.ts +12 -11
- package/dist/generated/instructions/setMetadataUpdateAuthority.d.ts.map +1 -1
- package/dist/generated/instructions/setMetadataUpdateAuthority.js +24 -6
- package/dist/generated/instructions/setPoolDynamicFeeConfig.d.ts +14 -13
- package/dist/generated/instructions/setPoolDynamicFeeConfig.d.ts.map +1 -1
- package/dist/generated/instructions/setPoolDynamicFeeConfig.js +26 -8
- package/dist/generated/instructions/setPoolProtocolShare.d.ts +14 -13
- package/dist/generated/instructions/setPoolProtocolShare.d.ts.map +1 -1
- package/dist/generated/instructions/setPoolProtocolShare.js +26 -8
- package/dist/generated/instructions/swapExactIn.d.ts +15 -14
- package/dist/generated/instructions/swapExactIn.d.ts.map +1 -1
- package/dist/generated/instructions/swapExactIn.js +36 -9
- package/dist/generated/instructions/swapExactOut.d.ts +15 -14
- package/dist/generated/instructions/swapExactOut.d.ts.map +1 -1
- package/dist/generated/instructions/swapExactOut.js +36 -9
- package/dist/generated/instructions/syncPool.d.ts +7 -6
- package/dist/generated/instructions/syncPool.d.ts.map +1 -1
- package/dist/generated/instructions/syncPool.js +4 -3
- package/dist/generated/instructions/transferAdminAuthority.d.ts +12 -11
- package/dist/generated/instructions/transferAdminAuthority.d.ts.map +1 -1
- package/dist/generated/instructions/transferAdminAuthority.js +24 -6
- package/dist/generated/instructions/withdraw.d.ts +19 -18
- package/dist/generated/instructions/withdraw.d.ts.map +1 -1
- package/dist/generated/instructions/withdraw.js +52 -12
- package/package.json +8 -8
- package/src/entities/dlmm_program.ts +3 -3
- package/src/generated/instructions/acceptAdminAuthority.ts +68 -25
- package/src/generated/instructions/claimFee.ts +218 -83
- package/src/generated/instructions/claimProtocolFee.ts +346 -131
- package/src/generated/instructions/closePosition.ts +160 -61
- package/src/generated/instructions/createAdminConfig.ts +172 -63
- package/src/generated/instructions/createBinArray.ts +124 -51
- package/src/generated/instructions/createPool.ts +354 -133
- package/src/generated/instructions/deleteBinArray.ts +172 -63
- package/src/generated/instructions/depositByWeight.ts +218 -83
- package/src/generated/instructions/openPosition.ts +300 -117
- package/src/generated/instructions/resetAdminAuthority.ts +138 -51
- package/src/generated/instructions/setMetadataUpdateAuthority.ts +74 -27
- package/src/generated/instructions/setPoolDynamicFeeConfig.ts +98 -39
- package/src/generated/instructions/setPoolProtocolShare.ts +98 -39
- package/src/generated/instructions/swapExactIn.ts +155 -60
- package/src/generated/instructions/swapExactOut.ts +155 -60
- package/src/generated/instructions/syncPool.ts +37 -12
- package/src/generated/instructions/transferAdminAuthority.ts +74 -27
- package/src/generated/instructions/withdraw.ts +218 -83
|
@@ -36,7 +36,6 @@ import {
|
|
|
36
36
|
type InstructionWithData,
|
|
37
37
|
type ReadonlyAccount,
|
|
38
38
|
type ReadonlyUint8Array,
|
|
39
|
-
type TransactionSigner,
|
|
40
39
|
type WritableAccount,
|
|
41
40
|
type WritableSignerAccount,
|
|
42
41
|
} from "@solana/kit";
|
|
@@ -44,7 +43,11 @@ import {
|
|
|
44
43
|
getAccountMetaFactory,
|
|
45
44
|
getAddressFromResolvedInstructionAccount,
|
|
46
45
|
getNonNullResolvedInstructionInput,
|
|
46
|
+
type InstructionAccountInput,
|
|
47
|
+
type InstructionAccountInputAddress,
|
|
48
|
+
type InstructionSignerInput,
|
|
47
49
|
type ResolvedInstructionAccount,
|
|
50
|
+
type ResolvedInstructionAccountMeta,
|
|
48
51
|
} from "@solana/program-client-core";
|
|
49
52
|
import { findAdminConfigPda, findPoolPda } from "../pdas/index.js";
|
|
50
53
|
import { PICON_DLMM_PROGRAM_ADDRESS } from "../programs/index.js";
|
|
@@ -164,29 +167,33 @@ export function getCreatePoolInstructionDataCodec(): FixedSizeCodec<
|
|
|
164
167
|
}
|
|
165
168
|
|
|
166
169
|
export type CreatePoolAsyncInput<
|
|
167
|
-
TAccountAuthority extends
|
|
168
|
-
TAccountAdminConfig extends
|
|
169
|
-
TAccountTokenMintX extends
|
|
170
|
-
TAccountTokenMintY extends
|
|
171
|
-
TAccountTokenVaultX extends
|
|
172
|
-
TAccountTokenVaultY extends
|
|
173
|
-
TAccountPool extends
|
|
174
|
-
TAccountTokenProgramX extends
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
170
|
+
TAccountAuthority extends InstructionSignerInput = InstructionSignerInput,
|
|
171
|
+
TAccountAdminConfig extends InstructionAccountInput = InstructionAccountInput,
|
|
172
|
+
TAccountTokenMintX extends InstructionAccountInput = InstructionAccountInput,
|
|
173
|
+
TAccountTokenMintY extends InstructionAccountInput = InstructionAccountInput,
|
|
174
|
+
TAccountTokenVaultX extends InstructionAccountInput = InstructionAccountInput,
|
|
175
|
+
TAccountTokenVaultY extends InstructionAccountInput = InstructionAccountInput,
|
|
176
|
+
TAccountPool extends InstructionAccountInput = InstructionAccountInput,
|
|
177
|
+
TAccountTokenProgramX extends InstructionAccountInput =
|
|
178
|
+
InstructionAccountInput,
|
|
179
|
+
TAccountTokenProgramY extends InstructionAccountInput =
|
|
180
|
+
InstructionAccountInput,
|
|
181
|
+
TAccountAssociatedTokenProgram extends InstructionAccountInput =
|
|
182
|
+
InstructionAccountInput,
|
|
183
|
+
TAccountSystemProgram extends InstructionAccountInput =
|
|
184
|
+
InstructionAccountInput,
|
|
178
185
|
> = {
|
|
179
|
-
authority:
|
|
180
|
-
adminConfig?:
|
|
181
|
-
tokenMintX:
|
|
182
|
-
tokenMintY:
|
|
183
|
-
tokenVaultX?:
|
|
184
|
-
tokenVaultY?:
|
|
185
|
-
pool?:
|
|
186
|
-
tokenProgramX:
|
|
187
|
-
tokenProgramY:
|
|
188
|
-
associatedTokenProgram?:
|
|
189
|
-
systemProgram?:
|
|
186
|
+
authority: TAccountAuthority;
|
|
187
|
+
adminConfig?: TAccountAdminConfig;
|
|
188
|
+
tokenMintX: TAccountTokenMintX;
|
|
189
|
+
tokenMintY: TAccountTokenMintY;
|
|
190
|
+
tokenVaultX?: TAccountTokenVaultX;
|
|
191
|
+
tokenVaultY?: TAccountTokenVaultY;
|
|
192
|
+
pool?: TAccountPool;
|
|
193
|
+
tokenProgramX: TAccountTokenProgramX;
|
|
194
|
+
tokenProgramY: TAccountTokenProgramY;
|
|
195
|
+
associatedTokenProgram?: TAccountAssociatedTokenProgram;
|
|
196
|
+
systemProgram?: TAccountSystemProgram;
|
|
190
197
|
binStep: CreatePoolInstructionDataArgs["binStep"];
|
|
191
198
|
feeRate: CreatePoolInstructionDataArgs["feeRate"];
|
|
192
199
|
protocolShare: CreatePoolInstructionDataArgs["protocolShare"];
|
|
@@ -194,17 +201,17 @@ export type CreatePoolAsyncInput<
|
|
|
194
201
|
};
|
|
195
202
|
|
|
196
203
|
export async function getCreatePoolInstructionAsync<
|
|
197
|
-
TAccountAuthority extends
|
|
198
|
-
TAccountAdminConfig extends
|
|
199
|
-
TAccountTokenMintX extends
|
|
200
|
-
TAccountTokenMintY extends
|
|
201
|
-
TAccountTokenVaultX extends
|
|
202
|
-
TAccountTokenVaultY extends
|
|
203
|
-
TAccountPool extends
|
|
204
|
-
TAccountTokenProgramX extends
|
|
205
|
-
TAccountTokenProgramY extends
|
|
206
|
-
TAccountAssociatedTokenProgram extends
|
|
207
|
-
TAccountSystemProgram extends
|
|
204
|
+
TAccountAuthority extends InstructionSignerInput,
|
|
205
|
+
TAccountAdminConfig extends InstructionAccountInput,
|
|
206
|
+
TAccountTokenMintX extends InstructionAccountInput,
|
|
207
|
+
TAccountTokenMintY extends InstructionAccountInput,
|
|
208
|
+
TAccountTokenVaultX extends InstructionAccountInput,
|
|
209
|
+
TAccountTokenVaultY extends InstructionAccountInput,
|
|
210
|
+
TAccountPool extends InstructionAccountInput,
|
|
211
|
+
TAccountTokenProgramX extends InstructionAccountInput,
|
|
212
|
+
TAccountTokenProgramY extends InstructionAccountInput,
|
|
213
|
+
TAccountAssociatedTokenProgram extends InstructionAccountInput,
|
|
214
|
+
TAccountSystemProgram extends InstructionAccountInput,
|
|
208
215
|
TProgramAddress extends Address = typeof PICON_DLMM_PROGRAM_ADDRESS,
|
|
209
216
|
>(
|
|
210
217
|
input: CreatePoolAsyncInput<
|
|
@@ -224,38 +231,111 @@ export async function getCreatePoolInstructionAsync<
|
|
|
224
231
|
): Promise<
|
|
225
232
|
CreatePoolInstruction<
|
|
226
233
|
TProgramAddress,
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
234
|
+
ResolvedInstructionAccountMeta<
|
|
235
|
+
TAccountAuthority,
|
|
236
|
+
InstructionAccountInputAddress<TAccountAuthority>
|
|
237
|
+
>,
|
|
238
|
+
ResolvedInstructionAccountMeta<
|
|
239
|
+
TAccountAdminConfig,
|
|
240
|
+
InstructionAccountInputAddress<TAccountAdminConfig>
|
|
241
|
+
>,
|
|
242
|
+
ResolvedInstructionAccountMeta<
|
|
243
|
+
TAccountTokenMintX,
|
|
244
|
+
InstructionAccountInputAddress<TAccountTokenMintX>
|
|
245
|
+
>,
|
|
246
|
+
ResolvedInstructionAccountMeta<
|
|
247
|
+
TAccountTokenMintY,
|
|
248
|
+
InstructionAccountInputAddress<TAccountTokenMintY>
|
|
249
|
+
>,
|
|
250
|
+
ResolvedInstructionAccountMeta<
|
|
251
|
+
TAccountTokenVaultX,
|
|
252
|
+
InstructionAccountInputAddress<TAccountTokenVaultX>
|
|
253
|
+
>,
|
|
254
|
+
ResolvedInstructionAccountMeta<
|
|
255
|
+
TAccountTokenVaultY,
|
|
256
|
+
InstructionAccountInputAddress<TAccountTokenVaultY>
|
|
257
|
+
>,
|
|
258
|
+
ResolvedInstructionAccountMeta<
|
|
259
|
+
TAccountPool,
|
|
260
|
+
InstructionAccountInputAddress<TAccountPool>
|
|
261
|
+
>,
|
|
262
|
+
ResolvedInstructionAccountMeta<
|
|
263
|
+
TAccountTokenProgramX,
|
|
264
|
+
InstructionAccountInputAddress<TAccountTokenProgramX>
|
|
265
|
+
>,
|
|
266
|
+
ResolvedInstructionAccountMeta<
|
|
267
|
+
TAccountTokenProgramY,
|
|
268
|
+
InstructionAccountInputAddress<TAccountTokenProgramY>
|
|
269
|
+
>,
|
|
270
|
+
ResolvedInstructionAccountMeta<
|
|
271
|
+
TAccountAssociatedTokenProgram,
|
|
272
|
+
InstructionAccountInputAddress<TAccountAssociatedTokenProgram>
|
|
273
|
+
>,
|
|
274
|
+
ResolvedInstructionAccountMeta<
|
|
275
|
+
TAccountSystemProgram,
|
|
276
|
+
InstructionAccountInputAddress<TAccountSystemProgram>
|
|
277
|
+
>
|
|
238
278
|
>
|
|
239
279
|
> {
|
|
240
280
|
// Program address.
|
|
241
281
|
const programAddress = config?.programAddress ?? PICON_DLMM_PROGRAM_ADDRESS;
|
|
242
282
|
|
|
283
|
+
// Account meta helper.
|
|
284
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
285
|
+
|
|
243
286
|
// Original accounts.
|
|
244
287
|
const originalAccounts = {
|
|
245
|
-
authority: {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
288
|
+
authority: {
|
|
289
|
+
value: input.authority ?? null,
|
|
290
|
+
isSigner: true,
|
|
291
|
+
isWritable: true,
|
|
292
|
+
},
|
|
293
|
+
adminConfig: {
|
|
294
|
+
value: input.adminConfig ?? null,
|
|
295
|
+
isSigner: false,
|
|
296
|
+
isWritable: false,
|
|
297
|
+
},
|
|
298
|
+
tokenMintX: {
|
|
299
|
+
value: input.tokenMintX ?? null,
|
|
300
|
+
isSigner: false,
|
|
301
|
+
isWritable: false,
|
|
302
|
+
},
|
|
303
|
+
tokenMintY: {
|
|
304
|
+
value: input.tokenMintY ?? null,
|
|
305
|
+
isSigner: false,
|
|
306
|
+
isWritable: false,
|
|
307
|
+
},
|
|
308
|
+
tokenVaultX: {
|
|
309
|
+
value: input.tokenVaultX ?? null,
|
|
310
|
+
isSigner: false,
|
|
311
|
+
isWritable: true,
|
|
312
|
+
},
|
|
313
|
+
tokenVaultY: {
|
|
314
|
+
value: input.tokenVaultY ?? null,
|
|
315
|
+
isSigner: false,
|
|
316
|
+
isWritable: true,
|
|
317
|
+
},
|
|
318
|
+
pool: { value: input.pool ?? null, isSigner: false, isWritable: true },
|
|
319
|
+
tokenProgramX: {
|
|
320
|
+
value: input.tokenProgramX ?? null,
|
|
321
|
+
isSigner: false,
|
|
322
|
+
isWritable: false,
|
|
323
|
+
},
|
|
324
|
+
tokenProgramY: {
|
|
325
|
+
value: input.tokenProgramY ?? null,
|
|
326
|
+
isSigner: false,
|
|
327
|
+
isWritable: false,
|
|
328
|
+
},
|
|
254
329
|
associatedTokenProgram: {
|
|
255
330
|
value: input.associatedTokenProgram ?? null,
|
|
331
|
+
isSigner: false,
|
|
332
|
+
isWritable: false,
|
|
333
|
+
},
|
|
334
|
+
systemProgram: {
|
|
335
|
+
value: input.systemProgram ?? null,
|
|
336
|
+
isSigner: false,
|
|
256
337
|
isWritable: false,
|
|
257
338
|
},
|
|
258
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
259
339
|
};
|
|
260
340
|
const accounts = originalAccounts as Record<
|
|
261
341
|
keyof typeof originalAccounts,
|
|
@@ -341,7 +421,6 @@ export async function getCreatePoolInstructionAsync<
|
|
|
341
421
|
"11111111111111111111111111111111" as Address<"11111111111111111111111111111111">;
|
|
342
422
|
}
|
|
343
423
|
|
|
344
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
345
424
|
return Object.freeze({
|
|
346
425
|
accounts: [
|
|
347
426
|
getAccountMeta("authority", accounts.authority),
|
|
@@ -362,44 +441,81 @@ export async function getCreatePoolInstructionAsync<
|
|
|
362
441
|
programAddress,
|
|
363
442
|
} as CreatePoolInstruction<
|
|
364
443
|
TProgramAddress,
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
444
|
+
ResolvedInstructionAccountMeta<
|
|
445
|
+
TAccountAuthority,
|
|
446
|
+
InstructionAccountInputAddress<TAccountAuthority>
|
|
447
|
+
>,
|
|
448
|
+
ResolvedInstructionAccountMeta<
|
|
449
|
+
TAccountAdminConfig,
|
|
450
|
+
InstructionAccountInputAddress<TAccountAdminConfig>
|
|
451
|
+
>,
|
|
452
|
+
ResolvedInstructionAccountMeta<
|
|
453
|
+
TAccountTokenMintX,
|
|
454
|
+
InstructionAccountInputAddress<TAccountTokenMintX>
|
|
455
|
+
>,
|
|
456
|
+
ResolvedInstructionAccountMeta<
|
|
457
|
+
TAccountTokenMintY,
|
|
458
|
+
InstructionAccountInputAddress<TAccountTokenMintY>
|
|
459
|
+
>,
|
|
460
|
+
ResolvedInstructionAccountMeta<
|
|
461
|
+
TAccountTokenVaultX,
|
|
462
|
+
InstructionAccountInputAddress<TAccountTokenVaultX>
|
|
463
|
+
>,
|
|
464
|
+
ResolvedInstructionAccountMeta<
|
|
465
|
+
TAccountTokenVaultY,
|
|
466
|
+
InstructionAccountInputAddress<TAccountTokenVaultY>
|
|
467
|
+
>,
|
|
468
|
+
ResolvedInstructionAccountMeta<
|
|
469
|
+
TAccountPool,
|
|
470
|
+
InstructionAccountInputAddress<TAccountPool>
|
|
471
|
+
>,
|
|
472
|
+
ResolvedInstructionAccountMeta<
|
|
473
|
+
TAccountTokenProgramX,
|
|
474
|
+
InstructionAccountInputAddress<TAccountTokenProgramX>
|
|
475
|
+
>,
|
|
476
|
+
ResolvedInstructionAccountMeta<
|
|
477
|
+
TAccountTokenProgramY,
|
|
478
|
+
InstructionAccountInputAddress<TAccountTokenProgramY>
|
|
479
|
+
>,
|
|
480
|
+
ResolvedInstructionAccountMeta<
|
|
481
|
+
TAccountAssociatedTokenProgram,
|
|
482
|
+
InstructionAccountInputAddress<TAccountAssociatedTokenProgram>
|
|
483
|
+
>,
|
|
484
|
+
ResolvedInstructionAccountMeta<
|
|
485
|
+
TAccountSystemProgram,
|
|
486
|
+
InstructionAccountInputAddress<TAccountSystemProgram>
|
|
487
|
+
>
|
|
376
488
|
>);
|
|
377
489
|
}
|
|
378
490
|
|
|
379
491
|
export type CreatePoolInput<
|
|
380
|
-
TAccountAuthority extends
|
|
381
|
-
TAccountAdminConfig extends
|
|
382
|
-
TAccountTokenMintX extends
|
|
383
|
-
TAccountTokenMintY extends
|
|
384
|
-
TAccountTokenVaultX extends
|
|
385
|
-
TAccountTokenVaultY extends
|
|
386
|
-
TAccountPool extends
|
|
387
|
-
TAccountTokenProgramX extends
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
492
|
+
TAccountAuthority extends InstructionSignerInput = InstructionSignerInput,
|
|
493
|
+
TAccountAdminConfig extends InstructionAccountInput = InstructionAccountInput,
|
|
494
|
+
TAccountTokenMintX extends InstructionAccountInput = InstructionAccountInput,
|
|
495
|
+
TAccountTokenMintY extends InstructionAccountInput = InstructionAccountInput,
|
|
496
|
+
TAccountTokenVaultX extends InstructionAccountInput = InstructionAccountInput,
|
|
497
|
+
TAccountTokenVaultY extends InstructionAccountInput = InstructionAccountInput,
|
|
498
|
+
TAccountPool extends InstructionAccountInput = InstructionAccountInput,
|
|
499
|
+
TAccountTokenProgramX extends InstructionAccountInput =
|
|
500
|
+
InstructionAccountInput,
|
|
501
|
+
TAccountTokenProgramY extends InstructionAccountInput =
|
|
502
|
+
InstructionAccountInput,
|
|
503
|
+
TAccountAssociatedTokenProgram extends InstructionAccountInput =
|
|
504
|
+
InstructionAccountInput,
|
|
505
|
+
TAccountSystemProgram extends InstructionAccountInput =
|
|
506
|
+
InstructionAccountInput,
|
|
391
507
|
> = {
|
|
392
|
-
authority:
|
|
393
|
-
adminConfig:
|
|
394
|
-
tokenMintX:
|
|
395
|
-
tokenMintY:
|
|
396
|
-
tokenVaultX:
|
|
397
|
-
tokenVaultY:
|
|
398
|
-
pool:
|
|
399
|
-
tokenProgramX:
|
|
400
|
-
tokenProgramY:
|
|
401
|
-
associatedTokenProgram?:
|
|
402
|
-
systemProgram?:
|
|
508
|
+
authority: TAccountAuthority;
|
|
509
|
+
adminConfig: TAccountAdminConfig;
|
|
510
|
+
tokenMintX: TAccountTokenMintX;
|
|
511
|
+
tokenMintY: TAccountTokenMintY;
|
|
512
|
+
tokenVaultX: TAccountTokenVaultX;
|
|
513
|
+
tokenVaultY: TAccountTokenVaultY;
|
|
514
|
+
pool: TAccountPool;
|
|
515
|
+
tokenProgramX: TAccountTokenProgramX;
|
|
516
|
+
tokenProgramY: TAccountTokenProgramY;
|
|
517
|
+
associatedTokenProgram?: TAccountAssociatedTokenProgram;
|
|
518
|
+
systemProgram?: TAccountSystemProgram;
|
|
403
519
|
binStep: CreatePoolInstructionDataArgs["binStep"];
|
|
404
520
|
feeRate: CreatePoolInstructionDataArgs["feeRate"];
|
|
405
521
|
protocolShare: CreatePoolInstructionDataArgs["protocolShare"];
|
|
@@ -407,17 +523,17 @@ export type CreatePoolInput<
|
|
|
407
523
|
};
|
|
408
524
|
|
|
409
525
|
export function getCreatePoolInstruction<
|
|
410
|
-
TAccountAuthority extends
|
|
411
|
-
TAccountAdminConfig extends
|
|
412
|
-
TAccountTokenMintX extends
|
|
413
|
-
TAccountTokenMintY extends
|
|
414
|
-
TAccountTokenVaultX extends
|
|
415
|
-
TAccountTokenVaultY extends
|
|
416
|
-
TAccountPool extends
|
|
417
|
-
TAccountTokenProgramX extends
|
|
418
|
-
TAccountTokenProgramY extends
|
|
419
|
-
TAccountAssociatedTokenProgram extends
|
|
420
|
-
TAccountSystemProgram extends
|
|
526
|
+
TAccountAuthority extends InstructionSignerInput,
|
|
527
|
+
TAccountAdminConfig extends InstructionAccountInput,
|
|
528
|
+
TAccountTokenMintX extends InstructionAccountInput,
|
|
529
|
+
TAccountTokenMintY extends InstructionAccountInput,
|
|
530
|
+
TAccountTokenVaultX extends InstructionAccountInput,
|
|
531
|
+
TAccountTokenVaultY extends InstructionAccountInput,
|
|
532
|
+
TAccountPool extends InstructionAccountInput,
|
|
533
|
+
TAccountTokenProgramX extends InstructionAccountInput,
|
|
534
|
+
TAccountTokenProgramY extends InstructionAccountInput,
|
|
535
|
+
TAccountAssociatedTokenProgram extends InstructionAccountInput,
|
|
536
|
+
TAccountSystemProgram extends InstructionAccountInput,
|
|
421
537
|
TProgramAddress extends Address = typeof PICON_DLMM_PROGRAM_ADDRESS,
|
|
422
538
|
>(
|
|
423
539
|
input: CreatePoolInput<
|
|
@@ -436,37 +552,110 @@ export function getCreatePoolInstruction<
|
|
|
436
552
|
config?: { programAddress?: TProgramAddress },
|
|
437
553
|
): CreatePoolInstruction<
|
|
438
554
|
TProgramAddress,
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
555
|
+
ResolvedInstructionAccountMeta<
|
|
556
|
+
TAccountAuthority,
|
|
557
|
+
InstructionAccountInputAddress<TAccountAuthority>
|
|
558
|
+
>,
|
|
559
|
+
ResolvedInstructionAccountMeta<
|
|
560
|
+
TAccountAdminConfig,
|
|
561
|
+
InstructionAccountInputAddress<TAccountAdminConfig>
|
|
562
|
+
>,
|
|
563
|
+
ResolvedInstructionAccountMeta<
|
|
564
|
+
TAccountTokenMintX,
|
|
565
|
+
InstructionAccountInputAddress<TAccountTokenMintX>
|
|
566
|
+
>,
|
|
567
|
+
ResolvedInstructionAccountMeta<
|
|
568
|
+
TAccountTokenMintY,
|
|
569
|
+
InstructionAccountInputAddress<TAccountTokenMintY>
|
|
570
|
+
>,
|
|
571
|
+
ResolvedInstructionAccountMeta<
|
|
572
|
+
TAccountTokenVaultX,
|
|
573
|
+
InstructionAccountInputAddress<TAccountTokenVaultX>
|
|
574
|
+
>,
|
|
575
|
+
ResolvedInstructionAccountMeta<
|
|
576
|
+
TAccountTokenVaultY,
|
|
577
|
+
InstructionAccountInputAddress<TAccountTokenVaultY>
|
|
578
|
+
>,
|
|
579
|
+
ResolvedInstructionAccountMeta<
|
|
580
|
+
TAccountPool,
|
|
581
|
+
InstructionAccountInputAddress<TAccountPool>
|
|
582
|
+
>,
|
|
583
|
+
ResolvedInstructionAccountMeta<
|
|
584
|
+
TAccountTokenProgramX,
|
|
585
|
+
InstructionAccountInputAddress<TAccountTokenProgramX>
|
|
586
|
+
>,
|
|
587
|
+
ResolvedInstructionAccountMeta<
|
|
588
|
+
TAccountTokenProgramY,
|
|
589
|
+
InstructionAccountInputAddress<TAccountTokenProgramY>
|
|
590
|
+
>,
|
|
591
|
+
ResolvedInstructionAccountMeta<
|
|
592
|
+
TAccountAssociatedTokenProgram,
|
|
593
|
+
InstructionAccountInputAddress<TAccountAssociatedTokenProgram>
|
|
594
|
+
>,
|
|
595
|
+
ResolvedInstructionAccountMeta<
|
|
596
|
+
TAccountSystemProgram,
|
|
597
|
+
InstructionAccountInputAddress<TAccountSystemProgram>
|
|
598
|
+
>
|
|
450
599
|
> {
|
|
451
600
|
// Program address.
|
|
452
601
|
const programAddress = config?.programAddress ?? PICON_DLMM_PROGRAM_ADDRESS;
|
|
453
602
|
|
|
603
|
+
// Account meta helper.
|
|
604
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
605
|
+
|
|
454
606
|
// Original accounts.
|
|
455
607
|
const originalAccounts = {
|
|
456
|
-
authority: {
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
608
|
+
authority: {
|
|
609
|
+
value: input.authority ?? null,
|
|
610
|
+
isSigner: true,
|
|
611
|
+
isWritable: true,
|
|
612
|
+
},
|
|
613
|
+
adminConfig: {
|
|
614
|
+
value: input.adminConfig ?? null,
|
|
615
|
+
isSigner: false,
|
|
616
|
+
isWritable: false,
|
|
617
|
+
},
|
|
618
|
+
tokenMintX: {
|
|
619
|
+
value: input.tokenMintX ?? null,
|
|
620
|
+
isSigner: false,
|
|
621
|
+
isWritable: false,
|
|
622
|
+
},
|
|
623
|
+
tokenMintY: {
|
|
624
|
+
value: input.tokenMintY ?? null,
|
|
625
|
+
isSigner: false,
|
|
626
|
+
isWritable: false,
|
|
627
|
+
},
|
|
628
|
+
tokenVaultX: {
|
|
629
|
+
value: input.tokenVaultX ?? null,
|
|
630
|
+
isSigner: false,
|
|
631
|
+
isWritable: true,
|
|
632
|
+
},
|
|
633
|
+
tokenVaultY: {
|
|
634
|
+
value: input.tokenVaultY ?? null,
|
|
635
|
+
isSigner: false,
|
|
636
|
+
isWritable: true,
|
|
637
|
+
},
|
|
638
|
+
pool: { value: input.pool ?? null, isSigner: false, isWritable: true },
|
|
639
|
+
tokenProgramX: {
|
|
640
|
+
value: input.tokenProgramX ?? null,
|
|
641
|
+
isSigner: false,
|
|
642
|
+
isWritable: false,
|
|
643
|
+
},
|
|
644
|
+
tokenProgramY: {
|
|
645
|
+
value: input.tokenProgramY ?? null,
|
|
646
|
+
isSigner: false,
|
|
647
|
+
isWritable: false,
|
|
648
|
+
},
|
|
465
649
|
associatedTokenProgram: {
|
|
466
650
|
value: input.associatedTokenProgram ?? null,
|
|
651
|
+
isSigner: false,
|
|
652
|
+
isWritable: false,
|
|
653
|
+
},
|
|
654
|
+
systemProgram: {
|
|
655
|
+
value: input.systemProgram ?? null,
|
|
656
|
+
isSigner: false,
|
|
467
657
|
isWritable: false,
|
|
468
658
|
},
|
|
469
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
470
659
|
};
|
|
471
660
|
const accounts = originalAccounts as Record<
|
|
472
661
|
keyof typeof originalAccounts,
|
|
@@ -486,7 +675,6 @@ export function getCreatePoolInstruction<
|
|
|
486
675
|
"11111111111111111111111111111111" as Address<"11111111111111111111111111111111">;
|
|
487
676
|
}
|
|
488
677
|
|
|
489
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
490
678
|
return Object.freeze({
|
|
491
679
|
accounts: [
|
|
492
680
|
getAccountMeta("authority", accounts.authority),
|
|
@@ -507,17 +695,50 @@ export function getCreatePoolInstruction<
|
|
|
507
695
|
programAddress,
|
|
508
696
|
} as CreatePoolInstruction<
|
|
509
697
|
TProgramAddress,
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
698
|
+
ResolvedInstructionAccountMeta<
|
|
699
|
+
TAccountAuthority,
|
|
700
|
+
InstructionAccountInputAddress<TAccountAuthority>
|
|
701
|
+
>,
|
|
702
|
+
ResolvedInstructionAccountMeta<
|
|
703
|
+
TAccountAdminConfig,
|
|
704
|
+
InstructionAccountInputAddress<TAccountAdminConfig>
|
|
705
|
+
>,
|
|
706
|
+
ResolvedInstructionAccountMeta<
|
|
707
|
+
TAccountTokenMintX,
|
|
708
|
+
InstructionAccountInputAddress<TAccountTokenMintX>
|
|
709
|
+
>,
|
|
710
|
+
ResolvedInstructionAccountMeta<
|
|
711
|
+
TAccountTokenMintY,
|
|
712
|
+
InstructionAccountInputAddress<TAccountTokenMintY>
|
|
713
|
+
>,
|
|
714
|
+
ResolvedInstructionAccountMeta<
|
|
715
|
+
TAccountTokenVaultX,
|
|
716
|
+
InstructionAccountInputAddress<TAccountTokenVaultX>
|
|
717
|
+
>,
|
|
718
|
+
ResolvedInstructionAccountMeta<
|
|
719
|
+
TAccountTokenVaultY,
|
|
720
|
+
InstructionAccountInputAddress<TAccountTokenVaultY>
|
|
721
|
+
>,
|
|
722
|
+
ResolvedInstructionAccountMeta<
|
|
723
|
+
TAccountPool,
|
|
724
|
+
InstructionAccountInputAddress<TAccountPool>
|
|
725
|
+
>,
|
|
726
|
+
ResolvedInstructionAccountMeta<
|
|
727
|
+
TAccountTokenProgramX,
|
|
728
|
+
InstructionAccountInputAddress<TAccountTokenProgramX>
|
|
729
|
+
>,
|
|
730
|
+
ResolvedInstructionAccountMeta<
|
|
731
|
+
TAccountTokenProgramY,
|
|
732
|
+
InstructionAccountInputAddress<TAccountTokenProgramY>
|
|
733
|
+
>,
|
|
734
|
+
ResolvedInstructionAccountMeta<
|
|
735
|
+
TAccountAssociatedTokenProgram,
|
|
736
|
+
InstructionAccountInputAddress<TAccountAssociatedTokenProgram>
|
|
737
|
+
>,
|
|
738
|
+
ResolvedInstructionAccountMeta<
|
|
739
|
+
TAccountSystemProgram,
|
|
740
|
+
InstructionAccountInputAddress<TAccountSystemProgram>
|
|
741
|
+
>
|
|
521
742
|
>);
|
|
522
743
|
}
|
|
523
744
|
|