hyperstack-typescript 0.3.14 → 0.3.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +397 -13
- package/dist/index.esm.js +606 -24
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +617 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,363 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wallet adapter interface for signing and sending transactions.
|
|
3
|
+
* This is framework-agnostic and can be implemented by any wallet provider.
|
|
4
|
+
*/
|
|
5
|
+
interface WalletAdapter {
|
|
6
|
+
/** The wallet's public key as a base58-encoded string */
|
|
7
|
+
publicKey: string;
|
|
8
|
+
/**
|
|
9
|
+
* Sign and send a transaction.
|
|
10
|
+
* @param transaction - The transaction to sign and send (can be raw bytes, a Transaction object, or an array of instructions)
|
|
11
|
+
* @returns The transaction signature
|
|
12
|
+
*/
|
|
13
|
+
signAndSend: (transaction: unknown) => Promise<string>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Wallet connection state
|
|
17
|
+
*/
|
|
18
|
+
type WalletState = 'disconnected' | 'connecting' | 'connected' | 'error';
|
|
19
|
+
/**
|
|
20
|
+
* Options for wallet connection
|
|
21
|
+
*/
|
|
22
|
+
interface WalletConnectOptions {
|
|
23
|
+
/** Whether to use the default wallet selection UI if multiple wallets are available */
|
|
24
|
+
useDefaultSelector?: boolean;
|
|
25
|
+
/** Specific wallet provider to use */
|
|
26
|
+
provider?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Categories of accounts in an instruction.
|
|
31
|
+
* - `signer`: Must sign the transaction (e.g., user wallet)
|
|
32
|
+
* - `known`: Program-derived addresses with fixed known addresses (e.g., System Program)
|
|
33
|
+
* - `pda`: Program-derived addresses computed from seeds
|
|
34
|
+
* - `userProvided`: Must be provided by the caller (e.g., mint, bonding curve)
|
|
35
|
+
*/
|
|
36
|
+
type AccountCategory = 'signer' | 'known' | 'pda' | 'userProvided';
|
|
37
|
+
/**
|
|
38
|
+
* Metadata for a single account in an instruction.
|
|
39
|
+
*/
|
|
40
|
+
interface AccountMeta {
|
|
41
|
+
/** Account name (e.g., "user", "mint") */
|
|
42
|
+
name: string;
|
|
43
|
+
/** Whether this account must sign the transaction */
|
|
44
|
+
isSigner: boolean;
|
|
45
|
+
/** Whether this account is writable */
|
|
46
|
+
isWritable: boolean;
|
|
47
|
+
/** Category of this account */
|
|
48
|
+
category: AccountCategory;
|
|
49
|
+
/** Fixed address for "known" accounts (e.g., "11111111111111111111111111111111") */
|
|
50
|
+
knownAddress?: string;
|
|
51
|
+
/** PDA configuration for "pda" accounts */
|
|
52
|
+
pdaConfig?: PdaConfig;
|
|
53
|
+
/** Whether this account is optional */
|
|
54
|
+
isOptional?: boolean;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Configuration for PDA (Program-Derived Address) derivation.
|
|
58
|
+
*/
|
|
59
|
+
interface PdaConfig {
|
|
60
|
+
/** Program ID that owns this PDA (defaults to instruction's programId) */
|
|
61
|
+
programId?: string;
|
|
62
|
+
/** Seed definitions for PDA derivation */
|
|
63
|
+
seeds: PdaSeed[];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Single seed in a PDA derivation.
|
|
67
|
+
*/
|
|
68
|
+
type PdaSeed = {
|
|
69
|
+
type: 'literal';
|
|
70
|
+
value: string;
|
|
71
|
+
} | {
|
|
72
|
+
type: 'argRef';
|
|
73
|
+
argName: string;
|
|
74
|
+
} | {
|
|
75
|
+
type: 'accountRef';
|
|
76
|
+
accountName: string;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Resolved account with its final address.
|
|
80
|
+
*/
|
|
81
|
+
interface ResolvedAccount {
|
|
82
|
+
/** Account name */
|
|
83
|
+
name: string;
|
|
84
|
+
/** The resolved public key address */
|
|
85
|
+
address: string;
|
|
86
|
+
/** Whether this account must sign */
|
|
87
|
+
isSigner: boolean;
|
|
88
|
+
/** Whether this account is writable */
|
|
89
|
+
isWritable: boolean;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Result of account resolution.
|
|
93
|
+
*/
|
|
94
|
+
interface AccountResolutionResult {
|
|
95
|
+
/** All resolved accounts */
|
|
96
|
+
accounts: ResolvedAccount[];
|
|
97
|
+
/** Accounts that need to be provided by the user */
|
|
98
|
+
missingUserAccounts: string[];
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Options for account resolution.
|
|
102
|
+
*/
|
|
103
|
+
interface AccountResolutionOptions {
|
|
104
|
+
/** User-provided account addresses */
|
|
105
|
+
accounts?: Record<string, string>;
|
|
106
|
+
/** Wallet adapter for signer accounts */
|
|
107
|
+
wallet?: WalletAdapter;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Resolves instruction accounts by categorizing and deriving addresses.
|
|
111
|
+
*
|
|
112
|
+
* @param accountMetas - Account metadata from the instruction definition
|
|
113
|
+
* @param args - Instruction arguments (used for PDA derivation)
|
|
114
|
+
* @param options - Resolution options including wallet and user-provided accounts
|
|
115
|
+
* @returns Resolved accounts and any missing required accounts
|
|
116
|
+
*/
|
|
117
|
+
declare function resolveAccounts(accountMetas: AccountMeta[], args: Record<string, unknown>, options: AccountResolutionOptions): AccountResolutionResult;
|
|
118
|
+
/**
|
|
119
|
+
* Validates that all required accounts are present.
|
|
120
|
+
*
|
|
121
|
+
* @param result - Account resolution result
|
|
122
|
+
* @throws Error if any required accounts are missing
|
|
123
|
+
*/
|
|
124
|
+
declare function validateAccountResolution(result: AccountResolutionResult): void;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Derives a Program-Derived Address (PDA) from seeds and program ID.
|
|
128
|
+
*
|
|
129
|
+
* This function implements PDA derivation using the Solana algorithm:
|
|
130
|
+
* 1. Concatenate all seeds
|
|
131
|
+
* 2. Hash with SHA-256
|
|
132
|
+
* 3. Check if result is off-curve (valid PDA)
|
|
133
|
+
*
|
|
134
|
+
* Note: This is a placeholder implementation. In production, you would use
|
|
135
|
+
* the actual Solana web3.js library's PDA derivation.
|
|
136
|
+
*
|
|
137
|
+
* @param seeds - Array of seed buffers
|
|
138
|
+
* @param programId - The program ID (as base58 string)
|
|
139
|
+
* @returns The derived PDA address (base58 string)
|
|
140
|
+
*/
|
|
141
|
+
declare function derivePda(seeds: Buffer[], programId: string): Promise<string>;
|
|
142
|
+
/**
|
|
143
|
+
* Creates a seed buffer from various input types.
|
|
144
|
+
*
|
|
145
|
+
* @param value - The value to convert to a seed
|
|
146
|
+
* @returns Buffer suitable for PDA derivation
|
|
147
|
+
*/
|
|
148
|
+
declare function createSeed(value: string | Buffer | Uint8Array | bigint): Buffer;
|
|
149
|
+
/**
|
|
150
|
+
* Creates a public key seed from a base58-encoded address.
|
|
151
|
+
*
|
|
152
|
+
* @param address - Base58-encoded public key
|
|
153
|
+
* @returns 32-byte buffer
|
|
154
|
+
*/
|
|
155
|
+
declare function createPublicKeySeed(address: string): Buffer;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Borsh-compatible instruction data serializer.
|
|
159
|
+
*
|
|
160
|
+
* This module handles serializing instruction arguments into the binary format
|
|
161
|
+
* expected by Solana programs using Borsh serialization.
|
|
162
|
+
*/
|
|
163
|
+
/**
|
|
164
|
+
* Instruction argument schema for serialization.
|
|
165
|
+
*/
|
|
166
|
+
interface ArgSchema {
|
|
167
|
+
/** Argument name */
|
|
168
|
+
name: string;
|
|
169
|
+
/** Argument type */
|
|
170
|
+
type: ArgType;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Supported argument types for Borsh serialization.
|
|
174
|
+
*/
|
|
175
|
+
type ArgType = 'u8' | 'u16' | 'u32' | 'u64' | 'u128' | 'i8' | 'i16' | 'i32' | 'i64' | 'i128' | 'bool' | 'string' | 'pubkey' | {
|
|
176
|
+
vec: ArgType;
|
|
177
|
+
} | {
|
|
178
|
+
option: ArgType;
|
|
179
|
+
} | {
|
|
180
|
+
array: [ArgType, number];
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* Serializes instruction arguments into a Buffer using Borsh encoding.
|
|
184
|
+
*
|
|
185
|
+
* @param discriminator - The 8-byte instruction discriminator
|
|
186
|
+
* @param args - Arguments to serialize
|
|
187
|
+
* @param schema - Schema defining argument types
|
|
188
|
+
* @returns Serialized instruction data
|
|
189
|
+
*/
|
|
190
|
+
declare function serializeInstructionData(discriminator: Uint8Array, args: Record<string, unknown>, schema: ArgSchema[]): Buffer;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Confirmation level for transaction processing.
|
|
194
|
+
* - `processed`: Transaction processed but not confirmed
|
|
195
|
+
* - `confirmed`: Transaction confirmed by cluster
|
|
196
|
+
* - `finalized`: Transaction finalized (recommended for production)
|
|
197
|
+
*/
|
|
198
|
+
type ConfirmationLevel = 'processed' | 'confirmed' | 'finalized';
|
|
199
|
+
/**
|
|
200
|
+
* Options for executing an instruction.
|
|
201
|
+
*/
|
|
202
|
+
interface ExecuteOptions {
|
|
203
|
+
/** Wallet adapter for signing */
|
|
204
|
+
wallet?: WalletAdapter;
|
|
205
|
+
/** User-provided account addresses */
|
|
206
|
+
accounts?: Record<string, string>;
|
|
207
|
+
/** Confirmation level to wait for */
|
|
208
|
+
confirmationLevel?: ConfirmationLevel;
|
|
209
|
+
/** Maximum time to wait for confirmation (ms) */
|
|
210
|
+
timeout?: number;
|
|
211
|
+
/** Refresh view after transaction completes */
|
|
212
|
+
refresh?: {
|
|
213
|
+
view: string;
|
|
214
|
+
key?: string;
|
|
215
|
+
}[];
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Result of a successful instruction execution.
|
|
219
|
+
*/
|
|
220
|
+
interface ExecutionResult {
|
|
221
|
+
/** Transaction signature */
|
|
222
|
+
signature: string;
|
|
223
|
+
/** Confirmation level achieved */
|
|
224
|
+
confirmationLevel: ConfirmationLevel;
|
|
225
|
+
/** Slot when transaction was processed */
|
|
226
|
+
slot: number;
|
|
227
|
+
/** Error code if transaction failed */
|
|
228
|
+
error?: string;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Waits for transaction confirmation.
|
|
232
|
+
*
|
|
233
|
+
* @param signature - Transaction signature
|
|
234
|
+
* @param level - Desired confirmation level
|
|
235
|
+
* @param timeout - Maximum wait time in milliseconds
|
|
236
|
+
* @returns Confirmation result
|
|
237
|
+
*/
|
|
238
|
+
declare function waitForConfirmation(signature: string, level?: ConfirmationLevel, timeout?: number): Promise<{
|
|
239
|
+
level: ConfirmationLevel;
|
|
240
|
+
slot: number;
|
|
241
|
+
}>;
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Parses and handles instruction errors.
|
|
245
|
+
*/
|
|
246
|
+
/**
|
|
247
|
+
* Custom error from a Solana program.
|
|
248
|
+
*/
|
|
249
|
+
interface ProgramError {
|
|
250
|
+
/** Error code */
|
|
251
|
+
code: number;
|
|
252
|
+
/** Error name */
|
|
253
|
+
name: string;
|
|
254
|
+
/** Error message */
|
|
255
|
+
message: string;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Error metadata from IDL.
|
|
259
|
+
*/
|
|
260
|
+
interface ErrorMetadata {
|
|
261
|
+
code: number;
|
|
262
|
+
name: string;
|
|
263
|
+
msg: string;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Parses an error returned from a Solana transaction.
|
|
267
|
+
*
|
|
268
|
+
* @param error - The error from the transaction
|
|
269
|
+
* @param errorMetadata - Error definitions from the IDL
|
|
270
|
+
* @returns Parsed program error or null if not a program error
|
|
271
|
+
*/
|
|
272
|
+
declare function parseInstructionError(error: unknown, errorMetadata: ErrorMetadata[]): ProgramError | null;
|
|
273
|
+
/**
|
|
274
|
+
* Formats an error for display.
|
|
275
|
+
*
|
|
276
|
+
* @param error - The program error
|
|
277
|
+
* @returns Human-readable error message
|
|
278
|
+
*/
|
|
279
|
+
declare function formatProgramError(error: ProgramError): string;
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Resolved accounts map passed to the instruction builder.
|
|
283
|
+
* Keys are account names, values are base58 addresses.
|
|
284
|
+
*/
|
|
285
|
+
type ResolvedAccounts = Record<string, string>;
|
|
286
|
+
/**
|
|
287
|
+
* The instruction object returned by the handler's build function.
|
|
288
|
+
* This is a framework-agnostic representation that can be converted
|
|
289
|
+
* to @solana/web3.js TransactionInstruction.
|
|
290
|
+
*/
|
|
291
|
+
interface BuiltInstruction {
|
|
292
|
+
/** Program ID (base58) */
|
|
293
|
+
programId: string;
|
|
294
|
+
/** Account keys in order */
|
|
295
|
+
keys: Array<{
|
|
296
|
+
pubkey: string;
|
|
297
|
+
isSigner: boolean;
|
|
298
|
+
isWritable: boolean;
|
|
299
|
+
}>;
|
|
300
|
+
/** Serialized instruction data */
|
|
301
|
+
data: Uint8Array;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Instruction handler from the generated stack SDK.
|
|
305
|
+
* The build() function is generated code that handles serialization.
|
|
306
|
+
*/
|
|
307
|
+
interface InstructionHandler {
|
|
308
|
+
/**
|
|
309
|
+
* Build the instruction with resolved accounts.
|
|
310
|
+
* This is generated code - serialization logic lives here.
|
|
311
|
+
*/
|
|
312
|
+
build(args: Record<string, unknown>, accounts: ResolvedAccounts): BuiltInstruction;
|
|
313
|
+
/** Account metadata - used by core SDK for resolution */
|
|
314
|
+
accounts: AccountMeta[];
|
|
315
|
+
/** Error definitions - used by core SDK for error parsing */
|
|
316
|
+
errors: ErrorMetadata[];
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* @deprecated Use InstructionHandler instead. Will be removed in next major version.
|
|
320
|
+
* Legacy instruction definition for backwards compatibility.
|
|
321
|
+
*/
|
|
322
|
+
interface InstructionDefinition {
|
|
323
|
+
/** Instruction name */
|
|
324
|
+
name: string;
|
|
325
|
+
/** Program ID (base58) */
|
|
326
|
+
programId: string;
|
|
327
|
+
/** 8-byte discriminator */
|
|
328
|
+
discriminator: Uint8Array;
|
|
329
|
+
/** Account metadata */
|
|
330
|
+
accounts: AccountMeta[];
|
|
331
|
+
/** Argument schema for serialization */
|
|
332
|
+
argsSchema: ArgSchema[];
|
|
333
|
+
/** Error definitions */
|
|
334
|
+
errors: ErrorMetadata[];
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Executes an instruction handler with the given arguments and options.
|
|
338
|
+
*
|
|
339
|
+
* This is the main function for executing Solana instructions. It handles:
|
|
340
|
+
* 1. Account resolution (signer, PDA, user-provided)
|
|
341
|
+
* 2. Calling the generated build() function
|
|
342
|
+
* 3. Transaction signing and sending
|
|
343
|
+
* 4. Confirmation waiting
|
|
344
|
+
*
|
|
345
|
+
* @param handler - Instruction handler from generated SDK
|
|
346
|
+
* @param args - Instruction arguments
|
|
347
|
+
* @param options - Execution options
|
|
348
|
+
* @returns Execution result with signature
|
|
349
|
+
*/
|
|
350
|
+
declare function executeInstruction(handler: InstructionHandler, args: Record<string, unknown>, options?: ExecuteOptions): Promise<ExecutionResult>;
|
|
351
|
+
/**
|
|
352
|
+
* Creates an instruction executor bound to a specific wallet.
|
|
353
|
+
*
|
|
354
|
+
* @param wallet - Wallet adapter
|
|
355
|
+
* @returns Bound executor function
|
|
356
|
+
*/
|
|
357
|
+
declare function createInstructionExecutor(wallet: WalletAdapter): {
|
|
358
|
+
execute: (handler: InstructionHandler, args: Record<string, unknown>, options?: Omit<ExecuteOptions, "wallet">) => Promise<ExecutionResult>;
|
|
359
|
+
};
|
|
360
|
+
|
|
1
361
|
type ConnectionState = 'disconnected' | 'connecting' | 'connected' | 'reconnecting' | 'error';
|
|
2
362
|
type Update<T> = {
|
|
3
363
|
type: 'upsert';
|
|
@@ -33,7 +393,9 @@ interface ViewDef<T, TMode extends 'state' | 'list'> {
|
|
|
33
393
|
}
|
|
34
394
|
interface StackDefinition {
|
|
35
395
|
readonly name: string;
|
|
396
|
+
readonly url: string;
|
|
36
397
|
readonly views: Record<string, ViewGroup>;
|
|
398
|
+
instructions?: Record<string, InstructionHandler>;
|
|
37
399
|
}
|
|
38
400
|
interface ViewGroup {
|
|
39
401
|
state?: ViewDef<unknown, 'state'>;
|
|
@@ -47,6 +409,11 @@ interface Subscription {
|
|
|
47
409
|
take?: number;
|
|
48
410
|
skip?: number;
|
|
49
411
|
}
|
|
412
|
+
interface WatchOptions {
|
|
413
|
+
take?: number;
|
|
414
|
+
skip?: number;
|
|
415
|
+
filters?: Record<string, string>;
|
|
416
|
+
}
|
|
50
417
|
interface HyperStackOptions<TStack extends StackDefinition> {
|
|
51
418
|
stack: TStack;
|
|
52
419
|
autoReconnect?: boolean;
|
|
@@ -71,22 +438,19 @@ type TypedViews<TViews extends StackDefinition['views']> = {
|
|
|
71
438
|
[K in keyof TViews]: TypedViewGroup<TViews[K]>;
|
|
72
439
|
};
|
|
73
440
|
type TypedViewGroup<TGroup> = {
|
|
74
|
-
state: TGroup extends
|
|
75
|
-
state: ViewDef<infer T, 'state'>;
|
|
76
|
-
} ? TypedStateView<T> : never;
|
|
77
|
-
list: TGroup extends {
|
|
78
|
-
list: ViewDef<infer T, 'list'>;
|
|
79
|
-
} ? TypedListView<T> : never;
|
|
441
|
+
[K in keyof TGroup]: TGroup[K] extends ViewDef<infer T, 'state'> ? TypedStateView<T> : TGroup[K] extends ViewDef<infer T, 'list'> ? TypedListView<T> : never;
|
|
80
442
|
};
|
|
81
443
|
interface TypedStateView<T> {
|
|
82
|
-
|
|
83
|
-
|
|
444
|
+
use(key: string, options?: WatchOptions): AsyncIterable<T>;
|
|
445
|
+
watch(key: string, options?: WatchOptions): AsyncIterable<Update<T>>;
|
|
446
|
+
watchRich(key: string, options?: WatchOptions): AsyncIterable<RichUpdate<T>>;
|
|
84
447
|
get(key: string): Promise<T | null>;
|
|
85
448
|
getSync(key: string): T | null | undefined;
|
|
86
449
|
}
|
|
87
450
|
interface TypedListView<T> {
|
|
88
|
-
|
|
89
|
-
|
|
451
|
+
use(options?: WatchOptions): AsyncIterable<T>;
|
|
452
|
+
watch(options?: WatchOptions): AsyncIterable<Update<T>>;
|
|
453
|
+
watchRich(options?: WatchOptions): AsyncIterable<RichUpdate<T>>;
|
|
90
454
|
get(): Promise<T[]>;
|
|
91
455
|
getSync(): T[] | undefined;
|
|
92
456
|
}
|
|
@@ -213,10 +577,26 @@ declare class SubscriptionRegistry {
|
|
|
213
577
|
private makeSubKey;
|
|
214
578
|
}
|
|
215
579
|
|
|
580
|
+
interface ConnectOptions {
|
|
581
|
+
url?: string;
|
|
582
|
+
storage?: StorageAdapter;
|
|
583
|
+
maxEntriesPerView?: number | null;
|
|
584
|
+
autoReconnect?: boolean;
|
|
585
|
+
reconnectIntervals?: number[];
|
|
586
|
+
maxReconnectAttempts?: number;
|
|
587
|
+
}
|
|
588
|
+
/** @deprecated Use ConnectOptions instead */
|
|
216
589
|
interface HyperStackOptionsWithStorage<TStack extends StackDefinition> extends HyperStackOptions<TStack> {
|
|
217
590
|
storage?: StorageAdapter;
|
|
218
591
|
maxEntriesPerView?: number | null;
|
|
219
592
|
}
|
|
593
|
+
interface InstructionExecutorOptions extends Omit<ExecuteOptions, 'wallet'> {
|
|
594
|
+
wallet: WalletAdapter;
|
|
595
|
+
}
|
|
596
|
+
type InstructionExecutor = (args: Record<string, unknown>, options: InstructionExecutorOptions) => Promise<ExecutionResult>;
|
|
597
|
+
type InstructionsInterface<TInstructions extends Record<string, InstructionHandler> | undefined> = TInstructions extends Record<string, InstructionHandler> ? {
|
|
598
|
+
[K in keyof TInstructions]: InstructionExecutor;
|
|
599
|
+
} : {};
|
|
220
600
|
declare class HyperStack<TStack extends StackDefinition> {
|
|
221
601
|
private readonly connection;
|
|
222
602
|
private readonly storage;
|
|
@@ -224,9 +604,12 @@ declare class HyperStack<TStack extends StackDefinition> {
|
|
|
224
604
|
private readonly subscriptionRegistry;
|
|
225
605
|
private readonly _views;
|
|
226
606
|
private readonly stack;
|
|
607
|
+
private readonly _instructions;
|
|
227
608
|
private constructor();
|
|
228
|
-
|
|
609
|
+
private buildInstructions;
|
|
610
|
+
static connect<T extends StackDefinition>(stack: T, options?: ConnectOptions): Promise<HyperStack<T>>;
|
|
229
611
|
get views(): TypedViews<TStack['views']>;
|
|
612
|
+
get instructions(): InstructionsInterface<TStack['instructions']>;
|
|
230
613
|
get connectionState(): ConnectionState;
|
|
231
614
|
get stackName(): string;
|
|
232
615
|
get store(): StorageAdapter;
|
|
@@ -346,11 +729,12 @@ declare class MemoryAdapter implements StorageAdapter {
|
|
|
346
729
|
}
|
|
347
730
|
|
|
348
731
|
declare function createUpdateStream<T>(storage: StorageAdapter, subscriptionRegistry: SubscriptionRegistry, subscription: Subscription, keyFilter?: string): AsyncIterable<Update<T>>;
|
|
732
|
+
declare function createEntityStream<T>(storage: StorageAdapter, subscriptionRegistry: SubscriptionRegistry, subscription: Subscription, keyFilter?: string): AsyncIterable<T>;
|
|
349
733
|
declare function createRichUpdateStream<T>(storage: StorageAdapter, subscriptionRegistry: SubscriptionRegistry, subscription: Subscription, keyFilter?: string): AsyncIterable<RichUpdate<T>>;
|
|
350
734
|
|
|
351
735
|
declare function createTypedStateView<T>(viewDef: ViewDef<T, 'state'>, storage: StorageAdapter, subscriptionRegistry: SubscriptionRegistry): TypedStateView<T>;
|
|
352
736
|
declare function createTypedListView<T>(viewDef: ViewDef<T, 'list'>, storage: StorageAdapter, subscriptionRegistry: SubscriptionRegistry): TypedListView<T>;
|
|
353
737
|
declare function createTypedViews<TStack extends StackDefinition>(stack: TStack, storage: StorageAdapter, subscriptionRegistry: SubscriptionRegistry): TypedViews<TStack['views']>;
|
|
354
738
|
|
|
355
|
-
export { ConnectionManager, DEFAULT_CONFIG, DEFAULT_MAX_ENTRIES_PER_VIEW, EntityStore, FrameProcessor, HyperStack, HyperStackError, MemoryAdapter, SubscriptionRegistry, createRichUpdateStream, createTypedListView, createTypedStateView, createTypedViews, createUpdateStream, isEntityFrame, isSnapshotFrame, isSubscribedFrame, isValidFrame, parseFrame, parseFrameFromBlob };
|
|
356
|
-
export type { ConnectionState, ConnectionStateCallback, EntityFrame, EntityStoreConfig, Frame, FrameMode, FrameOp, FrameProcessorConfig, HyperStackConfig, HyperStackOptions, HyperStackOptionsWithStorage, RichUpdate, RichUpdateCallback$1 as RichUpdateCallback, SnapshotEntity, SnapshotFrame, SortConfig, SortOrder, StackDefinition, StorageAdapter, StorageAdapterConfig, SubscribeCallback, SubscribedFrame, Subscription, TypedListView, TypedStateView, TypedViewGroup, TypedViews, UnsubscribeFn, Update, UpdateCallback, ViewConfig, ViewDef, ViewGroup, ViewSortConfig };
|
|
739
|
+
export { ConnectionManager, DEFAULT_CONFIG, DEFAULT_MAX_ENTRIES_PER_VIEW, EntityStore, FrameProcessor, HyperStack, HyperStackError, MemoryAdapter, SubscriptionRegistry, createEntityStream, createInstructionExecutor, createPublicKeySeed, createRichUpdateStream, createSeed, createTypedListView, createTypedStateView, createTypedViews, createUpdateStream, derivePda, executeInstruction, formatProgramError, isEntityFrame, isSnapshotFrame, isSubscribedFrame, isValidFrame, parseFrame, parseFrameFromBlob, parseInstructionError, resolveAccounts, serializeInstructionData, validateAccountResolution, waitForConfirmation };
|
|
740
|
+
export type { AccountCategory, AccountMeta, AccountResolutionOptions, AccountResolutionResult, ArgSchema, ArgType, BuiltInstruction, ConfirmationLevel, ConnectionState, ConnectionStateCallback, EntityFrame, EntityStoreConfig, ErrorMetadata, ExecuteOptions, ExecutionResult, Frame, FrameMode, FrameOp, FrameProcessorConfig, HyperStackConfig, HyperStackOptions, HyperStackOptionsWithStorage, InstructionDefinition, InstructionExecutor, InstructionExecutorOptions, InstructionHandler, PdaConfig, PdaSeed, ProgramError, ResolvedAccount, ResolvedAccounts, RichUpdate, RichUpdateCallback$1 as RichUpdateCallback, SnapshotEntity, SnapshotFrame, SortConfig, SortOrder, StackDefinition, StorageAdapter, StorageAdapterConfig, SubscribeCallback, SubscribedFrame, Subscription, TypedListView, TypedStateView, TypedViewGroup, TypedViews, UnsubscribeFn, Update, UpdateCallback, ViewConfig, ViewDef, ViewGroup, ViewSortConfig, WalletAdapter, WalletConnectOptions, WalletState, WatchOptions };
|