@secondlayer/sdk 10.4.1 → 10.4.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.
@@ -582,7 +582,8 @@ interface ConsumerSink<Tx = unknown> {
582
582
  type WithSinkTx<TTx> = [TTx] extends [never] ? unknown : {
583
583
  tx: TTx;
584
584
  };
585
- import { StreamsEvent, StreamsEventType } from "@secondlayer/shared/streams-rows";
585
+ import { VmEventType } from "@secondlayer/shared";
586
+ import { StreamsEvent, StreamsEventType, StreamsWireEvent, VmStreamsEvent } from "@secondlayer/shared/streams-rows";
586
587
  type StreamsTip = {
587
588
  block_height: number;
588
589
  block_hash: string;
@@ -678,9 +679,11 @@ type StreamsEventsListParams = {
678
679
  cursor?: string | null;
679
680
  fromHeight?: number;
680
681
  toHeight?: number;
681
- types?: readonly StreamsEventType[];
682
+ /** `vm` reads ordinal. Omit for Streams 1.0. */
683
+ clock?: "classic" | "vm";
684
+ types?: readonly (StreamsEventType | VmEventType)[];
682
685
  /** Event types to exclude (applied after `types`). */
683
- notTypes?: readonly StreamsEventType[];
686
+ notTypes?: readonly (StreamsEventType | VmEventType)[];
684
687
  contractId?: StreamsFilterValue;
685
688
  sender?: StreamsFilterValue;
686
689
  recipient?: StreamsFilterValue;
@@ -1071,11 +1074,26 @@ type StreamsClient = {
1071
1074
  }): AsyncIterableIterator<StreamsBatch<StreamsEventOfTypes<T>>>;
1072
1075
  consume(params?: StreamsConsumeParams): AsyncIterableIterator<StreamsBatch>;
1073
1076
  events: {
1074
- /** Narrowing overload, matching `consume`. */
1075
- list<const T extends readonly StreamsEventType[]>(params: StreamsEventsListParams & {
1077
+ /** `clock: "vm"` pages carry vm rows only (a parallel vocabulary,
1078
+ * `event_index` = `ordinal`). Never `StreamsEvent`. */
1079
+ list(params: StreamsEventsListParams & {
1080
+ clock: "vm";
1081
+ }): Promise<StreamsEventsEnvelope<VmStreamsEvent>>;
1082
+ /** Narrowing overload, matching `consume`. Classic clock only —
1083
+ * `clock: "vm"` is overload 1, and a general `StreamsEventsListParams`
1084
+ * variable (clock unresolved) is the wire-union fallback. */
1085
+ list<const T extends readonly StreamsEventType[]>(params: Omit<StreamsEventsListParams, "clock" | "types" | "notTypes"> & {
1076
1086
  types: T;
1087
+ notTypes?: readonly StreamsEventType[];
1088
+ clock?: "classic";
1077
1089
  }): Promise<StreamsEventsEnvelope<StreamsEventOfTypes<T>>>;
1078
- list(params?: StreamsEventsListParams): Promise<StreamsEventsEnvelope>;
1090
+ list(params?: Omit<StreamsEventsListParams, "clock" | "types" | "notTypes"> & {
1091
+ types?: readonly StreamsEventType[];
1092
+ notTypes?: readonly StreamsEventType[];
1093
+ clock?: "classic";
1094
+ }): Promise<StreamsEventsEnvelope>;
1095
+ /** Unresolved `clock` on a general params variable: the wire union. */
1096
+ list(params: StreamsEventsListParams): Promise<StreamsEventsEnvelope<StreamsWireEvent>>;
1079
1097
  byTxId(txId: string): Promise<StreamsEventsListEnvelope>;
1080
1098
  /**
1081
1099
  * Pull pages from Streams and call `onBatch` after each page.
@@ -1450,8 +1468,38 @@ type IndexPrint = IndexEventBase & {
1450
1468
  raw_value: string | null;
1451
1469
  };
1452
1470
  };
1471
+ type IndexNestedContractCall = IndexEventBase & {
1472
+ event_type: "nested_contract_call";
1473
+ sender: string | null;
1474
+ caller: string;
1475
+ function_name: string;
1476
+ function_args: unknown;
1477
+ raw_result: string | null;
1478
+ };
1479
+ type IndexVarSet = IndexEventBase & {
1480
+ event_type: "var_set";
1481
+ var_name: string;
1482
+ raw_value: string;
1483
+ };
1484
+ type IndexMapSet = IndexEventBase & {
1485
+ event_type: "map_set";
1486
+ map: string;
1487
+ raw_key: string;
1488
+ raw_value: string;
1489
+ };
1490
+ type IndexMapInsert = IndexEventBase & {
1491
+ event_type: "map_insert";
1492
+ map: string;
1493
+ raw_key: string;
1494
+ raw_value: string;
1495
+ };
1496
+ type IndexMapDelete = IndexEventBase & {
1497
+ event_type: "map_delete";
1498
+ map: string;
1499
+ raw_key: string;
1500
+ };
1453
1501
  /** Decoded chain event, discriminated by `event_type`. */
1454
- type IndexEvent = IndexFtTransfer | IndexNftTransfer | IndexStxTransfer | IndexStxMint | IndexStxBurn | IndexStxLock | IndexFtMint | IndexFtBurn | IndexNftMint | IndexNftBurn | IndexPrint;
1502
+ type IndexEvent = IndexFtTransfer | IndexNftTransfer | IndexStxTransfer | IndexStxMint | IndexStxBurn | IndexStxLock | IndexFtMint | IndexFtBurn | IndexNftMint | IndexNftBurn | IndexPrint | IndexNestedContractCall | IndexVarSet | IndexMapSet | IndexMapInsert | IndexMapDelete;
1455
1503
  type IndexEventType = IndexEvent["event_type"];
1456
1504
  /** Fields every read returns regardless of `fields` — the consume contract
1457
1505
  * (`cursor`, `block_height`) plus the union discriminant. */
@@ -1476,8 +1524,7 @@ type IndexEventOf<T extends IndexEventType> = Extract<IndexEvent, {
1476
1524
  event_type: T;
1477
1525
  }>;
1478
1526
  type EventsListParams<T extends IndexEventType = IndexEventType> = {
1479
- /** Required. One of the decoded event types. Passing a literal narrows the
1480
- * rows every surface hands back to that event's own shape. */
1527
+ /** Decoded types or VM types (`nested_contract_call`, `map_set`, …). */
1481
1528
  eventType: T;
1482
1529
  cursor?: string | null;
1483
1530
  fromCursor?: string | null;
@@ -1488,6 +1535,12 @@ type EventsListParams<T extends IndexEventType = IndexEventType> = {
1488
1535
  assetIdentifier?: string;
1489
1536
  sender?: string;
1490
1537
  recipient?: string;
1538
+ functionName?: string;
1539
+ caller?: string;
1540
+ map?: string;
1541
+ varName?: string;
1542
+ /** Restrict to one transaction. */
1543
+ txId?: string;
1491
1544
  fromHeight?: number;
1492
1545
  toHeight?: number;
1493
1546
  /** Restrict to contracts conforming to a trait/standard (e.g. "sip-010").
@@ -1806,6 +1806,11 @@ class Index extends BaseClient {
1806
1806
  asset_identifier: params.assetIdentifier,
1807
1807
  sender: params.sender,
1808
1808
  recipient: params.recipient,
1809
+ function_name: params.functionName,
1810
+ caller: params.caller,
1811
+ map: params.map,
1812
+ var_name: params.varName,
1813
+ tx_id: params.txId,
1809
1814
  trait: params.trait,
1810
1815
  tx_context: params.txContext ? "true" : undefined
1811
1816
  })}`, undefined, { signal: params.signal });
@@ -2318,6 +2323,7 @@ function createStreamsClient(options) {
2318
2323
  asset_identifier: params.assetIdentifier,
2319
2324
  types: params.types,
2320
2325
  not_types: params.notTypes,
2326
+ clock: params.clock === "vm" ? "vm" : undefined,
2321
2327
  filters: encodeFilters(params.filters)
2322
2328
  })}`);
2323
2329
  }
@@ -2637,5 +2643,5 @@ export {
2637
2643
  Subgraphs
2638
2644
  };
2639
2645
 
2640
- //# debugId=EC50B5FEA0569DC264756E2164756E21
2646
+ //# debugId=B66CAEBD81B3C1B764756E2164756E21
2641
2647
  //# sourceMappingURL=index.js.map