@secondlayer/stacks 6.0.0 → 6.1.1

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 (217) hide show
  1. package/dist/shared/stacks-esm-0pc6tmf0.js +50 -0
  2. package/dist/shared/{stacks-qex691bh.js.map → stacks-esm-0pc6tmf0.js.map} +2 -2
  3. package/dist/shared/{stacks-qt8ehebn.js → stacks-esm-16d82wyc.js} +10 -10
  4. package/dist/shared/{stacks-qt8ehebn.js.map → stacks-esm-16d82wyc.js.map} +2 -2
  5. package/dist/shared/{stacks-qs5fzts5.js → stacks-esm-7a0ehykf.js} +43 -43
  6. package/dist/shared/{stacks-qs5fzts5.js.map → stacks-esm-7a0ehykf.js.map} +2 -2
  7. package/dist/shared/{stacks-4hs8r4q2.js → stacks-esm-7v18h5dk.js} +4 -4
  8. package/dist/shared/{stacks-xjkn3en1.cjs.map → stacks-esm-7v18h5dk.js.map} +2 -2
  9. package/dist/shared/{stacks-71k0vmct.js → stacks-esm-8f5catbf.js} +126 -126
  10. package/dist/shared/{stacks-71k0vmct.js.map → stacks-esm-8f5catbf.js.map} +2 -2
  11. package/dist/shared/{stacks-wxfd6r4b.js → stacks-esm-8jt6k8p3.js} +13 -13
  12. package/dist/shared/{stacks-wxfd6r4b.js.map → stacks-esm-8jt6k8p3.js.map} +2 -2
  13. package/dist/shared/{stacks-x0qqwrev.js → stacks-esm-a20wyky3.js} +92 -92
  14. package/dist/shared/{stacks-agk106zs.cjs.map → stacks-esm-a20wyky3.js.map} +2 -2
  15. package/dist/shared/{stacks-gjz26k6b.js → stacks-esm-b54n1jdx.js} +102 -58
  16. package/dist/shared/stacks-esm-b54n1jdx.js.map +12 -0
  17. package/dist/shared/{stacks-9c1yam8b.js → stacks-esm-cmtj5vky.js} +162 -162
  18. package/dist/shared/{stacks-9c1yam8b.js.map → stacks-esm-cmtj5vky.js.map} +2 -2
  19. package/dist/shared/{stacks-z90xdr1x.js → stacks-esm-e2qhfgke.js} +36 -36
  20. package/dist/shared/{stacks-z90xdr1x.js.map → stacks-esm-e2qhfgke.js.map} +2 -2
  21. package/dist/shared/{stacks-v03zef3g.js → stacks-esm-ea4m4bk7.js} +117 -117
  22. package/dist/shared/{stacks-v03zef3g.js.map → stacks-esm-ea4m4bk7.js.map} +2 -2
  23. package/dist/shared/{stacks-69nq48jp.js → stacks-esm-hkw1kvd4.js} +140 -140
  24. package/dist/shared/{stacks-69nq48jp.js.map → stacks-esm-hkw1kvd4.js.map} +2 -2
  25. package/dist/shared/{stacks-qcae5852.js → stacks-esm-k108pemv.js} +4 -4
  26. package/dist/shared/{stacks-qcae5852.js.map → stacks-esm-k108pemv.js.map} +2 -2
  27. package/dist/shared/stacks-esm-kbz5s6v8.js +84 -0
  28. package/dist/shared/{stacks-4d7c3x27.js.map → stacks-esm-kbz5s6v8.js.map} +2 -2
  29. package/dist/shared/{stacks-kg1npstf.js → stacks-esm-mt1thm7k.js} +9 -9
  30. package/dist/shared/{stacks-kg1npstf.js.map → stacks-esm-mt1thm7k.js.map} +2 -2
  31. package/dist/shared/{stacks-yvb7rvwk.js → stacks-esm-n1mekwnb.js} +9 -9
  32. package/dist/shared/{stacks-8vzxax5e.cjs.map → stacks-esm-n1mekwnb.js.map} +2 -2
  33. package/dist/shared/{stacks-mftyrc60.js → stacks-esm-nt5hf8ht.js} +34 -34
  34. package/dist/shared/{stacks-mftyrc60.js.map → stacks-esm-nt5hf8ht.js.map} +2 -2
  35. package/dist/shared/{stacks-51ybf135.js → stacks-esm-phgy8yqf.js} +210 -210
  36. package/dist/shared/{stacks-51ybf135.js.map → stacks-esm-phgy8yqf.js.map} +2 -2
  37. package/dist/shared/{stacks-mbt36bzt.js → stacks-esm-pxv6ny92.js} +116 -116
  38. package/dist/shared/{stacks-mbt36bzt.js.map → stacks-esm-pxv6ny92.js.map} +2 -2
  39. package/dist/shared/{stacks-8brgfvqx.js → stacks-esm-qfzxhdqz.js} +19 -19
  40. package/dist/shared/{stacks-8brgfvqx.js.map → stacks-esm-qfzxhdqz.js.map} +2 -2
  41. package/dist/shared/{stacks-fd4rx56e.js → stacks-esm-snj9s2q8.js} +43 -43
  42. package/dist/shared/{stacks-fd4rx56e.js.map → stacks-esm-snj9s2q8.js.map} +2 -2
  43. package/dist/shared/{stacks-yajyej2y.js → stacks-esm-ss9ap75h.js} +28 -28
  44. package/dist/shared/{stacks-yajyej2y.js.map → stacks-esm-ss9ap75h.js.map} +2 -2
  45. package/dist/shared/{stacks-1m3m1agc.js → stacks-esm-t88hc019.js} +18 -18
  46. package/dist/shared/{stacks-1m3m1agc.js.map → stacks-esm-t88hc019.js.map} +2 -2
  47. package/dist/shared/stacks-esm-tdrdye4y.js +48 -0
  48. package/dist/shared/{stacks-enpj9krt.cjs.map → stacks-esm-tdrdye4y.js.map} +2 -2
  49. package/dist/src/accounts/index.cjs +565 -9
  50. package/dist/src/accounts/index.cjs.map +10 -4
  51. package/dist/src/accounts/index.d.cts +1 -1
  52. package/dist/src/accounts/index.d.ts +1 -1
  53. package/dist/src/accounts/index.js +26 -26
  54. package/dist/src/accounts/index.js.map +2 -2
  55. package/dist/src/actions/index.cjs +3860 -44
  56. package/dist/src/actions/index.cjs.map +65 -3
  57. package/dist/src/actions/index.d.cts +1 -1
  58. package/dist/src/actions/index.d.ts +1 -1
  59. package/dist/src/actions/index.js +102 -103
  60. package/dist/src/actions/index.js.map +1 -1
  61. package/dist/src/bitcoin/index.cjs +2506 -31
  62. package/dist/src/bitcoin/index.cjs.map +31 -3
  63. package/dist/src/bitcoin/index.d.cts +92 -92
  64. package/dist/src/bitcoin/index.d.ts +92 -92
  65. package/dist/src/bitcoin/index.js +88 -90
  66. package/dist/src/bitcoin/index.js.map +2 -2
  67. package/dist/src/bns/index.cjs +4435 -10
  68. package/dist/src/bns/index.cjs.map +50 -3
  69. package/dist/src/bns/index.d.cts +1 -1
  70. package/dist/src/bns/index.d.ts +1 -1
  71. package/dist/src/bns/index.js +39 -41
  72. package/dist/src/bns/index.js.map +2 -2
  73. package/dist/src/chains/index.cjs +141 -5
  74. package/dist/src/chains/index.cjs.map +5 -3
  75. package/dist/src/chains/index.d.cts +1 -1
  76. package/dist/src/chains/index.d.ts +1 -1
  77. package/dist/src/chains/index.js +12 -12
  78. package/dist/src/chains/index.js.map +1 -1
  79. package/dist/src/clarity/index.cjs +2021 -1
  80. package/dist/src/clarity/index.cjs.map +24 -3
  81. package/dist/src/clarity/index.d.cts +1 -1
  82. package/dist/src/clarity/index.d.ts +1 -1
  83. package/dist/src/clarity/index.js +170 -171
  84. package/dist/src/clarity/index.js.map +1 -1
  85. package/dist/src/connect/index.cjs +19 -19
  86. package/dist/src/connect/index.cjs.map +2 -2
  87. package/dist/src/connect/index.d.cts +1 -1
  88. package/dist/src/connect/index.d.ts +1 -1
  89. package/dist/src/connect/index.js +19 -19
  90. package/dist/src/connect/index.js.map +2 -2
  91. package/dist/src/connect/walletconnect/index.cjs +6 -46
  92. package/dist/src/connect/walletconnect/index.cjs.map +3 -4
  93. package/dist/src/connect/walletconnect/index.d.cts +1 -1
  94. package/dist/src/connect/walletconnect/index.d.ts +1 -1
  95. package/dist/src/connect/walletconnect/index.js +6 -46
  96. package/dist/src/connect/walletconnect/index.js.map +3 -4
  97. package/dist/src/filters/index.cjs +727 -1
  98. package/dist/src/filters/index.cjs.map +11 -3
  99. package/dist/src/filters/index.d.cts +76 -13
  100. package/dist/src/filters/index.d.ts +76 -13
  101. package/dist/src/filters/index.js +30 -26
  102. package/dist/src/filters/index.js.map +1 -1
  103. package/dist/src/index.cjs +4000 -126
  104. package/dist/src/index.cjs.map +69 -4
  105. package/dist/src/index.d.cts +658 -607
  106. package/dist/src/index.d.ts +658 -607
  107. package/dist/src/index.js +219 -219
  108. package/dist/src/index.js.map +2 -2
  109. package/dist/src/postconditions/index.cjs +1728 -1
  110. package/dist/src/postconditions/index.cjs.map +20 -3
  111. package/dist/src/postconditions/index.d.cts +1 -1
  112. package/dist/src/postconditions/index.d.ts +1 -1
  113. package/dist/src/postconditions/index.js +16 -17
  114. package/dist/src/postconditions/index.js.map +1 -1
  115. package/dist/src/pox/index.cjs +3866 -11
  116. package/dist/src/pox/index.cjs.map +48 -3
  117. package/dist/src/pox/index.d.cts +1 -1
  118. package/dist/src/pox/index.d.ts +1 -1
  119. package/dist/src/pox/index.js +40 -41
  120. package/dist/src/pox/index.js.map +2 -2
  121. package/dist/src/pox5/index.cjs +4124 -95
  122. package/dist/src/pox5/index.cjs.map +55 -4
  123. package/dist/src/pox5/index.d.cts +9 -1
  124. package/dist/src/pox5/index.d.ts +9 -1
  125. package/dist/src/pox5/index.js +210 -209
  126. package/dist/src/pox5/index.js.map +3 -3
  127. package/dist/src/sbtc/index.cjs +3719 -16
  128. package/dist/src/sbtc/index.cjs.map +47 -3
  129. package/dist/src/sbtc/index.d.cts +1 -1
  130. package/dist/src/sbtc/index.d.ts +1 -1
  131. package/dist/src/sbtc/index.js +39 -40
  132. package/dist/src/sbtc/index.js.map +2 -2
  133. package/dist/src/simnet/index.cjs +16 -16
  134. package/dist/src/simnet/index.cjs.map +2 -2
  135. package/dist/src/simnet/index.d.cts +1 -1
  136. package/dist/src/simnet/index.d.ts +1 -1
  137. package/dist/src/simnet/index.js +16 -16
  138. package/dist/src/simnet/index.js.map +2 -2
  139. package/dist/src/stackingdao/index.cjs +3747 -3
  140. package/dist/src/stackingdao/index.cjs.map +45 -3
  141. package/dist/src/stackingdao/index.d.cts +1 -1
  142. package/dist/src/stackingdao/index.d.ts +1 -1
  143. package/dist/src/stackingdao/index.js +26 -27
  144. package/dist/src/stackingdao/index.js.map +2 -2
  145. package/dist/src/subscriptions/index.cjs +160 -6
  146. package/dist/src/subscriptions/index.cjs.map +6 -3
  147. package/dist/src/subscriptions/index.d.cts +1 -1
  148. package/dist/src/subscriptions/index.d.ts +1 -1
  149. package/dist/src/subscriptions/index.js +14 -15
  150. package/dist/src/subscriptions/index.js.map +1 -1
  151. package/dist/src/transactions/index.cjs +2189 -49
  152. package/dist/src/transactions/index.cjs.map +23 -3
  153. package/dist/src/transactions/index.d.cts +1 -1
  154. package/dist/src/transactions/index.d.ts +1 -1
  155. package/dist/src/transactions/index.js +104 -105
  156. package/dist/src/transactions/index.js.map +1 -1
  157. package/dist/src/utils/index.cjs +503 -69
  158. package/dist/src/utils/index.cjs.map +9 -3
  159. package/dist/src/utils/index.d.cts +1 -1
  160. package/dist/src/utils/index.d.ts +1 -1
  161. package/dist/src/utils/index.js +131 -131
  162. package/dist/src/utils/index.js.map +2 -2
  163. package/package.json +1 -1
  164. package/dist/shared/stacks-02actsrx.cjs +0 -17
  165. package/dist/shared/stacks-02actsrx.cjs.map +0 -10
  166. package/dist/shared/stacks-03vfm21t.cjs +0 -222
  167. package/dist/shared/stacks-03vfm21t.cjs.map +0 -12
  168. package/dist/shared/stacks-24h5k94q.cjs +0 -74
  169. package/dist/shared/stacks-24h5k94q.cjs.map +0 -11
  170. package/dist/shared/stacks-37kz5t9f.cjs +0 -764
  171. package/dist/shared/stacks-37kz5t9f.cjs.map +0 -23
  172. package/dist/shared/stacks-3mt2q2na.cjs +0 -65
  173. package/dist/shared/stacks-3mt2q2na.cjs.map +0 -9
  174. package/dist/shared/stacks-4d7c3x27.js +0 -84
  175. package/dist/shared/stacks-4hs8r4q2.js.map +0 -10
  176. package/dist/shared/stacks-8vzxax5e.cjs +0 -45
  177. package/dist/shared/stacks-agk106zs.cjs +0 -267
  178. package/dist/shared/stacks-bdgh9n83.cjs +0 -212
  179. package/dist/shared/stacks-bdgh9n83.cjs.map +0 -11
  180. package/dist/shared/stacks-dpxnxhqb.cjs +0 -51
  181. package/dist/shared/stacks-dpxnxhqb.cjs.map +0 -11
  182. package/dist/shared/stacks-ee53k9j2.cjs +0 -651
  183. package/dist/shared/stacks-ee53k9j2.cjs.map +0 -13
  184. package/dist/shared/stacks-enpj9krt.cjs +0 -38
  185. package/dist/shared/stacks-f35mnrmg.cjs +0 -164
  186. package/dist/shared/stacks-f35mnrmg.cjs.map +0 -10
  187. package/dist/shared/stacks-fhzwsn5d.cjs +0 -261
  188. package/dist/shared/stacks-fhzwsn5d.cjs.map +0 -12
  189. package/dist/shared/stacks-gjz26k6b.js.map +0 -12
  190. package/dist/shared/stacks-gza2n1zs.cjs +0 -73
  191. package/dist/shared/stacks-gza2n1zs.cjs.map +0 -11
  192. package/dist/shared/stacks-kem68d80.cjs +0 -156
  193. package/dist/shared/stacks-kem68d80.cjs.map +0 -10
  194. package/dist/shared/stacks-n98w7g57.cjs +0 -234
  195. package/dist/shared/stacks-n98w7g57.cjs.map +0 -10
  196. package/dist/shared/stacks-p337hp6m.cjs +0 -336
  197. package/dist/shared/stacks-p337hp6m.cjs.map +0 -25
  198. package/dist/shared/stacks-q34k4vnc.cjs +0 -286
  199. package/dist/shared/stacks-q34k4vnc.cjs.map +0 -12
  200. package/dist/shared/stacks-qex691bh.js +0 -50
  201. package/dist/shared/stacks-rryme9bv.cjs +0 -569
  202. package/dist/shared/stacks-rryme9bv.cjs.map +0 -13
  203. package/dist/shared/stacks-s5vej5z6.cjs +0 -410
  204. package/dist/shared/stacks-s5vej5z6.cjs.map +0 -15
  205. package/dist/shared/stacks-sdqkapct.cjs +0 -67
  206. package/dist/shared/stacks-sdqkapct.cjs.map +0 -12
  207. package/dist/shared/stacks-v2rfr46a.js +0 -48
  208. package/dist/shared/stacks-v2rfr46a.js.map +0 -10
  209. package/dist/shared/stacks-vea7nde7.cjs +0 -731
  210. package/dist/shared/stacks-vea7nde7.cjs.map +0 -13
  211. package/dist/shared/stacks-wk8yp13j.cjs +0 -33
  212. package/dist/shared/stacks-wk8yp13j.cjs.map +0 -11
  213. package/dist/shared/stacks-x0qqwrev.js.map +0 -12
  214. package/dist/shared/stacks-xjkn3en1.cjs +0 -42
  215. package/dist/shared/stacks-xnrywjf1.cjs +0 -131
  216. package/dist/shared/stacks-xnrywjf1.cjs.map +0 -11
  217. package/dist/shared/stacks-yvb7rvwk.js.map +0 -10
