@secondlayer/stacks 6.1.2 → 6.2.1

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.
Files changed (53) hide show
  1. package/dist/shared/{stacks-esm-qfzxhdqz.js → stacks-esm-1b2rhv6y.js} +2 -2
  2. package/dist/shared/{stacks-esm-snj9s2q8.js → stacks-esm-7n5wd5md.js} +3 -3
  3. package/dist/shared/stacks-esm-b54n1jdx.js.map +4 -4
  4. package/dist/shared/{stacks-esm-pxv6ny92.js → stacks-esm-exgw8j2j.js} +4 -4
  5. package/dist/shared/{stacks-esm-phgy8yqf.js → stacks-esm-p3zypwsw.js} +15 -3
  6. package/dist/shared/{stacks-esm-phgy8yqf.js.map → stacks-esm-p3zypwsw.js.map} +3 -3
  7. package/dist/shared/{stacks-esm-cmtj5vky.js → stacks-esm-pq0e379d.js} +2 -2
  8. package/dist/shared/{stacks-esm-ea4m4bk7.js → stacks-esm-xcd4sv1h.js} +3 -3
  9. package/dist/src/actions/index.cjs +13 -1
  10. package/dist/src/actions/index.cjs.map +3 -3
  11. package/dist/src/actions/index.js +5 -5
  12. package/dist/src/bns/index.cjs +13 -1
  13. package/dist/src/bns/index.cjs.map +3 -3
  14. package/dist/src/bns/index.js +5 -5
  15. package/dist/src/filters/index.cjs.map +4 -4
  16. package/dist/src/filters/index.d.cts +153 -17
  17. package/dist/src/filters/index.d.ts +153 -17
  18. package/dist/src/index.cjs +13 -1
  19. package/dist/src/index.cjs.map +6 -6
  20. package/dist/src/index.d.cts +133 -5
  21. package/dist/src/index.d.ts +133 -5
  22. package/dist/src/index.js +4 -4
  23. package/dist/src/postconditions/index.cjs +13 -1
  24. package/dist/src/postconditions/index.cjs.map +3 -3
  25. package/dist/src/postconditions/index.js +2 -2
  26. package/dist/src/pox/index.cjs +13 -1
  27. package/dist/src/pox/index.cjs.map +3 -3
  28. package/dist/src/pox/index.js +5 -5
  29. package/dist/src/pox5/index.cjs +13 -1
  30. package/dist/src/pox5/index.cjs.map +3 -3
  31. package/dist/src/pox5/index.js +4 -4
  32. package/dist/src/sbtc/index.cjs +13 -1
  33. package/dist/src/sbtc/index.cjs.map +3 -3
  34. package/dist/src/sbtc/index.js +4 -4
  35. package/dist/src/simnet/index.cjs +4 -2
  36. package/dist/src/simnet/index.cjs.map +3 -3
  37. package/dist/src/simnet/index.js +4 -2
  38. package/dist/src/simnet/index.js.map +3 -3
  39. package/dist/src/stackingdao/index.cjs +13 -1
  40. package/dist/src/stackingdao/index.cjs.map +3 -3
  41. package/dist/src/stackingdao/index.js +5 -5
  42. package/dist/src/transactions/index.cjs +15 -2
  43. package/dist/src/transactions/index.cjs.map +3 -3
  44. package/dist/src/transactions/index.d.cts +9 -1
  45. package/dist/src/transactions/index.d.ts +9 -1
  46. package/dist/src/transactions/index.js +7 -5
  47. package/dist/src/transactions/index.js.map +1 -1
  48. package/package.json +2 -1
  49. /package/dist/shared/{stacks-esm-qfzxhdqz.js.map → stacks-esm-1b2rhv6y.js.map} +0 -0
  50. /package/dist/shared/{stacks-esm-snj9s2q8.js.map → stacks-esm-7n5wd5md.js.map} +0 -0
  51. /package/dist/shared/{stacks-esm-pxv6ny92.js.map → stacks-esm-exgw8j2j.js.map} +0 -0
  52. /package/dist/shared/{stacks-esm-cmtj5vky.js.map → stacks-esm-pq0e379d.js.map} +0 -0
  53. /package/dist/shared/{stacks-esm-ea4m4bk7.js.map → stacks-esm-xcd4sv1h.js.map} +0 -0
@@ -1,3 +1,4 @@
1
+ /** The decoded event types. Index and Streams expose the same set. */
1
2
  declare const DECODED_EVENT_TYPES: readonly ["stx_transfer", "stx_mint", "stx_burn", "stx_lock", "ft_transfer", "ft_mint", "ft_burn", "nft_transfer", "nft_mint", "nft_burn", "print"];
