@picon-finance/dlmm-sdk 2.0.3 → 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 (77) hide show
  1. package/dist/generated/instructions/acceptAdminAuthority.d.ts +12 -11
  2. package/dist/generated/instructions/acceptAdminAuthority.d.ts.map +1 -1
  3. package/dist/generated/instructions/acceptAdminAuthority.js +16 -4
  4. package/dist/generated/instructions/claimFee.d.ts +19 -18
  5. package/dist/generated/instructions/claimFee.d.ts.map +1 -1
  6. package/dist/generated/instructions/claimFee.js +52 -12
  7. package/dist/generated/instructions/claimProtocolFee.d.ts +30 -29
  8. package/dist/generated/instructions/claimProtocolFee.d.ts.map +1 -1
  9. package/dist/generated/instructions/claimProtocolFee.js +90 -20
  10. package/dist/generated/instructions/closePosition.d.ts +18 -17
  11. package/dist/generated/instructions/closePosition.d.ts.map +1 -1
  12. package/dist/generated/instructions/closePosition.js +38 -10
  13. package/dist/generated/instructions/createAdminConfig.d.ts +18 -17
  14. package/dist/generated/instructions/createAdminConfig.d.ts.map +1 -1
  15. package/dist/generated/instructions/createAdminConfig.js +54 -12
  16. package/dist/generated/instructions/createBinArray.d.ts +16 -15
  17. package/dist/generated/instructions/createBinArray.d.ts.map +1 -1
  18. package/dist/generated/instructions/createBinArray.js +28 -10
  19. package/dist/generated/instructions/createPool.d.ts +30 -29
  20. package/dist/generated/instructions/createPool.d.ts.map +1 -1
  21. package/dist/generated/instructions/createPool.js +98 -22
  22. package/dist/generated/instructions/deleteBinArray.d.ts +18 -17
  23. package/dist/generated/instructions/deleteBinArray.d.ts.map +1 -1
  24. package/dist/generated/instructions/deleteBinArray.js +54 -12
  25. package/dist/generated/instructions/depositByWeight.d.ts +19 -18
  26. package/dist/generated/instructions/depositByWeight.d.ts.map +1 -1
  27. package/dist/generated/instructions/depositByWeight.js +52 -12
  28. package/dist/generated/instructions/openPosition.d.ts +28 -27
  29. package/dist/generated/instructions/openPosition.d.ts.map +1 -1
  30. package/dist/generated/instructions/openPosition.js +64 -16
  31. package/dist/generated/instructions/resetAdminAuthority.d.ts +16 -15
  32. package/dist/generated/instructions/resetAdminAuthority.d.ts.map +1 -1
  33. package/dist/generated/instructions/resetAdminAuthority.js +44 -10
  34. package/dist/generated/instructions/setMetadataUpdateAuthority.d.ts +12 -11
  35. package/dist/generated/instructions/setMetadataUpdateAuthority.d.ts.map +1 -1
  36. package/dist/generated/instructions/setMetadataUpdateAuthority.js +24 -6
  37. package/dist/generated/instructions/setPoolDynamicFeeConfig.d.ts +14 -13
  38. package/dist/generated/instructions/setPoolDynamicFeeConfig.d.ts.map +1 -1
  39. package/dist/generated/instructions/setPoolDynamicFeeConfig.js +26 -8
  40. package/dist/generated/instructions/setPoolProtocolShare.d.ts +14 -13
  41. package/dist/generated/instructions/setPoolProtocolShare.d.ts.map +1 -1
  42. package/dist/generated/instructions/setPoolProtocolShare.js +26 -8
  43. package/dist/generated/instructions/swapExactIn.d.ts +15 -14
  44. package/dist/generated/instructions/swapExactIn.d.ts.map +1 -1
  45. package/dist/generated/instructions/swapExactIn.js +36 -9
  46. package/dist/generated/instructions/swapExactOut.d.ts +15 -14
  47. package/dist/generated/instructions/swapExactOut.d.ts.map +1 -1
  48. package/dist/generated/instructions/swapExactOut.js +36 -9
  49. package/dist/generated/instructions/syncPool.d.ts +7 -6
  50. package/dist/generated/instructions/syncPool.d.ts.map +1 -1
  51. package/dist/generated/instructions/syncPool.js +4 -3
  52. package/dist/generated/instructions/transferAdminAuthority.d.ts +12 -11
  53. package/dist/generated/instructions/transferAdminAuthority.d.ts.map +1 -1
  54. package/dist/generated/instructions/transferAdminAuthority.js +24 -6
  55. package/dist/generated/instructions/withdraw.d.ts +19 -18
  56. package/dist/generated/instructions/withdraw.d.ts.map +1 -1
  57. package/dist/generated/instructions/withdraw.js +52 -12
  58. package/package.json +5 -5
  59. package/src/generated/instructions/acceptAdminAuthority.ts +68 -25
  60. package/src/generated/instructions/claimFee.ts +218 -83
  61. package/src/generated/instructions/claimProtocolFee.ts +346 -131
  62. package/src/generated/instructions/closePosition.ts +160 -61
  63. package/src/generated/instructions/createAdminConfig.ts +172 -63
  64. package/src/generated/instructions/createBinArray.ts +124 -51
  65. package/src/generated/instructions/createPool.ts +354 -133
  66. package/src/generated/instructions/deleteBinArray.ts +172 -63
  67. package/src/generated/instructions/depositByWeight.ts +218 -83
  68. package/src/generated/instructions/openPosition.ts +300 -117
  69. package/src/generated/instructions/resetAdminAuthority.ts +138 -51
  70. package/src/generated/instructions/setMetadataUpdateAuthority.ts +74 -27
  71. package/src/generated/instructions/setPoolDynamicFeeConfig.ts +98 -39
  72. package/src/generated/instructions/setPoolProtocolShare.ts +98 -39
  73. package/src/generated/instructions/swapExactIn.ts +155 -60
  74. package/src/generated/instructions/swapExactOut.ts +155 -60
  75. package/src/generated/instructions/syncPool.ts +37 -12
  76. package/src/generated/instructions/transferAdminAuthority.ts +74 -27
  77. package/src/generated/instructions/withdraw.ts +218 -83
