@btc-vision/transaction 1.8.3 → 1.8.5

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.3";
8
+ var ji = "1.8.5";
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}`);
@@ -1603,7 +1603,7 @@ var cr = [
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
1605
  const r = new V();
1606
- r.writeBytes(t.data.publicKey.toBuffer()), r.writeBytes(t.data.solution), t.data.graffiti && r.writeBytes(t.data.graffiti), i.writeBytesWithLength(r.getBuffer());
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
1607
  }
1608
1608
  encodeLinkRequest(t, i) {
1609
1609
  const r = t.data, s = new V();
@@ -1651,13 +1651,13 @@ var cr = [
1651
1651
  this.xSenderPubKey,
1652
1652
  p.OP_DUP,
1653
1653
  p.OP_HASH256,
1654
- D.hash256(this.xSenderPubKey),
1654
+ C.hash256(this.xSenderPubKey),
1655
1655
  p.OP_EQUALVERIFY,
1656
1656
  p.OP_CHECKSIGVERIFY,
1657
1657
  this.contractSaltPubKey,
1658
1658
  p.OP_CHECKSIGVERIFY,
1659
1659
  p.OP_HASH160,
1660
- D.hash160(t),
1660
+ C.hash160(t),
1661
1661
  p.OP_EQUALVERIFY,
1662
1662
  p.OP_DEPTH,
1663
1663
  p.OP_1,
@@ -1709,13 +1709,13 @@ var cr = [
1709
1709
  this.xSenderPubKey,
1710
1710
  p.OP_DUP,
1711
1711
  p.OP_HASH256,
1712
- D.hash256(this.xSenderPubKey),
1712
+ C.hash256(this.xSenderPubKey),
1713
1713
  p.OP_EQUALVERIFY,
1714
1714
  p.OP_CHECKSIGVERIFY,
1715
1715
  this.contractSaltPubKey,
1716
1716
  p.OP_CHECKSIGVERIFY,
1717
1717
  p.OP_HASH256,
1718
- D.hash256(t),
1718
+ C.hash256(t),
1719
1719
  p.OP_EQUALVERIFY,
1720
1720
  p.OP_DEPTH,
1721
1721
  p.OP_1,
@@ -1807,7 +1807,7 @@ var cr = [
1807
1807
  const r = v.extractDataHashes(i);
1808
1808
  if (!r || r.length !== t.length) return !1;
1809
1809
  for (let s = 0; s < t.length; s++) {
1810
- const n = D.hash160(t[s]);
1810
+ const n = C.hash160(t[s]);
1811
1811
  if (!R(r[s], n)) return !1;
1812
1812
  }
1813
1813
  return !0;
@@ -1828,7 +1828,7 @@ var cr = [
1828
1828
  };
1829
1829
  }
1830
1830
  hashChunk(t) {
1831
- return D.hash160(t);
1831
+ return C.hash160(t);
1832
1832
  }
1833
1833
  generateWitnessScript(t) {
1834
1834
  if (t.length === 0) throw new Error("At least one data hash is required");
@@ -1910,7 +1910,7 @@ var cr = [
1910
1910
  this.senderPubKey,
1911
1911
  p.OP_DUP,
1912
1912
  p.OP_HASH256,
1913
- D.hash256(this.senderPubKey),
1913
+ C.hash256(this.senderPubKey),
1914
1914
  p.OP_EQUALVERIFY,
1915
1915
  p.OP_CHECKSIGVERIFY,
1916
1916
  t,
@@ -2013,9 +2013,9 @@ var cr = [
2013
2013
  const s = lt([
2014
2014
  t,
2015
2015
  r,
2016
- D.hash256(i)
2016
+ C.hash256(i)
2017
2017
  ]);
2018
- return D.hash256(s);
2018
+ return C.hash256(s);
2019
2019
  }
2020
2020
  static generateAddressFromScript(t, i) {
2021
2021
  const r = t.network || y.bitcoin, s = {
@@ -2047,8 +2047,8 @@ var pe = class {
2047
2047
  static tweakSigner(e, t = {}) {
2048
2048
  let i = e.privateKey;
2049
2049
  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));
2050
+ e.publicKey[0] === 3 && (i = D.privateNegate(i));
2051
+ const r = D.privateAdd(i, ki(O(e.publicKey), t.tweakHash));
2052
2052
  if (!r) throw new Error("Invalid tweaked private key!");
2053
2053
  return I.fromPrivateKey(r, t.network);
2054
2054
  }
@@ -2066,7 +2066,7 @@ var mt = /* @__PURE__ */ (function(e) {
2066
2066
  return e.ecdsa = "ecdsa", e.schnorr = "schnorr", e;
2067
2067
  })({}), pr = class {
2068
2068
  sha256(e) {
2069
- return D.sha256(e);
2069
+ return C.sha256(e);
2070
2070
  }
2071
2071
  async trySignSchnorrWithOPWallet(e) {
2072
2072
  const t = this.getOPWallet();
@@ -2152,32 +2152,32 @@ var mt = /* @__PURE__ */ (function(e) {
2152
2152
  signMessage(e, t) {
2153
2153
  if (typeof t == "string" && (t = new TextEncoder().encode(t)), !e.privateKey) throw new Error("Private key not found in keypair.");
2154
2154
  const i = this.sha256(t);
2155
- if (!C.signSchnorr) throw new Error("backend.signSchnorr is not available.");
2155
+ if (!D.signSchnorr) throw new Error("backend.signSchnorr is not available.");
2156
2156
  return {
2157
- signature: C.signSchnorr(i, e.privateKey),
2157
+ signature: D.signSchnorr(i, e.privateKey),
2158
2158
  message: i
2159
2159
  };
2160
2160
  }
2161
2161
  signECDSA(e, t) {
2162
2162
  if (typeof t == "string" && (t = new TextEncoder().encode(t)), !e.privateKey) throw new Error("Private key not found in keypair.");
2163
2163
  const i = this.sha256(t);
2164
- if (!C.sign) throw new Error("backend.signSchnorr is not available.");
2164
+ if (!D.sign) throw new Error("backend.signSchnorr is not available.");
2165
2165
  return {
2166
- signature: C.sign(i, e.privateKey),
2166
+ signature: D.sign(i, e.privateKey),
2167
2167
  message: i
2168
2168
  };
2169
2169
  }
2170
2170
  verifyECDSASignature(e, t, i) {
2171
2171
  if (typeof t == "string" && (t = new TextEncoder().encode(t)), i.length !== 64) throw new Error("Invalid signature length.");
2172
2172
  const r = this.sha256(t);
2173
- if (!C.verify) throw new Error("backend.verifySchnorr is not available.");
2174
- return C.verify(r, e, i);
2173
+ if (!D.verify) throw new Error("backend.verifySchnorr is not available.");
2174
+ return D.verify(r, e, i);
2175
2175
  }
2176
2176
  verifySignature(e, t, i) {
2177
2177
  if (typeof t == "string" && (t = new TextEncoder().encode(t)), i.length !== 64) throw new Error("Invalid signature length.");
2178
2178
  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);
2179
+ if (!D.verifySchnorr) throw new Error("backend.verifySchnorr is not available.");
2180
+ return D.verifySchnorr(r, O(e), i);
2181
2181
  }
2182
2182
  tweakAndVerifySignature(e, t, i) {
2183
2183
  const r = I.tweakPublicKey(e);
@@ -2360,7 +2360,7 @@ function fr(e) {
2360
2360
  function $e(e, t, i, r, s) {
2361
2361
  return `m/${e}'/${t}'/${i}'/${r}/${s}`;
