@btc-vision/transaction 1.8.4 → 1.8.6-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/browser/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { a as ae, r as Ti } from "./rolldown-runtime.js";
2
2
  import { a as Ai, c as ce, d as xt, i as Be, l as ot, n as Ei, o as bi, r as Ii, s as Pt, t as Pi, u as ke } from "./vendors.js";
3
- import { A as vi, B as D, C as E, D as Oi, E as b, F as lt, I as be, L as Vt, M as _i, N as Ui, O as Bi, P as ki, R as f, S as Le, T as Re, V as p, _ as Ie, a as Ce, b as y, c as Li, d as R, f as Ri, g as zt, h as Ci, i as W, j as qt, k as S, l as Di, m as Ki, n as _, o as xi, p as Ni, r as Mi, s as it, t as H, u as Fi, v as Wi, w as k, x as Hi, y as O, z as Vi } from "./btc-vision-bitcoin.js";
4
- import { A as zi, F as Ht, c as qi, f as Gi, l as ue, n as Xi, s as $i, t as Yi, u as Nt } from "./noble-curves.js";
3
+ import { A as vi, B as C, C as E, D as Oi, E as b, F as lt, I as be, L as Vt, M as _i, N as Ui, O as Bi, P as ki, R as f, S as Le, T as Re, V as p, _ as Ie, a as De, b as y, c as Li, d as R, f as Ri, g as zt, h as Di, i as W, j as qt, k as S, l as Ci, m as Ki, n as _, o as xi, p as Mi, r as Ni, s as it, t as H, u as Fi, v as Wi, w as k, x as Hi, y as O, z as Vi } from "./btc-vision-bitcoin.js";
4
+ import { A as zi, F as Ht, c as qi, f as Gi, l as ue, n as Xi, s as $i, t as Yi, u as Mt } from "./noble-curves.js";
5
5
  var Lt = Symbol;
6
6
  typeof Lt.dispose != "symbol" && (Lt.dispose = /* @__PURE__ */ Symbol.for("Symbol.dispose"));
7
7
  typeof Lt.asyncDispose != "symbol" && (Lt.asyncDispose = /* @__PURE__ */ Symbol.for("Symbol.asyncDispose"));
8
- var ji = "1.8.4";
8
+ var ji = "1.8.6";
9
9
  function Qi(e, t = {}) {
10
10
  return new Uint8Array(xt.gzip(e, { level: t.level || 6 }));
11
11
  }
@@ -36,15 +36,15 @@ var Pe = {
36
36
  }
37
37
  };
38
38
  Pt();
39
- var C = bi(), er = C;
39
+ var D = bi(), er = D;
40
40
  Bi(er);
41
41
  var P = /* @__PURE__ */ ae(Ai(), 1);
42
42
  Pt();
43
43
  ue();
44
44
  qi();