@@ -32,7 +32,6 @@ import {
32
32
  type InstructionWithData,
33
33
  type ReadonlyAccount,
34
34
  type ReadonlyUint8Array,
35
- type TransactionSigner,
36
35
  type WritableAccount,
37
36
  type WritableSignerAccount,
38
37
  } from "@solana/kit";
@@ -40,7 +39,11 @@ import {
40
39
  getAccountMetaFactory,
41
40
  getAddressFromResolvedInstructionAccount,
42
41
  getNonNullResolvedInstructionInput,
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 { findBinArrayPda } from "../pdas/index.js";
46
49
  import { PICON_DLMM_PROGRAM_ADDRESS } from "../programs/index.js";
@@ -124,24 +127,25 @@ export function getCreateBinArrayInstructionDataCodec(): FixedSizeCodec<
124
127
  }
125
128
 
126
129
  export type CreateBinArrayAsyncInput<
127
- TAccountPayer extends string = string,
128
- TAccountPool extends string = string,
129
- TAccountBinArray extends string = string,
130
- TAccountSystemProgram extends string = string,
130
+ TAccountPayer extends InstructionSignerInput = InstructionSignerInput,
131
+ TAccountPool extends InstructionAccountInput = InstructionAccountInput,
132
+ TAccountBinArray extends InstructionAccountInput = InstructionAccountInput,
133
+ TAccountSystemProgram extends InstructionAccountInput =
134
+ InstructionAccountInput,
131
135
  > = {
132
- payer: TransactionSigner<TAccountPayer>;
133
- pool: Address<TAccountPool>;
134
- binArray?: Address<TAccountBinArray>;
135
- systemProgram?: Address<TAccountSystemProgram>;
136
+ payer: TAccountPayer;
137
+ pool: TAccountPool;
138
+ binArray?: TAccountBinArray;
139
+ systemProgram?: TAccountSystemProgram;
136
140
  index: CreateBinArrayInstructionDataArgs["index"];
137
141
  idempotent: CreateBinArrayInstructionDataArgs["idempotent"];
138
142
  };
139
143
 
140
144
  export async function getCreateBinArrayInstructionAsync<
141
- TAccountPayer extends string,
142
- TAccountPool extends string,
143
- TAccountBinArray extends string,
144
- TAccountSystemProgram extends string,
145
+ TAccountPayer extends InstructionSignerInput,
146
+ TAccountPool extends InstructionAccountInput,
147
+ TAccountBinArray extends InstructionAccountInput,
148
+ TAccountSystemProgram extends InstructionAccountInput,
145
149
  TProgramAddress extends Address = typeof PICON_DLMM_PROGRAM_ADDRESS,
146
150
  >(
147
151
  input: CreateBinArrayAsyncInput<
@@ -154,21 +158,44 @@ export async function getCreateBinArrayInstructionAsync<
154
158
  ): Promise<
