@secondlayer/sdk 9.0.2 → 10.1.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,
@@ -680,7 +763,8 @@ type StreamsEventsConsumeParams<
680
763
  * the loop resumes from the sink's committed cursor, `onBatch` receives
681
764
  * `ctx.tx` and must write ONLY through it (rows and cursor commit in one
682
765
  * transaction), reorg rollback is automatic, and `onBatch`'s return value
683
- * is ignored.
766
+ * is ignored. Folds (balances) invert in the sink's `onRollback`, not in
767
+ * `onReorg`.
684
768
  */
685
769
  sink?: ConsumerSink<TTx>;
686
770
  /** Fires once per page, before `onBatch` and before any early return. */
@@ -728,12 +812,23 @@ type StreamsEventsConsumeParams<
728
812
  onBatch?: (events: D extends true ? IndexEvent[] : StreamsEvent[], envelope: StreamsEventsEnvelope, ctx: StreamsBatchContext & WithSinkTx<TTx>) => void | string | null | undefined | Promise<void> | Promise<string | null | undefined>;
729
813
  /**
730
814
  * 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).
815
+ * `ctx.cursor` in the same transaction. Called once per *new* reorg at or
816
+ * below the checkpoint (deduped in-memory, fork-ascending) before the SDK
817
+ * rewinds and re-reads the now-canonical events. A reorg whose fork sits
818
+ * above the checkpoint is not a rollback (nothing past it was written) and
819
+ * is skipped. Omit it to ignore reorgs (events stay canonical, but stale
820
+ * rows from an orphaned fork are left in place).
821
+ *
822
+ * With `onReorg` or a `sink` attached, every empty page also polls
823
+ * `reorgs.list` (one extra request per idle poll) so a fork that lands
824
+ * while the consumer idles at the tip is rolled back too.
735
825
  */
736
826
  onReorg?: (reorg: StreamsReorg, ctx: StreamsReorgContext) => Promise<void> | void;
827
+ /** Deepest rewind one reorg may make below the checkpoint before the loop
828
+ * refuses with `ValidationError`. Default 1000 blocks. The fork point is
829
+ * server supplied and drives a delete on every declared table, so raise
830
+ * this only for a source you trust. */
831
+ maxRollbackDepth?: number;
737
832
  /** Page-fetch retries after the first failure (429/5xx/network only —
738
833
  * 4xx and handler throws always propagate). Default 3; `0` disables. */
739
834
  retryCount?: number;
@@ -796,8 +891,16 @@ type StreamsEventsReplayParams = {
796
891
  * Called once per finalized dump file, in block order, before live tailing.
797
892
  * Process the parquet with your own tooling (e.g. DuckDB) — the SDK does not
798
893
  * decode parquet. Use `client.dumps.download(file)` to fetch + verify bytes.
894
+ *
895
+ * Delivery is file-granular and at-least-once: a file whose range straddles
896
+ * `from` is handed over whole. `ctx.from` is that cursor (`null` from
897
+ * genesis); skip rows at or below it, or key rows by `cursor` so a re-run
898
+ * is an idempotent no-op. Files ending at or below `from` are not handed
899
+ * over at all.
799
900
  */
800
- onDumpFile: (file: StreamsDumpFile) => Promise<void> | void;
901
+ onDumpFile: (file: StreamsDumpFile, ctx: {
902
+ from: string | null;
903
+ }) => Promise<void> | void;
801
904
  /** Called per live page after the dump phase, like `consume`. */
802
905
  onBatch: (events: StreamsEvent[], envelope: StreamsEventsEnvelope) => Promise<string | null | undefined> | string | null | undefined;
803
906
  /**
@@ -933,9 +1036,11 @@ type StreamsClient = {
933
1036
  * Subscribe to the real-time SSE push surface. Calls `onEvent` for each new
934
1037
  * canonical event as the server pushes it (chain cadence, not poll-bounded),
935
1038
  * and verifies each frame's inline ed25519 signature when the client was
936
- * created with `verify`. Returns an unsubscribe function.
1039
+ * created with `verify`. Returns an unsubscribe function whose `done`
1040
+ * settles when the loop ends. Not reorg-aware: an event delivered then
1041
+ * orphaned is never retracted. Durable writers use `consume()`.
937
1042
  */
938
- subscribe(params: StreamsEventsSubscribeParams): () => void;
1043
+ subscribe(params: StreamsEventsSubscribeParams): StreamsSubscription;
939
1044
  };