2362
2362
  }
2363
- var gr = (0, P.BIP32Factory)(C), Sr = class Ye {
2363
+ var gr = (0, P.BIP32Factory)(D), Sr = class Ye {
2364
2364
  _phrase;
2365
2365
  _passphrase;
2366
2366
  _network;
@@ -2678,7 +2678,7 @@ function Tr(e, t) {
2678
2678
  return Ar(e, t) !== -1;
2679
2679
  }
2680
2680
  function Ar(e, t) {
2681
- const i = D.hash160(e), r = O(e), s = b.decompile(t);
2681
+ const i = C.hash160(e), r = O(e), s = b.decompile(t);
2682
2682
  if (s === null) throw new Error("Unknown script error");
2683
2683
  return s.findIndex((n) => typeof n == "number" ? !1 : n instanceof Uint8Array && (R(n, e) || R(n, i) || R(n, r)));
2684
2684
  }
@@ -3043,7 +3043,7 @@ var At = /* @__PURE__ */ (function(e) {
3043
3043
  durationMs: 0
3044
3044
  };
3045
3045
  let c, u = !1;
3046
- this.parallelSigningConfig && "signBatch" in this.parallelSigningConfig ? c = this.parallelSigningConfig : (c = Ci.getInstance(this.parallelSigningConfig), c.isPreservingWorkers || (u = !0));
3046
+ this.parallelSigningConfig && "signBatch" in this.parallelSigningConfig ? c = this.parallelSigningConfig : (c = Di.getInstance(this.parallelSigningConfig), c.isPreservingWorkers || (u = !0));
3047
3047
  try {
3048
3048
  await c.initialize();
3049
3049
  const l = await c.signBatch(a, n);
@@ -3068,13 +3068,13 @@ var At = /* @__PURE__ */ (function(e) {
3068
3068
  }).output;
3069
3069
  }
3070
3070
  generateP2SHRedeemScriptLegacy(t) {
3071
- const i = D.hash160(this.signer.publicKey), r = b.compile([
3071
+ const i = C.hash160(this.signer.publicKey), r = b.compile([
3072
3072
  p.OP_DUP,
3073
3073
  p.OP_HASH160,
3074
3074
  i,
3075
3075
  p.OP_EQUALVERIFY,
3076
3076
  p.OP_CHECKSIG
3077
- ]), s = D.hash160(r), n = b.compile([
3077
+ ]), s = C.hash160(r), n = b.compile([
3078
3078
  p.OP_HASH160,
3079
3079
  s,
3080
3080
  p.OP_EQUAL
@@ -3147,7 +3147,7 @@ var At = /* @__PURE__ */ (function(e) {
3147
3147
  i === 0 && this.tapData?.hash && (n.tapMerkleRoot = this.tapData.hash);
3148
3148
  } else if (Vi(s))
3149
3149
  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);
3150
+ else if (Ci(s) || Fi(s)) if (t.nonWitnessUtxo) n.nonWitnessUtxo = t.nonWitnessUtxo instanceof Uint8Array ? t.nonWitnessUtxo : S(t.nonWitnessUtxo);
3151
3151
  else throw new Error("Missing nonWitnessUtxo for P2PK or P2MS UTXO");
3152
3152
  else this.error(`Unknown or unsupported script type for output: ${t.scriptPubKey.hex}`);
3153
3153
  return i === 0 && (this.tapLeafScript && (n.tapLeafScript = [this.tapLeafScript]), this.nonWitnessUtxo && (n.nonWitnessUtxo = this.nonWitnessUtxo)), n;
@@ -3194,20 +3194,20 @@ var At = /* @__PURE__ */ (function(e) {
3194
3194
  };
3195
3195
  if (o && s && i.witnessScript) {
3196
3196
  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);
3197
+ if ($.isP2WDAWitnessScript(i.witnessScript)) return this.finalizeSecondaryP2WDA(t, i);
3198
3198
  if (this.csvInputIndices.has(t)) return {
3199
3199
  finalScriptSig: void 0,
3200
3200
  finalScriptWitness: ee([i.partialSig[0].signature, i.witnessScript])
3201
3201
  };
3202
3202
  }
3203
- return Ce(t, i, r, s, n, o, !0, this.unlockScript);
3203
+ return De(t, i, r, s, n, o, !0, this.unlockScript);
3204
3204
  };
3205
3205
  finalizeSecondaryP2WDA(t, i) {
3206
3206
  if (!i.partialSig || i.partialSig.length === 0) throw new Error(`No signature for P2WDA input #${t}`);
3207
3207
  if (!i.witnessScript) throw new Error(`No witness script for P2WDA input #${t}`);
3208
3208
  return {
3209
3209
  finalScriptSig: void 0,
3210
- finalScriptWitness: ee(X.createSimpleP2WDAWitness(i.partialSig[0].signature, i.witnessScript))
3210
+ finalScriptWitness: ee($.createSimpleP2WDAWitness(i.partialSig[0].signature, i.witnessScript))
3211
3211
  };
3212
3212
  }
3213
3213
  async signInputsWalletBased(t) {
@@ -3583,9 +3583,9 @@ var Ue = new Uint8Array([
3583
3583
  finalScriptSig: void 0,
3584
3584
  finalScriptWitness: Uint8Array.from([0])
3585
3585
  };
3586
- if (d.witnessScript && X.isP2WDAWitnessScript(d.witnessScript)) {
3586
+ if (d.witnessScript && $.isP2WDAWitnessScript(d.witnessScript)) {
3587
3587
  const m = [];
3588
- for (let N = 0; N < 10; N++) m.push(new Uint8Array(0));
3588
+ for (let M = 0; M < 10; M++) m.push(new Uint8Array(0));
3589
3589
  const A = new Uint8Array(72);
3590
3590
  return { finalScriptWitness: L.witnessStackToScriptWitness([
3591
3591
  ...m,
@@ -3594,13 +3594,13 @@ var Ue = new Uint8Array([
3594
3594
  ]) };
3595
3595
  }
3596
3596
  if (h === 0 && this.tapLeafScript) {
3597
- const m = new Uint8Array(32), A = this.tapLeafScript.script, N = this.useP2MR ? 33 : 65, $ = new Uint8Array(N);
3597
+ const m = new Uint8Array(32), A = this.tapLeafScript.script, M = this.useP2MR ? 33 : 65, q = new Uint8Array(M);
3598
3598
  return { finalScriptWitness: L.witnessStackToScriptWitness([
3599
3599
  m,
3600
3600
  s,
3601
3601
  s,
3602
3602
  A,
3603
- $
3603
+ q
3604
3604
  ]) };
3605
3605
  }
3606
3606
  if (d.witnessUtxo) {
@@ -3621,10 +3621,10 @@ var Ue = new Uint8Array([
3621
3621
  }
3622
3622
  const m = it.script.decompile(d.witnessScript);
3623
3623
  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);
3624
+ const A = m[0], M = m[m.length - 1];
3625
+ if (typeof A == "number" && A >= p.OP_1 && M === p.OP_CHECKMULTISIG) {
3626
+ const q = A - p.OP_1 + 1, vt = [];
3627
+ for (let Ee = 0; Ee < q; Ee++) vt.push(n);
3628
3628
  return { finalScriptWitness: L.witnessStackToScriptWitness([
3629
3629
  new Uint8Array(0),
3630
3630
  ...vt,
@@ -3645,7 +3645,7 @@ var Ue = new Uint8Array([
3645
3645
  finalScriptWitness: void 0
3646
3646
  };
3647
3647
  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) : {
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]) } : De(h, d, w, !0, !!d.redeemScript, !!d.witnessScript) : {
3649
3649
  finalScriptSig: void 0,
3650
3650
  finalScriptWitness: void 0
3651
3651
  };
@@ -3742,7 +3742,7 @@ var Ue = new Uint8Array([
3742
3742
  t.revealMLDSAPublicKey && (n = this.generateMLDSASignature());
3743
3743
  const o = {
3744
3744
  priority: J.MLDSA_LINK_PUBKEY,
3745
- opcode: q.MLDSA_LINK_PUBKEY,
3745
+ opcode: G.MLDSA_LINK_PUBKEY,
3746
3746
  data: {
3747
3747
  verifyRequest: !!t.revealMLDSAPublicKey,
3748
3748
  publicKey: r.publicKey,
@@ -3974,7 +3974,7 @@ var Ue = new Uint8Array([
3974
3974
  return t;
3975
3975
  }
3976
3976
  getContractSeed() {
3977
- return D.hash256(this.randomBytes);
3977
+ return C.hash256(this.randomBytes);
3978
3978
  }
3979
3979
  customFinalizer = (e, t) => {
3980
3980
  if (!this.tapLeafScript) throw new Error("Tap leaf script is required");
@@ -4164,7 +4164,7 @@ var Ue = new Uint8Array([
4164
4164
  redeemVersion: 192
4165
4165
  };
4166
4166
  }
4167
- }, Ct = class ei extends B {
4167
+ }, Dt = class ei extends B {
4168
4168
  static MAXIMUM_CONTRACT_SIZE = 1536 * 1024;
4169
4169
  type = T.DEPLOYMENT;
4170
4170
  challenge;
@@ -4298,7 +4298,7 @@ var Ue = new Uint8Array([
4298
4298
  const i = [], r = t.challenge.getSubmission();
4299
4299
  if (r && i.push({
4300
4300
  priority: J.MLDSA_LINK_PUBKEY,
4301
- opcode: q.EPOCH_SUBMISSION,
4301
+ opcode: G.EPOCH_SUBMISSION,
4302
4302
  data: r
4303
4303
  }), t.revealMLDSAPublicKey && !t.linkMLDSAPublicKeyToAddress) throw new Error("To reveal the MLDSA public key, you must set linkMLDSAPublicKeyToAddress to true.");
4304
4304
  return t.linkMLDSAPublicKeyToAddress && this.generateMLDSALinkRequest(t, i), i;
@@ -4314,10 +4314,10 @@ var Ue = new Uint8Array([
4314
4314
  if (!this.bytecode) throw new Error("Bytecode is required");
4315
4315
  const t = lt([
4316
4316
  this.internalPubKeyToXOnly(),
4317
- D.hash256(this.randomBytes),
4318
- D.hash256(this.bytecode)
4317
+ C.hash256(this.randomBytes),
4318
+ C.hash256(this.bytecode)
4319
4319
  ]);
4320
- return D.hash256(t);
4320
+ return C.hash256(t);
4321
4321
  }
4322
4322
  customFinalizer = (t, i) => {
4323
4323
  if (!this.tapLeafScript) throw new Error("Tap leaf script is required");
@@ -4353,7 +4353,7 @@ var Ue = new Uint8Array([
4353
4353
  version: 192
4354
4354
  }];
4355
4355
  }
4356
- }, Dt = class extends B {
4356
+ }, Ct = class extends B {
4357
4357
  type = T.FUNDING;
4358
4358
  amount;
4359
4359
  splitInputsInto;
@@ -4433,13 +4433,13 @@ var Ue = new Uint8Array([
4433
4433
  const t = [];
4434
4434
  e.loadedStorage && t.push({
4435
4435
  priority: J.ACCESS_LIST,
4436
- opcode: q.ACCESS_LIST,
4436
+ opcode: G.ACCESS_LIST,
4437
4437
  data: e.loadedStorage
4438
4438
  });
4439
4439
  const i = e.challenge.getSubmission();
4440
4440
  if (i && t.push({
4441
4441
  priority: J.EPOCH_SUBMISSION,
4442
- opcode: q.EPOCH_SUBMISSION,
4442
+ opcode: G.EPOCH_SUBMISSION,
4443
4443
  data: i
4444
4444
  }), e.revealMLDSAPublicKey && !e.linkMLDSAPublicKeyToAddress) throw new Error("To reveal the MLDSA public key, you must set linkMLDSAPublicKeyToAddress to true.");
4445
4445
  return e.linkMLDSAPublicKeyToAddress && this.generateMLDSALinkRequest(e, t), t;
@@ -4498,13 +4498,13 @@ var Ue = new Uint8Array([
4498
4498
  const i = [];
4499
4499
  t.loadedStorage && i.push({
4500
4500
  priority: J.ACCESS_LIST,
4501
- opcode: q.ACCESS_LIST,
4501
+ opcode: G.ACCESS_LIST,
4502
4502
  data: t.loadedStorage
4503
4503
  });
4504
4504
  const r = t.challenge.getSubmission();
4505
4505
  return r && i.push({
4506
4506
  priority: J.EPOCH_SUBMISSION,
4507
- opcode: q.EPOCH_SUBMISSION,
4507
+ opcode: G.EPOCH_SUBMISSION,
4508
4508
  data: r
4509
4509
  }), i;
4510
4510
  }
@@ -4515,11 +4515,11 @@ var Ue = new Uint8Array([
4515
4515
  return O(this.scriptSigner.publicKey);
4516
4516
  }
4517
4517
  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);
4518
+ if (this.utxos.length === 0 || !$.isP2WDAUTXO(this.utxos[0])) throw new Error("Input 0 must be a P2WDA UTXO");
4519
+ for (let t = 0; t < this.utxos.length; t++) $.isP2WDAUTXO(this.utxos[t]) && this.p2wdaInputIndices.add(t);
4520
4520
  for (let t = 0; t < this.optionalInputs.length; t++) {
4521
4521
  const i = this.utxos.length + t;
4522
- X.isP2WDAUTXO(this.optionalInputs[t]) && this.p2wdaInputIndices.add(i);
4522
+ $.isP2WDAUTXO(this.optionalInputs[t]) && this.p2wdaInputIndices.add(i);
4523
4523
  }
4524
4524
  }
4525
4525
  validateOperationDataSize() {
@@ -4815,13 +4815,13 @@ var Ue = new Uint8Array([
4815
4815
  const t = [];
4816
4816
  e.loadedStorage && t.push({
4817
4817
  priority: J.ACCESS_LIST,
4818
- opcode: q.ACCESS_LIST,
4818
+ opcode: G.ACCESS_LIST,
4819
4819
  data: e.loadedStorage
4820
4820
  });
4821
4821
  const i = e.challenge.getSubmission();
4822
4822
  if (i && t.push({
4823
4823
  priority: J.EPOCH_SUBMISSION,
4824
- opcode: q.EPOCH_SUBMISSION,
4824
+ opcode: G.EPOCH_SUBMISSION,
4825
4825
  data: i
4826
4826
  }), e.revealMLDSAPublicKey && !e.linkMLDSAPublicKeyToAddress) throw new Error("To reveal the MLDSA public key, you must set linkMLDSAPublicKeyToAddress to true.");
4827
4827
  return e.linkMLDSAPublicKeyToAddress && this.generateMLDSALinkRequest(e, t), t;
@@ -4913,8 +4913,8 @@ var Ue = new Uint8Array([
4913
4913
  }, Kt, async (d) => {
4914
4914
  const w = await d.estimateTransactionFees() + d.getTotalOutputValue();
4915
4915
  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;
4916
+ const m = e.optionalInputs.reduce((M, q) => M + q.value, 0n), A = w > m ? w - m : 0n;
4917
+ return A < B.MINIMUM_DUST ? B.MINIMUM_DUST : A;
4918
4918
  }
4919
4919
  return w;
4920
4920
  }, "Interaction");
@@ -4986,9 +4986,9 @@ var Ue = new Uint8Array([
4986
4986
  const i = this.parseOptionalInputs(e.optionalInputs), { finalTransaction: r, estimatedAmount: s, challenge: n } = await this.iterateFundingAmount({
4987
4987
  ...e,
4988
4988
  optionalInputs: i
4989
- }, Ct, async (A) => {
4990
- const N = await A.estimateTransactionFees(), $ = this.getPriorityFee(e), vt = A.getOptionalOutputValue();
4991
- return N + $ + vt;
4989
+ }, Dt, async (A) => {
4990
+ const M = await A.estimateTransactionFees(), q = this.getPriorityFee(e), vt = A.getOptionalOutputValue();
4991
+ return M + q + vt;
4992
4992
  }, "Deployment");
4993
4993
  if (!n) throw new Error("Failed to get challenge from deployment transaction");
4994
4994
  const o = await r.getFundingTransactionParameters();
@@ -5000,7 +5000,7 @@ var Ue = new Uint8Array([
5000
5000
  });
5001
5001
  if (!a) throw new Error("Could not sign funding transaction.");
5002
5002
  o.estimatedFees = a.estimatedFees;
5003
- const c = await new Dt({
5003
+ const c = await new Ct({
5004
5004
  ...o,
5005
5005
  optionalInputs: [],
5006
5006
  optionalOutputs: []
@@ -5014,7 +5014,7 @@ var Ue = new Uint8Array([
5014
5014
  address: r.getScriptAddress()
5015
5015
  },
5016
5016
  value: BigInt(u.value)
5017
- }, h = new Ct({
5017
+ }, h = new Dt({
5018
5018
  ...e,
5019
5019
  utxos: [l],
5020
5020
  randomBytes: r.getRndBytes(),
@@ -5133,7 +5133,7 @@ var Ue = new Uint8Array([
5133
5133
  }
5134
5134
  async createFundTransaction(e) {
5135
5135
  if (!e.to) throw new Error('Field "to" not provided.');
5136
- const t = new Dt(e), i = await t.signTransaction();
5136
+ const t = new Ct(e), i = await t.signTransaction();
5137
5137
  if (!i) throw new Error("Could not sign funding transaction.");
5138
5138
  return {
5139
5139
  tx: i,
@@ -5144,7 +5144,7 @@ var Ue = new Uint8Array([
5144
5144
  };
5145
5145
  }
5146
5146
  hasP2WDAInputs(e) {
5147
- return e.some((t) => X.isP2WDAUTXO(t));
5147
+ return e.some((t) => $.isP2WDAUTXO(t));
5148
5148
  }
5149
5149
  async signP2WDAInteraction(e) {
5150
5150
  if (!e.from) throw new Error('Field "from" not provided.');
@@ -5202,15 +5202,16 @@ var Ue = new Uint8Array([
5202
5202
  await m.generateTransactionMinimalSignatures(), o = await i(m);
5203
5203
  } catch (A) {
5204
5204
  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}`);
5205
+ const M = A.message.match(/need (\d+) sats but only have (\d+) sats/);
5206
+ if (M)
5207
+ o = BigInt(M[1]), this.debug && console.log(`${r}: Caught insufficient funds, updating to ${o}`);
5208
5208
  else throw A;
5209
5209
  } else throw new Error("Unknown error during fee estimation", { cause: A });
5210
5210
  }
5211
5211
  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
5212
  }
5213
5213
  if (!u) throw new Error(`Failed to converge on ${r} funding amount`);
5214
+ if (o === 0n) throw new Error("Impossible. Transaction cant be free.");
5214
5215
  return {
5215
5216
  finalTransaction: u,
5216
5217
  estimatedAmount: o,
@@ -5230,7 +5231,7 @@ var Ue = new Uint8Array([
5230
5231
  value: BigInt(r.value)
5231
5232
  }];
5232
5233
  }
5233
- }, Q = class M extends B {
5234
+ }, Q = class N extends B {
5234
5235
  static LOCK_LEAF_SCRIPT = b.compile([
5235
5236
  p.OP_XOR,
5236
5237
  p.OP_NOP,
@@ -5249,14 +5250,14 @@ var Ue = new Uint8Array([
5249
5250
  requestedAmount;
5250
5251
  receiver;
5251
5252
  refundVault;
5252
- sighashTypes = M.signHashTypesArray;
5253
+ sighashTypes = N.signHashTypesArray;
5253
5254
  constructor(t) {
5254
5255
  if (!t.refundVault) throw new Error("Refund vault is required");
5255
5256
  if (!t.requestedAmount) throw new Error("Requested amount is required");
5256
5257
  if (!t.receiver) throw new Error("Receiver is required");
5257
5258
  if (super({
5258
5259
  ...t,
5259
- signer: I.fromPrivateKey(D.sha256(new TextEncoder().encode("aaaaaaaa"))),
5260
+ signer: I.fromPrivateKey(C.sha256(new TextEncoder().encode("aaaaaaaa"))),
5260
5261
  priorityFee: 0n,
5261
5262
  gasSatFee: 0n
5262
5263
  }), !t.pubkeys) throw new Error("Pubkeys are required");
@@ -5264,7 +5265,7 @@ var Ue = new Uint8Array([
5264
5265
  }
5265
5266
  static fromBase64(t) {
5266
5267
  const i = H.fromBase64(t.psbt, { network: t.network });
5267
- return new M({
5268
+ return new N({
5268
5269
  ...t,
5269
5270
  psbt: i
5270
5271
  });
@@ -5290,7 +5291,7 @@ var Ue = new Uint8Array([
5290
5291
  let n = !1, o = !0;
5291
5292
  for (let a = r; a < t.data.inputs.length; a++) {
5292
5293
  const c = t.data.inputs[a];
5293
- c.tapInternalKey || (c.tapInternalKey = O(M.numsPoint));
5294
+ c.tapInternalKey || (c.tapInternalKey = O(N.numsPoint));
5294
5295
  const u = [];
5295
5296
  if (c.finalScriptWitness) {
5296
5297
  const h = B.readScriptWitnessToWitnessStack(c.finalScriptWitness);
@@ -5307,9 +5308,9 @@ var Ue = new Uint8Array([
5307
5308
  c.tapScriptSig = (c.tapScriptSig || []).concat(u);
5308
5309
  }
5309
5310
  Reflect.deleteProperty(c, "finalScriptWitness");
5310
- const l = M.signHashTypesArray ? [M.calculateSignHash(M.signHashTypesArray)] : [];
5311
+ const l = N.signHashTypesArray ? [N.calculateSignHash(N.signHashTypesArray)] : [];
5311
5312
  try {
5312
- M.signInput(t, c, a, i, l), n = !0;
5313
+ N.signInput(t, c, a, i, l), n = !0;
5313
5314
  } catch (h) {
5314
5315
  console.log(h);
5315
5316
  }
@@ -5354,7 +5355,7 @@ var Ue = new Uint8Array([
5354
5355
  let n = 0;
5355
5356
  for (let o = i; o < t.data.inputs.length; o++) try {
5356
5357
  const a = t.data.inputs[o];
5357
- a.tapInternalKey || (a.tapInternalKey = O(M.numsPoint));
5358
+ a.tapInternalKey || (a.tapInternalKey = O(N.numsPoint));
5358
5359
  const c = [];
5359
5360
  if (a.finalScriptWitness) {
5360
5361
  const u = B.readScriptWitnessToWitnessStack(a.finalScriptWitness);
@@ -5367,9 +5368,9 @@ var Ue = new Uint8Array([
5367
5368
  leafVersion: 192,
5368
5369
  script: u[u.length - 2],
5369
5370
  controlBlock: u[u.length - 1]
5370
- }], a.tapScriptSig = M.dedupeSignatures(a.tapScriptSig || [], c);
5371
+ }], a.tapScriptSig = N.dedupeSignatures(a.tapScriptSig || [], c);
5371
5372
  }
5372
- Reflect.deleteProperty(a, "finalScriptWitness"), t.finalizeInput(o, (u, l) => M.partialFinalizer(u, l, [], r[o - i], s)), n++;
5373
+ Reflect.deleteProperty(a, "finalScriptWitness"), t.finalizeInput(o, (u, l) => N.partialFinalizer(u, l, [], r[o - i], s)), n++;
5373
5374
  } catch {
5374
5375
  }
5375
5376
  return n === t.data.inputs.length - i;
@@ -5429,7 +5430,7 @@ var Ue = new Uint8Array([
5429
5430
  scriptTree: this.scriptTree,
5430
5431
  name: E.P2MR
5431
5432
  } : {
5432
- internalPubkey: O(M.numsPoint),
5433
+ internalPubkey: O(N.numsPoint),
5433
5434
  network: this.network,
5434
5435
  scriptTree: this.scriptTree,
5435
5436
  name: E.P2TR
@@ -5445,7 +5446,7 @@ var Ue = new Uint8Array([
5445
5446
  redeem: t,
5446
5447
  name: E.P2MR
5447
5448
  } : {
5448
- internalPubkey: O(M.numsPoint),
5449
+ internalPubkey: O(N.numsPoint),
5449
5450
  network: this.network,
5450
5451
  scriptTree: this.scriptTree,
5451
5452
  redeem: t,
@@ -5460,7 +5461,7 @@ var Ue = new Uint8Array([
5460
5461
  output: this.compiledTargetScript,
5461
5462
  version: 192
5462
5463
  }, {
5463
- output: M.LOCK_LEAF_SCRIPT,
5464
+ output: N.LOCK_LEAF_SCRIPT,
5464
5465
  version: 192
5465
5466
  }];
5466
5467
  }
@@ -5484,7 +5485,7 @@ var Ue = new Uint8Array([
5484
5485
  redeemVersion: 192
5485
5486
  }, this.leftOverFundsScriptRedeem = {
5486
5487
  name: E.P2TR,
5487
- output: M.LOCK_LEAF_SCRIPT,
5488
+ output: N.LOCK_LEAF_SCRIPT,
5488
5489
  redeemVersion: 192
5489
5490
  };
5490
5491
  }
@@ -5507,7 +5508,7 @@ function ci(e) {
5507
5508
  function ui(e) {
5508
5509
  return e.type === T.CANCEL;
5509
5510
  }
5510
- function G(e) {
5511
+ function X(e) {
5511
5512
  return e.startsWith("0x") ? e.slice(2) : e;
5512
5513
  }
5513
5514
  var U = class {
@@ -5792,11 +5793,11 @@ var U = class {
5792
5793
  };
5793
5794
  }
5794
5795
  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))));
5796
+ 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
5797
  }
5797
5798
  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)));
5799
+ 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);
5800
+ for (const i of t.proofs) e.writeBytesWithLength(S(X(i)));
5800
5801
  }
5801
5802
  static readChallenge(e) {
5802
5803
  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 +6152,7 @@ function x(e) {
6151
6152
  var St = class {
6152
6153
  static BLOCKS_PER_EPOCH = 5n;
6153
6154
  static sha1(e) {
6154
- return D.sha1(e);
6155
+ return C.sha1(e);
6155
6156
  }
6156
6157
  static calculatePreimage(e, t, i) {
6157
6158
  if (e.length !== 32 || t.length !== 32 || i.length !== 32) throw new Error("All inputs must be 32 bytes");
@@ -6336,7 +6337,7 @@ var St = class {
6336
6337
  throw new Error(`Unsupported transaction type: ${e.header.transactionType}`);
6337
6338
  }
6338
6339
  static reconstructFunding(e, t) {
6339
- return new Dt({
6340
+ return new Ct({
6340
6341
  ...e,
6341
6342
  amount: BigInt(t.amount),
6342
6343
  splitInputsInto: t.splitInputsInto
@@ -6344,7 +6345,7 @@ var St = class {
6344
6345
  }
6345
6346
  static reconstructDeployment(e, t, i) {
6346
6347
  const r = new ne(t.challenge);
6347
- return new Ct({
6348
+ return new Dt({
6348
6349
  ...e,
6349
6350
  bytecode: S(t.bytecode),
6350
6351
  challenge: r,
@@ -6691,15 +6692,15 @@ var St = class {
6691
6692
  if (m <= 0n) continue;
6692
6693
  const A = Number(w.raw);
6693
6694
  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({
6695
+ const M = n[A];
6696
+ if (!M) throw new Error(`Invalid raw index ${A} - not found in raw transactions array`);
6697
+ let q = d.get(A);
6698
+ if (q === void 0 && (q = xi(M), d.set(A, q)), l += m, u.push({
6698
6699
  transactionId: w.transactionId,
6699
6700
  outputIndex: w.outputIndex,
6700
6701
  value: m,
6701
6702
  scriptPubKey: w.scriptPubKey,
6702
- nonWitnessUtxo: $
6703
+ nonWitnessUtxo: q
6703
6704
  }), l > h) break;
6704
6705
  }
6705
6706
  return d.clear(), u;
@@ -6898,7 +6899,7 @@ function kt(e) {
6898
6899
  const t = e[0];
6899
6900
  return e.length === 1 && t !== void 0 ? `${kt(t)}[]` : `tuple(${e.map((i) => kt(i)).join(",")})[]`;
6900
6901
  }
6901
- var Cr = class {
6902
+ var Dr = class {
6902
6903
  decodeData(e, t) {
6903
6904
  const i = new Ft(e), r = [];
6904
6905
  for (const s of t) r.push(this.decodeSingleValue(i, s));
@@ -7008,7 +7009,7 @@ var Cr = class {
7008
7009
  sha256(e) {
7009
7010
  return new Uint8Array(new Lr.default.sha256().update(e).digest());
7010
7011
  }
7011
- }, Dr = class wi {
7012
+ }, Cr = class wi {
7012
7013
  items;
7013
7014
  keys;
7014
7015
  constructor(t = []) {
@@ -7050,7 +7051,7 @@ var Cr = class {
7050
7051
  map;
7051
7052
  #t;
7052
7053
  constructor(t) {
7053
- this.compareFn = t, this.map = new Mt(), this.#t = [];
7054
+ this.compareFn = t, this.map = new Nt(), this.#t = [];
7054
7055
  }
7055
7056
  get size() {
7056
7057
  return this.map.size;
@@ -7169,11 +7170,11 @@ var Cr = class {
7169
7170
  index: i
7170
7171
  };
7171
7172
  }
7172
- }, Nr = class {
7173
+ }, Mr = class {
7173
7174
  constructor(e, t) {
7174
7175
  this.type = e, this.data = t;
7175
7176
  }
7176
- }, Mr = /* @__PURE__ */ (function(e) {
7177
+ }, Nr = /* @__PURE__ */ (function(e) {
7177
7178
  return e.mainnet = "mainnet", e.testnet = "testnet", e.signet = "Signet", e;
7178
7179
  })({}), Fr = /* @__PURE__ */ (function(e) {
7179
7180
  return e.ECDSA = "ECDSA", e.BIP322 = "BIP322", e;
@@ -7493,15 +7494,15 @@ var Wr = class extends we {
7493
7494
  for (let r = 0; r < t.length; r++) t[r] !== void 0 && !this.deleted[r] && this.set(t[r], i[r]);
7494
7495
  }
7495
7496
  }, fs = /* @__PURE__ */ Ti({
7496
- ABICoder: () => Cr,
7497
+ ABICoder: () => Dr,
7497
7498
  ABIDataTypes: () => g,
7498
7499
  ADDRESS_BYTE_LENGTH: () => 32,
7499
7500
  ANCHOR_SCRIPT: () => se,
7500
7501
  AbiTypeToStr: () => fi,
7501
7502
  Address: () => z,
7502
7503
  AddressGenerator: () => de,
7503
- AddressMap: () => Me,
7504
- AddressSet: () => Dr,
7504
+ AddressMap: () => Ne,
7505
+ AddressSet: () => Cr,
7505
7506
  AddressTypes: () => K,
7506
7507
  AddressVerificator: () => bt,
7507
7508
  BIPStandard: () => st,
@@ -7527,17 +7528,17 @@ var Wr = class extends we {
7527
7528
  CustomMap: () => Hr,
7528
7529
  CustomScriptTransaction: () => Rt,
7529
7530
  DeploymentGenerator: () => he,
7530
- DeploymentTransaction: () => Ct,
7531
+ DeploymentTransaction: () => Dt,
7531
7532
  DeterministicMap: () => Kr,
7532
7533
  DeterministicSet: () => xr,
7533
7534
  EXTENDED_ADDRESS_BYTE_LENGTH: () => 64,
7534
7535
  EcKeyPair: () => I,
7535
7536
  EpochValidator: () => St,
7536
7537
  ExtendedAddressMap: () => Fe,
7537
- FastMap: () => Mt,
7538
+ FastMap: () => Nt,
7538
7539
  FeaturePriority: () => J,
7539
- Features: () => q,
7540
- FundingTransaction: () => Dt,
7540
+ Features: () => G,
7541
+ FundingTransaction: () => Ct,
7541
7542
  Generator: () => tt,
7542
7543
  HashCommitmentGenerator: () => gt,
7543
7544
  I128_BYTE_LENGTH: () => 16,
@@ -7559,14 +7560,14 @@ var Wr = class extends we {
7559
7560
  MnemonicStrength: () => Jt,
7560
7561
  MultiSignGenerator: () => qe,
7561
7562
  MultiSignTransaction: () => Q,
7562
- NetEvent: () => Nr,
7563
+ NetEvent: () => Mr,
7563
7564
  OPNET_DEPLOYMENT_VERSION: () => 0,
7564
7565
  OPNetConsensusConfig: () => hi,
7565
7566
  OPNetLimitedProvider: () => _r,
7566
7567
  OfflineTransactionManager: () => Or,
7567
7568
  P2MR_MS: () => kr,
7568
7569
  P2TR_MS: () => Br,
7569
- P2WDADetector: () => X,
7570
+ P2WDADetector: () => $,
7570
7571
  P2WDAGenerator: () => Qt,
7571
7572
  PSBTTypes: () => Ur,
7572
7573
  QuantumBIP32Factory: () => P.QuantumBIP32Factory,
@@ -7602,7 +7603,7 @@ var Wr = class extends we {
7602
7603
  UnisatSigner: () => mr,
7603
7604
  Wallet: () => Ut,
7604
7605
  WalletNetworks: () => mt,
7605
- XverseNetwork: () => Mr,
7606
+ XverseNetwork: () => Nr,
7606
7607
  XverseSigner: () => Wr,
7607
7608
  abiTypeToSelectorString: () => kt,
7608
7609
  buildBIPPath: () => $e,
@@ -7630,15 +7631,15 @@ var Wr = class extends we {
7630
7631
  versionBuffer: () => ze
7631
7632
  }), gs = P.MLDSASecurityLevel, Ss = P.QuantumBIP32Factory, ws = P.QuantumDerivationPath;
7632
7633
  export {
7633
- Cr as ABICoder,
7634
+ Dr as ABICoder,
7634
7635
  g as ABIDataTypes,
7635
7636
  Xr as ADDRESS_BYTE_LENGTH,
7636
7637
  se as ANCHOR_SCRIPT,
7637
7638
  fi as AbiTypeToStr,
7638
7639
  z as Address,
7639
7640
  de as AddressGenerator,
7640
- Me as AddressMap,
7641
- Dr as AddressSet,
7641
+ Ne as AddressMap,
7642
+ Cr as AddressSet,
7642
7643
  K as AddressTypes,
7643
7644
  bt as AddressVerificator,
7644
7645
  st as BIPStandard,
@@ -7664,17 +7665,17 @@ export {
7664
7665
  Hr as CustomMap,
7665
7666
  Rt as CustomScriptTransaction,
7666
7667
  he as DeploymentGenerator,
7667
- Ct as DeploymentTransaction,
7668
+ Dt as DeploymentTransaction,
7668
7669
  Kr as DeterministicMap,
7669
7670
  xr as DeterministicSet,
7670
7671
  $r as EXTENDED_ADDRESS_BYTE_LENGTH,
7671
7672
  I as EcKeyPair,
7672
7673
  St as EpochValidator,
7673
7674
  Fe as ExtendedAddressMap,
7674
- Mt as FastMap,
7675
+ Nt as FastMap,
7675
7676
  J as FeaturePriority,
7676
- q as Features,
7677
- Dt as FundingTransaction,
7677
+ G as Features,
7678
+ Ct as FundingTransaction,
7678
7679
  tt as Generator,
7679
7680
  gt as HashCommitmentGenerator,
7680
7681
  ss as I128_BYTE_LENGTH,
@@ -7696,14 +7697,14 @@ export {
7696
7697
  Jt as MnemonicStrength,
7697
7698
  qe as MultiSignGenerator,
7698
7699
  Q as MultiSignTransaction,
7699
- Nr as NetEvent,
7700
+ Mr as NetEvent,
7700
7701
  hs as OPNET_DEPLOYMENT_VERSION,
7701
7702
  hi as OPNetConsensusConfig,
7702
7703
  _r as OPNetLimitedProvider,
7703
7704
  Or as OfflineTransactionManager,
7704
7705
  kr as P2MR_MS,
7705
7706
  Br as P2TR_MS,
7706
- X as P2WDADetector,
7707
+ $ as P2WDADetector,
7707
7708
  Qt as P2WDAGenerator,
7708
7709
  Ur as PSBTTypes,
7709
7710
  Ss as QuantumBIP32Factory,
@@ -7739,7 +7740,7 @@ export {
7739
7740
  mr as UnisatSigner,
7740
7741
  Ut as Wallet,
7741
7742
  mt as WalletNetworks,
7742
- Mr as XverseNetwork,
7743
+ Nr as XverseNetwork,
7743
7744
  Wr as XverseSigner,
7744
7745
  kt as abiTypeToSelectorString,
7745
7746
  $e as buildBIPPath,