@picon-finance/dlmm-sdk 2.0.5 → 2.0.7
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/bin_array.d.ts.map +1 -1
- package/dist/entities/dlmm_program.d.ts.map +1 -1
- package/dist/entities/pool.d.ts.map +1 -1
- package/dist/entities/position.d.ts.map +1 -1
- package/dist/generated/accounts/adminConfig.d.ts +8 -8
- package/dist/generated/accounts/adminConfig.d.ts.map +1 -1
- package/dist/generated/accounts/adminConfig.js +2 -2
- package/dist/generated/accounts/binArray.d.ts +7 -7
- package/dist/generated/accounts/binArray.d.ts.map +1 -1
- package/dist/generated/accounts/binArray.js +2 -2
- package/dist/generated/accounts/pool.d.ts +9 -9
- package/dist/generated/accounts/pool.d.ts.map +1 -1
- package/dist/generated/accounts/pool.js +2 -2
- package/dist/generated/accounts/position.d.ts +7 -7
- package/dist/generated/accounts/position.d.ts.map +1 -1
- package/dist/generated/accounts/position.js +2 -2
- package/dist/generated/errors/piconDlmm.d.ts +4 -2
- package/dist/generated/errors/piconDlmm.d.ts.map +1 -1
- package/dist/generated/errors/piconDlmm.js +6 -2
- package/dist/generated/events/claimFeeEvent.d.ts +4 -4
- package/dist/generated/events/claimFeeEvent.d.ts.map +1 -1
- package/dist/generated/events/closePositionEvent.d.ts +8 -2
- package/dist/generated/events/closePositionEvent.d.ts.map +1 -1
- package/dist/generated/events/createPoolEvent.d.ts +8 -2
- package/dist/generated/events/createPoolEvent.d.ts.map +1 -1
- package/dist/generated/events/depositEvent.d.ts +4 -4
- package/dist/generated/events/depositEvent.d.ts.map +1 -1
- package/dist/generated/events/openPositionEvent.d.ts +8 -2
- package/dist/generated/events/openPositionEvent.d.ts.map +1 -1
- package/dist/generated/events/swapEvent.d.ts +2 -2
- package/dist/generated/events/swapEvent.d.ts.map +1 -1
- package/dist/generated/events/withdrawEvent.d.ts +4 -4
- package/dist/generated/events/withdrawEvent.d.ts.map +1 -1
- package/dist/generated/instructions/acceptAdminAuthority.d.ts +6 -2
- package/dist/generated/instructions/acceptAdminAuthority.d.ts.map +1 -1
- package/dist/generated/instructions/acceptAdminAuthority.js +8 -2
- package/dist/generated/instructions/claimFee.d.ts +3 -1
- package/dist/generated/instructions/claimFee.d.ts.map +1 -1
- package/dist/generated/instructions/claimFee.js +4 -1
- package/dist/generated/instructions/claimProtocolFee.d.ts +6 -2
- package/dist/generated/instructions/claimProtocolFee.d.ts.map +1 -1
- package/dist/generated/instructions/claimProtocolFee.js +8 -2
- package/dist/generated/instructions/closePosition.d.ts +6 -2
- package/dist/generated/instructions/closePosition.d.ts.map +1 -1
- package/dist/generated/instructions/closePosition.js +8 -2
- package/dist/generated/instructions/createAdminConfig.d.ts +6 -2
- package/dist/generated/instructions/createAdminConfig.d.ts.map +1 -1
- package/dist/generated/instructions/createAdminConfig.js +8 -2
- package/dist/generated/instructions/createBinArray.d.ts +6 -2
- package/dist/generated/instructions/createBinArray.d.ts.map +1 -1
- package/dist/generated/instructions/createBinArray.js +8 -2
- package/dist/generated/instructions/createPool.d.ts +6 -2
- package/dist/generated/instructions/createPool.d.ts.map +1 -1
- package/dist/generated/instructions/createPool.js +8 -2
- package/dist/generated/instructions/deleteBinArray.d.ts +8 -4
- package/dist/generated/instructions/deleteBinArray.d.ts.map +1 -1
- package/dist/generated/instructions/deleteBinArray.js +8 -2
- package/dist/generated/instructions/depositByWeight.d.ts +3 -1
- package/dist/generated/instructions/depositByWeight.d.ts.map +1 -1
- package/dist/generated/instructions/depositByWeight.js +4 -1
- package/dist/generated/instructions/openPosition.d.ts +6 -2
- package/dist/generated/instructions/openPosition.d.ts.map +1 -1
- package/dist/generated/instructions/openPosition.js +8 -2
- package/dist/generated/instructions/resetAdminAuthority.d.ts +6 -2
- package/dist/generated/instructions/resetAdminAuthority.d.ts.map +1 -1
- package/dist/generated/instructions/resetAdminAuthority.js +8 -2
- package/dist/generated/instructions/setMetadataUpdateAuthority.d.ts +8 -4
- package/dist/generated/instructions/setMetadataUpdateAuthority.d.ts.map +1 -1
- package/dist/generated/instructions/setMetadataUpdateAuthority.js +8 -2
- package/dist/generated/instructions/setPoolDynamicFeeConfig.d.ts +6 -2
- package/dist/generated/instructions/setPoolDynamicFeeConfig.d.ts.map +1 -1
- package/dist/generated/instructions/setPoolDynamicFeeConfig.js +8 -2
- package/dist/generated/instructions/setPoolProtocolShare.d.ts +6 -2
- package/dist/generated/instructions/setPoolProtocolShare.d.ts.map +1 -1
- package/dist/generated/instructions/setPoolProtocolShare.js +8 -2
- package/dist/generated/instructions/swapExactIn.d.ts +3 -1
- package/dist/generated/instructions/swapExactIn.d.ts.map +1 -1
- package/dist/generated/instructions/swapExactIn.js +4 -1
- package/dist/generated/instructions/swapExactOut.d.ts +3 -1
- package/dist/generated/instructions/swapExactOut.d.ts.map +1 -1
- package/dist/generated/instructions/swapExactOut.js +4 -1
- package/dist/generated/instructions/syncPool.d.ts +3 -1
- package/dist/generated/instructions/syncPool.d.ts.map +1 -1
- package/dist/generated/instructions/syncPool.js +4 -1
- package/dist/generated/instructions/transferAdminAuthority.d.ts +8 -4
- package/dist/generated/instructions/transferAdminAuthority.d.ts.map +1 -1
- package/dist/generated/instructions/transferAdminAuthority.js +8 -2
- package/dist/generated/instructions/withdraw.d.ts +3 -1
- package/dist/generated/instructions/withdraw.d.ts.map +1 -1
- package/dist/generated/instructions/withdraw.js +4 -1
- package/dist/generated/pdas/adminConfig.d.ts +2 -2
- package/dist/generated/pdas/adminConfig.d.ts.map +1 -1
- package/dist/generated/pdas/adminConfig.js +4 -1
- package/dist/generated/pdas/binArray.d.ts +3 -3
- package/dist/generated/pdas/binArray.d.ts.map +1 -1
- package/dist/generated/pdas/binArray.js +4 -1
- package/dist/generated/pdas/pool.d.ts +4 -4
- package/dist/generated/pdas/pool.d.ts.map +1 -1
- package/dist/generated/pdas/pool.js +4 -1
- package/dist/generated/pdas/position.d.ts +3 -3
- package/dist/generated/pdas/position.d.ts.map +1 -1
- package/dist/generated/pdas/position.js +4 -1
- package/dist/generated/programs/piconDlmm.d.ts +61 -21
- package/dist/generated/programs/piconDlmm.d.ts.map +1 -1
- package/dist/generated/programs/piconDlmm.js +69 -26
- package/package.json +11 -10
- package/src/generated/accounts/adminConfig.ts +18 -9
- package/src/generated/accounts/binArray.ts +17 -8
- package/src/generated/accounts/pool.ts +19 -10
- package/src/generated/accounts/position.ts +17 -8
- package/src/generated/errors/piconDlmm.ts +9 -1
- package/src/generated/events/claimFeeEvent.ts +4 -3
- package/src/generated/events/closePositionEvent.ts +8 -1
- package/src/generated/events/createPoolEvent.ts +8 -1
- package/src/generated/events/depositEvent.ts +4 -3
- package/src/generated/events/openPositionEvent.ts +8 -1
- package/src/generated/events/swapEvent.ts +2 -1
- package/src/generated/events/withdrawEvent.ts +4 -3
- package/src/generated/instructions/acceptAdminAuthority.ts +18 -4
- package/src/generated/instructions/claimFee.ts +9 -2
- package/src/generated/instructions/claimProtocolFee.ts +18 -4
- package/src/generated/instructions/closePosition.ts +18 -4
- package/src/generated/instructions/createAdminConfig.ts +18 -4
- package/src/generated/instructions/createBinArray.ts +18 -4
- package/src/generated/instructions/createPool.ts +18 -4
- package/src/generated/instructions/deleteBinArray.ts +20 -5
- package/src/generated/instructions/depositByWeight.ts +9 -2
- package/src/generated/instructions/openPosition.ts +18 -4
- package/src/generated/instructions/resetAdminAuthority.ts +18 -4
- package/src/generated/instructions/setMetadataUpdateAuthority.ts +20 -5
- package/src/generated/instructions/setPoolDynamicFeeConfig.ts +18 -4
- package/src/generated/instructions/setPoolProtocolShare.ts +18 -4
- package/src/generated/instructions/swapExactIn.ts +9 -2
- package/src/generated/instructions/swapExactOut.ts +9 -2
- package/src/generated/instructions/syncPool.ts +9 -2
- package/src/generated/instructions/transferAdminAuthority.ts +20 -5
- package/src/generated/instructions/withdraw.ts +9 -2
- package/src/generated/pdas/adminConfig.ts +8 -2
- package/src/generated/pdas/binArray.ts +9 -3
- package/src/generated/pdas/pool.ts +10 -4
- package/src/generated/pdas/position.ts +9 -3
- package/src/generated/programs/piconDlmm.ts +149 -45
|
@@ -295,7 +295,7 @@ export function parsePiconDlmmInstruction(instruction) {
|
|
|
295
295
|
});
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
|
-
export function piconDlmmProgram() {
|
|
298
|
+
export function piconDlmmProgram(config = {}) {
|
|
299
299
|
return (client) => {
|
|
300
300
|
return extendClient(client, {
|
|
301
301
|
piconDlmm: {
|
|
@@ -306,34 +306,77 @@ export function piconDlmmProgram() {
|
|
|
306
306
|
position: addSelfFetchFunctions(client, getPositionCodec()),
|
|
307
307
|
},
|
|
308
308
|
instructions: {
|
|
309
|
-
acceptAdminAuthority: (input) => addSelfPlanAndSendFunctions(client, getAcceptAdminAuthorityInstructionAsync(input
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
309
|
+
acceptAdminAuthority: (input, instructionConfig) => addSelfPlanAndSendFunctions(client, getAcceptAdminAuthorityInstructionAsync(input, {
|
|
310
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress,
|
|
311
|
+
})),
|
|
312
|
+
claimFee: (input, instructionConfig) => addSelfPlanAndSendFunctions(client, getClaimFeeInstruction(input, {
|
|
313
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress,
|
|
314
|
+
})),
|
|
315
|
+
claimProtocolFee: (input, instructionConfig) => addSelfPlanAndSendFunctions(client, getClaimProtocolFeeInstructionAsync(input, {
|
|
316
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress,
|
|
317
|
+
})),
|
|
318
|
+
closePosition: (input, instructionConfig) => addSelfPlanAndSendFunctions(client, getClosePositionInstructionAsync(input, {
|
|
319
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress,
|
|
320
|
+
})),
|
|
321
|
+
createAdminConfig: (input, instructionConfig) => addSelfPlanAndSendFunctions(client, getCreateAdminConfigInstructionAsync(input, {
|
|
322
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress,
|
|
323
|
+
})),
|
|
324
|
+
createBinArray: (input, instructionConfig) => addSelfPlanAndSendFunctions(client, getCreateBinArrayInstructionAsync({ ...input, payer: input.payer ?? client.payer }, {
|
|
325
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress,
|
|
326
|
+
})),
|
|
327
|
+
createPool: (input, instructionConfig) => addSelfPlanAndSendFunctions(client, getCreatePoolInstructionAsync(input, {
|
|
328
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress,
|
|
329
|
+
})),
|
|
330
|
+
deleteBinArray: (input, instructionConfig) => addSelfPlanAndSendFunctions(client, getDeleteBinArrayInstructionAsync(input, {
|
|
331
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress,
|
|
332
|
+
})),
|
|
333
|
+
depositByWeight: (input, instructionConfig) => addSelfPlanAndSendFunctions(client, getDepositByWeightInstruction(input, {
|
|
334
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress,
|
|
335
|
+
})),
|
|
336
|
+
openPosition: (input, instructionConfig) => addSelfPlanAndSendFunctions(client, getOpenPositionInstructionAsync(input, {
|
|
337
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress,
|
|
338
|
+
})),
|
|
339
|
+
resetAdminAuthority: (input, instructionConfig) => addSelfPlanAndSendFunctions(client, getResetAdminAuthorityInstructionAsync(input, {
|
|
340
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress,
|
|
341
|
+
})),
|
|
342
|
+
setMetadataUpdateAuthority: (input, instructionConfig) => addSelfPlanAndSendFunctions(client, getSetMetadataUpdateAuthorityInstructionAsync(input, {
|
|
343
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress,
|
|
344
|
+
})),
|
|
345
|
+
setPoolDynamicFeeConfig: (input, instructionConfig) => addSelfPlanAndSendFunctions(client, getSetPoolDynamicFeeConfigInstructionAsync(input, {
|
|
346
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress,
|
|
347
|
+
})),
|
|
348
|
+
setPoolProtocolShare: (input, instructionConfig) => addSelfPlanAndSendFunctions(client, getSetPoolProtocolShareInstructionAsync(input, {
|
|
349
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress,
|
|
350
|
+
})),
|
|
351
|
+
swapExactIn: (input, instructionConfig) => addSelfPlanAndSendFunctions(client, getSwapExactInInstruction(input, {
|
|
352
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress,
|
|
353
|
+
})),
|
|
354
|
+
swapExactOut: (input, instructionConfig) => addSelfPlanAndSendFunctions(client, getSwapExactOutInstruction(input, {
|
|
355
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress,
|
|
356
|
+
})),
|
|
357
|
+
syncPool: (input, instructionConfig) => addSelfPlanAndSendFunctions(client, getSyncPoolInstruction(input, {
|
|
358
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress,
|
|
359
|
+
})),
|
|
360
|
+
transferAdminAuthority: (input, instructionConfig) => addSelfPlanAndSendFunctions(client, getTransferAdminAuthorityInstructionAsync(input, {
|
|
361
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress,
|
|
362
|
+
})),
|
|
363
|
+
withdraw: (input, instructionConfig) => addSelfPlanAndSendFunctions(client, getWithdrawInstruction(input, {
|
|
364
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress,
|
|
317
365
|
})),
|
|
318
|
-
createPool: (input) => addSelfPlanAndSendFunctions(client, getCreatePoolInstructionAsync(input)),
|
|
319
|
-
deleteBinArray: (input) => addSelfPlanAndSendFunctions(client, getDeleteBinArrayInstructionAsync(input)),
|
|
320
|
-
depositByWeight: (input) => addSelfPlanAndSendFunctions(client, getDepositByWeightInstruction(input)),
|
|
321
|
-
openPosition: (input) => addSelfPlanAndSendFunctions(client, getOpenPositionInstructionAsync(input)),
|
|
322
|
-
resetAdminAuthority: (input) => addSelfPlanAndSendFunctions(client, getResetAdminAuthorityInstructionAsync(input)),
|
|
323
|
-
setMetadataUpdateAuthority: (input) => addSelfPlanAndSendFunctions(client, getSetMetadataUpdateAuthorityInstructionAsync(input)),
|
|
324
|
-
setPoolDynamicFeeConfig: (input) => addSelfPlanAndSendFunctions(client, getSetPoolDynamicFeeConfigInstructionAsync(input)),
|
|
325
|
-
setPoolProtocolShare: (input) => addSelfPlanAndSendFunctions(client, getSetPoolProtocolShareInstructionAsync(input)),
|
|
326
|
-
swapExactIn: (input) => addSelfPlanAndSendFunctions(client, getSwapExactInInstruction(input)),
|
|
327
|
-
swapExactOut: (input) => addSelfPlanAndSendFunctions(client, getSwapExactOutInstruction(input)),
|
|
328
|
-
syncPool: (input) => addSelfPlanAndSendFunctions(client, getSyncPoolInstruction(input)),
|
|
329
|
-
transferAdminAuthority: (input) => addSelfPlanAndSendFunctions(client, getTransferAdminAuthorityInstructionAsync(input)),
|
|
330
|
-
withdraw: (input) => addSelfPlanAndSendFunctions(client, getWithdrawInstruction(input)),
|
|
331
366
|
},
|
|
332
367
|
pdas: {
|
|
333
|
-
adminConfig: findAdminConfigPda
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
368
|
+
adminConfig: (pdaConfig) => findAdminConfigPda({
|
|
369
|
+
programAddress: pdaConfig?.programAddress ?? config.programAddress,
|
|
370
|
+
}),
|
|
371
|
+
position: (seeds, pdaConfig) => findPositionPda(seeds, {
|
|
372
|
+
programAddress: pdaConfig?.programAddress ?? config.programAddress,
|
|
373
|
+
}),
|
|
374
|
+
binArray: (seeds, pdaConfig) => findBinArrayPda(seeds, {
|
|
375
|
+
programAddress: pdaConfig?.programAddress ?? config.programAddress,
|
|
376
|
+
}),
|
|
377
|
+
pool: (seeds, pdaConfig) => findPoolPda(seeds, {
|
|
378
|
+
programAddress: pdaConfig?.programAddress ?? config.programAddress,
|
|
379
|
+
}),
|
|
337
380
|
},
|
|
338
381
|
identifyAccount: identifyPiconDlmmAccount,
|
|
339
382
|
identifyInstruction: identifyPiconDlmmInstruction,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@picon-finance/dlmm-sdk",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.7",
|
|
4
4
|
"description": "Typescript SDK for interacting with the Picon DLMM protocol",
|
|
5
5
|
"author": "Picon Finance",
|
|
6
6
|
"license": "MIT",
|
|
@@ -43,17 +43,18 @@
|
|
|
43
43
|
"test": "bun test"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@solana-program/system": "^0.
|
|
47
|
-
"@solana-program/token": "^0.
|
|
48
|
-
"@solana-program/token-2022": "^0.
|
|
49
|
-
"@solana/kit": "^8.
|
|
50
|
-
"@solana/program-client-core": "^8.
|
|
51
|
-
"@solana/transaction-messages": "^8.
|
|
46
|
+
"@solana-program/system": "^0.16.0",
|
|
47
|
+
"@solana-program/token": "^0.18.0",
|
|
48
|
+
"@solana-program/token-2022": "^0.20.0",
|
|
49
|
+
"@solana/kit": "^8.5.0",
|
|
50
|
+
"@solana/program-client-core": "^8.5.0",
|
|
51
|
+
"@solana/transaction-messages": "^8.5.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@types/bun": "latest",
|
|
55
54
|
"@codama/nodes-from-anchor": "^1.5.6",
|
|
56
|
-
"@codama/renderers-js": "^2.
|
|
57
|
-
"
|
|
55
|
+
"@codama/renderers-js": "^2.7.0",
|
|
56
|
+
"@types/bun": "latest",
|
|
57
|
+
"codama": "^1.11.0",
|
|
58
|
+
"typescript": "^6.0.3"
|
|
58
59
|
}
|
|
59
60
|
}
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
type FixedSizeCodec,
|
|
31
31
|
type FixedSizeDecoder,
|
|
32
32
|
type FixedSizeEncoder,
|
|
33
|
+
type HasAddress,
|
|
33
34
|
type MaybeAccount,
|
|
34
35
|
type MaybeEncodedAccount,
|
|
35
36
|
type ReadonlyUint8Array,
|
|
@@ -53,9 +54,9 @@ export type AdminConfig = {
|
|
|
53
54
|
};
|
|
54
55
|
|
|
55
56
|
export type AdminConfigArgs = {
|
|
56
|
-
authority: Address;
|
|
57
|
-
pendingAuthority: Address;
|
|
58
|
-
metadataUpdateAuthority: Address;
|
|
57
|
+
authority: Address | HasAddress;
|
|
58
|
+
pendingAuthority: Address | HasAddress;
|
|
59
|
+
metadataUpdateAuthority: Address | HasAddress;
|
|
59
60
|
};
|
|
60
61
|
|
|
61
62
|
/** Gets the encoder for {@link AdminConfigArgs} account data. */
|
|
@@ -106,7 +107,7 @@ export function decodeAdminConfig<TAddress extends string = string>(
|
|
|
106
107
|
|
|
107
108
|
export async function fetchAdminConfig<TAddress extends string = string>(
|
|
108
109
|
rpc: Parameters<typeof fetchEncodedAccount>[0],
|
|
109
|
-
address: Address<TAddress>,
|
|
110
|
+
address: Address<TAddress> | HasAddress<TAddress>,
|
|
110
111
|
config?: FetchAccountConfig,
|
|
111
112
|
): Promise<Account<AdminConfig, TAddress>> {
|
|
112
113
|
const maybeAccount = await fetchMaybeAdminConfig(rpc, address, config);
|
|
@@ -116,16 +117,20 @@ export async function fetchAdminConfig<TAddress extends string = string>(
|
|
|
116
117
|
|
|
117
118
|
export async function fetchMaybeAdminConfig<TAddress extends string = string>(
|
|
118
119
|
rpc: Parameters<typeof fetchEncodedAccount>[0],
|
|
119
|
-
address: Address<TAddress>,
|
|
120
|
+
address: Address<TAddress> | HasAddress<TAddress>,
|
|
120
121
|
config?: FetchAccountConfig,
|
|
121
122
|
): Promise<MaybeAccount<AdminConfig, TAddress>> {
|
|
122
|
-
const maybeAccount = await fetchEncodedAccount(
|
|
123
|
+
const maybeAccount = await fetchEncodedAccount(
|
|
124
|
+
rpc,
|
|
125
|
+
typeof address === "string" ? address : address.address,
|
|
126
|
+
config,
|
|
127
|
+
);
|
|
123
128
|
return decodeAdminConfig(maybeAccount);
|
|
124
129
|
}
|
|
125
130
|
|
|
126
131
|
export async function fetchAllAdminConfig(
|
|
127
132
|
rpc: Parameters<typeof fetchEncodedAccounts>[0],
|
|
128
|
-
addresses: Array<Address>,
|
|
133
|
+
addresses: Array<Address | HasAddress>,
|
|
129
134
|
config?: FetchAccountsConfig,
|
|
130
135
|
): Promise<Account<AdminConfig>[]> {
|
|
131
136
|
const maybeAccounts = await fetchAllMaybeAdminConfig(rpc, addresses, config);
|
|
@@ -135,10 +140,14 @@ export async function fetchAllAdminConfig(
|
|
|
135
140
|
|
|
136
141
|
export async function fetchAllMaybeAdminConfig(
|
|
137
142
|
rpc: Parameters<typeof fetchEncodedAccounts>[0],
|
|
138
|
-
addresses: Array<Address>,
|
|
143
|
+
addresses: Array<Address | HasAddress>,
|
|
139
144
|
config?: FetchAccountsConfig,
|
|
140
145
|
): Promise<MaybeAccount<AdminConfig>[]> {
|
|
141
|
-
const maybeAccounts = await fetchEncodedAccounts(
|
|
146
|
+
const maybeAccounts = await fetchEncodedAccounts(
|
|
147
|
+
rpc,
|
|
148
|
+
addresses.map((a) => (typeof a === "string" ? a : a.address)),
|
|
149
|
+
config,
|
|
150
|
+
);
|
|
142
151
|
return maybeAccounts.map((maybeAccount) => decodeAdminConfig(maybeAccount));
|
|
143
152
|
}
|
|
144
153
|
|
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
type FixedSizeCodec,
|
|
35
35
|
type FixedSizeDecoder,
|
|
36
36
|
type FixedSizeEncoder,
|
|
37
|
+
type HasAddress,
|
|
37
38
|
type MaybeAccount,
|
|
38
39
|
type MaybeEncodedAccount,
|
|
39
40
|
type ReadonlyUint8Array,
|
|
@@ -64,8 +65,8 @@ export type BinArray = {
|
|
|
64
65
|
|
|
65
66
|
export type BinArrayArgs = {
|
|
66
67
|
index: number;
|
|
67
|
-
pool: Address;
|
|
68
|
-
payer: Address;
|
|
68
|
+
pool: Address | HasAddress;
|
|
69
|
+
payer: Address | HasAddress;
|
|
69
70
|
padding: ReadonlyUint8Array;
|
|
70
71
|
bins: Array<BinArgs>;
|
|
71
72
|
};
|
|
@@ -119,7 +120,7 @@ export function decodeBinArray<TAddress extends string = string>(
|
|
|
119
120
|
|
|
120
121
|
export async function fetchBinArray<TAddress extends string = string>(
|
|
121
122
|
rpc: Parameters<typeof fetchEncodedAccount>[0],
|
|
122
|
-
address: Address<TAddress>,
|
|
123
|
+
address: Address<TAddress> | HasAddress<TAddress>,
|
|
123
124
|
config?: FetchAccountConfig,
|
|
124
125
|
): Promise<Account<BinArray, TAddress>> {
|
|
125
126
|
const maybeAccount = await fetchMaybeBinArray(rpc, address, config);
|
|
@@ -129,16 +130,20 @@ export async function fetchBinArray<TAddress extends string = string>(
|
|
|
129
130
|
|
|
130
131
|
export async function fetchMaybeBinArray<TAddress extends string = string>(
|
|
131
132
|
rpc: Parameters<typeof fetchEncodedAccount>[0],
|
|
132
|
-
address: Address<TAddress>,
|
|
133
|
+
address: Address<TAddress> | HasAddress<TAddress>,
|
|
133
134
|
config?: FetchAccountConfig,
|
|
134
135
|
): Promise<MaybeAccount<BinArray, TAddress>> {
|
|
135
|
-
const maybeAccount = await fetchEncodedAccount(
|
|
136
|
+
const maybeAccount = await fetchEncodedAccount(
|
|
137
|
+
rpc,
|
|
138
|
+
typeof address === "string" ? address : address.address,
|
|
139
|
+
config,
|
|
140
|
+
);
|
|
136
141
|
return decodeBinArray(maybeAccount);
|
|
137
142
|
}
|
|
138
143
|
|
|
139
144
|
export async function fetchAllBinArray(
|
|
140
145
|
rpc: Parameters<typeof fetchEncodedAccounts>[0],
|
|
141
|
-
addresses: Array<Address>,
|
|
146
|
+
addresses: Array<Address | HasAddress>,
|
|
142
147
|
config?: FetchAccountsConfig,
|
|
143
148
|
): Promise<Account<BinArray>[]> {
|
|
144
149
|
const maybeAccounts = await fetchAllMaybeBinArray(rpc, addresses, config);
|
|
@@ -148,10 +153,14 @@ export async function fetchAllBinArray(
|
|
|
148
153
|
|
|
149
154
|
export async function fetchAllMaybeBinArray(
|
|
150
155
|
rpc: Parameters<typeof fetchEncodedAccounts>[0],
|
|
151
|
-
addresses: Array<Address>,
|
|
156
|
+
addresses: Array<Address | HasAddress>,
|
|
152
157
|
config?: FetchAccountsConfig,
|
|
153
158
|
): Promise<MaybeAccount<BinArray>[]> {
|
|
154
|
-
const maybeAccounts = await fetchEncodedAccounts(
|
|
159
|
+
const maybeAccounts = await fetchEncodedAccounts(
|
|
160
|
+
rpc,
|
|
161
|
+
addresses.map((a) => (typeof a === "string" ? a : a.address)),
|
|
162
|
+
config,
|
|
163
|
+
);
|
|
155
164
|
return maybeAccounts.map((maybeAccount) => decodeBinArray(maybeAccount));
|
|
156
165
|
}
|
|
157
166
|
|
|
@@ -38,6 +38,7 @@ import {
|
|
|
38
38
|
type FixedSizeCodec,
|
|
39
39
|
type FixedSizeDecoder,
|
|
40
40
|
type FixedSizeEncoder,
|
|
41
|
+
type HasAddress,
|
|
41
42
|
type MaybeAccount,
|
|
42
43
|
type MaybeEncodedAccount,
|
|
43
44
|
type ReadonlyUint8Array,
|
|
@@ -80,10 +81,10 @@ export type PoolArgs = {
|
|
|
80
81
|
bump: ReadonlyUint8Array;
|
|
81
82
|
activeBinId: number;
|
|
82
83
|
dynamicFeeState: DynamicFeeStateArgs;
|
|
83
|
-
tokenMintX: Address;
|
|
84
|
-
tokenMintY: Address;
|
|
85
|
-
tokenVaultX: Address;
|
|
86
|
-
tokenVaultY: Address;
|
|
84
|
+
tokenMintX: Address | HasAddress;
|
|
85
|
+
tokenMintY: Address | HasAddress;
|
|
86
|
+
tokenVaultX: Address | HasAddress;
|
|
87
|
+
tokenVaultY: Address | HasAddress;
|
|
87
88
|
protocolFeeX: number | bigint;
|
|
88
89
|
protocolFeeY: number | bigint;
|
|
89
90
|
};
|
|
@@ -151,7 +152,7 @@ export function decodePool<TAddress extends string = string>(
|
|
|
151
152
|
|
|
152
153
|
export async function fetchPool<TAddress extends string = string>(
|
|
153
154
|
rpc: Parameters<typeof fetchEncodedAccount>[0],
|
|
154
|
-
address: Address<TAddress>,
|
|
155
|
+
address: Address<TAddress> | HasAddress<TAddress>,
|
|
155
156
|
config?: FetchAccountConfig,
|
|
156
157
|
): Promise<Account<Pool, TAddress>> {
|
|
157
158
|
const maybeAccount = await fetchMaybePool(rpc, address, config);
|
|
@@ -161,16 +162,20 @@ export async function fetchPool<TAddress extends string = string>(
|
|
|
161
162
|
|
|
162
163
|
export async function fetchMaybePool<TAddress extends string = string>(
|
|
163
164
|
rpc: Parameters<typeof fetchEncodedAccount>[0],
|
|
164
|
-
address: Address<TAddress>,
|
|
165
|
+
address: Address<TAddress> | HasAddress<TAddress>,
|
|
165
166
|
config?: FetchAccountConfig,
|
|
166
167
|
): Promise<MaybeAccount<Pool, TAddress>> {
|
|
167
|
-
const maybeAccount = await fetchEncodedAccount(
|
|
168
|
+
const maybeAccount = await fetchEncodedAccount(
|
|
169
|
+
rpc,
|
|
170
|
+
typeof address === "string" ? address : address.address,
|
|
171
|
+
config,
|
|
172
|
+
);
|
|
168
173
|
return decodePool(maybeAccount);
|
|
169
174
|
}
|
|
170
175
|
|
|
171
176
|
export async function fetchAllPool(
|
|
172
177
|
rpc: Parameters<typeof fetchEncodedAccounts>[0],
|
|
173
|
-
addresses: Array<Address>,
|
|
178
|
+
addresses: Array<Address | HasAddress>,
|
|
174
179
|
config?: FetchAccountsConfig,
|
|
175
180
|
): Promise<Account<Pool>[]> {
|
|
176
181
|
const maybeAccounts = await fetchAllMaybePool(rpc, addresses, config);
|
|
@@ -180,10 +185,14 @@ export async function fetchAllPool(
|
|
|
180
185
|
|
|
181
186
|
export async function fetchAllMaybePool(
|
|
182
187
|
rpc: Parameters<typeof fetchEncodedAccounts>[0],
|
|
183
|
-
addresses: Array<Address>,
|
|
188
|
+
addresses: Array<Address | HasAddress>,
|
|
184
189
|
config?: FetchAccountsConfig,
|
|
185
190
|
): Promise<MaybeAccount<Pool>[]> {
|
|
186
|
-
const maybeAccounts = await fetchEncodedAccounts(
|
|
191
|
+
const maybeAccounts = await fetchEncodedAccounts(
|
|
192
|
+
rpc,
|
|
193
|
+
addresses.map((a) => (typeof a === "string" ? a : a.address)),
|
|
194
|
+
config,
|
|
195
|
+
);
|
|
187
196
|
return maybeAccounts.map((maybeAccount) => decodePool(maybeAccount));
|
|
188
197
|
}
|
|
189
198
|
|
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
type FixedSizeCodec,
|
|
35
35
|
type FixedSizeDecoder,
|
|
36
36
|
type FixedSizeEncoder,
|
|
37
|
+
type HasAddress,
|
|
37
38
|
type MaybeAccount,
|
|
38
39
|
type MaybeEncodedAccount,
|
|
39
40
|
type ReadonlyUint8Array,
|
|
@@ -64,8 +65,8 @@ export type Position = {
|
|
|
64
65
|
};
|
|
65
66
|
|
|
66
67
|
export type PositionArgs = {
|
|
67
|
-
pool: Address;
|
|
68
|
-
positionMint: Address;
|
|
68
|
+
pool: Address | HasAddress;
|
|
69
|
+
positionMint: Address | HasAddress;
|
|
69
70
|
lowerBinId: number;
|
|
70
71
|
upperBinId: number;
|
|
71
72
|
padding: ReadonlyUint8Array;
|
|
@@ -123,7 +124,7 @@ export function decodePosition<TAddress extends string = string>(
|
|
|
123
124
|
|
|
124
125
|
export async function fetchPosition<TAddress extends string = string>(
|
|
125
126
|
rpc: Parameters<typeof fetchEncodedAccount>[0],
|
|
126
|
-
address: Address<TAddress>,
|
|
127
|
+
address: Address<TAddress> | HasAddress<TAddress>,
|
|
127
128
|
config?: FetchAccountConfig,
|
|
128
129
|
): Promise<Account<Position, TAddress>> {
|
|
129
130
|
const maybeAccount = await fetchMaybePosition(rpc, address, config);
|
|
@@ -133,16 +134,20 @@ export async function fetchPosition<TAddress extends string = string>(
|
|
|
133
134
|
|
|
134
135
|
export async function fetchMaybePosition<TAddress extends string = string>(
|
|
135
136
|
rpc: Parameters<typeof fetchEncodedAccount>[0],
|
|
136
|
-
address: Address<TAddress>,
|
|
137
|
+
address: Address<TAddress> | HasAddress<TAddress>,
|
|
137
138
|
config?: FetchAccountConfig,
|
|
138
139
|
): Promise<MaybeAccount<Position, TAddress>> {
|
|
139
|
-
const maybeAccount = await fetchEncodedAccount(
|
|
140
|
+
const maybeAccount = await fetchEncodedAccount(
|
|
141
|
+
rpc,
|
|
142
|
+
typeof address === "string" ? address : address.address,
|
|
143
|
+
config,
|
|
144
|
+
);
|
|
140
145
|
return decodePosition(maybeAccount);
|
|
141
146
|
}
|
|
142
147
|
|
|
143
148
|
export async function fetchAllPosition(
|
|
144
149
|
rpc: Parameters<typeof fetchEncodedAccounts>[0],
|
|
145
|
-
addresses: Array<Address>,
|
|
150
|
+
addresses: Array<Address | HasAddress>,
|
|
146
151
|
config?: FetchAccountsConfig,
|
|
147
152
|
): Promise<Account<Position>[]> {
|
|
148
153
|
const maybeAccounts = await fetchAllMaybePosition(rpc, addresses, config);
|
|
@@ -152,10 +157,14 @@ export async function fetchAllPosition(
|
|
|
152
157
|
|
|
153
158
|
export async function fetchAllMaybePosition(
|
|
154
159
|
rpc: Parameters<typeof fetchEncodedAccounts>[0],
|
|
155
|
-
addresses: Array<Address>,
|
|
160
|
+
addresses: Array<Address | HasAddress>,
|
|
156
161
|
config?: FetchAccountsConfig,
|
|
157
162
|
): Promise<MaybeAccount<Position>[]> {
|
|
158
|
-
const maybeAccounts = await fetchEncodedAccounts(
|
|
163
|
+
const maybeAccounts = await fetchEncodedAccounts(
|
|
164
|
+
rpc,
|
|
165
|
+
addresses.map((a) => (typeof a === "string" ? a : a.address)),
|
|
166
|
+
config,
|
|
167
|
+
);
|
|
159
168
|
return maybeAccounts.map((maybeAccount) => decodePosition(maybeAccount));
|
|
160
169
|
}
|
|
161
170
|
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import {
|
|
10
10
|
isProgramError,
|
|
11
11
|
type Address,
|
|
12
|
+
type HasAddress,
|
|
12
13
|
type SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM,
|
|
13
14
|
type SolanaError,
|
|
14
15
|
} from "@solana/kit";
|
|
@@ -125,12 +126,19 @@ export function isPiconDlmmError<TProgramErrorCode extends PiconDlmmError>(
|
|
|
125
126
|
instructions: Record<number, { programAddress: Address }>;
|
|
126
127
|
},
|
|
127
128
|
code?: TProgramErrorCode,
|
|
129
|
+
config: { programAddress?: Address | HasAddress } = {},
|
|
128
130
|
): error is SolanaError<typeof SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM> &
|
|
129
131
|
Readonly<{ context: Readonly<{ code: TProgramErrorCode }> }> {
|
|
132
|
+
const programAddressInput =
|
|
133
|
+
config.programAddress ?? PICON_DLMM_PROGRAM_ADDRESS;
|
|
134
|
+
const programAddress =
|
|
135
|
+
typeof programAddressInput === "string"
|
|
136
|
+
? programAddressInput
|
|
137
|
+
: programAddressInput.address;
|
|
130
138
|
return isProgramError<TProgramErrorCode>(
|
|
131
139
|
error,
|
|
132
140
|
transactionMessage,
|
|
133
|
-
|
|
141
|
+
programAddress,
|
|
134
142
|
code,
|
|
135
143
|
);
|
|
136
144
|
}
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
type FixedSizeCodec,
|
|
28
28
|
type FixedSizeDecoder,
|
|
29
29
|
type FixedSizeEncoder,
|
|
30
|
+
type HasAddress,
|
|
30
31
|
type ReadonlyUint8Array,
|
|
31
32
|
} from "@solana/kit";
|
|
32
33
|
|
|
@@ -52,9 +53,9 @@ export type ClaimFeeEventEvent = {
|
|
|
52
53
|
};
|
|
53
54
|
|
|
54
55
|
export type ClaimFeeEventEventArgs = {
|
|
55
|
-
pool: Address;
|
|
56
|
-
position: Address;
|
|
57
|
-
owner: Address;
|
|
56
|
+
pool: Address | HasAddress;
|
|
57
|
+
position: Address | HasAddress;
|
|
58
|
+
owner: Address | HasAddress;
|
|
58
59
|
lowerBinId: number;
|
|
59
60
|
upperBinId: number;
|
|
60
61
|
amountX: number | bigint;
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
type FixedSizeCodec,
|
|
26
26
|
type FixedSizeDecoder,
|
|
27
27
|
type FixedSizeEncoder,
|
|
28
|
+
type HasAddress,
|
|
28
29
|
type ReadonlyUint8Array,
|
|
29
30
|
} from "@solana/kit";
|
|
30
31
|
|
|
@@ -45,7 +46,13 @@ export type ClosePositionEventEvent = {
|
|
|
45
46
|
upperBinId: number;
|
|
46
47
|
};
|
|
47
48
|
|
|
48
|
-
export type ClosePositionEventEventArgs =
|
|
49
|
+
export type ClosePositionEventEventArgs = {
|
|
50
|
+
pool: Address | HasAddress;
|
|
51
|
+
position: Address | HasAddress;
|
|
52
|
+
owner: Address | HasAddress;
|
|
53
|
+
lowerBinId: number;
|
|
54
|
+
upperBinId: number;
|
|
55
|
+
};
|
|
49
56
|
|
|
50
57
|
/** Gets the encoder for {@link ClosePositionEventEventArgs} event data. */
|
|
51
58
|
export function getClosePositionEventEventEncoder(): FixedSizeEncoder<ClosePositionEventEventArgs> {
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
type FixedSizeCodec,
|
|
28
28
|
type FixedSizeDecoder,
|
|
29
29
|
type FixedSizeEncoder,
|
|
30
|
+
type HasAddress,
|
|
30
31
|
type ReadonlyUint8Array,
|
|
31
32
|
} from "@solana/kit";
|
|
32
33
|
|
|
@@ -47,7 +48,13 @@ export type CreatePoolEventEvent = {
|
|
|
47
48
|
tokenMintY: Address;
|
|
48
49
|
};
|
|
49
50
|
|
|
50
|
-
export type CreatePoolEventEventArgs =
|
|
51
|
+
export type CreatePoolEventEventArgs = {
|
|
52
|
+
pool: Address | HasAddress;
|
|
53
|
+
binStep: number;
|
|
54
|
+
feeRate: number;
|
|
55
|
+
tokenMintX: Address | HasAddress;
|
|
56
|
+
tokenMintY: Address | HasAddress;
|
|
57
|
+
};
|
|
51
58
|
|
|
52
59
|
/** Gets the encoder for {@link CreatePoolEventEventArgs} event data. */
|
|
53
60
|
export function getCreatePoolEventEventEncoder(): FixedSizeEncoder<CreatePoolEventEventArgs> {
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
type FixedSizeCodec,
|
|
28
28
|
type FixedSizeDecoder,
|
|
29
29
|
type FixedSizeEncoder,
|
|
30
|
+
type HasAddress,
|
|
30
31
|
type ReadonlyUint8Array,
|
|
31
32
|
} from "@solana/kit";
|
|
32
33
|
|
|
@@ -52,9 +53,9 @@ export type DepositEventEvent = {
|
|
|
52
53
|
};
|
|
53
54
|
|
|
54
55
|
export type DepositEventEventArgs = {
|
|
55
|
-
pool: Address;
|
|
56
|
-
position: Address;
|
|
57
|
-
owner: Address;
|
|
56
|
+
pool: Address | HasAddress;
|
|
57
|
+
position: Address | HasAddress;
|
|
58
|
+
owner: Address | HasAddress;
|
|
58
59
|
lowerBinId: number;
|
|
59
60
|
upperBinId: number;
|
|
60
61
|
amountX: number | bigint;
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
type FixedSizeCodec,
|
|
26
26
|
type FixedSizeDecoder,
|
|
27
27
|
type FixedSizeEncoder,
|
|
28
|
+
type HasAddress,
|
|
28
29
|
type ReadonlyUint8Array,
|
|
29
30
|
} from "@solana/kit";
|
|
30
31
|
|
|
@@ -45,7 +46,13 @@ export type OpenPositionEventEvent = {
|
|
|
45
46
|
upperBinId: number;
|
|
46
47
|
};
|
|
47
48
|
|
|
48
|
-
export type OpenPositionEventEventArgs =
|
|
49
|
+
export type OpenPositionEventEventArgs = {
|
|
50
|
+
pool: Address | HasAddress;
|
|
51
|
+
position: Address | HasAddress;
|
|
52
|
+
owner: Address | HasAddress;
|
|
53
|
+
lowerBinId: number;
|
|
54
|
+
upperBinId: number;
|
|
55
|
+
};
|
|
49
56
|
|
|
50
57
|
/** Gets the encoder for {@link OpenPositionEventEventArgs} event data. */
|
|
51
58
|
export function getOpenPositionEventEventEncoder(): FixedSizeEncoder<OpenPositionEventEventArgs> {
|
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
type FixedSizeCodec,
|
|
30
30
|
type FixedSizeDecoder,
|
|
31
31
|
type FixedSizeEncoder,
|
|
32
|
+
type HasAddress,
|
|
32
33
|
type ReadonlyUint8Array,
|
|
33
34
|
} from "@solana/kit";
|
|
34
35
|
|
|
@@ -55,7 +56,7 @@ export type SwapEventEvent = {
|
|
|
55
56
|
};
|
|
56
57
|
|
|
57
58
|
export type SwapEventEventArgs = {
|
|
58
|
-
pool: Address;
|
|
59
|
+
pool: Address | HasAddress;
|
|
59
60
|
xToY: boolean;
|
|
60
61
|
preBinId: number;
|
|
61
62
|
postBinId: number;
|
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
type FixedSizeCodec,
|
|
30
30
|
type FixedSizeDecoder,
|
|
31
31
|
type FixedSizeEncoder,
|
|
32
|
+
type HasAddress,
|
|
32
33
|
type ReadonlyUint8Array,
|
|
33
34
|
} from "@solana/kit";
|
|
34
35
|
|
|
@@ -55,9 +56,9 @@ export type WithdrawEventEvent = {
|
|
|
55
56
|
};
|
|
56
57
|
|
|
57
58
|
export type WithdrawEventEventArgs = {
|
|
58
|
-
pool: Address;
|
|
59
|
-
position: Address;
|
|
60
|
-
owner: Address;
|
|
59
|
+
pool: Address | HasAddress;
|
|
60
|
+
position: Address | HasAddress;
|
|
61
|
+
owner: Address | HasAddress;
|
|
61
62
|
lowerBinId: number;
|
|
62
63
|
upperBinId: number;
|
|
63
64
|
bpsRemoved: number;
|
|
@@ -120,7 +120,9 @@ export async function getAcceptAdminAuthorityInstructionAsync<
|
|
|
120
120
|
TAccountPendingAuthority,
|
|
121
121
|
TAccountAdminConfig
|
|
122
122
|
>,
|
|
123
|
-
config?: {
|
|
123
|
+
config?: {
|
|
124
|
+
programAddress?: TProgramAddress | { readonly address: TProgramAddress };
|
|
125
|
+
},
|
|
124
126
|
): Promise<
|
|
125
127
|
AcceptAdminAuthorityInstruction<
|
|
126
128
|
TProgramAddress,
|
|
@@ -135,7 +137,12 @@ export async function getAcceptAdminAuthorityInstructionAsync<
|
|
|
135
137
|
>
|
|
136
138
|
> {
|
|
137
139
|
// Program address.
|
|
138
|
-
const
|
|
140
|
+
const programAddressInput =
|
|
141
|
+
config?.programAddress ?? PICON_DLMM_PROGRAM_ADDRESS;
|
|
142
|
+
const programAddress =
|
|
143
|
+
typeof programAddressInput === "string"
|
|
144
|
+
? programAddressInput
|
|
145
|
+
: programAddressInput.address;
|
|
139
146
|
|
|
140
147
|
// Account meta helper.
|
|
141
148
|
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
@@ -201,7 +208,9 @@ export function getAcceptAdminAuthorityInstruction<
|
|
|
201
208
|
TAccountPendingAuthority,
|
|
202
209
|
TAccountAdminConfig
|
|
203
210
|
>,
|
|
204
|
-
config?: {
|
|
211
|
+
config?: {
|
|
212
|
+
programAddress?: TProgramAddress | { readonly address: TProgramAddress };
|
|
213
|
+
},
|
|
205
214
|
): AcceptAdminAuthorityInstruction<
|
|
206
215
|
TProgramAddress,
|
|
207
216
|
ResolvedInstructionAccountMeta<
|
|
@@ -214,7 +223,12 @@ export function getAcceptAdminAuthorityInstruction<
|
|
|
214
223
|
>
|
|
215
224
|
> {
|
|
216
225
|
// Program address.
|
|
217
|
-
const
|
|
226
|
+
const programAddressInput =
|
|
227
|
+
config?.programAddress ?? PICON_DLMM_PROGRAM_ADDRESS;
|
|
228
|
+
const programAddress =
|
|
229
|
+
typeof programAddressInput === "string"
|
|
230
|
+
? programAddressInput
|
|
231
|
+
: programAddressInput.address;
|
|
218
232
|
|
|
219
233
|
// Account meta helper.
|
|
220
234
|
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|