940
1045
  blocks: {
941
1046
  events(heightOrHash: number | string): Promise<StreamsEventsListEnvelope>;
@@ -1014,7 +1119,8 @@ type IndexConsumeOptions<
1014
1119
  * the loop resumes from the sink's committed cursor, `onBatch` receives
1015
1120
  * `ctx.tx` and must write ONLY through it (rows and cursor commit in one
1016
1121
  * transaction — a throw aborts both), reorg rollback is automatic (no
1017
- * `onReorg` needed), and `onBatch`'s return value is ignored.
1122
+ * `onReorg` needed), and `onBatch`'s return value is ignored. Folds
1123
+ * (balances) invert in the sink's `onRollback`, not in `onReorg`.
1018
1124
  */
1019
1125
  sink?: ConsumerSink<TTx>;
1020
1126
  /** Fires once per page, before `onBatch` and before any early return —
@@ -1022,9 +1128,18 @@ type IndexConsumeOptions<
1022
1128
  * `consumerHealth().record`. */
1023
1129
  onProgress?: (ctx: ConsumerBatchContext) => void;
1024
1130
  onBatch: (items: TItem[], envelope: TEnvelope, ctx: ConsumerBatchContext & WithSinkTx<TTx>) => void | string | null | undefined | Promise<void> | Promise<string | null | undefined>;
1131
+ /** Called once per new reorg at or below the checkpoint, before the loop
1132
+ * rewinds to `ctx.cursor` (`null` = pre-genesis) and re-reads. A reorg
1133
+ * whose fork sits ABOVE the checkpoint is not a rollback: nothing past
1134
+ * it was written, so it is noted and the page is read as normal. */
1025
1135
  onReorg?: (reorg: IndexReorg, ctx: {
1026
- cursor: string;
1136
+ cursor: string | null;
1027
1137
  }) => Promise<void> | void;
1138
+ /** Deepest rewind one reorg may make below the checkpoint before the loop
1139
+ * refuses with `ValidationError`. Default 1000 blocks. The fork point is
1140
+ * server supplied and drives a delete on every declared table, so raise
1141
+ * this only for a source you trust. */
1142
+ maxRollbackDepth?: number;
1028
1143
  sleep?: Sleep;
1029
1144
  emptyBackoffMs?: number;
1030
1145
  maxPages?: number;
@@ -1143,10 +1258,24 @@ type FtTransfersListParams = {
1143
1258
  fromHeight?: number;
1144
1259
  toHeight?: number;
1145
1260
  };
