@btc-vision/bitcoin 7.0.0-alpha.9 → 7.0.0-beta.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 (202) hide show
  1. package/README.md +22 -0
  2. package/benchmark-compare/BENCHMARK.md +144 -0
  3. package/benchmark-compare/compare.bench.ts +1024 -0
  4. package/benchmark-compare/harness.ts +220 -0
  5. package/benchmark-compare/package.json +18 -0
  6. package/browser/address.d.ts.map +1 -1
  7. package/browser/block.d.ts.map +1 -1
  8. package/browser/chunks/{psbt-parallel-BBFlkmiv.js → psbt-parallel-B-dfm5GZ.js} +2430 -2523
  9. package/browser/crypto-hashes.d.ts +4 -0
  10. package/browser/crypto-hashes.d.ts.map +1 -0
  11. package/browser/crypto-hashes.native.d.ts +4 -0
  12. package/browser/crypto-hashes.native.d.ts.map +1 -0
  13. package/browser/crypto.d.ts.map +1 -1
  14. package/browser/index.d.ts +2 -2
  15. package/browser/index.d.ts.map +1 -1
  16. package/browser/index.js +571 -547
  17. package/browser/io/base58check.d.ts +26 -0
  18. package/browser/io/base58check.d.ts.map +1 -0
  19. package/browser/io/base64.d.ts +8 -0
  20. package/browser/io/base64.d.ts.map +1 -1
  21. package/browser/io/index.d.ts +2 -1
  22. package/browser/io/index.d.ts.map +1 -1
  23. package/browser/io/utils.d.ts.map +1 -1
  24. package/browser/payments/bip341.d.ts.map +1 -1
  25. package/browser/payments/p2op.d.ts.map +1 -1
  26. package/browser/payments/p2pkh.d.ts.map +1 -1
  27. package/browser/payments/p2sh.d.ts.map +1 -1
  28. package/browser/payments/p2tr.d.ts.map +1 -1
  29. package/browser/payments/p2wpkh.d.ts.map +1 -1
  30. package/browser/psbt/PsbtCache.d.ts.map +1 -1
  31. package/browser/psbt/PsbtSigner.d.ts.map +1 -1
  32. package/browser/psbt/PsbtTransaction.d.ts +2 -2
  33. package/browser/psbt/PsbtTransaction.d.ts.map +1 -1
  34. package/browser/psbt/bip371.d.ts.map +1 -1
  35. package/browser/psbt.d.ts +1 -1
  36. package/browser/psbt.d.ts.map +1 -1
  37. package/browser/react-native-quick-crypto.d.ts +11 -0
  38. package/browser/script.d.ts.map +1 -1
  39. package/browser/transaction.d.ts.map +1 -1
  40. package/browser/workers/WorkerSigningPool.node.d.ts.map +1 -1
  41. package/browser/workers/WorkerSigningPool.sequential.d.ts.map +1 -1
  42. package/browser/workers/index.js +5 -5
  43. package/build/address.d.ts.map +1 -1
  44. package/build/address.js +19 -12
  45. package/build/address.js.map +1 -1
  46. package/build/bip66.js +4 -4
  47. package/build/bip66.js.map +1 -1
  48. package/build/block.d.ts.map +1 -1
  49. package/build/block.js +9 -2
  50. package/build/block.js.map +1 -1
  51. package/build/crypto-hashes.d.ts +4 -0
  52. package/build/crypto-hashes.d.ts.map +1 -0
  53. package/build/crypto-hashes.js +4 -0
  54. package/build/crypto-hashes.js.map +1 -0
  55. package/build/crypto-hashes.native.d.ts +4 -0
  56. package/build/crypto-hashes.native.d.ts.map +1 -0
  57. package/build/crypto-hashes.native.js +15 -0
  58. package/build/crypto-hashes.native.js.map +1 -0
  59. package/build/crypto.d.ts.map +1 -1
  60. package/build/crypto.js +1 -2
  61. package/build/crypto.js.map +1 -1
  62. package/build/env.js.map +1 -1
  63. package/build/index.d.ts +2 -2
  64. package/build/index.d.ts.map +1 -1
  65. package/build/index.js +1 -1
  66. package/build/index.js.map +1 -1
  67. package/build/io/BinaryReader.js +1 -1
  68. package/build/io/BinaryReader.js.map +1 -1
  69. package/build/io/base58check.d.ts +26 -0
  70. package/build/io/base58check.d.ts.map +1 -0
  71. package/build/io/base58check.js +32 -0
  72. package/build/io/base58check.js.map +1 -0
  73. package/build/io/base64.d.ts +8 -0
  74. package/build/io/base64.d.ts.map +1 -1
  75. package/build/io/base64.js +14 -0
  76. package/build/io/base64.js.map +1 -1
  77. package/build/io/hex.js +1 -1
  78. package/build/io/hex.js.map +1 -1
  79. package/build/io/index.d.ts +2 -1
  80. package/build/io/index.d.ts.map +1 -1
  81. package/build/io/index.js +4 -2
  82. package/build/io/index.js.map +1 -1
  83. package/build/io/utils.d.ts.map +1 -1
  84. package/build/io/utils.js +3 -4
  85. package/build/io/utils.js.map +1 -1
  86. package/build/merkle.js.map +1 -1
  87. package/build/payments/bip341.d.ts.map +1 -1
  88. package/build/payments/bip341.js +4 -3
  89. package/build/payments/bip341.js.map +1 -1
  90. package/build/payments/p2op.d.ts.map +1 -1
  91. package/build/payments/p2op.js +6 -4
  92. package/build/payments/p2op.js.map +1 -1
  93. package/build/payments/p2pkh.d.ts.map +1 -1
  94. package/build/payments/p2pkh.js +3 -4
  95. package/build/payments/p2pkh.js.map +1 -1
  96. package/build/payments/p2sh.d.ts.map +1 -1
  97. package/build/payments/p2sh.js +3 -4
  98. package/build/payments/p2sh.js.map +1 -1
  99. package/build/payments/p2tr.d.ts.map +1 -1
  100. package/build/payments/p2tr.js +13 -6
  101. package/build/payments/p2tr.js.map +1 -1
  102. package/build/payments/p2wpkh.d.ts.map +1 -1
  103. package/build/payments/p2wpkh.js +7 -5
  104. package/build/payments/p2wpkh.js.map +1 -1
  105. package/build/payments/p2wsh.js.map +1 -1
  106. package/build/psbt/PsbtCache.d.ts.map +1 -1
  107. package/build/psbt/PsbtCache.js +8 -4
  108. package/build/psbt/PsbtCache.js.map +1 -1
  109. package/build/psbt/PsbtFinalizer.js +14 -8
  110. package/build/psbt/PsbtFinalizer.js.map +1 -1
  111. package/build/psbt/PsbtSigner.d.ts.map +1 -1
  112. package/build/psbt/PsbtSigner.js +3 -2
  113. package/build/psbt/PsbtSigner.js.map +1 -1
  114. package/build/psbt/PsbtTransaction.d.ts +2 -2
  115. package/build/psbt/PsbtTransaction.d.ts.map +1 -1
  116. package/build/psbt/PsbtTransaction.js.map +1 -1
  117. package/build/psbt/bip371.d.ts.map +1 -1
  118. package/build/psbt/bip371.js +4 -3
  119. package/build/psbt/bip371.js.map +1 -1
  120. package/build/psbt/utils.js.map +1 -1
  121. package/build/psbt.d.ts +1 -1
  122. package/build/psbt.d.ts.map +1 -1
  123. package/build/psbt.js.map +1 -1
  124. package/build/push_data.js +1 -1
  125. package/build/push_data.js.map +1 -1
  126. package/build/script.d.ts.map +1 -1
  127. package/build/script.js +4 -3
  128. package/build/script.js.map +1 -1
  129. package/build/script_number.js +1 -1
  130. package/build/script_number.js.map +1 -1
  131. package/build/script_signature.js.map +1 -1
  132. package/build/transaction.d.ts.map +1 -1
  133. package/build/transaction.js +2 -1
  134. package/build/transaction.js.map +1 -1
  135. package/build/tsconfig.build.tsbuildinfo +1 -1
  136. package/build/types.js.map +1 -1
  137. package/build/workers/WorkerSigningPool.js.map +1 -1
  138. package/build/workers/WorkerSigningPool.node.d.ts.map +1 -1
  139. package/build/workers/WorkerSigningPool.node.js +25 -3
  140. package/build/workers/WorkerSigningPool.node.js.map +1 -1
  141. package/build/workers/WorkerSigningPool.sequential.d.ts.map +1 -1
  142. package/build/workers/WorkerSigningPool.sequential.js +2 -0
  143. package/build/workers/WorkerSigningPool.sequential.js.map +1 -1
  144. package/build/workers/psbt-parallel.js.map +1 -1
  145. package/package.json +7 -5
  146. package/src/address.ts +18 -13
  147. package/src/bip66.ts +18 -18
  148. package/src/block.ts +7 -2
  149. package/src/crypto-hashes.native.ts +18 -0
  150. package/src/crypto-hashes.ts +3 -0
  151. package/src/crypto.ts +1 -2
  152. package/src/env.ts +6 -6
  153. package/src/index.ts +3 -0
  154. package/src/io/BinaryReader.ts +1 -1
  155. package/src/io/base58check.ts +35 -0
  156. package/src/io/base64.ts +15 -0
  157. package/src/io/hex.ts +1 -1
  158. package/src/io/index.ts +5 -2
  159. package/src/io/utils.ts +6 -7
  160. package/src/merkle.ts +3 -3
  161. package/src/payments/bip341.ts +5 -4
  162. package/src/payments/p2op.ts +6 -4
  163. package/src/payments/p2pkh.ts +4 -5
  164. package/src/payments/p2sh.ts +4 -5
  165. package/src/payments/p2tr.ts +18 -11
  166. package/src/payments/p2wpkh.ts +7 -5
  167. package/src/payments/p2wsh.ts +1 -1
  168. package/src/psbt/PsbtCache.ts +14 -11
  169. package/src/psbt/PsbtFinalizer.ts +14 -8
  170. package/src/psbt/PsbtSigner.ts +4 -3
  171. package/src/psbt/PsbtTransaction.ts +2 -2
  172. package/src/psbt/bip371.ts +4 -3
  173. package/src/psbt/utils.ts +1 -1
  174. package/src/psbt.ts +10 -8
  175. package/src/push_data.ts +5 -5
  176. package/src/react-native-quick-crypto.d.ts +11 -0
  177. package/src/script.ts +5 -4
  178. package/src/script_number.ts +6 -6
  179. package/src/script_signature.ts +2 -2
  180. package/src/transaction.ts +14 -13
  181. package/src/types.ts +1 -1
  182. package/src/workers/WorkerSigningPool.node.ts +28 -4
  183. package/src/workers/WorkerSigningPool.sequential.ts +2 -1
  184. package/src/workers/WorkerSigningPool.ts +3 -3
  185. package/src/workers/psbt-parallel.ts +2 -2
  186. package/test/address.spec.ts +1 -0
  187. package/test/bitcoin.core.spec.ts +9 -2
  188. package/test/browser/psbt.spec.ts +54 -29
  189. package/test/browser/workers-signing.spec.ts +8 -8
  190. package/test/crypto.spec.ts +1 -1
  191. package/test/env.spec.ts +2 -2
  192. package/test/integration/_regtest.ts +2 -2
  193. package/test/integration/blocks.spec.ts +1 -1
  194. package/test/integration/csv.spec.ts +1 -1
  195. package/test/integration/payments.spec.ts +2 -2
  196. package/test/integration/taproot.spec.ts +3 -3
  197. package/test/integration/transactions.spec.ts +6 -5
  198. package/test/psbt.spec.ts +49 -25
  199. package/test/transaction.spec.ts +6 -3
  200. package/test/workers-pool.spec.ts +5 -5
  201. package/test/workers-signing.spec.ts +8 -8
  202. package/test/workers.spec.ts +3 -3