155
159
  CreateBinArrayInstruction<
156
160
  TProgramAddress,
157
- TAccountPayer,
158
- TAccountPool,
159
- TAccountBinArray,
160
- TAccountSystemProgram
161
+ ResolvedInstructionAccountMeta<
162
+ TAccountPayer,
163
+ InstructionAccountInputAddress<TAccountPayer>
164
+ >,
165
+ ResolvedInstructionAccountMeta<
166
+ TAccountPool,
167
+ InstructionAccountInputAddress<TAccountPool>
168
+ >,
169
+ ResolvedInstructionAccountMeta<
170
+ TAccountBinArray,
171
+ InstructionAccountInputAddress<TAccountBinArray>
172
+ >,
173
+ ResolvedInstructionAccountMeta<
174
+ TAccountSystemProgram,
175
+ InstructionAccountInputAddress<TAccountSystemProgram>
176
+ >
161
177
  >
162
178
  > {
163
179
  // Program address.
164
180
  const programAddress = config?.programAddress ?? PICON_DLMM_PROGRAM_ADDRESS;
165
181
 
182
+ // Account meta helper.
183
+ const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
184
+
166
185
  // Original accounts.
167
186
  const originalAccounts = {
168
- payer: { value: input.payer ?? null, isWritable: true },
169
- pool: { value: input.pool ?? null, isWritable: false },
170
- binArray: { value: input.binArray ?? null, isWritable: true },
171
- systemProgram: { value: input.systemProgram ?? null, isWritable: false },
187
+ payer: { value: input.payer ?? null, isSigner: true, isWritable: true },
188
+ pool: { value: input.pool ?? null, isSigner: false, isWritable: false },
189
+ binArray: {
190
+ value: input.binArray ?? null,
191
+ isSigner: false,
192
+ isWritable: true,
193
+ },
194
+ systemProgram: {
195
+ value: input.systemProgram ?? null,
196
+ isSigner: false,
197
+ isWritable: false,
198
+ },
172
199
  };
173
200
  const accounts = originalAccounts as Record<
174
201
  keyof typeof originalAccounts,
@@ -196,7 +223,6 @@ export async function getCreateBinArrayInstructionAsync<
196
223
  "11111111111111111111111111111111" as Address<"11111111111111111111111111111111">;
197
224
  }
198
225
 
199
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
200
226
  return Object.freeze({
201
227
  accounts: [
202
228
  getAccountMeta("payer", accounts.payer),
@@ -210,32 +236,45 @@ export async function getCreateBinArrayInstructionAsync<
210
236
  programAddress,
211
237
  } as CreateBinArrayInstruction<
212
238
  TProgramAddress,
213
- TAccountPayer,
214
- TAccountPool,
215
- TAccountBinArray,
216
- TAccountSystemProgram
239
+ ResolvedInstructionAccountMeta<
240
+ TAccountPayer,
241
+ InstructionAccountInputAddress<TAccountPayer>
242
+ >,
243
+ ResolvedInstructionAccountMeta<
244
+ TAccountPool,
245
+ InstructionAccountInputAddress<TAccountPool>
246
+ >,
247
+ ResolvedInstructionAccountMeta<
248
+ TAccountBinArray,
249
+ InstructionAccountInputAddress<TAccountBinArray>
250
+ >,
251
+ ResolvedInstructionAccountMeta<
252
+ TAccountSystemProgram,
253
+ InstructionAccountInputAddress<TAccountSystemProgram>
254
+ >
217
255
  >);
218
256
  }
219
257
 
220
258
  export type CreateBinArrayInput<
221
- TAccountPayer extends string = string,
222
- TAccountPool extends string = string,
223
- TAccountBinArray extends string = string,
224
- TAccountSystemProgram extends string = string,
259
+ TAccountPayer extends InstructionSignerInput = InstructionSignerInput,
260
+ TAccountPool extends InstructionAccountInput = InstructionAccountInput,
261
+ TAccountBinArray extends InstructionAccountInput = InstructionAccountInput,
262
+ TAccountSystemProgram extends InstructionAccountInput =
263
+ InstructionAccountInput,
225
264
  > = {
226
- payer: TransactionSigner<TAccountPayer>;
227
- pool: Address<TAccountPool>;
228
- binArray: Address<TAccountBinArray>;
229
- systemProgram?: Address<TAccountSystemProgram>;
265
+ payer: TAccountPayer;
266
+ pool: TAccountPool;
267
+ binArray: TAccountBinArray;
268
+ systemProgram?: TAccountSystemProgram;
230
269
  index: CreateBinArrayInstructionDataArgs["index"];
231
270
  idempotent: CreateBinArrayInstructionDataArgs["idempotent"];
232
271
  };