@@ -1,49 +1,48 @@
1
1
  import {
2
- EPOCH_4_ACTIVATION_BURN_HEIGHT_MAINNET,
3
- buildTxProof
4
- } from "../../shared/stacks-mftyrc60.js";
2
+ bytesToHex2,
3
+ hexToBytes2,
4
+ concatBytes2,
5
+ intToBigInt2
6
+ } from "../../shared/stacks-esm-7a0ehykf.js";
5
7
  import {
6
- BtcAddress,
7
- canonicalizeBtcAddress,
8
- parseBtcAddress,
9
- stringifyBtcAddress
10
- } from "../../shared/stacks-yajyej2y.js";
8
+ serializeCVBytes2,
9
+ Cl2,
10
+ deserializeCVBytes2
11
+ } from "../../shared/stacks-esm-hkw1kvd4.js";
12
+ import"../../shared/stacks-esm-kbz5s6v8.js";
13
+ import"../../shared/stacks-esm-a20wyky3.js";
14
+ import"../../shared/stacks-esm-phgy8yqf.js";
15
+ import"../../shared/stacks-esm-cmtj5vky.js";
11
16
  import {
12
- BITCOIN_NETWORK_PARAMS,
13
- parseBitcoinTx,
14
- stripWitness
15
- } from "../../shared/stacks-z90xdr1x.js";
17
+ parseBitcoinTx2,
18
+ stripWitness2,
19
+ BITCOIN_NETWORK_PARAMS
20
+ } from "../../shared/stacks-esm-e2qhfgke.js";
16
21
  import {
17
- getContract
18
- } from "../../shared/stacks-fd4rx56e.js";
22
+ structuredDataHash2
23
+ } from "../../shared/stacks-esm-tdrdye4y.js";
19
24
  import {
20
- getBalance,
21
- getDataVar,
22
- multicall
23
- } from "../../shared/stacks-1m3m1agc.js";
25
+ canonicalizeBtcAddress,
26
+ parseBtcAddress2,
27
+ stringifyBtcAddress2,
28
+ BtcAddress2
29
+ } from "../../shared/stacks-esm-ss9ap75h.js";
24
30
  import {
25
- getMapEntry
26
- } from "../../shared/stacks-v03zef3g.js";
27
- import"../../shared/stacks-qex691bh.js";
28
- import"../../shared/stacks-x0qqwrev.js";
31
+ buildTxProof2,
32
+ EPOCH_4_ACTIVATION_BURN_HEIGHT_MAINNET2
33
+ } from "../../shared/stacks-esm-nt5hf8ht.js";
29
34
  import {
30
- structuredDataHash
31
- } from "../../shared/stacks-v2rfr46a.js";
32
- import"../../shared/stacks-9c1yam8b.js";
33
- import"../../shared/stacks-51ybf135.js";
35
+ getContract2
36
+ } from "../../shared/stacks-esm-snj9s2q8.js";
34
37
  import {
35
- Cl,
36
- deserializeCVBytes,
37
- serializeCVBytes
38
- } from "../../shared/stacks-69nq48jp.js";
39
- import"../../shared/stacks-4hs8r4q2.js";
40
- import"../../shared/stacks-4d7c3x27.js";
38
+ getBalance2,
39
+ getDataVar2,
40
+ multicall2
41
+ } from "../../shared/stacks-esm-t88hc019.js";
41
42
  import {
42
- bytesToHex,
43
- concatBytes,
44
- hexToBytes,
45
- intToBigInt
46
- } from "../../shared/stacks-qs5fzts5.js";
43
+ getMapEntry2
44
+ } from "../../shared/stacks-esm-ea4m4bk7.js";
45
+ import"../../shared/stacks-esm-0pc6tmf0.js";
47
46
 
