@secondlayer/stacks 4.3.2 → 5.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.
Files changed (164) hide show
  1. package/README.md +27 -11
  2. package/dist/shared/{stacks-gxq2pbky.js → stacks-2as26bcg.js} +10 -7
  3. package/dist/shared/stacks-2as26bcg.js.map +13 -0
  4. package/dist/shared/{stacks-bfan7ex7.js → stacks-4d7c3x27.js} +5 -5
  5. package/dist/shared/{stacks-bfan7ex7.js.map → stacks-4d7c3x27.js.map} +3 -3
  6. package/dist/shared/{stacks-709tra19.js → stacks-4hs8r4q2.js} +16 -2
  7. package/dist/shared/stacks-4hs8r4q2.js.map +10 -0
  8. package/dist/shared/{stacks-w23294am.js → stacks-51ybf135.js} +3 -3
  9. package/dist/shared/{stacks-0jk7vd8r.cjs → stacks-69nq48jp.js} +120 -17
  10. package/dist/shared/stacks-69nq48jp.js.map +15 -0
  11. package/dist/shared/{stacks-8pfdscq6.js → stacks-6gavarmy.js} +37 -9
  12. package/dist/shared/stacks-6gavarmy.js.map +12 -0
  13. package/dist/shared/{stacks-7wkf2rph.js → stacks-7bqkf3b0.js} +86 -71
  14. package/dist/shared/{stacks-7wkf2rph.js.map → stacks-7bqkf3b0.js.map} +9 -10
  15. package/dist/shared/{stacks-zcpvzbr0.js → stacks-8brgfvqx.js} +3 -3
  16. package/dist/shared/{stacks-4vzmhw3q.cjs → stacks-8vzxax5e.cjs} +13 -3
  17. package/dist/shared/stacks-8vzxax5e.cjs.map +10 -0
  18. package/dist/shared/{stacks-hnqt5rz4.js → stacks-9c1yam8b.js} +3 -3
  19. package/dist/shared/{stacks-bnbdqznq.cjs → stacks-bdgh9n83.cjs} +11 -10
  20. package/dist/shared/{stacks-bnbdqznq.cjs.map → stacks-bdgh9n83.cjs.map} +3 -3
  21. package/dist/shared/{stacks-fb75yew8.js → stacks-db3kwavg.cjs} +346 -138
  22. package/dist/shared/stacks-db3kwavg.cjs.map +23 -0
  23. package/dist/shared/{stacks-jpt52csy.js → stacks-e3nwm1dz.js} +14 -17
  24. package/dist/shared/stacks-e3nwm1dz.js.map +10 -0
  25. package/dist/shared/{stacks-27fmgajb.js → stacks-ga026yxz.js} +9 -9
  26. package/dist/shared/{stacks-27fmgajb.js.map → stacks-ga026yxz.js.map} +3 -3
  27. package/dist/shared/{stacks-nyaw1z2a.cjs → stacks-ggdz96r1.cjs} +4 -4
  28. package/dist/shared/{stacks-nyaw1z2a.cjs.map → stacks-ggdz96r1.cjs.map} +3 -3
  29. package/dist/shared/{stacks-08y0y0t7.js → stacks-gjz26k6b.js} +2 -2
  30. package/dist/shared/{stacks-x5386y2y.cjs → stacks-gza2n1zs.cjs} +5 -5
  31. package/dist/shared/{stacks-x5386y2y.cjs.map → stacks-gza2n1zs.cjs.map} +3 -3
  32. package/dist/shared/{stacks-ta1gar0b.cjs → stacks-kqn4y8kq.cjs} +7 -5
  33. package/dist/shared/{stacks-ta1gar0b.cjs.map → stacks-kqn4y8kq.cjs.map} +3 -3
  34. package/dist/shared/{stacks-ztzygy90.js → stacks-mftyrc60.js} +2 -2
  35. package/dist/shared/stacks-n4d8j8q3.js +801 -0
  36. package/dist/shared/stacks-n4d8j8q3.js.map +23 -0
  37. package/dist/shared/{stacks-ycbq8pf7.cjs → stacks-p337hp6m.cjs} +74 -59
  38. package/dist/shared/{stacks-ycbq8pf7.cjs.map → stacks-p337hp6m.cjs.map} +9 -10
  39. package/dist/shared/{stacks-ttdk2g2f.js → stacks-s5vej5z6.cjs} +92 -41
  40. package/dist/shared/stacks-s5vej5z6.cjs.map +15 -0
  41. package/dist/shared/stacks-sdqkapct.cjs +67 -0
  42. package/dist/shared/stacks-sdqkapct.cjs.map +12 -0
  43. package/dist/shared/{stacks-1arrcd11.js → stacks-v2rfr46a.js} +2 -2
  44. package/dist/shared/{stacks-9mqveyjv.cjs → stacks-w9t61fra.cjs} +7 -10
  45. package/dist/shared/stacks-w9t61fra.cjs.map +10 -0
  46. package/dist/shared/{stacks-tjjnkt3r.js → stacks-wxfd6r4b.js} +2 -2
  47. package/dist/shared/{stacks-4z72akdf.js → stacks-x0qqwrev.js} +3 -3
  48. package/dist/shared/{stacks-gck1sq7h.cjs → stacks-xjkn3en1.cjs} +16 -2
  49. package/dist/shared/stacks-xjkn3en1.cjs.map +10 -0
  50. package/dist/shared/stacks-xnrywjf1.cjs +131 -0
  51. package/dist/shared/stacks-xnrywjf1.cjs.map +11 -0
  52. package/dist/shared/stacks-yajyej2y.js +139 -0
  53. package/dist/shared/stacks-yajyej2y.js.map +11 -0
  54. package/dist/shared/{stacks-913a2rx7.js → stacks-yvb7rvwk.js} +13 -3
  55. package/dist/shared/stacks-yvb7rvwk.js.map +10 -0
  56. package/dist/shared/{stacks-0cdm20eh.js → stacks-z90xdr1x.js} +7 -11
  57. package/dist/shared/{stacks-0cdm20eh.js.map → stacks-z90xdr1x.js.map} +3 -3
  58. package/dist/src/accounts/index.js +2 -3
  59. package/dist/src/accounts/index.js.map +2 -2
  60. package/dist/src/actions/index.cjs +2 -1
  61. package/dist/src/actions/index.cjs.map +1 -1
  62. package/dist/src/actions/index.d.cts +108 -20
  63. package/dist/src/actions/index.d.ts +108 -20
  64. package/dist/src/actions/index.js +17 -15
  65. package/dist/src/actions/index.js.map +1 -1
  66. package/dist/src/bitcoin/index.d.cts +27 -0
  67. package/dist/src/bitcoin/index.d.ts +27 -0
  68. package/dist/src/bitcoin/index.js +10 -11
  69. package/dist/src/bitcoin/index.js.map +2 -2
  70. package/dist/src/bns/index.d.cts +27 -0
  71. package/dist/src/bns/index.d.ts +27 -0
  72. package/dist/src/bns/index.js +13 -13
  73. package/dist/src/bns/index.js.map +1 -1
  74. package/dist/src/clarity/index.js +7 -6
  75. package/dist/src/clarity/index.js.map +1 -1
  76. package/dist/src/connect/index.cjs +44 -30
  77. package/dist/src/connect/index.cjs.map +7 -7
  78. package/dist/src/connect/index.d.cts +16 -1
  79. package/dist/src/connect/index.d.ts +16 -1
  80. package/dist/src/connect/index.js +44 -30
  81. package/dist/src/connect/index.js.map +7 -7
  82. package/dist/src/connect/walletconnect/index.cjs +49 -413
  83. package/dist/src/connect/walletconnect/index.cjs.map +4 -4
  84. package/dist/src/connect/walletconnect/index.js +47 -411
  85. package/dist/src/connect/walletconnect/index.js.map +4 -4
  86. package/dist/src/filters/index.js +2 -2
  87. package/dist/src/index.cjs +49 -124
  88. package/dist/src/index.cjs.map +6 -8
  89. package/dist/src/index.d.cts +163 -54
  90. package/dist/src/index.d.ts +163 -54
  91. package/dist/src/index.js +79 -147
  92. package/dist/src/index.js.map +6 -8
  93. package/dist/src/postconditions/index.js +6 -5
  94. package/dist/src/postconditions/index.js.map +1 -1
  95. package/dist/src/pox/index.cjs +7 -83
  96. package/dist/src/pox/index.cjs.map +3 -3
  97. package/dist/src/pox/index.d.cts +32 -1
  98. package/dist/src/pox/index.d.ts +32 -1
  99. package/dist/src/pox/index.js +22 -102
  100. package/dist/src/pox/index.js.map +3 -3
  101. package/dist/src/pox5/index.cjs +4 -112
  102. package/dist/src/pox5/index.cjs.map +3 -4
  103. package/dist/src/pox5/index.d.cts +27 -0
  104. package/dist/src/pox5/index.d.ts +27 -0
  105. package/dist/src/pox5/index.js +20 -131
  106. package/dist/src/pox5/index.js.map +3 -4
  107. package/dist/src/sbtc/index.cjs +2 -27
  108. package/dist/src/sbtc/index.cjs.map +3 -3
  109. package/dist/src/sbtc/index.d.cts +30 -2
  110. package/dist/src/sbtc/index.d.ts +30 -2
  111. package/dist/src/sbtc/index.js +15 -45
  112. package/dist/src/sbtc/index.js.map +3 -3
  113. package/dist/src/stackingdao/index.d.cts +27 -0
  114. package/dist/src/stackingdao/index.d.ts +27 -0
  115. package/dist/src/stackingdao/index.js +11 -11
  116. package/dist/src/stackingdao/index.js.map +1 -1
  117. package/dist/src/subscriptions/index.d.cts +27 -0
  118. package/dist/src/subscriptions/index.d.ts +27 -0
  119. package/dist/src/subscriptions/index.js +2 -2
  120. package/dist/src/tools/btc/index.cjs.map +2 -2
  121. package/dist/src/tools/btc/index.js.map +2 -2
  122. package/dist/src/tools/index.cjs +629 -392
  123. package/dist/src/tools/index.cjs.map +30 -28
  124. package/dist/src/tools/index.d.cts +44 -0
  125. package/dist/src/tools/index.d.ts +44 -0
  126. package/dist/src/tools/index.js +628 -391
  127. package/dist/src/tools/index.js.map +30 -28
  128. package/dist/src/transactions/index.js +6 -5
  129. package/dist/src/transactions/index.js.map +1 -1
  130. package/dist/src/utils/index.d.cts +2 -5
  131. package/dist/src/utils/index.d.ts +2 -5
  132. package/dist/src/utils/index.js +2 -2
  133. package/package.json +18 -7
  134. package/dist/shared/stacks-0eatsx6d.cjs +0 -25
  135. package/dist/shared/stacks-0eatsx6d.cjs.map +0 -10
  136. package/dist/shared/stacks-0jk7vd8r.cjs.map +0 -14
  137. package/dist/shared/stacks-4vzmhw3q.cjs.map +0 -10
  138. package/dist/shared/stacks-5nmz5ad9.js +0 -409
  139. package/dist/shared/stacks-5nmz5ad9.js.map +0 -10
  140. package/dist/shared/stacks-709tra19.js.map +0 -10
  141. package/dist/shared/stacks-8pfdscq6.js.map +0 -12
  142. package/dist/shared/stacks-913a2rx7.js.map +0 -10
  143. package/dist/shared/stacks-9mqveyjv.cjs.map +0 -10
  144. package/dist/shared/stacks-e4xn4m7j.js +0 -27
  145. package/dist/shared/stacks-e4xn4m7j.js.map +0 -10
  146. package/dist/shared/stacks-fb75yew8.js.map +0 -21
  147. package/dist/shared/stacks-gck1sq7h.cjs.map +0 -10
  148. package/dist/shared/stacks-gxq2pbky.js.map +0 -13
  149. package/dist/shared/stacks-jpt52csy.js.map +0 -10
  150. package/dist/shared/stacks-mnnhpex3.cjs +0 -407
  151. package/dist/shared/stacks-mnnhpex3.cjs.map +0 -10
  152. package/dist/shared/stacks-tdsp5gsb.cjs +0 -527
  153. package/dist/shared/stacks-tdsp5gsb.cjs.map +0 -21
  154. package/dist/shared/stacks-ttdk2g2f.js.map +0 -14
  155. package/dist/shared/stacks-wdp5yr8n.cjs +0 -39
  156. package/dist/shared/stacks-wdp5yr8n.cjs.map +0 -12
  157. /package/dist/shared/{stacks-w23294am.js.map → stacks-51ybf135.js.map} +0 -0
  158. /package/dist/shared/{stacks-zcpvzbr0.js.map → stacks-8brgfvqx.js.map} +0 -0
  159. /package/dist/shared/{stacks-hnqt5rz4.js.map → stacks-9c1yam8b.js.map} +0 -0
  160. /package/dist/shared/{stacks-08y0y0t7.js.map → stacks-gjz26k6b.js.map} +0 -0
  161. /package/dist/shared/{stacks-ztzygy90.js.map → stacks-mftyrc60.js.map} +0 -0
  162. /package/dist/shared/{stacks-1arrcd11.js.map → stacks-v2rfr46a.js.map} +0 -0
  163. /package/dist/shared/{stacks-tjjnkt3r.js.map → stacks-wxfd6r4b.js.map} +0 -0
  164. /package/dist/shared/{stacks-4z72akdf.js.map → stacks-x0qqwrev.js.map} +0 -0
