@secondlayer/sdk 15.0.0 → 15.0.2
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 +755 -181
- package/dist/index.js.map +11 -11
- package/dist/streams/index.d.ts +190 -88
- package/dist/streams/index.js.map +3 -3
- package/dist/subgraphs/index.d.ts +754 -180
- package/dist/subgraphs/index.js.map +9 -9
- package/dist/webhooks/doctor.d.ts +1 -1
- package/dist/webhooks/doctor.js.map +1 -1
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -4,9 +4,20 @@ import { InstanceDiagnosis, PublicStatus } from "@secondlayer/shared/archive/ins
|
|
|
4
4
|
/** Structural `/public/status` payload. Extra fields are ignored by diagnosis. */
|
|
5
5
|
type InstanceStatus = PublicStatus;
|
|
6
6
|
type InstanceClient = {
|
|
7
|
+
/**
|
|
8
|
+
* Get the instance's public status report.
|
|
9
|
+
*
|
|
10
|
+
* Reads `GET /public/status`: the overall status, chain tip, chain integrity, and the state of each service and decoder.
|
|
11
|
+
*/
|
|
7
12
|
status(): Promise<InstanceStatus>;
|
|
13
|
+
/**
|
|
14
|
+
* Turn the status report into a verdict with next steps.
|
|
15
|
+
*
|
|
16
|
+
* Resolves to a `state` (`healthy`, `empty-index`, or `degraded`), the API's own `overall` status, and a list of issues, each with the commands that resolve it. A fresh instance with no blocks indexed reads as `empty-index`, not broken.
|
|
17
|
+
*/
|
|
8
18
|
diagnose(): Promise<InstanceDiagnosis>;
|
|
9
19
|
};
|
|
20
|
+
/** What to verify against, and the optional block range. */
|
|
10
21
|
type ArchiveVerifyInput = {
|
|
11
22
|
against: string;
|
|
12
23
|
target?: string;
|
|
@@ -16,6 +27,7 @@ type ArchiveVerifyInput = {
|
|
|
16
27
|
publicKeyPem?: string;
|
|
17
28
|
};
|
|
18
29
|
type ArchiveVerifyRangeStatus = "match" | "digest-mismatch" | "count-mismatch" | "missing";
|
|
30
|
+
/** Whether the archive is clean, diverged, or unanchored, by range. */
|
|
19
31
|
type ArchiveVerifyResult = {
|
|
20
32
|
status: "clean" | "diverged" | "unanchored";
|
|
21
33
|
target: string;
|
|
@@ -40,8 +52,11 @@ type ArchiveVerifyResult = {
|
|
|
40
52
|
};
|
|
41
53
|
import { RangeDigest } from "@secondlayer/shared/archive/range-digest";
|
|
42
54
|
import { ArchiveStatus } from "@secondlayer/shared/archive/status";
|
|
55
|
+
/** The three archive datasets: blocks, transactions, and events. */
|
|
43
56
|
type ArchiveDataset = "blocks" | "transactions" | "events";
|
|
57
|
+
/** Whether an archive purchase is a bootstrap or a repair. */
|
|
44
58
|
type ArchiveFlow = "bootstrap" | "repair";
|
|
59
|
+
/** One archive file: dataset, block range, path, rows, bytes. */
|
|
45
60
|
type ArchivePartition = {
|
|
46
61
|
dataset: string;
|
|
47
62
|
from_block: number;
|
|
@@ -64,6 +79,7 @@ type ArchiveManifest = {
|
|
|
64
79
|
key_id?: string;
|
|
65
80
|
[key: string]: unknown;
|
|
66
81
|
};
|
|
82
|
+
/** A loaded archive manifest with its origin and signature check. */
|
|
67
83
|
type LoadedArchive = {
|
|
68
84
|
manifest: ArchiveManifest;
|
|
69
85
|
origin: string;
|
|
@@ -74,6 +90,7 @@ type LoadedArchive = {
|
|
|
74
90
|
reason?: string;
|
|
75
91
|
};
|
|
76
92
|
};
|
|
93
|
+
/** The price of an archive request, after any free allowance. */
|
|
77
94
|
type ArchiveQuote = {
|
|
78
95
|
partitions: number;
|
|
79
96
|
bundles: number;
|
|
@@ -90,11 +107,13 @@ type ArchiveFetchItem = {
|
|
|
90
107
|
expiresAt: string;
|
|
91
108
|
chargedUsdMicros: number;
|
|
92
109
|
};
|
|
110
|
+
/** Download links for archive partitions and what they cost. */
|
|
93
111
|
type ArchiveFetchResult = {
|
|
94
112
|
urls: ArchiveFetchItem[];
|
|
95
113
|
chargedTotalUsdMicros: number;
|
|
96
114
|
balanceAfterUsdMicros: number;
|
|
97
115
|
};
|
|
116
|
+
/** Your archive credit balance and its refill settings. */
|
|
98
117
|
type ArchiveCreditsBalance = {
|
|
99
118
|
creditsUsdMicros: string;
|
|
100
119
|
refill: {
|
|
@@ -103,37 +122,88 @@ type ArchiveCreditsBalance = {
|
|
|
103
122
|
lastAt: string | null;
|
|
104
123
|
};
|
|
105
124
|
};
|
|
125
|
+
/** Options for loading an archive manifest. */
|
|
106
126
|
type ArchiveLoadOptions = {
|
|
107
127
|
insecure?: boolean;
|
|
108
128
|
};
|
|
109
129
|
type ArchiveClient = {
|
|
130
|
+
/**
|
|
131
|
+
* Load the latest signed archive manifest.
|
|
132
|
+
*
|
|
133
|
+
* Reads `<archive>/latest.json` unless `against` names another manifest URL. The manifest's ed25519 signature is checked against the archive signing key, and a missing or invalid one throws `ArchiveSignatureError`. `insecure: true` skips the check; `signature.verified` on the result says whether it held.
|
|
134
|
+
*/
|
|
110
135
|
latest(against?: string, opts?: ArchiveLoadOptions): Promise<LoadedArchive>;
|
|
136
|
+
/**
|
|
137
|
+
* Load an archive manifest from a URL.
|
|
138
|
+
*
|
|
139
|
+
* Takes http(s) URLs only; a local path throws a `ValidationError` and stays on the CLI. The signature check is the same as {@link latest}.
|
|
140
|
+
*/
|
|
111
141
|
load(against: string, opts?: ArchiveLoadOptions): Promise<LoadedArchive>;
|
|
142
|
+
/**
|
|
143
|
+
* Get the archive's current operational state.
|
|
144
|
+
*
|
|
145
|
+
* Reads the public `status.json`: `fresh`, `lagging`, `stale`, `gap`, `failed-audit`, or `source-unavailable`, plus how far the last signed publish reaches.
|
|
146
|
+
*/
|
|
112
147
|
status(): Promise<ArchiveStatus>;
|
|
148
|
+
/**
|
|
149
|
+
* List a loaded archive's partitions, optionally filtered.
|
|
150
|
+
*
|
|
151
|
+
* Runs locally on the manifest you already loaded and makes no request. Filter by `dataset` (`blocks`, `transactions`, or `events`) and a block range.
|
|
152
|
+
*/
|
|
113
153
|
partitions(ref: LoadedArchive, filter?: {
|
|
114
154
|
dataset?: ArchiveDataset;
|
|
115
155
|
fromBlock?: number;
|
|
116
156
|
toBlock?: number;
|
|
117
157
|
}): ArchivePartition[];
|
|
158
|
+
/**
|
|
159
|
+
* Price a fetch against your balance before you pay for it.
|
|
160
|
+
*
|
|
161
|
+
* Nothing is charged. `flow` is `bootstrap` or `repair`. The quote has the bundle count, the price in USD, the free repair allowance applied, your balance, and `sufficient`. Needs an account key (`sk-sl_*`), not an instance token.
|
|
162
|
+
*/
|
|
118
163
|
quote(input: {
|
|
119
164
|
paths: string[];
|
|
120
165
|
flow: ArchiveFlow;
|
|
121
166
|
}): Promise<ArchiveQuote>;
|
|
167
|
+
/**
|
|
168
|
+
* Get presigned download URLs for archive partitions.
|
|
169
|
+
*
|
|
170
|
+
* Draws credits per partition bundle; your first six repair bundles each month are free. Lists longer than 64 paths go out in batches of 64. Each URL is short-lived (`expiresAt`); pass it to {@link download}. An empty balance throws `InsufficientArchiveCreditsError` with the shortfall. Needs an account key (`sk-sl_*`).
|
|
171
|
+
*/
|
|
122
172
|
fetch(input: {
|
|
123
173
|
paths: string[];
|
|
124
174
|
flow: ArchiveFlow;
|
|
125
175
|
}): Promise<ArchiveFetchResult>;
|
|
176
|
+
/**
|
|
177
|
+
* Download a partition's bytes and verify them.
|
|
178
|
+
*
|
|
179
|
+
* The sha256 is checked against the manifest, and a mismatch throws `ArchiveSignatureError`. On the official archive host you must pass the presigned `url` from {@link fetch}, or it throws a `ValidationError`; any other host downloads straight from its archive tree.
|
|
180
|
+
*/
|
|
126
181
|
download(partition: ArchivePartition, opts?: {
|
|
127
182
|
url?: string;
|
|
128
183
|
}): Promise<Uint8Array>;
|
|
129
184
|
credits: {
|
|
185
|
+
/**
|
|
186
|
+
* Get your archive credit balance.
|
|
187
|
+
*
|
|
188
|
+
* Returns `creditsUsdMicros` (millionths of a dollar, as a string) and your auto-refill setting. Needs an account key (`sk-sl_*`).
|
|
189
|
+
*/
|
|
130
190
|
balance(): Promise<ArchiveCreditsBalance>;
|
|
191
|
+
/**
|
|
192
|
+
* Start a card checkout for a credit pack.
|
|
193
|
+
*
|
|
194
|
+
* `pack` is the dollar amount: 10, 25, 50, or 100. Resolves to the checkout `url`. Needs no account key.
|
|
195
|
+
*/
|
|
131
196
|
checkout(input: {
|
|
132
197
|
email: string;
|
|
133
198
|
pack: 10 | 25 | 50 | 100;
|
|
134
199
|
}): Promise<{
|
|
135
200
|
url: string;
|
|
136
201
|
}>;
|
|
202
|
+
/**
|
|
203
|
+
* Set or turn off automatic credit refill.
|
|
204
|
+
*
|
|
205
|
+
* Pass `belowUsd` and `packUsd` to buy a pack whenever the balance drops below the threshold, or `{ off: true }` to stop. Needs an account key (`sk-sl_*`).
|
|
206
|
+
*/
|
|
137
207
|
refill(input: {
|
|
138
208
|
belowUsd: number;
|
|
139
209
|
packUsd: 10 | 25 | 50 | 100;
|
|
@@ -147,6 +217,11 @@ type ArchiveClient = {
|
|
|
147
217
|
};
|
|
148
218
|
/** Hosted archive client plus instance `verify`. `status()` is still the public archive tree. */
|
|
149
219
|
type SecondLayerArchive = ArchiveClient & {
|
|
220
|
+
/**
|
|
221
|
+
* Check your instance's data against a signed archive.
|
|
222
|
+
*
|
|
223
|
+
* Runs `POST /v1/archive/verify` on your instance: read-only, and it compares raw identity digests only (the deep semantic check is CLI-only). Resolves to `clean`, `diverged`, or `unanchored`; a failed signature is `unanchored`, never `clean`. Narrow the check with `fromBlock` and `toBlock`. Verification is free.
|
|
224
|
+
*/
|
|
150
225
|
verify(input: ArchiveVerifyInput): Promise<ArchiveVerifyResult>;
|
|
151
226
|
};
|
|
152
227
|
type FetchLike = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
@@ -280,6 +355,7 @@ declare abstract class BaseClient {
|
|
|
280
355
|
*/
|
|
281
356
|
/** Whether a trait match must be declared in source, inferred from ABI, or either. */
|
|
282
357
|
type ContractConformance = "declared" | "inferred" | "any";
|
|
358
|
+
/** Trait, conformance, and paging for listing contracts. */
|
|
283
359
|
interface ContractsListParams {
|
|
284
360
|
/** Required. Trait identifier to match (e.g. "sip-010", or a fully-qualified trait). */
|
|
285
361
|
trait: string;
|
|
@@ -292,6 +368,7 @@ interface ContractsListParams {
|
|
|
292
368
|
/** Opaque cursor from a prior response's `next_cursor`. */
|
|
293
369
|
cursor?: string;
|
|
294
370
|
}
|
|
371
|
+
/** A deployed contract with its traits, standards, and ABI status. */
|
|
295
372
|
interface ContractSummary {
|
|
296
373
|
contract_id: string;
|
|
297
374
|
deployer: string;
|
|
@@ -302,6 +379,7 @@ interface ContractSummary {
|
|
|
302
379
|
/** Present only when `include: "abi"` was requested. */
|
|
303
380
|
abi?: unknown;
|
|
304
381
|
}
|
|
382
|
+
/** One page of contracts and the cursor for the next page. */
|
|
305
383
|
interface ContractsEnvelope {
|
|
306
384
|
contracts: ContractSummary[];
|
|
307
385
|
next_cursor: string | null;
|
|
@@ -311,8 +389,10 @@ declare class Contracts extends BaseClient {
|
|
|
311
389
|
/** Find contracts conforming to `trait`. `trait` is required (server 400s without it). */
|
|
312
390
|
list(params: ContractsListParams): Promise<ContractsEnvelope>;
|
|
313
391
|
/**
|
|
314
|
-
*
|
|
315
|
-
*
|
|
392
|
+
* Get one contract from the registry by id, or `null`.
|
|
393
|
+
*
|
|
394
|
+
* The prod-safe ABI source. Pass `{ includeAbi: true }` for the full ABI
|
|
395
|
+
* blob. Resolves to `null` on 404.
|
|
316
396
|
*/
|
|
317
397
|
get(contractId: string, opts?: {
|
|
318
398
|
includeAbi?: boolean;
|
|
@@ -533,6 +613,7 @@ type WithSinkTx<TTx> = [TTx] extends [never] ? unknown : {
|
|
|
533
613
|
import { VmEventType } from "@secondlayer/shared";
|
|
534
614
|
import { RuneEventType, RuneStreamsEvent, StreamsEvent, StreamsEventType, StreamsWireEvent, VmStreamsEvent } from "@secondlayer/shared/streams-rows";
|
|
535
615
|
import { StreamsWireEvent as StreamsWireEvent2, RuneEtchEntry, RuneEventPayload, StreamsEventPayload } from "@secondlayer/shared/streams-rows";
|
|
616
|
+
/** The chain tip: latest block, Bitcoin anchor, and finality boundary. */
|
|
536
617
|
type StreamsTip = {
|
|
537
618
|
block_height: number;
|
|
538
619
|
block_hash: string;
|
|
@@ -552,15 +633,19 @@ type StreamsTip = {
|
|
|
552
633
|
/** Oldest seekable cursor (`<oldest_seekable_height>:0`); `null` = unlimited. */
|
|
553
634
|
oldest_cursor?: string | null;
|
|
554
635
|
};
|
|
555
|
-
/**
|
|
556
|
-
*
|
|
557
|
-
*
|
|
636
|
+
/**
|
|
637
|
+
* The Bitcoin tip, without burn-chain or retention fields.
|
|
638
|
+
*
|
|
639
|
+
* Bitcoin has no burn chain of its own, and Runes reads have no retention
|
|
640
|
+
* ladder. Returned by `tip({ chain: "bitcoin" })`.
|
|
641
|
+
*/
|
|
558
642
|
type StreamsBitcoinTip = {
|
|
559
643
|
block_height: number;
|
|
560
644
|
block_hash: string;
|
|
561
645
|
finalized_height: number;
|
|
562
646
|
lag_seconds: number;
|
|
563
647
|
};
|
|
648
|
+
/** A canonical Stacks block with its Bitcoin anchor. */
|
|
564
649
|
type StreamsCanonicalBlock = {
|
|
565
650
|
block_height: number;
|
|
566
651
|
block_hash: string;
|
|
@@ -568,7 +653,7 @@ type StreamsCanonicalBlock = {
|
|
|
568
653
|
burn_block_hash: string | null;
|
|
569
654
|
is_canonical: true;
|
|
570
655
|
};
|
|
571
|
-
/**
|
|
656
|
+
/** A Bitcoin canonical block, without burn-chain fields. */
|
|
572
657
|
type StreamsBitcoinCanonicalBlock = {
|
|
573
658
|
block_height: number;
|
|
574
659
|
block_hash: string;
|
|
@@ -589,6 +674,7 @@ type StreamsReorg = {
|
|
|
589
674
|
*/
|
|
590
675
|
new_canonical_tip: string;
|
|
591
676
|
};
|
|
677
|
+
/** One page of events with the next cursor, tip, and reorgs. */
|
|
592
678
|
type StreamsEventsEnvelope<
|
|
593
679
|
TEvent = StreamsEvent,
|
|
594
680
|
TTip = StreamsTip
|
|
@@ -598,24 +684,30 @@ type StreamsEventsEnvelope<
|
|
|
598
684
|
tip: TTip;
|
|
599
685
|
reorgs: StreamsReorg[];
|
|
600
686
|
};
|
|
687
|
+
/** One page of events with the tip and reorgs, no cursor. */
|
|
601
688
|
type StreamsEventsListEnvelope<
|
|
602
689
|
TEvent = StreamsEvent,
|
|
603
690
|
TTip = StreamsTip
|
|
604
691
|
> = Omit<StreamsEventsEnvelope<TEvent, TTip>, "next_cursor">;
|
|
605
|
-
/**
|
|
606
|
-
*
|
|
692
|
+
/**
|
|
693
|
+
* The event union narrowed to a `types` selection.
|
|
694
|
+
*
|
|
695
|
+
* A const-generic `types: ["ft_transfer"]` narrows the event type.
|
|
696
|
+
*/
|
|
607
697
|
type StreamsEventOfTypes<T extends readonly StreamsEventType[]> = Extract<StreamsEvent, {
|
|
608
698
|
event_type: T[number];
|
|
609
699
|
}>;
|
|
700
|
+
/** A starting point and limit for listing reorgs. */
|
|
610
701
|
type StreamsReorgsListParams = {
|
|
611
702
|
since: string;
|
|
612
703
|
limit?: number;
|
|
613
704
|
};
|
|
705
|
+
/** A list of reorgs and the cursor to resume from. */
|
|
614
706
|
type StreamsReorgsListEnvelope = {
|
|
615
707
|
reorgs: StreamsReorg[];
|
|
616
708
|
next_since: string | null;
|
|
617
709
|
};
|
|
618
|
-
/** A
|
|
710
|
+
/** A single value or a list of values to match. */
|
|
619
711
|
type StreamsFilterValue = string | readonly string[];
|
|
620
712
|
/**
|
|
621
713
|
* One labelled filter group. Fields inside a group AND together; groups in a
|
|
@@ -645,14 +737,15 @@ type StreamsEventForFilter<
|
|
|
645
737
|
}> : Extract<StreamsEvent, {
|
|
646
738
|
event_type: T;
|
|
647
739
|
}> : D extends true ? IndexEvent : StreamsEvent;
|
|
740
|
+
/** Cursor, height range, and limit shared by every list call. */
|
|
648
741
|
type StreamsEventsListParamsCommon = {
|
|
649
742
|
cursor?: string | null;
|
|
650
743
|
fromHeight?: number;
|
|
651
744
|
toHeight?: number;
|
|
652
745
|
limit?: number;
|
|
653
746
|
};
|
|
654
|
-
/** `chain: "stacks"` (default, omit `chain` entirely) — unchanged since
|
|
655
|
-
*
|
|
747
|
+
/** `chain: "stacks"` (default, omit `chain` entirely) — unchanged since before Runes events
|
|
748
|
+
* were added. */
|
|
656
749
|
type StreamsEventsStacksListParams = StreamsEventsListParamsCommon & {
|
|
657
750
|
chain?: "stacks";
|
|
658
751
|
/** `vm` reads ordinal. Omit for Streams 1.0. */
|
|
@@ -672,12 +765,13 @@ type StreamsEventsStacksListParams = StreamsEventsListParamsCommon & {
|
|
|
672
765
|
filters?: StreamsFilterMap;
|
|
673
766
|
};
|
|
674
767
|
/**
|
|
675
|
-
*
|
|
676
|
-
*
|
|
677
|
-
* `
|
|
678
|
-
*
|
|
679
|
-
*
|
|
680
|
-
*
|
|
768
|
+
* List options for Runes events, with their own cursor space.
|
|
769
|
+
*
|
|
770
|
+
* `types` is restricted to `RuneEventType` at the type level, so e.g. `{ chain:
|
|
771
|
+
* "bitcoin", types: ["ft_transfer"] }` is a compile error rather than a silent
|
|
772
|
+
* 400 at request time. `contractId`, `sender`, `recipient`, `assetIdentifier`,
|
|
773
|
+
* `filters`, and `clock` don't exist on this branch; they're Stacks-only (the
|
|
774
|
+
* server 400s on them too).
|
|
681
775
|
*/
|
|
682
776
|
type StreamsEventsBitcoinListParams = StreamsEventsListParamsCommon & {
|
|
683
777
|
chain: "bitcoin";
|
|
@@ -688,7 +782,9 @@ type StreamsEventsBitcoinListParams = StreamsEventsListParamsCommon & {
|
|
|
688
782
|
/** A mainnet address. */
|
|
689
783
|
address?: string;
|
|
690
784
|
};
|
|
785
|
+
/** Chain, cursor, height range, and filters for listing Streams events. */
|
|
691
786
|
type StreamsEventsListParams = StreamsEventsStacksListParams | StreamsEventsBitcoinListParams;
|
|
787
|
+
/** Cursor, batching, and stop options shared by every event stream. */
|
|
692
788
|
type StreamsEventsStreamCommon = {
|
|
693
789
|
fromCursor?: string | null;
|
|
694
790
|
batchSize?: number;
|
|
@@ -697,8 +793,12 @@ type StreamsEventsStreamCommon = {
|
|
|
697
793
|
maxEmptyPolls?: number;
|
|
698
794
|
signal?: AbortSignal;
|
|
699
795
|
};
|
|
700
|
-
/**
|
|
701
|
-
*
|
|
796
|
+
/**
|
|
797
|
+
* Stream options for Stacks events, the default chain.
|
|
798
|
+
*
|
|
799
|
+
* `chain: "stacks"` is the default, so omit `chain` entirely. Matches
|
|
800
|
+
* `StreamsEventsStacksListParams`.
|
|
801
|
+
*/
|
|
702
802
|
type StreamsEventsStreamStacksParams = StreamsEventsStreamCommon & {
|
|
703
803
|
chain?: "stacks";
|
|
704
804
|
types?: readonly StreamsEventType[];
|
|
@@ -710,11 +810,14 @@ type StreamsEventsStreamStacksParams = StreamsEventsStreamCommon & {
|
|
|
710
810
|
/** Labelled filter groups; see {@link StreamsEventsListParams.filters}. */
|
|
711
811
|
filters?: StreamsFilterMap;
|
|
712
812
|
};
|
|
713
|
-
/**
|
|
714
|
-
*
|
|
715
|
-
*
|
|
716
|
-
*
|
|
717
|
-
*
|
|
813
|
+
/**
|
|
814
|
+
* Stream options for Runes events, tailed like the Stacks default.
|
|
815
|
+
*
|
|
816
|
+
* `types` is restricted to `RuneEventType` at the type level, matching
|
|
817
|
+
* `StreamsEventsBitcoinListParams`. `contractId`, `sender`, `recipient`,
|
|
818
|
+
* `assetIdentifier`, and `filters` don't exist on this branch; they're
|
|
819
|
+
* Stacks-only.
|
|
820
|
+
*/
|
|
718
821
|
type StreamsEventsStreamBitcoinParams = StreamsEventsStreamCommon & {
|
|
719
822
|
chain: "bitcoin";
|
|
720
823
|
types?: readonly RuneEventType[];
|
|
@@ -768,9 +871,12 @@ type StreamsEventsSubscribeStacksParams = StreamsEventsSubscribeCommon & {
|
|
|
768
871
|
*/
|
|
769
872
|
onEvent: (event: StreamsEvent) => void | Promise<void>;
|
|
770
873
|
};
|
|
771
|
-
/**
|
|
772
|
-
*
|
|
773
|
-
*
|
|
874
|
+
/**
|
|
875
|
+
* Options for pushing Runes events live, on their own cursor space.
|
|
876
|
+
*
|
|
877
|
+
* `contractId`, `sender`, `recipient`, `assetIdentifier`, and `filters` don't
|
|
878
|
+
* exist on this branch; they're Stacks-only.
|
|
879
|
+
*/
|
|
774
880
|
type StreamsEventsSubscribeBitcoinParams = StreamsEventsSubscribeCommon & {
|
|
775
881
|
chain: "bitcoin";
|
|
776
882
|
types?: readonly RuneEventType[];
|
|
@@ -861,6 +967,7 @@ type StreamsBatchContext = ConsumerBatchContext;
|
|
|
861
967
|
type StreamsReorgContext = {
|
|
862
968
|
cursor: string | null;
|
|
863
969
|
};
|
|
970
|
+
/** Options for consuming Streams events: cursor, batching, filters, handler. */
|
|
864
971
|
type StreamsEventsConsumeParams<
|
|
865
972
|
TTx = never,
|
|
866
973
|
D extends boolean = false,
|
|
@@ -978,13 +1085,14 @@ type StreamsEventsConsumeParams<
|
|
|
978
1085
|
wake?: () => Promise<void>;
|
|
979
1086
|
};
|
|
980
1087
|
/**
|
|
981
|
-
*
|
|
982
|
-
*
|
|
983
|
-
*
|
|
984
|
-
*
|
|
985
|
-
*
|
|
986
|
-
*
|
|
987
|
-
*
|
|
1088
|
+
* Options for the checkpointed sweep over Runes events.
|
|
1089
|
+
*
|
|
1090
|
+
* A separate, simpler type from `StreamsEventsConsumeParams` rather than a
|
|
1091
|
+
* widened union member: `filters`, `on`, and `decoded` are Stacks-only concepts
|
|
1092
|
+
* (labelled OR-groups and Index-shaped projection have no Runes equivalent
|
|
1093
|
+
* yet), so `onBatch` is the only way in and is required. Reorg rewind still
|
|
1094
|
+
* works the same way (bitcoin reorgs carry the same `fork_point_height` and
|
|
1095
|
+
* `new_canonical_tip` shape as Stacks ones).
|
|
988
1096
|
*/
|
|
989
1097
|
type StreamsEventsConsumeBitcoinParams<TTx = never> = {
|
|
990
1098
|
chain: "bitcoin";
|
|
@@ -1017,9 +1125,10 @@ type StreamsEventsConsumeBitcoinParams<TTx = never> = {
|
|
|
1017
1125
|
wake?: () => Promise<void>;
|
|
1018
1126
|
};
|
|
1019
1127
|
/**
|
|
1020
|
-
* One
|
|
1021
|
-
*
|
|
1022
|
-
*
|
|
1128
|
+
* One page yielded by `consume`, with `cursor` to persist and resume.
|
|
1129
|
+
*
|
|
1130
|
+
* It is the `GET /v1/streams/events` envelope verbatim, with `next_cursor`
|
|
1131
|
+
* renamed to `cursor`.
|
|
1023
1132
|
*/
|
|
1024
1133
|
type StreamsBatch<
|
|
1025
1134
|
TEvent = StreamsEvent,
|
|
@@ -1033,6 +1142,7 @@ type StreamsBatch<
|
|
|
1033
1142
|
/** Chain reorgs reported alongside this page; empty when none. */
|
|
1034
1143
|
reorgs: StreamsReorg[];
|
|
1035
1144
|
};
|
|
1145
|
+
/** Cursor, batch size, and polling options shared by every consume loop. */
|
|
1036
1146
|
type StreamsConsumeCommon = {
|
|
1037
1147
|
/** Resume strictly after this cursor; omit to start from the oldest seekable page. */
|
|
1038
1148
|
cursor?: string | null;
|
|
@@ -1056,9 +1166,12 @@ type StreamsConsumeStacksParams = StreamsConsumeCommon & {
|
|
|
1056
1166
|
* event echoes the labels it matched. */
|
|
1057
1167
|
filters?: StreamsFilterMap;
|
|
1058
1168
|
};
|
|
1059
|
-
/**
|
|
1060
|
-
*
|
|
1061
|
-
*
|
|
1169
|
+
/**
|
|
1170
|
+
* Consume options for Runes batches, with their own cursor space.
|
|
1171
|
+
*
|
|
1172
|
+
* `contractId`, `sender`, `recipient`, `assetIdentifier`, and `filters` don't
|
|
1173
|
+
* exist on this branch; they're Stacks-only.
|
|
1174
|
+
*/
|
|
1062
1175
|
type StreamsConsumeBitcoinParams = StreamsConsumeCommon & {
|
|
1063
1176
|
chain: "bitcoin";
|
|
1064
1177
|
types?: readonly RuneEventType[];
|
|
@@ -1069,11 +1182,13 @@ type StreamsConsumeBitcoinParams = StreamsConsumeCommon & {
|
|
|
1069
1182
|
address?: string;
|
|
1070
1183
|
};
|
|
1071
1184
|
type StreamsConsumeParams = StreamsConsumeStacksParams | StreamsConsumeBitcoinParams;
|
|
1185
|
+
/** Where a consume loop stopped: cursor, pages read, empty polls. */
|
|
1072
1186
|
type StreamsEventsConsumeResult = {
|
|
1073
1187
|
cursor: string | null;
|
|
1074
1188
|
pages: number;
|
|
1075
1189
|
emptyPolls: number;
|
|
1076
1190
|
};
|
|
1191
|
+
/** Options for replaying history from dump files, then tailing live. */
|
|
1077
1192
|
type StreamsEventsReplayParams = {
|
|
1078
1193
|
/** Start point: `"genesis"` (default) or a `<block>:<index>` cursor. */
|
|
1079
1194
|
from?: "genesis" | string;
|
|
@@ -1129,6 +1244,7 @@ type StreamsDumpFile = {
|
|
|
1129
1244
|
schema_version: number;
|
|
1130
1245
|
created_at: string;
|
|
1131
1246
|
};
|
|
1247
|
+
/** The index of finalized Parquet dump files for one dataset. */
|
|
1132
1248
|
type StreamsDumpsManifest = {
|
|
1133
1249
|
dataset: string;
|
|
1134
1250
|
network: string;
|
|
@@ -1160,38 +1276,43 @@ type StreamsDumps = {
|
|
|
1160
1276
|
};
|
|
1161
1277
|
type StreamsClient = {
|
|
1162
1278
|
/**
|
|
1163
|
-
*
|
|
1279
|
+
* Read Streams page by page as an async iterator.
|
|
1280
|
+
*
|
|
1281
|
+
* Yields one {@link StreamsBatch} per events page, so each yield is exactly
|
|
1282
|
+
* one API call. Empty pages are skipped; at the tip the iterator polls again
|
|
1283
|
+
* every `intervalMs` (default 2000) until `signal` aborts.
|
|
1164
1284
|
*
|
|
1165
|
-
*
|
|
1166
|
-
*
|
|
1167
|
-
* with zero extra API calls. Batches are chosen over per-block groupings
|
|
1168
|
-
* because the envelope is page-keyed, so every yield is exactly one fetch.
|
|
1169
|
-
* Empty pages are skipped; at the tip the iterator re-polls every
|
|
1170
|
-
* `intervalMs` (default 2000) until aborted via `signal`.
|
|
1285
|
+
* Reorgs appear on `batch.reorgs`, but the cursor is not rewound for you.
|
|
1286
|
+
* Use `events.consume` with `onReorg` when you need rollback.
|
|
1171
1287
|
*
|
|
1172
|
-
*
|
|
1173
|
-
*
|
|
1174
|
-
* rollback semantics.
|
|
1288
|
+
* A literal `types` array narrows every batch's event union to those types.
|
|
1289
|
+
* `chain: "bitcoin"` batches carry Runes rows only, on the bitcoin tip shape.
|
|
1175
1290
|
*/
|
|
1176
|
-
/** `chain: "bitcoin"` — batches carry Runes rows only, on the bitcoin tip
|
|
1177
|
-
* shape (plan 059/061). */
|
|
1178
1291
|
consume(params: StreamsConsumeBitcoinParams): AsyncIterableIterator<StreamsBatch<RuneStreamsEvent, StreamsBitcoinTip>>;
|
|
1179
|
-
/** Narrowing overload: a literal `types` array narrows every batch's
|
|
1180
|
-
* event union to exactly those members. */
|
|
1181
1292
|
consume<const T extends readonly StreamsEventType[]>(params: StreamsConsumeStacksParams & {
|
|
1182
1293
|
types: T;
|
|
1183
1294
|
}): AsyncIterableIterator<StreamsBatch<StreamsEventOfTypes<T>>>;
|
|
1184
1295
|
consume(params?: StreamsConsumeParams): AsyncIterableIterator<StreamsBatch>;
|
|
1185
1296
|
events: {
|
|
1186
|
-
/**
|
|
1187
|
-
*
|
|
1188
|
-
*
|
|
1297
|
+
/**
|
|
1298
|
+
* Read one page of chain events and the next cursor.
|
|
1299
|
+
*
|
|
1300
|
+
* Narrow with `types`, `notTypes`, `contractId`, `sender`, `recipient`,
|
|
1301
|
+
* `assetIdentifier`, `fromHeight`/`toHeight`, or labelled `filters`.
|
|
1302
|
+
* Filters match exactly, and an event type without a given field never
|
|
1303
|
+
* matches it. Pass `next_cursor` back as `cursor` to continue. The
|
|
1304
|
+
* envelope also carries the `tip` and any `reorgs`. To write the events
|
|
1305
|
+
* somewhere with a checkpoint, use `events.consume` instead.
|
|
1306
|
+
*
|
|
1307
|
+
* A literal `types` array narrows every row to those event types.
|
|
1308
|
+
* `clock: "vm"` pages carry vm rows only (a parallel vocabulary,
|
|
1309
|
+
* `event_index` = `ordinal`), never `StreamsEvent`; it is Stacks only.
|
|
1310
|
+
* `chain: "bitcoin"` pages carry Runes rows only, on the bitcoin tip shape,
|
|
1311
|
+
* and filter by `rune` or `address`.
|
|
1312
|
+
*/
|
|
1189
1313
|
list(params: StreamsEventsStacksListParams & {
|
|
1190
1314
|
clock: "vm";
|
|
1191
1315
|
}): Promise<StreamsEventsEnvelope<VmStreamsEvent>>;
|
|
1192
|
-
/** Narrowing overload, matching `consume`. Classic clock only —
|
|
1193
|
-
* `clock: "vm"` is overload 1, and a general `StreamsEventsListParams`
|
|
1194
|
-
* variable (clock unresolved) is the wire-union fallback. */
|
|
1195
1316
|
list<const T extends readonly StreamsEventType[]>(params: Omit<StreamsEventsStacksListParams, "clock" | "types" | "notTypes"> & {
|
|
1196
1317
|
types: T;
|
|
1197
1318
|
notTypes?: readonly StreamsEventType[];
|
|
@@ -1202,27 +1323,35 @@ type StreamsClient = {
|
|
|
1202
1323
|
notTypes?: readonly StreamsEventType[];
|
|
1203
1324
|
clock?: "classic";
|
|
1204
1325
|
}): Promise<StreamsEventsEnvelope>;
|
|
1205
|
-
/** `chain: "bitcoin"` pages carry Runes rows only, on the bitcoin tip
|
|
1206
|
-
* shape (plan 059). */
|
|
1207
1326
|
list(params: StreamsEventsBitcoinListParams): Promise<StreamsEventsEnvelope<RuneStreamsEvent, StreamsBitcoinTip>>;
|
|
1208
|
-
/** Unresolved `chain`/`clock` on a general params variable: the wire union. */
|
|
1209
1327
|
list(params: StreamsEventsListParams): Promise<StreamsEventsEnvelope<StreamsWireEvent>>;
|
|
1210
|
-
/**
|
|
1328
|
+
/**
|
|
1329
|
+
* Read every event a transaction emitted.
|
|
1330
|
+
*
|
|
1331
|
+
* Returns the events and the `tip`, with no `next_cursor`: one transaction
|
|
1332
|
+
* is one response.
|
|
1333
|
+
*
|
|
1334
|
+
* `chain: "bitcoin"` returns the Runes events for one Bitcoin transaction.
|
|
1335
|
+
*/
|
|
1211
1336
|
byTxId(txId: string, opts: {
|
|
1212
1337
|
chain: "bitcoin";
|
|
1213
1338
|
}): Promise<StreamsEventsListEnvelope<RuneStreamsEvent, StreamsBitcoinTip>>;
|
|
1214
1339
|
byTxId(txId: string): Promise<StreamsEventsListEnvelope>;
|
|
1215
1340
|
/**
|
|
1216
|
-
*
|
|
1341
|
+
* Run a checkpointed indexer that rewinds on reorgs.
|
|
1342
|
+
*
|
|
1343
|
+
* Write your rows in `onBatch` and commit `ctx.cursor` in the same
|
|
1344
|
+
* transaction; resume with `fromCursor`. Reorgs at or below your checkpoint
|
|
1345
|
+
* call `onReorg`, then the loop re-reads from the fork point. Delivery is
|
|
1346
|
+
* at-least-once, so keep writes idempotent. With a `sink`, the checkpoint
|
|
1347
|
+
* and rollback are handled for you. `mode: "tail"` (default) keeps polling
|
|
1348
|
+
* at the tip; `mode: "bounded"` returns on the first empty page. It also
|
|
1349
|
+
* stops on `maxPages`, `maxEmptyPolls`, or `signal`. Pass `finalizedOnly`
|
|
1350
|
+
* to skip reorg handling entirely.
|
|
1217
1351
|
*
|
|
1218
|
-
*
|
|
1219
|
-
*
|
|
1220
|
-
* polling when caught up; `mode: "bounded"` exits on the first empty page.
|
|
1221
|
-
* The consumer also exits when `maxPages`, `maxEmptyPolls`, or `signal`
|
|
1222
|
-
* stops it.
|
|
1352
|
+
* `chain: "bitcoin"` sweeps Runes events; see
|
|
1353
|
+
* {@link StreamsEventsConsumeBitcoinParams}.
|
|
1223
1354
|
*/
|
|
1224
|
-
/** `chain: "bitcoin"` — the checkpointed sweep over Runes events; see
|
|
1225
|
-
* {@link StreamsEventsConsumeBitcoinParams}. */
|
|
1226
1355
|
consume<TTx = never>(params: StreamsEventsConsumeBitcoinParams<TTx> & {
|
|
1227
1356
|
sink?: ConsumerSink<TTx>;
|
|
1228
1357
|
}): Promise<StreamsEventsConsumeResult>;
|
|
@@ -1234,46 +1363,66 @@ type StreamsClient = {
|
|
|
1234
1363
|
sink?: ConsumerSink<TTx>;
|
|
1235
1364
|
}): Promise<StreamsEventsConsumeResult>;
|
|
1236
1365
|
/**
|
|
1237
|
-
* Backfill from bulk dumps, then continue live
|
|
1238
|
-
*
|
|
1239
|
-
*
|
|
1240
|
-
*
|
|
1241
|
-
* `
|
|
1366
|
+
* Backfill from bulk dumps, then continue live in one call.
|
|
1367
|
+
*
|
|
1368
|
+
* Hands each finalized dump file to `onDumpFile` in block order, then tails
|
|
1369
|
+
* live from the manifest's `latest_finalized_cursor`, with no gap or
|
|
1370
|
+
* duplicate at the seam. A file that straddles `from` is delivered whole,
|
|
1371
|
+
* so skip the rows at or below it. Requires `dumpsBaseUrl`.
|
|
1242
1372
|
*/
|
|
1243
1373
|
replay(params: StreamsEventsReplayParams): Promise<StreamsEventsConsumeResult>;
|
|
1244
1374
|
/**
|
|
1245
|
-
*
|
|
1375
|
+
* Read events one at a time as an async iterator.
|
|
1246
1376
|
*
|
|
1247
|
-
*
|
|
1248
|
-
* indefinitely
|
|
1249
|
-
* `maxEmptyPolls`
|
|
1377
|
+
* For live processors and watch-style apps that keep their own state. It
|
|
1378
|
+
* tails indefinitely and stops when `signal`, `maxPages`, or
|
|
1379
|
+
* `maxEmptyPolls` ends it. There is no checkpoint or reorg handling; use
|
|
1380
|
+
* `events.consume` for that.
|
|
1381
|
+
*
|
|
1382
|
+
* A literal `types` array narrows every event to those types.
|
|
1383
|
+
* `chain: "bitcoin"` yields Runes events only.
|
|
1250
1384
|
*/
|
|
1251
|
-
/** `chain: "bitcoin"` — Runes events only (plan 059/061). */
|
|
1252
1385
|
stream(params: StreamsEventsStreamBitcoinParams): AsyncIterable<RuneStreamsEvent>;
|
|
1253
|
-
/** Narrowing overload, matching `consume`. */
|
|
1254
1386
|
stream<const T extends readonly StreamsEventType[]>(params: StreamsEventsStreamStacksParams & {
|
|
1255
1387
|
types: T;
|
|
1256
1388
|
}): AsyncIterable<StreamsEventOfTypes<T>>;
|
|
1257
1389
|
stream(params?: StreamsEventsStreamParams): AsyncIterable<StreamsEvent>;
|
|
1258
1390
|
/**
|
|
1259
|
-
*
|
|
1260
|
-
*
|
|
1261
|
-
*
|
|
1262
|
-
*
|
|
1263
|
-
*
|
|
1264
|
-
*
|
|
1391
|
+
* Get each new event pushed to `onEvent` as it lands.
|
|
1392
|
+
*
|
|
1393
|
+
* Reconnects from the last handled cursor after a transport error, and
|
|
1394
|
+
* verifies each frame's ed25519 signature when the client has `verify` on.
|
|
1395
|
+
* Returns an unsubscribe function whose `done` promise settles when the
|
|
1396
|
+
* loop ends. Not reorg-aware: an event delivered and then orphaned is never
|
|
1397
|
+
* retracted. Durable writers use `events.consume`.
|
|
1398
|
+
*
|
|
1399
|
+
* `chain: "bitcoin"` delivers Runes rows to `onEvent`.
|
|
1265
1400
|
*/
|
|
1266
|
-
/** `chain: "bitcoin"` — `onEvent` receives Runes rows (plan 059/061). */
|
|
1267
1401
|
subscribe(params: StreamsEventsSubscribeBitcoinParams): StreamsSubscription;
|
|
1268
1402
|
subscribe(params: StreamsEventsSubscribeStacksParams): StreamsSubscription;
|
|
1269
1403
|
};
|
|
1270
1404
|
blocks: {
|
|
1405
|
+
/**
|
|
1406
|
+
* Read every event in one block, by height or hash.
|
|
1407
|
+
*
|
|
1408
|
+
* Returns the events and the `tip`, with no `next_cursor`.
|
|
1409
|
+
*
|
|
1410
|
+
* `chain: "bitcoin"` returns the Runes events in one Bitcoin block.
|
|
1411
|
+
*/
|
|
1271
1412
|
events(heightOrHash: number | string, opts: {
|
|
1272
1413
|
chain: "bitcoin";
|
|
1273
1414
|
}): Promise<StreamsEventsListEnvelope<RuneStreamsEvent, StreamsBitcoinTip>>;
|
|
1274
1415
|
events(heightOrHash: number | string): Promise<StreamsEventsListEnvelope>;
|
|
1275
1416
|
};
|
|
1276
1417
|
reorgs: {
|
|
1418
|
+
/**
|
|
1419
|
+
* List chain reorgs since a cursor.
|
|
1420
|
+
*
|
|
1421
|
+
* `since` is required. Each reorg gives its `fork_point_height` and the
|
|
1422
|
+
* orphaned range. Page with `next_since`.
|
|
1423
|
+
*
|
|
1424
|
+
* `chain: "bitcoin"` lists Bitcoin reorgs, on their own cursor space.
|
|
1425
|
+
*/
|
|
1277
1426
|
list(params: StreamsReorgsListParams & {
|
|
1278
1427
|
chain: "bitcoin";
|
|
1279
1428
|
}): Promise<StreamsReorgsListEnvelope>;
|
|
@@ -1281,10 +1430,27 @@ type StreamsClient = {
|
|
|
1281
1430
|
};
|
|
1282
1431
|
/** Bulk parquet dumps. Requires `dumpsBaseUrl` on the client. */
|
|
1283
1432
|
dumps: StreamsDumps;
|
|
1433
|
+
/**
|
|
1434
|
+
* Get the canonical block at a height.
|
|
1435
|
+
*
|
|
1436
|
+
* Returns the block hash and, on Stacks, the burn block it anchors to.
|
|
1437
|
+
*
|
|
1438
|
+
* `chain: "bitcoin"` returns the Bitcoin block, without burn-chain fields.
|
|
1439
|
+
*/
|
|
1284
1440
|
canonical(height: number, opts: {
|
|
1285
1441
|
chain: "bitcoin";
|
|
1286
1442
|
}): Promise<StreamsBitcoinCanonicalBlock>;
|
|
1287
1443
|
canonical(height: number): Promise<StreamsCanonicalBlock>;
|
|
1444
|
+
/**
|
|
1445
|
+
* Get the current chain tip.
|
|
1446
|
+
*
|
|
1447
|
+
* Returns the tip height and hash, `finalized_height`, and `lag_seconds`. On
|
|
1448
|
+
* Stacks it also reports the oldest height your tier can seek; older reads
|
|
1449
|
+
* come from the bulk dumps.
|
|
1450
|
+
*
|
|
1451
|
+
* `chain: "bitcoin"` returns the Bitcoin tip, without burn-chain or retention
|
|
1452
|
+
* fields.
|
|
1453
|
+
*/
|
|
1288
1454
|
tip(opts: {
|
|
1289
1455
|
chain: "bitcoin";
|
|
1290
1456
|
}): Promise<StreamsBitcoinTip>;
|
|
@@ -1452,6 +1618,7 @@ type IndexReorg = {
|
|
|
1452
1618
|
*/
|
|
1453
1619
|
new_canonical_tip: string;
|
|
1454
1620
|
};
|
|
1621
|
+
/** A decoded fungible-token transfer: sender, recipient, asset, amount. */
|
|
1455
1622
|
type FtTransfer = {
|
|
1456
1623
|
cursor: string;
|
|
1457
1624
|
block_height: number;
|
|
@@ -1466,6 +1633,7 @@ type FtTransfer = {
|
|
|
1466
1633
|
recipient: string;
|
|
1467
1634
|
amount: string;
|
|
1468
1635
|
};
|
|
1636
|
+
/** One page of fungible-token transfers, with the cursor, tip, and reorgs. */
|
|
1469
1637
|
type FtTransfersEnvelope<TRow = FtTransfer> = {
|
|
1470
1638
|
events: TRow[];
|
|
1471
1639
|
next_cursor: string | null;
|
|
@@ -1477,6 +1645,7 @@ type FtTransfersEnvelope<TRow = FtTransfer> = {
|
|
|
1477
1645
|
type FtTransferAlwaysFields = "cursor" | "block_height" | "event_type";
|
|
1478
1646
|
/** An ft-transfer row narrowed to the requested columns plus the always-present ones. */
|
|
1479
1647
|
type FtTransferFields<F extends keyof FtTransfer & string> = Pick<FtTransfer, (F | FtTransferAlwaysFields) & keyof FtTransfer>;
|
|
1648
|
+
/** Column selection, paging, and filters for listing token transfers. */
|
|
1480
1649
|
type FtTransfersListParams = {
|
|
1481
1650
|
/**
|
|
1482
1651
|
* Columns to return. The server projects the row, so an unrequested column
|
|
@@ -1512,7 +1681,9 @@ type WalkOptions = PageRetryOptions & {
|
|
|
1512
1681
|
* walk from a stopped one. */
|
|
1513
1682
|
signal?: AbortSignal;
|
|
1514
1683
|
};
|
|
1684
|
+
/** `FtTransfersListParams` without `limit`, plus walk options. */
|
|
1515
1685
|
type FtTransfersWalkParams = Omit<FtTransfersListParams, "limit"> & WalkOptions;
|
|
1686
|
+
/** A decoded non-fungible-token transfer: sender, recipient, asset, value. */
|
|
1516
1687
|
type NftTransfer = {
|
|
1517
1688
|
cursor: string;
|
|
1518
1689
|
block_height: number;
|
|
@@ -1527,6 +1698,7 @@ type NftTransfer = {
|
|
|
1527
1698
|
recipient: string;
|
|
1528
1699
|
value: string;
|
|
1529
1700
|
};
|
|
1701
|
+
/** One page of non-fungible-token transfers, with the cursor, tip, and reorgs. */
|
|
1530
1702
|
type NftTransfersEnvelope<TRow = NftTransfer> = {
|
|
1531
1703
|
events: TRow[];
|
|
1532
1704
|
next_cursor: string | null;
|
|
@@ -1537,6 +1709,7 @@ type NftTransfersEnvelope<TRow = NftTransfer> = {
|
|
|
1537
1709
|
type NftTransferAlwaysFields = "cursor" | "block_height" | "event_type";
|
|
1538
1710
|
/** An nft-transfer row narrowed to the requested columns plus the always-present ones. */
|
|
1539
1711
|
type NftTransferFields<F extends keyof NftTransfer & string> = Pick<NftTransfer, (F | NftTransferAlwaysFields) & keyof NftTransfer>;
|
|
1712
|
+
/** Column selection, paging, and filters for listing NFT transfers. */
|
|
1540
1713
|
type NftTransfersListParams = {
|
|
1541
1714
|
/** Columns to return (see {@link FtTransfersListParams.fields}). */
|
|
1542
1715
|
fields?: readonly (keyof NftTransfer & string)[];
|
|
@@ -1550,6 +1723,7 @@ type NftTransfersListParams = {
|
|
|
1550
1723
|
fromHeight?: number;
|
|
1551
1724
|
toHeight?: number;
|
|
1552
1725
|
};
|
|
1726
|
+
/** `NftTransfersListParams` without `limit`, plus walk options. */
|
|
1553
1727
|
type NftTransfersWalkParams = Omit<NftTransfersListParams, "limit"> & WalkOptions;
|
|
1554
1728
|
type IndexEventBase = {
|
|
1555
1729
|
cursor: string;
|
|
@@ -1570,6 +1744,7 @@ type IndexEventBase = {
|
|
|
1570
1744
|
tx_contract_id?: string | null;
|
|
1571
1745
|
tx_function_name?: string | null;
|
|
1572
1746
|
};
|
|
1747
|
+
/** A fungible-token transfer event. */
|
|
1573
1748
|
type IndexFtTransfer = IndexEventBase & {
|
|
1574
1749
|
event_type: "ft_transfer";
|
|
1575
1750
|
asset_identifier: string;
|
|
@@ -1577,6 +1752,7 @@ type IndexFtTransfer = IndexEventBase & {
|
|
|
1577
1752
|
recipient: string;
|
|
1578
1753
|
amount: string;
|
|
1579
1754
|
};
|
|
1755
|
+
/** A non-fungible-token transfer event. */
|
|
1580
1756
|
type IndexNftTransfer = IndexEventBase & {
|
|
1581
1757
|
event_type: "nft_transfer";
|
|
1582
1758
|
asset_identifier: string;
|
|
@@ -1584,6 +1760,7 @@ type IndexNftTransfer = IndexEventBase & {
|
|
|
1584
1760
|
recipient: string;
|
|
1585
1761
|
value: string;
|
|
1586
1762
|
};
|
|
1763
|
+
/** An STX transfer event. */
|
|
1587
1764
|
type IndexStxTransfer = IndexEventBase & {
|
|
1588
1765
|
event_type: "stx_transfer";
|
|
1589
1766
|
sender: string;
|
|
@@ -1591,16 +1768,19 @@ type IndexStxTransfer = IndexEventBase & {
|
|
|
1591
1768
|
amount: string;
|
|
1592
1769
|
memo: string | null;
|
|
1593
1770
|
};
|
|
1771
|
+
/** An STX mint event. */
|
|
1594
1772
|
type IndexStxMint = IndexEventBase & {
|
|
1595
1773
|
event_type: "stx_mint";
|
|
1596
1774
|
recipient: string;
|
|
1597
1775
|
amount: string;
|
|
1598
1776
|
};
|
|
1777
|
+
/** An STX burn event. */
|
|
1599
1778
|
type IndexStxBurn = IndexEventBase & {
|
|
1600
1779
|
event_type: "stx_burn";
|
|
1601
1780
|
sender: string;
|
|
1602
1781
|
amount: string;
|
|
1603
1782
|
};
|
|
1783
|
+
/** An STX lock event with its unlock height. */
|
|
1604
1784
|
type IndexStxLock = IndexEventBase & {
|
|
1605
1785
|
event_type: "stx_lock";
|
|
1606
1786
|
sender: string;
|
|
@@ -1609,30 +1789,35 @@ type IndexStxLock = IndexEventBase & {
|
|
|
1609
1789
|
unlock_height: string | null;
|
|
1610
1790
|
};
|
|
1611
1791
|
};
|
|
1792
|
+
/** A fungible-token mint event. */
|
|
1612
1793
|
type IndexFtMint = IndexEventBase & {
|
|
1613
1794
|
event_type: "ft_mint";
|
|
1614
1795
|
asset_identifier: string;
|
|
1615
1796
|
recipient: string;
|
|
1616
1797
|
amount: string;
|
|
1617
1798
|
};
|
|
1799
|
+
/** A fungible-token burn event. */
|
|
1618
1800
|
type IndexFtBurn = IndexEventBase & {
|
|
1619
1801
|
event_type: "ft_burn";
|
|
1620
1802
|
asset_identifier: string;
|
|
1621
1803
|
sender: string;
|
|
1622
1804
|
amount: string;
|
|
1623
1805
|
};
|
|
1806
|
+
/** A non-fungible-token mint event. */
|
|
1624
1807
|
type IndexNftMint = IndexEventBase & {
|
|
1625
1808
|
event_type: "nft_mint";
|
|
1626
1809
|
asset_identifier: string;
|
|
1627
1810
|
recipient: string;
|
|
1628
1811
|
value: string;
|
|
1629
1812
|
};
|
|
1813
|
+
/** A non-fungible-token burn event. */
|
|
1630
1814
|
type IndexNftBurn = IndexEventBase & {
|
|
1631
1815
|
event_type: "nft_burn";
|
|
1632
1816
|
asset_identifier: string;
|
|
1633
1817
|
sender: string;
|
|
1634
1818
|
value: string;
|
|
1635
1819
|
};
|
|
1820
|
+
/** A contract `print` event with its topic and value. */
|
|
1636
1821
|
type IndexPrint = IndexEventBase & {
|
|
1637
1822
|
event_type: "print";
|
|
1638
1823
|
payload: {
|
|
@@ -1641,6 +1826,7 @@ type IndexPrint = IndexEventBase & {
|
|
|
1641
1826
|
raw_value: string | null;
|
|
1642
1827
|
};
|
|
1643
1828
|
};
|
|
1829
|
+
/** A contract call made from inside another contract call. */
|
|
1644
1830
|
type IndexNestedContractCall = IndexEventBase & {
|
|
1645
1831
|
event_type: "nested_contract_call";
|
|
1646
1832
|
sender: string | null;
|
|
@@ -1649,23 +1835,27 @@ type IndexNestedContractCall = IndexEventBase & {
|
|
|
1649
1835
|
function_args: unknown;
|
|
1650
1836
|
raw_result: string | null;
|
|
1651
1837
|
};
|
|
1838
|
+
/** A contract data variable write. */
|
|
1652
1839
|
type IndexVarSet = IndexEventBase & {
|
|
1653
1840
|
event_type: "var_set";
|
|
1654
1841
|
var_name: string;
|
|
1655
1842
|
raw_value: string;
|
|
1656
1843
|
};
|
|
1844
|
+
/** A contract map entry overwrite. */
|
|
1657
1845
|
type IndexMapSet = IndexEventBase & {
|
|
1658
1846
|
event_type: "map_set";
|
|
1659
1847
|
map: string;
|
|
1660
1848
|
raw_key: string;
|
|
1661
1849
|
raw_value: string;
|
|
1662
1850
|
};
|
|
1851
|
+
/** A new contract map entry. */
|
|
1663
1852
|
type IndexMapInsert = IndexEventBase & {
|
|
1664
1853
|
event_type: "map_insert";
|
|
1665
1854
|
map: string;
|
|
1666
1855
|
raw_key: string;
|
|
1667
1856
|
raw_value: string;
|
|
1668
1857
|
};
|
|
1858
|
+
/** A contract map entry deletion. */
|
|
1669
1859
|
type IndexMapDelete = IndexEventBase & {
|
|
1670
1860
|
event_type: "map_delete";
|
|
1671
1861
|
map: string;
|
|
@@ -1682,6 +1872,7 @@ type IndexEventFields<
|
|
|
1682
1872
|
T extends IndexEventType,
|
|
1683
1873
|
F extends keyof IndexEventOf<T> & string
|
|
1684
1874
|
> = Pick<IndexEventOf<T>, (F | IndexAlwaysFields) & keyof IndexEventOf<T>>;
|
|
1875
|
+
/** One page of decoded events, with the cursor, tip, and reorgs. */
|
|
1685
1876
|
type EventsEnvelope<
|
|
1686
1877
|
T extends IndexEventType = IndexEventType,
|
|
1687
1878
|
TRow = IndexEventOf<T>
|
|
@@ -1696,6 +1887,7 @@ type EventsEnvelope<
|
|
|
1696
1887
|
type IndexEventOf<T extends IndexEventType> = Extract<IndexEvent, {
|
|
1697
1888
|
event_type: T;
|
|
1698
1889
|
}>;
|
|
1890
|
+
/** Event type, paging, and filters for listing decoded events. */
|
|
1699
1891
|
type EventsListParams<T extends IndexEventType = IndexEventType> = {
|
|
1700
1892
|
/** Decoded types or VM types (`nested_contract_call`, `map_set`, …). */
|
|
1701
1893
|
eventType: T;
|
|
@@ -1740,11 +1932,13 @@ type EventsListParams<T extends IndexEventType = IndexEventType> = {
|
|
|
1740
1932
|
*/
|
|
1741
1933
|
fields?: readonly (keyof IndexEventOf<T> & string)[];
|
|
1742
1934
|
};
|
|
1935
|
+
/** `EventsListParams` without `limit`, plus walk options. */
|
|
1743
1936
|
type EventsWalkParams<T extends IndexEventType = IndexEventType> = Omit<EventsListParams<T>, "limit"> & WalkOptions;
|
|
1744
1937
|
type EventsConsumeParams<
|
|
1745
1938
|
T extends IndexEventType = IndexEventType,
|
|
1746
1939
|
TTx = never
|
|
1747
1940
|
> = Omit<EventsListParams<T>, "cursor" | "fromCursor" | "limit" | "fields"> & IndexConsumeOptions<IndexEventOf<T>, EventsEnvelope<T>, TTx>;
|
|
1941
|
+
/** A decoded contract call: contract, function, sender, arguments, result. */
|
|
1748
1942
|
type IndexContractCall = {
|
|
1749
1943
|
cursor: string;
|
|
1750
1944
|
block_height: number;
|
|
@@ -1759,12 +1953,14 @@ type IndexContractCall = {
|
|
|
1759
1953
|
result: unknown;
|
|
1760
1954
|
result_hex: string | null;
|
|
1761
1955
|
};
|
|
1956
|
+
/** One page of contract calls, with the cursor, tip, and reorgs. */
|
|
1762
1957
|
type ContractCallsEnvelope = {
|
|
1763
1958
|
contract_calls: IndexContractCall[];
|
|
1764
1959
|
next_cursor: string | null;
|
|
1765
1960
|
tip: IndexTip;
|
|
1766
1961
|
reorgs: IndexReorg[];
|
|
1767
1962
|
};
|
|
1963
|
+
/** Paging and contract filters for listing contract calls. */
|
|
1768
1964
|
type ContractCallsListParams = {
|
|
1769
1965
|
cursor?: string | null;
|
|
1770
1966
|
fromCursor?: string | null;
|
|
@@ -1780,6 +1976,7 @@ type ContractCallsListParams = {
|
|
|
1780
1976
|
* Mutually exclusive with contractId. */
|
|
1781
1977
|
trait?: string;
|
|
1782
1978
|
};
|
|
1979
|
+
/** `ContractCallsListParams` without `limit`, plus walk options. */
|
|
1783
1980
|
type ContractCallsWalkParams = Omit<ContractCallsListParams, "limit"> & WalkOptions;
|
|
1784
1981
|
type ContractCallsConsumeParams<TTx = never> = Omit<ContractCallsListParams, "cursor" | "fromCursor" | "limit"> & IndexConsumeOptions<IndexContractCall, ContractCallsEnvelope, TTx>;
|
|
1785
1982
|
/** One canonical block in the sync map. Lean by design — block + parent hash
|
|
@@ -1793,11 +1990,13 @@ type IndexCanonicalBlock = {
|
|
|
1793
1990
|
burn_block_height: number;
|
|
1794
1991
|
burn_block_hash: string | null;
|
|
1795
1992
|
};
|
|
1993
|
+
/** One page of canonical blocks, with the next cursor and chain tip. */
|
|
1796
1994
|
type CanonicalEnvelope = {
|
|
1797
1995
|
canonical: IndexCanonicalBlock[];
|
|
1798
1996
|
next_cursor: string | null;
|
|
1799
1997
|
tip: IndexTip;
|
|
1800
1998
|
};
|
|
1999
|
+
/** Paging and height filters for listing canonical blocks. */
|
|
1801
2000
|
type CanonicalListParams = {
|
|
1802
2001
|
cursor?: string | null;
|
|
1803
2002
|
fromCursor?: string | null;
|
|
@@ -1805,6 +2004,7 @@ type CanonicalListParams = {
|
|
|
1805
2004
|
fromHeight?: number;
|
|
1806
2005
|
toHeight?: number;
|
|
1807
2006
|
};
|
|
2007
|
+
/** `CanonicalListParams` without `limit`, plus walk options. */
|
|
1808
2008
|
type CanonicalWalkParams = Omit<CanonicalListParams, "limit"> & WalkOptions;
|
|
1809
2009
|
/** One MARF write a block committed, in the node's write order. Present only
|
|
1810
2010
|
* from the height the instance's node subscribed to `state_writes`. */
|
|
@@ -1829,12 +2029,14 @@ type IndexStateWrite = {
|
|
|
1829
2029
|
tx_contract_id?: string | null;
|
|
1830
2030
|
tx_function_name?: string | null;
|
|
1831
2031
|
};
|
|
2032
|
+
/** One page of contract state writes, with the cursor, tip, and reorgs. */
|
|
1832
2033
|
type StateWritesEnvelope = {
|
|
1833
2034
|
state_writes: IndexStateWrite[];
|
|
1834
2035
|
next_cursor: string | null;
|
|
1835
2036
|
tip: IndexTip;
|
|
1836
2037
|
reorgs: IndexReorg[];
|
|
1837
2038
|
};
|
|
2039
|
+
/** Paging and filters for listing contract state writes. */
|
|
1838
2040
|
type StateWritesListParams = {
|
|
1839
2041
|
cursor?: string | null;
|
|
1840
2042
|
fromCursor?: string | null;
|
|
@@ -1848,6 +2050,7 @@ type StateWritesListParams = {
|
|
|
1848
2050
|
/** Join the writing transaction's `tx_*` fields onto each row. */
|
|
1849
2051
|
txContext?: boolean;
|
|
1850
2052
|
};
|
|
2053
|
+
/** `StateWritesListParams` without `limit`, plus walk options. */
|
|
1851
2054
|
type StateWritesWalkParams = Omit<StateWritesListParams, "limit"> & WalkOptions;
|
|
1852
2055
|
/** A block resource. Metadata is intentionally thin — only chain-linkage and
|
|
1853
2056
|
* burn-anchor fields are persisted (no miner / tx_count / signer). */
|
|
@@ -1861,15 +2064,18 @@ type IndexBlock = {
|
|
|
1861
2064
|
block_time: string | null;
|
|
1862
2065
|
canonical: boolean;
|
|
1863
2066
|
};
|
|
2067
|
+
/** One page of blocks, with the next cursor and chain tip. */
|
|
1864
2068
|
type BlocksEnvelope = {
|
|
1865
2069
|
blocks: IndexBlock[];
|
|
1866
2070
|
next_cursor: string | null;
|
|
1867
2071
|
tip: IndexTip;
|
|
1868
2072
|
};
|
|
2073
|
+
/** One block and the chain tip. */
|
|
1869
2074
|
type BlockEnvelope = {
|
|
1870
2075
|
block: IndexBlock;
|
|
1871
2076
|
tip: IndexTip;
|
|
1872
2077
|
};
|
|
2078
|
+
/** Paging and height filters for listing blocks. */
|
|
1873
2079
|
type BlocksListParams = {
|
|
1874
2080
|
cursor?: string | null;
|
|
1875
2081
|
fromCursor?: string | null;
|
|
@@ -1877,6 +2083,7 @@ type BlocksListParams = {
|
|
|
1877
2083
|
fromHeight?: number;
|
|
1878
2084
|
toHeight?: number;
|
|
1879
2085
|
};
|
|
2086
|
+
/** `BlocksListParams` without `limit`, plus walk options. */
|
|
1880
2087
|
type BlocksWalkParams = Omit<BlocksListParams, "limit"> & WalkOptions;
|
|
1881
2088
|
type IndexPostCondition = {
|
|
1882
2089
|
type: "stx";
|
|
@@ -1953,12 +2160,14 @@ type IndexTransaction = {
|
|
|
1953
2160
|
cause: number;
|
|
1954
2161
|
};
|
|
1955
2162
|
};
|
|
2163
|
+
/** One page of transactions, with the cursor, tip, and reorgs. */
|
|
1956
2164
|
type TransactionsEnvelope<TRow = IndexTransaction> = {
|
|
1957
2165
|
transactions: TRow[];
|
|
1958
2166
|
next_cursor: string | null;
|
|
1959
2167
|
tip: IndexTip;
|
|
1960
2168
|
reorgs: IndexReorg[];
|
|
1961
2169
|
};
|
|
2170
|
+
/** One transaction and the chain tip. */
|
|
1962
2171
|
type TransactionEnvelope = {
|
|
1963
2172
|
transaction: IndexTransaction;
|
|
1964
2173
|
tip: IndexTip;
|
|
@@ -1967,6 +2176,7 @@ type TransactionEnvelope = {
|
|
|
1967
2176
|
type TransactionAlwaysFields = "cursor" | "block_height" | "tx_id";
|
|
1968
2177
|
/** A Transaction row narrowed to the requested columns plus the always-present ones. */
|
|
1969
2178
|
type TransactionFields<F extends keyof IndexTransaction & string> = Pick<IndexTransaction, (F | TransactionAlwaysFields) & keyof IndexTransaction>;
|
|
2179
|
+
/** Column selection, paging, and filters for listing transactions. */
|
|
1970
2180
|
type TransactionsListParams = {
|
|
1971
2181
|
/**
|
|
1972
2182
|
* Columns to return. The server projects the row, so an unrequested column
|
|
@@ -1983,6 +2193,7 @@ type TransactionsListParams = {
|
|
|
1983
2193
|
fromHeight?: number;
|
|
1984
2194
|
toHeight?: number;
|
|
1985
2195
|
};
|
|
2196
|
+
/** `TransactionsListParams` without `limit`, plus walk options. */
|
|
1986
2197
|
type TransactionsWalkParams = Omit<TransactionsListParams, "limit"> & WalkOptions;
|
|
1987
2198
|
/** A decoded PoX-4 stacking action (one per stacking contract call). */
|
|
1988
2199
|
type IndexStackingAction = {
|
|
@@ -2009,6 +2220,7 @@ type IndexStackingAction = {
|
|
|
2009
2220
|
signer_key: string | null;
|
|
2010
2221
|
result_ok: boolean;
|
|
2011
2222
|
};
|
|
2223
|
+
/** One page of stacking actions, with the cursor, tip, and reorgs. */
|
|
2012
2224
|
type StackingEnvelope = {
|
|
2013
2225
|
stacking: IndexStackingAction[];
|
|
2014
2226
|
next_cursor: string | null;
|
|
@@ -2017,6 +2229,7 @@ type StackingEnvelope = {
|
|
|
2017
2229
|
/** Present only when the PoX-4 decoder is disabled, explaining an empty feed. */
|
|
2018
2230
|
notes?: string;
|
|
2019
2231
|
};
|
|
2232
|
+
/** Paging and filters for listing stacking actions. */
|
|
2020
2233
|
type StackingListParams = {
|
|
2021
2234
|
cursor?: string | null;
|
|
2022
2235
|
fromCursor?: string | null;
|
|
@@ -2027,6 +2240,7 @@ type StackingListParams = {
|
|
|
2027
2240
|
fromHeight?: number;
|
|
2028
2241
|
toHeight?: number;
|
|
2029
2242
|
};
|
|
2243
|
+
/** `StackingListParams` without `limit`, plus walk options. */
|
|
2030
2244
|
type StackingWalkParams = Omit<StackingListParams, "limit"> & WalkOptions;
|
|
2031
2245
|
/** A pending (unconfirmed) transaction. Like a transaction document but
|
|
2032
2246
|
* pre-chain — no block_height/tx_index/result/events — with `received_at` and
|
|
@@ -2063,15 +2277,18 @@ type IndexMempoolTransaction = {
|
|
|
2063
2277
|
cause: number;
|
|
2064
2278
|
};
|
|
2065
2279
|
};
|
|
2280
|
+
/** One page of pending transactions, with the next cursor and chain tip. */
|
|
2066
2281
|
type MempoolEnvelope = {
|
|
2067
2282
|
mempool: IndexMempoolTransaction[];
|
|
2068
2283
|
next_cursor: string | null;
|
|
2069
2284
|
tip: IndexTip;
|
|
2070
2285
|
};
|
|
2286
|
+
/** One pending transaction and the chain tip. */
|
|
2071
2287
|
type MempoolTransactionEnvelope = {
|
|
2072
2288
|
transaction: IndexMempoolTransaction;
|
|
2073
2289
|
tip: IndexTip;
|
|
2074
2290
|
};
|
|
2291
|
+
/** Paging and sender filters for listing pending transactions. */
|
|
2075
2292
|
type MempoolListParams = {
|
|
2076
2293
|
cursor?: string | null;
|
|
2077
2294
|
fromCursor?: string | null;
|
|
@@ -2083,11 +2300,13 @@ type MempoolListParams = {
|
|
|
2083
2300
|
/** Filter to pending calls to a single function (composes with `contractId`). */
|
|
2084
2301
|
functionName?: string;
|
|
2085
2302
|
};
|
|
2303
|
+
/** `MempoolListParams` without `limit`, plus walk options. */
|
|
2086
2304
|
type MempoolWalkParams = Omit<MempoolListParams, "limit"> & WalkOptions;
|
|
2087
2305
|
/**
|
|
2088
|
-
*
|
|
2089
|
-
*
|
|
2090
|
-
*
|
|
2306
|
+
* Per-topic print payload schema for a contract, inferred from sampled events.
|
|
2307
|
+
*
|
|
2308
|
+
* `topics` is sorted by count desc; `sampled` is true when the contract has
|
|
2309
|
+
* more print events than the windows examined.
|
|
2091
2310
|
*/
|
|
2092
2311
|
type PrintSchemaResponse = {
|
|
2093
2312
|
contract_id: string;
|
|
@@ -2124,8 +2343,12 @@ type IndexSbtcDeposit = {
|
|
|
2124
2343
|
type IndexSbtcDepositDetail = IndexSbtcDeposit & {
|
|
2125
2344
|
status: "COMPLETED";
|
|
2126
2345
|
};
|
|
2127
|
-
/**
|
|
2128
|
-
*
|
|
2346
|
+
/**
|
|
2347
|
+
* A peg-out as one row per request, with its latest status.
|
|
2348
|
+
*
|
|
2349
|
+
* Collapsed to one row per `request_id`, with lifecycle `status` derived from
|
|
2350
|
+
* the latest accept/reject.
|
|
2351
|
+
*/
|
|
2129
2352
|
type IndexSbtcWithdrawal = {
|
|
2130
2353
|
cursor: string;
|
|
2131
2354
|
request_id: number;
|
|
@@ -2179,8 +2402,11 @@ type IndexSbtcWithdrawalDetail = {
|
|
|
2179
2402
|
};
|
|
2180
2403
|
finalized: boolean;
|
|
2181
2404
|
};
|
|
2182
|
-
/**
|
|
2183
|
-
*
|
|
2405
|
+
/**
|
|
2406
|
+
* A raw decoded sBTC protocol-state event, one per event.
|
|
2407
|
+
*
|
|
2408
|
+
* It is the full `sbtc_events` row, one per event across all topics.
|
|
2409
|
+
*/
|
|
2184
2410
|
type IndexSbtcEvent = {
|
|
2185
2411
|
cursor: string;
|
|
2186
2412
|
block_height: number;
|
|
@@ -2219,6 +2445,7 @@ type IndexSbtcSummary = {
|
|
|
2219
2445
|
total_locked_sats: string;
|
|
2220
2446
|
sbtc_supply_sats: string | null;
|
|
2221
2447
|
};
|
|
2448
|
+
/** One page of sBTC deposits, with the cursor, tip, and reorgs. */
|
|
2222
2449
|
type SbtcDepositsEnvelope<TRow = IndexSbtcDeposit> = {
|
|
2223
2450
|
deposits: TRow[];
|
|
2224
2451
|
next_cursor: string | null;
|
|
@@ -2227,10 +2454,12 @@ type SbtcDepositsEnvelope<TRow = IndexSbtcDeposit> = {
|
|
|
2227
2454
|
/** Present only when the sBTC decoder is disabled, explaining an empty feed. */
|
|
2228
2455
|
notes?: string;
|
|
2229
2456
|
};
|
|
2457
|
+
/** One sBTC deposit and the chain tip. */
|
|
2230
2458
|
type SbtcDepositEnvelope = {
|
|
2231
2459
|
deposit: IndexSbtcDepositDetail;
|
|
2232
2460
|
tip: IndexTip;
|
|
2233
2461
|
};
|
|
2462
|
+
/** One page of sBTC withdrawals, with the cursor, tip, and reorgs. */
|
|
2234
2463
|
type SbtcWithdrawalsEnvelope<TRow = IndexSbtcWithdrawal> = {
|
|
2235
2464
|
withdrawals: TRow[];
|
|
2236
2465
|
next_cursor: string | null;
|
|
@@ -2238,10 +2467,12 @@ type SbtcWithdrawalsEnvelope<TRow = IndexSbtcWithdrawal> = {
|
|
|
2238
2467
|
reorgs: IndexReorg[];
|
|
2239
2468
|
notes?: string;
|
|
2240
2469
|
};
|
|
2470
|
+
/** One sBTC withdrawal and the chain tip. */
|
|
2241
2471
|
type SbtcWithdrawalEnvelope = {
|
|
2242
2472
|
withdrawal: IndexSbtcWithdrawalDetail;
|
|
2243
2473
|
tip: IndexTip;
|
|
2244
2474
|
};
|
|
2475
|
+
/** One page of sBTC events, with the cursor, tip, and reorgs. */
|
|
2245
2476
|
type SbtcEventsEnvelope = {
|
|
2246
2477
|
events: IndexSbtcEvent[];
|
|
2247
2478
|
next_cursor: string | null;
|
|
@@ -2249,11 +2480,13 @@ type SbtcEventsEnvelope = {
|
|
|
2249
2480
|
reorgs: IndexReorg[];
|
|
2250
2481
|
notes?: string;
|
|
2251
2482
|
};
|
|
2483
|
+
/** The sBTC totals and the chain tip. */
|
|
2252
2484
|
type SbtcSummaryEnvelope = {
|
|
2253
2485
|
summary: IndexSbtcSummary;
|
|
2254
2486
|
tip: IndexTip;
|
|
2255
2487
|
notes?: string;
|
|
2256
2488
|
};
|
|
2489
|
+
/** Column selection, paging, and filters for listing sBTC deposits. */
|
|
2257
2490
|
type SbtcDepositsListParams = {
|
|
2258
2491
|
cursor?: string | null;
|
|
2259
2492
|
fromCursor?: string | null;
|
|
@@ -2275,11 +2508,13 @@ type SbtcDepositsListParams = {
|
|
|
2275
2508
|
type SbtcDepositAlwaysFields = "cursor" | "block_height";
|
|
2276
2509
|
/** A deposit row narrowed to the requested columns plus the always-present ones. */
|
|
2277
2510
|
type SbtcDepositFields<F extends keyof IndexSbtcDeposit & string> = Pick<IndexSbtcDeposit, (F | SbtcDepositAlwaysFields) & keyof IndexSbtcDeposit>;
|
|
2511
|
+
/** `SbtcDepositsListParams` without `limit`, plus walk options. */
|
|
2278
2512
|
type SbtcDepositsWalkParams = Omit<SbtcDepositsListParams, "limit"> & WalkOptions;
|
|
2279
2513
|
/** SbtcWithdrawal columns that survive any projection. */
|
|
2280
2514
|
type SbtcWithdrawalAlwaysFields = "cursor" | "request_id";
|
|
2281
2515
|
/** A SbtcWithdrawal row narrowed to the requested columns plus the always-present ones. */
|
|
2282
2516
|
type SbtcWithdrawalFields<F extends keyof IndexSbtcWithdrawal & string> = Pick<IndexSbtcWithdrawal, (F | SbtcWithdrawalAlwaysFields) & keyof IndexSbtcWithdrawal>;
|
|
2517
|
+
/** Column selection, paging, and filters for listing sBTC withdrawals. */
|
|
2283
2518
|
type SbtcWithdrawalsListParams = {
|
|
2284
2519
|
/**
|
|
2285
2520
|
* Columns to return. The server projects the row, so an unrequested column
|
|
@@ -2300,7 +2535,9 @@ type SbtcWithdrawalsListParams = {
|
|
|
2300
2535
|
fromHeight?: number;
|
|
2301
2536
|
toHeight?: number;
|
|
2302
2537
|
};
|
|
2538
|
+
/** `SbtcWithdrawalsListParams` without `limit`, plus walk options. */
|
|
2303
2539
|
type SbtcWithdrawalsWalkParams = Omit<SbtcWithdrawalsListParams, "limit"> & WalkOptions;
|
|
2540
|
+
/** Paging and filters for listing sBTC events. */
|
|
2304
2541
|
type SbtcEventsListParams = {
|
|
2305
2542
|
cursor?: string | null;
|
|
2306
2543
|
fromCursor?: string | null;
|
|
@@ -2313,6 +2550,7 @@ type SbtcEventsListParams = {
|
|
|
2313
2550
|
fromHeight?: number;
|
|
2314
2551
|
toHeight?: number;
|
|
2315
2552
|
};
|
|
2553
|
+
/** `SbtcEventsListParams` without `limit`, plus walk options. */
|
|
2316
2554
|
type SbtcEventsWalkParams = Omit<SbtcEventsListParams, "limit"> & WalkOptions;
|
|
2317
2555
|
type SbtcEventsConsumeParams<TTx = never> = Omit<SbtcEventsListParams, "cursor" | "fromCursor" | "limit"> & IndexConsumeOptions<IndexSbtcEvent, SbtcEventsEnvelope, TTx>;
|
|
2318
2556
|
type SbtcDepositsConsumeParams<TTx = never> = Omit<SbtcDepositsListParams, "cursor" | "fromCursor" | "limit" | "fields"> & IndexConsumeOptions<IndexSbtcDeposit, SbtcDepositsEnvelope, TTx>;
|
|
@@ -2320,15 +2558,27 @@ type SbtcDepositsConsumeParams<TTx = never> = Omit<SbtcDepositsListParams, "curs
|
|
|
2320
2558
|
* events, scoreboard). The only productized decoded sBTC peg feed on Stacks. */
|
|
2321
2559
|
interface SbtcResource {
|
|
2322
2560
|
deposits: {
|
|
2323
|
-
/**
|
|
2324
|
-
*
|
|
2561
|
+
/**
|
|
2562
|
+
* Read one page of completed sBTC deposits.
|
|
2563
|
+
*
|
|
2564
|
+
* Filter by `sender`, `bitcoinTxid`, and a height range. `confirmed: true` keeps only deposits past the finality boundary. `fields` returns only those columns and narrows the row type; `cursor` and `block_height` always come back.
|
|
2565
|
+
*/
|
|
2325
2566
|
list<const F extends keyof IndexSbtcDeposit & string>(params: SbtcDepositsListParams & {
|
|
2326
2567
|
fields: readonly F[];
|
|
2327
2568
|
}): Promise<SbtcDepositsEnvelope<SbtcDepositFields<F>>>;
|
|
2328
2569
|
list(params?: SbtcDepositsListParams): Promise<SbtcDepositsEnvelope>;
|
|
2570
|
+
/**
|
|
2571
|
+
* Iterate every completed sBTC deposit, paging for you.
|
|
2572
|
+
*
|
|
2573
|
+
* Takes the same filters as `list`. Not a live index: it does not checkpoint, ignores reorgs, and ends when it catches the tip. `batchSize` defaults to 200 (max 1000); page fetches retry on 429 and 5xx; aborting `signal` rejects the iterator.
|
|
2574
|
+
*/
|
|
2329
2575
|
walk(params?: SbtcDepositsWalkParams): AsyncIterable<IndexSbtcDeposit>;
|
|
2330
|
-
/**
|
|
2331
|
-
*
|
|
2576
|
+
/**
|
|
2577
|
+
* Run a checkpointed, reorg-aware indexer over completed deposits.
|
|
2578
|
+
*
|
|
2579
|
+
* Deposits are append-only, so they are safe to mirror. See
|
|
2580
|
+
* {@link IndexConsumeOptions}.
|
|
2581
|
+
*/
|
|
2332
2582
|
consume<TTx = never>(params: SbtcDepositsConsumeParams<TTx> & {
|
|
2333
2583
|
sink?: ConsumerSink<TTx>;
|
|
2334
2584
|
}): Promise<{
|
|
@@ -2340,21 +2590,43 @@ interface SbtcResource {
|
|
|
2340
2590
|
get(bitcoinTxid: string): Promise<SbtcDepositEnvelope | null>;
|
|
2341
2591
|
};
|
|
2342
2592
|
withdrawals: {
|
|
2343
|
-
/**
|
|
2344
|
-
*
|
|
2593
|
+
/**
|
|
2594
|
+
* Read one page of sBTC withdrawals, each with its current status.
|
|
2595
|
+
*
|
|
2596
|
+
* Filter by `status` (`REQUESTED`, `ACCEPTED`, `REJECTED`), `sender`, `requestId`, `settlementConfirmed`, and a height range. A row changes as the peg-out moves along, which is why withdrawals have no `consume`. `fields` returns only those columns and narrows the row type; `cursor` and `request_id` always come back.
|
|
2597
|
+
*/
|
|
2345
2598
|
list<const F extends keyof IndexSbtcWithdrawal & string>(params: SbtcWithdrawalsListParams & {
|
|
2346
2599
|
fields: readonly F[];
|
|
2347
2600
|
}): Promise<SbtcWithdrawalsEnvelope<SbtcWithdrawalFields<F>>>;
|
|
2348
2601
|
list(params?: SbtcWithdrawalsListParams): Promise<SbtcWithdrawalsEnvelope>;
|
|
2602
|
+
/**
|
|
2603
|
+
* Iterate every sBTC withdrawal, paging for you.
|
|
2604
|
+
*
|
|
2605
|
+
* Takes the same filters as `list`. Not a live index: it does not checkpoint, ignores reorgs, and ends when it catches the tip. `batchSize` defaults to 200 (max 1000); page fetches retry on 429 and 5xx; aborting `signal` rejects the iterator.
|
|
2606
|
+
*/
|
|
2349
2607
|
walk(params?: SbtcWithdrawalsWalkParams): AsyncIterable<IndexSbtcWithdrawal>;
|
|
2350
2608
|
/** Fetch a withdrawal's full lifecycle by request id; 404 → null. */
|
|
2351
2609
|
get(requestId: number): Promise<SbtcWithdrawalEnvelope | null>;
|
|
2352
2610
|
};
|
|
2353
2611
|
events: {
|
|
2612
|
+
/**
|
|
2613
|
+
* Read one page of the raw sBTC peg event log.
|
|
2614
|
+
*
|
|
2615
|
+
* Filter by `topic`, `sender`, `requestId`, `bitcoinTxid`, and a height range. `confirmed: true` keeps only events past the finality boundary.
|
|
2616
|
+
*/
|
|
2354
2617
|
list(params?: SbtcEventsListParams): Promise<SbtcEventsEnvelope>;
|
|
2618
|
+
/**
|
|
2619
|
+
* Iterate every sBTC peg event, paging for you.
|
|
2620
|
+
*
|
|
2621
|
+
* Takes the same filters as `list`. Not a live index: it does not checkpoint, ignores reorgs, and ends when it catches the tip. `batchSize` defaults to 200 (max 1000); page fetches retry on 429 and 5xx; aborting `signal` rejects the iterator.
|
|
2622
|
+
*/
|
|
2355
2623
|
walk(params?: SbtcEventsWalkParams): AsyncIterable<IndexSbtcEvent>;
|
|
2356
|
-
/**
|
|
2357
|
-
*
|
|
2624
|
+
/**
|
|
2625
|
+
* Run a checkpointed, reorg-aware indexer over the raw peg event log.
|
|
2626
|
+
*
|
|
2627
|
+
* The log is append-only across all six topics. See
|
|
2628
|
+
* {@link IndexConsumeOptions}.
|
|
2629
|
+
*/
|
|
2358
2630
|
consume<TTx = never>(params: SbtcEventsConsumeParams<TTx> & {
|
|
2359
2631
|
sink?: ConsumerSink<TTx>;
|
|
2360
2632
|
}): Promise<{
|
|
@@ -2363,7 +2635,11 @@ interface SbtcResource {
|
|
|
2363
2635
|
emptyPolls: number;
|
|
2364
2636
|
}>;
|
|
2365
2637
|
};
|
|
2366
|
-
/**
|
|
2638
|
+
/**
|
|
2639
|
+
* Get the all-time sBTC peg scoreboard.
|
|
2640
|
+
*
|
|
2641
|
+
* A single aggregate, with no pagination.
|
|
2642
|
+
*/
|
|
2367
2643
|
summary(): Promise<SbtcSummaryEnvelope>;
|
|
2368
2644
|
}
|
|
2369
2645
|
/** One pox-5 reward cycle, exact to the node. */
|
|
@@ -2420,6 +2696,7 @@ type IndexPoxCycleSigner = {
|
|
|
2420
2696
|
in_set: boolean;
|
|
2421
2697
|
rewards_claimed: string;
|
|
2422
2698
|
};
|
|
2699
|
+
/** One page of reward cycles, newest first, with the next cursor. */
|
|
2423
2700
|
type PoxCyclesEnvelope = {
|
|
2424
2701
|
/** The PoX version this response reports. Currently 5. */
|
|
2425
2702
|
pox_version: 5;
|
|
@@ -2428,6 +2705,7 @@ type PoxCyclesEnvelope = {
|
|
|
2428
2705
|
next_cursor: number | null;
|
|
2429
2706
|
tip: IndexTip;
|
|
2430
2707
|
};
|
|
2708
|
+
/** One reward cycle with its signers and the chain tip. */
|
|
2431
2709
|
type PoxCycleEnvelope = {
|
|
2432
2710
|
pox_version: 5;
|
|
2433
2711
|
cycle: IndexPoxCycle & {
|
|
@@ -2435,19 +2713,35 @@ type PoxCycleEnvelope = {
|
|
|
2435
2713
|
};
|
|
2436
2714
|
tip: IndexTip;
|
|
2437
2715
|
};
|
|
2716
|
+
/** Paging for listing reward cycles. */
|
|
2438
2717
|
type PoxCyclesListParams = {
|
|
2439
2718
|
/** A `reward_cycle` to page from; the page returns cycles below it (descending). */
|
|
2440
2719
|
cursor?: number | null;
|
|
2441
2720
|
limit?: number;
|
|
2442
2721
|
};
|
|
2722
|
+
/** `PoxCyclesListParams` without `limit`, plus walk options. */
|
|
2443
2723
|
type PoxCyclesWalkParams = Omit<PoxCyclesListParams, "limit"> & WalkOptions;
|
|
2444
2724
|
/** `index.pox` — reward cycles of the current PoX (PoX-5). */
|
|
2445
2725
|
interface PoxResource {
|
|
2446
2726
|
cycles: {
|
|
2727
|
+
/**
|
|
2728
|
+
* Read one page of PoX reward cycles, newest first.
|
|
2729
|
+
*
|
|
2730
|
+
* `cursor` is a `reward_cycle` number, and the page returns the cycles below it. `next_cursor` is the next cycle number to page from, or `null` at the end. This reports the current PoX (PoX-5); PoX-4 history is not served here, so read `stacking` for it.
|
|
2731
|
+
*/
|
|
2447
2732
|
list(params?: PoxCyclesListParams): Promise<PoxCyclesEnvelope>;
|
|
2733
|
+
/**
|
|
2734
|
+
* Iterate every reward cycle, paging for you.
|
|
2735
|
+
*
|
|
2736
|
+
* Takes the same filters as `list` (it pages by reward cycle number). Not a live index: it does not checkpoint, ignores reorgs, and ends when it catches the tip. `batchSize` defaults to 200 (max 1000); page fetches retry on 429 and 5xx; aborting `signal` rejects the iterator.
|
|
2737
|
+
*/
|
|
2448
2738
|
walk(params?: PoxCyclesWalkParams): AsyncIterable<IndexPoxCycle>;
|
|
2449
|
-
/**
|
|
2450
|
-
*
|
|
2739
|
+
/**
|
|
2740
|
+
* Get one reward cycle by number, or `null`.
|
|
2741
|
+
*
|
|
2742
|
+
* Resolves to `null` on 404: an unknown cycle, or one below pox-5's first
|
|
2743
|
+
* reward cycle (141), whose PoX-4 history is final and not served here.
|
|
2744
|
+
*/
|
|
2451
2745
|
get(rewardCycle: number): Promise<PoxCycleEnvelope | null>;
|
|
2452
2746
|
};
|
|
2453
2747
|
}
|
|
@@ -2483,6 +2777,7 @@ type IndexPox5Event = {
|
|
|
2483
2777
|
/** The full decoded print tuple as JSON. */
|
|
2484
2778
|
data: unknown;
|
|
2485
2779
|
};
|
|
2780
|
+
/** One page of PoX-5 events, with the cursor, tip, and reorgs. */
|
|
2486
2781
|
type Pox5EventsEnvelope<TRow = IndexPox5Event> = {
|
|
2487
2782
|
events: TRow[];
|
|
2488
2783
|
next_cursor: string | null;
|
|
@@ -2495,6 +2790,7 @@ type Pox5EventsEnvelope<TRow = IndexPox5Event> = {
|
|
|
2495
2790
|
type Pox5EventAlwaysFields = "cursor" | "block_height" | "topic";
|
|
2496
2791
|
/** A Pox5Event row narrowed to the requested columns plus the always-present ones. */
|
|
2497
2792
|
type Pox5EventFields<F extends keyof IndexPox5Event & string> = Pick<IndexPox5Event, (F | Pox5EventAlwaysFields) & keyof IndexPox5Event>;
|
|
2793
|
+
/** Column selection, paging, and filters for listing PoX-5 events. */
|
|
2498
2794
|
type Pox5EventsListParams = {
|
|
2499
2795
|
/**
|
|
2500
2796
|
* Columns to return. The server projects the row, so an unrequested column
|
|
@@ -2516,21 +2812,34 @@ type Pox5EventsListParams = {
|
|
|
2516
2812
|
fromHeight?: number;
|
|
2517
2813
|
toHeight?: number;
|
|
2518
2814
|
};
|
|
2815
|
+
/** `Pox5EventsListParams` without `limit`, plus walk options. */
|
|
2519
2816
|
type Pox5EventsWalkParams = Omit<Pox5EventsListParams, "limit"> & WalkOptions;
|
|
2520
2817
|
type Pox5EventsConsumeParams<TTx = never> = Omit<Pox5EventsListParams, "cursor" | "fromCursor" | "limit"> & IndexConsumeOptions<IndexPox5Event, Pox5EventsEnvelope, TTx>;
|
|
2521
2818
|
/** `index.pox5` — decoded PoX-5 print events, the staking primitive from the
|
|
2522
2819
|
* epoch 4.0 hard fork onward (PoX-4's `index.stacking` stream ends there). */
|
|
2523
2820
|
interface Pox5Resource {
|
|
2524
2821
|
events: {
|
|
2525
|
-
/**
|
|
2526
|
-
*
|
|
2822
|
+
/**
|
|
2823
|
+
* Read one page of decoded PoX-5 staking events.
|
|
2824
|
+
*
|
|
2825
|
+
* Filter by `topic`, `staker`, `signer`, `signerManager`, `bondIndex`, `rewardCycle`, and a height range. `confirmed: true` keeps only rows past the finality boundary. `fields` returns only those columns and narrows the row type; `cursor`, `block_height`, and `topic` always come back.
|
|
2826
|
+
*/
|
|
2527
2827
|
list<const F extends keyof IndexPox5Event & string>(params: Pox5EventsListParams & {
|
|
2528
2828
|
fields: readonly F[];
|
|
2529
2829
|
}): Promise<Pox5EventsEnvelope<Pox5EventFields<F>>>;
|
|
2530
2830
|
list(params?: Pox5EventsListParams): Promise<Pox5EventsEnvelope>;
|
|
2831
|
+
/**
|
|
2832
|
+
* Iterate every PoX-5 event, paging for you.
|
|
2833
|
+
*
|
|
2834
|
+
* Takes the same filters as `list`. Not a live index: it does not checkpoint, ignores reorgs, and ends when it catches the tip. `batchSize` defaults to 200 (max 1000); page fetches retry on 429 and 5xx; aborting `signal` rejects the iterator.
|
|
2835
|
+
*/
|
|
2531
2836
|
walk(params?: Pox5EventsWalkParams): AsyncIterable<IndexPox5Event>;
|
|
2532
|
-
/**
|
|
2533
|
-
*
|
|
2837
|
+
/**
|
|
2838
|
+
* Run a checkpointed, reorg-aware indexer over PoX-5 events.
|
|
2839
|
+
*
|
|
2840
|
+
* The pox-5 print log is append-only across all 19 topics. See
|
|
2841
|
+
* {@link IndexConsumeOptions}.
|
|
2842
|
+
*/
|
|
2534
2843
|
consume<TTx = never>(params: Pox5EventsConsumeParams<TTx> & {
|
|
2535
2844
|
sink?: ConsumerSink<TTx>;
|
|
2536
2845
|
}): Promise<{
|
|
@@ -2543,11 +2852,13 @@ interface Pox5Resource {
|
|
|
2543
2852
|
/** A rune's `<block>:<tx>` id — the etch transaction's position, e.g. `840000:3`. */
|
|
2544
2853
|
type RuneId = `${number}:${number}`;
|
|
2545
2854
|
/**
|
|
2546
|
-
* A rune
|
|
2547
|
-
*
|
|
2548
|
-
* `dog.go.to.the.moon` and `doggotothemoon` all resolve
|
|
2549
|
-
*
|
|
2550
|
-
*
|
|
2855
|
+
* A rune id or name, in any case, with or without spacers.
|
|
2856
|
+
*
|
|
2857
|
+
* `DOG•GO•TO•THE•MOON`, `dog.go.to.the.moon` and `doggotothemoon` all resolve
|
|
2858
|
+
* to the same rune.
|
|
2859
|
+
*
|
|
2860
|
+
* Typing every rune name is a no: 178k runes and growing, so a generated union
|
|
2861
|
+
* would be huge and stale on day one. `list({ search })` covers discovery.
|
|
2551
2862
|
*/
|
|
2552
2863
|
type RuneRef = RuneId | (string & {});
|
|
2553
2864
|
/** The Bitcoin chain tip a Runes read was served against — a separate clock
|
|
@@ -2592,8 +2903,11 @@ type IndexRuneTerms = {
|
|
|
2592
2903
|
offset_start: string | null;
|
|
2593
2904
|
offset_end: string | null;
|
|
2594
2905
|
};
|
|
2595
|
-
/**
|
|
2596
|
-
*
|
|
2906
|
+
/**
|
|
2907
|
+
* One etched rune: identity, counters, supply, and mint terms.
|
|
2908
|
+
*
|
|
2909
|
+
* Counters cover premine, mint, and burn; supply is computed.
|
|
2910
|
+
*/
|
|
2597
2911
|
type IndexRuneEntry = IndexRuneRefSummary & {
|
|
2598
2912
|
/** Etch sequence number (u128 decimal string) — 0 is genesis. */
|
|
2599
2913
|
number: string;
|
|
@@ -2610,6 +2924,7 @@ type IndexRuneEntry = IndexRuneRefSummary & {
|
|
|
2610
2924
|
etched_tx_index: number;
|
|
2611
2925
|
terms: IndexRuneTerms | null;
|
|
2612
2926
|
};
|
|
2927
|
+
/** One page of runes, with the cursor and Bitcoin tip. */
|
|
2613
2928
|
type RunesEnvelope<TRow = IndexRuneEntry> = {
|
|
2614
2929
|
runes: TRow[];
|
|
2615
2930
|
next_cursor: string | null;
|
|
@@ -2620,6 +2935,7 @@ type RunesEnvelope<TRow = IndexRuneEntry> = {
|
|
|
2620
2935
|
/** Present only when Runes data is not configured on this instance. */
|
|
2621
2936
|
notes?: string;
|
|
2622
2937
|
};
|
|
2938
|
+
/** Name search, sort order, and paging for listing runes. */
|
|
2623
2939
|
type RunesListParams = {
|
|
2624
2940
|
/** Name prefix, spacers and case ignored (`dog` matches `DOG•GO•TO•THE•MOON`). */
|
|
2625
2941
|
search?: string;
|
|
@@ -2628,13 +2944,17 @@ type RunesListParams = {
|
|
|
2628
2944
|
cursor?: string | null;
|
|
2629
2945
|
limit?: number;
|
|
2630
2946
|
};
|
|
2947
|
+
/** One rune and the Bitcoin tip. */
|
|
2631
2948
|
type RuneEnvelope = {
|
|
2632
2949
|
rune: IndexRuneEntry;
|
|
2633
2950
|
tip: IndexBitcoinTip;
|
|
2634
2951
|
};
|
|
2635
2952
|
type IndexRuneEventKind = "rune_etch" | "rune_mint" | "rune_transfer" | "rune_burn";
|
|
2636
|
-
/**
|
|
2637
|
-
*
|
|
2953
|
+
/**
|
|
2954
|
+
* One rune etch, mint, transfer, or burn, with the rune's identity.
|
|
2955
|
+
*
|
|
2956
|
+
* The identity is embedded so an activity feed needs no second lookup to show a name.
|
|
2957
|
+
*/
|
|
2638
2958
|
type IndexRuneEvent = {
|
|
2639
2959
|
cursor: string;
|
|
2640
2960
|
block_height: number;
|
|
@@ -2649,6 +2969,7 @@ type IndexRuneEvent = {
|
|
|
2649
2969
|
address: string | null;
|
|
2650
2970
|
rune: IndexRuneRefSummary;
|
|
2651
2971
|
};
|
|
2972
|
+
/** One page of rune events, with the cursor, Bitcoin tip, and reorgs. */
|
|
2652
2973
|
type RuneActivityEnvelope<TRow = IndexRuneEvent> = {
|
|
2653
2974
|
events: TRow[];
|
|
2654
2975
|
next_cursor: string | null;
|
|
@@ -2656,6 +2977,7 @@ type RuneActivityEnvelope<TRow = IndexRuneEvent> = {
|
|
|
2656
2977
|
reorgs: IndexBtcReorg[];
|
|
2657
2978
|
notes?: string;
|
|
2658
2979
|
};
|
|
2980
|
+
/** Paging and height filters for listing rune events. */
|
|
2659
2981
|
type RuneActivityListParams = {
|
|
2660
2982
|
cursor?: string | null;
|
|
2661
2983
|
fromCursor?: string | null;
|
|
@@ -2667,6 +2989,7 @@ type RuneActivityListParams = {
|
|
|
2667
2989
|
kind?: readonly IndexRuneEventKind[];
|
|
2668
2990
|
txid?: string;
|
|
2669
2991
|
};
|
|
2992
|
+
/** `RuneActivityListParams` without `limit`, plus walk options. */
|
|
2670
2993
|
type RuneActivityWalkParams = Omit<RuneActivityListParams, "limit"> & WalkOptions;
|
|
2671
2994
|
/** A rune's balance on one unspent output, with the rune's identity embedded. */
|
|
2672
2995
|
type IndexRuneBalance = {
|
|
@@ -2678,6 +3001,7 @@ type IndexRuneBalance = {
|
|
|
2678
3001
|
/** u128 decimal string. Never `Number()`. */
|
|
2679
3002
|
amount: string;
|
|
2680
3003
|
};
|
|
3004
|
+
/** One page of rune balances, with the cursor and Bitcoin tip. */
|
|
2681
3005
|
type RuneBalancesEnvelope<TRow = IndexRuneBalance> = {
|
|
2682
3006
|
balances: TRow[];
|
|
2683
3007
|
next_cursor: string | null;
|
|
@@ -2686,8 +3010,11 @@ type RuneBalancesEnvelope<TRow = IndexRuneBalance> = {
|
|
|
2686
3010
|
reorgs: IndexBtcReorg[];
|
|
2687
3011
|
notes?: string;
|
|
2688
3012
|
};
|
|
2689
|
-
/**
|
|
2690
|
-
*
|
|
3013
|
+
/**
|
|
3014
|
+
* Rune balance filters; exactly one of `address` or `outpoint`.
|
|
3015
|
+
*
|
|
3016
|
+
* Enforced at the type level, not just at runtime.
|
|
3017
|
+
*/
|
|
2691
3018
|
type RuneBalancesListParams = ({
|
|
2692
3019
|
address: string;
|
|
2693
3020
|
outpoint?: never;
|
|
@@ -2708,14 +3035,28 @@ interface RunesResource {
|
|
|
2708
3035
|
/** The rune catalog. `search` prefix-matches the name; `sort` is etch
|
|
2709
3036
|
* order (default) or busiest-first. */
|
|
2710
3037
|
list(params?: RunesListParams): Promise<RunesEnvelope>;
|
|
2711
|
-
/**
|
|
2712
|
-
*
|
|
3038
|
+
/**
|
|
3039
|
+
* Get one rune by id or name, or `null`.
|
|
3040
|
+
*
|
|
3041
|
+
* Resolves to `null` on 404: no such rune, or Runes isn't configured on
|
|
3042
|
+
* this instance.
|
|
3043
|
+
*/
|
|
2713
3044
|
get(rune: RuneRef): Promise<RuneEnvelope | null>;
|
|
2714
3045
|
/** Current per-outpoint rune balances by address or outpoint. */
|
|
2715
3046
|
balances(params: RuneBalancesListParams): Promise<RuneBalancesEnvelope>;
|
|
2716
3047
|
/** Etch/mint/transfer/burn events, cursor `<block_height>:<event_index>`. */
|
|
2717
3048
|
activity: {
|
|
3049
|
+
/**
|
|
3050
|
+
* Read one page of Rune etch, mint, transfer, and burn events.
|
|
3051
|
+
*
|
|
3052
|
+
* Filter by `rune` (an id or a name), `address`, `kind`, `txid`, and a height range. The cursor is `<block_height>:<event_index>`, and the envelope's tip is a Bitcoin tip. `notes` says so when Runes is not configured on the instance.
|
|
3053
|
+
*/
|
|
2718
3054
|
list(params?: RuneActivityListParams): Promise<RuneActivityEnvelope>;
|
|
3055
|
+
/**
|
|
3056
|
+
* Iterate every Rune event, paging for you.
|
|
3057
|
+
*
|
|
3058
|
+
* Takes the same filters as `list`. Not a live index: it does not checkpoint, ignores reorgs, and ends when it catches the tip. `batchSize` defaults to 200 (max 1000); page fetches retry on 429 and 5xx; aborting `signal` rejects the iterator.
|
|
3059
|
+
*/
|
|
2719
3060
|
walk(params?: RuneActivityWalkParams): AsyncIterable<IndexRuneEvent>;
|
|
2720
3061
|
};
|
|
2721
3062
|
}
|
|
@@ -2733,15 +3074,20 @@ interface FtTransfersResource {
|
|
|
2733
3074
|
fields: readonly F[];
|
|
2734
3075
|
}): Promise<FtTransfersEnvelope<FtTransferFields<F>>>;
|
|
2735
3076
|
(params?: FtTransfersListParams): Promise<FtTransfersEnvelope>;
|
|
2736
|
-
/**
|
|
2737
|
-
*
|
|
3077
|
+
/**
|
|
3078
|
+
* Read one page of fungible-token transfers, plus the cursor for the next.
|
|
3079
|
+
*
|
|
3080
|
+
* Filter by `contractId`, `assetIdentifier`, `sender`, `recipient`, and a height range. Filters are equality only: there is no amount filter. Pass `next_cursor` back as `cursor` to continue. `fields` returns only those columns and narrows the row type; `cursor`, `block_height`, and `event_type` always come back. `reorgs` on the envelope lists forks that overlap the page.
|
|
3081
|
+
*/
|
|
2738
3082
|
list<const F extends keyof FtTransfer & string>(params: FtTransfersListParams & {
|
|
2739
3083
|
fields: readonly F[];
|
|
2740
3084
|
}): Promise<FtTransfersEnvelope<FtTransferFields<F>>>;
|
|
2741
3085
|
list(params?: FtTransfersListParams): Promise<FtTransfersEnvelope>;
|
|
2742
|
-
/**
|
|
2743
|
-
*
|
|
2744
|
-
*
|
|
3086
|
+
/**
|
|
3087
|
+
* Iterate every fungible-token transfer, paging for you.
|
|
3088
|
+
*
|
|
3089
|
+
* Takes the same filters as `list`. Not a live index: it does not checkpoint, ignores reorgs, and ends when it catches the tip. `batchSize` defaults to 200 (max 1000); page fetches retry on 429 and 5xx; aborting `signal` rejects the iterator.
|
|
3090
|
+
*/
|
|
2745
3091
|
walk<const F extends keyof FtTransfer & string>(params: FtTransfersWalkParams & {
|
|
2746
3092
|
fields: readonly F[];
|
|
2747
3093
|
}): AsyncIterable<FtTransferFields<F>>;
|
|
@@ -2755,13 +3101,20 @@ interface NftTransfersResource {
|
|
|
2755
3101
|
fields: readonly F[];
|
|
2756
3102
|
}): Promise<NftTransfersEnvelope<NftTransferFields<F>>>;
|
|
2757
3103
|
(params?: NftTransfersListParams): Promise<NftTransfersEnvelope>;
|
|
2758
|
-
/**
|
|
2759
|
-
*
|
|
3104
|
+
/**
|
|
3105
|
+
* Read one page of NFT transfers, plus the cursor for the next.
|
|
3106
|
+
*
|
|
3107
|
+
* Filter by `contractId`, `assetIdentifier`, `sender`, `recipient`, and a height range. Pass `next_cursor` back as `cursor` to continue. `fields` returns only those columns and narrows the row type; `cursor`, `block_height`, and `event_type` always come back.
|
|
3108
|
+
*/
|
|
2760
3109
|
list<const F extends keyof NftTransfer & string>(params: NftTransfersListParams & {
|
|
2761
3110
|
fields: readonly F[];
|
|
2762
3111
|
}): Promise<NftTransfersEnvelope<NftTransferFields<F>>>;
|
|
2763
3112
|
list(params?: NftTransfersListParams): Promise<NftTransfersEnvelope>;
|
|
2764
|
-
/**
|
|
3113
|
+
/**
|
|
3114
|
+
* Iterate every NFT transfer, paging for you.
|
|
3115
|
+
*
|
|
3116
|
+
* Takes the same filters as `list`. Not a live index: it does not checkpoint, ignores reorgs, and ends when it catches the tip. `batchSize` defaults to 200 (max 1000); page fetches retry on 429 and 5xx; aborting `signal` rejects the iterator.
|
|
3117
|
+
*/
|
|
2765
3118
|
walk<const F extends keyof NftTransfer & string>(params: NftTransfersWalkParams & {
|
|
2766
3119
|
fields: readonly F[];
|
|
2767
3120
|
}): AsyncIterable<NftTransferFields<F>>;
|
|
@@ -2778,9 +3131,11 @@ interface IndexEventsResource {
|
|
|
2778
3131
|
fields: readonly F[];
|
|
2779
3132
|
}): Promise<EventsEnvelope<T, IndexEventFields<T, F>>>;
|
|
2780
3133
|
<T extends IndexEventType>(params: EventsListParams<T>): Promise<EventsEnvelope<T>>;
|
|
2781
|
-
/**
|
|
2782
|
-
*
|
|
2783
|
-
*
|
|
3134
|
+
/**
|
|
3135
|
+
* Read one page of decoded events of one type.
|
|
3136
|
+
*
|
|
3137
|
+
* `eventType` is required: a decoded type (`ft_transfer`, `print`, ...) or a VM type (`nested_contract_call`, `map_set`, ...), and a literal narrows the row type. Scope with `contractId` (one id or up to 20) or `trait`, never both, plus `assetIdentifier`, `sender`, `recipient`, `functionName`, `caller`, `map`, `varName`, `txId`, and a height range. `txContext: true` joins the submitting transaction onto each event. `fields` returns only those columns and narrows the row type; it saves wire bytes but does not change what you are billed, since rows are metered, not columns.
|
|
3138
|
+
*/
|
|
2784
3139
|
list<
|
|
2785
3140
|
T extends IndexEventType,
|
|
2786
3141
|
const F extends keyof IndexEventOf<T> & string
|
|
@@ -2788,9 +3143,11 @@ interface IndexEventsResource {
|
|
|
2788
3143
|
fields: readonly F[];
|
|
2789
3144
|
}): Promise<EventsEnvelope<T, IndexEventFields<T, F>>>;
|
|
2790
3145
|
list<T extends IndexEventType>(params: EventsListParams<T>): Promise<EventsEnvelope<T>>;
|
|
2791
|
-
/**
|
|
2792
|
-
*
|
|
2793
|
-
*
|
|
3146
|
+
/**
|
|
3147
|
+
* Iterate every decoded event of one type, paging for you.
|
|
3148
|
+
*
|
|
3149
|
+
* Takes the same filters as `list`, including `eventType`. Not a live index: it does not checkpoint, ignores reorgs, and ends when it catches the tip. `batchSize` defaults to 200 (max 1000); page fetches retry on 429 and 5xx; aborting `signal` rejects the iterator.
|
|
3150
|
+
*/
|
|
2794
3151
|
walk<
|
|
2795
3152
|
T extends IndexEventType,
|
|
2796
3153
|
const F extends keyof IndexEventOf<T> & string
|
|
@@ -2798,6 +3155,11 @@ interface IndexEventsResource {
|
|
|
2798
3155
|
fields: readonly F[];
|
|
2799
3156
|
}): AsyncIterable<IndexEventFields<T, F>>;
|
|
2800
3157
|
walk<T extends IndexEventType>(params: EventsWalkParams<T>): AsyncIterable<IndexEventOf<T>>;
|
|
3158
|
+
/**
|
|
3159
|
+
* Run a checkpointed, reorg-aware indexer over decoded events.
|
|
3160
|
+
*
|
|
3161
|
+
* Write your rows in `onBatch` and commit `ctx.cursor` in the same transaction; resume with `fromCursor`. Without `fromCursor` or `fromHeight` the API serves only its recent default window, so pass `fromHeight: 0` for a full backfill. A reorg at or below your checkpoint calls `onReorg`, then the loop re-reads from the fork point. Delivery is at-least-once, so keep writes idempotent. With a `sink`, the checkpoint and rollback are handled for you. `finalizedOnly` holds delivery to finalized rows, so no reorg handling is needed. `mode: "tail"` (default) keeps polling at the tip; `mode: "bounded"` returns on the first empty page. Resolves to `{ cursor, pages, emptyPolls }`.
|
|
3162
|
+
*/
|
|
2801
3163
|
consume<
|
|
2802
3164
|
T extends IndexEventType,
|
|
2803
3165
|
TTx = never
|
|
@@ -2816,9 +3178,12 @@ type IndexEventTypeFilters = {
|
|
|
2816
3178
|
equality_filters?: string[];
|
|
2817
3179
|
required_non_null?: string[];
|
|
2818
3180
|
};
|
|
2819
|
-
/**
|
|
2820
|
-
*
|
|
2821
|
-
*
|
|
3181
|
+
/**
|
|
3182
|
+
* The `GET /v1/index` discovery doc: live endpoints and filter vocabulary.
|
|
3183
|
+
*
|
|
3184
|
+
* Shape is intentionally open (the server may add fields); the agent-relevant
|
|
3185
|
+
* parts are the per-type filter rules.
|
|
3186
|
+
*/
|
|
2822
3187
|
type IndexDiscovery = {
|
|
2823
3188
|
event_type_filters?: Record<string, IndexEventTypeFilters>;
|
|
2824
3189
|
[key: string]: unknown;
|
|
@@ -2826,15 +3191,19 @@ type IndexDiscovery = {
|
|
|
2826
3191
|
declare class Index extends BaseClient {
|
|
2827
3192
|
constructor(options?: Partial<SecondLayerOptions>);
|
|
2828
3193
|
/**
|
|
2829
|
-
*
|
|
2830
|
-
*
|
|
2831
|
-
*
|
|
3194
|
+
* Get the live vocabulary of what Index can query.
|
|
3195
|
+
*
|
|
3196
|
+
* The discovery doc lists every endpoint and each event type's columns,
|
|
3197
|
+
* allowed and equality filters, and required-non-null fields. Read it to
|
|
3198
|
+
* learn what's queryable (and which types accept `trait`) instead of
|
|
3199
|
+
* hardcoding.
|
|
2832
3200
|
*/
|
|
2833
3201
|
discover(): Promise<IndexDiscovery>;
|
|
2834
3202
|
/**
|
|
2835
|
-
*
|
|
2836
|
-
*
|
|
2837
|
-
*
|
|
3203
|
+
* Get the print payload schema a contract actually emits.
|
|
3204
|
+
*
|
|
3205
|
+
* Lists the topics it emits and each field's observed Clarity, TS, and
|
|
3206
|
+
* column types. Anonymous read; resolves to `null` on 404.
|
|
2838
3207
|
*/
|
|
2839
3208
|
printSchema(contractId: string): Promise<PrintSchemaResponse | null>;
|
|
2840
3209
|
/** Callable: `index.ftTransfers(params)` ≡ `index.ftTransfers.list(params)`. */
|
|
@@ -2845,8 +3214,23 @@ declare class Index extends BaseClient {
|
|
|
2845
3214
|
* Callable: `index.events(params)` ≡ `index.events.list(params)`. */
|
|
2846
3215
|
readonly events: IndexEventsResource;
|
|
2847
3216
|
readonly contractCalls: {
|
|
3217
|
+
/**
|
|
3218
|
+
* Read one page of decoded contract calls.
|
|
3219
|
+
*
|
|
3220
|
+
* Filter by `contractId` (one id or up to 20) or `trait`, never both, plus `functionName`, `sender`, and a height range. Each row has the function name, arguments, result, and status. Pass `next_cursor` back as `cursor` to continue.
|
|
3221
|
+
*/
|
|
2848
3222
|
list: (params?: ContractCallsListParams) => Promise<ContractCallsEnvelope>;
|
|
3223
|
+
/**
|
|
3224
|
+
* Iterate every decoded contract call, paging for you.
|
|
3225
|
+
*
|
|
3226
|
+
* Takes the same filters as `list`. Not a live index: it does not checkpoint, ignores reorgs, and ends when it catches the tip. `batchSize` defaults to 200 (max 1000); page fetches retry on 429 and 5xx; aborting `signal` rejects the iterator.
|
|
3227
|
+
*/
|
|
2849
3228
|
walk: (params?: ContractCallsWalkParams) => AsyncIterable<IndexContractCall>;
|
|
3229
|
+
/**
|
|
3230
|
+
* Run a checkpointed, reorg-aware indexer over contract calls.
|
|
3231
|
+
*
|
|
3232
|
+
* Write your rows in `onBatch` and commit `ctx.cursor` in the same transaction; resume with `fromCursor`. Without `fromCursor` or `fromHeight` the API serves only its recent default window, so pass `fromHeight: 0` for a full backfill. A reorg at or below your checkpoint calls `onReorg`, then the loop re-reads from the fork point. Delivery is at-least-once, so keep writes idempotent. With a `sink`, the checkpoint and rollback are handled for you. `finalizedOnly` holds delivery to finalized rows, so no reorg handling is needed. `mode: "tail"` (default) keeps polling at the tip; `mode: "bounded"` returns on the first empty page. Resolves to `{ cursor, pages, emptyPolls }`. Calls already carry `sender` and `function_name`, so there is no `txContext`.
|
|
3233
|
+
*/
|
|
2850
3234
|
consume: <TTx = never>(params: ContractCallsConsumeParams<TTx> & {
|
|
2851
3235
|
sink?: ConsumerSink<TTx>;
|
|
2852
3236
|
}) => Promise<{
|
|
@@ -2857,49 +3241,125 @@ declare class Index extends BaseClient {
|
|
|
2857
3241
|
};
|
|
2858
3242
|
/** Canonical block-hash map — sync only the current canonical chain. */
|
|
2859
3243
|
readonly canonical: {
|
|
3244
|
+
/**
|
|
3245
|
+
* Read one page of the canonical block-hash map.
|
|
3246
|
+
*
|
|
3247
|
+
* Each row is a block's hash, its parent hash, and its burn-chain anchor. Compare it with your own tables to confirm you follow the current chain.
|
|
3248
|
+
*/
|
|
2860
3249
|
list: (params?: CanonicalListParams) => Promise<CanonicalEnvelope>;
|
|
3250
|
+
/**
|
|
3251
|
+
* Iterate every canonical block hash, paging for you.
|
|
3252
|
+
*
|
|
3253
|
+
* Takes the same filters as `list`. Not a live index: it does not checkpoint, ignores reorgs, and ends when it catches the tip. `batchSize` defaults to 200 (max 1000); page fetches retry on 429 and 5xx; aborting `signal` rejects the iterator.
|
|
3254
|
+
*/
|
|
2861
3255
|
walk: (params?: CanonicalWalkParams) => AsyncIterable<IndexCanonicalBlock>;
|
|
2862
3256
|
};
|
|
2863
3257
|
/** Exact MARF writes per canonical block (`/v1/index/state-writes`). */
|
|
2864
3258
|
readonly stateWrites: {
|
|
3259
|
+
/**
|
|
3260
|
+
* Read one page of the contract-state writes each block committed.
|
|
3261
|
+
*
|
|
3262
|
+
* Rows are the exact key and value writes, in the node's write order (`ordinal`), so you can see which key a transaction changed when events alone do not show it. Filter by `blockHeight` (excludes `fromHeight` and `toHeight`) or `contractId`. `txContext: true` joins the writing transaction. Rows exist only from the height your node first subscribed to state writes.
|
|
3263
|
+
*/
|
|
2865
3264
|
list: (params?: StateWritesListParams) => Promise<StateWritesEnvelope>;
|
|
3265
|
+
/**
|
|
3266
|
+
* Iterate every state write, paging for you.
|
|
3267
|
+
*
|
|
3268
|
+
* Takes the same filters as `list`. Not a live index: it does not checkpoint, ignores reorgs, and ends when it catches the tip. `batchSize` defaults to 200 (max 1000); page fetches retry on 429 and 5xx; aborting `signal` rejects the iterator.
|
|
3269
|
+
*/
|
|
2866
3270
|
walk: (params?: StateWritesWalkParams) => AsyncIterable<IndexStateWrite>;
|
|
2867
3271
|
};
|
|
2868
3272
|
/** Canonical blocks: paginated `list`/`walk`, plus `get` by height or hash
|
|
2869
3273
|
* (resolves to null on 404). */
|
|
2870
3274
|
readonly blocks: {
|
|
3275
|
+
/**
|
|
3276
|
+
* Read one page of canonical blocks.
|
|
3277
|
+
*
|
|
3278
|
+
* Each block has its hash, parent hash, burn-chain anchor, and `block_time`. Filter by a height range.
|
|
3279
|
+
*/
|
|
2871
3280
|
list: (params?: BlocksListParams) => Promise<BlocksEnvelope>;
|
|
3281
|
+
/**
|
|
3282
|
+
* Iterate every canonical block, paging for you.
|
|
3283
|
+
*
|
|
3284
|
+
* Takes the same filters as `list`. Not a live index: it does not checkpoint, ignores reorgs, and ends when it catches the tip. `batchSize` defaults to 200 (max 1000); page fetches retry on 429 and 5xx; aborting `signal` rejects the iterator.
|
|
3285
|
+
*/
|
|
2872
3286
|
walk: (params?: BlocksWalkParams) => AsyncIterable<IndexBlock>;
|
|
3287
|
+
/**
|
|
3288
|
+
* Get one block by height or hash, or `null`.
|
|
3289
|
+
*
|
|
3290
|
+
* Resolves to `null` when no such block exists (404).
|
|
3291
|
+
*/
|
|
2873
3292
|
get: (ref: string | number) => Promise<BlockEnvelope | null>;
|
|
2874
3293
|
};
|
|
2875
3294
|
/** Full transaction documents: paginated `list`/`walk`, plus `get` by tx_id
|
|
2876
3295
|
* (resolves to null on 404). */
|
|
2877
3296
|
readonly transactions: {
|
|
2878
|
-
/**
|
|
2879
|
-
*
|
|
2880
|
-
*
|
|
2881
|
-
*
|
|
3297
|
+
/**
|
|
3298
|
+
* Read one page of full transaction documents.
|
|
3299
|
+
*
|
|
3300
|
+
* Filter by `type`, `sender`, `contractId`, and a height range. Each document has the decoded post conditions and the payload for its `tx_type`; enrichment fields are null when the raw transaction cannot be decoded. `fields` returns only those columns and narrows the row type; `cursor`, `block_height`, and `tx_id` always come back.
|
|
3301
|
+
*/
|
|
2882
3302
|
list: {
|
|
2883
3303
|
<const F extends keyof IndexTransaction & string>(params: TransactionsListParams & {
|
|
2884
3304
|
fields: readonly F[];
|
|
2885
3305
|
}): Promise<TransactionsEnvelope<TransactionFields<F>>>;
|
|
2886
3306
|
(params?: TransactionsListParams): Promise<TransactionsEnvelope>;
|
|
2887
3307
|
};
|
|
3308
|
+
/**
|
|
3309
|
+
* Iterate every transaction document, paging for you.
|
|
3310
|
+
*
|
|
3311
|
+
* Takes the same filters as `list`. Not a live index: it does not checkpoint, ignores reorgs, and ends when it catches the tip. `batchSize` defaults to 200 (max 1000); page fetches retry on 429 and 5xx; aborting `signal` rejects the iterator.
|
|
3312
|
+
*/
|
|
2888
3313
|
walk: (params?: TransactionsWalkParams) => AsyncIterable<IndexTransaction>;
|
|
3314
|
+
/**
|
|
3315
|
+
* Get one transaction by id, or `null`.
|
|
3316
|
+
*
|
|
3317
|
+
* Resolves to `null` when the transaction is not found (404).
|
|
3318
|
+
*/
|
|
2889
3319
|
get: (txId: string) => Promise<TransactionEnvelope | null>;
|
|
3320
|
+
/**
|
|
3321
|
+
* Get a transaction's inclusion proof, or `null`.
|
|
3322
|
+
*
|
|
3323
|
+
* The proof is the raw transaction, the Nakamoto block header, and the merkle path. Check it yourself with `verifyTransactionProof`; nothing in it needs to be trusted. Resolves to `null` on 404. A 503 (`PROOF_TX_SET_INCOMPLETE` or `PROOF_NODE_UNAVAILABLE`) throws an `ApiError`: the proof cannot be assembled on this deployment right now.
|
|
3324
|
+
*/
|
|
2890
3325
|
getProof: (txId: string) => Promise<TransactionProof | null>;
|
|
2891
3326
|
};
|
|
2892
3327
|
/** Decoded PoX-4 stacking actions. Empty (with a `notes` hint) when the
|
|
2893
3328
|
* platform's PoX-4 decoder is disabled. */
|
|
2894
3329
|
readonly stacking: {
|
|
3330
|
+
/**
|
|
3331
|
+
* Read one page of decoded PoX-4 stacking actions.
|
|
3332
|
+
*
|
|
3333
|
+
* One row per stacking contract call. Filter by `functionName`, `stacker`, `caller`, and a height range. The feed is empty, with a `notes` hint, when the instance's PoX-4 decoder is disabled. For the current PoX, use `pox5.events` and `pox.cycles`.
|
|
3334
|
+
*/
|
|
2895
3335
|
list: (params?: StackingListParams) => Promise<StackingEnvelope>;
|
|
3336
|
+
/**
|
|
3337
|
+
* Iterate every PoX-4 stacking action, paging for you.
|
|
3338
|
+
*
|
|
3339
|
+
* Takes the same filters as `list`. Not a live index: it does not checkpoint, ignores reorgs, and ends when it catches the tip. `batchSize` defaults to 200 (max 1000); page fetches retry on 429 and 5xx; aborting `signal` rejects the iterator.
|
|
3340
|
+
*/
|
|
2896
3341
|
walk: (params?: StackingWalkParams) => AsyncIterable<IndexStackingAction>;
|
|
2897
3342
|
};
|
|
2898
3343
|
/** Pending (unconfirmed) transactions: paginated `list`/`walk`, plus `get` by
|
|
2899
3344
|
* tx_id (resolves to null when the tx has confirmed or dropped). */
|
|
2900
3345
|
readonly mempool: {
|
|
3346
|
+
/**
|
|
3347
|
+
* Read one page of pending, unconfirmed transactions.
|
|
3348
|
+
*
|
|
3349
|
+
* Filter by `sender`, `type`, `contractId`, and `functionName`. There is no height filter: rows carry `received_at` and a sequence cursor instead of a block position.
|
|
3350
|
+
*/
|
|
2901
3351
|
list: (params?: MempoolListParams) => Promise<MempoolEnvelope>;
|
|
3352
|
+
/**
|
|
3353
|
+
* Iterate every pending transaction, paging for you.
|
|
3354
|
+
*
|
|
3355
|
+
* Takes the same filters as `list`. Not a live index: it does not checkpoint, ignores reorgs, and ends when it catches the tip. `batchSize` defaults to 200 (max 1000); page fetches retry on 429 and 5xx; aborting `signal` rejects the iterator.
|
|
3356
|
+
*/
|
|
2902
3357
|
walk: (params?: MempoolWalkParams) => AsyncIterable<IndexMempoolTransaction>;
|
|
3358
|
+
/**
|
|
3359
|
+
* Get one pending transaction, or `null`.
|
|
3360
|
+
*
|
|
3361
|
+
* Resolves to `null` once the transaction has confirmed or dropped.
|
|
3362
|
+
*/
|
|
2903
3363
|
get: (txId: string) => Promise<MempoolTransactionEnvelope | null>;
|
|
2904
3364
|
};
|
|
2905
3365
|
/** Decoded sBTC peg surface — the only productized decoded sBTC peg feed on
|
|
@@ -2976,6 +3436,7 @@ import { ReindexResponse, SubgraphAggregateParams, SubgraphAggregateResponse, Su
|
|
|
2976
3436
|
import { DeploySubgraphRequest, DeploySubgraphResponse } from "@secondlayer/shared/schemas/subgraphs";
|
|
2977
3437
|
import { SubgraphAgentSchema, SubgraphSpecOptions } from "@secondlayer/shared/subgraphs/spec";
|
|
2978
3438
|
import { InferSubgraphClient } from "@secondlayer/subgraphs";
|
|
3439
|
+
/** A deployed subgraph's source code, handler bundle, and pin. */
|
|
2979
3440
|
interface SubgraphSource {
|
|
2980
3441
|
name: string;
|
|
2981
3442
|
version: string;
|
|
@@ -3019,6 +3480,7 @@ interface SubgraphRowsEnvelope<T = unknown> {
|
|
|
3019
3480
|
blocks_behind: number;
|
|
3020
3481
|
};
|
|
3021
3482
|
}
|
|
3483
|
+
/** A deployed subgraph's bundled sources, schema, and handler code. */
|
|
3022
3484
|
interface BundleSubgraphResponse {
|
|
3023
3485
|
ok: true;
|
|
3024
3486
|
name: string;
|
|
@@ -3030,26 +3492,54 @@ interface BundleSubgraphResponse {
|
|
|
3030
3492
|
bundleSize: number;
|
|
3031
3493
|
}
|
|
3032
3494
|
declare class Subgraphs extends BaseClient {
|
|
3495
|
+
/**
|
|
3496
|
+
* List the subgraphs deployed to this instance.
|
|
3497
|
+
*
|
|
3498
|
+
* Each summary has the status, the last processed block against the chain tip, progress, `gapCount`, and an `integrity` flag.
|
|
3499
|
+
*/
|
|
3033
3500
|
list(): Promise<{
|
|
3034
3501
|
data: SubgraphSummary[];
|
|
3035
3502
|
}>;
|
|
3036
3503
|
/**
|
|
3037
|
-
*
|
|
3038
|
-
*
|
|
3039
|
-
*
|
|
3504
|
+
* Get a subgraph's health, sync position, and tables.
|
|
3505
|
+
*
|
|
3506
|
+
* The verify step after a deploy, reindex, or backfill: poll it until
|
|
3507
|
+
* `sync` catches the tip.
|
|
3040
3508
|
*/
|
|
3041
3509
|
status(name: string): Promise<SubgraphDetail>;
|
|
3510
|
+
/**
|
|
3511
|
+
* Get a subgraph's OpenAPI spec.
|
|
3512
|
+
*
|
|
3513
|
+
* Describes the REST routes generated for each table. Pass `serverUrl` to set the server the spec advertises.
|
|
3514
|
+
*/
|
|
3042
3515
|
openapi(name: string, options?: SubgraphSpecOptions): Promise<Record<string, unknown>>;
|
|
3516
|
+
/**
|
|
3517
|
+
* Get a subgraph's schema as JSON, shaped for agents.
|
|
3518
|
+
*
|
|
3519
|
+
* Per table: the endpoints, columns, indexes, which fields are sortable, selectable, searchable, or filterable, and a ready example query. Pass `serverUrl` to set the server the endpoints use.
|
|
3520
|
+
*/
|
|
3043
3521
|
schema(name: string, options?: SubgraphSpecOptions): Promise<SubgraphAgentSchema>;
|
|
3522
|
+
/**
|
|
3523
|
+
* Get a subgraph's generated API docs as Markdown text.
|
|
3524
|
+
*
|
|
3525
|
+
* Pass `serverUrl` to set the server the examples use.
|
|
3526
|
+
*/
|
|
3044
3527
|
markdown(name: string, options?: SubgraphSpecOptions): Promise<string>;
|
|
3045
3528
|
/**
|
|
3046
|
-
*
|
|
3529
|
+
* Rebuild a subgraph from scratch.
|
|
3530
|
+
*
|
|
3531
|
+
* A reindex always drops and rebuilds the whole subgraph, so it takes no
|
|
3047
3532
|
* block range; the API rejects one with `REINDEX_RANGE_NOT_SUPPORTED`.
|
|
3048
3533
|
* Use {@link backfill} to process a specific range. While a reindex or
|
|
3049
3534
|
* backfill is already running the API answers 409 with code
|
|
3050
3535
|
* `OPERATION_IN_PROGRESS`; poll {@link operations} until it finishes.
|
|
3051
3536
|
*/
|
|
3052
3537
|
reindex(name: string): Promise<ReindexResponse>;
|
|
3538
|
+
/**
|
|
3539
|
+
* Stop a running reindex or backfill.
|
|
3540
|
+
*
|
|
3541
|
+
* Requests the cancel and resolves with the `operationId` and a `cancel_requested` status. Poll {@link getOperation} until `status` is terminal. Throws a 404 with code `NO_OPERATION` when nothing is running.
|
|
3542
|
+
*/
|
|
3053
3543
|
stop(name: string): Promise<{
|
|
3054
3544
|
message: string;
|
|
3055
3545
|
operationId?: string;
|
|
@@ -3061,19 +3551,31 @@ declare class Subgraphs extends BaseClient {
|
|
|
3061
3551
|
fromBlock: number;
|
|
3062
3552
|
toBlock: number;
|
|
3063
3553
|
}): Promise<ReindexResponse>;
|
|
3554
|
+
/**
|
|
3555
|
+
* List the block ranges a subgraph is missing.
|
|
3556
|
+
*
|
|
3557
|
+
* Each gap has its `start`, `end`, `size`, `reason`, and when it was detected and resolved. `resolved` filters to resolved or open gaps; page with `limit` and `offset`. `meta` reports the total gap count and total missing blocks.
|
|
3558
|
+
*/
|
|
3064
3559
|
gaps(name: string, opts?: {
|
|
3065
3560
|
limit?: number;
|
|
3066
3561
|
offset?: number;
|
|
3067
3562
|
resolved?: boolean;
|
|
3068
3563
|
}): Promise<SubgraphGapsResponse>;
|
|
3564
|
+
/**
|
|
3565
|
+
* Delete a subgraph and its tables.
|
|
3566
|
+
*
|
|
3567
|
+
* Permanent. The API cancels any running reindex or backfill first, waits up to 5 seconds for it to stop, then drops the subgraph's tables and registry entry. `force: true` is sent as `?force=true`.
|
|
3568
|
+
*/
|
|
3069
3569
|
delete(name: string, options?: {
|
|
3070
3570
|
force?: boolean;
|
|
3071
3571
|
}): Promise<{
|
|
3072
3572
|
message: string;
|
|
3073
3573
|
}>;
|
|
3074
3574
|
/**
|
|
3075
|
-
*
|
|
3076
|
-
*
|
|
3575
|
+
* Read a table's rows, one cursor page at a time.
|
|
3576
|
+
*
|
|
3577
|
+
* Anon works on an open instance; pass an apiKey on the client where reads
|
|
3578
|
+
* are closed. `next_cursor` is set
|
|
3077
3579
|
* on every page that returned rows and is `null` only on an empty page, so a
|
|
3078
3580
|
* poller tails with `cursor = page.next_cursor ?? cursor`. A paging loop
|
|
3079
3581
|
* ends on an empty page (or one shorter than `limit`).
|
|
@@ -3085,13 +3587,20 @@ declare class Subgraphs extends BaseClient {
|
|
|
3085
3587
|
operations(name: string): Promise<{
|
|
3086
3588
|
operations: SubgraphOperationStatus[];
|
|
3087
3589
|
}>;
|
|
3088
|
-
/**
|
|
3089
|
-
*
|
|
3590
|
+
/** Get the status of one reindex, backfill, or stop operation.
|
|
3591
|
+
*
|
|
3592
|
+
* Poll the `operationId` returned by `reindex`, `backfill`, or `stop`
|
|
3593
|
+
* until `status` is terminal. */
|
|
3090
3594
|
getOperation(name: string, operationId: string): Promise<SubgraphOperationStatus>;
|
|
3091
3595
|
/** Create or update a subgraph. A deploy that needs a rebuild queues one;
|
|
3092
3596
|
* if a reindex or backfill is already running the API answers 409 with
|
|
3093
3597
|
* code `OPERATION_IN_PROGRESS` (an `ApiError`, not a dedicated class). */
|
|
3094
3598
|
deploy(data: DeploySubgraphRequest): Promise<DeploySubgraphResponse>;
|
|
3599
|
+
/**
|
|
3600
|
+
* Get a deployed subgraph's source.
|
|
3601
|
+
*
|
|
3602
|
+
* Returns `sourceCode`, the bundled `handlerCode` the runtime executes, and the `pin` hash of what you deployed. `handlerCode` and `pin` are `null` for local deploys. A subgraph deployed before source was captured returns `sourceCode: null` and `readOnly: true` with a `reason`; redeploy it to capture the source.
|
|
3603
|
+
*/
|
|
3095
3604
|
getSource(name: string): Promise<SubgraphSource>;
|
|
3096
3605
|
/**
|
|
3097
3606
|
* Bundle a TypeScript subgraph source on the server. Used by the web chat
|
|
@@ -3100,13 +3609,15 @@ declare class Subgraphs extends BaseClient {
|
|
|
3100
3609
|
bundle(data: {
|
|
3101
3610
|
code: string;
|
|
3102
3611
|
}): Promise<BundleSubgraphResponse>;
|
|
3103
|
-
/**
|
|
3104
|
-
*
|
|
3612
|
+
/** Count the rows in a table that match a filter.
|
|
3613
|
+
*
|
|
3614
|
+
* The count is exact. Same auth posture as {@link rows}. */
|
|
3105
3615
|
count(name: string, table: string, params?: Pick<SubgraphQueryParams, "filters">): Promise<{
|
|
3106
3616
|
count: number;
|
|
3107
3617
|
}>;
|
|
3108
|
-
/**
|
|
3109
|
-
*
|
|
3618
|
+
/** Compute scalar aggregates over a table's matching rows.
|
|
3619
|
+
*
|
|
3620
|
+
* Same auth posture as {@link rows}. */
|
|
3110
3621
|
aggregate(name: string, table: string, params?: SubgraphAggregateParams): Promise<SubgraphAggregateResponse>;
|
|
3111
3622
|
/**
|
|
3112
3623
|
* Returns a typed client for a subgraph defined with `defineSubgraph()`.
|
|
@@ -3139,37 +3650,93 @@ import { CreateWebhookRequest, CreateWebhookResponse, DeadRow, DeliveryRow, Repl
|
|
|
3139
3650
|
import { ChainTrigger, ChainTriggerType, CreateWebhookRequest as CreateWebhookRequest2, CreateWebhookResponse as CreateWebhookResponse2, DeadRow as DeadRow2, DeliveryRow as DeliveryRow2, ReplayResult as ReplayResult2, RotateSecretResponse as RotateSecretResponse2, WebhookActivity as WebhookActivity2, WebhookActivityHour, WebhookAuth, WebhookDeliveryDetail as WebhookDeliveryDetail2, WebhookDetail as WebhookDetail2, WebhookFormat, WebhookKind, WebhookStatus, WebhookSummary as WebhookSummary2, WebhookTestResult as WebhookTestResult2, UpdateWebhookRequest as UpdateWebhookRequest2 } from "@secondlayer/shared/schemas/webhooks";
|
|
3140
3651
|
import { trigger } from "@secondlayer/shared/schemas/webhooks";
|
|
3141
3652
|
declare class Webhooks extends BaseClient {
|
|
3653
|
+
/**
|
|
3654
|
+
* List your webhooks.
|
|
3655
|
+
*
|
|
3656
|
+
* Each summary has the status, format, URL, last delivery and last success, and the circuit breaker state (`circuitFailures`, `circuitOpenedAt`).
|
|
3657
|
+
*/
|
|
3142
3658
|
list(): Promise<{
|
|
3143
3659
|
data: WebhookSummary[];
|
|
3144
3660
|
}>;
|
|
3661
|
+
/**
|
|
3662
|
+
* Get one webhook's full configuration.
|
|
3663
|
+
*
|
|
3664
|
+
* Adds the triggers, the receiver's auth (redacted to header names and whether a secret is set), the retry and timeout limits, `lastError`, and a `warning` when this instance's trigger evaluator is not running.
|
|
3665
|
+
*/
|
|
3145
3666
|
get(id: string): Promise<WebhookDetail>;
|
|
3667
|
+
/**
|
|
3668
|
+
* Create a webhook that POSTs chain events to your URL.
|
|
3669
|
+
*
|
|
3670
|
+
* Takes a `name`, a `url`, and `triggers` built with `trigger.*`; each trigger is validated before anything is provisioned, and an invalid one is a 400. The signing secret comes back once in `signingSecret`, so store it. A webhook starts at the chain tip and never backfills: use {@link replay} for history. Hosted accounts cap `maxRetries` at 7 and `timeoutMs` at 30000.
|
|
3671
|
+
*/
|
|
3146
3672
|
create(input: CreateWebhookRequest): Promise<CreateWebhookResponse>;
|
|
3673
|
+
/**
|
|
3674
|
+
* Change a webhook's name, URL, format, auth, or delivery limits.
|
|
3675
|
+
*
|
|
3676
|
+
* Send only the fields to change: `name`, `url`, `format`, `authConfig`, `maxRetries`, `timeoutMs`, `concurrency`. Triggers are not part of an update. Resolves to the updated webhook.
|
|
3677
|
+
*/
|
|
3147
3678
|
update(id: string, patch: UpdateWebhookRequest): Promise<WebhookDetail>;
|
|
3679
|
+
/**
|
|
3680
|
+
* Stop deliveries without deleting the webhook.
|
|
3681
|
+
*
|
|
3682
|
+
* Resolves to the updated webhook. {@link resume} turns it back on.
|
|
3683
|
+
*/
|
|
3148
3684
|
pause(id: string): Promise<WebhookDetail>;
|
|
3685
|
+
/**
|
|
3686
|
+
* Start delivering again after a pause.
|
|
3687
|
+
*
|
|
3688
|
+
* Also clears a circuit-breaker pause, which happens after 20 straight failed deliveries. Resolves to the updated webhook.
|
|
3689
|
+
*/
|
|
3149
3690
|
resume(id: string): Promise<WebhookDetail>;
|
|
3691
|
+
/**
|
|
3692
|
+
* Delete a webhook.
|
|
3693
|
+
*
|
|
3694
|
+
* Resolves to `{ ok: true }`. Throws a 404 when the webhook does not exist.
|
|
3695
|
+
*/
|
|
3150
3696
|
delete(id: string): Promise<{
|
|
3151
3697
|
ok: true;
|
|
3152
3698
|
}>;
|
|
3699
|
+
/**
|
|
3700
|
+
* Issue a new signing secret.
|
|
3701
|
+
*
|
|
3702
|
+
* The new secret comes back once in `signingSecret`. Update the receiver that calls `verifyWebhookSignature` with it: deliveries are signed with the new secret from now on.
|
|
3703
|
+
*/
|
|
3153
3704
|
rotateSecret(id: string): Promise<RotateSecretResponse>;
|
|
3154
|
-
/** Send a one-off test
|
|
3155
|
-
*
|
|
3705
|
+
/** Send a one-off test delivery to a webhook's URL.
|
|
3706
|
+
*
|
|
3707
|
+
* Built for the webhook's format and SSRF-guarded. Logged as a delivery
|
|
3708
|
+
* row, visible via `deliveries`. */
|
|
3156
3709
|
test(id: string): Promise<WebhookTestResult>;
|
|
3157
3710
|
/** The last 100 delivery attempts, newest first. The server caps the window;
|
|
3158
3711
|
* there is nothing to page. */
|
|
3159
3712
|
deliveries(id: string): Promise<{
|
|
3160
3713
|
data: DeliveryRow[];
|
|
3161
3714
|
}>;
|
|
3162
|
-
/**
|
|
3163
|
-
*
|
|
3715
|
+
/** Get a webhook's hourly delivery counts for the last 7 days.
|
|
3716
|
+
*
|
|
3717
|
+
* Each hour has delivered, waiting, and gave-up counts, plus the current
|
|
3718
|
+
* queue depth. This is the events chart on the detail page. */
|
|
3164
3719
|
activity(id: string): Promise<WebhookActivity>;
|
|
3165
|
-
/**
|
|
3166
|
-
*
|
|
3720
|
+
/** Get one delivery attempt with its payload and response.
|
|
3721
|
+
*
|
|
3722
|
+
* Includes the outbox context (payload, response headers). This is the
|
|
3723
|
+
* delivery card on the detail page. */
|
|
3167
3724
|
delivery(id: string, deliveryId: string): Promise<WebhookDeliveryDetail>;
|
|
3725
|
+
/**
|
|
3726
|
+
* Re-deliver historical events over an existing webhook.
|
|
3727
|
+
*
|
|
3728
|
+
* Pass `fromBlock` and `toBlock`; the range is capped at 100,000 blocks. A replay is historical only and never moves the live cursor. It is idempotent: the same range twice is a no-op, so pass any string as `force` to re-deliver it. Replays carry `is_replay` and use the standard `chain.{type}.apply` envelope. Resolves to `replayId`, `enqueuedCount`, and `scannedCount`. A second replay while one is running is a 409. `sbtc_withdrawal_swept_confirmed` is forward-only and never replayed. Hosted accounts get 5 replays an hour.
|
|
3729
|
+
*/
|
|
3168
3730
|
replay(id: string, range: {
|
|
3169
3731
|
fromBlock: number;
|
|
3170
3732
|
toBlock: number;
|
|
3171
3733
|
force?: string;
|
|
3172
3734
|
}): Promise<ReplayResult>;
|
|
3735
|
+
/**
|
|
3736
|
+
* List the events a webhook gave up delivering.
|
|
3737
|
+
*
|
|
3738
|
+
* Returns up to 100 dead-lettered events, newest failure first. Each row's `id` is what {@link requeue} takes.
|
|
3739
|
+
*/
|
|
3173
3740
|
dead(id: string): Promise<{
|
|
3174
3741
|
data: DeadRow[];
|
|
3175
3742
|
}>;
|
|
@@ -3208,10 +3775,11 @@ interface ContextField<T> {
|
|
|
3208
3775
|
error?: ContextFieldError;
|
|
3209
3776
|
}
|
|
3210
3777
|
/**
|
|
3211
|
-
* A point-in-time orientation snapshot
|
|
3212
|
-
*
|
|
3213
|
-
*
|
|
3214
|
-
* catching up) instead of a bare
|
|
3778
|
+
* A point-in-time orientation snapshot: live tips and what this instance holds.
|
|
3779
|
+
*
|
|
3780
|
+
* Every field is a `ContextField`, so a missing value says why it is missing
|
|
3781
|
+
* (API unreachable, token rejected, index still catching up) instead of a bare
|
|
3782
|
+
* `null`. `context()` itself never throws.
|
|
3215
3783
|
*/
|
|
3216
3784
|
interface ContextSnapshot {
|
|
3217
3785
|
/** Token identity from `/api/accounts/me`. A self-hosted instance has no
|
|
@@ -3243,8 +3811,12 @@ declare class SecondLayer extends BaseClient {
|
|
|
3243
3811
|
readonly instance: InstanceClient;
|
|
3244
3812
|
constructor(options?: Partial<SecondLayerOptions>);
|
|
3245
3813
|
/**
|
|
3246
|
-
*
|
|
3247
|
-
*
|
|
3814
|
+
* Run up to 10 public reads in one round trip (`POST /v1/batch`).
|
|
3815
|
+
*
|
|
3816
|
+
* Each item is authorized on its own; the client's bearer token applies to
|
|
3817
|
+
* every item. Results come back in order as `{ path, status, body }`. Only
|
|
3818
|
+
* paths under `/v1/index/`, `/v1/subgraphs`, `/v1/streams/`, and
|
|
3819
|
+
* `/v1/contracts` are allowed; anything else is a per-item 400.
|
|
3248
3820
|
*/
|
|
3249
3821
|
batch(requests: Array<{
|
|
3250
3822
|
path: string;
|
|
@@ -3257,10 +3829,12 @@ declare class SecondLayer extends BaseClient {
|
|
|
3257
3829
|
}>;
|
|
3258
3830
|
}>;
|
|
3259
3831
|
/**
|
|
3260
|
-
*
|
|
3261
|
-
*
|
|
3262
|
-
*
|
|
3263
|
-
*
|
|
3832
|
+
* Get a one-call snapshot of your account and instance.
|
|
3833
|
+
*
|
|
3834
|
+
* Returns a {@link ContextSnapshot}: the same orientation an MCP agent reads
|
|
3835
|
+
* from `secondlayer://context`, available to any SDK or CLI consumer. Reads
|
|
3836
|
+
* run concurrently; a failed read lands as `{ value: null, error }` on its
|
|
3837
|
+
* field rather than rejecting the whole snapshot.
|
|
3264
3838
|
*/
|
|
3265
3839
|
context(): Promise<ContextSnapshot>;
|
|
3266
3840
|
}
|
|
@@ -3291,7 +3865,7 @@ import { DeadRow as DeadRow3, DeliveryRow as DeliveryRow3, WebhookDetail as Webh
|
|
|
3291
3865
|
* dashboard's webhook detail page. Moved out of the CLI (unchanged behavior)
|
|
3292
3866
|
* so the web can build the same judgment without printing CLI-command text.
|
|
3293
3867
|
*
|
|
3294
|
-
*
|
|
3868
|
+
* Five deterministic, numbers-only detectors sit on top of the
|
|
3295
3869
|
* existing flag checks: no model, no history beyond the deliveries window
|
|
3296
3870
|
* already fetched. Thresholds are named constants below, conservative on
|
|
3297
3871
|
* purpose — a wrong insight costs more trust than a missed one.
|