@usearete/sdk 0.1.5 → 0.2.0
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 +273 -58
- package/dist/index.d.ts +957 -175
- package/dist/index.esm.js +2004 -680
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +2055 -681
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wallet adapter boundary for the Arete SDK.
|
|
3
|
+
*
|
|
4
|
+
* The core SDK is intentionally RPC-free: it only constructs `BuiltInstruction`
|
|
5
|
+
* objects. Everything network-related (recent blockhash, message compilation,
|
|
6
|
+
* signing, sending, and confirmation) lives behind the `WalletAdapter`
|
|
7
|
+
* boundary, implemented by adapters that wrap the Solana library of your choice
|
|
8
|
+
* (@solana/web3.js, @solana/kit, a raw Keypair signer for scripts, etc.).
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* A single account reference within a built instruction.
|
|
12
|
+
*/
|
|
13
|
+
interface BuiltAccountMeta {
|
|
14
|
+
/** Account address as a base58-encoded string */
|
|
15
|
+
pubkey: string;
|
|
16
|
+
/** Whether this account must sign the transaction */
|
|
17
|
+
isSigner: boolean;
|
|
18
|
+
/** Whether this account is writable */
|
|
19
|
+
isWritable: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A framework-agnostic representation of a Solana instruction.
|
|
23
|
+
*
|
|
24
|
+
* This is the boundary type between the core SDK (which builds instructions)
|
|
25
|
+
* and wallet adapters (which broadcast them). It maps 1:1 onto a
|
|
26
|
+
* @solana/web3.js `TransactionInstruction` or a @solana/kit `Instruction`.
|
|
27
|
+
*/
|
|
28
|
+
interface BuiltInstruction {
|
|
29
|
+
/** Program ID (base58) */
|
|
30
|
+
programId: string;
|
|
31
|
+
/** Account keys, in the exact order required by the program */
|
|
32
|
+
keys: BuiltAccountMeta[];
|
|
33
|
+
/** Serialized instruction data (discriminator + Borsh-encoded args) */
|
|
34
|
+
data: Uint8Array;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Confirmation level for transaction processing.
|
|
38
|
+
* - `processed`: Transaction processed but not confirmed
|
|
39
|
+
* - `confirmed`: Transaction confirmed by cluster
|
|
40
|
+
* - `finalized`: Transaction finalized (recommended for production)
|
|
41
|
+
*/
|
|
42
|
+
type ConfirmationLevel = 'processed' | 'confirmed' | 'finalized';
|
|
43
|
+
/**
|
|
44
|
+
* Options forwarded to the wallet adapter when sending a transaction.
|
|
45
|
+
*
|
|
46
|
+
* The core SDK does not interpret these; it passes them straight through to
|
|
47
|
+
* the adapter, which owns all RPC semantics.
|
|
48
|
+
*/
|
|
49
|
+
interface SendOptions {
|
|
50
|
+
/** Confirmation level the adapter should wait for */
|
|
51
|
+
confirmationLevel?: ConfirmationLevel;
|
|
52
|
+
/** Skip the RPC preflight simulation */
|
|
53
|
+
skipPreflight?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Optional extra local signers for this send.
|
|
56
|
+
*
|
|
57
|
+
* The concrete signer type depends on the wallet adapter implementation
|
|
58
|
+
* (for example `@solana/web3.js` Signers or `@solana/kit` TransactionSigners).
|
|
59
|
+
*/
|
|
60
|
+
signers?: readonly unknown[];
|
|
61
|
+
/** Adapter-specific passthrough options (priority fees, lookup tables, etc.) */
|
|
62
|
+
[key: string]: unknown;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Result returned by a wallet adapter after broadcasting a transaction.
|
|
66
|
+
*/
|
|
67
|
+
interface SendResult {
|
|
68
|
+
/** Transaction signature (base58) */
|
|
69
|
+
signature: string;
|
|
70
|
+
/** Slot in which the transaction landed, if the adapter reports it */
|
|
71
|
+
slot?: number;
|
|
72
|
+
}
|
|
1
73
|
/**
|
|
2
74
|
* Wallet adapter interface for signing and sending transactions.
|
|
3
|
-
*
|
|
75
|
+
*
|
|
76
|
+
* Implementations own blockhash fetching, message compilation (legacy or v0),
|
|
77
|
+
* signing, sending, and confirmation. The core SDK only needs `publicKey` for
|
|
78
|
+
* signer-account resolution and `signAndSend` to broadcast built instructions.
|
|
4
79
|
*/
|
|
5
80
|
interface WalletAdapter {
|
|
6
81
|
/** The wallet's public key as a base58-encoded string */
|
|
7
82
|
publicKey: string;
|
|
83
|
+
/** Signer addresses the adapter can satisfy without per-send signers. */
|
|
84
|
+
readonly signerAddresses?: readonly string[];
|
|
8
85
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
86
|
+
* Compile, sign, and broadcast one or more built instructions as a single
|
|
87
|
+
* transaction.
|
|
88
|
+
*
|
|
89
|
+
* Accepting an array (rather than a single instruction) makes batching and
|
|
90
|
+
* composition fall out for free.
|
|
91
|
+
*
|
|
92
|
+
* @param instructions - Instructions to include in the transaction, in order
|
|
93
|
+
* @param options - Adapter-specific send/confirmation options
|
|
94
|
+
* @returns The transaction signature (and slot, if known)
|
|
12
95
|
*/
|
|
13
|
-
signAndSend
|
|
96
|
+
signAndSend(instructions: readonly BuiltInstruction[], options?: SendOptions): Promise<SendResult>;
|
|
14
97
|
}
|
|
15
98
|
/**
|
|
16
99
|
* Wallet connection state
|
|
@@ -68,9 +151,13 @@ interface PdaConfig {
|
|
|
68
151
|
type PdaSeed = {
|
|
69
152
|
type: 'literal';
|
|
70
153
|
value: string;
|
|
154
|
+
} | {
|
|
155
|
+
type: 'bytes';
|
|
156
|
+
value: number[];
|
|
71
157
|
} | {
|
|
72
158
|
type: 'argRef';
|
|
73
159
|
argName: string;
|
|
160
|
+
argType?: string;
|
|
74
161
|
} | {
|
|
75
162
|
type: 'accountRef';
|
|
76
163
|
accountName: string;
|
|
@@ -101,8 +188,10 @@ interface AccountResolutionResult {
|
|
|
101
188
|
* Options for account resolution.
|
|
102
189
|
*/
|
|
103
190
|
interface AccountResolutionOptions {
|
|
104
|
-
/**
|
|
191
|
+
/** Explicit account-address overrides, including signer slots when needed */
|
|
105
192
|
accounts?: Record<string, string>;
|
|
193
|
+
/** Helper-only PDA seed inputs */
|
|
194
|
+
resolve?: Record<string, unknown>;
|
|
106
195
|
/** Wallet adapter for signer accounts */
|
|
107
196
|
wallet?: WalletAdapter;
|
|
108
197
|
/** Program ID for PDA derivation (required if any PDAs exist) */
|
|
@@ -194,13 +283,42 @@ interface ArgSchema {
|
|
|
194
283
|
}
|
|
195
284
|
/**
|
|
196
285
|
* Supported argument types for Borsh serialization.
|
|
286
|
+
*
|
|
287
|
+
* Struct and enum schemas are fully inlined (field names and types travel
|
|
288
|
+
* with the schema), so the serializer needs no runtime type registry.
|
|
197
289
|
*/
|
|
198
|
-
type ArgType = 'u8' | 'u16' | 'u32' | 'u64' | 'u128' | 'i8' | 'i16' | 'i32' | 'i64' | 'i128' | 'bool' | 'string' | 'pubkey' | {
|
|
290
|
+
type ArgType = 'u8' | 'u16' | 'u32' | 'u64' | 'u128' | 'i8' | 'i16' | 'i32' | 'i64' | 'i128' | 'f32' | 'f64' | 'bool' | 'string' | 'pubkey' | 'bytes' | {
|
|
199
291
|
vec: ArgType;
|
|
200
292
|
} | {
|
|
201
293
|
option: ArgType;
|
|
202
294
|
} | {
|
|
203
|
-
array: [ArgType, number];
|
|
295
|
+
array: readonly [ArgType, number];
|
|
296
|
+
} | {
|
|
297
|
+
hashMap: readonly [ArgType, ArgType];
|
|
298
|
+
} | {
|
|
299
|
+
struct: readonly ArgStructField[];
|
|
300
|
+
} | {
|
|
301
|
+
enum: readonly EnumVariant[];
|
|
302
|
+
};
|
|
303
|
+
/** One field of a struct schema, in declaration (serialization) order. */
|
|
304
|
+
interface ArgStructField {
|
|
305
|
+
readonly name: string;
|
|
306
|
+
readonly type: ArgType;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* One enum variant: a bare string for fieldless variants, or a named variant
|
|
310
|
+
* carrying struct fields / tuple elements.
|
|
311
|
+
*
|
|
312
|
+
* Values: fieldless variants are passed as the variant name (or its index);
|
|
313
|
+
* data-carrying variants as a single-key object, e.g. `{ transfer: { amount } }`
|
|
314
|
+
* or `{ pair: [1, 2] }`.
|
|
315
|
+
*/
|
|
316
|
+
type EnumVariant = string | {
|
|
317
|
+
readonly name: string;
|
|
318
|
+
readonly fields: readonly ArgStructField[];
|
|
319
|
+
} | {
|
|
320
|
+
readonly name: string;
|
|
321
|
+
readonly tuple: readonly ArgType[];
|
|
204
322
|
};
|
|
205
323
|
/**
|
|
206
324
|
* Serializes instruction arguments into a Buffer using Borsh encoding.
|
|
@@ -212,57 +330,6 @@ type ArgType = 'u8' | 'u16' | 'u32' | 'u64' | 'u128' | 'i8' | 'i16' | 'i32' | 'i
|
|
|
212
330
|
*/
|
|
213
331
|
declare function serializeInstructionData(discriminator: Uint8Array, args: Record<string, unknown>, schema: ArgSchema[]): Buffer;
|
|
214
332
|
|
|
215
|
-
/**
|
|
216
|
-
* Confirmation level for transaction processing.
|
|
217
|
-
* - `processed`: Transaction processed but not confirmed
|
|
218
|
-
* - `confirmed`: Transaction confirmed by cluster
|
|
219
|
-
* - `finalized`: Transaction finalized (recommended for production)
|
|
220
|
-
*/
|
|
221
|
-
type ConfirmationLevel = 'processed' | 'confirmed' | 'finalized';
|
|
222
|
-
/**
|
|
223
|
-
* Options for executing an instruction.
|
|
224
|
-
*/
|
|
225
|
-
interface ExecuteOptions {
|
|
226
|
-
/** Wallet adapter for signing */
|
|
227
|
-
wallet?: WalletAdapter;
|
|
228
|
-
/** User-provided account addresses */
|
|
229
|
-
accounts?: Record<string, string>;
|
|
230
|
-
/** Confirmation level to wait for */
|
|
231
|
-
confirmationLevel?: ConfirmationLevel;
|
|
232
|
-
/** Maximum time to wait for confirmation (ms) */
|
|
233
|
-
timeout?: number;
|
|
234
|
-
/** Refresh view after transaction completes */
|
|
235
|
-
refresh?: {
|
|
236
|
-
view: string;
|
|
237
|
-
key?: string;
|
|
238
|
-
}[];
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Result of a successful instruction execution.
|
|
242
|
-
*/
|
|
243
|
-
interface ExecutionResult {
|
|
244
|
-
/** Transaction signature */
|
|
245
|
-
signature: string;
|
|
246
|
-
/** Confirmation level achieved */
|
|
247
|
-
confirmationLevel: ConfirmationLevel;
|
|
248
|
-
/** Slot when transaction was processed */
|
|
249
|
-
slot: number;
|
|
250
|
-
/** Error code if transaction failed */
|
|
251
|
-
error?: string;
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* Waits for transaction confirmation.
|
|
255
|
-
*
|
|
256
|
-
* @param signature - Transaction signature
|
|
257
|
-
* @param level - Desired confirmation level
|
|
258
|
-
* @param timeout - Maximum wait time in milliseconds
|
|
259
|
-
* @returns Confirmation result
|
|
260
|
-
*/
|
|
261
|
-
declare function waitForConfirmation(signature: string, level?: ConfirmationLevel, timeout?: number): Promise<{
|
|
262
|
-
level: ConfirmationLevel;
|
|
263
|
-
slot: number;
|
|
264
|
-
}>;
|
|
265
|
-
|
|
266
333
|
/**
|
|
267
334
|
* Parses and handles instruction errors.
|
|
268
335
|
*/
|
|
@@ -300,87 +367,139 @@ declare function parseInstructionError(error: unknown, errorMetadata: ErrorMetad
|
|
|
300
367
|
* @returns Human-readable error message
|
|
301
368
|
*/
|
|
302
369
|
declare function formatProgramError(error: ProgramError): string;
|
|
370
|
+
/**
|
|
371
|
+
* Error thrown when an instruction fails to send and the underlying failure
|
|
372
|
+
* could be parsed against the handler's IDL error definitions.
|
|
373
|
+
*/
|
|
374
|
+
declare class InstructionError extends Error {
|
|
375
|
+
/** Parsed program error, if the failure matched a known error code. */
|
|
376
|
+
readonly programError: ProgramError | null;
|
|
377
|
+
/** The original underlying error from the wallet adapter / RPC. */
|
|
378
|
+
readonly cause: unknown;
|
|
379
|
+
constructor(message: string, programError: ProgramError | null, cause: unknown);
|
|
380
|
+
}
|
|
303
381
|
|
|
304
382
|
/**
|
|
305
|
-
* Resolved accounts map passed to
|
|
383
|
+
* Resolved accounts map passed to a handler's build function.
|
|
306
384
|
* Keys are account names, values are base58 addresses.
|
|
307
385
|
*/
|
|
308
386
|
type ResolvedAccounts = Record<string, string>;
|
|
387
|
+
|
|
309
388
|
/**
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
*
|
|
389
|
+
* Instruction handler consumed by the core executor.
|
|
390
|
+
*
|
|
391
|
+
* Handlers are normally produced by {@link createInstructionHandler} (either
|
|
392
|
+
* hand-written or code-generated), so `build` is implemented generically and
|
|
393
|
+
* callers never deal with serialization directly.
|
|
394
|
+
*
|
|
395
|
+
* The phantom `_params` / `_error` fields carry compile-time type information
|
|
396
|
+
* for the typed client surface; they are never populated at runtime.
|
|
313
397
|
*/
|
|
314
|
-
interface
|
|
315
|
-
/** Program ID (base58) */
|
|
398
|
+
interface InstructionHandler<TParams = Record<string, unknown>, TError = unknown> {
|
|
399
|
+
/** Program ID for this instruction (base58). Used for PDA derivation. */
|
|
400
|
+
programId?: string;
|
|
401
|
+
/** Ordered account metadata used by the core SDK for resolution. */
|
|
402
|
+
accounts: AccountMeta[];
|
|
403
|
+
/** Error definitions used for error parsing. */
|
|
404
|
+
errors: ErrorMetadata[];
|
|
405
|
+
/**
|
|
406
|
+
* Names of the instruction's serialized arguments. Everything in the merged
|
|
407
|
+
* params object that is NOT in this list is treated as a user-provided
|
|
408
|
+
* account address override.
|
|
409
|
+
*/
|
|
410
|
+
argNames: string[];
|
|
411
|
+
/**
|
|
412
|
+
* Build the instruction from already-resolved, ordered accounts.
|
|
413
|
+
* Implemented by {@link createInstructionHandler}.
|
|
414
|
+
*/
|
|
415
|
+
build(args: Record<string, unknown>, resolved: ResolvedAccount[]): BuiltInstruction;
|
|
416
|
+
/** Phantom: merged params type (args + user-provided accounts). */
|
|
417
|
+
readonly _params?: TParams;
|
|
418
|
+
/** Phantom: typed error union. */
|
|
419
|
+
readonly _error?: TError;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Configuration accepted by {@link createInstructionHandler}.
|
|
423
|
+
*/
|
|
424
|
+
interface InstructionHandlerConfig {
|
|
425
|
+
/** Program ID (base58). */
|
|
316
426
|
programId: string;
|
|
317
|
-
/**
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
/**
|
|
324
|
-
|
|
427
|
+
/** Instruction discriminator bytes (8 for Anchor, 1 for Steel, etc.). */
|
|
428
|
+
discriminator: Uint8Array | number[];
|
|
429
|
+
/** Ordered account metadata. */
|
|
430
|
+
accounts: AccountMeta[];
|
|
431
|
+
/** Ordered argument schema for Borsh serialization. */
|
|
432
|
+
args: ArgSchema[];
|
|
433
|
+
/** Error definitions from the IDL. */
|
|
434
|
+
errors?: ErrorMetadata[];
|
|
325
435
|
}
|
|
326
436
|
/**
|
|
327
|
-
*
|
|
328
|
-
*
|
|
437
|
+
* Creates a data-driven instruction handler.
|
|
438
|
+
*
|
|
439
|
+
* The returned handler implements `build()` generically: it serializes args
|
|
440
|
+
* via the schema-driven serializer and constructs the account key list from
|
|
441
|
+
* the resolved, ordered accounts. No imperative per-instruction code is
|
|
442
|
+
* required, which keeps generated SDKs tiny and puts all serialization logic
|
|
443
|
+
* in one tested place.
|
|
444
|
+
*/
|
|
445
|
+
declare function createInstructionHandler<TParams = Record<string, unknown>, TError = unknown>(config: InstructionHandlerConfig): InstructionHandler<TParams, TError>;
|
|
446
|
+
/**
|
|
447
|
+
* Options for building an instruction (no network access).
|
|
329
448
|
*/
|
|
330
|
-
interface
|
|
449
|
+
interface BuildOptions {
|
|
450
|
+
/** Wallet, used only for `publicKey` to resolve signer accounts. */
|
|
451
|
+
wallet?: WalletAdapter;
|
|
452
|
+
/** Explicit account-address overrides, including signer slots when needed. */
|
|
453
|
+
accounts?: Record<string, string>;
|
|
331
454
|
/**
|
|
332
|
-
*
|
|
333
|
-
*
|
|
455
|
+
* Extra account metas appended after the instruction's declared accounts
|
|
456
|
+
* (Anchor's `remainingAccounts`) — for routers, transfer hooks, and other
|
|
457
|
+
* composition patterns the IDL cannot express.
|
|
334
458
|
*/
|
|
335
|
-
|
|
336
|
-
/** Account metadata - used by core SDK for resolution */
|
|
337
|
-
accounts: AccountMeta[];
|
|
338
|
-
/** Error definitions - used by core SDK for error parsing */
|
|
339
|
-
errors: ErrorMetadata[];
|
|
340
|
-
/** Program ID for this instruction (used for PDA derivation) */
|
|
341
|
-
programId?: string;
|
|
459
|
+
remainingAccounts?: BuiltAccountMeta[];
|
|
342
460
|
}
|
|
343
461
|
/**
|
|
344
|
-
*
|
|
345
|
-
* Legacy instruction definition for backwards compatibility.
|
|
462
|
+
* Options for executing (building + sending) an instruction.
|
|
346
463
|
*/
|
|
347
|
-
interface
|
|
348
|
-
/**
|
|
349
|
-
|
|
350
|
-
/**
|
|
351
|
-
|
|
352
|
-
/**
|
|
353
|
-
|
|
354
|
-
/** Account metadata */
|
|
355
|
-
accounts: AccountMeta[];
|
|
356
|
-
/** Argument schema for serialization */
|
|
357
|
-
argsSchema: ArgSchema[];
|
|
358
|
-
/** Error definitions */
|
|
359
|
-
errors: ErrorMetadata[];
|
|
464
|
+
interface ExecuteOptions extends BuildOptions {
|
|
465
|
+
/** Wallet adapter that signs and broadcasts the transaction. */
|
|
466
|
+
wallet?: WalletAdapter;
|
|
467
|
+
/** Confirmation level forwarded to the adapter. */
|
|
468
|
+
confirmationLevel?: ConfirmationLevel;
|
|
469
|
+
/** Additional options forwarded verbatim to the wallet adapter. */
|
|
470
|
+
send?: SendOptions;
|
|
360
471
|
}
|
|
361
472
|
/**
|
|
362
|
-
*
|
|
473
|
+
* Result of a successful instruction execution.
|
|
474
|
+
*/
|
|
475
|
+
interface ExecutionResult {
|
|
476
|
+
/** Transaction signature. */
|
|
477
|
+
signature: string;
|
|
478
|
+
/** Slot in which the transaction landed, if the adapter reports it. */
|
|
479
|
+
slot?: number;
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Builds a {@link BuiltInstruction} from a handler and a merged params object.
|
|
363
483
|
*
|
|
364
|
-
* This is
|
|
365
|
-
*
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
484
|
+
* This is a pure function: it performs no network access. It is the unit of
|
|
485
|
+
* composition for batching (`wallet.signAndSend([a, b, c])`).
|
|
486
|
+
*/
|
|
487
|
+
declare function buildInstruction(handler: InstructionHandler<any, any>, params: Record<string, unknown>, options?: BuildOptions): BuiltInstruction;
|
|
488
|
+
/**
|
|
489
|
+
* Builds, signs, and sends an instruction via the wallet adapter.
|
|
369
490
|
*
|
|
370
|
-
*
|
|
371
|
-
*
|
|
372
|
-
*
|
|
373
|
-
* @
|
|
491
|
+
* The core SDK does not touch RPC: the adapter owns blockhash, compilation,
|
|
492
|
+
* signing, sending, and confirmation. On failure, program errors are parsed
|
|
493
|
+
* against the handler's IDL error definitions and surfaced as an
|
|
494
|
+
* {@link InstructionError}.
|
|
374
495
|
*/
|
|
375
|
-
declare function executeInstruction(handler: InstructionHandler,
|
|
496
|
+
declare function executeInstruction(handler: InstructionHandler<any, any>, params: Record<string, unknown>, options?: ExecuteOptions): Promise<ExecutionResult>;
|
|
376
497
|
/**
|
|
377
498
|
* Creates an instruction executor bound to a specific wallet.
|
|
378
|
-
*
|
|
379
|
-
* @param wallet - Wallet adapter
|
|
380
|
-
* @returns Bound executor function
|
|
381
499
|
*/
|
|
382
500
|
declare function createInstructionExecutor(wallet: WalletAdapter): {
|
|
383
|
-
execute: (handler: InstructionHandler,
|
|
501
|
+
execute: (handler: InstructionHandler, params: Record<string, unknown>, options?: Omit<ExecuteOptions, "wallet">) => Promise<ExecutionResult>;
|
|
502
|
+
build: (handler: InstructionHandler, params: Record<string, unknown>, options?: Omit<BuildOptions, "wallet">) => BuiltInstruction;
|
|
384
503
|
};
|
|
385
504
|
|
|
386
505
|
type SeedDef = {
|
|
@@ -400,6 +519,7 @@ type SeedDef = {
|
|
|
400
519
|
interface PdaDeriveContext {
|
|
401
520
|
accounts?: Record<string, string>;
|
|
402
521
|
args?: Record<string, unknown>;
|
|
522
|
+
resolve?: Record<string, unknown>;
|
|
403
523
|
programId?: string;
|
|
404
524
|
}
|
|
405
525
|
interface PdaFactory {
|
|
@@ -450,12 +570,54 @@ interface ViewDef<T, TMode extends 'state' | 'list'> {
|
|
|
450
570
|
readonly view: string;
|
|
451
571
|
readonly _entity?: T;
|
|
452
572
|
}
|
|
573
|
+
interface StackEndpoints {
|
|
574
|
+
readonly ws: string;
|
|
575
|
+
readonly http?: string;
|
|
576
|
+
}
|
|
577
|
+
type ReadTransportMethod = 'GET' | 'POST';
|
|
578
|
+
interface ProgramAccountReadDefinition<T> {
|
|
579
|
+
readonly account: string;
|
|
580
|
+
readonly path: string;
|
|
581
|
+
readonly schema?: Schema<T>;
|
|
582
|
+
readonly _result?: T;
|
|
583
|
+
}
|
|
584
|
+
interface ProgramQueryDefinition<TParams = unknown, TResult = unknown> {
|
|
585
|
+
readonly name: string;
|
|
586
|
+
readonly path: string;
|
|
587
|
+
readonly method?: ReadTransportMethod;
|
|
588
|
+
readonly schema?: Schema<TResult>;
|
|
589
|
+
readonly _params?: TParams;
|
|
590
|
+
readonly _result?: TResult;
|
|
591
|
+
}
|
|
592
|
+
interface StackQueryDefinition<TParams = unknown, TResult = unknown> {
|
|
593
|
+
readonly name: string;
|
|
594
|
+
readonly path: string;
|
|
595
|
+
readonly method?: ReadTransportMethod;
|
|
596
|
+
readonly schema?: Schema<TResult>;
|
|
597
|
+
readonly _params?: TParams;
|
|
598
|
+
readonly _result?: TResult;
|
|
599
|
+
}
|
|
600
|
+
interface ProgramSdkDefinition {
|
|
601
|
+
readonly name: string;
|
|
602
|
+
readonly programId?: string;
|
|
603
|
+
readonly schemas?: Record<string, Schema<unknown>>;
|
|
604
|
+
readonly pdas?: Record<string, unknown>;
|
|
605
|
+
readonly accounts?: Record<string, ProgramAccountReadDefinition<unknown>>;
|
|
606
|
+
readonly queries?: Record<string, ProgramQueryDefinition<unknown, unknown>>;
|
|
607
|
+
readonly rawInstructions?: Record<string, InstructionHandler<any, any>>;
|
|
608
|
+
readonly addresses?: Record<string, unknown>;
|
|
609
|
+
readonly constants?: unknown;
|
|
610
|
+
readonly defaults?: unknown;
|
|
611
|
+
readonly math?: unknown;
|
|
612
|
+
}
|
|
453
613
|
interface StackDefinition {
|
|
454
614
|
readonly name: string;
|
|
455
|
-
readonly
|
|
615
|
+
readonly endpoints: StackEndpoints;
|
|
456
616
|
readonly views: Record<string, ViewGroup>;
|
|
457
617
|
readonly schemas?: Record<string, Schema<unknown>>;
|
|
458
|
-
|
|
618
|
+
readonly patchSchemas?: Record<string, Schema<unknown>>;
|
|
619
|
+
readonly queries?: Record<string, StackQueryDefinition<unknown, unknown>>;
|
|
620
|
+
readonly programs?: Record<string, ProgramSdkDefinition>;
|
|
459
621
|
}
|
|
460
622
|
interface ViewGroup {
|
|
461
623
|
state?: ViewDef<unknown, 'state'>;
|
|
@@ -535,7 +697,8 @@ interface AuthConfig {
|
|
|
535
697
|
tokenEndpointCredentials?: RequestCredentials;
|
|
536
698
|
}
|
|
537
699
|
interface AreteConfig {
|
|
538
|
-
|
|
700
|
+
/** WebSocket endpoint. `null`/omitted disables the WebSocket transport (HTTP-only mode). */
|
|
701
|
+
websocketUrl?: string | null;
|
|
539
702
|
reconnectIntervals?: number[];
|
|
540
703
|
maxReconnectAttempts?: number;
|
|
541
704
|
initialSubscriptions?: Subscription[];
|
|
@@ -673,8 +836,11 @@ declare class ConnectionManager {
|
|
|
673
836
|
private handleSocketIssueMessage;
|
|
674
837
|
private rotateConnectionForTokenRefresh;
|
|
675
838
|
private buildAuthUrl;
|
|
839
|
+
private requireWebsocketUrl;
|
|
676
840
|
private createWebSocket;
|
|
677
841
|
getState(): ConnectionState;
|
|
842
|
+
getHttpAuthToken(forceRefresh?: boolean): Promise<string | undefined>;
|
|
843
|
+
clearHttpAuthToken(): void;
|
|
678
844
|
onFrame(handler: FrameHandler): () => void;
|
|
679
845
|
onStateChange(handler: ConnectionStateCallback): () => void;
|
|
680
846
|
onSocketIssue(handler: SocketIssueCallback): () => void;
|
|
@@ -696,7 +862,7 @@ declare class ConnectionManager {
|
|
|
696
862
|
}
|
|
697
863
|
|
|
698
864
|
type UpdateCallback<T = unknown> = (viewPath: string, key: string, update: Update<T>) => void;
|
|
699
|
-
type RichUpdateCallback
|
|
865
|
+
type RichUpdateCallback<T = unknown> = (viewPath: string, key: string, update: RichUpdate<T>) => void;
|
|
700
866
|
interface StorageAdapterConfig {
|
|
701
867
|
maxEntriesPerView?: number | null;
|
|
702
868
|
}
|
|
@@ -722,7 +888,7 @@ interface StorageAdapter {
|
|
|
722
888
|
setViewConfig?(viewPath: string, config: ViewSortConfig): void;
|
|
723
889
|
getViewConfig?(viewPath: string): ViewSortConfig | undefined;
|
|
724
890
|
onUpdate(callback: UpdateCallback): () => void;
|
|
725
|
-
onRichUpdate(callback: RichUpdateCallback
|
|
891
|
+
onRichUpdate(callback: RichUpdateCallback): () => void;
|
|
726
892
|
notifyUpdate<T>(viewPath: string, key: string, update: Update<T>): void;
|
|
727
893
|
notifyRichUpdate<T>(viewPath: string, key: string, update: RichUpdate<T>): void;
|
|
728
894
|
}
|
|
@@ -739,8 +905,367 @@ declare class SubscriptionRegistry {
|
|
|
739
905
|
private makeSubKey;
|
|
740
906
|
}
|
|
741
907
|
|
|
742
|
-
interface
|
|
908
|
+
interface ChainClock {
|
|
909
|
+
slot: number;
|
|
910
|
+
epoch?: number;
|
|
911
|
+
leaderScheduleEpoch?: number;
|
|
912
|
+
unixTimestamp: number;
|
|
913
|
+
}
|
|
914
|
+
interface MintAccountInfo {
|
|
915
|
+
address: string;
|
|
916
|
+
ownerProgram: string;
|
|
917
|
+
decimals: number | null;
|
|
918
|
+
supply: string | null;
|
|
919
|
+
mintAuthority: string | null;
|
|
920
|
+
freezeAuthority: string | null;
|
|
921
|
+
}
|
|
922
|
+
interface TokenAccountInfo {
|
|
923
|
+
address: string;
|
|
924
|
+
ownerProgram: string;
|
|
925
|
+
mint: string | null;
|
|
926
|
+
owner: string | null;
|
|
927
|
+
amount: string | null;
|
|
928
|
+
uiAmountString: string | null;
|
|
929
|
+
}
|
|
930
|
+
interface TokenBalanceInfo {
|
|
931
|
+
exists: boolean;
|
|
932
|
+
address: string | null;
|
|
933
|
+
owner: string;
|
|
934
|
+
mint: string;
|
|
935
|
+
tokenProgram?: string;
|
|
936
|
+
amount: string;
|
|
937
|
+
decimals?: number | null;
|
|
938
|
+
uiAmountString?: string | null;
|
|
939
|
+
}
|
|
940
|
+
interface RawAccountInfo {
|
|
941
|
+
address: string;
|
|
942
|
+
ownerProgram: string;
|
|
943
|
+
lamports: number;
|
|
944
|
+
executable: boolean;
|
|
945
|
+
data: Uint8Array;
|
|
946
|
+
}
|
|
947
|
+
interface ChainClient {
|
|
948
|
+
exists(address: string): Promise<boolean>;
|
|
949
|
+
lamports(address: string): Promise<number>;
|
|
950
|
+
minimumBalanceForRentExemption(space: number): Promise<number>;
|
|
951
|
+
clock(): Promise<ChainClock>;
|
|
952
|
+
account(address: string): Promise<RawAccountInfo | null>;
|
|
953
|
+
mint(address: string): Promise<MintAccountInfo | null>;
|
|
954
|
+
tokenAccount(address: string): Promise<TokenAccountInfo | null>;
|
|
955
|
+
balance(input: {
|
|
956
|
+
owner: string;
|
|
957
|
+
mint: string;
|
|
958
|
+
tokenProgram?: string;
|
|
959
|
+
}): Promise<TokenBalanceInfo>;
|
|
960
|
+
}
|
|
961
|
+
type FetchLike = typeof fetch;
|
|
962
|
+
declare function deriveHttpEndpoint(wsUrl: string): string;
|
|
963
|
+
declare function createChainClient(httpBaseUrl: string, fetchImpl: FetchLike): ChainClient;
|
|
964
|
+
|
|
965
|
+
interface SignerRegistry<TSigner = unknown> {
|
|
966
|
+
register(address: string, signer: TSigner): void;
|
|
967
|
+
unregister(address: string): boolean;
|
|
968
|
+
get(address: string): TSigner | undefined;
|
|
969
|
+
has(address: string): boolean;
|
|
970
|
+
addresses(): readonly string[];
|
|
971
|
+
values(): readonly TSigner[];
|
|
972
|
+
entries(): readonly (readonly [string, TSigner])[];
|
|
973
|
+
clear(): void;
|
|
974
|
+
}
|
|
975
|
+
declare function createSignerRegistry<TSigner = unknown>(entries?: Iterable<readonly [string, TSigner]>): SignerRegistry<TSigner>;
|
|
976
|
+
|
|
977
|
+
type OperationKind = 'instruction' | 'transaction' | 'flow';
|
|
978
|
+
type NonEmptyReadonlyArray<T> = readonly [T, ...T[]];
|
|
979
|
+
type JsonPrimitive = string | number | boolean | null;
|
|
980
|
+
type JsonValue = JsonPrimitive | JsonObject | readonly JsonValue[];
|
|
981
|
+
interface JsonObject {
|
|
982
|
+
readonly [key: string]: JsonValue;
|
|
983
|
+
}
|
|
984
|
+
interface PreparedOperationDescription {
|
|
985
|
+
readonly kind: OperationKind;
|
|
986
|
+
readonly name: string;
|
|
987
|
+
readonly artifacts: JsonValue;
|
|
988
|
+
readonly transactions: readonly {
|
|
989
|
+
readonly name: string;
|
|
990
|
+
readonly requiredSignerAddresses: readonly string[];
|
|
991
|
+
readonly errors: readonly ErrorMetadata[];
|
|
992
|
+
readonly instructions: readonly {
|
|
993
|
+
readonly programId: string;
|
|
994
|
+
readonly keys: readonly {
|
|
995
|
+
readonly pubkey: string;
|
|
996
|
+
readonly isSigner: boolean;
|
|
997
|
+
readonly isWritable: boolean;
|
|
998
|
+
}[];
|
|
999
|
+
readonly data: readonly number[];
|
|
1000
|
+
}[];
|
|
1001
|
+
}[];
|
|
1002
|
+
}
|
|
1003
|
+
interface PreparedTransactionBody {
|
|
1004
|
+
readonly name: string;
|
|
1005
|
+
readonly instructions: NonEmptyReadonlyArray<BuiltInstruction>;
|
|
1006
|
+
readonly requiredSignerAddresses: readonly string[];
|
|
1007
|
+
readonly errors: readonly ErrorMetadata[];
|
|
1008
|
+
}
|
|
1009
|
+
interface OperationPlan<TArtifacts = void> {
|
|
1010
|
+
readonly name: string;
|
|
1011
|
+
readonly artifacts: TArtifacts;
|
|
1012
|
+
readonly transactions: NonEmptyReadonlyArray<PreparedTransactionBody>;
|
|
1013
|
+
}
|
|
1014
|
+
interface PreparedOperationBase<TKind extends OperationKind, TArtifacts> {
|
|
1015
|
+
readonly kind: TKind;
|
|
1016
|
+
readonly name: string;
|
|
1017
|
+
readonly plan: OperationPlan<TArtifacts>;
|
|
1018
|
+
readonly artifacts: TArtifacts;
|
|
1019
|
+
}
|
|
1020
|
+
interface PreparedInstruction<TArtifacts = void> extends PreparedOperationBase<'instruction', TArtifacts> {
|
|
1021
|
+
readonly instruction: BuiltInstruction;
|
|
1022
|
+
readonly transaction: PreparedTransactionBody;
|
|
1023
|
+
}
|
|
1024
|
+
interface PreparedTransaction<TArtifacts = void> extends PreparedOperationBase<'transaction', TArtifacts> {
|
|
1025
|
+
readonly transaction: PreparedTransactionBody;
|
|
1026
|
+
}
|
|
1027
|
+
interface PreparedFlow<TArtifacts = void> extends PreparedOperationBase<'flow', TArtifacts> {
|
|
1028
|
+
}
|
|
1029
|
+
type PreparedOperation<TArtifacts = unknown> = PreparedInstruction<TArtifacts> | PreparedTransaction<TArtifacts> | PreparedFlow<TArtifacts>;
|
|
1030
|
+
interface CreatePreparedInstructionInput<TArtifacts> {
|
|
1031
|
+
name: string;
|
|
1032
|
+
instruction: BuiltInstruction;
|
|
1033
|
+
artifacts: TArtifacts;
|
|
1034
|
+
requiredSignerAddresses?: readonly string[];
|
|
1035
|
+
errors?: readonly ErrorMetadata[];
|
|
1036
|
+
}
|
|
1037
|
+
type PreparedTransactionInstruction = BuiltInstruction | PreparedInstruction<unknown>;
|
|
1038
|
+
type PreparedTransactionOperation = PreparedInstruction<unknown> | PreparedTransaction<unknown>;
|
|
1039
|
+
interface CreatePreparedTransactionBaseInput<TArtifacts> {
|
|
1040
|
+
name: string;
|
|
1041
|
+
artifacts: TArtifacts;
|
|
1042
|
+
requiredSignerAddresses?: readonly string[];
|
|
1043
|
+
errors?: readonly ErrorMetadata[];
|
|
1044
|
+
}
|
|
1045
|
+
type CreatePreparedTransactionInput<TArtifacts> = CreatePreparedTransactionBaseInput<TArtifacts> & ({
|
|
1046
|
+
instructions: readonly PreparedTransactionInstruction[];
|
|
1047
|
+
operations?: never;
|
|
1048
|
+
} | {
|
|
1049
|
+
operations: readonly PreparedTransactionOperation[];
|
|
1050
|
+
instructions?: never;
|
|
1051
|
+
});
|
|
1052
|
+
interface CreatePreparedFlowInput<TArtifacts> {
|
|
1053
|
+
name: string;
|
|
1054
|
+
transactions: readonly PreparedTransactionBody[];
|
|
1055
|
+
artifacts: TArtifacts;
|
|
1056
|
+
}
|
|
1057
|
+
declare function createPreparedTransactionBody(input: {
|
|
1058
|
+
name: string;
|
|
1059
|
+
instructions: readonly BuiltInstruction[];
|
|
1060
|
+
requiredSignerAddresses?: readonly string[];
|
|
1061
|
+
errors?: readonly ErrorMetadata[];
|
|
1062
|
+
}): PreparedTransactionBody;
|
|
1063
|
+
declare function createPreparedInstruction<TArtifacts>(input: CreatePreparedInstructionInput<TArtifacts>): PreparedInstruction<TArtifacts>;
|
|
1064
|
+
declare function createPreparedTransaction<TArtifacts>(input: CreatePreparedTransactionInput<TArtifacts>): PreparedTransaction<TArtifacts>;
|
|
1065
|
+
declare function createPreparedFlow<TArtifacts>(input: CreatePreparedFlowInput<TArtifacts>): PreparedFlow<TArtifacts>;
|
|
1066
|
+
declare function prependTransactionInstructions(transaction: PreparedTransactionBody, instructions: readonly BuiltInstruction[]): PreparedTransactionBody;
|
|
1067
|
+
declare function appendTransactionInstructions(transaction: PreparedTransactionBody, instructions: readonly BuiltInstruction[]): PreparedTransactionBody;
|
|
1068
|
+
declare function appendFlowTransactions<TArtifacts>(flow: PreparedFlow<TArtifacts>, transactions: readonly PreparedTransactionBody[]): PreparedFlow<TArtifacts>;
|
|
1069
|
+
declare function prependFlowTransactionInstructions<TArtifacts>(flow: PreparedFlow<TArtifacts>, transactionIndex: number, instructions: readonly BuiltInstruction[]): PreparedFlow<TArtifacts>;
|
|
1070
|
+
interface OperationTransactionReceipt {
|
|
1071
|
+
readonly transactionIndex: number;
|
|
1072
|
+
readonly transactionName: string;
|
|
1073
|
+
readonly signature: string;
|
|
1074
|
+
readonly slot?: number;
|
|
1075
|
+
}
|
|
1076
|
+
interface SingleTransactionOperationReceipt<TArtifacts> {
|
|
1077
|
+
readonly kind: 'instruction' | 'transaction';
|
|
1078
|
+
readonly operationName: string;
|
|
1079
|
+
readonly artifacts: TArtifacts;
|
|
1080
|
+
readonly signatures: NonEmptyReadonlyArray<string>;
|
|
1081
|
+
readonly transaction: OperationTransactionReceipt;
|
|
1082
|
+
}
|
|
1083
|
+
interface FlowOperationReceipt<TArtifacts> {
|
|
1084
|
+
readonly kind: 'flow';
|
|
1085
|
+
readonly operationName: string;
|
|
1086
|
+
readonly artifacts: TArtifacts;
|
|
1087
|
+
readonly signatures: NonEmptyReadonlyArray<string>;
|
|
1088
|
+
readonly transactions: NonEmptyReadonlyArray<OperationTransactionReceipt>;
|
|
1089
|
+
}
|
|
1090
|
+
type OperationReceiptFor<TPrepared extends PreparedOperation> = TPrepared extends PreparedFlow<infer TArtifacts> ? FlowOperationReceipt<TArtifacts> : TPrepared extends PreparedInstruction<infer TArtifacts> ? SingleTransactionOperationReceipt<TArtifacts> : TPrepared extends PreparedTransaction<infer TArtifacts> ? SingleTransactionOperationReceipt<TArtifacts> : never;
|
|
1091
|
+
interface OperationExecutionEvent<TPrepared extends PreparedOperation = PreparedOperation> {
|
|
1092
|
+
readonly operation: TPrepared;
|
|
1093
|
+
readonly transaction: PreparedTransactionBody;
|
|
1094
|
+
readonly transactionIndex: number;
|
|
1095
|
+
}
|
|
1096
|
+
interface OperationExecutionSuccessEvent<TPrepared extends PreparedOperation = PreparedOperation> extends OperationExecutionEvent<TPrepared> {
|
|
1097
|
+
readonly receipt: OperationTransactionReceipt;
|
|
1098
|
+
}
|
|
1099
|
+
interface OperationExecutionOptions<TSigner = unknown, TPrepared extends PreparedOperation = PreparedOperation> {
|
|
1100
|
+
wallet?: WalletAdapter;
|
|
1101
|
+
send?: SendOptions;
|
|
1102
|
+
signers?: readonly TSigner[];
|
|
1103
|
+
signerRegistry?: SignerRegistry<TSigner>;
|
|
1104
|
+
availableSignerAddresses?: readonly string[];
|
|
1105
|
+
onTransactionStart?: (event: OperationExecutionEvent<TPrepared>) => void | Promise<void>;
|
|
1106
|
+
onTransactionSuccess?: (event: OperationExecutionSuccessEvent<TPrepared>) => void | Promise<void>;
|
|
1107
|
+
}
|
|
1108
|
+
interface OperationExecutionHost<TSigner = unknown> {
|
|
1109
|
+
readonly wallet?: WalletAdapter;
|
|
1110
|
+
readonly publicKey?: string;
|
|
1111
|
+
transaction(instructions: readonly BuiltInstruction[], options?: {
|
|
1112
|
+
wallet?: WalletAdapter;
|
|
1113
|
+
send?: SendOptions;
|
|
1114
|
+
errors?: ErrorMetadata[];
|
|
1115
|
+
signers?: readonly TSigner[];
|
|
1116
|
+
}): Promise<{
|
|
1117
|
+
signature: string;
|
|
1118
|
+
slot?: number;
|
|
1119
|
+
}>;
|
|
1120
|
+
}
|
|
1121
|
+
declare class OperationExecutionError<TPrepared extends PreparedOperation = PreparedOperation> extends Error {
|
|
1122
|
+
readonly operation: TPrepared;
|
|
1123
|
+
readonly failedTransaction: PreparedTransactionBody;
|
|
1124
|
+
readonly failedTransactionIndex: number;
|
|
1125
|
+
readonly completedReceipts: readonly OperationTransactionReceipt[];
|
|
1126
|
+
readonly cause: unknown;
|
|
1127
|
+
constructor(input: {
|
|
1128
|
+
operation: TPrepared;
|
|
1129
|
+
failedTransaction: PreparedTransactionBody;
|
|
1130
|
+
failedTransactionIndex: number;
|
|
1131
|
+
completedReceipts: readonly OperationTransactionReceipt[];
|
|
1132
|
+
cause: unknown;
|
|
1133
|
+
});
|
|
1134
|
+
}
|
|
1135
|
+
declare function executePreparedOperation<TPrepared extends PreparedOperation, TSigner = unknown>(host: OperationExecutionHost<TSigner>, operation: TPrepared, options?: OperationExecutionOptions<TSigner, TPrepared>): Promise<OperationReceiptFor<TPrepared>>;
|
|
1136
|
+
declare function toJsonValue(value: unknown): JsonValue;
|
|
1137
|
+
declare function describePreparedOperation(operation: PreparedOperation): PreparedOperationDescription;
|
|
1138
|
+
declare function formatPreparedOperation(operation: PreparedOperation): string;
|
|
1139
|
+
|
|
1140
|
+
interface InstructionOperation<TInput = unknown, TArtifacts = void> {
|
|
1141
|
+
readonly kind: 'instruction';
|
|
1142
|
+
prepare(input: TInput): Promise<PreparedInstruction<TArtifacts>>;
|
|
1143
|
+
}
|
|
1144
|
+
interface TransactionOperation<TInput = unknown, TArtifacts = void> {
|
|
1145
|
+
readonly kind: 'transaction';
|
|
1146
|
+
prepare(input: TInput): Promise<PreparedTransaction<TArtifacts>>;
|
|
1147
|
+
}
|
|
1148
|
+
interface FlowOperation<TInput = unknown, TArtifacts = void> {
|
|
1149
|
+
readonly kind: 'flow';
|
|
1150
|
+
prepare(input: TInput): Promise<PreparedFlow<TArtifacts>>;
|
|
1151
|
+
}
|
|
1152
|
+
type AnyOperation = InstructionOperation<any, any> | TransactionOperation<any, any> | FlowOperation<any, any>;
|
|
1153
|
+
type OperationNamespace<TOperation extends AnyOperation = AnyOperation> = {
|
|
1154
|
+
readonly [key: string]: TOperation | OperationNamespace<TOperation>;
|
|
1155
|
+
};
|
|
1156
|
+
type InstructionOperationNamespace = OperationNamespace<InstructionOperation<any, any>>;
|
|
1157
|
+
type TransactionOperationNamespace = OperationNamespace<TransactionOperation<any, any>>;
|
|
1158
|
+
type FlowOperationNamespace = OperationNamespace<FlowOperation<any, any>>;
|
|
1159
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
1160
|
+
declare function instructionOperation<TInput, TArtifacts>(prepare: (input: TInput) => MaybePromise<PreparedInstruction<TArtifacts>>): InstructionOperation<TInput, TArtifacts>;
|
|
1161
|
+
declare function transactionOperation<TInput, TArtifacts>(prepare: (input: TInput) => MaybePromise<PreparedTransaction<TArtifacts>>): TransactionOperation<TInput, TArtifacts>;
|
|
1162
|
+
declare function flowOperation<TInput, TArtifacts>(prepare: (input: TInput) => MaybePromise<PreparedFlow<TArtifacts>>): FlowOperation<TInput, TArtifacts>;
|
|
1163
|
+
|
|
1164
|
+
declare const STACK_RUNTIME_EXTENSIONS: "__areteStackRuntimeExtensions";
|
|
1165
|
+
declare const PROGRAM_OPERATION_EXTENSIONS: "__areteProgramOperationExtensions";
|
|
1166
|
+
type EmptyRecord = Record<string, never>;
|
|
1167
|
+
type MaybeField<TKey extends string, TValue> = [TValue] extends [never] ? {} : {
|
|
1168
|
+
readonly [K in TKey]: TValue;
|
|
1169
|
+
};
|
|
1170
|
+
type Field<TValue, TKey extends PropertyKey> = TKey extends keyof TValue ? TValue[TKey] : never;
|
|
1171
|
+
type DeepMerge<TBase, TExtension> = TBase extends Record<string, unknown> ? TExtension extends Record<string, unknown> ? Omit<TBase, keyof TExtension> & {
|
|
1172
|
+
readonly [K in keyof TExtension]: K extends keyof TBase ? DeepMerge<TBase[K], TExtension[K]> : TExtension[K];
|
|
1173
|
+
} : TExtension : TExtension;
|
|
1174
|
+
type MergeField<TBase, TExtension> = [TBase] extends [never] ? TExtension : [TExtension] extends [never] ? TBase : DeepMerge<TBase, TExtension>;
|
|
1175
|
+
type FactoryReturn<TValue, TKey extends PropertyKey> = TKey extends keyof TValue ? NonNullable<TValue[TKey]> extends (...args: any[]) => infer TResult ? TResult : never : never;
|
|
1176
|
+
interface ProgramOperations<TInstructions extends InstructionOperationNamespace | EmptyRecord = EmptyRecord, TTransactions extends TransactionOperationNamespace | EmptyRecord = EmptyRecord, TFlows extends FlowOperationNamespace | EmptyRecord = EmptyRecord> {
|
|
1177
|
+
readonly instructions?: TInstructions;
|
|
1178
|
+
readonly transactions?: TTransactions;
|
|
1179
|
+
readonly flows?: TFlows;
|
|
1180
|
+
}
|
|
1181
|
+
type AnyProgramOperations = ProgramOperations<InstructionOperationNamespace, TransactionOperationNamespace, FlowOperationNamespace>;
|
|
1182
|
+
type InstructionOperationsOf<TOperations> = TOperations extends ProgramOperations<infer TInstructions, any, any> ? TInstructions : EmptyRecord;
|
|
1183
|
+
type TransactionOperationsOf<TOperations> = TOperations extends ProgramOperations<any, infer TTransactions, any> ? TTransactions : EmptyRecord;
|
|
1184
|
+
type FlowOperationsOf<TOperations> = TOperations extends ProgramOperations<any, any, infer TFlows> ? TFlows : EmptyRecord;
|
|
1185
|
+
interface ProgramOperationContext<TProgram extends ProgramSdkDefinition = ProgramSdkDefinition> {
|
|
1186
|
+
readonly chain: ChainClient;
|
|
1187
|
+
readonly wallet: WalletAdapter | undefined;
|
|
1188
|
+
readonly program: ProgramInterface<TProgram>;
|
|
1189
|
+
}
|
|
1190
|
+
interface ProgramRuntimeExtensions<TOperations extends AnyProgramOperations = ProgramOperations, TProgram extends ProgramSdkDefinition = ProgramSdkDefinition> {
|
|
1191
|
+
readonly createOperations: (context: ProgramOperationContext<TProgram>) => TOperations;
|
|
1192
|
+
}
|
|
1193
|
+
interface ProgramRuntimeExtensionCarrier<TOperations extends AnyProgramOperations = ProgramOperations> {
|
|
1194
|
+
readonly [PROGRAM_OPERATION_EXTENSIONS]?: ProgramRuntimeExtensions<TOperations, any>;
|
|
1195
|
+
}
|
|
1196
|
+
type ProgramOperationsOf<TProgram> = TProgram extends ProgramRuntimeExtensionCarrier<infer TOperations> ? TOperations : ProgramOperations;
|
|
1197
|
+
type MergeProgramOperations<TBase extends AnyProgramOperations, TExtension extends AnyProgramOperations> = ProgramOperations<Extract<MergeField<InstructionOperationsOf<TBase>, InstructionOperationsOf<TExtension>>, InstructionOperationNamespace | EmptyRecord>, Extract<MergeField<TransactionOperationsOf<TBase>, TransactionOperationsOf<TExtension>>, TransactionOperationNamespace | EmptyRecord>, Extract<MergeField<FlowOperationsOf<TBase>, FlowOperationsOf<TExtension>>, FlowOperationNamespace | EmptyRecord>>;
|
|
1198
|
+
type ExtendedProgramDefinition<TBase extends ProgramSdkDefinition, TAddresses = never, TConstants = never, TDefaults = never, TOperations extends AnyProgramOperations = ProgramOperations, TMath = never> = TBase & MaybeField<'addresses', TAddresses> & MaybeField<'constants', TConstants> & MaybeField<'defaults', TDefaults> & MaybeField<'math', TMath> & ProgramRuntimeExtensionCarrier<MergeProgramOperations<ProgramOperationsOf<TBase>, TOperations>>;
|
|
1199
|
+
interface ProgramExtensionInput<TAddresses = never, TConstants = never, TDefaults = never, TOperations extends AnyProgramOperations = ProgramOperations, TProgram extends ProgramSdkDefinition = ProgramSdkDefinition, TMath = never> {
|
|
1200
|
+
readonly pdas?: Record<string, unknown>;
|
|
1201
|
+
readonly accounts?: Record<string, unknown>;
|
|
1202
|
+
readonly queries?: Record<string, unknown>;
|
|
1203
|
+
readonly raw?: Record<string, unknown>;
|
|
1204
|
+
readonly addresses?: TAddresses;
|
|
1205
|
+
readonly constants?: TConstants;
|
|
1206
|
+
readonly defaults?: TDefaults;
|
|
1207
|
+
readonly math?: TMath;
|
|
1208
|
+
readonly createOperations?: (context: ProgramOperationContext<TProgram>) => TOperations;
|
|
1209
|
+
}
|
|
1210
|
+
declare function defineProgramExtensions<TBase extends ProgramSdkDefinition>(): <TAddresses = never, TConstants = never, TDefaults = never, TOperations extends AnyProgramOperations = ProgramOperations, TMath = never>(extensions: Omit<ProgramExtensionInput<any, any, any, any, any, any>, "addresses" | "constants" | "defaults" | "math" | "createOperations"> & {
|
|
1211
|
+
readonly addresses?: TAddresses;
|
|
1212
|
+
readonly constants?: TConstants;
|
|
1213
|
+
readonly defaults?: TDefaults;
|
|
1214
|
+
readonly math?: TMath;
|
|
1215
|
+
readonly createOperations?: (context: ProgramOperationContext<ExtendedProgramDefinition<TBase, TAddresses, TConstants, TDefaults, ProgramOperations, TMath>>) => TOperations;
|
|
1216
|
+
}) => ProgramExtensionInput<TAddresses, TConstants, TDefaults, TOperations, ExtendedProgramDefinition<TBase, TAddresses, TConstants, TDefaults, ProgramOperations, TMath>, TMath>;
|
|
1217
|
+
declare function extendProgram<TBase extends ProgramSdkDefinition, TExtension extends ProgramExtensionInput<any, any, any, any, any, any>>(program: TBase, extensions: TExtension): ExtendedProgramDefinition<TBase, MergeField<Field<TBase, 'addresses'>, Field<TExtension, 'addresses'>>, MergeField<Field<TBase, 'constants'>, Field<TExtension, 'constants'>>, MergeField<Field<TBase, 'defaults'>, Field<TExtension, 'defaults'>>, Extract<FactoryReturn<TExtension, 'createOperations'>, AnyProgramOperations>, MergeField<Field<TBase, 'math'>, Field<TExtension, 'math'>>>;
|
|
1218
|
+
declare function extendPrograms<TPrograms extends Record<string, ProgramSdkDefinition>, TExtensions extends Partial<{
|
|
1219
|
+
[K in keyof TPrograms]: ProgramExtensionInput<any, any, any, any, any, any>;
|
|
1220
|
+
}>>(programs: TPrograms, extensions: TExtensions): {
|
|
1221
|
+
readonly [K in keyof TPrograms]: K extends keyof TExtensions ? NonNullable<TExtensions[K]> extends ProgramExtensionInput<infer TAddresses, infer THelpers, infer TTypes, infer TOperations, any, infer TMath> ? ExtendedProgramDefinition<TPrograms[K], TAddresses, THelpers, TTypes, TOperations, TMath> : TPrograms[K] : TPrograms[K];
|
|
1222
|
+
};
|
|
1223
|
+
declare function getProgramRuntimeExtensions<TProgram extends ProgramSdkDefinition>(program: TProgram): ProgramRuntimeExtensions<ProgramOperationsOf<TProgram>, TProgram> | undefined;
|
|
1224
|
+
interface StackRuntimeExtensions<TRead = EmptyRecord, TFlows extends FlowOperationNamespace | EmptyRecord = EmptyRecord, TClient = unknown> {
|
|
1225
|
+
readonly createRead?: (client: TClient) => TRead;
|
|
1226
|
+
readonly createFlows?: (client: TClient) => TFlows;
|
|
1227
|
+
}
|
|
1228
|
+
interface StackRuntimeExtensionCarrier<TRead = EmptyRecord, TFlows extends FlowOperationNamespace | EmptyRecord = EmptyRecord> {
|
|
1229
|
+
readonly [STACK_RUNTIME_EXTENSIONS]?: StackRuntimeExtensions<TRead, TFlows>;
|
|
1230
|
+
}
|
|
1231
|
+
type ExtendedStackDefinition<TBase extends StackDefinition, TAddresses = never, TConstants = never, TDefaults = never, TMath = never, TRead = never, TFlows extends FlowOperationNamespace | EmptyRecord = never> = TBase & MaybeField<'addresses', TAddresses> & MaybeField<'constants', TConstants> & MaybeField<'defaults', TDefaults> & MaybeField<'math', TMath> & StackRuntimeExtensionCarrier<TRead, TFlows>;
|
|
1232
|
+
type StackConnectedExtensions<TStack> = MaybeField<'addresses', Field<TStack, 'addresses'>> & MaybeField<'constants', Field<TStack, 'constants'>> & MaybeField<'defaults', Field<TStack, 'defaults'>> & MaybeField<'math', Field<TStack, 'math'>> & (TStack extends StackRuntimeExtensionCarrier<infer TRead, infer TFlows> ? MaybeField<'read', TRead> & MaybeField<'flows', TFlows> : {});
|
|
1233
|
+
type ConnectedStackClient<TClient extends object, TStack> = TClient & StackConnectedExtensions<TStack>;
|
|
1234
|
+
type StackReadOf<TStack> = TStack extends StackRuntimeExtensionCarrier<infer TRead, any> ? TRead : never;
|
|
1235
|
+
type StackFlowsOf<TStack> = TStack extends StackRuntimeExtensionCarrier<any, infer TFlows> ? TFlows : never;
|
|
1236
|
+
interface StackExtensionInput<TAddresses = never, TConstants = never, TDefaults = never, TMath = never, TRead = never, TFlows extends FlowOperationNamespace | EmptyRecord = never, TClient = unknown> {
|
|
1237
|
+
readonly addresses?: TAddresses;
|
|
1238
|
+
readonly constants?: TConstants;
|
|
1239
|
+
readonly defaults?: TDefaults;
|
|
1240
|
+
readonly math?: TMath;
|
|
1241
|
+
readonly createRead?: (client: TClient) => TRead;
|
|
1242
|
+
readonly createFlows?: (client: TClient) => TFlows;
|
|
1243
|
+
}
|
|
1244
|
+
type StackExtensionClient<TBase extends StackDefinition, TAddresses = never, TConstants = never, TDefaults = never, TMath = never> = Arete$1<TBase> & MaybeField<'addresses', TAddresses> & MaybeField<'constants', TConstants> & MaybeField<'defaults', TDefaults> & MaybeField<'math', TMath>;
|
|
1245
|
+
declare function defineStackExtensions<TBase extends StackDefinition>(): <TExtension extends StackExtensionInput<any, any, any, any, any, FlowOperationNamespace | EmptyRecord, any>>(extensions: TExtension & {
|
|
1246
|
+
readonly createRead?: (client: StackExtensionClient<TBase, any, any, any, any>) => unknown;
|
|
1247
|
+
readonly createFlows?: (client: StackExtensionClient<TBase, any, any, any, any>) => FlowOperationNamespace | EmptyRecord;
|
|
1248
|
+
}) => TExtension;
|
|
1249
|
+
declare function extendStack<TBase extends StackDefinition, TExtension extends StackExtensionInput<any, any, any, any, any, any, any>>(stack: TBase, extensions: TExtension): ExtendedStackDefinition<TBase, MergeField<Field<TBase, 'addresses'>, Field<TExtension, 'addresses'>>, MergeField<Field<TBase, 'constants'>, Field<TExtension, 'constants'>>, MergeField<Field<TBase, 'defaults'>, Field<TExtension, 'defaults'>>, MergeField<Field<TBase, 'math'>, Field<TExtension, 'math'>>, MergeField<StackReadOf<TBase>, FactoryReturn<TExtension, 'createRead'>>, Extract<MergeField<StackFlowsOf<TBase>, FactoryReturn<TExtension, 'createFlows'>>, FlowOperationNamespace | EmptyRecord>>;
|
|
1250
|
+
declare function getStackRuntimeExtensions<TStack extends StackDefinition>(stack: TStack): StackRuntimeExtensions | undefined;
|
|
1251
|
+
declare function applyConnectedStackExtensions<TClient extends object, TStack extends StackDefinition>(client: TClient, stack: TStack): ConnectedStackClient<TClient, TStack>;
|
|
1252
|
+
|
|
1253
|
+
type ProgramMap = Record<string, ProgramSdkDefinition>;
|
|
1254
|
+
type NormalizeProgramMap<TPrograms> = TPrograms extends ProgramMap ? TPrograms : Record<string, never>;
|
|
1255
|
+
type MergeProgramMaps<TStackPrograms, TAttachedPrograms> = Omit<NormalizeProgramMap<TAttachedPrograms>, keyof NormalizeProgramMap<TStackPrograms>> & NormalizeProgramMap<TStackPrograms>;
|
|
1256
|
+
type StackWithAttachedPrograms<TStack extends StackDefinition, TAttachedPrograms extends ProgramMap | undefined> = Omit<TStack, 'programs'> & {
|
|
1257
|
+
programs: MergeProgramMaps<TStack['programs'], TAttachedPrograms>;
|
|
1258
|
+
};
|
|
1259
|
+
declare function withPrograms<TStack extends StackDefinition, TAttachedPrograms extends ProgramMap | undefined>(stack: TStack, attachedPrograms: TAttachedPrograms): StackWithAttachedPrograms<TStack, TAttachedPrograms>;
|
|
1260
|
+
interface ConnectOptions<TPrograms extends ProgramMap | undefined = undefined> {
|
|
743
1261
|
url?: string;
|
|
1262
|
+
httpUrl?: string;
|
|
1263
|
+
/**
|
|
1264
|
+
* Transport mode. `'ws'` (default) opens the streaming WebSocket; `'http'`
|
|
1265
|
+
* skips the socket entirely — point reads, chain reads, and instruction
|
|
1266
|
+
* execution work, while views/subscriptions throw `WEBSOCKET_DISABLED`.
|
|
1267
|
+
*/
|
|
1268
|
+
transport?: 'ws' | 'http';
|
|
744
1269
|
storage?: StorageAdapter;
|
|
745
1270
|
maxEntriesPerView?: number | null;
|
|
746
1271
|
autoReconnect?: boolean;
|
|
@@ -750,34 +1275,148 @@ interface ConnectOptions {
|
|
|
750
1275
|
validateFrames?: boolean;
|
|
751
1276
|
/** Authentication configuration */
|
|
752
1277
|
auth?: AuthConfig;
|
|
1278
|
+
/** Default wallet adapter used for instruction execution (overridable per call). */
|
|
1279
|
+
wallet?: WalletAdapter;
|
|
1280
|
+
/** Optional fetch implementation for HTTP point reads. */
|
|
1281
|
+
fetch?: typeof fetch;
|
|
1282
|
+
/** Additional program SDKs exposed under client.programs.<key>. */
|
|
1283
|
+
programs?: TPrograms;
|
|
1284
|
+
/** Default semantic-operation execution settings. */
|
|
1285
|
+
execution?: OperationExecutionOptions<any>;
|
|
753
1286
|
}
|
|
754
1287
|
/** @deprecated Use ConnectOptions instead */
|
|
755
1288
|
interface AreteOptionsWithStorage<TStack extends StackDefinition> extends AreteOptions<TStack> {
|
|
1289
|
+
httpUrl?: string;
|
|
756
1290
|
storage?: StorageAdapter;
|
|
757
1291
|
maxEntriesPerView?: number | null;
|
|
758
1292
|
flushIntervalMs?: number;
|
|
759
1293
|
auth?: AuthConfig;
|
|
1294
|
+
wallet?: WalletAdapter;
|
|
1295
|
+
fetch?: typeof fetch;
|
|
1296
|
+
execution?: OperationExecutionOptions<any>;
|
|
1297
|
+
}
|
|
1298
|
+
interface TransactionOptions<TSigner = unknown> {
|
|
1299
|
+
wallet?: WalletAdapter;
|
|
1300
|
+
send?: SendOptions;
|
|
1301
|
+
errors?: ErrorMetadata[];
|
|
1302
|
+
signers?: readonly TSigner[];
|
|
760
1303
|
}
|
|
761
|
-
|
|
762
|
-
|
|
1304
|
+
/**
|
|
1305
|
+
* A typed, callable instruction.
|
|
1306
|
+
*
|
|
1307
|
+
* Calling it builds + signs + sends the transaction. The attached `build`
|
|
1308
|
+
* method is a pure prepare step that returns a {@link BuiltInstruction} for
|
|
1309
|
+
* batching/composition.
|
|
1310
|
+
*/
|
|
1311
|
+
interface TypedInstruction<TParams, TError> {
|
|
1312
|
+
build(params: TParams, options?: BuildOptions): BuiltInstruction;
|
|
1313
|
+
/** Phantom error type for downstream inference. */
|
|
1314
|
+
readonly _error?: TError;
|
|
763
1315
|
}
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
1316
|
+
interface TypedAccountReader<T> {
|
|
1317
|
+
fetch(address: string): Promise<T | null>;
|
|
1318
|
+
fetchMany(addresses: readonly string[]): Promise<Array<T | null>>;
|
|
1319
|
+
exists(address: string): Promise<boolean>;
|
|
1320
|
+
}
|
|
1321
|
+
type TypedQueryExecutor<TParams, TResult> = (params: TParams) => Promise<TResult>;
|
|
1322
|
+
type TypedAccountReaderFor<TEntry> = TEntry extends ProgramAccountReadDefinition<infer T> ? TypedAccountReader<T> : TypedAccountReader<unknown>;
|
|
1323
|
+
type TypedQueryFor<TEntry> = TEntry extends ProgramQueryDefinition<infer P, infer R> ? TypedQueryExecutor<P, R> : TEntry extends StackQueryDefinition<infer P, infer R> ? TypedQueryExecutor<P, R> : TypedQueryExecutor<Record<string, unknown>, unknown>;
|
|
1324
|
+
type RawInstructionsInterface<TInstructions extends Record<string, InstructionHandler<any, any>> | undefined> = TInstructions extends Record<string, InstructionHandler<any, any>> ? {
|
|
1325
|
+
[K in keyof TInstructions]: TInstructions[K] extends InstructionHandler<infer P, infer E> ? TypedInstruction<P, E> : TypedInstruction<Record<string, unknown>, unknown>;
|
|
1326
|
+
} : Record<string, never>;
|
|
1327
|
+
type ProgramAccountsInterface<TAccounts extends Record<string, ProgramAccountReadDefinition<unknown>> | undefined> = TAccounts extends Record<string, ProgramAccountReadDefinition<unknown>> ? {
|
|
1328
|
+
[K in keyof TAccounts]: TypedAccountReaderFor<TAccounts[K]>;
|
|
1329
|
+
} : Record<string, never>;
|
|
1330
|
+
type ProgramQueriesInterface<TQueries extends Record<string, ProgramQueryDefinition<unknown, unknown>> | undefined> = TQueries extends Record<string, ProgramQueryDefinition<unknown, unknown>> ? {
|
|
1331
|
+
[K in keyof TQueries]: TypedQueryFor<TQueries[K]>;
|
|
1332
|
+
} : Record<string, never>;
|
|
1333
|
+
type ProgramNamespace<TNamespace> = TNamespace extends Record<string, unknown> ? TNamespace : Record<string, never>;
|
|
1334
|
+
type OperationField<TOperations, TKey extends PropertyKey> = TKey extends keyof TOperations ? ProgramNamespace<TOperations[TKey]> : Record<string, never>;
|
|
1335
|
+
type ProgramInterface<TProgram extends ProgramSdkDefinition> = {
|
|
1336
|
+
name: TProgram['name'];
|
|
1337
|
+
programId: TProgram['programId'];
|
|
1338
|
+
schemas: TProgram['schemas'];
|
|
1339
|
+
pdas: TProgram['pdas'] extends Record<string, unknown> ? TProgram['pdas'] : Record<string, never>;
|
|
1340
|
+
accounts: ProgramAccountsInterface<TProgram['accounts']>;
|
|
1341
|
+
queries: ProgramQueriesInterface<TProgram['queries']>;
|
|
1342
|
+
raw: RawInstructionsInterface<TProgram['rawInstructions']>;
|
|
1343
|
+
addresses: ProgramNamespace<TProgram['addresses']>;
|
|
1344
|
+
constants: ProgramNamespace<TProgram['constants']>;
|
|
1345
|
+
defaults: ProgramNamespace<TProgram['defaults']>;
|
|
1346
|
+
math: ProgramNamespace<TProgram['math']>;
|
|
1347
|
+
instructions: OperationField<ProgramOperationsOf<TProgram>, 'instructions'>;
|
|
1348
|
+
transactions: OperationField<ProgramOperationsOf<TProgram>, 'transactions'>;
|
|
1349
|
+
flows: OperationField<ProgramOperationsOf<TProgram>, 'flows'>;
|
|
1350
|
+
};
|
|
1351
|
+
type ProgramsInterface<TPrograms extends Record<string, ProgramSdkDefinition> | undefined> = TPrograms extends Record<string, ProgramSdkDefinition> ? {
|
|
1352
|
+
[K in keyof TPrograms]: ProgramInterface<TPrograms[K]>;
|
|
1353
|
+
} : Record<string, never>;
|
|
1354
|
+
type QueriesInterface<TQueries extends Record<string, StackQueryDefinition<unknown, unknown>> | undefined> = TQueries extends Record<string, StackQueryDefinition<unknown, unknown>> ? {
|
|
1355
|
+
[K in keyof TQueries]: TypedQueryFor<TQueries[K]>;
|
|
1356
|
+
} : Record<string, never>;
|
|
1357
|
+
type RawProgramsInterface<TPrograms extends Record<string, ProgramSdkDefinition> | undefined> = TPrograms extends Record<string, ProgramSdkDefinition> ? {
|
|
1358
|
+
[K in keyof TPrograms]: RawInstructionsInterface<TPrograms[K]['rawInstructions']>;
|
|
1359
|
+
} : Record<string, never>;
|
|
1360
|
+
/** @deprecated Retained for backward compatibility; prefer {@link TypedInstruction}. */
|
|
1361
|
+
type InstructionExecutor = TypedInstruction<Record<string, unknown>, unknown>;
|
|
1362
|
+
type ConnectedArete<TStack extends StackDefinition, TExtensions = TStack> = Arete$1<TStack> & StackConnectedExtensions<TExtensions>;
|
|
1363
|
+
declare class Arete$1<TStack extends StackDefinition> {
|
|
769
1364
|
private readonly connection;
|
|
770
1365
|
private readonly storage;
|
|
771
1366
|
private readonly processor;
|
|
772
1367
|
private readonly subscriptionRegistry;
|
|
773
1368
|
private readonly _views;
|
|
1369
|
+
private readonly _queries;
|
|
1370
|
+
private readonly _programs;
|
|
1371
|
+
private readonly _chain;
|
|
774
1372
|
private readonly stack;
|
|
775
|
-
private readonly
|
|
1373
|
+
private readonly httpBaseUrl;
|
|
1374
|
+
private readonly fetchImpl;
|
|
1375
|
+
private readonly executionDefaults?;
|
|
1376
|
+
private _wallet?;
|
|
1377
|
+
private _aggregatedErrors?;
|
|
776
1378
|
private constructor();
|
|
777
|
-
private
|
|
778
|
-
|
|
1379
|
+
private resolveFetchImpl;
|
|
1380
|
+
private buildQueries;
|
|
1381
|
+
private buildPrograms;
|
|
1382
|
+
private createTypedInstruction;
|
|
1383
|
+
private createAccountReader;
|
|
1384
|
+
private createQueryExecutor;
|
|
1385
|
+
private readJson;
|
|
1386
|
+
private authenticatedFetch;
|
|
1387
|
+
private resolveReadUrl;
|
|
1388
|
+
/** Merge the client's default wallet into call options (call options win). */
|
|
1389
|
+
private withWallet;
|
|
1390
|
+
static connect<T extends StackDefinition, TPrograms extends ProgramMap | undefined = undefined>(stack: T, options?: ConnectOptions<TPrograms>): Promise<ConnectedArete<StackWithAttachedPrograms<T, TPrograms>, T>>;
|
|
779
1391
|
get views(): TypedViews<TStack['views']>;
|
|
780
|
-
get
|
|
1392
|
+
get queries(): QueriesInterface<TStack['queries']>;
|
|
1393
|
+
get programs(): ProgramsInterface<TStack['programs']>;
|
|
1394
|
+
get chain(): ChainClient;
|
|
1395
|
+
/** The default wallet adapter, if one was configured. */
|
|
1396
|
+
get wallet(): WalletAdapter | undefined;
|
|
1397
|
+
/** The connected wallet address, if a default wallet was configured. */
|
|
1398
|
+
get publicKey(): string | undefined;
|
|
1399
|
+
/**
|
|
1400
|
+
* Set (or clear) the default wallet adapter used for instruction execution.
|
|
1401
|
+
* Useful for connecting/disconnecting a wallet after the client is created.
|
|
1402
|
+
*/
|
|
1403
|
+
setWallet(wallet: WalletAdapter | undefined): void;
|
|
1404
|
+
/**
|
|
1405
|
+
* Sign and send a batch of pre-built instructions as a single transaction.
|
|
1406
|
+
*
|
|
1407
|
+
* Build instructions with `client.programs.<program>.raw.<name>.build(params)`
|
|
1408
|
+
* and compose them here. RPC/compilation/confirmation are owned by the adapter.
|
|
1409
|
+
*
|
|
1410
|
+
* On failure, the error is parsed against `options.errors` when given,
|
|
1411
|
+
* otherwise against error metadata aggregated from all the stack's handlers
|
|
1412
|
+
* (deduped by code, first-wins — if the stack bundles programs with
|
|
1413
|
+
* overlapping error codes, pass `options.errors` or use the per-instruction
|
|
1414
|
+
* call path for precise attribution).
|
|
1415
|
+
*/
|
|
1416
|
+
transaction(instructions: readonly BuiltInstruction[], options?: TransactionOptions): Promise<ExecutionResult>;
|
|
1417
|
+
execute<TPrepared extends PreparedOperation, TSigner = unknown>(prepared: TPrepared, options?: OperationExecutionOptions<TSigner, TPrepared>): Promise<OperationReceiptFor<TPrepared>>;
|
|
1418
|
+
/** Error metadata from every handler in the stack, deduped by code. */
|
|
1419
|
+
private aggregateErrors;
|
|
781
1420
|
get connectionState(): ConnectionState;
|
|
782
1421
|
get stackName(): string;
|
|
783
1422
|
get store(): StorageAdapter;
|
|
@@ -793,6 +1432,174 @@ declare class Arete<TStack extends StackDefinition> {
|
|
|
793
1432
|
getSubscriptionRegistry(): SubscriptionRegistry;
|
|
794
1433
|
}
|
|
795
1434
|
|
|
1435
|
+
/**
|
|
1436
|
+
* A session composes multiple stack and standalone-program SDK clients
|
|
1437
|
+
* behind one wallet and one shared endpoint configuration.
|
|
1438
|
+
*
|
|
1439
|
+
* Each member gets its own client (connection + store); a stack is itself a
|
|
1440
|
+
* composition of programs + views, and a standalone program member reuses the
|
|
1441
|
+
* exact same machinery as a stack with no views, connected HTTP-only.
|
|
1442
|
+
*/
|
|
1443
|
+
interface SessionDefinition {
|
|
1444
|
+
readonly stacks?: Record<string, StackDefinition>;
|
|
1445
|
+
readonly programs?: Record<string, ProgramSdkDefinition>;
|
|
1446
|
+
}
|
|
1447
|
+
type SessionStackPrograms<TDef extends SessionDefinition> = Partial<{
|
|
1448
|
+
[K in keyof NonNullable<TDef['stacks']>]: Record<string, ProgramSdkDefinition> | undefined;
|
|
1449
|
+
}>;
|
|
1450
|
+
type EffectiveStackPrograms<TDef extends SessionDefinition, TStackPrograms extends SessionStackPrograms<TDef>, K extends keyof NonNullable<TDef['stacks']>> = NonNullable<TDef['stacks']>[K] extends StackDefinition ? K extends keyof TStackPrograms ? StackWithAttachedPrograms<NonNullable<TDef['stacks']>[K], TStackPrograms[K]>['programs'] : NonNullable<NonNullable<TDef['stacks']>[K]['programs']> : never;
|
|
1451
|
+
type StackProgramKeys<TDef extends SessionDefinition, TStackPrograms extends SessionStackPrograms<TDef>> = {
|
|
1452
|
+
[K in keyof NonNullable<TDef['stacks']>]: keyof EffectiveStackPrograms<TDef, TStackPrograms, K>;
|
|
1453
|
+
}[keyof NonNullable<TDef['stacks']>];
|
|
1454
|
+
/** Per-member connection overrides (a subset of {@link ConnectOptions}). */
|
|
1455
|
+
interface SessionMemberOptions<TPrograms extends Record<string, ProgramSdkDefinition> | undefined = undefined> {
|
|
1456
|
+
url?: string;
|
|
1457
|
+
httpUrl?: string;
|
|
1458
|
+
transport?: 'ws' | 'http';
|
|
1459
|
+
auth?: AuthConfig;
|
|
1460
|
+
storage?: StorageAdapter;
|
|
1461
|
+
autoReconnect?: boolean;
|
|
1462
|
+
programs?: TPrograms;
|
|
1463
|
+
}
|
|
1464
|
+
interface SessionOptions<TDef extends SessionDefinition = SessionDefinition, TStackPrograms extends SessionStackPrograms<TDef> = {}> {
|
|
1465
|
+
/** One wallet governs execution across every member. */
|
|
1466
|
+
wallet?: WalletAdapter;
|
|
1467
|
+
/** Canonical chain reader shared by the session when explicitly provided. */
|
|
1468
|
+
chain?: ChainClient;
|
|
1469
|
+
auth?: AuthConfig;
|
|
1470
|
+
fetch?: typeof fetch;
|
|
1471
|
+
/** Default transport for all members ('ws' unless overridden). */
|
|
1472
|
+
transport?: 'ws' | 'http';
|
|
1473
|
+
/** Shared fallback endpoints used when a member defines none of its own. */
|
|
1474
|
+
endpoints?: {
|
|
1475
|
+
http?: string;
|
|
1476
|
+
ws?: string;
|
|
1477
|
+
};
|
|
1478
|
+
/** Default execution settings shared by transaction/plan helpers on the session. */
|
|
1479
|
+
execution?: OperationExecutionOptions<any>;
|
|
1480
|
+
/** Signers available to every transaction executed through this session. */
|
|
1481
|
+
signerRegistry?: SignerRegistry<any>;
|
|
1482
|
+
/** Per-member overrides, keyed by the member's key in the definition. */
|
|
1483
|
+
stacks?: {
|
|
1484
|
+
[K in keyof NonNullable<TDef['stacks']>]?: SessionMemberOptions<K extends keyof TStackPrograms ? TStackPrograms[K] : undefined>;
|
|
1485
|
+
};
|
|
1486
|
+
programs?: Record<string, SessionMemberOptions>;
|
|
1487
|
+
}
|
|
1488
|
+
type SessionStacks<TDef extends SessionDefinition, TStackPrograms extends SessionStackPrograms<TDef> = {}> = {
|
|
1489
|
+
readonly [K in keyof NonNullable<TDef['stacks']>]: NonNullable<TDef['stacks']>[K] extends StackDefinition ? K extends keyof TStackPrograms ? ConnectedArete<StackWithAttachedPrograms<NonNullable<TDef['stacks']>[K], TStackPrograms[K]>, NonNullable<TDef['stacks']>[K]> : ConnectedArete<NonNullable<TDef['stacks']>[K], NonNullable<TDef['stacks']>[K]> : never;
|
|
1490
|
+
};
|
|
1491
|
+
type StackProgramInterfaceForKey<TDef extends SessionDefinition, TStackPrograms extends SessionStackPrograms<TDef>, P extends PropertyKey> = {
|
|
1492
|
+
[K in keyof NonNullable<TDef['stacks']>]: P extends keyof SessionStacks<TDef, TStackPrograms>[K]['programs'] ? SessionStacks<TDef, TStackPrograms>[K]['programs'][P] : never;
|
|
1493
|
+
}[keyof NonNullable<TDef['stacks']>];
|
|
1494
|
+
type PromotedSessionPrograms<TDef extends SessionDefinition, TStackPrograms extends SessionStackPrograms<TDef>> = {
|
|
1495
|
+
readonly [P in StackProgramKeys<TDef, TStackPrograms>]: StackProgramInterfaceForKey<TDef, TStackPrograms, P>;
|
|
1496
|
+
};
|
|
1497
|
+
type ExplicitSessionPrograms<TDef extends SessionDefinition> = {
|
|
1498
|
+
readonly [K in keyof NonNullable<TDef['programs']>]: NonNullable<TDef['programs']>[K] extends ProgramSdkDefinition ? ProgramInterface<NonNullable<TDef['programs']>[K]> : never;
|
|
1499
|
+
};
|
|
1500
|
+
type SessionPrograms<TDef extends SessionDefinition, TStackPrograms extends SessionStackPrograms<TDef> = {}> = Omit<PromotedSessionPrograms<TDef, TStackPrograms>, keyof NonNullable<TDef['programs']>> & ExplicitSessionPrograms<TDef>;
|
|
1501
|
+
interface Session<TDef extends SessionDefinition = SessionDefinition, TStackPrograms extends SessionStackPrograms<TDef> = {}> {
|
|
1502
|
+
readonly stacks: SessionStacks<TDef, TStackPrograms>;
|
|
1503
|
+
readonly programs: SessionPrograms<TDef, TStackPrograms>;
|
|
1504
|
+
readonly wallet: WalletAdapter | undefined;
|
|
1505
|
+
readonly signerRegistry: SignerRegistry<any>;
|
|
1506
|
+
readonly chain: ChainClient;
|
|
1507
|
+
transaction(instructions: readonly BuiltInstruction[], options?: TransactionOptions): Promise<ExecutionResult>;
|
|
1508
|
+
execute<TPrepared extends PreparedOperation, TSigner = unknown>(prepared: TPrepared, options?: OperationExecutionOptions<TSigner, TPrepared>): Promise<OperationReceiptFor<TPrepared>>;
|
|
1509
|
+
setWallet(wallet: WalletAdapter | undefined): void;
|
|
1510
|
+
close(): void;
|
|
1511
|
+
}
|
|
1512
|
+
declare function createSession<TDef extends SessionDefinition, TStackPrograms extends SessionStackPrograms<TDef> = {}>(definition: TDef, options?: SessionOptions<TDef, TStackPrograms>): Promise<Session<TDef, TStackPrograms>>;
|
|
1513
|
+
|
|
1514
|
+
interface AccountLoader {
|
|
1515
|
+
getAccount(address: string): Promise<{
|
|
1516
|
+
data: Uint8Array;
|
|
1517
|
+
} | null>;
|
|
1518
|
+
}
|
|
1519
|
+
declare function chainAccountLoader(chain: ChainClient): AccountLoader;
|
|
1520
|
+
|
|
1521
|
+
declare const SPL_TOKEN_PROGRAM_ADDRESS = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
1522
|
+
declare const TOKEN_2022_PROGRAM_ADDRESS = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
|
|
1523
|
+
declare const ASSOCIATED_TOKEN_PROGRAM_ADDRESS = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
1524
|
+
declare const SYSTEM_PROGRAM_ADDRESS = "11111111111111111111111111111111";
|
|
1525
|
+
declare function resolveTokenProgramAddress(chain: ChainClient, mint: string, override?: string): Promise<string>;
|
|
1526
|
+
declare function deriveAssociatedTokenAccount(input: {
|
|
1527
|
+
owner: string;
|
|
1528
|
+
mint: string;
|
|
1529
|
+
tokenProgram?: string;
|
|
1530
|
+
}): string;
|
|
1531
|
+
|
|
1532
|
+
/**
|
|
1533
|
+
* A token amount expressed either in UI units (human decimal string/number)
|
|
1534
|
+
* or raw base units. A bare bigint is treated as raw.
|
|
1535
|
+
*/
|
|
1536
|
+
type AmountInput = bigint | {
|
|
1537
|
+
ui: string | number;
|
|
1538
|
+
} | {
|
|
1539
|
+
raw: bigint | string | number;
|
|
1540
|
+
};
|
|
1541
|
+
interface AmountResolutionInput {
|
|
1542
|
+
mint: string;
|
|
1543
|
+
amount: AmountInput;
|
|
1544
|
+
decimals?: number;
|
|
1545
|
+
}
|
|
1546
|
+
/** Convert a UI amount ("1.5") to raw base units using string math (no float precision loss). */
|
|
1547
|
+
declare function parseUiAmountToRaw(value: string | number, decimals: number): bigint;
|
|
1548
|
+
/** Format raw base units as a UI decimal string (inverse of {@link parseUiAmountToRaw}). */
|
|
1549
|
+
declare function formatRawToUi(raw: bigint | string | number, decimals: number): string;
|
|
1550
|
+
/** Resolve an {@link AmountInput} to raw base units with known decimals. */
|
|
1551
|
+
declare function toRawAmount(amount: AmountInput, decimals: number): bigint;
|
|
1552
|
+
/** Fetch a mint's decimals via the chain read endpoint, throwing when unavailable. */
|
|
1553
|
+
declare function getMintDecimals(chain: ChainClient, mint: string): Promise<number>;
|
|
1554
|
+
/**
|
|
1555
|
+
* Resolve an {@link AmountInput} to raw base units, fetching the mint's
|
|
1556
|
+
* decimals only when they are unknown and actually needed (a bare bigint or
|
|
1557
|
+
* `{raw}` input with explicit `decimals` never touches the network).
|
|
1558
|
+
*/
|
|
1559
|
+
declare function resolveAmount(chain: ChainClient, input: AmountResolutionInput): Promise<{
|
|
1560
|
+
raw: bigint;
|
|
1561
|
+
decimals: number;
|
|
1562
|
+
}>;
|
|
1563
|
+
/**
|
|
1564
|
+
* Resolve an {@link AmountInput} to raw base units without forcing a decimals
|
|
1565
|
+
* fetch when the input is already expressed in raw units.
|
|
1566
|
+
*/
|
|
1567
|
+
declare function resolveAmountToRaw(chain: ChainClient, input: AmountResolutionInput): Promise<bigint>;
|
|
1568
|
+
/** Resolve a named set of {@link AmountInput} values to raw base units. */
|
|
1569
|
+
declare function resolveAmountsToRaw<TInputs extends Record<string, AmountResolutionInput>>(chain: ChainClient, inputs: TInputs): Promise<{
|
|
1570
|
+
[K in keyof TInputs]: bigint;
|
|
1571
|
+
}>;
|
|
1572
|
+
|
|
1573
|
+
declare class ReadRequestError extends Error {
|
|
1574
|
+
readonly status: number;
|
|
1575
|
+
readonly path: string;
|
|
1576
|
+
readonly body: string;
|
|
1577
|
+
readonly serverErrorCode: string | undefined;
|
|
1578
|
+
constructor(input: {
|
|
1579
|
+
status: number;
|
|
1580
|
+
path: string;
|
|
1581
|
+
body: string;
|
|
1582
|
+
serverErrorCode?: string;
|
|
1583
|
+
});
|
|
1584
|
+
}
|
|
1585
|
+
declare function programAccountRead<T>(input: {
|
|
1586
|
+
account: string;
|
|
1587
|
+
path: string;
|
|
1588
|
+
schema?: Schema<T>;
|
|
1589
|
+
}): ProgramAccountReadDefinition<T>;
|
|
1590
|
+
declare function programQuery<TParams = unknown, TResult = unknown>(input: {
|
|
1591
|
+
name: string;
|
|
1592
|
+
path: string;
|
|
1593
|
+
method?: ReadTransportMethod;
|
|
1594
|
+
schema?: Schema<TResult>;
|
|
1595
|
+
}): ProgramQueryDefinition<TParams, TResult>;
|
|
1596
|
+
declare function stackQuery<TParams = unknown, TResult = unknown>(input: {
|
|
1597
|
+
name: string;
|
|
1598
|
+
path: string;
|
|
1599
|
+
method?: ReadTransportMethod;
|
|
1600
|
+
schema?: Schema<TResult>;
|
|
1601
|
+
}): StackQueryDefinition<TParams, TResult>;
|
|
1602
|
+
|
|
796
1603
|
interface FrameProcessorConfig {
|
|
797
1604
|
maxEntriesPerView?: number | null;
|
|
798
1605
|
/**
|
|
@@ -805,18 +1612,28 @@ interface FrameProcessorConfig {
|
|
|
805
1612
|
*/
|
|
806
1613
|
flushIntervalMs?: number;
|
|
807
1614
|
schemas?: Record<string, Schema<unknown>>;
|
|
1615
|
+
patchSchemas?: Record<string, Schema<unknown>>;
|
|
808
1616
|
}
|
|
809
1617
|
declare class FrameProcessor {
|
|
810
1618
|
private storage;
|
|
811
1619
|
private maxEntriesPerView;
|
|
812
1620
|
private flushIntervalMs;
|
|
813
1621
|
private schemas?;
|
|
1622
|
+
private patchSchemas?;
|
|
814
1623
|
private pendingUpdates;
|
|
815
1624
|
private flushTimer;
|
|
816
1625
|
private isProcessing;
|
|
817
1626
|
constructor(storage: StorageAdapter, config?: FrameProcessorConfig);
|
|
818
1627
|
private getSchema;
|
|
819
|
-
private
|
|
1628
|
+
private normalizeEntity;
|
|
1629
|
+
private hasSchema;
|
|
1630
|
+
private normalizePathSegment;
|
|
1631
|
+
private normalizePath;
|
|
1632
|
+
private normalizeSortConfig;
|
|
1633
|
+
private normalizeAppendPaths;
|
|
1634
|
+
private extractSeq;
|
|
1635
|
+
private getInternalSeq;
|
|
1636
|
+
private attachInternalSeq;
|
|
820
1637
|
handleFrame<T>(frame: Frame<T>): void;
|
|
821
1638
|
/**
|
|
822
1639
|
* Immediately flush all pending updates.
|
|
@@ -840,45 +1657,6 @@ declare class FrameProcessor {
|
|
|
840
1657
|
private enforceMaxEntries;
|
|
841
1658
|
}
|
|
842
1659
|
|
|
843
|
-
interface EntityStoreConfig {
|
|
844
|
-
maxEntriesPerView?: number | null;
|
|
845
|
-
}
|
|
846
|
-
interface ViewConfig {
|
|
847
|
-
sort?: SortConfig;
|
|
848
|
-
}
|
|
849
|
-
type EntityUpdateCallback = (viewPath: string, key: string, update: Update<unknown>) => void;
|
|
850
|
-
type RichUpdateCallback = (viewPath: string, key: string, update: RichUpdate<unknown>) => void;
|
|
851
|
-
declare class EntityStore {
|
|
852
|
-
private views;
|
|
853
|
-
private viewConfigs;
|
|
854
|
-
private updateCallbacks;
|
|
855
|
-
private richUpdateCallbacks;
|
|
856
|
-
private maxEntriesPerView;
|
|
857
|
-
constructor(config?: EntityStoreConfig);
|
|
858
|
-
private enforceMaxEntries;
|
|
859
|
-
handleFrame<T>(frame: Frame<T>): void;
|
|
860
|
-
private handleSubscribedFrame;
|
|
861
|
-
private handleSnapshotFrame;
|
|
862
|
-
private handleEntityFrame;
|
|
863
|
-
getAll<T>(viewPath: string): T[];
|
|
864
|
-
get<T>(viewPath: string, key: string): T | null;
|
|
865
|
-
getAllSync<T>(viewPath: string): T[] | undefined;
|
|
866
|
-
getSync<T>(viewPath: string, key: string): T | null | undefined;
|
|
867
|
-
keys(viewPath: string): string[];
|
|
868
|
-
size(viewPath: string): number;
|
|
869
|
-
clear(): void;
|
|
870
|
-
clearView(viewPath: string): void;
|
|
871
|
-
getViewConfig(viewPath: string): ViewConfig | undefined;
|
|
872
|
-
setViewConfig(viewPath: string, config: ViewConfig): void;
|
|
873
|
-
onUpdate(callback: EntityUpdateCallback): UnsubscribeFn;
|
|
874
|
-
onRichUpdate(callback: RichUpdateCallback): UnsubscribeFn;
|
|
875
|
-
subscribe<T>(viewPath: string, callback: SubscribeCallback<T>): UnsubscribeFn;
|
|
876
|
-
subscribeToKey<T>(viewPath: string, key: string, callback: SubscribeCallback<T>): UnsubscribeFn;
|
|
877
|
-
private notifyUpdate;
|
|
878
|
-
private notifyRichUpdate;
|
|
879
|
-
private notifyRichDelete;
|
|
880
|
-
}
|
|
881
|
-
|
|
882
1660
|
declare class MemoryAdapter implements StorageAdapter {
|
|
883
1661
|
private views;
|
|
884
1662
|
private updateCallbacks;
|
|
@@ -896,7 +1674,7 @@ declare class MemoryAdapter implements StorageAdapter {
|
|
|
896
1674
|
clear(viewPath?: string): void;
|
|
897
1675
|
evictOldest(viewPath: string): string | undefined;
|
|
898
1676
|
onUpdate(callback: UpdateCallback): () => void;
|
|
899
|
-
onRichUpdate(callback: RichUpdateCallback
|
|
1677
|
+
onRichUpdate(callback: RichUpdateCallback): () => void;
|
|
900
1678
|
notifyUpdate<T>(viewPath: string, key: string, update: Update<T>): void;
|
|
901
1679
|
notifyRichUpdate<T>(viewPath: string, key: string, update: RichUpdate<T>): void;
|
|
902
1680
|
}
|
|
@@ -909,5 +1687,9 @@ declare function createTypedStateView<T>(viewDef: ViewDef<T, 'state'>, storage:
|
|
|
909
1687
|
declare function createTypedListView<T>(viewDef: ViewDef<T, 'list'>, storage: StorageAdapter, subscriptionRegistry: SubscriptionRegistry): TypedListView<T>;
|
|
910
1688
|
declare function createTypedViews<TStack extends StackDefinition>(stack: TStack, storage: StorageAdapter, subscriptionRegistry: SubscriptionRegistry): TypedViews<TStack['views']>;
|
|
911
1689
|
|
|
912
|
-
|
|
913
|
-
|
|
1690
|
+
declare const Arete: typeof Arete$1 & {
|
|
1691
|
+
session: typeof createSession;
|
|
1692
|
+
};
|
|
1693
|
+
|
|
1694
|
+
export { ASSOCIATED_TOKEN_PROGRAM_ADDRESS, Arete, AreteError, ConnectionManager, DEFAULT_CONFIG, DEFAULT_MAX_ENTRIES_PER_VIEW, FrameProcessor, InstructionError, MemoryAdapter, OperationExecutionError, PROGRAM_OPERATION_EXTENSIONS, ReadRequestError, SPL_TOKEN_PROGRAM_ADDRESS, STACK_RUNTIME_EXTENSIONS, SYSTEM_PROGRAM_ADDRESS, SubscriptionRegistry, TOKEN_2022_PROGRAM_ADDRESS, account, appendFlowTransactions, appendTransactionInstructions, applyConnectedStackExtensions, arg, buildInstruction, bytes, chainAccountLoader, createChainClient, createEntityStream, createInstructionExecutor, createInstructionHandler, createPreparedFlow, createPreparedInstruction, createPreparedTransaction, createPreparedTransactionBody, createProgramPdas, createPublicKeySeed, createRichUpdateStream, createSeed, createSession, createSignerRegistry, createTypedListView, createTypedStateView, createTypedViews, createUpdateStream, decodeBase58, defineProgramExtensions, defineStackExtensions, deriveAssociatedTokenAccount, deriveHttpEndpoint, findProgramAddress as derivePda, describePreparedOperation, encodeBase58, executeInstruction, executePreparedOperation, extendProgram, extendPrograms, extendStack, findProgramAddress, findProgramAddressSync, flowOperation, formatPreparedOperation, formatProgramError, formatRawToUi, getMintDecimals, getProgramRuntimeExtensions, getStackRuntimeExtensions, instructionOperation, isEntityFrame, isSnapshotFrame, isSubscribedFrame, isValidFrame, literal, parseFrame, parseFrameFromBlob, parseInstructionError, parseUiAmountToRaw, pda, prependFlowTransactionInstructions, prependTransactionInstructions, programAccountRead, programQuery, resolveAccounts, resolveAmount, resolveAmountToRaw, resolveAmountsToRaw, resolveTokenProgramAddress, serializeInstructionData, stackQuery, toJsonValue, toRawAmount, transactionOperation, validateAccountResolution, withPrograms };
|
|
1695
|
+
export type { AccountCategory, AccountLoader, AccountMeta, AccountResolutionOptions, AccountResolutionResult, AmountInput, AnyOperation, AreteConfig, AreteOptions, AreteOptionsWithStorage, ArgSchema, ArgType, AuthConfig, AuthTokenResult, BuildOptions, BuiltAccountMeta, BuiltInstruction, ChainClient, ChainClock, ConfirmationLevel, ConnectOptions, ConnectedArete, ConnectedStackClient, ConnectionState, ConnectionStateCallback, CreatePreparedFlowInput, CreatePreparedInstructionInput, CreatePreparedTransactionInput, EntityFrame, ErrorMetadata, ExecuteOptions, ExecutionResult, ExtendedProgramDefinition, ExtendedStackDefinition, FlowOperation, FlowOperationNamespace, FlowOperationReceipt, Frame, FrameMode, FrameOp, FrameProcessorConfig, InstructionExecutor, InstructionHandler, InstructionHandlerConfig, InstructionOperation, InstructionOperationNamespace, JsonObject, JsonPrimitive, JsonValue, MergeProgramMaps, MintAccountInfo, NonEmptyReadonlyArray, OperationExecutionEvent, OperationExecutionHost, OperationExecutionOptions, OperationExecutionSuccessEvent, OperationKind, OperationNamespace, OperationPlan, OperationReceiptFor, OperationTransactionReceipt, PdaConfig, PdaDeriveContext, PdaFactory, PdaSeed, PreparedFlow, PreparedInstruction, PreparedOperation, PreparedOperationDescription, PreparedTransaction, PreparedTransactionBody, PreparedTransactionInstruction, PreparedTransactionOperation, ProgramAccountReadDefinition, ProgramError, ProgramExtensionInput, ProgramInterface, ProgramOperationContext, ProgramOperations, ProgramOperationsOf, ProgramPdas, ProgramQueryDefinition, ProgramRuntimeExtensionCarrier, ProgramRuntimeExtensions, ProgramSdkDefinition, ProgramsInterface, QueriesInterface, RawAccountInfo, RawInstructionsInterface, RawProgramsInterface, ReadTransportMethod, ResolvedAccount, ResolvedAccounts, RichUpdate, RichUpdateCallback, Schema, SchemaResult, SeedDef, SendOptions, SendResult, Session, SessionDefinition, SessionMemberOptions, SessionOptions, SignerRegistry, SingleTransactionOperationReceipt, SnapshotEntity, SnapshotFrame, SocketIssue, SocketIssueCallback, SortConfig, SortOrder, StackConnectedExtensions, StackDefinition, StackEndpoints, StackExtensionClient, StackExtensionInput, StackQueryDefinition, StackRuntimeExtensionCarrier, StackRuntimeExtensions, StackWithAttachedPrograms, StorageAdapter, StorageAdapterConfig, SubscribeCallback, SubscribedFrame, Subscription, TokenAccountInfo, TokenBalanceInfo, TransactionOperation, TransactionOperationNamespace, TransactionOptions, TypedAccountReader, TypedInstruction, TypedListView, TypedQueryExecutor, TypedStateView, TypedViewGroup, TypedViews, UnsubscribeFn, Update, UpdateCallback, ViewDef, ViewGroup, ViewSortConfig, WalletAdapter, WalletConnectOptions, WalletState, WatchOptions, WebSocketFactoryInit };
|