233
272
 
234
273
  export function getCreateBinArrayInstruction<
235
- TAccountPayer extends string,
236
- TAccountPool extends string,
237
- TAccountBinArray extends string,
238
- TAccountSystemProgram extends string,
274
+ TAccountPayer extends InstructionSignerInput,
275
+ TAccountPool extends InstructionAccountInput,
276
+ TAccountBinArray extends InstructionAccountInput,
277
+ TAccountSystemProgram extends InstructionAccountInput,
239
278
  TProgramAddress extends Address = typeof PICON_DLMM_PROGRAM_ADDRESS,
240
279
  >(
241
280
  input: CreateBinArrayInput<
@@ -247,20 +286,43 @@ export function getCreateBinArrayInstruction<
247
286
  config?: { programAddress?: TProgramAddress },
248
287
  ): CreateBinArrayInstruction<
249
288
  TProgramAddress,
250
- TAccountPayer,
251
- TAccountPool,
252
- TAccountBinArray,
253
- TAccountSystemProgram
289
+ ResolvedInstructionAccountMeta<
290
+ TAccountPayer,
291
+ InstructionAccountInputAddress<TAccountPayer>
292
+ >,
293
+ ResolvedInstructionAccountMeta<
294
+ TAccountPool,
295
+ InstructionAccountInputAddress<TAccountPool>
296
+ >,
297
+ ResolvedInstructionAccountMeta<
298
+ TAccountBinArray,
299
+ InstructionAccountInputAddress<TAccountBinArray>
300
+ >,
301
+ ResolvedInstructionAccountMeta<
302
+ TAccountSystemProgram,
303
+ InstructionAccountInputAddress<TAccountSystemProgram>
304
+ >
254
305
  > {
255
306
  // Program address.
256
307
  const programAddress = config?.programAddress ?? PICON_DLMM_PROGRAM_ADDRESS;
257
308
 
309
+ // Account meta helper.
310
+ const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
311
+
258
312
  // Original accounts.
259
313
  const originalAccounts = {
260
- payer: { value: input.payer ?? null, isWritable: true },
261
- pool: { value: input.pool ?? null, isWritable: false },
262
- binArray: { value: input.binArray ?? null, isWritable: true },
263
- systemProgram: { value: input.systemProgram ?? null, isWritable: false },
314
+ payer: { value: input.payer ?? null, isSigner: true, isWritable: true },
315
+ pool: { value: input.pool ?? null, isSigner: false, isWritable: false },
316
+ binArray: {
317
+ value: input.binArray ?? null,
318
+ isSigner: false,
319
+ isWritable: true,
320
+ },
321
+ systemProgram: {
322
+ value: input.systemProgram ?? null,
323
+ isSigner: false,
324
+ isWritable: false,
325
+ },
264
326
  };
265
327
  const accounts = originalAccounts as Record<
266
328
  keyof typeof originalAccounts,
@@ -276,7 +338,6 @@ export function getCreateBinArrayInstruction<
276
338
  "11111111111111111111111111111111" as Address<"11111111111111111111111111111111">;
277
339
  }
278
340
 
279
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
280
341
  return Object.freeze({
281
342
  accounts: [
282
343
  getAccountMeta("payer", accounts.payer),
@@ -290,10 +351,22 @@ export function getCreateBinArrayInstruction<
290
351
  programAddress,
291
352
  } as CreateBinArrayInstruction<
292
353
  TProgramAddress,
293
- TAccountPayer,
294
- TAccountPool,
295
- TAccountBinArray,
296
- TAccountSystemProgram
354
+ ResolvedInstructionAccountMeta<
355
+ TAccountPayer,
356
+ InstructionAccountInputAddress<TAccountPayer>
357
+ >,
358
+ ResolvedInstructionAccountMeta<
359
+ TAccountPool,
360
+ InstructionAccountInputAddress<TAccountPool>
361
+ >,
362
+ ResolvedInstructionAccountMeta<
363
+ TAccountBinArray,
364
+ InstructionAccountInputAddress<TAccountBinArray>
365
+ >,
366
+ ResolvedInstructionAccountMeta<
367
+ TAccountSystemProgram,
368
+ InstructionAccountInputAddress<TAccountSystemProgram>
369
+ >
297
370
  >);
298
371
  }
299
372