@solana/program-client-core 8.3.0 → 8.4.0-canary-20260918134912
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/README.md +190 -1
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.native.mjs.map +1 -1
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.mjs.map +1 -1
- package/dist/types/instruction-input-resolution.d.ts +35 -27
- package/dist/types/instruction-input-resolution.d.ts.map +1 -1
- package/package.json +10 -10
- package/src/instruction-input-resolution.ts +35 -27
|
@@ -73,7 +73,7 @@ export declare function getNonNullResolvedInstructionInput<T>(inputName: string,
|
|
|
73
73
|
*
|
|
74
74
|
* @example
|
|
75
75
|
* ```ts
|
|
76
|
-
* const address = getAddressFromResolvedInstructionAccount('mint', resolvedMint);
|
|
76
|
+
* const address = getAddressFromResolvedInstructionAccount('mint', resolvedMint.value);
|
|
77
77
|
* ```
|
|
78
78
|
*/
|
|
79
79
|
export declare function getAddressFromResolvedInstructionAccount<T extends string = string>(inputName: string, value: ResolvedInstructionAccount<T>['value'] | undefined): Address<T>;
|
|
@@ -93,7 +93,7 @@ export declare function getAddressFromResolvedInstructionAccount<T extends strin
|
|
|
93
93
|
*
|
|
94
94
|
* @example
|
|
95
95
|
* ```ts
|
|
96
|
-
* const pda = getResolvedInstructionAccountAsProgramDerivedAddress('metadata', resolvedMetadata);
|
|
96
|
+
* const pda = getResolvedInstructionAccountAsProgramDerivedAddress('metadata', resolvedMetadata.value);
|
|
97
97
|
* const [address, bump] = pda;
|
|
98
98
|
* ```
|
|
99
99
|
*/
|
|
@@ -115,7 +115,7 @@ export declare function getResolvedInstructionAccountAsProgramDerivedAddress<T e
|
|
|
115
115
|
*
|
|
116
116
|
* @example
|
|
117
117
|
* ```ts
|
|
118
|
-
* const signer = getResolvedInstructionAccountAsTransactionSigner('authority', resolvedAuthority);
|
|
118
|
+
* const signer = getResolvedInstructionAccountAsTransactionSigner('authority', resolvedAuthority.value);
|
|
119
119
|
* ```
|
|
120
120
|
*/
|
|
121
121
|
export declare function getResolvedInstructionAccountAsTransactionSigner<T extends string = string>(inputName: string, value: ResolvedInstructionAccount<T>['value'] | undefined): TransactionSigner<T>;
|
|
@@ -158,8 +158,9 @@ export type ResolvedInstructionAccount<TAddress extends string = string, TValue
|
|
|
158
158
|
* {@link ProgramDerivedAddress} or an account meta — this type helper resolves to the
|
|
159
159
|
* branded address string it carries. This allows generated program clients to recover the
|
|
160
160
|
* address type parameter of an account from the caller's input type alone — e.g. via
|
|
161
|
-
* `InstructionAccountInputAddress<
|
|
162
|
-
*
|
|
161
|
+
* `InstructionAccountInputAddress<TAccountAuthority>` where `TAccountAuthority` captures the
|
|
162
|
+
* input provided for the `authority` account — instead of declaring a dedicated address
|
|
163
|
+
* type parameter on the instruction builder.
|
|
163
164
|
*
|
|
164
165
|
* When given a union of inputs, the helper distributes over it, so a union whose members
|
|
165
166
|
* all share the same address brand resolves to that brand. Inputs carrying no brand
|
|
@@ -208,39 +209,46 @@ export type InstructionAccountInputAddress<TInput> = TInput extends HasAddress<i
|
|
|
208
209
|
* provided. Defaults to `TAddress`, which treats signers as plain address carriers.
|
|
209
210
|
*
|
|
210
211
|
* @example
|
|
211
|
-
* The instruction builder below
|
|
212
|
-
*
|
|
213
|
-
*
|
|
212
|
+
* The instruction builder below — the shape emitted by the Codama JS renderer — declares
|
|
213
|
+
* one type parameter per account holding the input value provided for that account, and
|
|
214
|
+
* recovers the account's address type parameter from it using
|
|
215
|
+
* {@link InstructionAccountInputAddress}. Since its `input` parameter remains a concrete
|
|
216
|
+
* object type once inferred, TypeScript keeps performing excess property checks on it, so
|
|
217
|
+
* a misspelled optional account is a compile error rather than silently falling back to
|
|
218
|
+
* its default value.
|
|
214
219
|
* ```ts
|
|
215
|
-
*
|
|
216
|
-
*
|
|
220
|
+
* type TransferInput<
|
|
221
|
+
* TAccountAuthority extends InstructionAccountInput | InstructionSignerInput =
|
|
222
|
+
* | InstructionAccountInput
|
|
223
|
+
* | InstructionSignerInput,
|
|
224
|
+
* > = { authority: TAccountAuthority; amount: bigint };
|
|
225
|
+
*
|
|
226
|
+
* declare function getTransferInstruction<
|
|
227
|
+
* TAccountAuthority extends InstructionAccountInput | InstructionSignerInput,
|
|
228
|
+
* >(
|
|
229
|
+
* input: TransferInput<TAccountAuthority>,
|
|
217
230
|
* ): TransferInstruction<
|
|
218
231
|
* ResolvedInstructionAccountMeta<
|
|
219
|
-
*
|
|
220
|
-
* InstructionAccountInputAddress<
|
|
221
|
-
* ReadonlySignerAccount<InstructionAccountInputAddress<
|
|
222
|
-
* AccountSignerMeta<InstructionAccountInputAddress<
|
|
232
|
+
* TAccountAuthority,
|
|
233
|
+
* InstructionAccountInputAddress<TAccountAuthority>,
|
|
234
|
+
* ReadonlySignerAccount<InstructionAccountInputAddress<TAccountAuthority>> &
|
|
235
|
+
* AccountSignerMeta<InstructionAccountInputAddress<TAccountAuthority>>
|
|
223
236
|
* >
|
|
224
237
|
* >;
|
|
225
238
|
* ```
|
|
226
239
|
*
|
|
227
|
-
* Alternatively, instruction builders may
|
|
228
|
-
*
|
|
229
|
-
* the
|
|
230
|
-
* referencing the address type parameters only in `TInput`'s constraint makes their
|
|
231
|
-
* inference fall back to `string`. Defaulting `TInput` to the concrete input type keeps
|
|
232
|
-
* call sites with explicit type arguments working.
|
|
240
|
+
* Alternatively, instruction builders may capture the caller's whole input in a single
|
|
241
|
+
* `TInput` type parameter and index into it — at the cost of excess property checks, since
|
|
242
|
+
* the input is then inferred as `TInput` itself.
|
|
233
243
|
* ```ts
|
|
234
|
-
* declare function getTransferInstruction<
|
|
235
|
-
*
|
|
236
|
-
* TInput extends TransferInput<TAccountAuthority> = TransferInput<TAccountAuthority>,
|
|
237
|
-
* >(
|
|
238
|
-
* input: TransferInput<TAccountAuthority> & TInput,
|
|
244
|
+
* declare function getTransferInstruction<TInput extends TransferInput>(
|
|
245
|
+
* input: TInput,
|
|
239
246
|
* ): TransferInstruction<
|
|
240
247
|
* ResolvedInstructionAccountMeta<
|
|
241
248
|
* TInput['authority'],
|
|
242
|
-
*
|
|
243
|
-
* ReadonlySignerAccount<
|
|
249
|
+
* InstructionAccountInputAddress<TInput['authority']>,
|
|
250
|
+
* ReadonlySignerAccount<InstructionAccountInputAddress<TInput['authority']>> &
|
|
251
|
+
* AccountSignerMeta<InstructionAccountInputAddress<TInput['authority']>>
|
|
244
252
|
* >
|
|
245
253
|
* >;
|
|
246
254
|
* ```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instruction-input-resolution.d.ts","sourceRoot":"","sources":["../../src/instruction-input-resolution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,UAAU,EAA2B,KAAK,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAOvH,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,oBAAoB,EAAE,WAAW,EAAuB,MAAM,sBAAsB,CAAC;AACrH,OAAO,EAAE,KAAK,iBAAiB,EAAuB,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEtG;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,uBAAuB,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM,IAC9D,oBAAoB,CAAC,QAAQ,CAAC,GAC9B,OAAO,CAAC,QAAQ,CAAC,GACjB,UAAU,CAAC,QAAQ,CAAC,GACpB,qBAAqB,CAAC,QAAQ,CAAC,CAAC;AAEtC;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,sBAAsB,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM,IAC7D,iBAAiB,CAAC,QAAQ,CAAC,GAC3B,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AAElC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,kCAAkC,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI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S,WAAW,CAAA;KAAE;CAC5C,GACK,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC;IAAE,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAA;CAAE,CAAC,GACrD,iBAAiB,CAAC,QAAQ,CAAC,GAC3B,WAAW,CAAC,QAAQ,CAAC,CAAC,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAA;CAAE,GACvD,CAAC,MAAM,CAAC,SAAS,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,GAC5C,WAAW,GACX,QAAQ,CAAC;AAEjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,qBAAqB,CAAC,cAAc,EAAE,OAAO,EAAE,uBAAuB,EAAE,SAAS,GAAG,WAAW,IACnG,WAAW,MAAM,EAAE,SAAS,0BAA0B,KAAG,WAAW,GAAG,iBAAiB,GAAG,SAAS,CAgC/G"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solana/program-client-core",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.4.0-canary-20260918134912",
|
|
4
4
|
"description": "Core utilities for building Solana program clients",
|
|
5
5
|
"homepage": "https://www.solanakit.com/api#solanaprogram-client-core",
|
|
6
6
|
"exports": {
|
|
@@ -56,15 +56,15 @@
|
|
|
56
56
|
"maintained node versions"
|
|
57
57
|
],
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@solana/addresses": "8.
|
|
60
|
-
"@solana/
|
|
61
|
-
"@solana/
|
|
62
|
-
"@solana/instruction-plans": "8.
|
|
63
|
-
"@solana/
|
|
64
|
-
"@solana/
|
|
65
|
-
"@solana/
|
|
66
|
-
"@solana/rpc-api": "8.
|
|
67
|
-
"@solana/
|
|
59
|
+
"@solana/addresses": "8.4.0-canary-20260918134912",
|
|
60
|
+
"@solana/codecs-core": "8.4.0-canary-20260918134912",
|
|
61
|
+
"@solana/errors": "8.4.0-canary-20260918134912",
|
|
62
|
+
"@solana/instruction-plans": "8.4.0-canary-20260918134912",
|
|
63
|
+
"@solana/instructions": "8.4.0-canary-20260918134912",
|
|
64
|
+
"@solana/plugin-interfaces": "8.4.0-canary-20260918134912",
|
|
65
|
+
"@solana/signers": "8.4.0-canary-20260918134912",
|
|
66
|
+
"@solana/rpc-api": "8.4.0-canary-20260918134912",
|
|
67
|
+
"@solana/accounts": "8.4.0-canary-20260918134912"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"typescript": ">=5.4.0"
|
|
@@ -96,7 +96,7 @@ export function getNonNullResolvedInstructionInput<T>(inputName: string, value:
|
|
|
96
96
|
*
|
|
97
97
|
* @example
|
|
98
98
|
* ```ts
|
|
99
|
-
* const address = getAddressFromResolvedInstructionAccount('mint', resolvedMint);
|
|
99
|
+
* const address = getAddressFromResolvedInstructionAccount('mint', resolvedMint.value);
|
|
100
100
|
* ```
|
|
101
101
|
*/
|
|
102
102
|
export function getAddressFromResolvedInstructionAccount<T extends string = string>(
|
|
@@ -129,7 +129,7 @@ export function getAddressFromResolvedInstructionAccount<T extends string = stri
|
|
|
129
129
|
*
|
|
130
130
|
* @example
|
|
131
131
|
* ```ts
|
|
132
|
-
* const pda = getResolvedInstructionAccountAsProgramDerivedAddress('metadata', resolvedMetadata);
|
|
132
|
+
* const pda = getResolvedInstructionAccountAsProgramDerivedAddress('metadata', resolvedMetadata.value);
|
|
133
133
|
* const [address, bump] = pda;
|
|
134
134
|
* ```
|
|
135
135
|
*/
|
|
@@ -163,7 +163,7 @@ export function getResolvedInstructionAccountAsProgramDerivedAddress<T extends s
|
|
|
163
163
|
*
|
|
164
164
|
* @example
|
|
165
165
|
* ```ts
|
|
166
|
-
* const signer = getResolvedInstructionAccountAsTransactionSigner('authority', resolvedAuthority);
|
|
166
|
+
* const signer = getResolvedInstructionAccountAsTransactionSigner('authority', resolvedAuthority.value);
|
|
167
167
|
* ```
|
|
168
168
|
*/
|
|
169
169
|
export function getResolvedInstructionAccountAsTransactionSigner<T extends string = string>(
|
|
@@ -226,8 +226,9 @@ export type ResolvedInstructionAccount<
|
|
|
226
226
|
* {@link ProgramDerivedAddress} or an account meta — this type helper resolves to the
|
|
227
227
|
* branded address string it carries. This allows generated program clients to recover the
|
|
228
228
|
* address type parameter of an account from the caller's input type alone — e.g. via
|
|
229
|
-
* `InstructionAccountInputAddress<
|
|
230
|
-
*
|
|
229
|
+
* `InstructionAccountInputAddress<TAccountAuthority>` where `TAccountAuthority` captures the
|
|
230
|
+
* input provided for the `authority` account — instead of declaring a dedicated address
|
|
231
|
+
* type parameter on the instruction builder.
|
|
231
232
|
*
|
|
232
233
|
* When given a union of inputs, the helper distributes over it, so a union whose members
|
|
233
234
|
* all share the same address brand resolves to that brand. Inputs carrying no brand
|
|
@@ -284,39 +285,46 @@ export type InstructionAccountInputAddress<TInput> =
|
|
|
284
285
|
* provided. Defaults to `TAddress`, which treats signers as plain address carriers.
|
|
285
286
|
*
|
|
286
287
|
* @example
|
|
287
|
-
* The instruction builder below
|
|
288
|
-
*
|
|
289
|
-
*
|
|
288
|
+
* The instruction builder below — the shape emitted by the Codama JS renderer — declares
|
|
289
|
+
* one type parameter per account holding the input value provided for that account, and
|
|
290
|
+
* recovers the account's address type parameter from it using
|
|
291
|
+
* {@link InstructionAccountInputAddress}. Since its `input` parameter remains a concrete
|
|
292
|
+
* object type once inferred, TypeScript keeps performing excess property checks on it, so
|
|
293
|
+
* a misspelled optional account is a compile error rather than silently falling back to
|
|
294
|
+
* its default value.
|
|
290
295
|
* ```ts
|
|
291
|
-
*
|
|
292
|
-
*
|
|
296
|
+
* type TransferInput<
|
|
297
|
+
* TAccountAuthority extends InstructionAccountInput | InstructionSignerInput =
|
|
298
|
+
* | InstructionAccountInput
|
|
299
|
+
* | InstructionSignerInput,
|
|
300
|
+
* > = { authority: TAccountAuthority; amount: bigint };
|
|
301
|
+
*
|
|
302
|
+
* declare function getTransferInstruction<
|
|
303
|
+
* TAccountAuthority extends InstructionAccountInput | InstructionSignerInput,
|
|
304
|
+
* >(
|
|
305
|
+
* input: TransferInput<TAccountAuthority>,
|
|
293
306
|
* ): TransferInstruction<
|
|
294
307
|
* ResolvedInstructionAccountMeta<
|
|
295
|
-
*
|
|
296
|
-
* InstructionAccountInputAddress<
|
|
297
|
-
* ReadonlySignerAccount<InstructionAccountInputAddress<
|
|
298
|
-
* AccountSignerMeta<InstructionAccountInputAddress<
|
|
308
|
+
* TAccountAuthority,
|
|
309
|
+
* InstructionAccountInputAddress<TAccountAuthority>,
|
|
310
|
+
* ReadonlySignerAccount<InstructionAccountInputAddress<TAccountAuthority>> &
|
|
311
|
+
* AccountSignerMeta<InstructionAccountInputAddress<TAccountAuthority>>
|
|
299
312
|
* >
|
|
300
313
|
* >;
|
|
301
314
|
* ```
|
|
302
315
|
*
|
|
303
|
-
* Alternatively, instruction builders may
|
|
304
|
-
*
|
|
305
|
-
* the
|
|
306
|
-
* referencing the address type parameters only in `TInput`'s constraint makes their
|
|
307
|
-
* inference fall back to `string`. Defaulting `TInput` to the concrete input type keeps
|
|
308
|
-
* call sites with explicit type arguments working.
|
|
316
|
+
* Alternatively, instruction builders may capture the caller's whole input in a single
|
|
317
|
+
* `TInput` type parameter and index into it — at the cost of excess property checks, since
|
|
318
|
+
* the input is then inferred as `TInput` itself.
|
|
309
319
|
* ```ts
|
|
310
|
-
* declare function getTransferInstruction<
|
|
311
|
-
*
|
|
312
|
-
* TInput extends TransferInput<TAccountAuthority> = TransferInput<TAccountAuthority>,
|
|
313
|
-
* >(
|
|
314
|
-
* input: TransferInput<TAccountAuthority> & TInput,
|
|
320
|
+
* declare function getTransferInstruction<TInput extends TransferInput>(
|
|
321
|
+
* input: TInput,
|
|
315
322
|
* ): TransferInstruction<
|
|
316
323
|
* ResolvedInstructionAccountMeta<
|
|
317
324
|
* TInput['authority'],
|
|
318
|
-
*
|
|
319
|
-
* ReadonlySignerAccount<
|
|
325
|
+
* InstructionAccountInputAddress<TInput['authority']>,
|
|
326
|
+
* ReadonlySignerAccount<InstructionAccountInputAddress<TInput['authority']>> &
|
|
327
|
+
* AccountSignerMeta<InstructionAccountInputAddress<TInput['authority']>>
|
|
320
328
|
* >
|
|
321
329
|
* >;
|
|
322
330
|
* ```
|