@secondlayer/sdk 13.1.0 → 14.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -0
- package/dist/index.d.ts +466 -65
- package/dist/index.js +157 -49
- package/dist/index.js.map +9 -9
- package/dist/streams/index.d.ts +220 -43
- package/dist/streams/index.js +116 -49
- package/dist/streams/index.js.map +7 -7
- package/dist/subgraphs/index.d.ts +462 -62
- package/dist/subgraphs/index.js +156 -49
- package/dist/subgraphs/index.js.map +6 -6
- package/package.json +4 -4
package/dist/streams/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VmEventType } from "@secondlayer/shared";
|
|
2
|
-
import { STREAMS_EVENT_TYPES, StreamsEvent, StreamsEventType, StreamsWireEvent, VmStreamsEvent } from "@secondlayer/shared/streams-rows";
|
|
2
|
+
import { RuneEventType, RuneStreamsEvent, STREAMS_EVENT_TYPES, StreamsEvent, StreamsEventType, StreamsWireEvent, VmStreamsEvent } from "@secondlayer/shared/streams-rows";
|
|
3
3
|
/**
|
|
4
4
|
* A consumer sink: the destination adapter a consume loop writes through.
|
|
5
5
|
*
|
|
@@ -250,7 +250,7 @@ type IndexMapDelete = IndexEventBase & {
|
|
|
250
250
|
};
|
|
251
251
|
/** Decoded chain event, discriminated by `event_type`. */
|
|
252
252
|
type IndexEvent = IndexFtTransfer | IndexNftTransfer | IndexStxTransfer | IndexStxMint | IndexStxBurn | IndexStxLock | IndexFtMint | IndexFtBurn | IndexNftMint | IndexNftBurn | IndexPrint | IndexNestedContractCall | IndexVarSet | IndexMapSet | IndexMapInsert | IndexMapDelete;
|
|
253
|
-
import { StreamsWireEvent as StreamsWireEvent2, StreamsEventPayload } from "@secondlayer/shared/streams-rows";
|
|
253
|
+
import { StreamsWireEvent as StreamsWireEvent2, RuneEtchEntry, RuneEventPayload, StreamsEventPayload } from "@secondlayer/shared/streams-rows";
|
|
254
254
|
type StreamsTip = {
|
|
255
255
|
block_height: number;
|
|
256
256
|
block_hash: string;
|
|
@@ -270,6 +270,15 @@ type StreamsTip = {
|
|
|
270
270
|
/** Oldest seekable cursor (`<oldest_seekable_height>:0`); `null` = unlimited. */
|
|
271
271
|
oldest_cursor?: string | null;
|
|
272
272
|
};
|
|
273
|
+
/** `chain=bitcoin` tip (plan 059) — no `burn_block_height`/retention fields,
|
|
274
|
+
* since Bitcoin has no burn chain of its own and Runes reads have no
|
|
275
|
+
* retention ladder. Returned by `tip({ chain: "bitcoin" })`. */
|
|
276
|
+
type StreamsBitcoinTip = {
|
|
277
|
+
block_height: number;
|
|
278
|
+
block_hash: string;
|
|
279
|
+
finalized_height: number;
|
|
280
|
+
lag_seconds: number;
|
|
281
|
+
};
|
|
273
282
|
type StreamsCanonicalBlock = {
|
|
274
283
|
block_height: number;
|
|
275
284
|
block_hash: string;
|
|
@@ -277,6 +286,12 @@ type StreamsCanonicalBlock = {
|
|
|
277
286
|
burn_block_hash: string | null;
|
|
278
287
|
is_canonical: true;
|
|
279
288
|
};
|
|
289
|
+
/** `chain=bitcoin` canonical block (plan 059) — no burn-chain fields. */
|
|
290
|
+
type StreamsBitcoinCanonicalBlock = {
|
|
291
|
+
block_height: number;
|
|
292
|
+
block_hash: string;
|
|
293
|
+
is_canonical: true;
|
|
294
|
+
};
|
|
280
295
|
type StreamsReorg = {
|
|
281
296
|
detected_at: string;
|
|
282
297
|
fork_point_height: number;
|
|
@@ -292,13 +307,19 @@ type StreamsReorg = {
|
|
|
292
307
|
*/
|
|
293
308
|
new_canonical_tip: string;
|
|
294
309
|
};
|
|
295
|
-
type StreamsEventsEnvelope<
|
|
310
|
+
type StreamsEventsEnvelope<
|
|
311
|
+
TEvent = StreamsEvent,
|
|
312
|
+
TTip = StreamsTip
|
|
313
|
+
> = {
|
|
296
314
|
events: TEvent[];
|
|
297
315
|
next_cursor: string | null;
|
|
298
|
-
tip:
|
|
316
|
+
tip: TTip;
|
|
299
317
|
reorgs: StreamsReorg[];
|
|
300
318
|
};
|
|
301
|
-
type StreamsEventsListEnvelope
|
|
319
|
+
type StreamsEventsListEnvelope<
|
|
320
|
+
TEvent = StreamsEvent,
|
|
321
|
+
TTip = StreamsTip
|
|
322
|
+
> = Omit<StreamsEventsEnvelope<TEvent, TTip>, "next_cursor">;
|
|
302
323
|
/** The StreamsEvent union narrowed to a `types` selection — what a
|
|
303
324
|
* const-generic `types: ["ft_transfer"]` buys at the type level. */
|
|
304
325
|
type StreamsEventOfTypes<T extends readonly StreamsEventType[]> = Extract<StreamsEvent, {
|
|
@@ -342,10 +363,16 @@ type StreamsEventForFilter<
|
|
|
342
363
|
}> : Extract<StreamsEvent, {
|
|
343
364
|
event_type: T;
|
|
344
365
|
}> : D extends true ? IndexEvent : StreamsEvent;
|
|
345
|
-
type
|
|
366
|
+
type StreamsEventsListParamsCommon = {
|
|
346
367
|
cursor?: string | null;
|
|
347
368
|
fromHeight?: number;
|
|
348
369
|
toHeight?: number;
|
|
370
|
+
limit?: number;
|
|
371
|
+
};
|
|
372
|
+
/** `chain: "stacks"` (default, omit `chain` entirely) — unchanged since
|
|
373
|
+
* before plan 059. */
|
|
374
|
+
type StreamsEventsStacksListParams = StreamsEventsListParamsCommon & {
|
|
375
|
+
chain?: "stacks";
|
|
349
376
|
/** `vm` reads ordinal. Omit for Streams 1.0. */
|
|
350
377
|
clock?: "classic" | "vm";
|
|
351
378
|
types?: readonly (StreamsEventType | VmEventType)[];
|
|
@@ -361,27 +388,37 @@ type StreamsEventsListParams = {
|
|
|
361
388
|
* unrelated concerns share one page, one cursor, one checkpoint.
|
|
362
389
|
*/
|
|
363
390
|
filters?: StreamsFilterMap;
|
|
364
|
-
limit?: number;
|
|
365
391
|
};
|
|
366
|
-
|
|
392
|
+
/**
|
|
393
|
+
* `chain: "bitcoin"` (plan 059) — Runes events, own cursor space. `types` is
|
|
394
|
+
* restricted to {@link RuneEventType} at the type level, so e.g.
|
|
395
|
+
* `{ chain: "bitcoin", types: ["ft_transfer"] }` is a compile error rather
|
|
396
|
+
* than a silent 400 at request time. `contractId`/`sender`/`recipient`/
|
|
397
|
+
* `assetIdentifier`/`filters`/`clock` don't exist on this branch — they're
|
|
398
|
+
* Stacks-only (the server 400s on them too).
|
|
399
|
+
*/
|
|
400
|
+
type StreamsEventsBitcoinListParams = StreamsEventsListParamsCommon & {
|
|
401
|
+
chain: "bitcoin";
|
|
402
|
+
types?: readonly RuneEventType[];
|
|
403
|
+
notTypes?: readonly RuneEventType[];
|
|
404
|
+
/** A RuneRef: an id (`840000:3`) or a name (`DOG•GO•TO•THE•MOON`). */
|
|
405
|
+
rune?: string;
|
|
406
|
+
/** A mainnet address. */
|
|
407
|
+
address?: string;
|
|
408
|
+
};
|
|
409
|
+
type StreamsEventsListParams = StreamsEventsStacksListParams | StreamsEventsBitcoinListParams;
|
|
410
|
+
type StreamsEventsStreamCommon = {
|
|
367
411
|
fromCursor?: string | null;
|
|
368
|
-
types?: readonly StreamsEventType[];
|
|
369
|
-
notTypes?: readonly StreamsEventType[];
|
|
370
|
-
contractId?: StreamsFilterValue;
|
|
371
|
-
sender?: StreamsFilterValue;
|
|
372
|
-
recipient?: StreamsFilterValue;
|
|
373
|
-
assetIdentifier?: string;
|
|
374
|
-
/** Labelled filter groups; see {@link StreamsEventsListParams.filters}. */
|
|
375
|
-
filters?: StreamsFilterMap;
|
|
376
412
|
batchSize?: number;
|
|
377
413
|
emptyBackoffMs?: number;
|
|
378
414
|
maxPages?: number;
|
|
379
415
|
maxEmptyPolls?: number;
|
|
380
416
|
signal?: AbortSignal;
|
|
381
417
|
};
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
418
|
+
/** `chain: "stacks"` (default, omit `chain` entirely) — matches
|
|
419
|
+
* {@link StreamsEventsStacksListParams}. */
|
|
420
|
+
type StreamsEventsStreamStacksParams = StreamsEventsStreamCommon & {
|
|
421
|
+
chain?: "stacks";
|
|
385
422
|
types?: readonly StreamsEventType[];
|
|
386
423
|
notTypes?: readonly StreamsEventType[];
|
|
387
424
|
contractId?: StreamsFilterValue;
|
|
@@ -390,15 +427,28 @@ type StreamsEventsSubscribeParams = {
|
|
|
390
427
|
assetIdentifier?: string;
|
|
391
428
|
/** Labelled filter groups; see {@link StreamsEventsListParams.filters}. */
|
|
392
429
|
filters?: StreamsFilterMap;
|
|
430
|
+
};
|
|
431
|
+
/** `chain: "bitcoin"` (plan 059/061) — Runes events, tailed the same way as
|
|
432
|
+
* the Stacks default. `types` is restricted to {@link RuneEventType} at the
|
|
433
|
+
* type level, matching {@link StreamsEventsBitcoinListParams}.
|
|
434
|
+
* `contractId`/`sender`/`recipient`/`assetIdentifier`/`filters` don't exist
|
|
435
|
+
* on this branch — they're Stacks-only. */
|
|
436
|
+
type StreamsEventsStreamBitcoinParams = StreamsEventsStreamCommon & {
|
|
437
|
+
chain: "bitcoin";
|
|
438
|
+
types?: readonly RuneEventType[];
|
|
439
|
+
notTypes?: readonly RuneEventType[];
|
|
440
|
+
/** A RuneRef: an id (`840000:3`) or a name (`DOG•GO•TO•THE•MOON`). */
|
|
441
|
+
rune?: string;
|
|
442
|
+
/** A mainnet address. */
|
|
443
|
+
address?: string;
|
|
444
|
+
};
|
|
445
|
+
type StreamsEventsStreamParams = StreamsEventsStreamStacksParams | StreamsEventsStreamBitcoinParams;
|
|
446
|
+
type StreamsEventsSubscribeCommon = {
|
|
447
|
+
/** Resume strictly after this cursor; omit to live-tail from the tip. */
|
|
448
|
+
fromCursor?: string | null;
|
|
393
449
|
/** Abort to unsubscribe (the returned function does the same). */
|
|
394
450
|
signal?: AbortSignal;
|
|
395
451
|
/**
|
|
396
|
-
* Called for each pushed event, in order. The resume cursor advances only
|
|
397
|
-
* after this resolves, so a handler that throws sees the same event again
|
|
398
|
-
* on reconnect (at-least-once). Key durable writes by `cursor`.
|
|
399
|
-
*/
|
|
400
|
-
onEvent: (event: StreamsEvent) => void | Promise<void>;
|
|
401
|
-
/**
|
|
402
452
|
* Called on every failure. Transport errors (dropped socket, 5xx, 429, a
|
|
403
453
|
* stale connection, a throwing handler) reconnect from the last handled
|
|
404
454
|
* cursor with exponential backoff. Errors that a retry cannot fix (401,
|
|
@@ -418,6 +468,38 @@ type StreamsEventsSubscribeParams = {
|
|
|
418
468
|
*/
|
|
419
469
|
staleAfterMs?: number;
|
|
420
470
|
};
|
|
471
|
+
/** `chain: "stacks"` (default, omit `chain` entirely). */
|
|
472
|
+
type StreamsEventsSubscribeStacksParams = StreamsEventsSubscribeCommon & {
|
|
473
|
+
chain?: "stacks";
|
|
474
|
+
types?: readonly StreamsEventType[];
|
|
475
|
+
notTypes?: readonly StreamsEventType[];
|
|
476
|
+
contractId?: StreamsFilterValue;
|
|
477
|
+
sender?: StreamsFilterValue;
|
|
478
|
+
recipient?: StreamsFilterValue;
|
|
479
|
+
assetIdentifier?: string;
|
|
480
|
+
/** Labelled filter groups; see {@link StreamsEventsListParams.filters}. */
|
|
481
|
+
filters?: StreamsFilterMap;
|
|
482
|
+
/**
|
|
483
|
+
* Called for each pushed event, in order. The resume cursor advances only
|
|
484
|
+
* after this resolves, so a handler that throws sees the same event again
|
|
485
|
+
* on reconnect (at-least-once). Key durable writes by `cursor`.
|
|
486
|
+
*/
|
|
487
|
+
onEvent: (event: StreamsEvent) => void | Promise<void>;
|
|
488
|
+
};
|
|
489
|
+
/** `chain: "bitcoin"` (plan 059/061) — Runes events pushed live, on their own
|
|
490
|
+
* cursor space. `contractId`/`sender`/`recipient`/`assetIdentifier`/`filters`
|
|
491
|
+
* don't exist on this branch — they're Stacks-only. */
|
|
492
|
+
type StreamsEventsSubscribeBitcoinParams = StreamsEventsSubscribeCommon & {
|
|
493
|
+
chain: "bitcoin";
|
|
494
|
+
types?: readonly RuneEventType[];
|
|
495
|
+
notTypes?: readonly RuneEventType[];
|
|
496
|
+
/** A RuneRef: an id (`840000:3`) or a name (`DOG•GO•TO•THE•MOON`). */
|
|
497
|
+
rune?: string;
|
|
498
|
+
/** A mainnet address. */
|
|
499
|
+
address?: string;
|
|
500
|
+
onEvent: (event: RuneStreamsEvent) => void | Promise<void>;
|
|
501
|
+
};
|
|
502
|
+
type StreamsEventsSubscribeParams = StreamsEventsSubscribeStacksParams | StreamsEventsSubscribeBitcoinParams;
|
|
421
503
|
/**
|
|
422
504
|
* Handle for a live subscription: call it to unsubscribe. `done` resolves
|
|
423
505
|
* after unsubscribe (or the signal aborting) and rejects with the error that
|
|
@@ -502,6 +584,10 @@ type StreamsEventsConsumeParams<
|
|
|
502
584
|
D extends boolean = false,
|
|
503
585
|
F extends StreamsFilterMap = Record<never, never>
|
|
504
586
|
> = {
|
|
587
|
+
/** `chain: "stacks"` (default, omit `chain` entirely) — the bitcoin branch
|
|
588
|
+
* is {@link StreamsEventsConsumeBitcoinParams}, a separate overload with
|
|
589
|
+
* no `filters`/`on`/`decoded` (Stacks-only concepts). */
|
|
590
|
+
chain?: "stacks";
|
|
505
591
|
fromCursor?: string | null;
|
|
506
592
|
/**
|
|
507
593
|
* Deliver events pre-decoded as the flat, `event_type`-discriminated rows
|
|
@@ -610,22 +696,74 @@ type StreamsEventsConsumeParams<
|
|
|
610
696
|
wake?: () => Promise<void>;
|
|
611
697
|
};
|
|
612
698
|
/**
|
|
699
|
+
* `chain: "bitcoin"` (plan 059/061) — the checkpointed sweep over Runes
|
|
700
|
+
* events. A separate, simpler type from {@link StreamsEventsConsumeParams}
|
|
701
|
+
* rather than a widened union member: `filters`/`on`/`decoded` are Stacks-only
|
|
702
|
+
* concepts (labelled OR-groups and Index-shaped projection have no Runes
|
|
703
|
+
* equivalent yet), so `onBatch` is the only way in and is required. Reorg
|
|
704
|
+
* rewind still works the same way (bitcoin reorgs carry the same
|
|
705
|
+
* `fork_point_height` + `new_canonical_tip` shape as Stacks ones).
|
|
706
|
+
*/
|
|
707
|
+
type StreamsEventsConsumeBitcoinParams<TTx = never> = {
|
|
708
|
+
chain: "bitcoin";
|
|
709
|
+
fromCursor?: string | null;
|
|
710
|
+
sink?: ConsumerSink<TTx>;
|
|
711
|
+
onProgress?: (ctx: ConsumerBatchContext) => void;
|
|
712
|
+
mode?: "tail" | "bounded";
|
|
713
|
+
finalizedOnly?: boolean;
|
|
714
|
+
types?: readonly RuneEventType[];
|
|
715
|
+
notTypes?: readonly RuneEventType[];
|
|
716
|
+
/** A RuneRef: an id (`840000:3`) or a name (`DOG•GO•TO•THE•MOON`). */
|
|
717
|
+
rune?: string;
|
|
718
|
+
/** A mainnet address. */
|
|
719
|
+
address?: string;
|
|
720
|
+
batchSize?: number;
|
|
721
|
+
onBatch: (events: RuneStreamsEvent[], envelope: StreamsEventsEnvelope<RuneStreamsEvent, StreamsBitcoinTip>, ctx: StreamsBatchContext & WithSinkTx<TTx>) => void | string | null | undefined | Promise<void> | Promise<string | null | undefined>;
|
|
722
|
+
onReorg?: (reorg: StreamsReorg, ctx: StreamsReorgContext) => Promise<void> | void;
|
|
723
|
+
maxRollbackDepth?: number;
|
|
724
|
+
retryCount?: number;
|
|
725
|
+
retryDelay?: number;
|
|
726
|
+
onError?: (err: unknown, ctx: {
|
|
727
|
+
attempt: number;
|
|
728
|
+
retriesLeft: number;
|
|
729
|
+
delayMs: number;
|
|
730
|
+
}) => void;
|
|
731
|
+
emptyBackoffMs?: number;
|
|
732
|
+
maxPages?: number;
|
|
733
|
+
maxEmptyPolls?: number;
|
|
734
|
+
signal?: AbortSignal;
|
|
735
|
+
wake?: () => Promise<void>;
|
|
736
|
+
};
|
|
737
|
+
/**
|
|
613
738
|
* One yielded page from {@link StreamsClient.consume} — the
|
|
614
739
|
* `GET /v1/streams/events` envelope verbatim, with `next_cursor` renamed to
|
|
615
740
|
* `cursor` (the checkpoint to persist and resume from).
|
|
616
741
|
*/
|
|
617
|
-
type StreamsBatch<
|
|
742
|
+
type StreamsBatch<
|
|
743
|
+
TEvent = StreamsEvent,
|
|
744
|
+
TTip = StreamsTip
|
|
745
|
+
> = {
|
|
618
746
|
/** Canonical events of this page, in cursor order. */
|
|
619
747
|
events: TEvent[];
|
|
620
748
|
/** Checkpoint after this page — pass back as `consume({ cursor })` to resume. */
|
|
621
749
|
cursor: string | null;
|
|
622
|
-
tip:
|
|
750
|
+
tip: TTip;
|
|
623
751
|
/** Chain reorgs reported alongside this page; empty when none. */
|
|
624
752
|
reorgs: StreamsReorg[];
|
|
625
753
|
};
|
|
626
|
-
type
|
|
754
|
+
type StreamsConsumeCommon = {
|
|
627
755
|
/** Resume strictly after this cursor; omit to start from the oldest seekable page. */
|
|
628
756
|
cursor?: string | null;
|
|
757
|
+
/** Events per page (the `limit` query param). Default 100. */
|
|
758
|
+
batchSize?: number;
|
|
759
|
+
/** Poll interval while caught up at the tip, in ms. Default 2000. */
|
|
760
|
+
intervalMs?: number;
|
|
761
|
+
/** Abort to end the iteration. */
|
|
762
|
+
signal?: AbortSignal;
|
|
763
|
+
};
|
|
764
|
+
/** `chain: "stacks"` (default, omit `chain` entirely). */
|
|
765
|
+
type StreamsConsumeStacksParams = StreamsConsumeCommon & {
|
|
766
|
+
chain?: "stacks";
|
|
629
767
|
types?: readonly StreamsEventType[];
|
|
630
768
|
notTypes?: readonly StreamsEventType[];
|
|
631
769
|
contractId?: StreamsFilterValue;
|
|
@@ -635,13 +773,20 @@ type StreamsConsumeParams = {
|
|
|
635
773
|
/** Labelled OR-groups — same semantics as `events.consume`; each returned
|
|
636
774
|
* event echoes the labels it matched. */
|
|
637
775
|
filters?: StreamsFilterMap;
|
|
638
|
-
/** Events per page (the `limit` query param). Default 100. */
|
|
639
|
-
batchSize?: number;
|
|
640
|
-
/** Poll interval while caught up at the tip, in ms. Default 2000. */
|
|
641
|
-
intervalMs?: number;
|
|
642
|
-
/** Abort to end the iteration. */
|
|
643
|
-
signal?: AbortSignal;
|
|
644
776
|
};
|
|
777
|
+
/** `chain: "bitcoin"` (plan 059/061) — Runes batches, own cursor space.
|
|
778
|
+
* `contractId`/`sender`/`recipient`/`assetIdentifier`/`filters` don't exist
|
|
779
|
+
* on this branch — they're Stacks-only. */
|
|
780
|
+
type StreamsConsumeBitcoinParams = StreamsConsumeCommon & {
|
|
781
|
+
chain: "bitcoin";
|
|
782
|
+
types?: readonly RuneEventType[];
|
|
783
|
+
notTypes?: readonly RuneEventType[];
|
|
784
|
+
/** A RuneRef: an id (`840000:3`) or a name (`DOG•GO•TO•THE•MOON`). */
|
|
785
|
+
rune?: string;
|
|
786
|
+
/** A mainnet address. */
|
|
787
|
+
address?: string;
|
|
788
|
+
};
|
|
789
|
+
type StreamsConsumeParams = StreamsConsumeStacksParams | StreamsConsumeBitcoinParams;
|
|
645
790
|
type StreamsEventsConsumeResult = {
|
|
646
791
|
cursor: string | null;
|
|
647
792
|
pages: number;
|
|
@@ -746,33 +891,44 @@ type StreamsClient = {
|
|
|
746
891
|
* rewound automatically — use `events.consume` with `onReorg` for managed
|
|
747
892
|
* rollback semantics.
|
|
748
893
|
*/
|
|
894
|
+
/** `chain: "bitcoin"` — batches carry Runes rows only, on the bitcoin tip
|
|
895
|
+
* shape (plan 059/061). */
|
|
896
|
+
consume(params: StreamsConsumeBitcoinParams): AsyncIterableIterator<StreamsBatch<RuneStreamsEvent, StreamsBitcoinTip>>;
|
|
749
897
|
/** Narrowing overload: a literal `types` array narrows every batch's
|
|
750
898
|
* event union to exactly those members. */
|
|
751
|
-
consume<const T extends readonly StreamsEventType[]>(params:
|
|
899
|
+
consume<const T extends readonly StreamsEventType[]>(params: StreamsConsumeStacksParams & {
|
|
752
900
|
types: T;
|
|
753
901
|
}): AsyncIterableIterator<StreamsBatch<StreamsEventOfTypes<T>>>;
|
|
754
902
|
consume(params?: StreamsConsumeParams): AsyncIterableIterator<StreamsBatch>;
|
|
755
903
|
events: {
|
|
756
904
|
/** `clock: "vm"` pages carry vm rows only (a parallel vocabulary,
|
|
757
|
-
* `event_index` = `ordinal`). Never `StreamsEvent`.
|
|
758
|
-
|
|
905
|
+
* `event_index` = `ordinal`). Never `StreamsEvent`. Stacks-only —
|
|
906
|
+
* `chain: "bitcoin"` has no `clock`. */
|
|
907
|
+
list(params: StreamsEventsStacksListParams & {
|
|
759
908
|
clock: "vm";
|
|
760
909
|
}): Promise<StreamsEventsEnvelope<VmStreamsEvent>>;
|
|
761
910
|
/** Narrowing overload, matching `consume`. Classic clock only —
|
|
762
911
|
* `clock: "vm"` is overload 1, and a general `StreamsEventsListParams`
|
|
763
912
|
* variable (clock unresolved) is the wire-union fallback. */
|
|
764
|
-
list<const T extends readonly StreamsEventType[]>(params: Omit<
|
|
913
|
+
list<const T extends readonly StreamsEventType[]>(params: Omit<StreamsEventsStacksListParams, "clock" | "types" | "notTypes"> & {
|
|
765
914
|
types: T;
|
|
766
915
|
notTypes?: readonly StreamsEventType[];
|
|
767
916
|
clock?: "classic";
|
|
768
917
|
}): Promise<StreamsEventsEnvelope<StreamsEventOfTypes<T>>>;
|
|
769
|
-
list(params?: Omit<
|
|
918
|
+
list(params?: Omit<StreamsEventsStacksListParams, "clock" | "types" | "notTypes"> & {
|
|
770
919
|
types?: readonly StreamsEventType[];
|
|
771
920
|
notTypes?: readonly StreamsEventType[];
|
|
772
921
|
clock?: "classic";
|
|
773
922
|
}): Promise<StreamsEventsEnvelope>;
|
|
774
|
-
/**
|
|
923
|
+
/** `chain: "bitcoin"` pages carry Runes rows only, on the bitcoin tip
|
|
924
|
+
* shape (plan 059). */
|
|
925
|
+
list(params: StreamsEventsBitcoinListParams): Promise<StreamsEventsEnvelope<RuneStreamsEvent, StreamsBitcoinTip>>;
|
|
926
|
+
/** Unresolved `chain`/`clock` on a general params variable: the wire union. */
|
|
775
927
|
list(params: StreamsEventsListParams): Promise<StreamsEventsEnvelope<StreamsWireEvent>>;
|
|
928
|
+
/** `chain: "bitcoin"` — Runes events for one transaction. */
|
|
929
|
+
byTxId(txId: string, opts: {
|
|
930
|
+
chain: "bitcoin";
|
|
931
|
+
}): Promise<StreamsEventsListEnvelope<RuneStreamsEvent, StreamsBitcoinTip>>;
|
|
776
932
|
byTxId(txId: string): Promise<StreamsEventsListEnvelope>;
|
|
777
933
|
/**
|
|
778
934
|
* Pull pages from Streams and call `onBatch` after each page.
|
|
@@ -783,6 +939,11 @@ type StreamsClient = {
|
|
|
783
939
|
* The consumer also exits when `maxPages`, `maxEmptyPolls`, or `signal`
|
|
784
940
|
* stops it.
|
|
785
941
|
*/
|
|
942
|
+
/** `chain: "bitcoin"` — the checkpointed sweep over Runes events; see
|
|
943
|
+
* {@link StreamsEventsConsumeBitcoinParams}. */
|
|
944
|
+
consume<TTx = never>(params: StreamsEventsConsumeBitcoinParams<TTx> & {
|
|
945
|
+
sink?: ConsumerSink<TTx>;
|
|
946
|
+
}): Promise<StreamsEventsConsumeResult>;
|
|
786
947
|
consume<
|
|
787
948
|
const F extends StreamsFilterMap = Record<never, never>,
|
|
788
949
|
TTx = never,
|
|
@@ -805,8 +966,10 @@ type StreamsClient = {
|
|
|
805
966
|
* indefinitely by default and stops when its `AbortSignal`, `maxPages`, or
|
|
806
967
|
* `maxEmptyPolls` stops it.
|
|
807
968
|
*/
|
|
969
|
+
/** `chain: "bitcoin"` — Runes events only (plan 059/061). */
|
|
970
|
+
stream(params: StreamsEventsStreamBitcoinParams): AsyncIterable<RuneStreamsEvent>;
|
|
808
971
|
/** Narrowing overload, matching `consume`. */
|
|
809
|
-
stream<const T extends readonly StreamsEventType[]>(params:
|
|
972
|
+
stream<const T extends readonly StreamsEventType[]>(params: StreamsEventsStreamStacksParams & {
|
|
810
973
|
types: T;
|
|
811
974
|
}): AsyncIterable<StreamsEventOfTypes<T>>;
|
|
812
975
|
stream(params?: StreamsEventsStreamParams): AsyncIterable<StreamsEvent>;
|
|
@@ -818,17 +981,31 @@ type StreamsClient = {
|
|
|
818
981
|
* settles when the loop ends. Not reorg-aware: an event delivered then
|
|
819
982
|
* orphaned is never retracted. Durable writers use `consume()`.
|
|
820
983
|
*/
|
|
821
|
-
|
|
984
|
+
/** `chain: "bitcoin"` — `onEvent` receives Runes rows (plan 059/061). */
|
|
985
|
+
subscribe(params: StreamsEventsSubscribeBitcoinParams): StreamsSubscription;
|
|
986
|
+
subscribe(params: StreamsEventsSubscribeStacksParams): StreamsSubscription;
|
|
822
987
|
};
|
|
823
988
|
blocks: {
|
|
989
|
+
events(heightOrHash: number | string, opts: {
|
|
990
|
+
chain: "bitcoin";
|
|
991
|
+
}): Promise<StreamsEventsListEnvelope<RuneStreamsEvent, StreamsBitcoinTip>>;
|
|
824
992
|
events(heightOrHash: number | string): Promise<StreamsEventsListEnvelope>;
|
|
825
993
|
};
|
|
826
994
|
reorgs: {
|
|
995
|
+
list(params: StreamsReorgsListParams & {
|
|
996
|
+
chain: "bitcoin";
|
|
997
|
+
}): Promise<StreamsReorgsListEnvelope>;
|
|
827
998
|
list(params: StreamsReorgsListParams): Promise<StreamsReorgsListEnvelope>;
|
|
828
999
|
};
|
|
829
1000
|
/** Bulk parquet dumps. Requires `dumpsBaseUrl` on the client. */
|
|
830
1001
|
dumps: StreamsDumps;
|
|
1002
|
+
canonical(height: number, opts: {
|
|
1003
|
+
chain: "bitcoin";
|
|
1004
|
+
}): Promise<StreamsBitcoinCanonicalBlock>;
|
|
831
1005
|
canonical(height: number): Promise<StreamsCanonicalBlock>;
|
|
1006
|
+
tip(opts: {
|
|
1007
|
+
chain: "bitcoin";
|
|
1008
|
+
}): Promise<StreamsBitcoinTip>;
|
|
832
1009
|
tip(): Promise<StreamsTip>;
|
|
833
1010
|
};
|
|
834
1011
|
type CreateStreamsClientOptions = {
|
|
@@ -1031,4 +1208,4 @@ declare const Cursor: {
|
|
|
1031
1208
|
eventIndex: number;
|
|
1032
1209
|
};
|
|
1033
1210
|
};
|
|
1034
|
-
export { AuthError, ConsumerBatchContext, Cursor, DecodedEventColumns, DecodedEventRow, DecodedFtBurn, DecodedFtBurnPayload, DecodedFtMint, DecodedFtMintPayload, DecodedFtTransfer, DecodedFtTransferPayload, DecodedNftBurn, DecodedNftBurnPayload, DecodedNftMint, DecodedNftMintPayload, DecodedNftTransfer, DecodedNftTransferPayload, DecodedPrint, DecodedPrintPayload, DecodedPrintValue, DecodedStxBurn, DecodedStxBurnPayload, DecodedStxLock, DecodedStxLockPayload, DecodedStxMint, DecodedStxMintPayload, DecodedStxTransfer, DecodedStxTransferPayload, FetchLike2 as FetchLike, FtTransferEvent, FtTransferPayload2 as FtTransferPayload, NftTransferEvent, NftTransferPayload2 as NftTransferPayload, RateLimitError, STREAMS_EVENT_TYPES, StreamsBatch, StreamsBatchContext, StreamsCanonicalBlock, StreamsClient, StreamsConsumeParams, StreamsDumpFile, StreamsDumps, StreamsDumpsManifest, StreamsEvent, StreamsEventPayload, StreamsEventType, StreamsEventsConsumeParams, StreamsEventsConsumeResult, StreamsEventsEnvelope, StreamsEventsListEnvelope, StreamsEventsListParams, StreamsEventsStreamParams, StreamsEventsSubscribeParams, StreamsReorg, StreamsReorgContext, StreamsReorgsListEnvelope, StreamsReorgsListParams, StreamsServerError, StreamsSignatureError, StreamsSubscription, StreamsTip, StreamsWireEvent2 as StreamsWireEvent, ValidationError, VmStreamsEvent, createStreamsClient, decode, decodeFtBurn, decodeFtMint, decodeFtTransfer, decodeNftBurn, decodeNftMint, decodeNftTransfer, decodePrint, decodeStxBurn, decodeStxLock, decodeStxMint, decodeStxTransfer, isFtBurn, isFtMint, isFtTransfer, isNftBurn, isNftMint, isNftTransfer, isPrint, isStxBurn, isStxLock, isStxMint, isStxTransfer };
|
|
1211
|
+
export { AuthError, ConsumerBatchContext, Cursor, DecodedEventColumns, DecodedEventRow, DecodedFtBurn, DecodedFtBurnPayload, DecodedFtMint, DecodedFtMintPayload, DecodedFtTransfer, DecodedFtTransferPayload, DecodedNftBurn, DecodedNftBurnPayload, DecodedNftMint, DecodedNftMintPayload, DecodedNftTransfer, DecodedNftTransferPayload, DecodedPrint, DecodedPrintPayload, DecodedPrintValue, DecodedStxBurn, DecodedStxBurnPayload, DecodedStxLock, DecodedStxLockPayload, DecodedStxMint, DecodedStxMintPayload, DecodedStxTransfer, DecodedStxTransferPayload, FetchLike2 as FetchLike, FtTransferEvent, FtTransferPayload2 as FtTransferPayload, NftTransferEvent, NftTransferPayload2 as NftTransferPayload, RateLimitError, RuneEtchEntry, RuneEventPayload, RuneEventType, RuneStreamsEvent, STREAMS_EVENT_TYPES, StreamsBatch, StreamsBatchContext, StreamsBitcoinCanonicalBlock, StreamsBitcoinTip, StreamsCanonicalBlock, StreamsClient, StreamsConsumeBitcoinParams, StreamsConsumeParams, StreamsConsumeStacksParams, StreamsDumpFile, StreamsDumps, StreamsDumpsManifest, StreamsEvent, StreamsEventPayload, StreamsEventType, StreamsEventsBitcoinListParams, StreamsEventsConsumeBitcoinParams, StreamsEventsConsumeParams, StreamsEventsConsumeResult, StreamsEventsEnvelope, StreamsEventsListEnvelope, StreamsEventsListParams, StreamsEventsStacksListParams, StreamsEventsStreamBitcoinParams, StreamsEventsStreamParams, StreamsEventsStreamStacksParams, StreamsEventsSubscribeBitcoinParams, StreamsEventsSubscribeParams, StreamsEventsSubscribeStacksParams, StreamsReorg, StreamsReorgContext, StreamsReorgsListEnvelope, StreamsReorgsListParams, StreamsServerError, StreamsSignatureError, StreamsSubscription, StreamsTip, StreamsWireEvent2 as StreamsWireEvent, ValidationError, VmStreamsEvent, createStreamsClient, decode, decodeFtBurn, decodeFtMint, decodeFtTransfer, decodeNftBurn, decodeNftMint, decodeNftTransfer, decodePrint, decodeStxBurn, decodeStxLock, decodeStxMint, decodeStxTransfer, isFtBurn, isFtMint, isFtTransfer, isNftBurn, isNftMint, isNftTransfer, isPrint, isStxBurn, isStxLock, isStxMint, isStxTransfer };
|