@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.
Files changed (83) hide show
  1. package/dist/entities/dlmm_program.d.ts +1 -1
  2. package/dist/entities/dlmm_program.d.ts.map +1 -1
  3. package/dist/entities/dlmm_program.js +2 -2
  4. package/dist/entities/pool.d.ts +1 -1
  5. package/dist/entities/pool.d.ts.map +1 -1
  6. package/dist/generated/instructions/acceptAdminAuthority.d.ts +12 -11
  7. package/dist/generated/instructions/acceptAdminAuthority.d.ts.map +1 -1
  8. package/dist/generated/instructions/acceptAdminAuthority.js +16 -4
  9. package/dist/generated/instructions/claimFee.d.ts +19 -18
  10. package/dist/generated/instructions/claimFee.d.ts.map +1 -1
  11. package/dist/generated/instructions/claimFee.js +52 -12
  12. package/dist/generated/instructions/claimProtocolFee.d.ts +30 -29
  13. package/dist/generated/instructions/claimProtocolFee.d.ts.map +1 -1
  14. package/dist/generated/instructions/claimProtocolFee.js +90 -20
  15. package/dist/generated/instructions/closePosition.d.ts +18 -17
  16. package/dist/generated/instructions/closePosition.d.ts.map +1 -1
  17. package/dist/generated/instructions/closePosition.js +38 -10
  18. package/dist/generated/instructions/createAdminConfig.d.ts +18 -17
  19. package/dist/generated/instructions/createAdminConfig.d.ts.map +1 -1
  20. package/dist/generated/instructions/createAdminConfig.js +54 -12
  21. package/dist/generated/instructions/createBinArray.d.ts +16 -15
  22. package/dist/generated/instructions/createBinArray.d.ts.map +1 -1
  23. package/dist/generated/instructions/createBinArray.js +28 -10
  24. package/dist/generated/instructions/createPool.d.ts +30 -29
  25. package/dist/generated/instructions/createPool.d.ts.map +1 -1
  26. package/dist/generated/instructions/createPool.js +98 -22
  27. package/dist/generated/instructions/deleteBinArray.d.ts +18 -17
  28. package/dist/generated/instructions/deleteBinArray.d.ts.map +1 -1
  29. package/dist/generated/instructions/deleteBinArray.js +54 -12
  30. package/dist/generated/instructions/depositByWeight.d.ts +19 -18
  31. package/dist/generated/instructions/depositByWeight.d.ts.map +1 -1
  32. package/dist/generated/instructions/depositByWeight.js +52 -12
  33. package/dist/generated/instructions/openPosition.d.ts +28 -27
  34. package/dist/generated/instructions/openPosition.d.ts.map +1 -1
  35. package/dist/generated/instructions/openPosition.js +64 -16
  36. package/dist/generated/instructions/resetAdminAuthority.d.ts +16 -15
  37. package/dist/generated/instructions/resetAdminAuthority.d.ts.map +1 -1
  38. package/dist/generated/instructions/resetAdminAuthority.js +44 -10
  39. package/dist/generated/instructions/setMetadataUpdateAuthority.d.ts +12 -11
  40. package/dist/generated/instructions/setMetadataUpdateAuthority.d.ts.map +1 -1
  41. package/dist/generated/instructions/setMetadataUpdateAuthority.js +24 -6
  42. package/dist/generated/instructions/setPoolDynamicFeeConfig.d.ts +14 -13
  43. package/dist/generated/instructions/setPoolDynamicFeeConfig.d.ts.map +1 -1
  44. package/dist/generated/instructions/setPoolDynamicFeeConfig.js +26 -8
  45. package/dist/generated/instructions/setPoolProtocolShare.d.ts +14 -13
  46. package/dist/generated/instructions/setPoolProtocolShare.d.ts.map +1 -1
  47. package/dist/generated/instructions/setPoolProtocolShare.js +26 -8
  48. package/dist/generated/instructions/swapExactIn.d.ts +15 -14
  49. package/dist/generated/instructions/swapExactIn.d.ts.map +1 -1
  50. package/dist/generated/instructions/swapExactIn.js +36 -9
  51. package/dist/generated/instructions/swapExactOut.d.ts +15 -14
  52. package/dist/generated/instructions/swapExactOut.d.ts.map +1 -1
  53. package/dist/generated/instructions/swapExactOut.js +36 -9
  54. package/dist/generated/instructions/syncPool.d.ts +7 -6
  55. package/dist/generated/instructions/syncPool.d.ts.map +1 -1
  56. package/dist/generated/instructions/syncPool.js +4 -3
  57. package/dist/generated/instructions/transferAdminAuthority.d.ts +12 -11
  58. package/dist/generated/instructions/transferAdminAuthority.d.ts.map +1 -1
  59. package/dist/generated/instructions/transferAdminAuthority.js +24 -6
  60. package/dist/generated/instructions/withdraw.d.ts +19 -18
  61. package/dist/generated/instructions/withdraw.d.ts.map +1 -1
  62. package/dist/generated/instructions/withdraw.js +52 -12
  63. package/package.json +8 -8
  64. package/src/entities/dlmm_program.ts +3 -3
  65. package/src/generated/instructions/acceptAdminAuthority.ts +68 -25
  66. package/src/generated/instructions/claimFee.ts +218 -83
  67. package/src/generated/instructions/claimProtocolFee.ts +346 -131
  68. package/src/generated/instructions/closePosition.ts +160 -61
  69. package/src/generated/instructions/createAdminConfig.ts +172 -63
  70. package/src/generated/instructions/createBinArray.ts +124 -51
  71. package/src/generated/instructions/createPool.ts +354 -133
  72. package/src/generated/instructions/deleteBinArray.ts +172 -63
  73. package/src/generated/instructions/depositByWeight.ts +218 -83
  74. package/src/generated/instructions/openPosition.ts +300 -117
  75. package/src/generated/instructions/resetAdminAuthority.ts +138 -51
  76. package/src/generated/instructions/setMetadataUpdateAuthority.ts +74 -27
  77. package/src/generated/instructions/setPoolDynamicFeeConfig.ts +98 -39
  78. package/src/generated/instructions/setPoolProtocolShare.ts +98 -39
  79. package/src/generated/instructions/swapExactIn.ts +155 -60
  80. package/src/generated/instructions/swapExactOut.ts +155 -60
  81. package/src/generated/instructions/syncPool.ts +37 -12
  82. package/src/generated/instructions/transferAdminAuthority.ts +74 -27
  83. package/src/generated/instructions/withdraw.ts +218 -83