2
3
  type DecodedEventType = (typeof DECODED_EVENT_TYPES)[number];
3
4
  /** Opt-in node vm_events, stored names. Parallel to DECODED_EVENT_TYPES — not
@@ -153,9 +154,12 @@ declare function assetId(value: string): AssetIdentifier;
153
154
  * Shares {@link parsePrincipal} with the ABI guards so the two surfaces can't
154
155
  * disagree about what a principal is. */
155
156
  declare function isPrincipal(value: string): value is Principal;
156
- /** Webhooks and Subgraph sources match `*` wildcards in
157
- * principal/identifier patterns; every
158
- * other surface treats the value literally. */
157
+ /**
158
+ * Tells whether a value contains a `*` wildcard.
159
+ *
160
+ * Webhooks and Subgraph sources match `*` wildcards in principal and
161
+ * identifier patterns; every other surface treats the value literally.
162
+ */
159
163
  declare function hasWildcard(value: string): boolean;
160
164
  /** Throw unless `value` is a principal or a wildcard pattern. The factories
161
165
  * call this so a swapped argument (asset id where a sender belongs, typo'd
@@ -439,11 +443,15 @@ type ChainEventFilter<
439
443
  type: T
440
444
  } = SpecFor<T>
441
445
  > = S & ProjectionsFor<T, S>;
442
- /** Build a canonical filter: validated spec + the projections its member
443
- * supports (methods are attached per member at runtime, matching the
444
- * type-level gating exactly). `const F` preserves field literals — a
445
- * `prints`/`abi` declaration keeps its exact type through
446
- * `toSubgraphSource()`, which is what feeds `defineSubgraph` narrowing. */
446
+ /**
447
+ * Builds a canonical filter from a member type and its fields.
448
+ *
449
+ * It validates the spec and attaches the projections its member supports.
450
+ * Methods are attached per member at runtime, matching the type-level gating
451
+ * exactly. `const F` preserves field literals, so a `prints` or `abi`
452
+ * declaration keeps its exact type through `toSubgraphSource()`, which is what
453
+ * feeds `defineSubgraph` narrowing.
454
+ */
447
455
  declare function makeChainEventFilter<
448
456
  T extends ChainEventFilterType,
449
457
  const F extends Omit<SpecFor<T>, "type">
@@ -451,10 +459,11 @@ declare function makeChainEventFilter<
451
459
  type: T
452
460
  } & F>;
453
461
  /**
454
- * Rehydrate a canonical filter from a subgraph-source-shaped object (the
455
- * inverse of `toSubgraphSource`). Powers migration and the round-trip
456
- * property gate: `toSubgraphSource(fromSubgraphSource(f))` must deep-equal
457
- * `f` for every production subgraph source.
462
+ * Rebuilds a canonical filter from a subgraph source object.
463
+ *
464
+ * It is the inverse of `toSubgraphSource`. It powers migration and the
465
+ * round-trip property gate: `toSubgraphSource(fromSubgraphSource(f))` must
466
+ * deep-equal `f` for every production subgraph source.
458
467
  */
459
468
  declare function fromSubgraphSource(source: SubgraphSourceSpec): ChainEventFilter<SubgraphMemberType>;
460
469
  type Fields<T extends ChainEventFilterType> = Omit<SpecFor<T>, "type">;
@@ -462,18 +471,74 @@ type Fields<T extends ChainEventFilterType> = Omit<SpecFor<T>, "type">;
462
471
  * annotation on exported values (an inferred object of generic factories
463
472
  * collapses to `{}` in the emitted declarations). */
