@thru/sdk 0.2.22

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.
Files changed (73) hide show
  1. package/README.abi.md +112 -0
  2. package/README.md +342 -0
  3. package/dist/abi/index.cjs +946 -0
  4. package/dist/abi/index.cjs.map +1 -0
  5. package/dist/abi/index.d.cts +331 -0
  6. package/dist/abi/index.d.ts +331 -0
  7. package/dist/abi/index.js +892 -0
  8. package/dist/abi/index.js.map +1 -0
  9. package/dist/abi/wasm/bundler/abi_reflect_wasm.d.ts +65 -0
  10. package/dist/abi/wasm/bundler/abi_reflect_wasm.js +5 -0
  11. package/dist/abi/wasm/bundler/abi_reflect_wasm_bg.js +412 -0
  12. package/dist/abi/wasm/bundler/abi_reflect_wasm_bg.wasm +0 -0
  13. package/dist/abi/wasm/bundler/abi_reflect_wasm_bg.wasm.d.ts +24 -0
  14. package/dist/abi/wasm/bundler/package.json +17 -0
  15. package/dist/abi/wasm/node/abi_reflect_wasm.d.ts +65 -0
  16. package/dist/abi/wasm/node/abi_reflect_wasm.js +425 -0
  17. package/dist/abi/wasm/node/abi_reflect_wasm_bg.wasm +0 -0
  18. package/dist/abi/wasm/node/abi_reflect_wasm_bg.wasm.d.ts +24 -0
  19. package/dist/abi/wasm/node/package.json +11 -0
  20. package/dist/abi/wasm/web/abi_reflect_wasm.d.ts +114 -0
  21. package/dist/abi/wasm/web/abi_reflect_wasm.js +499 -0
  22. package/dist/abi/wasm/web/abi_reflect_wasm_bg.wasm +0 -0
  23. package/dist/abi/wasm/web/abi_reflect_wasm_bg.wasm.d.ts +24 -0
  24. package/dist/abi/wasm/web/package.json +15 -0
  25. package/dist/chunk-CVBQ4UPL.js +3614 -0
  26. package/dist/chunk-CVBQ4UPL.js.map +1 -0
  27. package/dist/chunk-NSBPE2FW.js +15 -0
  28. package/dist/chunk-NSBPE2FW.js.map +1 -0
  29. package/dist/chunk-RL3Q6FDE.js +105 -0
  30. package/dist/chunk-RL3Q6FDE.js.map +1 -0
  31. package/dist/chunk-UDIXYJXC.js +260 -0
  32. package/dist/chunk-UDIXYJXC.js.map +1 -0
  33. package/dist/chunk-YQDWOMNO.js +271 -0
  34. package/dist/chunk-YQDWOMNO.js.map +1 -0
  35. package/dist/client-Cfi7zRLm.d.cts +1247 -0
  36. package/dist/client-worIo0a3.d.ts +1247 -0
  37. package/dist/client.cjs +3791 -0
  38. package/dist/client.cjs.map +1 -0
  39. package/dist/client.d.cts +7 -0
  40. package/dist/client.d.ts +7 -0
  41. package/dist/client.js +7 -0
  42. package/dist/client.js.map +1 -0
  43. package/dist/crypto/index.cjs +170 -0
  44. package/dist/crypto/index.cjs.map +1 -0
  45. package/dist/crypto/index.d.cts +60 -0
  46. package/dist/crypto/index.d.ts +60 -0
  47. package/dist/crypto/index.js +5 -0
  48. package/dist/crypto/index.js.map +1 -0
  49. package/dist/helpers/index.cjs +270 -0
  50. package/dist/helpers/index.cjs.map +1 -0
  51. package/dist/helpers/index.d.cts +15 -0
  52. package/dist/helpers/index.d.ts +15 -0
  53. package/dist/helpers/index.js +4 -0
  54. package/dist/helpers/index.js.map +1 -0
  55. package/dist/metafile-cjs.json +1 -0
  56. package/dist/metafile-esm.json +1 -0
  57. package/dist/proto/index.cjs +433 -0
  58. package/dist/proto/index.cjs.map +1 -0
  59. package/dist/proto/index.d.cts +435 -0
  60. package/dist/proto/index.d.ts +435 -0
  61. package/dist/proto/index.js +4 -0
  62. package/dist/proto/index.js.map +1 -0
  63. package/dist/sdk.cjs +4137 -0
  64. package/dist/sdk.cjs.map +1 -0
  65. package/dist/sdk.d.cts +36 -0
  66. package/dist/sdk.d.ts +36 -0
  67. package/dist/sdk.js +7 -0
  68. package/dist/sdk.js.map +1 -0
  69. package/dist/streaming_service_pb-DvCdJiCr.d.cts +4877 -0
  70. package/dist/streaming_service_pb-DvCdJiCr.d.ts +4877 -0
  71. package/dist/webcrypto-LTajLAad.d.cts +3 -0
  72. package/dist/webcrypto-LTajLAad.d.ts +3 -0
  73. package/package.json +88 -0
