@btc-vision/transaction 1.8.0-beta.4 → 1.8.0-beta.6

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 (59) hide show
  1. package/browser/btc-vision-bitcoin.js +178 -178
  2. package/browser/generators/AddressGenerator.d.ts.map +1 -1
  3. package/browser/index.js +615 -623
  4. package/browser/keypair/AddressVerificator.d.ts.map +1 -1
  5. package/browser/keypair/EcKeyPair.d.ts.map +1 -1
  6. package/browser/keypair/Wallet.d.ts.map +1 -1
  7. package/browser/mnemonic/Mnemonic.d.ts.map +1 -1
  8. package/browser/signer/ParallelSignerAdapter.d.ts +1 -1
  9. package/browser/signer/ParallelSignerAdapter.d.ts.map +1 -1
  10. package/browser/signer/TweakedSigner.d.ts.map +1 -1
  11. package/browser/transaction/builders/TransactionBuilder.d.ts.map +1 -1
  12. package/browser/transaction/interfaces/ITweakedTransactionData.d.ts +1 -2
  13. package/browser/transaction/interfaces/ITweakedTransactionData.d.ts.map +1 -1
  14. package/browser/transaction/shared/TweakedTransaction.d.ts +1 -2
  15. package/browser/transaction/shared/TweakedTransaction.d.ts.map +1 -1
  16. package/build/generators/AddressGenerator.d.ts.map +1 -1
  17. package/build/generators/AddressGenerator.js +1 -3
  18. package/build/generators/AddressGenerator.js.map +1 -1
  19. package/build/keypair/AddressVerificator.d.ts.map +1 -1
  20. package/build/keypair/AddressVerificator.js +1 -3
  21. package/build/keypair/AddressVerificator.js.map +1 -1
  22. package/build/keypair/EcKeyPair.d.ts.map +1 -1
  23. package/build/keypair/EcKeyPair.js +2 -3
  24. package/build/keypair/EcKeyPair.js.map +1 -1
  25. package/build/keypair/Wallet.d.ts.map +1 -1
  26. package/build/keypair/Wallet.js +1 -3
  27. package/build/keypair/Wallet.js.map +1 -1
  28. package/build/mnemonic/Mnemonic.d.ts.map +1 -1
  29. package/build/mnemonic/Mnemonic.js +2 -3
  30. package/build/mnemonic/Mnemonic.js.map +1 -1
  31. package/build/signer/ParallelSignerAdapter.d.ts +1 -1
  32. package/build/signer/ParallelSignerAdapter.d.ts.map +1 -1
  33. package/build/signer/TweakedSigner.d.ts.map +1 -1
  34. package/build/signer/TweakedSigner.js +3 -4
  35. package/build/signer/TweakedSigner.js.map +1 -1
  36. package/build/transaction/builders/TransactionBuilder.d.ts.map +1 -1
  37. package/build/transaction/builders/TransactionBuilder.js +1 -3
  38. package/build/transaction/builders/TransactionBuilder.js.map +1 -1
  39. package/build/transaction/interfaces/ITweakedTransactionData.d.ts +1 -1
  40. package/build/transaction/interfaces/ITweakedTransactionData.d.ts.map +1 -1
  41. package/build/transaction/shared/TweakedTransaction.d.ts +1 -1
  42. package/build/transaction/shared/TweakedTransaction.d.ts.map +1 -1
  43. package/build/transaction/shared/TweakedTransaction.js +1 -1
  44. package/build/transaction/shared/TweakedTransaction.js.map +1 -1
  45. package/build/tsconfig.build.tsbuildinfo +1 -1
  46. package/build/utxo/OPNetLimitedProvider.js +2 -2
  47. package/build/utxo/OPNetLimitedProvider.js.map +1 -1
  48. package/package.json +2 -2
  49. package/src/generators/AddressGenerator.ts +1 -4
  50. package/src/keypair/AddressVerificator.ts +1 -4
  51. package/src/keypair/EcKeyPair.ts +1 -4
  52. package/src/keypair/Wallet.ts +0 -4
  53. package/src/mnemonic/Mnemonic.ts +2 -4
  54. package/src/signer/ParallelSignerAdapter.ts +1 -1
  55. package/src/signer/TweakedSigner.ts +2 -5
  56. package/src/transaction/builders/TransactionBuilder.ts +0 -4
  57. package/src/transaction/interfaces/ITweakedTransactionData.ts +1 -1
  58. package/src/transaction/shared/TweakedTransaction.ts +1 -1
  59. package/src/utxo/OPNetLimitedProvider.ts +2 -2