1146
- type FtTransfersWalkParams = Omit<FtTransfersListParams, "limit"> & {
1261
+ /** Largest page any Index list route serves. The server clamps `limit` above
1262
+ * this without saying so, so `walk` refuses a bigger `batchSize` up front
1263
+ * rather than paging in silently smaller steps. */
1264
+ declare const INDEX_MAX_PAGE_SIZE = 1e3;
1265
+ /** Options every `walk*` feed shares on top of its list filters. Page fetches
1266
+ * retry with the same `retryCount`/`retryDelay`/`onError` vocabulary as
1267
+ * `consume()`; the tradeoff is that a walk can pause for the retry delays
1268
+ * instead of failing fast on the first 429. */
1269
+ type WalkOptions = PageRetryOptions & {
1270
+ /** Rows per page request. Default 200, max `INDEX_MAX_PAGE_SIZE` (1000). */
1147
1271
  batchSize?: number;
1272
+ /** Stops the walk. The iterator always rejects with the signal's reason (an
1273
+ * `AbortError` by default), whether the abort lands during a page request
1274
+ * (which is cancelled) or between yields, so a caller can tell a finished
1275
+ * walk from a stopped one. */
1148
1276
  signal?: AbortSignal;
1149
1277
  };
1278
+ type FtTransfersWalkParams = Omit<FtTransfersListParams, "limit"> & WalkOptions;
1150
1279
  type NftTransfer = {
1151
1280
  cursor: string;
1152
1281
  block_height: number;
@@ -1184,10 +1313,7 @@ type NftTransfersListParams = {
1184
1313
  fromHeight?: number;
1185
1314
  toHeight?: number;
1186
1315
  };
1187
- type NftTransfersWalkParams = Omit<NftTransfersListParams, "limit"> & {
1188
- batchSize?: number;
1189
- signal?: AbortSignal;
1190
- };
1316
+ type NftTransfersWalkParams = Omit<NftTransfersListParams, "limit"> & WalkOptions;
1191
1317
  type IndexEventBase = {
1192
1318
  cursor: string;
1193
1319
  block_height: number;
@@ -1342,10 +1468,7 @@ type EventsListParams<T extends IndexEventType = IndexEventType> = {
1342
1468
  */
1343
1469
  fields?: readonly (keyof IndexEventOf<T> & string)[];
1344
1470
  };
1345
- type EventsWalkParams<T extends IndexEventType = IndexEventType> = Omit<EventsListParams<T>, "limit"> & {
1346
- batchSize?: number;
1347
- signal?: AbortSignal;
1348
- };
1471
+ type EventsWalkParams<T extends IndexEventType = IndexEventType> = Omit<EventsListParams<T>, "limit"> & WalkOptions;
1349
1472
  type EventsConsumeParams<
1350
1473
  T extends IndexEventType = IndexEventType,
1351
1474
  TTx = never
@@ -1385,10 +1508,7 @@ type ContractCallsListParams = {
1385
1508
  * Mutually exclusive with contractId. */
1386
1509
  trait?: string;
1387
1510
  };
1388
- type ContractCallsWalkParams = Omit<ContractCallsListParams, "limit"> & {
1389
- batchSize?: number;
1390
- signal?: AbortSignal;
1391
- };
1511
+ type ContractCallsWalkParams = Omit<ContractCallsListParams, "limit"> & WalkOptions;
1392
1512
  type ContractCallsConsumeParams<TTx = never> = Omit<ContractCallsListParams, "cursor" | "fromCursor" | "limit"> & IndexConsumeOptions<IndexContractCall, ContractCallsEnvelope, TTx>;
1393
1513
  /** One canonical block in the sync map. Lean by design — block + parent hash
1394
1514
  * for chain linkage, burn anchor for Bitcoin confirmations. Use `blocks` for
@@ -1413,10 +1533,7 @@ type CanonicalListParams = {
1413
1533
  fromHeight?: number;
1414
1534
  toHeight?: number;
1415
1535
  };
1416
- type CanonicalWalkParams = Omit<CanonicalListParams, "limit"> & {
1417
- batchSize?: number;
1418
- signal?: AbortSignal;
1419
- };
1536
+ type CanonicalWalkParams = Omit<CanonicalListParams, "limit"> & WalkOptions;
1420
1537
  /** A block resource. Metadata is intentionally thin — only chain-linkage and
1421
1538
  * burn-anchor fields are persisted (no miner / tx_count / signer). */
1422
1539
  type IndexBlock = {
@@ -1445,10 +1562,7 @@ type BlocksListParams = {
1445
1562
  fromHeight?: number;
1446
1563
  toHeight?: number;
1447
1564
  };
1448
- type BlocksWalkParams = Omit<BlocksListParams, "limit"> & {
1449
- batchSize?: number;
1450
- signal?: AbortSignal;
1451
- };
1565
+ type BlocksWalkParams = Omit<BlocksListParams, "limit"> & WalkOptions;
1452
1566
  type IndexPostCondition = {
1453
1567
  type: "stx";
1454
1568
  principal: string;
@@ -1554,10 +1668,7 @@ type TransactionsListParams = {
1554
1668
  fromHeight?: number;
1555
1669
  toHeight?: number;
1556
1670
  };
1557
- type TransactionsWalkParams = Omit<TransactionsListParams, "limit"> & {
1558
- batchSize?: number;
1559
- signal?: AbortSignal;
1560
- };
1671
+ type TransactionsWalkParams = Omit<TransactionsListParams, "limit"> & WalkOptions;
1561
1672
  /** A decoded PoX-4 stacking action (one per stacking contract call). */
1562
1673
  type IndexStackingAction = {
1563
1674
  cursor: string;
@@ -1601,10 +1712,7 @@ type StackingListParams = {
1601
1712
  fromHeight?: number;
1602
1713
  toHeight?: number;
1603
1714
  };
1604
- type StackingWalkParams = Omit<StackingListParams, "limit"> & {
1605
- batchSize?: number;
1606
- signal?: AbortSignal;
1607
- };
1715
+ type StackingWalkParams = Omit<StackingListParams, "limit"> & WalkOptions;
1608
1716
  /** A pending (unconfirmed) transaction. Like a transaction document but
1609
1717
  * pre-chain — no block_height/tx_index/result/events — with `received_at` and
1610
1718
  * a sequence cursor instead of a block position. */
@@ -1660,10 +1768,7 @@ type MempoolListParams = {
1660
1768
  /** Filter to pending calls to a single function (composes with `contractId`). */
1661
1769
  functionName?: string;
1662
1770
  };
1663
- type MempoolWalkParams = Omit<MempoolListParams, "limit"> & {
1664
- batchSize?: number;
1665
- signal?: AbortSignal;
1666
- };
1771
+ type MempoolWalkParams = Omit<MempoolListParams, "limit"> & WalkOptions;
1667
1772
  /**
1668
1773
  * Empirical per-topic print payload schema for a contract, inferred from
1669
1774
  * sampled on-chain events. `topics` is sorted by count desc; `sampled` is true
@@ -1855,10 +1960,7 @@ type SbtcDepositsListParams = {
1855
1960
  type SbtcDepositAlwaysFields = "cursor" | "block_height";
1856
1961
  /** A deposit row narrowed to the requested columns plus the always-present ones. */
1857
1962
  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
- };
1963
+ type SbtcDepositsWalkParams = Omit<SbtcDepositsListParams, "limit"> & WalkOptions;
1862
1964
  /** SbtcWithdrawal columns that survive any projection. */
1863
1965
  type SbtcWithdrawalAlwaysFields = "cursor" | "request_id";
1864
1966
  /** A SbtcWithdrawal row narrowed to the requested columns plus the always-present ones. */
@@ -1883,10 +1985,7 @@ type SbtcWithdrawalsListParams = {
1883
1985
  fromHeight?: number;
1884
1986
  toHeight?: number;
1885
1987
  };
1886
- type SbtcWithdrawalsWalkParams = Omit<SbtcWithdrawalsListParams, "limit"> & {
1887
- batchSize?: number;
1888
- signal?: AbortSignal;
1889
- };
1988
+ type SbtcWithdrawalsWalkParams = Omit<SbtcWithdrawalsListParams, "limit"> & WalkOptions;
1890
1989
  type SbtcEventsListParams = {
1891
1990
  cursor?: string | null;
1892
1991
  fromCursor?: string | null;
@@ -1899,10 +1998,7 @@ type SbtcEventsListParams = {
1899
1998
  fromHeight?: number;
1900
1999
  toHeight?: number;
1901
2000
  };
1902
- type SbtcEventsWalkParams = Omit<SbtcEventsListParams, "limit"> & {
1903
- batchSize?: number;
1904
- signal?: AbortSignal;
1905
- };
2001
+ type SbtcEventsWalkParams = Omit<SbtcEventsListParams, "limit"> & WalkOptions;
1906
2002
  type SbtcEventsConsumeParams<TTx = never> = Omit<SbtcEventsListParams, "cursor" | "fromCursor" | "limit"> & IndexConsumeOptions<IndexSbtcEvent, SbtcEventsEnvelope, TTx>;
1907
2003
  type SbtcDepositsConsumeParams<TTx = never> = Omit<SbtcDepositsListParams, "cursor" | "fromCursor" | "limit" | "fields"> & IndexConsumeOptions<IndexSbtcDeposit, SbtcDepositsEnvelope, TTx>;
1908
2004
  /** `index.sbtc` — the decoded sBTC peg surface (deposits, withdrawals, raw
@@ -1993,10 +2089,7 @@ type PoxCyclesListParams = {
1993
2089
  cursor?: number | null;
1994
2090
  limit?: number;
1995
2091
  };
1996
- type PoxCyclesWalkParams = Omit<PoxCyclesListParams, "limit"> & {
1997
- batchSize?: number;
1998
- signal?: AbortSignal;
1999
- };
2092
+ type PoxCyclesWalkParams = Omit<PoxCyclesListParams, "limit"> & WalkOptions;
2000
2093
  /** `index.pox` — PoX reward-cycle aggregates. */
2001
2094
  interface PoxResource {
2002
2095
  cycles: {
@@ -2071,10 +2164,7 @@ type Pox5EventsListParams = {
2071
2164
  fromHeight?: number;
2072
2165
  toHeight?: number;
2073
2166
  };
2074
- type Pox5EventsWalkParams = Omit<Pox5EventsListParams, "limit"> & {
2075
- batchSize?: number;
2076
- signal?: AbortSignal;
2077
- };
2167
+ type Pox5EventsWalkParams = Omit<Pox5EventsListParams, "limit"> & WalkOptions;
2078
2168
  /** `index.pox5` — decoded PoX-5 print events, the staking primitive from the
2079
2169
  * epoch 4.0 hard fork onward (PoX-4's `index.stacking` stream ends there). */
2080
2170
  interface Pox5Resource {
@@ -2279,9 +2369,13 @@ declare class Index extends BaseClient {
2279
2369
  private listNftTransfers;
2280
2370
  /** Shared keyset-pagination loop for every `walk*` feed: seed the cursor from
2281
2371
  * `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. */
2372
+ * the server stops advancing the cursor (`next_cursor` null or unchanged). A
2373
+ * short page is not a tail signal: the server clamps oversized limits without
2374
+ * saying so, so trusting page length truncated backfills. The cost is one
2375
+ * extra empty fetch at the end of feeds that never return a null cursor.
2376
+ * `list` merges the resource's filter params; `itemsOf` selects the envelope's
2377
+ * item array. Each page fetch retries under `fetchPageWithRetry`; the cursor
2378
+ * is a string keyset for every feed except PoX cycles, which use a number. */
2285
2379
  private keysetWalk;
2286
2380
  private walkFtTransfers;
2287
2381
  private walkNftTransfers;
@@ -2370,23 +2464,48 @@ interface ActiveSubgraphOperation {
2370
2464
  status: SubgraphOperationStatus["status"];
2371
2465
  progress: number | null;
2372
2466
  }
2467
+ /** Why one snapshot field could not be read. Serialized from the SDK error
2468
+ * family so a snapshot stays plain data. */
2469
+ interface ContextFieldError {
2470
+ message: string;
2471
+ /** Stable code from the API envelope (`UNAUTHORIZED`, `INDEX_NOT_READY`)
2472
+ * or the SDK (`REQUEST_TIMEOUT`); absent for a bare transport failure. */
2473
+ code?: string;
2474
+ /** HTTP status; `0` when the API could not be reached. */
2475
+ status?: number;
2476
+ /** Whether the same read can succeed on a retry (429, 5xx, network). */
2477
+ retryable: boolean;
2478
+ }
2479
+ /** One snapshot field: the value, or `null` plus the error that produced it.
2480
+ * `value: null` with no `error` means the read succeeded and found nothing. */
2481
+ interface ContextField<T> {
2482
+ value: T | null;
2483
+ error?: ContextFieldError;
2484
+ }
2373
2485
  /**
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.
2486
+ * A point-in-time orientation snapshot for an agent: the live tips and what
2487
+ * this instance holds. Every field is a {@link ContextField}, so a missing
2488
+ * value says why it is missing (API unreachable, token rejected, index still
2489
+ * catching up) instead of a bare `null`. `context()` itself never throws.
2377
2490
  */
2378
2491
  interface ContextSnapshot {
2379
- account: ContextAccount | null;
2380
- streamsTip: StreamsTip | null;
2381
- indexTip: IndexTip | null;
2382
- subgraphs: SubgraphSummary2[] | null;
2383
- subscriptions: {
2492
+ /** Token identity from `/api/accounts/me`. A self-hosted instance has no
2493
+ * account system: the read 404s and the field carries that error. */
2494
+ account: ContextField<ContextAccount>;
2495
+ streamsTip: ContextField<StreamsTip>;
2496
+ indexTip: ContextField<IndexTip>;
2497
+ subgraphs: ContextField<SubgraphSummary2[]>;
2498
+ subscriptions: ContextField<{
2384
2499
  count: number;
2385
2500
  byStatus: Record<string, number>;
2386
- } | null;
2501
+ }>;
2387
2502
  /** In-flight reindex operations (bounded to subgraphs reporting `reindexing`). */
2388
- activeOperations: ActiveSubgraphOperation[] | null;
2503
+ activeOperations: ContextField<ActiveSubgraphOperation[]>;
2389
2504
  }
2505
+ /** Fold one read into a {@link ContextField}: the value, or `null` with the
2506
+ * failure described. Exported for callers that assemble their own snapshot
2507
+ * from extra reads and want the same shape. */
2508
+ declare function contextField<T>(read: Promise<T>): Promise<ContextField<T>>;
2390
2509
  declare class SecondLayer extends BaseClient {
2391
2510
  readonly streams: StreamsClient;
2392
2511
  readonly index: Index;
@@ -2395,14 +2514,8 @@ declare class SecondLayer extends BaseClient {
2395
2514
  readonly subscriptions: Subscriptions;
2396
2515
  constructor(options?: Partial<SecondLayerOptions>);
2397
2516
  /**
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
2517
  * 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.
2518
+ * is authorized on its own; the client's bearer token applies to every item.
2406
2519
  */
2407
2520
  batch(requests: Array<{
2408
2521
  path: string;
@@ -2414,6 +2527,12 @@ declare class SecondLayer extends BaseClient {
2414
2527
  body: unknown;
2415
2528
  }>;
2416
2529
  }>;
2530
+ /**
2531
+ * Assemble a {@link ContextSnapshot}: the same orientation an MCP agent
2532
+ * reads from `secondlayer://context`, available to any SDK/CLI consumer.
2533
+ * Reads run concurrently; a failed read lands as `{ value: null, error }`
2534
+ * on its field rather than rejecting the whole snapshot.
2535
+ */
2417
2536
  context(): Promise<ContextSnapshot>;
2418
2537
  }
2419
2538
  /**
@@ -2437,6 +2556,8 @@ declare function getSubgraph<T extends {
2437
2556
  type CreateStreamsClientOptions = {
2438
2557
  apiKey?: string;
2439
2558
  baseUrl?: string;
2559
+ /** Deploy origin label sent as `x-sl-origin` (telemetry). Defaults to `cli`. */
2560
+ origin?: "cli" | "mcp" | "session";
2440
2561
  fetchImpl?: FetchLike2;
2441
2562
  /**
2442
2563
  * Public base URL for bulk parquet dumps (the R2/CDN bucket root). Required
@@ -2564,37 +2685,32 @@ declare class ApiError extends SecondLayerError {
2564
2685
  body?: unknown;
2565
2686
  constructor(status: number, message: string, body?: unknown, code?: string, options?: SecondLayerErrorOptions);
2566
2687
  }
2567
- /** Thrown on a 401 — by both the platform clients and Streams. */
2688
+ /** Thrown on a 401 by both the instance clients and Streams. Carries the
2689
+ * server's `{error, code}` envelope when it sent one, so a revoked token reads
2690
+ * differently from a missing one. */
2568
2691
  declare class AuthError extends ApiError {
2569
2692
  readonly status: 401;
2570
- constructor(message?: string);
2693
+ constructor(message?: string, body?: unknown, code?: string);
2571
2694
  }
2572
- /** Thrown on a 429 — by both the platform clients and Streams. `retryable`,
2695
+ /** Thrown on a 429 by both the instance clients and Streams. `retryable`,
2573
2696
  * with `retryAfterSeconds` parsed from the `Retry-After` header when sent. */
2574
2697
  declare class RateLimitError extends ApiError {
2575
2698
  /** Raw `Retry-After` header value (seconds or HTTP-date). */
2576
2699
  readonly retryAfter?: string | undefined;
2577
2700
  readonly status: 429;
2578
- constructor(message?: string, retryAfter?: string | undefined);
2701
+ constructor(message?: string, retryAfter?: string | undefined, body?: unknown, code?: string);
2579
2702
  }
2580
- /** Thrown on a 4xx the caller can fix (bad cursor, bad params). Never retried. */
2703
+ /** Thrown on a 4xx the caller can fix (bad cursor, bad params). Never retried.
2704
+ * `code` is the server's machine-readable code when the envelope carried one. */
2581
2705
  declare class ValidationError extends ApiError {
2582
- constructor(message: string, status: number, body?: unknown);
2706
+ constructor(message: string, status: number, body?: unknown, code?: string);
2583
2707
  }
2584
2708
  /** Parse a `Retry-After` header: delta-seconds or an HTTP-date. */
2585
2709
  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`. */
2710
+ /** Thrown on a 5xx from the Streams API, and on a failed signing-key fetch.
2711
+ * `retryable`: the page retry policy tries again. */
2596
2712
  declare class StreamsServerError extends ApiError {
2597
- constructor(message: string, status: number, body?: unknown);
2713
+ constructor(message: string, status: number, body?: unknown, code?: string);
2598
2714
  }
2599
2715
  /** Thrown when response signature verification is enabled and fails. */
2600
2716
  declare class StreamsSignatureError extends SecondLayerError {
@@ -2626,8 +2742,13 @@ declare const Cursor: {
2626
2742
  * every reorg. The sentinel is int4 max (the `event_index`/`tx_index` column
2627
2743
  * type), larger than any real index, so nothing at `height - 1` survives the
2628
2744
  * keyset and the next returned row is exactly `(height, 0)`.
2745
+ *
2746
+ * `atHeight(0)` is `null`: the pre-genesis position both consume loops
2747
+ * accept as "read everything from the first event". There is no string
2748
+ * cursor below `0:0`, and `0:0` itself is exclusive, so returning it here
2749
+ * skipped the genesis event.
2629
2750
  */
2630
- atHeight(height: number): string;
2751
+ atHeight(height: number): string | null;
2631
2752
  /** Parse a `<block>:<index>` cursor. Throws `ValidationError` if malformed. */
2632
2753
  parse(cursor: string): {
2633
2754
  blockHeight: number;
@@ -2834,4 +2955,4 @@ declare function verifySecondlayerSignature(rawBody: string, headers: WebhookHea
2834
2955
  declare function decodeChainWebhook(rawBody: string): ChainWebhookDelivery;
2835
2956
  import { RewardSet as RewardSet2 } from "@secondlayer/shared/node/consensus";
2836
2957
  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 };
2958
+ 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 };