@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
|
@@ -90,6 +90,7 @@ declare abstract class BaseClient {
|
|
|
90
90
|
* subclasses that stream a body call this directly and read it themselves. */
|
|
91
91
|
protected fetchResponse(method: string, path: string, body?: unknown, signal?: AbortSignal, extraHeaders?: Record<string, string>): Promise<Response>;
|
|
92
92
|
}
|
|
93
|
+
/** A deployed subgraph's source code, handler bundle, and pin. */
|
|
93
94
|
interface SubgraphSource {
|
|
94
95
|
name: string;
|
|
95
96
|
version: string;
|
|
@@ -133,6 +134,7 @@ interface SubgraphRowsEnvelope<T = unknown> {
|
|
|
133
134
|
blocks_behind: number;
|
|
134
135
|
};
|
|
135
136
|
}
|
|
137
|
+
/** A deployed subgraph's bundled sources, schema, and handler code. */
|
|
136
138
|
interface BundleSubgraphResponse {
|
|
137
139
|
ok: true;
|
|
138
140
|
name: string;
|
|
@@ -318,6 +320,7 @@ type InstanceClient = {
|
|
|
318
320
|
*/
|
|
319
321
|
diagnose(): Promise<InstanceDiagnosis>;
|
|
320
322
|
};
|
|
323
|
+
/** What to verify against, and the optional block range. */
|
|
321
324
|
type ArchiveVerifyInput = {
|
|
322
325
|
against: string;
|
|
323
326
|
target?: string;
|
|
@@ -327,6 +330,7 @@ type ArchiveVerifyInput = {
|
|
|
327
330
|
publicKeyPem?: string;
|
|
328
331
|
};
|
|
329
332
|
type ArchiveVerifyRangeStatus = "match" | "digest-mismatch" | "count-mismatch" | "missing";
|
|
333
|
+
/** Whether the archive is clean, diverged, or unanchored, by range. */
|
|
330
334
|
type ArchiveVerifyResult = {
|
|
331
335
|
status: "clean" | "diverged" | "unanchored";
|
|
332
336
|
target: string;
|
|
@@ -351,8 +355,11 @@ type ArchiveVerifyResult = {
|
|
|
351
355
|
};
|
|
352
356
|
import { RangeDigest } from "@secondlayer/shared/archive/range-digest";
|
|
353
357
|
import { ArchiveStatus } from "@secondlayer/shared/archive/status";
|
|
358
|
+
/** The three archive datasets: blocks, transactions, and events. */
|
|
354
359
|
type ArchiveDataset = "blocks" | "transactions" | "events";
|
|
360
|
+
/** Whether an archive purchase is a bootstrap or a repair. */
|
|
355
361
|
type ArchiveFlow = "bootstrap" | "repair";
|
|
362
|
+
/** One archive file: dataset, block range, path, rows, bytes. */
|
|
356
363
|
type ArchivePartition = {
|
|
357
364
|
dataset: string;
|
|
358
365
|
from_block: number;
|
|
@@ -375,6 +382,7 @@ type ArchiveManifest = {
|
|
|
375
382
|
key_id?: string;
|
|
376
383
|
[key: string]: unknown;
|
|
377
384
|
};
|
|
385
|
+
/** A loaded archive manifest with its origin and signature check. */
|
|
378
386
|
type LoadedArchive = {
|
|
379
387
|
manifest: ArchiveManifest;
|
|
380
388
|
origin: string;
|
|
@@ -385,6 +393,7 @@ type LoadedArchive = {
|
|
|
385
393
|
reason?: string;
|
|
386
394
|
};
|
|
387
395
|
};
|
|
396
|
+
/** The price of an archive request, after any free allowance. */
|
|
388
397
|
type ArchiveQuote = {
|
|
389
398
|
partitions: number;
|
|
390
399
|
bundles: number;
|
|
@@ -401,11 +410,13 @@ type ArchiveFetchItem = {
|
|
|
401
410
|
expiresAt: string;
|
|
402
411
|
chargedUsdMicros: number;
|
|
403
412
|
};
|
|
413
|
+
/** Download links for archive partitions and what they cost. */
|
|
404
414
|
type ArchiveFetchResult = {
|
|
405
415
|
urls: ArchiveFetchItem[];
|
|
406
416
|
chargedTotalUsdMicros: number;
|
|
407
417
|
balanceAfterUsdMicros: number;
|
|
408
418
|
};
|
|
419
|
+
/** Your archive credit balance and its refill settings. */
|
|
409
420
|
type ArchiveCreditsBalance = {
|
|
410
421
|
creditsUsdMicros: string;
|
|
411
422
|
refill: {
|
|
@@ -414,6 +425,7 @@ type ArchiveCreditsBalance = {
|
|
|
414
425
|
lastAt: string | null;
|
|
415
426
|
};
|
|
416
427
|
};
|
|
428
|
+
/** Options for loading an archive manifest. */
|
|
417
429
|
type ArchiveLoadOptions = {
|
|
418
430
|
insecure?: boolean;
|
|
419
431
|
};
|
|
@@ -525,6 +537,7 @@ type SecondLayerArchive = ArchiveClient & {
|
|
|
525
537
|
*/
|
|
526
538
|
/** Whether a trait match must be declared in source, inferred from ABI, or either. */
|
|
527
539
|
type ContractConformance = "declared" | "inferred" | "any";
|
|
540
|
+
/** Trait, conformance, and paging for listing contracts. */
|
|
528
541
|
interface ContractsListParams {
|
|
529
542
|
/** Required. Trait identifier to match (e.g. "sip-010", or a fully-qualified trait). */
|
|
530
543
|
trait: string;
|
|
@@ -537,6 +550,7 @@ interface ContractsListParams {
|
|
|
537
550
|
/** Opaque cursor from a prior response's `next_cursor`. */
|
|
538
551
|
cursor?: string;
|
|
539
552
|
}
|
|
553
|
+
/** A deployed contract with its traits, standards, and ABI status. */
|
|
540
554
|
interface ContractSummary {
|
|
541
555
|
contract_id: string;
|
|
542
556
|
deployer: string;
|
|
@@ -547,6 +561,7 @@ interface ContractSummary {
|
|
|
547
561
|
/** Present only when `include: "abi"` was requested. */
|
|
548
562
|
abi?: unknown;
|
|
549
563
|
}
|
|
564
|
+
/** One page of contracts and the cursor for the next page. */
|
|
550
565
|
interface ContractsEnvelope {
|
|
551
566
|
contracts: ContractSummary[];
|
|
552
567
|
next_cursor: string | null;
|
|
@@ -734,6 +749,7 @@ type WithSinkTx<TTx> = [TTx] extends [never] ? unknown : {
|
|
|
734
749
|
};
|
|
735
750
|
import { VmEventType } from "@secondlayer/shared";
|
|
736
751
|
import { RuneEventType, RuneStreamsEvent, StreamsEvent, StreamsEventType, StreamsWireEvent, VmStreamsEvent } from "@secondlayer/shared/streams-rows";
|
|
752
|
+
/** The chain tip: latest block, Bitcoin anchor, and finality boundary. */
|
|
737
753
|
type StreamsTip = {
|
|
738
754
|
block_height: number;
|
|
739
755
|
block_hash: string;
|
|
@@ -753,15 +769,19 @@ type StreamsTip = {
|
|
|
753
769
|
/** Oldest seekable cursor (`<oldest_seekable_height>:0`); `null` = unlimited. */
|
|
754
770
|
oldest_cursor?: string | null;
|
|
755
771
|
};
|
|
756
|
-
/**
|
|
757
|
-
*
|
|
758
|
-
*
|
|
772
|
+
/**
|
|
773
|
+
* The Bitcoin tip, without burn-chain or retention fields.
|
|
774
|
+
*
|
|
775
|
+
* Bitcoin has no burn chain of its own, and Runes reads have no retention
|
|
776
|
+
* ladder. Returned by `tip({ chain: "bitcoin" })`.
|
|
777
|
+
*/
|
|
759
778
|
type StreamsBitcoinTip = {
|
|
760
779
|
block_height: number;
|
|
761
780
|
block_hash: string;
|
|
762
781
|
finalized_height: number;
|
|
763
782
|
lag_seconds: number;
|
|
764
783
|
};
|
|
784
|
+
/** A canonical Stacks block with its Bitcoin anchor. */
|
|
765
785
|
type StreamsCanonicalBlock = {
|
|
766
786
|
block_height: number;
|
|
767
787
|
block_hash: string;
|
|
@@ -769,7 +789,7 @@ type StreamsCanonicalBlock = {
|
|
|
769
789
|
burn_block_hash: string | null;
|
|
770
790
|
is_canonical: true;
|
|
771
791
|
};
|
|
772
|
-
/**
|
|
792
|
+
/** A Bitcoin canonical block, without burn-chain fields. */
|
|
773
793
|
type StreamsBitcoinCanonicalBlock = {
|
|
774
794
|
block_height: number;
|
|
775
795
|
block_hash: string;
|
|
@@ -790,6 +810,7 @@ type StreamsReorg = {
|
|
|
790
810
|
*/
|
|
791
811
|
new_canonical_tip: string;
|
|
792
812
|
};
|
|
813
|
+
/** One page of events with the next cursor, tip, and reorgs. */
|
|
793
814
|
type StreamsEventsEnvelope<
|
|
794
815
|
TEvent = StreamsEvent,
|
|
795
816
|
TTip = StreamsTip
|
|
@@ -799,24 +820,30 @@ type StreamsEventsEnvelope<
|
|
|
799
820
|
tip: TTip;
|
|
800
821
|
reorgs: StreamsReorg[];
|
|
801
822
|
};
|
|
823
|
+
/** One page of events with the tip and reorgs, no cursor. */
|
|
802
824
|
type StreamsEventsListEnvelope<
|
|
803
825
|
TEvent = StreamsEvent,
|
|
804
826
|
TTip = StreamsTip
|
|
805
827
|
> = Omit<StreamsEventsEnvelope<TEvent, TTip>, "next_cursor">;
|
|
806
|
-
/**
|
|
807
|
-
*
|
|
828
|
+
/**
|
|
829
|
+
* The event union narrowed to a `types` selection.
|
|
830
|
+
*
|
|
831
|
+
* A const-generic `types: ["ft_transfer"]` narrows the event type.
|
|
832
|
+
*/
|
|
808
833
|
type StreamsEventOfTypes<T extends readonly StreamsEventType[]> = Extract<StreamsEvent, {
|
|
809
834
|
event_type: T[number];
|
|
810
835
|
}>;
|
|
836
|
+
/** A starting point and limit for listing reorgs. */
|
|
811
837
|
type StreamsReorgsListParams = {
|
|
812
838
|
since: string;
|
|
813
839
|
limit?: number;
|
|
814
840
|
};
|
|
841
|
+
/** A list of reorgs and the cursor to resume from. */
|
|
815
842
|
type StreamsReorgsListEnvelope = {
|
|
816
843
|
reorgs: StreamsReorg[];
|
|
817
844
|
next_since: string | null;
|
|
818
845
|
};
|
|
819
|
-
/** A
|
|
846
|
+
/** A single value or a list of values to match. */
|
|
820
847
|
type StreamsFilterValue = string | readonly string[];
|
|
821
848
|
/**
|
|
822
849
|
* One labelled filter group. Fields inside a group AND together; groups in a
|
|
@@ -846,6 +873,7 @@ type StreamsEventForFilter<
|
|
|
846
873
|
}> : Extract<StreamsEvent, {
|
|
847
874
|
event_type: T;
|
|
848
875
|
}> : D extends true ? IndexEvent : StreamsEvent;
|
|
876
|
+
/** Cursor, height range, and limit shared by every list call. */
|
|
849
877
|
type StreamsEventsListParamsCommon = {
|
|
850
878
|
cursor?: string | null;
|
|
851
879
|
fromHeight?: number;
|
|
@@ -873,12 +901,13 @@ type StreamsEventsStacksListParams = StreamsEventsListParamsCommon & {
|
|
|
873
901
|
filters?: StreamsFilterMap;
|
|
874
902
|
};
|
|
875
903
|
/**
|
|
876
|
-
*
|
|
877
|
-
*
|
|
878
|
-
* `
|
|
879
|
-
*
|
|
880
|
-
*
|
|
881
|
-
*
|
|
904
|
+
* List options for Runes events, with their own cursor space.
|
|
905
|
+
*
|
|
906
|
+
* `types` is restricted to `RuneEventType` at the type level, so e.g. `{ chain:
|
|
907
|
+
* "bitcoin", types: ["ft_transfer"] }` is a compile error rather than a silent
|
|
908
|
+
* 400 at request time. `contractId`, `sender`, `recipient`, `assetIdentifier`,
|
|
909
|
+
* `filters`, and `clock` don't exist on this branch; they're Stacks-only (the
|
|
910
|
+
* server 400s on them too).
|
|
882
911
|
*/
|
|
883
912
|
type StreamsEventsBitcoinListParams = StreamsEventsListParamsCommon & {
|
|
884
913
|
chain: "bitcoin";
|
|
@@ -889,7 +918,9 @@ type StreamsEventsBitcoinListParams = StreamsEventsListParamsCommon & {
|
|
|
889
918
|
/** A mainnet address. */
|
|
890
919
|
address?: string;
|
|
891
920
|
};
|
|
921
|
+
/** Chain, cursor, height range, and filters for listing Streams events. */
|
|
892
922
|
type StreamsEventsListParams = StreamsEventsStacksListParams | StreamsEventsBitcoinListParams;
|
|
923
|
+
/** Cursor, batching, and stop options shared by every event stream. */
|
|
893
924
|
type StreamsEventsStreamCommon = {
|
|
894
925
|
fromCursor?: string | null;
|
|
895
926
|
batchSize?: number;
|
|
@@ -898,8 +929,12 @@ type StreamsEventsStreamCommon = {
|
|
|
898
929
|
maxEmptyPolls?: number;
|
|
899
930
|
signal?: AbortSignal;
|
|
900
931
|
};
|
|
901
|
-
/**
|
|
902
|
-
*
|
|
932
|
+
/**
|
|
933
|
+
* Stream options for Stacks events, the default chain.
|
|
934
|
+
*
|
|
935
|
+
* `chain: "stacks"` is the default, so omit `chain` entirely. Matches
|
|
936
|
+
* `StreamsEventsStacksListParams`.
|
|
937
|
+
*/
|
|
903
938
|
type StreamsEventsStreamStacksParams = StreamsEventsStreamCommon & {
|
|
904
939
|
chain?: "stacks";
|
|
905
940
|
types?: readonly StreamsEventType[];
|
|
@@ -911,11 +946,14 @@ type StreamsEventsStreamStacksParams = StreamsEventsStreamCommon & {
|
|
|
911
946
|
/** Labelled filter groups; see {@link StreamsEventsListParams.filters}. */
|
|
912
947
|
filters?: StreamsFilterMap;
|
|
913
948
|
};
|
|
914
|
-
/**
|
|
915
|
-
*
|
|
916
|
-
*
|
|
917
|
-
*
|
|
918
|
-
*
|
|
949
|
+
/**
|
|
950
|
+
* Stream options for Runes events, tailed like the Stacks default.
|
|
951
|
+
*
|
|
952
|
+
* `types` is restricted to `RuneEventType` at the type level, matching
|
|
953
|
+
* `StreamsEventsBitcoinListParams`. `contractId`, `sender`, `recipient`,
|
|
954
|
+
* `assetIdentifier`, and `filters` don't exist on this branch; they're
|
|
955
|
+
* Stacks-only.
|
|
956
|
+
*/
|
|
919
957
|
type StreamsEventsStreamBitcoinParams = StreamsEventsStreamCommon & {
|
|
920
958
|
chain: "bitcoin";
|
|
921
959
|
types?: readonly RuneEventType[];
|
|
@@ -969,9 +1007,12 @@ type StreamsEventsSubscribeStacksParams = StreamsEventsSubscribeCommon & {
|
|
|
969
1007
|
*/
|
|
970
1008
|
onEvent: (event: StreamsEvent) => void | Promise<void>;
|
|
971
1009
|
};
|
|
972
|
-
/**
|
|
973
|
-
*
|
|
974
|
-
*
|
|
1010
|
+
/**
|
|
1011
|
+
* Options for pushing Runes events live, on their own cursor space.
|
|
1012
|
+
*
|
|
1013
|
+
* `contractId`, `sender`, `recipient`, `assetIdentifier`, and `filters` don't
|
|
1014
|
+
* exist on this branch; they're Stacks-only.
|
|
1015
|
+
*/
|
|
975
1016
|
type StreamsEventsSubscribeBitcoinParams = StreamsEventsSubscribeCommon & {
|
|
976
1017
|
chain: "bitcoin";
|
|
977
1018
|
types?: readonly RuneEventType[];
|
|
@@ -1061,6 +1102,7 @@ type StreamsBatchContext = ConsumerBatchContext;
|
|
|
1061
1102
|
type StreamsReorgContext = {
|
|
1062
1103
|
cursor: string | null;
|
|
1063
1104
|
};
|
|
1105
|
+
/** Options for consuming Streams events: cursor, batching, filters, handler. */
|
|
1064
1106
|
type StreamsEventsConsumeParams<
|
|
1065
1107
|
TTx = never,
|
|
1066
1108
|
D extends boolean = false,
|
|
@@ -1178,13 +1220,14 @@ type StreamsEventsConsumeParams<
|
|
|
1178
1220
|
wake?: () => Promise<void>;
|
|
1179
1221
|
};
|
|
1180
1222
|
/**
|
|
1181
|
-
*
|
|
1182
|
-
*
|
|
1183
|
-
*
|
|
1184
|
-
*
|
|
1185
|
-
*
|
|
1186
|
-
*
|
|
1187
|
-
*
|
|
1223
|
+
* Options for the checkpointed sweep over Runes events.
|
|
1224
|
+
*
|
|
1225
|
+
* A separate, simpler type from `StreamsEventsConsumeParams` rather than a
|
|
1226
|
+
* widened union member: `filters`, `on`, and `decoded` are Stacks-only concepts
|
|
1227
|
+
* (labelled OR-groups and Index-shaped projection have no Runes equivalent
|
|
1228
|
+
* yet), so `onBatch` is the only way in and is required. Reorg rewind still
|
|
1229
|
+
* works the same way (bitcoin reorgs carry the same `fork_point_height` and
|
|
1230
|
+
* `new_canonical_tip` shape as Stacks ones).
|
|
1188
1231
|
*/
|
|
1189
1232
|
type StreamsEventsConsumeBitcoinParams<TTx = never> = {
|
|
1190
1233
|
chain: "bitcoin";
|
|
@@ -1217,9 +1260,10 @@ type StreamsEventsConsumeBitcoinParams<TTx = never> = {
|
|
|
1217
1260
|
wake?: () => Promise<void>;
|
|
1218
1261
|
};
|
|
1219
1262
|
/**
|
|
1220
|
-
* One
|
|
1221
|
-
*
|
|
1222
|
-
*
|
|
1263
|
+
* One page yielded by `consume`, with `cursor` to persist and resume.
|
|
1264
|
+
*
|
|
1265
|
+
* It is the `GET /v1/streams/events` envelope verbatim, with `next_cursor`
|
|
1266
|
+
* renamed to `cursor`.
|
|
1223
1267
|
*/
|
|
1224
1268
|
type StreamsBatch<
|
|
1225
1269
|
TEvent = StreamsEvent,
|
|
@@ -1233,6 +1277,7 @@ type StreamsBatch<
|
|
|
1233
1277
|
/** Chain reorgs reported alongside this page; empty when none. */
|
|
1234
1278
|
reorgs: StreamsReorg[];
|
|
1235
1279
|
};
|
|
1280
|
+
/** Cursor, batch size, and polling options shared by every consume loop. */
|
|
1236
1281
|
type StreamsConsumeCommon = {
|
|
1237
1282
|
/** Resume strictly after this cursor; omit to start from the oldest seekable page. */
|
|
1238
1283
|
cursor?: string | null;
|
|
@@ -1256,9 +1301,12 @@ type StreamsConsumeStacksParams = StreamsConsumeCommon & {
|
|
|
1256
1301
|
* event echoes the labels it matched. */
|
|
1257
1302
|
filters?: StreamsFilterMap;
|
|
1258
1303
|
};
|
|
1259
|
-
/**
|
|
1260
|
-
*
|
|
1261
|
-
*
|
|
1304
|
+
/**
|
|
1305
|
+
* Consume options for Runes batches, with their own cursor space.
|
|
1306
|
+
*
|
|
1307
|
+
* `contractId`, `sender`, `recipient`, `assetIdentifier`, and `filters` don't
|
|
1308
|
+
* exist on this branch; they're Stacks-only.
|
|
1309
|
+
*/
|
|
1262
1310
|
type StreamsConsumeBitcoinParams = StreamsConsumeCommon & {
|
|
1263
1311
|
chain: "bitcoin";
|
|
1264
1312
|
types?: readonly RuneEventType[];
|
|
@@ -1269,11 +1317,13 @@ type StreamsConsumeBitcoinParams = StreamsConsumeCommon & {
|
|
|
1269
1317
|
address?: string;
|
|
1270
1318
|
};
|
|
1271
1319
|
type StreamsConsumeParams = StreamsConsumeStacksParams | StreamsConsumeBitcoinParams;
|
|
1320
|
+
/** Where a consume loop stopped: cursor, pages read, empty polls. */
|
|
1272
1321
|
type StreamsEventsConsumeResult = {
|
|
1273
1322
|
cursor: string | null;
|
|
1274
1323
|
pages: number;
|
|
1275
1324
|
emptyPolls: number;
|
|
1276
1325
|
};
|
|
1326
|
+
/** Options for replaying history from dump files, then tailing live. */
|
|
1277
1327
|
type StreamsEventsReplayParams = {
|
|
1278
1328
|
/** Start point: `"genesis"` (default) or a `<block>:<index>` cursor. */
|
|
1279
1329
|
from?: "genesis" | string;
|
|
@@ -1328,6 +1378,7 @@ type StreamsDumpFile = {
|
|
|
1328
1378
|
schema_version: number;
|
|
1329
1379
|
created_at: string;
|
|
1330
1380
|
};
|
|
1381
|
+
/** The index of finalized Parquet dump files for one dataset. */
|
|
1331
1382
|
type StreamsDumpsManifest = {
|
|
1332
1383
|
dataset: string;
|
|
1333
1384
|
network: string;
|
|
@@ -1670,6 +1721,7 @@ type IndexReorg = {
|
|
|
1670
1721
|
*/
|
|
1671
1722
|
new_canonical_tip: string;
|
|
1672
1723
|
};
|
|
1724
|
+
/** A decoded fungible-token transfer: sender, recipient, asset, amount. */
|
|
1673
1725
|
type FtTransfer = {
|
|
1674
1726
|
cursor: string;
|
|
1675
1727
|
block_height: number;
|
|
@@ -1684,6 +1736,7 @@ type FtTransfer = {
|
|
|
1684
1736
|
recipient: string;
|
|
1685
1737
|
amount: string;
|
|
1686
1738
|
};
|
|
1739
|
+
/** One page of fungible-token transfers, with the cursor, tip, and reorgs. */
|
|
1687
1740
|
type FtTransfersEnvelope<TRow = FtTransfer> = {
|
|
1688
1741
|
events: TRow[];
|
|
1689
1742
|
next_cursor: string | null;
|
|
@@ -1695,6 +1748,7 @@ type FtTransfersEnvelope<TRow = FtTransfer> = {
|
|
|
1695
1748
|
type FtTransferAlwaysFields = "cursor" | "block_height" | "event_type";
|
|
1696
1749
|
/** An ft-transfer row narrowed to the requested columns plus the always-present ones. */
|
|
1697
1750
|
type FtTransferFields<F extends keyof FtTransfer & string> = Pick<FtTransfer, (F | FtTransferAlwaysFields) & keyof FtTransfer>;
|
|
1751
|
+
/** Column selection, paging, and filters for listing token transfers. */
|
|
1698
1752
|
type FtTransfersListParams = {
|
|
1699
1753
|
/**
|
|
1700
1754
|
* Columns to return. The server projects the row, so an unrequested column
|
|
@@ -1726,7 +1780,9 @@ type WalkOptions = PageRetryOptions & {
|
|
|
1726
1780
|
* walk from a stopped one. */
|
|
1727
1781
|
signal?: AbortSignal;
|
|
1728
1782
|
};
|
|
1783
|
+
/** `FtTransfersListParams` without `limit`, plus walk options. */
|
|
1729
1784
|
type FtTransfersWalkParams = Omit<FtTransfersListParams, "limit"> & WalkOptions;
|
|
1785
|
+
/** A decoded non-fungible-token transfer: sender, recipient, asset, value. */
|
|
1730
1786
|
type NftTransfer = {
|
|
1731
1787
|
cursor: string;
|
|
1732
1788
|
block_height: number;
|
|
@@ -1741,6 +1797,7 @@ type NftTransfer = {
|
|
|
1741
1797
|
recipient: string;
|
|
1742
1798
|
value: string;
|
|
1743
1799
|
};
|
|
1800
|
+
/** One page of non-fungible-token transfers, with the cursor, tip, and reorgs. */
|
|
1744
1801
|
type NftTransfersEnvelope<TRow = NftTransfer> = {
|
|
1745
1802
|
events: TRow[];
|
|
1746
1803
|
next_cursor: string | null;
|
|
@@ -1751,6 +1808,7 @@ type NftTransfersEnvelope<TRow = NftTransfer> = {
|
|
|
1751
1808
|
type NftTransferAlwaysFields = "cursor" | "block_height" | "event_type";
|
|
1752
1809
|
/** An nft-transfer row narrowed to the requested columns plus the always-present ones. */
|
|
1753
1810
|
type NftTransferFields<F extends keyof NftTransfer & string> = Pick<NftTransfer, (F | NftTransferAlwaysFields) & keyof NftTransfer>;
|
|
1811
|
+
/** Column selection, paging, and filters for listing NFT transfers. */
|
|
1754
1812
|
type NftTransfersListParams = {
|
|
1755
1813
|
/** Columns to return (see {@link FtTransfersListParams.fields}). */
|
|
1756
1814
|
fields?: readonly (keyof NftTransfer & string)[];
|
|
@@ -1764,6 +1822,7 @@ type NftTransfersListParams = {
|
|
|
1764
1822
|
fromHeight?: number;
|
|
1765
1823
|
toHeight?: number;
|
|
1766
1824
|
};
|
|
1825
|
+
/** `NftTransfersListParams` without `limit`, plus walk options. */
|
|
1767
1826
|
type NftTransfersWalkParams = Omit<NftTransfersListParams, "limit"> & WalkOptions;
|
|
1768
1827
|
type IndexEventBase = {
|
|
1769
1828
|
cursor: string;
|
|
@@ -1784,6 +1843,7 @@ type IndexEventBase = {
|
|
|
1784
1843
|
tx_contract_id?: string | null;
|
|
1785
1844
|
tx_function_name?: string | null;
|
|
1786
1845
|
};
|
|
1846
|
+
/** A fungible-token transfer event. */
|
|
1787
1847
|
type IndexFtTransfer = IndexEventBase & {
|
|
1788
1848
|
event_type: "ft_transfer";
|
|
1789
1849
|
asset_identifier: string;
|
|
@@ -1791,6 +1851,7 @@ type IndexFtTransfer = IndexEventBase & {
|
|
|
1791
1851
|
recipient: string;
|
|
1792
1852
|
amount: string;
|
|
1793
1853
|
};
|
|
1854
|
+
/** A non-fungible-token transfer event. */
|
|
1794
1855
|
type IndexNftTransfer = IndexEventBase & {
|
|
1795
1856
|
event_type: "nft_transfer";
|
|
1796
1857
|
asset_identifier: string;
|
|
@@ -1798,6 +1859,7 @@ type IndexNftTransfer = IndexEventBase & {
|
|
|
1798
1859
|
recipient: string;
|
|
1799
1860
|
value: string;
|
|
1800
1861
|
};
|
|
1862
|
+
/** An STX transfer event. */
|
|
1801
1863
|
type IndexStxTransfer = IndexEventBase & {
|
|
1802
1864
|
event_type: "stx_transfer";
|
|
1803
1865
|
sender: string;
|
|
@@ -1805,16 +1867,19 @@ type IndexStxTransfer = IndexEventBase & {
|
|
|
1805
1867
|
amount: string;
|
|
1806
1868
|
memo: string | null;
|
|
1807
1869
|
};
|
|
1870
|
+
/** An STX mint event. */
|
|
1808
1871
|
type IndexStxMint = IndexEventBase & {
|
|
1809
1872
|
event_type: "stx_mint";
|
|
1810
1873
|
recipient: string;
|
|
1811
1874
|
amount: string;
|
|
1812
1875
|
};
|
|
1876
|
+
/** An STX burn event. */
|
|
1813
1877
|
type IndexStxBurn = IndexEventBase & {
|
|
1814
1878
|
event_type: "stx_burn";
|
|
1815
1879
|
sender: string;
|
|
1816
1880
|
amount: string;
|
|
1817
1881
|
};
|
|
1882
|
+
/** An STX lock event with its unlock height. */
|
|
1818
1883
|
type IndexStxLock = IndexEventBase & {
|
|
1819
1884
|
event_type: "stx_lock";
|
|
1820
1885
|
sender: string;
|
|
@@ -1823,30 +1888,35 @@ type IndexStxLock = IndexEventBase & {
|
|
|
1823
1888
|
unlock_height: string | null;
|
|
1824
1889
|
};
|
|
1825
1890
|
};
|
|
1891
|
+
/** A fungible-token mint event. */
|
|
1826
1892
|
type IndexFtMint = IndexEventBase & {
|
|
1827
1893
|
event_type: "ft_mint";
|
|
1828
1894
|
asset_identifier: string;
|
|
1829
1895
|
recipient: string;
|
|
1830
1896
|
amount: string;
|
|
1831
1897
|
};
|
|
1898
|
+
/** A fungible-token burn event. */
|
|
1832
1899
|
type IndexFtBurn = IndexEventBase & {
|
|
1833
1900
|
event_type: "ft_burn";
|
|
1834
1901
|
asset_identifier: string;
|
|
1835
1902
|
sender: string;
|
|
1836
1903
|
amount: string;
|
|
1837
1904
|
};
|
|
1905
|
+
/** A non-fungible-token mint event. */
|
|
1838
1906
|
type IndexNftMint = IndexEventBase & {
|
|
1839
1907
|
event_type: "nft_mint";
|
|
1840
1908
|
asset_identifier: string;
|
|
1841
1909
|
recipient: string;
|
|
1842
1910
|
value: string;
|
|
1843
1911
|
};
|
|
1912
|
+
/** A non-fungible-token burn event. */
|
|
1844
1913
|
type IndexNftBurn = IndexEventBase & {
|
|
1845
1914
|
event_type: "nft_burn";
|
|
1846
1915
|
asset_identifier: string;
|
|
1847
1916
|
sender: string;
|
|
1848
1917
|
value: string;
|
|
1849
1918
|
};
|
|
1919
|
+
/** A contract `print` event with its topic and value. */
|
|
1850
1920
|
type IndexPrint = IndexEventBase & {
|
|
1851
1921
|
event_type: "print";
|
|
1852
1922
|
payload: {
|
|
@@ -1855,6 +1925,7 @@ type IndexPrint = IndexEventBase & {
|
|
|
1855
1925
|
raw_value: string | null;
|
|
1856
1926
|
};
|
|
1857
1927
|
};
|
|
1928
|
+
/** A contract call made from inside another contract call. */
|
|
1858
1929
|
type IndexNestedContractCall = IndexEventBase & {
|
|
1859
1930
|
event_type: "nested_contract_call";
|
|
1860
1931
|
sender: string | null;
|
|
@@ -1863,23 +1934,27 @@ type IndexNestedContractCall = IndexEventBase & {
|
|
|
1863
1934
|
function_args: unknown;
|
|
1864
1935
|
raw_result: string | null;
|
|
1865
1936
|
};
|
|
1937
|
+
/** A contract data variable write. */
|
|
1866
1938
|
type IndexVarSet = IndexEventBase & {
|
|
1867
1939
|
event_type: "var_set";
|
|
1868
1940
|
var_name: string;
|
|
1869
1941
|
raw_value: string;
|
|
1870
1942
|
};
|
|
1943
|
+
/** A contract map entry overwrite. */
|
|
1871
1944
|
type IndexMapSet = IndexEventBase & {
|
|
1872
1945
|
event_type: "map_set";
|
|
1873
1946
|
map: string;
|
|
1874
1947
|
raw_key: string;
|
|
1875
1948
|
raw_value: string;
|
|
1876
1949
|
};
|
|
1950
|
+
/** A new contract map entry. */
|
|
1877
1951
|
type IndexMapInsert = IndexEventBase & {
|
|
1878
1952
|
event_type: "map_insert";
|
|
1879
1953
|
map: string;
|
|
1880
1954
|
raw_key: string;
|
|
1881
1955
|
raw_value: string;
|
|
1882
1956
|
};
|
|
1957
|
+
/** A contract map entry deletion. */
|
|
1883
1958
|
type IndexMapDelete = IndexEventBase & {
|
|
1884
1959
|
event_type: "map_delete";
|
|
1885
1960
|
map: string;
|
|
@@ -1896,6 +1971,7 @@ type IndexEventFields<
|
|
|
1896
1971
|
T extends IndexEventType,
|
|
1897
1972
|
F extends keyof IndexEventOf<T> & string
|
|
1898
1973
|
> = Pick<IndexEventOf<T>, (F | IndexAlwaysFields) & keyof IndexEventOf<T>>;
|
|
1974
|
+
/** One page of decoded events, with the cursor, tip, and reorgs. */
|
|
1899
1975
|
type EventsEnvelope<
|
|
1900
1976
|
T extends IndexEventType = IndexEventType,
|
|
1901
1977
|
TRow = IndexEventOf<T>
|
|
@@ -1910,6 +1986,7 @@ type EventsEnvelope<
|
|
|
1910
1986
|
type IndexEventOf<T extends IndexEventType> = Extract<IndexEvent, {
|
|
1911
1987
|
event_type: T;
|
|
1912
1988
|
}>;
|
|
1989
|
+
/** Event type, paging, and filters for listing decoded events. */
|
|
1913
1990
|
type EventsListParams<T extends IndexEventType = IndexEventType> = {
|
|
1914
1991
|
/** Decoded types or VM types (`nested_contract_call`, `map_set`, …). */
|
|
1915
1992
|
eventType: T;
|
|
@@ -1954,11 +2031,13 @@ type EventsListParams<T extends IndexEventType = IndexEventType> = {
|
|
|
1954
2031
|
*/
|
|
1955
2032
|
fields?: readonly (keyof IndexEventOf<T> & string)[];
|
|
1956
2033
|
};
|
|
2034
|
+
/** `EventsListParams` without `limit`, plus walk options. */
|
|
1957
2035
|
type EventsWalkParams<T extends IndexEventType = IndexEventType> = Omit<EventsListParams<T>, "limit"> & WalkOptions;
|
|
1958
2036
|
type EventsConsumeParams<
|
|
1959
2037
|
T extends IndexEventType = IndexEventType,
|
|
1960
2038
|
TTx = never
|
|
1961
2039
|
> = Omit<EventsListParams<T>, "cursor" | "fromCursor" | "limit" | "fields"> & IndexConsumeOptions<IndexEventOf<T>, EventsEnvelope<T>, TTx>;
|
|
2040
|
+
/** A decoded contract call: contract, function, sender, arguments, result. */
|
|
1962
2041
|
type IndexContractCall = {
|
|
1963
2042
|
cursor: string;
|
|
1964
2043
|
block_height: number;
|
|
@@ -1973,12 +2052,14 @@ type IndexContractCall = {
|
|
|
1973
2052
|
result: unknown;
|
|
1974
2053
|
result_hex: string | null;
|
|
1975
2054
|
};
|
|
2055
|
+
/** One page of contract calls, with the cursor, tip, and reorgs. */
|
|
1976
2056
|
type ContractCallsEnvelope = {
|
|
1977
2057
|
contract_calls: IndexContractCall[];
|
|
1978
2058
|
next_cursor: string | null;
|
|
1979
2059
|
tip: IndexTip;
|
|
1980
2060
|
reorgs: IndexReorg[];
|
|
1981
2061
|
};
|
|
2062
|
+
/** Paging and contract filters for listing contract calls. */
|
|
1982
2063
|
type ContractCallsListParams = {
|
|
1983
2064
|
cursor?: string | null;
|
|
1984
2065
|
fromCursor?: string | null;
|
|
@@ -1994,6 +2075,7 @@ type ContractCallsListParams = {
|
|
|
1994
2075
|
* Mutually exclusive with contractId. */
|
|
1995
2076
|
trait?: string;
|
|
1996
2077
|
};
|
|
2078
|
+
/** `ContractCallsListParams` without `limit`, plus walk options. */
|
|
1997
2079
|
type ContractCallsWalkParams = Omit<ContractCallsListParams, "limit"> & WalkOptions;
|
|
1998
2080
|
type ContractCallsConsumeParams<TTx = never> = Omit<ContractCallsListParams, "cursor" | "fromCursor" | "limit"> & IndexConsumeOptions<IndexContractCall, ContractCallsEnvelope, TTx>;
|
|
1999
2081
|
/** One canonical block in the sync map. Lean by design — block + parent hash
|
|
@@ -2007,11 +2089,13 @@ type IndexCanonicalBlock = {
|
|
|
2007
2089
|
burn_block_height: number;
|
|
2008
2090
|
burn_block_hash: string | null;
|
|
2009
2091
|
};
|
|
2092
|
+
/** One page of canonical blocks, with the next cursor and chain tip. */
|
|
2010
2093
|
type CanonicalEnvelope = {
|
|
2011
2094
|
canonical: IndexCanonicalBlock[];
|
|
2012
2095
|
next_cursor: string | null;
|
|
2013
2096
|
tip: IndexTip;
|
|
2014
2097
|
};
|
|
2098
|
+
/** Paging and height filters for listing canonical blocks. */
|
|
2015
2099
|
type CanonicalListParams = {
|
|
2016
2100
|
cursor?: string | null;
|
|
2017
2101
|
fromCursor?: string | null;
|
|
@@ -2019,6 +2103,7 @@ type CanonicalListParams = {
|
|
|
2019
2103
|
fromHeight?: number;
|
|
2020
2104
|
toHeight?: number;
|
|
2021
2105
|
};
|
|
2106
|
+
/** `CanonicalListParams` without `limit`, plus walk options. */
|
|
2022
2107
|
type CanonicalWalkParams = Omit<CanonicalListParams, "limit"> & WalkOptions;
|
|
2023
2108
|
/** One MARF write a block committed, in the node's write order. Present only
|
|
2024
2109
|
* from the height the instance's node subscribed to `state_writes`. */
|
|
@@ -2043,12 +2128,14 @@ type IndexStateWrite = {
|
|
|
2043
2128
|
tx_contract_id?: string | null;
|
|
2044
2129
|
tx_function_name?: string | null;
|
|
2045
2130
|
};
|
|
2131
|
+
/** One page of contract state writes, with the cursor, tip, and reorgs. */
|
|
2046
2132
|
type StateWritesEnvelope = {
|
|
2047
2133
|
state_writes: IndexStateWrite[];
|
|
2048
2134
|
next_cursor: string | null;
|
|
2049
2135
|
tip: IndexTip;
|
|
2050
2136
|
reorgs: IndexReorg[];
|
|
2051
2137
|
};
|
|
2138
|
+
/** Paging and filters for listing contract state writes. */
|
|
2052
2139
|
type StateWritesListParams = {
|
|
2053
2140
|
cursor?: string | null;
|
|
2054
2141
|
fromCursor?: string | null;
|
|
@@ -2062,6 +2149,7 @@ type StateWritesListParams = {
|
|
|
2062
2149
|
/** Join the writing transaction's `tx_*` fields onto each row. */
|
|
2063
2150
|
txContext?: boolean;
|
|
2064
2151
|
};
|
|
2152
|
+
/** `StateWritesListParams` without `limit`, plus walk options. */
|
|
2065
2153
|
type StateWritesWalkParams = Omit<StateWritesListParams, "limit"> & WalkOptions;
|
|
2066
2154
|
/** A block resource. Metadata is intentionally thin — only chain-linkage and
|
|
2067
2155
|
* burn-anchor fields are persisted (no miner / tx_count / signer). */
|
|
@@ -2075,15 +2163,18 @@ type IndexBlock = {
|
|
|
2075
2163
|
block_time: string | null;
|
|
2076
2164
|
canonical: boolean;
|
|
2077
2165
|
};
|
|
2166
|
+
/** One page of blocks, with the next cursor and chain tip. */
|
|
2078
2167
|
type BlocksEnvelope = {
|
|
2079
2168
|
blocks: IndexBlock[];
|
|
2080
2169
|
next_cursor: string | null;
|
|
2081
2170
|
tip: IndexTip;
|
|
2082
2171
|
};
|
|
2172
|
+
/** One block and the chain tip. */
|
|
2083
2173
|
type BlockEnvelope = {
|
|
2084
2174
|
block: IndexBlock;
|
|
2085
2175
|
tip: IndexTip;
|
|
2086
2176
|
};
|
|
2177
|
+
/** Paging and height filters for listing blocks. */
|
|
2087
2178
|
type BlocksListParams = {
|
|
2088
2179
|
cursor?: string | null;
|
|
2089
2180
|
fromCursor?: string | null;
|
|
@@ -2091,6 +2182,7 @@ type BlocksListParams = {
|
|
|
2091
2182
|
fromHeight?: number;
|
|
2092
2183
|
toHeight?: number;
|
|
2093
2184
|
};
|
|
2185
|
+
/** `BlocksListParams` without `limit`, plus walk options. */
|
|
2094
2186
|
type BlocksWalkParams = Omit<BlocksListParams, "limit"> & WalkOptions;
|
|
2095
2187
|
type IndexPostCondition = {
|
|
2096
2188
|
type: "stx";
|
|
@@ -2167,12 +2259,14 @@ type IndexTransaction = {
|
|
|
2167
2259
|
cause: number;
|
|
2168
2260
|
};
|
|
2169
2261
|
};
|
|
2262
|
+
/** One page of transactions, with the cursor, tip, and reorgs. */
|
|
2170
2263
|
type TransactionsEnvelope<TRow = IndexTransaction> = {
|
|
2171
2264
|
transactions: TRow[];
|
|
2172
2265
|
next_cursor: string | null;
|
|
2173
2266
|
tip: IndexTip;
|
|
2174
2267
|
reorgs: IndexReorg[];
|
|
2175
2268
|
};
|
|
2269
|
+
/** One transaction and the chain tip. */
|
|
2176
2270
|
type TransactionEnvelope = {
|
|
2177
2271
|
transaction: IndexTransaction;
|
|
2178
2272
|
tip: IndexTip;
|
|
@@ -2181,6 +2275,7 @@ type TransactionEnvelope = {
|
|
|
2181
2275
|
type TransactionAlwaysFields = "cursor" | "block_height" | "tx_id";
|
|
2182
2276
|
/** A Transaction row narrowed to the requested columns plus the always-present ones. */
|
|
2183
2277
|
type TransactionFields<F extends keyof IndexTransaction & string> = Pick<IndexTransaction, (F | TransactionAlwaysFields) & keyof IndexTransaction>;
|
|
2278
|
+
/** Column selection, paging, and filters for listing transactions. */
|
|
2184
2279
|
type TransactionsListParams = {
|
|
2185
2280
|
/**
|
|
2186
2281
|
* Columns to return. The server projects the row, so an unrequested column
|
|
@@ -2197,6 +2292,7 @@ type TransactionsListParams = {
|
|
|
2197
2292
|
fromHeight?: number;
|
|
2198
2293
|
toHeight?: number;
|
|
2199
2294
|
};
|
|
2295
|
+
/** `TransactionsListParams` without `limit`, plus walk options. */
|
|
2200
2296
|
type TransactionsWalkParams = Omit<TransactionsListParams, "limit"> & WalkOptions;
|
|
2201
2297
|
/** A decoded PoX-4 stacking action (one per stacking contract call). */
|
|
2202
2298
|
type IndexStackingAction = {
|
|
@@ -2223,6 +2319,7 @@ type IndexStackingAction = {
|
|
|
2223
2319
|
signer_key: string | null;
|
|
2224
2320
|
result_ok: boolean;
|
|
2225
2321
|
};
|
|
2322
|
+
/** One page of stacking actions, with the cursor, tip, and reorgs. */
|
|
2226
2323
|
type StackingEnvelope = {
|
|
2227
2324
|
stacking: IndexStackingAction[];
|
|
2228
2325
|
next_cursor: string | null;
|
|
@@ -2231,6 +2328,7 @@ type StackingEnvelope = {
|
|
|
2231
2328
|
/** Present only when the PoX-4 decoder is disabled, explaining an empty feed. */
|
|
2232
2329
|
notes?: string;
|
|
2233
2330
|
};
|
|
2331
|
+
/** Paging and filters for listing stacking actions. */
|
|
2234
2332
|
type StackingListParams = {
|
|
2235
2333
|
cursor?: string | null;
|
|
2236
2334
|
fromCursor?: string | null;
|
|
@@ -2241,6 +2339,7 @@ type StackingListParams = {
|
|
|
2241
2339
|
fromHeight?: number;
|
|
2242
2340
|
toHeight?: number;
|
|
2243
2341
|
};
|
|
2342
|
+
/** `StackingListParams` without `limit`, plus walk options. */
|
|
2244
2343
|
type StackingWalkParams = Omit<StackingListParams, "limit"> & WalkOptions;
|
|
2245
2344
|
/** A pending (unconfirmed) transaction. Like a transaction document but
|
|
2246
2345
|
* pre-chain — no block_height/tx_index/result/events — with `received_at` and
|
|
@@ -2277,15 +2376,18 @@ type IndexMempoolTransaction = {
|
|
|
2277
2376
|
cause: number;
|
|
2278
2377
|
};
|
|
2279
2378
|
};
|
|
2379
|
+
/** One page of pending transactions, with the next cursor and chain tip. */
|
|
2280
2380
|
type MempoolEnvelope = {
|
|
2281
2381
|
mempool: IndexMempoolTransaction[];
|
|
2282
2382
|
next_cursor: string | null;
|
|
2283
2383
|
tip: IndexTip;
|
|
2284
2384
|
};
|
|
2385
|
+
/** One pending transaction and the chain tip. */
|
|
2285
2386
|
type MempoolTransactionEnvelope = {
|
|
2286
2387
|
transaction: IndexMempoolTransaction;
|
|
2287
2388
|
tip: IndexTip;
|
|
2288
2389
|
};
|
|
2390
|
+
/** Paging and sender filters for listing pending transactions. */
|
|
2289
2391
|
type MempoolListParams = {
|
|
2290
2392
|
cursor?: string | null;
|
|
2291
2393
|
fromCursor?: string | null;
|
|
@@ -2297,11 +2399,13 @@ type MempoolListParams = {
|
|
|
2297
2399
|
/** Filter to pending calls to a single function (composes with `contractId`). */
|
|
2298
2400
|
functionName?: string;
|
|
2299
2401
|
};
|
|
2402
|
+
/** `MempoolListParams` without `limit`, plus walk options. */
|
|
2300
2403
|
type MempoolWalkParams = Omit<MempoolListParams, "limit"> & WalkOptions;
|
|
2301
2404
|
/**
|
|
2302
|
-
*
|
|
2303
|
-
*
|
|
2304
|
-
*
|
|
2405
|
+
* Per-topic print payload schema for a contract, inferred from sampled events.
|
|
2406
|
+
*
|
|
2407
|
+
* `topics` is sorted by count desc; `sampled` is true when the contract has
|
|
2408
|
+
* more print events than the windows examined.
|
|
2305
2409
|
*/
|
|
2306
2410
|
type PrintSchemaResponse = {
|
|
2307
2411
|
contract_id: string;
|
|
@@ -2338,8 +2442,12 @@ type IndexSbtcDeposit = {
|
|
|
2338
2442
|
type IndexSbtcDepositDetail = IndexSbtcDeposit & {
|
|
2339
2443
|
status: "COMPLETED";
|
|
2340
2444
|
};
|
|
2341
|
-
/**
|
|
2342
|
-
*
|
|
2445
|
+
/**
|
|
2446
|
+
* A peg-out as one row per request, with its latest status.
|
|
2447
|
+
*
|
|
2448
|
+
* Collapsed to one row per `request_id`, with lifecycle `status` derived from
|
|
2449
|
+
* the latest accept/reject.
|
|
2450
|
+
*/
|
|
2343
2451
|
type IndexSbtcWithdrawal = {
|
|
2344
2452
|
cursor: string;
|
|
2345
2453
|
request_id: number;
|
|
@@ -2393,8 +2501,11 @@ type IndexSbtcWithdrawalDetail = {
|
|
|
2393
2501
|
};
|
|
2394
2502
|
finalized: boolean;
|
|
2395
2503
|
};
|
|
2396
|
-
/**
|
|
2397
|
-
*
|
|
2504
|
+
/**
|
|
2505
|
+
* A raw decoded sBTC protocol-state event, one per event.
|
|
2506
|
+
*
|
|
2507
|
+
* It is the full `sbtc_events` row, one per event across all topics.
|
|
2508
|
+
*/
|
|
2398
2509
|
type IndexSbtcEvent = {
|
|
2399
2510
|
cursor: string;
|
|
2400
2511
|
block_height: number;
|
|
@@ -2433,6 +2544,7 @@ type IndexSbtcSummary = {
|
|
|
2433
2544
|
total_locked_sats: string;
|
|
2434
2545
|
sbtc_supply_sats: string | null;
|
|
2435
2546
|
};
|
|
2547
|
+
/** One page of sBTC deposits, with the cursor, tip, and reorgs. */
|
|
2436
2548
|
type SbtcDepositsEnvelope<TRow = IndexSbtcDeposit> = {
|
|
2437
2549
|
deposits: TRow[];
|
|
2438
2550
|
next_cursor: string | null;
|
|
@@ -2441,10 +2553,12 @@ type SbtcDepositsEnvelope<TRow = IndexSbtcDeposit> = {
|
|
|
2441
2553
|
/** Present only when the sBTC decoder is disabled, explaining an empty feed. */
|
|
2442
2554
|
notes?: string;
|
|
2443
2555
|
};
|
|
2556
|
+
/** One sBTC deposit and the chain tip. */
|
|
2444
2557
|
type SbtcDepositEnvelope = {
|
|
2445
2558
|
deposit: IndexSbtcDepositDetail;
|
|
2446
2559
|
tip: IndexTip;
|
|
2447
2560
|
};
|
|
2561
|
+
/** One page of sBTC withdrawals, with the cursor, tip, and reorgs. */
|
|
2448
2562
|
type SbtcWithdrawalsEnvelope<TRow = IndexSbtcWithdrawal> = {
|
|
2449
2563
|
withdrawals: TRow[];
|
|
2450
2564
|
next_cursor: string | null;
|
|
@@ -2452,10 +2566,12 @@ type SbtcWithdrawalsEnvelope<TRow = IndexSbtcWithdrawal> = {
|
|
|
2452
2566
|
reorgs: IndexReorg[];
|
|
2453
2567
|
notes?: string;
|
|
2454
2568
|
};
|
|
2569
|
+
/** One sBTC withdrawal and the chain tip. */
|
|
2455
2570
|
type SbtcWithdrawalEnvelope = {
|
|
2456
2571
|
withdrawal: IndexSbtcWithdrawalDetail;
|
|
2457
2572
|
tip: IndexTip;
|
|
2458
2573
|
};
|
|
2574
|
+
/** One page of sBTC events, with the cursor, tip, and reorgs. */
|
|
2459
2575
|
type SbtcEventsEnvelope = {
|
|
2460
2576
|
events: IndexSbtcEvent[];
|
|
2461
2577
|
next_cursor: string | null;
|
|
@@ -2463,11 +2579,13 @@ type SbtcEventsEnvelope = {
|
|
|
2463
2579
|
reorgs: IndexReorg[];
|
|
2464
2580
|
notes?: string;
|
|
2465
2581
|
};
|
|
2582
|
+
/** The sBTC totals and the chain tip. */
|
|
2466
2583
|
type SbtcSummaryEnvelope = {
|
|
2467
2584
|
summary: IndexSbtcSummary;
|
|
2468
2585
|
tip: IndexTip;
|
|
2469
2586
|
notes?: string;
|
|
2470
2587
|
};
|
|
2588
|
+
/** Column selection, paging, and filters for listing sBTC deposits. */
|
|
2471
2589
|
type SbtcDepositsListParams = {
|
|
2472
2590
|
cursor?: string | null;
|
|
2473
2591
|
fromCursor?: string | null;
|
|
@@ -2489,11 +2607,13 @@ type SbtcDepositsListParams = {
|
|
|
2489
2607
|
type SbtcDepositAlwaysFields = "cursor" | "block_height";
|
|
2490
2608
|
/** A deposit row narrowed to the requested columns plus the always-present ones. */
|
|
2491
2609
|
type SbtcDepositFields<F extends keyof IndexSbtcDeposit & string> = Pick<IndexSbtcDeposit, (F | SbtcDepositAlwaysFields) & keyof IndexSbtcDeposit>;
|
|
2610
|
+
/** `SbtcDepositsListParams` without `limit`, plus walk options. */
|
|
2492
2611
|
type SbtcDepositsWalkParams = Omit<SbtcDepositsListParams, "limit"> & WalkOptions;
|
|
2493
2612
|
/** SbtcWithdrawal columns that survive any projection. */
|
|
2494
2613
|
type SbtcWithdrawalAlwaysFields = "cursor" | "request_id";
|
|
2495
2614
|
/** A SbtcWithdrawal row narrowed to the requested columns plus the always-present ones. */
|
|
2496
2615
|
type SbtcWithdrawalFields<F extends keyof IndexSbtcWithdrawal & string> = Pick<IndexSbtcWithdrawal, (F | SbtcWithdrawalAlwaysFields) & keyof IndexSbtcWithdrawal>;
|
|
2616
|
+
/** Column selection, paging, and filters for listing sBTC withdrawals. */
|
|
2497
2617
|
type SbtcWithdrawalsListParams = {
|
|
2498
2618
|
/**
|
|
2499
2619
|
* Columns to return. The server projects the row, so an unrequested column
|
|
@@ -2514,7 +2634,9 @@ type SbtcWithdrawalsListParams = {
|
|
|
2514
2634
|
fromHeight?: number;
|
|
2515
2635
|
toHeight?: number;
|
|
2516
2636
|
};
|
|
2637
|
+
/** `SbtcWithdrawalsListParams` without `limit`, plus walk options. */
|
|
2517
2638
|
type SbtcWithdrawalsWalkParams = Omit<SbtcWithdrawalsListParams, "limit"> & WalkOptions;
|
|
2639
|
+
/** Paging and filters for listing sBTC events. */
|
|
2518
2640
|
type SbtcEventsListParams = {
|
|
2519
2641
|
cursor?: string | null;
|
|
2520
2642
|
fromCursor?: string | null;
|
|
@@ -2527,6 +2649,7 @@ type SbtcEventsListParams = {
|
|
|
2527
2649
|
fromHeight?: number;
|
|
2528
2650
|
toHeight?: number;
|
|
2529
2651
|
};
|
|
2652
|
+
/** `SbtcEventsListParams` without `limit`, plus walk options. */
|
|
2530
2653
|
type SbtcEventsWalkParams = Omit<SbtcEventsListParams, "limit"> & WalkOptions;
|
|
2531
2654
|
type SbtcEventsConsumeParams<TTx = never> = Omit<SbtcEventsListParams, "cursor" | "fromCursor" | "limit"> & IndexConsumeOptions<IndexSbtcEvent, SbtcEventsEnvelope, TTx>;
|
|
2532
2655
|
type SbtcDepositsConsumeParams<TTx = never> = Omit<SbtcDepositsListParams, "cursor" | "fromCursor" | "limit" | "fields"> & IndexConsumeOptions<IndexSbtcDeposit, SbtcDepositsEnvelope, TTx>;
|
|
@@ -2672,6 +2795,7 @@ type IndexPoxCycleSigner = {
|
|
|
2672
2795
|
in_set: boolean;
|
|
2673
2796
|
rewards_claimed: string;
|
|
2674
2797
|
};
|
|
2798
|
+
/** One page of reward cycles, newest first, with the next cursor. */
|
|
2675
2799
|
type PoxCyclesEnvelope = {
|
|
2676
2800
|
/** The PoX version this response reports. Currently 5. */
|
|
2677
2801
|
pox_version: 5;
|
|
@@ -2680,6 +2804,7 @@ type PoxCyclesEnvelope = {
|
|
|
2680
2804
|
next_cursor: number | null;
|
|
2681
2805
|
tip: IndexTip;
|
|
2682
2806
|
};
|
|
2807
|
+
/** One reward cycle with its signers and the chain tip. */
|
|
2683
2808
|
type PoxCycleEnvelope = {
|
|
2684
2809
|
pox_version: 5;
|
|
2685
2810
|
cycle: IndexPoxCycle & {
|
|
@@ -2687,11 +2812,13 @@ type PoxCycleEnvelope = {
|
|
|
2687
2812
|
};
|
|
2688
2813
|
tip: IndexTip;
|
|
2689
2814
|
};
|
|
2815
|
+
/** Paging for listing reward cycles. */
|
|
2690
2816
|
type PoxCyclesListParams = {
|
|
2691
2817
|
/** A `reward_cycle` to page from; the page returns cycles below it (descending). */
|
|
2692
2818
|
cursor?: number | null;
|
|
2693
2819
|
limit?: number;
|
|
2694
2820
|
};
|
|
2821
|
+
/** `PoxCyclesListParams` without `limit`, plus walk options. */
|
|
2695
2822
|
type PoxCyclesWalkParams = Omit<PoxCyclesListParams, "limit"> & WalkOptions;
|
|
2696
2823
|
/** `index.pox` — reward cycles of the current PoX (PoX-5). */
|
|
2697
2824
|
interface PoxResource {
|
|
@@ -2749,6 +2876,7 @@ type IndexPox5Event = {
|
|
|
2749
2876
|
/** The full decoded print tuple as JSON. */
|
|
2750
2877
|
data: unknown;
|
|
2751
2878
|
};
|
|
2879
|
+
/** One page of PoX-5 events, with the cursor, tip, and reorgs. */
|
|
2752
2880
|
type Pox5EventsEnvelope<TRow = IndexPox5Event> = {
|
|
2753
2881
|
events: TRow[];
|
|
2754
2882
|
next_cursor: string | null;
|
|
@@ -2761,6 +2889,7 @@ type Pox5EventsEnvelope<TRow = IndexPox5Event> = {
|
|
|
2761
2889
|
type Pox5EventAlwaysFields = "cursor" | "block_height" | "topic";
|
|
2762
2890
|
/** A Pox5Event row narrowed to the requested columns plus the always-present ones. */
|
|
2763
2891
|
type Pox5EventFields<F extends keyof IndexPox5Event & string> = Pick<IndexPox5Event, (F | Pox5EventAlwaysFields) & keyof IndexPox5Event>;
|
|
2892
|
+
/** Column selection, paging, and filters for listing PoX-5 events. */
|
|
2764
2893
|
type Pox5EventsListParams = {
|
|
2765
2894
|
/**
|
|
2766
2895
|
* Columns to return. The server projects the row, so an unrequested column
|
|
@@ -2782,6 +2911,7 @@ type Pox5EventsListParams = {
|
|
|
2782
2911
|
fromHeight?: number;
|
|
2783
2912
|
toHeight?: number;
|
|
2784
2913
|
};
|
|
2914
|
+
/** `Pox5EventsListParams` without `limit`, plus walk options. */
|
|
2785
2915
|
type Pox5EventsWalkParams = Omit<Pox5EventsListParams, "limit"> & WalkOptions;
|
|
2786
2916
|
type Pox5EventsConsumeParams<TTx = never> = Omit<Pox5EventsListParams, "cursor" | "fromCursor" | "limit"> & IndexConsumeOptions<IndexPox5Event, Pox5EventsEnvelope, TTx>;
|
|
2787
2917
|
/** `index.pox5` — decoded PoX-5 print events, the staking primitive from the
|
|
@@ -2821,11 +2951,13 @@ interface Pox5Resource {
|
|
|
2821
2951
|
/** A rune's `<block>:<tx>` id — the etch transaction's position, e.g. `840000:3`. */
|
|
2822
2952
|
type RuneId = `${number}:${number}`;
|
|
2823
2953
|
/**
|
|
2824
|
-
* A rune
|
|
2825
|
-
*
|
|
2826
|
-
* `dog.go.to.the.moon` and `doggotothemoon` all resolve
|
|
2827
|
-
*
|
|
2828
|
-
*
|
|
2954
|
+
* A rune id or name, in any case, with or without spacers.
|
|
2955
|
+
*
|
|
2956
|
+
* `DOG•GO•TO•THE•MOON`, `dog.go.to.the.moon` and `doggotothemoon` all resolve
|
|
2957
|
+
* to the same rune.
|
|
2958
|
+
*
|
|
2959
|
+
* Typing every rune name is a no: 178k runes and growing, so a generated union
|
|
2960
|
+
* would be huge and stale on day one. `list({ search })` covers discovery.
|
|
2829
2961
|
*/
|
|
2830
2962
|
type RuneRef = RuneId | (string & {});
|
|
2831
2963
|
/** The Bitcoin chain tip a Runes read was served against — a separate clock
|
|
@@ -2870,8 +3002,11 @@ type IndexRuneTerms = {
|
|
|
2870
3002
|
offset_start: string | null;
|
|
2871
3003
|
offset_end: string | null;
|
|
2872
3004
|
};
|
|
2873
|
-
/**
|
|
2874
|
-
*
|
|
3005
|
+
/**
|
|
3006
|
+
* One etched rune: identity, counters, supply, and mint terms.
|
|
3007
|
+
*
|
|
3008
|
+
* Counters cover premine, mint, and burn; supply is computed.
|
|
3009
|
+
*/
|
|
2875
3010
|
type IndexRuneEntry = IndexRuneRefSummary & {
|
|
2876
3011
|
/** Etch sequence number (u128 decimal string) — 0 is genesis. */
|
|
2877
3012
|
number: string;
|
|
@@ -2888,6 +3023,7 @@ type IndexRuneEntry = IndexRuneRefSummary & {
|
|
|
2888
3023
|
etched_tx_index: number;
|
|
2889
3024
|
terms: IndexRuneTerms | null;
|
|
2890
3025
|
};
|
|
3026
|
+
/** One page of runes, with the cursor and Bitcoin tip. */
|
|
2891
3027
|
type RunesEnvelope<TRow = IndexRuneEntry> = {
|
|
2892
3028
|
runes: TRow[];
|
|
2893
3029
|
next_cursor: string | null;
|
|
@@ -2898,6 +3034,7 @@ type RunesEnvelope<TRow = IndexRuneEntry> = {
|
|
|
2898
3034
|
/** Present only when Runes data is not configured on this instance. */
|
|
2899
3035
|
notes?: string;
|
|
2900
3036
|
};
|
|
3037
|
+
/** Name search, sort order, and paging for listing runes. */
|
|
2901
3038
|
type RunesListParams = {
|
|
2902
3039
|
/** Name prefix, spacers and case ignored (`dog` matches `DOG•GO•TO•THE•MOON`). */
|
|
2903
3040
|
search?: string;
|
|
@@ -2906,13 +3043,17 @@ type RunesListParams = {
|
|
|
2906
3043
|
cursor?: string | null;
|
|
2907
3044
|
limit?: number;
|
|
2908
3045
|
};
|
|
3046
|
+
/** One rune and the Bitcoin tip. */
|
|
2909
3047
|
type RuneEnvelope = {
|
|
2910
3048
|
rune: IndexRuneEntry;
|
|
2911
3049
|
tip: IndexBitcoinTip;
|
|
2912
3050
|
};
|
|
2913
3051
|
type IndexRuneEventKind = "rune_etch" | "rune_mint" | "rune_transfer" | "rune_burn";
|
|
2914
|
-
/**
|
|
2915
|
-
*
|
|
3052
|
+
/**
|
|
3053
|
+
* One rune etch, mint, transfer, or burn, with the rune's identity.
|
|
3054
|
+
*
|
|
3055
|
+
* The identity is embedded so an activity feed needs no second lookup to show a name.
|
|
3056
|
+
*/
|
|
2916
3057
|
type IndexRuneEvent = {
|
|
2917
3058
|
cursor: string;
|
|
2918
3059
|
block_height: number;
|
|
@@ -2927,6 +3068,7 @@ type IndexRuneEvent = {
|
|
|
2927
3068
|
address: string | null;
|
|
2928
3069
|
rune: IndexRuneRefSummary;
|
|
2929
3070
|
};
|
|
3071
|
+
/** One page of rune events, with the cursor, Bitcoin tip, and reorgs. */
|
|
2930
3072
|
type RuneActivityEnvelope<TRow = IndexRuneEvent> = {
|
|
2931
3073
|
events: TRow[];
|
|
2932
3074
|
next_cursor: string | null;
|
|
@@ -2934,6 +3076,7 @@ type RuneActivityEnvelope<TRow = IndexRuneEvent> = {
|
|
|
2934
3076
|
reorgs: IndexBtcReorg[];
|
|
2935
3077
|
notes?: string;
|
|
2936
3078
|
};
|
|
3079
|
+
/** Paging and height filters for listing rune events. */
|
|
2937
3080
|
type RuneActivityListParams = {
|
|
2938
3081
|
cursor?: string | null;
|
|
2939
3082
|
fromCursor?: string | null;
|
|
@@ -2945,6 +3088,7 @@ type RuneActivityListParams = {
|
|
|
2945
3088
|
kind?: readonly IndexRuneEventKind[];
|
|
2946
3089
|
txid?: string;
|
|
2947
3090
|
};
|
|
3091
|
+
/** `RuneActivityListParams` without `limit`, plus walk options. */
|
|
2948
3092
|
type RuneActivityWalkParams = Omit<RuneActivityListParams, "limit"> & WalkOptions;
|
|
2949
3093
|
/** A rune's balance on one unspent output, with the rune's identity embedded. */
|
|
2950
3094
|
type IndexRuneBalance = {
|
|
@@ -2956,6 +3100,7 @@ type IndexRuneBalance = {
|
|
|
2956
3100
|
/** u128 decimal string. Never `Number()`. */
|
|
2957
3101
|
amount: string;
|
|
2958
3102
|
};
|
|
3103
|
+
/** One page of rune balances, with the cursor and Bitcoin tip. */
|
|
2959
3104
|
type RuneBalancesEnvelope<TRow = IndexRuneBalance> = {
|
|
2960
3105
|
balances: TRow[];
|
|
2961
3106
|
next_cursor: string | null;
|
|
@@ -2964,8 +3109,11 @@ type RuneBalancesEnvelope<TRow = IndexRuneBalance> = {
|
|
|
2964
3109
|
reorgs: IndexBtcReorg[];
|
|
2965
3110
|
notes?: string;
|
|
2966
3111
|
};
|
|
2967
|
-
/**
|
|
2968
|
-
*
|
|
3112
|
+
/**
|
|
3113
|
+
* Rune balance filters; exactly one of `address` or `outpoint`.
|
|
3114
|
+
*
|
|
3115
|
+
* Enforced at the type level, not just at runtime.
|
|
3116
|
+
*/
|
|
2969
3117
|
type RuneBalancesListParams = ({
|
|
2970
3118
|
address: string;
|
|
2971
3119
|
outpoint?: never;
|
|
@@ -3129,9 +3277,12 @@ type IndexEventTypeFilters = {
|
|
|
3129
3277
|
equality_filters?: string[];
|
|
3130
3278
|
required_non_null?: string[];
|
|
3131
3279
|
};
|
|
3132
|
-
/**
|
|
3133
|
-
*
|
|
3134
|
-
*
|
|
3280
|
+
/**
|
|
3281
|
+
* The `GET /v1/index` discovery doc: live endpoints and filter vocabulary.
|
|
3282
|
+
*
|
|
3283
|
+
* Shape is intentionally open (the server may add fields); the agent-relevant
|
|
3284
|
+
* parts are the per-type filter rules.
|
|
3285
|
+
*/
|
|
3135
3286
|
type IndexDiscovery = {
|
|
3136
3287
|
event_type_filters?: Record<string, IndexEventTypeFilters>;
|
|
3137
3288
|
[key: string]: unknown;
|
|
@@ -3507,10 +3658,11 @@ interface ContextField<T> {
|
|
|
3507
3658
|
error?: ContextFieldError;
|
|
3508
3659
|
}
|
|
3509
3660
|
/**
|
|
3510
|
-
* A point-in-time orientation snapshot
|
|
3511
|
-
*
|
|
3512
|
-
*
|
|
3513
|
-
* catching up) instead of a bare
|
|
3661
|
+
* A point-in-time orientation snapshot: live tips and what this instance holds.
|
|
3662
|
+
*
|
|
3663
|
+
* Every field is a `ContextField`, so a missing value says why it is missing
|
|
3664
|
+
* (API unreachable, token rejected, index still catching up) instead of a bare
|
|
3665
|
+
* `null`. `context()` itself never throws.
|
|
3514
3666
|
*/
|
|
3515
3667
|
interface ContextSnapshot {
|
|
3516
3668
|
/** Token identity from `/api/accounts/me`. A self-hosted instance has no
|