package/browser/index.js CHANGED
@@ -1,28 +1,28 @@
1
- import { B as H, p as Qt, m as bi, s as ut, c as O, b as Ue, L as Re, d as Mt, a as Tt, e as le, Y as Fe, f as Ai } from "./vendors.js";
2
- import { L as at, l as b, v as k, s as y, D as v, a as ht, J as nt, R as P, z as f, A as Ti, T as g, I as X, W as Ii, m as Ei, d as ee, H as C, V as D, i as Pi, g as vi, k as Oi, p as Me, w as Ui, C as V, b as ie, c as K, e as ki, f as ke, B as Bi, h as _i, M as Be, E as Li, F as _e, j as Ki, K as xi, N as Di, n as Ci, o as Ne, O as B, q as re } from "./btc-vision-bitcoin.js";
3
- import { s as Ri, m as Fi, b as Mi } from "./noble-curves.js";
4
- import { w as jt, d as te, f as Ni, x as Wi } from "./noble-hashes.js";
5
- const Ht = Symbol;
6
- typeof Ht.dispose != "symbol" && (Ht.dispose = /* @__PURE__ */ Symbol.for("Symbol.dispose"));
7
- typeof Ht.asyncDispose != "symbol" && (Ht.asyncDispose = /* @__PURE__ */ Symbol.for("Symbol.asyncDispose"));
8
- const Hi = "1.8.0-beta.1";
9
- function Vi(n, t = {}) {
10
- return H.from(Qt.gzip(n, { level: t.level || 6 }));
1
+ import { B as H, p as Yt, m as wi, s as at, c as O, b as ve, L as Ce, d as Rt, a as bt, e as ce, Y as De, f as mi } from "./vendors.js";
2
+ import { T as bi, o as b, v as k, s as y, F as v, S as ut, J as nt, B as P, z as f, A as Ai, a as g, I as X, W as Ii, d as Ti, l as Jt, U as D, V as C, i as Ei, b as Pi, E as vi, c as Re, p as Oi, C as V, e as te, f as K, r as Ui, N as Oe, g as ki, R as Bi, H as Ue, h as _i, L as ke, _ as Li, j as Ki, P as xi, k as Ci, m as Fe, x as B, q as ee } from "./btc-vision-bitcoin.js";
3
+ import { s as Di, m as Ri, b as Fi } from "./noble-curves.js";
4
+ import { w as Gt, d as Zt, f as Mi, x as Ni } from "./noble-hashes.js";
5
+ const Nt = Symbol;
6
+ typeof Nt.dispose != "symbol" && (Nt.dispose = /* @__PURE__ */ Symbol.for("Symbol.dispose"));
7
+ typeof Nt.asyncDispose != "symbol" && (Nt.asyncDispose = /* @__PURE__ */ Symbol.for("Symbol.asyncDispose"));
8
+ const Wi = "1.8.0-beta.1";
9
+ function Hi(n, t = {}) {
10
+ return H.from(Yt.gzip(n, { level: t.level || 6 }));
11
11
  }
12
- function zi(n) {
13
- return H.from(Qt.ungzip(n));
12
+ function Vi(n) {
13
+ return H.from(Yt.ungzip(n));
14
14
  }
15
- function qi(n, t = {}) {
16
- return H.from(Qt.deflate(n, { level: t.level || 6 }));
15
+ function zi(n, t = {}) {
16
+ return H.from(Yt.deflate(n, { level: t.level || 6 }));
17
17
  }
18
- function $i(n) {
19
- return H.from(Qt.inflate(n));
18
+ function qi(n) {
19
+ return H.from(Yt.inflate(n));
20
20
  }
21
- const Le = {
22
- gzipSync: Vi,
23
- gunzipSync: zi,
24
- deflateSync: qi,
25
- inflateSync: $i
21
+ const Be = {
22
+ gzipSync: Hi,
23
+ gunzipSync: Vi,
24
+ deflateSync: zi,
25
+ inflateSync: qi
26
26
  };
27
27
  class $ {
28
28
  static zlibOptions = {
@@ -36,7 +36,7 @@ class $ {
36
36
  * @returns {Buffer} The compressed data.
37
37
  */
38
38
  static compress(t) {
39
- return Le.gzipSync(t, $.zlibOptions);
39
+ return Be.gzipSync(t, $.zlibOptions);
40
40
  }
41
41
  /**
42
42
  * Decompresses the data using gunzip.
@@ -44,24 +44,23 @@ class $ {
44
44
  * @returns {Buffer} The decompressed data.
45
45
  */
46
46
  static decompress(t) {
47
- return Le.gunzipSync(t, $.zlibOptions);
47
+ return Be.gunzipSync(t, $.zlibOptions);
48
48
  }
49
49
  }
50
- const N = bi(), ct = N;
51
- at(ct);
52
- at(ct);
53
- const We = typeof Ue == "function" ? Ue : O.BIP32Factory;
54
- if (!We)
50
+ const N = wi(), $i = N;
51
+ bi($i);
52
+ const Me = typeof ve == "function" ? ve : O.BIP32Factory;
53
+ if (!Me)
55
54
  throw new Error("Failed to load BIP32 library");
56
- const pt = Ri.Point, Xi = pt.Fn.ORDER, Yi = new Uint8Array([84, 97, 112, 84, 119, 101, 97, 107]), Ke = jt(Yi);
55
+ const ht = Di.Point, Xi = ht.Fn.ORDER, Yi = new Uint8Array([84, 97, 112, 84, 119, 101, 97, 107]), _e = Gt(Yi);
57
56
  function Gi(n) {
58
- return jt(Ni(Ke, Ke, n));
57
+ return Gt(Mi(_e, _e, n));
59
58
  }
60
59
  class E {
61
- static BIP32 = We(N);
62
- static ECPairSigner = ut;
60
+ static BIP32 = Me(N);
61
+ static ECPairSigner = at;
63
62
  static {
64
- pt.BASE.precompute(8);
63
+ ht.BASE.precompute(8);
65
64
  }
66
65
  /**
67
66
  * Generate a keypair from a WIF
@@ -70,7 +69,7 @@ class E {
70
69
  * @returns {UniversalSigner} - The generated keypair
71
70
  */
72
71
  static fromWIF(t, e = b.bitcoin) {
73
- return ut.fromWIF(N, t, e);
72
+ return at.fromWIF(N, t, e);
74
73
  }
75
74
  /**
76
75
  * Generate a keypair from a private key
@@ -79,7 +78,7 @@ class E {
79
78
  * @returns {UniversalSigner} - The generated keypair
80
79
  */
81
80
  static fromPrivateKey(t, e = b.bitcoin) {
82
- return ut.fromPrivateKey(N, t, e);
81
+ return at.fromPrivateKey(N, t, e);
83
82
  }
84
83
  /**
85
84
  * Generate a keypair from a public key
@@ -88,7 +87,7 @@ class E {
88
87
  * @returns {UniversalSigner} - The generated keypair
89
88
  */
90
89
  static fromPublicKey(t, e = b.bitcoin) {
91
- return ut.fromPublicKey(N, t, e);
90
+ return at.fromPublicKey(N, t, e);
92
91
  }
93
92
  /**
94
93
  * Generate a multi-sig address
@@ -173,14 +172,14 @@ class E {
173
172
  * @returns {string} - The generated P2OP address
174
173
  */
175
174
  static p2op(t, e = b.bitcoin, i = 0) {
176
- const r = ht([
175
+ const r = ut([
177
176
  new Uint8Array([i]),
178
177
  nt.crypto.hash160(t)
179
178
  ]);
180
179
  if (r.length < 2 || r.length > 40)
181
180
  throw new Error("Witness program must be 2-40 bytes.");
182
181
  const s = P.compile([f.OP_16, r]);
183
- return Ti(s, e);
182
+ return Ai(s, e);
184
183
  }
185
184
  /**
186
185
  * Get the address of a xOnly tweaked public key
@@ -210,8 +209,8 @@ class E {
210
209
  */
211
210
  static tweakPublicKey(t) {
212
211
  typeof t == "string" && t.startsWith("0x") && (t = t.slice(2));
213
- const e = typeof t == "string" ? t : g(t), i = pt.fromHex(e), r = (i.y & 1n) === 0n ? i : i.negate(), s = r.toBytes(!0).subarray(1), o = Gi(s), a = Fi(Mi(o), Xi);
214
- return r.add(pt.BASE.multiply(a)).toBytes(!0);
212
+ const e = typeof t == "string" ? t : g(t), i = ht.fromHex(e), r = (i.y & 1n) === 0n ? i : i.negate(), s = r.toBytes(!0).subarray(1), o = Gi(s), a = Ri(Fi(o), Xi);
213
+ return r.add(ht.BASE.multiply(a)).toBytes(!0);
215
214
  }
216
215
  /**
217
216
  * Tweak a batch of public keys
@@ -220,9 +219,9 @@ class E {
220
219
  * @returns {Uint8Array[]} - The tweaked public keys
221
220
  */
222
221
  static tweakBatchSharedT(t, e) {
223
- const i = pt.BASE.multiply(e);
222
+ const i = ht.BASE.multiply(e);
224
223
  return t.map((r) => {
225
- const s = pt.fromHex(g(r));
224
+ const s = ht.fromHex(g(r));
226
225
  return (s.y % 2n === 0n ? s : s.negate()).add(i).toBytes(!0);
227
226
  });
228
227
  }
@@ -234,8 +233,8 @@ class E {
234
233
  * @returns An object containing both classical and quantum key information
235
234
  */
236
235
  static generateWallet(t = b.bitcoin, e = O.MLDSASecurityLevel.LEVEL2) {
237
- const i = ut.makeRandom(N, t, {
238
- rng: (o) => te(o)
236
+ const i = at.makeRandom(N, t, {
237
+ rng: (o) => Zt(o)
239
238
  }), r = this.getP2WPKHAddress(i, t);
240
239
  if (!r)
241
240
  throw new Error("Failed to generate wallet");
@@ -259,7 +258,7 @@ class E {
259
258
  * @returns A random ML-DSA keypair
260
259
  */
261
260
  static generateQuantumKeyPair(t = O.MLDSASecurityLevel.LEVEL2, e = b.bitcoin) {
262
- const i = te(64), r = O.QuantumBIP32Factory.fromSeed(i, e, t);
261
+ const i = Zt(64), r = O.QuantumBIP32Factory.fromSeed(i, e, t);
263
262
  if (!r.privateKey || !r.publicKey)
264
263
  throw new Error("Failed to generate quantum keypair");
265
264
  return {
@@ -333,8 +332,8 @@ class E {
333
332
  * @returns {UniversalSigner} - The generated keypair
334
333
  */
335
334
  static generateRandomKeyPair(t = b.bitcoin) {
336
- return ut.makeRandom(N, t, {
337
- rng: (e) => te(e)
335
+ return at.makeRandom(N, t, {
336
+ rng: (e) => Zt(e)
338
337
  });
339
338
  }
340
339
  /**
@@ -385,11 +384,11 @@ class E {
385
384
  static fromSeedKeyPair(t, e = b.bitcoin) {
386
385
  const r = this.BIP32.fromSeed(t, e).privateKey;
387
386
  if (!r) throw new Error("Failed to generate key pair");
388
- return ut.fromPrivateKey(N, r, e);
387
+ return at.fromPrivateKey(N, r, e);
389
388
  }
390
389
  }
391
390
  var z = /* @__PURE__ */ ((n) => (n[n.ACCESS_LIST = 1] = "ACCESS_LIST", n[n.EPOCH_SUBMISSION = 2] = "EPOCH_SUBMISSION", n[n.MLDSA_LINK_PUBKEY = 4] = "MLDSA_LINK_PUBKEY", n))(z || {}), J = /* @__PURE__ */ ((n) => (n[n.ACCESS_LIST = 1] = "ACCESS_LIST", n[n.EPOCH_SUBMISSION = 2] = "EPOCH_SUBMISSION", n[n.MLDSA_LINK_PUBKEY = 3] = "MLDSA_LINK_PUBKEY", n))(J || {});
392
- const x = 32, yt = 64, St = 64, Qi = 4, Ut = 32, Et = 16, Vt = 8, wt = 4, mt = 2, zt = 1, ji = 32, Pt = 16, kt = 8, Bt = 4, _t = 2, Lt = 1, Zi = 1;
391
+ const x = 32, ft = 64, gt = 64, Qi = 4, vt = 32, It = 16, Wt = 8, yt = 4, St = 2, Ht = 1, ji = 32, Tt = 16, Ot = 8, Ut = 4, kt = 2, Bt = 1, Zi = 1;
393
392
  function Ji(n, t, e, i) {
394
393
  throw new Error(`${t} (${e}: ${i})`);
395
394
  }
@@ -402,14 +401,14 @@ function tr() {
402
401
  return globalThis;
403
402
  throw new Error("unable to locate global object");
404
403
  }
405
- const xe = tr();
406
- xe.crypto || xe.msCrypto;
407
- function se(n) {
404
+ const Le = tr();
405
+ Le.crypto || Le.msCrypto;
406
+ function ie(n) {
408
407
  switch (n) {
409
408
  case "sha256":
410
- return jt.create();
409
+ return Gt.create();
411
410
  case "sha512":
412
- return Wi.create();
411
+ return Ni.create();
413
412
  }
414
413
  Ji(!1, "invalid hashing algorithm name", "algorithm", n);
415
414
  }
@@ -457,7 +456,7 @@ class M {
457
456
  * @returns {string} The hashed data
458
457
  */
459
458
  static opnetHash(t) {
460
- const e = se("sha512");
459
+ const e = ie("sha512");
461
460
  e.update(t);
462
461
  const i = e.digest();
463
462
  return `0x${H.from(i).toString("hex")}`;
@@ -560,7 +559,6 @@ class Q {
560
559
  return t.length === 34 && t[0] === 0 && t[1] === 32;
561
560
  }
562
561
  }
563
- at(ct);
564
562
  var it = /* @__PURE__ */ ((n) => (n.P2PKH = "P2PKH", n.P2OP = "P2OP", n.P2SH_OR_P2SH_P2WPKH = "P2SH_OR_P2SH-P2WPKH", n.P2PK = "P2PK", n.P2TR = "P2TR", n.P2WPKH = "P2WPKH", n.P2WSH = "P2WSH", n.P2WDA = "P2WDA", n))(it || {});
565
563
  class Y {
566
564
  static isValidP2TRAddress(t, e) {
@@ -735,8 +733,8 @@ class Y {
735
733
  }
736
734
  }
737
735
  }
738
- const lt = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn;
739
- class He {
736
+ const ct = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn;
737
+ class Ne {
740
738
  /**
741
739
  * The maximum increments to try before giving up on deriving a valid x.
742
740
  */
@@ -760,14 +758,14 @@ class He {
760
758
  findOrDeriveValidPoint(t, e = !0, i = this.maxTries) {
761
759
  if (t.length !== 32)
762
760
  throw new Error("xBytes must be exactly 32 bytes.");
763
- let r = this.bytesToBigInt(t) % lt, s = this.isValidX(r);
761
+ let r = this.bytesToBigInt(t) % ct, s = this.isValidX(r);
764
762
  if (e && s === null)
765
763
  throw new Error("The given x is not a valid curve point.");
766
764
  let o = 0;
767
765
  for (; s === null; )
768
- if (r = (r + 1n) % lt, s = this.isValidX(r), o++, o > i)
766
+ if (r = (r + 1n) % ct, s = this.isValidX(r), o++, o > i)
769
767
  throw new Error(`Could not find a valid X point within ${i} increments.`);
770
- const a = s, c = (lt - a) % lt;
768
+ const a = s, c = (ct - a) % ct;
771
769
  return { x: r, y1: a, y2: c };
772
770
  }
773
771
  /**
@@ -799,8 +797,8 @@ class He {
799
797
  * Returns the square root if it is, or null if not.
800
798
  */
801
799
  isValidX(t) {
802
- const e = (this.modPow(t, 3n, lt) + 7n) % lt;
803
- return this.sqrtModP(e, lt);
800
+ const e = (this.modPow(t, 3n, ct) + 7n) % ct;
801
+ return this.sqrtModP(e, ct);
804
802
  }
805
803
  /**
806
804
  * Computes base^exp (mod m) using exponentiation by squaring.
@@ -843,13 +841,13 @@ class He {
843
841
  }
844
842
  }
845
843
  class ir {
846
- deriver = new He();
844
+ deriver = new Ne();
847
845
  generateHybridKeyFromHash(t) {
848
846
  const e = this.deriver.findOrDeriveValidPoint(new Uint8Array(t), !1), i = this.deriver.getCanonicalY(e.y1, e.y2);
849
847
  return new Uint8Array(this.deriver.getHybridPublicKey(e.x, i));
850
848
  }
851
849
  }
852
- const ne = new ir();
850
+ const re = new ir();
853
851
  class q {
854
852
  static UNSPENDABLE_INTERNAL_KEY = y(
855
853
  "50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0"
@@ -1452,7 +1450,7 @@ class L extends Uint8Array {
1452
1450
  const t = this.#o;
1453
1451
  if (t && t.length === x && !this.#i)
1454
1452
  try {
1455
- this.#s = ne.generateHybridKeyFromHash(t);
1453
+ this.#s = re.generateHybridKeyFromHash(t);
1456
1454
  } catch {
1457
1455
  }
1458
1456
  }
@@ -1470,7 +1468,7 @@ class L extends Uint8Array {
1470
1468
  `Invalid ML-DSA public key length: ${t.length}. Expected 1312 (ML-DSA-44/LEVEL2), 1952 (ML-DSA-65/LEVEL3), or 2592 (ML-DSA-87/LEVEL5) bytes.`
1471
1469
  );
1472
1470
  this.#a = new Uint8Array(t.length), this.#a.set(t);
1473
- const e = jt(new Uint8Array(t)), i = new Uint8Array(x);
1471
+ const e = Gt(new Uint8Array(t)), i = new Uint8Array(x);
1474
1472
  i.set(e), super.set(i);
1475
1473
  }
1476
1474
  }
@@ -1494,14 +1492,14 @@ class L extends Uint8Array {
1494
1492
  const i = v(
1495
1493
  E.tweakPublicKey(this.#i)
1496
1494
  );
1497
- this.#s = ne.generateHybridKeyFromHash(i), this.#o = new Uint8Array(x), this.#o.set(i);
1495
+ this.#s = re.generateHybridKeyFromHash(i), this.#o = new Uint8Array(x), this.#o.set(i);
1498
1496
  }
1499
1497
  }
1500
- class At {
1498
+ class mt {
1501
1499
  _keys = [];
1502
1500
  _values = {};
1503
1501
  constructor(t) {
1504
- if (t instanceof At)
1502
+ if (t instanceof mt)
1505
1503
  this.setAll(t);
1506
1504
  else if (t)
1507
1505
  for (const [e, i] of t)
@@ -1566,10 +1564,10 @@ class At {
1566
1564
  yield [t, this._values[t]];
1567
1565
  }
1568
1566
  }
1569
- class Ve {
1567
+ class We {
1570
1568
  items;
1571
1569
  constructor(t) {
1572
- if (this.items = new At(), t)
1570
+ if (this.items = new mt(), t)
1573
1571
  for (const [e, i] of t)
1574
1572
  this.set(e, i);
1575
1573
  }
@@ -1624,14 +1622,14 @@ class Ve {
1624
1622
  yield* this.entries();
1625
1623
  }
1626
1624
  }
1627
- class ze {
1625
+ class He {
1628
1626
  // Store tweaked bigint -> index mapping for fast lookup
1629
1627
  indexMap;
1630
1628
  // Store actual addresses and values
1631
1629
  _keys = [];
1632
1630
  _values = [];
1633
1631
  constructor(t) {
1634
- if (this.indexMap = new At(), t)
1632
+ if (this.indexMap = new mt(), t)
1635
1633
  for (const [e, i] of t)
1636
1634
  this.set(e, i);
1637
1635
  }
@@ -1695,7 +1693,7 @@ class ze {
1695
1693
  yield* this.entries();
1696
1694
  }
1697
1695
  }
1698
- class Nt {
1696
+ class Ft {
1699
1697
  static EXPECTED_BUFFER_LENGTH = 32;
1700
1698
  static bufferToUint8Array(t) {
1701
1699
  const e = new Uint8Array(t.byteLength);
@@ -1719,7 +1717,7 @@ class Nt {
1719
1717
  static uint8ArrayToPointer(t) {
1720
1718
  return t.length === 0 ? 0n : BigInt("0x" + g(t));
1721
1719
  }
1722
- static valueToUint8Array(t, e = Ut) {
1720
+ static valueToUint8Array(t, e = vt) {
1723
1721
  if (t < 0n)
1724
1722
  throw new RangeError("Value cannot be negative");
1725
1723
  const i = t.toString(16).padStart(e * 2, "0");
@@ -1731,7 +1729,7 @@ class Nt {
1731
1729
  return t.length === 0 ? 0n : BigInt("0x" + g(t));
1732
1730
  }
1733
1731
  }
1734
- class Zt {
1732
+ class Qt {
1735
1733
  buffer;
1736
1734
  currentOffset = 0;
1737
1735
  constructor(t) {
@@ -1764,79 +1762,79 @@ class Zt {
1764
1762
  * Reads a single signed byte (i8).
1765
1763
  */
1766
1764
  readI8() {
1767
- this.verifyEnd(this.currentOffset + Lt);
1765
+ this.verifyEnd(this.currentOffset + Bt);
1768
1766
  const t = this.buffer.getInt8(this.currentOffset);
1769
- return this.currentOffset += Lt, t;
1767
+ return this.currentOffset += Bt, t;
1770
1768
  }
1771
1769
  /**
1772
1770
  * Reads a signed 16-bit integer. By default, big-endian.
1773
1771
  * @param be - Endianness; true means big-endian (the default).
1774
1772
  */
1775
1773
  readI16(t = !0) {
1776
- this.verifyEnd(this.currentOffset + _t);
1774
+ this.verifyEnd(this.currentOffset + kt);
1777
1775
  const e = this.buffer.getInt16(this.currentOffset, !t);
1778
- return this.currentOffset += _t, e;
1776
+ return this.currentOffset += kt, e;
1779
1777
  }
1780
1778
  /**
1781
1779
  * Reads a signed 32-bit integer. By default, big-endian.
1782
1780
  * @param be - Endianness; true means big-endian (the default).
1783
1781
  */
1784
1782
  readI32(t = !0) {
1785
- this.verifyEnd(this.currentOffset + Bt);
1783
+ this.verifyEnd(this.currentOffset + Ut);
1786
1784
  const e = this.buffer.getInt32(this.currentOffset, !t);
1787
- return this.currentOffset += Bt, e;
1785
+ return this.currentOffset += Ut, e;
1788
1786
  }
1789
1787
  /**
1790
1788
  * Reads a signed 64-bit integer. By default, big-endian.
1791
1789
  * @param be - Endianness; true means big-endian (the default).
1792
1790
  */
1793
1791
  readI64(t = !0) {
1794
- this.verifyEnd(this.currentOffset + kt);
1792
+ this.verifyEnd(this.currentOffset + Ot);
1795
1793
  const e = this.buffer.getBigInt64(this.currentOffset, !t);
1796
- return this.currentOffset += kt, e;
1794
+ return this.currentOffset += Ot, e;
1797
1795
  }
1798
1796
  // ------------------- Unsigned Integer Readers ------------------- //
1799
1797
  /**
1800
1798
  * Reads a single unsigned byte (u8).
1801
1799
  */
1802
1800
  readU8() {
1803
- this.verifyEnd(this.currentOffset + zt);
1801
+ this.verifyEnd(this.currentOffset + Ht);
1804
1802
  const t = this.buffer.getUint8(this.currentOffset);
1805
- return this.currentOffset += zt, t;
1803
+ return this.currentOffset += Ht, t;
1806
1804
  }
1807
1805
  /**
1808
1806
  * Reads an unsigned 16-bit integer. By default, big-endian.
1809
1807
  * @param be - Endianness; true means big-endian (the default).
1810
1808
  */
1811
1809
  readU16(t = !0) {
1812
- this.verifyEnd(this.currentOffset + mt);
1810
+ this.verifyEnd(this.currentOffset + St);
1813
1811
  const e = this.buffer.getUint16(this.currentOffset, !t);
1814
- return this.currentOffset += mt, e;
1812
+ return this.currentOffset += St, e;
1815
1813
  }
1816
1814
  /**
1817
1815
  * Reads an unsigned 32-bit integer. By default, big-endian.
1818
1816
  * @param be - Endianness; true means big-endian (the default).
1819
1817
  */
1820
1818
  readU32(t = !0) {
1821
- this.verifyEnd(this.currentOffset + wt);
1819
+ this.verifyEnd(this.currentOffset + yt);
1822
1820
  const e = this.buffer.getUint32(this.currentOffset, !t);
1823
- return this.currentOffset += wt, e;
1821
+ return this.currentOffset += yt, e;
1824
1822
  }
1825
1823
  /**
1826
1824
  * Reads an unsigned 64-bit integer. By default, big-endian.
1827
1825
  * @param be - Endianness; true means big-endian (the default).
1828
1826
  */
1829
1827
  readU64(t = !0) {
1830
- this.verifyEnd(this.currentOffset + Vt);
1828
+ this.verifyEnd(this.currentOffset + Wt);
1831
1829
  const e = this.buffer.getBigUint64(this.currentOffset, !t);
1832
- return this.currentOffset += Vt, e;
1830
+ return this.currentOffset += Wt, e;
1833
1831
  }
1834
1832
  /**
1835
1833
  * Reads a 128-bit unsigned integer. By default, read big-endian.
1836
1834
  * @param be - Endianness; true => big-endian (default).
1837
1835
  */
1838
1836
  readU128(t = !0) {
1839
- const e = this.readBytes(Et);
1837
+ const e = this.readBytes(It);
1840
1838
  let i = e;
1841
1839
  return t || (i = this.reverseBytes(e)), BigInt("0x" + this.toHexString(i));
1842
1840
  }
@@ -1845,7 +1843,7 @@ class Zt {
1845
1843
  * @param be - Endianness; true => big-endian (default).
1846
1844
  */
1847
1845
  readU256(t = !0) {
1848
- const e = this.readBytes(Ut);
1846
+ const e = this.readBytes(vt);
1849
1847
  let i = e;
1850
1848
  return t || (i = this.reverseBytes(e)), BigInt("0x" + this.toHexString(i));
1851
1849
  }
@@ -1854,7 +1852,7 @@ class Zt {
1854
1852
  * @param be - Endianness; true => big-endian (default).
1855
1853
  */
1856
1854
  readI128(t = !0) {
1857
- const e = this.readBytes(Pt);
1855
+ const e = this.readBytes(Tt);
1858
1856
  let i = e;
1859
1857
  t || (i = this.reverseBytes(e));
1860
1858
  let r = BigInt("0x" + this.toHexString(i));
@@ -1931,7 +1929,7 @@ class Zt {
1931
1929
  * @returns An Address instance with both keys set
1932
1930
  */
1933
1931
  readExtendedAddress() {
1934
- this.verifyEnd(this.currentOffset + yt);
1932
+ this.verifyEnd(this.currentOffset + ft);
1935
1933
  const t = Array.from(this.readBytes(x)), e = Array.from(this.readBytes(x));
1936
1934
  return new L(e, t);
1937
1935
  }
@@ -1946,9 +1944,9 @@ class Zt {
1946
1944
  */
1947
1945
  readSchnorrSignature() {
1948
1946
  this.verifyEnd(
1949
- this.currentOffset + yt + St
1947
+ this.currentOffset + ft + gt
1950
1948
  );
1951
- const t = this.readExtendedAddress(), e = this.readBytes(St);
1949
+ const t = this.readExtendedAddress(), e = this.readBytes(gt);
1952
1950
  return { address: t, signature: e };
1953
1951
  }
1954
1952
  /**
@@ -2027,7 +2025,7 @@ class Zt {
2027
2025
  * Reads [u16 length][ (address, u256) pairs ].
2028
2026
  */
2029
2027
  readAddressValueTuple(t = !0) {
2030
- const e = this.readU16(t), i = new Ve();
2028
+ const e = this.readU16(t), i = new We();
2031
2029
  for (let r = 0; r < e; r++) {
2032
2030
  const s = this.readAddress(), o = this.readU256(t);
2033
2031
  if (i.has(s))
@@ -2053,7 +2051,7 @@ class Zt {
2053
2051
  * This is the equivalent of btc-runtime's readExtendedAddressMapU256().
2054
2052
  */
2055
2053
  readExtendedAddressMapU256(t = !0) {
2056
- const e = this.readU16(t), i = new ze();
2054
+ const e = this.readU16(t), i = new He();
2057
2055
  for (let r = 0; r < e; r++) {
2058
2056
  const s = this.readExtendedAddress(), o = this.readU256(t);
2059
2057
  if (i.has(s))
@@ -2102,26 +2100,26 @@ class W {
2102
2100
  }
2103
2101
  static estimateArrayOfBufferLength(t) {
2104
2102
  if (t.length > 65535) throw new Error("Array size is too large");
2105
- let e = mt;
2103
+ let e = St;
2106
2104
  for (let i = 0; i < t.length; i++)
2107
- e += wt + t[i].length;
2105
+ e += yt + t[i].length;
2108
2106
  return e;
2109
2107
  }
2110
2108
  writeU8(t) {
2111
2109
  if (t > 255) throw new Error("u8 value is too large.");
2112
- this.allocSafe(zt), this.buffer.setUint8(this.currentOffset++, t);
2110
+ this.allocSafe(Ht), this.buffer.setUint8(this.currentOffset++, t);
2113
2111
  }
2114
2112
  writeU16(t, e = !0) {
2115
2113
  if (t > 65535) throw new Error("u16 value is too large.");
2116
- this.allocSafe(mt), this.buffer.setUint16(this.currentOffset, t, !e), this.currentOffset += 2;
2114
+ this.allocSafe(St), this.buffer.setUint16(this.currentOffset, t, !e), this.currentOffset += 2;
2117
2115
  }
2118
2116
  writeU32(t, e = !0) {
2119
2117
  if (t > 4294967295) throw new Error("u32 value is too large.");
2120
- this.allocSafe(wt), this.buffer.setUint32(this.currentOffset, t, !e), this.currentOffset += 4;
2118
+ this.allocSafe(yt), this.buffer.setUint32(this.currentOffset, t, !e), this.currentOffset += 4;
2121
2119
  }
2122
2120
  writeU64(t, e = !0) {
2123
2121
  if (t > 18446744073709551615n) throw new Error("u64 value is too large.");
2124
- this.allocSafe(Vt), this.buffer.setBigUint64(this.currentOffset, t, !e), this.currentOffset += 8;
2122
+ this.allocSafe(Wt), this.buffer.setBigUint64(this.currentOffset, t, !e), this.currentOffset += 8;
2125
2123
  }
2126
2124
  // ------------------- Signed Integer Writers ------------------- //
2127
2125
  /**
@@ -2129,14 +2127,14 @@ class W {
2129
2127
  */
2130
2128
  writeI8(t) {
2131
2129
  if (t < -128 || t > 127) throw new Error("i8 value is out of range.");
2132
- this.allocSafe(Lt), this.buffer.setInt8(this.currentOffset, t), this.currentOffset += Lt;
2130
+ this.allocSafe(Bt), this.buffer.setInt8(this.currentOffset, t), this.currentOffset += Bt;
2133
2131
  }
2134
2132
  /**
2135
2133
  * Writes a signed 16-bit integer. By default big-endian (be = true).
2136
2134
  */
2137
2135
  writeI16(t, e = !0) {
2138
2136
  if (t < -32768 || t > 32767) throw new Error("i16 value is out of range.");
2139
- this.allocSafe(_t), this.buffer.setInt16(this.currentOffset, t, !e), this.currentOffset += _t;
2137
+ this.allocSafe(kt), this.buffer.setInt16(this.currentOffset, t, !e), this.currentOffset += kt;
2140
2138
  }
2141
2139
  /**
2142
2140
  * Writes a signed 32-bit integer. By default big-endian (be = true).
@@ -2144,7 +2142,7 @@ class W {
2144
2142
  writeI32(t, e = !0) {
2145
2143
  if (t < -2147483648 || t > 2147483647)
2146
2144
  throw new Error("i32 value is out of range.");
2147
- this.allocSafe(Bt), this.buffer.setInt32(this.currentOffset, t, !e), this.currentOffset += Bt;
2145
+ this.allocSafe(Ut), this.buffer.setInt32(this.currentOffset, t, !e), this.currentOffset += Ut;
2148
2146
  }
2149
2147
  /**
2150
2148
  * Writes a signed 64-bit integer. By default big-endian (be = true).
@@ -2152,7 +2150,7 @@ class W {
2152
2150
  writeI64(t, e = !0) {
2153
2151
  if (t < -9223372036854775808n || t > 9223372036854775807n)
2154
2152
  throw new Error("i64 value is out of range.");
2155
- this.allocSafe(kt), this.buffer.setBigInt64(this.currentOffset, t, !e), this.currentOffset += kt;
2153
+ this.allocSafe(Ot), this.buffer.setBigInt64(this.currentOffset, t, !e), this.currentOffset += Ot;
2156
2154
  }
2157
2155
  // ---------------------------------------------------------------- //
2158
2156
  writeSelector(t) {
@@ -2164,9 +2162,9 @@ class W {
2164
2162
  writeI128(t, e = !0) {
2165
2163
  if (t > 170141183460469231731687303715884105727n || t < -170141183460469231731687303715884105728n)
2166
2164
  throw new Error("i128 value is too large.");
2167
- this.allocSafe(Pt);
2168
- const i = Nt.valueToUint8Array(t, Pt);
2169
- if (i.byteLength !== Pt)
2165
+ this.allocSafe(Tt);
2166
+ const i = Ft.valueToUint8Array(t, Tt);
2167
+ if (i.byteLength !== Tt)
2170
2168
  throw new Error(`Invalid i128 value: ${t}`);
2171
2169
  if (e)
2172
2170
  for (let r = 0; r < i.byteLength; r++)
@@ -2178,9 +2176,9 @@ class W {
2178
2176
  writeU256(t, e = !0) {
2179
2177
  if (t > 115792089237316195423570985008687907853269984665640564039457584007913129639935n && t < 0n)
2180
2178
  throw new Error("u256 value is too large or negative.");
2181
- this.allocSafe(Ut);
2182
- const i = Nt.valueToUint8Array(t);
2183
- if (i.byteLength !== Ut)
2179
+ this.allocSafe(vt);
2180
+ const i = Ft.valueToUint8Array(t);
2181
+ if (i.byteLength !== vt)
2184
2182
  throw new Error(`Invalid u256 value: ${t}`);
2185
2183
  if (e)
2186
2184
  for (let r = 0; r < i.byteLength; r++)
@@ -2192,9 +2190,9 @@ class W {
2192
2190
  writeU128(t, e = !0) {
2193
2191
  if (t > 340282366920938463463374607431768211455n && t < 0n)
2194
2192
  throw new Error("u128 value is too large or negative.");
2195
- this.allocSafe(Et);
2196
- const i = Nt.valueToUint8Array(t, Et);
2197
- if (i.byteLength !== Et)
2193
+ this.allocSafe(It);
2194
+ const i = Ft.valueToUint8Array(t, It);
2195
+ if (i.byteLength !== It)
2198
2196
  throw new Error(`Invalid u128 value: ${t}`);
2199
2197
  if (e)
2200
2198
  for (let r = 0; r < i.byteLength; r++)
@@ -2214,7 +2212,7 @@ class W {
2214
2212
  }
2215
2213
  writeStringWithLength(t) {
2216
2214
  const i = new TextEncoder().encode(t);
2217
- this.allocSafe(wt + i.length), this.writeU32(i.length), this.writeBytes(i);
2215
+ this.allocSafe(yt + i.length), this.writeU32(i.length), this.writeBytes(i);
2218
2216
  }
2219
2217
  /**
2220
2218
  * Writes an address (32 bytes MLDSA key hash only).
@@ -2239,7 +2237,7 @@ class W {
2239
2237
  * @param value - The Address containing both keys
2240
2238
  */
2241
2239
  writeExtendedAddress(t) {
2242
- this.allocSafe(yt), this.writeTweakedPublicKey(t), this.writeBytes(t);
2240
+ this.allocSafe(ft), this.writeTweakedPublicKey(t), this.writeBytes(t);
2243
2241
  }
2244
2242
  /**
2245
2243
  * Writes a Schnorr signature with its associated full Address.
@@ -2253,11 +2251,11 @@ class W {
2253
2251
  * @throws {Error} If signature is not exactly 64 bytes
2254
2252
  */
2255
2253
  writeSchnorrSignature(t, e) {
2256
- if (e.length !== St)
2254
+ if (e.length !== gt)
2257
2255
  throw new Error(
2258
- `Invalid Schnorr signature length: expected ${St}, got ${e.length}`
2256
+ `Invalid Schnorr signature length: expected ${gt}, got ${e.length}`
2259
2257
  );
2260
- this.allocSafe(yt + St), this.writeExtendedAddress(t), this.writeBytes(e);
2258
+ this.allocSafe(ft + gt), this.writeExtendedAddress(t), this.writeBytes(e);
2261
2259
  }
2262
2260
  getBuffer(t = !0) {
2263
2261
  const e = new Uint8Array(this.buffer.byteLength);
@@ -2269,7 +2267,7 @@ class W {
2269
2267
  this.currentOffset = 0, this.buffer = this.getDefaultBuffer(4);
2270
2268
  }
2271
2269
  toBytesReader() {
2272
- return new Zt(this.getBuffer());
2270
+ return new Qt(this.getBuffer());
2273
2271
  }
2274
2272
  getOffset() {
2275
2273
  return this.currentOffset;
@@ -2329,7 +2327,7 @@ class W {
2329
2327
  */
2330
2328
  writeExtendedAddressArray(t) {
2331
2329
  if (t.length > 65535) throw new Error("Array size is too large");
2332
- this.allocSafe(mt + t.length * yt), this.writeU16(t.length);
2330
+ this.allocSafe(St + t.length * ft), this.writeU16(t.length);
2333
2331
  for (let e = 0; e < t.length; e++)
2334
2332
  this.writeExtendedAddress(t[e]);
2335
2333
  }
@@ -2405,7 +2403,7 @@ class j {
2405
2403
  /**
2406
2404
  * The magic number of OPNet
2407
2405
  */
2408
- static MAGIC = Ei("op");
2406
+ static MAGIC = Ti("op");
2409
2407
  /**
2410
2408
  * The public key of the sender
2411
2409
  * @protected
@@ -2433,7 +2431,7 @@ class j {
2433
2431
  let e = 0;
2434
2432
  for (const r of t)
2435
2433
  e |= r;
2436
- const i = ee(3);
2434
+ const i = Jt(3);
2437
2435
  return i[0] = e >> 16 & 255, i[1] = e >> 8 & 255, i[2] = e & 255, Uint8Array.from([this.senderPubKey[0], ...i]);
2438
2436
  }
2439
2437
  getHeader(t, e = []) {
@@ -2450,7 +2448,7 @@ class j {
2450
2448
  splitBufferIntoChunks(t, e = j.DATA_CHUNK_SIZE) {
2451
2449
  const i = [];
2452
2450
  for (let r = 0; r < t.length; r += e) {
2453
- const s = Math.min(e, t.length - r), o = ee(s);
2451
+ const s = Math.min(e, t.length - r), o = Jt(s);
2454
2452
  for (let a = 0; a < s; a++)
2455
2453
  o[a] = t[r + a];
2456
2454
  i.push([o]);
@@ -2507,7 +2505,7 @@ class j {
2507
2505
  r.writeBytes(i.legacySignature), e.writeBytesWithLength(r.getBuffer());
2508
2506
  }
2509
2507
  }
2510
- class he extends j {
2508
+ class ue extends j {
2511
2509
  constructor(t, e, i = b.bitcoin) {
2512
2510
  super(t, e, i);
2513
2511
  }
@@ -2525,7 +2523,7 @@ class he extends j {
2525
2523
  throw new Error("Public key must be compressed");
2526
2524
  if (s.byteLength !== 33)
2527
2525
  throw new Error(`Public key must be 33 bytes, got ${s.byteLength} bytes.`);
2528
- i = ht([i, s]);
2526
+ i = ut([i, s]);
2529
2527
  }
2530
2528
  const r = $.compress(i);
2531
2529
  return r.byteLength >= i.byteLength ? i : r;
@@ -2547,11 +2545,11 @@ class he extends j {
2547
2545
  const a = [], c = [];
2548
2546
  if (s && s.length) {
2549
2547
  const d = s.sort(
2550
- (S, T) => S.priority - T.priority
2548
+ (S, I) => S.priority - I.priority
2551
2549
  ), w = new W();
2552
2550
  for (let S = 0; S < d.length; S++) {
2553
- const T = d[S];
2554
- a.push(T.opcode), this.encodeFeature(T, w);
2551
+ const I = d[S];
2552
+ a.push(I.opcode), this.encodeFeature(I, w);
2555
2553
  }
2556
2554
  c.push(
2557
2555
  ...this.splitBufferIntoChunks(new Uint8Array(w.getBuffer()))
@@ -2568,13 +2566,13 @@ class he extends j {
2568
2566
  this.xSenderPubKey,
2569
2567
  f.OP_DUP,
2570
2568
  f.OP_HASH256,
2571
- C.hash256(this.xSenderPubKey),
2569
+ D.hash256(this.xSenderPubKey),
2572
2570
  f.OP_EQUALVERIFY,
2573
2571
  f.OP_CHECKSIGVERIFY,
2574
2572
  this.contractSaltPubKey,
2575
2573
  f.OP_CHECKSIGVERIFY,
2576
2574
  f.OP_HASH160,
2577
- C.hash160(e),
2575
+ D.hash160(e),
2578
2576
  f.OP_EQUALVERIFY,
2579
2577
  f.OP_DEPTH,
2580
2578
  f.OP_1,
@@ -2596,7 +2594,7 @@ class he extends j {
2596
2594
  return h;
2597
2595
  }
2598
2596
  }
2599
- class qe extends j {
2597
+ class Ve extends j {
2600
2598
  constructor(t, e = b.bitcoin) {
2601
2599
  super(t, void 0, e);
2602
2600
  }
@@ -2613,8 +2611,8 @@ class qe extends j {
2613
2611
  return i;
2614
2612
  }
2615
2613
  }
2616
- const $e = 0, Xe = Uint8Array.from([$e]);
2617
- class de extends j {
2614
+ const ze = 0, qe = Uint8Array.from([ze]);
2615
+ class le extends j {
2618
2616
  constructor(t, e, i = b.bitcoin) {
2619
2617
  super(t, e, i);
2620
2618
  }
@@ -2667,13 +2665,13 @@ class de extends j {
2667
2665
  this.xSenderPubKey,
2668
2666
  f.OP_DUP,
2669
2667
  f.OP_HASH256,
2670
- C.hash256(this.xSenderPubKey),
2668
+ D.hash256(this.xSenderPubKey),
2671
2669
  f.OP_EQUALVERIFY,
2672
2670
  f.OP_CHECKSIGVERIFY,
2673
2671
  this.contractSaltPubKey,
2674
2672
  f.OP_CHECKSIGVERIFY,
2675
2673
  f.OP_HASH256,
2676
- C.hash256(e),
2674
+ D.hash256(e),
2677
2675
  f.OP_EQUALVERIFY,
2678
2676
  f.OP_DEPTH,
2679
2677
  f.OP_1,
@@ -2691,7 +2689,7 @@ class de extends j {
2691
2689
  ].flat();
2692
2690
  }
2693
2691
  }
2694
- class I extends Re {
2692
+ class T extends Ce {
2695
2693
  /**
2696
2694
  * Maximum chunk size per Bitcoin P2WSH stack item limit.
2697
2695
  * See policy.h: MAX_STANDARD_P2WSH_STACK_ITEM_SIZE = 80
@@ -2731,13 +2729,13 @@ class I extends Re {
2731
2729
  * - Script commitment: 23 bytes
2732
2730
  * Total: 104 bytes per chunk
2733
2731
  */
2734
- static WITNESS_PER_CHUNK_OVERHEAD = I.MAX_CHUNK_SIZE + 1 + I.BYTES_PER_COMMITMENT;
2732
+ static WITNESS_PER_CHUNK_OVERHEAD = T.MAX_CHUNK_SIZE + 1 + T.BYTES_PER_COMMITMENT;
2735
2733
  /**
2736
2734
  * Maximum data chunks per P2WSH output.
2737
2735
  * Limited by total witness size: (1650 - 112) / 104 = 14 chunks
2738
2736
  */
2739
2737
  static MAX_CHUNKS_PER_OUTPUT = Math.floor(
2740
- (I.MAX_WITNESS_SIZE - I.WITNESS_FIXED_OVERHEAD) / I.WITNESS_PER_CHUNK_OVERHEAD
2738
+ (T.MAX_WITNESS_SIZE - T.WITNESS_FIXED_OVERHEAD) / T.WITNESS_PER_CHUNK_OVERHEAD
2741
2739
  );
2742
2740
  /** Base weight per input (non-witness): 41 bytes * 4 = 164 */
2743
2741
  static INPUT_BASE_WEIGHT = 164;
@@ -2746,10 +2744,10 @@ class I extends Re {
2746
2744
  * Total witness size is ~1566 bytes (under 1650 limit)
2747
2745
  * Witness bytes count as 1 weight unit each.
2748
2746
  */
2749
- static INPUT_WITNESS_WEIGHT_MAX = I.MAX_WITNESS_SIZE;
2747
+ static INPUT_WITNESS_WEIGHT_MAX = T.MAX_WITNESS_SIZE;
2750
2748
  // Use max as upper bound
2751
2749
  /** Total weight per input (with max chunks) */
2752
- static WEIGHT_PER_INPUT = I.INPUT_BASE_WEIGHT + I.INPUT_WITNESS_WEIGHT_MAX;
2750
+ static WEIGHT_PER_INPUT = T.INPUT_BASE_WEIGHT + T.INPUT_WITNESS_WEIGHT_MAX;
2753
2751
  logColor = "#4a90d9";
2754
2752
  publicKey;
2755
2753
  network;
@@ -2767,8 +2765,8 @@ class I extends Re {
2767
2765
  * @returns Maximum inputs per reveal tx (~38 with max chunks)
2768
2766
  */
2769
2767
  static calculateMaxInputsPerTx() {
2770
- const i = I.MAX_STANDARD_WEIGHT - 40 - 200;
2771
- return Math.floor(i / I.WEIGHT_PER_INPUT);
2768
+ const i = T.MAX_STANDARD_WEIGHT - 40 - 200;
2769
+ return Math.floor(i / T.WEIGHT_PER_INPUT);
2772
2770
  }
2773
2771
  /**
2774
2772
  * Calculate maximum data per standard reveal transaction.
@@ -2776,7 +2774,7 @@ class I extends Re {
2776
2774
  * @returns Maximum data in bytes (~300KB with batched chunks at 70 chunks/output)
2777
2775
  */
2778
2776
  static calculateMaxDataPerTx() {
2779
- return I.calculateMaxInputsPerTx() * I.MAX_CHUNKS_PER_OUTPUT * I.MAX_CHUNK_SIZE;
2777
+ return T.calculateMaxInputsPerTx() * T.MAX_CHUNKS_PER_OUTPUT * T.MAX_CHUNK_SIZE;
2780
2778
  }
2781
2779
  /**
2782
2780
  * Estimate the number of P2WSH outputs needed for a given data size.
@@ -2786,7 +2784,7 @@ class I extends Re {
2786
2784
  */
2787
2785
  static estimateOutputCount(t) {
2788
2786
  return Math.ceil(
2789
- t / (I.MAX_CHUNKS_PER_OUTPUT * I.MAX_CHUNK_SIZE)
2787
+ t / (T.MAX_CHUNKS_PER_OUTPUT * T.MAX_CHUNK_SIZE)
2790
2788
  );
2791
2789
  }
2792
2790
  /**
@@ -2796,7 +2794,7 @@ class I extends Re {
2796
2794
  * @returns Number of 80-byte chunks needed
2797
2795
  */
2798
2796
  static estimateChunkCount(t) {
2799
- return Math.ceil(t / I.MAX_CHUNK_SIZE);
2797
+ return Math.ceil(t / T.MAX_CHUNK_SIZE);
2800
2798
  }
2801
2799
  /**
2802
2800
  * Validate that a witness script is a valid multi-hash committed script.
@@ -2839,7 +2837,7 @@ class I extends Re {
2839
2837
  static extractDataHashes(t) {
2840
2838
  try {
2841
2839
  const e = P.decompile(t);
2842
- if (!e || !I.validateHashCommittedScript(t))
2840
+ if (!e || !T.validateHashCommittedScript(t))
2843
2841
  return null;
2844
2842
  const i = e.slice(0, -2), r = [];
2845
2843
  for (let s = 0; s < i.length; s += 3)
@@ -2858,7 +2856,7 @@ class I extends Re {
2858
2856
  static extractPublicKey(t) {
2859
2857
  try {
2860
2858
  const e = P.decompile(t);
2861
- return !e || !I.validateHashCommittedScript(t) ? null : e[e.length - 2];
2859
+ return !e || !T.validateHashCommittedScript(t) ? null : e[e.length - 2];
2862
2860
  } catch {
2863
2861
  return null;
2864
2862
  }
@@ -2871,12 +2869,12 @@ class I extends Re {
2871
2869
  * @returns true if all chunks match their commitments
2872
2870
  */
2873
2871
  static verifyChunkCommitments(t, e) {
2874
- const i = I.extractDataHashes(e);
2872
+ const i = T.extractDataHashes(e);
2875
2873
  if (!i || i.length !== t.length)
2876
2874
  return !1;
2877
2875
  for (let r = 0; r < t.length; r++) {
2878
- const s = C.hash160(t[r]);
2879
- if (!D(i[r], s))
2876
+ const s = D.hash160(t[r]);
2877
+ if (!C(i[r], s))
2880
2878
  return !1;
2881
2879
  }
2882
2880
  return !0;
@@ -2890,7 +2888,7 @@ class I extends Re {
2890
2888
  * @returns Fee estimates
2891
2889
  */
2892
2890
  static estimateFees(t, e, i = 0.7) {
2893
- const r = Math.ceil(t * i), s = I.estimateOutputCount(r), o = I.estimateChunkCount(r), a = 116, c = s * 43 + 43, l = 11 + a + c, h = 40 + s * I.WEIGHT_PER_INPUT + 200, p = Math.ceil(h / 4), d = BigInt(Math.ceil(l * e)), w = BigInt(Math.ceil(p * e)), S = d + w, T = BigInt(s) * I.MIN_OUTPUT_VALUE, F = S + T;
2891
+ const r = Math.ceil(t * i), s = T.estimateOutputCount(r), o = T.estimateChunkCount(r), a = 116, c = s * 43 + 43, l = 11 + a + c, h = 40 + s * T.WEIGHT_PER_INPUT + 200, p = Math.ceil(h / 4), d = BigInt(Math.ceil(l * e)), w = BigInt(Math.ceil(p * e)), S = d + w, I = BigInt(s) * T.MIN_OUTPUT_VALUE, F = S + I;
2894
2892
  return {
2895
2893
  compressedSize: r,
2896
2894
  outputCount: s,
@@ -2900,7 +2898,7 @@ class I extends Re {
2900
2898
  setupFee: d,
2901
2899
  revealFee: w,
2902
2900
  totalFee: S,
2903
- outputsValue: T,
2901
+ outputsValue: I,
2904
2902
  totalCost: F
2905
2903
  };
2906
2904
  }
@@ -2909,7 +2907,7 @@ class I extends Re {
2909
2907
  * HASH160 = RIPEMD160(SHA256(data))
2910
2908
  */
2911
2909
  hashChunk(t) {
2912
- return C.hash160(t);
2910
+ return D.hash160(t);
2913
2911
  }
2914
2912
  /**
2915
2913
  * Generate a hash-committed witness script for multiple data chunks.
@@ -2931,9 +2929,9 @@ class I extends Re {
2931
2929
  generateWitnessScript(t) {
2932
2930
  if (t.length === 0)
2933
2931
  throw new Error("At least one data hash is required");
2934
- if (t.length > I.MAX_CHUNKS_PER_OUTPUT)
2932
+ if (t.length > T.MAX_CHUNKS_PER_OUTPUT)
2935
2933
  throw new Error(
2936
- `Too many chunks: ${t.length} exceeds limit of ${I.MAX_CHUNKS_PER_OUTPUT}`
2934
+ `Too many chunks: ${t.length} exceeds limit of ${T.MAX_CHUNKS_PER_OUTPUT}`
2937
2935
  );
2938
2936
  for (const i of t)
2939
2937
  if (i.length !== 20)
@@ -2972,10 +2970,10 @@ class I extends Re {
2972
2970
  * @param maxChunkSize Maximum bytes per stack item (default: 80, P2WSH stack item limit)
2973
2971
  * @returns Array of hash-committed P2WSH outputs
2974
2972
  */
2975
- prepareChunks(t, e = I.MAX_CHUNK_SIZE) {
2976
- if (e > I.MAX_CHUNK_SIZE)
2973
+ prepareChunks(t, e = T.MAX_CHUNK_SIZE) {
2974
+ if (e > T.MAX_CHUNK_SIZE)
2977
2975
  throw new Error(
2978
- `Chunk size ${e} exceeds P2WSH stack item limit of ${I.MAX_CHUNK_SIZE}`
2976
+ `Chunk size ${e} exceeds P2WSH stack item limit of ${T.MAX_CHUNK_SIZE}`
2979
2977
  );
2980
2978
  if (t.length === 0)
2981
2979
  throw new Error("Data cannot be empty");
@@ -2990,7 +2988,7 @@ class I extends Re {
2990
2988
  for (; o < i.length; ) {
2991
2989
  const c = i.slice(
2992
2990
  o,
2993
- o + I.MAX_CHUNKS_PER_OUTPUT
2991
+ o + T.MAX_CHUNKS_PER_OUTPUT
2994
2992
  ), u = c, l = u.map((d) => this.hashChunk(d)), h = this.generateWitnessScript(l), p = this.generateP2WSHAddress(h);
2995
2993
  s.push({
2996
2994
  address: p.address,
@@ -3025,7 +3023,7 @@ class sr extends j {
3025
3023
  throw new Error("Public key must be compressed");
3026
3024
  if (s.byteLength !== 33)
3027
3025
  throw new Error(`Public key must be 33 bytes, got ${s.byteLength} bytes.`);
3028
- i = ht([i, s]);
3026
+ i = ut([i, s]);
3029
3027
  }
3030
3028
  const r = $.compress(i);
3031
3029
  return r.byteLength >= i.byteLength ? i : r;
@@ -3046,11 +3044,11 @@ class sr extends j {
3046
3044
  const a = [], c = [];
3047
3045
  if (s && s.length) {
3048
3046
  const d = s.sort(
3049
- (S, T) => S.priority - T.priority
3047
+ (S, I) => S.priority - I.priority
3050
3048
  ), w = new W();
3051
3049
  for (let S = 0; S < d.length; S++) {
3052
- const T = d[S];
3053
- a.push(T.opcode), this.encodeFeature(T, w);
3050
+ const I = d[S];
3051
+ a.push(I.opcode), this.encodeFeature(I, w);
3054
3052
  }
3055
3053
  c.push(
3056
3054
  ...this.splitBufferIntoChunks(new Uint8Array(w.getBuffer()))
@@ -3065,7 +3063,7 @@ class sr extends j {
3065
3063
  this.senderPubKey,
3066
3064
  f.OP_DUP,
3067
3065
  f.OP_HASH256,
3068
- C.hash256(this.senderPubKey),
3066
+ D.hash256(this.senderPubKey),
3069
3067
  f.OP_EQUALVERIFY,
3070
3068
  f.OP_CHECKSIGVERIFY,
3071
3069
  e,
@@ -3090,25 +3088,25 @@ class sr extends j {
3090
3088
  return h;
3091
3089
  }
3092
3090
  }
3093
- class Kt {
3091
+ class _t {
3094
3092
  static MAXIMUM_SUPPORTED_SIGNATURE = 255;
3095
3093
  static compile(t, e = 0, i) {
3096
3094
  if (e < 2)
3097
3095
  throw new Error("Minimum signatures must be greater than 1");
3098
3096
  if (t.length < e)
3099
3097
  throw new Error("The amount of public keys is lower than the minimum required");
3100
- if (e > Kt.MAXIMUM_SUPPORTED_SIGNATURE)
3098
+ if (e > _t.MAXIMUM_SUPPORTED_SIGNATURE)
3101
3099
  throw new Error(
3102
- `The maximum amount of signatures is ${Kt.MAXIMUM_SUPPORTED_SIGNATURE}`
3100
+ `The maximum amount of signatures is ${_t.MAXIMUM_SUPPORTED_SIGNATURE}`
3103
3101
  );
3104
- const r = ee(1);
3102
+ const r = Jt(1);
3105
3103
  r[0] = e, t = t.filter(
3106
- (h, p, d) => p === d.findIndex((w) => D(h, w))
3107
- ), t = t.sort((h, p) => Pi(h, p));
3104
+ (h, p, d) => p === d.findIndex((w) => C(h, w))
3105
+ ), t = t.sort((h, p) => Ei(h, p));
3108
3106
  let s = !1;
3109
3107
  const o = t.map((h) => {
3110
3108
  const p = v(h);
3111
- return i && !s && (s = D(i, p)), p;
3109
+ return i && !s && (s = C(i, p)), p;
3112
3110
  });
3113
3111
  i && !s && o.push(i);
3114
3112
  const c = [
@@ -3131,7 +3129,7 @@ class Kt {
3131
3129
  return u;
3132
3130
  }
3133
3131
  }
3134
- class xt extends j {
3132
+ class Lt extends j {
3135
3133
  static P2WDA_VERSION = 1;
3136
3134
  constructor(t, e, i = b.bitcoin) {
3137
3135
  super(t, e, i);
@@ -3170,7 +3168,7 @@ class xt extends j {
3170
3168
  if (e.length !== 32)
3171
3169
  throw new Error("Contract secret must be exactly 32 bytes");
3172
3170
  const o = new W();
3173
- o.writeU8(xt.P2WDA_VERSION);
3171
+ o.writeU8(Lt.P2WDA_VERSION);
3174
3172
  const a = s.sort((c, u) => c.priority - u.priority);
3175
3173
  return o.writeBytes(
3176
3174
  this.getHeader(
@@ -3197,24 +3195,23 @@ class xt extends j {
3197
3195
  t.writeU8(i.opcode), this.encodeFeature(i, t);
3198
3196
  }
3199
3197
  }
3200
- at(ct);
3201
- class pe {
3198
+ class he {
3202
3199
  // Generate a valid SegWit address from random bytes
3203
3200
  static generatePKSH(t, e) {
3204
3201
  if (t.length !== 32) throw new Error("Invalid hash length");
3205
- const i = vi(t);
3202
+ const i = Pi(t);
3206
3203
  return this.toSegwitAddress(i, e);
3207
3204
  }
3208
3205
  // Generate a valid Taproot address from a public key
3209
3206
  static generateTaprootAddress(t, e) {
3210
3207
  if (t.length !== 32) throw new Error("Invalid public key length");
3211
- const i = Mt.bech32m.toWords(t);
3212
- return i.unshift(1), Mt.bech32m.encode(e.bech32, i);
3208
+ const i = Rt.bech32m.toWords(t);
3209
+ return i.unshift(1), Rt.bech32m.encode(e.bech32, i);
3213
3210
  }
3214
3211
  // Convert a hash to a SegWit address
3215
3212
  static toSegwitAddress(t, e) {
3216
- const i = Mt.bech32.toWords(t);
3217
- return i.unshift(0), Mt.bech32.encode(e.bech32, i);
3213
+ const i = Rt.bech32.toWords(t);
3214
+ return i.unshift(0), Rt.bech32.encode(e.bech32, i);
3218
3215
  }
3219
3216
  }
3220
3217
  class rt {
@@ -3236,11 +3233,11 @@ class rt {
3236
3233
  if (!a || a.length === 0)
3237
3234
  return !1;
3238
3235
  const c = a[a.length - 1];
3239
- return D(c, e);
3236
+ return C(c, e);
3240
3237
  }
3241
3238
  static getContractSeed(t, e, i) {
3242
- const r = C.hash256(e), s = ht([t, i, r]);
3243
- return C.hash256(s);
3239
+ const r = D.hash256(e), s = ut([t, i, r]);
3240
+ return D.hash256(s);
3244
3241
  }
3245
3242
  static generateAddressFromScript(t, e) {
3246
3243
  const i = t.network || b.bitcoin, r = {
@@ -3251,7 +3248,7 @@ class rt {
3251
3248
  return k.p2tr(r).address;
3252
3249
  }
3253
3250
  static buildScriptTree(t) {
3254
- const e = t.network || b.bitcoin, r = new de(
3251
+ const e = t.network || b.bitcoin, r = new le(
3255
3252
  t.deployerPubKey,
3256
3253
  v(t.contractSaltPubKey),
3257
3254
  e
@@ -3278,11 +3275,10 @@ class rt {
3278
3275
  ], compiledTargetScript: r, network: e };
3279
3276
  }
3280
3277
  }
3281
- at(ct);
3282
- function dt(n) {
3283
- return "privateKey" in n;
3278
+ function lt(n) {
3279
+ return "privateKey" in n && n.privateKey != null;
3284
3280
  }
3285
- class fe {
3281
+ class de {
3286
3282
  /**
3287
3283
  * Tweak a signer
3288
3284
  * @param {UniversalSigner} signer - The signer to tweak (must have privateKey)
@@ -3296,19 +3292,19 @@ class fe {
3296
3292
  t.publicKey[0] === 3 && (i = N.privateNegate(i));
3297
3293
  const r = N.privateAdd(
3298
3294
  i,
3299
- Oi(v(t.publicKey), e.tweakHash)
3295
+ vi(v(t.publicKey), e.tweakHash)
3300
3296
  );
3301
3297
  if (!r)
3302
3298
  throw new Error("Invalid tweaked private key!");
3303
3299
  return E.fromPrivateKey(r, e.network);
3304
3300
  }
3305
3301
  }
3306
- function Ye(n) {
3302
+ function $e(n) {
3307
3303
  return typeof n == "object" && n !== null && "web3" in n && typeof n.web3 == "object" && "getMLDSAPublicKey" in n.web3 && "signMLDSAMessage" in n.web3;
3308
3304
  }
3309
3305
  class nr {
3310
3306
  sha256(t) {
3311
- return C.sha256(t);
3307
+ return D.sha256(t);
3312
3308
  }
3313
3309
  async trySignSchnorrWithOPWallet(t) {
3314
3310
  const e = this.getOPWallet();
@@ -3381,7 +3377,7 @@ class nr {
3381
3377
  return y(e);
3382
3378
  }
3383
3379
  tweakAndSignMessage(t, e, i) {
3384
- const r = fe.tweakSigner(t, { network: i });
3380
+ const r = de.tweakSigner(t, { network: i });
3385
3381
  return this.signMessage(r, e);
3386
3382
  }
3387
3383
  signMessage(t, e) {
@@ -3434,11 +3430,10 @@ class nr {
3434
3430
  if (typeof window > "u")
3435
3431
  return null;
3436
3432
  const t = window;
3437
- return !t.opnet || !Ye(t.opnet) ? null : t.opnet;
3433
+ return !t.opnet || !$e(t.opnet) ? null : t.opnet;
3438
3434
  }
3439
3435
  }
3440
3436
  const ot = new nr();
3441
- at(ct);
3442
3437
  class et {
3443
3438
  constructor(t, e, i = b.bitcoin, r = O.MLDSASecurityLevel.LEVEL2, s) {
3444
3439
  this.network = i, this._securityLevel = r;
@@ -3614,7 +3609,7 @@ class et {
3614
3609
  );
3615
3610
  }
3616
3611
  }
3617
- var qt = /* @__PURE__ */ ((n) => (n[n.MINIMUM = 128] = "MINIMUM", n[n.LOW = 160] = "LOW", n[n.MEDIUM = 192] = "MEDIUM", n[n.HIGH = 224] = "HIGH", n[n.MAXIMUM = 256] = "MAXIMUM", n))(qt || {}), vt = /* @__PURE__ */ ((n) => (n[n.BIP44 = 44] = "BIP44", n[n.BIP49 = 49] = "BIP49", n[n.BIP84 = 84] = "BIP84", n[n.BIP86 = 86] = "BIP86", n))(vt || {});
3612
+ var Vt = /* @__PURE__ */ ((n) => (n[n.MINIMUM = 128] = "MINIMUM", n[n.LOW = 160] = "LOW", n[n.MEDIUM = 192] = "MEDIUM", n[n.HIGH = 224] = "HIGH", n[n.MAXIMUM = 256] = "MAXIMUM", n))(Vt || {}), Et = /* @__PURE__ */ ((n) => (n[n.BIP44 = 44] = "BIP44", n[n.BIP49 = 49] = "BIP49", n[n.BIP84 = 84] = "BIP84", n[n.BIP86 = 86] = "BIP86", n))(Et || {});
3618
3613
  function or(n) {
3619
3614
  switch (n) {
3620
3615
  case 44:
@@ -3629,12 +3624,11 @@ function or(n) {
3629
3624
  return "Unknown BIP standard";
3630
3625
  }
3631
3626
  }
3632
- function Ge(n, t, e, i, r) {
3627
+ function Xe(n, t, e, i, r) {
3633
3628
  return `m/${n}'/${t}'/${e}'/${i}/${r}`;
3634
3629
  }
3635
- at(ct);
3636
3630
  const ar = O.BIP32Factory(N);
3637
- class ge {
3631
+ class pe {
3638
3632
  _phrase;
3639
3633
  _passphrase;
3640
3634
  _network;
@@ -3643,9 +3637,9 @@ class ge {
3643
3637
  _classicalRoot;
3644
3638
  _quantumRoot;
3645
3639
  constructor(t, e = "", i = b.bitcoin, r = O.MLDSASecurityLevel.LEVEL2) {
3646
- if (!Tt.validateMnemonic(t))
3640
+ if (!bt.validateMnemonic(t))
3647
3641
  throw new Error("Invalid mnemonic phrase");
3648
- this._phrase = t, this._passphrase = e, this._network = i, this._securityLevel = r, this._seed = Tt.mnemonicToSeedSync(this._phrase, this._passphrase), this._classicalRoot = ar.fromSeed(this._seed, this._network), this._quantumRoot = O.QuantumBIP32Factory.fromSeed(
3642
+ this._phrase = t, this._passphrase = e, this._network = i, this._securityLevel = r, this._seed = bt.mnemonicToSeedSync(this._phrase, this._passphrase), this._classicalRoot = ar.fromSeed(this._seed, this._network), this._quantumRoot = O.QuantumBIP32Factory.fromSeed(
3649
3643
  this._seed,
3650
3644
  this._network,
3651
3645
  this._securityLevel
@@ -3675,17 +3669,17 @@ class ge {
3675
3669
  [Symbol.dispose]() {
3676
3670
  this.zeroize();
3677
3671
  }
3678
- static generatePhrase(t = qt.MAXIMUM) {
3679
- return Tt.generateMnemonic(t);
3672
+ static generatePhrase(t = Vt.MAXIMUM) {
3673
+ return bt.generateMnemonic(t);
3680
3674
  }
3681
- static generate(t = qt.MAXIMUM, e = "", i = b.bitcoin, r = O.MLDSASecurityLevel.LEVEL2) {
3682
- const s = Tt.generateMnemonic(t);
3683
- return new ge(s, e, i, r);
3675
+ static generate(t = Vt.MAXIMUM, e = "", i = b.bitcoin, r = O.MLDSASecurityLevel.LEVEL2) {
3676
+ const s = bt.generateMnemonic(t);
3677
+ return new pe(s, e, i, r);
3684
3678
  }
3685
3679
  static validate(t) {
3686
- return Tt.validateMnemonic(t);
3680
+ return bt.validateMnemonic(t);
3687
3681
  }
3688
- derive(t = 0, e = 0, i = !1, r = vt.BIP84) {
3682
+ derive(t = 0, e = 0, i = !1, r = Et.BIP84) {
3689
3683
  const s = this.buildClassicalPath(e, t, i, r), o = this._classicalRoot.derivePath(s);
3690
3684
  if (!o.privateKey)
3691
3685
  throw new Error(`Failed to derive classical private key at index ${t}`);
@@ -3738,7 +3732,7 @@ class ge {
3738
3732
  o.push(this.deriveOPWallet(t, i + a, r, s));
3739
3733
  return o;
3740
3734
  }
3741
- deriveMultiple(t, e = 0, i = 0, r = !1, s = vt.BIP84) {
3735
+ deriveMultiple(t, e = 0, i = 0, r = !1, s = Et.BIP84) {
3742
3736
  const o = [];
3743
3737
  for (let a = 0; a < t; a++)
3744
3738
  o.push(this.derive(e + a, i, r, s));
@@ -3764,9 +3758,9 @@ class ge {
3764
3758
  getQuantumRoot() {
3765
3759
  return this._quantumRoot;
3766
3760
  }
3767
- buildClassicalPath(t, e, i, r = vt.BIP84) {
3761
+ buildClassicalPath(t, e, i, r = Et.BIP84) {
3768
3762
  const s = this.getCoinType();
3769
- return Ge(r, s, t, i ? 1 : 0, e);
3763
+ return Xe(r, s, t, i ? 1 : 0, e);
3770
3764
  }
3771
3765
  buildQuantumPath(t, e, i) {
3772
3766
  return `m/360'/${this.getCoinType()}'/${t}'/${i ? 1 : 0}/${e}`;
@@ -3775,8 +3769,8 @@ class ge {
3775
3769
  return this._network.bech32 === b.testnet.bech32 || this._network.bech32 === b.regtest.bech32 ? 1 : 0;
3776
3770
  }
3777
3771
  }
3778
- var Qe = /* @__PURE__ */ ((n) => (n[n.MLDSA44 = 1312] = "MLDSA44", n[n.MLDSA65 = 1952] = "MLDSA65", n[n.MLDSA87 = 2592] = "MLDSA87", n))(Qe || {});
3779
- function oe(n) {
3772
+ var Ye = /* @__PURE__ */ ((n) => (n[n.MLDSA44 = 1312] = "MLDSA44", n[n.MLDSA65 = 1952] = "MLDSA65", n[n.MLDSA87 = 2592] = "MLDSA87", n))(Ye || {});
3773
+ function se(n) {
3780
3774
  switch (n) {
3781
3775
  case 1312:
3782
3776
  return O.MLDSASecurityLevel.LEVEL2;
@@ -3806,28 +3800,28 @@ class cr {
3806
3800
  return this.address;
3807
3801
  }
3808
3802
  }
3809
- var ye = /* @__PURE__ */ ((n) => (n[n.Bitcoin = 0] = "Bitcoin", n[n.Fractal = 1] = "Fractal", n))(ye || {});
3810
- function Se(n) {
3811
- return n && !!(n.tapInternalKey || n.tapMerkleRoot || n.tapLeafScript && n.tapLeafScript.length || n.tapBip32Derivation && n.tapBip32Derivation.length || n.witnessUtxo && Me(n.witnessUtxo.script));
3803
+ var fe = /* @__PURE__ */ ((n) => (n[n.Bitcoin = 0] = "Bitcoin", n[n.Fractal = 1] = "Fractal", n))(fe || {});
3804
+ function ge(n) {
3805
+ return n && !!(n.tapInternalKey || n.tapMerkleRoot || n.tapLeafScript && n.tapLeafScript.length || n.tapBip32Derivation && n.tapBip32Derivation.length || n.witnessUtxo && Re(n.witnessUtxo.script));
3812
3806
  }
3813
3807
  function ur(n) {
3814
3808
  return n.redeemScript ? n.redeemScript : n.witnessScript ? n.witnessScript : n.witnessUtxo ? n.witnessUtxo.script : (n.nonWitnessUtxo, null);
3815
3809
  }
3816
- function we(n, t) {
3810
+ function ye(n, t) {
3817
3811
  if (n.nonWitnessUtxo && !n.redeemScript && !n.witnessScript && !n.witnessUtxo || n.redeemScript)
3818
3812
  return !0;
3819
3813
  const e = ur(n);
3820
- return e ? me(t, e) : !1;
3814
+ return e ? Se(t, e) : !1;
3821
3815
  }
3822
- function me(n, t) {
3823
- return Ui(n, t) !== -1;
3816
+ function Se(n, t) {
3817
+ return Oi(n, t) !== -1;
3824
3818
  }
3825
- class be {
3819
+ class we {
3826
3820
  constructor() {
3827
3821
  }
3828
3822
  }
3829
- var Ot = /* @__PURE__ */ ((n) => (n.Mainnet = "mainnet", n.Testnet = "testnet", n.Regtest = "regtest", n))(Ot || {}), je = /* @__PURE__ */ ((n) => (n.BITCOIN_MAINNET = "BITCOIN_MAINNET", n.BITCOIN_TESTNET = "BITCOIN_TESTNET", n.BITCOIN_TESTNET4 = "BITCOIN_TESTNET4", n.BITCOIN_REGTEST = "BITCOIN_REGTEST", n.BITCOIN_SIGNET = "BITCOIN_SIGNET", n.FRACTAL_BITCOIN_MAINNET = "FRACTAL_BITCOIN_MAINNET", n.FRACTAL_BITCOIN_TESTNET = "FRACTAL_BITCOIN_TESTNET", n))(je || {}), Ze = /* @__PURE__ */ ((n) => (n.ecdsa = "ecdsa", n.bip322 = "bip322-simple", n))(Ze || {}), Je = /* @__PURE__ */ ((n) => (n.ecdsa = "ecdsa", n.schnorr = "schnorr", n))(Je || {});
3830
- class lr extends be {
3823
+ var Pt = /* @__PURE__ */ ((n) => (n.Mainnet = "mainnet", n.Testnet = "testnet", n.Regtest = "regtest", n))(Pt || {}), Ge = /* @__PURE__ */ ((n) => (n.BITCOIN_MAINNET = "BITCOIN_MAINNET", n.BITCOIN_TESTNET = "BITCOIN_TESTNET", n.BITCOIN_TESTNET4 = "BITCOIN_TESTNET4", n.BITCOIN_REGTEST = "BITCOIN_REGTEST", n.BITCOIN_SIGNET = "BITCOIN_SIGNET", n.FRACTAL_BITCOIN_MAINNET = "FRACTAL_BITCOIN_MAINNET", n.FRACTAL_BITCOIN_TESTNET = "FRACTAL_BITCOIN_TESTNET", n))(Ge || {}), Qe = /* @__PURE__ */ ((n) => (n.ecdsa = "ecdsa", n.bip322 = "bip322-simple", n))(Qe || {}), je = /* @__PURE__ */ ((n) => (n.ecdsa = "ecdsa", n.schnorr = "schnorr", n))(je || {});
3824
+ class lr extends we {
3831
3825
  isInitialized = !1;
3832
3826
  constructor() {
3833
3827
  if (super(), !window)
@@ -3879,13 +3873,13 @@ class lr extends be {
3879
3873
  return;
3880
3874
  const t = await this.unisat.getNetwork();
3881
3875
  switch (t) {
3882
- case Ot.Mainnet:
3876
+ case Pt.Mainnet:
3883
3877
  this._network = b.bitcoin;
3884
3878
  break;
3885
- case Ot.Testnet:
3879
+ case Pt.Testnet:
3886
3880
  this._network = b.testnet;
3887
3881
  break;
3888
- case Ot.Regtest:
3882
+ case Pt.Regtest:
3889
3883
  this._network = b.regtest;
3890
3884
  break;
3891
3885
  default:
@@ -3894,7 +3888,7 @@ class lr extends be {
3894
3888
  const e = await this.unisat.getPublicKey();
3895
3889
  if (e === "")
3896
3890
  throw new Error("Unlock your wallet first");
3897
- this._publicKey = le(y(e)), this._p2wpkh = E.getP2WPKHAddress(this, this.network), this._p2tr = E.getTaprootAddress(this, this.network), this._addresses = [this._p2wpkh, this._p2tr], this.isInitialized = !0;
3891
+ this._publicKey = ce(y(e)), this._p2wpkh = E.getP2WPKHAddress(this, this.network), this._p2tr = E.getTaprootAddress(this, this.network), this._addresses = [this._p2wpkh, this._p2tr], this.isInitialized = !0;
3898
3892
  }
3899
3893
  getPublicKey() {
3900
3894
  if (!this.isInitialized)
@@ -3931,7 +3925,7 @@ class lr extends be {
3931
3925
  e.push(a);
3932
3926
  const c = o.data.inputs.map((u, l) => {
3933
3927
  let h = !1, p = !1;
3934
- if (Se(u)) {
3928
+ if (ge(u)) {
3935
3929
  if (u.tapLeafScript && u.tapLeafScript.length > 0) {
3936
3930
  for (const d of u.tapLeafScript)
3937
3931
  if (hr(this.publicKey, d.script)) {
@@ -3941,9 +3935,9 @@ class lr extends be {
3941
3935
  }
3942
3936
  if (!h && u.tapInternalKey) {
3943
3937
  const d = u.tapInternalKey, w = v(this.publicKey);
3944
- D(d, w) && (h = !0, p = !0);
3938
+ C(d, w) && (h = !0, p = !0);
3945
3939
  }
3946
- } else we(u, this.publicKey) && (h = !0, p = !1);
3940
+ } else ye(u, this.publicKey) && (h = !0, p = !1);
3947
3941
  return h ? {
3948
3942
  index: l,
3949
3943
  publicKey: g(this.publicKey),
@@ -3961,7 +3955,7 @@ class lr extends be {
3961
3955
  hasAlreadySignedTapScriptSig(t) {
3962
3956
  for (let e = 0; e < t.length; e++) {
3963
3957
  const i = t[e], r = new Uint8Array(i.pubkey);
3964
- if (D(r, this.publicKey) && i.signature)
3958
+ if (C(r, this.publicKey) && i.signature)
3965
3959
  return !0;
3966
3960
  }
3967
3961
  return !1;
@@ -3969,7 +3963,7 @@ class lr extends be {
3969
3963
  hasAlreadyPartialSig(t) {
3970
3964
  for (let e = 0; e < t.length; e++) {
3971
3965
  const i = t[e], r = new Uint8Array(i.pubkey);
3972
- if (D(r, this.publicKey) && i.signature)
3966
+ if (C(r, this.publicKey) && i.signature)
3973
3967
  return !0;
3974
3968
  }
3975
3969
  return !1;
@@ -4006,7 +4000,7 @@ class lr extends be {
4006
4000
  const i = [];
4007
4001
  for (let r = 0; r < e.length; r++) {
4008
4002
  const s = e[r];
4009
- t.find((a) => D(a.pubkey, s.pubkey)) || i.push(s);
4003
+ t.find((a) => C(a.pubkey, s.pubkey)) || i.push(s);
4010
4004
  }
4011
4005
  return i;
4012
4006
  }
@@ -4015,17 +4009,17 @@ function hr(n, t) {
4015
4009
  return dr(n, t) !== -1;
4016
4010
  }
4017
4011
  function dr(n, t) {
4018
- const e = C.hash160(n), i = v(n), r = P.decompile(t);
4012
+ const e = D.hash160(n), i = v(n), r = P.decompile(t);
4019
4013
  if (r === null) throw new Error("Unknown script error");
4020
- return r.findIndex((s) => typeof s == "number" ? !1 : s instanceof Uint8Array && (D(s, n) || D(s, e) || D(s, i)));
4014
+ return r.findIndex((s) => typeof s == "number" ? !1 : s instanceof Uint8Array && (C(s, n) || C(s, e) || C(s, i)));
4021
4015
  }
4022
- function ti(n) {
4016
+ function Ze(n) {
4023
4017
  return new Map(n);
4024
4018
  }
4025
4019
  function pr(n) {
4026
4020
  return {
4027
4021
  enabled: !0,
4028
- signerMap: n instanceof Map ? n : ti(n)
4022
+ signerMap: n instanceof Map ? n : Ze(n)
4029
4023
  };
4030
4024
  }
4031
4025
  function fr() {
@@ -4040,7 +4034,7 @@ function gr(n) {
4040
4034
  getPrivateKey() {
4041
4035
  if (!n.privateKey)
4042
4036
  throw new Error("Signer does not have a private key");
4043
- return Fe(n.privateKey);
4037
+ return De(n.privateKey);
4044
4038
  },
4045
4039
  sign(t, e) {
4046
4040
  return n.sign(t, e);
@@ -4052,13 +4046,13 @@ function gr(n) {
4052
4046
  }
4053
4047
  };
4054
4048
  }
4055
- function ei(n, t) {
4049
+ function Je(n, t) {
4056
4050
  return {
4057
- publicKey: le(n.publicKey),
4051
+ publicKey: ce(n.publicKey),
4058
4052
  getPrivateKey() {
4059
4053
  if (!t.privateKey)
4060
4054
  throw new Error("Tweaked signer does not have a private key");
4061
- return Fe(t.privateKey);
4055
+ return De(t.privateKey);
4062
4056
  },
4063
4057
  sign(e, i) {
4064
4058
  return t.sign(e, i);
@@ -4073,7 +4067,7 @@ function ei(n, t) {
4073
4067
  };
4074
4068
  }
4075
4069
  var m = /* @__PURE__ */ ((n) => (n[n.GENERIC = 0] = "GENERIC", n[n.FUNDING = 1] = "FUNDING", n[n.DEPLOYMENT = 2] = "DEPLOYMENT", n[n.INTERACTION = 3] = "INTERACTION", n[n.MULTI_SIG = 4] = "MULTI_SIG", n[n.CUSTOM_CODE = 5] = "CUSTOM_CODE", n[n.CANCEL = 6] = "CANCEL", n[n.CONSOLIDATED_SETUP = 7] = "CONSOLIDATED_SETUP", n[n.CONSOLIDATED_REVEAL = 8] = "CONSOLIDATED_REVEAL", n))(m || {});
4076
- function ae(n) {
4070
+ function ne(n) {
4077
4071
  let t = new Uint8Array(0);
4078
4072
  function e(a, c) {
4079
4073
  const u = new Uint8Array(a.length + c.length);
@@ -4083,8 +4077,8 @@ function ae(n) {
4083
4077
  t = e(t, a);
4084
4078
  }
4085
4079
  function r(a) {
4086
- const c = t.length, u = ie.encodingLength(a), l = new Uint8Array(c + u);
4087
- l.set(t, 0), t = l, ie.encode(a, t, c);
4080
+ const c = t.length, u = te.encodingLength(a), l = new Uint8Array(c + u);
4081
+ l.set(t, 0), t = l, te.encode(a, t, c);
4088
4082
  }
4089
4083
  function s(a) {
4090
4084
  r(a.length), i(a);
@@ -4094,8 +4088,8 @@ function ae(n) {
4094
4088
  }
4095
4089
  return o(n), t;
4096
4090
  }
4097
- var ii = /* @__PURE__ */ ((n) => (n[n.REPLACE_BY_FEE = 4294967293] = "REPLACE_BY_FEE", n[n.FINAL = 4294967295] = "FINAL", n))(ii || {}), ri = /* @__PURE__ */ ((n) => (n[n.BLOCKS = 0] = "BLOCKS", n[n.TIMESTAMPS = 1] = "TIMESTAMPS", n))(ri || {});
4098
- class Jt extends Re {
4091
+ var ti = /* @__PURE__ */ ((n) => (n[n.REPLACE_BY_FEE = 4294967293] = "REPLACE_BY_FEE", n[n.FINAL = 4294967295] = "FINAL", n))(ti || {}), ei = /* @__PURE__ */ ((n) => (n[n.BLOCKS = 0] = "BLOCKS", n[n.TIMESTAMPS = 1] = "TIMESTAMPS", n))(ei || {});
4092
+ class jt extends Ce {
4099
4093
  logColor = "#00ffe1";
4100
4094
  finalized = !1;
4101
4095
  /**
@@ -4222,7 +4216,7 @@ class Jt extends Re {
4222
4216
  return e += a, c;
4223
4217
  }
4224
4218
  function r() {
4225
- const a = ie.decode(t, e);
4219
+ const a = te.decode(t, e);
4226
4220
  return e += a.bytes, a.numberValue || 0;
4227
4221
  }
4228
4222
  function s() {
@@ -4435,7 +4429,7 @@ class Jt extends Re {
4435
4429
  async signInput(t, e, i, r, s = !1, o = !1) {
4436
4430
  if (this.anchorInputIndices.has(i)) return;
4437
4431
  const a = r.publicKey;
4438
- let c = Se(e);
4432
+ let c = ge(e);
4439
4433
  s && (c = !c);
4440
4434
  let u = !1, l = !1;
4441
4435
  if (c)
@@ -4446,7 +4440,7 @@ class Jt extends Re {
4446
4440
  `Failed to sign Taproot script path input ${i} (reverse: ${s}): ${h.message}`
4447
4441
  ), l = !0;
4448
4442
  }
4449
- else if (s || we(e, a))
4443
+ else if (s || ye(e, a))
4450
4444
  try {
4451
4445
  await this.signNonTaprootInput(r, t, i), u = !0;
4452
4446
  } catch (h) {
@@ -4485,7 +4479,7 @@ class Jt extends Re {
4485
4479
  }
4486
4480
  async signInputsNonWalletBased(t) {
4487
4481
  if (!this.noSignatures)
4488
- if (this.canUseParallelSigning && dt(this.signer)) {
4482
+ if (this.canUseParallelSigning && lt(this.signer)) {
4489
4483
  let e = /* @__PURE__ */ new Set();
4490
4484
  try {
4491
4485
  const i = await this.signKeyPathInputsParallel(t);
@@ -4584,8 +4578,8 @@ class Jt extends Re {
4584
4578
  const r = this.getTweakerHash();
4585
4579
  r !== void 0 && (i.tweakHash = r);
4586
4580
  }
4587
- if (dt(e))
4588
- return fe.tweakSigner(e, i);
4581
+ if (lt(e))
4582
+ return de.tweakSigner(e, i);
4589
4583
  }
4590
4584
  /**
4591
4585
  * Whether parallel signing can be used for this transaction.
@@ -4604,7 +4598,7 @@ class Jt extends Re {
4604
4598
  const i = this.signer, r = this.getTweakedSigner(!0);
4605
4599
  if (!r)
4606
4600
  throw new Error("Cannot create tweaked signer for parallel signing");
4607
- const s = ei(i, r), o = ki(t, s), a = e ? o.filter((l) => !e.has(l.inputIndex)) : o;
4601
+ const s = Je(i, r), o = Ui(t, s), a = e ? o.filter((l) => !e.has(l.inputIndex)) : o;
4608
4602
  if (a.length === 0)
4609
4603
  return {
4610
4604
  success: !0,
@@ -4613,12 +4607,12 @@ class Jt extends Re {
4613
4607
  durationMs: 0
4614
4608
  };
4615
4609
  let c, u = !1;
4616
- this.parallelSigningConfig instanceof ke ? c = this.parallelSigningConfig : (c = ke.getInstance(this.parallelSigningConfig), c.isPreservingWorkers || (u = !0));
4610
+ this.parallelSigningConfig instanceof Oe ? c = this.parallelSigningConfig : (c = Oe.getInstance(this.parallelSigningConfig), c.isPreservingWorkers || (u = !0));
4617
4611
  try {
4618
4612
  await c.initialize();
4619
4613
  const l = await c.signBatch(a, s);
4620
4614
  if (l.success)
4621
- Bi(t, l, s);
4615
+ ki(t, l, s);
4622
4616
  else {
4623
4617
  const p = [...l.errors.entries()].map(([d, w]) => `Input ${d}: ${w}`).join(", ");
4624
4618
  this.error(`Parallel signing had errors: ${p}`);
@@ -4639,13 +4633,13 @@ class Jt extends Re {
4639
4633
  }).output;
4640
4634
  }
4641
4635
  generateP2SHRedeemScriptLegacy(t) {
4642
- const e = C.hash160(this.signer.publicKey), i = P.compile([
4636
+ const e = D.hash160(this.signer.publicKey), i = P.compile([
4643
4637
  f.OP_DUP,
4644
4638
  f.OP_HASH160,
4645
4639
  e,
4646
4640
  f.OP_EQUALVERIFY,
4647
4641
  f.OP_CHECKSIG
4648
- ]), r = C.hash160(i), s = P.compile([
4642
+ ]), r = D.hash160(i), s = P.compile([
4649
4643
  f.OP_HASH160,
4650
4644
  r,
4651
4645
  f.OP_EQUAL
@@ -4698,14 +4692,14 @@ class Jt extends Re {
4698
4692
  script: r
4699
4693
  }
4700
4694
  };
4701
- if (_i(r))
4695
+ if (Bi(r))
4702
4696
  if (t.nonWitnessUtxo)
4703
4697
  s.nonWitnessUtxo = t.nonWitnessUtxo instanceof Uint8Array ? t.nonWitnessUtxo : y(t.nonWitnessUtxo);
4704
4698
  else
4705
4699
  throw new Error("Missing nonWitnessUtxo for P2PKH UTXO");
4706
- else if (!(Be(r) || Li(r))) if (_e(r))
4700
+ else if (!(Ue(r) || _i(r))) if (ke(r))
4707
4701
  this.processP2WSHInput(t, s, e);
4708
- else if (Ki(r)) {
4702
+ else if (Li(r)) {
4709
4703
  let o;
4710
4704
  if (t.redeemScript)
4711
4705
  o = t.redeemScript instanceof Uint8Array ? t.redeemScript : y(t.redeemScript);
@@ -4729,16 +4723,16 @@ class Jt extends Re {
4729
4723
  const c = a.redeem.output;
4730
4724
  if (!c)
4731
4725
  throw new Error("Failed to extract redeem output from P2SH UTXO");
4732
- t.nonWitnessUtxo && (s.nonWitnessUtxo = t.nonWitnessUtxo instanceof Uint8Array ? t.nonWitnessUtxo : y(t.nonWitnessUtxo)), Be(c) ? Reflect.deleteProperty(s, "nonWitnessUtxo") : _e(c) ? (Reflect.deleteProperty(s, "nonWitnessUtxo"), this.processP2WSHInput(t, s, e)) : Reflect.deleteProperty(s, "witnessUtxo");
4733
- } else if (Me(r)) {
4726
+ t.nonWitnessUtxo && (s.nonWitnessUtxo = t.nonWitnessUtxo instanceof Uint8Array ? t.nonWitnessUtxo : y(t.nonWitnessUtxo)), Ue(c) ? Reflect.deleteProperty(s, "nonWitnessUtxo") : ke(c) ? (Reflect.deleteProperty(s, "nonWitnessUtxo"), this.processP2WSHInput(t, s, e)) : Reflect.deleteProperty(s, "witnessUtxo");
4727
+ } else if (Re(r)) {
4734
4728
  if (this.sighashTypes) {
4735
- const o = Jt.calculateSignHash(this.sighashTypes);
4729
+ const o = jt.calculateSignHash(this.sighashTypes);
4736
4730
  o && (s.sighashType = o);
4737
4731
  }
4738
4732
  this.addressRotationEnabled ? s.tapInternalKey = this.internalPubKeyToXOnlyForInput(e) : (this.tweakSigner(), s.tapInternalKey = this.internalPubKeyToXOnly());
4739
- } else if (xi(r))
4733
+ } else if (Ki(r))
4740
4734
  this.anchorInputIndices.add(e), s.isPayToAnchor = !0;
4741
- else if (Di(r) || Ci(r))
4735
+ else if (xi(r) || Ci(r))
4742
4736
  if (t.nonWitnessUtxo)
4743
4737
  s.nonWitnessUtxo = t.nonWitnessUtxo instanceof Uint8Array ? t.nonWitnessUtxo : y(t.nonWitnessUtxo);
4744
4738
  else
@@ -4802,11 +4796,11 @@ class Jt extends Re {
4802
4796
  const h = [e.partialSig[0].signature, e.witnessScript];
4803
4797
  return {
4804
4798
  finalScriptSig: void 0,
4805
- finalScriptWitness: ae(h)
4799
+ finalScriptWitness: ne(h)
4806
4800
  };
4807
4801
  }
4808
4802
  }
4809
- return Ne(
4803
+ return Fe(
4810
4804
  t,
4811
4805
  e,
4812
4806
  i,
@@ -4831,7 +4825,7 @@ class Jt extends Re {
4831
4825
  );
4832
4826
  return {
4833
4827
  finalScriptSig: void 0,
4834
- finalScriptWitness: ae(i)
4828
+ finalScriptWitness: ne(i)
4835
4829
  };
4836
4830
  }
4837
4831
  async signInputsWalletBased(t) {
@@ -4893,7 +4887,7 @@ class Jt extends Re {
4893
4887
  isTaprootScriptSpend(t, e) {
4894
4888
  if (t.tapLeafScript && t.tapLeafScript.length > 0) {
4895
4889
  for (const i of t.tapLeafScript)
4896
- if (me(e, i.script))
4890
+ if (Se(e, i.script))
4897
4891
  return !0;
4898
4892
  }
4899
4893
  return !1;
@@ -5025,12 +5019,12 @@ const yr = /* @__PURE__ */ new Map([
5025
5019
  ])
5026
5020
  ]
5027
5021
  ]);
5028
- function De(n) {
5022
+ function Ke(n) {
5029
5023
  const t = yr.get(n);
5030
5024
  if (!t) throw new Error("Unsupported network for chain ID retrieval");
5031
5025
  return t.slice();
5032
5026
  }
5033
- const Ce = new Uint8Array([
5027
+ const xe = new Uint8Array([
5034
5028
  231,
5035
5029
  132,
5036
5030
  153,
@@ -5063,10 +5057,8 @@ const Ce = new Uint8Array([
5063
5057
  64,
5064
5058
  121,
5065
5059
  57
5066
- ]);
5067
- at(ct);
5068
- const G = 330n, It = 297n, ce = y("51024e73");
5069
- class A extends Jt {
5060
+ ]), G = 330n, At = 297n, oe = y("51024e73");
5061
+ class A extends jt {
5070
5062
  static MINIMUM_DUST = 330n;
5071
5063
  logColor = "#785def";
5072
5064
  debugFees = !1;
@@ -5182,7 +5174,7 @@ class A extends Jt {
5182
5174
  * @returns {Buffer}
5183
5175
  */
5184
5176
  static witnessStackToScriptWitness(t) {
5185
- return ae(t);
5177
+ return ne(t);
5186
5178
  }
5187
5179
  addOPReturn(t) {
5188
5180
  const e = P.compile([f.OP_RETURN, t]);
@@ -5194,7 +5186,7 @@ class A extends Jt {
5194
5186
  addAnchor() {
5195
5187
  this.addOutput({
5196
5188
  value: B(0n),
5197
- script: ce
5189
+ script: oe
5198
5190
  });
5199
5191
  }
5200
5192
  async getFundingTransactionParameters() {
@@ -5300,7 +5292,7 @@ class A extends Jt {
5300
5292
  throw new Error("Output value is 0 and no script provided");
5301
5293
  if (i.script.length < 2)
5302
5294
  throw new Error("Output script is too short");
5303
- if (i.script[0] !== f.OP_RETURN && !D(i.script, ce))
5295
+ if (i.script[0] !== f.OP_RETURN && !C(i.script, oe))
5304
5296
  throw new Error(
5305
5297
  "Output script must start with OP_RETURN or be an ANCHOR when value is 0"
5306
5298
  );
@@ -5352,17 +5344,17 @@ class A extends Jt {
5352
5344
  const S = [];
5353
5345
  for (let F = 0; F < 10; F++)
5354
5346
  S.push(new Uint8Array(0));
5355
- const T = new Uint8Array(72);
5347
+ const I = new Uint8Array(72);
5356
5348
  return {
5357
5349
  finalScriptWitness: A.witnessStackToScriptWitness([
5358
5350
  ...S,
5359
- T,
5351
+ I,
5360
5352
  d.witnessScript
5361
5353
  ])
5362
5354
  };
5363
5355
  }
5364
5356
  if (p === 0 && this.tapLeafScript) {
5365
- const S = new Uint8Array(32), T = this.tapLeafScript.script, F = new Uint8Array(65);
5357
+ const S = new Uint8Array(32), I = this.tapLeafScript.script, F = new Uint8Array(65);
5366
5358
  return {
5367
5359
  finalScriptWitness: A.witnessStackToScriptWitness([
5368
5360
  S,
@@ -5370,14 +5362,14 @@ class A extends Jt {
5370
5362
  // It's a tapScriptSig, which is Schnorr
5371
5363
  r,
5372
5364
  // Second Schnorr signature
5373
- T,
5365
+ I,
5374
5366
  F
5375
5367
  ])
5376
5368
  };
5377
5369
  }
5378
5370
  if (d.witnessUtxo) {
5379
- const S = d.witnessUtxo.script, T = nt.script.decompile(S);
5380
- if (T && T.length === 5 && T[0] === f.OP_DUP && T[1] === f.OP_HASH160 && T[3] === f.OP_EQUALVERIFY && T[4] === f.OP_CHECKSIG)
5371
+ const S = d.witnessUtxo.script, I = nt.script.decompile(S);
5372
+ if (I && I.length === 5 && I[0] === f.OP_DUP && I[1] === f.OP_HASH160 && I[3] === f.OP_EQUALVERIFY && I[4] === f.OP_CHECKSIG)
5381
5373
  return {
5382
5374
  finalScriptSig: nt.script.compile([
5383
5375
  s,
@@ -5395,24 +5387,24 @@ class A extends Jt {
5395
5387
  ])
5396
5388
  };
5397
5389
  if (d.redeemScript) {
5398
- const T = [s, d.witnessScript];
5390
+ const I = [s, d.witnessScript];
5399
5391
  return {
5400
5392
  finalScriptSig: d.redeemScript,
5401
- finalScriptWitness: A.witnessStackToScriptWitness(T)
5393
+ finalScriptWitness: A.witnessStackToScriptWitness(I)
5402
5394
  };
5403
5395
  }
5404
5396
  const S = nt.script.decompile(d.witnessScript);
5405
5397
  if (S && S.length >= 4) {
5406
- const T = S[0], F = S[S.length - 1];
5407
- if (typeof T == "number" && T >= f.OP_1 && F === f.OP_CHECKMULTISIG) {
5408
- const Ct = T - f.OP_1 + 1, Rt = [];
5409
- for (let Ft = 0; Ft < Ct; Ft++)
5410
- Rt.push(s);
5398
+ const I = S[0], F = S[S.length - 1];
5399
+ if (typeof I == "number" && I >= f.OP_1 && F === f.OP_CHECKMULTISIG) {
5400
+ const xt = I - f.OP_1 + 1, Ct = [];
5401
+ for (let Dt = 0; Dt < xt; Dt++)
5402
+ Ct.push(s);
5411
5403
  return {
5412
5404
  finalScriptWitness: A.witnessStackToScriptWitness([
5413
5405
  new Uint8Array(0),
5414
5406
  // OP_0 due to multisig bug
5415
- ...Rt,
5407
+ ...Ct,
5416
5408
  d.witnessScript
5417
5409
  ])
5418
5410
  };
@@ -5455,7 +5447,7 @@ class A extends Jt {
5455
5447
  s,
5456
5448
  o
5457
5449
  ])
5458
- } : Ne(
5450
+ } : Fe(
5459
5451
  p,
5460
5452
  d,
5461
5453
  w,
@@ -5481,7 +5473,7 @@ class A extends Jt {
5481
5473
  return this.transaction = V.fromBase64(t, {
5482
5474
  network: this.network,
5483
5475
  version: this.txVersion
5484
- }), this.signed = !1, this.sighashTypes = [re.SIGHASH_ANYONECANPAY, re.SIGHASH_ALL], await this.signPSBT();
5476
+ }), this.signed = !1, this.sighashTypes = [ee.SIGHASH_ANYONECANPAY, ee.SIGHASH_ALL], await this.signPSBT();
5485
5477
  }
5486
5478
  setPSBT(t) {
5487
5479
  this.transaction = t;
@@ -5593,8 +5585,8 @@ class A extends Jt {
5593
5585
  const t = v(this.tweakedSigner.publicKey), e = this.signer.publicKey;
5594
5586
  if (e.length !== 33)
5595
5587
  throw new Error("Original public key must be compressed (33 bytes)");
5596
- const i = De(this.network), r = new W();
5597
- r.writeU8(O.MLDSASecurityLevel.LEVEL2), r.writeBytes(this.hashedPublicKey), r.writeBytes(t), r.writeBytes(e), r.writeBytes(Ce), r.writeBytes(i);
5588
+ const i = Ke(this.network), r = new W();
5589
+ r.writeU8(O.MLDSASecurityLevel.LEVEL2), r.writeBytes(this.hashedPublicKey), r.writeBytes(t), r.writeBytes(e), r.writeBytes(xe), r.writeBytes(i);
5598
5590
  const s = r.getBuffer(), o = ot.signMessage(this.tweakedSigner, s);
5599
5591
  if (!ot.verifySignature(t, s, o.signature))
5600
5592
  throw new Error("Could not verify generated legacy signature for MLDSA link request");
@@ -5608,11 +5600,11 @@ class A extends Jt {
5608
5600
  const t = v(this.tweakedSigner.publicKey), e = this.signer.publicKey;
5609
5601
  if (e.length !== 33)
5610
5602
  throw new Error("Original public key must be compressed (33 bytes)");
5611
- const i = De(this.network), r = oe(this.mldsaSigner.publicKey.length);
5603
+ const i = Ke(this.network), r = se(this.mldsaSigner.publicKey.length);
5612
5604
  if (r !== O.MLDSASecurityLevel.LEVEL2)
5613
5605
  throw new Error("Only MLDSA level 2 is supported for link requests");
5614
5606
  const s = new W();
5615
- s.writeU8(r), s.writeBytes(this.hashedPublicKey), s.writeBytes(this.mldsaSigner.publicKey), s.writeBytes(t), s.writeBytes(e), s.writeBytes(Ce), s.writeBytes(i);
5607
+ s.writeU8(r), s.writeBytes(this.hashedPublicKey), s.writeBytes(this.mldsaSigner.publicKey), s.writeBytes(t), s.writeBytes(e), s.writeBytes(xe), s.writeBytes(i);
5616
5608
  const o = s.getBuffer(), a = ot.signMLDSAMessage(this.mldsaSigner, o);
5617
5609
  if (!ot.verifyMLDSASignature(
5618
5610
  this.mldsaSigner,
@@ -5633,7 +5625,7 @@ class A extends Jt {
5633
5625
  verifyRequest: !!t.revealMLDSAPublicKey,
5634
5626
  publicKey: i.publicKey,
5635
5627
  hashedPublicKey: this.hashedPublicKey,
5636
- level: oe(i.publicKey.length),
5628
+ level: se(i.publicKey.length),
5637
5629
  legacySignature: r,
5638
5630
  mldsaSignature: s
5639
5631
  }
@@ -5740,13 +5732,13 @@ class A extends Jt {
5740
5732
  addFeeToOutput(t, e, i, r) {
5741
5733
  if (r) {
5742
5734
  let s;
5743
- t > G + It ? s = It : s = t, this.addOutput(
5735
+ t > G + At ? s = At : s = t, this.addOutput(
5744
5736
  {
5745
5737
  value: B(s),
5746
5738
  address: e
5747
5739
  },
5748
5740
  !0
5749
- ), s === It && t - It > G && this.addOutput(
5741
+ ), s === At && t - At > G && this.addOutput(
5750
5742
  {
5751
5743
  value: B(t - s),
5752
5744
  address: i.address
@@ -5892,7 +5884,7 @@ class A extends Jt {
5892
5884
  return !1;
5893
5885
  }
5894
5886
  }
5895
- class $t extends A {
5887
+ class zt extends A {
5896
5888
  type = m.CUSTOM_CODE;
5897
5889
  /**
5898
5890
  * The contract address
@@ -5953,7 +5945,7 @@ class $t extends A {
5953
5945
  constructor(t) {
5954
5946
  if (super(t), !t.script) throw new Error("Bitcoin script is required");
5955
5947
  if (!t.witnesses) throw new Error("Witness(es) are required");
5956
- this.witnesses = t.witnesses, this.randomBytes = t.randomBytes || M.rndBytes(), this.LOCK_LEAF_SCRIPT = this.defineLockScript(), this.scriptSeed = this.getContractSeed(), this.contractSigner = E.fromSeedKeyPair(this.scriptSeed, this.network), this.generator = new qe(this.internalPubKeyToXOnly(), this.network), this.compiledTargetScript = this.generator.compile(t.script), this.scriptTree = this.getScriptTree(), this.internalInit(), this._scriptAddress = pe.generatePKSH(this.scriptSeed, this.network);
5948
+ this.witnesses = t.witnesses, this.randomBytes = t.randomBytes || M.rndBytes(), this.LOCK_LEAF_SCRIPT = this.defineLockScript(), this.scriptSeed = this.getContractSeed(), this.contractSigner = E.fromSeedKeyPair(this.scriptSeed, this.network), this.generator = new Ve(this.internalPubKeyToXOnly(), this.network), this.compiledTargetScript = this.generator.compile(t.script), this.scriptTree = this.getScriptTree(), this.internalInit(), this._scriptAddress = he.generatePKSH(this.scriptSeed, this.network);
5957
5949
  }
5958
5950
  /**
5959
5951
  * @description Get the contract address (PKSH)
@@ -6024,7 +6016,7 @@ class $t extends A {
6024
6016
  }
6025
6017
  t.signInput(0, this.getSignerKey()), t.finalizeInput(0, this.customFinalizer);
6026
6018
  const e = /* @__PURE__ */ new Set([0]);
6027
- if (this.canUseParallelSigning && dt(this.signer))
6019
+ if (this.canUseParallelSigning && lt(this.signer))
6028
6020
  try {
6029
6021
  const i = await this.signKeyPathInputsParallel(
6030
6022
  t,
@@ -6093,7 +6085,7 @@ class $t extends A {
6093
6085
  * @private
6094
6086
  */
6095
6087
  getContractSeed() {
6096
- return C.hash256(this.randomBytes);
6088
+ return D.hash256(this.randomBytes);
6097
6089
  }
6098
6090
  /**
6099
6091
  * Finalize the transaction
@@ -6159,7 +6151,7 @@ class $t extends A {
6159
6151
  ];
6160
6152
  }
6161
6153
  }
6162
- class Ae extends A {
6154
+ class me extends A {
6163
6155
  static MAXIMUM_CALLDATA_SIZE = 1024 * 1024;
6164
6156
  // 1MB
6165
6157
  /**
@@ -6195,7 +6187,7 @@ class Ae extends A {
6195
6187
  this.challenge = t.challenge, this.LOCK_LEAF_SCRIPT = this.defineLockScript(), this.disableAutoRefund = t.disableAutoRefund || !1, this.epochChallenge = q.generateTimeLockAddress(
6196
6188
  this.challenge.publicKey.originalPublicKeyBuffer(),
6197
6189
  this.network
6198
- ), this.calldata = $.compress(t.calldata), this.randomBytes = t.randomBytes || M.rndBytes(), this.scriptSigner = this.generateKeyPairFromSeed(), this.calldataGenerator = new he(
6190
+ ), this.calldata = $.compress(t.calldata), this.randomBytes = t.randomBytes || M.rndBytes(), this.scriptSigner = this.generateKeyPairFromSeed(), this.calldataGenerator = new ue(
6199
6191
  this.signer.publicKey,
6200
6192
  this.scriptSignerXOnlyPubKey(),
6201
6193
  this.network
@@ -6364,7 +6356,7 @@ class Ae extends A {
6364
6356
  }
6365
6357
  }
6366
6358
  async signInputsNonWalletBased(t) {
6367
- if (await this.signInput(t, t.data.inputs[0], 0, this.scriptSigner), await this.signInput(t, t.data.inputs[0], 0, this.getSignerKey()), t.finalizeInput(0, this.customFinalizer.bind(this)), this.canUseParallelSigning && dt(this.signer)) {
6359
+ if (await this.signInput(t, t.data.inputs[0], 0, this.scriptSigner), await this.signInput(t, t.data.inputs[0], 0, this.getSignerKey()), t.finalizeInput(0, this.customFinalizer.bind(this)), this.canUseParallelSigning && lt(this.signer)) {
6368
6360
  let e = /* @__PURE__ */ new Set();
6369
6361
  try {
6370
6362
  const i = await this.signKeyPathInputsParallel(t, /* @__PURE__ */ new Set([0]));
@@ -6424,7 +6416,7 @@ class Ae extends A {
6424
6416
  };
6425
6417
  }
6426
6418
  }
6427
- class bt extends A {
6419
+ class wt extends A {
6428
6420
  static MAXIMUM_CONTRACT_SIZE = 128 * 1024;
6429
6421
  type = m.DEPLOYMENT;
6430
6422
  challenge;
@@ -6500,12 +6492,12 @@ class bt extends A {
6500
6492
  if (super(t), !this.hashedPublicKey)
6501
6493
  throw new Error("MLDSA signer must be defined to deploy a contract.");
6502
6494
  if (this.bytecode = $.compress(
6503
- new Uint8Array([...Xe, ...t.bytecode])
6495
+ new Uint8Array([...qe, ...t.bytecode])
6504
6496
  ), this.verifyBytecode(), t.calldata && (this.calldata = t.calldata, this.verifyCalldata()), !t.challenge) throw new Error("Challenge solution is required");
6505
6497
  if (this.randomBytes = t.randomBytes || M.rndBytes(), this.challenge = t.challenge, this.LOCK_LEAF_SCRIPT = this.defineLockScript(), this.epochChallenge = q.generateTimeLockAddress(
6506
6498
  this.challenge.publicKey.originalPublicKeyBuffer(),
6507
6499
  this.network
6508
- ), this.contractSeed = this.getContractSeed(), this.contractSigner = E.fromSeedKeyPair(this.contractSeed, this.network), this.deploymentGenerator = new de(
6500
+ ), this.contractSeed = this.getContractSeed(), this.contractSigner = E.fromSeedKeyPair(this.contractSeed, this.network), this.deploymentGenerator = new le(
6509
6501
  this.signer.publicKey,
6510
6502
  this.contractSignerXOnlyPubKey(),
6511
6503
  this.network
@@ -6626,7 +6618,7 @@ class bt extends A {
6626
6618
  }
6627
6619
  t.signInput(0, this.contractSigner), t.signInput(0, this.getSignerKey()), t.finalizeInput(0, this.customFinalizer.bind(this));
6628
6620
  const e = /* @__PURE__ */ new Set([0]);
6629
- if (this.canUseParallelSigning && dt(this.signer))
6621
+ if (this.canUseParallelSigning && lt(this.signer))
6630
6622
  try {
6631
6623
  const i = await this.signKeyPathInputsParallel(
6632
6624
  t,
@@ -6694,12 +6686,12 @@ class bt extends A {
6694
6686
  return t.linkMLDSAPublicKeyToAddress && this.generateMLDSALinkRequest(t, e), e;
6695
6687
  }
6696
6688
  verifyCalldata() {
6697
- if (this.calldata && this.calldata.length > Ae.MAXIMUM_CALLDATA_SIZE)
6689
+ if (this.calldata && this.calldata.length > me.MAXIMUM_CALLDATA_SIZE)
6698
6690
  throw new Error("Calldata size overflow.");
6699
6691
  }
6700
6692
  verifyBytecode() {
6701
6693
  if (!this.bytecode) throw new Error("Bytecode is required");
6702
- if (this.bytecode.length > bt.MAXIMUM_CONTRACT_SIZE)
6694
+ if (this.bytecode.length > wt.MAXIMUM_CONTRACT_SIZE)
6703
6695
  throw new Error("Contract size overflow.");
6704
6696
  }
6705
6697
  /**
@@ -6709,8 +6701,8 @@ class bt extends A {
6709
6701
  getContractSeed() {
6710
6702
  if (!this.bytecode)
6711
6703
  throw new Error("Bytecode is required");
6712
- const t = this.internalPubKeyToXOnly(), e = C.hash256(this.randomBytes), i = C.hash256(this.bytecode), r = ht([t, e, i]);
6713
- return C.hash256(r);
6704
+ const t = this.internalPubKeyToXOnly(), e = D.hash256(this.randomBytes), i = D.hash256(this.bytecode), r = ut([t, e, i]);
6705
+ return D.hash256(r);
6714
6706
  }
6715
6707
  /**
6716
6708
  * Finalize the transaction
@@ -6774,7 +6766,7 @@ class bt extends A {
6774
6766
  ];
6775
6767
  }
6776
6768
  }
6777
- class Xt extends A {
6769
+ class qt extends A {
6778
6770
  type = m.FUNDING;
6779
6771
  amount;
6780
6772
  splitInputsInto;
@@ -6820,7 +6812,7 @@ class Xt extends A {
6820
6812
  return this.signer;
6821
6813
  }
6822
6814
  }
6823
- class Yt extends Ae {
6815
+ class $t extends me {
6824
6816
  type = m.INTERACTION;
6825
6817
  compiledTargetScript;
6826
6818
  scriptTree;
@@ -6902,7 +6894,7 @@ class tt extends A {
6902
6894
  throw new Error("Calldata is required");
6903
6895
  if (!t.challenge)
6904
6896
  throw new Error("Challenge solution is required");
6905
- if (this.disableAutoRefund = t.disableAutoRefund || !1, this.contractSecret = y(t.contract.replace("0x", "")), this.calldata = $.compress(t.calldata), this.challenge = t.challenge, this.randomBytes = t.randomBytes || M.rndBytes(), this.scriptSigner = this.generateKeyPairFromSeed(), this.p2wdaGenerator = new xt(
6897
+ if (this.disableAutoRefund = t.disableAutoRefund || !1, this.contractSecret = y(t.contract.replace("0x", "")), this.calldata = $.compress(t.calldata), this.challenge = t.challenge, this.randomBytes = t.randomBytes || M.rndBytes(), this.scriptSigner = this.generateKeyPairFromSeed(), this.p2wdaGenerator = new Lt(
6906
6898
  this.signer.publicKey,
6907
6899
  this.scriptSignerXOnlyPubKey(),
6908
6900
  this.network
@@ -7018,7 +7010,7 @@ class tt extends A {
7018
7010
  if (!this.compiledOperationData)
7019
7011
  throw new Error("Operation data not compiled");
7020
7012
  const t = this.compiledOperationData.length;
7021
- if (!xt.validateWitnessSize(t)) {
7013
+ if (!Lt.validateWitnessSize(t)) {
7022
7014
  const i = t + 64, r = Math.ceil(i * 0.7), s = Math.ceil(
7023
7015
  r / tt.MAX_BYTES_PER_WITNESS
7024
7016
  );
@@ -7038,10 +7030,10 @@ class tt extends A {
7038
7030
  throw new Error(`No witness script for P2WDA input #${t}`);
7039
7031
  if (!this.compiledOperationData)
7040
7032
  throw new Error("Operation data not compiled");
7041
- const i = e.partialSig[0].signature, r = ht([i, this.compiledOperationData]), o = ot.signMessage(
7033
+ const i = e.partialSig[0].signature, r = ut([i, this.compiledOperationData]), o = ot.signMessage(
7042
7034
  this.signer,
7043
7035
  r
7044
- ).signature, a = ht([o, this.compiledOperationData]), c = $.compress(a), u = this.splitIntoWitnessChunks(c);
7036
+ ).signature, a = ut([o, this.compiledOperationData]), c = $.compress(a), u = this.splitIntoWitnessChunks(c);
7045
7037
  if (u.length > tt.MAX_WITNESS_FIELDS)
7046
7038
  throw new Error(
7047
7039
  `Compressed data needs ${u.length} witness fields, max is ${tt.MAX_WITNESS_FIELDS}`
@@ -7070,7 +7062,7 @@ class tt extends A {
7070
7062
  return e;
7071
7063
  }
7072
7064
  }
7073
- class Te extends A {
7065
+ class be extends A {
7074
7066
  type = m.CANCEL;
7075
7067
  /**
7076
7068
  * The tap leaf script for spending
@@ -7201,7 +7193,7 @@ class Te extends A {
7201
7193
  async signInputsNonWalletBased(t) {
7202
7194
  await this.signInput(t, t.data.inputs[0], 0, this.getSignerKey()), t.finalizeInput(0, this.customFinalizer.bind(this));
7203
7195
  let e = /* @__PURE__ */ new Set();
7204
- if (this.canUseParallelSigning && dt(this.signer))
7196
+ if (this.canUseParallelSigning && lt(this.signer))
7205
7197
  try {
7206
7198
  const i = await this.signKeyPathInputsParallel(
7207
7199
  t,
@@ -7259,7 +7251,7 @@ class Te extends A {
7259
7251
  };
7260
7252
  }
7261
7253
  }
7262
- class si extends A {
7254
+ class ii extends A {
7263
7255
  type = m.INTERACTION;
7264
7256
  /** Random bytes for interaction (same as InteractionTransaction) */
7265
7257
  randomBytes;
@@ -7298,12 +7290,12 @@ class si extends A {
7298
7290
  throw new Error("Calldata is required");
7299
7291
  if (!t.challenge)
7300
7292
  throw new Error("Challenge solution is required");
7301
- if (this.contractAddress = t.to, this.contractSecret = y(t.contract.replace("0x", "")), this.disableAutoRefund = t.disableAutoRefund || !1, this.maxChunkSize = t.maxChunkSize ?? I.MAX_CHUNK_SIZE, this.contractSecret.length !== 32)
7293
+ if (this.contractAddress = t.to, this.contractSecret = y(t.contract.replace("0x", "")), this.disableAutoRefund = t.disableAutoRefund || !1, this.maxChunkSize = t.maxChunkSize ?? T.MAX_CHUNK_SIZE, this.contractSecret.length !== 32)
7302
7294
  throw new Error("Invalid contract secret length. Expected 32 bytes.");
7303
7295
  if (this.calldata = $.compress(t.calldata), this.randomBytes = t.randomBytes || M.rndBytes(), this.scriptSigner = E.fromSeedKeyPair(this.randomBytes, this.network), this.challenge = t.challenge, this.epochChallenge = q.generateTimeLockAddress(
7304
7296
  this.challenge.publicKey.originalPublicKeyBuffer(),
7305
7297
  this.network
7306
- ), this.calldataGenerator = new he(
7298
+ ), this.calldataGenerator = new ue(
7307
7299
  this.signer.publicKey,
7308
7300
  v(this.scriptSigner.publicKey),
7309
7301
  this.network
@@ -7322,7 +7314,7 @@ class si extends A {
7322
7314
  this.priorityFee,
7323
7315
  this.generateFeatures(t)
7324
7316
  );
7325
- this.hashCommitmentGenerator = new I(
7317
+ this.hashCommitmentGenerator = new T(
7326
7318
  this.signer.publicKey,
7327
7319
  this.network
7328
7320
  ), this.commitmentOutputs = this.hashCommitmentGenerator.prepareChunks(
@@ -7520,14 +7512,14 @@ class si extends A {
7520
7512
  calculateValuePerOutput() {
7521
7513
  if (this.cachedValuePerOutput !== null)
7522
7514
  return this.cachedValuePerOutput;
7523
- const t = this.commitmentOutputs.length, e = this.getTransactionOPNetFee(), i = e < G ? G : e, r = this.estimateRevealVBytes(), s = BigInt(Math.ceil(r * this.feeRate)), o = i + s + A.MINIMUM_DUST, a = BigInt(Math.ceil(Number(o) / t)), c = I.MIN_OUTPUT_VALUE;
7515
+ const t = this.commitmentOutputs.length, e = this.getTransactionOPNetFee(), i = e < G ? G : e, r = this.estimateRevealVBytes(), s = BigInt(Math.ceil(r * this.feeRate)), o = i + s + A.MINIMUM_DUST, a = BigInt(Math.ceil(Number(o) / t)), c = T.MIN_OUTPUT_VALUE;
7524
7516
  return this.cachedValuePerOutput = a > c ? a : c, this.cachedValuePerOutput;
7525
7517
  }
7526
7518
  /**
7527
7519
  * Get refund address.
7528
7520
  */
7529
7521
  getRefundAddress() {
7530
- return this.from ? this.from : pe.generatePKSH(this.signer.publicKey, this.network);
7522
+ return this.from ? this.from : he.generatePKSH(this.signer.publicKey, this.network);
7531
7523
  }
7532
7524
  /**
7533
7525
  * Generate features (same as InteractionTransaction).
@@ -7554,16 +7546,16 @@ class si extends A {
7554
7546
  * Validate output count is within standard tx limits.
7555
7547
  */
7556
7548
  validateOutputCount() {
7557
- const t = I.calculateMaxInputsPerTx();
7549
+ const t = T.calculateMaxInputsPerTx();
7558
7550
  if (this.commitmentOutputs.length > t) {
7559
- const e = I.calculateMaxDataPerTx();
7551
+ const e = T.calculateMaxDataPerTx();
7560
7552
  throw new Error(
7561
7553
  `Data too large: ${this.commitmentOutputs.length} P2WSH outputs needed, max ${t} per standard transaction (~${Math.floor(e / 1024)}KB). Compiled data: ${this.compiledTargetScript.length} bytes.`
7562
7554
  );
7563
7555
  }
7564
7556
  }
7565
7557
  }
7566
- class ni {
7558
+ class ri {
7567
7559
  debug = !1;
7568
7560
  DUMMY_PUBKEY = new Uint8Array(32).fill(1);
7569
7561
  P2TR_SCRIPT = Uint8Array.from([81, 32, ...this.DUMMY_PUBKEY]);
@@ -7586,7 +7578,7 @@ class ni {
7586
7578
  return e;
7587
7579
  if (!("signer" in t))
7588
7580
  throw new Error('Field "signer" not provided, OP_WALLET not detected.');
7589
- const r = await new Te(t).signTransaction();
7581
+ const r = await new be(t).signTransaction();
7590
7582
  return {
7591
7583
  transaction: r.toHex(),
7592
7584
  nextUTXOs: this.getUTXOAsTransaction(r, t.from, 0),
@@ -7609,7 +7601,7 @@ class ni {
7609
7601
  throw new Error('Field "signer" not provided, OP_WALLET not detected.');
7610
7602
  const e = this.parseOptionalInputs(t.optionalInputs), { finalTransaction: i, estimatedAmount: r } = await this.iterateFundingAmount(
7611
7603
  { ...t, optionalInputs: e },
7612
- $t,
7604
+ zt,
7613
7605
  async (h) => {
7614
7606
  const p = await h.estimateTransactionFees(), d = this.getPriorityFee(t), w = h.getOptionalOutputValue();
7615
7607
  return p + d + w;
@@ -7640,7 +7632,7 @@ class ni {
7640
7632
  estimatedFees: i.estimatedFees,
7641
7633
  compiledTargetScript: i.exportCompiledTargetScript(),
7642
7634
  optionalInputs: e
7643
- }, l = await new $t(c).signTransaction();
7635
+ }, l = await new zt(c).signTransaction();
7644
7636
  return [
7645
7637
  a.tx.toHex(),
7646
7638
  l.toHex(),
@@ -7669,10 +7661,10 @@ class ni {
7669
7661
  return this.signP2WDAInteraction(t);
7670
7662
  const r = this.parseOptionalInputs(t.optionalInputs), { finalTransaction: s, estimatedAmount: o, challenge: a } = await this.iterateFundingAmount(
7671
7663
  { ...t, optionalInputs: r },
7672
- Yt,
7664
+ $t,
7673
7665
  async (S) => {
7674
- const T = await S.estimateTransactionFees(), F = S.getTotalOutputValue();
7675
- return T + F;
7666
+ const I = await S.estimateTransactionFees(), F = S.getTotalOutputValue();
7667
+ return I + F;
7676
7668
  },
7677
7669
  "Interaction"
7678
7670
  );
@@ -7708,7 +7700,7 @@ class ni {
7708
7700
  nonWitnessUtxo: l.tx.toBuffer(),
7709
7701
  estimatedFees: s.estimatedFees,
7710
7702
  optionalInputs: r
7711
- }, d = new Yt(p), w = await d.signTransaction();
7703
+ }, d = new $t(p), w = await d.signTransaction();
7712
7704
  return {
7713
7705
  interactionAddress: s.getScriptAddress(),
7714
7706
  fundingTransaction: l.tx.toHex(),
@@ -7752,7 +7744,7 @@ class ni {
7752
7744
  throw new Error('Field "signer" not provided.');
7753
7745
  if (!t.challenge)
7754
7746
  throw new Error('Field "challenge" not provided.');
7755
- const e = this.parseOptionalInputs(t.optionalInputs), i = new si({
7747
+ const e = this.parseOptionalInputs(t.optionalInputs), i = new ii({
7756
7748
  ...t,
7757
7749
  optionalInputs: e
7758
7750
  }), r = await i.build();
@@ -7782,10 +7774,10 @@ class ni {
7782
7774
  throw new Error('Field "signer" not provided, OP_WALLET not detected.');
7783
7775
  const i = this.parseOptionalInputs(t.optionalInputs), { finalTransaction: r, estimatedAmount: s, challenge: o } = await this.iterateFundingAmount(
7784
7776
  { ...t, optionalInputs: i },
7785
- bt,
7786
- async (Ct) => {
7787
- const Rt = await Ct.estimateTransactionFees(), Ft = this.getPriorityFee(t), mi = Ct.getOptionalOutputValue();
7788
- return Rt + Ft + mi;
7777
+ wt,
7778
+ async (xt) => {
7779
+ const Ct = await xt.estimateTransactionFees(), Dt = this.getPriorityFee(t), Si = xt.getOptionalOutputValue();
7780
+ return Ct + Dt + Si;
7789
7781
  },
7790
7782
  "Deployment"
7791
7783
  );
@@ -7801,7 +7793,7 @@ class ni {
7801
7793
  if (!c)
7802
7794
  throw new Error("Could not sign funding transaction.");
7803
7795
  a.estimatedFees = c.estimatedFees;
7804
- const l = await new Xt({
7796
+ const l = await new qt({
7805
7797
  ...a,
7806
7798
  optionalInputs: [],
7807
7799
  optionalOutputs: []
@@ -7825,14 +7817,14 @@ class ni {
7825
7817
  nonWitnessUtxo: l.toBuffer(),
7826
7818
  estimatedFees: r.estimatedFees,
7827
7819
  optionalInputs: i
7828
- }, w = new bt(d), S = await w.signTransaction(), T = l.outs[1], F = {
7820
+ }, w = new wt(d), S = await w.signTransaction(), I = l.outs[1], F = {
7829
7821
  transactionId: l.getId(),
7830
7822
  outputIndex: 1,
7831
7823
  scriptPubKey: {
7832
- hex: g(T.script),
7824
+ hex: g(I.script),
7833
7825
  address: t.from
7834
7826
  },
7835
- value: BigInt(T.value)
7827
+ value: BigInt(I.value)
7836
7828
  };
7837
7829
  return {
7838
7830
  transaction: [l.toHex(), S.toHex()],
@@ -7969,7 +7961,7 @@ class ni {
7969
7961
  */
7970
7962
  async createFundTransaction(t) {
7971
7963
  if (!t.to) throw new Error('Field "to" not provided.');
7972
- const e = new Xt(t), i = await e.signTransaction();
7964
+ const e = new qt(t), i = await e.signTransaction();
7973
7965
  if (!i)
7974
7966
  throw new Error("Could not sign funding transaction.");
7975
7967
  return {
@@ -8063,7 +8055,7 @@ class ni {
8063
8055
  let a = this.INITIAL_FUNDING_ESTIMATE, c = 0n, u = 0, l = null, h = null;
8064
8056
  for (; u < this.MAX_ITERATIONS && a !== c; ) {
8065
8057
  c = a;
8066
- const p = new re();
8058
+ const p = new ee();
8067
8059
  p.addOutput(this.P2TR_SCRIPT, B(a));
8068
8060
  const d = {
8069
8061
  transactionId: g(new Uint8Array(32)),
@@ -8089,15 +8081,15 @@ class ni {
8089
8081
  const S = new e(w);
8090
8082
  try {
8091
8083
  await S.generateTransactionMinimalSignatures(), a = await i(S);
8092
- } catch (T) {
8093
- if (T instanceof Error) {
8094
- const F = T.message.match(/need (\d+) sats but only have (\d+) sats/);
8084
+ } catch (I) {
8085
+ if (I instanceof Error) {
8086
+ const F = I.message.match(/need (\d+) sats but only have (\d+) sats/);
8095
8087
  if (F)
8096
8088
  a = BigInt(F[1]), this.debug && console.log(
8097
8089
  `${r}: Caught insufficient funds, updating to ${a}`
8098
8090
  );
8099
8091
  else
8100
- throw T;
8092
+ throw I;
8101
8093
  } else
8102
8094
  throw new Error("Unknown error during fee estimation");
8103
8095
  }
@@ -8173,13 +8165,13 @@ class _ extends A {
8173
8165
  if (super({
8174
8166
  ...t,
8175
8167
  signer: E.fromPrivateKey(
8176
- C.sha256(new TextEncoder().encode("aaaaaaaa"))
8168
+ D.sha256(new TextEncoder().encode("aaaaaaaa"))
8177
8169
  ),
8178
8170
  priorityFee: 0n,
8179
8171
  gasSatFee: 0n
8180
8172
  }), !t.pubkeys)
8181
8173
  throw new Error("Pubkeys are required");
8182
- t.psbt && (this.log("Using provided PSBT."), this.transaction = t.psbt, this.originalInputCount = this.transaction.data.inputs.length), this.refundVault = t.refundVault, this.requestedAmount = t.requestedAmount, this.receiver = t.receiver, this.publicKeys = t.pubkeys, this.minimumSignatures = t.minimumSignatures, this.compiledTargetScript = Kt.compile(
8174
+ t.psbt && (this.log("Using provided PSBT."), this.transaction = t.psbt, this.originalInputCount = this.transaction.data.inputs.length), this.refundVault = t.refundVault, this.requestedAmount = t.requestedAmount, this.receiver = t.receiver, this.publicKeys = t.pubkeys, this.minimumSignatures = t.minimumSignatures, this.compiledTargetScript = _t.compile(
8183
8175
  t.pubkeys,
8184
8176
  this.minimumSignatures
8185
8177
  ), this.scriptTree = this.getScriptTree(), this.internalInit();
@@ -8214,7 +8206,7 @@ class _ extends A {
8214
8206
  if (!(o.length < 3))
8215
8207
  for (let a = 0; a < o.length - 2; a += 3) {
8216
8208
  const c = o[a + 2];
8217
- if (D(c, e)) {
8209
+ if (C(c, e)) {
8218
8210
  i = !0;
8219
8211
  break;
8220
8212
  }
@@ -8289,7 +8281,7 @@ class _ extends A {
8289
8281
  for (const u of r) {
8290
8282
  let l = !1;
8291
8283
  for (const h of e.tapScriptSig)
8292
- D(h.pubkey, v(u)) && (o.push(h.signature), l = !0);
8284
+ C(h.pubkey, v(u)) && (o.push(h.signature), l = !0);
8293
8285
  l || o.push(new Uint8Array(0));
8294
8286
  }
8295
8287
  o = o.reverse();
@@ -8553,23 +8545,23 @@ class _ extends A {
8553
8545
  };
8554
8546
  }
8555
8547
  }
8556
- const Ie = 1, Wt = 66;
8557
- function oi(n) {
8548
+ const Ae = 1, Mt = 66;
8549
+ function si(n) {
8558
8550
  return n.type === m.FUNDING;
8559
8551
  }
8560
- function ai(n) {
8552
+ function ni(n) {
8561
8553
  return n.type === m.DEPLOYMENT;
8562
8554
  }
8563
- function ci(n) {
8555
+ function oi(n) {
8564
8556
  return n.type === m.INTERACTION;
8565
8557
  }
8566
8558
  function st(n) {
8567
8559
  return n.type === m.MULTI_SIG;
8568
8560
  }
8569
- function ui(n) {
8561
+ function ai(n) {
8570
8562
  return n.type === m.CUSTOM_CODE;
8571
8563
  }
8572
- function li(n) {
8564
+ function ci(n) {
8573
8565
  return n.type === m.CANCEL;
8574
8566
  }
8575
8567
  class U {
@@ -8596,8 +8588,8 @@ class U {
8596
8588
  const e = t.subarray(-32), i = t.subarray(0, -32), r = this.calculateChecksum(i);
8597
8589
  if (!this.bytesEqual(e, r))
8598
8590
  throw new Error("Invalid checksum - data may be corrupted");
8599
- const s = new Zt(i), o = this.readHeader(s);
8600
- if (o.formatVersion > Ie)
8591
+ const s = new Qt(i), o = this.readHeader(s);
8592
+ if (o.formatVersion > Ae)
8601
8593
  throw new Error(`Unsupported format version: ${o.formatVersion}`);
8602
8594
  const a = this.readBaseParams(s), c = this.readUTXOArray(s), u = this.readUTXOArray(s), l = this.readOutputArray(s), h = s.readBoolean(), p = this.readSignerMappings(s), d = this.readTypeSpecificData(s, o.transactionType), w = this.readPrecomputedData(s);
8603
8595
  return {
@@ -8646,13 +8638,13 @@ class U {
8646
8638
  return this.deserialize(y(t));
8647
8639
  }
8648
8640
  static writeHeader(t, e) {
8649
- t.writeU8(Wt), t.writeU8(e.formatVersion), t.writeU8(e.consensusVersion), t.writeU8(e.transactionType), t.writeU32(e.chainId), t.writeU64(BigInt(e.timestamp));
8641
+ t.writeU8(Mt), t.writeU8(e.formatVersion), t.writeU8(e.consensusVersion), t.writeU8(e.transactionType), t.writeU32(e.chainId), t.writeU64(BigInt(e.timestamp));
8650
8642
  }
8651
8643
  static readHeader(t) {
8652
8644
  const e = t.readU8();
8653
- if (e !== Wt)
8645
+ if (e !== Mt)
8654
8646
  throw new Error(
8655
- `Invalid magic byte: expected 0x${Wt.toString(16)}, got 0x${e.toString(16)}`
8647
+ `Invalid magic byte: expected 0x${Mt.toString(16)}, got 0x${e.toString(16)}`
8656
8648
  );
8657
8649
  return {
8658
8650
  formatVersion: t.readU8(),
@@ -8926,13 +8918,13 @@ class U {
8926
8918
  const e = t.readU64().toString(), i = t.readStringWithLength(), r = t.readStringWithLength(), s = "0x" + g(t.readBytesWithLength()), o = "0x" + g(t.readBytesWithLength()), a = "0x" + g(t.readBytesWithLength()), c = t.readU8(), u = this.readChallengeVerification(t), l = t.readBoolean();
8927
8919
  let h;
8928
8920
  if (l) {
8929
- const p = t.readStringWithLength(), d = t.readStringWithLength(), w = "0x" + g(t.readBytesWithLength()), T = t.readBoolean() ? "0x" + g(t.readBytesWithLength()) : void 0, F = "0x" + g(t.readBytesWithLength());
8921
+ const p = t.readStringWithLength(), d = t.readStringWithLength(), w = "0x" + g(t.readBytesWithLength()), I = t.readBoolean() ? "0x" + g(t.readBytesWithLength()) : void 0, F = "0x" + g(t.readBytesWithLength());
8930
8922
  h = {
8931
8923
  mldsaPublicKey: p,
8932
8924
  legacyPublicKey: d,
8933
8925
  solution: w,
8934
8926
  signature: F,
8935
- ...T !== void 0 ? { graffiti: T } : {}
8927
+ ...I !== void 0 ? { graffiti: I } : {}
8936
8928
  };
8937
8929
  }
8938
8930
  return {
@@ -8992,8 +8984,8 @@ class U {
8992
8984
  * Calculate double SHA256 checksum (Bitcoin standard)
8993
8985
  */
8994
8986
  static calculateChecksum(t) {
8995
- const e = se("sha256").update(t).digest();
8996
- return new Uint8Array(se("sha256").update(e).digest());
8987
+ const e = ie("sha256").update(t).digest();
8988
+ return new Uint8Array(ie("sha256").update(e).digest());
8997
8989
  }
8998
8990
  /**
8999
8991
  * Compare two Uint8Arrays for equality
@@ -9047,15 +9039,15 @@ class U {
9047
9039
  }
9048
9040
  }
9049
9041
  }
9050
- var Dt = /* @__PURE__ */ ((n) => (n[n.Roswell = 0] = "Roswell", n[n.Rachel = 1] = "Rachel", n[n.Kecksburg = 2] = "Kecksburg", n[n.Phoenix = 3] = "Phoenix", n[n.Aurora = 4] = "Aurora", n[n.Rendlesham = 5] = "Rendlesham", n[n.Lazar = 6] = "Lazar", n[n.ShagHarbor = 7] = "ShagHarbor", n[n.Exeter = 8] = "Exeter", n[n.Stephenville = 9] = "Stephenville", n[n.Valensole = 10] = "Valensole", n[n.Socorro = 11] = "Socorro", n[n.Pascagoula = 12] = "Pascagoula", n[n.Tehran = 13] = "Tehran", n[n.Westall = 14] = "Westall", n[n.Hopkinsville = 15] = "Hopkinsville", n[n.Belgium = 16] = "Belgium", n[n.Breeze = 17] = "Breeze", n[n.Flatwoods = 18] = "Flatwoods", n[n.Maury = 20] = "Maury", n[n.Varginha = 21] = "Varginha", n[n.Trindade = 22] = "Trindade", n[n.Levelland = 23] = "Levelland", n[n.Wanaque = 24] = "Wanaque", n[n.Coyame = 25] = "Coyame", n[n.Delphos = 26] = "Delphos", n))(Dt || {});
9051
- const hi = {
9052
- CONSENSUS: Dt.Roswell,
9042
+ var Kt = /* @__PURE__ */ ((n) => (n[n.Roswell = 0] = "Roswell", n[n.Rachel = 1] = "Rachel", n[n.Kecksburg = 2] = "Kecksburg", n[n.Phoenix = 3] = "Phoenix", n[n.Aurora = 4] = "Aurora", n[n.Rendlesham = 5] = "Rendlesham", n[n.Lazar = 6] = "Lazar", n[n.ShagHarbor = 7] = "ShagHarbor", n[n.Exeter = 8] = "Exeter", n[n.Stephenville = 9] = "Stephenville", n[n.Valensole = 10] = "Valensole", n[n.Socorro = 11] = "Socorro", n[n.Pascagoula = 12] = "Pascagoula", n[n.Tehran = 13] = "Tehran", n[n.Westall = 14] = "Westall", n[n.Hopkinsville = 15] = "Hopkinsville", n[n.Belgium = 16] = "Belgium", n[n.Breeze = 17] = "Breeze", n[n.Flatwoods = 18] = "Flatwoods", n[n.Maury = 20] = "Maury", n[n.Varginha = 21] = "Varginha", n[n.Trindade = 22] = "Trindade", n[n.Levelland = 23] = "Levelland", n[n.Wanaque = 24] = "Wanaque", n[n.Coyame = 25] = "Coyame", n[n.Delphos = 26] = "Delphos", n))(Kt || {});
9043
+ const ui = {
9044
+ CONSENSUS: Kt.Roswell,
9053
9045
  CONSENSUS_NAME: "Roswell",
9054
9046
  // The block height at which this consensus was enabled.
9055
9047
  ENABLED_AT_BLOCK: 0n
9056
- }, di = {
9057
- [Dt.Roswell]: hi
9058
- }, Ee = Dt.Roswell, Sr = di[Ee];
9048
+ }, li = {
9049
+ [Kt.Roswell]: ui
9050
+ }, Ie = Kt.Roswell, Sr = li[Ie];
9059
9051
  class Z {
9060
9052
  /**
9061
9053
  * Capture state from a FundingTransaction
@@ -9139,8 +9131,8 @@ class Z {
9139
9131
  */
9140
9132
  static createHeader(t, e, i) {
9141
9133
  return {
9142
- formatVersion: Ie,
9143
- consensusVersion: Ee,
9134
+ formatVersion: Ae,
9135
+ consensusVersion: Ie,
9144
9136
  transactionType: t,
9145
9137
  chainId: i ?? this.networkToChainId(e),
9146
9138
  timestamp: Date.now()
@@ -9330,19 +9322,19 @@ class Z {
9330
9322
  * Convert network to chain ID
9331
9323
  */
9332
9324
  static networkToChainId(t) {
9333
- return ye.Bitcoin;
9325
+ return fe.Bitcoin;
9334
9326
  }
9335
9327
  }
9336
9328
  function R(n) {
9337
9329
  return H.from(n.replace("0x", ""), "hex");
9338
9330
  }
9339
- class ft {
9331
+ class dt {
9340
9332
  static BLOCKS_PER_EPOCH = 5n;
9341
9333
  /**
9342
9334
  * Calculate SHA-1 hash
9343
9335
  */
9344
9336
  static sha1(t) {
9345
- return C.sha1(t);
9337
+ return D.sha1(t);
9346
9338
  }
9347
9339
  /**
9348
9340
  * Calculate mining preimage
@@ -9386,7 +9378,7 @@ class ft {
9386
9378
  t.publicKey.toBuffer(),
9387
9379
  t.salt
9388
9380
  ), s = this.sha1(r);
9389
- if (!D(s, t.solution) || this.countMatchingBits(s, i.targetHash) !== t.difficulty)
9381
+ if (!C(s, t.solution) || this.countMatchingBits(s, i.targetHash) !== t.difficulty)
9390
9382
  return !1;
9391
9383
  const a = t.epochNumber * this.BLOCKS_PER_EPOCH, c = a + this.BLOCKS_PER_EPOCH - 1n;
9392
9384
  return !(i.startBlock !== a || i.endBlock !== c);
@@ -9421,7 +9413,7 @@ class ft {
9421
9413
  i.toBuffer(),
9422
9414
  s
9423
9415
  ), u = this.sha1(c);
9424
- if (!D(u, r) || this.countMatchingBits(u, a.targetHash) !== o)
9416
+ if (!C(u, r) || this.countMatchingBits(u, a.targetHash) !== o)
9425
9417
  return !1;
9426
9418
  const h = e * this.BLOCKS_PER_EPOCH, p = h + this.BLOCKS_PER_EPOCH - 1n;
9427
9419
  return !(a.startBlock !== h || a.endBlock !== p);
@@ -9457,7 +9449,7 @@ class ft {
9457
9449
  };
9458
9450
  }
9459
9451
  }
9460
- class pi {
9452
+ class hi {
9461
9453
  epochHash;
9462
9454
  epochRoot;
9463
9455
  targetHash;
@@ -9469,7 +9461,7 @@ class pi {
9469
9461
  this.epochHash = R(t.epochHash), this.epochRoot = R(t.epochRoot), this.targetHash = R(t.targetHash), this.targetChecksum = R(t.targetChecksum), this.startBlock = BigInt(t.startBlock), this.endBlock = BigInt(t.endBlock), this.proofs = Object.freeze(t.proofs.map((e) => R(e)));
9470
9462
  }
9471
9463
  }
9472
- class fi {
9464
+ class di {
9473
9465
  constructor(t, e) {
9474
9466
  this.epochNumber = e, this.publicKey = L.fromString(t.mldsaPublicKey, t.legacyPublicKey), this.solution = R(t.solution), this.graffiti = t.graffiti ? R(t.graffiti) : void 0, this.signature = R(t.signature);
9475
9467
  }
@@ -9488,7 +9480,7 @@ class fi {
9488
9480
  );
9489
9481
  }
9490
9482
  }
9491
- class ue {
9483
+ class ae {
9492
9484
  epochNumber;
9493
9485
  publicKey;
9494
9486
  solution;
@@ -9498,13 +9490,13 @@ class ue {
9498
9490
  verification;
9499
9491
  submission;
9500
9492
  constructor(t) {
9501
- this.epochNumber = BigInt(t.epochNumber), this.publicKey = L.fromString(t.mldsaPublicKey, t.legacyPublicKey), this.solution = R(t.solution), this.salt = R(t.salt), this.graffiti = R(t.graffiti), this.difficulty = t.difficulty, this.verification = new pi(t.verification), this.submission = t.submission ? new fi(t.submission, this.epochNumber + 2n) : t.submission;
9493
+ this.epochNumber = BigInt(t.epochNumber), this.publicKey = L.fromString(t.mldsaPublicKey, t.legacyPublicKey), this.solution = R(t.solution), this.salt = R(t.salt), this.graffiti = R(t.graffiti), this.difficulty = t.difficulty, this.verification = new hi(t.verification), this.submission = t.submission ? new di(t.submission, this.epochNumber + 2n) : t.submission;
9502
9494
  }
9503
9495
  /**
9504
9496
  * Static method to validate from raw data directly
9505
9497
  */
9506
9498
  static validateRaw(t) {
9507
- return ft.validateEpochWinner(t);
9499
+ return dt.validateEpochWinner(t);
9508
9500
  }
9509
9501
  verifySubmissionSignature() {
9510
9502
  if (!this.submission)
@@ -9523,7 +9515,7 @@ class ue {
9523
9515
  * @returns {boolean} True if the challenge is valid
9524
9516
  */
9525
9517
  verify() {
9526
- return ft.validateChallengeSolution(this);
9518
+ return dt.validateChallengeSolution(this);
9527
9519
  }
9528
9520
  /**
9529
9521
  * Get the preimage challenge
@@ -9567,7 +9559,7 @@ class ue {
9567
9559
  * @returns {Promise<Buffer>} The calculated solution hash
9568
9560
  */
9569
9561
  calculateSolution() {
9570
- return ft.calculateSolution(
9562
+ return dt.calculateSolution(
9571
9563
  this.verification.targetChecksum,
9572
9564
  this.publicKey.toBuffer(),
9573
9565
  this.salt
@@ -9579,7 +9571,7 @@ class ue {
9579
9571
  * @returns {Promise<{valid: boolean; difficulty: number}>} Validation result
9580
9572
  */
9581
9573
  checkDifficulty(t) {
9582
- return ft.checkDifficulty(
9574
+ return dt.checkDifficulty(
9583
9575
  this.solution,
9584
9576
  this.verification.targetHash,
9585
9577
  t
@@ -9590,10 +9582,10 @@ class ue {
9590
9582
  * @returns {bigint | null} The target block number or null if epoch 0
9591
9583
  */
9592
9584
  getMiningTargetBlock() {
9593
- return ft.getMiningTargetBlock(this.epochNumber);
9585
+ return dt.getMiningTargetBlock(this.epochNumber);
9594
9586
  }
9595
9587
  }
9596
- class gt {
9588
+ class pt {
9597
9589
  /**
9598
9590
  * Reconstruct and optionally rebuild transaction with new parameters
9599
9591
  * @param state - Serialized transaction state
@@ -9625,17 +9617,17 @@ class gt {
9625
9617
  ...t.precomputedData.estimatedFees !== void 0 ? { estimatedFees: BigInt(t.precomputedData.estimatedFees) } : {},
9626
9618
  ...t.precomputedData.compiledTargetScript !== void 0 ? { compiledTargetScript: y(t.precomputedData.compiledTargetScript) } : {}
9627
9619
  }, p = t.typeSpecificData;
9628
- if (oi(p))
9620
+ if (si(p))
9629
9621
  return this.reconstructFunding(h, p);
9630
- if (ai(p))
9622
+ if (ni(p))
9631
9623
  return this.reconstructDeployment(h, p, t);
9632
- if (ci(p))
9624
+ if (oi(p))
9633
9625
  return this.reconstructInteraction(h, p, t);
9634
9626
  if (st(p))
9635
9627
  return this.reconstructMultiSig(h, p);
9636
- if (ui(p))
9628
+ if (ai(p))
9637
9629
  return this.reconstructCustomScript(h, p, t);
9638
- if (li(p))
9630
+ if (ci(p))
9639
9631
  return this.reconstructCancel(h, p);
9640
9632
  throw new Error(`Unsupported transaction type: ${t.header.transactionType}`);
9641
9633
  }
@@ -9648,13 +9640,13 @@ class gt {
9648
9640
  amount: BigInt(e.amount),
9649
9641
  splitInputsInto: e.splitInputsInto
9650
9642
  };
9651
- return new Xt(i);
9643
+ return new qt(i);
9652
9644
  }
9653
9645
  /**
9654
9646
  * Reconstruct a DeploymentTransaction
9655
9647
  */
9656
9648
  static reconstructDeployment(t, e, i) {
9657
- const r = new ue(e.challenge), s = {
9649
+ const r = new ae(e.challenge), s = {
9658
9650
  ...t,
9659
9651
  bytecode: y(e.bytecode),
9660
9652
  challenge: r,
@@ -9663,13 +9655,13 @@ class gt {
9663
9655
  ...e.revealMLDSAPublicKey !== void 0 ? { revealMLDSAPublicKey: e.revealMLDSAPublicKey } : {},
9664
9656
  ...e.linkMLDSAPublicKeyToAddress !== void 0 ? { linkMLDSAPublicKeyToAddress: e.linkMLDSAPublicKeyToAddress } : {}
9665
9657
  };
9666
- return new bt(s);
9658
+ return new wt(s);
9667
9659
  }
9668
9660
  /**
9669
9661
  * Reconstruct an InteractionTransaction
9670
9662
  */
9671
9663
  static reconstructInteraction(t, e, i) {
9672
- const r = new ue(e.challenge);
9664
+ const r = new ae(e.challenge);
9673
9665
  if (!t.to)
9674
9666
  throw new Error('InteractionTransaction requires a "to" address');
9675
9667
  const s = {
@@ -9685,7 +9677,7 @@ class gt {
9685
9677
  ...e.revealMLDSAPublicKey !== void 0 ? { revealMLDSAPublicKey: e.revealMLDSAPublicKey } : {},
9686
9678
  ...e.linkMLDSAPublicKeyToAddress !== void 0 ? { linkMLDSAPublicKeyToAddress: e.linkMLDSAPublicKeyToAddress } : {}
9687
9679
  };
9688
- return new Yt(s);
9680
+ return new $t(s);
9689
9681
  }
9690
9682
  /**
9691
9683
  * Reconstruct a MultiSignTransaction
@@ -9739,7 +9731,7 @@ class gt {
9739
9731
  ...e.annex !== void 0 ? { annex: y(e.annex) } : {},
9740
9732
  ...i.precomputedData.randomBytes !== void 0 ? { randomBytes: y(i.precomputedData.randomBytes) } : {}
9741
9733
  };
9742
- return new $t(o);
9734
+ return new zt(o);
9743
9735
  }
9744
9736
  /**
9745
9737
  * Reconstruct a CancelTransaction
@@ -9749,7 +9741,7 @@ class gt {
9749
9741
  ...t,
9750
9742
  compiledTargetScript: y(e.compiledTargetScript)
9751
9743
  };
9752
- return new Te(i);
9744
+ return new be(i);
9753
9745
  }
9754
9746
  /**
9755
9747
  * Build address rotation config from options
@@ -9912,7 +9904,7 @@ class wr {
9912
9904
  */
9913
9905
  static importForSigning(t, e) {
9914
9906
  const i = U.fromBase64(t);
9915
- return gt.reconstruct(i, e);
9907
+ return pt.reconstruct(i, e);
9916
9908
  }
9917
9909
  /**
9918
9910
  * Complete signing and export signed transaction
@@ -10039,7 +10031,7 @@ class wr {
10039
10031
  throw new Error("State is not a multisig transaction");
10040
10032
  const r = i.typeSpecificData, s = r.pubkeys.map((d) => y(d));
10041
10033
  let o;
10042
- const a = gt.nameToNetwork(i.baseParams.networkName);
10034
+ const a = pt.nameToNetwork(i.baseParams.networkName);
10043
10035
  r.existingPsbtBase64 ? o = V.fromBase64(r.existingPsbtBase64, { network: a }) : o = await this.importForSigning(t, {
10044
10036
  signer: e
10045
10037
  }).signPSBT();
@@ -10088,7 +10080,7 @@ class wr {
10088
10080
  const r = i.typeSpecificData;
10089
10081
  if (!r.existingPsbtBase64)
10090
10082
  return !1;
10091
- const s = gt.nameToNetwork(i.baseParams.networkName), o = V.fromBase64(r.existingPsbtBase64, { network: s }), a = e instanceof Uint8Array ? e : y(e);
10083
+ const s = pt.nameToNetwork(i.baseParams.networkName), o = V.fromBase64(r.existingPsbtBase64, { network: s }), a = e instanceof Uint8Array ? e : y(e);
10092
10084
  return _.verifyIfSigned(o, a);
10093
10085
  }
10094
10086
  /**
@@ -10109,7 +10101,7 @@ class wr {
10109
10101
  isComplete: !1,
10110
10102
  signers: []
10111
10103
  };
10112
- const s = gt.nameToNetwork(e.baseParams.networkName), o = V.fromBase64(i.existingPsbtBase64, { network: s }), a = /* @__PURE__ */ new Set();
10104
+ const s = pt.nameToNetwork(e.baseParams.networkName), o = V.fromBase64(i.existingPsbtBase64, { network: s }), a = /* @__PURE__ */ new Set();
10113
10105
  for (let u = i.originalInputCount; u < o.data.inputs.length; u++) {
10114
10106
  const l = o.data.inputs[u];
10115
10107
  if (l.tapScriptSig)
@@ -10147,7 +10139,7 @@ class wr {
10147
10139
  const i = e.typeSpecificData;
10148
10140
  if (!i.existingPsbtBase64)
10149
10141
  throw new Error("No PSBT found in state - transaction has not been signed");
10150
- const r = gt.nameToNetwork(e.baseParams.networkName), s = V.fromBase64(i.existingPsbtBase64, { network: r }), o = i.pubkeys.map((u) => y(u)), a = [];
10142
+ const r = pt.nameToNetwork(e.baseParams.networkName), s = V.fromBase64(i.existingPsbtBase64, { network: r }), o = i.pubkeys.map((u) => y(u)), a = [];
10151
10143
  for (let u = i.originalInputCount; u < s.data.inputs.length; u++)
10152
10144
  a.push(o);
10153
10145
  if (!_.attemptFinalizeInputs(
@@ -10233,12 +10225,12 @@ class mr {
10233
10225
  if (w <= 0n)
10234
10226
  continue;
10235
10227
  const S = Number(d.raw);
10236
- if (S == null)
10228
+ if (!Number.isInteger(S) || S < 0 || S >= o.length)
10237
10229
  throw new Error(
10238
- `Missing raw index for UTXO ${d.transactionId}:${d.outputIndex}`
10230
+ `Invalid raw index for UTXO ${d.transactionId}:${d.outputIndex}`
10239
10231
  );
10240
- const T = o[S];
10241
- if (!T)
10232
+ const I = o[S];
10233
+ if (!I)
10242
10234
  throw new Error(
10243
10235
  `Invalid raw index ${S} - not found in raw transactions array`
10244
10236
  );
@@ -10247,7 +10239,7 @@ class mr {
10247
10239
  outputIndex: d.outputIndex,
10248
10240
  value: w,
10249
10241
  scriptPubKey: d.scriptPubKey,
10250
- nonWitnessUtxo: H.from(T, "base64")
10242
+ nonWitnessUtxo: H.from(I, "base64")
10251
10243
  }), h > p)
10252
10244
  break;
10253
10245
  }
@@ -10319,7 +10311,7 @@ class mr {
10319
10311
  priorityFee: 0n,
10320
10312
  gasSatFee: 330n,
10321
10313
  mldsaSigner: null
10322
- }, l = await new ni().createBTCTransfer(c), h = await this.broadcastTransaction(l.tx, !1);
10314
+ }, l = await new ri().createBTCTransfer(c), h = await this.broadcastTransaction(l.tx, !1);
10323
10315
  return h || { error: "Could not broadcast transaction" };
10324
10316
  }
10325
10317
  /**
@@ -10406,7 +10398,7 @@ class mr {
10406
10398
  return new UnwrapGeneration(result as UnwrappedGenerationParameters);
10407
10399
  }*/
10408
10400
  }
10409
- var gi = /* @__PURE__ */ ((n) => (n[n.UNWRAP = 0] = "UNWRAP", n))(gi || {});
10401
+ var pi = /* @__PURE__ */ ((n) => (n[n.UNWRAP = 0] = "UNWRAP", n))(pi || {});
10410
10402
  class br {
10411
10403
  /**
10412
10404
  * Generate a multi-sig address
@@ -10434,10 +10426,10 @@ class br {
10434
10426
  return o;
10435
10427
  }
10436
10428
  }
10437
- var yi = /* @__PURE__ */ ((n) => (n.UINT8 = "UINT8", n.UINT16 = "UINT16", n.UINT32 = "UINT32", n.UINT64 = "UINT64", n.UINT128 = "UINT128", n.UINT256 = "UINT256", n.INT8 = "INT8", n.INT16 = "INT16", n.INT32 = "INT32", n.INT64 = "INT64", n.INT128 = "INT128", n.BOOL = "BOOL", n.ADDRESS = "ADDRESS", n.EXTENDED_ADDRESS = "EXTENDED_ADDRESS", n.STRING = "STRING", n.BYTES4 = "BYTES4", n.BYTES32 = "BYTES32", n.BYTES = "BYTES", n.ADDRESS_UINT256_TUPLE = "ADDRESS_UINT256_TUPLE", n.EXTENDED_ADDRESS_UINT256_TUPLE = "EXTENDED_ADDRESS_UINT256_TUPLE", n.SCHNORR_SIGNATURE = "SCHNORR_SIGNATURE", n.ARRAY_OF_ADDRESSES = "ARRAY_OF_ADDRESSES", n.ARRAY_OF_EXTENDED_ADDRESSES = "ARRAY_OF_EXTENDED_ADDRESSES", n.ARRAY_OF_UINT256 = "ARRAY_OF_UINT256", n.ARRAY_OF_UINT128 = "ARRAY_OF_UINT128", n.ARRAY_OF_UINT64 = "ARRAY_OF_UINT64", n.ARRAY_OF_UINT32 = "ARRAY_OF_UINT32", n.ARRAY_OF_UINT16 = "ARRAY_OF_UINT16", n.ARRAY_OF_UINT8 = "ARRAY_OF_UINT8", n.ARRAY_OF_STRING = "ARRAY_OF_STRING", n.ARRAY_OF_BYTES = "ARRAY_OF_BYTES", n.ARRAY_OF_BUFFERS = "ARRAY_OF_BUFFERS", n))(yi || {});
10429
+ var fi = /* @__PURE__ */ ((n) => (n.UINT8 = "UINT8", n.UINT16 = "UINT16", n.UINT32 = "UINT32", n.UINT64 = "UINT64", n.UINT128 = "UINT128", n.UINT256 = "UINT256", n.INT8 = "INT8", n.INT16 = "INT16", n.INT32 = "INT32", n.INT64 = "INT64", n.INT128 = "INT128", n.BOOL = "BOOL", n.ADDRESS = "ADDRESS", n.EXTENDED_ADDRESS = "EXTENDED_ADDRESS", n.STRING = "STRING", n.BYTES4 = "BYTES4", n.BYTES32 = "BYTES32", n.BYTES = "BYTES", n.ADDRESS_UINT256_TUPLE = "ADDRESS_UINT256_TUPLE", n.EXTENDED_ADDRESS_UINT256_TUPLE = "EXTENDED_ADDRESS_UINT256_TUPLE", n.SCHNORR_SIGNATURE = "SCHNORR_SIGNATURE", n.ARRAY_OF_ADDRESSES = "ARRAY_OF_ADDRESSES", n.ARRAY_OF_EXTENDED_ADDRESSES = "ARRAY_OF_EXTENDED_ADDRESSES", n.ARRAY_OF_UINT256 = "ARRAY_OF_UINT256", n.ARRAY_OF_UINT128 = "ARRAY_OF_UINT128", n.ARRAY_OF_UINT64 = "ARRAY_OF_UINT64", n.ARRAY_OF_UINT32 = "ARRAY_OF_UINT32", n.ARRAY_OF_UINT16 = "ARRAY_OF_UINT16", n.ARRAY_OF_UINT8 = "ARRAY_OF_UINT8", n.ARRAY_OF_STRING = "ARRAY_OF_STRING", n.ARRAY_OF_BYTES = "ARRAY_OF_BYTES", n.ARRAY_OF_BUFFERS = "ARRAY_OF_BUFFERS", n))(fi || {});
10438
10430
  class Ar {
10439
10431
  decodeData(t, e) {
10440
- const i = new Zt(t), r = [];
10432
+ const i = new Qt(t), r = [];
10441
10433
  for (let s = 0; s < e.length; s++)
10442
10434
  switch (e[s]) {
10443
10435
  case "UINT8":
@@ -10547,10 +10539,10 @@ class Ar {
10547
10539
  return t.toString(16);
10548
10540
  }
10549
10541
  sha256(t) {
10550
- return new Ai.sha256().update(t).digest();
10542
+ return new mi.sha256().update(t).digest();
10551
10543
  }
10552
10544
  }
10553
- class Pe {
10545
+ class Te {
10554
10546
  items;
10555
10547
  keys;
10556
10548
  constructor(t = []) {
@@ -10573,7 +10565,7 @@ class Pe {
10573
10565
  this.items.delete(e) && (this.keys = this.keys.filter((i) => i.toBigInt() !== e));
10574
10566
  }
10575
10567
  clone() {
10576
- return new Pe(this.keys);
10568
+ return new Te(this.keys);
10577
10569
  }
10578
10570
  clear() {
10579
10571
  this.items.clear(), this.keys = [];
@@ -10591,9 +10583,9 @@ class Pe {
10591
10583
  yield* this.keys;
10592
10584
  }
10593
10585
  }
10594
- class ve {
10586
+ class Ee {
10595
10587
  constructor(t) {
10596
- this.compareFn = t, this.map = new At(), this.#t = [];
10588
+ this.compareFn = t, this.map = new mt(), this.#t = [];
10597
10589
  }
10598
10590
  map;
10599
10591
  #t;
@@ -10601,7 +10593,7 @@ class ve {
10601
10593
  return this.map.size;
10602
10594
  }
10603
10595
  static fromMap(t, e) {
10604
- const i = new ve(e);
10596
+ const i = new Ee(e);
10605
10597
  for (const [r, s] of t)
10606
10598
  i.set(r, s);
10607
10599
  return i;
@@ -10668,7 +10660,7 @@ class ve {
10668
10660
  yield [t, this.map.get(t)];
10669
10661
  }
10670
10662
  }
10671
- class Oe {
10663
+ class Pe {
10672
10664
  constructor(t) {
10673
10665
  this.compareFn = t, this.elements = [];
10674
10666
  }
@@ -10677,7 +10669,7 @@ class Oe {
10677
10669
  return this.elements.length;
10678
10670
  }
10679
10671
  static fromSet(t, e) {
10680
- const i = new Oe(e);
10672
+ const i = new Pe(e);
10681
10673
  for (const r of t)
10682
10674
  i.add(r);
10683
10675
  return i;
@@ -10720,13 +10712,13 @@ class Oe {
10720
10712
  return { found: !1, index: e };
10721
10713
  }
10722
10714
  }
10723
- class Tr {
10715
+ class Ir {
10724
10716
  constructor(t, e) {
10725
10717
  this.type = t, this.data = e;
10726
10718
  }
10727
10719
  }
10728
- var Si = /* @__PURE__ */ ((n) => (n.mainnet = "mainnet", n.testnet = "testnet", n.signet = "Signet", n))(Si || {}), wi = /* @__PURE__ */ ((n) => (n.ECDSA = "ECDSA", n.BIP322 = "BIP322", n))(wi || {});
10729
- class Ir extends be {
10720
+ var gi = /* @__PURE__ */ ((n) => (n.mainnet = "mainnet", n.testnet = "testnet", n.signet = "Signet", n))(gi || {}), yi = /* @__PURE__ */ ((n) => (n.ECDSA = "ECDSA", n.BIP322 = "BIP322", n))(yi || {});
10721
+ class Tr extends we {
10730
10722
  isInitialized = !1;
10731
10723
  constructor() {
10732
10724
  if (super(), !window)
@@ -10779,7 +10771,7 @@ class Ir extends be {
10779
10771
  throw new Error("Payment address not found");
10780
10772
  const i = e.address.startsWith("tb") ? b.testnet : e.address.startsWith("bc") ? b.bitcoin : null;
10781
10773
  if (!i) throw new Error("Network not supported");
10782
- this._network = i, this._publicKey = le(y(e.publicKey)), this._p2wpkh = E.getP2WPKHAddress(this, this.network), this._p2tr = E.getTaprootAddress(this, this.network), this._addresses = [this._p2wpkh, this._p2tr], this.isInitialized = !0;
10774
+ this._network = i, this._publicKey = ce(y(e.publicKey)), this._p2wpkh = E.getP2WPKHAddress(this, this.network), this._p2tr = E.getTaprootAddress(this, this.network), this._addresses = [this._p2wpkh, this._p2tr], this.isInitialized = !0;
10783
10775
  }
10784
10776
  async signData(t, e, i) {
10785
10777
  if (!this.isInitialized)
@@ -10830,19 +10822,19 @@ class Ir extends be {
10830
10822
  e.push(c);
10831
10823
  const u = a.data.inputs.map((l, h) => {
10832
10824
  let p = !1, d = !1;
10833
- if (Se(l)) {
10825
+ if (ge(l)) {
10834
10826
  if (l.tapLeafScript && l.tapLeafScript.length > 0) {
10835
10827
  for (const w of l.tapLeafScript)
10836
- if (me(this.publicKey, w.script)) {
10828
+ if (Se(this.publicKey, w.script)) {
10837
10829
  p = !0, d = !1;
10838
10830
  break;
10839
10831
  }
10840
10832
  }
10841
10833
  if (!p && l.tapInternalKey) {
10842
10834
  const w = l.tapInternalKey, S = v(this.publicKey);
10843
- D(w, S) && (p = !0, d = !0);
10835
+ C(w, S) && (p = !0, d = !0);
10844
10836
  }
10845
- } else we(l, this.publicKey) && (p = !0, d = !1);
10837
+ } else ye(l, this.publicKey) && (p = !0, d = !1);
10846
10838
  return p ? {
10847
10839
  index: h,
10848
10840
  publicKey: g(this.publicKey),
@@ -10867,7 +10859,7 @@ class Ir extends be {
10867
10859
  hasAlreadySignedTapScriptSig(t) {
10868
10860
  for (let e = 0; e < t.length; e++) {
10869
10861
  const i = t[e], r = new Uint8Array(i.pubkey);
10870
- if (D(r, this.publicKey) && i.signature)
10862
+ if (C(r, this.publicKey) && i.signature)
10871
10863
  return !0;
10872
10864
  }
10873
10865
  return !1;
@@ -10875,7 +10867,7 @@ class Ir extends be {
10875
10867
  hasAlreadyPartialSig(t) {
10876
10868
  for (let e = 0; e < t.length; e++) {
10877
10869
  const i = t[e], r = new Uint8Array(i.pubkey);
10878
- if (D(r, this.publicKey) && i.signature)
10870
+ if (C(r, this.publicKey) && i.signature)
10879
10871
  return !0;
10880
10872
  }
10881
10873
  return !1;
@@ -10917,12 +10909,12 @@ class Ir extends be {
10917
10909
  const i = [];
10918
10910
  for (let r = 0; r < e.length; r++) {
10919
10911
  const s = e[r];
10920
- t.find((a) => D(a.pubkey, s.pubkey)) || i.push(s);
10912
+ t.find((a) => C(a.pubkey, s.pubkey)) || i.push(s);
10921
10913
  }
10922
10914
  return i;
10923
10915
  }
10924
10916
  }
10925
- class Gt {
10917
+ class Xt {
10926
10918
  static INITIAL_CAPACITY = 16;
10927
10919
  static LOAD_FACTOR = 0.75;
10928
10920
  #t;
@@ -10930,7 +10922,7 @@ class Gt {
10930
10922
  deleted;
10931
10923
  capacity;
10932
10924
  constructor() {
10933
- this.capacity = Gt.INITIAL_CAPACITY, this.#t = new Array(this.capacity), this.#e = new Array(this.capacity), this.deleted = new Array(this.capacity).fill(!1);
10925
+ this.capacity = Xt.INITIAL_CAPACITY, this.#t = new Array(this.capacity), this.#e = new Array(this.capacity), this.deleted = new Array(this.capacity).fill(!1);
10934
10926
  }
10935
10927
  _size = 0;
10936
10928
  get size() {
@@ -10939,7 +10931,7 @@ class Gt {
10939
10931
  set(t, e) {
10940
10932
  let i = !0;
10941
10933
  const r = this.findInsertIndex(t);
10942
- return (this.#t[r] === void 0 || this.deleted[r]) && (this._size++, i = !1), this.#t[r] = t, this.#e[r] = e, this.deleted[r] = !1, this._size > this.capacity * Gt.LOAD_FACTOR && this.resize(), i;
10934
+ return (this.#t[r] === void 0 || this.deleted[r]) && (this._size++, i = !1), this.#t[r] = t, this.#e[r] = e, this.deleted[r] = !1, this._size > this.capacity * Xt.LOAD_FACTOR && this.resize(), i;
10943
10935
  }
10944
10936
  get(t) {
10945
10937
  const e = this.findIndex(t);
@@ -11087,262 +11079,262 @@ class Gt {
11087
11079
  const Ur = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
11088
11080
  __proto__: null,
11089
11081
  ABICoder: Ar,
11090
- ABIDataTypes: yi,
11082
+ ABIDataTypes: fi,
11091
11083
  ADDRESS_BYTE_LENGTH: x,
11092
- ANCHOR_SCRIPT: ce,
11084
+ ANCHOR_SCRIPT: oe,
11093
11085
  Address: L,
11094
- AddressGenerator: pe,
11095
- AddressMap: Ve,
11096
- AddressSet: Pe,
11086
+ AddressGenerator: he,
11087
+ AddressMap: We,
11088
+ AddressSet: Te,
11097
11089
  AddressTypes: it,
11098
11090
  AddressVerificator: Y,
11099
- BIPStandard: vt,
11091
+ BIPStandard: Et,
11100
11092
  BOOLEAN_BYTE_LENGTH: Zi,
11101
- BinaryReader: Zt,
11093
+ BinaryReader: Qt,
11102
11094
  BinaryWriter: W,
11103
11095
  BitcoinUtils: M,
11104
- BufferHelper: Nt,
11105
- CSVModes: ri,
11106
- CalldataGenerator: he,
11107
- CancelTransaction: Te,
11108
- ChainId: ye,
11109
- ChallengeSolution: ue,
11110
- ChallengeSubmission: fi,
11111
- ChallengeVerification: pi,
11096
+ BufferHelper: Ft,
11097
+ CSVModes: ei,
11098
+ CalldataGenerator: ue,
11099
+ CancelTransaction: be,
11100
+ ChainId: fe,
11101
+ ChallengeSolution: ae,
11102
+ ChallengeSubmission: di,
11103
+ ChallengeVerification: hi,
11112
11104
  Compressor: $,
11113
- Consensus: Dt,
11114
- ConsolidatedInteractionTransaction: si,
11115
- ContractAddress: ne,
11105
+ Consensus: Kt,
11106
+ ConsolidatedInteractionTransaction: ii,
11107
+ ContractAddress: re,
11116
11108
  ContractBaseMetadata: cr,
11117
- CustomGenerator: qe,
11118
- CustomKeypair: be,
11119
- CustomMap: Gt,
11120
- CustomScriptTransaction: $t,
11121
- DeploymentGenerator: de,
11122
- DeploymentTransaction: bt,
11123
- DeterministicMap: ve,
11124
- DeterministicSet: Oe,
11125
- EXTENDED_ADDRESS_BYTE_LENGTH: yt,
11109
+ CustomGenerator: Ve,
11110
+ CustomKeypair: we,
11111
+ CustomMap: Xt,
11112
+ CustomScriptTransaction: zt,
11113
+ DeploymentGenerator: le,
11114
+ DeploymentTransaction: wt,
11115
+ DeterministicMap: Ee,
11116
+ DeterministicSet: Pe,
11117
+ EXTENDED_ADDRESS_BYTE_LENGTH: ft,
11126
11118
  EcKeyPair: E,
11127
- EpochValidator: ft,
11128
- ExtendedAddressMap: ze,
11129
- FastMap: At,
11119
+ EpochValidator: dt,
11120
+ ExtendedAddressMap: He,
11121
+ FastMap: mt,
11130
11122
  FeaturePriority: J,
11131
11123
  Features: z,
11132
- FundingTransaction: Xt,
11124
+ FundingTransaction: qt,
11133
11125
  Generator: j,
11134
- HashCommitmentGenerator: I,
11135
- I128_BYTE_LENGTH: Pt,
11136
- I16_BYTE_LENGTH: _t,
11126
+ HashCommitmentGenerator: T,
11127
+ I128_BYTE_LENGTH: Tt,
11128
+ I16_BYTE_LENGTH: kt,
11137
11129
  I256_BYTE_LENGTH: ji,
11138
- I32_BYTE_LENGTH: Bt,
11139
- I64_BYTE_LENGTH: kt,
11140
- I8_BYTE_LENGTH: Lt,
11141
- InteractionTransaction: Yt,
11130
+ I32_BYTE_LENGTH: Ut,
11131
+ I64_BYTE_LENGTH: Ot,
11132
+ I8_BYTE_LENGTH: Bt,
11133
+ InteractionTransaction: $t,
11142
11134
  InteractionTransactionP2WDA: tt,
11143
11135
  LegacyCalldataGenerator: sr,
11144
- MINIMUM_AMOUNT_CA: It,
11136
+ MINIMUM_AMOUNT_CA: At,
11145
11137
  MINIMUM_AMOUNT_REWARD: G,
11146
- MLDSAPublicKeyMetadata: Qe,
11138
+ MLDSAPublicKeyMetadata: Ye,
11147
11139
  MLDSASecurityLevel: O.MLDSASecurityLevel,
11148
11140
  MessageSigner: ot,
11149
- MessageType: Ze,
11150
- Mnemonic: ge,
11151
- MnemonicStrength: qt,
11152
- MultiSignGenerator: Kt,
11141
+ MessageType: Qe,
11142
+ Mnemonic: pe,
11143
+ MnemonicStrength: Vt,
11144
+ MultiSignGenerator: _t,
11153
11145
  MultiSignTransaction: _,
11154
- NetEvent: Tr,
11155
- OPNET_DEPLOYMENT_VERSION: $e,
11156
- OPNetConsensusConfig: di,
11146
+ NetEvent: Ir,
11147
+ OPNET_DEPLOYMENT_VERSION: ze,
11148
+ OPNetConsensusConfig: li,
11157
11149
  OPNetLimitedProvider: mr,
11158
11150
  OfflineTransactionManager: wr,
11159
11151
  P2TR_MS: br,
11160
11152
  P2WDADetector: Q,
11161
- P2WDAGenerator: xt,
11162
- PSBTTypes: gi,
11153
+ P2WDAGenerator: Lt,
11154
+ PSBTTypes: pi,
11163
11155
  QuantumBIP32Factory: O.QuantumBIP32Factory,
11164
11156
  QuantumDerivationPath: O.QuantumDerivationPath,
11165
- RoswellConsensus: hi,
11166
- SCHNORR_SIGNATURE_BYTE_LENGTH: St,
11157
+ RoswellConsensus: ui,
11158
+ SCHNORR_SIGNATURE_BYTE_LENGTH: gt,
11167
11159
  SELECTOR_BYTE_LENGTH: Qi,
11168
- SERIALIZATION_FORMAT_VERSION: Ie,
11169
- SERIALIZATION_MAGIC_BYTE: Wt,
11170
- Secp256k1PointDeriver: He,
11171
- SharedInteractionTransaction: Ae,
11172
- SignatureType: Je,
11173
- SigningProtocol: wi,
11160
+ SERIALIZATION_FORMAT_VERSION: Ae,
11161
+ SERIALIZATION_MAGIC_BYTE: Mt,
11162
+ Secp256k1PointDeriver: Ne,
11163
+ SharedInteractionTransaction: me,
11164
+ SignatureType: je,
11165
+ SigningProtocol: yi,
11174
11166
  TapscriptVerificator: rt,
11175
11167
  TimeLockGenerator: q,
11176
11168
  TransactionBuilder: A,
11177
- TransactionFactory: ni,
11178
- TransactionReconstructor: gt,
11179
- TransactionSequence: ii,
11169
+ TransactionFactory: ri,
11170
+ TransactionReconstructor: pt,
11171
+ TransactionSequence: ti,
11180
11172
  TransactionSerializer: U,
11181
11173
  TransactionStateCapture: Z,
11182
11174
  TransactionType: m,
11183
- TweakedSigner: fe,
11184
- TweakedTransaction: Jt,
11185
- U128_BYTE_LENGTH: Et,
11186
- U16_BYTE_LENGTH: mt,
11187
- U256_BYTE_LENGTH: Ut,
11188
- U32_BYTE_LENGTH: wt,
11189
- U64_BYTE_LENGTH: Vt,
11190
- U8_BYTE_LENGTH: zt,
11191
- UnisatChainType: je,
11175
+ TweakedSigner: de,
11176
+ TweakedTransaction: jt,
11177
+ U128_BYTE_LENGTH: It,
11178
+ U16_BYTE_LENGTH: St,
11179
+ U256_BYTE_LENGTH: vt,
11180
+ U32_BYTE_LENGTH: yt,
11181
+ U64_BYTE_LENGTH: Wt,
11182
+ U8_BYTE_LENGTH: Ht,
11183
+ UnisatChainType: Ge,
11192
11184
  UnisatSigner: lr,
11193
11185
  Wallet: et,
11194
- WalletNetworks: Ot,
11195
- XverseNetwork: Si,
11196
- XverseSigner: Ir,
11197
- buildBIPPath: Ge,
11186
+ WalletNetworks: Pt,
11187
+ XverseNetwork: gi,
11188
+ XverseSigner: Tr,
11189
+ buildBIPPath: Xe,
11198
11190
  createAddressRotation: pr,
11199
- createSignerMap: ti,
11200
- currentConsensus: Ee,
11191
+ createSignerMap: Ze,
11192
+ currentConsensus: Ie,
11201
11193
  currentConsensusConfig: Sr,
11202
11194
  disabledAddressRotation: fr,
11203
11195
  getBIPDescription: or,
11204
- getLevelFromPublicKeyLength: oe,
11205
- isCancelSpecificData: li,
11206
- isCustomScriptSpecificData: ui,
11207
- isDeploymentSpecificData: ai,
11208
- isFundingSpecificData: oi,
11209
- isInteractionSpecificData: ci,
11196
+ getLevelFromPublicKeyLength: se,
11197
+ isCancelSpecificData: ci,
11198
+ isCustomScriptSpecificData: ai,
11199
+ isDeploymentSpecificData: ni,
11200
+ isFundingSpecificData: si,
11201
+ isInteractionSpecificData: oi,
11210
11202
  isMultiSigSpecificData: st,
11211
- isOPWallet: Ye,
11212
- isUniversalSigner: dt,
11203
+ isOPWallet: $e,
11204
+ isUniversalSigner: lt,
11213
11205
  toParallelKeyPair: gr,
11214
- toTweakedParallelKeyPair: ei,
11215
- version: Hi,
11216
- versionBuffer: Xe
11206
+ toTweakedParallelKeyPair: Je,
11207
+ version: Wi,
11208
+ versionBuffer: qe
11217
11209
  }, Symbol.toStringTag, { value: "Module" })), kr = O.MLDSASecurityLevel, Br = O.QuantumBIP32Factory, _r = O.QuantumDerivationPath;
11218
11210
  export {
11219
11211
  Ar as ABICoder,
11220
- yi as ABIDataTypes,
11212
+ fi as ABIDataTypes,
11221
11213
  x as ADDRESS_BYTE_LENGTH,
11222
- ce as ANCHOR_SCRIPT,
11214
+ oe as ANCHOR_SCRIPT,
11223
11215
  L as Address,
11224
- pe as AddressGenerator,
11225
- Ve as AddressMap,
11226
- Pe as AddressSet,
11216
+ he as AddressGenerator,
11217
+ We as AddressMap,
11218
+ Te as AddressSet,
11227
11219
  it as AddressTypes,
11228
11220
  Y as AddressVerificator,
11229
- vt as BIPStandard,
11221
+ Et as BIPStandard,
11230
11222
  Zi as BOOLEAN_BYTE_LENGTH,
11231
- Zt as BinaryReader,
11223
+ Qt as BinaryReader,
11232
11224
  W as BinaryWriter,
11233
11225
  M as BitcoinUtils,
11234
- Nt as BufferHelper,
11235
- ri as CSVModes,
11236
- he as CalldataGenerator,
11237
- Te as CancelTransaction,
11238
- ye as ChainId,
11239
- ue as ChallengeSolution,
11240
- fi as ChallengeSubmission,
11241
- pi as ChallengeVerification,
11226
+ Ft as BufferHelper,
11227
+ ei as CSVModes,
11228
+ ue as CalldataGenerator,
11229
+ be as CancelTransaction,
11230
+ fe as ChainId,
11231
+ ae as ChallengeSolution,
11232
+ di as ChallengeSubmission,
11233
+ hi as ChallengeVerification,
11242
11234
  $ as Compressor,
11243
- Dt as Consensus,
11244
- si as ConsolidatedInteractionTransaction,
11245
- ne as ContractAddress,
11235
+ Kt as Consensus,
11236
+ ii as ConsolidatedInteractionTransaction,
11237
+ re as ContractAddress,
11246
11238
  cr as ContractBaseMetadata,
11247
- qe as CustomGenerator,
11248
- be as CustomKeypair,
11249
- Gt as CustomMap,
11250
- $t as CustomScriptTransaction,
11251
- de as DeploymentGenerator,
11252
- bt as DeploymentTransaction,
11253
- ve as DeterministicMap,
11254
- Oe as DeterministicSet,
11255
- yt as EXTENDED_ADDRESS_BYTE_LENGTH,
11239
+ Ve as CustomGenerator,
11240
+ we as CustomKeypair,
11241
+ Xt as CustomMap,
11242
+ zt as CustomScriptTransaction,
11243
+ le as DeploymentGenerator,
11244
+ wt as DeploymentTransaction,
11245
+ Ee as DeterministicMap,
11246
+ Pe as DeterministicSet,
11247
+ ft as EXTENDED_ADDRESS_BYTE_LENGTH,
11256
11248
  E as EcKeyPair,
11257
- ft as EpochValidator,
11258
- ze as ExtendedAddressMap,
11259
- At as FastMap,
11249
+ dt as EpochValidator,
11250
+ He as ExtendedAddressMap,
11251
+ mt as FastMap,
11260
11252
  J as FeaturePriority,
11261
11253
  z as Features,
11262
- Xt as FundingTransaction,
11254
+ qt as FundingTransaction,
11263
11255
  j as Generator,
11264
- I as HashCommitmentGenerator,
11265
- Pt as I128_BYTE_LENGTH,
11266
- _t as I16_BYTE_LENGTH,
11256
+ T as HashCommitmentGenerator,
11257
+ Tt as I128_BYTE_LENGTH,
11258
+ kt as I16_BYTE_LENGTH,
11267
11259
  ji as I256_BYTE_LENGTH,
11268
- Bt as I32_BYTE_LENGTH,
11269
- kt as I64_BYTE_LENGTH,
11270
- Lt as I8_BYTE_LENGTH,
11271
- Yt as InteractionTransaction,
11260
+ Ut as I32_BYTE_LENGTH,
11261
+ Ot as I64_BYTE_LENGTH,
11262
+ Bt as I8_BYTE_LENGTH,
11263
+ $t as InteractionTransaction,
11272
11264
  tt as InteractionTransactionP2WDA,
11273
11265
  sr as LegacyCalldataGenerator,
11274
- It as MINIMUM_AMOUNT_CA,
11266
+ At as MINIMUM_AMOUNT_CA,
11275
11267
  G as MINIMUM_AMOUNT_REWARD,
11276
- Qe as MLDSAPublicKeyMetadata,
11268
+ Ye as MLDSAPublicKeyMetadata,
11277
11269
  kr as MLDSASecurityLevel,
11278
11270
  ot as MessageSigner,
11279
- Ze as MessageType,
11280
- ge as Mnemonic,
11281
- qt as MnemonicStrength,
11282
- Kt as MultiSignGenerator,
11271
+ Qe as MessageType,
11272
+ pe as Mnemonic,
11273
+ Vt as MnemonicStrength,
11274
+ _t as MultiSignGenerator,
11283
11275
  _ as MultiSignTransaction,
11284
- Tr as NetEvent,
11285
- $e as OPNET_DEPLOYMENT_VERSION,
11286
- di as OPNetConsensusConfig,
11276
+ Ir as NetEvent,
11277
+ ze as OPNET_DEPLOYMENT_VERSION,
11278
+ li as OPNetConsensusConfig,
11287
11279
  mr as OPNetLimitedProvider,
11288
11280
  wr as OfflineTransactionManager,
11289
11281
  br as P2TR_MS,
11290
11282
  Q as P2WDADetector,
11291
- xt as P2WDAGenerator,
11292
- gi as PSBTTypes,
11283
+ Lt as P2WDAGenerator,
11284
+ pi as PSBTTypes,
11293
11285
  Br as QuantumBIP32Factory,
11294
11286
  _r as QuantumDerivationPath,
11295
- hi as RoswellConsensus,
11296
- St as SCHNORR_SIGNATURE_BYTE_LENGTH,
11287
+ ui as RoswellConsensus,
11288
+ gt as SCHNORR_SIGNATURE_BYTE_LENGTH,
11297
11289
  Qi as SELECTOR_BYTE_LENGTH,
11298
- Ie as SERIALIZATION_FORMAT_VERSION,
11299
- Wt as SERIALIZATION_MAGIC_BYTE,
11300
- He as Secp256k1PointDeriver,
11301
- Ae as SharedInteractionTransaction,
11302
- Je as SignatureType,
11303
- wi as SigningProtocol,
11290
+ Ae as SERIALIZATION_FORMAT_VERSION,
11291
+ Mt as SERIALIZATION_MAGIC_BYTE,
11292
+ Ne as Secp256k1PointDeriver,
11293
+ me as SharedInteractionTransaction,
11294
+ je as SignatureType,
11295
+ yi as SigningProtocol,
11304
11296
  rt as TapscriptVerificator,
11305
11297
  q as TimeLockGenerator,
11306
11298
  A as TransactionBuilder,
11307
- ni as TransactionFactory,
11308
- gt as TransactionReconstructor,
11309
- ii as TransactionSequence,
11299
+ ri as TransactionFactory,
11300
+ pt as TransactionReconstructor,
11301
+ ti as TransactionSequence,
11310
11302
  U as TransactionSerializer,
11311
11303
  Z as TransactionStateCapture,
11312
11304
  m as TransactionType,
11313
- fe as TweakedSigner,
11314
- Jt as TweakedTransaction,
11315
- Et as U128_BYTE_LENGTH,
11316
- mt as U16_BYTE_LENGTH,
11317
- Ut as U256_BYTE_LENGTH,
11318
- wt as U32_BYTE_LENGTH,
11319
- Vt as U64_BYTE_LENGTH,
11320
- zt as U8_BYTE_LENGTH,
11321
- je as UnisatChainType,
11305
+ de as TweakedSigner,
11306
+ jt as TweakedTransaction,
11307
+ It as U128_BYTE_LENGTH,
11308
+ St as U16_BYTE_LENGTH,
11309
+ vt as U256_BYTE_LENGTH,
11310
+ yt as U32_BYTE_LENGTH,
11311
+ Wt as U64_BYTE_LENGTH,
11312
+ Ht as U8_BYTE_LENGTH,
11313
+ Ge as UnisatChainType,
11322
11314
  lr as UnisatSigner,
11323
11315
  et as Wallet,
11324
- Ot as WalletNetworks,
11325
- Si as XverseNetwork,
11326
- Ir as XverseSigner,
11327
- Ge as buildBIPPath,
11316
+ Pt as WalletNetworks,
11317
+ gi as XverseNetwork,
11318
+ Tr as XverseSigner,
11319
+ Xe as buildBIPPath,
11328
11320
  pr as createAddressRotation,
11329
- ti as createSignerMap,
11330
- Ee as currentConsensus,
11321
+ Ze as createSignerMap,
11322
+ Ie as currentConsensus,
11331
11323
  Sr as currentConsensusConfig,
11332
11324
  fr as disabledAddressRotation,
11333
11325
  or as getBIPDescription,
11334
- oe as getLevelFromPublicKeyLength,
11335
- li as isCancelSpecificData,
11336
- ui as isCustomScriptSpecificData,
11337
- ai as isDeploymentSpecificData,
11338
- oi as isFundingSpecificData,
11339
- ci as isInteractionSpecificData,
11326
+ se as getLevelFromPublicKeyLength,
11327
+ ci as isCancelSpecificData,
11328
+ ai as isCustomScriptSpecificData,
11329
+ ni as isDeploymentSpecificData,
11330
+ si as isFundingSpecificData,
11331
+ oi as isInteractionSpecificData,
11340
11332
  st as isMultiSigSpecificData,
11341
- Ye as isOPWallet,
11342
- dt as isUniversalSigner,
11333
+ $e as isOPWallet,
11334
+ lt as isUniversalSigner,
11343
11335
  Ur as opnet,
11344
11336
  gr as toParallelKeyPair,
11345
- ei as toTweakedParallelKeyPair,
11346
- Hi as version,
11347
- Xe as versionBuffer
11337
+ Je as toTweakedParallelKeyPair,
11338
+ Wi as version,
11339
+ qe as versionBuffer
11348
11340
  };