@thru/thru-sdk 0.1.28 → 0.1.29

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 CHANGED
@@ -67,6 +67,29 @@ for await (const update of thru.streaming.trackTransaction(signature)) {
67
67
  }
68
68
  ```
69
69
 
70
+ ## Client Configuration
71
+
72
+ `createThruClient` accepts advanced transport options so you can customize networking, interceptors, and default call behaviour:
73
+
74
+ ```ts
75
+ const thru = createThruClient({
76
+ baseUrl: "https://grpc-web.alphanet.thruput.org",
77
+ transportOptions: {
78
+ useBinaryFormat: false,
79
+ defaultTimeoutMs: 10_000,
80
+ },
81
+ interceptors: [authInterceptor],
82
+ callOptions: {
83
+ timeoutMs: 5_000,
84
+ headers: [["x-team", "sdk"]],
85
+ },
86
+ });
87
+ ```
88
+
89
+ - `transportOptions` are passed to `createGrpcWebTransport`. Provide custom fetch implementations, JSON/binary options, or merge additional interceptors.
90
+ - `interceptors` let you append cross-cutting logic (auth, metrics) without re-implementing transports.
91
+ - `callOptions` act as defaults for **every** RPC. You can set timeouts, headers, or a shared `AbortSignal`, and each module call merges in per-request overrides.
92
+
70
93
  ## Domain Models
71
94
 
72
95
  The SDK revolves around immutable domain classes. They copy mutable buffers, expose clear invariants, and provide conversion helpers where needed.
@@ -231,23 +254,17 @@ for await (const update of thru.streaming.trackTransaction(signature)) {
231
254
  Server-side filtering is supported everywhere via CEL expressions:
232
255
 
233
256
  ```ts
234
- import { create } from "@bufbuild/protobuf";
235
- import {
236
- FilterSchema,
237
- FilterParamValueSchema,
238
- } from "@thru/thru-sdk";
257
+ import { Filter, FilterParamValue } from "@thru/thru-sdk";
239
258
 
