@secondlayer/stacks 0.2.1 → 0.3.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 (171) hide show
  1. package/dist/shared/stacks-02actsrx.cjs.map +2 -2
  2. package/dist/shared/{stacks-vyb9rx8q.js → stacks-09wa7ewe.js} +125 -115
  3. package/dist/shared/stacks-09wa7ewe.js.map +15 -0
  4. package/dist/shared/{stacks-ky14tdf6.cjs → stacks-0nfexv24.cjs} +20 -8
  5. package/dist/shared/stacks-0nfexv24.cjs.map +14 -0
  6. package/dist/shared/{stacks-an5k8n4t.cjs → stacks-14pgpkrr.cjs} +82 -73
  7. package/dist/shared/stacks-14pgpkrr.cjs.map +23 -0
  8. package/dist/shared/{stacks-vbke9mqw.cjs → stacks-17sdtaxg.cjs} +120 -106
  9. package/dist/shared/stacks-17sdtaxg.cjs.map +15 -0
  10. package/dist/shared/{stacks-wrb1es85.js → stacks-1s5w4ncf.js} +46 -34
  11. package/dist/shared/stacks-1s5w4ncf.js.map +17 -0
  12. package/dist/shared/stacks-24h5k94q.cjs.map +3 -3
  13. package/dist/shared/{stacks-evnzth1q.cjs → stacks-4vzmhw3q.cjs} +3 -3
  14. package/dist/shared/stacks-4vzmhw3q.cjs.map +10 -0
  15. package/dist/shared/{stacks-vd9jcp0b.js → stacks-4x2bcc2k.js} +89 -80
  16. package/dist/shared/stacks-4x2bcc2k.js.map +23 -0
  17. package/dist/shared/stacks-5tprhns9.cjs.map +3 -3
  18. package/dist/shared/stacks-709tra19.js.map +2 -2
  19. package/dist/shared/{stacks-qcx67vqa.js → stacks-70p84bgg.js} +3 -3
  20. package/dist/shared/stacks-70p84bgg.js.map +10 -0
  21. package/dist/shared/{stacks-k2p5tv6x.js → stacks-913a2rx7.js} +3 -3
  22. package/dist/shared/stacks-913a2rx7.js.map +10 -0
  23. package/dist/shared/{stacks-qyt8m5v0.js → stacks-96d6m1zy.js} +16 -7
  24. package/dist/shared/stacks-96d6m1zy.js.map +11 -0
  25. package/dist/shared/stacks-9g0jhab3.cjs.map +2 -2
  26. package/dist/shared/stacks-dr5en54r.cjs.map +2 -2
  27. package/dist/shared/stacks-fcaefc5b.cjs.map +2 -2
  28. package/dist/shared/stacks-gck1sq7h.cjs.map +2 -2
  29. package/dist/shared/{stacks-yfveb68e.js → stacks-je937aas.js} +3 -3
  30. package/dist/shared/stacks-je937aas.js.map +10 -0
  31. package/dist/shared/{stacks-k58k970n.js → stacks-kg1npstf.js} +5 -3
  32. package/dist/shared/stacks-kg1npstf.js.map +10 -0
  33. package/dist/shared/{stacks-qvg7c24g.cjs → stacks-n98w7g57.cjs} +5 -3
  34. package/dist/shared/stacks-n98w7g57.cjs.map +10 -0
  35. package/dist/shared/{stacks-9mdk86wp.js → stacks-nqae5amn.cjs} +77 -159
  36. package/dist/shared/stacks-nqae5amn.cjs.map +10 -0
  37. package/dist/shared/stacks-qcae5852.js.map +2 -2
  38. package/dist/shared/stacks-qt8ehebn.js.map +3 -3
  39. package/dist/shared/{stacks-r1t6g3c3.cjs → stacks-ra02bpny.cjs} +8 -3
  40. package/dist/shared/stacks-ra02bpny.cjs.map +11 -0
  41. package/dist/shared/{stacks-bycy6t9k.js → stacks-rwfgts3s.js} +2 -2
  42. package/dist/shared/{stacks-bycy6t9k.js.map → stacks-rwfgts3s.js.map} +2 -2
  43. package/dist/shared/{stacks-gjvbq6w7.js → stacks-s10yb9gz.js} +2 -2
  44. package/dist/shared/stacks-s10yb9gz.js.map +10 -0
  45. package/dist/shared/{stacks-v3zy6zds.cjs → stacks-s30kkvm8.js} +104 -117
  46. package/dist/shared/stacks-s30kkvm8.js.map +10 -0
  47. package/dist/shared/{stacks-nqytwfcc.js → stacks-s7z5q8be.js} +8 -3
  48. package/dist/shared/stacks-s7z5q8be.js.map +11 -0
  49. package/dist/shared/stacks-v9jqcpd4.js.map +2 -2
  50. package/dist/shared/stacks-vdfag81a.cjs.map +2 -2
  51. package/dist/shared/{stacks-fedzr2ka.js → stacks-wjem3xw9.js} +23 -11
  52. package/dist/shared/stacks-wjem3xw9.js.map +14 -0
  53. package/dist/shared/{stacks-k08tgzyp.cjs → stacks-wyxj879g.cjs} +3 -3
  54. package/dist/shared/stacks-wyxj879g.cjs.map +13 -0
  55. package/dist/shared/stacks-y3dh7hv1.js.map +3 -3
  56. package/dist/shared/{stacks-2ar4prfz.cjs → stacks-y5262j0z.cjs} +14 -5
  57. package/dist/shared/stacks-y5262j0z.cjs.map +11 -0
  58. package/dist/shared/stacks-ya3x01yd.cjs.map +2 -2
  59. package/dist/shared/{stacks-9avax1yf.js → stacks-zf7rbpzp.js} +5 -5
  60. package/dist/shared/stacks-zf7rbpzp.js.map +13 -0
  61. package/dist/shared/{stacks-61rvzkz1.cjs → stacks-znrb59ce.cjs} +41 -29
  62. package/dist/shared/stacks-znrb59ce.cjs.map +17 -0
  63. package/dist/src/accounts/index.cjs +2 -2
  64. package/dist/src/accounts/index.cjs.map +5 -5
  65. package/dist/src/accounts/index.js +4 -8
  66. package/dist/src/accounts/index.js.map +5 -5
  67. package/dist/src/actions/index.d.cts +36 -29
  68. package/dist/src/actions/index.d.ts +36 -29
  69. package/dist/src/actions/index.js +10 -10
  70. package/dist/src/bns/index.cjs +55 -43
  71. package/dist/src/bns/index.cjs.map +9 -9
  72. package/dist/src/bns/index.d.cts +29 -29
  73. package/dist/src/bns/index.d.ts +29 -29
  74. package/dist/src/bns/index.js +66 -54
  75. package/dist/src/bns/index.js.map +9 -9
  76. package/dist/src/clarity/index.js +6 -6
  77. package/dist/src/connect/index.cjs +114 -112
  78. package/dist/src/connect/index.cjs.map +13 -13
  79. package/dist/src/connect/index.js +114 -112
  80. package/dist/src/connect/index.js.map +13 -13
  81. package/dist/src/connect/walletconnect/index.cjs +3 -3
  82. package/dist/src/connect/walletconnect/index.cjs.map +10 -10
  83. package/dist/src/connect/walletconnect/index.js +3 -3
  84. package/dist/src/connect/walletconnect/index.js.map +10 -10
  85. package/dist/src/index.cjs +108 -2
  86. package/dist/src/index.cjs.map +19 -15
  87. package/dist/src/index.d.cts +298 -112
  88. package/dist/src/index.d.ts +298 -112
  89. package/dist/src/index.js +125 -12
  90. package/dist/src/index.js.map +19 -15
  91. package/dist/src/postconditions/index.js +3 -3
  92. package/dist/src/pox/index.cjs.map +6 -6
  93. package/dist/src/pox/index.d.cts +29 -29
  94. package/dist/src/pox/index.d.ts +29 -29
  95. package/dist/src/pox/index.js +9 -9
  96. package/dist/src/pox/index.js.map +6 -6
  97. package/dist/src/stackingdao/index.cjs +31 -6
  98. package/dist/src/stackingdao/index.cjs.map +6 -6
  99. package/dist/src/stackingdao/index.d.cts +29 -29
  100. package/dist/src/stackingdao/index.d.ts +29 -29
  101. package/dist/src/stackingdao/index.js +41 -16
  102. package/dist/src/stackingdao/index.js.map +6 -6
  103. package/dist/src/subscriptions/index.d.cts +29 -29
  104. package/dist/src/subscriptions/index.d.ts +29 -29
  105. package/dist/src/tools/btc/index.cjs +130 -0
  106. package/dist/src/tools/btc/index.cjs.map +10 -0
  107. package/dist/src/tools/btc/index.d.cts +8 -0
  108. package/dist/src/tools/btc/index.d.ts +8 -0
  109. package/dist/src/tools/btc/index.js +89 -0
  110. package/dist/src/tools/btc/index.js.map +10 -0
  111. package/dist/src/tools/index.cjs +2470 -0
  112. package/dist/src/tools/index.cjs.map +61 -0
  113. package/dist/src/tools/index.d.cts +144 -0
  114. package/dist/src/tools/index.d.ts +144 -0
  115. package/dist/src/tools/index.js +2435 -0
  116. package/dist/src/tools/index.js.map +61 -0
  117. package/dist/src/transactions/index.d.cts +7 -0
  118. package/dist/src/transactions/index.d.ts +7 -0
  119. package/dist/src/transactions/index.js +6 -6
  120. package/dist/src/triggers/index.cjs +66 -0
  121. package/dist/src/triggers/index.cjs.map +10 -0
  122. package/dist/src/triggers/index.d.cts +116 -0
  123. package/dist/src/triggers/index.d.ts +116 -0
  124. package/dist/src/triggers/index.js +25 -0
  125. package/dist/src/triggers/index.js.map +10 -0
  126. package/dist/src/tx/index.cjs +65 -0
  127. package/dist/src/tx/index.cjs.map +10 -0
  128. package/dist/src/tx/index.d.cts +42 -0
  129. package/dist/src/tx/index.d.ts +42 -0
  130. package/dist/src/tx/index.js +22 -0
  131. package/dist/src/tx/index.js.map +10 -0
  132. package/dist/src/ui/index.cjs +431 -0
  133. package/dist/src/ui/index.cjs.map +27 -0
  134. package/dist/src/ui/index.d.cts +107 -0
  135. package/dist/src/ui/index.d.ts +107 -0
  136. package/dist/src/ui/index.js +391 -0
  137. package/dist/src/ui/index.js.map +27 -0
  138. package/dist/src/ui/schemas.cjs +134 -0
  139. package/dist/src/ui/schemas.cjs.map +18 -0
  140. package/dist/src/ui/schemas.d.cts +83 -0
  141. package/dist/src/ui/schemas.d.ts +83 -0
  142. package/dist/src/ui/schemas.js +91 -0
  143. package/dist/src/ui/schemas.js.map +18 -0
  144. package/dist/src/utils/index.cjs +3 -3
  145. package/dist/src/utils/index.cjs.map +4 -4
  146. package/dist/src/utils/index.js +7 -7
  147. package/dist/src/utils/index.js.map +4 -4
  148. package/package.json +157 -105
  149. package/dist/shared/stacks-2ar4prfz.cjs.map +0 -11
  150. package/dist/shared/stacks-61rvzkz1.cjs.map +0 -17
  151. package/dist/shared/stacks-9avax1yf.js.map +0 -13
  152. package/dist/shared/stacks-9mdk86wp.js.map +0 -10
  153. package/dist/shared/stacks-an5k8n4t.cjs.map +0 -23
  154. package/dist/shared/stacks-evnzth1q.cjs.map +0 -10
  155. package/dist/shared/stacks-fedzr2ka.js.map +0 -13
  156. package/dist/shared/stacks-gjvbq6w7.js.map +0 -10
  157. package/dist/shared/stacks-k08tgzyp.cjs.map +0 -13
  158. package/dist/shared/stacks-k2p5tv6x.js.map +0 -10
  159. package/dist/shared/stacks-k58k970n.js.map +0 -10
  160. package/dist/shared/stacks-ky14tdf6.cjs.map +0 -13
  161. package/dist/shared/stacks-nqytwfcc.js.map +0 -11
  162. package/dist/shared/stacks-qcx67vqa.js.map +0 -10
  163. package/dist/shared/stacks-qvg7c24g.cjs.map +0 -10
  164. package/dist/shared/stacks-qyt8m5v0.js.map +0 -11
  165. package/dist/shared/stacks-r1t6g3c3.cjs.map +0 -11
  166. package/dist/shared/stacks-v3zy6zds.cjs.map +0 -10
  167. package/dist/shared/stacks-vbke9mqw.cjs.map +0 -15
  168. package/dist/shared/stacks-vd9jcp0b.js.map +0 -23
  169. package/dist/shared/stacks-vyb9rx8q.js.map +0 -15
  170. package/dist/shared/stacks-wrb1es85.js.map +0 -17
  171. package/dist/shared/stacks-yfveb68e.js.map +0 -10
