@secondlayer/sdk 9.0.2 → 10.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -16,7 +16,30 @@ interface SecondLayerOptions {
16
16
  dumpsBaseUrl?: string;
17
17
  /** Deploy origin label sent as `x-sl-origin` (telemetry). Defaults to `cli`. */
18
18
  origin?: "cli" | "mcp" | "session";
19
+ /** Check the ed25519 signature on every Streams read. Omit for lenient
20
+ * (verify when signed, pass through unsigned self-host responses), `true`
21
+ * or `{ publicKey }` for strict, `false` for off. Reaches `sl.streams`. */
22
+ verify?: boolean | {
23
+ publicKey: string;
24
+ };
25
+ /** Check the dumps manifest signature before trusting any file hash
26
+ * (default on). Reaches `sl.streams.dumps`. */
27
+ verifyDumpsManifest?: boolean;
28
+ /** How long one request may take, headers and body, before it fails with a
29
+ * retryable `ApiError` (default 30 000 ms). A hung socket then trips the
30
+ * retry policy instead of stalling a walk or consume loop forever. `0`
31
+ * disables the timeout. */
32
+ requestTimeoutMs?: number;
19
33
  }
34
+ /** Default per-request budget. Long enough for a 1000-row filtered page on a
35
+ * cold cache, short enough that a half-open connection surfaces as a retry. */
36
+ declare const DEFAULT_REQUEST_TIMEOUT_MS = 3e4;
37
+ /** Per-call options every `request*` method accepts. */
38
+ type RequestOptions = {
39
+ /** Cancels the in-flight request (and its body read). The rejection is the
40
+ * signal's reason, an `AbortError` by default, never an `ApiError`. */
41
+ signal?: AbortSignal;
42
+ };
20
43
  /** Product default: the local one-box API. Override with `baseUrl` or `SL_API_URL`. */
21
44
  declare const LOCAL_API_URL = "http://127.0.0.1:3800";
22
45
  declare function resolveBaseUrl(explicit?: string): string;
@@ -50,14 +73,24 @@ declare abstract class BaseClient {
50
73
  protected apiKey?: string;
51
74
  protected origin: "cli" | "mcp" | "session";
52
75
  protected fetchImpl: FetchLike;
76
+ protected requestTimeoutMs: number;
53
77
  constructor(options?: Partial<SecondLayerOptions>);
54
78
  static authHeaders(apiKey?: string): Record<string, string>;
55
- protected request<T>(method: string, path: string, body?: unknown): Promise<T>;
79
+ protected request<T>(method: string, path: string, body?: unknown, opts?: RequestOptions): Promise<T>;
56
80
  /** Like `request`, but maps a 404 to `null` instead of throwing — the one
57
81
  * place that owns the "absent resource" rule for `get*` accessors. */
58
- protected requestOrNull<T>(method: string, path: string, body?: unknown): Promise<T | null>;
59
- protected requestText(method: string, path: string, body?: unknown): Promise<string>;
60
- private fetchResponse;
82
+ protected requestOrNull<T>(method: string, path: string, body?: unknown, opts?: RequestOptions): Promise<T | null>;
83
+ protected requestText(method: string, path: string, body?: unknown, opts?: RequestOptions): Promise<string>;
84
+ /** Run one request under the caller's signal plus the per-request timeout.
85
+ * One combined signal covers the fetch and the body read, so a socket that
86
+ * stalls mid-body times out the same way one that never answers does. A
87
+ * timeout rejects with a retryable `ApiError`; a caller abort rejects with
88
+ * the signal's reason so loops can tell "stop" from "try again". */
89
+ private withRequestBudget;
90
+ /** Issue the HTTP request and map non-2xx statuses onto the error family.
91
+ * `signal` is the combined caller-plus-timeout signal from `request*`;
92
+ * subclasses that stream a body call this directly and read it themselves. */
93
+ protected fetchResponse(method: string, path: string, body?: unknown, signal?: AbortSignal): Promise<Response>;
61
94
  }
