@secondlayer/stacks 6.0.0 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/dist/shared/{stacks-qt8ehebn.js → stacks-esm-0rdxcta7.js} +2 -2
  2. package/dist/shared/{stacks-qt8ehebn.js.map → stacks-esm-0rdxcta7.js.map} +1 -1
  3. package/dist/shared/{stacks-4hs8r4q2.js → stacks-esm-1jae0a3r.js} +2 -2
  4. package/dist/shared/{stacks-xjkn3en1.cjs.map → stacks-esm-1jae0a3r.js.map} +1 -1
  5. package/dist/shared/{stacks-4d7c3x27.js → stacks-esm-2mc7ebrm.js} +3 -3
  6. package/dist/shared/{stacks-4d7c3x27.js.map → stacks-esm-2mc7ebrm.js.map} +1 -1
  7. package/dist/shared/{stacks-8brgfvqx.js → stacks-esm-3g33bqsm.js} +4 -4
  8. package/dist/shared/{stacks-8brgfvqx.js.map → stacks-esm-3g33bqsm.js.map} +1 -1
  9. package/dist/shared/{stacks-gjz26k6b.js → stacks-esm-3pv5avgr.js} +59 -15
  10. package/dist/shared/stacks-esm-3pv5avgr.js.map +12 -0
  11. package/dist/shared/{stacks-qex691bh.js → stacks-esm-743jfh10.js} +6 -6
  12. package/dist/shared/{stacks-qex691bh.js.map → stacks-esm-743jfh10.js.map} +1 -1
  13. package/dist/shared/{stacks-wxfd6r4b.js → stacks-esm-7fpqgtyx.js} +3 -3
  14. package/dist/shared/{stacks-wxfd6r4b.js.map → stacks-esm-7fpqgtyx.js.map} +1 -1
  15. package/dist/shared/{stacks-71k0vmct.js → stacks-esm-9rnx0zxr.js} +5 -5
  16. package/dist/shared/{stacks-71k0vmct.js.map → stacks-esm-9rnx0zxr.js.map} +1 -1
  17. package/dist/shared/{stacks-fd4rx56e.js → stacks-esm-aw2mj3sj.js} +7 -7
  18. package/dist/shared/{stacks-fd4rx56e.js.map → stacks-esm-aw2mj3sj.js.map} +1 -1
  19. package/dist/shared/{stacks-qs5fzts5.js → stacks-esm-cvhazvhd.js} +2 -2
  20. package/dist/shared/{stacks-qs5fzts5.js.map → stacks-esm-cvhazvhd.js.map} +1 -1
  21. package/dist/shared/{stacks-69nq48jp.js → stacks-esm-fcfdn2zx.js} +5 -5
  22. package/dist/shared/{stacks-69nq48jp.js.map → stacks-esm-fcfdn2zx.js.map} +1 -1
  23. package/dist/shared/{stacks-x0qqwrev.js → stacks-esm-hr7fpxtj.js} +4 -4
  24. package/dist/shared/{stacks-x0qqwrev.js.map → stacks-esm-hr7fpxtj.js.map} +1 -1
  25. package/dist/shared/{stacks-mbt36bzt.js → stacks-esm-kds4n82p.js} +11 -11
  26. package/dist/shared/{stacks-mbt36bzt.js.map → stacks-esm-kds4n82p.js.map} +1 -1
  27. package/dist/shared/{stacks-kg1npstf.js → stacks-esm-n53kvwmt.js} +2 -2
  28. package/dist/shared/{stacks-kg1npstf.js.map → stacks-esm-n53kvwmt.js.map} +1 -1
  29. package/dist/shared/{stacks-v2rfr46a.js → stacks-esm-pxhfqfff.js} +4 -4
  30. package/dist/shared/{stacks-v2rfr46a.js.map → stacks-esm-pxhfqfff.js.map} +1 -1
  31. package/dist/shared/{stacks-yajyej2y.js → stacks-esm-q19a17fd.js} +3 -3
  32. package/dist/shared/{stacks-yajyej2y.js.map → stacks-esm-q19a17fd.js.map} +1 -1
  33. package/dist/shared/{stacks-v03zef3g.js → stacks-esm-qk0p9fr6.js} +9 -9
  34. package/dist/shared/{stacks-v03zef3g.js.map → stacks-esm-qk0p9fr6.js.map} +1 -1
  35. package/dist/shared/{stacks-qcae5852.js → stacks-esm-qkj67g80.js} +2 -2
  36. package/dist/shared/{stacks-qcae5852.js.map → stacks-esm-qkj67g80.js.map} +1 -1
  37. package/dist/shared/{stacks-mftyrc60.js → stacks-esm-r6dejrgr.js} +4 -4
  38. package/dist/shared/{stacks-mftyrc60.js.map → stacks-esm-r6dejrgr.js.map} +1 -1
  39. package/dist/shared/{stacks-9c1yam8b.js → stacks-esm-r9q4wnyw.js} +5 -5
  40. package/dist/shared/{stacks-9c1yam8b.js.map → stacks-esm-r9q4wnyw.js.map} +1 -1
  41. package/dist/shared/{stacks-51ybf135.js → stacks-esm-skmcf5n2.js} +5 -5
  42. package/dist/shared/{stacks-51ybf135.js.map → stacks-esm-skmcf5n2.js.map} +1 -1
  43. package/dist/shared/{stacks-yvb7rvwk.js → stacks-esm-v45990hx.js} +2 -2
  44. package/dist/shared/{stacks-8vzxax5e.cjs.map → stacks-esm-v45990hx.js.map} +1 -1
  45. package/dist/shared/{stacks-z90xdr1x.js → stacks-esm-wv67m4g6.js} +3 -3
  46. package/dist/shared/{stacks-z90xdr1x.js.map → stacks-esm-wv67m4g6.js.map} +1 -1
  47. package/dist/shared/{stacks-1m3m1agc.js → stacks-esm-x1r01353.js} +5 -5
  48. package/dist/shared/{stacks-1m3m1agc.js.map → stacks-esm-x1r01353.js.map} +1 -1
  49. package/dist/src/accounts/index.cjs +558 -4
  50. package/dist/src/accounts/index.cjs.map +10 -4
  51. package/dist/src/accounts/index.js +3 -3
  52. package/dist/src/actions/index.cjs +3815 -1
  53. package/dist/src/actions/index.cjs.map +65 -3
  54. package/dist/src/actions/index.js +14 -14
  55. package/dist/src/bitcoin/index.cjs +2477 -1
  56. package/dist/src/bitcoin/index.cjs.map +31 -3
  57. package/dist/src/bitcoin/index.js +11 -11
  58. package/dist/src/bns/index.cjs +4439 -17
  59. package/dist/src/bns/index.cjs.map +50 -3
  60. package/dist/src/bns/index.js +14 -14
  61. package/dist/src/chains/index.cjs +135 -1
  62. package/dist/src/chains/index.cjs.map +5 -3
  63. package/dist/src/chains/index.js +1 -1
  64. package/dist/src/clarity/index.cjs +2019 -1
  65. package/dist/src/clarity/index.cjs.map +24 -3
  66. package/dist/src/clarity/index.js +8 -8
  67. package/dist/src/filters/index.cjs +725 -1
  68. package/dist/src/filters/index.cjs.map +11 -3
  69. package/dist/src/filters/index.d.cts +76 -13
  70. package/dist/src/filters/index.d.ts +76 -13
  71. package/dist/src/filters/index.js +8 -4
  72. package/dist/src/filters/index.js.map +1 -1
  73. package/dist/src/index.cjs +3935 -62
  74. package/dist/src/index.cjs.map +69 -4
  75. package/dist/src/index.d.cts +62 -11
  76. package/dist/src/index.d.ts +62 -11
  77. package/dist/src/index.js +16 -16
  78. package/dist/src/postconditions/index.cjs +1726 -1
  79. package/dist/src/postconditions/index.cjs.map +20 -3
  80. package/dist/src/postconditions/index.js +6 -6
  81. package/dist/src/pox/index.cjs +3855 -1
  82. package/dist/src/pox/index.cjs.map +48 -3
  83. package/dist/src/pox/index.js +13 -13
  84. package/dist/src/pox5/index.cjs +4054 -29
  85. package/dist/src/pox5/index.cjs.map +54 -3
  86. package/dist/src/pox5/index.js +15 -15
  87. package/dist/src/sbtc/index.cjs +3705 -4
  88. package/dist/src/sbtc/index.cjs.map +47 -3
  89. package/dist/src/sbtc/index.js +12 -12
  90. package/dist/src/stackingdao/index.cjs +3751 -8
  91. package/dist/src/stackingdao/index.cjs.map +45 -3
  92. package/dist/src/stackingdao/index.js +12 -12
  93. package/dist/src/subscriptions/index.cjs +153 -1
  94. package/dist/src/subscriptions/index.cjs.map +6 -3
  95. package/dist/src/subscriptions/index.js +2 -2
  96. package/dist/src/transactions/index.cjs +2139 -1
  97. package/dist/src/transactions/index.cjs.map +23 -3
  98. package/dist/src/transactions/index.js +6 -6
  99. package/dist/src/utils/index.cjs +435 -3
  100. package/dist/src/utils/index.cjs.map +9 -3
  101. package/dist/src/utils/index.js +3 -3
  102. package/package.json +1 -1
  103. package/dist/shared/stacks-02actsrx.cjs +0 -17
  104. package/dist/shared/stacks-02actsrx.cjs.map +0 -10
  105. package/dist/shared/stacks-03vfm21t.cjs +0 -222
  106. package/dist/shared/stacks-03vfm21t.cjs.map +0 -12
  107. package/dist/shared/stacks-24h5k94q.cjs +0 -74
  108. package/dist/shared/stacks-24h5k94q.cjs.map +0 -11
  109. package/dist/shared/stacks-37kz5t9f.cjs +0 -764
  110. package/dist/shared/stacks-37kz5t9f.cjs.map +0 -23
  111. package/dist/shared/stacks-3mt2q2na.cjs +0 -65
  112. package/dist/shared/stacks-3mt2q2na.cjs.map +0 -9
  113. package/dist/shared/stacks-4hs8r4q2.js.map +0 -10
  114. package/dist/shared/stacks-8vzxax5e.cjs +0 -45
  115. package/dist/shared/stacks-agk106zs.cjs +0 -267
  116. package/dist/shared/stacks-agk106zs.cjs.map +0 -12
  117. package/dist/shared/stacks-bdgh9n83.cjs +0 -212
  118. package/dist/shared/stacks-bdgh9n83.cjs.map +0 -11
  119. package/dist/shared/stacks-dpxnxhqb.cjs +0 -51
  120. package/dist/shared/stacks-dpxnxhqb.cjs.map +0 -11
  121. package/dist/shared/stacks-ee53k9j2.cjs +0 -651
  122. package/dist/shared/stacks-ee53k9j2.cjs.map +0 -13
  123. package/dist/shared/stacks-enpj9krt.cjs +0 -38
  124. package/dist/shared/stacks-enpj9krt.cjs.map +0 -10
  125. package/dist/shared/stacks-f35mnrmg.cjs +0 -164
  126. package/dist/shared/stacks-f35mnrmg.cjs.map +0 -10
  127. package/dist/shared/stacks-fhzwsn5d.cjs +0 -261
  128. package/dist/shared/stacks-fhzwsn5d.cjs.map +0 -12
  129. package/dist/shared/stacks-gjz26k6b.js.map +0 -12
  130. package/dist/shared/stacks-gza2n1zs.cjs +0 -73
  131. package/dist/shared/stacks-gza2n1zs.cjs.map +0 -11
  132. package/dist/shared/stacks-kem68d80.cjs +0 -156
  133. package/dist/shared/stacks-kem68d80.cjs.map +0 -10
  134. package/dist/shared/stacks-n98w7g57.cjs +0 -234
  135. package/dist/shared/stacks-n98w7g57.cjs.map +0 -10
  136. package/dist/shared/stacks-p337hp6m.cjs +0 -336
  137. package/dist/shared/stacks-p337hp6m.cjs.map +0 -25
  138. package/dist/shared/stacks-q34k4vnc.cjs +0 -286
  139. package/dist/shared/stacks-q34k4vnc.cjs.map +0 -12
  140. package/dist/shared/stacks-rryme9bv.cjs +0 -569
  141. package/dist/shared/stacks-rryme9bv.cjs.map +0 -13
  142. package/dist/shared/stacks-s5vej5z6.cjs +0 -410
  143. package/dist/shared/stacks-s5vej5z6.cjs.map +0 -15
  144. package/dist/shared/stacks-sdqkapct.cjs +0 -67
  145. package/dist/shared/stacks-sdqkapct.cjs.map +0 -12
  146. package/dist/shared/stacks-vea7nde7.cjs +0 -731
  147. package/dist/shared/stacks-vea7nde7.cjs.map +0 -13
  148. package/dist/shared/stacks-wk8yp13j.cjs +0 -33
  149. package/dist/shared/stacks-wk8yp13j.cjs.map +0 -11
  150. package/dist/shared/stacks-xjkn3en1.cjs +0 -42
  151. package/dist/shared/stacks-xnrywjf1.cjs +0 -131
  152. package/dist/shared/stacks-xnrywjf1.cjs.map +0 -11
  153. package/dist/shared/stacks-yvb7rvwk.js.map +0 -10