240
- const ownerBytes = new Uint8Array(32);
241
- const ownerParam = create(FilterParamValueSchema, {
242
- kind: { case: "bytesValue", value: ownerBytes },
243
- });
244
-
245
- const filter = create(FilterSchema, {
246
- expression: "meta.owner.value == params.owner_bytes",
247
- params: { owner_bytes: ownerParam },
259
+ const ownerFilter = new Filter({
260
+ expression: "account.meta.owner.value == params.owner",
261
+ params: {
262
+ owner: FilterParamValue.pubkey("taExampleAddress..."),
263
+ min_balance: FilterParamValue.uint(1_000_000n),
264
+ },
248
265
  });
249
266
 
250
- const accounts = await thru.accounts.list({ filter });
267
+ const accounts = await thru.accounts.list({ filter: ownerFilter });
251
268
  ```
252
269
 
253
270
  Accepted parameter kinds:
@@ -256,11 +273,18 @@ Accepted parameter kinds:
256
273
  - `boolValue`
257
274
  - `intValue`
258
275
  - `doubleValue`
276
+ - `uintValue`
277
+ - `pubkeyValue`
278
+ - `signatureValue`
279
+ - `taPubkeyValue`
280
+ - `tsSignatureValue`
259
281
 
260
282
  Functions that take filters:
261
283
  - List APIs: `thru.accounts.list`, `thru.blocks.list`, `thru.transactions.listForAccount`
262
284
  - Streams: `thru.streaming.streamBlocks`, `thru.streaming.streamAccountUpdates`, `thru.streaming.streamTransactions`, `thru.streaming.streamEvents`
263
285
 
286
+ Use the helper constructors on `FilterParamValue` to safely build parameters from raw bytes, ta/ts-encoded strings, or simple numbers.
287
+
264
288
  ## Modules Overview
265
289
 
266
290
  - `thru.blocks` — fetch/stream blocks and height snapshots
@@ -268,7 +292,24 @@ Functions that take filters:
268
292
  - `thru.transactions` — build, sign, submit, track, and inspect transactions
269
293
  - `thru.events` — query event history
270
294
  - `thru.proofs` — generate state proofs
295
+ - `thru.consensus` — build version contexts and stringify consensus states
271
296
  - `thru.streaming` — streaming wrappers for blocks, accounts, transactions, events
272
297
  - `thru.helpers` — address, signature, and block-hash conversion helpers
273
298
 
274
299
  The public surface is fully domain-based; reaching for lower-level protobuf structures is no longer necessary.
300
+
301
+ ## Streaming helpers
302
+
303
+ Async iterable utilities make it easier to consume streaming APIs:
304
+
305
+ ```ts
306
+ import { collectStream, firstStreamValue } from "@thru/thru-sdk";
307
+
308
+ const updates = await collectStream(thru.streaming.streamBlocks({ startSlot: height.finalized }), {
309
+ limit: 5,
310
+ });
311
+
312
+ const firstEvent = await firstStreamValue(thru.streaming.streamEvents());
313
+ ```
314
+
315
+ `collectStream` gathers values (optionally respecting `AbortSignal`s), `firstStreamValue` returns the first item, and `forEachStreamValue` lets you run async handlers for each streamed update.
@@ -1,8 +1,8 @@
1
1
  import { BytesLike, Pubkey as Pubkey$1 } from '@thru/helpers';
2
- import { Message } from '@bufbuild/protobuf';
3
2
  import { Timestamp } from '@bufbuild/protobuf/wkt';
4
- import { createClient } from '@connectrpc/connect';
5
- import { createGrpcWebTransport } from '@connectrpc/connect-web';
3
+ import { Message } from '@bufbuild/protobuf';
4
+ import { Transport, createClient, CallOptions, Interceptor } from '@connectrpc/connect';
5
+ import { GrpcWebTransportOptions } from '@connectrpc/connect-web';
6
6
  import { GenMessage } from '@bufbuild/protobuf/codegenv2';
7
7
 
8
8
  /**
@@ -49,6 +49,15 @@ type VersionContext = Message<"thru.common.v1.VersionContext"> & {
49
49
  */
50
50
  value: Timestamp;
51
51
  case: "timestamp";
52
+ } | {
53
+ /**
54
+ * Request the version for a specific seq number.
55
+ * Relevant only for GetAccount and GetRawAccount requests.
56
+ *
57
+ * @generated from field: uint64 seq = 5;
58
+ */
59
+ value: bigint;
60
+ case: "seq";
52
61
  } | {
53
62
  case: undefined;
54
63
  value?: undefined;
@@ -118,9 +127,9 @@ declare enum ConsensusStatus {
118
127
  /**
119
128
  * Pubkey represents a 32-byte public key value.
120
129
  *
121
- * @generated from message thru.core.v1.Pubkey
130
+ * @generated from message thru.common.v1.Pubkey
122
131
  */
123
- type Pubkey = Message<"thru.core.v1.Pubkey"> & {
132
+ type Pubkey = Message<"thru.common.v1.Pubkey"> & {
124
133
  /**
125
134
  * 32-byte public key buffer.
126
135
  *
@@ -129,30 +138,43 @@ type Pubkey = Message<"thru.core.v1.Pubkey"> & {
129
138
  value: Uint8Array;
130
139
  };
131
140
  /**
132
- * BlockHash represents a 64-byte hash for block identifiers.
141
+ * Signature represents a 64-byte signature value.
133
142
  *
134
- * @generated from message thru.core.v1.BlockHash
143
+ * @generated from message thru.common.v1.Signature
135
144
  */
136
- type BlockHash = Message<"thru.core.v1.BlockHash"> & {
145
+ type Signature = Message<"thru.common.v1.Signature"> & {
137
146
  /**
138
- * 64-byte block hash buffer.
147
+ * 64-byte signature buffer.
139
148
  *
140
149
  * @generated from field: bytes value = 1;
141
150
  */
142
151
  value: Uint8Array;
143
152
  };
144
153
  /**
145
- * Signature represents a 64-byte signature value.
154
+ * TaPubkey represents a ta-encoded public key string (46 characters).
146
155
  *
147
- * @generated from message thru.core.v1.Signature
156
+ * @generated from message thru.common.v1.TaPubkey
148
157
  */
149
- type Signature = Message<"thru.core.v1.Signature"> & {
158
+ type TaPubkey = Message<"thru.common.v1.TaPubkey"> & {
150
159
  /**
151
- * 64-byte signature buffer.
160
+ * 46-character ta-encoded public key string.
152
161
  *
153
- * @generated from field: bytes value = 1;
162
+ * @generated from field: string value = 1;
154
163
  */
155
- value: Uint8Array;
164
+ value: string;
165
+ };
166
+ /**
167
+ * TsSignature represents a ts-encoded signature string (90 characters).
168
+ *
169
+ * @generated from message thru.common.v1.TsSignature
170
+ */
171
+ type TsSignature = Message<"thru.common.v1.TsSignature"> & {
172
+ /**
173
+ * 90-character ts-encoded signature string.
174
+ *
175
+ * @generated from field: string value = 1;
176
+ */
177
+ value: string;
156
178
  };
157
179
 
158
180
  /**
@@ -162,7 +184,7 @@ type Signature = Message<"thru.core.v1.Signature"> & {
162
184
  */
163
185
  type TransactionHeader = Message<"thru.core.v1.TransactionHeader"> & {
164
186
  /**
165
- * @generated from field: thru.core.v1.Signature fee_payer_signature = 1;
187
+ * @generated from field: thru.common.v1.Signature fee_payer_signature = 1;
166
188
  */
167
189
  feePayerSignature?: Signature;
168
190
  /**
@@ -214,11 +236,11 @@ type TransactionHeader = Message<"thru.core.v1.TransactionHeader"> & {
214
236
  */
215
237
  startSlot: bigint;
216
238
  /**
217
- * @generated from field: thru.core.v1.Pubkey fee_payer_pubkey = 14;
239
+ * @generated from field: thru.common.v1.Pubkey fee_payer_pubkey = 14;
218
240
  */
219
241
  feePayerPubkey?: Pubkey;
220
242
  /**
221
- * @generated from field: thru.core.v1.Pubkey program_pubkey = 15;
243
+ * @generated from field: thru.common.v1.Pubkey program_pubkey = 15;
222
244
  */
223
245
  programPubkey?: Pubkey;
224
246
  };
@@ -265,11 +287,11 @@ type TransactionExecutionResult = Message<"thru.core.v1.TransactionExecutionResu
265
287
  */
266
288
  eventsSize: number;
267
289
  /**
268
- * @generated from field: repeated thru.core.v1.Pubkey readwrite_accounts = 10;
290
+ * @generated from field: repeated thru.common.v1.Pubkey readwrite_accounts = 10;
269
291
  */
270
292
  readwriteAccounts: Pubkey[];
271
293
  /**
272
- * @generated from field: repeated thru.core.v1.Pubkey readonly_accounts = 11;
294
+ * @generated from field: repeated thru.common.v1.Pubkey readonly_accounts = 11;
273
295
  */
274
296
  readonlyAccounts: Pubkey[];
275
297
  /**
@@ -296,7 +318,7 @@ type TransactionEvent = Message<"thru.core.v1.TransactionEvent"> & {
296
318
  */
297
319
  programIdx: number;
298
320
  /**
299
- * @generated from field: thru.core.v1.Pubkey program = 4;
321
+ * @generated from field: thru.common.v1.Pubkey program = 4;
300
322
  */
301
323
  program?: Pubkey;
302
324
  /**
@@ -311,7 +333,7 @@ type TransactionEvent = Message<"thru.core.v1.TransactionEvent"> & {
311
333
  */
312
334
  type Transaction$1 = Message<"thru.core.v1.Transaction"> & {
313
335
  /**
314
- * @generated from field: thru.core.v1.Signature signature = 1;
336
+ * @generated from field: thru.common.v1.Signature signature = 1;
315
337
  */
316
338
  signature?: Signature;
317
339
  /**
@@ -342,7 +364,7 @@ type Transaction$1 = Message<"thru.core.v1.Transaction"> & {
342
364
  */
343
365
  type RawTransaction = Message<"thru.core.v1.RawTransaction"> & {
344
366
  /**
345
- * @generated from field: thru.core.v1.Signature signature = 1;
367
+ * @generated from field: thru.common.v1.Signature signature = 1;
346
368
  */
347
369
  signature?: Signature;
348
370
  /**
@@ -608,10 +630,40 @@ type FilterParamValue$1 = Message<"thru.common.v1.FilterParamValue"> & {
608
630
  case: "intValue";
609
631
  } | {
610
632
  /**
611
- * @generated from field: double double_value = 5;
633
+ * @generated from field: uint64 uint_value = 5;
634
+ */
635
+ value: bigint;
636
+ case: "uintValue";
637
+ } | {
638
+ /**
639
+ * @generated from field: double double_value = 6;
612
640
  */
613
641
  value: number;
614
642
  case: "doubleValue";
643
+ } | {
644
+ /**
645
+ * @generated from field: thru.common.v1.Pubkey pubkey_value = 7;
646
+ */
647
+ value: Pubkey;
648
+ case: "pubkeyValue";
649
+ } | {
650
+ /**
651
+ * @generated from field: thru.common.v1.Signature signature_value = 8;
652
+ */
653
+ value: Signature;
654
+ case: "signatureValue";
655
+ } | {
656
+ /**
657
+ * @generated from field: thru.common.v1.TaPubkey ta_pubkey_value = 9;
658
+ */
659
+ value: TaPubkey;
660
+ case: "taPubkeyValue";
661
+ } | {
662
+ /**
663
+ * @generated from field: thru.common.v1.TsSignature ts_signature_value = 10;
664
+ */
665
+ value: TsSignature;
666
+ case: "tsSignatureValue";
615
667
  } | {
616
668
  case: undefined;
617
669
  value?: undefined;
@@ -683,7 +735,7 @@ type AccountMeta$1 = Message<"thru.core.v1.AccountMeta"> & {
683
735
  */
684
736
  seq: bigint;
685
737
  /**
686
- * @generated from field: thru.core.v1.Pubkey owner = 5;
738
+ * @generated from field: thru.common.v1.Pubkey owner = 5;
687
739
  */
688
740
  owner?: Pubkey;
689
741
  /**
@@ -751,7 +803,7 @@ type VersionContextMetadata = Message<"thru.core.v1.VersionContextMetadata"> & {
751
803
  */
752
804
  type Account$1 = Message<"thru.core.v1.Account"> & {
753
805
  /**
754
- * @generated from field: thru.core.v1.Pubkey address = 1;
806
+ * @generated from field: thru.common.v1.Pubkey address = 1;
755
807
  */
756
808
  address?: Pubkey;
757
809
  /**
@@ -778,7 +830,7 @@ type Account$1 = Message<"thru.core.v1.Account"> & {
778
830
  */
779
831
  type RawAccount = Message<"thru.core.v1.RawAccount"> & {
780
832
  /**
781
- * @generated from field: thru.core.v1.Pubkey address = 1;
833
+ * @generated from field: thru.common.v1.Pubkey address = 1;
782
834
  */
783
835
  address?: Pubkey;
784
836
  /**
@@ -832,6 +884,20 @@ declare enum AccountView {
832
884
  FULL = 4
833
885
  }
834
886
 
887
+ /**
888
+ * BlockHash represents a 64-byte hash for block identifiers.
889
+ *
890
+ * @generated from message thru.core.v1.BlockHash
891
+ */
892
+ type BlockHash = Message<"thru.core.v1.BlockHash"> & {
893
+ /**
894
+ * 64-byte block hash buffer.
895
+ *
896
+ * @generated from field: bytes value = 1;
897
+ */
898
+ value: Uint8Array;
899
+ };
900
+
835
901
  /**
836
902
  * BlockHeader describes metadata about a block.
837
903
  *
@@ -847,7 +913,7 @@ type BlockHeader$1 = Message<"thru.core.v1.BlockHeader"> & {
847
913
  */
848
914
  blockHash?: BlockHash;
849
915
  /**
850
- * @generated from field: thru.core.v1.Signature header_signature = 3;
916
+ * @generated from field: thru.common.v1.Signature header_signature = 3;
851
917
  */
852
918
  headerSignature?: Signature;
853
919
  /**
@@ -855,7 +921,7 @@ type BlockHeader$1 = Message<"thru.core.v1.BlockHeader"> & {
855
921
  */
856
922
  version: number;
857
923
  /**
858
- * @generated from field: thru.core.v1.Pubkey producer = 5;
924
+ * @generated from field: thru.common.v1.Pubkey producer = 5;
859
925
  */
860
926
  producer?: Pubkey;
861
927
  /**
@@ -886,6 +952,10 @@ type BlockHeader$1 = Message<"thru.core.v1.BlockHeader"> & {
886
952
  * @generated from field: uint64 price = 12;
887
953
  */
888
954
  price: bigint;
955
+ /**
956
+ * @generated from field: google.protobuf.Timestamp block_time = 13;
957
+ */
958
+ blockTime?: Timestamp;
889
959
  };
890
960
  /**
891
961
  * BlockFooter captures execution result metadata for a block.
@@ -894,7 +964,7 @@ type BlockHeader$1 = Message<"thru.core.v1.BlockHeader"> & {
894
964
  */
895
965
  type BlockFooter$1 = Message<"thru.core.v1.BlockFooter"> & {
896
966
  /**
897
- * @generated from field: thru.core.v1.Signature signature = 1;
967
+ * @generated from field: thru.common.v1.Signature signature = 1;
898
968
  */
899
969
  signature?: Signature;
900
970
  /**
@@ -1018,7 +1088,7 @@ type StreamEventsResponse = Message<"thru.services.v1.StreamEventsResponse"> & {
1018
1088
  */
1019
1089
  timestamp?: Timestamp;
1020
1090
  /**
1021
- * @generated from field: thru.core.v1.Pubkey program = 4;
1091
+ * @generated from field: thru.common.v1.Pubkey program = 4;
1022
1092
  */
1023
1093
  program?: Pubkey;
1024
1094
  /**
@@ -1026,7 +1096,7 @@ type StreamEventsResponse = Message<"thru.services.v1.StreamEventsResponse"> & {
1026
1096
  */
1027
1097
  callIdx: number;
1028
1098
  /**
1029
- * @generated from field: thru.core.v1.Signature signature = 6;
1099
+ * @generated from field: thru.common.v1.Signature signature = 6;
1030
1100
  */
1031
1101
  signature?: Signature;
1032
1102
  /**
@@ -1293,11 +1363,11 @@ type Event = Message<"thru.services.v1.Event"> & {
1293
1363
  */
1294
1364
  eventId: string;
1295
1365
  /**
1296
- * @generated from field: thru.core.v1.Signature transaction_signature = 2;
1366
+ * @generated from field: thru.common.v1.Signature transaction_signature = 2;
1297
1367
  */
1298
1368
  transactionSignature?: Signature;
1299
1369
  /**
1300
- * @generated from field: optional thru.core.v1.Pubkey program = 3;
1370
+ * @generated from field: optional thru.common.v1.Pubkey program = 3;
1301
1371
  */
1302
1372
  program?: Pubkey;
1303
1373
  /**
@@ -1320,6 +1390,14 @@ type Event = Message<"thru.services.v1.Event"> & {
1320
1390
  * @generated from field: optional uint32 payload_size = 8;
1321
1391
  */
1322
1392
  payloadSize?: number;
1393
+ /**
1394
+ * @generated from field: optional uint32 block_offset = 9;
1395
+ */
1396
+ blockOffset?: number;
1397
+ /**
1398
+ * @generated from field: optional google.protobuf.Timestamp timestamp = 10;
1399
+ */
1400
+ timestamp?: Timestamp;
1323
1401
  };
1324
1402
  /**
1325
1403
  * TransactionStatus captures status metadata for a transaction.
@@ -1328,7 +1406,7 @@ type Event = Message<"thru.services.v1.Event"> & {
1328
1406
  */
1329
1407
  type TransactionStatus = Message<"thru.services.v1.TransactionStatus"> & {
1330
1408
  /**
1331
- * @generated from field: thru.core.v1.Signature signature = 1;
1409
+ * @generated from field: thru.common.v1.Signature signature = 1;
1332
1410
  */
1333
1411
  signature?: Signature;
1334
1412
  /**
@@ -1364,7 +1442,7 @@ type BatchSendTransactionsResponse = Message<"thru.services.v1.BatchSendTransact
1364
1442
  /**
1365
1443
  * Signatures for each transaction (in same order as request).
1366
1444
  *
1367
- * @generated from field: repeated thru.core.v1.Signature signatures = 1;
1445
+ * @generated from field: repeated thru.common.v1.Signature signatures = 1;
1368
1446
  */
1369
1447
  signatures: Signature[];
1370
1448
  /**
@@ -1375,18 +1453,24 @@ type BatchSendTransactionsResponse = Message<"thru.services.v1.BatchSendTransact
1375
1453
  accepted: boolean[];
1376
1454
  };
1377
1455
 
1456
+ type PartialTransportOptions = Partial<GrpcWebTransportOptions>;
1378
1457
  interface ThruClientConfig {
1379
1458
  baseUrl?: string;
1459
+ transport?: Transport;
1460
+ transportOptions?: PartialTransportOptions;
1461
+ interceptors?: Interceptor[];
1462
+ callOptions?: CallOptions;
1380
1463
  }
1381
1464
  type QueryClient = ReturnType<typeof createClient<typeof QueryService>>;
1382
1465
  type CommandClient = ReturnType<typeof createClient<typeof CommandService>>;
1383
1466
  type StreamingClient = ReturnType<typeof createClient<typeof StreamingService>>;
1384
1467
  interface ThruClientContext {
1385
1468
  baseUrl: string;
1386
- transport: ReturnType<typeof createGrpcWebTransport>;
1469
+ transport: Transport;
1387
1470
  query: QueryClient;
1388
1471
  command: CommandClient;
1389
1472
  streaming: StreamingClient;
1473
+ callOptions?: CallOptions;
1390
1474
  }
1391
1475
 
1392
1476
  interface AccountFlagsData {
@@ -1483,7 +1567,7 @@ type StreamAccountUpdate = {
1483
1567
  update: AccountUpdateDelta;
1484
1568
  };
1485
1569
 
1486
- type FilterParamValueCase = "stringValue" | "bytesValue" | "boolValue" | "intValue" | "doubleValue";
1570
+ type FilterParamValueCase = "stringValue" | "bytesValue" | "boolValue" | "intValue" | "doubleValue" | "uintValue" | "pubkeyValue" | "signatureValue" | "taPubkeyValue" | "tsSignatureValue";
1487
1571
  declare class FilterParamValue {
1488
1572
  private readonly case?;
1489
1573
  private readonly value?;
@@ -1494,6 +1578,11 @@ declare class FilterParamValue {
1494
1578
  static bool(value: boolean): FilterParamValue;
1495
1579
  static int(value: bigint): FilterParamValue;
1496
1580
  static double(value: number): FilterParamValue;
1581
+ static uint(value: number | bigint): FilterParamValue;
1582
+ static pubkey(value: Pubkey$1, field?: string): FilterParamValue;
1583
+ static signature(value: BytesLike, field?: string): FilterParamValue;
1584
+ static taPubkey(value: Pubkey$1 | string, field?: string): FilterParamValue;
1585
+ static tsSignature(value: BytesLike | string, field?: string): FilterParamValue;
1497
1586
  static fromProto(proto: FilterParamValue$1): FilterParamValue;
1498
1587
  toProto(): FilterParamValue$1;
1499
1588
  getCase(): FilterParamValueCase | undefined;
@@ -1501,7 +1590,12 @@ declare class FilterParamValue {
1501
1590
  getBytes(): Uint8Array | undefined;
1502
1591
  getBool(): boolean | undefined;
1503
1592
  getInt(): bigint | undefined;
1593
+ getUint(): bigint | undefined;
1504
1594
  getDouble(): number | undefined;
1595
+ getPubkey(): Uint8Array | undefined;
1596
+ getSignature(): Uint8Array | undefined;
1597
+ getTaPubkey(): string | undefined;
1598
+ getTsSignature(): string | undefined;
1505
1599
  }
1506
1600
  interface FilterParamsInit {
1507
1601
  [key: string]: FilterParamValue;
@@ -1670,12 +1764,20 @@ declare class Block {
1670
1764
  private static parseTransactionsFromBody;
1671
1765
  }
1672
1766
 
1767
+ type TsSignatureInput = string | Uint8Array;
1768
+
1673
1769
  type BlockSelector = {
1674
1770
  slot: number | bigint;
1675
1771
  } | {
1676
1772
  blockHash: BytesLike;
1677
1773
  };
1774
+ declare function toSignature(value: BytesLike): Signature;
1775
+ declare function toSignatureBytes(value: BytesLike): Uint8Array;
1776
+ declare function toTsSignature(value: TsSignatureInput | BytesLike, field?: string): TsSignature;
1678
1777
  declare function toPubkey(value: Pubkey$1, field: string): Pubkey;
1778
+ declare function toPubkeyBytes(value: Pubkey$1, field: string): Uint8Array;
1779
+ declare function toTaPubkey(value: Pubkey$1 | string, field?: string): TaPubkey;
1780
+ declare function toBlockHash(value: BytesLike): BlockHash;
1679
1781
  interface DeriveProgramAddressOptions {
1680
1782
  programAddress: Pubkey$1;
1681
1783
  seed: BytesLike;
@@ -1719,6 +1821,39 @@ declare namespace blocks {
1719
1821
  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 };
1720
1822
  }
1721
1823
 
1824
+ declare function consensusStatusToString(status: ConsensusStatus): string;
1825
+
1826
+ type VersionContextInput = VersionContext | {
1827
+ current: true;
1828
+ } | {
1829
+ currentOrHistorical: true;
1830
+ } | {
1831
+ slot: number | bigint;
1832
+ } | {
1833
+ timestamp: Date | number | Timestamp;
1834
+ } | {
1835
+ seq: number | bigint;
1836
+ };
1837
+
1838
+ declare function currentVersionContext(): VersionContext;
1839
+ declare function currentOrHistoricalVersionContext(): VersionContext;
1840
+ declare function slotVersionContext(slot: number | bigint): VersionContext;
1841
+ declare function timestampVersionContext(value: Date | number | Timestamp): VersionContext;
1842
+ declare function seqVersionContext(seq: number | bigint): VersionContext;
1843
+ declare function versionContext(input?: VersionContextInput): VersionContext;
1844
+
1845
+ type consensus_VersionContextInput = VersionContextInput;
1846
+ declare const consensus_consensusStatusToString: typeof consensusStatusToString;
1847
+ declare const consensus_currentOrHistoricalVersionContext: typeof currentOrHistoricalVersionContext;
1848
+ declare const consensus_currentVersionContext: typeof currentVersionContext;
1849
+ declare const consensus_seqVersionContext: typeof seqVersionContext;
1850
+ declare const consensus_slotVersionContext: typeof slotVersionContext;
1851
+ declare const consensus_timestampVersionContext: typeof timestampVersionContext;
1852
+ declare const consensus_versionContext: typeof versionContext;
1853
+ declare namespace consensus {
1854
+ 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 };
1855
+ }
1856
+
1722
1857
  interface ChainEventParams {
1723
1858
  id: string;
1724
1859
  transactionSignature?: Uint8Array;
@@ -1816,7 +1951,7 @@ declare class StateProof {
1816
1951
  type GenerateStateProofOptions = {
1817
1952
  address?: Pubkey$1;
1818
1953
  proofType: StateProofType;
1819
- targetSlot: bigint;
1954
+ targetSlot?: bigint;
1820
1955
  };
1821
1956
 
1822
1957
  declare function generateStateProof(ctx: ThruClientContext, options: GenerateStateProofOptions): Promise<StateProof>;
@@ -1866,7 +2001,19 @@ interface StreamEventsResult {
1866
2001
  }
1867
2002
  declare function streamEvents(ctx: ThruClientContext, options?: StreamEventsOptions): AsyncIterable<StreamEventsResult>;
1868
2003
  declare function trackTransaction(ctx: ThruClientContext, signature: BytesLike, options?: TrackTransactionOptions): AsyncIterable<TrackTransactionUpdate>;
2004
+ interface CollectStreamOptions {
2005
+ limit?: number;
2006
+ signal?: AbortSignal;
2007
+ }
2008
+ declare function collectStream<T>(iterable: AsyncIterable<T>, options?: CollectStreamOptions): Promise<T[]>;
2009
+ declare function firstStreamValue<T>(iterable: AsyncIterable<T>, options?: {
2010
+ signal?: AbortSignal;
2011
+ }): Promise<T | undefined>;
2012
+ declare function forEachStreamValue<T>(iterable: AsyncIterable<T>, handler: (value: T, index: number) => void | Promise<void>, options?: {
2013
+ signal?: AbortSignal;
2014
+ }): Promise<void>;
1869
2015
 
2016
+ type streaming_CollectStreamOptions = CollectStreamOptions;
1870
2017
  type streaming_StreamAccountUpdatesOptions = StreamAccountUpdatesOptions;
1871
2018
  type streaming_StreamAccountUpdatesResult = StreamAccountUpdatesResult;
1872
2019
  type streaming_StreamBlocksOptions = StreamBlocksOptions;
@@ -1878,13 +2025,16 @@ type streaming_StreamTransactionsOptions = StreamTransactionsOptions;
1878
2025
  type streaming_StreamTransactionsResult = StreamTransactionsResult;
1879
2026
  type streaming_TrackTransactionOptions = TrackTransactionOptions;
1880
2027
  type streaming_TrackTransactionUpdate = TrackTransactionUpdate;
2028
+ declare const streaming_collectStream: typeof collectStream;
2029
+ declare const streaming_firstStreamValue: typeof firstStreamValue;
2030
+ declare const streaming_forEachStreamValue: typeof forEachStreamValue;
1881
2031
  declare const streaming_streamAccountUpdates: typeof streamAccountUpdates;
1882
2032
  declare const streaming_streamBlocks: typeof streamBlocks;
1883
2033
  declare const streaming_streamEvents: typeof streamEvents;
1884
2034
  declare const streaming_streamTransactions: typeof streamTransactions;
1885
2035
  declare const streaming_trackTransaction: typeof trackTransaction;
1886
2036
  declare namespace streaming {
1887
- export { 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_StreamTransactionUpdate as StreamTransactionUpdate, type streaming_StreamTransactionsOptions as StreamTransactionsOptions, type streaming_StreamTransactionsResult as StreamTransactionsResult, type streaming_TrackTransactionOptions as TrackTransactionOptions, type streaming_TrackTransactionUpdate as TrackTransactionUpdate, streaming_streamAccountUpdates as streamAccountUpdates, streaming_streamBlocks as streamBlocks, streaming_streamEvents as streamEvents, streaming_streamTransactions as streamTransactions, streaming_trackTransaction as trackTransaction };
2037
+ 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_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_streamTransactions as streamTransactions, streaming_trackTransaction as trackTransaction };
1888
2038
  }
1889
2039
 
1890
2040
  interface TransactionFeePayerConfig {
@@ -1985,4 +2135,4 @@ declare class VersionInfo {
1985
2135
  get(component: string): string | undefined;
1986
2136
  }
1987
2137
 
1988
- export { type StreamEventsOptions as $, Account as A, type BuildTransactionParams as B, ChainEvent as C, type BlockList as D, ExecutionStatus as E, Filter as F, type BlockQueryOptions as G, HeightSnapshot as H, type ListBlocksOptions as I, type RawBlockQueryOptions as J, type GetEventOptions as K, type ListAccountsOptions as L, type BlockSelector as M, type DeriveProgramAddressOptions as N, type DeriveProgramAddressResult as O, PageRequest as P, type GeneratedKeyPair as Q, type RawAccountQueryOptions as R, type SignedTransactionResult as S, Transaction as T, type StreamAccountUpdate as U, VersionInfo as V, type HeightSnapshotParams as W, type StreamAccountUpdatesOptions as X, type StreamAccountUpdatesResult as Y, type StreamBlocksOptions as Z, type StreamBlocksResult as _, accounts as a, type StreamEventsResult as a0, type StreamTransactionsOptions as a1, type StreamTransactionsResult as a2, type StreamTransactionUpdate as a3, type TrackTransactionOptions as a4, type TrackTransactionUpdate as a5, type TransactionExecutionEvent as a6, type TransactionExecutionResultData as a7, type InstructionContext as a8, type ProgramIdentifier as a9, listTransactionsForAccount as aA, streamTransactions as aB, buildTransaction as aC, buildAndSignTransaction as aD, sendTransaction as aE, batchSendTransactions as aF, trackTransaction as aG, getEvent as aH, streamEvents as aI, generateStateProof as aJ, generateKeyPair as aK, fromPrivateKey as aL, type Signature as aM, type Pubkey as aN, type BlockHash as aO, type ThruClientConfig as aP, type BatchSendTransactionsOptions as aa, type BuildAndSignTransactionOptions as ab, type BuildTransactionOptions as ac, type InstructionData as ad, type ListTransactionsForAccountOptions as ae, type RawTransactionQueryOptions as af, type TransactionAccountsConfig as ag, type TransactionFeePayerConfig as ah, type TransactionHeaderConfig as ai, type TransactionList as aj, type TransactionQueryOptions as ak, type GenerateStateProofOptions as al, type ThruClientContext as am, getBlock as an, getRawBlock as ao, listBlocks as ap, streamBlocks as aq, getBlockHeight as ar, getAccount as as, getRawAccount as at, listAccounts as au, streamAccountUpdates as av, createAccount as aw, getTransaction as ax, getRawTransaction as ay, getTransactionStatus as az, blocks as b, Block as c, FilterParamValue as d, events as e, PageResponse as f, StateProof as g, height as h, TransactionStatusSnapshot as i, deriveProgramAddress as j, keys as k, toPubkey as l, ConsensusStatus as m, FilterParamValueSchema as n, FilterSchema as o, proofs as p, AccountView as q, BlockView as r, streaming as s, transactions as t, TransactionView as u, TransactionVmError as v, type PageRequestParams as w, type PageResponseParams as x, type AccountQueryOptions as y, type CreateAccountOptions as z };
2138
+ export { type GetEventOptions as $, Account as A, type BuildTransactionParams as B, ChainEvent as C, FilterParamValueSchema as D, FilterSchema as E, Filter as F, AccountView as G, HeightSnapshot as H, BlockView as I, ExecutionStatus as J, TransactionView as K, TransactionVmError as L, type PageRequestParams as M, type PageResponseParams as N, type VersionContextInput as O, PageRequest as P, type AccountQueryOptions as Q, type CreateAccountOptions as R, type SignedTransactionResult as S, Transaction as T, type ListAccountsOptions as U, VersionInfo as V, type RawAccountQueryOptions as W, type BlockList as X, type BlockQueryOptions as Y, type ListBlocksOptions as Z, type RawBlockQueryOptions as _, accounts as a, slotVersionContext as a$, type BlockSelector as a0, type DeriveProgramAddressOptions as a1, type DeriveProgramAddressResult as a2, type GeneratedKeyPair as a3, type StreamAccountUpdate as a4, type HeightSnapshotParams as a5, type StreamAccountUpdatesOptions as a6, type StreamAccountUpdatesResult as a7, type StreamBlocksOptions as a8, type StreamBlocksResult as a9, listBlocks as aA, streamBlocks as aB, getBlockHeight as aC, getAccount as aD, getRawAccount as aE, listAccounts as aF, streamAccountUpdates as aG, createAccount as aH, getTransaction as aI, getRawTransaction as aJ, getTransactionStatus as aK, listTransactionsForAccount as aL, streamTransactions as aM, buildTransaction as aN, buildAndSignTransaction as aO, sendTransaction as aP, batchSendTransactions as aQ, trackTransaction as aR, getEvent as aS, streamEvents as aT, generateStateProof as aU, generateKeyPair as aV, fromPrivateKey as aW, consensusStatusToString as aX, versionContext as aY, currentVersionContext as aZ, currentOrHistoricalVersionContext as a_, type StreamEventsOptions as aa, type StreamEventsResult as ab, type StreamTransactionsOptions as ac, type StreamTransactionsResult as ad, type StreamTransactionUpdate as ae, type TrackTransactionOptions as af, type TrackTransactionUpdate as ag, type TransactionExecutionEvent as ah, type TransactionExecutionResultData as ai, type InstructionContext as aj, type ProgramIdentifier as ak, type BatchSendTransactionsOptions as al, type BuildAndSignTransactionOptions as am, type BuildTransactionOptions as an, type InstructionData as ao, type ListTransactionsForAccountOptions as ap, type RawTransactionQueryOptions as aq, type TransactionAccountsConfig as ar, type TransactionFeePayerConfig as as, type TransactionHeaderConfig as at, type TransactionList as au, type TransactionQueryOptions as av, type GenerateStateProofOptions as aw, type ThruClientContext as ax, getBlock as ay, getRawBlock as az, blocks as b, timestampVersionContext as b0, seqVersionContext as b1, type Signature as b2, type TsSignature as b3, type Pubkey as b4, type TaPubkey as b5, type BlockHash as b6, type ThruClientConfig as b7, consensus as c, Block as d, events as e, FilterParamValue as f, PageResponse as g, height as h, StateProof as i, TransactionStatusSnapshot as j, keys as k, deriveProgramAddress as l, toBlockHash as m, toPubkey as n, toPubkeyBytes as o, proofs as p, toSignature as q, toSignatureBytes as r, streaming as s, transactions as t, toTaPubkey as u, toTsSignature as v, collectStream as w, firstStreamValue as x, forEachStreamValue as y, ConsensusStatus as z };