@@ -35,12 +35,15 @@ import {
35
35
  type ReadonlyAccount,
36
36
  type ReadonlySignerAccount,
37
37
  type ReadonlyUint8Array,
38
- type TransactionSigner,
39
38
  type WritableAccount,
40
39
  } from "@solana/kit";
41
40
  import {
42
41
  getAccountMetaFactory,
42
+ type InstructionAccountInput,
43
+ type InstructionAccountInputAddress,
44
+ type InstructionSignerInput,
43
45
  type ResolvedInstructionAccount,
46
+ type ResolvedInstructionAccountMeta,
44
47
  } from "@solana/program-client-core";
45
48
  import { PICON_DLMM_PROGRAM_ADDRESS } from "../programs/index.js";
46
49
  import {
@@ -177,55 +180,62 @@ export function getClaimFeeInstructionDataCodec(): Codec<
177
180
  }
178
181
 
179
182
  export type ClaimFeeInput<
180
- TAccountOwner extends string = string,
181
- TAccountPool extends string = string,
182
- TAccountPosition extends string = string,
183
- TAccountPositionTokenAccount extends string = string,
184
- TAccountTokenMintX extends string = string,
185
- TAccountTokenMintY extends string = string,
186
- TAccountTokenOwnerAccountX extends string = string,
187
- TAccountTokenOwnerAccountY extends string = string,
188
- TAccountTokenVaultX extends string = string,
189
- TAccountTokenVaultY extends string = string,
190
- TAccountTokenProgramX extends string = string,
191
- TAccountTokenProgramY extends string = string,
192
- TAccountLowerBinArray extends string = string,
193
- TAccountUpperBinArray extends string = string,
183
+ TAccountOwner extends InstructionSignerInput = InstructionSignerInput,
184
+ TAccountPool extends InstructionAccountInput = InstructionAccountInput,
185
+ TAccountPosition extends InstructionAccountInput = InstructionAccountInput,
186
+ TAccountPositionTokenAccount extends InstructionAccountInput =
187
+ InstructionAccountInput,
188
+ TAccountTokenMintX extends InstructionAccountInput = InstructionAccountInput,
189
+ TAccountTokenMintY extends InstructionAccountInput = InstructionAccountInput,
190
+ TAccountTokenOwnerAccountX extends InstructionAccountInput =
191
+ InstructionAccountInput,
192
+ TAccountTokenOwnerAccountY extends InstructionAccountInput =
193
+ InstructionAccountInput,
194
+ TAccountTokenVaultX extends InstructionAccountInput = InstructionAccountInput,
195
+ TAccountTokenVaultY extends InstructionAccountInput = InstructionAccountInput,
196
+ TAccountTokenProgramX extends InstructionAccountInput =
197
+ InstructionAccountInput,
198
+ TAccountTokenProgramY extends InstructionAccountInput =
199
+ InstructionAccountInput,
200
+ TAccountLowerBinArray extends InstructionAccountInput =
201
+ InstructionAccountInput,
202
+ TAccountUpperBinArray extends InstructionAccountInput =
203
+ InstructionAccountInput,
194
204
  > = {
195
- owner: TransactionSigner<TAccountOwner>;
196
- pool: Address<TAccountPool>;
197
- position: Address<TAccountPosition>;
198
- positionTokenAccount: Address<TAccountPositionTokenAccount>;
199
- tokenMintX: Address<TAccountTokenMintX>;
200
- tokenMintY: Address<TAccountTokenMintY>;
201
- tokenOwnerAccountX: Address<TAccountTokenOwnerAccountX>;
202
- tokenOwnerAccountY: Address<TAccountTokenOwnerAccountY>;
203
- tokenVaultX: Address<TAccountTokenVaultX>;
204
- tokenVaultY: Address<TAccountTokenVaultY>;
205
- tokenProgramX: Address<TAccountTokenProgramX>;
206
- tokenProgramY: Address<TAccountTokenProgramY>;
207
- lowerBinArray: Address<TAccountLowerBinArray>;
208
- upperBinArray?: Address<TAccountUpperBinArray>;
205
+ owner: TAccountOwner;
206
+ pool: TAccountPool;
207
+ position: TAccountPosition;
208
+ positionTokenAccount: TAccountPositionTokenAccount;
209
+ tokenMintX: TAccountTokenMintX;
210
+ tokenMintY: TAccountTokenMintY;
211
+ tokenOwnerAccountX: TAccountTokenOwnerAccountX;
212
+ tokenOwnerAccountY: TAccountTokenOwnerAccountY;
213
+ tokenVaultX: TAccountTokenVaultX;
214
+ tokenVaultY: TAccountTokenVaultY;
215
+ tokenProgramX: TAccountTokenProgramX;
216
+ tokenProgramY: TAccountTokenProgramY;
217
+ lowerBinArray: TAccountLowerBinArray;
218
+ upperBinArray?: TAccountUpperBinArray;
209
219
  lowerBinId: ClaimFeeInstructionDataArgs["lowerBinId"];
210
220
  upperBinId: ClaimFeeInstructionDataArgs["upperBinId"];
211
221
  remainingAccountsScheme: ClaimFeeInstructionDataArgs["remainingAccountsScheme"];
212
222
  };