@@ -1,222 +0,0 @@
1
- // src/bitcoin/merkle.ts
2
- function hashPair(left, right) {
3
- return doubleSha256(concatBytes(left, right));
4
- }
5
- function nextLevel(level) {
6
- const next = [];
7
- for (let i = 0;i < level.length; i += 2) {
8
- const left = level[i];
9
- if (left === undefined)
10
- throw new Error("merkle: missing left node");
11
- const right = level[i + 1] ?? left;
12
- next.push(hashPair(left, right));
13
- }
14
- return next;
15
- }
16
- function merkleRoot(txidsInternal) {
17
- if (txidsInternal.length === 0) {
18
- throw new Error("merkleRoot: empty tx list");
19
- }
20
- let level = txidsInternal.slice();
21
- while (level.length > 1) {
22
- level = nextLevel(level);
23
- }
24
- const root = level[0];
25
- if (root === undefined)
26
- throw new Error("merkleRoot: no root");
27
- return root;
28
- }
29
- function buildMerkleProof(txidsInternal, txIndex) {
30
- const txCount = txidsInternal.length;
31
- if (txCount === 0) {
32
- throw new Error("buildMerkleProof: empty tx list");
33
- }
34
- if (txIndex < 0 || txIndex >= txCount) {
35
- throw new Error(`buildMerkleProof: txIndex ${txIndex} out of range for ${txCount} txs`);
36
- }
37
- const siblings = [];
38
- let index = txIndex;
39
- let level = txidsInternal.slice();
40
- while (level.length > 1) {
41
- const isRight = index % 2 === 1;
42
- const siblingIndex = isRight ? index - 1 : index + 1;
43
- const self = level[index];
44
- if (self === undefined)
45
- throw new Error("buildMerkleProof: missing node");
46
- siblings.push(level[siblingIndex] ?? self);
47
- level = nextLevel(level);
48
- index = Math.floor(index / 2);
49
- }
50
- return { siblings, txIndex, txCount };
51
- }
52
- function rootFromProof(leafInternal, proof) {
53
- let hash = leafInternal;
54
- let index = proof.txIndex;
55
- for (const sibling of proof.siblings) {
56
- hash = index % 2 === 1 ? hashPair(sibling, hash) : hashPair(hash, sibling);
57
- index = Math.floor(index / 2);
58
- }
59
- return hash;
60
- }
61
-
62
- // src/bitcoin/proof.ts
63
- function normalizeTxid(txid) {
64
- return without0x(txid).toLowerCase();
65
- }
66
- function assembleBlockForTx(args) {
67
- const txIndex = args.txidsDisplay.indexOf(normalizeTxid(args.txid));
68
- if (txIndex < 0) {
69
- throw new Error(`tx ${args.txid} not found in block ${args.blockId}`);
70
- }
71
- return {
72
- header: hexToBytes(args.headerHex),
73
- height: args.height,
74
- txidsInternal: args.txidsDisplay.map((t) => reverseBytes(hexToBytes(t))),
75
- txIndex
76
- };
77
- }
78
- async function buildTxProof(source, params) {
79
- const { txid, vout } = params;
80
- const want = normalizeTxid(txid);
81
- const [rawTx, block] = await Promise.all([
82
- source.getRawTx(txid),
83
- source.getBlockForTx(txid)
84
- ]);
85
- const parsed = parseBitcoinTx(rawTx);
86
- const gotDisplay = bytesToHex(reverseBytes(parsed.txidInternal));
87
- if (gotDisplay !== want) {
88
- throw new Error(`source returned a tx whose id ${gotDisplay} does not match requested ${want}`);
89
- }
90
- const atIndex = block.txidsInternal[block.txIndex];
91
- if (!atIndex || bytesToHex(atIndex) !== bytesToHex(parsed.txidInternal)) {
92
- throw new Error(`source txIndex ${block.txIndex} does not point at tx ${want}`);
93
- }
94
- const merkle = buildMerkleProof(block.txidsInternal, block.txIndex);
95
- const headerRoot = parseBlockHeader(block.header).merkleRoot;
96
- const computed = rootFromProof(parsed.txidInternal, merkle);
97
- if (bytesToHex(computed) !== bytesToHex(headerRoot)) {
98
- throw new Error("constructed merkle proof does not reconcile with the block header merkle root");
99
- }
100
- return {
101
- rawTx,
102
- txidInternal: parsed.txidInternal,
103
- vout,
104
- merkle,
105
- header: block.header,
106
- height: block.height
107
- };
108
- }
109
- function fallbackProofSource(sources) {
110
- if (sources.length === 0) {
111
- throw new Error("fallbackProofSource: at least one source is required");
112
- }
113
- async function firstSuccess(fn) {
114
- let lastError;
115
- for (const source of sources) {
116
- try {
117
- return await fn(source);
118
- } catch (error) {
119
- lastError = error;
120
- }
121
- }
122
- throw lastError;
123
- }
124
- return {
125
- getRawTx: (txid) => firstSuccess((s) => s.getRawTx(txid)),
126
- getBlockForTx: (txid) => firstSuccess((s) => s.getBlockForTx(txid))
127
- };
128
- }
129
- function bitcoinRpcSource(config) {
130
- const doFetch = config.fetch ?? fetch;
131
- async function rpc(method, rpcParams) {
132
- const headers = {
133
- "content-type": "application/json"
134
- };
135
- if (config.auth) {
136
- const basic = typeof config.auth === "string" ? config.auth : btoa(`${config.auth.username}:${config.auth.password}`);
137
- headers.authorization = `Basic ${basic}`;
138
- }
139
- const res = await doFetch(config.url, {
140
- method: "POST",
141
- headers,
142
- body: JSON.stringify({
143
- jsonrpc: "1.0",
144
- id: "secondlayer",
145
- method,
146
- params: rpcParams
147
- })
148
- });
149
- if (!res.ok) {
150
- throw new Error(`bitcoin rpc ${method} failed: HTTP ${res.status}`);
151
- }
152
- const json = await res.json();
153
- if (json.error) {
154
- throw new Error(`bitcoin rpc ${method} error: ${json.error.message}`);
155
- }
156
- return json.result;
157
- }
158
- return {
159
- async getRawTx(txid) {
160
- return hexToBytes(await rpc("getrawtransaction", [txid, false]));
161
- },
162
- async getBlockForTx(txid) {
163
- const tx = await rpc("getrawtransaction", [
164
- txid,
165
- true
166
- ]);
167
- if (!tx.blockhash) {
168
- throw new Error(`tx ${txid} is not in a block (node needs -txindex, or the tx is unconfirmed)`);
169
- }
170
- const block = await rpc("getblock", [
171
- tx.blockhash,
172
- 1
173
- ]);
174
- const header = await rpc("getblockheader", [tx.blockhash, false]);
175
- return assembleBlockForTx({
176
- txid,
177
- blockId: tx.blockhash,
178
- headerHex: header,
179
- height: block.height,
180
- txidsDisplay: block.tx
181
- });
182
- }
183
- };
184
- }
185
- function esploraSource(config) {
186
- const doFetch = config.fetch ?? fetch;
187
- const base = config.url.replace(/\/+$/, "");
188
- async function get(path) {
189
- const res = await doFetch(`${base}${path}`);
190
- if (!res.ok) {
191
- throw new Error(`esplora GET ${path} failed: HTTP ${res.status}`);
192
- }
193
- return res;
194
- }
195
- return {
196
- async getRawTx(txid) {
197
- return hexToBytes((await (await get(`/tx/${txid}/hex`)).text()).trim());
198
- },
199
- async getBlockForTx(txid) {
200
- const status = await (await get(`/tx/${txid}`)).json();
201
- if (!status.status.confirmed) {
202
- throw new Error(`tx ${txid} is unconfirmed`);
203
- }
204
- const blockHashHex = status.status.block_hash;
205
- const header = (await (await get(`/block/${blockHashHex}/header`)).text()).trim();
206
- const txids = await (await get(`/block/${blockHashHex}/txids`)).json();
207
- return assembleBlockForTx({
208
- txid,
209
- blockId: blockHashHex,
210
- headerHex: header,
211
- height: status.status.block_height,
212
- txidsDisplay: txids
213
- });
214
- }
215
- };
216
- }
217
-
218
- // src/epochs.ts
219
- var EPOCH_4_ACTIVATION_BURN_HEIGHT_MAINNET = 960230;
220
-
221
- //# debugId=CE288481C610C7EC64756E2164756E21
222
- //# sourceMappingURL=stacks-03vfm21t.cjs.map
@@ -1,12 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/bitcoin/merkle.ts", "../src/bitcoin/proof.ts", "../src/epochs.ts"],
4
- "sourcesContent": [
5
- "import { concatBytes } from \"../utils/encoding.ts\";\nimport { doubleSha256 } from \"./serialize.ts\";\n\n/**\n * A Bitcoin merkle inclusion proof, shaped for the SIP-044 `verify-merkle-proof`\n * built-in: `(leaf-hash, root-hash, tx-index, tx-count, sibling-hashes)`.\n *\n * - `siblings` are the sibling node hashes from the leaf up to (excluding) the\n * root, in *internal* byte order — never reversed.\n * - `txCount` (not tree-depth) pins the canonical tree shape; the built-in\n * rejects any proof whose length differs from `ceil(log2(tx-count))`.\n */\nexport interface MerkleProof {\n\tsiblings: Uint8Array[];\n\ttxIndex: number;\n\ttxCount: number;\n}\n\n/** Combine an ordered pair of nodes into their parent hash. */\nfunction hashPair(left: Uint8Array, right: Uint8Array): Uint8Array {\n\treturn doubleSha256(concatBytes(left, right));\n}\n\n/** Collapse one merkle level into the next, duplicating the last node if odd. */\nfunction nextLevel(level: Uint8Array[]): Uint8Array[] {\n\tconst next: Uint8Array[] = [];\n\tfor (let i = 0; i < level.length; i += 2) {\n\t\tconst left = level[i];\n\t\tif (left === undefined) throw new Error(\"merkle: missing left node\");\n\t\t// Bitcoin duplicates the final node when a level has an odd count.\n\t\tconst right = level[i + 1] ?? left;\n\t\tnext.push(hashPair(left, right));\n\t}\n\treturn next;\n}\n\n/**\n * Compute the merkle root over txids in *internal* byte order. The result is\n * also internal order — it matches the `merkle-root` field read straight out of\n * an 80-byte block header, so it can be cross-checked against the header before\n * a proof is trusted.\n */\nexport function merkleRoot(txidsInternal: Uint8Array[]): Uint8Array {\n\tif (txidsInternal.length === 0) {\n\t\tthrow new Error(\"merkleRoot: empty tx list\");\n\t}\n\tlet level = txidsInternal.slice();\n\twhile (level.length > 1) {\n\t\tlevel = nextLevel(level);\n\t}\n\tconst root = level[0];\n\tif (root === undefined) throw new Error(\"merkleRoot: no root\");\n\treturn root;\n}\n\n/**\n * Build the merkle inclusion proof for the tx at `txIndex`. Sibling count is\n * exactly `ceil(log2(txCount))`, as the SIP-044 built-in requires.\n */\nexport function buildMerkleProof(\n\ttxidsInternal: Uint8Array[],\n\ttxIndex: number,\n): MerkleProof {\n\tconst txCount = txidsInternal.length;\n\tif (txCount === 0) {\n\t\tthrow new Error(\"buildMerkleProof: empty tx list\");\n\t}\n\tif (txIndex < 0 || txIndex >= txCount) {\n\t\tthrow new Error(\n\t\t\t`buildMerkleProof: txIndex ${txIndex} out of range for ${txCount} txs`,\n\t\t);\n\t}\n\n\tconst siblings: Uint8Array[] = [];\n\tlet index = txIndex;\n\tlet level = txidsInternal.slice();\n\twhile (level.length > 1) {\n\t\tconst isRight = index % 2 === 1;\n\t\tconst siblingIndex = isRight ? index - 1 : index + 1;\n\t\tconst self = level[index];\n\t\tif (self === undefined) throw new Error(\"buildMerkleProof: missing node\");\n\t\t// When the node is the last of an odd level, it is paired with itself.\n\t\tsiblings.push(level[siblingIndex] ?? self);\n\t\tlevel = nextLevel(level);\n\t\tindex = Math.floor(index / 2);\n\t}\n\n\treturn { siblings, txIndex, txCount };\n}\n\n/**\n * Recompute the merkle root from a leaf + its proof — the same fold the on-chain\n * `verify-merkle-proof` performs. Use it off-chain to self-check a constructed\n * proof against the header's merkle root before submitting a contract call.\n */\nexport function rootFromProof(\n\tleafInternal: Uint8Array,\n\tproof: MerkleProof,\n): Uint8Array {\n\tlet hash = leafInternal;\n\tlet index = proof.txIndex;\n\tfor (const sibling of proof.siblings) {\n\t\thash = index % 2 === 1 ? hashPair(sibling, hash) : hashPair(hash, sibling);\n\t\tindex = Math.floor(index / 2);\n\t}\n\treturn hash;\n}\n",
6
- "import { bytesToHex, hexToBytes, without0x } from \"../utils/encoding.ts\";\nimport { type MerkleProof, buildMerkleProof, rootFromProof } from \"./merkle.ts\";\nimport { parseBitcoinTx, parseBlockHeader, reverseBytes } from \"./serialize.ts\";\n\n/**\n * A self-contained Bitcoin SPV proof: everything the SIP-044 built-ins need to\n * prove a tx (and one of its outputs) is committed in a confirmed block. Hashes\n * are internal byte order throughout.\n */\nexport interface SpvProof {\n\trawTx: Uint8Array;\n\t/** The tx's txid, internal order — the merkle leaf. */\n\ttxidInternal: Uint8Array;\n\t/** Output index of interest, if the proof targets a specific output. */\n\tvout?: number;\n\tmerkle: MerkleProof;\n\t/** The 80-byte block header that commits the tx. */\n\theader: Uint8Array;\n\t/** Bitcoin block height. */\n\theight: number;\n}\n\n/** The block context a `ProofSource` resolves for a confirmed tx. */\nexport interface BlockForTx {\n\t/** 80-byte block header. */\n\theader: Uint8Array;\n\theight: number;\n\t/** All of the block's txids, internal order, in block order. */\n\ttxidsInternal: Uint8Array[];\n\t/** Index of the target tx within the block. */\n\ttxIndex: number;\n}\n\n/**\n * Where proof inputs come from. The default is the integrator's own Bitcoin node\n * (`bitcoinRpcSource`) — trustless; a hosted Esplora-compatible endpoint\n * (`esploraSource`) is the fallback. `buildTxProof` independently re-checks\n * whatever a source returns, so a wrong or hostile source fails loudly rather\n * than producing a bad proof.\n */\nexport interface ProofSource {\n\t/** Raw (serialized) tx bytes for a txid (display-order hex). */\n\tgetRawTx(txid: string): Promise<Uint8Array>;\n\t/** The confirming block's header, height, and txid set for a txid. */\n\tgetBlockForTx(txid: string): Promise<BlockForTx>;\n}\n\nfunction normalizeTxid(txid: string): string {\n\treturn without0x(txid).toLowerCase();\n}\n\n/**\n * Locate `txid` in a block's txid set and assemble its `BlockForTx`. Owns the\n * display→internal byte-order reversal (`reverseBytes`) so the ProofSources\n * can't drift on the one operation a silent merkle-root mismatch would hide.\n * `txidsDisplay` are display-order hex txids as returned by Core / Esplora.\n */\nfunction assembleBlockForTx(args: {\n\ttxid: string;\n\tblockId: string;\n\theaderHex: string;\n\theight: number;\n\ttxidsDisplay: string[];\n}): BlockForTx {\n\tconst txIndex = args.txidsDisplay.indexOf(normalizeTxid(args.txid));\n\tif (txIndex < 0) {\n\t\tthrow new Error(`tx ${args.txid} not found in block ${args.blockId}`);\n\t}\n\treturn {\n\t\theader: hexToBytes(args.headerHex),\n\t\theight: args.height,\n\t\ttxidsInternal: args.txidsDisplay.map((t) => reverseBytes(hexToBytes(t))),\n\t\ttxIndex,\n\t};\n}\n\n/**\n * Assemble an `SpvProof` for a txid from a `ProofSource`, validating every claim\n * the source makes:\n * - the returned raw tx actually hashes to the requested txid,\n * - the claimed `txIndex` points at that txid in the block, and\n * - the resulting merkle proof folds back to the block header's merkle root.\n * Any mismatch throws — the proof is never returned half-trusted.\n */\nexport async function buildTxProof(\n\tsource: ProofSource,\n\tparams: { txid: string; vout?: number },\n): Promise<SpvProof> {\n\tconst { txid, vout } = params;\n\tconst want = normalizeTxid(txid);\n\n\tconst [rawTx, block] = await Promise.all([\n\t\tsource.getRawTx(txid),\n\t\tsource.getBlockForTx(txid),\n\t]);\n\n\tconst parsed = parseBitcoinTx(rawTx);\n\tconst gotDisplay = bytesToHex(reverseBytes(parsed.txidInternal));\n\tif (gotDisplay !== want) {\n\t\tthrow new Error(\n\t\t\t`source returned a tx whose id ${gotDisplay} does not match requested ${want}`,\n\t\t);\n\t}\n\n\tconst atIndex = block.txidsInternal[block.txIndex];\n\tif (!atIndex || bytesToHex(atIndex) !== bytesToHex(parsed.txidInternal)) {\n\t\tthrow new Error(\n\t\t\t`source txIndex ${block.txIndex} does not point at tx ${want}`,\n\t\t);\n\t}\n\n\tconst merkle = buildMerkleProof(block.txidsInternal, block.txIndex);\n\n\tconst headerRoot = parseBlockHeader(block.header).merkleRoot;\n\tconst computed = rootFromProof(parsed.txidInternal, merkle);\n\tif (bytesToHex(computed) !== bytesToHex(headerRoot)) {\n\t\tthrow new Error(\n\t\t\t\"constructed merkle proof does not reconcile with the block header merkle root\",\n\t\t);\n\t}\n\n\treturn {\n\t\trawTx,\n\t\ttxidInternal: parsed.txidInternal,\n\t\tvout,\n\t\tmerkle,\n\t\theader: block.header,\n\t\theight: block.height,\n\t};\n}\n\n/**\n * Compose sources into an ordered fallback chain: each call tries them in turn\n * and returns the first success, throwing the last error if all fail. Put the\n * trustless integrator node first and a hosted endpoint last.\n */\nexport function fallbackProofSource(sources: ProofSource[]): ProofSource {\n\tif (sources.length === 0) {\n\t\tthrow new Error(\"fallbackProofSource: at least one source is required\");\n\t}\n\tasync function firstSuccess<T>(\n\t\tfn: (s: ProofSource) => Promise<T>,\n\t): Promise<T> {\n\t\tlet lastError: unknown;\n\t\tfor (const source of sources) {\n\t\t\ttry {\n\t\t\t\treturn await fn(source);\n\t\t\t} catch (error) {\n\t\t\t\tlastError = error;\n\t\t\t}\n\t\t}\n\t\tthrow lastError;\n\t}\n\treturn {\n\t\tgetRawTx: (txid) => firstSuccess((s) => s.getRawTx(txid)),\n\t\tgetBlockForTx: (txid) => firstSuccess((s) => s.getBlockForTx(txid)),\n\t};\n}\n\nexport interface BitcoinRpcConfig {\n\t/** Bitcoin Core JSON-RPC endpoint URL. */\n\turl: string;\n\t/** Basic auth — `{ username, password }` or a pre-encoded base64 string. */\n\tauth?: { username: string; password: string } | string;\n\t/** Override the fetch implementation (testing / custom agents). */\n\tfetch?: typeof fetch;\n}\n\n/**\n * A `ProofSource` backed by the integrator's own Bitcoin Core node over\n * JSON-RPC. This is the trustless default. The node must run with `-txindex`\n * (or the tx must be in the mempool's block view) so `getrawtransaction` can\n * resolve the confirming block.\n */\nexport function bitcoinRpcSource(config: BitcoinRpcConfig): ProofSource {\n\tconst doFetch = config.fetch ?? fetch;\n\n\tasync function rpc<T>(method: string, rpcParams: unknown[]): Promise<T> {\n\t\tconst headers: Record<string, string> = {\n\t\t\t\"content-type\": \"application/json\",\n\t\t};\n\t\tif (config.auth) {\n\t\t\tconst basic =\n\t\t\t\ttypeof config.auth === \"string\"\n\t\t\t\t\t? config.auth\n\t\t\t\t\t: btoa(`${config.auth.username}:${config.auth.password}`);\n\t\t\theaders.authorization = `Basic ${basic}`;\n\t\t}\n\t\tconst res = await doFetch(config.url, {\n\t\t\tmethod: \"POST\",\n\t\t\theaders,\n\t\t\tbody: JSON.stringify({\n\t\t\t\tjsonrpc: \"1.0\",\n\t\t\t\tid: \"secondlayer\",\n\t\t\t\tmethod,\n\t\t\t\tparams: rpcParams,\n\t\t\t}),\n\t\t});\n\t\tif (!res.ok) {\n\t\t\tthrow new Error(`bitcoin rpc ${method} failed: HTTP ${res.status}`);\n\t\t}\n\t\tconst json = (await res.json()) as {\n\t\t\tresult: T;\n\t\t\terror: { message: string } | null;\n\t\t};\n\t\tif (json.error) {\n\t\t\tthrow new Error(`bitcoin rpc ${method} error: ${json.error.message}`);\n\t\t}\n\t\treturn json.result;\n\t}\n\n\treturn {\n\t\tasync getRawTx(txid) {\n\t\t\treturn hexToBytes(await rpc<string>(\"getrawtransaction\", [txid, false]));\n\t\t},\n\t\tasync getBlockForTx(txid) {\n\t\t\tconst tx = await rpc<{ blockhash?: string }>(\"getrawtransaction\", [\n\t\t\t\ttxid,\n\t\t\t\ttrue,\n\t\t\t]);\n\t\t\tif (!tx.blockhash) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`tx ${txid} is not in a block (node needs -txindex, or the tx is unconfirmed)`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst block = await rpc<{ tx: string[]; height: number }>(\"getblock\", [\n\t\t\t\ttx.blockhash,\n\t\t\t\t1,\n\t\t\t]);\n\t\t\tconst header = await rpc<string>(\"getblockheader\", [tx.blockhash, false]);\n\t\t\treturn assembleBlockForTx({\n\t\t\t\ttxid,\n\t\t\t\tblockId: tx.blockhash,\n\t\t\t\theaderHex: header,\n\t\t\t\theight: block.height,\n\t\t\t\ttxidsDisplay: block.tx,\n\t\t\t});\n\t\t},\n\t};\n}\n\nexport interface EsploraConfig {\n\t/** Esplora REST base URL, e.g. `https://blockstream.info/api` or a self-hosted instance. */\n\turl: string;\n\t/** Override the fetch implementation. */\n\tfetch?: typeof fetch;\n}\n\n/**\n * A `ProofSource` backed by an Esplora REST API (self-hosted, or a hosted\n * provider as a fallback). Provider-agnostic: any Esplora-compatible endpoint\n * works. Use as the hosted fallback behind `bitcoinRpcSource`.\n */\nexport function esploraSource(config: EsploraConfig): ProofSource {\n\tconst doFetch = config.fetch ?? fetch;\n\tconst base = config.url.replace(/\\/+$/, \"\");\n\n\tasync function get(path: string): Promise<Response> {\n\t\tconst res = await doFetch(`${base}${path}`);\n\t\tif (!res.ok) {\n\t\t\tthrow new Error(`esplora GET ${path} failed: HTTP ${res.status}`);\n\t\t}\n\t\treturn res;\n\t}\n\n\treturn {\n\t\tasync getRawTx(txid) {\n\t\t\treturn hexToBytes((await (await get(`/tx/${txid}/hex`)).text()).trim());\n\t\t},\n\t\tasync getBlockForTx(txid) {\n\t\t\tconst status = (await (await get(`/tx/${txid}`)).json()) as {\n\t\t\t\tstatus: {\n\t\t\t\t\tconfirmed: boolean;\n\t\t\t\t\tblock_height: number;\n\t\t\t\t\tblock_hash: string;\n\t\t\t\t};\n\t\t\t};\n\t\t\tif (!status.status.confirmed) {\n\t\t\t\tthrow new Error(`tx ${txid} is unconfirmed`);\n\t\t\t}\n\t\t\tconst blockHashHex = status.status.block_hash;\n\t\t\tconst header = (\n\t\t\t\tawait (await get(`/block/${blockHashHex}/header`)).text()\n\t\t\t).trim();\n\t\t\tconst txids = (await (\n\t\t\t\tawait get(`/block/${blockHashHex}/txids`)\n\t\t\t).json()) as string[];\n\t\t\treturn assembleBlockForTx({\n\t\t\t\ttxid,\n\t\t\t\tblockId: blockHashHex,\n\t\t\t\theaderHex: header,\n\t\t\t\theight: status.status.block_height,\n\t\t\t\ttxidsDisplay: txids,\n\t\t\t});\n\t\t},\n\t};\n}\n",
7
- "/**\n * Stacks hard-fork epoch activation heights, as Bitcoin burn block heights.\n *\n * Epoch 4.0 carries both SIP-044 (the native Bitcoin SPV built-ins / Clarity 6)\n * and SIP-045 (`pox-5` Bitcoin Staking) — one fork, one height. Keep it here so\n * the two modules can never disagree.\n */\n\n/**\n * Epoch 4.0 activation height on mainnet — Bitcoin block 960,230 (~2026-07-30\n * AM UTC, per the stacks-core 4.0.1 release notes).\n *\n * Only mainnet has a fixed height. On other networks, read it from the node\n * (`getPox5Activation` for pox-5) or pass it explicitly.\n */\nexport const EPOCH_4_ACTIVATION_BURN_HEIGHT_MAINNET = 960_230;\n"
8
- ],
9
- "mappings": ";AAmBA,SAAS,QAAQ,CAAC,MAAkB,OAA+B;AAAA,EAClE,OAAO,aAAa,YAAY,MAAM,KAAK,CAAC;AAAA;AAI7C,SAAS,SAAS,CAAC,OAAmC;AAAA,EACrD,MAAM,OAA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,MACf,CAAC;AAAA;AAAA,EAEH;AAAA;;;ACxRM,IAAM,yCAAyC;",
10
- "debugId": "CE288481C610C7EC64756E2164756E21",
11
- "names": []
12
- }
@@ -1,74 +0,0 @@
1
- // src/chains/definitions.ts
2
- var mainnet = {
3
- id: 1,
4
- name: "Stacks Mainnet",
5
- network: "mainnet",
6
- transactionVersion: 0,
7
- peerNetworkId: 385875968,
8
- addressVersion: { singleSig: 22, multiSig: 20 },
9
- magicBytes: "X2",
10
- bootAddress: "SP000000000000000000002Q6VF78",
11
- nativeCurrency: { name: "Stacks", symbol: "STX", decimals: 6 },
12
- rpcUrls: {
13
- default: {
14
- http: ["https://api.mainnet.hiro.so"],
15
- ws: ["wss://api.mainnet.hiro.so/extended/v1/ws"]
16
- }
17
- },
18
- blockExplorers: {
19
- default: { name: "Hiro Explorer", url: "https://explorer.hiro.so" }
20
- }
21
- };
22
- var testnet = {
23
- id: 2147483648,
24
- name: "Stacks Testnet",
25
- network: "testnet",
26
- transactionVersion: 128,
27
- peerNetworkId: 4278190080,
28
- addressVersion: { singleSig: 26, multiSig: 21 },
29
- magicBytes: "T2",
30
- bootAddress: "ST000000000000000000002AMW42H",
31
- nativeCurrency: { name: "Stacks", symbol: "STX", decimals: 6 },
32
- rpcUrls: {
33
- default: {
34
- http: ["https://api.testnet.hiro.so"],
35
- ws: ["wss://api.testnet.hiro.so/extended/v1/ws"]
36
- }
37
- },
38
- blockExplorers: {
39
- default: {
40
- name: "Hiro Explorer",
41
- url: "https://explorer.hiro.so/?chain=testnet"
42
- }
43
- }
44
- };
45
- var devnet = {
46
- id: 2147483648,
47
- name: "Stacks Devnet",
48
- network: "testnet",
49
- transactionVersion: 128,
50
- peerNetworkId: 4278190080,
51
- addressVersion: { singleSig: 26, multiSig: 21 },
52
- magicBytes: "id",
53
- bootAddress: "ST000000000000000000002AMW42H",
54
- nativeCurrency: { name: "Stacks", symbol: "STX", decimals: 6 },
55
- rpcUrls: {
56
- default: {
57
- http: ["http://localhost:3999"],
58
- ws: ["ws://localhost:3999/extended/v1/ws"]
59
- }
60
- }
61
- };
62
- var mocknet = {
63
- ...devnet,
64
- name: "Stacks Mocknet",
65
- addressVersion: { ...devnet.addressVersion }
66
- };
67
-
68
- // src/chains/defineChain.ts
69
- function defineChain(chain) {
70
- return chain;
71
- }
72
-
73
- //# debugId=2AFA2816A3EAB92964756E2164756E21
74
- //# sourceMappingURL=stacks-24h5k94q.cjs.map
@@ -1,11 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/chains/definitions.ts", "../src/chains/defineChain.ts"],
4
- "sourcesContent": [
5
- "import type { StacksChain } from \"./types.ts\";\n\n/** Stacks mainnet chain definition (Hiro API). */\nexport const mainnet: StacksChain = {\n\tid: 0x00000001,\n\tname: \"Stacks Mainnet\",\n\tnetwork: \"mainnet\",\n\ttransactionVersion: 0x00,\n\tpeerNetworkId: 0x17000000,\n\taddressVersion: { singleSig: 22, multiSig: 20 },\n\tmagicBytes: \"X2\",\n\tbootAddress: \"SP000000000000000000002Q6VF78\",\n\tnativeCurrency: { name: \"Stacks\", symbol: \"STX\", decimals: 6 },\n\trpcUrls: {\n\t\tdefault: {\n\t\t\thttp: [\"https://api.mainnet.hiro.so\"],\n\t\t\tws: [\"wss://api.mainnet.hiro.so/extended/v1/ws\"],\n\t\t},\n\t},\n\tblockExplorers: {\n\t\tdefault: { name: \"Hiro Explorer\", url: \"https://explorer.hiro.so\" },\n\t},\n};\n\n/** Stacks testnet chain definition (Hiro API). */\nexport const testnet: StacksChain = {\n\tid: 0x80000000,\n\tname: \"Stacks Testnet\",\n\tnetwork: \"testnet\",\n\ttransactionVersion: 0x80,\n\tpeerNetworkId: 0xff000000,\n\taddressVersion: { singleSig: 26, multiSig: 21 },\n\tmagicBytes: \"T2\",\n\tbootAddress: \"ST000000000000000000002AMW42H\",\n\tnativeCurrency: { name: \"Stacks\", symbol: \"STX\", decimals: 6 },\n\trpcUrls: {\n\t\tdefault: {\n\t\t\thttp: [\"https://api.testnet.hiro.so\"],\n\t\t\tws: [\"wss://api.testnet.hiro.so/extended/v1/ws\"],\n\t\t},\n\t},\n\tblockExplorers: {\n\t\tdefault: {\n\t\t\tname: \"Hiro Explorer\",\n\t\t\turl: \"https://explorer.hiro.so/?chain=testnet\",\n\t\t},\n\t},\n};\n\n/** Local development chain definition (localhost:3999). */\nexport const devnet: StacksChain = {\n\tid: 0x80000000,\n\tname: \"Stacks Devnet\",\n\tnetwork: \"testnet\",\n\ttransactionVersion: 0x80,\n\tpeerNetworkId: 0xff000000,\n\taddressVersion: { singleSig: 26, multiSig: 21 },\n\tmagicBytes: \"id\",\n\tbootAddress: \"ST000000000000000000002AMW42H\",\n\tnativeCurrency: { name: \"Stacks\", symbol: \"STX\", decimals: 6 },\n\trpcUrls: {\n\t\tdefault: {\n\t\t\thttp: [\"http://localhost:3999\"],\n\t\t\tws: [\"ws://localhost:3999/extended/v1/ws\"],\n\t\t},\n\t},\n};\n\n/** Alias for devnet used in mock/test environments. */\nexport const mocknet: StacksChain = {\n\t...devnet,\n\tname: \"Stacks Mocknet\",\n\taddressVersion: { ...devnet.addressVersion },\n};\n",
6
- "import type { StacksChain } from \"./types.ts\";\n\n/** Identity helper for defining a custom {@link StacksChain} with full type inference. */\nexport function defineChain(chain: StacksChain): StacksChain {\n\treturn chain;\n}\n"
7
- ],
8
- "mappings": ";AAGO,IAAM,UAAuB;AAAA,EACnC,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,SAAS;AAAA,EACT,oBAAoB;AAAA,EACpB,eAAe;AAAA,EACf,gBAAgB,EAAE,WAAW,IAAI,UAAU,GAAG;AAAA,EAC9C,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,gBAAgB,EAAE,MAAM,UAAU,QAAQ,OAAO,UAAU,EAAE;AAAA,EAC7D,SAAS;AAAA,IACR,SAAS;AAAA,MACR,MAAM,CAAC,6BAA6B;AAAA,MACpC,IAAI,CAAC,0CAA0C;AAAA,IAChD;AAAA,EACD;AAAA,EACA,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