@secondlayer/sdk 15.0.1 → 15.0.3
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 +213 -61
- package/dist/index.js.map +7 -7
- package/dist/streams/index.d.ts +88 -36
- package/dist/streams/index.js.map +1 -1
- package/dist/subgraphs/index.d.ts +213 -61
- package/dist/subgraphs/index.js.map +6 -6
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ type InstanceClient = {
|
|
|
17
17
|
*/
|
|
18
18
|
diagnose(): Promise<InstanceDiagnosis>;
|
|
19
19
|
};
|
|
20
|
+
/** What to verify against, and the optional block range. */
|
|
20
21
|
type ArchiveVerifyInput = {
|
|
21
22
|
against: string;
|
|
22
23
|
target?: string;
|
|
@@ -26,6 +27,7 @@ type ArchiveVerifyInput = {
|
|
|
26
27
|
publicKeyPem?: string;
|
|
27
28
|
};
|
|
28
29
|
type ArchiveVerifyRangeStatus = "match" | "digest-mismatch" | "count-mismatch" | "missing";
|
|
30
|
+
/** Whether the archive is clean, diverged, or unanchored, by range. */
|
|
29
31
|
type ArchiveVerifyResult = {
|
|
30
32
|
status: "clean" | "diverged" | "unanchored";
|
|
31
33
|
target: string;
|
|
@@ -50,8 +52,11 @@ type ArchiveVerifyResult = {
|
|
|
50
52
|
};
|
|
51
53
|
import { RangeDigest } from "@secondlayer/shared/archive/range-digest";
|
|
52
54
|
import { ArchiveStatus } from "@secondlayer/shared/archive/status";
|
|
55
|
+
/** The three archive datasets: blocks, transactions, and events. */
|
|
53
56
|
type ArchiveDataset = "blocks" | "transactions" | "events";
|
|
57
|
+
/** Whether an archive purchase is a bootstrap or a repair. */
|
|
54
58
|
type ArchiveFlow = "bootstrap" | "repair";
|
|
59
|
+
/** One archive file: dataset, block range, path, rows, bytes. */
|
|
55
60
|
type ArchivePartition = {
|
|
56
61
|
dataset: string;
|
|
57
62
|
from_block: number;
|
|
@@ -74,6 +79,7 @@ type ArchiveManifest = {
|
|
|
74
79
|
key_id?: string;
|
|
75
80
|
[key: string]: unknown;
|
|
76
81
|
};
|
|
82
|
+
/** A loaded archive manifest with its origin and signature check. */
|
|
77
83
|
type LoadedArchive = {
|
|
78
84
|
manifest: ArchiveManifest;
|
|
79
85
|
origin: string;
|
|
@@ -84,6 +90,7 @@ type LoadedArchive = {
|
|
|
84
90
|
reason?: string;
|
|
85
91
|
};
|
|
86
92
|
};
|
|
93
|
+
/** The price of an archive request, after any free allowance. */
|
|
87
94
|
type ArchiveQuote = {
|
|
88
95
|
partitions: number;
|
|
89
96
|
bundles: number;
|
|
@@ -100,11 +107,13 @@ type ArchiveFetchItem = {
|
|
|
100
107
|
expiresAt: string;
|
|
101
108
|
chargedUsdMicros: number;
|
|
102
109
|
};
|
|
110
|
+
/** Download links for archive partitions and what they cost. */
|
|
103
111
|
type ArchiveFetchResult = {
|
|
104
112
|
urls: ArchiveFetchItem[];
|
|
105
113
|
chargedTotalUsdMicros: number;
|
|
106
114
|
balanceAfterUsdMicros: number;
|
|
107
115
|
};
|
|
116
|
+
/** Your archive credit balance and its refill settings. */
|
|
108
117
|
type ArchiveCreditsBalance = {
|
|
109
118
|
creditsUsdMicros: string;
|
|
110
119
|
refill: {
|
|
@@ -113,6 +122,7 @@ type ArchiveCreditsBalance = {
|
|
|
113
122
|
lastAt: string | null;
|
|
114
123
|
};
|
|
115
124
|
};
|
|
125
|
+
/** Options for loading an archive manifest. */
|
|
116
126
|
type ArchiveLoadOptions = {
|
|
117
127
|
insecure?: boolean;
|
|
118
128
|
};
|
|
@@ -345,6 +355,7 @@ declare abstract class BaseClient {
|
|
|
345
355
|
*/
|
|
346
356
|
/** Whether a trait match must be declared in source, inferred from ABI, or either. */
|
|
347
357
|
type ContractConformance = "declared" | "inferred" | "any";
|
|
358
|
+
/** Trait, conformance, and paging for listing contracts. */
|
|
348
359
|
interface ContractsListParams {
|
|
349
360
|
/** Required. Trait identifier to match (e.g. "sip-010", or a fully-qualified trait). */
|
|
350
361
|
trait: string;
|
|
@@ -357,6 +368,7 @@ interface ContractsListParams {
|
|
|
357
368
|
/** Opaque cursor from a prior response's `next_cursor`. */
|
|
358
369
|
cursor?: string;
|
|
359
370
|
}
|
|
371
|
+
/** A deployed contract with its traits, standards, and ABI status. */
|
|
360
372
|
interface ContractSummary {
|
|
361
373
|
contract_id: string;
|
|
362
374
|
deployer: string;
|
|
@@ -367,6 +379,7 @@ interface ContractSummary {
|
|
|
367
379
|
/** Present only when `include: "abi"` was requested. */
|
|
368
380
|
abi?: unknown;
|
|
369
381
|
}
|
|
382
|
+
/** One page of contracts and the cursor for the next page. */
|
|
370
383
|
interface ContractsEnvelope {
|
|
371
384
|
contracts: ContractSummary[];
|
|
372
385
|
next_cursor: string | null;
|
|
@@ -600,6 +613,7 @@ type WithSinkTx<TTx> = [TTx] extends [never] ? unknown : {
|
|
|
600
613
|
import { VmEventType } from "@secondlayer/shared";
|
|
601
614
|
import { RuneEventType, RuneStreamsEvent, StreamsEvent, StreamsEventType, StreamsWireEvent, VmStreamsEvent } from "@secondlayer/shared/streams-rows";
|
|
602
615
|
import { StreamsWireEvent as StreamsWireEvent2, RuneEtchEntry, RuneEventPayload, StreamsEventPayload } from "@secondlayer/shared/streams-rows";
|
|
616
|
+
/** The chain tip: latest block, Bitcoin anchor, and finality boundary. */
|
|
603
617
|
type StreamsTip = {
|
|
604
618
|
block_height: number;
|
|
605
619
|
block_hash: string;
|
|
@@ -619,15 +633,19 @@ type StreamsTip = {
|
|
|
619
633
|
/** Oldest seekable cursor (`<oldest_seekable_height>:0`); `null` = unlimited. */
|
|
620
634
|
oldest_cursor?: string | null;
|
|
621
635
|
};
|
|
622
|
-
/**
|
|
623
|
-
*
|
|
624
|
-
*
|
|
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
|
+
*/
|
|
625
642
|
type StreamsBitcoinTip = {
|
|
626
643
|
block_height: number;
|
|
627
644
|
block_hash: string;
|
|
628
645
|
finalized_height: number;
|
|
629
646
|
lag_seconds: number;
|
|
630
647
|
};
|
|
648
|
+
/** A canonical Stacks block with its Bitcoin anchor. */
|
|
631
649
|
type StreamsCanonicalBlock = {
|
|
632
650
|
block_height: number;
|
|
633
651
|
block_hash: string;
|
|
@@ -635,7 +653,7 @@ type StreamsCanonicalBlock = {
|
|
|
635
653
|
burn_block_hash: string | null;
|
|
636
654
|
is_canonical: true;
|
|
637
655
|
};
|
|
638
|
-
/**
|
|
656
|
+
/** A Bitcoin canonical block, without burn-chain fields. */
|
|
639
657
|
type StreamsBitcoinCanonicalBlock = {
|
|
640
658
|
block_height: number;
|
|
641
659
|
block_hash: string;
|
|
@@ -656,6 +674,7 @@ type StreamsReorg = {
|
|
|
656
674
|
*/
|
|
657
675
|
new_canonical_tip: string;
|
|
658
676
|
};
|
|
677
|
+
/** One page of events with the next cursor, tip, and reorgs. */
|
|
659
678
|
type StreamsEventsEnvelope<
|
|
660
679
|
TEvent = StreamsEvent,
|
|
661
680
|
TTip = StreamsTip
|
|
@@ -665,24 +684,30 @@ type StreamsEventsEnvelope<
|
|
|
665
684
|
tip: TTip;
|
|
666
685
|
reorgs: StreamsReorg[];
|
|
667
686
|
};
|
|
687
|
+
/** One page of events with the tip and reorgs, no cursor. */
|
|
668
688
|
type StreamsEventsListEnvelope<
|
|
669
689
|
TEvent = StreamsEvent,
|
|
670
690
|
TTip = StreamsTip
|
|
671
691
|
> = Omit<StreamsEventsEnvelope<TEvent, TTip>, "next_cursor">;
|
|
672
|
-
/**
|
|
673
|
-
*
|
|
692
|
+
/**
|
|
693
|
+
* The event union narrowed to a `types` selection.
|
|
694
|
+
*
|
|
695
|
+
* A const-generic `types: ["ft_transfer"]` narrows the event type.
|
|
696
|
+
*/
|
|
674
697
|
type StreamsEventOfTypes<T extends readonly StreamsEventType[]> = Extract<StreamsEvent, {
|
|
675
698
|
event_type: T[number];
|
|
676
699
|
}>;
|
|
700
|
+
/** A starting point and limit for listing reorgs. */
|
|
677
701
|
type StreamsReorgsListParams = {
|
|
678
702
|
since: string;
|
|
679
703
|
limit?: number;
|
|
680
704
|
};
|
|
705
|
+
/** A list of reorgs and the cursor to resume from. */
|
|
681
706
|
type StreamsReorgsListEnvelope = {
|
|
682
707
|
reorgs: StreamsReorg[];
|
|
683
708
|
next_since: string | null;
|
|
684
709
|
};
|
|
685
|
-
/** A
|
|
710
|
+
/** A single value or a list of values to match. */
|
|
686
711
|
type StreamsFilterValue = string | readonly string[];
|
|
687
712
|
/**
|
|
688
713
|
* One labelled filter group. Fields inside a group AND together; groups in a
|
|
@@ -712,6 +737,7 @@ type StreamsEventForFilter<
|
|
|
712
737
|
}> : Extract<StreamsEvent, {
|
|
713
738
|
event_type: T;
|
|
714
739
|
}> : D extends true ? IndexEvent : StreamsEvent;
|
|
740
|
+
/** Cursor, height range, and limit shared by every list call. */
|
|
715
741
|
type StreamsEventsListParamsCommon = {
|
|
716
742
|
cursor?: string | null;
|
|
717
743
|
fromHeight?: number;
|
|
@@ -739,12 +765,13 @@ type StreamsEventsStacksListParams = StreamsEventsListParamsCommon & {
|
|
|
739
765
|
filters?: StreamsFilterMap;
|
|
740
766
|
};
|
|
741
767
|
/**
|
|
742
|
-
*
|
|
743
|
-
*
|
|
744
|
-
* `
|
|
745
|
-
*
|
|
746
|
-
*
|
|
747
|
-
*
|
|
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).
|
|
748
775
|
*/
|
|
749
776
|
type StreamsEventsBitcoinListParams = StreamsEventsListParamsCommon & {
|
|
750
777
|
chain: "bitcoin";
|
|
@@ -755,7 +782,9 @@ type StreamsEventsBitcoinListParams = StreamsEventsListParamsCommon & {
|
|
|
755
782
|
/** A mainnet address. */
|
|
756
783
|
address?: string;
|
|
757
784
|
};
|
|
785
|
+
/** Chain, cursor, height range, and filters for listing Streams events. */
|
|
758
786
|
type StreamsEventsListParams = StreamsEventsStacksListParams | StreamsEventsBitcoinListParams;
|
|
787
|
+
/** Cursor, batching, and stop options shared by every event stream. */
|
|
759
788
|
type StreamsEventsStreamCommon = {
|
|
760
789
|
fromCursor?: string | null;
|
|
761
790
|
batchSize?: number;
|
|
@@ -764,8 +793,12 @@ type StreamsEventsStreamCommon = {
|
|
|
764
793
|
maxEmptyPolls?: number;
|
|
765
794
|
signal?: AbortSignal;
|
|
766
795
|
};
|
|
767
|
-
/**
|
|
768
|
-
*
|
|
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
|
+
*/
|
|
769
802
|
type StreamsEventsStreamStacksParams = StreamsEventsStreamCommon & {
|
|
770
803
|
chain?: "stacks";
|
|
771
804
|
types?: readonly StreamsEventType[];
|
|
@@ -777,11 +810,14 @@ type StreamsEventsStreamStacksParams = StreamsEventsStreamCommon & {
|
|
|
777
810
|
/** Labelled filter groups; see {@link StreamsEventsListParams.filters}. */
|
|
778
811
|
filters?: StreamsFilterMap;
|
|
779
812
|
};
|
|
780
|
-
/**
|
|
781
|
-
*
|
|
782
|
-
*
|
|
783
|
-
*
|
|
784
|
-
*
|
|
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
|
+
*/
|
|
785
821
|
type StreamsEventsStreamBitcoinParams = StreamsEventsStreamCommon & {
|
|
786
822
|
chain: "bitcoin";
|
|
787
823
|
types?: readonly RuneEventType[];
|
|
@@ -835,9 +871,12 @@ type StreamsEventsSubscribeStacksParams = StreamsEventsSubscribeCommon & {
|
|
|
835
871
|
*/
|
|
836
872
|
onEvent: (event: StreamsEvent) => void | Promise<void>;
|
|
837
873
|
};
|
|
838
|
-
/**
|
|
839
|
-
*
|
|
840
|
-
*
|
|
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
|
+
*/
|
|
841
880
|
type StreamsEventsSubscribeBitcoinParams = StreamsEventsSubscribeCommon & {
|
|
842
881
|
chain: "bitcoin";
|
|
843
882
|
types?: readonly RuneEventType[];
|
|
@@ -928,6 +967,7 @@ type StreamsBatchContext = ConsumerBatchContext;
|
|
|
928
967
|
type StreamsReorgContext = {
|
|
929
968
|
cursor: string | null;
|
|
930
969
|
};
|
|
970
|
+
/** Options for consuming Streams events: cursor, batching, filters, handler. */
|
|
931
971
|
type StreamsEventsConsumeParams<
|
|
932
972
|
TTx = never,
|
|
933
973
|
D extends boolean = false,
|
|
@@ -1045,13 +1085,14 @@ type StreamsEventsConsumeParams<
|
|
|
1045
1085
|
wake?: () => Promise<void>;
|
|
1046
1086
|
};
|
|
1047
1087
|
/**
|
|
1048
|
-
*
|
|
1049
|
-
*
|
|
1050
|
-
*
|
|
1051
|
-
*
|
|
1052
|
-
*
|
|
1053
|
-
*
|
|
1054
|
-
*
|
|
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).
|
|
1055
1096
|
*/
|
|
1056
1097
|
type StreamsEventsConsumeBitcoinParams<TTx = never> = {
|
|
1057
1098
|
chain: "bitcoin";
|
|
@@ -1084,9 +1125,10 @@ type StreamsEventsConsumeBitcoinParams<TTx = never> = {
|
|
|
1084
1125
|
wake?: () => Promise<void>;
|
|
1085
1126
|
};
|
|
1086
1127
|
/**
|
|
1087
|
-
* One
|
|
1088
|
-
*
|
|
1089
|
-
*
|
|
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`.
|
|
1090
1132
|
*/
|
|
1091
1133
|
type StreamsBatch<
|
|
1092
1134
|
TEvent = StreamsEvent,
|
|
@@ -1100,6 +1142,7 @@ type StreamsBatch<
|
|
|
1100
1142
|
/** Chain reorgs reported alongside this page; empty when none. */
|
|
1101
1143
|
reorgs: StreamsReorg[];
|
|
1102
1144
|
};
|
|
1145
|
+
/** Cursor, batch size, and polling options shared by every consume loop. */
|
|
1103
1146
|
type StreamsConsumeCommon = {
|
|
1104
1147
|
/** Resume strictly after this cursor; omit to start from the oldest seekable page. */
|
|
1105
1148
|
cursor?: string | null;
|
|
@@ -1123,9 +1166,12 @@ type StreamsConsumeStacksParams = StreamsConsumeCommon & {
|
|
|
1123
1166
|
* event echoes the labels it matched. */
|
|
1124
1167
|
filters?: StreamsFilterMap;
|
|
1125
1168
|
};
|
|
1126
|
-
/**
|
|
1127
|
-
*
|
|
1128
|
-
*
|
|
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
|
+
*/
|
|
1129
1175
|
type StreamsConsumeBitcoinParams = StreamsConsumeCommon & {
|
|
1130
1176
|
chain: "bitcoin";
|
|
1131
1177
|
types?: readonly RuneEventType[];
|
|
@@ -1136,11 +1182,13 @@ type StreamsConsumeBitcoinParams = StreamsConsumeCommon & {
|
|
|
1136
1182
|
address?: string;
|
|
1137
1183
|
};
|
|
1138
1184
|
type StreamsConsumeParams = StreamsConsumeStacksParams | StreamsConsumeBitcoinParams;
|
|
1185
|
+
/** Where a consume loop stopped: cursor, pages read, empty polls. */
|
|
1139
1186
|
type StreamsEventsConsumeResult = {
|
|
1140
1187
|
cursor: string | null;
|
|
1141
1188
|
pages: number;
|
|
1142
1189
|
emptyPolls: number;
|
|
1143
1190
|
};
|
|
1191
|
+
/** Options for replaying history from dump files, then tailing live. */
|
|
1144
1192
|
type StreamsEventsReplayParams = {
|
|
1145
1193
|
/** Start point: `"genesis"` (default) or a `<block>:<index>` cursor. */
|
|
1146
1194
|
from?: "genesis" | string;
|
|
@@ -1196,6 +1244,7 @@ type StreamsDumpFile = {
|
|
|
1196
1244
|
schema_version: number;
|
|
1197
1245
|
created_at: string;
|
|
1198
1246
|
};
|
|
1247
|
+
/** The index of finalized Parquet dump files for one dataset. */
|
|
1199
1248
|
type StreamsDumpsManifest = {
|
|
1200
1249
|
dataset: string;
|
|
1201
1250
|
network: string;
|
|
@@ -1569,6 +1618,7 @@ type IndexReorg = {
|
|
|
1569
1618
|
*/
|
|
1570
1619
|
new_canonical_tip: string;
|
|
1571
1620
|
};
|
|
1621
|
+
/** A decoded fungible-token transfer: sender, recipient, asset, amount. */
|
|
1572
1622
|
type FtTransfer = {
|
|
1573
1623
|
cursor: string;
|
|
1574
1624
|
block_height: number;
|
|
@@ -1583,6 +1633,7 @@ type FtTransfer = {
|
|
|
1583
1633
|
recipient: string;
|
|
1584
1634
|
amount: string;
|
|
1585
1635
|
};
|
|
1636
|
+
/** One page of fungible-token transfers, with the cursor, tip, and reorgs. */
|
|
1586
1637
|
type FtTransfersEnvelope<TRow = FtTransfer> = {
|
|
1587
1638
|
events: TRow[];
|
|
1588
1639
|
next_cursor: string | null;
|
|
@@ -1594,6 +1645,7 @@ type FtTransfersEnvelope<TRow = FtTransfer> = {
|
|
|
1594
1645
|
type FtTransferAlwaysFields = "cursor" | "block_height" | "event_type";
|
|
1595
1646
|
/** An ft-transfer row narrowed to the requested columns plus the always-present ones. */
|
|
1596
1647
|
type FtTransferFields<F extends keyof FtTransfer & string> = Pick<FtTransfer, (F | FtTransferAlwaysFields) & keyof FtTransfer>;
|
|
1648
|
+
/** Column selection, paging, and filters for listing token transfers. */
|
|
1597
1649
|
type FtTransfersListParams = {
|
|
1598
1650
|
/**
|
|
1599
1651
|
* Columns to return. The server projects the row, so an unrequested column
|
|
@@ -1629,7 +1681,9 @@ type WalkOptions = PageRetryOptions & {
|
|
|
1629
1681
|
* walk from a stopped one. */
|
|
1630
1682
|
signal?: AbortSignal;
|
|
1631
1683
|
};
|
|
1684
|
+
/** `FtTransfersListParams` without `limit`, plus walk options. */
|
|
1632
1685
|
type FtTransfersWalkParams = Omit<FtTransfersListParams, "limit"> & WalkOptions;
|
|
1686
|
+
/** A decoded non-fungible-token transfer: sender, recipient, asset, value. */
|
|
1633
1687
|
type NftTransfer = {
|
|
1634
1688
|
cursor: string;
|
|
1635
1689
|
block_height: number;
|
|
@@ -1644,6 +1698,7 @@ type NftTransfer = {
|
|
|
1644
1698
|
recipient: string;
|
|
1645
1699
|
value: string;
|
|
1646
1700
|
};
|
|
1701
|
+
/** One page of non-fungible-token transfers, with the cursor, tip, and reorgs. */
|
|
1647
1702
|
type NftTransfersEnvelope<TRow = NftTransfer> = {
|
|
1648
1703
|
events: TRow[];
|
|
1649
1704
|
next_cursor: string | null;
|
|
@@ -1654,6 +1709,7 @@ type NftTransfersEnvelope<TRow = NftTransfer> = {
|
|
|
1654
1709
|
type NftTransferAlwaysFields = "cursor" | "block_height" | "event_type";
|
|
1655
1710
|
/** An nft-transfer row narrowed to the requested columns plus the always-present ones. */
|
|
1656
1711
|
type NftTransferFields<F extends keyof NftTransfer & string> = Pick<NftTransfer, (F | NftTransferAlwaysFields) & keyof NftTransfer>;
|
|
1712
|
+
/** Column selection, paging, and filters for listing NFT transfers. */
|
|
1657
1713
|
type NftTransfersListParams = {
|
|
1658
1714
|
/** Columns to return (see {@link FtTransfersListParams.fields}). */
|
|
1659
1715
|
fields?: readonly (keyof NftTransfer & string)[];
|
|
@@ -1667,6 +1723,7 @@ type NftTransfersListParams = {
|
|
|
1667
1723
|
fromHeight?: number;
|
|
1668
1724
|
toHeight?: number;
|
|
1669
1725
|
};
|
|
1726
|
+
/** `NftTransfersListParams` without `limit`, plus walk options. */
|
|
1670
1727
|
type NftTransfersWalkParams = Omit<NftTransfersListParams, "limit"> & WalkOptions;
|
|
1671
1728
|
type IndexEventBase = {
|
|
1672
1729
|
cursor: string;
|
|
@@ -1687,6 +1744,7 @@ type IndexEventBase = {
|
|
|
1687
1744
|
tx_contract_id?: string | null;
|
|
1688
1745
|
tx_function_name?: string | null;
|
|
1689
1746
|
};
|
|
1747
|
+
/** A fungible-token transfer event. */
|
|
1690
1748
|
type IndexFtTransfer = IndexEventBase & {
|
|
1691
1749
|
event_type: "ft_transfer";
|
|
1692
1750
|
asset_identifier: string;
|
|
@@ -1694,6 +1752,7 @@ type IndexFtTransfer = IndexEventBase & {
|
|
|
1694
1752
|
recipient: string;
|
|
1695
1753
|
amount: string;
|
|
1696
1754
|
};
|
|
1755
|
+
/** A non-fungible-token transfer event. */
|
|
1697
1756
|
type IndexNftTransfer = IndexEventBase & {
|
|
1698
1757
|
event_type: "nft_transfer";
|
|
1699
1758
|
asset_identifier: string;
|
|
@@ -1701,6 +1760,7 @@ type IndexNftTransfer = IndexEventBase & {
|
|
|
1701
1760
|
recipient: string;
|
|
1702
1761
|
value: string;
|
|
1703
1762
|
};
|
|
1763
|
+
/** An STX transfer event. */
|
|
1704
1764
|
type IndexStxTransfer = IndexEventBase & {
|
|
1705
1765
|
event_type: "stx_transfer";
|
|
1706
1766
|
sender: string;
|
|
@@ -1708,16 +1768,19 @@ type IndexStxTransfer = IndexEventBase & {
|
|
|
1708
1768
|
amount: string;
|
|
1709
1769
|
memo: string | null;
|
|
1710
1770
|
};
|
|
1771
|
+
/** An STX mint event. */
|
|
1711
1772
|
type IndexStxMint = IndexEventBase & {
|
|
1712
1773
|
event_type: "stx_mint";
|
|
1713
1774
|
recipient: string;
|
|
1714
1775
|
amount: string;
|
|
1715
1776
|
};
|
|
1777
|
+
/** An STX burn event. */
|
|
1716
1778
|
type IndexStxBurn = IndexEventBase & {
|
|
1717
1779
|
event_type: "stx_burn";
|
|
1718
1780
|
sender: string;
|
|
1719
1781
|
amount: string;
|
|
1720
1782
|
};
|
|
1783
|
+
/** An STX lock event with its unlock height. */
|
|
1721
1784
|
type IndexStxLock = IndexEventBase & {
|
|
1722
1785
|
event_type: "stx_lock";
|
|
1723
1786
|
sender: string;
|
|
@@ -1726,30 +1789,35 @@ type IndexStxLock = IndexEventBase & {
|
|
|
1726
1789
|
unlock_height: string | null;
|
|
1727
1790
|
};
|
|
1728
1791
|
};
|
|
1792
|
+
/** A fungible-token mint event. */
|
|
1729
1793
|
type IndexFtMint = IndexEventBase & {
|
|
1730
1794
|
event_type: "ft_mint";
|
|
1731
1795
|
asset_identifier: string;
|
|
1732
1796
|
recipient: string;
|
|
1733
1797
|
amount: string;
|
|
1734
1798
|
};
|
|
1799
|
+
/** A fungible-token burn event. */
|
|
1735
1800
|
type IndexFtBurn = IndexEventBase & {
|
|
1736
1801
|
event_type: "ft_burn";
|
|
1737
1802
|
asset_identifier: string;
|
|
1738
1803
|
sender: string;
|
|
1739
1804
|
amount: string;
|
|
1740
1805
|
};
|
|
1806
|
+
/** A non-fungible-token mint event. */
|
|
1741
1807
|
type IndexNftMint = IndexEventBase & {
|
|
1742
1808
|
event_type: "nft_mint";
|
|
1743
1809
|
asset_identifier: string;
|
|
1744
1810
|
recipient: string;
|
|
1745
1811
|
value: string;
|
|
1746
1812
|
};
|
|
1813
|
+
/** A non-fungible-token burn event. */
|
|
1747
1814
|
type IndexNftBurn = IndexEventBase & {
|
|
1748
1815
|
event_type: "nft_burn";
|
|
1749
1816
|
asset_identifier: string;
|
|
1750
1817
|
sender: string;
|
|
1751
1818
|
value: string;
|
|
1752
1819
|
};
|
|
1820
|
+
/** A contract `print` event with its topic and value. */
|
|
1753
1821
|
type IndexPrint = IndexEventBase & {
|
|
1754
1822
|
event_type: "print";
|
|
1755
1823
|
payload: {
|
|
@@ -1758,6 +1826,7 @@ type IndexPrint = IndexEventBase & {
|
|
|
1758
1826
|
raw_value: string | null;
|
|
1759
1827
|
};
|
|
1760
1828
|
};
|
|
1829
|
+
/** A contract call made from inside another contract call. */
|
|
1761
1830
|
type IndexNestedContractCall = IndexEventBase & {
|
|
1762
1831
|
event_type: "nested_contract_call";
|
|
1763
1832
|
sender: string | null;
|
|
@@ -1766,23 +1835,27 @@ type IndexNestedContractCall = IndexEventBase & {
|
|
|
1766
1835
|
function_args: unknown;
|
|
1767
1836
|
raw_result: string | null;
|
|
1768
1837
|
};
|
|
1838
|
+
/** A contract data variable write. */
|
|
1769
1839
|
type IndexVarSet = IndexEventBase & {
|
|
1770
1840
|
event_type: "var_set";
|
|
1771
1841
|
var_name: string;
|
|
1772
1842
|
raw_value: string;
|
|
1773
1843
|
};
|
|
1844
|
+
/** A contract map entry overwrite. */
|
|
1774
1845
|
type IndexMapSet = IndexEventBase & {
|
|
1775
1846
|
event_type: "map_set";
|
|
1776
1847
|
map: string;
|
|
1777
1848
|
raw_key: string;
|
|
1778
1849
|
raw_value: string;
|
|
1779
1850
|
};
|
|
1851
|
+
/** A new contract map entry. */
|
|
1780
1852
|
type IndexMapInsert = IndexEventBase & {
|
|
1781
1853
|
event_type: "map_insert";
|
|
1782
1854
|
map: string;
|
|
1783
1855
|
raw_key: string;
|
|
1784
1856
|
raw_value: string;
|
|
1785
1857
|
};
|
|
1858
|
+
/** A contract map entry deletion. */
|
|
1786
1859
|
type IndexMapDelete = IndexEventBase & {
|
|
1787
1860
|
event_type: "map_delete";
|
|
1788
1861
|
map: string;
|
|
@@ -1799,6 +1872,7 @@ type IndexEventFields<
|
|
|
1799
1872
|
T extends IndexEventType,
|
|
1800
1873
|
F extends keyof IndexEventOf<T> & string
|
|
1801
1874
|
> = Pick<IndexEventOf<T>, (F | IndexAlwaysFields) & keyof IndexEventOf<T>>;
|
|
1875
|
+
/** One page of decoded events, with the cursor, tip, and reorgs. */
|
|
1802
1876
|
type EventsEnvelope<
|
|
1803
1877
|
T extends IndexEventType = IndexEventType,
|
|
1804
1878
|
TRow = IndexEventOf<T>
|
|
@@ -1813,6 +1887,7 @@ type EventsEnvelope<
|
|
|
1813
1887
|
type IndexEventOf<T extends IndexEventType> = Extract<IndexEvent, {
|
|
1814
1888
|
event_type: T;
|
|
1815
1889
|
}>;
|
|
1890
|
+
/** Event type, paging, and filters for listing decoded events. */
|
|
1816
1891
|
type EventsListParams<T extends IndexEventType = IndexEventType> = {
|
|
1817
1892
|
/** Decoded types or VM types (`nested_contract_call`, `map_set`, …). */
|
|
1818
1893
|
eventType: T;
|
|
@@ -1857,11 +1932,13 @@ type EventsListParams<T extends IndexEventType = IndexEventType> = {
|
|
|
1857
1932
|
*/
|
|
1858
1933
|
fields?: readonly (keyof IndexEventOf<T> & string)[];
|
|
1859
1934
|
};
|
|
1935
|
+
/** `EventsListParams` without `limit`, plus walk options. */
|
|
1860
1936
|
type EventsWalkParams<T extends IndexEventType = IndexEventType> = Omit<EventsListParams<T>, "limit"> & WalkOptions;
|
|
1861
1937
|
type EventsConsumeParams<
|
|
1862
1938
|
T extends IndexEventType = IndexEventType,
|
|
1863
1939
|
TTx = never
|
|
1864
1940
|
> = Omit<EventsListParams<T>, "cursor" | "fromCursor" | "limit" | "fields"> & IndexConsumeOptions<IndexEventOf<T>, EventsEnvelope<T>, TTx>;
|
|
1941
|
+
/** A decoded contract call: contract, function, sender, arguments, result. */
|
|
1865
1942
|
type IndexContractCall = {
|
|
1866
1943
|
cursor: string;
|
|
1867
1944
|
block_height: number;
|
|
@@ -1876,12 +1953,14 @@ type IndexContractCall = {
|
|
|
1876
1953
|
result: unknown;
|
|
1877
1954
|
result_hex: string | null;
|
|
1878
1955
|
};
|
|
1956
|
+
/** One page of contract calls, with the cursor, tip, and reorgs. */
|
|
1879
1957
|
type ContractCallsEnvelope = {
|
|
1880
1958
|
contract_calls: IndexContractCall[];
|
|
1881
1959
|
next_cursor: string | null;
|
|
1882
1960
|
tip: IndexTip;
|
|
1883
1961
|
reorgs: IndexReorg[];
|
|
1884
1962
|
};
|
|
1963
|
+
/** Paging and contract filters for listing contract calls. */
|
|
1885
1964
|
type ContractCallsListParams = {
|
|
1886
1965
|
cursor?: string | null;
|
|
1887
1966
|
fromCursor?: string | null;
|
|
@@ -1897,6 +1976,7 @@ type ContractCallsListParams = {
|
|
|
1897
1976
|
* Mutually exclusive with contractId. */
|
|
1898
1977
|
trait?: string;
|
|
1899
1978
|
};
|
|
1979
|
+
/** `ContractCallsListParams` without `limit`, plus walk options. */
|
|
1900
1980
|
type ContractCallsWalkParams = Omit<ContractCallsListParams, "limit"> & WalkOptions;
|
|
1901
1981
|
type ContractCallsConsumeParams<TTx = never> = Omit<ContractCallsListParams, "cursor" | "fromCursor" | "limit"> & IndexConsumeOptions<IndexContractCall, ContractCallsEnvelope, TTx>;
|
|
1902
1982
|
/** One canonical block in the sync map. Lean by design — block + parent hash
|
|
@@ -1910,11 +1990,13 @@ type IndexCanonicalBlock = {
|
|
|
1910
1990
|
burn_block_height: number;
|
|
1911
1991
|
burn_block_hash: string | null;
|
|
1912
1992
|
};
|
|
1993
|
+
/** One page of canonical blocks, with the next cursor and chain tip. */
|
|
1913
1994
|
type CanonicalEnvelope = {
|
|
1914
1995
|
canonical: IndexCanonicalBlock[];
|
|
1915
1996
|
next_cursor: string | null;
|
|
1916
1997
|
tip: IndexTip;
|
|
1917
1998
|
};
|
|
1999
|
+
/** Paging and height filters for listing canonical blocks. */
|
|
1918
2000
|
type CanonicalListParams = {
|
|
1919
2001
|
cursor?: string | null;
|
|
1920
2002
|
fromCursor?: string | null;
|
|
@@ -1922,6 +2004,7 @@ type CanonicalListParams = {
|
|
|
1922
2004
|
fromHeight?: number;
|
|
1923
2005
|
toHeight?: number;
|
|
1924
2006
|
};
|
|
2007
|
+
/** `CanonicalListParams` without `limit`, plus walk options. */
|
|
1925
2008
|
type CanonicalWalkParams = Omit<CanonicalListParams, "limit"> & WalkOptions;
|
|
1926
2009
|
/** One MARF write a block committed, in the node's write order. Present only
|
|
1927
2010
|
* from the height the instance's node subscribed to `state_writes`. */
|
|
@@ -1946,12 +2029,14 @@ type IndexStateWrite = {
|
|
|
1946
2029
|
tx_contract_id?: string | null;
|
|
1947
2030
|
tx_function_name?: string | null;
|
|
1948
2031
|
};
|
|
2032
|
+
/** One page of contract state writes, with the cursor, tip, and reorgs. */
|
|
1949
2033
|
type StateWritesEnvelope = {
|
|
1950
2034
|
state_writes: IndexStateWrite[];
|
|
1951
2035
|
next_cursor: string | null;
|
|
1952
2036
|
tip: IndexTip;
|
|
1953
2037
|
reorgs: IndexReorg[];
|
|
1954
2038
|
};
|
|
2039
|
+
/** Paging and filters for listing contract state writes. */
|
|
1955
2040
|
type StateWritesListParams = {
|
|
1956
2041
|
cursor?: string | null;
|
|
1957
2042
|
fromCursor?: string | null;
|
|
@@ -1965,6 +2050,7 @@ type StateWritesListParams = {
|
|
|
1965
2050
|
/** Join the writing transaction's `tx_*` fields onto each row. */
|
|
1966
2051
|
txContext?: boolean;
|
|
1967
2052
|
};
|
|
2053
|
+
/** `StateWritesListParams` without `limit`, plus walk options. */
|
|
1968
2054
|
type StateWritesWalkParams = Omit<StateWritesListParams, "limit"> & WalkOptions;
|
|
1969
2055
|
/** A block resource. Metadata is intentionally thin — only chain-linkage and
|
|
1970
2056
|
* burn-anchor fields are persisted (no miner / tx_count / signer). */
|
|
@@ -1978,15 +2064,18 @@ type IndexBlock = {
|
|
|
1978
2064
|
block_time: string | null;
|
|
1979
2065
|
canonical: boolean;
|
|
1980
2066
|
};
|
|
2067
|
+
/** One page of blocks, with the next cursor and chain tip. */
|
|
1981
2068
|
type BlocksEnvelope = {
|
|
1982
2069
|
blocks: IndexBlock[];
|
|
1983
2070
|
next_cursor: string | null;
|
|
1984
2071
|
tip: IndexTip;
|
|
1985
2072
|
};
|
|
2073
|
+
/** One block and the chain tip. */
|
|
1986
2074
|
type BlockEnvelope = {
|
|
1987
2075
|
block: IndexBlock;
|
|
1988
2076
|
tip: IndexTip;
|
|
1989
2077
|
};
|
|
2078
|
+
/** Paging and height filters for listing blocks. */
|
|
1990
2079
|
type BlocksListParams = {
|
|
1991
2080
|
cursor?: string | null;
|
|
1992
2081
|
fromCursor?: string | null;
|
|
@@ -1994,6 +2083,7 @@ type BlocksListParams = {
|
|
|
1994
2083
|
fromHeight?: number;
|
|
1995
2084
|
toHeight?: number;
|
|
1996
2085
|
};
|
|
2086
|
+
/** `BlocksListParams` without `limit`, plus walk options. */
|
|
1997
2087
|
type BlocksWalkParams = Omit<BlocksListParams, "limit"> & WalkOptions;
|
|
1998
2088
|
type IndexPostCondition = {
|
|
1999
2089
|
type: "stx";
|
|
@@ -2070,12 +2160,14 @@ type IndexTransaction = {
|
|
|
2070
2160
|
cause: number;
|
|
2071
2161
|
};
|
|
2072
2162
|
};
|
|
2163
|
+
/** One page of transactions, with the cursor, tip, and reorgs. */
|
|
2073
2164
|
type TransactionsEnvelope<TRow = IndexTransaction> = {
|
|
2074
2165
|
transactions: TRow[];
|
|
2075
2166
|
next_cursor: string | null;
|
|
2076
2167
|
tip: IndexTip;
|
|
2077
2168
|
reorgs: IndexReorg[];
|
|
2078
2169
|
};
|
|
2170
|
+
/** One transaction and the chain tip. */
|
|
2079
2171
|
type TransactionEnvelope = {
|
|
2080
2172
|
transaction: IndexTransaction;
|
|
2081
2173
|
tip: IndexTip;
|
|
@@ -2084,6 +2176,7 @@ type TransactionEnvelope = {
|
|
|
2084
2176
|
type TransactionAlwaysFields = "cursor" | "block_height" | "tx_id";
|
|
2085
2177
|
/** A Transaction row narrowed to the requested columns plus the always-present ones. */
|
|
2086
2178
|
type TransactionFields<F extends keyof IndexTransaction & string> = Pick<IndexTransaction, (F | TransactionAlwaysFields) & keyof IndexTransaction>;
|
|
2179
|
+
/** Column selection, paging, and filters for listing transactions. */
|
|
2087
2180
|
type TransactionsListParams = {
|
|
2088
2181
|
/**
|
|
2089
2182
|
* Columns to return. The server projects the row, so an unrequested column
|
|
@@ -2100,6 +2193,7 @@ type TransactionsListParams = {
|
|
|
2100
2193
|
fromHeight?: number;
|
|
2101
2194
|
toHeight?: number;
|
|
2102
2195
|
};
|
|
2196
|
+
/** `TransactionsListParams` without `limit`, plus walk options. */
|
|
2103
2197
|
type TransactionsWalkParams = Omit<TransactionsListParams, "limit"> & WalkOptions;
|
|
2104
2198
|
/** A decoded PoX-4 stacking action (one per stacking contract call). */
|
|
2105
2199
|
type IndexStackingAction = {
|
|
@@ -2126,6 +2220,7 @@ type IndexStackingAction = {
|
|
|
2126
2220
|
signer_key: string | null;
|
|
2127
2221
|
result_ok: boolean;
|
|
2128
2222
|
};
|
|
2223
|
+
/** One page of stacking actions, with the cursor, tip, and reorgs. */
|
|
2129
2224
|
type StackingEnvelope = {
|
|
2130
2225
|
stacking: IndexStackingAction[];
|
|
2131
2226
|
next_cursor: string | null;
|
|
@@ -2134,6 +2229,7 @@ type StackingEnvelope = {
|
|
|
2134
2229
|
/** Present only when the PoX-4 decoder is disabled, explaining an empty feed. */
|
|
2135
2230
|
notes?: string;
|
|
2136
2231
|
};
|
|
2232
|
+
/** Paging and filters for listing stacking actions. */
|
|
2137
2233
|
type StackingListParams = {
|
|
2138
2234
|
cursor?: string | null;
|
|
2139
2235
|
fromCursor?: string | null;
|
|
@@ -2144,6 +2240,7 @@ type StackingListParams = {
|
|
|
2144
2240
|
fromHeight?: number;
|
|
2145
2241
|
toHeight?: number;
|
|
2146
2242
|
};
|
|
2243
|
+
/** `StackingListParams` without `limit`, plus walk options. */
|
|
2147
2244
|
type StackingWalkParams = Omit<StackingListParams, "limit"> & WalkOptions;
|
|
2148
2245
|
/** A pending (unconfirmed) transaction. Like a transaction document but
|
|
2149
2246
|
* pre-chain — no block_height/tx_index/result/events — with `received_at` and
|
|
@@ -2180,15 +2277,18 @@ type IndexMempoolTransaction = {
|
|
|
2180
2277
|
cause: number;
|
|
2181
2278
|
};
|
|
2182
2279
|
};
|
|
2280
|
+
/** One page of pending transactions, with the next cursor and chain tip. */
|
|
2183
2281
|
type MempoolEnvelope = {
|
|
2184
2282
|
mempool: IndexMempoolTransaction[];
|
|
2185
2283
|
next_cursor: string | null;
|
|
2186
2284
|
tip: IndexTip;
|
|
2187
2285
|
};
|
|
2286
|
+
/** One pending transaction and the chain tip. */
|
|
2188
2287
|
type MempoolTransactionEnvelope = {
|
|
2189
2288
|
transaction: IndexMempoolTransaction;
|
|
2190
2289
|
tip: IndexTip;
|
|
2191
2290
|
};
|
|
2291
|
+
/** Paging and sender filters for listing pending transactions. */
|
|
2192
2292
|
type MempoolListParams = {
|
|
2193
2293
|
cursor?: string | null;
|
|
2194
2294
|
fromCursor?: string | null;
|
|
@@ -2200,11 +2300,13 @@ type MempoolListParams = {
|
|
|
2200
2300
|
/** Filter to pending calls to a single function (composes with `contractId`). */
|
|
2201
2301
|
functionName?: string;
|
|
2202
2302
|
};
|
|
2303
|
+
/** `MempoolListParams` without `limit`, plus walk options. */
|
|
2203
2304
|
type MempoolWalkParams = Omit<MempoolListParams, "limit"> & WalkOptions;
|
|
2204
2305
|
/**
|
|
2205
|
-
*
|
|
2206
|
-
*
|
|
2207
|
-
*
|
|
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.
|
|
2208
2310
|
*/
|
|
2209
2311
|
type PrintSchemaResponse = {
|
|
2210
2312
|
contract_id: string;
|
|
@@ -2241,8 +2343,12 @@ type IndexSbtcDeposit = {
|
|
|
2241
2343
|
type IndexSbtcDepositDetail = IndexSbtcDeposit & {
|
|
2242
2344
|
status: "COMPLETED";
|
|
2243
2345
|
};
|
|
2244
|
-
/**
|
|
2245
|
-
*
|
|
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
|
+
*/
|
|
2246
2352
|
type IndexSbtcWithdrawal = {
|
|
2247
2353
|
cursor: string;
|
|
2248
2354
|
request_id: number;
|
|
@@ -2296,8 +2402,11 @@ type IndexSbtcWithdrawalDetail = {
|
|
|
2296
2402
|
};
|
|
2297
2403
|
finalized: boolean;
|
|
2298
2404
|
};
|
|
2299
|
-
/**
|
|
2300
|
-
*
|
|
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
|
+
*/
|
|
2301
2410
|
type IndexSbtcEvent = {
|
|
2302
2411
|
cursor: string;
|
|
2303
2412
|
block_height: number;
|
|
@@ -2336,6 +2445,7 @@ type IndexSbtcSummary = {
|
|
|
2336
2445
|
total_locked_sats: string;
|
|
2337
2446
|
sbtc_supply_sats: string | null;
|
|
2338
2447
|
};
|
|
2448
|
+
/** One page of sBTC deposits, with the cursor, tip, and reorgs. */
|
|
2339
2449
|
type SbtcDepositsEnvelope<TRow = IndexSbtcDeposit> = {
|
|
2340
2450
|
deposits: TRow[];
|
|
2341
2451
|
next_cursor: string | null;
|
|
@@ -2344,10 +2454,12 @@ type SbtcDepositsEnvelope<TRow = IndexSbtcDeposit> = {
|
|
|
2344
2454
|
/** Present only when the sBTC decoder is disabled, explaining an empty feed. */
|
|
2345
2455
|
notes?: string;
|
|
2346
2456
|
};
|
|
2457
|
+
/** One sBTC deposit and the chain tip. */
|
|
2347
2458
|
type SbtcDepositEnvelope = {
|
|
2348
2459
|
deposit: IndexSbtcDepositDetail;
|
|
2349
2460
|
tip: IndexTip;
|
|
2350
2461
|
};
|
|
2462
|
+
/** One page of sBTC withdrawals, with the cursor, tip, and reorgs. */
|
|
2351
2463
|
type SbtcWithdrawalsEnvelope<TRow = IndexSbtcWithdrawal> = {
|
|
2352
2464
|
withdrawals: TRow[];
|
|
2353
2465
|
next_cursor: string | null;
|
|
@@ -2355,10 +2467,12 @@ type SbtcWithdrawalsEnvelope<TRow = IndexSbtcWithdrawal> = {
|
|
|
2355
2467
|
reorgs: IndexReorg[];
|
|
2356
2468
|
notes?: string;
|
|
2357
2469
|
};
|
|
2470
|
+
/** One sBTC withdrawal and the chain tip. */
|
|
2358
2471
|
type SbtcWithdrawalEnvelope = {
|
|
2359
2472
|
withdrawal: IndexSbtcWithdrawalDetail;
|
|
2360
2473
|
tip: IndexTip;
|
|
2361
2474
|
};
|
|
2475
|
+
/** One page of sBTC events, with the cursor, tip, and reorgs. */
|
|
2362
2476
|
type SbtcEventsEnvelope = {
|
|
2363
2477
|
events: IndexSbtcEvent[];
|
|
2364
2478
|
next_cursor: string | null;
|
|
@@ -2366,11 +2480,13 @@ type SbtcEventsEnvelope = {
|
|
|
2366
2480
|
reorgs: IndexReorg[];
|
|
2367
2481
|
notes?: string;
|
|
2368
2482
|
};
|
|
2483
|
+
/** The sBTC totals and the chain tip. */
|
|
2369
2484
|
type SbtcSummaryEnvelope = {
|
|
2370
2485
|
summary: IndexSbtcSummary;
|
|
2371
2486
|
tip: IndexTip;
|
|
2372
2487
|
notes?: string;
|
|
2373
2488
|
};
|
|
2489
|
+
/** Column selection, paging, and filters for listing sBTC deposits. */
|
|
2374
2490
|
type SbtcDepositsListParams = {
|
|
2375
2491
|
cursor?: string | null;
|
|
2376
2492
|
fromCursor?: string | null;
|
|
@@ -2392,11 +2508,13 @@ type SbtcDepositsListParams = {
|
|
|
2392
2508
|
type SbtcDepositAlwaysFields = "cursor" | "block_height";
|
|
2393
2509
|
/** A deposit row narrowed to the requested columns plus the always-present ones. */
|
|
2394
2510
|
type SbtcDepositFields<F extends keyof IndexSbtcDeposit & string> = Pick<IndexSbtcDeposit, (F | SbtcDepositAlwaysFields) & keyof IndexSbtcDeposit>;
|
|
2511
|
+
/** `SbtcDepositsListParams` without `limit`, plus walk options. */
|
|
2395
2512
|
type SbtcDepositsWalkParams = Omit<SbtcDepositsListParams, "limit"> & WalkOptions;
|
|
2396
2513
|
/** SbtcWithdrawal columns that survive any projection. */
|
|
2397
2514
|
type SbtcWithdrawalAlwaysFields = "cursor" | "request_id";
|
|
2398
2515
|
/** A SbtcWithdrawal row narrowed to the requested columns plus the always-present ones. */
|
|
2399
2516
|
type SbtcWithdrawalFields<F extends keyof IndexSbtcWithdrawal & string> = Pick<IndexSbtcWithdrawal, (F | SbtcWithdrawalAlwaysFields) & keyof IndexSbtcWithdrawal>;
|
|
2517
|
+
/** Column selection, paging, and filters for listing sBTC withdrawals. */
|
|
2400
2518
|
type SbtcWithdrawalsListParams = {
|
|
2401
2519
|
/**
|
|
2402
2520
|
* Columns to return. The server projects the row, so an unrequested column
|
|
@@ -2417,7 +2535,9 @@ type SbtcWithdrawalsListParams = {
|
|
|
2417
2535
|
fromHeight?: number;
|
|
2418
2536
|
toHeight?: number;
|
|
2419
2537
|
};
|
|
2538
|
+
/** `SbtcWithdrawalsListParams` without `limit`, plus walk options. */
|
|
2420
2539
|
type SbtcWithdrawalsWalkParams = Omit<SbtcWithdrawalsListParams, "limit"> & WalkOptions;
|
|
2540
|
+
/** Paging and filters for listing sBTC events. */
|
|
2421
2541
|
type SbtcEventsListParams = {
|
|
2422
2542
|
cursor?: string | null;
|
|
2423
2543
|
fromCursor?: string | null;
|
|
@@ -2430,6 +2550,7 @@ type SbtcEventsListParams = {
|
|
|
2430
2550
|
fromHeight?: number;
|
|
2431
2551
|
toHeight?: number;
|
|
2432
2552
|
};
|
|
2553
|
+
/** `SbtcEventsListParams` without `limit`, plus walk options. */
|
|
2433
2554
|
type SbtcEventsWalkParams = Omit<SbtcEventsListParams, "limit"> & WalkOptions;
|
|
2434
2555
|
type SbtcEventsConsumeParams<TTx = never> = Omit<SbtcEventsListParams, "cursor" | "fromCursor" | "limit"> & IndexConsumeOptions<IndexSbtcEvent, SbtcEventsEnvelope, TTx>;
|
|
2435
2556
|
type SbtcDepositsConsumeParams<TTx = never> = Omit<SbtcDepositsListParams, "cursor" | "fromCursor" | "limit" | "fields"> & IndexConsumeOptions<IndexSbtcDeposit, SbtcDepositsEnvelope, TTx>;
|
|
@@ -2575,6 +2696,7 @@ type IndexPoxCycleSigner = {
|
|
|
2575
2696
|
in_set: boolean;
|
|
2576
2697
|
rewards_claimed: string;
|
|
2577
2698
|
};
|
|
2699
|
+
/** One page of reward cycles, newest first, with the next cursor. */
|
|
2578
2700
|
type PoxCyclesEnvelope = {
|
|
2579
2701
|
/** The PoX version this response reports. Currently 5. */
|
|
2580
2702
|
pox_version: 5;
|
|
@@ -2583,6 +2705,7 @@ type PoxCyclesEnvelope = {
|
|
|
2583
2705
|
next_cursor: number | null;
|
|
2584
2706
|
tip: IndexTip;
|
|
2585
2707
|
};
|
|
2708
|
+
/** One reward cycle with its signers and the chain tip. */
|
|
2586
2709
|
type PoxCycleEnvelope = {
|
|
2587
2710
|
pox_version: 5;
|
|
2588
2711
|
cycle: IndexPoxCycle & {
|
|
@@ -2590,11 +2713,13 @@ type PoxCycleEnvelope = {
|
|
|
2590
2713
|
};
|
|
2591
2714
|
tip: IndexTip;
|
|
2592
2715
|
};
|
|
2716
|
+
/** Paging for listing reward cycles. */
|
|
2593
2717
|
type PoxCyclesListParams = {
|
|
2594
2718
|
/** A `reward_cycle` to page from; the page returns cycles below it (descending). */
|
|
2595
2719
|
cursor?: number | null;
|
|
2596
2720
|
limit?: number;
|
|
2597
2721
|
};
|
|
2722
|
+
/** `PoxCyclesListParams` without `limit`, plus walk options. */
|
|
2598
2723
|
type PoxCyclesWalkParams = Omit<PoxCyclesListParams, "limit"> & WalkOptions;
|
|
2599
2724
|
/** `index.pox` — reward cycles of the current PoX (PoX-5). */
|
|
2600
2725
|
interface PoxResource {
|
|
@@ -2652,6 +2777,7 @@ type IndexPox5Event = {
|
|
|
2652
2777
|
/** The full decoded print tuple as JSON. */
|
|
2653
2778
|
data: unknown;
|
|
2654
2779
|
};
|
|
2780
|
+
/** One page of PoX-5 events, with the cursor, tip, and reorgs. */
|
|
2655
2781
|
type Pox5EventsEnvelope<TRow = IndexPox5Event> = {
|
|
2656
2782
|
events: TRow[];
|
|
2657
2783
|
next_cursor: string | null;
|
|
@@ -2664,6 +2790,7 @@ type Pox5EventsEnvelope<TRow = IndexPox5Event> = {
|
|
|
2664
2790
|
type Pox5EventAlwaysFields = "cursor" | "block_height" | "topic";
|
|
2665
2791
|
/** A Pox5Event row narrowed to the requested columns plus the always-present ones. */
|
|
2666
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. */
|
|
2667
2794
|
type Pox5EventsListParams = {
|
|
2668
2795
|
/**
|
|
2669
2796
|
* Columns to return. The server projects the row, so an unrequested column
|
|
@@ -2685,6 +2812,7 @@ type Pox5EventsListParams = {
|
|
|
2685
2812
|
fromHeight?: number;
|
|
2686
2813
|
toHeight?: number;
|
|
2687
2814
|
};
|
|
2815
|
+
/** `Pox5EventsListParams` without `limit`, plus walk options. */
|
|
2688
2816
|
type Pox5EventsWalkParams = Omit<Pox5EventsListParams, "limit"> & WalkOptions;
|
|
2689
2817
|
type Pox5EventsConsumeParams<TTx = never> = Omit<Pox5EventsListParams, "cursor" | "fromCursor" | "limit"> & IndexConsumeOptions<IndexPox5Event, Pox5EventsEnvelope, TTx>;
|
|
2690
2818
|
/** `index.pox5` — decoded PoX-5 print events, the staking primitive from the
|
|
@@ -2724,11 +2852,13 @@ interface Pox5Resource {
|
|
|
2724
2852
|
/** A rune's `<block>:<tx>` id — the etch transaction's position, e.g. `840000:3`. */
|
|
2725
2853
|
type RuneId = `${number}:${number}`;
|
|
2726
2854
|
/**
|
|
2727
|
-
* A rune
|
|
2728
|
-
*
|
|
2729
|
-
* `dog.go.to.the.moon` and `doggotothemoon` all resolve
|
|
2730
|
-
*
|
|
2731
|
-
*
|
|
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.
|
|
2732
2862
|
*/
|
|
2733
2863
|
type RuneRef = RuneId | (string & {});
|
|
2734
2864
|
/** The Bitcoin chain tip a Runes read was served against — a separate clock
|
|
@@ -2773,8 +2903,11 @@ type IndexRuneTerms = {
|
|
|
2773
2903
|
offset_start: string | null;
|
|
2774
2904
|
offset_end: string | null;
|
|
2775
2905
|
};
|
|
2776
|
-
/**
|
|
2777
|
-
*
|
|
2906
|
+
/**
|
|
2907
|
+
* One etched rune: identity, counters, supply, and mint terms.
|
|
2908
|
+
*
|
|
2909
|
+
* Counters cover premine, mint, and burn; supply is computed.
|
|
2910
|
+
*/
|
|
2778
2911
|
type IndexRuneEntry = IndexRuneRefSummary & {
|
|
2779
2912
|
/** Etch sequence number (u128 decimal string) — 0 is genesis. */
|
|
2780
2913
|
number: string;
|
|
@@ -2791,6 +2924,7 @@ type IndexRuneEntry = IndexRuneRefSummary & {
|
|
|
2791
2924
|
etched_tx_index: number;
|
|
2792
2925
|
terms: IndexRuneTerms | null;
|
|
2793
2926
|
};
|
|
2927
|
+
/** One page of runes, with the cursor and Bitcoin tip. */
|
|
2794
2928
|
type RunesEnvelope<TRow = IndexRuneEntry> = {
|
|
2795
2929
|
runes: TRow[];
|
|
2796
2930
|
next_cursor: string | null;
|
|
@@ -2801,6 +2935,7 @@ type RunesEnvelope<TRow = IndexRuneEntry> = {
|
|
|
2801
2935
|
/** Present only when Runes data is not configured on this instance. */
|
|
2802
2936
|
notes?: string;
|
|
2803
2937
|
};
|
|
2938
|
+
/** Name search, sort order, and paging for listing runes. */
|
|
2804
2939
|
type RunesListParams = {
|
|
2805
2940
|
/** Name prefix, spacers and case ignored (`dog` matches `DOG•GO•TO•THE•MOON`). */
|
|
2806
2941
|
search?: string;
|
|
@@ -2809,13 +2944,17 @@ type RunesListParams = {
|
|
|
2809
2944
|
cursor?: string | null;
|
|
2810
2945
|
limit?: number;
|
|
2811
2946
|
};
|
|
2947
|
+
/** One rune and the Bitcoin tip. */
|
|
2812
2948
|
type RuneEnvelope = {
|
|
2813
2949
|
rune: IndexRuneEntry;
|
|
2814
2950
|
tip: IndexBitcoinTip;
|
|
2815
2951
|
};
|
|
2816
2952
|
type IndexRuneEventKind = "rune_etch" | "rune_mint" | "rune_transfer" | "rune_burn";
|
|
2817
|
-
/**
|
|
2818
|
-
*
|
|
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
|
+
*/
|
|
2819
2958
|
type IndexRuneEvent = {
|
|
2820
2959
|
cursor: string;
|
|
2821
2960
|
block_height: number;
|
|
@@ -2830,6 +2969,7 @@ type IndexRuneEvent = {
|
|
|
2830
2969
|
address: string | null;
|
|
2831
2970
|
rune: IndexRuneRefSummary;
|
|
2832
2971
|
};
|
|
2972
|
+
/** One page of rune events, with the cursor, Bitcoin tip, and reorgs. */
|
|
2833
2973
|
type RuneActivityEnvelope<TRow = IndexRuneEvent> = {
|
|
2834
2974
|
events: TRow[];
|
|
2835
2975
|
next_cursor: string | null;
|
|
@@ -2837,6 +2977,7 @@ type RuneActivityEnvelope<TRow = IndexRuneEvent> = {
|
|
|
2837
2977
|
reorgs: IndexBtcReorg[];
|
|
2838
2978
|
notes?: string;
|
|
2839
2979
|
};
|
|
2980
|
+
/** Paging and height filters for listing rune events. */
|
|
2840
2981
|
type RuneActivityListParams = {
|
|
2841
2982
|
cursor?: string | null;
|
|
2842
2983
|
fromCursor?: string | null;
|
|
@@ -2848,6 +2989,7 @@ type RuneActivityListParams = {
|
|
|
2848
2989
|
kind?: readonly IndexRuneEventKind[];
|
|
2849
2990
|
txid?: string;
|
|
2850
2991
|
};
|
|
2992
|
+
/** `RuneActivityListParams` without `limit`, plus walk options. */
|
|
2851
2993
|
type RuneActivityWalkParams = Omit<RuneActivityListParams, "limit"> & WalkOptions;
|
|
2852
2994
|
/** A rune's balance on one unspent output, with the rune's identity embedded. */
|
|
2853
2995
|
type IndexRuneBalance = {
|
|
@@ -2859,6 +3001,7 @@ type IndexRuneBalance = {
|
|
|
2859
3001
|
/** u128 decimal string. Never `Number()`. */
|
|
2860
3002
|
amount: string;
|
|
2861
3003
|
};
|
|
3004
|
+
/** One page of rune balances, with the cursor and Bitcoin tip. */
|
|
2862
3005
|
type RuneBalancesEnvelope<TRow = IndexRuneBalance> = {
|
|
2863
3006
|
balances: TRow[];
|
|
2864
3007
|
next_cursor: string | null;
|
|
@@ -2867,8 +3010,11 @@ type RuneBalancesEnvelope<TRow = IndexRuneBalance> = {
|
|
|
2867
3010
|
reorgs: IndexBtcReorg[];
|
|
2868
3011
|
notes?: string;
|
|
2869
3012
|
};
|
|
2870
|
-
/**
|
|
2871
|
-
*
|
|
3013
|
+
/**
|
|
3014
|
+
* Rune balance filters; exactly one of `address` or `outpoint`.
|
|
3015
|
+
*
|
|
3016
|
+
* Enforced at the type level, not just at runtime.
|
|
3017
|
+
*/
|
|
2872
3018
|
type RuneBalancesListParams = ({
|
|
2873
3019
|
address: string;
|
|
2874
3020
|
outpoint?: never;
|
|
@@ -3032,9 +3178,12 @@ type IndexEventTypeFilters = {
|
|
|
3032
3178
|
equality_filters?: string[];
|
|
3033
3179
|
required_non_null?: string[];
|
|
3034
3180
|
};
|
|
3035
|
-
/**
|
|
3036
|
-
*
|
|
3037
|
-
*
|
|
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
|
+
*/
|
|
3038
3187
|
type IndexDiscovery = {
|
|
3039
3188
|
event_type_filters?: Record<string, IndexEventTypeFilters>;
|
|
3040
3189
|
[key: string]: unknown;
|
|
@@ -3287,6 +3436,7 @@ import { ReindexResponse, SubgraphAggregateParams, SubgraphAggregateResponse, Su
|
|
|
3287
3436
|
import { DeploySubgraphRequest, DeploySubgraphResponse } from "@secondlayer/shared/schemas/subgraphs";
|
|
3288
3437
|
import { SubgraphAgentSchema, SubgraphSpecOptions } from "@secondlayer/shared/subgraphs/spec";
|
|
3289
3438
|
import { InferSubgraphClient } from "@secondlayer/subgraphs";
|
|
3439
|
+
/** A deployed subgraph's source code, handler bundle, and pin. */
|
|
3290
3440
|
interface SubgraphSource {
|
|
3291
3441
|
name: string;
|
|
3292
3442
|
version: string;
|
|
@@ -3330,6 +3480,7 @@ interface SubgraphRowsEnvelope<T = unknown> {
|
|
|
3330
3480
|
blocks_behind: number;
|
|
3331
3481
|
};
|
|
3332
3482
|
}
|
|
3483
|
+
/** A deployed subgraph's bundled sources, schema, and handler code. */
|
|
3333
3484
|
interface BundleSubgraphResponse {
|
|
3334
3485
|
ok: true;
|
|
3335
3486
|
name: string;
|
|
@@ -3624,10 +3775,11 @@ interface ContextField<T> {
|
|
|
3624
3775
|
error?: ContextFieldError;
|
|
3625
3776
|
}
|
|
3626
3777
|
/**
|
|
3627
|
-
* A point-in-time orientation snapshot
|
|
3628
|
-
*
|
|
3629
|
-
*
|
|
3630
|
-
* 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.
|
|
3631
3783
|
*/
|
|
3632
3784
|
interface ContextSnapshot {
|
|
3633
3785
|
/** Token identity from `/api/accounts/me`. A self-hosted instance has no
|