@@ -1,3 +1,179 @@
1
+ import { AsyncLocalStorage } from "node:async_hooks";
2
+ import { ClarityValue, PostCondition } from "@stacks/transactions";
3
+ interface TransferIntent {
4
+ kind: "transfer";
5
+ recipient: string;
6
+ amount: bigint;
7
+ memo?: string;
8
+ postConditions?: PostCondition[];
9
+ }
10
+ interface ContractCallIntent {
11
+ kind: "contract-call";
12
+ /** Fully-qualified contract id, e.g. `"SP000000000000000000002Q6VF78.bns"`. */
13
+ contract: string;
14
+ fn: string;
15
+ args: ClarityValue[];
16
+ postConditions?: PostCondition[];
17
+ }
18
+ interface DeployIntent {
19
+ kind: "deploy";
20
+ name: string;
21
+ source: string;
22
+ clarityVersion?: 1 | 2 | 3;
23
+ }
24
+ interface MultiSendIntent {
25
+ kind: "multisend";
26
+ payments: Array<{
27
+ recipient: string
28
+ amount: bigint
29
+ memo?: string
30
+ }>;
31
+ }
32
+ type TxIntent = TransferIntent | ContractCallIntent | DeployIntent | MultiSendIntent;
33
+ /**
34
+ * Lightweight factory functions for building tx intents. Identity-shaped
35
+ * with a `kind` tag so the broadcast step can discriminate at runtime.
36
+ */
37
+ declare const tx: {
38
+ readonly transfer: (opts: Omit<TransferIntent, "kind">) => TransferIntent
39
+ readonly contractCall: (opts: Omit<ContractCallIntent, "kind">) => ContractCallIntent
40
+ readonly deploy: (opts: Omit<DeployIntent, "kind">) => DeployIntent
41
+ readonly multisend: (opts: Omit<MultiSendIntent, "kind">) => MultiSendIntent
42
+ };
43
+ /**
44
+ * Submit a transaction intent to the Stacks network via a workflow-declared
45
+ * signer. The Secondlayer runner intercepts this call to:
46
+ *
47
+ * 1. Resolve `signer` to a `RemoteSignerConfig` (endpoint + publicKey +
48
+ * hmacRef) declared on the workflow.
49
+ * 2. Fetch the HMAC secret from the runtime secret store.
50
+ * 3. Enforce safety caps (`maxMicroStx`, `maxFee`).
51
+ * 4. POST the unsigned tx breakdown to the customer's signer endpoint.
52
+ * 5. Submit the returned signed tx to the Stacks node.
53
+ *
54
+ * Returns the txId immediately. Confirmation polling lands in Sprint 5 via
55
+ * `awaitConfirmation: true` (no-op today — subgraph-backed path forthcoming).
56
+ *
57
+ * Throws `TxRejectedError`, `TxTimeoutError`, or `TxSignerRefusedError` from
58
+ * `@secondlayer/stacks/errors` on failure.
59
+ *
60
+ * Must be called inside a workflow handler (directly or inside `step.run`).
61
+ * Calls outside a runtime-bound context throw immediately.
62
+ */
63
+ interface BroadcastOptions {
64
+ /** Name of a signer declared in `WorkflowDefinition.signers`. */
65
+ signer: string;
66
+ /**
67
+ * If `true`, wait for the tx to be confirmed on-chain before returning.
68
+ * Sprint 4 ships this flag as a no-op — Sprint 5 adds subgraph-backed
69
+ * confirmation polling.
70
+ */
71
+ awaitConfirmation?: boolean;
72
+ /** Minimum confirmations before returning. Only meaningful when `awaitConfirmation: true`. */
73
+ minConfirmations?: number;
74
+ /**
75
+ * Hard cap on micro-STX that can be spent. Required when the tx amount is
76
+ * derived from an AI step (the deploy-time AST check enforces this).
77
+ */
78
+ maxMicroStx?: bigint;
79
+ /** Hard cap on fee in micro-STX. */
80
+ maxFee?: bigint;
81
+ }
82
+ interface BroadcastResult {
83
+ txId: string;
84
+ /** `false` for Sprint 4; `true` once `awaitConfirmation` lands in Sprint 5. */
85
+ confirmed: boolean;
86
+ }
87
+ /**
88
+ * Runtime contract implemented by `@secondlayer/workflow-runner`. The stacks
89
+ * package is a pure library — it holds no keys, no DB, and no network —
90
+ * so actual broadcasting is delegated to whatever runtime bound the context.
91
+ */
92
+ interface BroadcastRuntime {
93
+ broadcast(intent: TxIntent, opts: BroadcastOptions): Promise<BroadcastResult>;
94
+ }
95
+ /**
96
+ * Per-run `AsyncLocalStorage` binding. The runner calls
97
+ * `broadcastContext.run(runtime, async () => handler(ctx))` so concurrent
98
+ * workflow runs see isolated runtime bindings — no module-level global state
99
+ * is mutated.
100
+ */
101
+ declare const broadcastContext: AsyncLocalStorage<BroadcastRuntime>;
102
+ declare function broadcast(intent: TxIntent, opts: BroadcastOptions): Promise<BroadcastResult>;
103
+ /**
104
+ * Structured error classes thrown by `broadcast()` and the workflow runner's
105
+ * broadcast step. The runner's retry policy consults `reason` (for
106
+ * `TxRejectedError`) to decide whether to re-attempt — abort-by-post-condition
107
+ * is non-retryable, timeouts retry with a fee bump, etc.
108
+ */
109
+ type TxRejectionReason = "abort_by_post_condition" | "abort_by_response" | "runtime_error" | "out_of_gas" | "nonce_conflict" | "signature_invalid" | "unknown";
110
+ /**
111
+ * Thrown when a transaction submitted to the Stacks node is rejected
112
+ * (mempool or on-chain). Each `reason` maps to different retry semantics.
113
+ */
114
+ declare class TxRejectedError extends Error {
115
+ readonly reason: TxRejectionReason;
116
+ readonly txId?: string;
117
+ readonly name = "TxRejectedError";
118
+ constructor(message: string, reason: TxRejectionReason, txId?: string);
119
+ /**
120
+ * Heuristic: is retrying the same tx likely to succeed?
121
+ * `abort_by_post_condition` / `abort_by_response` reflect on-chain state
122
+ * or explicit rejection — same tx will fail again.
123
+ */
124
+ get isRetryable(): boolean;
125
+ }
126
+ /**
127
+ * Thrown when a broadcast was submitted (mempool accepted) but never mined
128
+ * within the configured `confirmationTimeout`. Retryable with fee bump.
129
+ */
130
+ declare class TxTimeoutError extends Error {
131
+ readonly txId: string;
132
+ readonly timeoutMs: number;
133
+ readonly name = "TxTimeoutError";
134
+ readonly isRetryable: true;
135
+ constructor(message: string, txId: string, timeoutMs: number);
136
+ }
137
+ /**
138
+ * Thrown when the remote signer refused to sign (policy denied, quota hit,
139
+ * bad request). Non-retryable — customer policy won't change on retry.
140
+ */
141
+ declare class TxSignerRefusedError extends Error {
142
+ readonly signerName: string;
143
+ readonly reason: string;
144
+ readonly name = "TxSignerRefusedError";
145
+ readonly isRetryable: false;
146
+ constructor(message: string, signerName: string, reason: string);
147
+ }
148
+ /** Account derived from a local private key (mnemonic or raw key). */
149
+ type LocalAccount = {
150
+ type: "local"
151
+ address: string
152
+ /** Compressed public key (hex) */
153
+ publicKey: string
154
+ /** Raw ECDSA sign over a hash */
155
+ sign(hash: Uint8Array): Uint8Array
156
+ /** Sign a structured message (SIP-018) */
157
+ signMessage(message: string | Uint8Array): string
158
+ };
159
+ /** Account with a user-provided signing function (sync or async). */
160
+ type CustomAccount = {
161
+ type: "custom"
162
+ address: string
163
+ publicKey: string
164
+ sign(hash: Uint8Array): Promise<Uint8Array> | Uint8Array
165
+ };
166
+ /** Browser wallet provider interface (e.g. Leather, Xverse). */
167
+ type StacksProvider = {
168
+ request(method: string, params?: any): Promise<any>
169
+ };
170
+ /** Account backed by a browser wallet {@link StacksProvider}. */
171
+ type ProviderAccount = {
172
+ type: "provider"
173
+ address: string
174
+ publicKey: string
175
+ provider: StacksProvider
176
+ };
1
177
  /** Full chain descriptor used by clients and transports for network-aware operations. */
