@secondlayer/stacks 4.3.2 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 -112
- 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 -131
- package/dist/src/pox5/index.js.map +3 -4
- package/dist/src/sbtc/index.cjs +2 -27
- 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 -45
- 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/README.md
CHANGED
|
@@ -38,6 +38,8 @@ const balance = await client.getBalance({
|
|
|
38
38
|
| `@secondlayer/stacks/utils` | Encoding, hashing, addresses, unit formatting |
|
|
39
39
|
| `@secondlayer/stacks/bitcoin` | Trust-minimized Bitcoin SPV — proof construction, Clarity codecs, verifier (SIP-044) |
|
|
40
40
|
| `@secondlayer/stacks/pox5` | PoX-5 Bitcoin Staking (SIP-045) — bonds, staking, lockup scripts, signer grants |
|
|
41
|
+
| `@secondlayer/stacks/sbtc` | `sbtc()` client extension: sBTC deposits, balances, withdrawals |
|
|
42
|
+
| `@secondlayer/stacks/filters` | Event and transaction filter builders, re-exported from the root |
|
|
41
43
|
|
|
42
44
|
### Frozen modules
|
|
43
45
|
|
|
@@ -59,9 +61,18 @@ multi-broadcast gap, which is why it lives here rather than being deferred to
|
|
|
59
61
|
| `@secondlayer/stacks/pox` | PoX stacking — solo and delegated |
|
|
60
62
|
| `@secondlayer/stacks/stackingdao` | StackingDAO liquid staking (STX/stSTX) |
|
|
61
63
|
|
|
64
|
+
### Deprecated: `/tools` and `/tools/btc`
|
|
65
|
+
|
|
66
|
+
Give your agent Stacks reads through [`@secondlayer/mcp`](https://www.npmjs.com/package/@secondlayer/mcp) instead. The two AI SDK tool entries below still import, and stay until the next major, but they get no new tools. The tradeoff of keeping them: `ai` and `zod` are now optional peer dependencies, so a project that imports either entry installs both itself; a project that only reads contracts installs neither.
|
|
67
|
+
|
|
68
|
+
| Module | Description |
|
|
69
|
+
|---|---|
|
|
70
|
+
| `@secondlayer/stacks/tools` | **Deprecated.** AI SDK `tool()` set for Stacks reads. Bare exports read `STACKS_NETWORK` (or `STACKS_CHAIN`) and `STACKS_NODE_RPC_URL`, `SL_API_URL` or `STACKS_RPC_URL`; `createStacksTools(client)` binds your own client |
|
|
71
|
+
| `@secondlayer/stacks/tools/btc` | **Deprecated.** AI SDK `tool()` set for Bitcoin reads via mempool.space (`BTC_MEMPOOL_URL` overrides the host) |
|
|
72
|
+
|
|
62
73
|
## Fee tiers
|
|
63
74
|
|
|
64
|
-
Every send action takes `fee` as an exact amount **or a named tier
|
|
75
|
+
Every send action takes `fee` as an exact amount **or a named tier**: `'min' | 'low' | 'mid' | 'high'`. Tiers map to the node's three estimations; `'min'` is the minimum relay fee (1 uSTX per serialized byte), computed offline with no round-trip. Omitting `fee` estimates mid. When the node answers `NoEstimateAvailable` (a quiet chain or fresh devnet with no fee history), the SDK falls back to `'min'` instead of failing; `resolveFee` returns `{ fee, tier }` so you can see which happened. Any other estimator failure (timeout, 5xx, auth) throws rather than silently under-paying, and the nonce reserved for that send is handed back.
|
|
65
76
|
|
|
66
77
|
```ts
|
|
67
78
|
await client.transferStx({ to, amount: 1000n, fee: "low" });
|
|
@@ -73,7 +84,7 @@ await client.callContract({ contract, functionName: "mint", fee: "min" });
|
|
|
73
84
|
`waitForTransactionReceipt` polls until a transaction is mined (optionally N confirmations deep) and returns a normalized receipt with the decoded Clarity result. It rejects with typed errors when the tx aborts (`TransactionAbortedError`, receipt attached), drops from the mempool (`TransactionDroppedError`), or times out — and it re-reads block placement every cycle, so reorgs don't strand the wait.
|
|
74
85
|
|
|
75
86
|
```ts
|
|
76
|
-
const
|
|
87
|
+
const txid = await client.callContract({ contract, functionName: "mint" });
|
|
77
88
|
const receipt = await client.waitForTransactionReceipt({ txid, confirmations: 2 });
|
|
78
89
|
receipt.result; // decoded ClarityValue
|
|
79
90
|
|
|
@@ -81,20 +92,22 @@ receipt.result; // decoded ClarityValue
|
|
|
81
92
|
const { receipt } = await sendTransaction(client, { transaction, wait: 2 });
|
|
82
93
|
```
|
|
83
94
|
|
|
84
|
-
Status reads are pluggable, like nonce sources: the default reads `/extended/v1/tx` on your transport host; `indexTxSource()` reads Secondlayer
|
|
95
|
+
Status reads are pluggable, like nonce sources: the default reads `/extended/v1/tx` on your transport host; `indexTxSource()` reads `/v1/index/transactions` on your Secondlayer instance, which returns the chain tip in the same response, so N-confirmation waits cost one request per poll. The index only knows mined transactions, so with this source the dropped-grace window defaults to the full `timeout` instead of 30s. Without `baseUrl` the transport URL is assumed to be your instance: a Hiro transport throws up front, and a host that answers `/v1/index` with a non-JSON 404 (a bare stacks-node) throws on the first poll instead of waiting out the timeout. A `baseUrl` other than the transport host reuses the transport's retry and timeout policy only; the transport's `apiKey` and `fetchOptions` stay with the transport host. Rejection reasons are typed too: `BroadcastError.reason` is a literal union of all 26 stacks-node rejection strings (with `reasonData` and `txid` attached).
|
|
85
96
|
|
|
86
97
|
## Errors
|
|
87
98
|
|
|
88
|
-
The HTTP transport throws a typed `HttpRequestError` (`.status` attached) on any non-2xx response instead of handing back the error body as if it were a successful result
|
|
99
|
+
The HTTP transport throws a typed `HttpRequestError` (`.status`, `.url`, `.method` attached) on any non-2xx response instead of handing back the error body as if it were a successful result, and it retries `429`s, not just `5xx`/network errors. One `timeout` covers each attempt end to end, headers and body, so a stalled response rejects with `TimeoutError` (`.url`, `.method`, `.timeout`, `.attempt`) instead of hanging. Pass `signal` on any request to cancel from your side; a caller abort is never retried. Broadcasts are sent once (`retryCount: 0`): re-posting a transaction the node may already hold would surface as a nonce conflict, so a timed-out broadcast checks whether the node knows the tx before failing. `MalformedResponseError` throws from `getBalance`, `getAccountInfo`, `getMapEntry`, `getBlockHeight`, and `getBurnBlockHeight` when the node's response is missing an expected field, instead of failing with an opaque native error (`BigInt(undefined)` and friends). Both are exported from `@secondlayer/stacks`. Every error carries a stable `code` (`HTTP_REQUEST_ERROR`, `TIMEOUT_ERROR`, `MALFORMED_RESPONSE_ERROR`, ...) that also appears in `toJSON()`, so a handler can branch on it without an `instanceof` chain and without parsing a message that may be reworded.
|
|
89
100
|
|
|
90
101
|
```ts
|
|
91
|
-
import { HttpRequestError, MalformedResponseError } from "@secondlayer/stacks";
|
|
102
|
+
import { BaseError, HttpRequestError, MalformedResponseError, TimeoutError } from "@secondlayer/stacks";
|
|
92
103
|
|
|
93
104
|
try {
|
|
94
105
|
await client.getBalance({ address });
|
|
95
106
|
} catch (e) {
|
|
96
107
|
if (e instanceof HttpRequestError) e.status; // non-2xx from the node/API
|
|
108
|
+
if (e instanceof TimeoutError) e.url; // headers or body did not arrive in time
|
|
97
109
|
if (e instanceof MalformedResponseError) { /* response shape didn't match */ }
|
|
110
|
+
if (e instanceof BaseError) e.code; // "TIMEOUT_ERROR", stable across releases and minification (derived from `name`, not the class)
|
|
98
111
|
}
|
|
99
112
|
```
|
|
100
113
|
|
|
@@ -151,7 +164,7 @@ if (await client.pox5.isActive()) {
|
|
|
151
164
|
}
|
|
152
165
|
```
|
|
153
166
|
|
|
154
|
-
Every wallet action (`setupBond`, `registerForBond`, `stake`, `unstake`, `unstakeSbtc`, `claimRewards`, `grantSignerKey`, …) inherits fee tiers, nonce management, and typed errors from the client. `client.pox5.getStakerState(staker)` returns a staker's whole position
|
|
167
|
+
Every wallet action (`setupBond`, `registerForBond`, `stake`, `unstake`, `unstakeSbtc`, `claimRewards`, `grantSignerKey`, …) inherits fee tiers, nonce management, and typed errors from the client. `client.pox5.getStakerState(staker)` returns a staker's whole position (staker info, bond membership, custodied sBTC, current cycle) in one call (four parallel reads under the hood; Stacks nodes have no batch RPC, and `multicall` caps reads in flight at 8 by default via `concurrency`). Individual reads return typed JS values decoded via the module's committed pox-5 ABI (bigints, camelCase tuples, `null` for absent optionals), and every action's arguments are checked against that ABI at compile time.
|
|
155
168
|
|
|
156
169
|
### Off-chain L1 tooling — works before activation
|
|
157
170
|
|
|
@@ -185,7 +198,7 @@ await Promise.all(
|
|
|
185
198
|
);
|
|
186
199
|
```
|
|
187
200
|
|
|
188
|
-
Passing an explicit `nonce` always bypasses the manager. The defaults are node-agnostic and in-memory
|
|
201
|
+
Passing an explicit `nonce` always bypasses the manager. The defaults are node-agnostic and in-memory, with zero external dependencies. A send that fails before the node accepts it (fee estimate outage, `FeeTooLow`, transport error) hands its nonce back, so the next send reuses it instead of leaving a gap the mempool cannot chain past. Custom stores opt in by implementing `release(key, nonce)`; the bundled memory, Redis and Postgres stores already do.
|
|
189
202
|
|
|
190
203
|
### Multiple processes / smart wallets
|
|
191
204
|
|
|
@@ -203,7 +216,7 @@ const nonceManager = createNonceManager({
|
|
|
203
216
|
|
|
204
217
|
### Mempool-aware sources (optional)
|
|
205
218
|
|
|
206
|
-
By default the floor is the node's confirmed nonce. To make it mempool-aware
|
|
219
|
+
By default the floor is the node's confirmed nonce. To make it mempool-aware, and to auto-fill the freed nonce of a dropped transaction, swap the source. `indexSource` reads your Secondlayer instance's mempool through the client transport (retries, timeout and `Authorization: Bearer` included), `hiroNonceSource` reads Hiro's, or bring your own pending feed with `mempoolAwareSource`:
|
|
207
220
|
|
|
208
221
|
```ts
|
|
209
222
|
import {
|
|
@@ -212,7 +225,10 @@ import {
|
|
|
212
225
|
startNonceReconciler,
|
|
213
226
|
} from "@secondlayer/stacks";
|
|
214
227
|
|
|
215
|
-
// indexSource() | hiroNonceSource({ baseUrl }) | mempoolAwareSource({ getPending })
|
|
228
|
+
// indexSource({ baseUrl?, apiKey? }) | hiroNonceSource({ baseUrl }) | mempoolAwareSource({ getPending })
|
|
229
|
+
// baseUrl defaults to the transport URL; pass it when the transport is not your instance.
|
|
230
|
+
// A missing URL, a Hiro transport, or a host without /v1/index rejects instead of
|
|
231
|
+
// silently falling back to the confirmed nonce; a 5xx or timeout still degrades.
|
|
216
232
|
const source = indexSource();
|
|
217
233
|
const nonceManager = createNonceManager({ source });
|
|
218
234
|
|
|
@@ -357,12 +373,12 @@ SDK (gzipped) 23.8 KB 189 KB
|
|
|
357
373
|
+ WalletConnect v2 +25.5 KB (included)
|
|
358
374
|
─────────────────── ───────────────────
|
|
359
375
|
Total 46.1 KB 536 KB ← 11.6x
|
|
360
|
-
Dependencies
|
|
376
|
+
Dependencies 8 294 ← 37x
|
|
361
377
|
node_modules 7 MB 351 MB ← 50x
|
|
362
378
|
Polyfills needed none Buffer, crypto
|
|
363
379
|
Packages to install 1 5+
|
|
364
380
|
```
|
|
365
381
|
|
|
366
|
-
|
|
382
|
+
8 runtime deps, all `@noble`/`@scure`: `@noble/hashes`, `@noble/secp256k1`, `@noble/curves`, `@noble/ciphers`, `@scure/base`, `@scure/bip32`, `@scure/bip39`, `@scure/btc-signer`. `ai` and `zod` are optional peers, pulled in only by the deprecated `/tools` entries.
|
|
367
383
|
|
|
368
384
|
Connect and WalletConnect are separate entry points — import only what you use. An app that just reads contracts pays 23.8 KB. Full wallet connection + WC v2 pays 46.1 KB. The equivalent stacks.js setup is 536 KB regardless.
|
|
@@ -18,12 +18,13 @@ import {
|
|
|
18
18
|
isUint128,
|
|
19
19
|
isUint8Array,
|
|
20
20
|
toCamelCase
|
|
21
|
-
} from "./stacks-
|
|
21
|
+
} from "./stacks-x0qqwrev.js";
|
|
22
22
|
import {
|
|
23
23
|
asciiToBytes,
|
|
24
24
|
bytesToAscii,
|
|
25
25
|
hexToBytes,
|
|
26
|
-
utf8ToBytes
|
|
26
|
+
utf8ToBytes,
|
|
27
|
+
without0x
|
|
27
28
|
} from "./stacks-qs5fzts5.js";
|
|
28
29
|
// src/clarity/prettyPrint.ts
|
|
29
30
|
function prettyPrint(val, encoding = "hex") {
|
|
@@ -74,11 +75,13 @@ function cvToJSON(val) {
|
|
|
74
75
|
return { type: "int", value: val.value.toString() };
|
|
75
76
|
case "uint":
|
|
76
77
|
return { type: "uint", value: val.value.toString() };
|
|
77
|
-
case "buffer":
|
|
78
|
+
case "buffer": {
|
|
79
|
+
const hex = without0x(val.value);
|
|
78
80
|
return {
|
|
79
|
-
type: `(buff ${Math.ceil(
|
|
80
|
-
value: `0x${
|
|
81
|
+
type: `(buff ${Math.ceil(hex.length / 2)})`,
|
|
82
|
+
value: `0x${hex}`
|
|
81
83
|
};
|
|
84
|
+
}
|
|
82
85
|
case "none":
|
|
83
86
|
return { type: "(optional none)", value: null };
|
|
84
87
|
case "some":
|
|
@@ -532,5 +535,5 @@ function normalizeAbi(abi) {
|
|
|
532
535
|
}
|
|
533
536
|
export { prettyPrint, cvToJSON, cvToValue, cvToBigInt, cvToString, cvToBuffer, cvToBoolean, cvToPrincipal, ClarityConversionError, jsToClarity, prepareArgs, validateArgs, validateArgsArray, TRAIT_STANDARDS, classifyContract, parseDeclaredStandards, normalizeAccess, normalizeType, normalizeAbi };
|
|
534
537
|
|
|
535
|
-
//# debugId=
|
|
536
|
-
//# sourceMappingURL=stacks-
|
|
538
|
+
//# debugId=09402291404FACAB64756E2164756E21
|
|
539
|
+
//# sourceMappingURL=stacks-2as26bcg.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/clarity/prettyPrint.ts", "../src/clarity/abi/converters.ts", "../src/clarity/abi/classify.ts", "../src/clarity/abi/normalize.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import {\n\tasciiToBytes,\n\tbytesToAscii,\n\thexToBytes,\n\tutf8ToBytes,\n\twithout0x,\n} from \"../utils/encoding.ts\";\nimport type { ClarityValue } from \"./types.ts\";\n\nexport function prettyPrint(\n\tval: ClarityValue,\n\tencoding: \"tryAscii\" | \"hex\" = \"hex\",\n): string | undefined {\n\tswitch (val.type) {\n\t\tcase \"true\":\n\t\t\treturn \"true\";\n\t\tcase \"false\":\n\t\t\treturn \"false\";\n\t\tcase \"int\":\n\t\t\treturn val.value.toString();\n\t\tcase \"uint\":\n\t\t\treturn `u${val.value.toString()}`;\n\t\tcase \"buffer\":\n\t\t\tif (encoding === \"tryAscii\") {\n\t\t\t\tconst str = bytesToAscii(hexToBytes(val.value));\n\t\t\t\tif (/^[ -~]*$/.test(str)) return JSON.stringify(str);\n\t\t\t}\n\t\t\treturn `0x${val.value}`;\n\t\tcase \"none\":\n\t\t\treturn \"none\";\n\t\tcase \"some\":\n\t\t\treturn `(some ${prettyPrint(val.value, encoding)})`;\n\t\tcase \"ok\":\n\t\t\treturn `(ok ${prettyPrint(val.value, encoding)})`;\n\t\tcase \"err\":\n\t\t\treturn `(err ${prettyPrint(val.value, encoding)})`;\n\t\tcase \"address\":\n\t\tcase \"contract\":\n\t\t\treturn val.value;\n\t\tcase \"list\":\n\t\t\treturn `(list ${val.value.map((v) => prettyPrint(v, encoding)).join(\" \")})`;\n\t\tcase \"tuple\":\n\t\t\treturn `(tuple ${Object.keys(val.value)\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: value is non-null after preceding check or by construction; TS narrowing limitation\n\t\t\t\t.map((key) => `(${key} ${prettyPrint(val.value[key]!, encoding)})`)\n\t\t\t\t.join(\" \")})`;\n\t\tcase \"ascii\":\n\t\t\treturn `\"${val.value}\"`;\n\t\tcase \"utf8\":\n\t\t\treturn `u\"${val.value}\"`;\n\t}\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\nexport function cvToJSON(val: ClarityValue): any {\n\tswitch (val.type) {\n\t\tcase \"true\":\n\t\t\treturn { type: \"bool\", value: true };\n\t\tcase \"false\":\n\t\t\treturn { type: \"bool\", value: false };\n\t\tcase \"int\":\n\t\t\treturn { type: \"int\", value: val.value.toString() };\n\t\tcase \"uint\":\n\t\t\treturn { type: \"uint\", value: val.value.toString() };\n\t\tcase \"buffer\": {\n\t\t\tconst hex = without0x(val.value);\n\t\t\treturn {\n\t\t\t\ttype: `(buff ${Math.ceil(hex.length / 2)})`,\n\t\t\t\tvalue: `0x${hex}`,\n\t\t\t};\n\t\t}\n\t\tcase \"none\":\n\t\t\treturn { type: \"(optional none)\", value: null };\n\t\tcase \"some\":\n\t\t\treturn { type: \"(optional)\", value: cvToJSON(val.value) };\n\t\tcase \"ok\":\n\t\t\treturn { type: \"(response)\", value: cvToJSON(val.value), success: true };\n\t\tcase \"err\":\n\t\t\treturn { type: \"(response)\", value: cvToJSON(val.value), success: false };\n\t\tcase \"address\":\n\t\tcase \"contract\":\n\t\t\treturn { type: \"principal\", value: val.value };\n\t\tcase \"list\":\n\t\t\treturn { type: \"(list)\", value: val.value.map(cvToJSON) };\n\t\tcase \"tuple\": {\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\t\t\tconst result: Record<string, any> = {};\n\t\t\tfor (const key of Object.keys(val.value)) {\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: value is non-null after preceding check or by construction; TS narrowing limitation\n\t\t\t\tresult[key] = cvToJSON(val.value[key]!);\n\t\t\t}\n\t\t\treturn { type: \"(tuple)\", value: result };\n\t\t}\n\t\tcase \"ascii\":\n\t\t\treturn {\n\t\t\t\ttype: `(string-ascii ${asciiToBytes(val.value).length})`,\n\t\t\t\tvalue: val.value,\n\t\t\t};\n\t\tcase \"utf8\":\n\t\t\treturn {\n\t\t\t\ttype: `(string-utf8 ${utf8ToBytes(val.value).length})`,\n\t\t\t\tvalue: val.value,\n\t\t\t};\n\t}\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\nexport function cvToValue(val: ClarityValue): any {\n\tswitch (val.type) {\n\t\tcase \"true\":\n\t\t\treturn true;\n\t\tcase \"false\":\n\t\t\treturn false;\n\t\tcase \"int\":\n\t\tcase \"uint\":\n\t\t\treturn val.value;\n\t\tcase \"buffer\":\n\t\t\treturn `0x${val.value}`;\n\t\tcase \"none\":\n\t\t\treturn null;\n\t\tcase \"some\":\n\t\t\treturn cvToValue(val.value);\n\t\tcase \"ok\":\n\t\tcase \"err\":\n\t\t\treturn cvToValue(val.value);\n\t\tcase \"address\":\n\t\tcase \"contract\":\n\t\t\treturn val.value;\n\t\tcase \"list\":\n\t\t\treturn val.value.map(cvToValue);\n\t\tcase \"tuple\": {\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\t\t\tconst result: Record<string, any> = {};\n\t\t\tfor (const key of Object.keys(val.value)) {\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: value is non-null after preceding check or by construction; TS narrowing limitation\n\t\t\t\tresult[key] = cvToValue(val.value[key]!);\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\t\tcase \"ascii\":\n\t\tcase \"utf8\":\n\t\t\treturn val.value;\n\t}\n}\n\n/** Narrow to bigint; throws unless `val` is an int or uint. */\nexport function cvToBigInt(val: ClarityValue): bigint {\n\tif (val.type !== \"int\" && val.type !== \"uint\") {\n\t\tthrow new Error(`cvToBigInt: expected int or uint, got ${val.type}`);\n\t}\n\treturn val.value;\n}\n\n/** Narrow to string; throws unless `val` is an ascii or utf8 string. */\nexport function cvToString(val: ClarityValue): string {\n\tif (val.type !== \"ascii\" && val.type !== \"utf8\") {\n\t\tthrow new Error(`cvToString: expected ascii or utf8, got ${val.type}`);\n\t}\n\treturn val.value;\n}\n\n/** Narrow to hex string (no 0x prefix); throws unless `val` is a buffer. */\nexport function cvToBuffer(val: ClarityValue): string {\n\tif (val.type !== \"buffer\") {\n\t\tthrow new Error(`cvToBuffer: expected buffer, got ${val.type}`);\n\t}\n\treturn val.value;\n}\n\n/** Narrow to boolean; throws unless `val` is a bool. */\nexport function cvToBoolean(val: ClarityValue): boolean {\n\tif (val.type !== \"true\" && val.type !== \"false\") {\n\t\tthrow new Error(`cvToBoolean: expected bool, got ${val.type}`);\n\t}\n\treturn val.type === \"true\";\n}\n\n/** Narrow to principal string; throws unless `val` is a standard or contract principal. */\nexport function cvToPrincipal(val: ClarityValue): string {\n\tif (val.type !== \"address\" && val.type !== \"contract\") {\n\t\tthrow new Error(\n\t\t\t`cvToPrincipal: expected principal or contract, got ${val.type}`,\n\t\t);\n\t}\n\treturn val.value;\n}\n",
|
|
6
|
+
"import type { AbiFunction } from \"./contract.ts\";\nimport {\n\tisAbiBuffer,\n\tisAbiList,\n\tisAbiOptional,\n\tisAbiResponse,\n\tisAbiStringAscii,\n\tisAbiStringUtf8,\n\tisAbiTuple,\n\tisBool,\n\tisInt128,\n\tisPrincipal,\n\tisString,\n\tisUint8Array,\n\tisUint128,\n} from \"./guards.ts\";\nimport type { AbiType } from \"./types.ts\";\nimport { toCamelCase } from \"./utils.ts\";\n\nexport class ClarityConversionError extends Error {\n\tconstructor(\n\t\tmessage: string,\n\t\tpublic readonly type: AbiType,\n\t\tpublic readonly value: unknown,\n\t) {\n\t\tsuper(message);\n\t\tthis.name = \"ClarityConversionError\";\n\t}\n}\n\nexport function jsToClarity(type: AbiType, value: unknown): unknown {\n\tif (type === \"none\") return null;\n\n\tif (type === \"uint128\") {\n\t\tif (!isUint128(value))\n\t\t\tthrow new ClarityConversionError(\"Invalid uint128 value\", type, value);\n\t\treturn value;\n\t}\n\n\tif (type === \"int128\") {\n\t\tif (!isInt128(value))\n\t\t\tthrow new ClarityConversionError(\"Invalid int128 value\", type, value);\n\t\treturn value;\n\t}\n\n\tif (type === \"bool\") {\n\t\tif (!isBool(value))\n\t\t\tthrow new ClarityConversionError(\"Invalid bool value\", type, value);\n\t\treturn value;\n\t}\n\n\tif (type === \"principal\") {\n\t\tif (!isPrincipal(value))\n\t\t\tthrow new ClarityConversionError(\"Invalid principal value\", type, value);\n\t\treturn value;\n\t}\n\n\tif (type === \"trait_reference\") {\n\t\tif (!isPrincipal(value))\n\t\t\tthrow new ClarityConversionError(\n\t\t\t\t\"Invalid trait_reference value\",\n\t\t\t\ttype,\n\t\t\t\tvalue,\n\t\t\t);\n\t\treturn value;\n\t}\n\n\tif (isAbiStringAscii(type)) {\n\t\tif (!isString(value))\n\t\t\tthrow new ClarityConversionError(\n\t\t\t\t\"Invalid string-ascii value\",\n\t\t\t\ttype,\n\t\t\t\tvalue,\n\t\t\t);\n\t\tconst str = value as string;\n\t\tfor (let i = 0; i < str.length; i++) {\n\t\t\tif (str.charCodeAt(i) > 127) {\n\t\t\t\tthrow new ClarityConversionError(\n\t\t\t\t\t`Non-ASCII character at position ${i}: '${str[i]}' (code ${str.charCodeAt(i)})`,\n\t\t\t\t\ttype,\n\t\t\t\t\tvalue,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tif (str.length > type[\"string-ascii\"].length) {\n\t\t\tthrow new ClarityConversionError(\n\t\t\t\t`String length ${str.length} exceeds max ${type[\"string-ascii\"].length}`,\n\t\t\t\ttype,\n\t\t\t\tvalue,\n\t\t\t);\n\t\t}\n\t\treturn value;\n\t}\n\n\tif (isAbiStringUtf8(type)) {\n\t\tif (!isString(value))\n\t\t\tthrow new ClarityConversionError(\n\t\t\t\t\"Invalid string-utf8 value\",\n\t\t\t\ttype,\n\t\t\t\tvalue,\n\t\t\t);\n\t\tconst str = value as string;\n\t\tconst byteLength = new TextEncoder().encode(str).length;\n\t\tif (byteLength > type[\"string-utf8\"].length) {\n\t\t\tthrow new ClarityConversionError(\n\t\t\t\t`String byte length ${byteLength} exceeds max ${type[\"string-utf8\"].length}`,\n\t\t\t\ttype,\n\t\t\t\tvalue,\n\t\t\t);\n\t\t}\n\t\treturn value;\n\t}\n\n\tif (isAbiBuffer(type)) {\n\t\tif (!isUint8Array(value))\n\t\t\tthrow new ClarityConversionError(\"Invalid buffer value\", type, value);\n\t\tconst buff = value as Uint8Array;\n\t\tif (buff.length > type.buff.length) {\n\t\t\tthrow new ClarityConversionError(\n\t\t\t\t`Buffer length ${buff.length} exceeds max ${type.buff.length}`,\n\t\t\t\ttype,\n\t\t\t\tvalue,\n\t\t\t);\n\t\t}\n\t\treturn value;\n\t}\n\n\tif (isAbiList(type)) {\n\t\tif (!Array.isArray(value))\n\t\t\tthrow new ClarityConversionError(\n\t\t\t\t\"Expected array for list type\",\n\t\t\t\ttype,\n\t\t\t\tvalue,\n\t\t\t);\n\t\tif (value.length > type.list.length) {\n\t\t\tthrow new ClarityConversionError(\n\t\t\t\t`List length ${value.length} exceeds max ${type.list.length}`,\n\t\t\t\ttype,\n\t\t\t\tvalue,\n\t\t\t);\n\t\t}\n\t\treturn value.map((item) => jsToClarity(type.list.type, item));\n\t}\n\n\tif (isAbiTuple(type)) {\n\t\tif (typeof value !== \"object\" || value === null)\n\t\t\tthrow new ClarityConversionError(\n\t\t\t\t\"Expected object for tuple type\",\n\t\t\t\ttype,\n\t\t\t\tvalue,\n\t\t\t);\n\t\tconst result: Record<string, unknown> = {};\n\t\tfor (const field of type.tuple) {\n\t\t\tconst camelKey = toCamelCase(field.name);\n\t\t\tconst hasOriginal = field.name in (value as object);\n\t\t\tconst hasCamel = camelKey in (value as object);\n\t\t\tif (!hasOriginal && !hasCamel) {\n\t\t\t\tthrow new ClarityConversionError(\n\t\t\t\t\t`Missing tuple field: ${field.name}`,\n\t\t\t\t\ttype,\n\t\t\t\t\tvalue,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst fieldValue = hasOriginal\n\t\t\t\t? (value as Record<string, unknown>)[field.name]\n\t\t\t\t: (value as Record<string, unknown>)[camelKey];\n\t\t\tresult[field.name] = jsToClarity(field.type, fieldValue);\n\t\t}\n\t\treturn result;\n\t}\n\n\tif (isAbiOptional(type)) {\n\t\tif (value === null || value === undefined) return null;\n\t\treturn jsToClarity(type.optional, value);\n\t}\n\n\tif (isAbiResponse(type)) {\n\t\tif (typeof value !== \"object\" || value === null)\n\t\t\tthrow new ClarityConversionError(\n\t\t\t\t\"Expected object for response type\",\n\t\t\t\ttype,\n\t\t\t\tvalue,\n\t\t\t);\n\t\tconst hasOk = \"ok\" in value;\n\t\tconst hasErr = \"err\" in value;\n\t\tif (hasOk && !hasErr) {\n\t\t\treturn {\n\t\t\t\tok: jsToClarity(type.response.ok, (value as { ok: unknown }).ok),\n\t\t\t};\n\t\t}\n\t\tif (hasErr && !hasOk) {\n\t\t\treturn {\n\t\t\t\terr: jsToClarity(type.response.error, (value as { err: unknown }).err),\n\t\t\t};\n\t\t}\n\t\tthrow new ClarityConversionError(\n\t\t\t\"Response must have exactly 'ok' or 'err' property\",\n\t\t\ttype,\n\t\t\tvalue,\n\t\t);\n\t}\n\n\tthrow new ClarityConversionError(\"Unknown Clarity type\", type, value);\n}\n\nexport function prepareArgs<F extends AbiFunction>(\n\tfunc: F,\n\targs: Record<string, unknown>,\n): unknown[] {\n\treturn func.args.map((arg) => {\n\t\tif (!(arg.name in args)) {\n\t\t\tthrow new ClarityConversionError(\n\t\t\t\t`Missing argument: ${arg.name}`,\n\t\t\t\targ.type,\n\t\t\t\tundefined,\n\t\t\t);\n\t\t}\n\t\treturn jsToClarity(arg.type, args[arg.name]);\n\t});\n}\n\nexport function validateArgs<F extends AbiFunction>(\n\tfunc: F,\n\targs: Record<string, unknown>,\n): void {\n\tfor (const arg of func.args) {\n\t\tif (!(arg.name in args)) {\n\t\t\tthrow new ClarityConversionError(\n\t\t\t\t`Missing argument: ${arg.name}`,\n\t\t\t\targ.type,\n\t\t\t\tundefined,\n\t\t\t);\n\t\t}\n\t\tjsToClarity(arg.type, args[arg.name]);\n\t}\n}\n\nexport function validateArgsArray<F extends AbiFunction>(\n\tfunc: F,\n\targs: unknown[],\n): void {\n\tif (args.length !== func.args.length) {\n\t\tthrow new ClarityConversionError(\n\t\t\t`Expected ${func.args.length} arguments, got ${args.length}`,\n\t\t\tfunc.args[0]?.type ?? \"bool\",\n\t\t\targs,\n\t\t);\n\t}\n\tfunc.args.forEach((arg, i) => {\n\t\tjsToClarity(arg.type, args[i]);\n\t});\n}\n",
|
|
7
|
+
"import type { AbiContract, AbiFunction } from \"./contract.ts\";\nimport { SIP009_ABI, SIP010_ABI, SIP013_ABI } from \"./standards.ts\";\n\n/**\n * Static conformance classification — \"does this contract's ABI look like a\n * SIP-009/010/013 token?\". Powers trait-based discovery for the (many) contracts\n * that conform to a standard without declaring its trait. Lean match: every\n * REQUIRED standard function must be present with the same access + arg arity\n * (optional functions like get-token-uri are ignored). Loose on exact arg/return\n * types to catch real-world variants; consumers wanting certainty use the\n * `declared` traits parsed from source instead.\n */\n\n/** The canonical SIP trait standards this package can classify/scaffold against.\n * Single source of truth — the `SipStandard` type, CLI `--trait` validation, and\n * the MCP traits resource all derive from this so the vocabulary can't drift. */\nexport const TRAIT_STANDARDS = [\"sip-009\", \"sip-010\", \"sip-013\"] as const;\n\nexport type SipStandard = (typeof TRAIT_STANDARDS)[number];\n\ninterface StandardSpec {\n\tid: SipStandard;\n\tabi: AbiContract;\n\t/** Functions in the reference ABI that real tokens may omit. */\n\toptional: ReadonlySet<string>;\n}\n\nconst STANDARDS: ReadonlyArray<StandardSpec> = [\n\t{ id: \"sip-010\", abi: SIP010_ABI, optional: new Set([\"get-token-uri\"]) },\n\t{ id: \"sip-009\", abi: SIP009_ABI, optional: new Set([\"get-token-uri\"]) },\n\t{\n\t\tid: \"sip-013\",\n\t\tabi: SIP013_ABI,\n\t\toptional: new Set([\n\t\t\t\"transfer-memo\",\n\t\t\t\"transfer-many\",\n\t\t\t\"transfer-many-memo\",\n\t\t\t\"get-token-uri\",\n\t\t\t\"get-overall-balance\",\n\t\t\t\"get-overall-supply\",\n\t\t]),\n\t},\n];\n\nfunction indexByName(abi: AbiContract): Map<string, AbiFunction> {\n\tconst m = new Map<string, AbiFunction>();\n\tfor (const f of abi.functions) m.set(f.name, f);\n\treturn m;\n}\n\nfunction conformsTo(candidate: AbiContract, spec: StandardSpec): boolean {\n\tconst fns = indexByName(candidate);\n\tfor (const required of spec.abi.functions) {\n\t\tif (spec.optional.has(required.name)) continue;\n\t\tconst got = fns.get(required.name);\n\t\tif (!got) return false;\n\t\tif (got.access !== required.access) return false;\n\t\tif (got.args.length !== required.args.length) return false;\n\t}\n\treturn true;\n}\n\n/** Return the SIP standards a contract's ABI statically conforms to. */\nexport function classifyContract(abi: AbiContract): SipStandard[] {\n\tif (!abi || !Array.isArray(abi.functions)) return [];\n\treturn STANDARDS.filter((s) => conformsTo(abi, s)).map((s) => s.id);\n}\n\n/**\n * Parse the standards a contract *declares* via `(impl-trait …)` in its Clarity\n * source. Matched heuristically on the trait-reference name (robust across\n * mainnet/testnet principals + community variants) rather than an exact principal\n * allowlist. The ABI/RPC doesn't carry trait info, so source is the only declared\n * signal. `declared` is the high-confidence signal; `classifyContract` is the\n * catch-all for conforming-but-undeclared contracts.\n */\nexport function parseDeclaredStandards(claritySource: string): SipStandard[] {\n\tconst out = new Set<SipStandard>();\n\tconst matches = claritySource.matchAll(/\\(impl-trait\\s+[^)]+\\)/gi);\n\tfor (const m of matches) {\n\t\tconst ref = m[0].toLowerCase();\n\t\tif (ref.includes(\"sip-010\") || ref.includes(\".ft-trait\"))\n\t\t\tout.add(\"sip-010\");\n\t\tif (ref.includes(\"sip-009\") || ref.includes(\"nft-trait\"))\n\t\t\tout.add(\"sip-009\");\n\t\tif (ref.includes(\"sip-013\") || ref.includes(\"semi-fungible\"))\n\t\t\tout.add(\"sip-013\");\n\t}\n\treturn [...out];\n}\n",
|
|
8
|
+
"/**\n * Normalize a Clarity ABI from any source into the canonical `AbiContract`\n * shape this package's type extractors expect.\n *\n * Sources differ in small, load-bearing ways: the Hiro API and Clarinet SDK\n * emit `buffer`/`read_only` and wrap function outputs as `{ type: … }`, while\n * the canonical shape uses `buff`/`read-only` and a bare `AbiType`. Passing a\n * raw ABI straight through produces a value that LOOKS right and silently\n * fails the `AbiContract` constraint, so `event.input` / `.read.x()` typing\n * quietly degrades. Run it through here first.\n *\n * Lives in `@secondlayer/stacks/clarity` (not the CLI) so a raw ABI can be\n * normalized anywhere — scaffolds, MCP, a user's own script — without the CLI\n * installed.\n */\n\nimport type {\n\tAbiContract,\n\tAbiFunction,\n\tAbiMap,\n\tAbiVariable,\n} from \"./contract.ts\";\nimport type { AbiType } from \"./types.ts\";\n\n/**\n * Normalize function access type from various formats to internal format\n */\nexport function normalizeAccess(\n\taccess: string,\n): \"public\" | \"read-only\" | \"private\" {\n\tif (access === \"read_only\") return \"read-only\";\n\treturn access as \"public\" | \"read-only\" | \"private\";\n}\n\n/**\n * Normalize a Clarity type from API format to internal format\n * Handles buffer vs buff, and recursively normalizes nested types\n */\nexport function normalizeType(type: unknown): AbiType {\n\tif (typeof type === \"string\") {\n\t\t// Handle string primitive types\n\t\tswitch (type) {\n\t\t\tcase \"uint128\":\n\t\t\tcase \"int128\":\n\t\t\tcase \"bool\":\n\t\t\tcase \"principal\":\n\t\t\tcase \"trait_reference\":\n\t\t\t\treturn type;\n\t\t\tdefault:\n\t\t\t\t// Unknown string type, return as-is\n\t\t\t\treturn type as AbiType;\n\t\t}\n\t}\n\n\tif (typeof type !== \"object\" || type === null) {\n\t\tthrow new Error(`Invalid ABI type: expected object, got ${typeof type}`);\n\t}\n\n\tconst typeObj = type as Record<string, unknown>;\n\n\t// Handle buffer vs buff (API uses buffer, we use buff)\n\tif (\"buffer\" in typeObj) {\n\t\tconst buffer = typeObj.buffer as { length?: number };\n\t\treturn {\n\t\t\tbuff: {\n\t\t\t\tlength: buffer?.length ?? 32,\n\t\t\t},\n\t\t};\n\t}\n\n\t// Already in internal format\n\tif (\"buff\" in typeObj) {\n\t\tconst buff = typeObj.buff as { length?: number };\n\t\treturn {\n\t\t\tbuff: {\n\t\t\t\tlength: buff?.length ?? 32,\n\t\t\t},\n\t\t};\n\t}\n\n\t// String types\n\tif (\"string-ascii\" in typeObj) {\n\t\tconst strAscii = typeObj[\"string-ascii\"] as { length?: number };\n\t\treturn {\n\t\t\t\"string-ascii\": {\n\t\t\t\tlength: strAscii?.length ?? 256,\n\t\t\t},\n\t\t};\n\t}\n\n\tif (\"string-utf8\" in typeObj) {\n\t\tconst strUtf8 = typeObj[\"string-utf8\"] as { length?: number };\n\t\treturn {\n\t\t\t\"string-utf8\": {\n\t\t\t\tlength: strUtf8?.length ?? 256,\n\t\t\t},\n\t\t};\n\t}\n\n\t// Response type - recursively normalize ok and error types\n\tif (\"response\" in typeObj) {\n\t\tconst response = typeObj.response as { ok?: unknown; error?: unknown };\n\t\treturn {\n\t\t\tresponse: {\n\t\t\t\tok: normalizeType(response?.ok ?? \"bool\"),\n\t\t\t\terror: normalizeType(response?.error ?? \"uint128\"),\n\t\t\t},\n\t\t};\n\t}\n\n\t// Optional type - recursively normalize inner type\n\tif (\"optional\" in typeObj) {\n\t\treturn {\n\t\t\toptional: normalizeType(typeObj.optional),\n\t\t};\n\t}\n\n\t// List type - recursively normalize element type\n\tif (\"list\" in typeObj) {\n\t\tconst list = typeObj.list as { type?: unknown; length?: number };\n\t\treturn {\n\t\t\tlist: {\n\t\t\t\ttype: normalizeType(list?.type ?? \"uint128\"),\n\t\t\t\tlength: list?.length ?? 100,\n\t\t\t},\n\t\t};\n\t}\n\n\t// Tuple type - recursively normalize field types\n\tif (\"tuple\" in typeObj) {\n\t\tconst tuple = typeObj.tuple as Array<{ name: string; type: unknown }>;\n\t\treturn {\n\t\t\ttuple: tuple.map((field) => ({\n\t\t\t\tname: field.name,\n\t\t\t\ttype: normalizeType(field.type),\n\t\t\t})),\n\t\t};\n\t}\n\n\t// Unknown type - fail explicitly\n\tthrow new Error(`Unknown ABI type structure: ${JSON.stringify(type)}`);\n}\n\n/**\n * Normalize a function definition from API format to internal format\n */\nexport function normalizeFunction(func: Record<string, unknown>): AbiFunction {\n\tconst access = normalizeAccess(func.access as string);\n\tconst args = (func.args as Array<{ name: string; type: unknown }>) ?? [];\n\tconst outputs = func.outputs as { type?: unknown } | unknown;\n\n\treturn {\n\t\tname: func.name as string,\n\t\taccess,\n\t\targs: args.map((arg) => ({\n\t\t\tname: arg.name,\n\t\t\ttype: normalizeType(arg.type),\n\t\t})),\n\t\toutputs: normalizeType(\n\t\t\ttypeof outputs === \"object\" && outputs !== null && \"type\" in outputs\n\t\t\t\t? (outputs as { type: unknown }).type\n\t\t\t\t: outputs,\n\t\t),\n\t};\n}\n\n/**\n * Normalize a map definition from API format to internal format\n */\nexport function normalizeMap(map: Record<string, unknown>): AbiMap {\n\treturn {\n\t\tname: map.name as string,\n\t\tkey: normalizeType(map.key),\n\t\tvalue: normalizeType(map.value),\n\t};\n}\n\n/**\n * Normalize a variable definition from API format to internal format\n */\nexport function normalizeVariable(\n\tvariable: Record<string, unknown>,\n): AbiVariable {\n\treturn {\n\t\tname: variable.name as string,\n\t\ttype: normalizeType(variable.type),\n\t\taccess: variable.access as \"constant\" | \"variable\",\n\t};\n}\n\n/**\n * Normalize an entire ABI from various sources to consistent internal format\n *\n * This handles ABIs from:\n * - Hiro API responses\n * - Clarinet SDK\n * - Upstream @secondlayer/stacks types\n */\nexport function normalizeAbi(abi: unknown): AbiContract {\n\tif (typeof abi !== \"object\" || abi === null) {\n\t\treturn { functions: [] };\n\t}\n\n\tconst abiObj = abi as Record<string, unknown>;\n\n\tconst functions: AbiFunction[] = [];\n\tconst maps: AbiMap[] = [];\n\tconst variables: AbiVariable[] = [];\n\n\t// Normalize functions\n\tif (Array.isArray(abiObj.functions)) {\n\t\tfor (const func of abiObj.functions) {\n\t\t\tif (typeof func === \"object\" && func !== null) {\n\t\t\t\tfunctions.push(normalizeFunction(func as Record<string, unknown>));\n\t\t\t}\n\t\t}\n\t}\n\n\t// Normalize maps\n\tif (Array.isArray(abiObj.maps)) {\n\t\tfor (const map of abiObj.maps) {\n\t\t\tif (typeof map === \"object\" && map !== null) {\n\t\t\t\tmaps.push(normalizeMap(map as Record<string, unknown>));\n\t\t\t}\n\t\t}\n\t}\n\n\t// Normalize variables\n\tif (Array.isArray(abiObj.variables)) {\n\t\tfor (const variable of abiObj.variables) {\n\t\t\tif (typeof variable === \"object\" && variable !== null) {\n\t\t\t\tvariables.push(normalizeVariable(variable as Record<string, unknown>));\n\t\t\t}\n\t\t}\n\t}\n\n\treturn {\n\t\tfunctions,\n\t\tmaps: maps.length > 0 ? maps : undefined,\n\t\tvariables: variables.length > 0 ? variables : undefined,\n\t};\n}\n"
|
|
9
|
+
],
|
|
10
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASO,SAAS,WAAW,CAC1B,KACA,WAA+B,OACV;AAAA,EACrB,QAAQ,IAAI;AAAA,SACN;AAAA,MACJ,OAAO;AAAA,SACH;AAAA,MACJ,OAAO;AAAA,SACH;AAAA,MACJ,OAAO,IAAI,MAAM,SAAS;AAAA,SACtB;AAAA,MACJ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O,QAAQ,YAAY,QAAQ,MAAM;AAAA,QAC5C,KAAK,KAAK,aAAa,GAA8B,CAAC;AAAA,MACvD;AAAA,IACD;AAAA,EACD;AAAA,EAGA,IAAI,MAAM,QAAQ,OAAO,SAAS,GAAG;AAAA,IACpC,WAAW,YAAY,OAAO,WAAW;AAAA,MACxC,IAAI,OAAO,aAAa,YAAY,aAAa,MAAM;AAAA,QACtD,UAAU,KAAK,kBAAkB,QAAmC,CAAC;AAAA,MACtE;AAAA,IACD;AAAA,EACD;AAAA,EAEA,OAAO;AAAA,IACN;AAAA,IACA,MAAM,KAAK,SAAS,IAAI,OAAO;AAAA,IAC/B,WAAW,UAAU,SAAS,IAAI,YAAY;AAAA,EAC/C;AAAA;",
|
|
11
|
+
"debugId": "09402291404FACAB64756E2164756E21",
|
|
12
|
+
"names": []
|
|
13
|
+
}
|
|
@@ -51,10 +51,10 @@ function parsePrincipal(value) {
|
|
|
51
51
|
return { address, contractName };
|
|
52
52
|
}
|
|
53
53
|
function parseContractId(contractId) {
|
|
54
|
-
const
|
|
55
|
-
if (!
|
|
54
|
+
const parsed = parsePrincipal(contractId);
|
|
55
|
+
if (!parsed?.contractName)
|
|
56
56
|
throw new Error(`Invalid contract identifier: ${contractId}`);
|
|
57
|
-
return [address,
|
|
57
|
+
return [parsed.address, parsed.contractName];
|
|
58
58
|
}
|
|
59
59
|
function isClarityName(name) {
|
|
60
60
|
const regex = /^[a-zA-Z]([a-zA-Z0-9]|[-_!?+<>=/*])*$|^[-+=/*]$|^[<>]=?$/;
|
|
@@ -80,5 +80,5 @@ function getContractAddress(deployer, contractName) {
|
|
|
80
80
|
|
|
81
81
|
export { MAX_U128, MAX_I128, MIN_I128, AddressVersion, ZERO_ADDRESS, TESTNET_ZERO_ADDRESS, MICROSTX_PER_STX, publicKeyToAddress, CONTRACT_NAME_REGEX, validateStacksAddress, isValidAddress, parsePrincipal, parseContractId, isClarityName, isAddressEqual, addressToVersion, getContractAddress };
|
|
82
82
|
|
|
83
|
-
//# debugId=
|
|
84
|
-
//# sourceMappingURL=stacks-
|
|
83
|
+
//# debugId=0B54120C08BE628064756E2164756E21
|
|
84
|
+
//# sourceMappingURL=stacks-4d7c3x27.js.map
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
"sources": ["../src/utils/constants.ts", "../src/utils/address.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"// Clarity integer bounds\nexport const MAX_U128: bigint = (1n << 128n) - 1n;\nexport const MAX_I128: bigint = (1n << 127n) - 1n;\nexport const MIN_I128: bigint = -(1n << 127n);\n\n/** C32-encoded address version bytes for single-sig and multi-sig on each network. */\nexport const AddressVersion = {\n\tMainnetSingleSig: 22,\n\tMainnetMultiSig: 20,\n\tTestnetSingleSig: 26,\n\tTestnetMultiSig: 21,\n} as const;\nexport type AddressVersion =\n\t(typeof AddressVersion)[keyof typeof AddressVersion];\n\n/** Mainnet burn address (all-zero hash160). */\nexport const ZERO_ADDRESS = \"SP000000000000000000002Q6VF78\";\n/** Testnet burn address (all-zero hash160). */\nexport const TESTNET_ZERO_ADDRESS = \"ST000000000000000000002AMW42H\";\n\n/** Number of microSTX per 1 STX (10^6). */\nexport const MICROSTX_PER_STX = 1_000_000n;\n",
|
|
6
|
-
"import { c32address, c32addressDecode } from \"./c32.ts\";\nimport { AddressVersion } from \"./constants.ts\";\nimport { bytesToHex, hexToBytes, without0x } from \"./encoding.ts\";\nimport { hash160 } from \"./hash.ts\";\n\nexport { c32address, c32addressDecode };\n\n/**\n * Derive the single-sig Stacks address for a compressed public key.\n */\nexport function publicKeyToAddress(\n\tpublicKey: string | Uint8Array,\n\tnetwork: \"mainnet\" | \"testnet\" = \"mainnet\",\n): string {\n\tconst bytes =\n\t\ttypeof publicKey === \"string\"\n\t\t\t? hexToBytes(without0x(publicKey))\n\t\t\t: publicKey;\n\tconst version =\n\t\tnetwork === \"mainnet\"\n\t\t\t? AddressVersion.MainnetSingleSig\n\t\t\t: AddressVersion.TestnetSingleSig;\n\treturn c32address(version, bytesToHex(hash160(bytes)));\n}\n\n/** Clarity contract-name grammar: leading letter, then letters/digits/`-`/`_`.\n * Underscore is legal (SIP-002) and deployed contracts use it — matches the\n * pattern the Index API already accepts for contract ids. */\nexport const CONTRACT_NAME_REGEX: RegExp = /^[a-zA-Z][a-zA-Z0-9_-]{0,127}$/;\n\nexport function validateStacksAddress(address: string): boolean {\n\ttry {\n\t\tc32addressDecode(address);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/** Alias for validateStacksAddress — matches future.md naming. */\nexport const isValidAddress: (address: string) => boolean =\n\tvalidateStacksAddress;\n\n/** Parse a principal into its parts, or null when malformed. The single\n * definition of \"valid principal\" for this package: exactly one optional\n * `.name` segment (never two), a c32-decodable address, and a contract name\n * matching the Clarity grammar. */\nexport function parsePrincipal(\n\tvalue: string,\n): { address: string; contractName?: string } | null {\n\tconst parts = value.split(\".\");\n\tif (parts.length > 2) return null;\n\tconst [address, contractName] = parts as [string, string | undefined];\n\tif (!validateStacksAddress(address)) return null;\n\tif (contractName === undefined) return { address };\n\tif (!CONTRACT_NAME_REGEX.test(contractName)) return null;\n\treturn { address, contractName };\n}\n\nexport function parseContractId(contractId: string): [string, string] {\n\tconst
|
|
6
|
+
"import { c32address, c32addressDecode } from \"./c32.ts\";\nimport { AddressVersion } from \"./constants.ts\";\nimport { bytesToHex, hexToBytes, without0x } from \"./encoding.ts\";\nimport { hash160 } from \"./hash.ts\";\n\nexport { c32address, c32addressDecode };\n\n/**\n * Derive the single-sig Stacks address for a compressed public key.\n */\nexport function publicKeyToAddress(\n\tpublicKey: string | Uint8Array,\n\tnetwork: \"mainnet\" | \"testnet\" = \"mainnet\",\n): string {\n\tconst bytes =\n\t\ttypeof publicKey === \"string\"\n\t\t\t? hexToBytes(without0x(publicKey))\n\t\t\t: publicKey;\n\tconst version =\n\t\tnetwork === \"mainnet\"\n\t\t\t? AddressVersion.MainnetSingleSig\n\t\t\t: AddressVersion.TestnetSingleSig;\n\treturn c32address(version, bytesToHex(hash160(bytes)));\n}\n\n/** Clarity contract-name grammar: leading letter, then letters/digits/`-`/`_`.\n * Underscore is legal (SIP-002) and deployed contracts use it — matches the\n * pattern the Index API already accepts for contract ids. */\nexport const CONTRACT_NAME_REGEX: RegExp = /^[a-zA-Z][a-zA-Z0-9_-]{0,127}$/;\n\nexport function validateStacksAddress(address: string): boolean {\n\ttry {\n\t\tc32addressDecode(address);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/** Alias for validateStacksAddress — matches future.md naming. */\nexport const isValidAddress: (address: string) => boolean =\n\tvalidateStacksAddress;\n\n/** Parse a principal into its parts, or null when malformed. The single\n * definition of \"valid principal\" for this package: exactly one optional\n * `.name` segment (never two), a c32-decodable address, and a contract name\n * matching the Clarity grammar. */\nexport function parsePrincipal(\n\tvalue: string,\n): { address: string; contractName?: string } | null {\n\tconst parts = value.split(\".\");\n\tif (parts.length > 2) return null;\n\tconst [address, contractName] = parts as [string, string | undefined];\n\tif (!validateStacksAddress(address)) return null;\n\tif (contractName === undefined) return { address };\n\tif (!CONTRACT_NAME_REGEX.test(contractName)) return null;\n\treturn { address, contractName };\n}\n\n/** Split `address.name` into its parts. Throws on anything `parsePrincipal`\n * rejects, and on a bare address with no contract name. */\nexport function parseContractId(contractId: string): [string, string] {\n\tconst parsed = parsePrincipal(contractId);\n\tif (!parsed?.contractName)\n\t\tthrow new Error(`Invalid contract identifier: ${contractId}`);\n\treturn [parsed.address, parsed.contractName];\n}\n\nexport function isClarityName(name: string): boolean {\n\tconst regex = /^[a-zA-Z]([a-zA-Z0-9]|[-_!?+<>=/*])*$|^[-+=/*]$|^[<>]=?$/;\n\treturn regex.test(name) && name.length < 128;\n}\n\n/**\n * Compare two Stacks addresses for equality (case-insensitive, version-aware).\n * Throws if either address is invalid.\n */\nexport function isAddressEqual(a: string, b: string): boolean {\n\tconst [versionA, hashA] = c32addressDecode(a);\n\tconst [versionB, hashB] = c32addressDecode(b);\n\treturn versionA === versionB && hashA.toLowerCase() === hashB.toLowerCase();\n}\n\n/** Extract the version byte from a Stacks address (22, 20, 26, or 21). */\nexport function addressToVersion(address: string): number {\n\treturn c32addressDecode(address)[0];\n}\n\n/**\n * Build a contract address from deployer + contract name.\n * Validates both parts; returns `deployer.contractName`.\n */\nexport function getContractAddress(\n\tdeployer: string,\n\tcontractName: string,\n): string {\n\tif (!validateStacksAddress(deployer)) {\n\t\tthrow new Error(`Invalid deployer address: ${deployer}`);\n\t}\n\tif (!isClarityName(contractName)) {\n\t\tthrow new Error(`Invalid contract name: ${contractName}`);\n\t}\n\treturn `${deployer}.${contractName}`;\n}\n"
|
|
7
7
|
],
|
|
8
|
-
"mappings": ";;;;;;;;;;AACO,IAAM,YAAoB,MAAM,QAAQ;AACxC,IAAM,YAAoB,MAAM,QAAQ;AACxC,IAAM,WAAmB,EAAE,MAAM;AAGjC,IAAM,iBAAiB;AAAA,EAC7B,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,iBAAiB;AAClB;AAKO,IAAM,eAAe;AAErB,IAAM,uBAAuB;AAG7B,IAAM,mBAAmB;;;ACXzB,SAAS,kBAAkB,CACjC,WACA,UAAiC,WACxB;AAAA,EACT,MAAM,QACL,OAAO,cAAc,WAClB,WAAW,UAAU,SAAS,CAAC,IAC/B;AAAA,EACJ,MAAM,UACL,YAAY,YACT,eAAe,mBACf,eAAe;AAAA,EACnB,OAAO,WAAW,SAAS,WAAW,QAAQ,KAAK,CAAC,CAAC;AAAA;AAM/C,IAAM,sBAA8B;AAEpC,SAAS,qBAAqB,CAAC,SAA0B;AAAA,EAC/D,IAAI;AAAA,IACH,iBAAiB,OAAO;AAAA,IACxB,OAAO;AAAA,IACN,MAAM;AAAA,IACP,OAAO;AAAA;AAAA;AAKF,IAAM,iBACZ;AAMM,SAAS,cAAc,CAC7B,OACoD;AAAA,EACpD,MAAM,QAAQ,MAAM,MAAM,GAAG;AAAA,EAC7B,IAA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"$1_$2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1_$2").toUpperCase();
|
|
4
|
+
}
|
|
5
|
+
|
|
2
6
|
class BaseError extends Error {
|
|
3
7
|
name = "StacksError";
|
|
8
|
+
#code;
|
|
4
9
|
shortMessage;
|
|
5
10
|
details;
|
|
6
11
|
constructor(shortMessage, options) {
|
|
@@ -10,12 +15,21 @@ class BaseError extends Error {
|
|
|
10
15
|
${options.details}` : ""
|
|
11
16
|
].join("");
|
|
12
17
|
super(message, { cause: options?.cause });
|
|
18
|
+
if (options?.code !== undefined)
|
|
19
|
+
this.#code = options.code;
|
|
13
20
|
this.shortMessage = shortMessage;
|
|
14
21
|
this.details = options?.details;
|
|
15
22
|
}
|
|
23
|
+
get code() {
|
|
24
|
+
return this.#code ?? codeFromName(this.name);
|
|
25
|
+
}
|
|
26
|
+
set code(value) {
|
|
27
|
+
this.#code = value;
|
|
28
|
+
}
|
|
16
29
|
toJSON() {
|
|
17
30
|
return {
|
|
18
31
|
name: this.name,
|
|
32
|
+
code: this.code,
|
|
19
33
|
message: this.message,
|
|
20
34
|
shortMessage: this.shortMessage,
|
|
21
35
|
details: this.details,
|
|
@@ -26,5 +40,5 @@ ${options.details}` : ""
|
|
|
26
40
|
|
|
27
41
|
export { BaseError };
|
|
28
42
|
|
|
29
|
-
//# debugId=
|
|
30
|
-
//# sourceMappingURL=stacks-
|
|
43
|
+
//# debugId=EE4BB444CE3D1BB664756E2164756E21
|
|
44
|
+
//# sourceMappingURL=stacks-4hs8r4q2.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/errors/base.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"/**\n * Derive a stable machine-readable code from an error's `name` field:\n * `HttpRequestError` becomes `HTTP_REQUEST_ERROR`. `name` is a string\n * literal each class sets, so the code survives a bundler that mangles\n * class names. Branch on `code` instead of parsing `message`, which is\n * free to change.\n */\nfunction codeFromName(name: string): string {\n\treturn name\n\t\t.replace(/([a-z0-9])([A-Z])/g, \"$1_$2\")\n\t\t.replace(/([A-Z]+)([A-Z][a-z])/g, \"$1_$2\")\n\t\t.toUpperCase();\n}\n\nexport class BaseError extends Error {\n\toverride name = \"StacksError\";\n\t#code?: string;\n\tshortMessage: string;\n\tdetails?: string;\n\n\tconstructor(\n\t\tshortMessage: string,\n\t\toptions?: { cause?: Error; details?: string; code?: string },\n\t) {\n\t\tconst message = [\n\t\t\tshortMessage,\n\t\t\toptions?.details ? `\\n${options.details}` : \"\",\n\t\t].join(\"\");\n\n\t\tsuper(message, { cause: options?.cause });\n\t\tif (options?.code !== undefined) this.#code = options.code;\n\t\tthis.shortMessage = shortMessage;\n\t\tthis.details = options?.details;\n\t}\n\n\t/**\n\t * Stable identifier for programmatic handling; survives message\n\t * rewording and minification. An explicit `code` option wins, else it\n\t * is derived from `name` (`TimeoutError` gives `TIMEOUT_ERROR`).\n\t */\n\tget code(): string {\n\t\treturn this.#code ?? codeFromName(this.name);\n\t}\n\n\tset code(value: string) {\n\t\tthis.#code = value;\n\t}\n\n\ttoJSON(): {\n\t\tname: string;\n\t\tcode: string;\n\t\tmessage: string;\n\t\tshortMessage: string;\n\t\tdetails: string | undefined;\n\t\tcause: string | undefined;\n\t} {\n\t\treturn {\n\t\t\tname: this.name,\n\t\t\tcode: this.code,\n\t\t\tmessage: this.message,\n\t\t\tshortMessage: this.shortMessage,\n\t\t\tdetails: this.details,\n\t\t\tcause: this.cause instanceof Error ? this.cause.message : undefined,\n\t\t};\n\t}\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";AAOA,SAAS,YAAY,CAAC,MAAsB;AAAA,EAC3C,OAAO,KACL,QAAQ,sBAAsB,OAAO,EACrC,QAAQ,yBAAyB,OAAO,EACxC,YAAY;AAAA;AAAA;AAGR,MAAM,kBAAkB,MAAM;AAAA,EAC3B,OAAO;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EAEA,WAAW,CACV,cACA,SACC;AAAA,IACD,MAAM,UAAU;AAAA,MACf;AAAA,MACA,SAAS,UAAU;AAAA,EAAK,QAAQ,YAAY;AAAA,IAC7C,EAAE,KAAK,EAAE;AAAA,IAET,MAAM,SAAS,EAAE,OAAO,SAAS,MAAM,CAAC;AAAA,IACxC,IAAI,SAAS,SAAS;AAAA,MAAW,KAAK,QAAQ,QAAQ;AAAA,IACtD,KAAK,eAAe;AAAA,IACpB,KAAK,UAAU,SAAS;AAAA;AAAA,MAQrB,IAAI,GAAW;AAAA,IAClB,OAAO,KAAK,SAAS,aAAa,KAAK,IAAI;AAAA;AAAA,MAGxC,IAAI,CAAC,OAAe;AAAA,IACvB,KAAK,QAAQ;AAAA;AAAA,EAGd,MAAM,GAOJ;AAAA,IACD,OAAO;AAAA,MACN,MAAM,KAAK;AAAA,MACX,MAAM,KAAK;AAAA,MACX,SAAS,KAAK;AAAA,MACd,cAAc,KAAK;AAAA,MACnB,SAAS,KAAK;AAAA,MACd,OAAO,KAAK,iBAAiB,QAAQ,KAAK,MAAM,UAAU;AAAA,IAC3D;AAAA;AAEF;",
|
|
8
|
+
"debugId": "EE4BB444CE3D1BB664756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
readCV,
|
|
5
5
|
readLPString,
|
|
6
6
|
serializeCVBytes
|
|
7
|
-
} from "./stacks-
|
|
7
|
+
} from "./stacks-69nq48jp.js";
|
|
8
8
|
import {
|
|
9
9
|
parseContractId
|
|
10
|
-
} from "./stacks-
|
|
10
|
+
} from "./stacks-4d7c3x27.js";
|
|
11
11
|
import {
|
|
12
12
|
asciiToBytes,
|
|
13
13
|
bytesToAscii,
|
|
@@ -757,4 +757,4 @@ function postConditionToHex(pc) {
|
|
|
757
757
|
export { AuthType, PayloadType, ClarityVersion, AnchorMode, PostConditionModeWire, AddressHashMode, PubKeyEncoding, FungibleConditionCode, NonFungibleConditionCode, PoxConditionCode, PostConditionPrincipalId, AssetType, AuthFieldType, RECOVERABLE_ECDSA_SIG_LENGTH_BYTES, MEMO_MAX_LENGTH_BYTES, MAX_STRING_LENGTH_BYTES, COINBASE_BYTES_LENGTH, VRF_PROOF_BYTES_LENGTH, MICROBLOCK_HEADER_BYTES_LENGTH, TenureChangeCause, serializePostConditionWire, serializePayload, clearTxCache, serializeTransaction, serializeTransactionHex, deserializePostConditionWire, deserializeTransaction, parsePostConditionAmount, convertPostCondition, wireToPostCondition, fromHex, postConditionToHex };
|
|
758
758
|
|
|
759
759
|
//# debugId=0727B877F1BE3A9864756E2164756E21
|
|
760
|
-
//# sourceMappingURL=stacks-
|
|
760
|
+
//# sourceMappingURL=stacks-51ybf135.js.map
|
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BaseError
|
|
3
|
+
} from "./stacks-4hs8r4q2.js";
|
|
4
|
+
import {
|
|
5
|
+
isClarityName,
|
|
6
|
+
parsePrincipal
|
|
7
|
+
} from "./stacks-4d7c3x27.js";
|
|
8
|
+
import {
|
|
9
|
+
asciiToBytes,
|
|
10
|
+
bigIntToBytes,
|
|
11
|
+
bytesToAscii,
|
|
12
|
+
bytesToHex,
|
|
13
|
+
bytesToTwosBigInt,
|
|
14
|
+
bytesToUtf8,
|
|
15
|
+
c32address,
|
|
16
|
+
c32addressDecode,
|
|
17
|
+
concatBytes,
|
|
18
|
+
hexToBytes,
|
|
19
|
+
intToBigInt,
|
|
20
|
+
intToHex,
|
|
21
|
+
toTwos,
|
|
22
|
+
utf8ToBytes,
|
|
23
|
+
without0x,
|
|
24
|
+
writeUInt32BE
|
|
25
|
+
} from "./stacks-qs5fzts5.js";
|
|
26
|
+
|
|
1
27
|
// src/clarity/types.ts
|
|
2
28
|
var ClarityWireType = {
|
|
3
29
|
int: 0,
|
|
@@ -82,7 +108,7 @@ function serializeCVBytes(value) {
|
|
|
82
108
|
return withTypeId(value.type, concatBytes(...parts));
|
|
83
109
|
}
|
|
84
110
|
case "tuple": {
|
|
85
|
-
const keys = Object.keys(value.value).sort((a, b) => a
|
|
111
|
+
const keys = Object.keys(value.value).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
86
112
|
const parts = [writeUInt32BE(keys.length)];
|
|
87
113
|
for (const key of keys) {
|
|
88
114
|
parts.push(serializeLPString(key));
|
|
@@ -106,6 +132,59 @@ function serializeCV(value) {
|
|
|
106
132
|
return bytesToHex(serializeCVBytes(value));
|
|
107
133
|
}
|
|
108
134
|
|
|
135
|
+
// src/errors/transaction.ts
|
|
136
|
+
class TransactionError extends BaseError {
|
|
137
|
+
name = "TransactionError";
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
class BroadcastError extends BaseError {
|
|
141
|
+
name = "BroadcastError";
|
|
142
|
+
txid;
|
|
143
|
+
reason;
|
|
144
|
+
reasonData;
|
|
145
|
+
constructor(message, options) {
|
|
146
|
+
super(message, options);
|
|
147
|
+
this.txid = options?.txid;
|
|
148
|
+
this.reason = options?.reason;
|
|
149
|
+
this.reasonData = options?.reasonData;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
class TransactionAbortedError extends BaseError {
|
|
154
|
+
name = "TransactionAbortedError";
|
|
155
|
+
receipt;
|
|
156
|
+
constructor(message, options) {
|
|
157
|
+
super(message, options);
|
|
158
|
+
this.receipt = options.receipt;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
class TransactionDroppedError extends BaseError {
|
|
163
|
+
name = "TransactionDroppedError";
|
|
164
|
+
txid;
|
|
165
|
+
constructor(message, options) {
|
|
166
|
+
super(message, options);
|
|
167
|
+
this.txid = options.txid;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
class WaitForTransactionTimeoutError extends BaseError {
|
|
172
|
+
name = "WaitForTransactionTimeoutError";
|
|
173
|
+
txid;
|
|
174
|
+
constructor(message, options) {
|
|
175
|
+
super(message, options);
|
|
176
|
+
this.txid = options.txid;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
class SerializationError extends BaseError {
|
|
181
|
+
name = "SerializationError";
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
class SigningError extends BaseError {
|
|
185
|
+
name = "SigningError";
|
|
186
|
+
}
|
|
187
|
+
|
|
109
188
|
// src/utils/bytes-reader.ts
|
|
110
189
|
class BytesReader {
|
|
111
190
|
data;
|
|
@@ -113,23 +192,32 @@ class BytesReader {
|
|
|
113
192
|
constructor(data) {
|
|
114
193
|
this.data = data;
|
|
115
194
|
}
|
|
195
|
+
remaining() {
|
|
196
|
+
return this.data.length - this.offset;
|
|
197
|
+
}
|
|
198
|
+
ensure(length) {
|
|
199
|
+
if (this.offset + length > this.data.length) {
|
|
200
|
+
throw new SerializationError(`Buffer underflow: need ${length} bytes at offset ${this.offset}, have ${this.data.length}`);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
116
203
|
readUInt8() {
|
|
204
|
+
this.ensure(1);
|
|
117
205
|
return this.data[this.offset++];
|
|
118
206
|
}
|
|
119
207
|
readUInt16BE() {
|
|
208
|
+
this.ensure(2);
|
|
120
209
|
const val = (this.data[this.offset] << 8 | this.data[this.offset + 1]) >>> 0;
|
|
121
210
|
this.offset += 2;
|
|
122
211
|
return val;
|
|
123
212
|
}
|
|
124
213
|
readUInt32BE() {
|
|
214
|
+
this.ensure(4);
|
|
125
215
|
const val = (this.data[this.offset] << 24 | this.data[this.offset + 1] << 16 | this.data[this.offset + 2] << 8 | this.data[this.offset + 3]) >>> 0;
|
|
126
216
|
this.offset += 4;
|
|
127
217
|
return val;
|
|
128
218
|
}
|
|
129
219
|
readBytes(length) {
|
|
130
|
-
|
|
131
|
-
throw new Error(`Buffer underflow: need ${length} bytes at offset ${this.offset}, have ${this.data.length}`);
|
|
132
|
-
}
|
|
220
|
+
this.ensure(length);
|
|
133
221
|
const slice = this.data.slice(this.offset, this.offset + length);
|
|
134
222
|
this.offset += length;
|
|
135
223
|
return slice;
|
|
@@ -153,7 +241,18 @@ function readLPString(reader, prefixBytes = 1) {
|
|
|
153
241
|
}
|
|
154
242
|
return bytesToUtf8(reader.readBytes(length));
|
|
155
243
|
}
|
|
156
|
-
|
|
244
|
+
var MAX_CV_DEPTH = 64;
|
|
245
|
+
var MIN_LIST_ITEM_BYTES = 1;
|
|
246
|
+
var MIN_TUPLE_ENTRY_BYTES = 2;
|
|
247
|
+
function checkCount(reader, count, minBytes) {
|
|
248
|
+
if (count * minBytes > reader.remaining()) {
|
|
249
|
+
throw new SerializationError(`Clarity value declares ${count} elements but only ${reader.remaining()} bytes remain`);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
function readCV(reader, depth = 0) {
|
|
253
|
+
if (depth > MAX_CV_DEPTH) {
|
|
254
|
+
throw new SerializationError(`Clarity value nests deeper than ${MAX_CV_DEPTH} levels`);
|
|
255
|
+
}
|
|
157
256
|
const typeByte = reader.readUInt8();
|
|
158
257
|
const type = clarityTypeFromByte(typeByte);
|
|
159
258
|
switch (type) {
|
|
@@ -172,11 +271,11 @@ function readCV(reader) {
|
|
|
172
271
|
case "none":
|
|
173
272
|
return noneCV();
|
|
174
273
|
case "some":
|
|
175
|
-
return someCV(readCV(reader));
|
|
274
|
+
return someCV(readCV(reader, depth + 1));
|
|
176
275
|
case "ok":
|
|
177
|
-
return responseOkCV(readCV(reader));
|
|
276
|
+
return responseOkCV(readCV(reader, depth + 1));
|
|
178
277
|
case "err":
|
|
179
|
-
return responseErrorCV(readCV(reader));
|
|
278
|
+
return responseErrorCV(readCV(reader, depth + 1));
|
|
180
279
|
case "address":
|
|
181
280
|
return standardPrincipalCV(readAddress(reader));
|
|
182
281
|
case "contract": {
|
|
@@ -186,18 +285,20 @@ function readCV(reader) {
|
|
|
186
285
|
}
|
|
187
286
|
case "list": {
|
|
188
287
|
const len = reader.readUInt32BE();
|
|
288
|
+
checkCount(reader, len, MIN_LIST_ITEM_BYTES);
|
|
189
289
|
const items = [];
|
|
190
290
|
for (let i = 0;i < len; i++) {
|
|
191
|
-
items.push(readCV(reader));
|
|
291
|
+
items.push(readCV(reader, depth + 1));
|
|
192
292
|
}
|
|
193
293
|
return listCV(items);
|
|
194
294
|
}
|
|
195
295
|
case "tuple": {
|
|
196
296
|
const len = reader.readUInt32BE();
|
|
297
|
+
checkCount(reader, len, MIN_TUPLE_ENTRY_BYTES);
|
|
197
298
|
const data = {};
|
|
198
299
|
for (let i = 0;i < len; i++) {
|
|
199
300
|
const key = readLPString(reader);
|
|
200
|
-
data[key] = readCV(reader);
|
|
301
|
+
data[key] = readCV(reader, depth + 1);
|
|
201
302
|
}
|
|
202
303
|
return tupleCV(data);
|
|
203
304
|
}
|
|
@@ -210,7 +311,7 @@ function readCV(reader) {
|
|
|
210
311
|
return stringUtf8CV(bytesToUtf8(reader.readBytes(len)));
|
|
211
312
|
}
|
|
212
313
|
default:
|
|
213
|
-
throw new
|
|
314
|
+
throw new SerializationError(`Cannot deserialize unknown clarity type: ${type}`);
|
|
214
315
|
}
|
|
215
316
|
}
|
|
216
317
|
function deserializeCVBytes(input) {
|
|
@@ -303,10 +404,10 @@ var Cl = {
|
|
|
303
404
|
uint: uintCV,
|
|
304
405
|
bool: boolCV,
|
|
305
406
|
principal(address) {
|
|
306
|
-
const
|
|
307
|
-
if (!
|
|
308
|
-
throw new Error(
|
|
309
|
-
return
|
|
407
|
+
const parsed = parsePrincipal(address);
|
|
408
|
+
if (!parsed)
|
|
409
|
+
throw new Error(`Invalid principal: ${address}`);
|
|
410
|
+
return parsed.contractName ? contractPrincipalCV(parsed.address, parsed.contractName) : standardPrincipalCV(parsed.address);
|
|
310
411
|
},
|
|
311
412
|
address(address) {
|
|
312
413
|
return Cl.principal(address);
|
|
@@ -331,5 +432,7 @@ var Cl = {
|
|
|
331
432
|
deserialize: deserializeCVBytes
|
|
332
433
|
};
|
|
333
434
|
|
|
334
|
-
|
|
335
|
-
|
|
435
|
+
export { ClarityWireType, clarityTypeFromByte, serializeCVBytes, serializeCV, TransactionError, BroadcastError, TransactionAbortedError, TransactionDroppedError, WaitForTransactionTimeoutError, SerializationError, SigningError, BytesReader, intCV, uintCV, trueCV, falseCV, boolCV, bufferCV, standardPrincipalCV, contractPrincipalCV, noneCV, someCV, responseOkCV, responseErrorCV, listCV, tupleCV, stringAsciiCV, stringUtf8CV, Cl, readAddress, readLPString, readCV, deserializeCVBytes, deserializeCV };
|
|
436
|
+
|
|
437
|
+
//# debugId=1F993877333185EB64756E2164756E21
|
|
438
|
+
//# sourceMappingURL=stacks-69nq48jp.js.map
|