48
47
  // src/pox5/constants.ts
49
48
  var POX5_CONTRACT_NAME = "pox-5";
@@ -69,7 +68,8 @@ var POX5_EVENT_TOPICS = [
69
68
  "grant-signer-key",
70
69
  "revoke-signer-grant"
71
70
  ];
72
- var POX5_ACTIVATION_BURN_HEIGHT_MAINNET = EPOCH_4_ACTIVATION_BURN_HEIGHT_MAINNET;
71
+ var POX5_ACTIVATION_BURN_HEIGHT_MAINNET = EPOCH_4_ACTIVATION_BURN_HEIGHT_MAINNET2;
72
+ var MAINNET_PREPARE_CYCLE_LENGTH = 100;
73
73
  var BOND_LENGTH_CYCLES = 12;
74
74
  var BOND_GAP_CYCLES = 2;
75
75
  var MAX_NUM_CYCLES = 96;
@@ -945,10 +945,10 @@ function pox5ContractId(client) {
945
945
  }
946
946
  function getPox5Contract(client) {
947
947
  const [address, name] = pox5ContractId(client).split(".");
948
- return getContract({ client, address, name, abi: POX5_ABI });
948
+ return getContract2({ client, address, name, abi: POX5_ABI });
949
949
  }
950
950
  function toBytes(input) {
951
- return typeof input === "string" ? hexToBytes(input) : input;
951
+ return typeof input === "string" ? hexToBytes2(input) : input;
952
952
  }