62
95
  interface SubgraphSource {
63
96
  name: string;
@@ -120,8 +153,10 @@ declare class Subgraphs extends BaseClient {
120
153
  markdown(name: string, options?: SubgraphSpecOptions): Promise<string>;
121
154
  /**
122
155
  * Reindex always drops and rebuilds the whole subgraph, so it takes no
123
- * block range — the API rejects one with `REINDEX_RANGE_NOT_SUPPORTED`.
124
- * Use {@link backfill} to process a specific range.
156
+ * block range; the API rejects one with `REINDEX_RANGE_NOT_SUPPORTED`.
157
+ * Use {@link backfill} to process a specific range. While a reindex or
158
+ * backfill is already running the API answers 409 with code
159
+ * `OPERATION_IN_PROGRESS`; poll {@link operations} until it finishes.
125
160
  */
126
161
  reindex(name: string): Promise<ReindexResponse>;
127
162
  stop(name: string): Promise<{
@@ -129,6 +164,8 @@ declare class Subgraphs extends BaseClient {
129
164
  operationId?: string;
130
165
  status?: string;
131
166
  }>;
167
+ /** Process one block range. 409 `OPERATION_IN_PROGRESS` while another
168
+ * reindex or backfill runs on this subgraph. */
132
169
  backfill(name: string, options: {
133
170
  fromBlock: number;
134
171
  toBlock: number;
@@ -158,6 +195,9 @@ declare class Subgraphs extends BaseClient {
158
195
  /** Status of a single operation (poll the `operationId` returned by
159
196
  * reindex/backfill/stop until `status` is terminal). */
160
197
  getOperation(name: string, operationId: string): Promise<SubgraphOperationStatus>;
198
+ /** Create or update a subgraph. A deploy that needs a rebuild queues one;
199
+ * if a reindex or backfill is already running the API answers 409 with
200
+ * code `OPERATION_IN_PROGRESS` (an `ApiError`, not a dedicated class). */
161
201
  deploy(data: DeploySubgraphRequest): Promise<DeploySubgraphResponse>;
162
202
  getSource(name: string): Promise<SubgraphSource>;
163
203
  /**
@@ -188,6 +228,13 @@ declare class Subgraphs extends BaseClient {
188
228
  name: string;
189
229
  schema: Record<string, unknown>;
190
230
  }>(def: T): InferSubgraphClient<T>;
231
+ /**
232
+ * `columns` is the table's declared column set from `defineSubgraph()`.
233
+ * Filters and orderBy always accept the canonical system names
234
+ * `_id` / `_blockHeight` / `_txId` / `_createdAt`; the unprefixed
235
+ * shorthands (`id`, `blockHeight`, ...) mean the system column only when
236
+ * the table declares no column of that name.
237
+ */
191
238
  private createTableClient;
192
239
  }
193
240
  import { InferSubgraphClient as InferSubgraphClient2 } from "@secondlayer/subgraphs";
@@ -438,8 +485,11 @@ interface ConsumerSink<Tx = unknown> {
438
485
  * same `rewindCursor` (the lowest fork point) but its own
439
486
  * `forkPointHeight` — scope the undo by `forkPointHeight` only (contract
440
487
  * invariant #11), and expect re-application after a crash (#10).
488
+ *
489
+ * `rewindCursor` is `null` only for a fork at genesis: clear the
490
+ * checkpoint so the next run starts from the first event.
441
491
  */
442
- rollback(forkPointHeight: number, rewindCursor: string): Promise<void>;
492
+ rollback(forkPointHeight: number, rewindCursor: string | null): Promise<void>;
443
493
  }
444
494
  /** The transaction type a sink hands to `onBatch` (`ctx.tx`). */
445
495
  type SinkTx<S> = S extends ConsumerSink<infer Tx> ? Tx : never;
@@ -590,11 +640,41 @@ type StreamsEventsSubscribeParams = {
590
640
  filters?: StreamsFilterMap;
591
641
  /** Abort to unsubscribe (the returned function does the same). */
592
642
  signal?: AbortSignal;
593
- /** Called for each pushed event, in order. */
643
+ /**
644
+ * Called for each pushed event, in order. The resume cursor advances only
645
+ * after this resolves, so a handler that throws sees the same event again
646
+ * on reconnect (at-least-once). Key durable writes by `cursor`.
647
+ */
594
648
  onEvent: (event: StreamsEvent) => void | Promise<void>;
595
- /** Called on a connection error; the subscription auto-reconnects from the
596
- * last delivered cursor unless the signal has aborted. */
649
+ /**
650
+ * Called on every failure. Transport errors (dropped socket, 5xx, 429, a
651
+ * stale connection, a throwing handler) reconnect from the last handled
652
+ * cursor with exponential backoff. Errors that a retry cannot fix (401,
653
+ * 4xx, a bad signature) end the subscription and reject its `done`.
654
+ */
597
655
  onError?: (err: unknown) => void;
656
+ /**
657
+ * First reconnect pause in ms (default 1000). Doubles per consecutive
658
+ * failure up to 30 s with jitter, resets once a frame arrives, and never
659
+ * undercuts a `Retry-After`.
660
+ */
661
+ reconnectDelayMs?: number;
662
+ /**
663
+ * Reconnect when no frame (pings included) arrives for this long (default
664
+ * 60000, three server heartbeats). Catches a half-open socket that never
665
+ * errors; set it above your instance's heartbeat interval.
666
+ */
667
+ staleAfterMs?: number;
668
+ };
669
+ /**
670
+ * Handle for a live subscription: call it to unsubscribe. `done` resolves
671
+ * after unsubscribe (or the signal aborting) and rejects with the error that
672
+ * ended the loop when a retry could not fix it, so a worker can `await`
673
+ * it instead of polling for silence.
674
+ */
675
+ type StreamsSubscription = {
676
+ (): void;
677
+ done: Promise<void>;
598
678
  };
599
679
  /**
600
680
  * The checkpoint the SDK computes for a batch. Persist `cursor` inside the same
@@ -659,8 +739,11 @@ type StreamsBatchContext = ConsumerBatchContext;
659
739
  * The checkpoint for a reorg rollback. Persist `cursor` (the rewind position)
660
740
  * inside the same transaction as your rollback so the two commit atomically.
661
741
  */
742
+ /** `cursor` is the rewind position the loop resumes from after `onReorg`:
743
+ * the foot of the fork point, or `null` for a fork at genesis. Persist it
744
+ * in the same transaction as the rollback. */
662
745
  type StreamsReorgContext = {
663
- cursor: string;
746
+ cursor: string | null;
664
747
  };
665
748
  type StreamsEventsConsumeParams<
666
749
  TTx = never,
@@ -728,12 +811,23 @@ type StreamsEventsConsumeParams<
728
811
  onBatch?: (events: D extends true ? IndexEvent[] : StreamsEvent[], envelope: StreamsEventsEnvelope, ctx: StreamsBatchContext & WithSinkTx<TTx>) => void | string | null | undefined | Promise<void> | Promise<string | null | undefined>;
729
812
  /**
730
813
  * Roll your projection back to `reorg.fork_point_height`, persisting
731
- * `ctx.cursor` in the same transaction. Called once per *new* reorg
732
- * (deduped in-memory, fork-ascending) before the SDK rewinds and re-reads the
733
- * now-canonical events. Omit it to ignore reorgs (events stay canonical, but
734
- * stale rows from an orphaned fork are left in place).
814
+ * `ctx.cursor` in the same transaction. Called once per *new* reorg at or
815
+ * below the checkpoint (deduped in-memory, fork-ascending) before the SDK
816
+ * rewinds and re-reads the now-canonical events. A reorg whose fork sits
817
+ * above the checkpoint is not a rollback (nothing past it was written) and
818
+ * is skipped. Omit it to ignore reorgs (events stay canonical, but stale
819
+ * rows from an orphaned fork are left in place).
820
+ *
821
+ * With `onReorg` or a `sink` attached, every empty page also polls
822
+ * `reorgs.list` (one extra request per idle poll) so a fork that lands
823
+ * while the consumer idles at the tip is rolled back too.
735
824
  */
736
825
  onReorg?: (reorg: StreamsReorg, ctx: StreamsReorgContext) => Promise<void> | void;
826
+ /** Deepest rewind one reorg may make below the checkpoint before the loop
827
+ * refuses with `ValidationError`. Default 1000 blocks. The fork point is
828
+ * server supplied and drives a delete on every declared table, so raise
829
+ * this only for a source you trust. */
830
+ maxRollbackDepth?: number;
737
831
  /** Page-fetch retries after the first failure (429/5xx/network only —
738
832
  * 4xx and handler throws always propagate). Default 3; `0` disables. */
739
833
  retryCount?: number;
@@ -796,8 +890,16 @@ type StreamsEventsReplayParams = {
796
890
  * Called once per finalized dump file, in block order, before live tailing.
797
891
  * Process the parquet with your own tooling (e.g. DuckDB) — the SDK does not
798
892
  * decode parquet. Use `client.dumps.download(file)` to fetch + verify bytes.
893
+ *
894
+ * Delivery is file-granular and at-least-once: a file whose range straddles
895
+ * `from` is handed over whole. `ctx.from` is that cursor (`null` from
896
+ * genesis); skip rows at or below it, or key rows by `cursor` so a re-run
897
+ * is an idempotent no-op. Files ending at or below `from` are not handed
898
+ * over at all.
799
899
  */
800
- onDumpFile: (file: StreamsDumpFile) => Promise<void> | void;
900
+ onDumpFile: (file: StreamsDumpFile, ctx: {
901
+ from: string | null;
902
+ }) => Promise<void> | void;
801
903
  /** Called per live page after the dump phase, like `consume`. */
802
904
  onBatch: (events: StreamsEvent[], envelope: StreamsEventsEnvelope) => Promise<string | null | undefined> | string | null | undefined;
803
905
  /**
@@ -933,9 +1035,11 @@ type StreamsClient = {
933
1035
  * Subscribe to the real-time SSE push surface. Calls `onEvent` for each new
934
1036
  * canonical event as the server pushes it (chain cadence, not poll-bounded),
935
1037
  * and verifies each frame's inline ed25519 signature when the client was
936
- * created with `verify`. Returns an unsubscribe function.
1038
+ * created with `verify`. Returns an unsubscribe function whose `done`
1039
+ * settles when the loop ends. Not reorg-aware: an event delivered then
1040
+ * orphaned is never retracted. Durable writers use `consume()`.
937
1041
  */
938
- subscribe(params: StreamsEventsSubscribeParams): () => void;
1042
+ subscribe(params: StreamsEventsSubscribeParams): StreamsSubscription;
939
1043
  };
940
1044
  blocks: {
941
1045
  events(heightOrHash: number | string): Promise<StreamsEventsListEnvelope>;
@@ -1022,9 +1126,18 @@ type IndexConsumeOptions<
1022
1126
  * `consumerHealth().record`. */
1023
1127
  onProgress?: (ctx: ConsumerBatchContext) => void;
1024
1128
  onBatch: (items: TItem[], envelope: TEnvelope, ctx: ConsumerBatchContext & WithSinkTx<TTx>) => void | string | null | undefined | Promise<void> | Promise<string | null | undefined>;
1129
+ /** Called once per new reorg at or below the checkpoint, before the loop
1130
+ * rewinds to `ctx.cursor` (`null` = pre-genesis) and re-reads. A reorg
1131
+ * whose fork sits ABOVE the checkpoint is not a rollback: nothing past
1132
+ * it was written, so it is noted and the page is read as normal. */
1025
1133
  onReorg?: (reorg: IndexReorg, ctx: {
1026
- cursor: string;
1134
+ cursor: string | null;
1027
1135
  }) => Promise<void> | void;
1136
+ /** Deepest rewind one reorg may make below the checkpoint before the loop
1137
+ * refuses with `ValidationError`. Default 1000 blocks. The fork point is
1138
+ * server supplied and drives a delete on every declared table, so raise
1139
+ * this only for a source you trust. */
1140
+ maxRollbackDepth?: number;
1028
1141
  sleep?: Sleep;
1029
1142
  emptyBackoffMs?: number;
1030
1143
  maxPages?: number;
@@ -1143,10 +1256,24 @@ type FtTransfersListParams = {
1143
1256
  fromHeight?: number;
1144
1257
  toHeight?: number;
1145
1258
  };
1146
- type FtTransfersWalkParams = Omit<FtTransfersListParams, "limit"> & {
1259
+ /** Largest page any Index list route serves. The server clamps `limit` above
1260
+ * this without saying so, so `walk` refuses a bigger `batchSize` up front
1261
+ * rather than paging in silently smaller steps. */
1262
+ declare const INDEX_MAX_PAGE_SIZE = 1e3;
1263
+ /** Options every `walk*` feed shares on top of its list filters. Page fetches
1264
+ * retry with the same `retryCount`/`retryDelay`/`onError` vocabulary as
1265
+ * `consume()`; the tradeoff is that a walk can pause for the retry delays
1266
+ * instead of failing fast on the first 429. */
1267
+ type WalkOptions = PageRetryOptions & {
1268
+ /** Rows per page request. Default 200, max `INDEX_MAX_PAGE_SIZE` (1000). */
1147
1269
  batchSize?: number;
1270
+ /** Stops the walk. The iterator always rejects with the signal's reason (an
1271
+ * `AbortError` by default), whether the abort lands during a page request
1272
+ * (which is cancelled) or between yields, so a caller can tell a finished
1273
+ * walk from a stopped one. */
1148
1274
  signal?: AbortSignal;
1149
1275
  };
1276
+ type FtTransfersWalkParams = Omit<FtTransfersListParams, "limit"> & WalkOptions;
1150
1277
  type NftTransfer = {
1151
1278
  cursor: string;
1152
1279
  block_height: number;
@@ -1184,10 +1311,7 @@ type NftTransfersListParams = {
1184
1311
  fromHeight?: number;
1185
1312
  toHeight?: number;
1186
1313
  };
1187
- type NftTransfersWalkParams = Omit<NftTransfersListParams, "limit"> & {
1188
- batchSize?: number;
1189
- signal?: AbortSignal;
1190
- };
1314
+ type NftTransfersWalkParams = Omit<NftTransfersListParams, "limit"> & WalkOptions;
1191
1315
  type IndexEventBase = {
1192
1316
  cursor: string;
1193
1317
  block_height: number;
@@ -1342,10 +1466,7 @@ type EventsListParams<T extends IndexEventType = IndexEventType> = {
1342
1466
  */
1343
1467
  fields?: readonly (keyof IndexEventOf<T> & string)[];
1344
1468
  };
1345
- type EventsWalkParams<T extends IndexEventType = IndexEventType> = Omit<EventsListParams<T>, "limit"> & {
1346
- batchSize?: number;
1347
- signal?: AbortSignal;
1348
- };
1469
+ type EventsWalkParams<T extends IndexEventType = IndexEventType> = Omit<EventsListParams<T>, "limit"> & WalkOptions;
1349
1470
  type EventsConsumeParams<
1350
1471
  T extends IndexEventType = IndexEventType,
1351
1472
  TTx = never
@@ -1385,10 +1506,7 @@ type ContractCallsListParams = {
1385
1506
  * Mutually exclusive with contractId. */
1386
1507
  trait?: string;
1387
1508
  };
1388
- type ContractCallsWalkParams = Omit<ContractCallsListParams, "limit"> & {
1389
- batchSize?: number;
1390
- signal?: AbortSignal;
1391
- };
1509
+ type ContractCallsWalkParams = Omit<ContractCallsListParams, "limit"> & WalkOptions;
1392
1510
  type ContractCallsConsumeParams<TTx = never> = Omit<ContractCallsListParams, "cursor" | "fromCursor" | "limit"> & IndexConsumeOptions<IndexContractCall, ContractCallsEnvelope, TTx>;
1393
1511
  /** One canonical block in the sync map. Lean by design — block + parent hash
1394
1512
  * for chain linkage, burn anchor for Bitcoin confirmations. Use `blocks` for
@@ -1413,10 +1531,7 @@ type CanonicalListParams = {
1413
1531
  fromHeight?: number;
1414
1532
  toHeight?: number;
1415
1533
  };
1416
- type CanonicalWalkParams = Omit<CanonicalListParams, "limit"> & {
1417
- batchSize?: number;
1418
- signal?: AbortSignal;
1419
- };
1534
+ type CanonicalWalkParams = Omit<CanonicalListParams, "limit"> & WalkOptions;
1420
1535
  /** A block resource. Metadata is intentionally thin — only chain-linkage and
1421
1536
  * burn-anchor fields are persisted (no miner / tx_count / signer). */
1422
1537
  type IndexBlock = {
@@ -1445,10 +1560,7 @@ type BlocksListParams = {
1445
1560
  fromHeight?: number;
1446
1561
  toHeight?: number;
1447
1562
  };
1448
- type BlocksWalkParams = Omit<BlocksListParams, "limit"> & {
1449
- batchSize?: number;
1450
- signal?: AbortSignal;
1451
- };
1563
+ type BlocksWalkParams = Omit<BlocksListParams, "limit"> & WalkOptions;
1452
1564
  type IndexPostCondition = {
1453
1565
  type: "stx";
1454
1566
  principal: string;
@@ -1554,10 +1666,7 @@ type TransactionsListParams = {
1554
1666
  fromHeight?: number;
1555
1667
  toHeight?: number;
1556
1668
  };
1557
- type TransactionsWalkParams = Omit<TransactionsListParams, "limit"> & {
1558
- batchSize?: number;
1559
- signal?: AbortSignal;
1560
- };
1669
+ type TransactionsWalkParams = Omit<TransactionsListParams, "limit"> & WalkOptions;
1561
1670
  /** A decoded PoX-4 stacking action (one per stacking contract call). */
1562
1671
  type IndexStackingAction = {
1563
1672
  cursor: string;
@@ -1601,10 +1710,7 @@ type StackingListParams = {
1601
1710
  fromHeight?: number;
1602
1711
  toHeight?: number;
1603
1712
  };
1604
- type StackingWalkParams = Omit<StackingListParams, "limit"> & {
1605
- batchSize?: number;
1606
- signal?: AbortSignal;
1607
- };
1713
+ type StackingWalkParams = Omit<StackingListParams, "limit"> & WalkOptions;
1608
1714
  /** A pending (unconfirmed) transaction. Like a transaction document but
1609
1715
  * pre-chain — no block_height/tx_index/result/events — with `received_at` and
1610
1716
  * a sequence cursor instead of a block position. */
@@ -1660,10 +1766,7 @@ type MempoolListParams = {
1660
1766
  /** Filter to pending calls to a single function (composes with `contractId`). */
1661
1767
  functionName?: string;
1662
1768
  };
1663
- type MempoolWalkParams = Omit<MempoolListParams, "limit"> & {
1664
- batchSize?: number;
1665
- signal?: AbortSignal;
1666
- };
1769
+ type MempoolWalkParams = Omit<MempoolListParams, "limit"> & WalkOptions;
1667
1770
  /**
1668
1771
  * Empirical per-topic print payload schema for a contract, inferred from
1669
1772
  * sampled on-chain events. `topics` is sorted by count desc; `sampled` is true
@@ -1855,10 +1958,7 @@ type SbtcDepositsListParams = {
1855
1958
  type SbtcDepositAlwaysFields = "cursor" | "block_height";
1856
1959
  /** A deposit row narrowed to the requested columns plus the always-present ones. */
1857
1960
  type SbtcDepositFields<F extends keyof IndexSbtcDeposit & string> = Pick<IndexSbtcDeposit, (F | SbtcDepositAlwaysFields) & keyof IndexSbtcDeposit>;
1858
- type SbtcDepositsWalkParams = Omit<SbtcDepositsListParams, "limit"> & {
1859
- batchSize?: number;
1860
- signal?: AbortSignal;
1861
- };
1961
+ type SbtcDepositsWalkParams = Omit<SbtcDepositsListParams, "limit"> & WalkOptions;
1862
1962
  /** SbtcWithdrawal columns that survive any projection. */
1863
1963
  type SbtcWithdrawalAlwaysFields = "cursor" | "request_id";
1864
1964
  /** A SbtcWithdrawal row narrowed to the requested columns plus the always-present ones. */
@@ -1883,10 +1983,7 @@ type SbtcWithdrawalsListParams = {
1883
1983
  fromHeight?: number;
1884
1984
  toHeight?: number;
1885
1985
  };
1886
- type SbtcWithdrawalsWalkParams = Omit<SbtcWithdrawalsListParams, "limit"> & {
1887
- batchSize?: number;
1888
- signal?: AbortSignal;
1889
- };
1986
+ type SbtcWithdrawalsWalkParams = Omit<SbtcWithdrawalsListParams, "limit"> & WalkOptions;
1890
1987
  type SbtcEventsListParams = {
1891
1988
  cursor?: string | null;
1892
1989
  fromCursor?: string | null;
@@ -1899,10 +1996,7 @@ type SbtcEventsListParams = {
1899
1996
  fromHeight?: number;
1900
1997
  toHeight?: number;
1901
1998
  };
1902
- type SbtcEventsWalkParams = Omit<SbtcEventsListParams, "limit"> & {
1903
- batchSize?: number;
1904
- signal?: AbortSignal;
1905
- };
1999
+ type SbtcEventsWalkParams = Omit<SbtcEventsListParams, "limit"> & WalkOptions;
1906
2000
  type SbtcEventsConsumeParams<TTx = never> = Omit<SbtcEventsListParams, "cursor" | "fromCursor" | "limit"> & IndexConsumeOptions<IndexSbtcEvent, SbtcEventsEnvelope, TTx>;
1907
2001
  type SbtcDepositsConsumeParams<TTx = never> = Omit<SbtcDepositsListParams, "cursor" | "fromCursor" | "limit" | "fields"> & IndexConsumeOptions<IndexSbtcDeposit, SbtcDepositsEnvelope, TTx>;
1908
2002
  /** `index.sbtc` — the decoded sBTC peg surface (deposits, withdrawals, raw
@@ -1993,10 +2087,7 @@ type PoxCyclesListParams = {
1993
2087
  cursor?: number | null;
1994
2088
  limit?: number;
1995
2089
  };
1996
- type PoxCyclesWalkParams = Omit<PoxCyclesListParams, "limit"> & {
1997
- batchSize?: number;
1998
- signal?: AbortSignal;
1999
- };
2090
+ type PoxCyclesWalkParams = Omit<PoxCyclesListParams, "limit"> & WalkOptions;
2000
2091
  /** `index.pox` — PoX reward-cycle aggregates. */
2001
2092
  interface PoxResource {
2002
2093
  cycles: {
@@ -2071,10 +2162,7 @@ type Pox5EventsListParams = {
2071
2162
  fromHeight?: number;
2072
2163
  toHeight?: number;
2073
2164
  };
2074
- type Pox5EventsWalkParams = Omit<Pox5EventsListParams, "limit"> & {
2075
- batchSize?: number;
2076
- signal?: AbortSignal;
2077
- };
2165
+ type Pox5EventsWalkParams = Omit<Pox5EventsListParams, "limit"> & WalkOptions;
2078
2166
  /** `index.pox5` — decoded PoX-5 print events, the staking primitive from the
2079
2167
  * epoch 4.0 hard fork onward (PoX-4's `index.stacking` stream ends there). */
2080
2168
  interface Pox5Resource {
@@ -2279,9 +2367,13 @@ declare class Index extends BaseClient {
2279
2367
  private listNftTransfers;
2280
2368
  /** Shared keyset-pagination loop for every `walk*` feed: seed the cursor from
2281
2369
  * `cursor`/`fromCursor` (and `fromHeight` 0 on the first page), then page until
2282
- * the cursor stops advancing or a short page signals the tail. `list` merges the
2283
- * resource's filter params; `itemsOf` selects the envelope's item array. PoX
2284
- * cycles use a numeric cursor and are walked separately. */
2370
+ * the server stops advancing the cursor (`next_cursor` null or unchanged). A
2371
+ * short page is not a tail signal: the server clamps oversized limits without
2372
+ * saying so, so trusting page length truncated backfills. The cost is one
2373
+ * extra empty fetch at the end of feeds that never return a null cursor.
2374
+ * `list` merges the resource's filter params; `itemsOf` selects the envelope's
2375
+ * item array. Each page fetch retries under `fetchPageWithRetry`; the cursor
2376
+ * is a string keyset for every feed except PoX cycles, which use a number. */
2285
2377
  private keysetWalk;
2286
2378
  private walkFtTransfers;
2287
2379
  private walkNftTransfers;
@@ -2370,23 +2462,48 @@ interface ActiveSubgraphOperation {
2370
2462
  status: SubgraphOperationStatus["status"];
2371
2463
  progress: number | null;
2372
2464
  }
2465
+ /** Why one snapshot field could not be read. Serialized from the SDK error
2466
+ * family so a snapshot stays plain data. */
2467
+ interface ContextFieldError {
2468
+ message: string;
2469
+ /** Stable code from the API envelope (`UNAUTHORIZED`, `INDEX_NOT_READY`)
2470
+ * or the SDK (`REQUEST_TIMEOUT`); absent for a bare transport failure. */
2471
+ code?: string;
2472
+ /** HTTP status; `0` when the API could not be reached. */
2473
+ status?: number;
2474
+ /** Whether the same read can succeed on a retry (429, 5xx, network). */
2475
+ retryable: boolean;
2476
+ }
2477
+ /** One snapshot field: the value, or `null` plus the error that produced it.
2478
+ * `value: null` with no `error` means the read succeeded and found nothing. */
2479
+ interface ContextField<T> {
2480
+ value: T | null;
2481
+ error?: ContextFieldError;
2482
+ }
2373
2483
  /**
2374
- * A point-in-time orientation snapshot for an agent: who you are, the live tips,
2375
- * and what you own. Each field is `null` when it couldn't be read (e.g. no key,
2376
- * or a free-tier key for a Build+ surface) so the snapshot never throws.
2484
+ * A point-in-time orientation snapshot for an agent: the live tips and what
2485
+ * this instance holds. Every field is a {@link ContextField}, so a missing
2486
+ * value says why it is missing (API unreachable, token rejected, index still
2487
+ * catching up) instead of a bare `null`. `context()` itself never throws.
2377
2488
  */
2378
2489
  interface ContextSnapshot {
2379
- account: ContextAccount | null;
2380
- streamsTip: StreamsTip | null;
2381
- indexTip: IndexTip | null;
2382
- subgraphs: SubgraphSummary2[] | null;
2383
- subscriptions: {
2490
+ /** Token identity from `/api/accounts/me`. A self-hosted instance has no
2491
+ * account system: the read 404s and the field carries that error. */
2492
+ account: ContextField<ContextAccount>;
2493
+ streamsTip: ContextField<StreamsTip>;
2494
+ indexTip: ContextField<IndexTip>;
2495
+ subgraphs: ContextField<SubgraphSummary2[]>;
2496
+ subscriptions: ContextField<{
2384
2497
  count: number;
2385
2498
  byStatus: Record<string, number>;
2386
- } | null;
2499
+ }>;
2387
2500
  /** In-flight reindex operations (bounded to subgraphs reporting `reindexing`). */
2388
- activeOperations: ActiveSubgraphOperation[] | null;
2501
+ activeOperations: ContextField<ActiveSubgraphOperation[]>;
2389
2502
  }
2503
+ /** Fold one read into a {@link ContextField}: the value, or `null` with the
2504
+ * failure described. Exported for callers that assemble their own snapshot
2505
+ * from extra reads and want the same shape. */
2506
+ declare function contextField<T>(read: Promise<T>): Promise<ContextField<T>>;
2390
2507
  declare class SecondLayer extends BaseClient {
2391
2508
  readonly streams: StreamsClient;
2392
2509
  readonly index: Index;
@@ -2395,14 +2512,8 @@ declare class SecondLayer extends BaseClient {
2395
2512
  readonly subscriptions: Subscriptions;
2396
2513
  constructor(options?: Partial<SecondLayerOptions>);
2397
2514
  /**
2398
- * Assemble a {@link ContextSnapshot} — the same orientation an MCP agent reads
2399
- * from `secondlayer://context`, but available to any SDK/CLI consumer. Reads
2400
- * run concurrently and degrade to `null` per field on failure.
2401
- */
2402
- /**
2403
2515
  * Up to 10 public reads in one round trip (`POST /v1/batch`). Each item
2404
- * keeps its own auth/quota/x402 semantics; forwarded credentials (API key,
2405
- * PAYMENT-BALANCE/SESSION) apply to every item.
2516
+ * is authorized on its own; the client's bearer token applies to every item.
2406
2517
  */
2407
2518
  batch(requests: Array<{
2408
2519
  path: string;
@@ -2414,6 +2525,12 @@ declare class SecondLayer extends BaseClient {
2414
2525
  body: unknown;
2415
2526
  }>;
2416
2527
  }>;
2528
+ /**
2529
+ * Assemble a {@link ContextSnapshot}: the same orientation an MCP agent
2530
+ * reads from `secondlayer://context`, available to any SDK/CLI consumer.
2531
+ * Reads run concurrently; a failed read lands as `{ value: null, error }`
2532
+ * on its field rather than rejecting the whole snapshot.
2533
+ */
2417
2534
  context(): Promise<ContextSnapshot>;
2418
2535
  }
2419
2536
  /**
@@ -2437,6 +2554,8 @@ declare function getSubgraph<T extends {
2437
2554
  type CreateStreamsClientOptions = {
2438
2555
  apiKey?: string;
2439
2556
  baseUrl?: string;
2557
+ /** Deploy origin label sent as `x-sl-origin` (telemetry). Defaults to `cli`. */
2558
+ origin?: "cli" | "mcp" | "session";
2440
2559
  fetchImpl?: FetchLike2;
2441
2560
  /**
2442
2561
  * Public base URL for bulk parquet dumps (the R2/CDN bucket root). Required
@@ -2564,37 +2683,32 @@ declare class ApiError extends SecondLayerError {
2564
2683
  body?: unknown;
2565
2684
  constructor(status: number, message: string, body?: unknown, code?: string, options?: SecondLayerErrorOptions);
2566
2685
  }
2567
- /** Thrown on a 401 — by both the platform clients and Streams. */
2686
+ /** Thrown on a 401 by both the instance clients and Streams. Carries the
2687
+ * server's `{error, code}` envelope when it sent one, so a revoked token reads
2688
+ * differently from a missing one. */
2568
2689
  declare class AuthError extends ApiError {
2569
2690
  readonly status: 401;
2570
- constructor(message?: string);
2691
+ constructor(message?: string, body?: unknown, code?: string);
2571
2692
  }
2572
- /** Thrown on a 429 — by both the platform clients and Streams. `retryable`,
2693
+ /** Thrown on a 429 by both the instance clients and Streams. `retryable`,
2573
2694
  * with `retryAfterSeconds` parsed from the `Retry-After` header when sent. */
2574
2695
  declare class RateLimitError extends ApiError {
2575
2696
  /** Raw `Retry-After` header value (seconds or HTTP-date). */
2576
2697
  readonly retryAfter?: string | undefined;
2577
2698
  readonly status: 429;
2578
- constructor(message?: string, retryAfter?: string | undefined);
2699
+ constructor(message?: string, retryAfter?: string | undefined, body?: unknown, code?: string);
2579
2700
  }
2580
- /** Thrown on a 4xx the caller can fix (bad cursor, bad params). Never retried. */
2701
+ /** Thrown on a 4xx the caller can fix (bad cursor, bad params). Never retried.
2702
+ * `code` is the server's machine-readable code when the envelope carried one. */
2581
2703
  declare class ValidationError extends ApiError {
2582
- constructor(message: string, status: number, body?: unknown);
2704
+ constructor(message: string, status: number, body?: unknown, code?: string);
2583
2705
  }
2584
2706
  /** Parse a `Retry-After` header: delta-seconds or an HTTP-date. */
2585
2707
  declare function parseRetryAfter(value?: string | null): number | undefined;
2586
- /**
2587
- * Thrown on optimistic-concurrency conflict when a deploy supplies an
2588
- * `expectedVersion` that no longer matches the server's stored version.
2589
- */
2590
- declare class VersionConflictError extends ApiError {
2591
- currentVersion: string;
2592
- expectedVersion: string;
2593
- constructor(currentVersion: string, expectedVersion: string, message?: string);
2594
- }
2595
- /** Thrown on a 5xx from the Streams API. `retryable`. */
2708
+ /** Thrown on a 5xx from the Streams API, and on a failed signing-key fetch.
2709
+ * `retryable`: the page retry policy tries again. */
2596
2710
  declare class StreamsServerError extends ApiError {
2597
- constructor(message: string, status: number, body?: unknown);
2711
+ constructor(message: string, status: number, body?: unknown, code?: string);
2598
2712
  }
2599
2713
  /** Thrown when response signature verification is enabled and fails. */
2600
2714
  declare class StreamsSignatureError extends SecondLayerError {
@@ -2626,8 +2740,13 @@ declare const Cursor: {
2626
2740
  * every reorg. The sentinel is int4 max (the `event_index`/`tx_index` column
2627
2741
  * type), larger than any real index, so nothing at `height - 1` survives the
2628
2742
  * keyset and the next returned row is exactly `(height, 0)`.
2743
+ *
2744
+ * `atHeight(0)` is `null`: the pre-genesis position both consume loops
2745
+ * accept as "read everything from the first event". There is no string
2746
+ * cursor below `0:0`, and `0:0` itself is exclusive, so returning it here
2747
+ * skipped the genesis event.
2629
2748
  */
2630
- atHeight(height: number): string;
2749
+ atHeight(height: number): string | null;
2631
2750
  /** Parse a `<block>:<index>` cursor. Throws `ValidationError` if malformed. */
2632
2751
  parse(cursor: string): {
2633
2752
  blockHeight: number;
@@ -2834,4 +2953,4 @@ declare function verifySecondlayerSignature(rawBody: string, headers: WebhookHea
2834
2953
  declare function decodeChainWebhook(rawBody: string): ChainWebhookDelivery;
2835
2954
  import { RewardSet as RewardSet2 } from "@secondlayer/shared/node/consensus";
2836
2955
  import { decodeClarityValue, toJsonSafe } from "@secondlayer/shared/streams-rows";
2837
- export { verifyWebhookSignature, verifyTransactionProof, verify as verifyStandardWebhooksHeaders, verifySecondlayerSignature, trigger, toJsonSafe, shutdownSignal, resolveBaseUrl, resolveApiKey, parseRetryAfter, isStxTransfer, isStxMint, isStxLock, isStxBurn, isPrint, isNftTransfer, isNftMint, isNftBurn, isFtTransfer, isFtMint, isFtBurn, getSubgraph, fetchRewardSet, decodeStxTransfer, decodeStxMint, decodeStxLock, decodeStxBurn, decodePrint, decodeNftTransfer, decodeNftMint, decodeNftBurn, decodeFtTransfer, decodeFtMint, decodeFtBurn, decodeClarityValue, decodeChainWebhook, decode, createStreamsClient, consumerHealth, consumeIndexFeed, WithSinkTx, WebhookHeaderInput, VersionConflictError, ValidationError, UpdateSubscriptionRequest2 as UpdateSubscriptionRequest, TransactionsWalkParams, TransactionsListParams, TransactionsEnvelope, TransactionProofVerifyResult, TransactionProof, TransactionEnvelope, Subscriptions, SubscriptionSummary2 as SubscriptionSummary, SubscriptionStatus, SubscriptionRuntime, SubscriptionKind, SubscriptionFormat, SubscriptionDetail2 as SubscriptionDetail, Subgraphs, SubgraphSpecOptions3 as SubgraphSpecOptions, SubgraphSpecFormat2 as SubgraphSpecFormat, SubgraphOperationStatus, SubgraphAgentSchema3 as SubgraphAgentSchema, StreamsTip, StreamsSignatureError, StreamsServerError, StreamsReorgsListParams, StreamsReorgsListEnvelope, StreamsReorgContext, StreamsReorg, StreamsEventsSubscribeParams, StreamsEventsStreamParams, StreamsEventsListParams, StreamsEventsListEnvelope, StreamsEventsEnvelope, StreamsEventsConsumeResult, StreamsEventsConsumeParams, StreamsEventType, StreamsEventPayload, StreamsEvent, StreamsDumpsManifest, StreamsDumps, StreamsDumpFile, StreamsConsumeParams, StreamsClient, StreamsCanonicalBlock, StreamsBatchContext, StreamsBatch, StandardWebhooksHeaders2 as StandardWebhooksHeaders, StackingWalkParams, StackingListParams, StackingEnvelope, SinkTx, SecondLayerOptions, SecondLayerErrorOptions, SecondLayerError, SecondLayer, SbtcWithdrawalsWalkParams, SbtcWithdrawalsListParams, SbtcWithdrawalsEnvelope, SbtcWithdrawalSweptConfirmedEvent, SbtcWithdrawalStatus, SbtcWithdrawalEvent, SbtcWithdrawalEnvelope, SbtcSummaryEnvelope, SbtcResource, SbtcEventsWalkParams, SbtcEventsListParams, SbtcEventsEnvelope, SbtcEventsConsumeParams, SbtcEventTopic2 as SbtcEventTopic, SbtcDepositsWalkParams, SbtcDepositsListParams, SbtcDepositsEnvelope, SbtcDepositsConsumeParams, SbtcDepositEvent, SbtcDepositEnvelope, RotateSecretResponse2 as RotateSecretResponse, RewardSet2 as RewardSet, ReplayResult2 as ReplayResult, RateLimitError, PrintSchemaResponse, PoxResource, PoxCyclesWalkParams, PoxCyclesListParams, PoxCyclesEnvelope, PoxCycleEnvelope, Pox5Resource, Pox5EventsWalkParams, Pox5EventsListParams, Pox5EventsEnvelope, NftTransfersWalkParams, NftTransfersResource, NftTransfersListParams, NftTransfersEnvelope, NftTransferPayload2 as NftTransferPayload, NftTransferEvent, NftTransfer, MempoolWalkParams, MempoolTransactionEnvelope, MempoolListParams, MempoolEnvelope, LOCAL_API_URL, IndexTransaction, IndexTip, IndexStxTransfer, IndexStxMint, IndexStxLock, IndexStxBurn, IndexStackingAction, IndexSbtcWithdrawalPhase, IndexSbtcWithdrawalDetail, IndexSbtcWithdrawal, IndexSbtcSummary, IndexSbtcEvent, IndexSbtcDepositDetail, IndexSbtcDeposit, IndexReorg, IndexPrint, IndexPoxFunctionCount, IndexPoxCycle, IndexPox5EventTopic, IndexPox5Event, IndexPostCondition, IndexNftTransfer, IndexNftMint, IndexNftBurn, IndexMempoolTransaction, IndexFtTransfer, IndexFtMint, IndexFtBurn, IndexFeedItem, IndexFeedFetcher, IndexFeedEnvelope, IndexEventsResource, IndexEventTypeFilters, IndexEventType, IndexEventOf, IndexEventFields, IndexEvent, IndexDiscovery, IndexContractCall, IndexConsumeOptions, IndexCanonicalBlock, IndexBlock, IndexAlwaysFields, Index, FtTransfersWalkParams, FtTransfersResource, FtTransfersListParams, FtTransfersEnvelope, FtTransferPayload2 as FtTransferPayload, FtTransferEvent, FtTransfer, FetchLike2 as FetchLike, EventsWalkParams, EventsListParams, EventsEnvelope, EventsConsumeParams, DeliveryRow2 as DeliveryRow, DecodedStxTransferPayload, DecodedStxTransfer, DecodedStxMintPayload, DecodedStxMint, DecodedStxLockPayload, DecodedStxLock, DecodedStxBurnPayload, DecodedStxBurn, DecodedPrintValue, DecodedPrintPayload, DecodedPrint, DecodedNftTransferPayload, DecodedNftTransfer, DecodedNftMintPayload, DecodedNftMint, DecodedNftBurnPayload, DecodedNftBurn, DecodedFtTransferPayload, DecodedFtTransfer, DecodedFtMintPayload, DecodedFtMint, DecodedFtBurnPayload, DecodedFtBurn, DecodedEventRow, DecodedEventColumns, DeadRow2 as DeadRow, Cursor, CreateSubscriptionResponse2 as CreateSubscriptionResponse, CreateSubscriptionRequest2 as CreateSubscriptionRequest, ContractsListParams, ContractsEnvelope, Contracts, ContractSummary, ContractConformance, ContractCallsWalkParams, ContractCallsListParams, ContractCallsEnvelope, ContractCallsConsumeParams, ContextSnapshot, ContextAccount, ConsumerSink, ConsumerHealth, ConsumerBatchContext, ChainWebhookEnvelope, ChainWebhookDelivery2 as ChainWebhookDelivery, ChainTxLevelEvent, ChainTriggerType, ChainTrigger, ChainTestDelivery, ChainStxTransferData, ChainStxMintData, ChainStxLockData, ChainStxBurnData, ChainReorgRollbackEnvelope, ChainReorgRollbackDelivery, ChainReorgOrphanedEntry, ChainPrintEventData, ChainNftTransferData, ChainNftMintData, ChainNftBurnData, ChainFtTransferData, ChainFtMintData, ChainFtBurnData, ChainEventEnvelope, ChainApplyEnvelopeOf, ChainApplyEnvelope, ChainApplyDeliveryOf, CanonicalWalkParams, CanonicalListParams, CanonicalEnvelope, CREDENTIAL_ENV_VARS, BlocksWalkParams, BlocksListParams, BlocksEnvelope, BlockEnvelope, AuthError, ApiError, ActiveSubgraphOperation };
2956
+ export { verifyWebhookSignature, verifyTransactionProof, verify as verifyStandardWebhooksHeaders, verifySecondlayerSignature, trigger, toJsonSafe, shutdownSignal, resolveBaseUrl, resolveApiKey, parseRetryAfter, isStxTransfer, isStxMint, isStxLock, isStxBurn, isPrint, isNftTransfer, isNftMint, isNftBurn, isFtTransfer, isFtMint, isFtBurn, getSubgraph, fetchRewardSet, decodeStxTransfer, decodeStxMint, decodeStxLock, decodeStxBurn, decodePrint, decodeNftTransfer, decodeNftMint, decodeNftBurn, decodeFtTransfer, decodeFtMint, decodeFtBurn, decodeClarityValue, decodeChainWebhook, decode, createStreamsClient, contextField, consumerHealth, consumeIndexFeed, WithSinkTx, WebhookHeaderInput, WalkOptions, ValidationError, UpdateSubscriptionRequest2 as UpdateSubscriptionRequest, TransactionsWalkParams, TransactionsListParams, TransactionsEnvelope, TransactionProofVerifyResult, TransactionProof, TransactionEnvelope, Subscriptions, SubscriptionSummary2 as SubscriptionSummary, SubscriptionStatus, SubscriptionRuntime, SubscriptionKind, SubscriptionFormat, SubscriptionDetail2 as SubscriptionDetail, Subgraphs, SubgraphSpecOptions3 as SubgraphSpecOptions, SubgraphSpecFormat2 as SubgraphSpecFormat, SubgraphOperationStatus, SubgraphAgentSchema3 as SubgraphAgentSchema, StreamsTip, StreamsSubscription, StreamsSignatureError, StreamsServerError, StreamsReorgsListParams, StreamsReorgsListEnvelope, StreamsReorgContext, StreamsReorg, StreamsEventsSubscribeParams, StreamsEventsStreamParams, StreamsEventsListParams, StreamsEventsListEnvelope, StreamsEventsEnvelope, StreamsEventsConsumeResult, StreamsEventsConsumeParams, StreamsEventType, StreamsEventPayload, StreamsEvent, StreamsDumpsManifest, StreamsDumps, StreamsDumpFile, StreamsConsumeParams, StreamsClient, StreamsCanonicalBlock, StreamsBatchContext, StreamsBatch, StandardWebhooksHeaders2 as StandardWebhooksHeaders, StackingWalkParams, StackingListParams, StackingEnvelope, SinkTx, SecondLayerOptions, SecondLayerErrorOptions, SecondLayerError, SecondLayer, SbtcWithdrawalsWalkParams, SbtcWithdrawalsListParams, SbtcWithdrawalsEnvelope, SbtcWithdrawalSweptConfirmedEvent, SbtcWithdrawalStatus, SbtcWithdrawalEvent, SbtcWithdrawalEnvelope, SbtcSummaryEnvelope, SbtcResource, SbtcEventsWalkParams, SbtcEventsListParams, SbtcEventsEnvelope, SbtcEventsConsumeParams, SbtcEventTopic2 as SbtcEventTopic, SbtcDepositsWalkParams, SbtcDepositsListParams, SbtcDepositsEnvelope, SbtcDepositsConsumeParams, SbtcDepositEvent, SbtcDepositEnvelope, RotateSecretResponse2 as RotateSecretResponse, RewardSet2 as RewardSet, RequestOptions, ReplayResult2 as ReplayResult, RateLimitError, PrintSchemaResponse, PoxResource, PoxCyclesWalkParams, PoxCyclesListParams, PoxCyclesEnvelope, PoxCycleEnvelope, Pox5Resource, Pox5EventsWalkParams, Pox5EventsListParams, Pox5EventsEnvelope, NftTransfersWalkParams, NftTransfersResource, NftTransfersListParams, NftTransfersEnvelope, NftTransferPayload2 as NftTransferPayload, NftTransferEvent, NftTransfer, MempoolWalkParams, MempoolTransactionEnvelope, MempoolListParams, MempoolEnvelope, LOCAL_API_URL, IndexTransaction, IndexTip, IndexStxTransfer, IndexStxMint, IndexStxLock, IndexStxBurn, IndexStackingAction, IndexSbtcWithdrawalPhase, IndexSbtcWithdrawalDetail, IndexSbtcWithdrawal, IndexSbtcSummary, IndexSbtcEvent, IndexSbtcDepositDetail, IndexSbtcDeposit, IndexReorg, IndexPrint, IndexPoxFunctionCount, IndexPoxCycle, IndexPox5EventTopic, IndexPox5Event, IndexPostCondition, IndexNftTransfer, IndexNftMint, IndexNftBurn, IndexMempoolTransaction, IndexFtTransfer, IndexFtMint, IndexFtBurn, IndexFeedItem, IndexFeedFetcher, IndexFeedEnvelope, IndexEventsResource, IndexEventTypeFilters, IndexEventType, IndexEventOf, IndexEventFields, IndexEvent, IndexDiscovery, IndexContractCall, IndexConsumeOptions, IndexCanonicalBlock, IndexBlock, IndexAlwaysFields, Index, INDEX_MAX_PAGE_SIZE, FtTransfersWalkParams, FtTransfersResource, FtTransfersListParams, FtTransfersEnvelope, FtTransferPayload2 as FtTransferPayload, FtTransferEvent, FtTransfer, FetchLike2 as FetchLike, EventsWalkParams, EventsListParams, EventsEnvelope, EventsConsumeParams, DeliveryRow2 as DeliveryRow, DecodedStxTransferPayload, DecodedStxTransfer, DecodedStxMintPayload, DecodedStxMint, DecodedStxLockPayload, DecodedStxLock, DecodedStxBurnPayload, DecodedStxBurn, DecodedPrintValue, DecodedPrintPayload, DecodedPrint, DecodedNftTransferPayload, DecodedNftTransfer, DecodedNftMintPayload, DecodedNftMint, DecodedNftBurnPayload, DecodedNftBurn, DecodedFtTransferPayload, DecodedFtTransfer, DecodedFtMintPayload, DecodedFtMint, DecodedFtBurnPayload, DecodedFtBurn, DecodedEventRow, DecodedEventColumns, DeadRow2 as DeadRow, DEFAULT_REQUEST_TIMEOUT_MS, Cursor, CreateSubscriptionResponse2 as CreateSubscriptionResponse, CreateSubscriptionRequest2 as CreateSubscriptionRequest, ContractsListParams, ContractsEnvelope, Contracts, ContractSummary, ContractConformance, ContractCallsWalkParams, ContractCallsListParams, ContractCallsEnvelope, ContractCallsConsumeParams, ContextSnapshot, ContextFieldError, ContextField, ContextAccount, ConsumerSink, ConsumerHealth, ConsumerBatchContext, ChainWebhookEnvelope, ChainWebhookDelivery2 as ChainWebhookDelivery, ChainTxLevelEvent, ChainTriggerType, ChainTrigger, ChainTestDelivery, ChainStxTransferData, ChainStxMintData, ChainStxLockData, ChainStxBurnData, ChainReorgRollbackEnvelope, ChainReorgRollbackDelivery, ChainReorgOrphanedEntry, ChainPrintEventData, ChainNftTransferData, ChainNftMintData, ChainNftBurnData, ChainFtTransferData, ChainFtMintData, ChainFtBurnData, ChainEventEnvelope, ChainApplyEnvelopeOf, ChainApplyEnvelope, ChainApplyDeliveryOf, CanonicalWalkParams, CanonicalListParams, CanonicalEnvelope, CREDENTIAL_ENV_VARS, BlocksWalkParams, BlocksListParams, BlocksEnvelope, BlockEnvelope, AuthError, ApiError, ActiveSubgraphOperation };