213
223
 
214
224
  export function getClaimFeeInstruction<
215
- TAccountOwner extends string,
216
- TAccountPool extends string,
217
- TAccountPosition extends string,
218
- TAccountPositionTokenAccount extends string,
219
- TAccountTokenMintX extends string,
220
- TAccountTokenMintY extends string,
221
- TAccountTokenOwnerAccountX extends string,
222
- TAccountTokenOwnerAccountY extends string,
223
- TAccountTokenVaultX extends string,
224
- TAccountTokenVaultY extends string,
225
- TAccountTokenProgramX extends string,
226
- TAccountTokenProgramY extends string,
227
- TAccountLowerBinArray extends string,
228
- TAccountUpperBinArray extends string,
225
+ TAccountOwner extends InstructionSignerInput,
226
+ TAccountPool extends InstructionAccountInput,
227
+ TAccountPosition extends InstructionAccountInput,
228
+ TAccountPositionTokenAccount extends InstructionAccountInput,
229
+ TAccountTokenMintX extends InstructionAccountInput,
230
+ TAccountTokenMintY extends InstructionAccountInput,
231
+ TAccountTokenOwnerAccountX extends InstructionAccountInput,
232
+ TAccountTokenOwnerAccountY extends InstructionAccountInput,
233
+ TAccountTokenVaultX extends InstructionAccountInput,
234
+ TAccountTokenVaultY extends InstructionAccountInput,
235
+ TAccountTokenProgramX extends InstructionAccountInput,
236
+ TAccountTokenProgramY extends InstructionAccountInput,
237
+ TAccountLowerBinArray extends InstructionAccountInput,
238
+ TAccountUpperBinArray extends InstructionAccountInput,
229
239
  TProgramAddress extends Address = typeof PICON_DLMM_PROGRAM_ADDRESS,
