@secondlayer/stacks 4.3.1 → 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.
- package/README.md +27 -11
- package/dist/shared/{stacks-gxq2pbky.js → stacks-2as26bcg.js} +10 -7
- package/dist/shared/stacks-2as26bcg.js.map +13 -0
- package/dist/shared/{stacks-bfan7ex7.js → stacks-4d7c3x27.js} +5 -5
- package/dist/shared/{stacks-bfan7ex7.js.map → stacks-4d7c3x27.js.map} +3 -3
- package/dist/shared/{stacks-709tra19.js → stacks-4hs8r4q2.js} +16 -2
- package/dist/shared/stacks-4hs8r4q2.js.map +10 -0
- package/dist/shared/{stacks-w23294am.js → stacks-51ybf135.js} +3 -3
- package/dist/shared/{stacks-0jk7vd8r.cjs → stacks-69nq48jp.js} +120 -17
- package/dist/shared/stacks-69nq48jp.js.map +15 -0
- package/dist/shared/{stacks-8pfdscq6.js → stacks-6gavarmy.js} +37 -9
- package/dist/shared/stacks-6gavarmy.js.map +12 -0
- package/dist/shared/{stacks-7wkf2rph.js → stacks-7bqkf3b0.js} +86 -71
- package/dist/shared/{stacks-7wkf2rph.js.map → stacks-7bqkf3b0.js.map} +9 -10
- package/dist/shared/{stacks-zcpvzbr0.js → stacks-8brgfvqx.js} +3 -3
- package/dist/shared/{stacks-4vzmhw3q.cjs → stacks-8vzxax5e.cjs} +13 -3
- package/dist/shared/stacks-8vzxax5e.cjs.map +10 -0
- package/dist/shared/{stacks-hnqt5rz4.js → stacks-9c1yam8b.js} +3 -3
- package/dist/shared/{stacks-bnbdqznq.cjs → stacks-bdgh9n83.cjs} +11 -10
- package/dist/shared/{stacks-bnbdqznq.cjs.map → stacks-bdgh9n83.cjs.map} +3 -3
- package/dist/shared/{stacks-fb75yew8.js → stacks-db3kwavg.cjs} +346 -138
- package/dist/shared/stacks-db3kwavg.cjs.map +23 -0
- package/dist/shared/{stacks-jpt52csy.js → stacks-e3nwm1dz.js} +14 -17
- package/dist/shared/stacks-e3nwm1dz.js.map +10 -0
- package/dist/shared/{stacks-27fmgajb.js → stacks-ga026yxz.js} +9 -9
- package/dist/shared/{stacks-27fmgajb.js.map → stacks-ga026yxz.js.map} +3 -3
- package/dist/shared/{stacks-nyaw1z2a.cjs → stacks-ggdz96r1.cjs} +4 -4
- package/dist/shared/{stacks-nyaw1z2a.cjs.map → stacks-ggdz96r1.cjs.map} +3 -3
- package/dist/shared/{stacks-08y0y0t7.js → stacks-gjz26k6b.js} +2 -2
- package/dist/shared/{stacks-x5386y2y.cjs → stacks-gza2n1zs.cjs} +5 -5
- package/dist/shared/{stacks-x5386y2y.cjs.map → stacks-gza2n1zs.cjs.map} +3 -3
- package/dist/shared/{stacks-ta1gar0b.cjs → stacks-kqn4y8kq.cjs} +7 -5
- package/dist/shared/{stacks-ta1gar0b.cjs.map → stacks-kqn4y8kq.cjs.map} +3 -3
- package/dist/shared/{stacks-ztzygy90.js → stacks-mftyrc60.js} +2 -2
- package/dist/shared/stacks-n4d8j8q3.js +801 -0
- package/dist/shared/stacks-n4d8j8q3.js.map +23 -0
- package/dist/shared/{stacks-ycbq8pf7.cjs → stacks-p337hp6m.cjs} +74 -59
- package/dist/shared/{stacks-ycbq8pf7.cjs.map → stacks-p337hp6m.cjs.map} +9 -10
- package/dist/shared/{stacks-ttdk2g2f.js → stacks-s5vej5z6.cjs} +92 -41
- package/dist/shared/stacks-s5vej5z6.cjs.map +15 -0
- package/dist/shared/stacks-sdqkapct.cjs +67 -0
- package/dist/shared/stacks-sdqkapct.cjs.map +12 -0
- package/dist/shared/{stacks-1arrcd11.js → stacks-v2rfr46a.js} +2 -2
- package/dist/shared/{stacks-9mqveyjv.cjs → stacks-w9t61fra.cjs} +7 -10
- package/dist/shared/stacks-w9t61fra.cjs.map +10 -0
- package/dist/shared/{stacks-tjjnkt3r.js → stacks-wxfd6r4b.js} +2 -2
- package/dist/shared/{stacks-4z72akdf.js → stacks-x0qqwrev.js} +3 -3
- package/dist/shared/{stacks-gck1sq7h.cjs → stacks-xjkn3en1.cjs} +16 -2
- package/dist/shared/stacks-xjkn3en1.cjs.map +10 -0
- package/dist/shared/stacks-xnrywjf1.cjs +131 -0
- package/dist/shared/stacks-xnrywjf1.cjs.map +11 -0
- package/dist/shared/stacks-yajyej2y.js +139 -0
- package/dist/shared/stacks-yajyej2y.js.map +11 -0
- package/dist/shared/{stacks-913a2rx7.js → stacks-yvb7rvwk.js} +13 -3
- package/dist/shared/stacks-yvb7rvwk.js.map +10 -0
- package/dist/shared/{stacks-0cdm20eh.js → stacks-z90xdr1x.js} +7 -11
- package/dist/shared/{stacks-0cdm20eh.js.map → stacks-z90xdr1x.js.map} +3 -3
- package/dist/src/accounts/index.js +2 -3
- package/dist/src/accounts/index.js.map +2 -2
- package/dist/src/actions/index.cjs +2 -1
- package/dist/src/actions/index.cjs.map +1 -1
- package/dist/src/actions/index.d.cts +108 -20
- package/dist/src/actions/index.d.ts +108 -20
- package/dist/src/actions/index.js +17 -15
- package/dist/src/actions/index.js.map +1 -1
- package/dist/src/bitcoin/index.d.cts +27 -0
- package/dist/src/bitcoin/index.d.ts +27 -0
- package/dist/src/bitcoin/index.js +10 -11
- package/dist/src/bitcoin/index.js.map +2 -2
- package/dist/src/bns/index.d.cts +27 -0
- package/dist/src/bns/index.d.ts +27 -0
- package/dist/src/bns/index.js +13 -13
- package/dist/src/bns/index.js.map +1 -1
- package/dist/src/clarity/index.js +7 -6
- package/dist/src/clarity/index.js.map +1 -1
- package/dist/src/connect/index.cjs +44 -30
- package/dist/src/connect/index.cjs.map +7 -7
- package/dist/src/connect/index.d.cts +16 -1
- package/dist/src/connect/index.d.ts +16 -1
- package/dist/src/connect/index.js +44 -30
- package/dist/src/connect/index.js.map +7 -7
- package/dist/src/connect/walletconnect/index.cjs +49 -413
- package/dist/src/connect/walletconnect/index.cjs.map +4 -4
- package/dist/src/connect/walletconnect/index.js +47 -411
- package/dist/src/connect/walletconnect/index.js.map +4 -4
- package/dist/src/filters/index.js +2 -2
- package/dist/src/index.cjs +49 -124
- package/dist/src/index.cjs.map +6 -8
- package/dist/src/index.d.cts +163 -54
- package/dist/src/index.d.ts +163 -54
- package/dist/src/index.js +79 -147
- package/dist/src/index.js.map +6 -8
- package/dist/src/postconditions/index.js +6 -5
- package/dist/src/postconditions/index.js.map +1 -1
- package/dist/src/pox/index.cjs +7 -83
- package/dist/src/pox/index.cjs.map +3 -3
- package/dist/src/pox/index.d.cts +32 -1
- package/dist/src/pox/index.d.ts +32 -1
- package/dist/src/pox/index.js +22 -102
- package/dist/src/pox/index.js.map +3 -3
- package/dist/src/pox5/index.cjs +4 -129
- package/dist/src/pox5/index.cjs.map +3 -4
- package/dist/src/pox5/index.d.cts +27 -0
- package/dist/src/pox5/index.d.ts +27 -0
- package/dist/src/pox5/index.js +20 -148
- package/dist/src/pox5/index.js.map +3 -4
- package/dist/src/sbtc/index.cjs +2 -59
- package/dist/src/sbtc/index.cjs.map +3 -3
- package/dist/src/sbtc/index.d.cts +30 -2
- package/dist/src/sbtc/index.d.ts +30 -2
- package/dist/src/sbtc/index.js +15 -74
- package/dist/src/sbtc/index.js.map +3 -3
- package/dist/src/stackingdao/index.d.cts +27 -0
- package/dist/src/stackingdao/index.d.ts +27 -0
- package/dist/src/stackingdao/index.js +11 -11
- package/dist/src/stackingdao/index.js.map +1 -1
- package/dist/src/subscriptions/index.d.cts +27 -0
- package/dist/src/subscriptions/index.d.ts +27 -0
- package/dist/src/subscriptions/index.js +2 -2
- package/dist/src/tools/btc/index.cjs.map +2 -2
- package/dist/src/tools/btc/index.js.map +2 -2
- package/dist/src/tools/index.cjs +629 -392
- package/dist/src/tools/index.cjs.map +30 -28
- package/dist/src/tools/index.d.cts +44 -0
- package/dist/src/tools/index.d.ts +44 -0
- package/dist/src/tools/index.js +628 -391
- package/dist/src/tools/index.js.map +30 -28
- package/dist/src/transactions/index.js +6 -5
- package/dist/src/transactions/index.js.map +1 -1
- package/dist/src/utils/index.d.cts +2 -5
- package/dist/src/utils/index.d.ts +2 -5
- package/dist/src/utils/index.js +2 -2
- package/package.json +18 -7
- package/dist/shared/stacks-0eatsx6d.cjs +0 -25
- package/dist/shared/stacks-0eatsx6d.cjs.map +0 -10
- package/dist/shared/stacks-0jk7vd8r.cjs.map +0 -14
- package/dist/shared/stacks-4vzmhw3q.cjs.map +0 -10
- package/dist/shared/stacks-5nmz5ad9.js +0 -409
- package/dist/shared/stacks-5nmz5ad9.js.map +0 -10
- package/dist/shared/stacks-709tra19.js.map +0 -10
- package/dist/shared/stacks-8pfdscq6.js.map +0 -12
- package/dist/shared/stacks-913a2rx7.js.map +0 -10
- package/dist/shared/stacks-9mqveyjv.cjs.map +0 -10
- package/dist/shared/stacks-e4xn4m7j.js +0 -27
- package/dist/shared/stacks-e4xn4m7j.js.map +0 -10
- package/dist/shared/stacks-fb75yew8.js.map +0 -21
- package/dist/shared/stacks-gck1sq7h.cjs.map +0 -10
- package/dist/shared/stacks-gxq2pbky.js.map +0 -13
- package/dist/shared/stacks-jpt52csy.js.map +0 -10
- package/dist/shared/stacks-mnnhpex3.cjs +0 -407
- package/dist/shared/stacks-mnnhpex3.cjs.map +0 -10
- package/dist/shared/stacks-tdsp5gsb.cjs +0 -527
- package/dist/shared/stacks-tdsp5gsb.cjs.map +0 -21
- package/dist/shared/stacks-ttdk2g2f.js.map +0 -14
- package/dist/shared/stacks-wdp5yr8n.cjs +0 -39
- package/dist/shared/stacks-wdp5yr8n.cjs.map +0 -12
- /package/dist/shared/{stacks-w23294am.js.map → stacks-51ybf135.js.map} +0 -0
- /package/dist/shared/{stacks-zcpvzbr0.js.map → stacks-8brgfvqx.js.map} +0 -0
- /package/dist/shared/{stacks-hnqt5rz4.js.map → stacks-9c1yam8b.js.map} +0 -0
- /package/dist/shared/{stacks-08y0y0t7.js.map → stacks-gjz26k6b.js.map} +0 -0
- /package/dist/shared/{stacks-ztzygy90.js.map → stacks-mftyrc60.js.map} +0 -0
- /package/dist/shared/{stacks-1arrcd11.js.map → stacks-v2rfr46a.js.map} +0 -0
- /package/dist/shared/{stacks-tjjnkt3r.js.map → stacks-wxfd6r4b.js.map} +0 -0
- /package/dist/shared/{stacks-4z72akdf.js.map → stacks-x0qqwrev.js.map} +0 -0
package/dist/src/index.d.ts
CHANGED
|
@@ -761,6 +761,14 @@ type NonceStore = {
|
|
|
761
761
|
/** Forget tracked state for `key` so the next reserve re-syncs from the floor. */
|
|
762
762
|
reset(key: string): void | Promise<void>
|
|
763
763
|
/**
|
|
764
|
+
* Hand back a nonce that {@link NonceStore.reserve} issued but that never
|
|
765
|
+
* reached the mempool. Rolls the counter back ONLY when `nonce` is the
|
|
766
|
+
* most recently issued value (`next - 1`); a stale release, or one that
|
|
767
|
+
* races a newer reservation, is a no-op. Optional: stores that omit it
|
|
768
|
+
* leave the gap for {@link reconcileNonce} to heal.
|
|
769
|
+
*/
|
|
770
|
+
release?(key: string, nonce: bigint): void | Promise<void>
|
|
771
|
+
/**
|
|
764
772
|
* Return the next nonce that {@link NonceStore.reserve} would hand out for
|
|
765
773
|
* `key` WITHOUT consuming it, or `undefined` if `key` is untracked. Used by
|
|
766
774
|
* {@link reconcileNonce} to detect drift. Optional — stores that omit it
|
|
@@ -778,6 +786,15 @@ type NonceManager = {
|
|
|
778
786
|
client: Client
|
|
779
787
|
address: string
|
|
780
788
|
}): void | Promise<void>
|
|
789
|
+
/**
|
|
790
|
+
* Give back a nonce from {@link NonceManager.consume} whose transaction
|
|
791
|
+
* was never accepted by the node. No-op unless it is the latest issued.
|
|
792
|
+
*/
|
|
793
|
+
release(params: {
|
|
794
|
+
client: Client
|
|
795
|
+
address: string
|
|
796
|
+
nonce: bigint
|
|
797
|
+
}): void | Promise<void>
|
|
781
798
|
/** Next nonce that {@link NonceManager.consume} would return without consuming it, or `undefined` if untracked. */
|
|
782
799
|
peek(params: {
|
|
783
800
|
client: Client
|
|
@@ -932,14 +949,32 @@ type RequestOptions = {
|
|
|
932
949
|
method?: "GET" | "POST" | "PUT" | "DELETE"
|
|
933
950
|
body?: unknown
|
|
934
951
|
headers?: Record<string, string>
|
|
952
|
+
/**
|
|
953
|
+
* Cancel the request from the caller's side. An aborted signal rejects
|
|
954
|
+
* with the signal's reason immediately and never retries; it is combined
|
|
955
|
+
* with the transport's own per-attempt timeout.
|
|
956
|
+
*/
|
|
957
|
+
signal?: AbortSignal
|
|
958
|
+
/**
|
|
959
|
+
* Override the transport's retry budget for this one request. Broadcasts
|
|
960
|
+
* pass `0`: re-sending a transaction the node may already hold trades a
|
|
961
|
+
* transient failure for a confusing nonce conflict.
|
|
962
|
+
*/
|
|
963
|
+
retryCount?: number
|
|
935
964
|
};
|
|
936
965
|
/** Shared configuration for all transport types. */
|
|
937
966
|
type TransportConfig = {
|
|
938
967
|
url?: string
|
|
968
|
+
/**
|
|
969
|
+
* Per-attempt deadline in ms covering headers AND body. A stalled body
|
|
970
|
+
* rejects with `TimeoutError` instead of hanging. Default 30_000.
|
|
971
|
+
*/
|
|
939
972
|
timeout?: number
|
|
940
973
|
retryCount?: number
|
|
941
974
|
retryDelay?: number
|
|
942
975
|
fetchOptions?: RequestInit
|
|
976
|
+
/** Sent as `x-api-key`. Held in the request closure and stripped from
|
|
977
|
+
* `Transport.config` so it never prints with the client. */
|
|
943
978
|
apiKey?: string
|
|
944
979
|
};
|
|
945
980
|
/** A resolved transport instance with a bound request function. */
|
|
@@ -1073,6 +1108,47 @@ type RawBlockResponse = {
|
|
|
1073
1108
|
miner_txid: string
|
|
1074
1109
|
txs: string[]
|
|
1075
1110
|
};
|
|
1111
|
+
declare class BaseError extends Error {
|
|
1112
|
+
private;
|
|
1113
|
+
name: string;
|
|
1114
|
+
shortMessage: string;
|
|
1115
|
+
details?: string;
|
|
1116
|
+
constructor(shortMessage: string, options?: {
|
|
1117
|
+
cause?: Error
|
|
1118
|
+
details?: string
|
|
1119
|
+
code?: string
|
|
1120
|
+
});
|
|
1121
|
+
/**
|
|
1122
|
+
* Stable identifier for programmatic handling; survives message
|
|
1123
|
+
* rewording and minification. An explicit `code` option wins, else it
|
|
1124
|
+
* is derived from `name` (`TimeoutError` gives `TIMEOUT_ERROR`).
|
|
1125
|
+
*/
|
|
1126
|
+
get code(): string;
|
|
1127
|
+
set code(value: string);
|
|
1128
|
+
toJSON(): {
|
|
1129
|
+
name: string
|
|
1130
|
+
code: string
|
|
1131
|
+
message: string
|
|
1132
|
+
shortMessage: string
|
|
1133
|
+
details: string | undefined
|
|
1134
|
+
cause: string | undefined
|
|
1135
|
+
};
|
|
1136
|
+
}
|
|
1137
|
+
/** Thrown by the HTTP transport when a response's status isn't 2xx. */
|
|
1138
|
+
declare class HttpRequestError extends BaseError {
|
|
1139
|
+
name: string;
|
|
1140
|
+
status: number;
|
|
1141
|
+
/** Request URL, when the transport knows it. */
|
|
1142
|
+
url?: string;
|
|
1143
|
+
/** Request method, when the transport knows it. */
|
|
1144
|
+
method?: string;
|
|
1145
|
+
constructor(status: number, options?: {
|
|
1146
|
+
cause?: Error
|
|
1147
|
+
details?: string
|
|
1148
|
+
url?: string
|
|
1149
|
+
method?: string
|
|
1150
|
+
});
|
|
1151
|
+
}
|
|
1076
1152
|
/**
|
|
1077
1153
|
* Pluggable transaction-status sources for {@link getTransaction} /
|
|
1078
1154
|
* `waitForTransactionReceipt`.
|
|
@@ -1083,9 +1159,9 @@ type RawBlockResponse = {
|
|
|
1083
1159
|
*
|
|
1084
1160
|
* - {@link extendedApiSource} — default; `/extended/v1/tx/{txid}` on the
|
|
1085
1161
|
* client's transport host (Hiro API or any extended-API-compatible host).
|
|
1086
|
-
* - {@link indexTxSource}
|
|
1087
|
-
* returns the chain tip in the same
|
|
1088
|
-
* need no second request.
|
|
1162
|
+
* - {@link indexTxSource}: a Secondlayer instance's
|
|
1163
|
+
* `/v1/index/transactions/{txid}`; returns the chain tip in the same
|
|
1164
|
+
* response, so N-confirmation waits need no second request.
|
|
1089
1165
|
*/
|
|
1090
1166
|
type TransactionStatus = "pending" | "success" | "abort_by_response" | "abort_by_post_condition" | "dropped";
|
|
1091
1167
|
type TransactionReceipt = {
|
|
@@ -1112,8 +1188,23 @@ type TransactionStatusSource = {
|
|
|
1112
1188
|
client: Client
|
|
1113
1189
|
txid: string
|
|
1114
1190
|
}): Promise<TransactionSnapshot>
|
|
1191
|
+
/**
|
|
1192
|
+
* True when the source only knows mined transactions and reports
|
|
1193
|
+
* `receipt: null` for the whole mempool life of a tx. The wait action
|
|
1194
|
+
* then stretches its dropped-grace window to the full timeout, since
|
|
1195
|
+
* "unknown" cannot mean "dropped" until the deadline.
|
|
1196
|
+
*/
|
|
1197
|
+
canonicalOnly?: boolean
|
|
1115
1198
|
};
|
|
1116
|
-
|
|
1199
|
+
/**
|
|
1200
|
+
* Thrown when an index-backed source cannot reach a Secondlayer instance
|
|
1201
|
+
* because of how it was configured (no URL, a Hiro host, a bare node).
|
|
1202
|
+
* Sources that degrade on transient failures let this one through: a
|
|
1203
|
+
* misconfiguration would otherwise degrade silently on every read.
|
|
1204
|
+
*/
|
|
1205
|
+
declare class IndexSourceConfigError extends Error {
|
|
1206
|
+
name: string;
|
|
1207
|
+
}
|
|
1117
1208
|
/**
|
|
1118
1209
|
* Default source: `GET /extended/v1/tx/{txid}` via the client's transport.
|
|
1119
1210
|
* Requires a host that serves Hiro's extended API (a bare stacks-node does
|
|
@@ -1122,17 +1213,25 @@ type FetchImpl = typeof globalThis.fetch;
|
|
|
1122
1213
|
*/
|
|
1123
1214
|
declare function extendedApiSource(): TransactionStatusSource;
|
|
1124
1215
|
type IndexTxSourceParams = {
|
|
1125
|
-
/**
|
|
1216
|
+
/**
|
|
1217
|
+
* URL of your Secondlayer instance. Without it the client's transport
|
|
1218
|
+
* URL is assumed to be the instance: a transport on a Hiro host throws
|
|
1219
|
+
* up front, and a host that answers `/v1/index` with a non-JSON 404
|
|
1220
|
+
* (a bare stacks-node) throws on the first read. Pass it whenever the
|
|
1221
|
+
* transport is not the instance.
|
|
1222
|
+
*/
|
|
1126
1223
|
baseUrl?: string
|
|
1224
|
+
/** Instance token, sent as `Authorization: Bearer`. */
|
|
1127
1225
|
apiKey?: string
|
|
1128
|
-
fetchImpl?: FetchImpl
|
|
1129
1226
|
};
|
|
1130
1227
|
/**
|
|
1131
|
-
* Source backed by Secondlayer's `/v1/index/transactions/{txid}`.
|
|
1132
|
-
* embeds the chain tip, so N-confirmation math needs no extra
|
|
1133
|
-
*
|
|
1134
|
-
*
|
|
1135
|
-
*
|
|
1228
|
+
* Source backed by a Secondlayer instance's `/v1/index/transactions/{txid}`.
|
|
1229
|
+
* The response embeds the chain tip, so N-confirmation math needs no extra
|
|
1230
|
+
* request. Requests go through the transport layer: same retries, timeout
|
|
1231
|
+
* and typed errors as every other read. The index only returns canonical
|
|
1232
|
+
* (mined) transactions; while a tx is in the mempool this source reports
|
|
1233
|
+
* `receipt: null`, and the wait action's grace window carries it until
|
|
1234
|
+
* inclusion.
|
|
1136
1235
|
*/
|
|
1137
1236
|
declare function indexTxSource(params?: IndexTxSourceParams): TransactionStatusSource;
|
|
1138
1237
|
type GetTransactionParams = {
|
|
@@ -1154,6 +1253,13 @@ type MulticallCall = {
|
|
|
1154
1253
|
type MulticallParams<TAllowFailure extends boolean = true> = {
|
|
1155
1254
|
calls: readonly MulticallCall[]
|
|
1156
1255
|
allowFailure?: TAllowFailure
|
|
1256
|
+
/**
|
|
1257
|
+
* Reads in flight at once. Default 8. Each call is its own
|
|
1258
|
+
* `/v2/contracts/call-read` request (Stacks nodes have no batch RPC), so
|
|
1259
|
+
* an uncapped fan-out turns one multicall into a burst that trips rate
|
|
1260
|
+
* limits and then retries in lockstep.
|
|
1261
|
+
*/
|
|
1262
|
+
concurrency?: number
|
|
1157
1263
|
};
|
|
1158
1264
|
type MulticallSuccessResult = {
|
|
1159
1265
|
status: "success"
|
|
@@ -1176,22 +1282,6 @@ type ReadContractParams = {
|
|
|
1176
1282
|
*/
|
|
1177
1283
|
tip?: string
|
|
1178
1284
|
};
|
|
1179
|
-
declare class BaseError extends Error {
|
|
1180
|
-
name: string;
|
|
1181
|
-
shortMessage: string;
|
|
1182
|
-
details?: string;
|
|
1183
|
-
constructor(shortMessage: string, options?: {
|
|
1184
|
-
cause?: Error
|
|
1185
|
-
details?: string
|
|
1186
|
-
});
|
|
1187
|
-
toJSON(): {
|
|
1188
|
-
name: string
|
|
1189
|
-
message: string
|
|
1190
|
-
shortMessage: string
|
|
1191
|
-
details: string | undefined
|
|
1192
|
-
cause: string | undefined
|
|
1193
|
-
};
|
|
1194
|
-
}
|
|
1195
1285
|
declare class SimulationError extends BaseError {
|
|
1196
1286
|
name: string;
|
|
1197
1287
|
writesDetected: boolean;
|
|
@@ -1245,8 +1335,9 @@ type WaitForTransactionReceiptParams = {
|
|
|
1245
1335
|
pollingInterval?: number
|
|
1246
1336
|
/**
|
|
1247
1337
|
* How long a tx may be unknown to the source before it counts as dropped,
|
|
1248
|
-
* ms. Covers broadcast propagation lag
|
|
1249
|
-
*
|
|
1338
|
+
* ms. Covers broadcast propagation lag. Default 30_000, or the full
|
|
1339
|
+
* `timeout` for a canonical-only source (one that cannot see the
|
|
1340
|
+
* mempool, so "unknown" means "not mined yet" until the deadline).
|
|
1250
1341
|
*/
|
|
1251
1342
|
droppedGracePeriod?: number
|
|
1252
1343
|
/** Where to read status from. Defaults to {@link extendedApiSource}. */
|
|
@@ -1677,10 +1768,10 @@ declare function postgresStore(params: PostgresStoreParams): NonceStore;
|
|
|
1677
1768
|
* is pluggable, so you are never locked to any one provider:
|
|
1678
1769
|
*
|
|
1679
1770
|
* - {@link mempoolAwareSource} — bring your own `getPending`.
|
|
1680
|
-
* - {@link indexSource}
|
|
1771
|
+
* - {@link indexSource}: prebuilt over a Secondlayer instance's `/v1/index/mempool`.
|
|
1681
1772
|
* - {@link hiroNonceSource} — prebuilt over Hiro's `/extended` nonces endpoint.
|
|
1682
1773
|
*/
|
|
1683
|
-
type
|
|
1774
|
+
type FetchImpl = typeof globalThis.fetch;
|
|
1684
1775
|
/**
|
|
1685
1776
|
* The next free nonce ≥ `confirmed` not already taken by a pending tx.
|
|
1686
1777
|
*
|
|
@@ -1708,16 +1799,24 @@ type MempoolAwareSourceParams = {
|
|
|
1708
1799
|
/**
|
|
1709
1800
|
* Build a gap-filling, mempool-aware source from any `getPending`. The confirmed
|
|
1710
1801
|
* floor defaults to the node read; if `getPending` throws, the source degrades
|
|
1711
|
-
* to confirmed-only rather than blocking a broadcast.
|
|
1802
|
+
* to confirmed-only rather than blocking a broadcast. A misconfigured pending
|
|
1803
|
+
* feed ({@link IndexSourceConfigError}) is rethrown: it would fail on every
|
|
1804
|
+
* read, and degrading silently would hide that the mempool is never consulted.
|
|
1712
1805
|
*/
|
|
1713
1806
|
declare function mempoolAwareSource(params: MempoolAwareSourceParams): NonceManagerSource;
|
|
1714
1807
|
type IndexSourceParams = {
|
|
1715
|
-
/**
|
|
1808
|
+
/**
|
|
1809
|
+
* URL of your Secondlayer instance. Without it the client's transport
|
|
1810
|
+
* URL is assumed to be the instance: a transport on a Hiro host throws
|
|
1811
|
+
* up front, and a host that answers `/v1/index` with a non-JSON 404
|
|
1812
|
+
* (a bare stacks-node) throws on the first read. Neither is degraded
|
|
1813
|
+
* to the confirmed floor. Pass it whenever the transport is not the
|
|
1814
|
+
* instance.
|
|
1815
|
+
*/
|
|
1716
1816
|
baseUrl?: string
|
|
1717
|
-
/**
|
|
1817
|
+
/** Instance token, sent as `Authorization: Bearer`. */
|
|
1718
1818
|
apiKey?: string
|
|
1719
|
-
|
|
1720
|
-
/** Max mempool pages to page through per address. Default 10 (×200 = 2000 txs). */
|
|
1819
|
+
/** Max mempool pages to read per address. Default 10 (×200 = 2000 txs). */
|
|
1721
1820
|
maxPages?: number
|
|
1722
1821
|
/** Override the confirmed floor (defaults to the node read). */
|
|
1723
1822
|
getConfirmed?: (args: {
|
|
@@ -1726,17 +1825,22 @@ type IndexSourceParams = {
|
|
|
1726
1825
|
}) => Promise<bigint>
|
|
1727
1826
|
};
|
|
1728
1827
|
/**
|
|
1729
|
-
* Mempool-aware source backed by Secondlayer's `/v1/index/mempool
|
|
1730
|
-
*
|
|
1731
|
-
*
|
|
1732
|
-
*
|
|
1828
|
+
* Mempool-aware source backed by a Secondlayer instance's `/v1/index/mempool`.
|
|
1829
|
+
* Requests go through the transport layer (retries, timeout, typed errors).
|
|
1830
|
+
* The instance's mempool is a go-forward view observed by its own node, so
|
|
1831
|
+
* it can lag or miss transactions that node never saw; the manager's local
|
|
1832
|
+
* increment still prevents same-process collisions. Past `maxPages` the
|
|
1833
|
+
* pending set is truncated and the next free nonce may already be taken;
|
|
1834
|
+
* a nonce conflict at broadcast then resets the manager. Transient failures
|
|
1835
|
+
* (5xx, timeout) degrade to the confirmed floor; a missing or wrong instance
|
|
1836
|
+
* URL throws so the misconfiguration is visible on the first read.
|
|
1733
1837
|
*/
|
|
1734
1838
|
declare function indexSource(params?: IndexSourceParams): NonceManagerSource;
|
|
1735
1839
|
type HiroNonceSourceParams = {
|
|
1736
1840
|
/** Hiro API base URL, e.g. `https://api.hiro.so` or `https://api.testnet.hiro.so`. */
|
|
1737
1841
|
baseUrl: string
|
|
1738
1842
|
apiKey?: string
|
|
1739
|
-
fetchImpl?:
|
|
1843
|
+
fetchImpl?: FetchImpl
|
|
1740
1844
|
};
|
|
1741
1845
|
/**
|
|
1742
1846
|
* Off-the-shelf, non-Secondlayer mempool-aware source over Hiro's
|
|
@@ -1856,19 +1960,24 @@ declare class SerializationError extends BaseError {
|
|
|
1856
1960
|
declare class SigningError extends BaseError {
|
|
1857
1961
|
name: string;
|
|
1858
1962
|
}
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
declare class HttpRequestError extends BaseError {
|
|
1963
|
+
/**
|
|
1964
|
+
* Thrown by the HTTP transport when a request, headers and body included,
|
|
1965
|
+
* does not finish inside `timeout`. Carries enough to tell which endpoint
|
|
1966
|
+
* stalled and on which retry attempt. A caller-supplied `signal` abort is
|
|
1967
|
+
* NOT a timeout: that rejects with the signal's own reason and never retries.
|
|
1968
|
+
*/
|
|
1969
|
+
declare class TimeoutError extends BaseError {
|
|
1867
1970
|
name: string;
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1971
|
+
method: string;
|
|
1972
|
+
url: string;
|
|
1973
|
+
timeout: number;
|
|
1974
|
+
/** Zero-based attempt index at which the timeout fired. */
|
|
1975
|
+
attempt: number;
|
|
1976
|
+
constructor(params: {
|
|
1977
|
+
method: string
|
|
1978
|
+
url: string
|
|
1979
|
+
timeout: number
|
|
1980
|
+
attempt: number
|
|
1872
1981
|
});
|
|
1873
1982
|
}
|
|
1874
1983
|
/** Thrown when a node/API response is missing an expected field. */
|
|
@@ -1878,4 +1987,4 @@ declare class MalformedResponseError extends BaseError {
|
|
|
1878
1987
|
declare class WebSocketError extends BaseError {
|
|
1879
1988
|
name: string;
|
|
1880
1989
|
}
|
|
1881
|
-
export { webSocket, walletActions, waitForTransactionReceipt2 as waitForTransactionReceipt, testnet, startNonceReconciler, resolveNonce, redisStore, reconcileNonce, publicActions, providerToAccount, postgresStore, parseStx, on, nextFreeNonce, multisigActions, mocknet, mempoolAwareSource, memoryStore, mainnet, jsonRpcSource, isValidAddress, isNonceConflictError, isAddressEqual, indexTxSource, indexSource, http, hiroNonceSource, getTransaction2 as getTransaction, getContractAddress, formatStx, fallback, extendedApiSource, devnet, defineChain, custom, createWalletClient, createPublicClient, createNonceManager, createMultiSigClient, createClient, broadcastWithNonceReset, ZERO_ADDRESS, WebSocketTransportConfig, WebSocketTransport, WebSocketError, WalletClientConfig, WalletClient, WalletActions, WaitForTransactionTimeoutError, WaitForTransactionReceiptParams, TxRejectionReason, TransportFactory, TransportConfig, Transport, TransactionStatusSource, TransactionStatus, TransactionSnapshot, TransactionReceipt, TransactionError, TransactionDroppedError, TransactionAbortedError, TESTNET_ZERO_ADDRESS, Subscription, StartNonceReconcilerParams, StacksProvider, StacksChain, SqlLike, SimulationError, SigningError, SerializationError, RequestOptions, RequestFn, RedisStoreParams, RedisLike, ReconcileNonceResult, ReconcileNonceParams,
|
|
1990
|
+
export { webSocket, walletActions, waitForTransactionReceipt2 as waitForTransactionReceipt, testnet, startNonceReconciler, resolveNonce, redisStore, reconcileNonce, publicActions, providerToAccount, postgresStore, parseStx, on, nextFreeNonce, multisigActions, mocknet, mempoolAwareSource, memoryStore, mainnet, jsonRpcSource, isValidAddress, isNonceConflictError, isAddressEqual, indexTxSource, indexSource, http, hiroNonceSource, getTransaction2 as getTransaction, getContractAddress, formatStx, fallback, extendedApiSource, devnet, defineChain, custom, createWalletClient, createPublicClient, createNonceManager, createMultiSigClient, createClient, broadcastWithNonceReset, ZERO_ADDRESS, WebSocketTransportConfig, WebSocketTransport, WebSocketError, WalletClientConfig, WalletClient, WalletActions, WaitForTransactionTimeoutError, WaitForTransactionReceiptParams, TxRejectionReason, TransportFactory, TransportConfig, Transport, TransactionStatusSource, TransactionStatus, TransactionSnapshot, TransactionReceipt, TransactionError, TransactionDroppedError, TransactionAbortedError, TimeoutError, TESTNET_ZERO_ADDRESS, Subscription, StartNonceReconcilerParams, StacksProvider, StacksChain, SqlLike, SimulationError, SigningError, SerializationError, RequestOptions, RequestFn, RedisStoreParams, RedisLike, ReconcileNonceResult, ReconcileNonceParams, PublicClientConfig, PublicClient, PublicActions, ProviderAccount, PostgresStoreParams, NonceStore, NonceManagerSource, NonceManager, MultiSigClientConfig, MultiSigClient, MultiSigActions, MempoolAwareSourceParams, MalformedResponseError, MICROSTX_PER_STX, LocalAccount, IndexTxSourceParams, IndexSourceParams, IndexSourceConfigError, HttpRequestError, HiroNonceSourceParams, GetTransactionParams, CustomAccount, CreateNonceManagerParams, ClientConfig, Client, ChainTriggerOf, ChainEventFilterType, ChainEventFilterSpec, ChainEventFilter, BroadcastError, BaseError, AddressVersion, Account };
|