package/browser/index.js CHANGED
@@ -1,58 +1,69 @@
1
- import { b as he, d as O, t as Le, i as Me, a as De, c as le, o as M, e as G, p as dt, f as gt, g as fe, h as Ft, j as Ge, k as yt, l as Ve, m as Bt, n as pe, q as de, P as Ht, r as D, s as ze, L as je, M as Xe, u as Ye, v as qe, w as Ze, x as Je, y as Qe, z as tn, A as en, B as nn, C as rn, D as wt, E as ge, F as sn, G as ye, H as on, I as an, J as cn, K as St, N as At, O as k, Q as V, R as B, S as st, T as un, U as It, V as b, W as Y, X as z, Y as H, Z as hn, _ as ln, $ as et, a0 as it, a1 as Et, a2 as we, a3 as zt, a4 as fn, a5 as pn, a6 as dn, a7 as gn, a8 as yn, a9 as wn, aa as nt, ab as rt, ac as jt, ad as Xt, ae as Yt, af as qt, ag as Q, ah as Sn, ai as En, aj as mn, ak as bn } from "./chunks/psbt-parallel-BBFlkmiv.js";
2
- import { al as ei, am as ni, an as ri, ao as si, ap as ii, aq as oi, ar as ai, as as ci, at as ui, au as hi, av as li, aw as fi, ax as pi, ay as di, az as gi, aA as yi, aB as wi, aC as Si, aD as Ei, aE as mi, aF as bi, aG as Ti, aH as Ai, aI as Ii, aJ as ki, aK as vi, aL as xi, aM as _i, aN as Ui, aO as Pi, aP as Ni, aQ as Hi, aR as Oi, aS as Ri, aT as Ki, aU as Ci, aV as Fi, aW as Bi, aX as Wi, aY as $i, aZ as Li, a_ as Mi, a$ as Di, b0 as Gi, b1 as Vi, b2 as zi, b3 as ji, b4 as Xi, b5 as Yi } from "./chunks/psbt-parallel-BBFlkmiv.js";
3
- function Tn(e) {
1
+ import { d as $e, a as O, t as Le, i as Me, b as De, c as he, e as Ge, o as M, f as G, p as dt, g as gt, h as le, j as Ft, k as Ve, l as yt, m as ze, n as Bt, q as fe, r as pe, P as Ht, s as D, u as je, L as Xe, M as Ye, v as qe, w as Ze, x as Je, y as Qe, z as tn, A as en, B as nn, C as rn, D as sn, E as wt, F as de, G as on, H as ge, I as an, J as cn, K as un, N as St, O as At, Q as k, R as V, S as B, T as st, U as hn, V as It, W as b, X as Y, Y as z, Z as H, _ as ln, $ as fn, a0 as et, a1 as it, a2 as Et, a3 as ye, a4 as zt, a5 as pn, a6 as dn, a7 as gn, a8 as yn, a9 as wn, aa as Sn, ab as nt, ac as rt, ad as jt, ae as Xt, af as Yt, ag as qt, ah as Q, ai as En, aj as mn, ak as bn, al as Tn } from "./chunks/psbt-parallel-B-dfm5GZ.js";
2
+ import { am as ri, an as si, ao as ii, ap as oi, aq as ai, ar as ci, as as ui, at as hi, au as li, av as fi, aw as pi, ax as di, ay as gi, az as yi, aA as wi, aB as Si, aC as Ei, aD as mi, aE as bi, aF as Ti, aG as Ai, aH as Ii, aI as ki, aJ as vi, aK as xi, aL as _i, aM as Ui, aN as Pi, aO as Ni, aP as Hi, aQ as Oi, aR as Ri, aS as Ki, aT as Ci, aU as Fi, aV as Bi, aW as Wi, aX as $i, aY as Li, aZ as Mi, a_ as Di, a$ as Gi, b0 as Vi, b1 as zi, b2 as ji, b3 as Xi, b4 as Yi, b5 as qi, b6 as Zi } from "./chunks/psbt-parallel-B-dfm5GZ.js";
3
+ function An(e) {
4
4
  const t = atob(e), n = new Uint8Array(t.length);
5
5
  for (let r = 0; r < t.length; r++)
6
6
  n[r] = t.charCodeAt(r);
7
7
  return n;
8
8
  }
9
- const q = 40, Z = 2, J = 15, Se = 16, ot = 16, mt = 2, bt = 80, An = "WARNING: Sending to a future segwit version address can lead to loss of funds. End users MUST be warned carefully in the GUI and asked if they wish to proceed with caution. Wallets should verify the segwit version from the output of fromBech32, then decide when it is safe to use which version of segwit.", Ee = (e) => {
9
+ function qs(e) {
10
+ let t = "";
11
+ for (let n = 0; n < e.length; n++)
12
+ t += String.fromCharCode(e[n]);
13
+ return btoa(t);
14
+ }
15
+ const q = 40, Z = 2, J = 15, we = 16, ot = 16, mt = 2, bt = 80, In = "WARNING: Sending to a future segwit version address can lead to loss of funds. End users MUST be warned carefully in the GUI and asked if they wish to proceed with caution. Wallets should verify the segwit version from the output of fromBech32, then decide when it is safe to use which version of segwit.", Se = (e) => {
10
16
  try {
11
17
  const t = e.subarray(2);
12
18
  if (t.length < Z || t.length > q)
13
19
  throw new TypeError("Invalid program length for segwit address");
14
- const n = e[0] - bt;
15
- if (n < mt || n > J + 1)
20
+ const n = e[0];
21
+ if (n === void 0) throw new TypeError("Empty output");
22
+ const r = n - bt;
23
+ if (r < mt || r > J + 1)
16
24
  throw new TypeError("Invalid version for segwit address");
17
- if (n === 1) throw new TypeError("taproot");
25
+ if (r === 1) throw new TypeError("taproot");
18
26
  return !0;
19
27
  } catch {
20
28
  }
21
29
  return !1;
22
30
  };
23
- function me(e, t) {
31
+ function Ee(e, t) {
24
32
  if (!(e instanceof Uint8Array)) throw new TypeError("output must be a Uint8Array");
25
33
  if (!t.bech32Opnet) throw new Error("Network does not support opnet");
26
34
  const n = e[0];
27
35
  let r = 1, s;
28
- if (e[1] < 76)
29
- s = e[1], r = 2;
30
- else if (e[1] === 76)
31
- s = e[2], r = 3;
36
+ const i = e[1], o = e[2];
37
+ if (i !== void 0 && i < 76)
38
+ s = i, r = 2;
39
+ else if (i === 76 && o !== void 0)
40
+ s = o, r = 3;
32
41
  else
33
42
  throw new TypeError("Unsupported push opcode in script");
34
- const i = e.subarray(r, r + s);
35
- if (i.length < Z || i.length > q)
43
+ const a = e.subarray(r, r + s);
44
+ if (a.length < Z || a.length > q)
36
45
  throw new TypeError("Invalid program length for segwit address");
37
- const o = n === M.OP_0 ? 0 : n >= M.OP_1 && n <= M.OP_16 ? n - (M.OP_1 - 1) : -1;
38
- if (o < J || o > Se)
39
- throw new TypeError(`Invalid segwit version ${o}`);
40
- const a = [o, ...O.bech32m.toWords(i)];
41
- return O.bech32m.encode(t.bech32Opnet, a);
46
+ const u = n === M.OP_0 ? 0 : n !== void 0 && n >= M.OP_1 && n <= M.OP_16 ? n - (M.OP_1 - 1) : -1;
47
+ if (u < J || u > we)
48
+ throw new TypeError(`Invalid segwit version ${u}`);
49
+ const l = [u, ...O.bech32m.toWords(a)];
50
+ return O.bech32m.encode(t.bech32Opnet, l);
42
51
  }
43
- function be(e, t) {
52
+ function me(e, t) {
44
53
  const n = e.subarray(2);
45
54
  if (n.length < Z || n.length > q)
46
55
  throw new TypeError("Invalid program length for segwit address");
47
- const r = e[0] - bt;
48
- if (r < mt || r > J)
56
+ const r = e[0];
57
+ if (r === void 0) throw new TypeError("Empty output");
58
+ const s = r - bt;
59
+ if (s < mt || s > J)
49
60
  throw new TypeError("Invalid version for segwit address");
50
61
  if (e[1] !== n.length)
51
62
  throw new TypeError(`Invalid script for segwit address ${e[1]} !== ${n.length}`);
52
- return at(n, r, t.bech32, t.bech32Opnet);
63
+ return at(n, s, t.bech32, t.bech32Opnet);
53
64
  }
54
- function Te(e) {
55
- const t = new Uint8Array(he.decode(e));
65
+ function be(e) {
66
+ const t = new Uint8Array($e(e));
56
67
  if (t.length < 21) throw new TypeError(e + " is too short");
57
68
  if (t.length > 21) throw new TypeError(e + " is too long");
58
69
  const n = t[0], r = t.subarray(1);
@@ -61,14 +72,14 @@ function Te(e) {
61
72
  function Ot(e, t) {
62
73
  if (!Me(e)) throw new TypeError("Expected 20 bytes hash");
63
74
  if (!De(t)) throw new TypeError("Expected UInt8 version");
64
- const n = le(21);
65
- return n[0] = t, n.set(e, 1), he.encode(n);
75
+ const n = he(21);
76
+ return n[0] = t, n.set(e, 1), Ge(n);
66
77
  }
67
78
  function at(e, t, n, r) {
68
79
  const s = O.bech32.toWords(e);
69
80
  return s.unshift(t), t === ot && r ? O.bech32m.encode(r, s) : t === 0 ? O.bech32.encode(n, s) : O.bech32m.encode(n, s);
70
81
  }
71
- function Ae(e, t) {
82
+ function Te(e, t) {
72
83
  t = t || G;
73
84
  const n = e.length;
74
85
  if (n === 25 && e[0] === 118 && e[1] === 169 && e[2] === 20 && e[23] === 136 && e[24] === 172)
@@ -84,21 +95,21 @@ function Ae(e, t) {
84
95
  return r.unshift(1), O.bech32m.encode(t.bech32, r);
85
96
  }
86
97
  try {
87
- return me(e, t);
98
+ return Ee(e, t);
88
99
  } catch {
89
100
  }
90
101
  try {
91
- return be(e, t);
102
+ return me(e, t);
92
103
  } catch {
93
104
  }
94
105
  throw new Error(Le(e) + " has no matching Address");
95
106
  }
96
- function Ie(e, t) {
107
+ function Ae(e, t) {
97
108
  let n, r;
98
109
  t && "bech32" in t ? n = t : t && typeof t == "object" ? (n = t.network || G, r = t.onFutureSegwitWarning) : n = G;
99
110
  let s, i;
100
111
  try {
101
- s = Te(e);
112
+ s = be(e);
102
113
  } catch {
103
114
  }
104
115
  if (s) {
@@ -108,7 +119,7 @@ function Ie(e, t) {
108
119
  return gt({ hash: s.hash }).output;
109
120
  } else {
110
121
  try {
111
- i = fe(e);
122
+ i = le(e);
112
123
  } catch {
113
124
  }
114
125
  if (i) {
@@ -116,20 +127,20 @@ function Ie(e, t) {
116
127
  throw new Error(e + " has an invalid prefix");
117
128
  if (i.version === 0) {
118
129
  if (i.data.length === 20)
119
- return Ft({ hash: Ge(i.data) }).output;
130
+ return Ft({ hash: Ve(i.data) }).output;
120
131
  if (i.data.length === 32)
121
- return yt({ hash: Ve(i.data) }).output;
132
+ return yt({ hash: ze(i.data) }).output;
122
133
  } else if (i.version === 1) {
123
134
  if (i.data.length === 32)
124
135
  return Bt({ pubkey: i.data }).output;
125
136
  } else if (i.version === ot) {
126
137
  if (!n.bech32Opnet) throw new Error(e + " has an invalid prefix");
127
- return pe({
138
+ return fe({
128
139
  program: i.data,
129
140
  network: n
130
141
  }).output;
131
142
  } else if (i.version >= mt && i.version <= J && i.data.length >= Z && i.data.length <= q)
132
- return i.version !== ot && r && r(An), de([
143
+ return i.version !== ot && r && r(In), pe([
133
144
  i.version + bt,
134
145
  i.data
135
146
  ]);
@@ -137,24 +148,24 @@ function Ie(e, t) {
137
148
  }
138
149
  throw new TypeError(e + " has no matching Script");
139
150
  }
140
- const In = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
151
+ const kn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
141
152
  __proto__: null,
142
- FUTURE_MAX_VERSION: Se,
153
+ FUTURE_MAX_VERSION: we,
143
154
  FUTURE_OPNET_VERSION: ot,
144
155
  FUTURE_SEGWIT_MAX_SIZE: q,
145
156
  FUTURE_SEGWIT_MAX_VERSION: J,
146
157
  FUTURE_SEGWIT_MIN_SIZE: Z,
147
158
  FUTURE_SEGWIT_MIN_VERSION: mt,
148
159
  FUTURE_SEGWIT_VERSION_DIFF: bt,
149
- _toFutureSegwitAddress: be,
150
- fromBase58Check: Te,
151
- fromBech32: fe,
152
- fromOutputScript: Ae,
153
- isUnknownSegwitVersion: Ee,
160
+ _toFutureSegwitAddress: me,
161
+ fromBase58Check: be,
162
+ fromBech32: le,
163
+ fromOutputScript: Te,
164
+ isUnknownSegwitVersion: Se,
154
165
  toBase58Check: Ot,
155
166
  toBech32: at,
156
- toFutureOPNetAddress: me,
157
- toOutputScript: Ie
167
+ toFutureOPNetAddress: Ee,
168
+ toOutputScript: Ae
158
169
  }, Symbol.toStringTag, { value: "Module" })), Zt = M;
159
170
  class j {
160
171
  // Static public fields
@@ -270,7 +281,7 @@ class j {
270
281
  if (this.#n)
271
282
  return this.#n;
272
283
  if (this.#s)
273
- return de([Zt.OP_RETURN].concat(this.#s));
284
+ return pe([Zt.OP_RETURN].concat(this.#s));
274
285
  }
275
286
  #h() {
276
287
  if (this.#n) {
@@ -281,12 +292,12 @@ class j {
281
292
  throw new TypeError("Output is invalid");
282
293
  if (!t.slice(1).every((n) => n instanceof Uint8Array))
283
294
  throw new TypeError("Output is invalid");
284
- if (this.#s && !ze(this.#s, this.data))
295
+ if (this.#s && !je(this.#s, this.data))
285
296
  throw new TypeError("Data mismatch");
286
297
  }
287
298
  }
288
299
  }
289
- function kn(e, t) {
300
+ function vn(e, t) {
290
301
  if (!e.data && !e.output)
291
302
  throw new TypeError("Not enough data");
292
303
  const n = new j(
@@ -299,81 +310,81 @@ function kn(e, t) {
299
310
  );
300
311
  return Object.assign(n.toPayment(), e);
301
312
  }
302
- const vn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
313
+ const xn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
303
314
  __proto__: null,
304
315
  Embed: j,
305
- LEAF_VERSION_TAPSCRIPT: je,
306
- MAX_TAPTREE_DEPTH: Xe,
307
- P2MS: Ye,
308
- P2OP: qe,
309
- P2PK: Ze,
310
- P2PKH: Je,
311
- P2SH: Qe,
312
- P2TR: tn,
313
- P2WPKH: en,
314
- P2WSH: nn,
316
+ LEAF_VERSION_TAPSCRIPT: Xe,
317
+ MAX_TAPTREE_DEPTH: Ye,
318
+ P2MS: qe,
319
+ P2OP: Ze,
320
+ P2PK: Je,
321
+ P2PKH: Qe,
322
+ P2SH: tn,
323
+ P2TR: en,
324
+ P2WPKH: nn,
325
+ P2WSH: rn,
315
326
  PaymentType: Ht,
316
- findScriptPath: rn,
317
- p2data: kn,
327
+ findScriptPath: sn,
328
+ p2data: vn,
318
329
  p2ms: wt,
319
- p2op: pe,
320
- p2pk: ge,
330
+ p2op: fe,
331
+ p2pk: de,
321
332
  p2pkh: dt,
322
333
  p2sh: gt,
323
334
  p2tr: Bt,
324
335
  p2wpkh: Ft,
325
336
  p2wsh: yt,
326
- rootHashFromPath: sn,
327
- tapleafHash: ye,
328
- toHashTree: on,
329
- tweakKey: an
337
+ rootHashFromPath: on,
338
+ tapleafHash: ge,
339
+ toHashTree: an,
340
+ tweakKey: cn
330
341
  }, Symbol.toStringTag, { value: "Module" }));
331
342
  class v extends Error {
332
343
  constructor(t) {
333
344
  super(t), this.name = "BitcoinError", Error.captureStackTrace && Error.captureStackTrace(this, v);
334
345
  }
335
346
  }
336
- class xn extends v {
347
+ class _n extends v {
337
348
  constructor(t) {
338
349
  super(t), this.name = "ValidationError";
339
350
  }
340
351
  }
341
- class _n extends v {
352
+ class Un extends v {
342
353
  constructor(t) {
343
354
  super(t), this.name = "InvalidInputError";
344
355
  }
345
356
  }
346
- class Un extends v {
357
+ class Pn extends v {
347
358
  constructor(t) {
348
359
  super(t), this.name = "InvalidOutputError";
349
360
  }
350
361
  }
351
- class Pn extends v {
362
+ class Nn extends v {
352
363
  constructor(t) {
353
364
  super(t), this.name = "ScriptError";
354
365
  }
355
366
  }
356
- class Nn extends v {
367
+ class Hn extends v {
357
368
  constructor(t) {
358
369
  super(t), this.name = "PsbtError";
359
370
  }
360
371
  }
361
- class Hn extends v {
372
+ class On extends v {
362
373
  constructor(t) {
363
374
  super(t), this.name = "EccError";
364
375
  }
365
376
  }
366
- class On extends v {
377
+ class Rn extends v {
367
378
  constructor(t) {
368
379
  super(t), this.name = "AddressError";
369
380
  }
370
381
  }
371
- class Rn extends v {
382
+ class Kn extends v {
372
383
  constructor(t) {
373
384
  super(t), this.name = "SignatureError";
374
385
  }
375
386
  }
376
- function Kn(e, t) {
387
+ function Cn(e, t) {
377
388
  if (!Array.isArray(e)) throw TypeError("Expected values Array");
378
389
  if (typeof t != "function") throw TypeError("Expected digest Function");
379
390
  let n = e.length;
@@ -388,7 +399,7 @@ function Kn(e, t) {
388
399
  }
389
400
  return r[0];
390
401
  }
391
- const kt = new TypeError("Cannot compute merkle root for zero transactions"), vt = new TypeError("Cannot compute witness commit for non-segwit block"), Cn = St("6a24aa21a9ed");
402
+ const kt = new TypeError("Cannot compute merkle root for zero transactions"), vt = new TypeError("Cannot compute witness commit for non-segwit block"), Fn = St("6a24aa21a9ed");
392
403
  class F {
393
404
  /** Block version number */
394
405
  version = 1;
@@ -414,7 +425,7 @@ class F {
414
425
  */
415
426
  static fromBuffer(t) {
416
427
  if (t.length < 80) throw new Error("Buffer too small (< 80 bytes)");
417
- const n = new cn(t), r = new F();
428
+ const n = new un(t), r = new F();
418
429
  if (r.version = n.readInt32LE(), r.prevHash = n.readBytes(32), r.merkleRoot = n.readBytes(32), r.timestamp = n.readUInt32LE(), r.bits = n.readUInt32LE(), r.nonce = n.readUInt32LE(), t.length === 80) return r;
419
430
  const s = () => {
420
431
  const a = b.fromBuffer(n.data.subarray(n.offset), !0);
@@ -442,7 +453,7 @@ class F {
442
453
  * @returns 32-byte target threshold
443
454
  */
444
455
  static calculateTarget(t) {
445
- const n = ((t & 4278190080) >> 24) - 3, r = t & 8388607, s = le(32), i = 29 - n;
456
+ const n = ((t & 4278190080) >> 24) - 3, r = t & 8388607, s = he(32), i = 29 - n;
446
457
  return s[i] = r >> 16 & 255, s[i + 1] = r >> 8 & 255, s[i + 2] = r & 255, s;
447
458
  }
448
459
  /**
@@ -457,10 +468,12 @@ class F {
457
468
  throw new TypeError("Expected an array of transactions");
458
469
  if (t.length === 0) throw kt;
459
470
  if (n && !Jt(t)) throw vt;
460
- const r = t.map((i) => i.getHash(n)), s = Kn(r, At);
471
+ const r = t.map((i) => i.getHash(n)), s = Cn(r, At);
461
472
  if (n) {
462
- const i = t[0].ins[0].witness[0], o = new Uint8Array(s.length + i.length);
463
- return o.set(s), o.set(i, s.length), At(o);
473
+ const a = t[0]?.ins[0]?.witness[0];
474
+ if (!a) throw new TypeError("Missing witness in coinbase");
475
+ const u = new Uint8Array(s.length + a.length);
476
+ return u.set(s), u.set(a, s.length), At(u);
464
477
  }
465
478
  return s;
466
479
  }
@@ -470,12 +483,14 @@ class F {
470
483
  */
471
484
  getWitnessCommit() {
472
485
  if (!this.transactions || !Jt(this.transactions)) return null;
473
- const t = this.transactions[0].outs.filter(
474
- (r) => k(r.script.subarray(0, 6), Cn)
475
- ).map((r) => r.script.subarray(6, 38));
476
- if (t.length === 0) return null;
477
- const n = t[t.length - 1];
478
- return n instanceof Uint8Array && n.length === 32 ? n : null;
486
+ const t = this.transactions[0];
487
+ if (!t) return null;
488
+ const n = t.outs.filter(
489
+ (s) => k(s.script.subarray(0, 6), Fn)
490
+ ).map((s) => s.script.subarray(6, 38));
491
+ if (n.length === 0) return null;
492
+ const r = n[n.length - 1];
493
+ return r instanceof Uint8Array && r.length === 32 ? r : null;
479
494
  }
480
495
  /**
481
496
  * Checks if this block has a witness commitment.
@@ -489,7 +504,7 @@ class F {
489
504
  * @returns True if any transaction has witness data
490
505
  */
491
506
  hasWitness() {
492
- return this.transactions ? Fn(this.transactions) : !1;
507
+ return this.transactions ? Bn(this.transactions) : !1;
493
508
  }
494
509
  /**
495
510
  * Calculates the weight of this block.
@@ -539,7 +554,7 @@ class F {
539
554
  toBuffer(t) {
540
555
  if (!this.prevHash) throw new TypeError("Block prevHash is required");
541
556
  if (!this.merkleRoot) throw new TypeError("Block merkleRoot is required");
542
- const n = new Uint8Array(this.byteLength(t)), r = new un(n);
557
+ const n = new Uint8Array(this.byteLength(t)), r = new hn(n);
543
558
  return r.writeInt32LE(this.version), r.writeBytes(this.prevHash), r.writeBytes(this.merkleRoot), r.writeUInt32LE(this.timestamp), r.writeUInt32LE(this.bits), r.writeUInt32LE(this.nonce), t || !this.transactions || (r.writeVarInt(this.transactions.length), this.transactions.forEach((s) => {
544
559
  const i = s.byteLength();
545
560
  s.toBuffer(n.subarray(r.offset)), r.offset += i;
@@ -586,7 +601,7 @@ function Jt(e) {
586
601
  const t = e[0];
587
602
  return t?.ins?.[0]?.witness ? t.ins[0].witness.length > 0 : !1;
588
603
  }
589
- function Fn(e) {
604
+ function Bn(e) {
590
605
  return e.some(
591
606
  (t) => t.ins?.some((n) => n.witness && n.witness.length > 0)
592
607
  );
@@ -606,12 +621,12 @@ var E;
606
621
  const ct = "0123456789abcdefABCDEF", ut = ct.split("").map((e) => e.codePointAt(0)), ht = Array(256).fill(!0).map((e, t) => {
607
622
  const n = String.fromCodePoint(t), r = ct.indexOf(n);
608
623
  return r < 0 ? void 0 : r < 16 ? r : r - 6;
609
- }), ke = new TextEncoder(), ve = new TextDecoder();
610
- function Bn(e) {
611
- return ve.decode(e);
612
- }
624
+ }), Ie = new TextEncoder(), ke = new TextDecoder();
613
625
  function Wn(e) {
614
- return ke.encode(e);
626
+ return ke.decode(e);
627
+ }
628
+ function $n(e) {
629
+ return Ie.encode(e);
615
630
  }
616
631
  function U(e) {
617
632
  const t = e.reduce((s, i) => s + i.length, 0), n = new Uint8Array(t);
@@ -622,22 +637,22 @@ function U(e) {
622
637
  }
623
638
  function d(e) {
624
639
  const t = e || new Uint8Array();
625
- return t.length > 512 ? Ln(t) : $n(t);
640
+ return t.length > 512 ? Mn(t) : Ln(t);
626
641
  }
627
- function $n(e) {
642
+ function Ln(e) {
628
643
  let t = "";
629
644
  for (let n = 0; n < e.length; ++n)
630
645
  t += ct[ht[ut[e[n] >> 4]]], t += ct[ht[ut[e[n] & 15]]];
631
646
  return t;
632
647
  }
633
- function Ln(e) {
648
+ function Mn(e) {
634
649
  const t = new Uint8Array(e.length * 2);
635
650
  for (let n = 0; n < e.length; ++n)
636
651
  t[n * 2] = ut[e[n] >> 4], t[n * 2 + 1] = ut[e[n] & 15];
637
- return ve.decode(t);
652
+ return ke.decode(t);
638
653
  }
639
- function Mn(e) {
640
- const t = ke.encode(e || ""), n = new Uint8Array(Math.floor(t.length / 2));
654
+ function Dn(e) {
655
+ const t = Ie.encode(e || ""), n = new Uint8Array(Math.floor(t.length / 2));
641
656
  let r;
642
657
  for (r = 0; r < n.length; r++) {
643
658
  const s = ht[t[r * 2]], i = ht[t[r * 2 + 1]];
@@ -647,10 +662,10 @@ function Mn(e) {
647
662
  }
648
663
  return r === n.length ? n : n.slice(0, r);
649
664
  }
650
- function Dn(e) {
665
+ function Gn(e) {
651
666
  return btoa(String.fromCharCode(...e));
652
667
  }
653
- function Gn(e) {
668
+ function Vn(e) {
654
669
  const t = atob(e), n = new Uint8Array(t.length);
655
670
  for (let r = 0; r < t.length; r++)
656
671
  n[r] = t.charCodeAt(r);
@@ -686,14 +701,14 @@ function Tt(e, t, n) {
686
701
  return r = (r << 8) + e[t] >>> 0, r = (r << 8) + e[t + 1] >>> 0, r = (r << 8) + e[t + 2] >>> 0, r = (r << 8) + e[t + 3] >>> 0, r;
687
702
  }
688
703
  }
689
- function Vn(e, t, n, r) {
704
+ function zn(e, t, n, r) {
690
705
  if (t + 8 > e.length)
691
706
  throw new Error("Offset is outside the bounds of Uint8Array");
692
707
  if (n > 0x7fffffffffffffffn || n < -0x8000000000000000n)
693
708
  throw new Error(`The value of "value" is out of range. It must be >= ${-0x8000000000000000n} and <= ${0x7fffffffffffffffn}. Received ${n}`);
694
709
  return r = r.toUpperCase(), r === "LE" ? (e[t] = Number(n & 0xffn), e[t + 1] = Number(n >> 8n & 0xffn), e[t + 2] = Number(n >> 16n & 0xffn), e[t + 3] = Number(n >> 24n & 0xffn), e[t + 4] = Number(n >> 32n & 0xffn), e[t + 5] = Number(n >> 40n & 0xffn), e[t + 6] = Number(n >> 48n & 0xffn), e[t + 7] = Number(n >> 56n & 0xffn)) : (e[t] = Number(n >> 56n & 0xffn), e[t + 1] = Number(n >> 48n & 0xffn), e[t + 2] = Number(n >> 40n & 0xffn), e[t + 3] = Number(n >> 32n & 0xffn), e[t + 4] = Number(n >> 24n & 0xffn), e[t + 5] = Number(n >> 16n & 0xffn), e[t + 6] = Number(n >> 8n & 0xffn), e[t + 7] = Number(n & 0xffn)), t + 8;
695
710
  }
696
- function zn(e, t, n) {
711
+ function jn(e, t, n) {
697
712
  if (t + 8 > e.length)
698
713
  throw new Error("Offset is outside the bounds of Uint8Array");
699
714
  n = n.toUpperCase();
@@ -705,8 +720,8 @@ function zn(e, t, n) {
705
720
  return s = (s << 8n) + BigInt(e[t]), s = (s << 8n) + BigInt(e[t + 1]), s = (s << 8n) + BigInt(e[t + 2]), s = (s << 8n) + BigInt(e[t + 3]), s = (s << 8n) + BigInt(e[t + 4]), s = (s << 8n) + BigInt(e[t + 5]), s = (s << 8n) + BigInt(e[t + 6]), s = (s << 8n) + BigInt(e[t + 7]), e[t] <= 127 ? s : s - 0x10000000000000000n;
706
721
  }
707
722
  }
708
- const jn = (e) => [...Array(e).keys()];
709
- function Xn(e) {
723
+ const Xn = (e) => [...Array(e).keys()];
724
+ function Yn(e) {
710
725
  if (e.key[0] !== _.GLOBAL_XPUB)
711
726
  throw new Error(
712
727
  "Decode Error: could not decode globalXpub with key 0x" + d(e.key)
@@ -724,13 +739,13 @@ function Xn(e) {
724
739
  extendedPubkey: t,
725
740
  path: "m"
726
741
  };
727
- for (const r of jn(e.value.length / 4 - 1)) {
742
+ for (const r of Xn(e.value.length / 4 - 1)) {
728
743
  const s = Tt(e.value, r * 4 + 4, "LE"), i = !!(s & 2147483648), o = s & 2147483647;
729
744
  n.path += "/" + o.toString(10) + (i ? "'" : "");
730
745
  }
731
746
  return n;
732
747
  }
733
- function Yn(e) {
748
+ function qn(e) {
734
749
  const t = new Uint8Array([_.GLOBAL_XPUB]), n = U([t, e.extendedPubkey]), r = e.path.split("/"), s = new Uint8Array(r.length * 4);
735
750
  s.set(e.masterFingerprint, 0);
736
751
  let i = 4;
@@ -743,118 +758,118 @@ function Yn(e) {
743
758
  value: s
744
759
  };
745
760
  }
746
- const qn = "{ masterFingerprint: Uint8Array; extendedPubkey: Uint8Array; path: string; }";
747
- function Zn(e) {
761
+ const Zn = "{ masterFingerprint: Uint8Array; extendedPubkey: Uint8Array; path: string; }";
762
+ function Jn(e) {
748
763
  const t = e.extendedPubkey, n = e.masterFingerprint, r = e.path;
749
764
  return t instanceof Uint8Array && t.length === 78 && [2, 3].indexOf(t[45]) > -1 && n instanceof Uint8Array && n.length === 4 && typeof r == "string" && !!r.match(/^m(\/\d+'?)*$/);
750
765
  }
751
- function Jn(e, t, n) {
766
+ function Qn(e, t, n) {
752
767
  const r = d(t.extendedPubkey);
753
768
  return n.has(r) ? !1 : (n.add(r), e.filter((s) => P(s.extendedPubkey, t.extendedPubkey)).length === 0);
754
769
  }
755
- const Qn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
770
+ const tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
756
771
  __proto__: null,
757
- canAddToArray: Jn,
758
- check: Zn,
759
- decode: Xn,
760
- encode: Yn,
761
- expected: qn
772
+ canAddToArray: Qn,
773
+ check: Jn,
774
+ decode: Yn,
775
+ encode: qn,
776
+ expected: Zn
762
777
  }, Symbol.toStringTag, { value: "Module" }));
763
- function tr(e) {
778
+ function er(e) {
764
779
  return {
765
780
  key: new Uint8Array([_.UNSIGNED_TX]),
766
781
  value: e.toBuffer()
767
782
  };
768
783
  }
769
- const er = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
784
+ const nr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
770
785
  __proto__: null,
771
- encode: tr
786
+ encode: er
772
787
  }, Symbol.toStringTag, { value: "Module" }));
773
- function nr(e) {
788
+ function rr(e) {
774
789
  if (e.key[0] !== p.FINAL_SCRIPTSIG)
775
790
  throw new Error(
776
791
  "Decode Error: could not decode finalScriptSig with key 0x" + d(e.key)
777
792
  );
778
793
  return e.value;
779
794
  }
780
- function rr(e) {
795
+ function sr(e) {
781
796
  return {
782
797
  key: new Uint8Array([p.FINAL_SCRIPTSIG]),
783
798
  value: e
784
799
  };
785
800
  }
786
- const sr = "Uint8Array";
787
- function ir(e) {
801
+ const ir = "Uint8Array";
802
+ function or(e) {
788
803
  return e instanceof Uint8Array;
789
804
  }
790
- function or(e, t) {
805
+ function ar(e, t) {
791
806
  return !!e && !!t && e.finalScriptSig === void 0;
792
807
  }
793
- const ar = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
808
+ const cr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
794
809
  __proto__: null,
795
- canAdd: or,
796
- check: ir,
797
- decode: nr,
798
- encode: rr,
799
- expected: sr
810
+ canAdd: ar,
811
+ check: or,
812
+ decode: rr,
813
+ encode: sr,
814
+ expected: ir
800
815
  }, Symbol.toStringTag, { value: "Module" }));
801
- function cr(e) {
816
+ function ur(e) {
802
817
  if (e.key[0] !== p.FINAL_SCRIPTWITNESS)
803
818
  throw new Error(
804
819
  "Decode Error: could not decode finalScriptWitness with key 0x" + d(e.key)
805
820
  );
806
821
  return e.value;
807
822
  }
808
- function ur(e) {
823
+ function hr(e) {
809
824
  return {
810
825
  key: new Uint8Array([p.FINAL_SCRIPTWITNESS]),
811
826
  value: e
812
827
  };
813
828
  }
814
- const hr = "Uint8Array";
815
- function lr(e) {
829
+ const lr = "Uint8Array";
830
+ function fr(e) {
816
831
  return e instanceof Uint8Array;
817
832
  }
818
- function fr(e, t) {
833
+ function pr(e, t) {
819
834
  return !!e && !!t && e.finalScriptWitness === void 0;
820
835
  }
821
- const pr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
836
+ const dr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
822
837
  __proto__: null,
823
- canAdd: fr,
824
- check: lr,
825
- decode: cr,
826
- encode: ur,
827
- expected: hr
838
+ canAdd: pr,
839
+ check: fr,
840
+ decode: ur,
841
+ encode: hr,
842
+ expected: lr
828
843
  }, Symbol.toStringTag, { value: "Module" }));
829
- function dr(e) {
844
+ function gr(e) {
830
845
  if (e.key[0] !== p.NON_WITNESS_UTXO)
831
846
  throw new Error(
832
847
  "Decode Error: could not decode nonWitnessUtxo with key 0x" + d(e.key)
833
848
  );
834
849
  return e.value;
835
850
  }
836
- function gr(e) {
851
+ function yr(e) {
837
852
  return {
838
853
  key: new Uint8Array([p.NON_WITNESS_UTXO]),
839
854
  value: e
840
855
  };
841
856
  }
842
- const yr = "Uint8Array";
843
- function wr(e) {
857
+ const wr = "Uint8Array";
858
+ function Sr(e) {
844
859
  return e instanceof Uint8Array;
845
860
  }
846
- function Sr(e, t) {
861
+ function Er(e, t) {
847
862
  return !!e && !!t && e.nonWitnessUtxo === void 0;
848
863
  }
849
- const Er = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
864
+ const mr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
850
865
  __proto__: null,
851
- canAdd: Sr,
852
- check: wr,
853
- decode: dr,
854
- encode: gr,
855
- expected: yr
866
+ canAdd: Er,
867
+ check: Sr,
868
+ decode: gr,
869
+ encode: yr,
870
+ expected: wr
856
871
  }, Symbol.toStringTag, { value: "Module" }));
857
- function mr(e) {
872
+ function br(e) {
858
873
  if (e.key[0] !== p.PARTIAL_SIG)
859
874
  throw new Error(
860
875
  "Decode Error: could not decode partialSig with key 0x" + d(e.key)
@@ -868,123 +883,123 @@ function mr(e) {
868
883
  signature: e.value
869
884
  };
870
885
  }
871
- function br(e) {
886
+ function Tr(e) {
872
887
  const t = new Uint8Array([p.PARTIAL_SIG]);
873
888
  return {
874
889
  key: U([t, e.pubkey]),
875
890
  value: e.signature
876
891
  };
877
892
  }
878
- const Tr = "{ pubkey: Uint8Array; signature: Uint8Array; }";
879
- function Ar(e) {
880
- return e.pubkey instanceof Uint8Array && e.signature instanceof Uint8Array && [33, 65].includes(e.pubkey.length) && [2, 3, 4].includes(e.pubkey[0]) && Ir(e.signature);
881
- }
893
+ const Ar = "{ pubkey: Uint8Array; signature: Uint8Array; }";
882
894
  function Ir(e) {
895
+ return e.pubkey instanceof Uint8Array && e.signature instanceof Uint8Array && [33, 65].includes(e.pubkey.length) && [2, 3, 4].includes(e.pubkey[0]) && kr(e.signature);
896
+ }
897
+ function kr(e) {
883
898
  if (!(e instanceof Uint8Array) || e.length < 9 || e[0] !== 48 || e.length !== e[1] + 3 || e[2] !== 2) return !1;
884
899
  const t = e[3];
885
900
  if (t > 33 || t < 1 || e[3 + t + 1] !== 2) return !1;
886
901
  const n = e[3 + t + 2];
887
902
  return !(n > 33 || n < 1 || e.length !== 3 + t + 2 + n + 2);
888
903
  }
889
- function kr(e, t, n) {
904
+ function vr(e, t, n) {
890
905
  const r = d(t.pubkey);
891
906
  return n.has(r) ? !1 : (n.add(r), e.filter((s) => P(s.pubkey, t.pubkey) === 0).length === 0);
892
907
  }
893
- const vr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
908
+ const xr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
894
909
  __proto__: null,
895
- canAddToArray: kr,
896
- check: Ar,
897
- decode: mr,
898
- encode: br,
899
- expected: Tr
910
+ canAddToArray: vr,
911
+ check: Ir,
912
+ decode: br,
913
+ encode: Tr,
914
+ expected: Ar
900
915
  }, Symbol.toStringTag, { value: "Module" }));
901
- function xr(e) {
916
+ function _r(e) {
902
917
  if (e.key[0] !== p.POR_COMMITMENT)
903
918
  throw new Error(
904
919
  "Decode Error: could not decode porCommitment with key 0x" + d(e.key)
905
920
  );
906
- return Bn(e.value);
921
+ return Wn(e.value);
907
922
  }
908
- function _r(e) {
923
+ function Ur(e) {
909
924
  return {
910
925
  key: new Uint8Array([p.POR_COMMITMENT]),
911
- value: Wn(e)
926
+ value: $n(e)
912
927
  };
913
928
  }
914
- const Ur = "string";
915
- function Pr(e) {
929
+ const Pr = "string";
930
+ function Nr(e) {
916
931
  return typeof e == "string";
917
932
  }
918
- function Nr(e, t) {
933
+ function Hr(e, t) {
919
934
  return !!e && !!t && e.porCommitment === void 0;
920
935
  }
921
- const Hr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
936
+ const Or = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
922
937
  __proto__: null,
923
- canAdd: Nr,
924
- check: Pr,
925
- decode: xr,
926
- encode: _r,
927
- expected: Ur
938
+ canAdd: Hr,
939
+ check: Nr,
940
+ decode: _r,
941
+ encode: Ur,
942
+ expected: Pr
928
943
  }, Symbol.toStringTag, { value: "Module" }));
929
- function Or(e) {
944
+ function Rr(e) {
930
945
  if (e.key[0] !== p.SIGHASH_TYPE)
931
946
  throw new Error(
932
947
  "Decode Error: could not decode sighashType with key 0x" + d(e.key)
933
948
  );
934
949
  return Number(Tt(e.value, 0, "LE"));
935
950
  }
936
- function Rr(e) {
951
+ function Kr(e) {
937
952
  const t = Uint8Array.from([p.SIGHASH_TYPE]), n = new Uint8Array(4);
938
953
  return Wt(n, 0, e, "LE"), {
939
954
  key: t,
940
955
  value: n
941
956
  };
942
957
  }
943
- const Kr = "number";
944
- function Cr(e) {
958
+ const Cr = "number";
959
+ function Fr(e) {
945
960
  return typeof e == "number";
946
961
  }
947
- function Fr(e, t) {
962
+ function Br(e, t) {
948
963
  return !!e && !!t && e.sighashType === void 0;
949
964
  }
950
- const Br = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
965
+ const Wr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
951
966
  __proto__: null,
952
- canAdd: Fr,
953
- check: Cr,
954
- decode: Or,
955
- encode: Rr,
956
- expected: Kr
967
+ canAdd: Br,
968
+ check: Fr,
969
+ decode: Rr,
970
+ encode: Kr,
971
+ expected: Cr
957
972
  }, Symbol.toStringTag, { value: "Module" }));
958
- function Wr(e) {
973
+ function $r(e) {
959
974
  if (e.key[0] !== p.TAP_KEY_SIG || e.key.length !== 1)
960
975
  throw new Error(
961
976
  "Decode Error: could not decode tapKeySig with key 0x" + d(e.key)
962
977
  );
963
- if (!xe(e.value))
978
+ if (!ve(e.value))
964
979
  throw new Error(
965
980
  "Decode Error: tapKeySig not a valid 64-65-byte BIP340 signature"
966
981
  );
967
982
  return e.value;
968
983
  }
969
- function $r(e) {
984
+ function Lr(e) {
970
985
  return { key: Uint8Array.from([p.TAP_KEY_SIG]), value: e };
971
986
  }
972
- const Lr = "Uint8Array";
973
- function xe(e) {
987
+ const Mr = "Uint8Array";
988
+ function ve(e) {
974
989
  return e instanceof Uint8Array && (e.length === 64 || e.length === 65);
975
990
  }
976
- function Mr(e, t) {
991
+ function Dr(e, t) {
977
992
  return !!e && !!t && e.tapKeySig === void 0;
978
993
  }
979
- const Dr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
994
+ const Gr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
980
995
  __proto__: null,
981
- canAdd: Mr,
982
- check: xe,
983
- decode: Wr,
984
- encode: $r,
985
- expected: Lr
996
+ canAdd: Dr,
997
+ check: ve,
998
+ decode: $r,
999
+ encode: Lr,
1000
+ expected: Mr
986
1001
  }, Symbol.toStringTag, { value: "Module" }));
987
- function Gr(e) {
1002
+ function Vr(e) {
988
1003
  if (e.key[0] !== p.TAP_LEAF_SCRIPT)
989
1004
  throw new Error(
990
1005
  "Decode Error: could not decode tapLeafScript with key 0x" + d(e.key)
@@ -1001,57 +1016,57 @@ function Gr(e) {
1001
1016
  const n = e.value.slice(0, -1);
1002
1017
  return { controlBlock: e.key.slice(1), script: n, leafVersion: t };
1003
1018
  }
1004
- function Vr(e) {
1019
+ function zr(e) {
1005
1020
  const t = Uint8Array.from([p.TAP_LEAF_SCRIPT]), n = Uint8Array.from([e.leafVersion]);
1006
1021
  return {
1007
1022
  key: U([t, e.controlBlock]),
1008
1023
  value: U([e.script, n])
1009
1024
  };
1010
1025
  }
1011
- const zr = "{ controlBlock: Uint8Array; leafVersion: number, script: Uint8Array; }";
1012
- function jr(e) {
1026
+ const jr = "{ controlBlock: Uint8Array; leafVersion: number, script: Uint8Array; }";
1027
+ function Xr(e) {
1013
1028
  return e.controlBlock instanceof Uint8Array && (e.controlBlock.length - 1) % 32 === 0 && (e.controlBlock[0] & 254) === e.leafVersion && e.script instanceof Uint8Array;
1014
1029
  }
1015
- function Xr(e, t, n) {
1030
+ function Yr(e, t, n) {
1016
1031
  const r = d(t.controlBlock);
1017
1032
  return n.has(r) ? !1 : (n.add(r), e.filter((s) => P(s.controlBlock, t.controlBlock) === 0).length === 0);
1018
1033
  }
1019
- const Yr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1034
+ const qr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1020
1035
  __proto__: null,
1021
- canAddToArray: Xr,
1022
- check: jr,
1023
- decode: Gr,
1024
- encode: Vr,
1025
- expected: zr
1036
+ canAddToArray: Yr,
1037
+ check: Xr,
1038
+ decode: Vr,
1039
+ encode: zr,
1040
+ expected: jr
1026
1041
  }, Symbol.toStringTag, { value: "Module" }));
1027
- function qr(e) {
1042
+ function Zr(e) {
1028
1043
  if (e.key[0] !== p.TAP_MERKLE_ROOT || e.key.length !== 1)
1029
1044
  throw new Error(
1030
1045
  "Decode Error: could not decode tapMerkleRoot with key 0x" + d(e.key)
1031
1046
  );
1032
- if (!_e(e.value))
1047
+ if (!xe(e.value))
1033
1048
  throw new Error("Decode Error: tapMerkleRoot not a 32-byte hash");
1034
1049
  return e.value;
1035
1050
  }
1036
- function Zr(e) {
1051
+ function Jr(e) {
1037
1052
  return { key: Uint8Array.from([p.TAP_MERKLE_ROOT]), value: e };
1038
1053
  }
1039
- const Jr = "Uint8Array";
1040
- function _e(e) {
1054
+ const Qr = "Uint8Array";
1055
+ function xe(e) {
1041
1056
  return e instanceof Uint8Array && e.length === 32;
1042
1057
  }
1043
- function Qr(e, t) {
1058
+ function ts(e, t) {
1044
1059
  return !!e && !!t && e.tapMerkleRoot === void 0;
1045
1060
  }
1046
- const ts = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1061
+ const es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1047
1062
  __proto__: null,
1048
- canAdd: Qr,
1049
- check: _e,
1050
- decode: qr,
1051
- encode: Zr,
1052
- expected: Jr
1063
+ canAdd: ts,
1064
+ check: xe,
1065
+ decode: Zr,
1066
+ encode: Jr,
1067
+ expected: Qr
1053
1068
  }, Symbol.toStringTag, { value: "Module" }));
1054
- function es(e) {
1069
+ function ns(e) {
1055
1070
  if (e.key[0] !== p.TAP_SCRIPT_SIG)
1056
1071
  throw new Error(
1057
1072
  "Decode Error: could not decode tapScriptSig with key 0x" + d(e.key)
@@ -1071,37 +1086,37 @@ function es(e) {
1071
1086
  signature: e.value
1072
1087
  };
1073
1088
  }
1074
- function ns(e) {
1089
+ function rs(e) {
1075
1090
  const t = Uint8Array.from([p.TAP_SCRIPT_SIG]);
1076
1091
  return {
1077
1092
  key: U([t, e.pubkey, e.leafHash]),
1078
1093
  value: e.signature
1079
1094
  };
1080
1095
  }
1081
- const rs = "{ pubkey: Uint8Array; leafHash: Uint8Array; signature: Uint8Array; }";
1082
- function ss(e) {
1096
+ const ss = "{ pubkey: Uint8Array; leafHash: Uint8Array; signature: Uint8Array; }";
1097
+ function is(e) {
1083
1098
  return e.pubkey instanceof Uint8Array && e.leafHash instanceof Uint8Array && e.signature instanceof Uint8Array && e.pubkey.length === 32 && e.leafHash.length === 32 && (e.signature.length === 64 || e.signature.length === 65);
1084
1099
  }
1085
- function is(e, t, n) {
1100
+ function os(e, t, n) {
1086
1101
  const r = d(t.pubkey) + d(t.leafHash);
1087
1102
  return n.has(r) ? !1 : (n.add(r), e.filter(
1088
1103
  (s) => P(s.pubkey, t.pubkey) === 0 && P(s.leafHash, t.leafHash) === 0
1089
1104
  ).length === 0);
1090
1105
  }
1091
- const os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1106
+ const as = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1092
1107
  __proto__: null,
1093
- canAddToArray: is,
1094
- check: ss,
1095
- decode: es,
1096
- encode: ns,
1097
- expected: rs
1108
+ canAddToArray: os,
1109
+ check: is,
1110
+ decode: ns,
1111
+ encode: rs,
1112
+ expected: ss
1098
1113
  }, Symbol.toStringTag, { value: "Module" }));
1099
- function as(e) {
1114
+ function cs(e) {
1100
1115
  if (e.key[0] !== p.WITNESS_UTXO)
1101
1116
  throw new Error(
1102
1117
  "Decode Error: could not decode witnessUtxo with key 0x" + d(e.key)
1103
1118
  );
1104
- const t = zn(e.value, 0, "LE");
1119
+ const t = jn(e.value, 0, "LE");
1105
1120
  let n = 8;
1106
1121
  const { numberValue: r, bytes: s } = Y(
1107
1122
  e.value,
@@ -1116,29 +1131,29 @@ function as(e) {
1116
1131
  value: t
1117
1132
  };
1118
1133
  }
1119
- function cs(e) {
1134
+ function us(e) {
1120
1135
  const { script: t, value: n } = e, r = V(t.length), s = new Uint8Array(8 + r + t.length);
1121
- return Vn(s, 0, BigInt(n), "LE"), z(t.length, s, 8), s.set(t, 8 + r), {
1136
+ return zn(s, 0, BigInt(n), "LE"), z(t.length, s, 8), s.set(t, 8 + r), {
1122
1137
  key: Uint8Array.from([p.WITNESS_UTXO]),
1123
1138
  value: s
1124
1139
  };
1125
1140
  }
1126
- const us = "{ script: Uint8Array; value: bigint; }";
1127
- function hs(e) {
1141
+ const hs = "{ script: Uint8Array; value: bigint; }";
1142
+ function ls(e) {
1128
1143
  return e.script instanceof Uint8Array && typeof e.value == "bigint";
1129
1144
  }
1130
- function ls(e, t) {
1145
+ function fs(e, t) {
1131
1146
  return !!e && !!t && e.witnessUtxo === void 0;
1132
1147
  }
1133
- const fs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1148
+ const ps = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1134
1149
  __proto__: null,
1135
- canAdd: ls,
1136
- check: hs,
1137
- decode: as,
1138
- encode: cs,
1139
- expected: us
1150
+ canAdd: fs,
1151
+ check: ls,
1152
+ decode: cs,
1153
+ encode: us,
1154
+ expected: hs
1140
1155
  }, Symbol.toStringTag, { value: "Module" }));
1141
- function ps(e) {
1156
+ function ds(e) {
1142
1157
  if (e.key[0] !== E.TAP_TREE || e.key.length !== 1)
1143
1158
  throw new Error(
1144
1159
  "Decode Error: could not decode tapTree with key 0x" + d(e.key)
@@ -1158,7 +1173,7 @@ function ps(e) {
1158
1173
  }
1159
1174
  return { leaves: n };
1160
1175
  }
1161
- function ds(e) {
1176
+ function gs(e) {
1162
1177
  const t = Uint8Array.from([E.TAP_TREE]), n = [].concat(
1163
1178
  ...e.leaves.map((r) => [
1164
1179
  Uint8Array.of(r.depth, r.leafVersion),
@@ -1171,24 +1186,24 @@ function ds(e) {
1171
1186
  value: U(n)
1172
1187
  };
1173
1188
  }
1174
- const gs = "{ leaves: [{ depth: number; leafVersion: number, script: Uint8Array; }] }";
1175
- function ys(e) {
1189
+ const ys = "{ leaves: [{ depth: number; leafVersion: number, script: Uint8Array; }] }";
1190
+ function ws(e) {
1176
1191
  return Array.isArray(e.leaves) && e.leaves.every(
1177
1192
  (t) => t.depth >= 0 && t.depth <= 128 && (t.leafVersion & 254) === t.leafVersion && t.script instanceof Uint8Array
1178
1193
  );
1179
1194
  }
1180
- function ws(e, t) {
1195
+ function Ss(e, t) {
1181
1196
  return !!e && !!t && e.tapTree === void 0;
1182
1197
  }
1183
- const Ss = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1198
+ const Es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1184
1199
  __proto__: null,
1185
- canAdd: ws,
1186
- check: ys,
1187
- decode: ps,
1188
- encode: ds,
1189
- expected: gs
1190
- }, Symbol.toStringTag, { value: "Module" })), Es = (e) => [...Array(e).keys()], ms = (e) => e.length === 33 && [2, 3].includes(e[0]) || e.length === 65 && e[0] === 4;
1191
- function $t(e, t = ms) {
1200
+ canAdd: Ss,
1201
+ check: ws,
1202
+ decode: ds,
1203
+ encode: gs,
1204
+ expected: ys
1205
+ }, Symbol.toStringTag, { value: "Module" })), ms = (e) => [...Array(e).keys()], bs = (e) => e.length === 33 && [2, 3].includes(e[0]) || e.length === 65 && e[0] === 4;
1206
+ function $t(e, t = bs) {
1192
1207
  function n(a) {
1193
1208
  if (a.key[0] !== e)
1194
1209
  throw new Error(
@@ -1208,9 +1223,9 @@ function $t(e, t = ms) {
1208
1223
  pubkey: u,
1209
1224
  path: "m"
1210
1225
  };
1211
- for (const f of Es(a.value.length / 4 - 1)) {
1212
- const c = Tt(a.value, f * 4 + 4, "LE"), h = !!(c & 2147483648), w = c & 2147483647;
1213
- l.path += "/" + w.toString(10) + (h ? "'" : "");
1226
+ for (const f of ms(a.value.length / 4 - 1)) {
1227
+ const c = Tt(a.value, f * 4 + 4, "LE"), h = !!(c & 2147483648), S = c & 2147483647;
1228
+ l.path += "/" + S.toString(10) + (h ? "'" : "");
1214
1229
  }
1215
1230
  return l;
1216
1231
  }
@@ -1218,9 +1233,9 @@ function $t(e, t = ms) {
1218
1233
  const u = Uint8Array.from([e]), l = U([u, a.pubkey]), f = a.path.split("/"), c = new Uint8Array(f.length * 4);
1219
1234
  c.set(a.masterFingerprint, 0);
1220
1235
  let h = 4;
1221
- return f.slice(1).forEach((w) => {
1222
- const g = w.slice(-1) === "'";
1223
- let y = 2147483647 & parseInt(g ? w.slice(0, -1) : w, 10);
1236
+ return f.slice(1).forEach((S) => {
1237
+ const g = S.slice(-1) === "'";
1238
+ let y = 2147483647 & parseInt(g ? S.slice(0, -1) : S, 10);
1224
1239
  g && (y += 2147483648), Wt(c, h, y, "LE"), h += 4;
1225
1240
  }), {
1226
1241
  key: l,
@@ -1254,7 +1269,7 @@ function Lt(e) {
1254
1269
  return r;
1255
1270
  }
1256
1271
  }
1257
- function Ue(e) {
1272
+ function _e(e) {
1258
1273
  function t(o) {
1259
1274
  if (o.key[0] !== e)
1260
1275
  throw new Error(
@@ -1283,9 +1298,9 @@ function Ue(e) {
1283
1298
  canAdd: i
1284
1299
  };
1285
1300
  }
1286
- const bs = (e) => e.length === 32;
1287
- function Pe(e) {
1288
- const t = $t(e, bs);
1301
+ const Ts = (e) => e.length === 32;
1302
+ function Ue(e) {
1303
+ const t = $t(e, Ts);
1289
1304
  function n(o) {
1290
1305
  const { numberValue: a, bytes: u } = Y(
1291
1306
  o.value
@@ -1317,7 +1332,7 @@ function Pe(e) {
1317
1332
  canAddToArray: t.canAddToArray
1318
1333
  };
1319
1334
  }
1320
- function Ne(e) {
1335
+ function Pe(e) {
1321
1336
  function t(o) {
1322
1337
  if (o.key[0] !== e || o.key.length !== 1)
1323
1338
  throw new Error(
@@ -1347,7 +1362,7 @@ function Ne(e) {
1347
1362
  canAdd: i
1348
1363
  };
1349
1364
  }
1350
- function He(e) {
1365
+ function Ne(e) {
1351
1366
  function t(o) {
1352
1367
  if (o.key[0] !== e)
1353
1368
  throw new Error(
@@ -1377,85 +1392,85 @@ function He(e) {
1377
1392
  };
1378
1393
  }
1379
1394
  const Mt = {
1380
- unsignedTx: er,
1381
- globalXpub: Qn,
1395
+ unsignedTx: nr,
1396
+ globalXpub: tr,
1382
1397
  // pass an Array of key bytes that require pubkey beside the key
1383
1398
  checkPubkey: Lt([])
1384
1399
  }, m = {
1385
- nonWitnessUtxo: Er,
1386
- partialSig: vr,
1387
- sighashType: Br,
1388
- finalScriptSig: ar,
1389
- finalScriptWitness: pr,
1390
- porCommitment: Hr,
1391
- witnessUtxo: fs,
1400
+ nonWitnessUtxo: mr,
1401
+ partialSig: xr,
1402
+ sighashType: Wr,
1403
+ finalScriptSig: cr,
1404
+ finalScriptWitness: dr,
1405
+ porCommitment: Or,
1406
+ witnessUtxo: ps,
1392
1407
  bip32Derivation: $t(p.BIP32_DERIVATION),
1393
- redeemScript: Ue(p.REDEEM_SCRIPT),
1394
- witnessScript: He(p.WITNESS_SCRIPT),
1408
+ redeemScript: _e(p.REDEEM_SCRIPT),
1409
+ witnessScript: Ne(p.WITNESS_SCRIPT),
1395
1410
  checkPubkey: Lt([
1396
1411
  p.PARTIAL_SIG,
1397
1412
  p.BIP32_DERIVATION
1398
1413
  ]),
1399
- tapKeySig: Dr,
1400
- tapScriptSig: os,
1401
- tapLeafScript: Yr,
1402
- tapBip32Derivation: Pe(
1414
+ tapKeySig: Gr,
1415
+ tapScriptSig: as,
1416
+ tapLeafScript: qr,
1417
+ tapBip32Derivation: Ue(
1403
1418
  p.TAP_BIP32_DERIVATION
1404
1419
  ),
1405
- tapInternalKey: Ne(p.TAP_INTERNAL_KEY),
1406
- tapMerkleRoot: ts
1420
+ tapInternalKey: Pe(p.TAP_INTERNAL_KEY),
1421
+ tapMerkleRoot: es
1407
1422
  }, N = {
1408
1423
  bip32Derivation: $t(E.BIP32_DERIVATION),
1409
- redeemScript: Ue(E.REDEEM_SCRIPT),
1410
- witnessScript: He(E.WITNESS_SCRIPT),
1424
+ redeemScript: _e(E.REDEEM_SCRIPT),
1425
+ witnessScript: Ne(E.WITNESS_SCRIPT),
1411
1426
  checkPubkey: Lt([E.BIP32_DERIVATION]),
1412
- tapBip32Derivation: Pe(
1427
+ tapBip32Derivation: Ue(
1413
1428
  E.TAP_BIP32_DERIVATION
1414
1429
  ),
1415
- tapTree: Ss,
1416
- tapInternalKey: Ne(E.TAP_INTERNAL_KEY)
1417
- }, Ts = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1430
+ tapTree: Es,
1431
+ tapInternalKey: Pe(E.TAP_INTERNAL_KEY)
1432
+ }, As = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1418
1433
  __proto__: null,
1419
1434
  globals: Mt,
1420
1435
  inputs: m,
1421
1436
  outputs: N
1422
1437
  }, Symbol.toStringTag, { value: "Module" })), lt = (e) => [...Array(e).keys()];
1423
1438
  function te(e) {
1424
- const t = e.map(As);
1439
+ const t = e.map(Is);
1425
1440
  return t.push(Uint8Array.from([0])), U(t);
1426
1441
  }
1427
- function As(e) {
1442
+ function Is(e) {
1428
1443
  const t = e.key.length, n = e.value.length, r = V(t), s = V(n), i = new Uint8Array(r + t + s + n);
1429
1444
  return z(t, i, 0), i.set(e.key, r), z(n, i, r + t), i.set(e.value, r + t + s), i;
1430
1445
  }
1431
- function Is(e, t) {
1446
+ function ks(e, t) {
1432
1447
  let n = 0;
1433
1448
  function r() {
1434
- const { numberValue: S, bytes: I } = Y(e, n);
1449
+ const { numberValue: w, bytes: I } = Y(e, n);
1435
1450
  n += I;
1436
- const R = e.slice(n, n + Number(S));
1437
- return n += Number(S), R;
1451
+ const R = e.slice(n, n + Number(w));
1452
+ return n += Number(w), R;
1438
1453
  }
1439
1454
  function s() {
1440
- const S = Tt(e, n, "BE");
1441
- return n += 4, S;
1455
+ const w = Tt(e, n, "BE");
1456
+ return n += 4, w;
1442
1457
  }
1443
1458
  function i() {
1444
- const S = Qt(e, n);
1445
- return n += 1, S;
1459
+ const w = Qt(e, n);
1460
+ return n += 1, w;
1446
1461
  }
1447
1462
  function o() {
1448
- const S = r(), I = r();
1463
+ const w = r(), I = r();
1449
1464
  return {
1450
- key: S,
1465
+ key: w,
1451
1466
  value: I
1452
1467
  };
1453
1468
  }
1454
1469
  function a() {
1455
1470
  if (n >= e.length)
1456
1471
  throw new Error("Format Error: Unexpected End of PSBT");
1457
- const S = Qt(e, n) === 0;
1458
- return S && n++, S;
1472
+ const w = Qt(e, n) === 0;
1473
+ return w && n++, w;
1459
1474
  }
1460
1475
  if (s() !== 1886610036)
1461
1476
  throw new Error("Format Error: Invalid Magic Number");
@@ -1465,44 +1480,44 @@ function Is(e, t) {
1465
1480
  );
1466
1481
  const u = [], l = {};
1467
1482
  for (; !a(); ) {
1468
- const S = o(), I = d(S.key);
1483
+ const w = o(), I = d(w.key);
1469
1484
  if (l[I])
1470
1485
  throw new Error(
1471
1486
  "Format Error: Keys must be unique for global keymap: key " + I
1472
1487
  );
1473
- l[I] = 1, u.push(S);
1488
+ l[I] = 1, u.push(w);
1474
1489
  }
1475
1490
  const f = u.filter(
1476
- (S) => S.key[0] === _.UNSIGNED_TX
1491
+ (w) => w.key[0] === _.UNSIGNED_TX
1477
1492
  );
1478
1493
  if (f.length !== 1)
1479
1494
  throw new Error("Format Error: Only one UNSIGNED_TX allowed");
1480
- const c = t(f[0].value), { inputCount: h, outputCount: w } = c.getInputOutputCounts(), g = [], y = [];
1481
- for (const S of lt(h)) {
1495
+ const c = t(f[0].value), { inputCount: h, outputCount: S } = c.getInputOutputCounts(), g = [], y = [];
1496
+ for (const w of lt(h)) {
1482
1497
  const I = {}, R = [];
1483
1498
  for (; !a(); ) {
1484
1499
  const W = o(), K = d(W.key);
1485
1500
  if (I[K])
1486
1501
  throw new Error(
1487
- "Format Error: Keys must be unique for each input: input index " + S + " key " + K
1502
+ "Format Error: Keys must be unique for each input: input index " + w + " key " + K
1488
1503
  );
1489
1504
  I[K] = 1, R.push(W);
1490
1505
  }
1491
1506
  g.push(R);
1492
1507
  }
1493
- for (const S of lt(w)) {
1508
+ for (const w of lt(S)) {
1494
1509
  const I = {}, R = [];
1495
1510
  for (; !a(); ) {
1496
1511
  const W = o(), K = d(W.key);
1497
1512
  if (I[K])
1498
1513
  throw new Error(
1499
- "Format Error: Keys must be unique for each output: output index " + S + " key " + K
1514
+ "Format Error: Keys must be unique for each output: output index " + w + " key " + K
1500
1515
  );
1501
1516
  I[K] = 1, R.push(W);
1502
1517
  }
1503
1518
  y.push(R);
1504
1519
  }
1505
- return Oe(c, {
1520
+ return He(c, {
1506
1521
  globalMapKeyVals: u,
1507
1522
  inputKeyVals: g,
1508
1523
  outputKeyVals: y
@@ -1515,7 +1530,7 @@ function A(e, t, n) {
1515
1530
  `Format Error: Invalid ${e} key: ${d(t)}`
1516
1531
  );
1517
1532
  }
1518
- function Oe(e, { globalMapKeyVals: t, inputKeyVals: n, outputKeyVals: r }) {
1533
+ function He(e, { globalMapKeyVals: t, inputKeyVals: n, outputKeyVals: r }) {
1519
1534
  const s = {
1520
1535
  unsignedTx: e
1521
1536
  };
@@ -1646,7 +1661,7 @@ function Oe(e, { globalMapKeyVals: t, inputKeyVals: n, outputKeyVals: r }) {
1646
1661
  }
1647
1662
  return { globalMap: s, inputs: u, outputs: l };
1648
1663
  }
1649
- function ks({ globalMap: e, inputs: t, outputs: n }) {
1664
+ function vs({ globalMap: e, inputs: t, outputs: n }) {
1650
1665
  const { globalKeyVals: r, inputKeyVals: s, outputKeyVals: i } = Rt({
1651
1666
  globalMap: e,
1652
1667
  inputs: t,
@@ -1656,7 +1671,7 @@ function ks({ globalMap: e, inputs: t, outputs: n }) {
1656
1671
  [f, o].concat(u, l)
1657
1672
  );
1658
1673
  }
1659
- const vs = (e, t) => P(e.key, t.key);
1674
+ const xs = (e, t) => P(e.key, t.key);
1660
1675
  function xt(e, t) {
1661
1676
  const n = /* @__PURE__ */ new Set(), r = Object.entries(e).reduce((i, [o, a]) => {
1662
1677
  if (o === "unknownKeyVals") return i;
@@ -1671,7 +1686,7 @@ function xt(e, t) {
1671
1686
  n.add(c);
1672
1687
  }), i.concat(l);
1673
1688
  }, []), s = e.unknownKeyVals ? e.unknownKeyVals.filter((i) => !n.has(d(i.key))) : [];
1674
- return r.concat(s).sort(vs);
1689
+ return r.concat(s).sort(xs);
1675
1690
  }
1676
1691
  function Rt({ globalMap: e, inputs: t, outputs: n }) {
1677
1692
  return {
@@ -1680,7 +1695,7 @@ function Rt({ globalMap: e, inputs: t, outputs: n }) {
1680
1695
  outputKeyVals: n.map((r) => xt(r, N))
1681
1696
  };
1682
1697
  }
1683
- function xs(e) {
1698
+ function _s(e) {
1684
1699
  const t = e[0], n = Rt(t), r = e.slice(1);
1685
1700
  if (r.length === 0) throw new Error("Combine: Nothing to combine");
1686
1701
  const s = ee(t);
@@ -1718,7 +1733,7 @@ function xs(e) {
1718
1733
  )
1719
1734
  );
1720
1735
  }
1721
- return Oe(s, {
1736
+ return He(s, {
1722
1737
  globalMapKeyVals: n.globalKeyVals,
1723
1738
  inputKeyVals: n.inputKeyVals,
1724
1739
  outputKeyVals: n.outputKeyVals
@@ -1767,7 +1782,7 @@ function Pt(e) {
1767
1782
  Number(isNaN(Number(n))) && t++;
1768
1783
  }), t;
1769
1784
  }
1770
- function _s(e, t) {
1785
+ function Us(e, t) {
1771
1786
  let n = !1;
1772
1787
  if (t.nonWitnessUtxo || t.witnessUtxo) {
1773
1788
  const r = !!t.redeemScript, s = !!t.witnessScript, i = !r || !!t.finalScriptSig, o = !s || !!t.finalScriptWitness, a = !!t.finalScriptSig || !!t.finalScriptWitness;
@@ -1788,7 +1803,7 @@ function Dt(e) {
1788
1803
  for (const r of Object.keys(t)) {
1789
1804
  const s = t[r], { canAdd: i, canAddToArray: o, check: a, expected: u } = (
1790
1805
  // @ts-ignore
1791
- Ts[e + "s"][r] || {}
1806
+ As[e + "s"][r] || {}
1792
1807
  ), l = !!o;
1793
1808
  if (a)
1794
1809
  if (l) {
@@ -1808,14 +1823,14 @@ function Dt(e) {
1808
1823
  }
1809
1824
  };
1810
1825
  }
1811
- const Us = Dt("global"), Re = Dt("input"), Ke = Dt("output");
1812
- function Ps(e, t) {
1826
+ const Ps = Dt("global"), Oe = Dt("input"), Re = Dt("output");
1827
+ function Ns(e, t) {
1813
1828
  const n = e.length - 1, r = T(e, n);
1814
- Re(t, r);
1829
+ Oe(t, r);
1815
1830
  }
1816
- function Ns(e, t) {
1831
+ function Hs(e, t) {
1817
1832
  const n = e.length - 1, r = X(e, n);
1818
- Ke(t, r);
1833
+ Re(t, r);
1819
1834
  }
1820
1835
  let re = class {
1821
1836
  constructor(t) {
@@ -1824,38 +1839,38 @@ let re = class {
1824
1839
  };
1825
1840
  }
1826
1841
  static fromBase64(t, n) {
1827
- const r = Gn(t);
1842
+ const r = Vn(t);
1828
1843
  return this.fromBuffer(r, n);
1829
1844
  }
1830
1845
  static fromHex(t, n) {
1831
- const r = Mn(t);
1846
+ const r = Dn(t);
1832
1847
  return this.fromBuffer(r, n);
1833
1848
  }
1834
1849
  static fromBuffer(t, n) {
1835
- const r = Is(t, n), s = new this(r.globalMap.unsignedTx);
1850
+ const r = ks(t, n), s = new this(r.globalMap.unsignedTx);
1836
1851
  return Object.assign(s, r), s;
1837
1852
  }
1838
1853
  toBase64() {
1839
1854
  const t = this.toBuffer();
1840
- return Dn(t);
1855
+ return Gn(t);
1841
1856
  }
1842
1857
  toHex() {
1843
1858
  const t = this.toBuffer();
1844
1859
  return d(t);
1845
1860
  }
1846
1861
  toBuffer() {
1847
- return ks(this);
1862
+ return vs(this);
1848
1863
  }
1849
1864
  updateGlobal(t) {
1850
- return Us(t, this.globalMap), this;
1865
+ return Ps(t, this.globalMap), this;
1851
1866
  }
1852
1867
  updateInput(t, n) {
1853
1868
  const r = T(this.inputs, t);
1854
- return Re(n, r), this;
1869
+ return Oe(n, r), this;
1855
1870
  }
1856
1871
  updateOutput(t, n) {
1857
1872
  const r = X(this.outputs, t);
1858
- return Ke(n, r), this;
1873
+ return Re(n, r), this;
1859
1874
  }
1860
1875
  addUnknownKeyValToGlobal(t) {
1861
1876
  return Ut(
@@ -1881,7 +1896,7 @@ let re = class {
1881
1896
  throw new Error("unknownKeyVals must be an Array");
1882
1897
  return n.forEach(
1883
1898
  (s) => this.addUnknownKeyValToInput(r, s)
1884
- ), Ps(this.inputs, t), this;
1899
+ ), Ns(this.inputs, t), this;
1885
1900
  }
1886
1901
  addOutput(t) {
1887
1902
  this.globalMap.unsignedTx.addOutput(t), this.outputs.push({
@@ -1892,11 +1907,11 @@ let re = class {
1892
1907
  throw new Error("unknownKeyVals must be an Array");
1893
1908
  return n.forEach(
1894
1909
  (s) => this.addUnknownKeyValToOutput(r, s)
1895
- ), Ns(this.outputs, t), this;
1910
+ ), Hs(this.outputs, t), this;
1896
1911
  }
1897
1912
  clearFinalizedInput(t) {
1898
1913
  const n = T(this.inputs, t);
1899
- _s(t, n);
1914
+ Us(t, n);
1900
1915
  for (const r of Object.keys(n))
1901
1916
  [
1902
1917
  "witnessUtxo",
@@ -1908,7 +1923,7 @@ let re = class {
1908
1923
  return this;
1909
1924
  }
1910
1925
  combine(...t) {
1911
- const n = xs([this].concat(t));
1926
+ const n = _s([this].concat(t));
1912
1927
  return Object.assign(this, n), this;
1913
1928
  }
1914
1929
  getTransaction() {
@@ -1926,28 +1941,28 @@ function Nt(e) {
1926
1941
  function Kt(e) {
1927
1942
  return !!e.finalScriptSig || !!e.finalScriptWitness;
1928
1943
  }
1929
- function Hs(e) {
1944
+ function Os(e) {
1930
1945
  if (!e.ins.every(
1931
1946
  (n) => n.script && n.script.length === 0 && n.witness && n.witness.length === 0
1932
1947
  ))
1933
1948
  throw new Error("Format Error: Transaction ScriptSigs are not empty");
1934
1949
  }
1935
- function Ce(e, t) {
1950
+ function Ke(e, t) {
1936
1951
  const n = st(new Uint8Array(t.hash)), r = `${B(n)}:${t.index}`;
1937
1952
  if (e.txInCache[r]) throw new Error("Duplicate input detected.");
1938
1953
  e.txInCache[r] = 1;
1939
1954
  }
1940
- function Os(e, t) {
1955
+ function Rs(e, t) {
1941
1956
  e.ins.forEach((n) => {
1942
- Ce(t, n);
1957
+ Ke(t, n);
1943
1958
  });
1944
1959
  }
1945
1960
  function $(e, t, n) {
1946
1961
  n !== !1 && e.forEach((r) => {
1947
- if (H(r) ? hn(r, t) : ln(r, t)) throw new Error("Can not modify transaction, signatures exist.");
1962
+ if (H(r) ? ln(r, t) : fn(r, t)) throw new Error("Can not modify transaction, signatures exist.");
1948
1963
  });
1949
1964
  }
1950
- function Rs(e) {
1965
+ function Ks(e) {
1951
1966
  if (!e.sighashType || !e.partialSig) return;
1952
1967
  const { partialSig: t, sighashType: n } = e;
1953
1968
  t.forEach((r) => {
@@ -1956,11 +1971,11 @@ function Rs(e) {
1956
1971
  throw new Error("Signature sighash does not match input sighash type");
1957
1972
  });
1958
1973
  }
1959
- function Fe(e, t, n) {
1974
+ function Ce(e, t, n) {
1960
1975
  if (!it(e, t))
1961
1976
  throw new Error(`Can not ${n} for this input with the key ${B(e)}`);
1962
1977
  }
1963
- function Be(e, t) {
1978
+ function Fe(e, t) {
1964
1979
  return (n, r, s, i) => {
1965
1980
  const o = e({
1966
1981
  redeem: { output: s }
@@ -1971,7 +1986,7 @@ function Be(e, t) {
1971
1986
  );
1972
1987
  };
1973
1988
  }
1974
- const se = Be(gt, "Redeem script"), ie = Be(yt, "Witness script");
1989
+ const se = Fe(gt, "Redeem script"), ie = Fe(yt, "Witness script");
1975
1990
  function oe(e) {
1976
1991
  let t = 0;
1977
1992
  function n(o) {
@@ -1991,7 +2006,7 @@ function oe(e) {
1991
2006
  }
1992
2007
  return i();
1993
2008
  }
1994
- function Ks(e) {
2009
+ function Cs(e) {
1995
2010
  let t = e & b.SIGHASH_ANYONECANPAY ? "SIGHASH_ANYONECANPAY | " : "";
1996
2011
  switch (e & 31) {
1997
2012
  case b.SIGHASH_ALL:
@@ -2006,7 +2021,7 @@ function Ks(e) {
2006
2021
  }
2007
2022
  return t;
2008
2023
  }
2009
- function Cs(e) {
2024
+ function Fs(e) {
2010
2025
  if (e.length === 65) {
2011
2026
  const t = e[64] & 1, n = new Uint8Array(e.subarray(0, 33));
2012
2027
  return n[0] = 2 | t, n;
@@ -2014,23 +2029,23 @@ function Cs(e) {
2014
2029
  return new Uint8Array(e);
2015
2030
  }
2016
2031
  function ae(e) {
2017
- return e.length === 33 && gn(e);
2032
+ return e.length === 33 && yn(e);
2018
2033
  }
2019
- function Fs(e) {
2020
- return yn(e);
2034
+ function Bs(e) {
2035
+ return wn(e);
2021
2036
  }
2022
2037
  function Gt(e) {
2023
- return Et(e) ? "witnesspubkeyhash" : fn(e) ? "pubkeyhash" : pn(e) ? "multisig" : dn(e) ? "pubkey" : "nonstandard";
2038
+ return Et(e) ? "witnesspubkeyhash" : pn(e) ? "pubkeyhash" : dn(e) ? "multisig" : gn(e) ? "pubkey" : "nonstandard";
2024
2039
  }
2025
2040
  function L(e) {
2026
2041
  return [...Array(e).keys()];
2027
2042
  }
2028
2043
  function ft(e) {
2029
- if (Et(e) || we(e))
2044
+ if (Et(e) || ye(e))
2030
2045
  throw new Error("P2WPKH or P2SH can not be contained within P2WSH");
2031
2046
  }
2032
2047
  function pt(e, t, n, r, s) {
2033
- const i = we(e), o = i && r && zt(r), a = zt(e);
2048
+ const i = ye(e), o = i && r && zt(r), a = zt(e);
2034
2049
  if (i && r === void 0)
2035
2050
  throw new Error("scriptPubkey is P2SH but redeemScript missing");
2036
2051
  let u;
@@ -2053,7 +2068,7 @@ function pt(e, t, n, r, s) {
2053
2068
  type: o ? "p2sh-p2wsh" : i ? "p2sh" : a ? "p2wsh" : "raw"
2054
2069
  };
2055
2070
  }
2056
- class Bs {
2071
+ class Ws {
2057
2072
  nonWitnessUtxoTxCache;
2058
2073
  nonWitnessUtxoBufCache;
2059
2074
  txInCache;
@@ -2098,8 +2113,8 @@ class Bs {
2098
2113
  value: n.witnessUtxo.value
2099
2114
  };
2100
2115
  if (n.nonWitnessUtxo !== void 0) {
2101
- const i = this.getNonWitnessUtxoTx(n, t, r).outs[this.tx.ins[t].index];
2102
- return { script: i.script, value: i.value };
2116
+ const s = this.getNonWitnessUtxoTx(n, t, r), i = this.tx.ins[t], o = s.outs[i.index];
2117
+ return { script: o.script, value: o.value };
2103
2118
  } else
2104
2119
  throw new Error("Can't find pubkey in input without Utxo data");
2105
2120
  }
@@ -2167,13 +2182,13 @@ class Bs {
2167
2182
  const n = D(t);
2168
2183
  if (!n) return;
2169
2184
  const r = n[n.length - 1];
2170
- if (!(!(r instanceof Uint8Array) || ae(r) || Fs(r) || !D(r)))
2185
+ if (!(!(r instanceof Uint8Array) || ae(r) || Bs(r) || !D(r)))
2171
2186
  return r;
2172
2187
  }
2173
2188
  redeemFromFinalWitnessScript(t) {
2174
2189
  if (!t) return;
2175
2190
  const n = oe(t), r = n[n.length - 1];
2176
- if (!(ae(r) || !D(r)))
2191
+ if (!(!r || ae(r) || !D(r)))
2177
2192
  return r;
2178
2193
  }
2179
2194
  /**
@@ -2182,17 +2197,18 @@ class Bs {
2182
2197
  */
2183
2198
  finalizeAndComputeAmounts(t, n, r, s, i) {
2184
2199
  let o = 0n;
2185
- t.forEach((h, w) => {
2186
- if (r && h.finalScriptSig && (n.ins[w].script = h.finalScriptSig), r && h.finalScriptWitness && (n.ins[w].witness = oe(h.finalScriptWitness)), h.witnessUtxo)
2200
+ t.forEach((h, S) => {
2201
+ const g = n.ins[S];
2202
+ if (r && h.finalScriptSig && (g.script = h.finalScriptSig), r && h.finalScriptWitness && (g.witness = oe(h.finalScriptWitness)), h.witnessUtxo)
2187
2203
  o += h.witnessUtxo.value;
2188
2204
  else if (h.nonWitnessUtxo) {
2189
2205
  if (!i)
2190
2206
  throw new Error("txFromBuffer is required for nonWitnessUtxo inputs");
2191
- const g = this.getNonWitnessUtxoTx(h, w, i), y = n.ins[w].index, S = g.outs[y];
2192
- o += S.value;
2207
+ const y = this.getNonWitnessUtxoTx(h, S, i), w = g.index, I = y.outs[w];
2208
+ o += I.value;
2193
2209
  }
2194
2210
  });
2195
- const a = n.outs.reduce((h, w) => h + w.value, 0n), u = o - a;
2211
+ const a = n.outs.reduce((h, S) => h + S.value, 0n), u = o - a;
2196
2212
  if (!s && u < 0n)
2197
2213
  throw new Error(
2198
2214
  `Outputs are spending more than Inputs ${o} < ${a}`
@@ -2215,14 +2231,14 @@ class Bs {
2215
2231
  const i = this.getNonWitnessUtxoTx(n, t, r), o = this.tx.ins[t].index;
2216
2232
  s.script = i.outs[o].script;
2217
2233
  } else n.witnessUtxo && (s.script = n.witnessUtxo.script);
2218
- return (n.witnessScript || s.script && Et(s.script) || s.script && Ee(s.script)) && (s.isSegwit = !0), s;
2234
+ return (n.witnessScript || s.script && Et(s.script) || s.script && Se(s.script)) && (s.isSegwit = !0), s;
2219
2235
  }
2220
2236
  getPrevoutTaprootKey(t, n, r) {
2221
2237
  const { script: s } = this.getScriptAndAmountFromUtxo(t, n, r);
2222
- return wn(s) ? s.subarray(2, 34) : null;
2238
+ return Sn(s) ? s.subarray(2, 34) : null;
2223
2239
  }
2224
2240
  }
2225
- class Ws {
2241
+ class $s {
2226
2242
  #t;
2227
2243
  #e;
2228
2244
  constructor(t, n) {
@@ -2235,7 +2251,7 @@ class Ws {
2235
2251
  !1,
2236
2252
  s
2237
2253
  );
2238
- return Fe(r, u, "sign"), { hash: o, sighashType: a };
2254
+ return Ce(r, u, "sign"), { hash: o, sighashType: a };
2239
2255
  }
2240
2256
  getHashForSig(t, n, r, s) {
2241
2257
  const i = this.#t.tx, o = n.sighashType || b.SIGHASH_ALL;
@@ -2246,13 +2262,13 @@ class Ws {
2246
2262
  n,
2247
2263
  t,
2248
2264
  this.#e
2249
- ), w = i.ins[t].hash, g = h.getHash();
2250
- if (!k(w, g))
2265
+ ), S = i.ins[t], g = S.hash, y = h.getHash();
2266
+ if (!k(g, y))
2251
2267
  throw new Error(
2252
2268
  `Non-witness UTXO hash for input #${t} doesn't match the hash specified in the prevout`
2253
2269
  );
2254
- const y = i.ins[t].index;
2255
- u = h.outs[y];
2270
+ const w = S.index;
2271
+ u = h.outs[w];
2256
2272
  } else if (n.witnessUtxo)
2257
2273
  u = {
2258
2274
  script: n.witnessUtxo.script,
@@ -2298,7 +2314,7 @@ PROCEED WITH CAUTION!
2298
2314
  const a = this.#t.tx, u = n.sighashType || b.SIGHASH_DEFAULT;
2299
2315
  if (ce(u, o), !this.#t.prevOuts) {
2300
2316
  const g = r.map(
2301
- (y, S) => this.#t.getScriptAndAmountFromUtxo(S, y, this.#e)
2317
+ (y, w) => this.#t.getScriptAndAmountFromUtxo(w, y, this.#e)
2302
2318
  );
2303
2319
  this.#t.prevOuts = g, this.#t.signingScripts = g.map((y) => y.script), this.#t.values = g.map((y) => y.value);
2304
2320
  }
@@ -2320,8 +2336,8 @@ PROCEED WITH CAUTION!
2320
2336
  h.push({ pubkey: s, hash: y });
2321
2337
  }
2322
2338
  }
2323
- const w = (n.tapLeafScript || []).filter((g) => it(s, g.script)).map((g) => {
2324
- const y = ye({
2339
+ const S = (n.tapLeafScript || []).filter((g) => it(s, g.script)).map((g) => {
2340
+ const y = ge({
2325
2341
  output: g.script,
2326
2342
  version: g.leafVersion
2327
2343
  });
@@ -2342,7 +2358,7 @@ PROCEED WITH CAUTION!
2342
2358
  leafHash: g.hash
2343
2359
  };
2344
2360
  });
2345
- return h.concat(w);
2361
+ return h.concat(S);
2346
2362
  }
2347
2363
  getAllTaprootHashesForSig(t, n, r) {
2348
2364
  const s = [];
@@ -2391,13 +2407,13 @@ PROCEED WITH CAUTION!
2391
2407
  }
2392
2408
  function ce(e, t) {
2393
2409
  if (t && !t.includes(e)) {
2394
- const n = Ks(e);
2410
+ const n = Cs(e);
2395
2411
  throw new Error(
2396
2412
  `Sighash type is not allowed. Retry the sign method passing the sighashTypes array of whitelisted types. Sighash type: ${n}`
2397
2413
  );
2398
2414
  }
2399
2415
  }
2400
- class $s {
2416
+ class Ls {
2401
2417
  #t;
2402
2418
  #e;
2403
2419
  constructor(t, n) {
@@ -2405,7 +2421,7 @@ class $s {
2405
2421
  }
2406
2422
  getFinalScripts(t, n, r, s, i, o, a = !0, u) {
2407
2423
  const l = Gt(r);
2408
- if (!We(n, r, l) && a)
2424
+ if (!Be(n, r, l) && a)
2409
2425
  throw new Error(`Can not finalize input #${t}`);
2410
2426
  if (!n.partialSig) throw new Error("Input missing partial signatures");
2411
2427
  return Vt(
@@ -2422,9 +2438,9 @@ class $s {
2422
2438
  return this.#t.getScriptFromInput(t, n, this.#e);
2423
2439
  }
2424
2440
  }
2425
- function Ls(e, t, n, r, s, i, o = !0, a) {
2441
+ function Ms(e, t, n, r, s, i, o = !0, a) {
2426
2442
  const u = Gt(n);
2427
- if (!We(t, n, u) && o)
2443
+ if (!Be(t, n, u) && o)
2428
2444
  throw new Error(`Can not finalize input #${e}`);
2429
2445
  if (!t.partialSig) throw new Error("Input missing partial signatures");
2430
2446
  return Vt(
@@ -2439,10 +2455,10 @@ function Ls(e, t, n, r, s, i, o = !0, a) {
2439
2455
  }
2440
2456
  function Vt(e, t, n, r, s, i, o) {
2441
2457
  let a, u;
2442
- const l = Ms(e, t, n), f = i ? yt({ redeem: l }) : null, c = s ? gt({ redeem: f || l }) : null;
2458
+ const l = Ds(e, t, n), f = i ? yt({ redeem: l }) : null, c = s ? gt({ redeem: f || l }) : null;
2443
2459
  return r ? (f && f.witness ? u = rt(f.witness) : l && l.witness ? u = rt(l.witness) : u = rt(o ?? [new Uint8Array([0])]), c && (a = c?.input)) : c ? a = c?.input : l ? a = l.input : a = Array.isArray(o) && o[0] ? o[0] : new Uint8Array([1]), { finalScriptSig: a, finalScriptWitness: u };
2444
2460
  }
2445
- function We(e, t, n) {
2461
+ function Be(e, t, n) {
2446
2462
  switch (n) {
2447
2463
  case "pubkey":
2448
2464
  case "pubkeyhash":
@@ -2465,43 +2481,49 @@ function ue(e, t, n) {
2465
2481
  if (!t) return !1;
2466
2482
  let r;
2467
2483
  if (n ? r = n.map((s) => {
2468
- const i = Cs(s);
2484
+ const i = Fs(s);
2469
2485
  return t.find((o) => k(o.pubkey, i));
2470
2486
  }).filter((s) => !!s) : r = t, r.length > e) throw new Error("Too many signatures");
2471
2487
  return r.length === e;
2472
2488
  }
2473
- function Ms(e, t, n) {
2489
+ function Ds(e, t, n) {
2474
2490
  const r = e;
2475
2491
  switch (t) {
2476
2492
  case "multisig": {
2477
- const s = Ds(e, n);
2493
+ const s = Gs(e, n);
2478
2494
  return wt({
2479
2495
  output: r,
2480
2496
  signatures: s
2481
2497
  });
2482
2498
  }
2483
- case "pubkey":
2484
- return ge({
2499
+ case "pubkey": {
2500
+ const s = n[0];
2501
+ return de({
2485
2502
  output: r,
2486
- signature: n[0].signature
2503
+ signature: s.signature
2487
2504
  });
2488
- case "pubkeyhash":
2505
+ }
2506
+ case "pubkeyhash": {
2507
+ const s = n[0];
2489
2508
  return dt({
2490
2509
  output: r,
2491
- pubkey: n[0].pubkey,
2492
- signature: n[0].signature
2510
+ pubkey: s.pubkey,
2511
+ signature: s.signature
2493
2512
  });
2494
- case "witnesspubkeyhash":
2513
+ }
2514
+ case "witnesspubkeyhash": {
2515
+ const s = n[0];
2495
2516
  return Ft({
2496
2517
  output: r,
2497
- pubkey: n[0].pubkey,
2498
- signature: n[0].signature
2518
+ pubkey: s.pubkey,
2519
+ signature: s.signature
2499
2520
  });
2521
+ }
2500
2522
  default:
2501
2523
  throw new Error(`Unknown script type: ${t}`);
2502
2524
  }
2503
2525
  }
2504
- function Ds(e, t) {
2526
+ function Gs(e, t) {
2505
2527
  const n = wt({ output: e });
2506
2528
  if (!n.pubkeys) throw new Error("Cannot extract pubkeys from multisig script");
2507
2529
  const r = [];
@@ -2511,11 +2533,11 @@ function Ds(e, t) {
2511
2533
  }
2512
2534
  return r;
2513
2535
  }
2514
- const Gs = new Uint8Array([2, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
2515
- class $e {
2536
+ const Vs = new Uint8Array([2, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
2537
+ class We {
2516
2538
  tx;
2517
- constructor(t = Gs) {
2518
- this.tx = b.fromBuffer(t), Hs(this.tx), Object.defineProperty(this, "tx", {
2539
+ constructor(t = Vs) {
2540
+ this.tx = b.fromBuffer(t), Os(this.tx), Object.defineProperty(this, "tx", {
2519
2541
  enumerable: !1,
2520
2542
  writable: !0
2521
2543
  });
@@ -2541,15 +2563,15 @@ class $e {
2541
2563
  return this.tx.toBuffer();
2542
2564
  }
2543
2565
  }
2544
- const Vs = (e) => new $e(e), zs = {
2566
+ const zs = (e) => new We(e), js = {
2545
2567
  network: G,
2546
2568
  maximumFeeRate: 5e3
2547
2569
  };
2548
2570
  function x(e) {
2549
2571
  return b.fromBuffer(e);
2550
2572
  }
2551
- function js(e, t, n, r, s, i, o = !0, a) {
2552
- return Ls(
2573
+ function Xs(e, t, n, r, s, i, o = !0, a) {
2574
+ return Ms(
2553
2575
  e,
2554
2576
  t,
2555
2577
  n,
@@ -2560,7 +2582,7 @@ function js(e, t, n, r, s, i, o = !0, a) {
2560
2582
  a
2561
2583
  );
2562
2584
  }
2563
- function qs(e, t, n, r, s, i, o) {
2585
+ function Js(e, t, n, r, s, i, o) {
2564
2586
  return Vt(
2565
2587
  e,
2566
2588
  t,
@@ -2572,10 +2594,10 @@ function qs(e, t, n, r, s, i, o) {
2572
2594
  );
2573
2595
  }
2574
2596
  class Ct {
2575
- constructor(t = {}, n = new re(new $e())) {
2576
- this.data = n, this.#n = Object.assign({}, zs, t);
2597
+ constructor(t = {}, n = new re(new We())) {
2598
+ this.data = n, this.#n = Object.assign({}, js, t);
2577
2599
  const r = this.data.globalMap.unsignedTx.tx;
2578
- this.#t = new Bs(r), t.version === 3 ? this.setVersionTRUC() : this.data.inputs.length === 0 && this.setVersion(2);
2600
+ this.#t = new Ws(r), t.version === 3 ? this.setVersionTRUC() : this.data.inputs.length === 0 && this.setVersion(2);
2579
2601
  }
2580
2602
  #t;
2581
2603
  #e;
@@ -2607,7 +2629,7 @@ class Ct {
2607
2629
  return this.#t.tx.outs.map((t) => {
2608
2630
  let n;
2609
2631
  try {
2610
- n = Ae(t.script, this.#n.network);
2632
+ n = Te(t.script, this.#n.network);
2611
2633
  } catch {
2612
2634
  }
2613
2635
  return {
@@ -2619,14 +2641,14 @@ class Ct {
2619
2641
  }
2620
2642
  /** Lazily initialized signer - created on first access */
2621
2643
  get #r() {
2622
- return this.#e || (this.#e = new Ws(this.#t, x)), this.#e;
2644
+ return this.#e || (this.#e = new $s(this.#t, x)), this.#e;
2623
2645
  }
2624
2646
  /** Lazily initialized finalizer - created on first access */
2625
2647
  get #o() {
2626
- return this.#s || (this.#s = new $s(this.#t, x)), this.#s;
2648
+ return this.#s || (this.#s = new Ls(this.#t, x)), this.#s;
2627
2649
  }
2628
2650
  static fromBase64(t, n = {}) {
2629
- const r = Tn(t);
2651
+ const r = An(t);
2630
2652
  return this.fromBuffer(r, n);
2631
2653
  }
2632
2654
  static fromHex(t, n = {}) {
@@ -2634,8 +2656,8 @@ class Ct {
2634
2656
  return this.fromBuffer(r, n);
2635
2657
  }
2636
2658
  static fromBuffer(t, n = {}) {
2637
- const r = re.fromBuffer(t, Vs), s = new Ct(n, r);
2638
- return Os(s.#t.tx, s.#t), s.#t.hasSignatures = s.data.inputs.some(
2659
+ const r = re.fromBuffer(t, zs), s = new Ct(n, r);
2660
+ return Rs(s.#t.tx, s.#t), s.#t.hasSignatures = s.data.inputs.some(
2639
2661
  (i) => i.partialSig?.length || i.tapKeySig || i.tapScriptSig?.length || i.finalScriptSig || i.finalScriptWitness
2640
2662
  ), s;
2641
2663
  }
@@ -2684,7 +2706,7 @@ class Ct {
2684
2706
  } : t;
2685
2707
  this.data.addInput(r);
2686
2708
  const s = this.#t.tx.ins[this.#t.tx.ins.length - 1];
2687
- Ce(this.#t, s);
2709
+ Ke(this.#t, s);
2688
2710
  const i = this.data.inputs.length - 1, o = this.data.inputs[i];
2689
2711
  return o.nonWitnessUtxo && this.#t.addNonWitnessTxCache(o, i, x), this.#t.invalidate("full"), this;
2690
2712
  }
@@ -2698,7 +2720,7 @@ class Ct {
2698
2720
  "Invalid arguments for Psbt.addOutput. Requires single object with at least [script or address] and [value]"
2699
2721
  );
2700
2722
  if (n && $(this.data.inputs, "addOutput", this.#t.hasSignatures), r) {
2701
- const { address: i } = t, { network: o } = this.#n, a = Ie(i, o);
2723
+ const { address: i } = t, { network: o } = this.#n, a = Ae(i, o);
2702
2724
  t = Object.assign({}, t, { script: a });
2703
2725
  }
2704
2726
  return Yt(t, t, "addOutput"), this.data.addOutput(t), this.#t.invalidate("outputs"), this;
@@ -2963,13 +2985,13 @@ class Ct {
2963
2985
  throw new Error(`Can not sign for input #${t} with the key ${B(o)}`);
2964
2986
  return a;
2965
2987
  }
2966
- #a(t, n, r = js, s = !0) {
2988
+ #a(t, n, r = Xs, s = !0) {
2967
2989
  const { script: i, isP2SH: o, isP2WSH: a, isSegwit: u } = this.#o.getScriptFromInput(
2968
2990
  t,
2969
2991
  n
2970
2992
  );
2971
2993
  if (!i) throw new Error(`No script found for input #${t}`);
2972
- Rs(n);
2994
+ Ks(n);
2973
2995
  const { finalScriptSig: l, finalScriptWitness: f } = r(
2974
2996
  t,
2975
2997
  n,
@@ -3015,14 +3037,14 @@ class Ct {
3015
3037
  const a = [];
3016
3038
  let u, l, f;
3017
3039
  for (const c of o) {
3018
- const h = c.signature, w = c.pubkey, g = et.decode(h), { hash: y, script: S } = f !== g.hashType || !u || !l ? this.#r.getHashForSig(
3040
+ const h = c.signature, S = c.pubkey, g = et.decode(h), { hash: y, script: w } = f !== g.hashType || !u || !l ? this.#r.getHashForSig(
3019
3041
  t,
3020
3042
  Object.assign({}, s, {
3021
3043
  sighashType: g.hashType
3022
3044
  }),
3023
3045
  !0
3024
3046
  ) : { hash: u, script: l };
3025
- f = g.hashType, u = y, l = S, Fe(w, S, "verify"), a.push(n(w, y, g.signature));
3047
+ f = g.hashType, u = y, l = w, Ce(S, w, "verify"), a.push(n(S, y, g.signature));
3026
3048
  }
3027
3049
  return a.every((c) => c);
3028
3050
  }
@@ -3046,11 +3068,11 @@ class Ct {
3046
3068
  }
3047
3069
  if (o)
3048
3070
  for (const c of o) {
3049
- const h = c.pubkey, w = u.find((g) => k(h, g.pubkey));
3050
- if (w) {
3071
+ const h = c.pubkey, S = u.find((g) => k(h, g.pubkey));
3072
+ if (S) {
3051
3073
  if (!n(
3052
3074
  h,
3053
- w.hash,
3075
+ S.hash,
3054
3076
  this.#r.trimTaprootSig(c.signature)
3055
3077
  )) return !1;
3056
3078
  f++;
@@ -3134,10 +3156,10 @@ class Ct {
3134
3156
  if (f.length) {
3135
3157
  const c = await Promise.all(
3136
3158
  f.map(async (h) => {
3137
- const w = await u(h.hash);
3159
+ const S = await u(h.hash);
3138
3160
  return {
3139
3161
  pubkey: nt(o),
3140
- signature: Q(w, n.sighashType),
3162
+ signature: Q(S, n.sighashType),
3141
3163
  leafHash: h.leafHash
3142
3164
  };
3143
3165
  })
@@ -3146,151 +3168,153 @@ class Ct {
3146
3168
  }
3147
3169
  }
3148
3170
  }
3149
- const Zs = {
3171
+ const Qs = {
3150
3172
  BitcoinError: v,
3151
- ValidationError: xn,
3152
- InvalidInputError: _n,
3153
- InvalidOutputError: Un,
3154
- ScriptError: Pn,
3155
- PsbtError: Nn,
3156
- EccError: Hn,
3157
- AddressError: On,
3158
- SignatureError: Rn
3159
- }, Js = {
3160
- networks: bn,
3161
- address: In,
3162
- payments: vn,
3163
- script: mn,
3164
- crypto: En,
3165
- Transaction: Sn
3173
+ ValidationError: _n,
3174
+ InvalidInputError: Un,
3175
+ InvalidOutputError: Pn,
3176
+ ScriptError: Nn,
3177
+ PsbtError: Hn,
3178
+ EccError: On,
3179
+ AddressError: Rn,
3180
+ SignatureError: Kn
3181
+ }, ti = {
3182
+ networks: Tn,
3183
+ address: kn,
3184
+ payments: xn,
3185
+ script: bn,
3186
+ crypto: mn,
3187
+ Transaction: En
3166
3188
  };
3167
3189
  export {
3168
- On as AddressError,
3190
+ Rn as AddressError,
3169
3191
  v as BitcoinError,
3170
3192
  F as Block,
3171
- ei as EccContext,
3172
- Hn as EccError,
3173
- Se as FUTURE_MAX_VERSION,
3193
+ ri as EccContext,
3194
+ On as EccError,
3195
+ we as FUTURE_MAX_VERSION,
3174
3196
  ot as FUTURE_OPNET_VERSION,
3175
3197
  q as FUTURE_SEGWIT_MAX_SIZE,
3176
3198
  J as FUTURE_SEGWIT_MAX_VERSION,
3177
3199
  Z as FUTURE_SEGWIT_MIN_SIZE,
3178
3200
  mt as FUTURE_SEGWIT_MIN_VERSION,
3179
3201
  bt as FUTURE_SEGWIT_VERSION_DIFF,
3180
- _n as InvalidInputError,
3181
- Un as InvalidOutputError,
3182
- je as LEAF_VERSION_TAPSCRIPT,
3183
- Xe as MAX_TAPTREE_DEPTH,
3202
+ Un as InvalidInputError,
3203
+ Pn as InvalidOutputError,
3204
+ Xe as LEAF_VERSION_TAPSCRIPT,
3205
+ Ye as MAX_TAPTREE_DEPTH,
3184
3206
  Ht as PaymentType,
3185
3207
  Ct as Psbt,
3186
- Bs as PsbtCache,
3187
- Nn as PsbtError,
3188
- $s as PsbtFinalizer,
3189
- Ws as PsbtSigner,
3190
- $e as PsbtTransaction,
3191
- Pn as ScriptError,
3192
- Rn as SignatureError,
3193
- ni as SignatureType,
3194
- ri as TAGGED_HASH_PREFIXES,
3195
- si as TAGS,
3196
- ii as TAPLEAF_VERSION_MASK,
3208
+ Ws as PsbtCache,
3209
+ Hn as PsbtError,
3210
+ Ls as PsbtFinalizer,
3211
+ $s as PsbtSigner,
3212
+ We as PsbtTransaction,
3213
+ Nn as ScriptError,
3214
+ Kn as SignatureError,
3215
+ si as SignatureType,
3216
+ ii as TAGGED_HASH_PREFIXES,
3217
+ oi as TAGS,
3218
+ ai as TAPLEAF_VERSION_MASK,
3197
3219
  b as Transaction,
3198
- xn as ValidationError,
3199
- oi as WorkerSigningPool,
3200
- be as _toFutureSegwitAddress,
3201
- In as address,
3202
- le as alloc,
3203
- ai as applySignaturesToPsbt,
3204
- ci as assertPrivateKey,
3205
- ui as assertXOnlyPublicKey,
3206
- ln as checkInputForSig,
3220
+ _n as ValidationError,
3221
+ ci as WorkerSigningPool,
3222
+ me as _toFutureSegwitAddress,
3223
+ kn as address,
3224
+ he as alloc,
3225
+ ui as applySignaturesToPsbt,
3226
+ hi as assertPrivateKey,
3227
+ li as assertXOnlyPublicKey,
3228
+ fn as checkInputForSig,
3207
3229
  Xt as checkTaprootInputFields,
3208
- hn as checkTaprootInputForSigs,
3230
+ ln as checkTaprootInputForSigs,
3209
3231
  Yt as checkTaprootOutputFields,
3210
3232
  jt as clone,
3211
3233
  It as compare,
3212
- hi as concat,
3213
- En as crypto,
3214
- li as decompressPublicKey,
3215
- Js as default,
3234
+ fi as concat,
3235
+ mn as crypto,
3236
+ pi as decompressPublicKey,
3237
+ ti as default,
3216
3238
  k as equals,
3217
- Zs as errors,
3218
- rn as findScriptPath,
3219
- Te as fromBase58Check,
3220
- fe as fromBech32,
3239
+ Qs as errors,
3240
+ sn as findScriptPath,
3241
+ be as fromBase58Check,
3242
+ An as fromBase64,
3243
+ le as fromBech32,
3221
3244
  St as fromHex,
3222
- Ae as fromOutputScript,
3223
- fi as fromUtf8,
3224
- pi as getEccLib,
3225
- js as getFinalScripts,
3226
- di as getPsigsFromInputFinalScripts,
3227
- gi as getSigningPool,
3228
- yi as getTapKeySigFromWitness,
3229
- wi as hash160,
3245
+ Te as fromOutputScript,
3246
+ di as fromUtf8,
3247
+ gi as getEccLib,
3248
+ Xs as getFinalScripts,
3249
+ yi as getPsigsFromInputFinalScripts,
3250
+ wi as getSigningPool,
3251
+ Si as getTapKeySigFromWitness,
3252
+ Ei as hash160,
3230
3253
  At as hash256,
3231
- Si as initEccLib,
3254
+ mi as initEccLib,
3232
3255
  Me as isBytes20,
3233
- Ei as isBytes32,
3234
- mi as isHex,
3235
- bi as isP2A,
3236
- pn as isP2MS,
3237
- Ti as isP2OP,
3238
- dn as isP2PK,
3239
- fn as isP2PKH,
3240
- we as isP2SHScript,
3241
- wn as isP2TR,
3256
+ bi as isBytes32,
3257
+ Ti as isHex,
3258
+ Ai as isP2A,
3259
+ dn as isP2MS,
3260
+ Ii as isP2OP,
3261
+ gn as isP2PK,
3262
+ pn as isP2PKH,
3263
+ ye as isP2SHScript,
3264
+ Sn as isP2TR,
3242
3265
  Et as isP2WPKH,
3243
3266
  zt as isP2WSHScript,
3244
- Ai as isPoint,
3245
- Ii as isPrivateKey,
3246
- ki as isSatoshi,
3247
- vi as isSchnorrSignature,
3248
- xi as isScript,
3249
- _i as isSignature,
3267
+ ki as isPoint,
3268
+ vi as isPrivateKey,
3269
+ xi as isSatoshi,
3270
+ _i as isSchnorrSignature,
3271
+ Ui as isScript,
3272
+ Pi as isSignature,
3250
3273
  H as isTaprootInput,
3251
- Ui as isTaprootOutput,
3252
- Ee as isUnknownSegwitVersion,
3253
- Pi as isXOnlyPublicKey,
3254
- Ni as isZero,
3255
- bn as networks,
3274
+ Ni as isTaprootOutput,
3275
+ Se as isUnknownSegwitVersion,
3276
+ Hi as isXOnlyPublicKey,
3277
+ Oi as isZero,
3278
+ Tn as networks,
3256
3279
  M as opcodes,
3257
- vn as payments,
3258
- qs as prepareFinalScripts,
3259
- Hi as prepareSigningTasks,
3280
+ xn as payments,
3281
+ Js as prepareFinalScripts,
3282
+ Ri as prepareSigningTasks,
3260
3283
  it as pubkeyInScript,
3261
- Oi as pubkeyPositionInScript,
3262
- Ri as pubkeysMatch,
3284
+ Ki as pubkeyPositionInScript,
3285
+ Ci as pubkeysMatch,
3263
3286
  st as reverse,
3264
- Ki as reverseCopy,
3265
- Ci as ripemd160,
3266
- sn as rootHashFromPath,
3267
- mn as script,
3287
+ Fi as reverseCopy,
3288
+ Bi as ripemd160,
3289
+ on as rootHashFromPath,
3290
+ bn as script,
3268
3291
  Q as serializeTaprootSignature,
3269
- Fi as sha1,
3270
- Bi as sha256,
3271
- Wi as signPsbtParallel,
3272
- $i as signatureBlocksAction,
3273
- Li as taggedHash,
3292
+ Wi as sha1,
3293
+ $i as sha256,
3294
+ Li as signPsbtParallel,
3295
+ Mi as signatureBlocksAction,
3296
+ Di as taggedHash,
3274
3297
  qt as tapScriptFinalizer,
3275
- Mi as tapTreeFromList,
3276
- Di as tapTreeToList,
3277
- Gi as tapTweakHash,
3278
- ye as tapleafHash,
3298
+ Gi as tapTreeFromList,
3299
+ Vi as tapTreeToList,
3300
+ zi as tapTweakHash,
3301
+ ge as tapleafHash,
3279
3302
  Ot as toBase58Check,
3303
+ qs as toBase64,
3280
3304
  at as toBech32,
3281
- Ge as toBytes20,
3282
- Ve as toBytes32,
3283
- me as toFutureOPNetAddress,
3284
- on as toHashTree,
3305
+ Ve as toBytes20,
3306
+ ze as toBytes32,
3307
+ Ee as toFutureOPNetAddress,
3308
+ an as toHashTree,
3285
3309
  B as toHex,
3286
- Ie as toOutputScript,
3287
- Vi as toSatoshi,
3288
- zi as toUtf8,
3310
+ Ae as toOutputScript,
3311
+ ji as toSatoshi,
3312
+ Xi as toUtf8,
3289
3313
  nt as toXOnly,
3290
- Vs as transactionFromBuffer,
3291
- ji as tweakInternalPubKey,
3292
- an as tweakKey,
3293
- Xi as varuint,
3314
+ zs as transactionFromBuffer,
3315
+ Yi as tweakInternalPubKey,
3316
+ cn as tweakKey,
3317
+ qi as varuint,
3294
3318
  rt as witnessStackToScriptWitness,
3295
- Yi as xor
3319
+ Zi as xor
3296
3320
  };