@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
|
@@ -32,14 +32,17 @@ 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";
|
|
39
38
|
import {
|
|
40
39
|
getAccountMetaFactory,
|
|
41
40
|
getAddressFromResolvedInstructionAccount,
|
|
41
|
+
type InstructionAccountInput,
|
|
42
|
+
type InstructionAccountInputAddress,
|
|
43
|
+
type InstructionSignerInput,
|
|
42
44
|
type ResolvedInstructionAccount,
|
|
45
|
+
type ResolvedInstructionAccountMeta,
|
|
43
46
|
} from "@solana/program-client-core";
|
|
44
47
|
import { findAdminConfigPda, findPositionPda } from "../pdas/index.js";
|
|
45
48
|
import { PICON_DLMM_PROGRAM_ADDRESS } from "../programs/index.js";
|
|
@@ -151,42 +154,47 @@ export function getOpenPositionInstructionDataCodec(): FixedSizeCodec<
|
|
|
151
154
|
}
|
|
152
155
|
|
|
153
156
|
export type OpenPositionAsyncInput<
|
|
154
|
-
TAccountOwner extends
|
|
155
|
-
TAccountPool extends
|
|
156
|
-
TAccountPosition extends
|
|
157
|
-
TAccountPositionMint extends
|
|
158
|
-
TAccountPositionTokenAccount extends
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
157
|
+
TAccountOwner extends InstructionSignerInput = InstructionSignerInput,
|
|
158
|
+
TAccountPool extends InstructionAccountInput = InstructionAccountInput,
|
|
159
|
+
TAccountPosition extends InstructionAccountInput = InstructionAccountInput,
|
|
160
|
+
TAccountPositionMint extends InstructionSignerInput = InstructionSignerInput,
|
|
161
|
+
TAccountPositionTokenAccount extends InstructionAccountInput =
|
|
162
|
+
InstructionAccountInput,
|
|
163
|
+
TAccountAdminConfig extends InstructionAccountInput = InstructionAccountInput,
|
|
164
|
+
TAccountMetadataUpdateAuthority extends InstructionAccountInput =
|
|
165
|
+
InstructionAccountInput,
|
|
166
|
+
TAccountTokenProgram extends InstructionAccountInput =
|
|
167
|
+
InstructionAccountInput,
|
|
168
|
+
TAccountAssociatedTokenProgram extends InstructionAccountInput =
|
|
169
|
+
InstructionAccountInput,
|
|
170
|
+
TAccountSystemProgram extends InstructionAccountInput =
|
|
171
|
+
InstructionAccountInput,
|
|
164
172
|
> = {
|
|
165
|
-
owner:
|
|
166
|
-
pool:
|
|
167
|
-
position?:
|
|
168
|
-
positionMint:
|
|
169
|
-
positionTokenAccount?:
|
|
170
|
-
adminConfig?:
|
|
171
|
-
metadataUpdateAuthority:
|
|
172
|
-
tokenProgram?:
|
|
173
|
-
associatedTokenProgram?:
|
|
174
|
-
systemProgram?:
|
|
173
|
+
owner: TAccountOwner;
|
|
174
|
+
pool: TAccountPool;
|
|
175
|
+
position?: TAccountPosition;
|
|
176
|
+
positionMint: TAccountPositionMint;
|
|
177
|
+
positionTokenAccount?: TAccountPositionTokenAccount;
|
|
178
|
+
adminConfig?: TAccountAdminConfig;
|
|
179
|
+
metadataUpdateAuthority: TAccountMetadataUpdateAuthority;
|
|
180
|
+
tokenProgram?: TAccountTokenProgram;
|
|
181
|
+
associatedTokenProgram?: TAccountAssociatedTokenProgram;
|
|
182
|
+
systemProgram?: TAccountSystemProgram;
|
|
175
183
|
lowerBinId: OpenPositionInstructionDataArgs["lowerBinId"];
|
|
176
184
|
upperBinId: OpenPositionInstructionDataArgs["upperBinId"];
|
|
177
185
|
};
|
|
178
186
|
|
|
179
187
|
export async function getOpenPositionInstructionAsync<
|
|
180
|
-
TAccountOwner extends
|
|
181
|
-
TAccountPool extends
|
|
182
|
-
TAccountPosition extends
|
|
183
|
-
TAccountPositionMint extends
|
|
184
|
-
TAccountPositionTokenAccount extends
|
|
185
|
-
TAccountAdminConfig extends
|
|
186
|
-
TAccountMetadataUpdateAuthority extends
|
|
187
|
-
TAccountTokenProgram extends
|
|
188
|
-
TAccountAssociatedTokenProgram extends
|
|
189
|
-
TAccountSystemProgram extends
|
|
188
|
+
TAccountOwner extends InstructionSignerInput,
|
|
189
|
+
TAccountPool extends InstructionAccountInput,
|
|
190
|
+
TAccountPosition extends InstructionAccountInput,
|
|
191
|
+
TAccountPositionMint extends InstructionSignerInput,
|
|
192
|
+
TAccountPositionTokenAccount extends InstructionAccountInput,
|
|
193
|
+
TAccountAdminConfig extends InstructionAccountInput,
|
|
194
|
+
TAccountMetadataUpdateAuthority extends InstructionAccountInput,
|
|
195
|
+
TAccountTokenProgram extends InstructionAccountInput,
|
|
196
|
+
TAccountAssociatedTokenProgram extends InstructionAccountInput,
|
|
197
|
+
TAccountSystemProgram extends InstructionAccountInput,
|
|
190
198
|
TProgramAddress extends Address = typeof PICON_DLMM_PROGRAM_ADDRESS,
|
|
191
199
|
>(
|
|
192
200
|
input: OpenPositionAsyncInput<
|
|
@@ -205,42 +213,98 @@ export async function getOpenPositionInstructionAsync<
|
|
|
205
213
|
): Promise<
|
|
206
214
|
OpenPositionInstruction<
|
|
207
215
|
TProgramAddress,
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
216
|
+
ResolvedInstructionAccountMeta<
|
|
217
|
+
TAccountOwner,
|
|
218
|
+
InstructionAccountInputAddress<TAccountOwner>
|
|
219
|
+
>,
|
|
220
|
+
ResolvedInstructionAccountMeta<
|
|
221
|
+
TAccountPool,
|
|
222
|
+
InstructionAccountInputAddress<TAccountPool>
|
|
223
|
+
>,
|
|
224
|
+
ResolvedInstructionAccountMeta<
|
|
225
|
+
TAccountPosition,
|
|
226
|
+
InstructionAccountInputAddress<TAccountPosition>
|
|
227
|
+
>,
|
|
228
|
+
ResolvedInstructionAccountMeta<
|
|
229
|
+
TAccountPositionMint,
|
|
230
|
+
InstructionAccountInputAddress<TAccountPositionMint>
|
|
231
|
+
>,
|
|
232
|
+
ResolvedInstructionAccountMeta<
|
|
233
|
+
TAccountPositionTokenAccount,
|
|
234
|
+
InstructionAccountInputAddress<TAccountPositionTokenAccount>
|
|
235
|
+
>,
|
|
236
|
+
ResolvedInstructionAccountMeta<
|
|
237
|
+
TAccountAdminConfig,
|
|
238
|
+
InstructionAccountInputAddress<TAccountAdminConfig>
|
|
239
|
+
>,
|
|
240
|
+
ResolvedInstructionAccountMeta<
|
|
241
|
+
TAccountMetadataUpdateAuthority,
|
|
242
|
+
InstructionAccountInputAddress<TAccountMetadataUpdateAuthority>
|
|
243
|
+
>,
|
|
244
|
+
ResolvedInstructionAccountMeta<
|
|
245
|
+
TAccountTokenProgram,
|
|
246
|
+
InstructionAccountInputAddress<TAccountTokenProgram>
|
|
247
|
+
>,
|
|
248
|
+
ResolvedInstructionAccountMeta<
|
|
249
|
+
TAccountAssociatedTokenProgram,
|
|
250
|
+
InstructionAccountInputAddress<TAccountAssociatedTokenProgram>
|
|
251
|
+
>,
|
|
252
|
+
ResolvedInstructionAccountMeta<
|
|
253
|
+
TAccountSystemProgram,
|
|
254
|
+
InstructionAccountInputAddress<TAccountSystemProgram>
|
|
255
|
+
>
|
|
218
256
|
>
|
|
219
257
|
> {
|
|
220
258
|
// Program address.
|
|
221
259
|
const programAddress = config?.programAddress ?? PICON_DLMM_PROGRAM_ADDRESS;
|
|
222
260
|
|
|
261
|
+
// Account meta helper.
|
|
262
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
263
|
+
|
|
223
264
|
// Original accounts.
|
|
224
265
|
const originalAccounts = {
|
|
225
|
-
owner: { value: input.owner ?? null, isWritable: true },
|
|
226
|
-
pool: { value: input.pool ?? null, isWritable: false },
|
|
227
|
-
position: {
|
|
228
|
-
|
|
266
|
+
owner: { value: input.owner ?? null, isSigner: true, isWritable: true },
|
|
267
|
+
pool: { value: input.pool ?? null, isSigner: false, isWritable: false },
|
|
268
|
+
position: {
|
|
269
|
+
value: input.position ?? null,
|
|
270
|
+
isSigner: false,
|
|
271
|
+
isWritable: true,
|
|
272
|
+
},
|
|
273
|
+
positionMint: {
|
|
274
|
+
value: input.positionMint ?? null,
|
|
275
|
+
isSigner: true,
|
|
276
|
+
isWritable: true,
|
|
277
|
+
},
|
|
229
278
|
positionTokenAccount: {
|
|
230
279
|
value: input.positionTokenAccount ?? null,
|
|
280
|
+
isSigner: false,
|
|
231
281
|
isWritable: true,
|
|
232
282
|
},
|
|
233
|
-
adminConfig: {
|
|
283
|
+
adminConfig: {
|
|
284
|
+
value: input.adminConfig ?? null,
|
|
285
|
+
isSigner: false,
|
|
286
|
+
isWritable: false,
|
|
287
|
+
},
|
|
234
288
|
metadataUpdateAuthority: {
|
|
235
289
|
value: input.metadataUpdateAuthority ?? null,
|
|
290
|
+
isSigner: false,
|
|
291
|
+
isWritable: false,
|
|
292
|
+
},
|
|
293
|
+
tokenProgram: {
|
|
294
|
+
value: input.tokenProgram ?? null,
|
|
295
|
+
isSigner: false,
|
|
236
296
|
isWritable: false,
|
|
237
297
|
},
|
|
238
|
-
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
239
298
|
associatedTokenProgram: {
|
|
240
299
|
value: input.associatedTokenProgram ?? null,
|
|
300
|
+
isSigner: false,
|
|
301
|
+
isWritable: false,
|
|
302
|
+
},
|
|
303
|
+
systemProgram: {
|
|
304
|
+
value: input.systemProgram ?? null,
|
|
305
|
+
isSigner: false,
|
|
241
306
|
isWritable: false,
|
|
242
307
|
},
|
|
243
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
244
308
|
};
|
|
245
309
|
const accounts = originalAccounts as Record<
|
|
246
310
|
keyof typeof originalAccounts,
|
|
@@ -304,7 +368,6 @@ export async function getOpenPositionInstructionAsync<
|
|
|
304
368
|
"11111111111111111111111111111111" as Address<"11111111111111111111111111111111">;
|
|
305
369
|
}
|
|
306
370
|
|
|
307
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
308
371
|
return Object.freeze({
|
|
309
372
|
accounts: [
|
|
310
373
|
getAccountMeta("owner", accounts.owner),
|
|
@@ -327,56 +390,91 @@ export async function getOpenPositionInstructionAsync<
|
|
|
327
390
|
programAddress,
|
|
328
391
|
} as OpenPositionInstruction<
|
|
329
392
|
TProgramAddress,
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
393
|
+
ResolvedInstructionAccountMeta<
|
|
394
|
+
TAccountOwner,
|
|
395
|
+
InstructionAccountInputAddress<TAccountOwner>
|
|
396
|
+
>,
|
|
397
|
+
ResolvedInstructionAccountMeta<
|
|
398
|
+
TAccountPool,
|
|
399
|
+
InstructionAccountInputAddress<TAccountPool>
|
|
400
|
+
>,
|
|
401
|
+
ResolvedInstructionAccountMeta<
|
|
402
|
+
TAccountPosition,
|
|
403
|
+
InstructionAccountInputAddress<TAccountPosition>
|
|
404
|
+
>,
|
|
405
|
+
ResolvedInstructionAccountMeta<
|
|
406
|
+
TAccountPositionMint,
|
|
407
|
+
InstructionAccountInputAddress<TAccountPositionMint>
|
|
408
|
+
>,
|
|
409
|
+
ResolvedInstructionAccountMeta<
|
|
410
|
+
TAccountPositionTokenAccount,
|
|
411
|
+
InstructionAccountInputAddress<TAccountPositionTokenAccount>
|
|
412
|
+
>,
|
|
413
|
+
ResolvedInstructionAccountMeta<
|
|
414
|
+
TAccountAdminConfig,
|
|
415
|
+
InstructionAccountInputAddress<TAccountAdminConfig>
|
|
416
|
+
>,
|
|
417
|
+
ResolvedInstructionAccountMeta<
|
|
418
|
+
TAccountMetadataUpdateAuthority,
|
|
419
|
+
InstructionAccountInputAddress<TAccountMetadataUpdateAuthority>
|
|
420
|
+
>,
|
|
421
|
+
ResolvedInstructionAccountMeta<
|
|
422
|
+
TAccountTokenProgram,
|
|
423
|
+
InstructionAccountInputAddress<TAccountTokenProgram>
|
|
424
|
+
>,
|
|
425
|
+
ResolvedInstructionAccountMeta<
|
|
426
|
+
TAccountAssociatedTokenProgram,
|
|
427
|
+
InstructionAccountInputAddress<TAccountAssociatedTokenProgram>
|
|
428
|
+
>,
|
|
429
|
+
ResolvedInstructionAccountMeta<
|
|
430
|
+
TAccountSystemProgram,
|
|
431
|
+
InstructionAccountInputAddress<TAccountSystemProgram>
|
|
432
|
+
>
|
|
340
433
|
>);
|
|
341
434
|
}
|
|
342
435
|
|
|
343
436
|
export type OpenPositionInput<
|
|
344
|
-
TAccountOwner extends
|
|
345
|
-
TAccountPool extends
|
|
346
|
-
TAccountPosition extends
|
|
347
|
-
TAccountPositionMint extends
|
|
348
|
-
TAccountPositionTokenAccount extends
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
437
|
+
TAccountOwner extends InstructionSignerInput = InstructionSignerInput,
|
|
438
|
+
TAccountPool extends InstructionAccountInput = InstructionAccountInput,
|
|
439
|
+
TAccountPosition extends InstructionAccountInput = InstructionAccountInput,
|
|
440
|
+
TAccountPositionMint extends InstructionSignerInput = InstructionSignerInput,
|
|
441
|
+
TAccountPositionTokenAccount extends InstructionAccountInput =
|
|
442
|
+
InstructionAccountInput,
|
|
443
|
+
TAccountAdminConfig extends InstructionAccountInput = InstructionAccountInput,
|
|
444
|
+
TAccountMetadataUpdateAuthority extends InstructionAccountInput =
|
|
445
|
+
InstructionAccountInput,
|
|
446
|
+
TAccountTokenProgram extends InstructionAccountInput =
|
|
447
|
+
InstructionAccountInput,
|
|
448
|
+
TAccountAssociatedTokenProgram extends InstructionAccountInput =
|
|
449
|
+
InstructionAccountInput,
|
|
450
|
+
TAccountSystemProgram extends InstructionAccountInput =
|
|
451
|
+
InstructionAccountInput,
|
|
354
452
|
> = {
|
|
355
|
-
owner:
|
|
356
|
-
pool:
|
|
357
|
-
position:
|
|
358
|
-
positionMint:
|
|
359
|
-
positionTokenAccount:
|
|
360
|
-
adminConfig:
|
|
361
|
-
metadataUpdateAuthority:
|
|
362
|
-
tokenProgram?:
|
|
363
|
-
associatedTokenProgram?:
|
|
364
|
-
systemProgram?:
|
|
453
|
+
owner: TAccountOwner;
|
|
454
|
+
pool: TAccountPool;
|
|
455
|
+
position: TAccountPosition;
|
|
456
|
+
positionMint: TAccountPositionMint;
|
|
457
|
+
positionTokenAccount: TAccountPositionTokenAccount;
|
|
458
|
+
adminConfig: TAccountAdminConfig;
|
|
459
|
+
metadataUpdateAuthority: TAccountMetadataUpdateAuthority;
|
|
460
|
+
tokenProgram?: TAccountTokenProgram;
|
|
461
|
+
associatedTokenProgram?: TAccountAssociatedTokenProgram;
|
|
462
|
+
systemProgram?: TAccountSystemProgram;
|
|
365
463
|
lowerBinId: OpenPositionInstructionDataArgs["lowerBinId"];
|
|
366
464
|
upperBinId: OpenPositionInstructionDataArgs["upperBinId"];
|
|
367
465
|
};
|
|
368
466
|
|
|
369
467
|
export function getOpenPositionInstruction<
|
|
370
|
-
TAccountOwner extends
|
|
371
|
-
TAccountPool extends
|
|
372
|
-
TAccountPosition extends
|
|
373
|
-
TAccountPositionMint extends
|
|
374
|
-
TAccountPositionTokenAccount extends
|
|
375
|
-
TAccountAdminConfig extends
|
|
376
|
-
TAccountMetadataUpdateAuthority extends
|
|
377
|
-
TAccountTokenProgram extends
|
|
378
|
-
TAccountAssociatedTokenProgram extends
|
|
379
|
-
TAccountSystemProgram extends
|
|
468
|
+
TAccountOwner extends InstructionSignerInput,
|
|
469
|
+
TAccountPool extends InstructionAccountInput,
|
|
470
|
+
TAccountPosition extends InstructionAccountInput,
|
|
471
|
+
TAccountPositionMint extends InstructionSignerInput,
|
|
472
|
+
TAccountPositionTokenAccount extends InstructionAccountInput,
|
|
473
|
+
TAccountAdminConfig extends InstructionAccountInput,
|
|
474
|
+
TAccountMetadataUpdateAuthority extends InstructionAccountInput,
|
|
475
|
+
TAccountTokenProgram extends InstructionAccountInput,
|
|
476
|
+
TAccountAssociatedTokenProgram extends InstructionAccountInput,
|
|
477
|
+
TAccountSystemProgram extends InstructionAccountInput,
|
|
380
478
|
TProgramAddress extends Address = typeof PICON_DLMM_PROGRAM_ADDRESS,
|
|
381
479
|
>(
|
|
382
480
|
input: OpenPositionInput<
|
|
@@ -394,41 +492,97 @@ export function getOpenPositionInstruction<
|
|
|
394
492
|
config?: { programAddress?: TProgramAddress },
|
|
395
493
|
): OpenPositionInstruction<
|
|
396
494
|
TProgramAddress,
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
495
|
+
ResolvedInstructionAccountMeta<
|
|
496
|
+
TAccountOwner,
|
|
497
|
+
InstructionAccountInputAddress<TAccountOwner>
|
|
498
|
+
>,
|
|
499
|
+
ResolvedInstructionAccountMeta<
|
|
500
|
+
TAccountPool,
|
|
501
|
+
InstructionAccountInputAddress<TAccountPool>
|
|
502
|
+
>,
|
|
503
|
+
ResolvedInstructionAccountMeta<
|
|
504
|
+
TAccountPosition,
|
|
505
|
+
InstructionAccountInputAddress<TAccountPosition>
|
|
506
|
+
>,
|
|
507
|
+
ResolvedInstructionAccountMeta<
|
|
508
|
+
TAccountPositionMint,
|
|
509
|
+
InstructionAccountInputAddress<TAccountPositionMint>
|
|
510
|
+
>,
|
|
511
|
+
ResolvedInstructionAccountMeta<
|
|
512
|
+
TAccountPositionTokenAccount,
|
|
513
|
+
InstructionAccountInputAddress<TAccountPositionTokenAccount>
|
|
514
|
+
>,
|
|
515
|
+
ResolvedInstructionAccountMeta<
|
|
516
|
+
TAccountAdminConfig,
|
|
517
|
+
InstructionAccountInputAddress<TAccountAdminConfig>
|
|
518
|
+
>,
|
|
519
|
+
ResolvedInstructionAccountMeta<
|
|
520
|
+
TAccountMetadataUpdateAuthority,
|
|
521
|
+
InstructionAccountInputAddress<TAccountMetadataUpdateAuthority>
|
|
522
|
+
>,
|
|
523
|
+
ResolvedInstructionAccountMeta<
|
|
524
|
+
TAccountTokenProgram,
|
|
525
|
+
InstructionAccountInputAddress<TAccountTokenProgram>
|
|
526
|
+
>,
|
|
527
|
+
ResolvedInstructionAccountMeta<
|
|
528
|
+
TAccountAssociatedTokenProgram,
|
|
529
|
+
InstructionAccountInputAddress<TAccountAssociatedTokenProgram>
|
|
530
|
+
>,
|
|
531
|
+
ResolvedInstructionAccountMeta<
|
|
532
|
+
TAccountSystemProgram,
|
|
533
|
+
InstructionAccountInputAddress<TAccountSystemProgram>
|
|
534
|
+
>
|
|
407
535
|
> {
|
|
408
536
|
// Program address.
|
|
409
537
|
const programAddress = config?.programAddress ?? PICON_DLMM_PROGRAM_ADDRESS;
|
|
410
538
|
|
|
539
|
+
// Account meta helper.
|
|
540
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
541
|
+
|
|
411
542
|
// Original accounts.
|
|
412
543
|
const originalAccounts = {
|
|
413
|
-
owner: { value: input.owner ?? null, isWritable: true },
|
|
414
|
-
pool: { value: input.pool ?? null, isWritable: false },
|
|
415
|
-
position: {
|
|
416
|
-
|
|
544
|
+
owner: { value: input.owner ?? null, isSigner: true, isWritable: true },
|
|
545
|
+
pool: { value: input.pool ?? null, isSigner: false, isWritable: false },
|
|
546
|
+
position: {
|
|
547
|
+
value: input.position ?? null,
|
|
548
|
+
isSigner: false,
|
|
549
|
+
isWritable: true,
|
|
550
|
+
},
|
|
551
|
+
positionMint: {
|
|
552
|
+
value: input.positionMint ?? null,
|
|
553
|
+
isSigner: true,
|
|
554
|
+
isWritable: true,
|
|
555
|
+
},
|
|
417
556
|
positionTokenAccount: {
|
|
418
557
|
value: input.positionTokenAccount ?? null,
|
|
558
|
+
isSigner: false,
|
|
419
559
|
isWritable: true,
|
|
420
560
|
},
|
|
421
|
-
adminConfig: {
|
|
561
|
+
adminConfig: {
|
|
562
|
+
value: input.adminConfig ?? null,
|
|
563
|
+
isSigner: false,
|
|
564
|
+
isWritable: false,
|
|
565
|
+
},
|
|
422
566
|
metadataUpdateAuthority: {
|
|
423
567
|
value: input.metadataUpdateAuthority ?? null,
|
|
568
|
+
isSigner: false,
|
|
569
|
+
isWritable: false,
|
|
570
|
+
},
|
|
571
|
+
tokenProgram: {
|
|
572
|
+
value: input.tokenProgram ?? null,
|
|
573
|
+
isSigner: false,
|
|
424
574
|
isWritable: false,
|
|
425
575
|
},
|
|
426
|
-
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
427
576
|
associatedTokenProgram: {
|
|
428
577
|
value: input.associatedTokenProgram ?? null,
|
|
578
|
+
isSigner: false,
|
|
579
|
+
isWritable: false,
|
|
580
|
+
},
|
|
581
|
+
systemProgram: {
|
|
582
|
+
value: input.systemProgram ?? null,
|
|
583
|
+
isSigner: false,
|
|
429
584
|
isWritable: false,
|
|
430
585
|
},
|
|
431
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
432
586
|
};
|
|
433
587
|
const accounts = originalAccounts as Record<
|
|
434
588
|
keyof typeof originalAccounts,
|
|
@@ -452,7 +606,6 @@ export function getOpenPositionInstruction<
|
|
|
452
606
|
"11111111111111111111111111111111" as Address<"11111111111111111111111111111111">;
|
|
453
607
|
}
|
|
454
608
|
|
|
455
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
456
609
|
return Object.freeze({
|
|
457
610
|
accounts: [
|
|
458
611
|
getAccountMeta("owner", accounts.owner),
|
|
@@ -475,16 +628,46 @@ export function getOpenPositionInstruction<
|
|
|
475
628
|
programAddress,
|
|
476
629
|
} as OpenPositionInstruction<
|
|
477
630
|
TProgramAddress,
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
631
|
+
ResolvedInstructionAccountMeta<
|
|
632
|
+
TAccountOwner,
|
|
633
|
+
InstructionAccountInputAddress<TAccountOwner>
|
|
634
|
+
>,
|
|
635
|
+
ResolvedInstructionAccountMeta<
|
|
636
|
+
TAccountPool,
|
|
637
|
+
InstructionAccountInputAddress<TAccountPool>
|
|
638
|
+
>,
|
|
639
|
+
ResolvedInstructionAccountMeta<
|
|
640
|
+
TAccountPosition,
|
|
641
|
+
InstructionAccountInputAddress<TAccountPosition>
|
|
642
|
+
>,
|
|
643
|
+
ResolvedInstructionAccountMeta<
|
|
644
|
+
TAccountPositionMint,
|
|
645
|
+
InstructionAccountInputAddress<TAccountPositionMint>
|
|
646
|
+
>,
|
|
647
|
+
ResolvedInstructionAccountMeta<
|
|
648
|
+
TAccountPositionTokenAccount,
|
|
649
|
+
InstructionAccountInputAddress<TAccountPositionTokenAccount>
|
|
650
|
+
>,
|
|
651
|
+
ResolvedInstructionAccountMeta<
|
|
652
|
+
TAccountAdminConfig,
|
|
653
|
+
InstructionAccountInputAddress<TAccountAdminConfig>
|
|
654
|
+
>,
|
|
655
|
+
ResolvedInstructionAccountMeta<
|
|
656
|
+
TAccountMetadataUpdateAuthority,
|
|
657
|
+
InstructionAccountInputAddress<TAccountMetadataUpdateAuthority>
|
|
658
|
+
>,
|
|
659
|
+
ResolvedInstructionAccountMeta<
|
|
660
|
+
TAccountTokenProgram,
|
|
661
|
+
InstructionAccountInputAddress<TAccountTokenProgram>
|
|
662
|
+
>,
|
|
663
|
+
ResolvedInstructionAccountMeta<
|
|
664
|
+
TAccountAssociatedTokenProgram,
|
|
665
|
+
InstructionAccountInputAddress<TAccountAssociatedTokenProgram>
|
|
666
|
+
>,
|
|
667
|
+
ResolvedInstructionAccountMeta<
|
|
668
|
+
TAccountSystemProgram,
|
|
669
|
+
InstructionAccountInputAddress<TAccountSystemProgram>
|
|
670
|
+
>
|
|
488
671
|
>);
|
|
489
672
|
}
|
|
490
673
|
|