@@ -311,6 +311,15 @@ type NonceManager = {
311
311
  client: Client
312
312
  address: string
313
313
  }): void | Promise<void>
314
+ /**
315
+ * Give back a nonce from {@link NonceManager.consume} whose transaction
316
+ * was never accepted by the node. No-op unless it is the latest issued.
317
+ */
318
+ release(params: {
319
+ client: Client
320
+ address: string
321
+ nonce: bigint
322
+ }): void | Promise<void>
314
323
  /** Next nonce that {@link NonceManager.consume} would return without consuming it, or `undefined` if untracked. */
315
324
  peek(params: {
316
325
  client: Client
@@ -366,14 +375,32 @@ type RequestOptions = {
366
375
  method?: "GET" | "POST" | "PUT" | "DELETE"
367
376
  body?: unknown
368
377
  headers?: Record<string, string>
378
+ /**
379
+ * Cancel the request from the caller's side. An aborted signal rejects
380
+ * with the signal's reason immediately and never retries; it is combined
381
+ * with the transport's own per-attempt timeout.
382
+ */
383
+ signal?: AbortSignal
384
+ /**
385
+ * Override the transport's retry budget for this one request. Broadcasts
386
+ * pass `0`: re-sending a transaction the node may already hold trades a
387
+ * transient failure for a confusing nonce conflict.
388
+ */
389
+ retryCount?: number
369
390
  };
370
391
  /** Shared configuration for all transport types. */
371
392
  type TransportConfig = {
372
393
  url?: string
394
+ /**
395
+ * Per-attempt deadline in ms covering headers AND body. A stalled body
396
+ * rejects with `TimeoutError` instead of hanging. Default 30_000.
397
+ */
373
398
  timeout?: number
374
399
  retryCount?: number
375
400
  retryDelay?: number
376
401
  fetchOptions?: RequestInit
402
+ /** Sent as `x-api-key`. Held in the request closure and stripped from
403
+ * `Transport.config` so it never prints with the client. */
377
404
  apiKey?: string
378
405
  };
379
406
  /** A resolved transport instance with a bound request function. */
@@ -420,6 +447,11 @@ type GetBlockParams = {
420
447
  height?: number
421
448
  hash?: string
422
449
  };
450
+ /**
451
+ * Fetch one block by hash or height, or the chain tip when both are omitted.
452
+ * Every path resolves to a single block object: the tip read unwraps the
453
+ * list envelope the extended API returns for `?limit=1`.
454
+ */
423
455
  declare function getBlock(client: Client, params?: GetBlockParams): Promise<any>;
424
456
  type GetRawBlockParams = {
425
457
  height: number
@@ -510,6 +542,13 @@ type MulticallCall = {
510
542
  type MulticallParams<TAllowFailure extends boolean = true> = {
511
543
  calls: readonly MulticallCall[]
512
544
  allowFailure?: TAllowFailure
545
+ /**
546
+ * Reads in flight at once. Default 8. Each call is its own
547
+ * `/v2/contracts/call-read` request (Stacks nodes have no batch RPC), so
548
+ * an uncapped fan-out turns one multicall into a burst that trips rate
549
+ * limits and then retries in lockstep.
550
+ */
551
+ concurrency?: number
513
552
  };
514
553
  type MulticallSuccessResult = {
515
554
  status: "success"
@@ -522,15 +561,25 @@ type MulticallFailureResult = {
522
561
  type MulticallResult<T extends boolean> = T extends true ? (MulticallSuccessResult | MulticallFailureResult)[] : ClarityValue[];
523
562
  declare function multicall<TAllowFailure extends boolean = true>(client: Client, params: MulticallParams<TAllowFailure>): Promise<MulticallResult<TAllowFailure>>;
524
563
  declare class BaseError extends Error {
564
+ private;
525
565
  name: string;
526
566
  shortMessage: string;
527
567
  details?: string;
528
568
  constructor(shortMessage: string, options?: {
529
569
  cause?: Error
530
570
  details?: string
571
+ code?: string
531
572
  });
573
+ /**
574
+ * Stable identifier for programmatic handling; survives message
575
+ * rewording and minification. An explicit `code` option wins, else it
576
+ * is derived from `name` (`TimeoutError` gives `TIMEOUT_ERROR`).
577
+ */
578
+ get code(): string;
579
+ set code(value: string);
532
580
  toJSON(): {
533
581
  name: string
582
+ code: string
534
583
  message: string
535
584
  shortMessage: string
536
585
  details: string | undefined
@@ -592,9 +641,9 @@ declare function simulateTransaction(client: Client, params: SimulateTransaction
592
641
  *
593
642
  * - {@link extendedApiSource} — default; `/extended/v1/tx/{txid}` on the
594
643
  * client's transport host (Hiro API or any extended-API-compatible host).
595
- * - {@link indexTxSource} — Secondlayer's `/v1/index/transactions/{txid}`;
596
- * returns the chain tip in the same response, so N-confirmation waits
597
- * need no second request.
644
+ * - {@link indexTxSource}: a Secondlayer instance's
645
+ * `/v1/index/transactions/{txid}`; returns the chain tip in the same
646
+ * response, so N-confirmation waits need no second request.
598
647
  */
599
648
  type TransactionStatus = "pending" | "success" | "abort_by_response" | "abort_by_post_condition" | "dropped";
600
649
  type TransactionReceipt = {
@@ -621,8 +670,14 @@ type TransactionStatusSource = {
621
670
  client: Client
622
671
  txid: string
623
672
  }): Promise<TransactionSnapshot>
673
+ /**
674
+ * True when the source only knows mined transactions and reports
675
+ * `receipt: null` for the whole mempool life of a tx. The wait action
676
+ * then stretches its dropped-grace window to the full timeout, since
677
+ * "unknown" cannot mean "dropped" until the deadline.
678
+ */
679
+ canonicalOnly?: boolean
624
680
  };
625
- type FetchImpl = typeof globalThis.fetch;
626
681
  /**
627
682
  * Default source: `GET /extended/v1/tx/{txid}` via the client's transport.
628
683
  * Requires a host that serves Hiro's extended API (a bare stacks-node does
@@ -631,17 +686,25 @@ type FetchImpl = typeof globalThis.fetch;
631
686
  */
632
687
  declare function extendedApiSource(): TransactionStatusSource;
633
688
  type IndexTxSourceParams = {
634
- /** Base URL of a Secondlayer-shaped index API. */
689
+ /**
690
+ * URL of your Secondlayer instance. Without it the client's transport
691
+ * URL is assumed to be the instance: a transport on a Hiro host throws
692
+ * up front, and a host that answers `/v1/index` with a non-JSON 404
693
+ * (a bare stacks-node) throws on the first read. Pass it whenever the
694
+ * transport is not the instance.
695
+ */
635
696
  baseUrl?: string
697
+ /** Instance token, sent as `Authorization: Bearer`. */
636
698
  apiKey?: string
637
- fetchImpl?: FetchImpl
638
699
  };
639
700
  /**
640
- * Source backed by Secondlayer's `/v1/index/transactions/{txid}`. The response
641
- * embeds the chain tip, so N-confirmation math needs no extra request. The
642
- * index only returns canonical (mined) transactions — while a tx is in the
643
- * mempool this source reports `receipt: null`, and the wait action's grace
644
- * window carries it until inclusion.
701
+ * Source backed by a Secondlayer instance's `/v1/index/transactions/{txid}`.
702
+ * The response embeds the chain tip, so N-confirmation math needs no extra
703
+ * request. Requests go through the transport layer: same retries, timeout
704
+ * and typed errors as every other read. The index only returns canonical
705
+ * (mined) transactions; while a tx is in the mempool this source reports
706
+ * `receipt: null`, and the wait action's grace window carries it until
707
+ * inclusion.
645
708
  */
646
709
  declare function indexTxSource(params?: IndexTxSourceParams): TransactionStatusSource;
647
710
  type GetTransactionParams = {
@@ -691,8 +754,9 @@ type WaitForTransactionReceiptParams = {
691
754
  pollingInterval?: number
692
755
  /**
693
756
  * How long a tx may be unknown to the source before it counts as dropped,
694
- * ms. Covers broadcast propagation lag and canonical-only sources that
695
- * can't see the mempool. Default 30_000.
757
+ * ms. Covers broadcast propagation lag. Default 30_000, or the full
758
+ * `timeout` for a canonical-only source (one that cannot see the
759
+ * mempool, so "unknown" means "not mined yet" until the deadline).
696
760
  */
697
761
  droppedGracePeriod?: number
698
762
  /** Where to read status from. Defaults to {@link extendedApiSource}. */
@@ -924,14 +988,35 @@ declare function isFeeTier(fee: FeeParam | undefined): fee is FeeTier;
924
988
  * stable regardless of the fee value later set on the spending condition.
925
989
  */
926
990
  declare function minimumFee(transaction: StacksTransaction): bigint;
991
+ /** Outcome of {@link resolveFee}: the amount and which tier produced it. */
992
+ type ResolvedFee = {
993
+ fee: bigint
994
+ /**
995
+ * Tier the amount came from. `'min'` when the estimator had no estimate
996
+ * and the relay floor was used instead. Absent when the caller passed an
997
+ * exact amount.
998
+ */
999
+ tier?: FeeTier
1000
+ };
1001
+ /**
1002
+ * True when the node answered `POST /v2/fees/transaction` with 400
1003
+ * `NoEstimateAvailable`: it is healthy but has no fee history for this
1004
+ * payload (fresh devnet, quiet chain). Every other failure means the
1005
+ * estimate was never obtained and must surface to the caller.
1006
+ */
1007
+ declare function isNoEstimateAvailable(error: unknown): boolean;
927
1008
  /**
928
1009
  * Resolve a fee param to a concrete amount. Numeric input passes through.
929
1010
  * Tiers `'low' | 'mid' | 'high'` index the node's estimations (nearest
930
- * available when fewer than three are returned); `'min'` — and any estimation
931
- * failure (e.g. NoEstimateAvailable) — resolves to {@link minimumFee}, which
932
- * needs no network round-trip.
1011
+ * available when fewer than three are returned); `'min'` resolves to
1012
+ * {@link minimumFee}, which needs no network round-trip.
1013
+ *
1014
+ * The relay floor is the fallback ONLY when the node reports
1015
+ * `NoEstimateAvailable` or returns no estimations. A transport timeout, 5xx,
1016
+ * or auth failure rethrows: silently under-paying because the node was
1017
+ * unreachable would strand the transaction in the mempool.
933
1018
  */
934
- declare function resolveFee(client: Client, transaction: StacksTransaction, fee: FeeParam | undefined): Promise<bigint>;
1019
+ declare function resolveFee(client: Client, transaction: StacksTransaction, fee: FeeParam | undefined): Promise<ResolvedFee>;
935
1020
  type TransferStxParams = {
936
1021
  to: string
937
1022
  amount: IntegerType
@@ -1223,9 +1308,12 @@ type ContractCallOptions = {
1223
1308
  postConditions?: PostConditionInput[]
1224
1309
  };
1225
1310
  /**
1226
- * Options for `buildCall.*` — building an unsigned transaction for
1311
+ * Options for `buildCall.*`, building an unsigned transaction for
1227
1312
  * wallet-signs-later flows. `publicKey` defaults to the client account's
1228
- * public key; `fee`/`nonce` are resolved from the network when omitted.
1313
+ * public key. When omitted, `nonce` is the confirmed on-chain nonce read
1314
+ * straight from the node (the client's nonce manager is never consumed for
1315
+ * a transaction that may never be sent) and `fee` is the mid estimate,
1316
+ * falling back to the relay floor only on `NoEstimateAvailable`.
1229
1317
  */
1230
1318
  type ContractBuildCallOptions = ContractCallOptions & {
1231
1319
  publicKey?: string
@@ -1261,4 +1349,4 @@ declare class ContractResponseError extends Error {
1261
1349
  name: string;
1262
1350
  constructor(message: string, errorValue: unknown);
1263
1351
  }
1264
- export { watchTransaction, watchNftEvent, watchMempool, watchBlocks, watchAddressBalance, watchAddress, waitForTransactionReceipt, transferStx, sponsorTransaction, simulateTransaction, simulateCall, signTransactionAction, signMessage2 as signMessage, sendTransaction, resolveFee, readContract, multicall, minimumFee, isResponseOutput, isProviderAccount, isFeeTier, indexTxSource, getTransaction, getRawBlock, getNonce, getNftHoldings, getMempoolStats, getMapEntry, getDataVar, getContractSource, getContractAbi, getContract, getBlockHeight, getBlock, getBalance, getAccountInfo, getAccountHistory, extendedApiSource, estimateFee, deployContract, callContract, buildFunctionArgs, WatchTransactionParams, WatchNftEventParams, WatchMempoolParams, WatchBlocksParams, WatchAddressParams, WatchAddressBalanceParams, WaitForTransactionReceiptParams, UnwrapResponse, TransferStxParams, TransactionStatusSource, TransactionStatus, TransactionSnapshot, TransactionReceipt, SponsorTransactionParams, SimulateTransferResult, SimulateTransactionResult, SimulateTransactionParams, SimulateDeployResult, SimulateContractCallResult, SimulateCallSuccess, SimulateCallResult, SimulateCallParams, SimulateCallFailure, SignTransactionParams, SignMessageParams, SendTransactionResult, SendTransactionParams, ReadContractParams, RawBlockResponse, NftHoldingsResponse, MulticallSuccessResult, MulticallResult, MulticallParams, MulticallFailureResult, MulticallCall, IndexTxSourceParams, GetTransactionParams, GetRawBlockParams, GetNonceParams, GetNftHoldingsParams, GetMapEntryParams, GetDataVarParams, GetContractSourceParams, GetContractParams, GetContractAbiParams, GetBlockParams, GetBalanceParams, GetAccountInfoParams, GetAccountHistoryParams, FeeTier, FeeParam, FeeEstimation, EstimateFeeParams, DeployContractParams, ContractSourceResponse, ContractResponseError, ContractInstance, ContractCallOptions, ContractBuildCallOptions, CallContractParams, AccountInfo, AccountHistoryResponse };
1352
+ export { watchTransaction, watchNftEvent, watchMempool, watchBlocks, watchAddressBalance, watchAddress, waitForTransactionReceipt, transferStx, sponsorTransaction, simulateTransaction, simulateCall, signTransactionAction, signMessage2 as signMessage, sendTransaction, resolveFee, readContract, multicall, minimumFee, isResponseOutput, isProviderAccount, isNoEstimateAvailable, isFeeTier, indexTxSource, getTransaction, getRawBlock, getNonce, getNftHoldings, getMempoolStats, getMapEntry, getDataVar, getContractSource, getContractAbi, getContract, getBlockHeight, getBlock, getBalance, getAccountInfo, getAccountHistory, extendedApiSource, estimateFee, deployContract, callContract, buildFunctionArgs, WatchTransactionParams, WatchNftEventParams, WatchMempoolParams, WatchBlocksParams, WatchAddressParams, WatchAddressBalanceParams, WaitForTransactionReceiptParams, UnwrapResponse, TransferStxParams, TransactionStatusSource, TransactionStatus, TransactionSnapshot, TransactionReceipt, SponsorTransactionParams, SimulateTransferResult, SimulateTransactionResult, SimulateTransactionParams, SimulateDeployResult, SimulateContractCallResult, SimulateCallSuccess, SimulateCallResult, SimulateCallParams, SimulateCallFailure, SignTransactionParams, SignMessageParams, SendTransactionResult, SendTransactionParams, ResolvedFee, ReadContractParams, RawBlockResponse, NftHoldingsResponse, MulticallSuccessResult, MulticallResult, MulticallParams, MulticallFailureResult, MulticallCall, IndexTxSourceParams, GetTransactionParams, GetRawBlockParams, GetNonceParams, GetNftHoldingsParams, GetMapEntryParams, GetDataVarParams, GetContractSourceParams, GetContractParams, GetContractAbiParams, GetBlockParams, GetBalanceParams, GetAccountInfoParams, GetAccountHistoryParams, FeeTier, FeeParam, FeeEstimation, EstimateFeeParams, DeployContractParams, ContractSourceResponse, ContractResponseError, ContractInstance, ContractCallOptions, ContractBuildCallOptions, CallContractParams, AccountInfo, AccountHistoryResponse };
@@ -311,6 +311,15 @@ type NonceManager = {
311
311
  client: Client
312
312
  address: string
313
313
  }): void | Promise<void>
314
+ /**
315
+ * Give back a nonce from {@link NonceManager.consume} whose transaction
316
+ * was never accepted by the node. No-op unless it is the latest issued.
317
+ */
318
+ release(params: {
319
+ client: Client
320
+ address: string
321
+ nonce: bigint
322
+ }): void | Promise<void>
314
323
  /** Next nonce that {@link NonceManager.consume} would return without consuming it, or `undefined` if untracked. */
315
324
  peek(params: {
316
325
  client: Client
@@ -366,14 +375,32 @@ type RequestOptions = {
366
375
  method?: "GET" | "POST" | "PUT" | "DELETE"
367
376
  body?: unknown
368
377
  headers?: Record<string, string>
378
+ /**
379
+ * Cancel the request from the caller's side. An aborted signal rejects
380
+ * with the signal's reason immediately and never retries; it is combined
381
+ * with the transport's own per-attempt timeout.
382
+ */
383
+ signal?: AbortSignal
384
+ /**
385
+ * Override the transport's retry budget for this one request. Broadcasts
386
+ * pass `0`: re-sending a transaction the node may already hold trades a
387
+ * transient failure for a confusing nonce conflict.
388
+ */
389
+ retryCount?: number
369
390
  };
370
391
  /** Shared configuration for all transport types. */
371
392
  type TransportConfig = {
372
393
  url?: string
394
+ /**
395
+ * Per-attempt deadline in ms covering headers AND body. A stalled body
396
+ * rejects with `TimeoutError` instead of hanging. Default 30_000.
397
+ */
373
398
  timeout?: number
374
399
  retryCount?: number
375
400
  retryDelay?: number
376
401
  fetchOptions?: RequestInit
402
+ /** Sent as `x-api-key`. Held in the request closure and stripped from
403
+ * `Transport.config` so it never prints with the client. */
377
404
  apiKey?: string
378
405
  };
379
406
  /** A resolved transport instance with a bound request function. */
@@ -420,6 +447,11 @@ type GetBlockParams = {
420
447
  height?: number
421
448
  hash?: string
422
449
  };
450
+ /**
451
+ * Fetch one block by hash or height, or the chain tip when both are omitted.
452
+ * Every path resolves to a single block object: the tip read unwraps the
453
+ * list envelope the extended API returns for `?limit=1`.
454
+ */
423
455
  declare function getBlock(client: Client, params?: GetBlockParams): Promise<any>;
424
456
  type GetRawBlockParams = {
425
457
  height: number
@@ -510,6 +542,13 @@ type MulticallCall = {
510
542
  type MulticallParams<TAllowFailure extends boolean = true> = {
511
543
  calls: readonly MulticallCall[]
512
544
  allowFailure?: TAllowFailure
545
+ /**
546
+ * Reads in flight at once. Default 8. Each call is its own
547
+ * `/v2/contracts/call-read` request (Stacks nodes have no batch RPC), so
548
+ * an uncapped fan-out turns one multicall into a burst that trips rate
549
+ * limits and then retries in lockstep.
550
+ */
551
+ concurrency?: number
513
552
  };
514
553
  type MulticallSuccessResult = {
515
554
  status: "success"
@@ -522,15 +561,25 @@ type MulticallFailureResult = {
522
561
  type MulticallResult<T extends boolean> = T extends true ? (MulticallSuccessResult | MulticallFailureResult)[] : ClarityValue[];
523
562
  declare function multicall<TAllowFailure extends boolean = true>(client: Client, params: MulticallParams<TAllowFailure>): Promise<MulticallResult<TAllowFailure>>;
524
563
  declare class BaseError extends Error {
564
+ private;
525
565
  name: string;
526
566
  shortMessage: string;
527
567
  details?: string;
528
568
  constructor(shortMessage: string, options?: {
529
569
  cause?: Error
530
570
  details?: string
571
+ code?: string
531
572
  });
573
+ /**
574
+ * Stable identifier for programmatic handling; survives message
575
+ * rewording and minification. An explicit `code` option wins, else it
576
+ * is derived from `name` (`TimeoutError` gives `TIMEOUT_ERROR`).
577
+ */
578
+ get code(): string;
579
+ set code(value: string);
532
580
  toJSON(): {
533
581
  name: string
582
+ code: string
534
583
  message: string
535
584
  shortMessage: string
536
585
  details: string | undefined
@@ -592,9 +641,9 @@ declare function simulateTransaction(client: Client, params: SimulateTransaction
592
641
  *
593
642
  * - {@link extendedApiSource} — default; `/extended/v1/tx/{txid}` on the
594
643
  * client's transport host (Hiro API or any extended-API-compatible host).
595
- * - {@link indexTxSource} — Secondlayer's `/v1/index/transactions/{txid}`;
596
- * returns the chain tip in the same response, so N-confirmation waits
597
- * need no second request.
644
+ * - {@link indexTxSource}: a Secondlayer instance's
645
+ * `/v1/index/transactions/{txid}`; returns the chain tip in the same
646
+ * response, so N-confirmation waits need no second request.
598
647
  */
599
648
  type TransactionStatus = "pending" | "success" | "abort_by_response" | "abort_by_post_condition" | "dropped";
600
649
  type TransactionReceipt = {
@@ -621,8 +670,14 @@ type TransactionStatusSource = {
621
670
  client: Client
622
671
  txid: string
623
672
  }): Promise<TransactionSnapshot>
673
+ /**
674
+ * True when the source only knows mined transactions and reports
675
+ * `receipt: null` for the whole mempool life of a tx. The wait action
676
+ * then stretches its dropped-grace window to the full timeout, since
677
+ * "unknown" cannot mean "dropped" until the deadline.
678
+ */
679
+ canonicalOnly?: boolean
624
680
  };
625
- type FetchImpl = typeof globalThis.fetch;
626
681
  /**
627
682
  * Default source: `GET /extended/v1/tx/{txid}` via the client's transport.
628
683
  * Requires a host that serves Hiro's extended API (a bare stacks-node does
@@ -631,17 +686,25 @@ type FetchImpl = typeof globalThis.fetch;
631
686
  */
632
687
  declare function extendedApiSource(): TransactionStatusSource;
633
688
  type IndexTxSourceParams = {
634
- /** Base URL of a Secondlayer-shaped index API. */
689
+ /**
690
+ * URL of your Secondlayer instance. Without it the client's transport
691
+ * URL is assumed to be the instance: a transport on a Hiro host throws
692
+ * up front, and a host that answers `/v1/index` with a non-JSON 404
693
+ * (a bare stacks-node) throws on the first read. Pass it whenever the
694
+ * transport is not the instance.
695
+ */
635
696
  baseUrl?: string
697
+ /** Instance token, sent as `Authorization: Bearer`. */
636
698
  apiKey?: string
637
- fetchImpl?: FetchImpl
638
699
  };
639
700
  /**
640
- * Source backed by Secondlayer's `/v1/index/transactions/{txid}`. The response
641
- * embeds the chain tip, so N-confirmation math needs no extra request. The
642
- * index only returns canonical (mined) transactions — while a tx is in the
643
- * mempool this source reports `receipt: null`, and the wait action's grace
644
- * window carries it until inclusion.
701
+ * Source backed by a Secondlayer instance's `/v1/index/transactions/{txid}`.
702
+ * The response embeds the chain tip, so N-confirmation math needs no extra
703
+ * request. Requests go through the transport layer: same retries, timeout
704
+ * and typed errors as every other read. The index only returns canonical
705
+ * (mined) transactions; while a tx is in the mempool this source reports
706
+ * `receipt: null`, and the wait action's grace window carries it until
707
+ * inclusion.
645
708
  */
646
709
  declare function indexTxSource(params?: IndexTxSourceParams): TransactionStatusSource;
647
710
  type GetTransactionParams = {
@@ -691,8 +754,9 @@ type WaitForTransactionReceiptParams = {
691
754
  pollingInterval?: number
692
755
  /**
693
756
  * How long a tx may be unknown to the source before it counts as dropped,
694
- * ms. Covers broadcast propagation lag and canonical-only sources that
695
- * can't see the mempool. Default 30_000.
757
+ * ms. Covers broadcast propagation lag. Default 30_000, or the full
758
+ * `timeout` for a canonical-only source (one that cannot see the
759
+ * mempool, so "unknown" means "not mined yet" until the deadline).
696
760
  */
697
761
  droppedGracePeriod?: number
698
762
  /** Where to read status from. Defaults to {@link extendedApiSource}. */
@@ -924,14 +988,35 @@ declare function isFeeTier(fee: FeeParam | undefined): fee is FeeTier;
924
988
  * stable regardless of the fee value later set on the spending condition.
925
989
  */
926
990
  declare function minimumFee(transaction: StacksTransaction): bigint;
991
+ /** Outcome of {@link resolveFee}: the amount and which tier produced it. */
992
+ type ResolvedFee = {
993
+ fee: bigint
994
+ /**
995
+ * Tier the amount came from. `'min'` when the estimator had no estimate
996
+ * and the relay floor was used instead. Absent when the caller passed an
997
+ * exact amount.
998
+ */
999
+ tier?: FeeTier
1000
+ };
1001
+ /**
1002
+ * True when the node answered `POST /v2/fees/transaction` with 400
1003
+ * `NoEstimateAvailable`: it is healthy but has no fee history for this
1004
+ * payload (fresh devnet, quiet chain). Every other failure means the
1005
+ * estimate was never obtained and must surface to the caller.
1006
+ */
1007
+ declare function isNoEstimateAvailable(error: unknown): boolean;
927
1008
  /**
928
1009
  * Resolve a fee param to a concrete amount. Numeric input passes through.
929
1010
  * Tiers `'low' | 'mid' | 'high'` index the node's estimations (nearest
930
- * available when fewer than three are returned); `'min'` — and any estimation
931
- * failure (e.g. NoEstimateAvailable) — resolves to {@link minimumFee}, which
932
- * needs no network round-trip.
1011
+ * available when fewer than three are returned); `'min'` resolves to
1012
+ * {@link minimumFee}, which needs no network round-trip.
1013
+ *
1014
+ * The relay floor is the fallback ONLY when the node reports
1015
+ * `NoEstimateAvailable` or returns no estimations. A transport timeout, 5xx,
1016
+ * or auth failure rethrows: silently under-paying because the node was
1017
+ * unreachable would strand the transaction in the mempool.
933
1018
  */
934
- declare function resolveFee(client: Client, transaction: StacksTransaction, fee: FeeParam | undefined): Promise<bigint>;
1019
+ declare function resolveFee(client: Client, transaction: StacksTransaction, fee: FeeParam | undefined): Promise<ResolvedFee>;
935
1020
  type TransferStxParams = {
936
1021
  to: string
937
1022
  amount: IntegerType
@@ -1223,9 +1308,12 @@ type ContractCallOptions = {
1223
1308
  postConditions?: PostConditionInput[]
1224
1309
  };
1225
1310
  /**
1226
- * Options for `buildCall.*` — building an unsigned transaction for
1311
+ * Options for `buildCall.*`, building an unsigned transaction for
1227
1312
  * wallet-signs-later flows. `publicKey` defaults to the client account's
1228
- * public key; `fee`/`nonce` are resolved from the network when omitted.
1313
+ * public key. When omitted, `nonce` is the confirmed on-chain nonce read
1314
+ * straight from the node (the client's nonce manager is never consumed for
1315
+ * a transaction that may never be sent) and `fee` is the mid estimate,
1316
+ * falling back to the relay floor only on `NoEstimateAvailable`.
1229
1317
  */
1230
1318
  type ContractBuildCallOptions = ContractCallOptions & {
1231
1319
  publicKey?: string
@@ -1261,4 +1349,4 @@ declare class ContractResponseError extends Error {
1261
1349
  name: string;
1262
1350
  constructor(message: string, errorValue: unknown);
1263
1351
  }
1264
- export { watchTransaction, watchNftEvent, watchMempool, watchBlocks, watchAddressBalance, watchAddress, waitForTransactionReceipt, transferStx, sponsorTransaction, simulateTransaction, simulateCall, signTransactionAction, signMessage2 as signMessage, sendTransaction, resolveFee, readContract, multicall, minimumFee, isResponseOutput, isProviderAccount, isFeeTier, indexTxSource, getTransaction, getRawBlock, getNonce, getNftHoldings, getMempoolStats, getMapEntry, getDataVar, getContractSource, getContractAbi, getContract, getBlockHeight, getBlock, getBalance, getAccountInfo, getAccountHistory, extendedApiSource, estimateFee, deployContract, callContract, buildFunctionArgs, WatchTransactionParams, WatchNftEventParams, WatchMempoolParams, WatchBlocksParams, WatchAddressParams, WatchAddressBalanceParams, WaitForTransactionReceiptParams, UnwrapResponse, TransferStxParams, TransactionStatusSource, TransactionStatus, TransactionSnapshot, TransactionReceipt, SponsorTransactionParams, SimulateTransferResult, SimulateTransactionResult, SimulateTransactionParams, SimulateDeployResult, SimulateContractCallResult, SimulateCallSuccess, SimulateCallResult, SimulateCallParams, SimulateCallFailure, SignTransactionParams, SignMessageParams, SendTransactionResult, SendTransactionParams, ReadContractParams, RawBlockResponse, NftHoldingsResponse, MulticallSuccessResult, MulticallResult, MulticallParams, MulticallFailureResult, MulticallCall, IndexTxSourceParams, GetTransactionParams, GetRawBlockParams, GetNonceParams, GetNftHoldingsParams, GetMapEntryParams, GetDataVarParams, GetContractSourceParams, GetContractParams, GetContractAbiParams, GetBlockParams, GetBalanceParams, GetAccountInfoParams, GetAccountHistoryParams, FeeTier, FeeParam, FeeEstimation, EstimateFeeParams, DeployContractParams, ContractSourceResponse, ContractResponseError, ContractInstance, ContractCallOptions, ContractBuildCallOptions, CallContractParams, AccountInfo, AccountHistoryResponse };
1352
+ export { watchTransaction, watchNftEvent, watchMempool, watchBlocks, watchAddressBalance, watchAddress, waitForTransactionReceipt, transferStx, sponsorTransaction, simulateTransaction, simulateCall, signTransactionAction, signMessage2 as signMessage, sendTransaction, resolveFee, readContract, multicall, minimumFee, isResponseOutput, isProviderAccount, isNoEstimateAvailable, isFeeTier, indexTxSource, getTransaction, getRawBlock, getNonce, getNftHoldings, getMempoolStats, getMapEntry, getDataVar, getContractSource, getContractAbi, getContract, getBlockHeight, getBlock, getBalance, getAccountInfo, getAccountHistory, extendedApiSource, estimateFee, deployContract, callContract, buildFunctionArgs, WatchTransactionParams, WatchNftEventParams, WatchMempoolParams, WatchBlocksParams, WatchAddressParams, WatchAddressBalanceParams, WaitForTransactionReceiptParams, UnwrapResponse, TransferStxParams, TransactionStatusSource, TransactionStatus, TransactionSnapshot, TransactionReceipt, SponsorTransactionParams, SimulateTransferResult, SimulateTransactionResult, SimulateTransactionParams, SimulateDeployResult, SimulateContractCallResult, SimulateCallSuccess, SimulateCallResult, SimulateCallParams, SimulateCallFailure, SignTransactionParams, SignMessageParams, SendTransactionResult, SendTransactionParams, ResolvedFee, ReadContractParams, RawBlockResponse, NftHoldingsResponse, MulticallSuccessResult, MulticallResult, MulticallParams, MulticallFailureResult, MulticallCall, IndexTxSourceParams, GetTransactionParams, GetRawBlockParams, GetNonceParams, GetNftHoldingsParams, GetMapEntryParams, GetDataVarParams, GetContractSourceParams, GetContractParams, GetContractAbiParams, GetBlockParams, GetBalanceParams, GetAccountInfoParams, GetAccountHistoryParams, FeeTier, FeeParam, FeeEstimation, EstimateFeeParams, DeployContractParams, ContractSourceResponse, ContractResponseError, ContractInstance, ContractCallOptions, ContractBuildCallOptions, CallContractParams, AccountInfo, AccountHistoryResponse };
@@ -3,7 +3,7 @@ import {
3
3
  buildFunctionArgs,
4
4
  getContract,
5
5
  isResponseOutput
6
- } from "../../shared/stacks-jpt52csy.js";
6
+ } from "../../shared/stacks-e3nwm1dz.js";
7
7
  import {
8
8
  deployContract,
9
9
  getAccountHistory,
@@ -14,19 +14,18 @@ import {
14
14
  getMempoolStats,
15
15
  getNftHoldings,
16
16
  getRawBlock,
17
- getTransaction,
18
17
  signMessage,
19
18
  signTransactionAction,
20
19
  simulateCall,
21
20
  simulateTransaction,
22
21
  sponsorTransaction,
23
22
  transferStx
24
- } from "../../shared/stacks-7wkf2rph.js";
23
+ } from "../../shared/stacks-7bqkf3b0.js";
25
24
  import {
26
25
  getBalance,
27
26
  getDataVar,
28
27
  multicall
29
- } from "../../shared/stacks-8pfdscq6.js";
28
+ } from "../../shared/stacks-6gavarmy.js";
30
29
  import {
31
30
  callContract,
32
31
  estimateFee,
@@ -34,17 +33,19 @@ import {
34
33
  getBlockHeight,
35
34
  getMapEntry,
36
35
  getNonce,
36
+ getTransaction,
37
37
  indexTxSource,
38
38
  isFeeTier,
39
+ isNoEstimateAvailable,
39
40
  isProviderAccount,
40
41
  minimumFee,
41
42
  resolveFee,
42
43
  sendTransaction,
43
44
  waitForTransactionReceipt
44
- } from "../../shared/stacks-fb75yew8.js";
45
+ } from "../../shared/stacks-n4d8j8q3.js";
45
46
  import {
46
47
  readContract
47
- } from "../../shared/stacks-27fmgajb.js";
48
+ } from "../../shared/stacks-ga026yxz.js";
48
49
  import {
49
50
  watchAddress,
50
51
  watchAddressBalance,
@@ -52,14 +53,14 @@ import {
52
53
  watchMempool,
53
54
  watchNftEvent,
54
55
  watchTransaction
55
- } from "../../shared/stacks-tjjnkt3r.js";
56
- import"../../shared/stacks-709tra19.js";
57
- import"../../shared/stacks-4z72akdf.js";
58
- import"../../shared/stacks-1arrcd11.js";
59
- import"../../shared/stacks-hnqt5rz4.js";
60
- import"../../shared/stacks-w23294am.js";
61
- import"../../shared/stacks-ttdk2g2f.js";
62
- import"../../shared/stacks-bfan7ex7.js";
56
+ } from "../../shared/stacks-wxfd6r4b.js";
57
+ import"../../shared/stacks-x0qqwrev.js";
58
+ import"../../shared/stacks-v2rfr46a.js";
59
+ import"../../shared/stacks-9c1yam8b.js";
60
+ import"../../shared/stacks-51ybf135.js";
61
+ import"../../shared/stacks-69nq48jp.js";
62
+ import"../../shared/stacks-4hs8r4q2.js";
63
+ import"../../shared/stacks-4d7c3x27.js";
63
64
  import"../../shared/stacks-qs5fzts5.js";
64
65
  export {
65
66
  watchTransaction,
@@ -82,6 +83,7 @@ export {
82
83
  minimumFee,
83
84
  isResponseOutput,
84
85
  isProviderAccount,
86
+ isNoEstimateAvailable,
85
87
  isFeeTier,
86
88
  indexTxSource,
87
89
  getTransaction,
@@ -107,5 +109,5 @@ export {
107
109
  ContractResponseError
108
110
  };
109
111
 
110
- //# debugId=30258F7ACEFDEE5C64756E2164756E21
112
+ //# debugId=79C026A02850368C64756E2164756E21
111
113
  //# sourceMappingURL=index.js.map
@@ -4,6 +4,6 @@
4
4
  "sourcesContent": [
5
5
  ],
6
6
  "mappings": "",
7
- "debugId": "30258F7ACEFDEE5C64756E2164756E21",
7
+ "debugId": "79C026A02850368C64756E2164756E21",
8
8
  "names": []
9
9
  }
@@ -524,6 +524,15 @@ type NonceManager = {
524
524
  client: Client
525
525
  address: string
526
526
  }): void | Promise<void>
527
+ /**
528
+ * Give back a nonce from {@link NonceManager.consume} whose transaction
529
+ * was never accepted by the node. No-op unless it is the latest issued.
530
+ */
531
+ release(params: {
532
+ client: Client
533
+ address: string
534
+ nonce: bigint
535
+ }): void | Promise<void>
527
536
  /** Next nonce that {@link NonceManager.consume} would return without consuming it, or `undefined` if untracked. */
528
537
  peek(params: {
529
538
  client: Client
@@ -579,14 +588,32 @@ type RequestOptions = {
579
588
  method?: "GET" | "POST" | "PUT" | "DELETE"
580
589
  body?: unknown
581
590
  headers?: Record<string, string>
591
+ /**
592
+ * Cancel the request from the caller's side. An aborted signal rejects
593
+ * with the signal's reason immediately and never retries; it is combined
594
+ * with the transport's own per-attempt timeout.
595
+ */
596
+ signal?: AbortSignal
597
+ /**
598
+ * Override the transport's retry budget for this one request. Broadcasts
599
+ * pass `0`: re-sending a transaction the node may already hold trades a
600
+ * transient failure for a confusing nonce conflict.
601
+ */
602
+ retryCount?: number
582
603
  };
583
604
  /** Shared configuration for all transport types. */
584
605
  type TransportConfig = {
585
606
  url?: string
607
+ /**
608
+ * Per-attempt deadline in ms covering headers AND body. A stalled body
609
+ * rejects with `TimeoutError` instead of hanging. Default 30_000.
610
+ */
586
611
  timeout?: number
587
612
  retryCount?: number
588
613
  retryDelay?: number
589
614
  fetchOptions?: RequestInit
615
+ /** Sent as `x-api-key`. Held in the request closure and stripped from
616
+ * `Transport.config` so it never prints with the client. */
590
617
  apiKey?: string
591
618
  };
592
619
  /** A resolved transport instance with a bound request function. */