@secondlayer/stacks 0.2.2 → 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.
- package/dist/shared/stacks-02actsrx.cjs.map +2 -2
- package/dist/shared/{stacks-xp9n3r0t.js → stacks-09wa7ewe.js} +108 -108
- package/dist/shared/stacks-09wa7ewe.js.map +15 -0
- package/dist/shared/{stacks-ky14tdf6.cjs → stacks-0nfexv24.cjs} +20 -8
- package/dist/shared/stacks-0nfexv24.cjs.map +14 -0
- package/dist/shared/{stacks-an5k8n4t.cjs → stacks-14pgpkrr.cjs} +82 -73
- package/dist/shared/stacks-14pgpkrr.cjs.map +23 -0
- package/dist/shared/{stacks-v6ja2eh7.cjs → stacks-17sdtaxg.cjs} +106 -102
- package/dist/shared/stacks-17sdtaxg.cjs.map +15 -0
- package/dist/shared/{stacks-96gaxfcf.js → stacks-1s5w4ncf.js} +44 -32
- package/dist/shared/stacks-1s5w4ncf.js.map +17 -0
- package/dist/shared/stacks-24h5k94q.cjs.map +3 -3
- package/dist/shared/{stacks-evnzth1q.cjs → stacks-4vzmhw3q.cjs} +3 -3
- package/dist/shared/stacks-4vzmhw3q.cjs.map +10 -0
- package/dist/shared/{stacks-k9p8m3wf.js → stacks-4x2bcc2k.js} +87 -78
- package/dist/shared/stacks-4x2bcc2k.js.map +23 -0
- package/dist/shared/stacks-5tprhns9.cjs.map +3 -3
- package/dist/shared/stacks-709tra19.js.map +2 -2
- package/dist/shared/{stacks-q79dx28x.js → stacks-70p84bgg.js} +3 -3
- package/dist/shared/stacks-70p84bgg.js.map +10 -0
- package/dist/shared/{stacks-k2p5tv6x.js → stacks-913a2rx7.js} +3 -3
- package/dist/shared/stacks-913a2rx7.js.map +10 -0
- package/dist/shared/{stacks-jrnmh4kc.js → stacks-96d6m1zy.js} +15 -6
- package/dist/shared/stacks-96d6m1zy.js.map +11 -0
- package/dist/shared/stacks-9g0jhab3.cjs.map +2 -2
- package/dist/shared/stacks-dr5en54r.cjs.map +2 -2
- package/dist/shared/stacks-fcaefc5b.cjs.map +2 -2
- package/dist/shared/stacks-gck1sq7h.cjs.map +2 -2
- package/dist/shared/stacks-je937aas.js.map +2 -2
- package/dist/shared/{stacks-k58k970n.js → stacks-kg1npstf.js} +5 -3
- package/dist/shared/stacks-kg1npstf.js.map +10 -0
- package/dist/shared/{stacks-qvg7c24g.cjs → stacks-n98w7g57.cjs} +5 -3
- package/dist/shared/stacks-n98w7g57.cjs.map +10 -0
- package/dist/shared/{stacks-6m1z4j07.js → stacks-nqae5amn.cjs} +74 -160
- package/dist/shared/stacks-nqae5amn.cjs.map +10 -0
- package/dist/shared/stacks-qcae5852.js.map +2 -2
- package/dist/shared/stacks-qt8ehebn.js.map +3 -3
- package/dist/shared/stacks-ra02bpny.cjs.map +3 -3
- package/dist/shared/stacks-rwfgts3s.js.map +2 -2
- package/dist/shared/stacks-s10yb9gz.js.map +2 -2
- package/dist/shared/{stacks-etf219gs.cjs → stacks-s30kkvm8.js} +101 -118
- package/dist/shared/stacks-s30kkvm8.js.map +10 -0
- package/dist/shared/stacks-s7z5q8be.js.map +3 -3
- package/dist/shared/stacks-v9jqcpd4.js.map +2 -2
- package/dist/shared/stacks-vdfag81a.cjs.map +2 -2
- package/dist/shared/{stacks-rg1g0fja.js → stacks-wjem3xw9.js} +21 -9
- package/dist/shared/stacks-wjem3xw9.js.map +14 -0
- package/dist/shared/{stacks-k08tgzyp.cjs → stacks-wyxj879g.cjs} +3 -3
- package/dist/shared/stacks-wyxj879g.cjs.map +13 -0
- package/dist/shared/stacks-y3dh7hv1.js.map +3 -3
- package/dist/shared/{stacks-2ar4prfz.cjs → stacks-y5262j0z.cjs} +14 -5
- package/dist/shared/stacks-y5262j0z.cjs.map +11 -0
- package/dist/shared/stacks-ya3x01yd.cjs.map +2 -2
- package/dist/shared/{stacks-p93g814f.js → stacks-zf7rbpzp.js} +4 -4
- package/dist/shared/stacks-zf7rbpzp.js.map +13 -0
- package/dist/shared/{stacks-61rvzkz1.cjs → stacks-znrb59ce.cjs} +41 -29
- package/dist/shared/stacks-znrb59ce.cjs.map +17 -0
- package/dist/src/accounts/index.cjs +2 -2
- package/dist/src/accounts/index.cjs.map +5 -5
- package/dist/src/accounts/index.js +2 -6
- package/dist/src/accounts/index.js.map +5 -5
- package/dist/src/actions/index.d.cts +29 -29
- package/dist/src/actions/index.d.ts +29 -29
- package/dist/src/actions/index.js +7 -7
- package/dist/src/bns/index.cjs +55 -43
- package/dist/src/bns/index.cjs.map +9 -9
- package/dist/src/bns/index.d.cts +29 -29
- package/dist/src/bns/index.d.ts +29 -29
- package/dist/src/bns/index.js +62 -50
- package/dist/src/bns/index.js.map +9 -9
- package/dist/src/clarity/index.js +4 -4
- package/dist/src/connect/index.cjs +114 -112
- package/dist/src/connect/index.cjs.map +13 -13
- package/dist/src/connect/index.js +114 -112
- package/dist/src/connect/index.js.map +13 -13
- package/dist/src/connect/walletconnect/index.cjs +3 -3
- package/dist/src/connect/walletconnect/index.cjs.map +10 -10
- package/dist/src/connect/walletconnect/index.js +3 -3
- package/dist/src/connect/walletconnect/index.js.map +10 -10
- package/dist/src/index.cjs +108 -2
- package/dist/src/index.cjs.map +19 -15
- package/dist/src/index.d.cts +291 -112
- package/dist/src/index.d.ts +291 -112
- package/dist/src/index.js +122 -9
- package/dist/src/index.js.map +19 -15
- package/dist/src/pox/index.cjs.map +6 -6
- package/dist/src/pox/index.d.cts +29 -29
- package/dist/src/pox/index.d.ts +29 -29
- package/dist/src/pox/index.js +5 -5
- package/dist/src/pox/index.js.map +6 -6
- package/dist/src/stackingdao/index.cjs +31 -6
- package/dist/src/stackingdao/index.cjs.map +6 -6
- package/dist/src/stackingdao/index.d.cts +29 -29
- package/dist/src/stackingdao/index.d.ts +29 -29
- package/dist/src/stackingdao/index.js +37 -12
- package/dist/src/stackingdao/index.js.map +6 -6
- package/dist/src/subscriptions/index.d.cts +29 -29
- package/dist/src/subscriptions/index.d.ts +29 -29
- package/dist/src/tools/btc/index.cjs +130 -0
- package/dist/src/tools/btc/index.cjs.map +10 -0
- package/dist/src/tools/btc/index.d.cts +8 -0
- package/dist/src/tools/btc/index.d.ts +8 -0
- package/dist/src/tools/btc/index.js +89 -0
- package/dist/src/tools/btc/index.js.map +10 -0
- package/dist/src/tools/index.cjs +2470 -0
- package/dist/src/tools/index.cjs.map +61 -0
- package/dist/src/tools/index.d.cts +144 -0
- package/dist/src/tools/index.d.ts +144 -0
- package/dist/src/tools/index.js +2435 -0
- package/dist/src/tools/index.js.map +61 -0
- package/dist/src/transactions/index.js +3 -3
- package/dist/src/triggers/index.cjs +66 -0
- package/dist/src/triggers/index.cjs.map +10 -0
- package/dist/src/triggers/index.d.cts +116 -0
- package/dist/src/triggers/index.d.ts +116 -0
- package/dist/src/triggers/index.js +25 -0
- package/dist/src/triggers/index.js.map +10 -0
- package/dist/src/tx/index.cjs +65 -0
- package/dist/src/tx/index.cjs.map +10 -0
- package/dist/src/tx/index.d.cts +42 -0
- package/dist/src/tx/index.d.ts +42 -0
- package/dist/src/tx/index.js +22 -0
- package/dist/src/tx/index.js.map +10 -0
- package/dist/src/ui/index.cjs +431 -0
- package/dist/src/ui/index.cjs.map +27 -0
- package/dist/src/ui/index.d.cts +107 -0
- package/dist/src/ui/index.d.ts +107 -0
- package/dist/src/ui/index.js +391 -0
- package/dist/src/ui/index.js.map +27 -0
- package/dist/src/ui/schemas.cjs +134 -0
- package/dist/src/ui/schemas.cjs.map +18 -0
- package/dist/src/ui/schemas.d.cts +83 -0
- package/dist/src/ui/schemas.d.ts +83 -0
- package/dist/src/ui/schemas.js +91 -0
- package/dist/src/ui/schemas.js.map +18 -0
- package/dist/src/utils/index.cjs +3 -3
- package/dist/src/utils/index.cjs.map +4 -4
- package/dist/src/utils/index.js +4 -4
- package/dist/src/utils/index.js.map +4 -4
- package/package.json +157 -105
- package/dist/shared/stacks-2ar4prfz.cjs.map +0 -11
- package/dist/shared/stacks-61rvzkz1.cjs.map +0 -17
- package/dist/shared/stacks-6m1z4j07.js.map +0 -10
- package/dist/shared/stacks-96gaxfcf.js.map +0 -17
- package/dist/shared/stacks-an5k8n4t.cjs.map +0 -23
- package/dist/shared/stacks-etf219gs.cjs.map +0 -10
- package/dist/shared/stacks-evnzth1q.cjs.map +0 -10
- package/dist/shared/stacks-jrnmh4kc.js.map +0 -11
- package/dist/shared/stacks-k08tgzyp.cjs.map +0 -13
- package/dist/shared/stacks-k2p5tv6x.js.map +0 -10
- package/dist/shared/stacks-k58k970n.js.map +0 -10
- package/dist/shared/stacks-k9p8m3wf.js.map +0 -23
- package/dist/shared/stacks-ky14tdf6.cjs.map +0 -13
- package/dist/shared/stacks-p93g814f.js.map +0 -13
- package/dist/shared/stacks-q79dx28x.js.map +0 -10
- package/dist/shared/stacks-qvg7c24g.cjs.map +0 -10
- package/dist/shared/stacks-rg1g0fja.js.map +0 -13
- package/dist/shared/stacks-v6ja2eh7.cjs.map +0 -15
- package/dist/shared/stacks-xp9n3r0t.js.map +0 -15
package/dist/src/index.d.cts
CHANGED
|
@@ -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:
|
|
301
|
+
readonly value: ClarityValue2
|
|
174
302
|
};
|
|
175
303
|
type ResponseOkCV = {
|
|
176
304
|
readonly type: "ok"
|
|
177
|
-
readonly value:
|
|
305
|
+
readonly value: ClarityValue2
|
|
178
306
|
};
|
|
179
307
|
type ResponseErrorCV = {
|
|
180
308
|
readonly type: "err"
|
|
181
|
-
readonly value:
|
|
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:
|
|
321
|
+
value: ClarityValue2[]
|
|
194
322
|
};
|
|
195
323
|
type TupleData = {
|
|
196
|
-
[key: string]:
|
|
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
|
|
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
|
|
@@ -284,7 +398,7 @@ declare const TenureChangeCause: {
|
|
|
284
398
|
type TenureChangeCause = (typeof TenureChangeCause)[keyof typeof TenureChangeCause];
|
|
285
399
|
type TokenTransferPayload = {
|
|
286
400
|
payloadType: typeof PayloadType.TokenTransfer
|
|
287
|
-
recipient:
|
|
401
|
+
recipient: ClarityValue2
|
|
288
402
|
amount: bigint
|
|
289
403
|
memo: string
|
|
290
404
|
};
|
|
@@ -293,7 +407,7 @@ type ContractCallPayload = {
|
|
|
293
407
|
contractAddress: string
|
|
294
408
|
contractName: string
|
|
295
409
|
functionName: string
|
|
296
|
-
functionArgs:
|
|
410
|
+
functionArgs: ClarityValue2[]
|
|
297
411
|
};
|
|
298
412
|
type SmartContractPayload = {
|
|
299
413
|
payloadType: typeof PayloadType.SmartContract | typeof PayloadType.VersionedSmartContract
|
|
@@ -308,7 +422,7 @@ type CoinbasePayload = {
|
|
|
308
422
|
type CoinbaseToAltRecipientPayload = {
|
|
309
423
|
payloadType: typeof PayloadType.CoinbaseToAltRecipient
|
|
310
424
|
coinbaseBuffer: string
|
|
311
|
-
recipient:
|
|
425
|
+
recipient: ClarityValue2
|
|
312
426
|
};
|
|
313
427
|
type PoisonMicroblockPayload = {
|
|
314
428
|
payloadType: typeof PayloadType.PoisonMicroblock
|
|
@@ -328,7 +442,7 @@ type TenureChangePayload = {
|
|
|
328
442
|
type NakamotoCoinbasePayload = {
|
|
329
443
|
payloadType: typeof PayloadType.NakamotoCoinbase
|
|
330
444
|
coinbaseBuffer: string
|
|
331
|
-
recipient:
|
|
445
|
+
recipient: ClarityValue2 | null
|
|
332
446
|
vrfProof: string
|
|
333
447
|
};
|
|
334
448
|
type TransactionPayload = TokenTransferPayload | ContractCallPayload | SmartContractPayload | CoinbasePayload | CoinbaseToAltRecipientPayload | PoisonMicroblockPayload | TenureChangePayload | NakamotoCoinbasePayload;
|
|
@@ -393,7 +507,7 @@ type NftPostConditionWire = {
|
|
|
393
507
|
principal: PostConditionPrincipalWire
|
|
394
508
|
asset: AssetInfoWire
|
|
395
509
|
conditionCode: number
|
|
396
|
-
assetId:
|
|
510
|
+
assetId: ClarityValue2
|
|
397
511
|
};
|
|
398
512
|
type PostConditionPrincipalWire = {
|
|
399
513
|
type: "origin"
|
|
@@ -417,10 +531,37 @@ type FeeEstimation = {
|
|
|
417
531
|
feeRate: number
|
|
418
532
|
fee: number
|
|
419
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
|
+
};
|
|
420
561
|
type MulticallCall = {
|
|
421
562
|
contract: string
|
|
422
563
|
functionName: string
|
|
423
|
-
args?:
|
|
564
|
+
args?: ClarityValue2[]
|
|
424
565
|
sender?: string
|
|
425
566
|
};
|
|
426
567
|
type MulticallParams<TAllowFailure extends boolean = true> = {
|
|
@@ -429,13 +570,19 @@ type MulticallParams<TAllowFailure extends boolean = true> = {
|
|
|
429
570
|
};
|
|
430
571
|
type MulticallSuccessResult = {
|
|
431
572
|
status: "success"
|
|
432
|
-
result:
|
|
573
|
+
result: ClarityValue2
|
|
433
574
|
};
|
|
434
575
|
type MulticallFailureResult = {
|
|
435
576
|
status: "failure"
|
|
436
577
|
error: Error
|
|
437
578
|
};
|
|
438
|
-
type MulticallResult<T extends boolean> = T extends true ? (MulticallSuccessResult | MulticallFailureResult)[] :
|
|
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
|
+
};
|
|
439
586
|
declare class BaseError extends Error {
|
|
440
587
|
name: string;
|
|
441
588
|
shortMessage: string;
|
|
@@ -463,13 +610,13 @@ declare class SimulationError extends BaseError {
|
|
|
463
610
|
type SimulateCallParams = {
|
|
464
611
|
contract: string
|
|
465
612
|
functionName: string
|
|
466
|
-
args?:
|
|
613
|
+
args?: ClarityValue2[]
|
|
467
614
|
sender?: string
|
|
468
615
|
tip?: string
|
|
469
616
|
};
|
|
470
617
|
type SimulateCallSuccess = {
|
|
471
618
|
success: true
|
|
472
|
-
result:
|
|
619
|
+
result: ClarityValue2
|
|
473
620
|
};
|
|
474
621
|
type SimulateCallFailure = {
|
|
475
622
|
success: false
|
|
@@ -637,9 +784,9 @@ type PublicActions = {
|
|
|
637
784
|
getAccountInfo: (params: GetAccountInfoParams) => Promise<AccountInfo>
|
|
638
785
|
getBlock: (params: GetBlockParams) => Promise<any>
|
|
639
786
|
getBlockHeight: () => Promise<number>
|
|
640
|
-
readContract: (params: ReadContractParams) => Promise<
|
|
787
|
+
readContract: (params: ReadContractParams) => Promise<ClarityValue2>
|
|
641
788
|
getContractAbi: (params: GetContractAbiParams) => Promise<any>
|
|
642
|
-
getMapEntry: (params: GetMapEntryParams) => Promise<
|
|
789
|
+
getMapEntry: (params: GetMapEntryParams) => Promise<ClarityValue2>
|
|
643
790
|
estimateFee: (params: EstimateFeeParams) => Promise<FeeEstimation[]>
|
|
644
791
|
multicall: <T extends boolean = true>(params: MulticallParams<T>) => Promise<MulticallResult<T>>
|
|
645
792
|
simulateCall: (params: SimulateCallParams) => Promise<SimulateCallResult>
|
|
@@ -660,18 +807,6 @@ type PublicClientConfig = Omit<ClientConfig, "account">;
|
|
|
660
807
|
* Use for queries, contract reads, and event subscriptions.
|
|
661
808
|
*/
|
|
662
809
|
declare function createPublicClient(config: PublicClientConfig): Client<PublicActions> & PublicActions;
|
|
663
|
-
type SendTransactionParams = {
|
|
664
|
-
transaction: StacksTransaction
|
|
665
|
-
attachment?: Uint8Array | string
|
|
666
|
-
};
|
|
667
|
-
type SendTransactionResult = {
|
|
668
|
-
txid: string
|
|
669
|
-
};
|
|
670
|
-
type SignTransactionParams = {
|
|
671
|
-
transaction: StacksTransaction
|
|
672
|
-
/** Public keys for multi-sig signing (auto-detected from _multisig metadata if omitted) */
|
|
673
|
-
signers?: string[]
|
|
674
|
-
};
|
|
675
810
|
type FungibleComparator = "eq" | "gt" | "gte" | "lt" | "lte";
|
|
676
811
|
type NonFungibleComparator = "sent" | "not-sent";
|
|
677
812
|
type StxPostCondition = {
|
|
@@ -692,27 +827,18 @@ type NftPostCondition = {
|
|
|
692
827
|
address: string
|
|
693
828
|
condition: NonFungibleComparator
|
|
694
829
|
asset: string
|
|
695
|
-
assetId:
|
|
830
|
+
assetId: ClarityValue2
|
|
696
831
|
};
|
|
697
|
-
type
|
|
832
|
+
type PostCondition2 = StxPostCondition | FtPostCondition | NftPostCondition;
|
|
698
833
|
type IntegerType = number | string | bigint | Uint8Array;
|
|
699
|
-
type TransferStxParams = {
|
|
700
|
-
to: string
|
|
701
|
-
amount: IntegerType
|
|
702
|
-
memo?: string
|
|
703
|
-
fee?: IntegerType
|
|
704
|
-
nonce?: IntegerType
|
|
705
|
-
postConditionMode?: "allow" | "deny"
|
|
706
|
-
postConditions?: PostCondition[]
|
|
707
|
-
};
|
|
708
834
|
type CallContractParams = {
|
|
709
835
|
contract: string
|
|
710
836
|
functionName: string
|
|
711
|
-
functionArgs?:
|
|
837
|
+
functionArgs?: ClarityValue2[]
|
|
712
838
|
fee?: IntegerType
|
|
713
839
|
nonce?: IntegerType
|
|
714
840
|
postConditionMode?: "allow" | "deny"
|
|
715
|
-
postConditions?:
|
|
841
|
+
postConditions?: PostCondition2[]
|
|
716
842
|
};
|
|
717
843
|
type DeployContractParams = {
|
|
718
844
|
contractName: string
|
|
@@ -721,21 +847,42 @@ type DeployContractParams = {
|
|
|
721
847
|
fee?: IntegerType
|
|
722
848
|
nonce?: IntegerType
|
|
723
849
|
postConditionMode?: "allow" | "deny"
|
|
724
|
-
postConditions?:
|
|
850
|
+
postConditions?: PostCondition2[]
|
|
851
|
+
};
|
|
852
|
+
type SendTransactionParams = {
|
|
853
|
+
transaction: StacksTransaction
|
|
854
|
+
attachment?: Uint8Array | string
|
|
855
|
+
};
|
|
856
|
+
type SendTransactionResult = {
|
|
857
|
+
txid: string
|
|
725
858
|
};
|
|
726
859
|
type SignMessageParams = {
|
|
727
|
-
message: string |
|
|
860
|
+
message: string | ClarityValue2
|
|
728
861
|
domain?: {
|
|
729
862
|
name: string
|
|
730
863
|
version: string
|
|
731
864
|
chainId: number
|
|
732
865
|
}
|
|
733
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
|
+
};
|
|
734
872
|
type SponsorTransactionParams = {
|
|
735
873
|
transaction: StacksTransaction
|
|
736
874
|
fee?: IntegerType
|
|
737
875
|
nonce?: IntegerType
|
|
738
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
|
+
};
|
|
739
886
|
/** Signing actions: send transactions, transfer STX, call/deploy contracts, sign messages. */
|
|
740
887
|
type WalletActions = {
|
|
741
888
|
sendTransaction: (params: SendTransactionParams) => Promise<SendTransactionResult>
|
|
@@ -765,16 +912,16 @@ type MultiSigTransferStxParams = {
|
|
|
765
912
|
fee?: IntegerType
|
|
766
913
|
nonce?: IntegerType
|
|
767
914
|
postConditionMode?: "allow" | "deny"
|
|
768
|
-
postConditions?:
|
|
915
|
+
postConditions?: PostCondition2[]
|
|
769
916
|
};
|
|
770
917
|
type MultiSigCallContractParams = {
|
|
771
918
|
contract: string
|
|
772
919
|
functionName: string
|
|
773
|
-
functionArgs?:
|
|
920
|
+
functionArgs?: ClarityValue2[]
|
|
774
921
|
fee?: IntegerType
|
|
775
922
|
nonce?: IntegerType
|
|
776
923
|
postConditionMode?: "allow" | "deny"
|
|
777
|
-
postConditions?:
|
|
924
|
+
postConditions?: PostCondition2[]
|
|
778
925
|
};
|
|
779
926
|
type MultiSigDeployContractParams = {
|
|
780
927
|
contractName: string
|
|
@@ -783,7 +930,7 @@ type MultiSigDeployContractParams = {
|
|
|
783
930
|
fee?: IntegerType
|
|
784
931
|
nonce?: IntegerType
|
|
785
932
|
postConditionMode?: "allow" | "deny"
|
|
786
|
-
postConditions?:
|
|
933
|
+
postConditions?: PostCondition2[]
|
|
787
934
|
};
|
|
788
935
|
type MultiSigSendTransactionParams = {
|
|
789
936
|
transaction: StacksTransaction
|
|
@@ -892,4 +1039,36 @@ declare function isAddressEqual(a: string, b: string): boolean;
|
|
|
892
1039
|
* Validates both parts; returns `deployer.contractName`.
|
|
893
1040
|
*/
|
|
894
1041
|
declare function getContractAddress(deployer: string, contractName: string): string;
|
|
895
|
-
|
|
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 };
|