953
953
  function optionalBytes(input) {
954
954
  return input === undefined ? null : toBytes(input);
@@ -957,7 +957,7 @@ var MAX_LOCKUP_OUTPUTS = 10;
957
957
  var MAX_LEAF_HASHES = 14;
958
958
  function btcLockupArg(lockup) {
959
959
  if ("sbtcSats" in lockup)
960
- return { err: intToBigInt(lockup.sbtcSats) };
960
+ return { err: intToBigInt2(lockup.sbtcSats) };
961
961
  if (lockup.l1Outputs.length === 0) {
962
962
  throw new Error("registerForBond: l1Outputs is empty — nothing would be locked");
963
963
  }
@@ -973,15 +973,15 @@ function btcLockupArg(lockup) {
973
973
  return {
974
974
  ok: {
975
975
  outputs: lockup.l1Outputs.map((o) => ({
976
- height: intToBigInt(o.height),
976
+ height: intToBigInt2(o.height),
977
977
  tx: toBytes(o.tx),
978
- outputIndex: intToBigInt(o.outputIndex),
978
+ outputIndex: intToBigInt2(o.outputIndex),
979
979
  header: toBytes(o.header),
980
980
  leafHashes: o.leafHashes.map(toBytes),
981
- txCount: intToBigInt(o.txCount),
982
- txIndex: intToBigInt(o.txIndex),
983
- amount: intToBigInt(o.amount),
984
- unlockBurnHeight: intToBigInt(o.unlockBurnHeight)
981
+ txCount: intToBigInt2(o.txCount),
982
+ txIndex: intToBigInt2(o.txIndex),
983
+ amount: intToBigInt2(o.amount),
984
+ unlockBurnHeight: intToBigInt2(o.unlockBurnHeight)
985
985
  })),
986
986
  stakerUnlockBytes: toBytes(lockup.stakerUnlockBytes)
987
987
  }
@@ -998,14 +998,14 @@ function setupBond(client, params) {
998
998
  ...tx
999
999
  } = params;
1000
1000
  return getPox5Contract(client).call.setupBond({
1001
- bondIndex: intToBigInt(bondIndex),
1002
- targetRate: intToBigInt(targetRate),
1003
- stxValueRatio: intToBigInt(stxValueRatio),
1004
- minUstxRatio: intToBigInt(minUstxRatio),
1001
+ bondIndex: intToBigInt2(bondIndex),
1002
+ targetRate: intToBigInt2(targetRate),
1003
+ stxValueRatio: intToBigInt2(stxValueRatio),
1004
+ minUstxRatio: intToBigInt2(minUstxRatio),
1005
1005
  earlyUnlockBytes: toBytes(earlyUnlockBytes),
1006
1006
  allowlist: allowlist.map((a) => ({
1007
1007
  staker: a.staker,
1008
- maxSats: intToBigInt(a.maxSats)
1008
+ maxSats: intToBigInt2(a.maxSats)
1009
1009
  }))
1010
1010
  }, tx);
1011
1011
  }
@@ -1019,9 +1019,9 @@ function registerForBond(client, params) {
1019
1019
  ...tx
1020
1020
  } = params;
1021
1021
  return getPox5Contract(client).call.registerForBond({
1022
- bondIndex: intToBigInt(bondIndex),
1022
+ bondIndex: intToBigInt2(bondIndex),
1023
1023
  signerManager,
1024
- amountUstx: intToBigInt(amountUstx),
1024
+ amountUstx: intToBigInt2(amountUstx),
1025
1025
  btcLockup: btcLockupArg(btcLockup),
1026
1026
  signerCalldata: optionalBytes(signerCalldata)
1027
1027
  }, tx);
@@ -1045,9 +1045,9 @@ function stake(client, params) {
1045
1045
  } = params;
1046
1046
  return getPox5Contract(client).call.stake({
1047
1047
  signerManager,
1048
- amountUstx: intToBigInt(amountUstx),
1049
- numCycles: intToBigInt(numCycles),
1050
- startBurnHt: intToBigInt(startBurnHeight),
1048
+ amountUstx: intToBigInt2(amountUstx),
1049
+ numCycles: intToBigInt2(numCycles),
1050
+ startBurnHt: intToBigInt2(startBurnHeight),
1051
1051
  signerCalldata: optionalBytes(signerCalldata)
1052
1052
  }, tx);
1053
1053
  }
@@ -1063,8 +1063,8 @@ function stakeUpdate(client, params) {
1063
1063
  return getPox5Contract(client).call.stakeUpdate({
1064
1064
  signerManager,
1065
1065
  oldSignerManager,
1066
- cyclesToExtend: intToBigInt(cyclesToExtend),
1067
- amountIncrease: intToBigInt(amountIncrease),
1066
+ cyclesToExtend: intToBigInt2(cyclesToExtend),
1067
+ amountIncrease: intToBigInt2(amountIncrease),
1068
1068
  signerCalldata: optionalBytes(signerCalldata)
1069
1069
  }, tx);
1070
1070
  }
@@ -1074,7 +1074,7 @@ function unstake(client, params) {
1074
1074
  }
1075
1075
  function unstakeSbtc(client, params) {
1076
1076
  const { signerManager, amountSats, ...tx } = params;
1077
- return getPox5Contract(client).call.unstakeSbtc({ signerManager, amountToWithdrawalSats: intToBigInt(amountSats) }, tx);
1077
+ return getPox5Contract(client).call.unstakeSbtc({ signerManager, amountToWithdrawalSats: intToBigInt2(amountSats) }, tx);
1078
1078
  }
1079
1079
  function announceL1EarlyExit(client, params) {
1080
1080
  const { staker, oldSignerManager, ...tx } = params;
@@ -1082,21 +1082,21 @@ function announceL1EarlyExit(client, params) {
1082
1082
  }
1083
1083
  function calculateRewards(client, params) {
1084
1084
  const { bondPeriods, ...tx } = params;
1085
- return getPox5Contract(client).call.calculateRewards({ bondPeriods: bondPeriods.map(intToBigInt) }, tx);
1085
+ return getPox5Contract(client).call.calculateRewards({ bondPeriods: bondPeriods.map(intToBigInt2) }, tx);
1086
1086
  }
1087
1087
  function claimRewards(client, params) {
1088
1088
  const { bondPeriods, rewardCycle, ...tx } = params;
1089
1089
  return getPox5Contract(client).call.claimRewards({
1090
- bondPeriods: bondPeriods.map(intToBigInt),
1091
- rewardCycle: intToBigInt(rewardCycle)
1090
+ bondPeriods: bondPeriods.map(intToBigInt2),
1091
+ rewardCycle: intToBigInt2(rewardCycle)
1092
1092
  }, tx);
1093
1093
  }
1094
1094
  function claimStakerRewardsForSigner(client, params) {
1095
1095
  const { staker, rewardCycle, bondIndex, ...tx } = params;
1096
1096
  return getPox5Contract(client).call.claimStakerRewardsForSigner({
1097
1097
  staker,
1098
- rewardCycle: intToBigInt(rewardCycle),
1099
- bondIndex: bondIndex === undefined ? null : intToBigInt(bondIndex)
1098
+ rewardCycle: intToBigInt2(rewardCycle),
1099
+ bondIndex: bondIndex === undefined ? null : intToBigInt2(bondIndex)
1100
1100
  }, tx);
1101
1101
  }
1102
1102
  function grantSignerKey(client, params) {
@@ -1104,7 +1104,7 @@ function grantSignerKey(client, params) {
1104
1104
  return getPox5Contract(client).call.grantSignerKey({
1105
1105
  signerKey: toBytes(signerKey),
1106
1106
  signerManager,
1107
- authId: intToBigInt(authId),
1107
+ authId: intToBigInt2(authId),
1108
1108
  signerSig: toBytes(signerSig)
1109
1109
  }, tx);
1110
1110
  }
@@ -1135,18 +1135,18 @@ async function getBondMembership(client, staker) {
1135
1135
  }
1136
1136
  async function getProtocolBond(client, bondIndex) {
1137
1137
  return await getPox5Contract(client).read.getProtocolBond({
1138
- bondIndex: intToBigInt(bondIndex)
1138
+ bondIndex: intToBigInt2(bondIndex)
1139
1139
  });
1140
1140
  }
1141
1141
  async function getBondAllowance(client, bondIndex, staker) {
1142
1142
  return await getPox5Contract(client).read.getBondAllowance({
1143
- bondIndex: intToBigInt(bondIndex),
1143
+ bondIndex: intToBigInt2(bondIndex),
1144
1144
  staker
1145
1145
  });
1146
1146
  }
1147
1147
  function getTotalSbtcStakedForBond(client, bondIndex) {
1148
1148
  return getPox5Contract(client).read.getTotalSbtcStakedForBond({
1149
- bondIndex: intToBigInt(bondIndex)
1149
+ bondIndex: intToBigInt2(bondIndex)
1150
1150
  });
1151
1151
  }
1152
1152
  function getStakerCustodiedSbtc(client, staker) {
@@ -1154,13 +1154,13 @@ function getStakerCustodiedSbtc(client, staker) {
1154
1154
  }
1155
1155
  function hasAnnouncedL1EarlyExit(client, bondIndex, staker) {
1156
1156
  return getPox5Contract(client).read.hasAnnouncedL1EarlyExit({
1157
- bondIndex: intToBigInt(bondIndex),
1157
+ bondIndex: intToBigInt2(bondIndex),
1158
1158
  staker
1159
1159
  });
1160
1160
  }
1161
1161
  function getBondL1UnlockHeight(client, bondIndex) {
1162
1162
  return getPox5Contract(client).read.getBondL1UnlockHeight({
1163
- bondIndex: intToBigInt(bondIndex)
1163
+ bondIndex: intToBigInt2(bondIndex)
1164
1164
  });
1165
1165
  }
1166
1166
  async function getSignerInfo(client, signer) {
@@ -1183,15 +1183,15 @@ function getFirstPox5RewardCycle(client) {
1183
1183
  function getEarned(client, params) {
1184
1184
  return getPox5Contract(client).read.getEarned({
1185
1185
  signer: params.signer,
1186
- rewardCycle: intToBigInt(params.rewardCycle),
1187
- bondIndex: params.bondIndex === undefined ? null : intToBigInt(params.bondIndex)
1186
+ rewardCycle: intToBigInt2(params.rewardCycle),
1187
+ bondIndex: params.bondIndex === undefined ? null : intToBigInt2(params.bondIndex)
1188
1188
  });
1189
1189
  }
1190
1190
  function getEarnedStakerRewards(client, params) {
1191
1191
  return getPox5Contract(client).read.getEarnedStakerRewards({
1192
1192
  signer: params.signer,
1193
- rewardCycle: intToBigInt(params.rewardCycle),
1194
- bondIndex: params.bondIndex === undefined ? null : intToBigInt(params.bondIndex),
1193
+ rewardCycle: intToBigInt2(params.rewardCycle),
1194
+ bondIndex: params.bondIndex === undefined ? null : intToBigInt2(params.bondIndex),
1195
1195
  staker: params.staker
1196
1196
  });
1197
1197
  }
@@ -1200,8 +1200,8 @@ function getLastRewardComputeHeight(client) {
1200
1200
  }
1201
1201
  function getTotalSharesStakedForCycle(client, rewardCycle, bondIndex) {
1202
1202
  return getPox5Contract(client).read.getTotalSharesStakedForCycle({
1203
- rewardCycle: intToBigInt(rewardCycle),
1204
- bondIndex: bondIndex === undefined ? null : intToBigInt(bondIndex)
1203
+ rewardCycle: intToBigInt2(rewardCycle),
1204
+ bondIndex: bondIndex === undefined ? null : intToBigInt2(bondIndex)
1205
1205
  });
1206
1206
  }
1207
1207
 
@@ -1285,11 +1285,11 @@ function finish(reasons) {
1285
1285
  return { ok: false, reasons: unique };
1286
1286
  }
1287
1287
  function toBytes2(input) {
1288
- return typeof input === "string" ? hexToBytes(input) : input;
1288
+ return typeof input === "string" ? hexToBytes2(input) : input;
1289
1289
  }
1290
1290
  function outpointKey(tx, outputIndex) {
1291
- const hex = typeof tx === "string" ? tx.toLowerCase() : bytesToHex(tx);
1292
- return `${hex}:${intToBigInt(outputIndex)}`;
1291
+ const hex = typeof tx === "string" ? tx.toLowerCase() : bytesToHex2(tx);
1292
+ return `${hex}:${intToBigInt2(outputIndex)}`;
1293
1293
  }
1294
1294
  async function readCycleClock(client) {
1295
1295
  const info = await getPoxInfo(client);
@@ -1338,7 +1338,7 @@ function bondOverlaps(membership, newFirstCycle, clock) {
1338
1338
  return start + BOND_LENGTH_CYCLES > newFirstCycle;
1339
1339
  }
1340
1340
  async function stxFloor(client, staker, amountUstx) {
1341
- const balance = await getBalance(client, { address: staker });
1341
+ const balance = await getBalance2(client, { address: staker });
1342
1342
  if (balance < amountUstx)
1343
1343
  return Pox5ErrorCode.InsufficientStx;
1344
1344
  return;
@@ -1353,9 +1353,9 @@ function minUstxForSats(sats, stxValueRatio, minUstxRatio) {
1353
1353
  }
1354
1354
  async function eligibleStake(client, params) {
1355
1355
  const reasons = [];
1356
- const amountUstx = intToBigInt(params.amountUstx);
1357
- const numCycles = intToBigInt(params.numCycles);
1358
- const startBurnHeight = intToBigInt(params.startBurnHeight);
1356
+ const amountUstx = intToBigInt2(params.amountUstx);
1357
+ const numCycles = intToBigInt2(params.numCycles);
1358
+ const startBurnHeight = intToBigInt2(params.startBurnHeight);
1359
1359
  const [clock, stakerInfo, membership, signerErrs, floor] = await Promise.all([
1360
1360
  readCycleClock(client),
1361
1361
  getStakerInfo(client, params.staker),
@@ -1396,18 +1396,18 @@ async function eligibleStake(client, params) {
1396
1396
  }
1397
1397
  async function eligibleRegisterForBond(client, params) {
1398
1398
  const reasons = [];
1399
- const amountUstx = intToBigInt(params.amountUstx);
1399
+ const amountUstx = intToBigInt2(params.amountUstx);
1400
1400
  const lockup = params.btcLockup;
1401
1401
  let sats = 0n;
1402
1402
  if ("sbtcSats" in lockup) {
1403
- sats = intToBigInt(lockup.sbtcSats);
1403
+ sats = intToBigInt2(lockup.sbtcSats);
1404
1404
  } else {
1405
1405
  if (lockup.l1Outputs.length === 0) {
1406
1406
  reasons.push(Pox5ErrorCode.InvalidLockupAmount);
1407
1407
  }
1408
1408
  const seen = new Set;
1409
1409
  for (const output of lockup.l1Outputs) {
1410
- sats += intToBigInt(output.amount);
1410
+ sats += intToBigInt2(output.amount);
1411
1411
  const key = outpointKey(output.tx, output.outputIndex);
1412
1412
  if (seen.has(key))
1413
1413
  reasons.push(Pox5ErrorCode.DuplicateLockupOutpoint);
@@ -1440,14 +1440,14 @@ async function eligibleRegisterForBond(client, params) {
1440
1440
  reasons.push(Pox5ErrorCode.InsufficientStx);
1441
1441
  }
1442
1442
  if (clock) {
1443
- const bondStart = bondPeriodToBurnHeight(Number(intToBigInt(params.bondIndex)), {
1443
+ const bondStart = bondPeriodToBurnHeight(Number(intToBigInt2(params.bondIndex)), {
1444
1444
  ...clock.params,
1445
1445
  firstBondPeriodCycle: clock.firstBondPeriodCycle
1446
1446
  });
1447
1447
  if (clock.burnHeight >= bondStart) {
1448
1448
  reasons.push(Pox5ErrorCode.BondAlreadyStarted);
1449
1449
  }
1450
- const firstRewardCycle = bondPeriodToRewardCycle(Number(intToBigInt(params.bondIndex)), { ...clock.params, firstBondPeriodCycle: clock.firstBondPeriodCycle });
1450
+ const firstRewardCycle = bondPeriodToRewardCycle(Number(intToBigInt2(params.bondIndex)), { ...clock.params, firstBondPeriodCycle: clock.firstBondPeriodCycle });
1451
1451
  if (stakerInfo) {
1452
1452
  const unlockCycle = Number(stakerInfo.firstRewardCycle) + Number(stakerInfo.numCycles);
1453
1453
  if (unlockCycle > firstRewardCycle) {
@@ -1467,7 +1467,7 @@ async function eligibleRegisterForBond(client, params) {
1467
1467
  if ("l1Outputs" in lockup && lockup.l1Outputs.length > 0) {
1468
1468
  const minUnlock = await getBondL1UnlockHeight(client, params.bondIndex);
1469
1469
  for (const output of lockup.l1Outputs) {
1470
- const height = intToBigInt(output.unlockBurnHeight);
1470
+ const height = intToBigInt2(output.unlockBurnHeight);
1471
1471
  if (height < minUnlock || height >= BITCOIN_LOCKTIME_THRESHOLD) {
1472
1472
  reasons.push(Pox5ErrorCode.InvalidUnlockHeight);
1473
1473
  }
@@ -1492,7 +1492,7 @@ async function eligibleUnstake(client, params) {
1492
1492
  }
1493
1493
  async function eligibleUnstakeSbtc(client, params) {
1494
1494
  const reasons = [];
1495
- const amount = intToBigInt(params.amountSats);
1495
+ const amount = intToBigInt2(params.amountSats);
1496
1496
  const [clock, membership] = await Promise.all([
1497
1497
  readCycleClock(client),
1498
1498
  getBondMembership(client, params.staker)
@@ -1516,7 +1516,7 @@ async function eligibleUnstakeSbtc(client, params) {
1516
1516
  async function eligibleClaimRewards(client, params) {
1517
1517
  const reasons = [];
1518
1518
  const contract = pox5ContractId(client);
1519
- const paused = await getDataVar(client, {
1519
+ const paused = await getDataVar2(client, {
1520
1520
  contract,
1521
1521
  varName: "rewards-paused"
1522
1522
  });
@@ -1544,13 +1544,13 @@ async function eligibleClaimRewards(client, params) {
1544
1544
  }
1545
1545
  async function eligibleGrantSignerKey(client, params) {
1546
1546
  const reasons = [];
1547
- const used = await getMapEntry(client, {
1547
+ const used = await getMapEntry2(client, {
1548
1548
  contract: pox5ContractId(client),
1549
1549
  mapName: "used-signer-key-grants",
1550
- key: Cl.tuple({
1551
- "signer-key": Cl.buffer(toBytes2(params.signerKey)),
1552
- "signer-manager": Cl.principal(params.signerManager),
1553
- "auth-id": Cl.uint(intToBigInt(params.authId))
1550
+ key: Cl2.tuple({
1551
+ "signer-key": Cl2.buffer(toBytes2(params.signerKey)),
1552
+ "signer-manager": Cl2.principal(params.signerManager),
1553
+ "auth-id": Cl2.uint(intToBigInt2(params.authId))
1554
1554
  })
1555
1555
  });
1556
1556
  if (used.type === "some")
@@ -1558,7 +1558,7 @@ async function eligibleGrantSignerKey(client, params) {
1558
1558
  return finish(reasons);
1559
1559
  }
1560
1560
  async function eligibleSetBondAdmin(client, params) {
1561
- const admin = await getDataVar(client, {
1561
+ const admin = await getDataVar2(client, {
1562
1562
  contract: pox5ContractId(client),
1563
1563
  varName: "bond-admin"
1564
1564
  });
@@ -1568,7 +1568,7 @@ async function eligibleSetBondAdmin(client, params) {
1568
1568
  return { ok: true };
1569
1569
  }
1570
1570
  async function eligiblePauseRewards(client, params) {
1571
- const admin = await getDataVar(client, {
1571
+ const admin = await getDataVar2(client, {
1572
1572
  contract: pox5ContractId(client),
1573
1573
  varName: "pause-admin"
1574
1574
  });
@@ -1610,7 +1610,7 @@ function pushScriptBytes(bytes) {
1610
1610
  prefix = Uint8Array.of(76, len);
1611
1611
  else
1612
1612
  prefix = Uint8Array.of(77, len & 255, len >> 8);
1613
- return concatBytes(prefix, bytes);
1613
+ return concatBytes2(prefix, bytes);
1614
1614
  }
1615
1615
  function pushCScriptNum(n) {
1616
1616
  const big = typeof n === "bigint" ? n : BigInt(n);
@@ -1621,13 +1621,13 @@ function pushCScriptNum(n) {
1621
1621
  return pushScriptBytes(serializeCScriptNum(big));
1622
1622
  }
1623
1623
  function stakerConsensusBuff(stxAddress) {
1624
- return serializeCVBytes(Cl.principal(stxAddress));
1624
+ return serializeCVBytes2(Cl2.principal(stxAddress));
1625
1625
  }
1626
1626
  function stakerPreimage(stxAddress) {
1627
1627
  return sha256(stakerConsensusBuff(stxAddress));
1628
1628
  }
1629
1629
  function toBytes3(input) {
1630
- return typeof input === "string" ? hexToBytes(input) : input;
1630
+ return typeof input === "string" ? hexToBytes2(input) : input;
1631
1631
  }
1632
1632
  function buildLockupScript(opts) {
1633
1633
  const height = BigInt(opts.unlockBurnHeight);
@@ -1638,10 +1638,10 @@ function buildLockupScript(opts) {
1638
1638
  throw new Error("unlockBurnHeight >= 500,000,000 would be read by Bitcoin as a timestamp (contract rejects it)");
1639
1639
  }
1640
1640
  const stakerHash = sha256(stakerPreimage(opts.stxAddress));
1641
- return concatBytes(Uint8Array.of(99), pushCScriptNum(height), Uint8Array.of(177, 103), hexToBytes("82012088a820"), stakerHash, Uint8Array.of(136), toBytes3(opts.earlyUnlockBytes), Uint8Array.of(104, 105), toBytes3(opts.stakerUnlockBytes));
1641
+ return concatBytes2(Uint8Array.of(99), pushCScriptNum(height), Uint8Array.of(177, 103), hexToBytes2("82012088a820"), stakerHash, Uint8Array.of(136), toBytes3(opts.earlyUnlockBytes), Uint8Array.of(104, 105), toBytes3(opts.stakerUnlockBytes));
1642
1642
  }
1643
1643
  function buildLockupOutputScript(opts) {
1644
- return concatBytes(Uint8Array.of(0, 32), sha256(buildLockupScript(opts)));
1644
+ return concatBytes2(Uint8Array.of(0, 32), sha256(buildLockupScript(opts)));
1645
1645
  }
1646
1646
  function buildLockupAddress(opts, network = "mainnet") {
1647
1647
  const hash = sha256(buildLockupScript(opts));
@@ -1658,7 +1658,7 @@ function buildDefaultStakerUnlockBytes(publicKey) {
1658
1658
  if (prefix !== 2 && prefix !== 3) {
1659
1659
  throw new Error(`Expected compressed pubkey prefix 0x02 or 0x03, got ${prefix}`);
1660
1660
  }
1661
- return concatBytes(pushScriptBytes(pubkey), Uint8Array.of(172));
1661
+ return concatBytes2(pushScriptBytes(pubkey), Uint8Array.of(172));
1662
1662
  }
1663
1663
  function buildRegisterMetadata(opts) {
1664
1664
  const unlockHeight = computeBondUnlockHeight(opts.bondIndex, opts.cycle);
@@ -1680,16 +1680,16 @@ function buildRegisterMetadata(opts) {
1680
1680
  // src/pox5/grants.ts
1681
1681
  import { secp256k1 } from "@noble/curves/secp256k1.js";
1682
1682
  function computeSignerGrantHash(opts) {
1683
- return structuredDataHash({
1684
- domain: Cl.tuple({
1685
- name: Cl.stringAscii(POX5_SIGNER_DOMAIN.name),
1686
- version: Cl.stringAscii(POX5_SIGNER_DOMAIN.version),
1687
- "chain-id": Cl.uint(opts.chainId)
1683
+ return structuredDataHash2({
1684
+ domain: Cl2.tuple({
1685
+ name: Cl2.stringAscii(POX5_SIGNER_DOMAIN.name),
1686
+ version: Cl2.stringAscii(POX5_SIGNER_DOMAIN.version),
1687
+ "chain-id": Cl2.uint(opts.chainId)
1688
1688
  }),
1689
- message: Cl.tuple({
1690
- topic: Cl.stringAscii("grant-authorization"),
1691
- "signer-manager": Cl.principal(opts.signerManager),
1692
- "auth-id": Cl.uint(opts.authId)
1689
+ message: Cl2.tuple({
1690
+ topic: Cl2.stringAscii("grant-authorization"),
1691
+ "signer-manager": Cl2.principal(opts.signerManager),
1692
+ "auth-id": Cl2.uint(opts.authId)
1693
1693
  })
1694
1694
  });
1695
1695
  }
@@ -1697,17 +1697,17 @@ async function signSignerGrant(account, opts) {
1697
1697
  const vrs = await account.sign(computeSignerGrantHash(opts));
1698
1698
  if (vrs.length !== 65)
1699
1699
  throw new Error(`Expected 65-byte recoverable signature, got ${vrs.length}`);
1700
- return bytesToHex(concatBytes(vrs.slice(1), vrs.slice(0, 1)));
1700
+ return bytesToHex2(concatBytes2(vrs.slice(1), vrs.slice(0, 1)));
1701
1701
  }
1702
1702
  function verifySignerGrant(opts) {
1703
1703
  try {
1704
- const sig = typeof opts.signature === "string" ? hexToBytes(opts.signature) : opts.signature;
1704
+ const sig = typeof opts.signature === "string" ? hexToBytes2(opts.signature) : opts.signature;
1705
1705
  if (sig.length !== 65)
1706
1706
  return false;
1707
- const pubkey = typeof opts.publicKey === "string" ? hexToBytes(opts.publicKey) : opts.publicKey;
1707
+ const pubkey = typeof opts.publicKey === "string" ? hexToBytes2(opts.publicKey) : opts.publicKey;
1708
1708
  const hash = computeSignerGrantHash(opts);
1709
1709
  const recovered = secp256k1.Signature.fromBytes(sig.slice(0, 64)).addRecoveryBit(sig[64]).recoverPublicKey(hash).toBytes(true);
1710
- return bytesToHex(recovered) === bytesToHex(pubkey);
1710
+ return bytesToHex2(recovered) === bytesToHex2(pubkey);
1711
1711
  } catch {
1712
1712
  return false;
1713
1713
  }
@@ -1716,15 +1716,15 @@ function verifySignerGrant(opts) {
1716
1716
  import { sha256 as sha2562 } from "@noble/hashes/sha2.js";
1717
1717
  var MAX_LEAF_HASHES2 = 14;
1718
1718
  function lockupScriptPubKey(lockScript) {
1719
- return concatBytes(Uint8Array.of(0, 32), sha2562(lockScript));
1719
+ return concatBytes2(Uint8Array.of(0, 32), sha2562(lockScript));
1720
1720
  }
1721
1721
  function scriptsEqual(a, b) {
1722
- return bytesToHex(a) === bytesToHex(b);
1722
+ return bytesToHex2(a) === bytesToHex2(b);
1723
1723
  }
1724
1724
  function spvProofToL1LockupOutput(opts) {
1725
1725
  const { proof, lockScript, unlockBurnHeight } = opts;
1726
- const tx = stripWitness(proof.rawTx);
1727
- const parsed = parseBitcoinTx(proof.rawTx);
1726
+ const tx = stripWitness2(proof.rawTx);
1727
+ const parsed = parseBitcoinTx2(proof.rawTx);
1728
1728
  const expected = lockupScriptPubKey(lockScript);
1729
1729
  let outputIndex = opts.vout ?? proof.vout;
1730
1730
  if (outputIndex === undefined) {
@@ -1763,7 +1763,7 @@ function spvProofToL1LockupOutput(opts) {
1763
1763
  };
1764
1764
  }
1765
1765
  async function buildPox5LockProof(opts) {
1766
- const proof = await buildTxProof(opts.source, {
1766
+ const proof = await buildTxProof2(opts.source, {
1767
1767
  txid: opts.txid,
1768
1768
  vout: opts.vout
1769
1769
  });
@@ -1796,16 +1796,16 @@ function btcNetworkFrom(network) {
1796
1796
  return REGTEST_NETWORK;
1797
1797
  }
1798
1798
  function toBytes4(value) {
1799
- return typeof value === "string" ? hexToBytes(value) : value;
1799
+ return typeof value === "string" ? hexToBytes2(value) : value;
1800
1800
  }
1801
1801
  function toPrivBytes(value) {
1802
1802
  return toBytes4(value).slice(0, 32);
1803
1803
  }
1804
1804
  function bytesEqual(a, b) {
1805
- return bytesToHex(a) === bytesToHex(b);
1805
+ return bytesToHex2(a) === bytesToHex2(b);
1806
1806
  }
1807
1807
  function scriptToWshOutput(lockScript) {
1808
- return concatBytes(Uint8Array.of(0, 32), sha2563(lockScript));
1808
+ return concatBytes2(Uint8Array.of(0, 32), sha2563(lockScript));
1809
1809
  }
1810
1810
  var SCAFFOLD_PREFIX_LEN = 10;
1811
1811
  function decodeLockScript(script) {
@@ -1829,9 +1829,9 @@ function buildReclaim(opts) {
1829
1829
  const network = btcNetworkFrom(opts.network);
1830
1830
  const lockScript = toBytes4(opts.lockScript);
1831
1831
  const { unlockHeight: scriptHeight } = decodeLockScript(lockScript);
1832
- const amount = intToBigInt(opts.utxo.value);
1832
+ const amount = intToBigInt2(opts.utxo.value);
1833
1833
  const { address } = opts.output;
1834
- const feeSats = intToBigInt(opts.output.feeSats);
1834
+ const feeSats = intToBigInt2(opts.output.feeSats);
1835
1835
  if (feeSats < 0n) {
1836
1836
  throw new Error(`buildReclaim: feeSats (${feeSats}) must be non-negative`);
1837
1837
  }
@@ -1865,7 +1865,7 @@ function buildReclaim(opts) {
1865
1865
  function computeReclaimSighash(tx, opts) {
1866
1866
  const input = tx.getInput(0);
1867
1867
  const witnessScript = opts?.witnessScript != null ? toBytes4(opts.witnessScript) : input.witnessScript;
1868
- const amount = opts?.amountSats != null ? intToBigInt(opts.amountSats) : input.witnessUtxo?.amount;
1868
+ const amount = opts?.amountSats != null ? intToBigInt2(opts.amountSats) : input.witnessUtxo?.amount;
1869
1869
  if (!witnessScript || amount == null) {
1870
1870
  throw new Error("computeReclaimSighash: need witnessScript + amount (pass `opts` for a raw-hex tx)");
1871
1871
  }
@@ -1873,7 +1873,7 @@ function computeReclaimSighash(tx, opts) {
1873
1873
  }
1874
1874
  function signReclaim(sighash, privateKey, opts) {
1875
1875
  const priv = toPrivBytes(privateKey);
1876
- return concatBytes(signECDSA(sighash, priv, opts?.lowR ?? false), Uint8Array.of(SIGHASH_ALL));
1876
+ return concatBytes2(signECDSA(sighash, priv, opts?.lowR ?? false), Uint8Array.of(SIGHASH_ALL));
1877
1877
  }
1878
1878
  function finalizeReclaim(opts) {
1879
1879
  const { tx } = opts;
@@ -1941,23 +1941,23 @@ function reclaim(opts) {
1941
1941
  // src/pox5/extension.ts
1942
1942
  async function getStakerState(client, staker) {
1943
1943
  const contract = pox5ContractId(client);
1944
- const results = await multicall(client, {
1944
+ const results = await multicall2(client, {
1945
1945
  allowFailure: false,
1946
1946
  calls: [
1947
1947
  {
1948
1948
  contract,
1949
1949
  functionName: "get-staker-info",
1950
- args: [Cl.principal(staker)]
1950
+ args: [Cl2.principal(staker)]
1951
1951
  },
1952
1952
  {
1953
1953
  contract,
1954
1954
  functionName: "get-bond-membership",
1955
- args: [Cl.principal(staker)]
1955
+ args: [Cl2.principal(staker)]
1956
1956
  },
1957
1957
  {
1958
1958
  contract,
1959
1959
  functionName: "get-staker-custodied-sbtc",
1960
- args: [Cl.principal(staker)]
1960
+ args: [Cl2.principal(staker)]
1961
1961
  },
1962
1962
  { contract, functionName: "current-pox-reward-cycle", args: [] }
1963
1963
  ]
@@ -2024,17 +2024,17 @@ function pox5() {
2024
2024
  }
2025
2025
  // src/pox5/signerCalldata.ts
2026
2026
  function buildSignerCalldata(opts) {
2027
- const repr = canonicalizeBtcAddress(typeof opts.poxAddress === "string" ? parseBtcAddress(opts.poxAddress) : opts.poxAddress);
2028
- return serializeCVBytes(Cl.tuple({
2029
- "pox-addr": Cl.tuple({
2030
- version: Cl.buffer(Uint8Array.of(repr.version)),
2031
- hashbytes: Cl.buffer(repr.hashbytes)
2027
+ const repr = canonicalizeBtcAddress(typeof opts.poxAddress === "string" ? parseBtcAddress2(opts.poxAddress) : opts.poxAddress);
2028
+ return serializeCVBytes2(Cl2.tuple({
2029
+ "pox-addr": Cl2.tuple({
2030
+ version: Cl2.buffer(Uint8Array.of(repr.version)),
2031
+ hashbytes: Cl2.buffer(repr.hashbytes)
2032
2032
  }),
2033
- "max-fee": Cl.uint(opts.maxFeeSats)
2033
+ "max-fee": Cl2.uint(opts.maxFeeSats)
2034
2034
  }));
2035
2035
  }
2036
2036
  function parseSignerCalldata(calldata) {
2037
- const cv = deserializeCVBytes(calldata);
2037
+ const cv = deserializeCVBytes2(calldata);
2038
2038
  if (cv.type !== "tuple") {
2039
2039
  throw new Error("signer calldata is not a Clarity tuple");
2040
2040
  }
@@ -2054,7 +2054,7 @@ function parseSignerCalldata(calldata) {
2054
2054
  if (!hashCv || hashCv.type !== "buffer") {
2055
2055
  throw new Error("signer calldata pox-addr missing hashbytes buffer");
2056
2056
  }
2057
- const versionBytes = hexToBytes(versionCv.value);
2057
+ const versionBytes = hexToBytes2(versionCv.value);
2058
2058
  if (versionBytes.length !== 1) {
2059
2059
  throw new Error(`signer calldata version must be buff 1, got ${versionBytes.length}`);
2060
2060
  }
@@ -2065,79 +2065,80 @@ function parseSignerCalldata(calldata) {
2065
2065
  return {
2066
2066
  poxAddress: canonicalizeBtcAddress({
2067
2067
  version,
2068
- hashbytes: hexToBytes(hashCv.value)
2068
+ hashbytes: hexToBytes2(hashCv.value)
2069
2069
  }),
2070
2070
  maxFeeSats: maxFee.value
2071
2071
  };
2072
2072
  }
2073
2073
  export {
2074
- verifySignerGrant,
2075
- stringifyBtcAddress,
2076
- stakerPreimage,
2077
- stakerConsensusBuff,
2078
- spvProofToL1LockupOutput,
2079
- signSignerGrant,
2080
- signReclaim,
2081
- serializeCScriptNum,
2082
- rewardCycleToBurnHeight,
2083
- reclaim,
2084
- pushScriptBytes,
2085
- pushCScriptNum,
2086
- pox5ContractId,
2087
- pox5,
2088
- parseSignerCalldata,
2089
- parsePox5Error,
2090
- parseBtcAddress,
2091
- isPox5Active,
2092
- isInPreparePhase,
2093
- getPoxInfo,
2094
- getPox5Activation,
2095
- finalizeReclaim,
2096
- eligibleUnstakeSbtc,
2097
- eligibleUnstake,
2098
- eligibleStake,
2099
- eligibleSetBondAdmin,
2100
- eligibleRegisterForBond,
2101
- eligiblePauseRewards,
2102
- eligibleGrantSignerKey,
2103
- eligibleClaimRewards,
2104
- distributionCycleToBurnHeight,
2105
- describePox5Error,
2106
- currentDistributionCycle,
2107
- computeSignerGrantHash,
2108
- computeReclaimSighash,
2109
- computeBondUnlockHeight,
2110
- burnHeightToRewardCycle,
2111
- burnHeightToDistributionIndex,
2112
- buildSignerCalldata,
2113
- buildRegisterMetadata,
2114
- buildReclaim,
2115
- buildPox5LockProof,
2116
- buildLockupScript,
2117
- buildLockupOutputScript,
2118
- buildLockupAddress,
2119
- buildDefaultStakerUnlockBytes,
2120
- bondUnlockCycle,
2121
- bondStatusAtHeight,
2122
- bondPhaseAtHeight,
2123
- bondPeriodToRewardCycle,
2124
- bondPeriodToBurnHeight,
2125
- assertPox5Active,
2126
- Pox5ErrorCode,
2127
- POX5_SIGNER_DOMAIN,
2128
- POX5_EVENT_TOPICS,
2129
- POX5_ERROR_NAMES,
2130
- POX5_CONTRACT_NAME,
2131
- POX5_CONTRACT_ID_MAINNET,
2132
- POX5_ACTIVATION_BURN_HEIGHT_MAINNET,
2133
- POX5_ABI,
2134
- MAX_NUM_CYCLES,
2135
- C_SCRIPT_NUM_MAX,
2136
- BtcAddress,
2137
- BOND_LENGTH_CYCLES,
2074
+ BITCOIN_LOCKTIME_THRESHOLD,
2138
2075
  BOND_GAP_CYCLES,
2139
- BITCOIN_LOCKTIME_THRESHOLD
2076
+ BOND_LENGTH_CYCLES,
2077
+ BtcAddress2 as BtcAddress,
2078
+ C_SCRIPT_NUM_MAX,
2079
+ MAINNET_PREPARE_CYCLE_LENGTH,
2080
+ MAX_NUM_CYCLES,
2081
+ POX5_ABI,
2082
+ POX5_ACTIVATION_BURN_HEIGHT_MAINNET,
2083
+ POX5_CONTRACT_ID_MAINNET,
2084
+ POX5_CONTRACT_NAME,
2085
+ POX5_ERROR_NAMES,
2086
+ POX5_EVENT_TOPICS,
2087
+ POX5_SIGNER_DOMAIN,
2088
+ Pox5ErrorCode,
2089
+ assertPox5Active,
2090
+ bondPeriodToBurnHeight,
2091
+ bondPeriodToRewardCycle,
2092
+ bondPhaseAtHeight,
2093
+ bondStatusAtHeight,
2094
+ bondUnlockCycle,
2095
+ buildDefaultStakerUnlockBytes,
2096
+ buildLockupAddress,
2097
+ buildLockupOutputScript,
2098
+ buildLockupScript,
2099
+ buildPox5LockProof,
2100
+ buildReclaim,
2101
+ buildRegisterMetadata,
2102
+ buildSignerCalldata,
2103
+ burnHeightToDistributionIndex,
2104
+ burnHeightToRewardCycle,
2105
+ computeBondUnlockHeight,
2106
+ computeReclaimSighash,
2107
+ computeSignerGrantHash,
2108
+ currentDistributionCycle,
2109
+ describePox5Error,
2110
+ distributionCycleToBurnHeight,
2111
+ eligibleClaimRewards,
2112
+ eligibleGrantSignerKey,
2113
+ eligiblePauseRewards,
2114
+ eligibleRegisterForBond,
2115
+ eligibleSetBondAdmin,
2116
+ eligibleStake,
2117
+ eligibleUnstake,
2118
+ eligibleUnstakeSbtc,
2119
+ finalizeReclaim,
2120
+ getPox5Activation,
2121
+ getPoxInfo,
2122
+ isInPreparePhase,
2123
+ isPox5Active,
2124
+ parseBtcAddress2 as parseBtcAddress,
2125
+ parsePox5Error,
2126
+ parseSignerCalldata,
2127
+ pox5,
2128
+ pox5ContractId,
2129
+ pushCScriptNum,
2130
+ pushScriptBytes,
2131
+ reclaim,
2132
+ rewardCycleToBurnHeight,
2133
+ serializeCScriptNum,
2134
+ signReclaim,
2135
+ signSignerGrant,
2136
+ spvProofToL1LockupOutput,
2137
+ stakerConsensusBuff,
2138
+ stakerPreimage,
2139
+ stringifyBtcAddress2 as stringifyBtcAddress,
2140
+ verifySignerGrant
2140
2141
  };
2141
2142
 
2142
- //# debugId=C098453496026E0064756E2164756E21
2143
+ //# debugId=ACA0F7197C35CC4B64756E2164756E21
2143
2144
  //# sourceMappingURL=index.js.map