230
240
  >(
231
241
  input: ClaimFeeInput<
@@ -247,49 +257,133 @@ export function getClaimFeeInstruction<
247
257
  config?: { programAddress?: TProgramAddress },
248
258
  ): ClaimFeeInstruction<
249
259
  TProgramAddress,
250
- TAccountOwner,
251
- TAccountPool,
252
- TAccountPosition,
253
- TAccountPositionTokenAccount,
254
- TAccountTokenMintX,
255
- TAccountTokenMintY,
256
- TAccountTokenOwnerAccountX,
257
- TAccountTokenOwnerAccountY,
258
- TAccountTokenVaultX,
259
- TAccountTokenVaultY,
260
- TAccountTokenProgramX,
261
- TAccountTokenProgramY,
262
- TAccountLowerBinArray,
263
- TAccountUpperBinArray
260
+ ResolvedInstructionAccountMeta<
261
+ TAccountOwner,
262
+ InstructionAccountInputAddress<TAccountOwner>
263
+ >,
264
+ ResolvedInstructionAccountMeta<
265
+ TAccountPool,
266
+ InstructionAccountInputAddress<TAccountPool>
267
+ >,
268
+ ResolvedInstructionAccountMeta<
269
+ TAccountPosition,
270
+ InstructionAccountInputAddress<TAccountPosition>
271
+ >,
272
+ ResolvedInstructionAccountMeta<
273
+ TAccountPositionTokenAccount,
274
+ InstructionAccountInputAddress<TAccountPositionTokenAccount>
275
+ >,
276
+ ResolvedInstructionAccountMeta<
277
+ TAccountTokenMintX,
278
+ InstructionAccountInputAddress<TAccountTokenMintX>
279
+ >,
280
+ ResolvedInstructionAccountMeta<
281
+ TAccountTokenMintY,
282
+ InstructionAccountInputAddress<TAccountTokenMintY>
283
+ >,
284
+ ResolvedInstructionAccountMeta<
285
+ TAccountTokenOwnerAccountX,
286
+ InstructionAccountInputAddress<TAccountTokenOwnerAccountX>
287
+ >,
288
+ ResolvedInstructionAccountMeta<
289
+ TAccountTokenOwnerAccountY,
290
+ InstructionAccountInputAddress<TAccountTokenOwnerAccountY>
291
+ >,
292
+ ResolvedInstructionAccountMeta<
293
+ TAccountTokenVaultX,
294
+ InstructionAccountInputAddress<TAccountTokenVaultX>
295
+ >,
296
+ ResolvedInstructionAccountMeta<
297
+ TAccountTokenVaultY,
298
+ InstructionAccountInputAddress<TAccountTokenVaultY>
299
+ >,
300
+ ResolvedInstructionAccountMeta<
301
+ TAccountTokenProgramX,
302
+ InstructionAccountInputAddress<TAccountTokenProgramX>
303
+ >,
304
+ ResolvedInstructionAccountMeta<
305
+ TAccountTokenProgramY,
306
+ InstructionAccountInputAddress<TAccountTokenProgramY>
307
+ >,
308
+ ResolvedInstructionAccountMeta<
309
+ TAccountLowerBinArray,
310
+ InstructionAccountInputAddress<TAccountLowerBinArray>
311
+ >,
312
+ ResolvedInstructionAccountMeta<
313
+ TAccountUpperBinArray,
314
+ InstructionAccountInputAddress<TAccountUpperBinArray>
315
+ >
264
316
  > {
265
317
  // Program address.
266
318
  const programAddress = config?.programAddress ?? PICON_DLMM_PROGRAM_ADDRESS;
267
319
 
320
+ // Account meta helper.
321
+ const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
322
+
268
323
  // Original accounts.
269
324
  const originalAccounts = {
270
- owner: { value: input.owner ?? null, isWritable: false },
271
- pool: { value: input.pool ?? null, isWritable: false },
272
- position: { value: input.position ?? null, isWritable: true },
325
+ owner: { value: input.owner ?? null, isSigner: true, isWritable: false },
326
+ pool: { value: input.pool ?? null, isSigner: false, isWritable: false },
327
+ position: {
328
+ value: input.position ?? null,
329
+ isSigner: false,
330
+ isWritable: true,
331
+ },
273
332
  positionTokenAccount: {
274
333
  value: input.positionTokenAccount ?? null,
334
+ isSigner: false,
335
+ isWritable: false,
336
+ },
337
+ tokenMintX: {
338
+ value: input.tokenMintX ?? null,
339
+ isSigner: false,
340
+ isWritable: false,
341
+ },
342
+ tokenMintY: {
343
+ value: input.tokenMintY ?? null,
344
+ isSigner: false,
275
345
  isWritable: false,
276
346
  },
277
- tokenMintX: { value: input.tokenMintX ?? null, isWritable: false },
278
- tokenMintY: { value: input.tokenMintY ?? null, isWritable: false },
279
347
  tokenOwnerAccountX: {
280
348
  value: input.tokenOwnerAccountX ?? null,
349
+ isSigner: false,
281
350
  isWritable: true,
282
351
  },
283
352
  tokenOwnerAccountY: {
284
353
  value: input.tokenOwnerAccountY ?? null,
354
+ isSigner: false,
355
+ isWritable: true,
356
+ },
357
+ tokenVaultX: {
358
+ value: input.tokenVaultX ?? null,
359
+ isSigner: false,
360
+ isWritable: true,
361
+ },
362
+ tokenVaultY: {
363
+ value: input.tokenVaultY ?? null,
364
+ isSigner: false,
285
365
  isWritable: true,
286
366
  },
287
- tokenVaultX: { value: input.tokenVaultX ?? null, isWritable: true },
288
- tokenVaultY: { value: input.tokenVaultY ?? null, isWritable: true },
289
- tokenProgramX: { value: input.tokenProgramX ?? null, isWritable: false },
290
- tokenProgramY: { value: input.tokenProgramY ?? null, isWritable: false },
291
- lowerBinArray: { value: input.lowerBinArray ?? null, isWritable: false },
292
- upperBinArray: { value: input.upperBinArray ?? null, isWritable: false },
367
+ tokenProgramX: {
368
+ value: input.tokenProgramX ?? null,
369
+ isSigner: false,
370
+ isWritable: false,
371
+ },
372
+ tokenProgramY: {
373
+ value: input.tokenProgramY ?? null,
374
+ isSigner: false,
375
+ isWritable: false,
376
+ },
377
+ lowerBinArray: {
378
+ value: input.lowerBinArray ?? null,
379
+ isSigner: false,
380
+ isWritable: false,
381
+ },
382
+ upperBinArray: {
383
+ value: input.upperBinArray ?? null,
384
+ isSigner: false,
385
+ isWritable: false,
386
+ },
293
387
  };
294
388
  const accounts = originalAccounts as Record<
295
389
  keyof typeof originalAccounts,
@@ -299,7 +393,6 @@ export function getClaimFeeInstruction<
299
393
  // Original args.
300
394
  const args = { ...input };
301
395
 
302
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
303
396
  return Object.freeze({
304
397
  accounts: [
305
398
  getAccountMeta("owner", accounts.owner),
@@ -323,20 +416,62 @@ export function getClaimFeeInstruction<
323
416
  programAddress,
324
417
  } as ClaimFeeInstruction<
325
418
  TProgramAddress,
326
- TAccountOwner,
327
- TAccountPool,
328
- TAccountPosition,
329
- TAccountPositionTokenAccount,
330
- TAccountTokenMintX,
331
- TAccountTokenMintY,
332
- TAccountTokenOwnerAccountX,
333
- TAccountTokenOwnerAccountY,
334
- TAccountTokenVaultX,
335
- TAccountTokenVaultY,
336
- TAccountTokenProgramX,
337
- TAccountTokenProgramY,
338
- TAccountLowerBinArray,
339
- TAccountUpperBinArray
419
+ ResolvedInstructionAccountMeta<
420
+ TAccountOwner,
421
+ InstructionAccountInputAddress<TAccountOwner>
422
+ >,
423
+ ResolvedInstructionAccountMeta<
424
+ TAccountPool,
425
+ InstructionAccountInputAddress<TAccountPool>
426
+ >,
427
+ ResolvedInstructionAccountMeta<
428
+ TAccountPosition,
429
+ InstructionAccountInputAddress<TAccountPosition>
430
+ >,
431
+ ResolvedInstructionAccountMeta<
432
+ TAccountPositionTokenAccount,
433
+ InstructionAccountInputAddress<TAccountPositionTokenAccount>
434
+ >,
435
+ ResolvedInstructionAccountMeta<
436
+ TAccountTokenMintX,
437
+ InstructionAccountInputAddress<TAccountTokenMintX>
438
+ >,
439
+ ResolvedInstructionAccountMeta<
440
+ TAccountTokenMintY,
441
+ InstructionAccountInputAddress<TAccountTokenMintY>
442
+ >,
443
+ ResolvedInstructionAccountMeta<
444
+ TAccountTokenOwnerAccountX,
445
+ InstructionAccountInputAddress<TAccountTokenOwnerAccountX>
446
+ >,
447
+ ResolvedInstructionAccountMeta<
448
+ TAccountTokenOwnerAccountY,
449
+ InstructionAccountInputAddress<TAccountTokenOwnerAccountY>
450
+ >,
451
+ ResolvedInstructionAccountMeta<
452
+ TAccountTokenVaultX,
453
+ InstructionAccountInputAddress<TAccountTokenVaultX>
454
+ >,
455
+ ResolvedInstructionAccountMeta<
456
+ TAccountTokenVaultY,
457
+ InstructionAccountInputAddress<TAccountTokenVaultY>
458
+ >,
459
+ ResolvedInstructionAccountMeta<
460
+ TAccountTokenProgramX,
461
+ InstructionAccountInputAddress<TAccountTokenProgramX>
462
+ >,
463
+ ResolvedInstructionAccountMeta<
464
+ TAccountTokenProgramY,
465
+ InstructionAccountInputAddress<TAccountTokenProgramY>
466
+ >,
467
+ ResolvedInstructionAccountMeta<
468
+ TAccountLowerBinArray,
469
+ InstructionAccountInputAddress<TAccountLowerBinArray>
470
+ >,
471
+ ResolvedInstructionAccountMeta<
472
+ TAccountUpperBinArray,
473
+ InstructionAccountInputAddress<TAccountUpperBinArray>
474
+ >
340
475
  >);
341
476
  }
342
477