45
- var De = typeof P.default == "function" ? P.default : P.BIP32Factory;
46
- if (!De) throw new Error("Failed to load BIP32 library");
47
- var dt = Yi.Point, ir = dt.Fn.ORDER, ve = Nt(new Uint8Array([
45
+ var Ce = typeof P.default == "function" ? P.default : P.BIP32Factory;
46
+ if (!Ce) throw new Error("Failed to load BIP32 library");
47
+ var dt = Yi.Point, ir = dt.Fn.ORDER, ve = Mt(new Uint8Array([
48
48
  84,
49
49
  97,
50
50
  112,
@@ -55,22 +55,22 @@ var dt = Yi.Point, ir = dt.Fn.ORDER, ve = Nt(new Uint8Array([
55
55
  107
56
56
  ]));
57
57
  function rr(e) {
58
- return Nt(zi(ve, ve, e));
58
+ return Mt(zi(ve, ve, e));
59
59
  }
60
60
  var I = class Xt {
61
- static BIP32 = De(C);
61
+ static BIP32 = Ce(D);
62
62
  static ECPairSigner = ot;
63
63
  static {
64
64
  dt.BASE.precompute(8);
65
65
  }
66
66
  static fromWIF(t, i = y.bitcoin) {
67
- return ot.fromWIF(C, t, i);
67
+ return ot.fromWIF(D, t, i);
68
68
  }
69
69
  static fromPrivateKey(t, i = y.bitcoin) {
70
- return ot.fromPrivateKey(C, t, i);
70
+ return ot.fromPrivateKey(D, t, i);
71
71
  }
72
72
  static fromPublicKey(t, i = y.bitcoin) {
73
- return ot.fromPublicKey(C, t, i);
73
+ return ot.fromPublicKey(D, t, i);
74
74
  }
75
75
  static generateMultiSigAddress(t, i, r = y.bitcoin) {
76
76
  const s = this.verifyPubKeys(t, r);
@@ -117,7 +117,7 @@ var I = class Xt {
117
117
  static p2op(t, i = y.bitcoin, r = 0) {
118
118
  const s = lt([new Uint8Array([r]), it.crypto.hash160(t)]);
119
119
  if (s.length < 2 || s.length > 40) throw new Error("Witness program must be 2-40 bytes.");
120
- return Mi(b.compile([p.OP_16, s]), i);
120
+ return Ni(b.compile([p.OP_16, s]), i);
121
121
  }
122
122
  static xOnlyTweakedPubKeyToAddress(t, i) {
123
123
  t.startsWith("0x") && (t = t.slice(2));
@@ -143,7 +143,7 @@ var I = class Xt {
143
143
  });
144
144
  }
145
145
  static generateWallet(t = y.bitcoin, i = P.MLDSASecurityLevel.LEVEL2) {
146
- const r = ot.makeRandom(C, t, { rng: (o) => Ht(o) }), s = this.getP2WPKHAddress(r, t);
146
+ const r = ot.makeRandom(D, t, { rng: (o) => Ht(o) }), s = this.getP2WPKHAddress(r, t);
147
147
  if (!s) throw new Error("Failed to generate wallet");
148
148
  const n = this.generateQuantumKeyPair(i, t);
149
149
  return {
@@ -201,7 +201,7 @@ var I = class Xt {
201
201
  return "0x" + f(r.output);
202
202
  }
203
203
  static generateRandomKeyPair(t = y.bitcoin) {
204
- return ot.makeRandom(C, t, { rng: (i) => Ht(i) });
204
+ return ot.makeRandom(D, t, { rng: (i) => Ht(i) });
205
205
  }
206
206
  static fromSeed(t, i = y.bitcoin) {
207
207
  return this.BIP32.fromSeed(t, i);
@@ -225,9 +225,9 @@ var I = class Xt {
225
225
  static fromSeedKeyPair(t, i = y.bitcoin) {
226
226
  const r = this.BIP32.fromSeed(t, i).privateKey;
227
227
  if (!r) throw new Error("Failed to generate key pair");
228
- return ot.fromPrivateKey(C, r, i);
228
+ return ot.fromPrivateKey(D, r, i);
229
229
  }
230
- }, q = /* @__PURE__ */ (function(e) {
230
+ }, G = /* @__PURE__ */ (function(e) {
231
231
  return e[e.ACCESS_LIST = 1] = "ACCESS_LIST", e[e.EPOCH_SUBMISSION = 2] = "EPOCH_SUBMISSION", e[e.MLDSA_LINK_PUBKEY = 4] = "MLDSA_LINK_PUBKEY", e;
232
232
  })({}), J = /* @__PURE__ */ (function(e) {
233
233
  return e[e.ACCESS_LIST = 1] = "ACCESS_LIST", e[e.EPOCH_SUBMISSION = 2] = "EPOCH_SUBMISSION", e[e.MLDSA_LINK_PUBKEY = 3] = "MLDSA_LINK_PUBKEY", e;
@@ -246,7 +246,7 @@ var Oe = nr(), ls = Oe.crypto || Oe.msCrypto;
246
246
  function $t(e) {
247
247
  switch (e) {
248
248
  case "sha256":
249
- return Nt.create();
249
+ return Mt.create();
250
250
  case "sha512":
251
251
  return Gi.create();
252
252
  }
@@ -278,7 +278,7 @@ var or = /^[0-9a-fA-F]+$/, F = class Ke {
278
278
  const r = i.digest();
279
279
  return `0x${f(new Uint8Array(r))}`;
280
280
  }
281
- }, X = class {
281
+ }, $ = class {
282
282
  static isP2WDAUTXO(e) {
283
283
  if (!e.witnessScript) return !1;
284
284
  const t = e.witnessScript instanceof Uint8Array ? e.witnessScript : S(e.witnessScript);
@@ -373,7 +373,7 @@ var or = /^[0-9a-fA-F]+$/, F = class Ke {
373
373
  return r;
374
374
  }
375
375
  static isP2WDAWitnessScript(t) {
376
- return X.isP2WDAWitnessScript(t);
376
+ return $.isP2WDAWitnessScript(t);
377
377
  }
378
378
  static isP2PKHOrP2SH(t, i) {
379
379
  try {
@@ -488,7 +488,7 @@ var or = /^[0-9a-fA-F]+$/, F = class Ke {
488
488
  isDefinitelyP2WDA: !1,
489
489
  error: "Witness script does not match address"
490
490
  };
491
- const s = X.extractPublicKeyFromP2WDA(r);
491
+ const s = $.extractPublicKeyFromP2WDA(r);
492
492
  return s ? {
493
493
  isValid: !0,
494
494
  isPotentiallyP2WDA: !0,
@@ -836,7 +836,7 @@ var cr = [
836
836
  const i = new Uint8Array(this.#i);
837
837
  if (i.length !== 33) throw new Error("P2WDA requires a compressed public key (33 bytes)");
838
838
  try {
839
- const r = X.generateP2WDAAddress(i, t);
839
+ const r = $.generateP2WDAAddress(i, t);
840
840
  return this.#n = t, this.#d = r, {
841
841
  address: r.address,
842
842
  witnessScript: r.witnessScript
@@ -895,7 +895,7 @@ var cr = [
895
895
  } else {
896
896
  if (!cr.includes(t.length)) throw new Error(`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.`);
897
897
  this.#a = new Uint8Array(t.length), this.#a.set(t);
898
- const i = Nt(new Uint8Array(t)), r = new Uint8Array(32);
898
+ const i = Mt(new Uint8Array(t)), r = new Uint8Array(32);
899
899
  r.set(i), super.set(r);
900
900
  }
901
901
  }
@@ -907,15 +907,15 @@ var cr = [
907
907
  }
908
908
  autoFormat(t) {
909
909
  const i = t[0];
910
- i === 3 || i === 2 || (i === 4 || i === 6 || i === 7) && (t = j.uncompressedToCompressed(t)), this.#i = Uint8Array.from(t), this.#h = I.fromPublicKey(this.#i), this.#r = Ni(this.#i);
910
+ i === 3 || i === 2 || (i === 4 || i === 6 || i === 7) && (t = j.uncompressedToCompressed(t)), this.#i = Uint8Array.from(t), this.#h = I.fromPublicKey(this.#i), this.#r = Mi(this.#i);
911
911
  const r = O(I.tweakPublicKey(this.#i));
912
912
  this.#s = Yt.generateHybridKeyFromHash(r), this.#o = new Uint8Array(32), this.#o.set(r);
913
913
  }
914
- }, Mt = class Ne {
914
+ }, Nt = class Me {
915
915
  _keys = [];
916
916
  _values = {};
917
917
  constructor(t) {
918
- if (t instanceof Ne) this.setAll(t);
918
+ if (t instanceof Me) this.setAll(t);
919
919
  else if (t) for (const [i, r] of t) this.set(i, r);
920
920
  }
921
921
  get size() {
@@ -967,10 +967,10 @@ var cr = [
967
967
  *[Symbol.iterator]() {
968
968
  for (const t of this._keys) yield [t, this._values[t]];
969
969
  }
970
- }, Me = class {
970
+ }, Ne = class {
971
971
  items;
972
972
  constructor(e) {
973
- if (this.items = new Mt(), e) for (const [t, i] of e) this.set(t, i);
973
+ if (this.items = new Nt(), e) for (const [t, i] of e) this.set(t, i);
974
974
  }
975
975
  get size() {
976
976
  return this.items.size;
@@ -1021,7 +1021,7 @@ var cr = [
1021
1021
  _keys = [];
1022
1022
  _values = [];
1023
1023
  constructor(e) {
1024
- if (this.indexMap = new Mt(), e) for (const [t, i] of e) this.set(t, i);
1024
+ if (this.indexMap = new Nt(), e) for (const [t, i] of e) this.set(t, i);
1025
1025
  }
1026
1026
  get size() {
1027
1027
  return this._keys.length;
@@ -1294,7 +1294,7 @@ var cr = [
1294
1294
  return i;
1295
1295
  }
1296
1296
  readAddressValueTuple(e = !0) {
1297
- const t = this.readU16(e), i = new Me();
1297
+ const t = this.readU16(e), i = new Ne();
1298
1298
  for (let r = 0; r < t; r++) {
1299
1299
  const s = this.readAddress(), n = this.readU256(e);
1300
1300
  if (i.has(s)) throw new Error("Duplicate address found in map");
@@ -1576,11 +1576,11 @@ var cr = [
1576
1576
  }
1577
1577
  encodeFeature(t, i) {
1578
1578
  switch (t.opcode) {
1579
- case q.ACCESS_LIST:
1579
+ case G.ACCESS_LIST:
1580
1580
  return this.encodeAccessListFeature(t, i);
1581
- case q.EPOCH_SUBMISSION:
1581
+ case G.EPOCH_SUBMISSION:
1582
1582
  return this.encodeChallengeSubmission(t, i);
1583
- case q.MLDSA_LINK_PUBKEY:
1583
+ case G.MLDSA_LINK_PUBKEY:
1584
1584
  return this.encodeLinkRequest(t, i);
1585
1585
  default:
1586
1586
  throw new Error(`Unknown feature type: ${t.opcode}`);
@@ -1602,8 +1602,9 @@ var cr = [
1602
1602
  }
1603
1603
  encodeChallengeSubmission(t, i) {
1604
1604
  if ("verifySignature" in t.data && !t.data.verifySignature()) throw new Error("Invalid signature in challenge submission feature");
1605
+ if (t.data.graffiti && t.data.graffiti.length > 16) throw new Error("Invalid epoch submission graffiti length");
1605
1606
  const r = new V();
1606
- r.writeBytes(t.data.publicKey.toBuffer()), r.writeBytes(t.data.solution), t.data.graffiti && r.writeBytesWithLength(t.data.graffiti), i.writeBytesWithLength(r.getBuffer());
1607
+ r.writeBytes(t.data.publicKey.toBuffer()), r.writeBytes(t.data.solution), t.data.graffiti && r.writeBytes(t.data.graffiti), i.writeBytesWithLength(r.getBuffer());
1607
1608
  }
1608
1609
  encodeLinkRequest(t, i) {
1609
1610
  const r = t.data, s = new V();
@@ -1651,13 +1652,13 @@ var cr = [
1651
1652
  this.xSenderPubKey,
1652
1653
  p.OP_DUP,
1653
1654
  p.OP_HASH256,
1654
- D.hash256(this.xSenderPubKey),
1655
+ C.hash256(this.xSenderPubKey),
1655
1656
  p.OP_EQUALVERIFY,
1656
1657
  p.OP_CHECKSIGVERIFY,
1657
1658
  this.contractSaltPubKey,
1658
1659
  p.OP_CHECKSIGVERIFY,
1659
1660
  p.OP_HASH160,
1660
- D.hash160(t),
1661
+ C.hash160(t),
1661
1662
  p.OP_EQUALVERIFY,
1662
1663
  p.OP_DEPTH,
1663
1664
  p.OP_1,
@@ -1709,13 +1710,13 @@ var cr = [
1709
1710
  this.xSenderPubKey,
1710
1711
  p.OP_DUP,
1711
1712
  p.OP_HASH256,
1712
- D.hash256(this.xSenderPubKey),
1713
+ C.hash256(this.xSenderPubKey),
1713
1714
  p.OP_EQUALVERIFY,
1714
1715
  p.OP_CHECKSIGVERIFY,
1715
1716
  this.contractSaltPubKey,
1716
1717
  p.OP_CHECKSIGVERIFY,
1717
1718
  p.OP_HASH256,
1718
- D.hash256(t),
1719
+ C.hash256(t),
1719
1720
  p.OP_EQUALVERIFY,
1720
1721
  p.OP_DEPTH,
1721
1722
  p.OP_1,
@@ -1807,7 +1808,7 @@ var cr = [
1807
1808
  const r = v.extractDataHashes(i);
1808
1809
  if (!r || r.length !== t.length) return !1;
1809
1810
  for (let s = 0; s < t.length; s++) {
1810
- const n = D.hash160(t[s]);
1811
+ const n = C.hash160(t[s]);
1811
1812
  if (!R(r[s], n)) return !1;
1812
1813
  }
1813
1814
  return !0;
@@ -1828,7 +1829,7 @@ var cr = [
1828
1829
  };
1829
1830
  }
1830
1831
  hashChunk(t) {
1831
- return D.hash160(t);
1832
+ return C.hash160(t);
1832
1833
  }
1833
1834
  generateWitnessScript(t) {
1834
1835
  if (t.length === 0) throw new Error("At least one data hash is required");
@@ -1910,7 +1911,7 @@ var cr = [
1910
1911
  this.senderPubKey,
1911
1912
  p.OP_DUP,
1912
1913
  p.OP_HASH256,
1913
- D.hash256(this.senderPubKey),
1914
+ C.hash256(this.senderPubKey),
1914
1915
  p.OP_EQUALVERIFY,
1915
1916
  p.OP_CHECKSIGVERIFY,
1916
1917
  t,
@@ -2013,9 +2014,9 @@ var cr = [
2013
2014
  const s = lt([
2014
2015
  t,
2015
2016
  r,
2016
- D.hash256(i)
2017
+ C.hash256(i)
2017
2018
  ]);
2018
- return D.hash256(s);
2019
+ return C.hash256(s);
2019
2020
  }
2020
2021
  static generateAddressFromScript(t, i) {
2021
2022
  const r = t.network || y.bitcoin, s = {
@@ -2047,8 +2048,8 @@ var pe = class {
2047
2048
  static tweakSigner(e, t = {}) {
2048
2049
  let i = e.privateKey;
2049
2050
  if (!i) throw new Error("Private key is required for tweaking signer!");
2050
- e.publicKey[0] === 3 && (i = C.privateNegate(i));
2051
- const r = C.privateAdd(i, ki(O(e.publicKey), t.tweakHash));
2051
+ e.publicKey[0] === 3 && (i = D.privateNegate(i));
2052
+ const r = D.privateAdd(i, ki(O(e.publicKey), t.tweakHash));
2052
2053
  if (!r) throw new Error("Invalid tweaked private key!");
2053
2054
  return I.fromPrivateKey(r, t.network);
2054
2055
  }
@@ -2066,7 +2067,7 @@ var mt = /* @__PURE__ */ (function(e) {
2066
2067
  return e.ecdsa = "ecdsa", e.schnorr = "schnorr", e;
2067
2068
  })({}), pr = class {
2068
2069
  sha256(e) {
2069
- return D.sha256(e);
2070
+ return C.sha256(e);
2070
2071
  }
2071
2072
  async trySignSchnorrWithOPWallet(e) {
2072
2073
  const t = this.getOPWallet();
@@ -2152,32 +2153,32 @@ var mt = /* @__PURE__ */ (function(e) {
2152
2153
  signMessage(e, t) {
2153
2154
  if (typeof t == "string" && (t = new TextEncoder().encode(t)), !e.privateKey) throw new Error("Private key not found in keypair.");
2154
2155
  const i = this.sha256(t);
2155
- if (!C.signSchnorr) throw new Error("backend.signSchnorr is not available.");
2156
+ if (!D.signSchnorr) throw new Error("backend.signSchnorr is not available.");
2156
2157
  return {
2157
- signature: C.signSchnorr(i, e.privateKey),
2158
+ signature: D.signSchnorr(i, e.privateKey),
2158
2159
  message: i
2159
2160
  };
2160
2161
  }
2161
2162
  signECDSA(e, t) {
2162
2163
  if (typeof t == "string" && (t = new TextEncoder().encode(t)), !e.privateKey) throw new Error("Private key not found in keypair.");
2163
2164
  const i = this.sha256(t);
2164
- if (!C.sign) throw new Error("backend.signSchnorr is not available.");
2165
+ if (!D.sign) throw new Error("backend.signSchnorr is not available.");
2165
2166
  return {
2166
- signature: C.sign(i, e.privateKey),
2167
+ signature: D.sign(i, e.privateKey),
2167
2168
  message: i
2168
2169
  };
2169
2170
  }
2170
2171
  verifyECDSASignature(e, t, i) {
2171
2172
  if (typeof t == "string" && (t = new TextEncoder().encode(t)), i.length !== 64) throw new Error("Invalid signature length.");
2172
2173
  const r = this.sha256(t);
2173
- if (!C.verify) throw new Error("backend.verifySchnorr is not available.");
2174
- return C.verify(r, e, i);
2174
+ if (!D.verify) throw new Error("backend.verifySchnorr is not available.");
2175
+ return D.verify(r, e, i);
2175
2176
  }
2176
2177
  verifySignature(e, t, i) {
2177
2178
  if (typeof t == "string" && (t = new TextEncoder().encode(t)), i.length !== 64) throw new Error("Invalid signature length.");
2178
2179
  const r = this.sha256(t);
2179
- if (!C.verifySchnorr) throw new Error("backend.verifySchnorr is not available.");
2180
- return C.verifySchnorr(r, O(e), i);
2180
+ if (!D.verifySchnorr) throw new Error("backend.verifySchnorr is not available.");
2181
+ return D.verifySchnorr(r, O(e), i);
2181
2182
  }
2182
2183
  tweakAndVerifySignature(e, t, i) {
2183
2184
  const r = I.tweakPublicKey(e);
@@ -2360,7 +2361,7 @@ function fr(e) {
2360
2361
  function $e(e, t, i, r, s) {
2361
2362
  return `m/${e}'/${t}'/${i}'/${r}/${s}`;
2362
2363
  }
2363
- var gr = (0, P.BIP32Factory)(C), Sr = class Ye {
2364
+ var gr = (0, P.BIP32Factory)(D), Sr = class Ye {
2364
2365
  _phrase;
2365
2366
  _passphrase;
2366
2367
  _network;
@@ -2678,7 +2679,7 @@ function Tr(e, t) {
2678
2679
  return Ar(e, t) !== -1;
2679
2680
  }
2680
2681
  function Ar(e, t) {
2681
- const i = D.hash160(e), r = O(e), s = b.decompile(t);
2682
+ const i = C.hash160(e), r = O(e), s = b.decompile(t);
2682
2683
  if (s === null) throw new Error("Unknown script error");
2683
2684
  return s.findIndex((n) => typeof n == "number" ? !1 : n instanceof Uint8Array && (R(n, e) || R(n, i) || R(n, r)));
2684
2685
  }
@@ -3043,7 +3044,7 @@ var At = /* @__PURE__ */ (function(e) {
3043
3044
  durationMs: 0
3044
3045
  };
3045
3046
  let c, u = !1;
3046
- this.parallelSigningConfig && "signBatch" in this.parallelSigningConfig ? c = this.parallelSigningConfig : (c = Ci.getInstance(this.parallelSigningConfig), c.isPreservingWorkers || (u = !0));
3047
+ this.parallelSigningConfig && "signBatch" in this.parallelSigningConfig ? c = this.parallelSigningConfig : (c = Di.getInstance(this.parallelSigningConfig), c.isPreservingWorkers || (u = !0));
3047
3048
  try {
3048
3049
  await c.initialize();
3049
3050
  const l = await c.signBatch(a, n);
@@ -3068,13 +3069,13 @@ var At = /* @__PURE__ */ (function(e) {
3068
3069
  }).output;
3069
3070
  }
3070
3071
  generateP2SHRedeemScriptLegacy(t) {
3071
- const i = D.hash160(this.signer.publicKey), r = b.compile([
3072
+ const i = C.hash160(this.signer.publicKey), r = b.compile([
3072
3073
  p.OP_DUP,
3073
3074
  p.OP_HASH160,
3074
3075
  i,
3075
3076
  p.OP_EQUALVERIFY,
3076
3077
  p.OP_CHECKSIG
3077
- ]), s = D.hash160(r), n = b.compile([
3078
+ ]), s = C.hash160(r), n = b.compile([
3078
3079
  p.OP_HASH160,
3079
3080
  s,
3080
3081
  p.OP_EQUAL
@@ -3147,7 +3148,7 @@ var At = /* @__PURE__ */ (function(e) {
3147
3148
  i === 0 && this.tapData?.hash && (n.tapMerkleRoot = this.tapData.hash);
3148
3149
  } else if (Vi(s))
3149
3150
  this.anchorInputIndices.add(i), n.isPayToAnchor = !0;
3150
- else if (Di(s) || Fi(s)) if (t.nonWitnessUtxo) n.nonWitnessUtxo = t.nonWitnessUtxo instanceof Uint8Array ? t.nonWitnessUtxo : S(t.nonWitnessUtxo);
3151
+ else if (Ci(s) || Fi(s)) if (t.nonWitnessUtxo) n.nonWitnessUtxo = t.nonWitnessUtxo instanceof Uint8Array ? t.nonWitnessUtxo : S(t.nonWitnessUtxo);
3151
3152
  else throw new Error("Missing nonWitnessUtxo for P2PK or P2MS UTXO");
3152
3153
  else this.error(`Unknown or unsupported script type for output: ${t.scriptPubKey.hex}`);
3153
3154
  return i === 0 && (this.tapLeafScript && (n.tapLeafScript = [this.tapLeafScript]), this.nonWitnessUtxo && (n.nonWitnessUtxo = this.nonWitnessUtxo)), n;
@@ -3194,20 +3195,20 @@ var At = /* @__PURE__ */ (function(e) {
3194
3195
  };
3195
3196
  if (o && s && i.witnessScript) {
3196
3197
  if (!i.partialSig || i.partialSig.length === 0) throw new Error(`No signatures for P2WSH input #${t}`);
3197
- if (X.isP2WDAWitnessScript(i.witnessScript)) return this.finalizeSecondaryP2WDA(t, i);
3198
+ if ($.isP2WDAWitnessScript(i.witnessScript)) return this.finalizeSecondaryP2WDA(t, i);
3198
3199
  if (this.csvInputIndices.has(t)) return {
3199
3200
  finalScriptSig: void 0,
3200
3201
  finalScriptWitness: ee([i.partialSig[0].signature, i.witnessScript])
3201
3202
  };
3202
3203
  }
3203
- return Ce(t, i, r, s, n, o, !0, this.unlockScript);
3204
+ return De(t, i, r, s, n, o, !0, this.unlockScript);
3204
3205
  };
3205
3206
  finalizeSecondaryP2WDA(t, i) {
3206
3207
  if (!i.partialSig || i.partialSig.length === 0) throw new Error(`No signature for P2WDA input #${t}`);
3207
3208
  if (!i.witnessScript) throw new Error(`No witness script for P2WDA input #${t}`);
3208
3209
  return {
3209
3210
  finalScriptSig: void 0,
3210
- finalScriptWitness: ee(X.createSimpleP2WDAWitness(i.partialSig[0].signature, i.witnessScript))
3211
+ finalScriptWitness: ee($.createSimpleP2WDAWitness(i.partialSig[0].signature, i.witnessScript))
3211
3212
  };
3212
3213
  }
3213
3214
  async signInputsWalletBased(t) {
@@ -3583,9 +3584,9 @@ var Ue = new Uint8Array([
3583
3584
  finalScriptSig: void 0,
3584
3585
  finalScriptWitness: Uint8Array.from([0])
3585
3586
  };
3586
- if (d.witnessScript && X.isP2WDAWitnessScript(d.witnessScript)) {
3587
+ if (d.witnessScript && $.isP2WDAWitnessScript(d.witnessScript)) {
3587
3588
  const m = [];
3588
- for (let N = 0; N < 10; N++) m.push(new Uint8Array(0));
3589
+ for (let M = 0; M < 10; M++) m.push(new Uint8Array(0));
3589
3590
  const A = new Uint8Array(72);
3590
3591
  return { finalScriptWitness: L.witnessStackToScriptWitness([
3591
3592
  ...m,
@@ -3594,13 +3595,13 @@ var Ue = new Uint8Array([
3594
3595
  ]) };
3595
3596
  }
3596
3597
  if (h === 0 && this.tapLeafScript) {
3597
- const m = new Uint8Array(32), A = this.tapLeafScript.script, N = this.useP2MR ? 33 : 65, $ = new Uint8Array(N);
3598
+ const m = new Uint8Array(32), A = this.tapLeafScript.script, M = this.useP2MR ? 33 : 65, q = new Uint8Array(M);
3598
3599
  return { finalScriptWitness: L.witnessStackToScriptWitness([
3599
3600
  m,
3600
3601
  s,
3601
3602
  s,
3602
3603
  A,
3603
- $
3604
+ q
3604
3605
  ]) };
3605
3606
  }
3606
3607
  if (d.witnessUtxo) {
@@ -3621,10 +3622,10 @@ var Ue = new Uint8Array([
3621
3622
  }
3622
3623
  const m = it.script.decompile(d.witnessScript);
3623
3624
  if (m && m.length >= 4) {
3624
- const A = m[0], N = m[m.length - 1];
3625
- if (typeof A == "number" && A >= p.OP_1 && N === p.OP_CHECKMULTISIG) {
3626
- const $ = A - p.OP_1 + 1, vt = [];
3627
- for (let Ee = 0; Ee < $; Ee++) vt.push(n);
3625
+ const A = m[0], M = m[m.length - 1];
3626
+ if (typeof A == "number" && A >= p.OP_1 && M === p.OP_CHECKMULTISIG) {
3627
+ const q = A - p.OP_1 + 1, vt = [];
3628
+ for (let Ee = 0; Ee < q; Ee++) vt.push(n);
3628
3629
  return { finalScriptWitness: L.witnessStackToScriptWitness([
3629
3630
  new Uint8Array(0),
3630
3631
  ...vt,
@@ -3645,7 +3646,7 @@ var Ue = new Uint8Array([
3645
3646
  finalScriptWitness: void 0
3646
3647
  };
3647
3648
  const w = d.witnessUtxo?.script;
3648
- return w ? d.tapInternalKey ? { finalScriptWitness: L.witnessStackToScriptWitness([s]) } : w.length === 22 && w[0] === p.OP_0 ? { finalScriptWitness: L.witnessStackToScriptWitness([n, o]) } : d.redeemScript?.length === 22 && d.redeemScript[0] === p.OP_0 ? { finalScriptWitness: L.witnessStackToScriptWitness([n, o]) } : Ce(h, d, w, !0, !!d.redeemScript, !!d.witnessScript) : {
3649
+ return w ? d.tapInternalKey ? { finalScriptWitness: L.witnessStackToScriptWitness([s]) } : w.length === 22 && w[0] === p.OP_0 ? { finalScriptWitness: L.witnessStackToScriptWitness([n, o]) } : d.redeemScript?.length === 22 && d.redeemScript[0] === p.OP_0 ? { finalScriptWitness: L.witnessStackToScriptWitness([n, o]) } : De(h, d, w, !0, !!d.redeemScript, !!d.witnessScript) : {
3649
3650
  finalScriptSig: void 0,
3650
3651
  finalScriptWitness: void 0
3651
3652
  };
@@ -3742,7 +3743,7 @@ var Ue = new Uint8Array([
3742
3743
  t.revealMLDSAPublicKey && (n = this.generateMLDSASignature());
3743
3744
  const o = {
3744
3745
  priority: J.MLDSA_LINK_PUBKEY,
3745
- opcode: q.MLDSA_LINK_PUBKEY,
3746
+ opcode: G.MLDSA_LINK_PUBKEY,
3746
3747
  data: {
3747
3748
  verifyRequest: !!t.revealMLDSAPublicKey,
3748
3749
  publicKey: r.publicKey,
@@ -3974,7 +3975,7 @@ var Ue = new Uint8Array([
3974
3975
  return t;
3975
3976
  }
3976
3977
  getContractSeed() {
3977
- return D.hash256(this.randomBytes);
3978
+ return C.hash256(this.randomBytes);
3978
3979
  }
3979
3980
  customFinalizer = (e, t) => {
3980
3981
  if (!this.tapLeafScript) throw new Error("Tap leaf script is required");
@@ -4164,7 +4165,7 @@ var Ue = new Uint8Array([
4164
4165
  redeemVersion: 192
4165
4166
  };
4166
4167
  }
4167
- }, Ct = class ei extends B {
4168
+ }, Dt = class ei extends B {
4168
4169
  static MAXIMUM_CONTRACT_SIZE = 1536 * 1024;
4169
4170
  type = T.DEPLOYMENT;
4170
4171
  challenge;
@@ -4298,7 +4299,7 @@ var Ue = new Uint8Array([
4298
4299
  const i = [], r = t.challenge.getSubmission();
4299
4300
  if (r && i.push({
4300
4301
  priority: J.MLDSA_LINK_PUBKEY,
4301
- opcode: q.EPOCH_SUBMISSION,
4302
+ opcode: G.EPOCH_SUBMISSION,
4302
4303
  data: r
4303
4304
  }), t.revealMLDSAPublicKey && !t.linkMLDSAPublicKeyToAddress) throw new Error("To reveal the MLDSA public key, you must set linkMLDSAPublicKeyToAddress to true.");
4304
4305
  return t.linkMLDSAPublicKeyToAddress && this.generateMLDSALinkRequest(t, i), i;
@@ -4314,10 +4315,10 @@ var Ue = new Uint8Array([
4314
4315
  if (!this.bytecode) throw new Error("Bytecode is required");
4315
4316
  const t = lt([
4316
4317
  this.internalPubKeyToXOnly(),
4317
- D.hash256(this.randomBytes),
4318
- D.hash256(this.bytecode)
4318
+ C.hash256(this.randomBytes),
4319
+ C.hash256(this.bytecode)
4319
4320
  ]);
4320
- return D.hash256(t);
4321
+ return C.hash256(t);
4321
4322
  }
4322
4323
  customFinalizer = (t, i) => {
4323
4324
  if (!this.tapLeafScript) throw new Error("Tap leaf script is required");
@@ -4353,7 +4354,7 @@ var Ue = new Uint8Array([
4353
4354
  version: 192
4354
4355
  }];
4355
4356
  }
4356
- }, Dt = class extends B {
4357
+ }, Ct = class extends B {
4357
4358
  type = T.FUNDING;
4358
4359
  amount;
4359
4360
  splitInputsInto;
@@ -4433,13 +4434,13 @@ var Ue = new Uint8Array([
4433
4434
  const t = [];
4434
4435
  e.loadedStorage && t.push({
4435
4436
  priority: J.ACCESS_LIST,
4436
- opcode: q.ACCESS_LIST,
4437
+ opcode: G.ACCESS_LIST,
4437
4438
  data: e.loadedStorage
4438
4439
  });
4439
4440
  const i = e.challenge.getSubmission();
4440
4441
  if (i && t.push({
4441
4442
  priority: J.EPOCH_SUBMISSION,
4442
- opcode: q.EPOCH_SUBMISSION,
4443
+ opcode: G.EPOCH_SUBMISSION,
4443
4444
  data: i
4444
4445
  }), e.revealMLDSAPublicKey && !e.linkMLDSAPublicKeyToAddress) throw new Error("To reveal the MLDSA public key, you must set linkMLDSAPublicKeyToAddress to true.");
4445
4446
  return e.linkMLDSAPublicKeyToAddress && this.generateMLDSALinkRequest(e, t), t;
@@ -4498,13 +4499,13 @@ var Ue = new Uint8Array([
4498
4499
  const i = [];
4499
4500
  t.loadedStorage && i.push({
4500
4501
  priority: J.ACCESS_LIST,
4501
- opcode: q.ACCESS_LIST,
4502
+ opcode: G.ACCESS_LIST,
4502
4503
  data: t.loadedStorage
4503
4504
  });
4504
4505
  const r = t.challenge.getSubmission();
4505
4506
  return r && i.push({
4506
4507
  priority: J.EPOCH_SUBMISSION,
4507
- opcode: q.EPOCH_SUBMISSION,
4508
+ opcode: G.EPOCH_SUBMISSION,
4508
4509
  data: r
4509
4510
  }), i;
4510
4511
  }
@@ -4515,11 +4516,11 @@ var Ue = new Uint8Array([
4515
4516
  return O(this.scriptSigner.publicKey);
4516
4517
  }
4517
4518
  validateP2WDAInputs() {
4518
- if (this.utxos.length === 0 || !X.isP2WDAUTXO(this.utxos[0])) throw new Error("Input 0 must be a P2WDA UTXO");
4519
- for (let t = 0; t < this.utxos.length; t++) X.isP2WDAUTXO(this.utxos[t]) && this.p2wdaInputIndices.add(t);
4519
+ if (this.utxos.length === 0 || !$.isP2WDAUTXO(this.utxos[0])) throw new Error("Input 0 must be a P2WDA UTXO");
4520
+ for (let t = 0; t < this.utxos.length; t++) $.isP2WDAUTXO(this.utxos[t]) && this.p2wdaInputIndices.add(t);
4520
4521
  for (let t = 0; t < this.optionalInputs.length; t++) {
4521
4522
  const i = this.utxos.length + t;
4522
- X.isP2WDAUTXO(this.optionalInputs[t]) && this.p2wdaInputIndices.add(i);
4523
+ $.isP2WDAUTXO(this.optionalInputs[t]) && this.p2wdaInputIndices.add(i);
4523
4524
  }
4524
4525
  }
4525
4526
  validateOperationDataSize() {
@@ -4815,13 +4816,13 @@ var Ue = new Uint8Array([
4815
4816
  const t = [];
4816
4817
  e.loadedStorage && t.push({
4817
4818
  priority: J.ACCESS_LIST,
4818
- opcode: q.ACCESS_LIST,
4819
+ opcode: G.ACCESS_LIST,
4819
4820
  data: e.loadedStorage
4820
4821
  });
4821
4822
  const i = e.challenge.getSubmission();
4822
4823
  if (i && t.push({
4823
4824
  priority: J.EPOCH_SUBMISSION,
4824
- opcode: q.EPOCH_SUBMISSION,
4825
+ opcode: G.EPOCH_SUBMISSION,
4825
4826
  data: i
4826
4827
  }), e.revealMLDSAPublicKey && !e.linkMLDSAPublicKeyToAddress) throw new Error("To reveal the MLDSA public key, you must set linkMLDSAPublicKeyToAddress to true.");
4827
4828
  return e.linkMLDSAPublicKeyToAddress && this.generateMLDSALinkRequest(e, t), t;
@@ -4913,8 +4914,8 @@ var Ue = new Uint8Array([
4913
4914
  }, Kt, async (d) => {
4914
4915
  const w = await d.estimateTransactionFees() + d.getTotalOutputValue();
4915
4916
  if (e.subtractExtraUTXOFromAmountRequired && e.optionalInputs && e.optionalInputs.length > 0) {
4916
- const m = e.optionalInputs.reduce((A, N) => A + N.value, 0n);
4917
- return w > m ? w - m : 0n;
4917
+ const m = e.optionalInputs.reduce((M, q) => M + q.value, 0n), A = w > m ? w - m : 0n;
4918
+ return A < B.MINIMUM_DUST ? B.MINIMUM_DUST : A;
4918
4919
  }
4919
4920
  return w;
4920
4921
  }, "Interaction");
@@ -4986,9 +4987,9 @@ var Ue = new Uint8Array([
4986
4987
  const i = this.parseOptionalInputs(e.optionalInputs), { finalTransaction: r, estimatedAmount: s, challenge: n } = await this.iterateFundingAmount({
4987
4988
  ...e,
4988
4989
  optionalInputs: i
4989
- }, Ct, async (A) => {
4990
- const N = await A.estimateTransactionFees(), $ = this.getPriorityFee(e), vt = A.getOptionalOutputValue();
4991
- return N + $ + vt;
4990
+ }, Dt, async (A) => {
4991
+ const M = await A.estimateTransactionFees(), q = this.getPriorityFee(e), vt = A.getOptionalOutputValue();
4992
+ return M + q + vt;
4992
4993
  }, "Deployment");
4993
4994
  if (!n) throw new Error("Failed to get challenge from deployment transaction");
4994
4995
  const o = await r.getFundingTransactionParameters();
@@ -5000,7 +5001,7 @@ var Ue = new Uint8Array([
5000
5001
  });
5001
5002
  if (!a) throw new Error("Could not sign funding transaction.");
5002
5003
  o.estimatedFees = a.estimatedFees;
5003
- const c = await new Dt({
5004
+ const c = await new Ct({
5004
5005
  ...o,
5005
5006
  optionalInputs: [],
5006
5007
  optionalOutputs: []
@@ -5014,7 +5015,7 @@ var Ue = new Uint8Array([
5014
5015
  address: r.getScriptAddress()
5015
5016
  },
5016
5017
  value: BigInt(u.value)
5017
- }, h = new Ct({
5018
+ }, h = new Dt({
5018
5019
  ...e,
5019
5020
  utxos: [l],
5020
5021
  randomBytes: r.getRndBytes(),
@@ -5133,7 +5134,7 @@ var Ue = new Uint8Array([
5133
5134
  }
5134
5135
  async createFundTransaction(e) {
5135
5136
  if (!e.to) throw new Error('Field "to" not provided.');
5136
- const t = new Dt(e), i = await t.signTransaction();
5137
+ const t = new Ct(e), i = await t.signTransaction();
5137
5138
  if (!i) throw new Error("Could not sign funding transaction.");
5138
5139
  return {
5139
5140
  tx: i,
@@ -5144,7 +5145,7 @@ var Ue = new Uint8Array([
5144
5145
  };
5145
5146
  }
5146
5147
  hasP2WDAInputs(e) {
5147
- return e.some((t) => X.isP2WDAUTXO(t));
5148
+ return e.some((t) => $.isP2WDAUTXO(t));
5148
5149
  }
5149
5150
  async signP2WDAInteraction(e) {
5150
5151
  if (!e.from) throw new Error('Field "from" not provided.');
@@ -5202,15 +5203,16 @@ var Ue = new Uint8Array([
5202
5203
  await m.generateTransactionMinimalSignatures(), o = await i(m);
5203
5204
  } catch (A) {
5204
5205
  if (A instanceof Error) {
5205
- const N = A.message.match(/need (\d+) sats but only have (\d+) sats/);
5206
- if (N)
5207
- o = BigInt(N[1]), this.debug && console.log(`${r}: Caught insufficient funds, updating to ${o}`);
5206
+ const M = A.message.match(/need (\d+) sats but only have (\d+) sats/);
5207
+ if (M)
5208
+ o = BigInt(M[1]), this.debug && console.log(`${r}: Caught insufficient funds, updating to ${o}`);
5208
5209
  else throw A;
5209
5210
  } else throw new Error("Unknown error during fee estimation", { cause: A });
5210
5211
  }
5211
5212
  u = m, "getChallenge" in m && typeof m.getChallenge == "function" && (l = m.getChallenge()), c++, this.debug && console.log(`${r} Iteration ${c}: Previous=${a}, New=${o}`);
5212
5213
  }
5213
5214
  if (!u) throw new Error(`Failed to converge on ${r} funding amount`);
5215
+ if (o === 0n) throw new Error("Impossible. Transaction cant be free.");
5214
5216
  return {
5215
5217
  finalTransaction: u,
5216
5218
  estimatedAmount: o,
@@ -5230,7 +5232,7 @@ var Ue = new Uint8Array([
5230
5232
  value: BigInt(r.value)
5231
5233
  }];
5232
5234
  }
5233
- }, Q = class M extends B {
5235
+ }, Q = class N extends B {
5234
5236
  static LOCK_LEAF_SCRIPT = b.compile([
5235
5237
  p.OP_XOR,
5236
5238
  p.OP_NOP,
@@ -5249,14 +5251,14 @@ var Ue = new Uint8Array([
5249
5251
  requestedAmount;
5250
5252
  receiver;
5251
5253
  refundVault;
5252
- sighashTypes = M.signHashTypesArray;
5254
+ sighashTypes = N.signHashTypesArray;
5253
5255
  constructor(t) {
5254
5256
  if (!t.refundVault) throw new Error("Refund vault is required");
5255
5257
  if (!t.requestedAmount) throw new Error("Requested amount is required");
5256
5258
  if (!t.receiver) throw new Error("Receiver is required");
5257
5259
  if (super({
5258
5260
  ...t,
5259
- signer: I.fromPrivateKey(D.sha256(new TextEncoder().encode("aaaaaaaa"))),
5261
+ signer: I.fromPrivateKey(C.sha256(new TextEncoder().encode("aaaaaaaa"))),
5260
5262
  priorityFee: 0n,
5261
5263
  gasSatFee: 0n
5262
5264
  }), !t.pubkeys) throw new Error("Pubkeys are required");
@@ -5264,7 +5266,7 @@ var Ue = new Uint8Array([
5264
5266
  }
5265
5267
  static fromBase64(t) {
5266
5268
  const i = H.fromBase64(t.psbt, { network: t.network });
5267
- return new M({
5269
+ return new N({
5268
5270
  ...t,
5269
5271
  psbt: i
5270
5272
  });
@@ -5290,7 +5292,7 @@ var Ue = new Uint8Array([
5290
5292
  let n = !1, o = !0;
5291
5293
  for (let a = r; a < t.data.inputs.length; a++) {
5292
5294
  const c = t.data.inputs[a];
5293
- c.tapInternalKey || (c.tapInternalKey = O(M.numsPoint));
5295
+ c.tapInternalKey || (c.tapInternalKey = O(N.numsPoint));
5294
5296
  const u = [];
5295
5297
  if (c.finalScriptWitness) {
5296
5298
  const h = B.readScriptWitnessToWitnessStack(c.finalScriptWitness);
@@ -5307,9 +5309,9 @@ var Ue = new Uint8Array([
5307
5309
  c.tapScriptSig = (c.tapScriptSig || []).concat(u);
5308
5310
  }
5309
5311
  Reflect.deleteProperty(c, "finalScriptWitness");
5310
- const l = M.signHashTypesArray ? [M.calculateSignHash(M.signHashTypesArray)] : [];
5312
+ const l = N.signHashTypesArray ? [N.calculateSignHash(N.signHashTypesArray)] : [];
5311
5313
  try {
5312
- M.signInput(t, c, a, i, l), n = !0;
5314
+ N.signInput(t, c, a, i, l), n = !0;
5313
5315
  } catch (h) {
5314
5316
  console.log(h);
5315
5317
  }
@@ -5354,7 +5356,7 @@ var Ue = new Uint8Array([
5354
5356
  let n = 0;
5355
5357
  for (let o = i; o < t.data.inputs.length; o++) try {
5356
5358
  const a = t.data.inputs[o];
5357
- a.tapInternalKey || (a.tapInternalKey = O(M.numsPoint));
5359
+ a.tapInternalKey || (a.tapInternalKey = O(N.numsPoint));
5358
5360
  const c = [];
5359
5361
  if (a.finalScriptWitness) {
5360
5362
  const u = B.readScriptWitnessToWitnessStack(a.finalScriptWitness);
@@ -5367,9 +5369,9 @@ var Ue = new Uint8Array([
5367
5369
  leafVersion: 192,
5368
5370
  script: u[u.length - 2],
5369
5371
  controlBlock: u[u.length - 1]
5370
- }], a.tapScriptSig = M.dedupeSignatures(a.tapScriptSig || [], c);
5372
+ }], a.tapScriptSig = N.dedupeSignatures(a.tapScriptSig || [], c);
5371
5373
  }
5372
- Reflect.deleteProperty(a, "finalScriptWitness"), t.finalizeInput(o, (u, l) => M.partialFinalizer(u, l, [], r[o - i], s)), n++;
5374
+ Reflect.deleteProperty(a, "finalScriptWitness"), t.finalizeInput(o, (u, l) => N.partialFinalizer(u, l, [], r[o - i], s)), n++;
5373
5375
  } catch {
5374
5376
  }
5375
5377
  return n === t.data.inputs.length - i;
@@ -5429,7 +5431,7 @@ var Ue = new Uint8Array([
5429
5431
  scriptTree: this.scriptTree,
5430
5432
  name: E.P2MR
5431
5433
  } : {
5432
- internalPubkey: O(M.numsPoint),
5434
+ internalPubkey: O(N.numsPoint),
5433
5435
  network: this.network,
5434
5436
  scriptTree: this.scriptTree,
5435
5437
  name: E.P2TR
@@ -5445,7 +5447,7 @@ var Ue = new Uint8Array([
5445
5447
  redeem: t,
5446
5448
  name: E.P2MR
5447
5449
  } : {
5448
- internalPubkey: O(M.numsPoint),
5450
+ internalPubkey: O(N.numsPoint),
5449
5451
  network: this.network,
5450
5452
  scriptTree: this.scriptTree,
5451
5453
  redeem: t,
@@ -5460,7 +5462,7 @@ var Ue = new Uint8Array([
5460
5462
  output: this.compiledTargetScript,
5461
5463
  version: 192
5462
5464
  }, {
5463
- output: M.LOCK_LEAF_SCRIPT,
5465
+ output: N.LOCK_LEAF_SCRIPT,
5464
5466
  version: 192
5465
5467
  }];
5466
5468
  }
@@ -5484,7 +5486,7 @@ var Ue = new Uint8Array([
5484
5486
  redeemVersion: 192
5485
5487
  }, this.leftOverFundsScriptRedeem = {
5486
5488
  name: E.P2TR,
5487
- output: M.LOCK_LEAF_SCRIPT,
5489
+ output: N.LOCK_LEAF_SCRIPT,
5488
5490
  redeemVersion: 192
5489
5491
  };
5490
5492
  }
@@ -5507,7 +5509,7 @@ function ci(e) {
5507
5509
  function ui(e) {
5508
5510
  return e.type === T.CANCEL;
5509
5511
  }
5510
- function G(e) {
5512
+ function X(e) {
5511
5513
  return e.startsWith("0x") ? e.slice(2) : e;
5512
5514
  }
5513
5515
  var U = class {
@@ -5792,11 +5794,11 @@ var U = class {
5792
5794
  };
5793
5795
  }
5794
5796
  static writeChallenge(e, t) {
5795
- e.writeU64(BigInt(t.epochNumber)), e.writeStringWithLength(t.mldsaPublicKey), e.writeStringWithLength(t.legacyPublicKey), e.writeBytesWithLength(S(G(t.solution))), e.writeBytesWithLength(S(G(t.salt))), e.writeBytesWithLength(S(G(t.graffiti))), e.writeU8(t.difficulty), this.writeChallengeVerification(e, t.verification), e.writeBoolean(t.submission !== void 0), t.submission !== void 0 && (e.writeStringWithLength(t.submission.mldsaPublicKey), e.writeStringWithLength(t.submission.legacyPublicKey), e.writeBytesWithLength(S(G(t.submission.solution))), e.writeBoolean(t.submission.graffiti !== void 0), t.submission.graffiti !== void 0 && e.writeBytesWithLength(S(G(t.submission.graffiti))), e.writeBytesWithLength(S(G(t.submission.signature))));
5797
+ e.writeU64(BigInt(t.epochNumber)), e.writeStringWithLength(t.mldsaPublicKey), e.writeStringWithLength(t.legacyPublicKey), e.writeBytesWithLength(S(X(t.solution))), e.writeBytesWithLength(S(X(t.salt))), e.writeBytesWithLength(S(X(t.graffiti))), e.writeU8(t.difficulty), this.writeChallengeVerification(e, t.verification), e.writeBoolean(t.submission !== void 0), t.submission !== void 0 && (e.writeStringWithLength(t.submission.mldsaPublicKey), e.writeStringWithLength(t.submission.legacyPublicKey), e.writeBytesWithLength(S(X(t.submission.solution))), e.writeBoolean(t.submission.graffiti !== void 0), t.submission.graffiti !== void 0 && e.writeBytesWithLength(S(X(t.submission.graffiti))), e.writeBytesWithLength(S(X(t.submission.signature))));
5796
5798
  }
5797
5799
  static writeChallengeVerification(e, t) {
5798
- e.writeBytesWithLength(S(G(t.epochHash))), e.writeBytesWithLength(S(G(t.epochRoot))), e.writeBytesWithLength(S(G(t.targetHash))), e.writeBytesWithLength(S(G(t.targetChecksum))), e.writeU64(BigInt(t.startBlock)), e.writeU64(BigInt(t.endBlock)), e.writeU16(t.proofs.length);
5799
- for (const i of t.proofs) e.writeBytesWithLength(S(G(i)));
5800
+ e.writeBytesWithLength(S(X(t.epochHash))), e.writeBytesWithLength(S(X(t.epochRoot))), e.writeBytesWithLength(S(X(t.targetHash))), e.writeBytesWithLength(S(X(t.targetChecksum))), e.writeU64(BigInt(t.startBlock)), e.writeU64(BigInt(t.endBlock)), e.writeU16(t.proofs.length);
5801
+ for (const i of t.proofs) e.writeBytesWithLength(S(X(i)));
5800
5802
  }
5801
5803
  static readChallenge(e) {
5802
5804
  const t = e.readU64().toString(), i = e.readStringWithLength(), r = e.readStringWithLength(), s = "0x" + f(e.readBytesWithLength()), n = "0x" + f(e.readBytesWithLength()), o = "0x" + f(e.readBytesWithLength()), a = e.readU8(), c = this.readChallengeVerification(e), u = e.readBoolean();
@@ -6151,7 +6153,7 @@ function x(e) {
6151
6153
  var St = class {
6152
6154
  static BLOCKS_PER_EPOCH = 5n;
6153
6155
  static sha1(e) {
6154
- return D.sha1(e);
6156
+ return C.sha1(e);
6155
6157
  }
6156
6158
  static calculatePreimage(e, t, i) {
6157
6159
  if (e.length !== 32 || t.length !== 32 || i.length !== 32) throw new Error("All inputs must be 32 bytes");
@@ -6336,7 +6338,7 @@ var St = class {
6336
6338
  throw new Error(`Unsupported transaction type: ${e.header.transactionType}`);
6337
6339
  }
6338
6340
  static reconstructFunding(e, t) {
6339
- return new Dt({
6341
+ return new Ct({
6340
6342
  ...e,
6341
6343
  amount: BigInt(t.amount),
6342
6344
  splitInputsInto: t.splitInputsInto
@@ -6344,7 +6346,7 @@ var St = class {
6344
6346
  }
6345
6347
  static reconstructDeployment(e, t, i) {
6346
6348
  const r = new ne(t.challenge);
6347
- return new Ct({
6349
+ return new Dt({
6348
6350
  ...e,
6349
6351
  bytecode: S(t.bytecode),
6350
6352
  challenge: r,
@@ -6691,15 +6693,15 @@ var St = class {
6691
6693
  if (m <= 0n) continue;
6692
6694
  const A = Number(w.raw);
6693
6695
  if (!Number.isInteger(A) || A < 0 || A >= n.length) throw new Error(`Invalid raw index for UTXO ${w.transactionId}:${w.outputIndex}`);
6694
- const N = n[A];
6695
- if (!N) throw new Error(`Invalid raw index ${A} - not found in raw transactions array`);
6696
- let $ = d.get(A);
6697
- if ($ === void 0 && ($ = xi(N), d.set(A, $)), l += m, u.push({
6696
+ const M = n[A];
6697
+ if (!M) throw new Error(`Invalid raw index ${A} - not found in raw transactions array`);
6698
+ let q = d.get(A);
6699
+ if (q === void 0 && (q = xi(M), d.set(A, q)), l += m, u.push({
6698
6700
  transactionId: w.transactionId,
6699
6701
  outputIndex: w.outputIndex,
6700
6702
  value: m,
6701
6703
  scriptPubKey: w.scriptPubKey,
6702
- nonWitnessUtxo: $
6704
+ nonWitnessUtxo: q
6703
6705
  }), l > h) break;
6704
6706
  }
6705
6707
  return d.clear(), u;
@@ -6898,7 +6900,7 @@ function kt(e) {
6898
6900
  const t = e[0];
6899
6901
  return e.length === 1 && t !== void 0 ? `${kt(t)}[]` : `tuple(${e.map((i) => kt(i)).join(",")})[]`;
6900
6902
  }
6901
- var Cr = class {
6903
+ var Dr = class {
6902
6904
  decodeData(e, t) {
6903
6905
  const i = new Ft(e), r = [];
6904
6906
  for (const s of t) r.push(this.decodeSingleValue(i, s));
@@ -7008,7 +7010,7 @@ var Cr = class {
7008
7010
  sha256(e) {
7009
7011
  return new Uint8Array(new Lr.default.sha256().update(e).digest());
7010
7012
  }
7011
- }, Dr = class wi {
7013
+ }, Cr = class wi {
7012
7014
  items;
7013
7015
  keys;
7014
7016
  constructor(t = []) {
@@ -7050,7 +7052,7 @@ var Cr = class {
7050
7052
  map;
7051
7053
  #t;
7052
7054
  constructor(t) {
7053
- this.compareFn = t, this.map = new Mt(), this.#t = [];
7055
+ this.compareFn = t, this.map = new Nt(), this.#t = [];
7054
7056
  }
7055
7057
  get size() {
7056
7058
  return this.map.size;
@@ -7169,11 +7171,11 @@ var Cr = class {
7169
7171
  index: i
7170
7172
  };
7171
7173
  }
7172
- }, Nr = class {
7174
+ }, Mr = class {
7173
7175
  constructor(e, t) {
7174
7176
  this.type = e, this.data = t;
7175
7177
  }
7176
- }, Mr = /* @__PURE__ */ (function(e) {
7178
+ }, Nr = /* @__PURE__ */ (function(e) {
7177
7179
  return e.mainnet = "mainnet", e.testnet = "testnet", e.signet = "Signet", e;
7178
7180
  })({}), Fr = /* @__PURE__ */ (function(e) {
7179
7181
  return e.ECDSA = "ECDSA", e.BIP322 = "BIP322", e;
@@ -7493,15 +7495,15 @@ var Wr = class extends we {
7493
7495
  for (let r = 0; r < t.length; r++) t[r] !== void 0 && !this.deleted[r] && this.set(t[r], i[r]);
7494
7496
  }
7495
7497
  }, fs = /* @__PURE__ */ Ti({
7496
- ABICoder: () => Cr,
7498
+ ABICoder: () => Dr,
7497
7499
  ABIDataTypes: () => g,
7498
7500
  ADDRESS_BYTE_LENGTH: () => 32,
7499
7501
  ANCHOR_SCRIPT: () => se,
7500
7502
  AbiTypeToStr: () => fi,
7501
7503
  Address: () => z,
7502
7504
  AddressGenerator: () => de,
7503
- AddressMap: () => Me,
7504
- AddressSet: () => Dr,
7505
+ AddressMap: () => Ne,
7506
+ AddressSet: () => Cr,
7505
7507
  AddressTypes: () => K,
7506
7508
  AddressVerificator: () => bt,
7507
7509
  BIPStandard: () => st,
@@ -7527,17 +7529,17 @@ var Wr = class extends we {
7527
7529
  CustomMap: () => Hr,
7528
7530
  CustomScriptTransaction: () => Rt,
7529
7531
  DeploymentGenerator: () => he,
7530
- DeploymentTransaction: () => Ct,
7532
+ DeploymentTransaction: () => Dt,
7531
7533
  DeterministicMap: () => Kr,
7532
7534
  DeterministicSet: () => xr,
7533
7535
  EXTENDED_ADDRESS_BYTE_LENGTH: () => 64,
7534
7536
  EcKeyPair: () => I,
7535
7537
  EpochValidator: () => St,
7536
7538
  ExtendedAddressMap: () => Fe,
7537
- FastMap: () => Mt,
7539
+ FastMap: () => Nt,
7538
7540
  FeaturePriority: () => J,
7539
- Features: () => q,
7540
- FundingTransaction: () => Dt,
7541
+ Features: () => G,
7542
+ FundingTransaction: () => Ct,
7541
7543
  Generator: () => tt,
7542
7544
  HashCommitmentGenerator: () => gt,
7543
7545
  I128_BYTE_LENGTH: () => 16,
@@ -7559,14 +7561,14 @@ var Wr = class extends we {
7559
7561
  MnemonicStrength: () => Jt,
7560
7562
  MultiSignGenerator: () => qe,
7561
7563
  MultiSignTransaction: () => Q,
7562
- NetEvent: () => Nr,
7564
+ NetEvent: () => Mr,
7563
7565
  OPNET_DEPLOYMENT_VERSION: () => 0,
7564
7566
  OPNetConsensusConfig: () => hi,
7565
7567
  OPNetLimitedProvider: () => _r,
7566
7568
  OfflineTransactionManager: () => Or,
7567
7569
  P2MR_MS: () => kr,
7568
7570
  P2TR_MS: () => Br,
7569
- P2WDADetector: () => X,
7571
+ P2WDADetector: () => $,
7570
7572
  P2WDAGenerator: () => Qt,
7571
7573
  PSBTTypes: () => Ur,
7572
7574
  QuantumBIP32Factory: () => P.QuantumBIP32Factory,
@@ -7602,7 +7604,7 @@ var Wr = class extends we {
7602
7604
  UnisatSigner: () => mr,
7603
7605
  Wallet: () => Ut,
7604
7606
  WalletNetworks: () => mt,
7605
- XverseNetwork: () => Mr,
7607
+ XverseNetwork: () => Nr,
7606
7608
  XverseSigner: () => Wr,
7607
7609
  abiTypeToSelectorString: () => kt,
7608
7610
  buildBIPPath: () => $e,
@@ -7630,15 +7632,15 @@ var Wr = class extends we {
7630
7632
  versionBuffer: () => ze
7631
7633
  }), gs = P.MLDSASecurityLevel, Ss = P.QuantumBIP32Factory, ws = P.QuantumDerivationPath;
7632
7634
  export {
7633
- Cr as ABICoder,
7635
+ Dr as ABICoder,
7634
7636
  g as ABIDataTypes,
7635
7637
  Xr as ADDRESS_BYTE_LENGTH,
7636
7638
  se as ANCHOR_SCRIPT,
7637
7639
  fi as AbiTypeToStr,
7638
7640
  z as Address,
7639
7641
  de as AddressGenerator,
7640
- Me as AddressMap,
7641
- Dr as AddressSet,
7642
+ Ne as AddressMap,
7643
+ Cr as AddressSet,
7642
7644
  K as AddressTypes,
7643
7645
  bt as AddressVerificator,
7644
7646
  st as BIPStandard,
@@ -7664,17 +7666,17 @@ export {
7664
7666
  Hr as CustomMap,
7665
7667
  Rt as CustomScriptTransaction,
7666
7668
  he as DeploymentGenerator,
7667
- Ct as DeploymentTransaction,
7669
+ Dt as DeploymentTransaction,
7668
7670
  Kr as DeterministicMap,
7669
7671
  xr as DeterministicSet,
7670
7672
  $r as EXTENDED_ADDRESS_BYTE_LENGTH,
7671
7673
  I as EcKeyPair,
7672
7674
  St as EpochValidator,
7673
7675
  Fe as ExtendedAddressMap,
7674
- Mt as FastMap,
7676
+ Nt as FastMap,
7675
7677
  J as FeaturePriority,
7676
- q as Features,
7677
- Dt as FundingTransaction,
7678
+ G as Features,
7679
+ Ct as FundingTransaction,
7678
7680
  tt as Generator,
7679
7681
  gt as HashCommitmentGenerator,
7680
7682
  ss as I128_BYTE_LENGTH,
@@ -7696,14 +7698,14 @@ export {
7696
7698
  Jt as MnemonicStrength,
7697
7699
  qe as MultiSignGenerator,
7698
7700
  Q as MultiSignTransaction,
7699
- Nr as NetEvent,
7701
+ Mr as NetEvent,
7700
7702
  hs as OPNET_DEPLOYMENT_VERSION,
7701
7703
  hi as OPNetConsensusConfig,
7702
7704
  _r as OPNetLimitedProvider,
7703
7705
  Or as OfflineTransactionManager,
7704
7706
  kr as P2MR_MS,
7705
7707
  Br as P2TR_MS,
7706
- X as P2WDADetector,
7708
+ $ as P2WDADetector,
7707
7709
  Qt as P2WDAGenerator,
7708
7710
  Ur as PSBTTypes,
7709
7711
  Ss as QuantumBIP32Factory,
@@ -7739,7 +7741,7 @@ export {
7739
7741
  mr as UnisatSigner,
7740
7742
  Ut as Wallet,
7741
7743
  mt as WalletNetworks,
7742
- Mr as XverseNetwork,
7744
+ Nr as XverseNetwork,
7743
7745
  Wr as XverseSigner,
7744
7746
  kt as abiTypeToSelectorString,
7745
7747
  $e as buildBIPPath,