@@ -0,0 +1,1247 @@
1
+ import { Transport, createClient, CallOptions, Interceptor } from '@connectrpc/connect';
2
+ import { GrpcWebTransportOptions } from '@connectrpc/connect-web';
3
+ import { bx as Pubkey$1, ct as TaPubkey, bQ as Signature$1, cN as TsSignature, cL as TransactionVmError, cz as Transaction$1, cC as TransactionExecutionResult, L as ConsensusStatus, cH as TransactionStatus, c as AccountFlags$1, e as AccountMeta$1, a as AccountData$1, A as Account$1, Y as FilterParamValue$1, X as Filter$1, bv as PageResponse$1, bt as PageRequest$1, l as AccountView, cP as VersionContext, R as DataSlice, bC as RawAccount, V as ExecutionStatus, v as BlockFooter$1, z as BlockHeader$1, s as Block$1, E as BlockView, bE as RawBlock, ad as GetChainInfoResponse, T as Event, c8 as StreamEventsResponse, av as GetNodeStatusResponse, an as GetNodePubkeyResponse, ar as GetNodeRecordsResponse, bS as StateProof$1, bW as StateProofType, aJ as GetStateRootsResponse, aF as GetSlotMetricsResponse, b7 as ListSlotMetricsResponse, bp as NodeRecord, cJ as TransactionView, cr as SubmissionStatus, bG as RawTransaction, q as BatchSendTransactionsResponse, aR as GetVersionResponse } from './streaming_service_pb-DvCdJiCr.js';
4
+ import { Timestamp } from '@bufbuild/protobuf/wkt';
5
+
6
+ type PubkeyInput = Uint8Array | string | Pubkey;
7
+ declare class Pubkey {
8
+ private readonly bytes;
9
+ private constructor();
10
+ static from(value: PubkeyInput): Pubkey;
11
+ static isThruFmt(value: string): boolean;
12
+ toBytes(): Uint8Array;
13
+ toBytesUnsafe(): Uint8Array;
14
+ toThruFmt(): string;
15
+ toHex(): string;
16
+ equals(other: PubkeyInput): boolean;
17
+ toProtoPubkey(): Pubkey$1;
18
+ toProtoTaPubkey(): TaPubkey;
19
+ static fromProtoPubkey(proto?: Pubkey$1): Pubkey;
20
+ static fromProtoTaPubkey(proto?: TaPubkey): Pubkey;
21
+ private static bytesFromString;
22
+ }
23
+
24
+ type SignatureInput = Uint8Array | string | Signature;
25
+ declare class Signature {
26
+ private readonly bytes;
27
+ private constructor();
28
+ static from(value: SignatureInput): Signature;
29
+ static fromProto(proto?: Signature$1): Signature;
30
+ static isThruFmt(value: string): boolean;
31
+ toBytes(): Uint8Array;
32
+ toBytesUnsafe(): Uint8Array;
33
+ toThruFmt(): string;
34
+ toHex(): string;
35
+ equals(other: SignatureInput): boolean;
36
+ toProtoSignature(): Signature$1;
37
+ toProtoTsSignature(): TsSignature;
38
+ static fromProtoTsSignature(proto?: TsSignature): Signature;
39
+ static fromProtoSignature(proto?: Signature$1): Signature;
40
+ private static bytesFromString;
41
+ }
42
+
43
+ interface ResourceLimits {
44
+ computeUnits?: number;
45
+ stateUnits?: number;
46
+ memoryUnits?: number;
47
+ }
48
+ interface OptionalProofs {
49
+ feePayerStateProof?: Uint8Array;
50
+ feePayerAccountMetaRaw?: Uint8Array;
51
+ }
52
+ interface TransactionHeaderInput extends ResourceLimits {
53
+ fee: bigint;
54
+ nonce: bigint;
55
+ startSlot: bigint;
56
+ expiryAfter?: number;
57
+ chainId?: number;
58
+ flags?: number;
59
+ }
60
+ interface TransactionAccountsInput {
61
+ readWriteAccounts?: PubkeyInput[];
62
+ readOnlyAccounts?: PubkeyInput[];
63
+ }
64
+ /**
65
+ * Context provided to instruction data functions.
66
+ * Contains all transaction accounts in their final sorted order and helper functions
67
+ * for looking up account indexes.
68
+ */
69
+ interface InstructionContext {
70
+ /** All accounts in final transaction order: [feePayer, program, ...readWrite, ...readOnly] */
71
+ accounts: Pubkey[];
72
+ /** Get the index of an account by its public key. Throws if account is not found in transaction. */
73
+ getAccountIndex: (pubkey: PubkeyInput) => number;
74
+ }
75
+ interface FeePayerInput {
76
+ publicKey: PubkeyInput;
77
+ privateKey?: Uint8Array;
78
+ }
79
+ /**
80
+ * Function that builds instruction data with access to the final account ordering.
81
+ * Use this when your instruction data contains account indices.
82
+ */
83
+ type InstructionDataBuilder = (context: InstructionContext) => Uint8Array | string;
84
+ interface BuildTransactionParams {
85
+ feePayer: FeePayerInput;
86
+ program: PubkeyInput;
87
+ header: TransactionHeaderInput;
88
+ accounts?: TransactionAccountsInput;
89
+ /**
90
+ * Static instruction data. Use this when your instruction data does not
91
+ * contain account indices, or when you've pre-computed the indices.
92
+ */
93
+ instructionData?: Uint8Array | string;
94
+ /**
95
+ * Builder function that receives the final account ordering.
96
+ * Use this when your instruction data contains account indices to ensure
97
+ * they match the post-sort transaction layout.
98
+ *
99
+ * @example
100
+ * ```typescript
101
+ * buildInstructionData: ({ getAccountIndex }) => {
102
+ * return buildMyInstruction(
103
+ * getAccountIndex(configAddress),
104
+ * getAccountIndex(trancheAddress),
105
+ * );
106
+ * }
107
+ * ```
108
+ */
109
+ buildInstructionData?: InstructionDataBuilder;
110
+ proofs?: OptionalProofs;
111
+ }
112
+ interface BuiltTransactionResult {
113
+ transaction: TransactionLike;
114
+ }
115
+ interface SignedTransactionResult extends BuiltTransactionResult {
116
+ signature: Signature;
117
+ rawTransaction: Uint8Array;
118
+ }
119
+ interface TransactionLike {
120
+ toWire(): Uint8Array;
121
+ }
122
+
123
+ interface TransactionExecutionEvent {
124
+ eventId: string;
125
+ callIdx: number;
126
+ programIdx: number;
127
+ program?: Pubkey;
128
+ payload: Uint8Array;
129
+ }
130
+ interface TransactionExecutionResultData {
131
+ consumedComputeUnits: number;
132
+ consumedMemoryUnits: number;
133
+ consumedStateUnits: number;
134
+ userErrorCode: bigint;
135
+ vmError: TransactionVmError;
136
+ executionResult: bigint;
137
+ pagesUsed: number;
138
+ eventsCount: number;
139
+ eventsSize: number;
140
+ readwriteAccounts: Pubkey[];
141
+ readonlyAccounts: Pubkey[];
142
+ events?: TransactionExecutionEvent[];
143
+ errorProgramAccIdx: number;
144
+ }
145
+ declare class Transaction {
146
+ readonly version: number;
147
+ readonly feePayer: Pubkey;
148
+ readonly program: Pubkey;
149
+ readonly fee: bigint;
150
+ readonly nonce: bigint;
151
+ readonly startSlot: bigint;
152
+ readonly expiryAfter: number;
153
+ readonly chainId: number;
154
+ readonly requestedComputeUnits: number;
155
+ readonly requestedStateUnits: number;
156
+ readonly requestedMemoryUnits: number;
157
+ readonly flags: number;
158
+ readonly readWriteAccounts: Pubkey[];
159
+ readonly readOnlyAccounts: Pubkey[];
160
+ readonly instructionData?: Uint8Array;
161
+ readonly instructionDataSize?: number;
162
+ readonly feePayerStateProof?: Uint8Array;
163
+ readonly feePayerAccountMetaRaw?: Uint8Array;
164
+ executionResult?: TransactionExecutionResultData;
165
+ slot?: bigint;
166
+ blockOffset?: number;
167
+ private signature?;
168
+ constructor(params: {
169
+ version?: number;
170
+ feePayer: PubkeyInput;
171
+ program: PubkeyInput;
172
+ header: TransactionHeaderInput;
173
+ accounts?: TransactionAccountsInput;
174
+ instructionData?: Uint8Array;
175
+ instructionDataSize?: number;
176
+ proofs?: OptionalProofs;
177
+ });
178
+ static fromWire(data: Uint8Array): Transaction;
179
+ static parseWire(data: Uint8Array, options?: {
180
+ strict?: boolean;
181
+ }): {
182
+ transaction: Transaction;
183
+ size: number;
184
+ };
185
+ static fromProto(proto: Transaction$1): Transaction;
186
+ getSignature(): Signature | undefined;
187
+ setSignature(signature: Signature): void;
188
+ sign(privateKey: Uint8Array): Promise<Signature>;
189
+ toWireForSigning(): Uint8Array;
190
+ toWire(): Uint8Array;
191
+ private createHeader;
192
+ private buildWirePayload;
193
+ private static parseBodySections;
194
+ private static ensureAvailable;
195
+ private static parseStateProof;
196
+ static executionResultFromProto(proto: TransactionExecutionResult): TransactionExecutionResultData;
197
+ }
198
+
199
+ type StreamTransactionUpdate = {
200
+ kind: "partial";
201
+ signature: Uint8Array;
202
+ slot?: bigint;
203
+ executionResult?: ReturnType<typeof Transaction.executionResultFromProto>;
204
+ } | {
205
+ kind: "full";
206
+ transaction: Transaction;
207
+ };
208
+ interface TrackTransactionUpdate {
209
+ signature?: Uint8Array;
210
+ status: string;
211
+ statusCode: ConsensusStatus;
212
+ slot?: bigint;
213
+ executionResult?: ReturnType<typeof Transaction.executionResultFromProto>;
214
+ transaction?: Transaction;
215
+ }
216
+
217
+ interface TransactionStatusParams {
218
+ signature: Uint8Array;
219
+ consensusStatus?: ConsensusStatus;
220
+ executionResult?: ReturnType<typeof Transaction.executionResultFromProto>;
221
+ }
222
+ declare class TransactionStatusSnapshot {
223
+ readonly signature: Uint8Array;
224
+ readonly statusCode?: ConsensusStatus;
225
+ readonly status?: string;
226
+ readonly executionResult?: ReturnType<typeof Transaction.executionResultFromProto>;
227
+ constructor(params: TransactionStatusParams);
228
+ static fromProto(proto: TransactionStatus): TransactionStatusSnapshot;
229
+ }
230
+
231
+ type PartialTransportOptions = Partial<GrpcWebTransportOptions>;
232
+ interface ThruClientConfig {
233
+ baseUrl?: string;
234
+ transport?: Transport;
235
+ transportOptions?: PartialTransportOptions;
236
+ interceptors?: Interceptor[];
237
+ callOptions?: CallOptions;
238
+ }
239
+ type QueryClient = ReturnType<typeof createClient<typeof QueryService>>;
240
+ type CommandClient = ReturnType<typeof createClient<typeof CommandService>>;
241
+ type StreamingClient = ReturnType<typeof createClient<typeof StreamingService>>;
242
+ interface ThruClientContext {
243
+ baseUrl: string;
244
+ transport: Transport;
245
+ query: QueryClient;
246
+ command: CommandClient;
247
+ streaming: StreamingClient;
248
+ callOptions?: CallOptions;
249
+ }
250
+
251
+ interface AccountFlagsData {
252
+ isProgram: boolean;
253
+ isPrivileged: boolean;
254
+ isUncompressable: boolean;
255
+ isEphemeral: boolean;
256
+ isDeleted: boolean;
257
+ isNew: boolean;
258
+ isCompressed: boolean;
259
+ }
260
+ declare class AccountFlags implements AccountFlagsData {
261
+ readonly isProgram: boolean;
262
+ readonly isPrivileged: boolean;
263
+ readonly isUncompressable: boolean;
264
+ readonly isEphemeral: boolean;
265
+ readonly isDeleted: boolean;
266
+ readonly isNew: boolean;
267
+ readonly isCompressed: boolean;
268
+ constructor(flags?: Partial<AccountFlagsData>);
269
+ static fromProto(flags?: AccountFlags$1): AccountFlags;
270
+ }
271
+ declare class AccountMeta {
272
+ readonly version: number;
273
+ readonly flags: AccountFlags;
274
+ readonly dataSize: number;
275
+ readonly seq: bigint;
276
+ readonly owner?: Pubkey;
277
+ readonly balance: bigint;
278
+ readonly nonce?: bigint;
279
+ constructor(params: {
280
+ version: number;
281
+ flags?: AccountFlags;
282
+ dataSize: number;
283
+ seq: bigint;
284
+ owner?: Pubkey;
285
+ balance: bigint;
286
+ nonce?: bigint;
287
+ });
288
+ static fromProto(meta?: AccountMeta$1): AccountMeta | undefined;
289
+ }
290
+ declare class AccountData {
291
+ readonly data?: Uint8Array;
292
+ readonly compressed: boolean;
293
+ readonly compressionAlgorithm?: string;
294
+ constructor(params: {
295
+ data?: Uint8Array;
296
+ compressed?: boolean;
297
+ compressionAlgorithm?: string;
298
+ });
299
+ static fromProto(data?: AccountData$1): AccountData | undefined;
300
+ }
301
+ interface AccountVersionContext {
302
+ slot?: bigint;
303
+ blockTimestampNs?: bigint;
304
+ }
305
+ declare class Account {
306
+ readonly address: Pubkey;
307
+ readonly meta?: AccountMeta;
308
+ readonly data?: AccountData;
309
+ readonly versionContext?: AccountVersionContext;
310
+ readonly consensusStatus?: ConsensusStatus;
311
+ constructor(params: {
312
+ address: Pubkey;
313
+ meta?: AccountMeta;
314
+ data?: AccountData;
315
+ versionContext?: AccountVersionContext;
316
+ consensusStatus?: ConsensusStatus;
317
+ });
318
+ static fromProto(proto: Account$1): Account;
319
+ }
320
+
321
+ interface AccountPageChunk {
322
+ pageIndex: number;
323
+ pageSize: number;
324
+ data: Uint8Array;
325
+ compressed?: boolean;
326
+ compressionAlgorithm?: string;
327
+ }
328
+ interface AccountSnapshot {
329
+ account: Account;
330
+ }
331
+ interface AccountUpdateDelta {
332
+ slot: bigint;
333
+ meta?: AccountMeta;
334
+ page?: AccountPageChunk;
335
+ deleted?: boolean;
336
+ }
337
+ type StreamAccountUpdate = {
338
+ kind: "snapshot";
339
+ snapshot: AccountSnapshot;
340
+ } | {
341
+ kind: "update";
342
+ update: AccountUpdateDelta;
343
+ };
344
+
345
+ type FilterParamValueCase = "stringValue" | "bytesValue" | "boolValue" | "intValue" | "doubleValue" | "uintValue" | "pubkeyValue" | "signatureValue" | "taPubkeyValue" | "tsSignatureValue";
346
+ declare class FilterParamValue {
347
+ private readonly case?;
348
+ private readonly value?;
349
+ private constructor();
350
+ static none(): FilterParamValue;
351
+ static string(value: string): FilterParamValue;
352
+ static bytes(value: Uint8Array): FilterParamValue;
353
+ static bool(value: boolean): FilterParamValue;
354
+ static int(value: bigint): FilterParamValue;
355
+ static double(value: number): FilterParamValue;
356
+ static uint(value: number | bigint): FilterParamValue;
357
+ static pubkey(value: PubkeyInput): FilterParamValue;
358
+ static signature(value: SignatureInput): FilterParamValue;
359
+ static taPubkey(value: PubkeyInput | string): FilterParamValue;
360
+ static tsSignature(value: SignatureInput): FilterParamValue;
361
+ static fromProto(proto: FilterParamValue$1): FilterParamValue;
362
+ toProto(): FilterParamValue$1;
363
+ getCase(): FilterParamValueCase | undefined;
364
+ getString(): string | undefined;
365
+ getBytes(): Uint8Array | undefined;
366
+ getBool(): boolean | undefined;
367
+ getInt(): bigint | undefined;
368
+ getUint(): bigint | undefined;
369
+ getDouble(): number | undefined;
370
+ getPubkey(): Uint8Array | undefined;
371
+ getSignature(): Uint8Array | undefined;
372
+ getTaPubkey(): string | undefined;
373
+ getTsSignature(): string | undefined;
374
+ }
375
+ interface FilterParamsInit {
376
+ [key: string]: FilterParamValue;
377
+ }
378
+ declare class Filter {
379
+ readonly expression?: string;
380
+ private readonly params;
381
+ constructor(init?: {
382
+ expression?: string;
383
+ params?: FilterParamsInit | Map<string, FilterParamValue> | Iterable<[string, FilterParamValue]>;
384
+ });
385
+ static fromProto(proto: Filter$1): Filter;
386
+ toProto(): Filter$1;
387
+ hasParam(name: string): boolean;
388
+ getParam(name: string): FilterParamValue | undefined;
389
+ listParams(): string[];
390
+ entries(): [string, FilterParamValue][];
391
+ withExpression(expression?: string): Filter;
392
+ withParam(name: string, value: FilterParamValue): Filter;
393
+ withoutParam(name: string): Filter;
394
+ private setParamInternal;
395
+ }
396
+
397
+ interface PageRequestParams {
398
+ pageSize?: number;
399
+ pageToken?: string;
400
+ orderBy?: string;
401
+ }
402
+ declare class PageRequest {
403
+ readonly pageSize?: number;
404
+ readonly pageToken?: string;
405
+ readonly orderBy?: string;
406
+ constructor(params?: PageRequestParams);
407
+ static fromProto(proto?: PageRequest$1): PageRequest | undefined;
408
+ toProto(): PageRequest$1;
409
+ withParams(params: PageRequestParams): PageRequest;
410
+ }
411
+ interface PageResponseParams {
412
+ nextPageToken?: string;
413
+ totalSize?: bigint;
414
+ }
415
+ declare class PageResponse {
416
+ readonly nextPageToken?: string;
417
+ readonly totalSize?: bigint;
418
+ constructor(params?: PageResponseParams);
419
+ static fromProto(proto?: PageResponse$1): PageResponse | undefined;
420
+ toProto(): PageResponse$1;
421
+ hasNextPage(): boolean;
422
+ }
423
+
424
+ interface CreateAccountOptions {
425
+ /** The new account's public key (fee payer). */
426
+ publicKey: PubkeyInput;
427
+ /** Optional overrides for the transaction header. */
428
+ header?: Partial<TransactionHeaderInput>;
429
+ }
430
+ interface AccountQueryOptions {
431
+ view?: AccountView;
432
+ versionContext?: VersionContext;
433
+ minConsensus?: ConsensusStatus;
434
+ dataSlice?: DataSlice;
435
+ }
436
+ interface RawAccountQueryOptions {
437
+ view?: AccountView;
438
+ versionContext?: VersionContext;
439
+ minConsensus?: ConsensusStatus;
440
+ }
441
+ interface ListAccountsOptions {
442
+ view?: AccountView;
443
+ versionContext?: VersionContext;
444
+ filter?: Filter;
445
+ page?: PageRequest;
446
+ minConsensus?: ConsensusStatus;
447
+ }
448
+ interface AccountList {
449
+ accounts: Account[];
450
+ page?: PageResponse;
451
+ }
452
+ declare function getAccount(ctx: ThruClientContext, address: PubkeyInput, options?: AccountQueryOptions): Promise<Account>;
453
+ declare function getRawAccount(ctx: ThruClientContext, address: PubkeyInput, options?: RawAccountQueryOptions): Promise<RawAccount>;
454
+ declare function listAccounts(ctx: ThruClientContext, options: ListAccountsOptions): Promise<AccountList>;
455
+ declare function createAccount(ctx: ThruClientContext, options: CreateAccountOptions): Promise<Transaction>;
456
+
457
+ type accounts_AccountList = AccountList;
458
+ type accounts_AccountQueryOptions = AccountQueryOptions;
459
+ type accounts_CreateAccountOptions = CreateAccountOptions;
460
+ type accounts_ListAccountsOptions = ListAccountsOptions;
461
+ type accounts_RawAccountQueryOptions = RawAccountQueryOptions;
462
+ declare const accounts_createAccount: typeof createAccount;
463
+ declare const accounts_getAccount: typeof getAccount;
464
+ declare const accounts_getRawAccount: typeof getRawAccount;
465
+ declare const accounts_listAccounts: typeof listAccounts;
466
+ declare namespace accounts {
467
+ export { type accounts_AccountList as AccountList, type accounts_AccountQueryOptions as AccountQueryOptions, type accounts_CreateAccountOptions as CreateAccountOptions, type accounts_ListAccountsOptions as ListAccountsOptions, type accounts_RawAccountQueryOptions as RawAccountQueryOptions, accounts_createAccount as createAccount, accounts_getAccount as getAccount, accounts_getRawAccount as getRawAccount, accounts_listAccounts as listAccounts };
468
+ }
469
+
470
+ interface BlockFooterParams {
471
+ signature?: Uint8Array;
472
+ status: ExecutionStatus;
473
+ consumedComputeUnits: bigint;
474
+ consumedStateUnits: number;
475
+ attestorPayment: bigint;
476
+ }
477
+ declare class BlockFooter {
478
+ readonly signature?: Uint8Array;
479
+ readonly status: ExecutionStatus;
480
+ readonly consumedComputeUnits: bigint;
481
+ readonly consumedStateUnits: number;
482
+ readonly attestorPayment: bigint;
483
+ constructor(params: BlockFooterParams);
484
+ static fromProto(proto: BlockFooter$1): BlockFooter;
485
+ }
486
+
487
+ interface BlockHeaderParams {
488
+ slot: bigint;
489
+ version: number;
490
+ headerSignature?: Uint8Array;
491
+ producer?: Uint8Array;
492
+ expiryTimestamp?: Timestamp;
493
+ startSlot: bigint;
494
+ expiryAfter?: number;
495
+ maxBlockSize?: number;
496
+ maxComputeUnits?: bigint;
497
+ maxStateUnits?: number;
498
+ bondAmountLockUp?: bigint;
499
+ weightSlot?: bigint;
500
+ blockHash?: Uint8Array;
501
+ chainId?: number;
502
+ }
503
+ declare class BlockHeader {
504
+ readonly slot: bigint;
505
+ readonly version: number;
506
+ readonly headerSignature?: Uint8Array;
507
+ readonly producer?: Uint8Array;
508
+ readonly expiryTimestamp?: Timestamp;
509
+ readonly startSlot: bigint;
510
+ readonly expiryAfter?: number;
511
+ readonly maxBlockSize?: number;
512
+ readonly maxComputeUnits?: bigint;
513
+ readonly maxStateUnits?: number;
514
+ readonly bondAmountLockUp?: bigint;
515
+ readonly weightSlot?: bigint;
516
+ readonly blockHash?: Uint8Array;
517
+ readonly chainId?: number;
518
+ constructor(params: BlockHeaderParams);
519
+ static fromProto(proto: BlockHeader$1): BlockHeader;
520
+ withBlockHash(blockHash: Uint8Array): BlockHeader;
521
+ }
522
+
523
+ declare class Block {
524
+ readonly header: BlockHeader;
525
+ readonly footer?: BlockFooter;
526
+ readonly body?: Uint8Array;
527
+ readonly consensusStatus?: ConsensusStatus;
528
+ blockTimeNs?: bigint;
529
+ attestorPayment?: bigint;
530
+ constructor(params: {
531
+ header: BlockHeader;
532
+ footer?: BlockFooter;
533
+ body?: Uint8Array;
534
+ consensusStatus?: ConsensusStatus;
535
+ });
536
+ static fromProto(proto: Block$1): Block;
537
+ static fromWire(data: Uint8Array): Block;
538
+ private static tryParseWireWithHeaderSize;
539
+ toWire(): Uint8Array;
540
+ getTransactions(): Transaction[];
541
+ private static extractTransactionBody;
542
+ private static extractWithHeaderSize;
543
+ /**
544
+ * Checks if the data looks like a valid transaction body.
545
+ * Uses heuristics to detect if we've correctly offset into the block data.
546
+ * Wire format: header (112 bytes) + body + signature (64 bytes at end)
547
+ * This is a lenient heuristic for format detection - version/flag validation
548
+ * happens in Transaction.parseWire.
549
+ */
550
+ private static looksLikeValidTransactionBody;
551
+ private serializeHeader;
552
+ private serializeFooter;
553
+ private static parseHeader;
554
+ /**
555
+ * Parses a block header with a specific expected size.
556
+ * Handles both current (168 bytes with weight_slot) and legacy (160 bytes without weight_slot) formats.
557
+ */
558
+ private static parseHeaderWithSize;
559
+ private static parseFooter;
560
+ private static parseTransactionsFromBody;
561
+ }
562
+
563
+ type BlockSelector = {
564
+ slot: number | bigint;
565
+ } | {
566
+ blockHash: Uint8Array | string;
567
+ };
568
+ interface DeriveProgramAddressOptions {
569
+ programAddress: PubkeyInput;
570
+ seed: Uint8Array | string;
571
+ ephemeral?: boolean;
572
+ }
573
+ interface DeriveProgramAddressResult {
574
+ bytes: Uint8Array;
575
+ address: string;
576
+ }
577
+ declare function deriveProgramAddress(options: DeriveProgramAddressOptions): DeriveProgramAddressResult;
578
+ type DeriveAddressInput = PubkeyInput | Uint8Array;
579
+ interface DeriveAddressResult {
580
+ bytes: Uint8Array;
581
+ address: string;
582
+ }
583
+ /**
584
+ * Derive an address by hashing an array of inputs.
585
+ * Inputs can be pubkeys (as string, Uint8Array, or Pubkey) or raw Uint8Array data.
586
+ *
587
+ * @example
588
+ * // Token account: SHA256(owner || mint || seed)
589
+ * deriveAddress([ownerPubkey, mintPubkey, seed])
590
+ *
591
+ * // Mint account: SHA256(creator || seed)
592
+ * deriveAddress([creatorPubkey, seed])
593
+ */
594
+ declare function deriveAddress(inputs: DeriveAddressInput[]): DeriveAddressResult;
595
+
596
+ interface BlockQueryOptions {
597
+ view?: BlockView;
598
+ minConsensus?: ConsensusStatus;
599
+ }
600
+ interface RawBlockQueryOptions {
601
+ minConsensus?: ConsensusStatus;
602
+ }
603
+ interface ListBlocksOptions {
604
+ filter?: Filter;
605
+ page?: PageRequest;
606
+ view?: BlockView;
607
+ minConsensus?: ConsensusStatus;
608
+ }
609
+ interface BlockList {
610
+ blocks: Block[];
611
+ page?: PageResponse;
612
+ }
613
+ declare function getBlock(ctx: ThruClientContext, selector: BlockSelector, options?: BlockQueryOptions): Promise<Block>;
614
+ declare function getRawBlock(ctx: ThruClientContext, selector: BlockSelector, options?: RawBlockQueryOptions): Promise<RawBlock>;
615
+ declare function listBlocks(ctx: ThruClientContext, options?: ListBlocksOptions): Promise<BlockList>;
616
+
617
+ type blocks_BlockList = BlockList;
618
+ type blocks_BlockQueryOptions = BlockQueryOptions;
619
+ type blocks_ListBlocksOptions = ListBlocksOptions;
620
+ type blocks_RawBlockQueryOptions = RawBlockQueryOptions;
621
+ declare const blocks_getBlock: typeof getBlock;
622
+ declare const blocks_getRawBlock: typeof getRawBlock;
623
+ declare const blocks_listBlocks: typeof listBlocks;
624
+ declare namespace blocks {
625
+ export { type blocks_BlockList as BlockList, type blocks_BlockQueryOptions as BlockQueryOptions, type blocks_ListBlocksOptions as ListBlocksOptions, type blocks_RawBlockQueryOptions as RawBlockQueryOptions, blocks_getBlock as getBlock, blocks_getRawBlock as getRawBlock, blocks_listBlocks as listBlocks };
626
+ }
627
+
628
+ declare function getChainInfo(ctx: ThruClientContext): Promise<GetChainInfoResponse>;
629
+ declare function getChainId(ctx: ThruClientContext): Promise<number>;
630
+
631
+ declare const chain_getChainId: typeof getChainId;
632
+ declare const chain_getChainInfo: typeof getChainInfo;
633
+ declare namespace chain {
634
+ export { chain_getChainId as getChainId, chain_getChainInfo as getChainInfo };
635
+ }
636
+
637
+ declare function consensusStatusToString(status: ConsensusStatus): string;
638
+
639
+ type VersionContextInput = VersionContext | {
640
+ current: true;
641
+ } | {
642
+ currentOrHistorical: true;
643
+ } | {
644
+ slot: number | bigint;
645
+ } | {
646
+ timestamp: Date | number | Timestamp;
647
+ } | {
648
+ seq: number | bigint;
649
+ };
650
+
651
+ declare function currentVersionContext(): VersionContext;
652
+ declare function currentOrHistoricalVersionContext(): VersionContext;
653
+ declare function slotVersionContext(slot: number | bigint): VersionContext;
654
+ declare function timestampVersionContext(value: Date | number | Timestamp): VersionContext;
655
+ declare function seqVersionContext(seq: number | bigint): VersionContext;
656
+ declare function versionContext(input?: VersionContextInput): VersionContext;
657
+
658
+ type consensus_VersionContextInput = VersionContextInput;
659
+ declare const consensus_consensusStatusToString: typeof consensusStatusToString;
660
+ declare const consensus_currentOrHistoricalVersionContext: typeof currentOrHistoricalVersionContext;
661
+ declare const consensus_currentVersionContext: typeof currentVersionContext;
662
+ declare const consensus_seqVersionContext: typeof seqVersionContext;
663
+ declare const consensus_slotVersionContext: typeof slotVersionContext;
664
+ declare const consensus_timestampVersionContext: typeof timestampVersionContext;
665
+ declare const consensus_versionContext: typeof versionContext;
666
+ declare namespace consensus {
667
+ export { type consensus_VersionContextInput as VersionContextInput, consensus_consensusStatusToString as consensusStatusToString, consensus_currentOrHistoricalVersionContext as currentOrHistoricalVersionContext, consensus_currentVersionContext as currentVersionContext, consensus_seqVersionContext as seqVersionContext, consensus_slotVersionContext as slotVersionContext, consensus_timestampVersionContext as timestampVersionContext, consensus_versionContext as versionContext };
668
+ }
669
+
670
+ interface ChainEventParams {
671
+ id: string;
672
+ transactionSignature?: Uint8Array;
673
+ program?: Uint8Array;
674
+ payload?: Uint8Array;
675
+ slot?: bigint;
676
+ callIndex?: number;
677
+ programIndex?: number;
678
+ payloadSize?: number;
679
+ timestampNs?: bigint;
680
+ }
681
+ declare class ChainEvent {
682
+ readonly id: string;
683
+ readonly transactionSignature?: Uint8Array;
684
+ readonly program?: Uint8Array;
685
+ readonly payload?: Uint8Array;
686
+ readonly slot?: bigint;
687
+ readonly callIndex?: number;
688
+ readonly programIndex?: number;
689
+ readonly payloadSize?: number;
690
+ readonly timestampNs?: bigint;
691
+ constructor(params: ChainEventParams);
692
+ static fromQuery(proto: Event): ChainEvent;
693
+ static fromStream(proto: StreamEventsResponse): ChainEvent;
694
+ }
695
+
696
+ interface GetEventOptions {
697
+ versionContext?: VersionContext;
698
+ }
699
+ interface ListEventsOptions {
700
+ filter?: Filter;
701
+ page?: PageRequest;
702
+ versionContext?: VersionContext;
703
+ minConsensus?: ConsensusStatus;
704
+ }
705
+ interface EventList {
706
+ events: ChainEvent[];
707
+ page?: PageResponse;
708
+ }
709
+ declare function getEvent(ctx: ThruClientContext, eventId: string, options?: GetEventOptions): Promise<ChainEvent>;
710
+ declare function listEvents(ctx: ThruClientContext, options?: ListEventsOptions): Promise<EventList>;
711
+
712
+ type events_EventList = EventList;
713
+ type events_GetEventOptions = GetEventOptions;
714
+ type events_ListEventsOptions = ListEventsOptions;
715
+ declare const events_getEvent: typeof getEvent;
716
+ declare const events_listEvents: typeof listEvents;
717
+ declare namespace events {
718
+ export { type events_EventList as EventList, type events_GetEventOptions as GetEventOptions, type events_ListEventsOptions as ListEventsOptions, events_getEvent as getEvent, events_listEvents as listEvents };
719
+ }
720
+
721
+ interface HeightSnapshotParams {
722
+ finalized: bigint;
723
+ locallyExecuted: bigint;
724
+ clusterExecuted: bigint;
725
+ }
726
+ declare class HeightSnapshot {
727
+ readonly finalized: bigint;
728
+ readonly locallyExecuted: bigint;
729
+ readonly clusterExecuted: bigint;
730
+ constructor(params: HeightSnapshotParams);
731
+ static fromProto(proto: {
732
+ finalized: bigint;
733
+ locallyExecuted: bigint;
734
+ clusterExecuted: bigint;
735
+ }): HeightSnapshot;
736
+ delta(other: HeightSnapshot): {
737
+ finalized: bigint;
738
+ locallyExecuted: bigint;
739
+ clusterExecuted: bigint;
740
+ };
741
+ }
742
+
743
+ declare function getBlockHeight(ctx: ThruClientContext): Promise<HeightSnapshot>;
744
+
745
+ declare const height_getBlockHeight: typeof getBlockHeight;
746
+ declare namespace height {
747
+ export { height_getBlockHeight as getBlockHeight };
748
+ }
749
+
750
+ interface GeneratedKeyPair {
751
+ address: string;
752
+ publicKey: Uint8Array;
753
+ privateKey: Uint8Array;
754
+ }
755
+ /**
756
+ * Generates a new Ed25519 keypair using the same HD wallet pipeline as the Thru wallet.
757
+ */
758
+ declare function generateKeyPair(): Promise<GeneratedKeyPair>;
759
+ declare function fromPrivateKey(privateKey: Uint8Array): Promise<Uint8Array>;
760
+
761
+ type keys_GeneratedKeyPair = GeneratedKeyPair;
762
+ declare const keys_fromPrivateKey: typeof fromPrivateKey;
763
+ declare const keys_generateKeyPair: typeof generateKeyPair;
764
+ declare namespace keys {
765
+ export { type keys_GeneratedKeyPair as GeneratedKeyPair, keys_fromPrivateKey as fromPrivateKey, keys_generateKeyPair as generateKeyPair };
766
+ }
767
+
768
+ declare function getNodeStatus(ctx: ThruClientContext): Promise<GetNodeStatusResponse>;
769
+ declare function getNodePubkey(ctx: ThruClientContext): Promise<GetNodePubkeyResponse>;
770
+ declare function getNodeRecords(ctx: ThruClientContext): Promise<GetNodeRecordsResponse>;
771
+
772
+ declare const node_getNodePubkey: typeof getNodePubkey;
773
+ declare const node_getNodeRecords: typeof getNodeRecords;
774
+ declare const node_getNodeStatus: typeof getNodeStatus;
775
+ declare namespace node {
776
+ export { node_getNodePubkey as getNodePubkey, node_getNodeRecords as getNodeRecords, node_getNodeStatus as getNodeStatus };
777
+ }
778
+
779
+ interface AccountNonceObserverOptions {
780
+ versionContext?: VersionContext;
781
+ signal?: AbortSignal;
782
+ }
783
+ interface WaitForNonceOptions {
784
+ timeoutMs?: number;
785
+ }
786
+ declare class AccountNonceObserver {
787
+ private readonly ctx;
788
+ private readonly account;
789
+ private readonly versionContext;
790
+ private readonly abortController;
791
+ private readonly waiters;
792
+ private latestNonce;
793
+ private closed;
794
+ private streamStarted;
795
+ constructor(ctx: ThruClientContext, account: PubkeyInput, options?: AccountNonceObserverOptions);
796
+ getLatestNonce(): bigint | undefined;
797
+ refresh(): Promise<bigint | undefined>;
798
+ start(): void;
799
+ waitForNonceAtLeast(target: bigint, options?: WaitForNonceOptions): Promise<bigint>;
800
+ close(): void;
801
+ private runStream;
802
+ private observeNonce;
803
+ private resolveReadyWaiters;
804
+ private rejectWaiters;
805
+ }
806
+ interface FeePayerNonceAllocation {
807
+ baseNonce: bigint;
808
+ nonces: bigint[];
809
+ barrierNonce: bigint;
810
+ }
811
+ interface FeePayerNonceManagerOptions {
812
+ observer?: AccountNonceObserver;
813
+ }
814
+ declare class FeePayerNonceManager {
815
+ readonly observer: AccountNonceObserver;
816
+ private allocationQueue;
817
+ private nextNonce;
818
+ constructor(ctx: ThruClientContext, feePayer: PubkeyInput, options?: FeePayerNonceManagerOptions);
819
+ allocate(count: number): Promise<FeePayerNonceAllocation>;
820
+ reset(nextNonce?: bigint): void;
821
+ sync(): Promise<bigint>;
822
+ waitForNonceAtLeast(target: bigint, options?: WaitForNonceOptions): Promise<bigint>;
823
+ close(): void;
824
+ private allocateUnsafe;
825
+ private withAllocationLock;
826
+ }
827
+
828
+ type nonce_AccountNonceObserver = AccountNonceObserver;
829
+ declare const nonce_AccountNonceObserver: typeof AccountNonceObserver;
830
+ type nonce_AccountNonceObserverOptions = AccountNonceObserverOptions;
831
+ type nonce_FeePayerNonceAllocation = FeePayerNonceAllocation;
832
+ type nonce_FeePayerNonceManager = FeePayerNonceManager;
833
+ declare const nonce_FeePayerNonceManager: typeof FeePayerNonceManager;
834
+ type nonce_FeePayerNonceManagerOptions = FeePayerNonceManagerOptions;
835
+ type nonce_WaitForNonceOptions = WaitForNonceOptions;
836
+ declare namespace nonce {
837
+ export { nonce_AccountNonceObserver as AccountNonceObserver, type nonce_AccountNonceObserverOptions as AccountNonceObserverOptions, type nonce_FeePayerNonceAllocation as FeePayerNonceAllocation, nonce_FeePayerNonceManager as FeePayerNonceManager, type nonce_FeePayerNonceManagerOptions as FeePayerNonceManagerOptions, type nonce_WaitForNonceOptions as WaitForNonceOptions };
838
+ }
839
+
840
+ declare class StateProof {
841
+ readonly proof: Uint8Array;
842
+ readonly slot: bigint;
843
+ constructor(params: {
844
+ proof: Uint8Array;
845
+ slot: bigint;
846
+ });
847
+ static fromProto(proto: StateProof$1): StateProof;
848
+ }
849
+
850
+ type GenerateStateProofOptions = {
851
+ address?: PubkeyInput;
852
+ proofType: StateProofType;
853
+ targetSlot?: bigint;
854
+ };
855
+
856
+ declare function generateStateProof(ctx: ThruClientContext, options: GenerateStateProofOptions): Promise<StateProof>;
857
+ interface GetStateRootsOptions {
858
+ slot?: bigint;
859
+ }
860
+ declare function getStateRoots(ctx: ThruClientContext, options?: GetStateRootsOptions): Promise<GetStateRootsResponse>;
861
+
862
+ type proofs_GetStateRootsOptions = GetStateRootsOptions;
863
+ declare const proofs_generateStateProof: typeof generateStateProof;
864
+ declare const proofs_getStateRoots: typeof getStateRoots;
865
+ declare namespace proofs {
866
+ export { type proofs_GetStateRootsOptions as GetStateRootsOptions, proofs_generateStateProof as generateStateProof, proofs_getStateRoots as getStateRoots };
867
+ }
868
+
869
+ interface ListSlotMetricsOptions {
870
+ startSlot: bigint;
871
+ endSlot?: bigint;
872
+ limit?: number;
873
+ }
874
+ declare function getSlotMetrics(ctx: ThruClientContext, slot: bigint): Promise<GetSlotMetricsResponse>;
875
+ declare function listSlotMetrics(ctx: ThruClientContext, options: ListSlotMetricsOptions): Promise<ListSlotMetricsResponse>;
876
+
877
+ type slots_ListSlotMetricsOptions = ListSlotMetricsOptions;
878
+ declare const slots_getSlotMetrics: typeof getSlotMetrics;
879
+ declare const slots_listSlotMetrics: typeof listSlotMetrics;
880
+ declare namespace slots {
881
+ export { type slots_ListSlotMetricsOptions as ListSlotMetricsOptions, slots_getSlotMetrics as getSlotMetrics, slots_listSlotMetrics as listSlotMetrics };
882
+ }
883
+
884
+ interface TrackTransactionOptions {
885
+ timeoutMs?: number;
886
+ signal?: AbortSignal;
887
+ }
888
+ interface StreamBlocksOptions {
889
+ startSlot?: bigint;
890
+ filter?: Filter;
891
+ view?: BlockView;
892
+ minConsensus?: ConsensusStatus;
893
+ signal?: AbortSignal;
894
+ }
895
+ interface StreamBlocksResult {
896
+ block: Block;
897
+ }
898
+ declare function streamBlocks(ctx: ThruClientContext, options?: StreamBlocksOptions): AsyncIterable<StreamBlocksResult>;
899
+ interface StreamAccountUpdatesOptions {
900
+ view?: AccountView;
901
+ filter?: Filter;
902
+ signal?: AbortSignal;
903
+ }
904
+ interface StreamAccountUpdatesResult {
905
+ update: StreamAccountUpdate;
906
+ }
907
+ declare function streamAccountUpdates(ctx: ThruClientContext, address: PubkeyInput, options?: StreamAccountUpdatesOptions): AsyncIterable<StreamAccountUpdatesResult>;
908
+ interface StreamTransactionsOptions {
909
+ filter?: Filter;
910
+ minConsensus?: ConsensusStatus;
911
+ signal?: AbortSignal;
912
+ }
913
+ type StreamTransactionsResult = StreamTransactionUpdate;
914
+ declare function streamTransactions(ctx: ThruClientContext, options?: StreamTransactionsOptions): AsyncIterable<StreamTransactionsResult>;
915
+ interface StreamEventsOptions {
916
+ filter?: Filter;
917
+ signal?: AbortSignal;
918
+ }
919
+ interface StreamEventsResult {
920
+ event: ChainEvent;
921
+ }
922
+ declare function streamEvents(ctx: ThruClientContext, options?: StreamEventsOptions): AsyncIterable<StreamEventsResult>;
923
+ declare function trackTransaction(ctx: ThruClientContext, signature: SignatureInput, options?: TrackTransactionOptions): AsyncIterable<TrackTransactionUpdate>;
924
+ interface StreamHeightOptions {
925
+ signal?: AbortSignal;
926
+ }
927
+ interface StreamHeightResult {
928
+ height: HeightSnapshot;
929
+ }
930
+ declare function streamHeight(ctx: ThruClientContext, options?: StreamHeightOptions): AsyncIterable<StreamHeightResult>;
931
+ interface StreamSlotMetricsOptions {
932
+ startSlot?: bigint;
933
+ signal?: AbortSignal;
934
+ }
935
+ interface StreamSlotMetricsResult {
936
+ slot: bigint;
937
+ collectedFees: bigint;
938
+ globalActivatedStateCounter: bigint;
939
+ globalDeactivatedStateCounter: bigint;
940
+ blockTimestamp?: Timestamp;
941
+ }
942
+ declare function streamSlotMetrics(ctx: ThruClientContext, options?: StreamSlotMetricsOptions): AsyncIterable<StreamSlotMetricsResult>;
943
+ type StreamNodeRecordsResult = {
944
+ type: "record";
945
+ record: NodeRecord;
946
+ } | {
947
+ type: "finished";
948
+ };
949
+ interface StreamNodeRecordsOptions {
950
+ signal?: AbortSignal;
951
+ }
952
+ declare function streamNodeRecords(ctx: ThruClientContext, options?: StreamNodeRecordsOptions): AsyncIterable<StreamNodeRecordsResult>;
953
+ interface CollectStreamOptions {
954
+ limit?: number;
955
+ signal?: AbortSignal;
956
+ }
957
+ declare function collectStream<T>(iterable: AsyncIterable<T>, options?: CollectStreamOptions): Promise<T[]>;
958
+ declare function firstStreamValue<T>(iterable: AsyncIterable<T>, options?: {
959
+ signal?: AbortSignal;
960
+ }): Promise<T | undefined>;
961
+ declare function forEachStreamValue<T>(iterable: AsyncIterable<T>, handler: (value: T, index: number) => void | Promise<void>, options?: {
962
+ signal?: AbortSignal;
963
+ }): Promise<void>;
964
+
965
+ type streaming_CollectStreamOptions = CollectStreamOptions;
966
+ type streaming_StreamAccountUpdatesOptions = StreamAccountUpdatesOptions;
967
+ type streaming_StreamAccountUpdatesResult = StreamAccountUpdatesResult;
968
+ type streaming_StreamBlocksOptions = StreamBlocksOptions;
969
+ type streaming_StreamBlocksResult = StreamBlocksResult;
970
+ type streaming_StreamEventsOptions = StreamEventsOptions;
971
+ type streaming_StreamEventsResult = StreamEventsResult;
972
+ type streaming_StreamHeightOptions = StreamHeightOptions;
973
+ type streaming_StreamHeightResult = StreamHeightResult;
974
+ type streaming_StreamNodeRecordsOptions = StreamNodeRecordsOptions;
975
+ type streaming_StreamNodeRecordsResult = StreamNodeRecordsResult;
976
+ type streaming_StreamSlotMetricsOptions = StreamSlotMetricsOptions;
977
+ type streaming_StreamSlotMetricsResult = StreamSlotMetricsResult;
978
+ type streaming_StreamTransactionUpdate = StreamTransactionUpdate;
979
+ type streaming_StreamTransactionsOptions = StreamTransactionsOptions;
980
+ type streaming_StreamTransactionsResult = StreamTransactionsResult;
981
+ type streaming_TrackTransactionOptions = TrackTransactionOptions;
982
+ type streaming_TrackTransactionUpdate = TrackTransactionUpdate;
983
+ declare const streaming_collectStream: typeof collectStream;
984
+ declare const streaming_firstStreamValue: typeof firstStreamValue;
985
+ declare const streaming_forEachStreamValue: typeof forEachStreamValue;
986
+ declare const streaming_streamAccountUpdates: typeof streamAccountUpdates;
987
+ declare const streaming_streamBlocks: typeof streamBlocks;
988
+ declare const streaming_streamEvents: typeof streamEvents;
989
+ declare const streaming_streamHeight: typeof streamHeight;
990
+ declare const streaming_streamNodeRecords: typeof streamNodeRecords;
991
+ declare const streaming_streamSlotMetrics: typeof streamSlotMetrics;
992
+ declare const streaming_streamTransactions: typeof streamTransactions;
993
+ declare const streaming_trackTransaction: typeof trackTransaction;
994
+ declare namespace streaming {
995
+ export { type streaming_CollectStreamOptions as CollectStreamOptions, type streaming_StreamAccountUpdatesOptions as StreamAccountUpdatesOptions, type streaming_StreamAccountUpdatesResult as StreamAccountUpdatesResult, type streaming_StreamBlocksOptions as StreamBlocksOptions, type streaming_StreamBlocksResult as StreamBlocksResult, type streaming_StreamEventsOptions as StreamEventsOptions, type streaming_StreamEventsResult as StreamEventsResult, type streaming_StreamHeightOptions as StreamHeightOptions, type streaming_StreamHeightResult as StreamHeightResult, type streaming_StreamNodeRecordsOptions as StreamNodeRecordsOptions, type streaming_StreamNodeRecordsResult as StreamNodeRecordsResult, type streaming_StreamSlotMetricsOptions as StreamSlotMetricsOptions, type streaming_StreamSlotMetricsResult as StreamSlotMetricsResult, type streaming_StreamTransactionUpdate as StreamTransactionUpdate, type streaming_StreamTransactionsOptions as StreamTransactionsOptions, type streaming_StreamTransactionsResult as StreamTransactionsResult, type streaming_TrackTransactionOptions as TrackTransactionOptions, type streaming_TrackTransactionUpdate as TrackTransactionUpdate, streaming_collectStream as collectStream, streaming_firstStreamValue as firstStreamValue, streaming_forEachStreamValue as forEachStreamValue, streaming_streamAccountUpdates as streamAccountUpdates, streaming_streamBlocks as streamBlocks, streaming_streamEvents as streamEvents, streaming_streamHeight as streamHeight, streaming_streamNodeRecords as streamNodeRecords, streaming_streamSlotMetrics as streamSlotMetrics, streaming_streamTransactions as streamTransactions, streaming_trackTransaction as trackTransaction };
996
+ }
997
+
998
+ interface TransactionFeePayerConfig {
999
+ publicKey: PubkeyInput;
1000
+ privateKey?: Uint8Array;
1001
+ }
1002
+ interface TransactionAccountsConfig {
1003
+ readWrite?: PubkeyInput[];
1004
+ readOnly?: PubkeyInput[];
1005
+ }
1006
+ interface TransactionHeaderConfig {
1007
+ fee?: bigint;
1008
+ nonce?: bigint;
1009
+ startSlot?: bigint;
1010
+ expiryAfter?: number;
1011
+ chainId?: number;
1012
+ computeUnits?: number;
1013
+ stateUnits?: number;
1014
+ memoryUnits?: number;
1015
+ flags?: number;
1016
+ }
1017
+ /**
1018
+ * Instruction data can be either:
1019
+ * - A Uint8Array directly
1020
+ * - A function that takes an InstructionContext and returns a Uint8Array
1021
+ */
1022
+ type InstructionData = Uint8Array | string | ((context: InstructionContext) => Promise<Uint8Array>);
1023
+ interface BuildTransactionOptions {
1024
+ feePayer: TransactionFeePayerConfig;
1025
+ program: PubkeyInput;
1026
+ header?: TransactionHeaderConfig;
1027
+ accounts?: TransactionAccountsConfig;
1028
+ instructionData?: InstructionData;
1029
+ feePayerStateProof?: Uint8Array;
1030
+ feePayerAccountMetaRaw?: Uint8Array;
1031
+ }
1032
+ interface BuildAndSignTransactionOptions extends BuildTransactionOptions {
1033
+ feePayer: TransactionFeePayerConfig & {
1034
+ privateKey: Uint8Array;
1035
+ };
1036
+ }
1037
+ interface TransactionQueryOptions {
1038
+ view?: TransactionView;
1039
+ versionContext?: VersionContext;
1040
+ minConsensus?: ConsensusStatus;
1041
+ }
1042
+ interface RawTransactionQueryOptions {
1043
+ versionContext?: VersionContext;
1044
+ minConsensus?: ConsensusStatus;
1045
+ }
1046
+ interface ListTransactionsForAccountOptions {
1047
+ filter?: Filter;
1048
+ page?: PageRequest;
1049
+ transactionOptions?: TransactionQueryOptions;
1050
+ }
1051
+ interface TransactionList {
1052
+ transactions: Transaction[];
1053
+ page?: PageResponse;
1054
+ }
1055
+ interface ListTransactionsOptions {
1056
+ filter?: Filter;
1057
+ page?: PageRequest;
1058
+ returnEvents?: boolean;
1059
+ versionContext?: VersionContext;
1060
+ minConsensus?: ConsensusStatus;
1061
+ }
1062
+ declare function getTransaction(ctx: ThruClientContext, signature: SignatureInput, options?: TransactionQueryOptions): Promise<Transaction>;
1063
+ declare function getRawTransaction(ctx: ThruClientContext, signature: SignatureInput, options?: RawTransactionQueryOptions): Promise<RawTransaction>;
1064
+ declare function getTransactionStatus(ctx: ThruClientContext, signature: SignatureInput): Promise<TransactionStatusSnapshot>;
1065
+ declare function listTransactionsForAccount(ctx: ThruClientContext, account: PubkeyInput, options?: ListTransactionsForAccountOptions): Promise<TransactionList>;
1066
+ declare function listTransactions(ctx: ThruClientContext, options?: ListTransactionsOptions): Promise<TransactionList>;
1067
+ declare function buildTransaction(ctx: ThruClientContext, options: BuildTransactionOptions): Promise<Transaction>;
1068
+ declare function buildAndSignTransaction(ctx: ThruClientContext, options: BuildAndSignTransactionOptions): Promise<SignedTransactionResult>;
1069
+ declare function sendTransaction(ctx: ThruClientContext, transaction: Transaction | Uint8Array): Promise<string>;
1070
+ interface BatchSendTransactionsOptions {
1071
+ numRetries?: number;
1072
+ }
1073
+ type BatchTrackStatus = "executed" | "finalized_without_execution" | "timeout" | "not_accepted" | "cancelled" | "track_error";
1074
+ interface BatchSendAndTrackOptions extends BatchSendTransactionsOptions {
1075
+ trackTimeoutMs?: number;
1076
+ signal?: AbortSignal;
1077
+ }
1078
+ interface BatchSendAndTrackResult {
1079
+ signature: string;
1080
+ accepted: boolean;
1081
+ trackStatus: BatchTrackStatus;
1082
+ update?: TrackTransactionUpdate;
1083
+ executionResult?: TransactionExecutionResultData;
1084
+ error?: unknown;
1085
+ }
1086
+ declare function batchSendTransactions(ctx: ThruClientContext, transactions: (Transaction | Uint8Array)[], options?: BatchSendTransactionsOptions): Promise<BatchSendTransactionsResponse>;
1087
+ declare function batchSendAndTrack(ctx: ThruClientContext, transactions: (Transaction | Uint8Array)[], options?: BatchSendAndTrackOptions): Promise<BatchSendAndTrackResult[]>;
1088
+ interface SendAndTrackTxnOptions {
1089
+ timeoutMs?: number;
1090
+ signal?: AbortSignal;
1091
+ }
1092
+ interface SendAndTrackTxnUpdate {
1093
+ status: SubmissionStatus;
1094
+ signature?: {
1095
+ value: Uint8Array;
1096
+ };
1097
+ consensusStatus: number;
1098
+ executionResult?: {
1099
+ vmError: number;
1100
+ consumedComputeUnits: number;
1101
+ userErrorCode: bigint;
1102
+ };
1103
+ }
1104
+ declare function sendAndTrackTxn(ctx: ThruClientContext, transaction: Transaction | Uint8Array, options?: SendAndTrackTxnOptions): AsyncIterable<SendAndTrackTxnUpdate>;
1105
+
1106
+ type transactions_BatchSendAndTrackOptions = BatchSendAndTrackOptions;
1107
+ type transactions_BatchSendAndTrackResult = BatchSendAndTrackResult;
1108
+ type transactions_BatchSendTransactionsOptions = BatchSendTransactionsOptions;
1109
+ type transactions_BatchTrackStatus = BatchTrackStatus;
1110
+ type transactions_BuildAndSignTransactionOptions = BuildAndSignTransactionOptions;
1111
+ type transactions_BuildTransactionOptions = BuildTransactionOptions;
1112
+ type transactions_InstructionData = InstructionData;
1113
+ type transactions_ListTransactionsForAccountOptions = ListTransactionsForAccountOptions;
1114
+ type transactions_ListTransactionsOptions = ListTransactionsOptions;
1115
+ type transactions_RawTransactionQueryOptions = RawTransactionQueryOptions;
1116
+ type transactions_SendAndTrackTxnOptions = SendAndTrackTxnOptions;
1117
+ type transactions_SendAndTrackTxnUpdate = SendAndTrackTxnUpdate;
1118
+ type transactions_TransactionAccountsConfig = TransactionAccountsConfig;
1119
+ type transactions_TransactionFeePayerConfig = TransactionFeePayerConfig;
1120
+ type transactions_TransactionHeaderConfig = TransactionHeaderConfig;
1121
+ type transactions_TransactionList = TransactionList;
1122
+ type transactions_TransactionQueryOptions = TransactionQueryOptions;
1123
+ declare const transactions_batchSendAndTrack: typeof batchSendAndTrack;
1124
+ declare const transactions_batchSendTransactions: typeof batchSendTransactions;
1125
+ declare const transactions_buildAndSignTransaction: typeof buildAndSignTransaction;
1126
+ declare const transactions_buildTransaction: typeof buildTransaction;
1127
+ declare const transactions_getRawTransaction: typeof getRawTransaction;
1128
+ declare const transactions_getTransaction: typeof getTransaction;
1129
+ declare const transactions_getTransactionStatus: typeof getTransactionStatus;
1130
+ declare const transactions_listTransactions: typeof listTransactions;
1131
+ declare const transactions_listTransactionsForAccount: typeof listTransactionsForAccount;
1132
+ declare const transactions_sendAndTrackTxn: typeof sendAndTrackTxn;
1133
+ declare const transactions_sendTransaction: typeof sendTransaction;
1134
+ declare namespace transactions {
1135
+ export { type transactions_BatchSendAndTrackOptions as BatchSendAndTrackOptions, type transactions_BatchSendAndTrackResult as BatchSendAndTrackResult, type transactions_BatchSendTransactionsOptions as BatchSendTransactionsOptions, type transactions_BatchTrackStatus as BatchTrackStatus, type transactions_BuildAndSignTransactionOptions as BuildAndSignTransactionOptions, type transactions_BuildTransactionOptions as BuildTransactionOptions, type transactions_InstructionData as InstructionData, type transactions_ListTransactionsForAccountOptions as ListTransactionsForAccountOptions, type transactions_ListTransactionsOptions as ListTransactionsOptions, type transactions_RawTransactionQueryOptions as RawTransactionQueryOptions, type transactions_SendAndTrackTxnOptions as SendAndTrackTxnOptions, type transactions_SendAndTrackTxnUpdate as SendAndTrackTxnUpdate, type transactions_TransactionAccountsConfig as TransactionAccountsConfig, type transactions_TransactionFeePayerConfig as TransactionFeePayerConfig, type transactions_TransactionHeaderConfig as TransactionHeaderConfig, type transactions_TransactionList as TransactionList, type transactions_TransactionQueryOptions as TransactionQueryOptions, transactions_batchSendAndTrack as batchSendAndTrack, transactions_batchSendTransactions as batchSendTransactions, transactions_buildAndSignTransaction as buildAndSignTransaction, transactions_buildTransaction as buildTransaction, transactions_getRawTransaction as getRawTransaction, transactions_getTransaction as getTransaction, transactions_getTransactionStatus as getTransactionStatus, transactions_listTransactions as listTransactions, transactions_listTransactionsForAccount as listTransactionsForAccount, transactions_sendAndTrackTxn as sendAndTrackTxn, transactions_sendTransaction as sendTransaction };
1136
+ }
1137
+
1138
+ declare class VersionInfo {
1139
+ readonly components: Record<string, string>;
1140
+ constructor(components: Record<string, string>);
1141
+ static fromProto(proto: GetVersionResponse): VersionInfo;
1142
+ get(component: string): string | undefined;
1143
+ }
1144
+
1145
+ declare function getVersion(ctx: ThruClientContext): Promise<VersionInfo>;
1146
+
1147
+ type BoundFunction<F> = F extends (ctx: ThruClientContext, ...args: infer P) => infer R ? (...args: P) => R : never;
1148
+ interface BoundBlocks {
1149
+ get: BoundFunction<typeof getBlock>;
1150
+ getRaw: BoundFunction<typeof getRawBlock>;
1151
+ list: BoundFunction<typeof listBlocks>;
1152
+ stream: BoundFunction<typeof streamBlocks>;
1153
+ getBlockHeight: BoundFunction<typeof getBlockHeight>;
1154
+ streamHeight: BoundFunction<typeof streamHeight>;
1155
+ }
1156
+ interface BoundAccounts {
1157
+ get: BoundFunction<typeof getAccount>;
1158
+ getRaw: BoundFunction<typeof getRawAccount>;
1159
+ list: BoundFunction<typeof listAccounts>;
1160
+ stream: BoundFunction<typeof streamAccountUpdates>;
1161
+ create: BoundFunction<typeof createAccount>;
1162
+ }
1163
+ interface BoundTransactions {
1164
+ get: BoundFunction<typeof getTransaction>;
1165
+ getRaw: BoundFunction<typeof getRawTransaction>;
1166
+ getStatus: BoundFunction<typeof getTransactionStatus>;
1167
+ list: BoundFunction<typeof listTransactions>;
1168
+ listForAccount: BoundFunction<typeof listTransactionsForAccount>;
1169
+ stream: BoundFunction<typeof streamTransactions>;
1170
+ build: BoundFunction<typeof buildTransaction>;
1171
+ buildAndSign: BoundFunction<typeof buildAndSignTransaction>;
1172
+ send: BoundFunction<typeof sendTransaction>;
1173
+ batchSend: BoundFunction<typeof batchSendTransactions>;
1174
+ batchSendAndTrack: BoundFunction<typeof batchSendAndTrack>;
1175
+ sendAndTrack: BoundFunction<typeof sendAndTrackTxn>;
1176
+ track: BoundFunction<typeof trackTransaction>;
1177
+ }
1178
+ interface BoundNonce {
1179
+ createObserver(account: PubkeyInput, options?: AccountNonceObserverOptions): AccountNonceObserver;
1180
+ createFeePayerManager(feePayer: PubkeyInput, options?: FeePayerNonceManagerOptions): FeePayerNonceManager;
1181
+ }
1182
+ interface BoundEvents {
1183
+ get: BoundFunction<typeof getEvent>;
1184
+ list: BoundFunction<typeof listEvents>;
1185
+ stream: BoundFunction<typeof streamEvents>;
1186
+ }
1187
+ interface BoundProofs {
1188
+ generate: BoundFunction<typeof generateStateProof>;
1189
+ getStateRoots: BoundFunction<typeof getStateRoots>;
1190
+ }
1191
+ interface BoundKeys {
1192
+ generateKeyPair: typeof generateKeyPair;
1193
+ fromPrivateKey: typeof fromPrivateKey;
1194
+ }
1195
+ interface BoundVersion {
1196
+ get: BoundFunction<typeof getVersion>;
1197
+ }
1198
+ interface BoundSlots {
1199
+ getMetrics: BoundFunction<typeof getSlotMetrics>;
1200
+ listMetrics: BoundFunction<typeof listSlotMetrics>;
1201
+ streamMetrics: BoundFunction<typeof streamSlotMetrics>;
1202
+ }
1203
+ interface BoundNode {
1204
+ getStatus: BoundFunction<typeof getNodeStatus>;
1205
+ getPubkey: BoundFunction<typeof getNodePubkey>;
1206
+ getRecords: BoundFunction<typeof getNodeRecords>;
1207
+ streamRecords: BoundFunction<typeof streamNodeRecords>;
1208
+ }
1209
+ interface BoundChain {
1210
+ getChainInfo: BoundFunction<typeof getChainInfo>;
1211
+ getChainId: BoundFunction<typeof getChainId>;
1212
+ }
1213
+ interface BoundConsensus {
1214
+ statusToString: typeof consensusStatusToString;
1215
+ versionContext: typeof versionContext;
1216
+ currentVersionContext: typeof currentVersionContext;
1217
+ currentOrHistoricalVersionContext: typeof currentOrHistoricalVersionContext;
1218
+ slotVersionContext: typeof slotVersionContext;
1219
+ timestampVersionContext: typeof timestampVersionContext;
1220
+ seqVersionContext: typeof seqVersionContext;
1221
+ }
1222
+ interface Helpers {
1223
+ createSignature(value: SignatureInput): Signature;
1224
+ createPubkey(value: PubkeyInput): Pubkey;
1225
+ deriveProgramAddress(options: DeriveProgramAddressOptions): DeriveProgramAddressResult;
1226
+ deriveAddress(inputs: DeriveAddressInput[]): DeriveAddressResult;
1227
+ }
1228
+ interface Thru {
1229
+ ctx: ThruClientContext;
1230
+ blocks: BoundBlocks;
1231
+ accounts: BoundAccounts;
1232
+ transactions: BoundTransactions;
1233
+ events: BoundEvents;
1234
+ slots: BoundSlots;
1235
+ proofs: BoundProofs;
1236
+ keys: BoundKeys;
1237
+ version: BoundVersion;
1238
+ consensus: BoundConsensus;
1239
+ nonce: BoundNonce;
1240
+ node: BoundNode;
1241
+ chain: BoundChain;
1242
+ helpers: Helpers;
1243
+ }
1244
+
1245
+ declare function createThruClient(config?: ThruClientConfig): Thru;
1246
+
1247
+ export { type StreamAccountUpdate as $, Account as A, type BatchSendAndTrackOptions as B, ChainEvent as C, type DeriveAddressInput as D, type ListBlocksOptions as E, type FeePayerNonceAllocation as F, type GenerateStateProofOptions as G, HeightSnapshot as H, type InstructionContext as I, type ListSlotMetricsOptions as J, type ListTransactionsForAccountOptions as K, type ListAccountsOptions as L, type PageRequestParams as M, PageResponse as N, type PageResponseParams as O, PageRequest as P, Pubkey as Q, type PubkeyInput as R, type RawAccountQueryOptions as S, type RawBlockQueryOptions as T, type RawTransactionQueryOptions as U, type SendAndTrackTxnOptions as V, type SendAndTrackTxnUpdate as W, Signature as X, type SignatureInput as Y, type SignedTransactionResult as Z, StateProof as _, AccountNonceObserver as a, type StreamAccountUpdatesOptions as a0, type StreamAccountUpdatesResult as a1, type StreamBlocksOptions as a2, type StreamBlocksResult as a3, type StreamEventsOptions as a4, type StreamEventsResult as a5, type StreamNodeRecordsOptions as a6, type StreamNodeRecordsResult as a7, type StreamSlotMetricsOptions as a8, type StreamSlotMetricsResult as a9, deriveProgramAddress as aA, events as aB, firstStreamValue as aC, forEachStreamValue as aD, height as aE, keys as aF, node as aG, nonce as aH, proofs as aI, slots as aJ, streaming as aK, transactions as aL, type StreamTransactionUpdate as aa, type StreamTransactionsOptions as ab, type StreamTransactionsResult as ac, type Thru as ad, type ThruClientConfig as ae, type TrackTransactionOptions as af, type TrackTransactionUpdate as ag, Transaction as ah, type TransactionAccountsConfig as ai, type TransactionExecutionEvent as aj, type TransactionExecutionResultData as ak, type TransactionFeePayerConfig as al, type TransactionHeaderConfig as am, type TransactionList as an, type TransactionQueryOptions as ao, TransactionStatusSnapshot as ap, type VersionContextInput as aq, VersionInfo as ar, type WaitForNonceOptions as as, accounts as at, blocks as au, chain as av, collectStream as aw, consensus as ax, createThruClient as ay, deriveAddress as az, type AccountNonceObserverOptions as b, type AccountQueryOptions as c, type BatchSendAndTrackResult as d, type BatchSendTransactionsOptions as e, type BatchTrackStatus as f, Block as g, type BlockList as h, type BlockQueryOptions as i, type BlockSelector as j, type BuildAndSignTransactionOptions as k, type BuildTransactionOptions as l, type BuildTransactionParams as m, type CreateAccountOptions as n, type DeriveAddressResult as o, type DeriveProgramAddressOptions as p, type DeriveProgramAddressResult as q, FeePayerNonceManager as r, type FeePayerNonceManagerOptions as s, Filter as t, FilterParamValue as u, type GeneratedKeyPair as v, type GetEventOptions as w, type GetStateRootsOptions as x, type HeightSnapshotParams as y, type InstructionData as z };