464
473
  interface OnNamespace {
474
+ /**
475
+ * Matches STX transfers.
476
+ *
477
+ * @param fields The members of {@link StxTransferSpec}, without `type`.
478
+ */
465
479
  stxTransfer(fields?: Fields<"stx_transfer">): ChainEventFilter<"stx_transfer">;
480
+ /**
481
+ * Matches STX mints.
482
+ *
483
+ * @param fields The members of {@link StxMintSpec}, without `type`.
484
+ */
466
485
  stxMint(fields?: Fields<"stx_mint">): ChainEventFilter<"stx_mint">;
486
+ /**
487
+ * Matches STX burns.
488
+ *
489
+ * @param fields The members of {@link StxBurnSpec}, without `type`.
490
+ */
467
491
  stxBurn(fields?: Fields<"stx_burn">): ChainEventFilter<"stx_burn">;
492
+ /**
493
+ * Matches STX lock events.
494
+ *
495
+ * @param fields The members of {@link StxLockSpec}, without `type`.
496
+ */
468
497
  stxLock(fields?: Fields<"stx_lock">): ChainEventFilter<"stx_lock">;
498
+ /**
499
+ * Matches fungible token transfers.
500
+ *
501
+ * @param fields The members of {@link FtTransferSpec}, without `type`.
502
+ */
469
503
  ftTransfer(fields?: Fields<"ft_transfer">): ChainEventFilter<"ft_transfer">;
504
+ /**
505
+ * Matches fungible token mints.
506
+ *
507
+ * @param fields The members of {@link FtMintSpec}, without `type`.
508
+ */
470
509
  ftMint(fields?: Fields<"ft_mint">): ChainEventFilter<"ft_mint">;
510
+ /**
511
+ * Matches fungible token burns.
512
+ *
513
+ * @param fields The members of {@link FtBurnSpec}, without `type`.
514
+ */
471
515
  ftBurn(fields?: Fields<"ft_burn">): ChainEventFilter<"ft_burn">;
516
+ /**
517
+ * Matches NFT transfers.
518
+ *
519
+ * @param fields The members of {@link NftTransferSpec}, without `type`.
520
+ */
472
521
  nftTransfer(fields?: Fields<"nft_transfer">): ChainEventFilter<"nft_transfer">;
522
+ /**
523
+ * Matches NFT mints.
524
+ *
525
+ * @param fields The members of {@link NftMintSpec}, without `type`.
526
+ */
473
527
  nftMint(fields?: Fields<"nft_mint">): ChainEventFilter<"nft_mint">;
528
+ /**
529
+ * Matches NFT burns.
530
+ *
531
+ * @param fields The members of {@link NftBurnSpec}, without `type`.
532
+ */
474
533
  nftBurn(fields?: Fields<"nft_burn">): ChainEventFilter<"nft_burn">;
475
- /** `abi` literals are preserved (`const A`) so `toSubgraphSource()` keeps
476
- * typing `event.input` inside `defineSubgraph`. */
534
+ /**
535
+ * Matches contract calls.
536
+ *
537
+ * `abi` literals are preserved (`const A`), so `toSubgraphSource()` keeps
538
+ * typing `event.input` inside `defineSubgraph`.
539
+ *
540
+ * @param fields The members of {@link ContractCallSpec}, without `type`.
541
+ */
477
542
  contractCall<const A extends AbiContract | undefined = undefined>(fields?: Omit<SpecFor<"contract_call">, "type" | "abi"> & {
478
543
  abi?: A
479
544
  }): ChainEventFilter<"contract_call", {
@@ -481,10 +546,21 @@ interface OnNamespace {
481
546
  } & Omit<SpecFor<"contract_call">, "type" | "abi"> & {
482
547
  abi?: A
483
548
  }>;
549
+ /**
550
+ * Matches contract deployments.
551
+ *
552
+ * @param fields The members of {@link ContractDeploySpec}, without `type`.
553
+ */
484
554
  contractDeploy(fields?: Fields<"contract_deploy">): ChainEventFilter<"contract_deploy">;
485
- /** Canonical member is `print_event` (as Subgraphs and Webhooks spell
486
- * it); `toIndexParams`/`toStreamsParams` project to `print`. `prints`
487
- * literals are preserved (`const P`) for per-topic `event.data` narrowing. */
555
+ /**
556
+ * Matches `print` events.
557
+ *
558
+ * The canonical member is `print_event`, as Subgraphs and Webhooks spell it;
559
+ * `toIndexParams` and `toStreamsParams` project to `print`. `prints` literals
560
+ * are preserved (`const P`), so `event.data` narrows per topic.
561
+ *
562
+ * @param fields The members of {@link PrintEventSpec}, without `type`.
563
+ */
488
564
  print<const P extends Record<string, Record<string, PrintFieldType>> | undefined = undefined>(fields?: Omit<SpecFor<"print_event">, "type" | "prints"> & {
489
565
  prints?: P
490
566
  }): ChainEventFilter<"print_event", {
@@ -492,15 +568,75 @@ interface OnNamespace {
492
568
  } & Omit<SpecFor<"print_event">, "type" | "prints"> & {
493
569
  prints?: P
494
570
  }>;
571
+ /**
572
+ * Matches contract calls made from inside another contract.
573
+ *
574
+ * @param fields The members of {@link NestedContractCallSpec}, without `type`.
575
+ */
495
576
  nestedCall(fields?: Fields<"nested_contract_call">): ChainEventFilter<"nested_contract_call">;
577
+ /**
578
+ * Matches data variable writes.
579
+ *
580
+ * @param fields The members of {@link VarSetSpec}, without `type`.
581
+ */
496
582
  varSet(fields?: Fields<"var_set">): ChainEventFilter<"var_set">;
583
+ /**
584
+ * Matches `map-set` writes.
585
+ *
586
+ * @param fields The members of {@link MapSetSpec}, without `type`.
587
+ */
497
588
  mapSet(fields?: Fields<"map_set">): ChainEventFilter<"map_set">;
589
+ /**
590
+ * Matches `map-insert` writes.
591
+ *
592
+ * @param fields The members of {@link MapInsertSpec}, without `type`.
593
+ */
498
594
  mapInsert(fields?: Fields<"map_insert">): ChainEventFilter<"map_insert">;
595
+ /**
596
+ * Matches `map-delete` writes.
597
+ *
598
+ * @param fields The members of {@link MapDeleteSpec}, without `type`.
599
+ */
499
600
  mapDelete(fields?: Fields<"map_delete">): ChainEventFilter<"map_delete">;
601
+ /**
602
+ * Matches sBTC deposits.
603
+ *
604
+ * Webhooks only: it has no Index, Streams or subgraph projection.
605
+ *
606
+ * @param fields The members of {@link SbtcDepositSpec}, without `type`.
607
+ */
500
608
  sbtcDeposit(fields?: Fields<"sbtc_deposit">): ChainEventFilter<"sbtc_deposit">;
609
+ /**
610
+ * Matches sBTC withdrawal requests.
611
+ *
612
+ * Webhooks only: it has no Index, Streams or subgraph projection.
613
+ *
614
+ * @param fields The members of {@link SbtcWithdrawalCreateSpec}, without `type`.
615
+ */
501
616
  sbtcWithdrawalCreate(fields?: Fields<"sbtc_withdrawal_create">): ChainEventFilter<"sbtc_withdrawal_create">;
617
+ /**
618
+ * Matches accepted sBTC withdrawals.
619
+ *
620
+ * Webhooks only: it has no Index, Streams or subgraph projection.
621
+ *
622
+ * @param fields The members of {@link SbtcWithdrawalAcceptSpec}, without `type`.
623
+ */
502
624
  sbtcWithdrawalAccept(fields?: Fields<"sbtc_withdrawal_accept">): ChainEventFilter<"sbtc_withdrawal_accept">;
625
+ /**
626
+ * Matches rejected sBTC withdrawals.
627
+ *
628
+ * Webhooks only: it has no Index, Streams or subgraph projection.
629
+ *
630
+ * @param fields The members of {@link SbtcWithdrawalRejectSpec}, without `type`.
631
+ */
503
632
  sbtcWithdrawalReject(fields?: Fields<"sbtc_withdrawal_reject">): ChainEventFilter<"sbtc_withdrawal_reject">;
633
+ /**
634
+ * Matches sBTC withdrawals whose sweep has confirmed.
635
+ *
636
+ * Webhooks only: it has no Index, Streams or subgraph projection.
637
+ *
638
+ * @param fields The members of {@link SbtcWithdrawalSweptConfirmedSpec}, without `type`.
639
+ */
504
640
  sbtcWithdrawalSweptConfirmed(fields?: Fields<"sbtc_withdrawal_swept_confirmed">): ChainEventFilter<"sbtc_withdrawal_swept_confirmed">;
505
641
  }
506
642
  /**
@@ -2290,7 +2290,19 @@ function deserializePostConditionWire(input) {
2290
2290
  }
2291
2291
  function deserializeTransaction(input, meta) {
2292
2292
  const bytes = typeof input === "string" ? hexToBytes(without0x(input)) : input;
2293
+ return readTransaction(new BytesReader(bytes), meta);
2294
+ }
2295
+ function splitTransactions(bytes, count) {
2293
2296
  const r = new BytesReader(bytes);
2297
+ const out = [];
2298
+ for (let i = 0;i < count; i++) {
2299
+ const start = r.offset;
2300
+ readTransaction(r);
2301
+ out.push(bytes.subarray(start, r.offset));
2302
+ }
2303
+ return out;
2304
+ }
2305
+ function readTransaction(r, meta) {
2294
2306
  const tx = {
2295
2307
  version: r.readUInt8(),
2296
2308
  chainId: r.readUInt32BE(),
@@ -4589,5 +4601,5 @@ function parseStx(stx) {
4589
4601
  return parseUnits(stx, 6);
4590
4602
  }
4591
4603
 
4592
- //# debugId=BBEDE03C59EADB7164756E2164756E21
4604
+ //# debugId=323CD9704C27481A64756E2164756E21
4593
4605
  //# sourceMappingURL=index.cjs.map