2
178
  type StacksChain = {
3
179
  /** Chain ID (e.g. 0x00000001 for mainnet) */
@@ -68,35 +244,6 @@ type Transport = {
68
244
  type TransportFactory = (params?: {
69
245
  chain?: StacksChain
70
246
  }) => Transport;
71
- /** Account derived from a local private key (mnemonic or raw key). */
72
- type LocalAccount = {
73
- type: "local"
74
- address: string
75
- /** Compressed public key (hex) */
76
- publicKey: string
77
- /** Raw ECDSA sign over a hash */
78
- sign(hash: Uint8Array): Uint8Array
79
- /** Sign a structured message (SIP-018) */
80
- signMessage(message: string | Uint8Array): string
81
- };
82
- /** Account with a user-provided signing function (sync or async). */
83
- type CustomAccount = {
84
- type: "custom"
85
- address: string
86
- publicKey: string
87
- sign(hash: Uint8Array): Promise<Uint8Array> | Uint8Array
88
- };
89
- /** Browser wallet provider interface (e.g. Leather, Xverse). */
90
- type StacksProvider = {
91
- request(method: string, params?: any): Promise<any>
92
- };
93
- /** Account backed by a browser wallet {@link StacksProvider}. */
94
- type ProviderAccount = {
95
- type: "provider"
96
- address: string
97
- publicKey: string
98
- provider: StacksProvider
99
- };
100
247
  /** Union of all supported account types (local key, custom signer, or browser provider). */
101
248
  type Account = LocalAccount | CustomAccount | ProviderAccount;
102
249
  /**
@@ -127,25 +274,6 @@ type WalletClient<TExtended extends Record<string, unknown> = Record<string, unk
127
274
  * Use `.extend()` to compose action decorators (public, wallet, multisig).
128
275
  */
129
276
  declare function createClient<TExtended extends Record<string, unknown> = Record<string, unknown>>(config: ClientConfig): Client<TExtended>;
130
- type GetNonceParams = {
131
- address: string
132
- };
133
- type GetBalanceParams = {
134
- address: string
135
- };
136
- type GetAccountInfoParams = {
137
- address: string
138
- };
139
- type AccountInfo = {
140
- balance: bigint
141
- nonce: bigint
142
- balanceProof: string
143
- nonceProof: string
144
- };
145
- type GetBlockParams = {
146
- height?: number
147
- hash?: string
148
- };
149
277
  type IntCV = {
150
278
  readonly type: "int"
151
279
  readonly value: bigint
@@ -170,15 +298,15 @@ type NoneCV = {
170
298
  };
171
299
  type SomeCV = {
172
300
  readonly type: "some"
173
- readonly value: ClarityValue
301
+ readonly value: ClarityValue2
174
302
  };
175
303
  type ResponseOkCV = {
176
304
  readonly type: "ok"
177
- readonly value: ClarityValue
305
+ readonly value: ClarityValue2
178
306
  };
179
307
  type ResponseErrorCV = {
180
308
  readonly type: "err"
181
- readonly value: ClarityValue
309
+ readonly value: ClarityValue2
182
310
  };
183
311
  type StandardPrincipalCV = {
184
312
  readonly type: "address"
@@ -190,10 +318,10 @@ type ContractPrincipalCV = {
190
318
  };
191
319
  type ListCV = {
192
320
  type: "list"
193
- value: ClarityValue[]
321
+ value: ClarityValue2[]
194
322
  };
195
323
  type TupleData = {
196
- [key: string]: ClarityValue
324
+ [key: string]: ClarityValue2
197
325
  };
198
326
  type TupleCV = {
199
327
  type: "tuple"
@@ -207,21 +335,7 @@ type StringUtf8CV = {
207
335
  readonly type: "utf8"
208
336
  readonly value: string
209
337
  };
210
- type ClarityValue = IntCV | UIntCV | BooleanCV | BufferCV | NoneCV | SomeCV | ResponseOkCV | ResponseErrorCV | StandardPrincipalCV | ContractPrincipalCV | ListCV | TupleCV | StringAsciiCV | StringUtf8CV;
211
- type ReadContractParams = {
212
- contract: string
213
- functionName: string
214
- args?: ClarityValue[]
215
- sender?: string
216
- };
217
- type GetContractAbiParams = {
218
- contract: string
219
- };
220
- type GetMapEntryParams = {
221
- contract: string
222
- mapName: string
223
- key: ClarityValue
224
- };
338
+ type ClarityValue2 = IntCV | UIntCV | BooleanCV | BufferCV | NoneCV | SomeCV | ResponseOkCV | ResponseErrorCV | StandardPrincipalCV | ContractPrincipalCV | ListCV | TupleCV | StringAsciiCV | StringUtf8CV;
225
339
  declare const AuthType: {
226
340
  readonly Standard: 0x04
227
341
  readonly Sponsored: 0x05
@@ -243,6 +357,8 @@ declare const ClarityVersion: {
243
357
  readonly Clarity1: 1
244
358
  readonly Clarity2: 2
245
359
  readonly Clarity3: 3
360
+ readonly Clarity4: 4
361
+ readonly Clarity5: 5
246
362
  };
247
363
  type ClarityVersion = (typeof ClarityVersion)[keyof typeof ClarityVersion];
248
364
  declare const AnchorMode: {
@@ -273,11 +389,16 @@ type PubKeyEncoding = (typeof PubKeyEncoding)[keyof typeof PubKeyEncoding];
273
389
  declare const TenureChangeCause: {
274
390
  readonly BlockFound: 0x00
275
391
  readonly Extended: 0x01
392
+ readonly ExtendedRuntime: 0x02
393
+ readonly ExtendedReadCount: 0x03
394
+ readonly ExtendedReadLength: 0x04
395
+ readonly ExtendedWriteCount: 0x05
396
+ readonly ExtendedWriteLength: 0x06
276
397
  };
277
398
  type TenureChangeCause = (typeof TenureChangeCause)[keyof typeof TenureChangeCause];
278
399
  type TokenTransferPayload = {
279
400
  payloadType: typeof PayloadType.TokenTransfer
280
- recipient: ClarityValue
401
+ recipient: ClarityValue2
281
402
  amount: bigint
282
403
  memo: string
283
404
  };
@@ -286,7 +407,7 @@ type ContractCallPayload = {
286
407
  contractAddress: string
287
408
  contractName: string
288
409
  functionName: string
289
- functionArgs: ClarityValue[]
410
+ functionArgs: ClarityValue2[]
290
411
  };
291
412
  type SmartContractPayload = {
292
413
  payloadType: typeof PayloadType.SmartContract | typeof PayloadType.VersionedSmartContract
@@ -301,7 +422,7 @@ type CoinbasePayload = {
301
422
  type CoinbaseToAltRecipientPayload = {
302
423
  payloadType: typeof PayloadType.CoinbaseToAltRecipient
303
424
  coinbaseBuffer: string
304
- recipient: ClarityValue
425
+ recipient: ClarityValue2
305
426
  };
306
427
  type PoisonMicroblockPayload = {
307
428
  payloadType: typeof PayloadType.PoisonMicroblock
@@ -321,7 +442,7 @@ type TenureChangePayload = {
321
442
  type NakamotoCoinbasePayload = {
322
443
  payloadType: typeof PayloadType.NakamotoCoinbase
323
444
  coinbaseBuffer: string
324
- recipient: ClarityValue | null
445
+ recipient: ClarityValue2 | null
325
446
  vrfProof: string
326
447
  };
327
448
  type TransactionPayload = TokenTransferPayload | ContractCallPayload | SmartContractPayload | CoinbasePayload | CoinbaseToAltRecipientPayload | PoisonMicroblockPayload | TenureChangePayload | NakamotoCoinbasePayload;
@@ -386,7 +507,7 @@ type NftPostConditionWire = {
386
507
  principal: PostConditionPrincipalWire
387
508
  asset: AssetInfoWire
388
509
  conditionCode: number
389
- assetId: ClarityValue
510
+ assetId: ClarityValue2
390
511
  };
391
512
  type PostConditionPrincipalWire = {
392
513
  type: "origin"
@@ -410,10 +531,37 @@ type FeeEstimation = {
410
531
  feeRate: number
411
532
  fee: number
412
533
  };
534
+ type GetAccountInfoParams = {
535
+ address: string
536
+ };
537
+ type AccountInfo = {
538
+ balance: bigint
539
+ nonce: bigint
540
+ balanceProof: string
541
+ nonceProof: string
542
+ };
543
+ type GetBalanceParams = {
544
+ address: string
545
+ };
546
+ type GetBlockParams = {
547
+ height?: number
548
+ hash?: string
549
+ };
550
+ type GetContractAbiParams = {
551
+ contract: string
552
+ };
553
+ type GetMapEntryParams = {
554
+ contract: string
555
+ mapName: string
556
+ key: ClarityValue2
557
+ };
558
+ type GetNonceParams = {
559
+ address: string
560
+ };
413
561
  type MulticallCall = {
414
562
  contract: string
415
563
  functionName: string
416
- args?: ClarityValue[]
564
+ args?: ClarityValue2[]
417
565
  sender?: string
418
566
  };
419
567
  type MulticallParams<TAllowFailure extends boolean = true> = {
@@ -422,13 +570,19 @@ type MulticallParams<TAllowFailure extends boolean = true> = {
422
570
  };
423
571
  type MulticallSuccessResult = {
424
572
  status: "success"
425
- result: ClarityValue
573
+ result: ClarityValue2
426
574
  };
427
575
  type MulticallFailureResult = {
428
576
  status: "failure"
429
577
  error: Error
430
578
  };
431
- type MulticallResult<T extends boolean> = T extends true ? (MulticallSuccessResult | MulticallFailureResult)[] : ClarityValue[];
579
+ type MulticallResult<T extends boolean> = T extends true ? (MulticallSuccessResult | MulticallFailureResult)[] : ClarityValue2[];
580
+ type ReadContractParams = {
581
+ contract: string
582
+ functionName: string
583
+ args?: ClarityValue2[]
584
+ sender?: string
585
+ };
432
586
  declare class BaseError extends Error {
433
587
  name: string;
434
588
  shortMessage: string;
@@ -456,13 +610,13 @@ declare class SimulationError extends BaseError {
456
610
  type SimulateCallParams = {
457
611
  contract: string
458
612
  functionName: string
459
- args?: ClarityValue[]
613
+ args?: ClarityValue2[]
460
614
  sender?: string
461
615
  tip?: string
462
616
  };
463
617
  type SimulateCallSuccess = {
464
618
  success: true
465
- result: ClarityValue
619
+ result: ClarityValue2
466
620
  };
467
621
  type SimulateCallFailure = {
468
622
  success: false
@@ -630,9 +784,9 @@ type PublicActions = {
630
784
  getAccountInfo: (params: GetAccountInfoParams) => Promise<AccountInfo>
631
785
  getBlock: (params: GetBlockParams) => Promise<any>
632
786
  getBlockHeight: () => Promise<number>
633
- readContract: (params: ReadContractParams) => Promise<ClarityValue>
787
+ readContract: (params: ReadContractParams) => Promise<ClarityValue2>
634
788
  getContractAbi: (params: GetContractAbiParams) => Promise<any>
635
- getMapEntry: (params: GetMapEntryParams) => Promise<ClarityValue>
789
+ getMapEntry: (params: GetMapEntryParams) => Promise<ClarityValue2>
636
790
  estimateFee: (params: EstimateFeeParams) => Promise<FeeEstimation[]>
637
791
  multicall: <T extends boolean = true>(params: MulticallParams<T>) => Promise<MulticallResult<T>>
638
792
  simulateCall: (params: SimulateCallParams) => Promise<SimulateCallResult>
@@ -653,18 +807,6 @@ type PublicClientConfig = Omit<ClientConfig, "account">;
653
807
  * Use for queries, contract reads, and event subscriptions.
654
808
  */
655
809
  declare function createPublicClient(config: PublicClientConfig): Client<PublicActions> & PublicActions;
656
- type SendTransactionParams = {
657
- transaction: StacksTransaction
658
- attachment?: Uint8Array | string
659
- };
660
- type SendTransactionResult = {
661
- txid: string
662
- };
663
- type SignTransactionParams = {
664
- transaction: StacksTransaction
665
- /** Public keys for multi-sig signing (auto-detected from _multisig metadata if omitted) */
666
- signers?: string[]
667
- };
668
810
  type FungibleComparator = "eq" | "gt" | "gte" | "lt" | "lte";
669
811
  type NonFungibleComparator = "sent" | "not-sent";
670
812
  type StxPostCondition = {
@@ -685,27 +827,18 @@ type NftPostCondition = {
685
827
  address: string
686
828
  condition: NonFungibleComparator
687
829
  asset: string
688
- assetId: ClarityValue
830
+ assetId: ClarityValue2
689
831
  };
690
- type PostCondition = StxPostCondition | FtPostCondition | NftPostCondition;
832
+ type PostCondition2 = StxPostCondition | FtPostCondition | NftPostCondition;
691
833
  type IntegerType = number | string | bigint | Uint8Array;
692
- type TransferStxParams = {
693
- to: string
694
- amount: IntegerType
695
- memo?: string
696
- fee?: IntegerType
697
- nonce?: IntegerType
698
- postConditionMode?: "allow" | "deny"
699
- postConditions?: PostCondition[]
700
- };
701
834
  type CallContractParams = {
702
835
  contract: string
703
836
  functionName: string
704
- functionArgs?: ClarityValue[]
837
+ functionArgs?: ClarityValue2[]
705
838
  fee?: IntegerType
706
839
  nonce?: IntegerType
707
840
  postConditionMode?: "allow" | "deny"
708
- postConditions?: PostCondition[]
841
+ postConditions?: PostCondition2[]
709
842
  };
710
843
  type DeployContractParams = {
711
844
  contractName: string
@@ -714,21 +847,42 @@ type DeployContractParams = {
714
847
  fee?: IntegerType
715
848
  nonce?: IntegerType
716
849
  postConditionMode?: "allow" | "deny"
717
- postConditions?: PostCondition[]
850
+ postConditions?: PostCondition2[]
851
+ };
852
+ type SendTransactionParams = {
853
+ transaction: StacksTransaction
854
+ attachment?: Uint8Array | string
855
+ };
856
+ type SendTransactionResult = {
857
+ txid: string
718
858
  };
719
859
  type SignMessageParams = {
720
- message: string | ClarityValue
860
+ message: string | ClarityValue2
721
861
  domain?: {
722
862
  name: string
723
863
  version: string
724
864
  chainId: number
725
865
  }
726
866
  };
867
+ type SignTransactionParams = {
868
+ transaction: StacksTransaction
869
+ /** Public keys for multi-sig signing (auto-detected from _multisig metadata if omitted) */
870
+ signers?: string[]
871
+ };
727
872
  type SponsorTransactionParams = {
728
873
  transaction: StacksTransaction
729
874
  fee?: IntegerType
730
875
  nonce?: IntegerType
731
876
  };
877
+ type TransferStxParams = {
878
+ to: string
879
+ amount: IntegerType
880
+ memo?: string
881
+ fee?: IntegerType
882
+ nonce?: IntegerType
883
+ postConditionMode?: "allow" | "deny"
884
+ postConditions?: PostCondition2[]
885
+ };
732
886
  /** Signing actions: send transactions, transfer STX, call/deploy contracts, sign messages. */
733
887
  type WalletActions = {
734
888
  sendTransaction: (params: SendTransactionParams) => Promise<SendTransactionResult>
@@ -758,16 +912,16 @@ type MultiSigTransferStxParams = {
758
912
  fee?: IntegerType
759
913
  nonce?: IntegerType
760
914
  postConditionMode?: "allow" | "deny"
761
- postConditions?: PostCondition[]
915
+ postConditions?: PostCondition2[]
762
916
  };
763
917
  type MultiSigCallContractParams = {
764
918
  contract: string
765
919
  functionName: string
766
- functionArgs?: ClarityValue[]
920
+ functionArgs?: ClarityValue2[]
767
921
  fee?: IntegerType
768
922
  nonce?: IntegerType
769
923
  postConditionMode?: "allow" | "deny"
770
- postConditions?: PostCondition[]
924
+ postConditions?: PostCondition2[]
771
925
  };
772
926
  type MultiSigDeployContractParams = {
773
927
  contractName: string
@@ -776,7 +930,7 @@ type MultiSigDeployContractParams = {
776
930
  fee?: IntegerType
777
931
  nonce?: IntegerType
778
932
  postConditionMode?: "allow" | "deny"
779
- postConditions?: PostCondition[]
933
+ postConditions?: PostCondition2[]
780
934
  };
781
935
  type MultiSigSendTransactionParams = {
782
936
  transaction: StacksTransaction
@@ -885,4 +1039,36 @@ declare function isAddressEqual(a: string, b: string): boolean;
885
1039
  * Validates both parts; returns `deployer.contractName`.
886
1040
  */
887
1041
  declare function getContractAddress(deployer: string, contractName: string): string;
888
- export { webSocket, walletActions, testnet, publicActions, providerToAccount, parseStx, multisigActions, mocknet, mainnet, isValidAddress, isAddressEqual, http, getContractAddress, formatStx, fallback, devnet, defineChain, custom, createWalletClient, createPublicClient, createMultiSigClient, createClient, ZERO_ADDRESS, WebSocketTransportConfig, WebSocketTransport, WalletClientConfig, WalletClient, WalletActions, TransportFactory, TransportConfig, Transport, TESTNET_ZERO_ADDRESS, Subscription, StacksProvider, StacksChain, RequestOptions, RequestFn, PublicClientConfig, PublicClient, PublicActions, ProviderAccount, MultiSigClientConfig, MultiSigClient, MultiSigActions, MICROSTX_PER_STX, LocalAccount, CustomAccount, ClientConfig, Client, AddressVersion, Account };
1042
+ declare class TransactionError extends BaseError {
1043
+ name: string;
1044
+ }
1045
+ declare class BroadcastError extends BaseError {
1046
+ name: string;
1047
+ txid?: string;
1048
+ reason?: string;
1049
+ constructor(message: string, options?: {
1050
+ cause?: Error
1051
+ txid?: string
1052
+ reason?: string
1053
+ });
1054
+ }
1055
+ declare class SerializationError extends BaseError {
1056
+ name: string;
1057
+ }
1058
+ declare class SigningError extends BaseError {
1059
+ name: string;
1060
+ }
1061
+ declare class ContractCallError extends BaseError {
1062
+ name: string;
1063
+ }
1064
+ declare class ReadOnlyCallError extends BaseError {
1065
+ name: string;
1066
+ }
1067
+ declare class WebSocketError extends BaseError {
1068
+ name: string;
1069
+ constructor(message: string, options?: {
1070
+ cause?: Error
1071
+ details?: string
1072
+ });
1073
+ }
1074
+ export { webSocket, walletActions, tx, testnet, publicActions, providerToAccount, parseStx, multisigActions, mocknet, mainnet, isValidAddress, isAddressEqual, http, getContractAddress, formatStx, fallback, devnet, defineChain, custom, createWalletClient, createPublicClient, createMultiSigClient, createClient, broadcastContext, broadcast, ZERO_ADDRESS, WebSocketTransportConfig, WebSocketTransport, WebSocketError, WalletClientConfig, WalletClient, WalletActions, TxTimeoutError, TxSignerRefusedError, TxRejectionReason, TxRejectedError, TxIntent, TransportFactory, TransportConfig, Transport, TransferIntent, TransactionError, TESTNET_ZERO_ADDRESS, Subscription, StacksProvider, StacksChain, SimulationError, SigningError, SerializationError, RequestOptions, RequestFn, ReadOnlyCallError, PublicClientConfig, PublicClient, PublicActions, ProviderAccount, MultiSigClientConfig, MultiSigClient, MultiSigActions, MultiSendIntent, MICROSTX_PER_STX, LocalAccount, DeployIntent, CustomAccount, ContractCallIntent, ContractCallError, ClientConfig, Client, BroadcastRuntime, BroadcastResult, BroadcastOptions, BroadcastError, BaseError, AddressVersion, Account };