@gardenfi/core 2.0.11 → 2.0.13

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/dist/index.js CHANGED
@@ -1,16 +1,16 @@
1
1
  var cu = Object.defineProperty;
2
2
  var hu = (e, t, r) => t in e ? cu(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
3
  var wr = (e, t, r) => hu(e, typeof t != "symbol" ? t + "" : t, r);
4
- import { Orderbook as lu, isMainnet as In, getTimeLock as du, isBitcoin as Gr, getBlockchainType as On, BlockchainType as It, EthereumLocalnet as pu, ArbitrumLocalnet as yu } from "@gardenfi/orderbook";
4
+ import { Orderbook as lu, isMainnet as In, getTimeLock as du, isBitcoin as Gr, getBlockchainType as On, BlockchainType as Ot, EthereumLocalnet as pu, ArbitrumLocalnet as yu } from "@gardenfi/orderbook";
5
5
  import { Environment as Or, Url as dn, with0x as jn, checkAllowanceAndApprove as bu, EventBroker as va, Auth as wu, Siwe as gu, sleep as mu, fetchBitcoinBlockNumber as ro, fetchEVMBlockNumber as no } from "@gardenfi/utils";
6
6
  import { BitcoinNetwork as io, Urgency as so, BitcoinProvider as _u, BitcoinWallet as vu } from "@catalogfi/wallets";
7
- import { getContract as Eu, sha256 as kn, defineChain as xu, createWalletClient as oo, custom as ao } from "viem";
7
+ import { getContract as Eu, sha256 as kn, createWalletClient as oo, custom as ao } from "viem";
8
8
  import * as fo from "varuint-bitcoin";
9
- import Su from "varuint-bitcoin";
9
+ import xu from "varuint-bitcoin";
10
10
  import * as nr from "tiny-secp256k1";
11
- import * as he from "bitcoinjs-lib";
12
- import { crypto as Bu } from "bitcoinjs-lib";
13
- import Pu from "bignumber.js";
11
+ import * as se from "bitcoinjs-lib";
12
+ import { crypto as Su } from "bitcoinjs-lib";
13
+ import Bu from "bignumber.js";
14
14
  var Ea = (e, t, r) => {
15
15
  if (!t.has(e))
16
16
  throw TypeError("Cannot " + r);
@@ -19,8 +19,8 @@ var Ea = (e, t, r) => {
19
19
  throw TypeError("Cannot add the same private member more than once");
20
20
  t instanceof WeakSet ? t.add(e) : t.set(e, r);
21
21
  }, Mi = (e, t, r, n) => (Ea(e, t, "write to private field"), t.set(e, r), r);
22
- const Au = (e) => new Promise((t) => setTimeout(t, e));
23
- class Tu {
22
+ const Pu = (e) => new Promise((t) => setTimeout(t, e));
23
+ class Au {
24
24
  /**
25
25
  * @param {number} maxRetries - The maximum number of retries, if less < 0 then it is set to 0
26
26
  * @param {number} delay - The delay between retries
@@ -40,12 +40,12 @@ class Tu {
40
40
  try {
41
41
  return await t();
42
42
  } catch (i) {
43
- r++, n = i, await Au(this.delay * r);
43
+ r++, n = i, await Pu(this.delay * r);
44
44
  }
45
45
  throw n;
46
46
  }
47
47
  }
48
- const Iu = (e) => {
48
+ const Tu = (e) => {
49
49
  try {
50
50
  return JSON.parse(e);
51
51
  } catch {
@@ -148,14 +148,14 @@ class er {
148
148
  static async parse(t) {
149
149
  const r = await t.text();
150
150
  if (t.status >= 200 && t.status < 300)
151
- return Iu(r);
151
+ return Tu(r);
152
152
  throw new Error(r);
153
153
  }
154
154
  }
155
155
  function uo(e) {
156
156
  return (e == null ? void 0 : e.message) || (e == null ? void 0 : e.toString()) || "unknown error";
157
157
  }
158
- const Rn = (e) => new Tu((e == null ? void 0 : e.retryCount) ?? 2, (e == null ? void 0 : e.retryDelay) ?? 1e3), Zt = (e) => e.startsWith("0x") ? e.slice(2) : e;
158
+ const Rn = (e) => new Au((e == null ? void 0 : e.retryCount) ?? 2, (e == null ? void 0 : e.retryDelay) ?? 1e3), Zt = (e) => e.startsWith("0x") ? e.slice(2) : e;
159
159
  var Gn, Wn, Vn;
160
160
  let ys = class {
161
161
  constructor(t, r, n = void 0) {
@@ -192,31 +192,31 @@ const re = (e) => new ys(!0, e), j = (e, ...t) => {
192
192
  }
193
193
  return new ys(!1, null, e);
194
194
  };
195
- var Pe = /* @__PURE__ */ ((e) => (e.Idle = "Idle", e.Initiate = "Initiate", e.Redeem = "Redeem", e.Refund = "Refund", e))(Pe || {});
195
+ var Me = /* @__PURE__ */ ((e) => (e.Idle = "Idle", e.Initiate = "Initiate", e.Redeem = "Redeem", e.Refund = "Refund", e))(Me || {});
196
196
  function bs(e) {
197
197
  return typeof e == "string" && (e = Buffer.from(e, "hex")), e.length === 32 ? e : e.subarray(1, 33);
198
198
  }
199
199
  function gr(e, t) {
200
200
  if (!e) throw new Error(t);
201
201
  }
202
- function Ou(e) {
202
+ function Iu(e) {
203
203
  return Buffer.concat([
204
204
  Uint8Array.from([192]),
205
- ku(e)
205
+ Ou(e)
206
206
  ]);
207
207
  }
208
- function ku(e) {
208
+ function Ou(e) {
209
209
  const t = fo.encodingLength(e.length), r = Buffer.allocUnsafe(t);
210
210
  return fo.encode(e.length, r), Buffer.concat([r, e]);
211
211
  }
212
- function Ru(e, t) {
212
+ function ku(e, t) {
213
213
  if (e.compare(t) > 0) {
214
214
  const r = e;
215
215
  e = t, t = r;
216
216
  }
217
217
  return [e, t];
218
218
  }
219
- const Jt = (e) => e.length === 64 ? e : e.slice(2), Uu = (e) => {
219
+ const Jt = (e) => e.length === 64 ? e : e.slice(2), Ru = (e) => {
220
220
  if (!e) return !1;
221
221
  try {
222
222
  const t = Buffer.from(e, "hex");
@@ -224,19 +224,19 @@ const Jt = (e) => e.length === 64 ? e : e.slice(2), Uu = (e) => {
224
224
  } catch {
225
225
  return !1;
226
226
  }
227
- }, Cu = (e, t, r, n) => e + ":" + t.toLowerCase() + "::" + r + ":" + n.toLowerCase();
228
- function M1(e, t) {
227
+ }, Uu = (e, t, r, n) => e + ":" + t.toLowerCase() + "::" + r + ":" + n.toLowerCase();
228
+ function D1(e, t) {
229
229
  if (!e) return !1;
230
- const r = t === Or.MAINNET ? he.networks.bitcoin : t === Or.TESTNET ? he.networks.testnet : he.networks.regtest;
230
+ const r = t === Or.MAINNET ? se.networks.bitcoin : t === Or.TESTNET ? se.networks.testnet : se.networks.regtest;
231
231
  if (!r) return !1;
232
- he.initEccLib(nr);
232
+ se.initEccLib(nr);
233
233
  try {
234
- return he.address.toOutputScript(e, r), !0;
234
+ return se.address.toOutputScript(e, r), !0;
235
235
  } catch {
236
236
  return !1;
237
237
  }
238
238
  }
239
- const Lu = (e) => {
239
+ const Cu = (e) => {
240
240
  switch (e) {
241
241
  case Or.MAINNET:
242
242
  return io.Mainnet;
@@ -282,7 +282,7 @@ const xa = (e, t, r) => {
282
282
  if (t > r) return we.Expired;
283
283
  }
284
284
  return e.initiate_tx_hash ? Number(e.initiate_block_number) ? we.Initiated : we.InitiateDetected : we.Idle;
285
- }, D1 = (e, t, r) => {
285
+ }, $1 = (e, t, r) => {
286
286
  const n = xa(
287
287
  e,
288
288
  t,
@@ -292,23 +292,23 @@ const xa = (e, t, r) => {
292
292
  }, Sa = (e) => {
293
293
  switch (e) {
294
294
  case be.Matched:
295
- return Pe.Initiate;
295
+ return Me.Initiate;
296
296
  case be.CounterPartyInitiated:
297
297
  case be.CounterPartyInitiateDetected:
298
298
  case be.RedeemDetected:
299
- return Pe.Redeem;
299
+ return Me.Redeem;
300
300
  case be.Expired:
301
- return Pe.Refund;
301
+ return Me.Refund;
302
302
  default:
303
- return Pe.Idle;
303
+ return Me.Idle;
304
304
  }
305
305
  }, ei = (e, t = 0) => {
306
306
  const r = Date.now(), n = e * 1e3 + t * 36e5;
307
307
  return r >= n;
308
- }, $1 = (e) => e.filter((t) => !Ba(t)), Ba = (e) => {
308
+ }, j1 = (e) => e.filter((t) => !Ba(t)), Ba = (e) => {
309
309
  const { source_swap: t, create_order: r } = e, { initiate_tx_hash: n, initiate_block_number: i } = t, { deadline: s } = r.additional_data;
310
310
  return n && Number(i) ? !1 : n && !Number(i) ? ei(Number(s), 12) : n ? !1 : ei(Number(s), 1);
311
- }, Nu = [
311
+ }, Lu = [
312
312
  {
313
313
  inputs: [
314
314
  {
@@ -701,7 +701,7 @@ const xa = (e, t, r) => {
701
701
  type: "function"
702
702
  }
703
703
  ];
704
- class Fu {
704
+ class Nu {
705
705
  constructor(t, r) {
706
706
  this.url = new dn("/relayer", t), this.auth = r;
707
707
  }
@@ -718,15 +718,15 @@ class Fu {
718
718
  if (l.error) return j(l.error);
719
719
  const d = Eu({
720
720
  address: jn(r.source_swap.asset),
721
- abi: Nu,
721
+ abi: Lu,
722
722
  client: t
723
- }), b = await d.read.token(), x = await bu(
723
+ }), b = await d.read.token(), E = await bu(
724
724
  Number(c),
725
725
  b,
726
726
  r.source_swap.asset,
727
727
  t
728
728
  );
729
- if (x.error) return j(x.error);
729
+ if (E.error) return j(E.error);
730
730
  const p = await d.read.eip712Domain(), I = await t.signTypedData({
731
731
  account: t.account,
732
732
  domain: {
@@ -793,35 +793,35 @@ class Fu {
793
793
  }
794
794
  }
795
795
  }
796
- const Hu = Buffer.from(
796
+ const Fu = Buffer.from(
797
797
  "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",
798
798
  "hex"
799
- ), Mu = Buffer.from(
799
+ ), Hu = Buffer.from(
800
800
  "483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",
801
801
  "hex"
802
- ), Du = Buffer.concat([Hu, Mu]), $u = Buffer.from(
802
+ ), Mu = Buffer.concat([Fu, Hu]), Du = Buffer.from(
803
803
  "0250929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0",
804
804
  "hex"
805
805
  ), ho = {
806
806
  failedToCreateInternalPubkey: "failed to create internal pubkey",
807
807
  failedToTweakPubkey: "failed to tweak pubkey"
808
808
  };
809
- function ju() {
810
- const e = Bu.sha256(Buffer.from("GardenHTLC", "utf-8")), t = nr.pointMultiply(
811
- Buffer.concat([Buffer.from("04", "hex"), Du]),
809
+ function $u() {
810
+ const e = Su.sha256(Buffer.from("GardenHTLC", "utf-8")), t = nr.pointMultiply(
811
+ Buffer.concat([Buffer.from("04", "hex"), Mu]),
812
812
  e
813
813
  );
814
814
  if (!t)
815
815
  throw new Error(ho.failedToCreateInternalPubkey);
816
- const r = nr.pointAdd($u, t);
816
+ const r = nr.pointAdd(Du, t);
817
817
  if (!r) throw new Error(ho.failedToCreateInternalPubkey);
818
818
  return bs(Buffer.from(r));
819
819
  }
820
- var jt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
821
- function Gu(e) {
820
+ var Gt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
821
+ function ju(e) {
822
822
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
823
823
  }
824
- function Wu(e) {
824
+ function Gu(e) {
825
825
  if (e.__esModule) return e;
826
826
  var t = e.default;
827
827
  if (typeof t == "function") {
@@ -840,12 +840,12 @@ function Wu(e) {
840
840
  });
841
841
  }), r;
842
842
  }
843
- var ge = {}, Le = {}, Pt = {}, di = {};
844
- di.byteLength = qu;
845
- di.toByteArray = Yu;
846
- di.fromByteArray = Qu;
847
- var ht = [], Je = [], Vu = typeof Uint8Array < "u" ? Uint8Array : Array, Di = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
848
- for (var mr = 0, zu = Di.length; mr < zu; ++mr)
843
+ var ge = {}, Le = {}, At = {}, di = {};
844
+ di.byteLength = zu;
845
+ di.toByteArray = Ku;
846
+ di.fromByteArray = Ju;
847
+ var ht = [], Je = [], Wu = typeof Uint8Array < "u" ? Uint8Array : Array, Di = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
848
+ for (var mr = 0, Vu = Di.length; mr < Vu; ++mr)
849
849
  ht[mr] = Di[mr], Je[Di.charCodeAt(mr)] = mr;
850
850
  Je[45] = 62;
851
851
  Je[95] = 63;
@@ -858,30 +858,30 @@ function Pa(e) {
858
858
  var n = r === t ? 0 : 4 - r % 4;
859
859
  return [r, n];
860
860
  }
861
- function qu(e) {
861
+ function zu(e) {
862
862
  var t = Pa(e), r = t[0], n = t[1];
863
863
  return (r + n) * 3 / 4 - n;
864
864
  }
865
- function Ku(e, t, r) {
865
+ function qu(e, t, r) {
866
866
  return (t + r) * 3 / 4 - r;
867
867
  }
868
- function Yu(e) {
869
- var t, r = Pa(e), n = r[0], i = r[1], s = new Vu(Ku(e, n, i)), o = 0, a = i > 0 ? n - 4 : n, c;
868
+ function Ku(e) {
869
+ var t, r = Pa(e), n = r[0], i = r[1], s = new Wu(qu(e, n, i)), o = 0, a = i > 0 ? n - 4 : n, c;
870
870
  for (c = 0; c < a; c += 4)
871
871
  t = Je[e.charCodeAt(c)] << 18 | Je[e.charCodeAt(c + 1)] << 12 | Je[e.charCodeAt(c + 2)] << 6 | Je[e.charCodeAt(c + 3)], s[o++] = t >> 16 & 255, s[o++] = t >> 8 & 255, s[o++] = t & 255;
872
872
  return i === 2 && (t = Je[e.charCodeAt(c)] << 2 | Je[e.charCodeAt(c + 1)] >> 4, s[o++] = t & 255), i === 1 && (t = Je[e.charCodeAt(c)] << 10 | Je[e.charCodeAt(c + 1)] << 4 | Je[e.charCodeAt(c + 2)] >> 2, s[o++] = t >> 8 & 255, s[o++] = t & 255), s;
873
873
  }
874
- function Xu(e) {
874
+ function Yu(e) {
875
875
  return ht[e >> 18 & 63] + ht[e >> 12 & 63] + ht[e >> 6 & 63] + ht[e & 63];
876
876
  }
877
- function Ju(e, t, r) {
877
+ function Xu(e, t, r) {
878
878
  for (var n, i = [], s = t; s < r; s += 3)
879
- n = (e[s] << 16 & 16711680) + (e[s + 1] << 8 & 65280) + (e[s + 2] & 255), i.push(Xu(n));
879
+ n = (e[s] << 16 & 16711680) + (e[s + 1] << 8 & 65280) + (e[s + 2] & 255), i.push(Yu(n));
880
880
  return i.join("");
881
881
  }
882
- function Qu(e) {
882
+ function Ju(e) {
883
883
  for (var t, r = e.length, n = r % 3, i = [], s = 16383, o = 0, a = r - n; o < a; o += s)
884
- i.push(Ju(e, o, o + s > a ? a : o + s));
884
+ i.push(Xu(e, o, o + s > a ? a : o + s));
885
885
  return n === 1 ? (t = e[r - 1], i.push(
886
886
  ht[t >> 2] + ht[t << 4 & 63] + "=="
887
887
  )) : n === 2 && (t = (e[r - 2] << 8) + e[r - 1], i.push(
@@ -891,10 +891,10 @@ function Qu(e) {
891
891
  var Is = {};
892
892
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
893
893
  Is.read = function(e, t, r, n, i) {
894
- var s, o, a = i * 8 - n - 1, c = (1 << a) - 1, l = c >> 1, d = -7, b = r ? i - 1 : 0, x = r ? -1 : 1, p = e[t + b];
895
- for (b += x, s = p & (1 << -d) - 1, p >>= -d, d += a; d > 0; s = s * 256 + e[t + b], b += x, d -= 8)
894
+ var s, o, a = i * 8 - n - 1, c = (1 << a) - 1, l = c >> 1, d = -7, b = r ? i - 1 : 0, E = r ? -1 : 1, p = e[t + b];
895
+ for (b += E, s = p & (1 << -d) - 1, p >>= -d, d += a; d > 0; s = s * 256 + e[t + b], b += E, d -= 8)
896
896
  ;
897
- for (o = s & (1 << -d) - 1, s >>= -d, d += n; d > 0; o = o * 256 + e[t + b], b += x, d -= 8)
897
+ for (o = s & (1 << -d) - 1, s >>= -d, d += n; d > 0; o = o * 256 + e[t + b], b += E, d -= 8)
898
898
  ;
899
899
  if (s === 0)
900
900
  s = 1 - l;
@@ -906,8 +906,8 @@ Is.read = function(e, t, r, n, i) {
906
906
  return (p ? -1 : 1) * o * Math.pow(2, s - n);
907
907
  };
908
908
  Is.write = function(e, t, r, n, i, s) {
909
- var o, a, c, l = s * 8 - i - 1, d = (1 << l) - 1, b = d >> 1, x = i === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, p = n ? 0 : s - 1, I = n ? 1 : -1, B = t < 0 || t === 0 && 1 / t < 0 ? 1 : 0;
910
- for (t = Math.abs(t), isNaN(t) || t === 1 / 0 ? (a = isNaN(t) ? 1 : 0, o = d) : (o = Math.floor(Math.log(t) / Math.LN2), t * (c = Math.pow(2, -o)) < 1 && (o--, c *= 2), o + b >= 1 ? t += x / c : t += x * Math.pow(2, 1 - b), t * c >= 2 && (o++, c /= 2), o + b >= d ? (a = 0, o = d) : o + b >= 1 ? (a = (t * c - 1) * Math.pow(2, i), o = o + b) : (a = t * Math.pow(2, b - 1) * Math.pow(2, i), o = 0)); i >= 8; e[r + p] = a & 255, p += I, a /= 256, i -= 8)
909
+ var o, a, c, l = s * 8 - i - 1, d = (1 << l) - 1, b = d >> 1, E = i === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, p = n ? 0 : s - 1, I = n ? 1 : -1, B = t < 0 || t === 0 && 1 / t < 0 ? 1 : 0;
910
+ for (t = Math.abs(t), isNaN(t) || t === 1 / 0 ? (a = isNaN(t) ? 1 : 0, o = d) : (o = Math.floor(Math.log(t) / Math.LN2), t * (c = Math.pow(2, -o)) < 1 && (o--, c *= 2), o + b >= 1 ? t += E / c : t += E * Math.pow(2, 1 - b), t * c >= 2 && (o++, c /= 2), o + b >= d ? (a = 0, o = d) : o + b >= 1 ? (a = (t * c - 1) * Math.pow(2, i), o = o + b) : (a = t * Math.pow(2, b - 1) * Math.pow(2, i), o = 0)); i >= 8; e[r + p] = a & 255, p += I, a /= 256, i -= 8)
911
911
  ;
912
912
  for (o = o << i | a, l += i; l > 0; e[r + p] = o & 255, p += I, o /= 256, l -= 8)
913
913
  ;
@@ -968,7 +968,7 @@ Is.write = function(e, t, r, n, i, s) {
968
968
  a.poolSize = 8192;
969
969
  function c(h, f, u) {
970
970
  if (typeof h == "string")
971
- return x(h, f);
971
+ return E(h, f);
972
972
  if (ArrayBuffer.isView(h))
973
973
  return I(h);
974
974
  if (h == null)
@@ -1015,7 +1015,7 @@ Is.write = function(e, t, r, n, i, s) {
1015
1015
  }, a.allocUnsafeSlow = function(h) {
1016
1016
  return b(h);
1017
1017
  };
1018
- function x(h, f) {
1018
+ function E(h, f) {
1019
1019
  if ((typeof f != "string" || f === "") && (f = "utf8"), !a.isEncoding(f))
1020
1020
  throw new TypeError("Unknown encoding: " + f);
1021
1021
  const u = _(h, f) | 0;
@@ -1170,7 +1170,7 @@ Is.write = function(e, t, r, n, i, s) {
1170
1170
  case "utf-8":
1171
1171
  return W(this, f, u);
1172
1172
  case "ascii":
1173
- return fe(this, f, u);
1173
+ return ue(this, f, u);
1174
1174
  case "latin1":
1175
1175
  case "binary":
1176
1176
  return Ze(this, f, u);
@@ -1245,7 +1245,7 @@ Is.write = function(e, t, r, n, i, s) {
1245
1245
  }
1246
1246
  return L < Q ? -1 : Q < L ? 1 : 0;
1247
1247
  };
1248
- function E(h, f, u, y, v) {
1248
+ function x(h, f, u, y, v) {
1249
1249
  if (h.length === 0) return -1;
1250
1250
  if (typeof u == "string" ? (y = u, u = 0) : u > 2147483647 ? u = 2147483647 : u < -2147483648 && (u = -2147483648), u = +u, Yt(u) && (u = v ? 0 : h.length - 1), u < 0 && (u = h.length + u), u >= h.length) {
1251
1251
  if (v) return -1;
@@ -1292,9 +1292,9 @@ Is.write = function(e, t, r, n, i, s) {
1292
1292
  a.prototype.includes = function(f, u, y) {
1293
1293
  return this.indexOf(f, u, y) !== -1;
1294
1294
  }, a.prototype.indexOf = function(f, u, y) {
1295
- return E(this, f, u, y, !0);
1295
+ return x(this, f, u, y, !0);
1296
1296
  }, a.prototype.lastIndexOf = function(f, u, y) {
1297
- return E(this, f, u, y, !1);
1297
+ return x(this, f, u, y, !1);
1298
1298
  };
1299
1299
  function $(h, f, u, y) {
1300
1300
  u = Number(u) || 0;
@@ -1314,7 +1314,7 @@ Is.write = function(e, t, r, n, i, s) {
1314
1314
  return br(te(f, h.length - u), h, u, y);
1315
1315
  }
1316
1316
  function z(h, f, u, y) {
1317
- return br(Tt(f), h, u, y);
1317
+ return br(It(f), h, u, y);
1318
1318
  }
1319
1319
  function Z(h, f, u, y) {
1320
1320
  return br($r(f), h, u, y);
@@ -1394,10 +1394,10 @@ Is.write = function(e, t, r, n, i, s) {
1394
1394
  }
1395
1395
  L === null ? (L = 65533, Q = 1) : L > 65535 && (L -= 65536, y.push(L >>> 10 & 1023 | 55296), L = 56320 | L & 1023), y.push(L), v += Q;
1396
1396
  }
1397
- return ae(y);
1397
+ return fe(y);
1398
1398
  }
1399
1399
  const q = 4096;
1400
- function ae(h) {
1400
+ function fe(h) {
1401
1401
  const f = h.length;
1402
1402
  if (f <= q)
1403
1403
  return String.fromCharCode.apply(String, h);
@@ -1409,7 +1409,7 @@ Is.write = function(e, t, r, n, i, s) {
1409
1409
  );
1410
1410
  return u;
1411
1411
  }
1412
- function fe(h, f, u) {
1412
+ function ue(h, f, u) {
1413
1413
  let y = "";
1414
1414
  u = Math.min(h.length, u);
1415
1415
  for (let v = f; v < u; ++v)
@@ -1571,7 +1571,7 @@ Is.write = function(e, t, r, n, i, s) {
1571
1571
  let L = Number(f >> BigInt(32) & BigInt(4294967295));
1572
1572
  return h[u++] = L, L = L >> 8, h[u++] = L, L = L >> 8, h[u++] = L, L = L >> 8, h[u++] = L, u;
1573
1573
  }
1574
- function At(h, f, u, y, v) {
1574
+ function Tt(h, f, u, y, v) {
1575
1575
  g(f, y, v, h, u, 7);
1576
1576
  let O = Number(f & BigInt(4294967295));
1577
1577
  h[u + 7] = O, O = O >> 8, h[u + 6] = O, O = O >> 8, h[u + 5] = O, O = O >> 8, h[u + 4] = O;
@@ -1581,7 +1581,7 @@ Is.write = function(e, t, r, n, i, s) {
1581
1581
  a.prototype.writeBigUInt64LE = Ke(function(f, u = 0) {
1582
1582
  return We(this, f, u, BigInt(0), BigInt("0xffffffffffffffff"));
1583
1583
  }), a.prototype.writeBigUInt64BE = Ke(function(f, u = 0) {
1584
- return At(this, f, u, BigInt(0), BigInt("0xffffffffffffffff"));
1584
+ return Tt(this, f, u, BigInt(0), BigInt("0xffffffffffffffff"));
1585
1585
  }), a.prototype.writeIntLE = function(f, u, y, v) {
1586
1586
  if (f = +f, u = u >>> 0, !v) {
1587
1587
  const me = Math.pow(2, 8 * y - 1);
@@ -1613,14 +1613,14 @@ Is.write = function(e, t, r, n, i, s) {
1613
1613
  }, a.prototype.writeBigInt64LE = Ke(function(f, u = 0) {
1614
1614
  return We(this, f, u, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
1615
1615
  }), a.prototype.writeBigInt64BE = Ke(function(f, u = 0) {
1616
- return At(this, f, u, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
1616
+ return Tt(this, f, u, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
1617
1617
  });
1618
- function dt(h, f, u, y, v, O) {
1618
+ function pt(h, f, u, y, v, O) {
1619
1619
  if (u + y > h.length) throw new RangeError("Index out of range");
1620
1620
  if (u < 0) throw new RangeError("Index out of range");
1621
1621
  }
1622
1622
  function A(h, f, u, y, v) {
1623
- return f = +f, u = u >>> 0, v || dt(h, f, u, 4), r.write(h, f, u, y, 23, 4), u + 4;
1623
+ return f = +f, u = u >>> 0, v || pt(h, f, u, 4), r.write(h, f, u, y, 23, 4), u + 4;
1624
1624
  }
1625
1625
  a.prototype.writeFloatLE = function(f, u, y) {
1626
1626
  return A(this, f, u, !0, y);
@@ -1628,7 +1628,7 @@ Is.write = function(e, t, r, n, i, s) {
1628
1628
  return A(this, f, u, !1, y);
1629
1629
  };
1630
1630
  function P(h, f, u, y, v) {
1631
- return f = +f, u = u >>> 0, v || dt(h, f, u, 8), r.write(h, f, u, y, 52, 8), u + 8;
1631
+ return f = +f, u = u >>> 0, v || pt(h, f, u, 8), r.write(h, f, u, y, 52, 8), u + 8;
1632
1632
  }
1633
1633
  a.prototype.writeDoubleLE = function(f, u, y) {
1634
1634
  return P(this, f, u, !0, y);
@@ -1813,7 +1813,7 @@ Is.write = function(e, t, r, n, i, s) {
1813
1813
  }
1814
1814
  return O;
1815
1815
  }
1816
- function Tt(h) {
1816
+ function It(h) {
1817
1817
  const f = [];
1818
1818
  for (let u = 0; u < h.length; ++u)
1819
1819
  f.push(h.charCodeAt(u) & 255);
@@ -1856,7 +1856,7 @@ Is.write = function(e, t, r, n, i, s) {
1856
1856
  function Xt() {
1857
1857
  throw new Error("BigInt not supported");
1858
1858
  }
1859
- })(Pt);
1859
+ })(At);
1860
1860
  var pn = {
1861
1861
  Array: function(e) {
1862
1862
  return e != null && e.constructor === Array;
@@ -1895,7 +1895,7 @@ function Aa(e) {
1895
1895
  function ks(e) {
1896
1896
  return tr.Nil(e) ? "" : Aa(e.constructor);
1897
1897
  }
1898
- function Zu(e) {
1898
+ function Qu(e) {
1899
1899
  return tr.Function(e) ? "" : tr.String(e) ? JSON.stringify(e) : e && tr.Object(e) ? "" : e;
1900
1900
  }
1901
1901
  function Rs(e, t) {
@@ -1905,34 +1905,34 @@ function ti(e) {
1905
1905
  return tr.Function(e) ? e.toJSON ? e.toJSON() : Aa(e) : tr.Array(e) ? "Array" : e && tr.Object(e) ? "Object" : e !== void 0 ? e : "";
1906
1906
  }
1907
1907
  function Ta(e, t, r) {
1908
- var n = Zu(t);
1908
+ var n = Qu(t);
1909
1909
  return "Expected " + ti(e) + ", got" + (r !== "" ? " " + r : "") + (n !== "" ? " " + n : "");
1910
1910
  }
1911
- function xt(e, t, r) {
1912
- r = r || ks(t), this.message = Ta(e, t, r), Rs(this, xt), this.__type = e, this.__value = t, this.__valueTypeName = r;
1911
+ function St(e, t, r) {
1912
+ r = r || ks(t), this.message = Ta(e, t, r), Rs(this, St), this.__type = e, this.__value = t, this.__valueTypeName = r;
1913
1913
  }
1914
- xt.prototype = Object.create(Error.prototype);
1915
- xt.prototype.constructor = xt;
1916
- function ec(e, t, r, n, i) {
1914
+ St.prototype = Object.create(Error.prototype);
1915
+ St.prototype.constructor = St;
1916
+ function Zu(e, t, r, n, i) {
1917
1917
  var s = '" of type ';
1918
1918
  return t === "key" && (s = '" with key type '), Ta('property "' + ti(r) + s + ti(e), n, i);
1919
1919
  }
1920
1920
  function Pr(e, t, r, n, i) {
1921
- e ? (i = i || ks(n), this.message = ec(e, r, t, n, i)) : this.message = 'Unexpected property "' + t + '"', Rs(this, xt), this.__label = r, this.__property = t, this.__type = e, this.__value = n, this.__valueTypeName = i;
1921
+ e ? (i = i || ks(n), this.message = Zu(e, r, t, n, i)) : this.message = 'Unexpected property "' + t + '"', Rs(this, St), this.__label = r, this.__property = t, this.__type = e, this.__value = n, this.__valueTypeName = i;
1922
1922
  }
1923
1923
  Pr.prototype = Object.create(Error.prototype);
1924
- Pr.prototype.constructor = xt;
1925
- function tc(e, t) {
1926
- return new xt(e, {}, t);
1924
+ Pr.prototype.constructor = St;
1925
+ function ec(e, t) {
1926
+ return new St(e, {}, t);
1927
1927
  }
1928
- function rc(e, t, r) {
1928
+ function tc(e, t, r) {
1929
1929
  return e instanceof Pr ? (t = t + "." + e.__property, e = new Pr(
1930
1930
  e.__type,
1931
1931
  t,
1932
1932
  e.__label,
1933
1933
  e.__value,
1934
1934
  e.__valueTypeName
1935
- )) : e instanceof xt && (e = new Pr(
1935
+ )) : e instanceof St && (e = new Pr(
1936
1936
  e.__type,
1937
1937
  t,
1938
1938
  r,
@@ -1941,27 +1941,27 @@ function rc(e, t, r) {
1941
1941
  )), Rs(e), e;
1942
1942
  }
1943
1943
  var Ia = {
1944
- TfTypeError: xt,
1944
+ TfTypeError: St,
1945
1945
  TfPropertyTypeError: Pr,
1946
- tfCustomError: tc,
1947
- tfSubError: rc,
1946
+ tfCustomError: ec,
1947
+ tfSubError: tc,
1948
1948
  tfJSON: ti,
1949
1949
  getValueTypeName: ks
1950
1950
  }, $i, po;
1951
- function nc() {
1951
+ function rc() {
1952
1952
  if (po) return $i;
1953
1953
  po = 1;
1954
1954
  var e = Os, t = Ia;
1955
- function r(E) {
1956
- return Buffer.isBuffer(E);
1955
+ function r(x) {
1956
+ return Buffer.isBuffer(x);
1957
1957
  }
1958
- function n(E) {
1959
- return typeof E == "string" && /^([0-9a-f]{2})+$/i.test(E);
1958
+ function n(x) {
1959
+ return typeof x == "string" && /^([0-9a-f]{2})+$/i.test(x);
1960
1960
  }
1961
- function i(E, M) {
1962
- var $ = E.toJSON();
1961
+ function i(x, M) {
1962
+ var $ = x.toJSON();
1963
1963
  function R(z) {
1964
- if (!E(z)) return !1;
1964
+ if (!x(z)) return !1;
1965
1965
  if (z.length === M) return !0;
1966
1966
  throw t.tfCustomError($ + "(Length: " + M + ")", $ + "(Length: " + z.length + ")");
1967
1967
  }
@@ -1970,42 +1970,42 @@ function nc() {
1970
1970
  }, R;
1971
1971
  }
1972
1972
  var s = i.bind(null, e.Array), o = i.bind(null, r), a = i.bind(null, n), c = i.bind(null, e.String);
1973
- function l(E, M, $) {
1973
+ function l(x, M, $) {
1974
1974
  $ = $ || e.Number;
1975
1975
  function R(z, Z) {
1976
- return $(z, Z) && z > E && z < M;
1976
+ return $(z, Z) && z > x && z < M;
1977
1977
  }
1978
1978
  return R.toJSON = function() {
1979
- return `${$.toJSON()} between [${E}, ${M}]`;
1979
+ return `${$.toJSON()} between [${x}, ${M}]`;
1980
1980
  }, R;
1981
1981
  }
1982
1982
  var d = Math.pow(2, 53) - 1;
1983
- function b(E) {
1984
- return typeof E == "number" && isFinite(E);
1983
+ function b(x) {
1984
+ return typeof x == "number" && isFinite(x);
1985
1985
  }
1986
- function x(E) {
1987
- return E << 24 >> 24 === E;
1986
+ function E(x) {
1987
+ return x << 24 >> 24 === x;
1988
1988
  }
1989
- function p(E) {
1990
- return E << 16 >> 16 === E;
1989
+ function p(x) {
1990
+ return x << 16 >> 16 === x;
1991
1991
  }
1992
- function I(E) {
1993
- return (E | 0) === E;
1992
+ function I(x) {
1993
+ return (x | 0) === x;
1994
1994
  }
1995
- function B(E) {
1996
- return typeof E == "number" && E >= -d && E <= d && Math.floor(E) === E;
1995
+ function B(x) {
1996
+ return typeof x == "number" && x >= -d && x <= d && Math.floor(x) === x;
1997
1997
  }
1998
- function T(E) {
1999
- return (E & 255) === E;
1998
+ function T(x) {
1999
+ return (x & 255) === x;
2000
2000
  }
2001
- function k(E) {
2002
- return (E & 65535) === E;
2001
+ function k(x) {
2002
+ return (x & 65535) === x;
2003
2003
  }
2004
- function U(E) {
2005
- return E >>> 0 === E;
2004
+ function U(x) {
2005
+ return x >>> 0 === x;
2006
2006
  }
2007
- function _(E) {
2008
- return typeof E == "number" && E >= 0 && E <= d && Math.floor(E) === E;
2007
+ function _(x) {
2008
+ return typeof x == "number" && x >= 0 && x <= d && Math.floor(x) === x;
2009
2009
  }
2010
2010
  var m = {
2011
2011
  ArrayN: s,
@@ -2014,7 +2014,7 @@ function nc() {
2014
2014
  Finite: b,
2015
2015
  Hex: n,
2016
2016
  HexN: a,
2017
- Int8: x,
2017
+ Int8: E,
2018
2018
  Int16: p,
2019
2019
  Int32: I,
2020
2020
  Int53: B,
@@ -2026,16 +2026,16 @@ function nc() {
2026
2026
  UInt53: _
2027
2027
  };
2028
2028
  for (var S in m)
2029
- m[S].toJSON = (function(E) {
2030
- return E;
2029
+ m[S].toJSON = (function(x) {
2030
+ return x;
2031
2031
  }).bind(null, S);
2032
2032
  return $i = m, $i;
2033
2033
  }
2034
- var wn = Ia, Ae = Os, pt = wn.tfJSON, Oa = wn.TfTypeError, ka = wn.TfPropertyTypeError, Wr = wn.tfSubError, ic = wn.getValueTypeName, _t = {
2034
+ var wn = Ia, Pe = Os, yt = wn.tfJSON, Oa = wn.TfTypeError, ka = wn.TfPropertyTypeError, Wr = wn.tfSubError, nc = wn.getValueTypeName, vt = {
2035
2035
  arrayOf: function(t, r) {
2036
2036
  t = ct(t), r = r || {};
2037
2037
  function n(i, s) {
2038
- return !Ae.Array(i) || Ae.Nil(i) || r.minLength !== void 0 && i.length < r.minLength || r.maxLength !== void 0 && i.length > r.maxLength || r.length !== void 0 && i.length !== r.length ? !1 : i.every(function(o, a) {
2038
+ return !Pe.Array(i) || Pe.Nil(i) || r.minLength !== void 0 && i.length < r.minLength || r.maxLength !== void 0 && i.length > r.maxLength || r.length !== void 0 && i.length !== r.length ? !1 : i.every(function(o, a) {
2039
2039
  try {
2040
2040
  return $e(t, o, s);
2041
2041
  } catch (c) {
@@ -2044,23 +2044,23 @@ var wn = Ia, Ae = Os, pt = wn.tfJSON, Oa = wn.TfTypeError, ka = wn.TfPropertyTyp
2044
2044
  });
2045
2045
  }
2046
2046
  return n.toJSON = function() {
2047
- var i = "[" + pt(t) + "]";
2047
+ var i = "[" + yt(t) + "]";
2048
2048
  return r.length !== void 0 ? i += "{" + r.length + "}" : (r.minLength !== void 0 || r.maxLength !== void 0) && (i += "{" + (r.minLength === void 0 ? 0 : r.minLength) + "," + (r.maxLength === void 0 ? 1 / 0 : r.maxLength) + "}"), i;
2049
2049
  }, n;
2050
2050
  },
2051
2051
  maybe: function e(t) {
2052
2052
  t = ct(t);
2053
2053
  function r(n, i) {
2054
- return Ae.Nil(n) || t(n, i, e);
2054
+ return Pe.Nil(n) || t(n, i, e);
2055
2055
  }
2056
2056
  return r.toJSON = function() {
2057
- return "?" + pt(t);
2057
+ return "?" + yt(t);
2058
2058
  }, r;
2059
2059
  },
2060
2060
  map: function(t, r) {
2061
2061
  t = ct(t), r && (r = ct(r));
2062
2062
  function n(i, s) {
2063
- if (!Ae.Object(i) || Ae.Nil(i)) return !1;
2063
+ if (!Pe.Object(i) || Pe.Nil(i)) return !1;
2064
2064
  for (var o in i) {
2065
2065
  try {
2066
2066
  r && $e(r, o, s);
@@ -2077,9 +2077,9 @@ var wn = Ia, Ae = Os, pt = wn.tfJSON, Oa = wn.TfTypeError, ka = wn.TfPropertyTyp
2077
2077
  return !0;
2078
2078
  }
2079
2079
  return r ? n.toJSON = function() {
2080
- return "{" + pt(r) + ": " + pt(t) + "}";
2080
+ return "{" + yt(r) + ": " + yt(t) + "}";
2081
2081
  } : n.toJSON = function() {
2082
- return "{" + pt(t) + "}";
2082
+ return "{" + yt(t) + "}";
2083
2083
  }, n;
2084
2084
  },
2085
2085
  object: function(t) {
@@ -2087,7 +2087,7 @@ var wn = Ia, Ae = Os, pt = wn.tfJSON, Oa = wn.TfTypeError, ka = wn.TfPropertyTyp
2087
2087
  for (var n in t)
2088
2088
  r[n] = ct(t[n]);
2089
2089
  function i(s, o) {
2090
- if (!Ae.Object(s) || Ae.Nil(s)) return !1;
2090
+ if (!Pe.Object(s) || Pe.Nil(s)) return !1;
2091
2091
  var a;
2092
2092
  try {
2093
2093
  for (a in r) {
@@ -2105,7 +2105,7 @@ var wn = Ia, Ae = Os, pt = wn.tfJSON, Oa = wn.TfTypeError, ka = wn.TfPropertyTyp
2105
2105
  return !0;
2106
2106
  }
2107
2107
  return i.toJSON = function() {
2108
- return pt(r);
2108
+ return yt(r);
2109
2109
  }, i;
2110
2110
  },
2111
2111
  anyOf: function() {
@@ -2120,7 +2120,7 @@ var wn = Ia, Ae = Os, pt = wn.tfJSON, Oa = wn.TfTypeError, ka = wn.TfPropertyTyp
2120
2120
  });
2121
2121
  }
2122
2122
  return r.toJSON = function() {
2123
- return t.map(pt).join("|");
2123
+ return t.map(yt).join("|");
2124
2124
  }, r;
2125
2125
  },
2126
2126
  allOf: function() {
@@ -2135,12 +2135,12 @@ var wn = Ia, Ae = Os, pt = wn.tfJSON, Oa = wn.TfTypeError, ka = wn.TfPropertyTyp
2135
2135
  });
2136
2136
  }
2137
2137
  return r.toJSON = function() {
2138
- return t.map(pt).join(" & ");
2138
+ return t.map(yt).join(" & ");
2139
2139
  }, r;
2140
2140
  },
2141
2141
  quacksLike: function(t) {
2142
2142
  function r(n) {
2143
- return t === ic(n);
2143
+ return t === nc(n);
2144
2144
  }
2145
2145
  return r.toJSON = function() {
2146
2146
  return t;
@@ -2149,7 +2149,7 @@ var wn = Ia, Ae = Os, pt = wn.tfJSON, Oa = wn.TfTypeError, ka = wn.TfPropertyTyp
2149
2149
  tuple: function() {
2150
2150
  var t = [].slice.call(arguments).map(ct);
2151
2151
  function r(n, i) {
2152
- return Ae.Nil(n) || Ae.Nil(n.length) || i && n.length !== t.length ? !1 : t.every(function(s, o) {
2152
+ return Pe.Nil(n) || Pe.Nil(n.length) || i && n.length !== t.length ? !1 : t.every(function(s, o) {
2153
2153
  try {
2154
2154
  return $e(s, n[o], i);
2155
2155
  } catch (a) {
@@ -2158,7 +2158,7 @@ var wn = Ia, Ae = Os, pt = wn.tfJSON, Oa = wn.TfTypeError, ka = wn.TfPropertyTyp
2158
2158
  });
2159
2159
  }
2160
2160
  return r.toJSON = function() {
2161
- return "(" + t.map(pt).join(", ") + ")";
2161
+ return "(" + t.map(yt).join(", ") + ")";
2162
2162
  }, r;
2163
2163
  },
2164
2164
  value: function(t) {
@@ -2170,54 +2170,54 @@ var wn = Ia, Ae = Os, pt = wn.tfJSON, Oa = wn.TfTypeError, ka = wn.TfPropertyTyp
2170
2170
  }, r;
2171
2171
  }
2172
2172
  };
2173
- _t.oneOf = _t.anyOf;
2173
+ vt.oneOf = vt.anyOf;
2174
2174
  function ct(e) {
2175
- if (Ae.String(e))
2176
- return e[0] === "?" ? _t.maybe(e.slice(1)) : Ae[e] || _t.quacksLike(e);
2177
- if (e && Ae.Object(e)) {
2178
- if (Ae.Array(e)) {
2175
+ if (Pe.String(e))
2176
+ return e[0] === "?" ? vt.maybe(e.slice(1)) : Pe[e] || vt.quacksLike(e);
2177
+ if (e && Pe.Object(e)) {
2178
+ if (Pe.Array(e)) {
2179
2179
  if (e.length !== 1) throw new TypeError("Expected compile() parameter of type Array of length 1");
2180
- return _t.arrayOf(e[0]);
2180
+ return vt.arrayOf(e[0]);
2181
2181
  }
2182
- return _t.object(e);
2183
- } else if (Ae.Function(e))
2182
+ return vt.object(e);
2183
+ } else if (Pe.Function(e))
2184
2184
  return e;
2185
- return _t.value(e);
2185
+ return vt.value(e);
2186
2186
  }
2187
2187
  function $e(e, t, r, n) {
2188
- if (Ae.Function(e)) {
2188
+ if (Pe.Function(e)) {
2189
2189
  if (e(t, r)) return !0;
2190
2190
  throw new Oa(n || e, t);
2191
2191
  }
2192
2192
  return $e(ct(e), t, r);
2193
2193
  }
2194
- for (var Dt in Ae)
2195
- $e[Dt] = Ae[Dt];
2196
- for (Dt in _t)
2197
- $e[Dt] = _t[Dt];
2198
- var yo = nc();
2199
- for (Dt in yo)
2200
- $e[Dt] = yo[Dt];
2194
+ for (var $t in Pe)
2195
+ $e[$t] = Pe[$t];
2196
+ for ($t in vt)
2197
+ $e[$t] = vt[$t];
2198
+ var yo = rc();
2199
+ for ($t in yo)
2200
+ $e[$t] = yo[$t];
2201
2201
  $e.compile = ct;
2202
2202
  $e.TfTypeError = Oa;
2203
2203
  $e.TfPropertyTypeError = ka;
2204
2204
  var Ra = $e;
2205
2205
  (function(e) {
2206
2206
  Object.defineProperty(e, "__esModule", { value: !0 }), e.oneOf = e.Null = e.BufferN = e.Function = e.UInt32 = e.UInt8 = e.tuple = e.maybe = e.Hex = e.Buffer = e.String = e.Boolean = e.Array = e.Number = e.Hash256bit = e.Hash160bit = e.Buffer256bit = e.isTaptree = e.isTapleaf = e.TAPLEAF_VERSION_MASK = e.Satoshi = e.isPoint = e.stacksEqual = e.typeforce = void 0;
2207
- const t = Pt;
2207
+ const t = At;
2208
2208
  e.typeforce = Ra;
2209
2209
  const r = t.Buffer.alloc(32, 0), n = t.Buffer.from(
2210
2210
  "fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f",
2211
2211
  "hex"
2212
2212
  );
2213
2213
  function i(d, b) {
2214
- return d.length !== b.length ? !1 : d.every((x, p) => x.equals(b[p]));
2214
+ return d.length !== b.length ? !1 : d.every((E, p) => E.equals(b[p]));
2215
2215
  }
2216
2216
  e.stacksEqual = i;
2217
2217
  function s(d) {
2218
2218
  if (!t.Buffer.isBuffer(d) || d.length < 33) return !1;
2219
- const b = d[0], x = d.slice(1, 33);
2220
- if (x.compare(r) === 0 || x.compare(n) >= 0) return !1;
2219
+ const b = d[0], E = d.slice(1, 33);
2220
+ if (E.compare(r) === 0 || E.compare(n) >= 0) return !1;
2221
2221
  if ((b === 2 || b === 3) && d.length === 33)
2222
2222
  return !0;
2223
2223
  const p = d.slice(33);
@@ -2238,11 +2238,11 @@ var Ra = $e;
2238
2238
  }
2239
2239
  e.isTaptree = l, e.Buffer256bit = e.typeforce.BufferN(32), e.Hash160bit = e.typeforce.BufferN(20), e.Hash256bit = e.typeforce.BufferN(32), e.Number = e.typeforce.Number, e.Array = e.typeforce.Array, e.Boolean = e.typeforce.Boolean, e.String = e.typeforce.String, e.Buffer = e.typeforce.Buffer, e.Hex = e.typeforce.Hex, e.maybe = e.typeforce.maybe, e.tuple = e.typeforce.tuple, e.UInt8 = e.typeforce.UInt8, e.UInt32 = e.typeforce.UInt32, e.Function = e.typeforce.Function, e.BufferN = e.typeforce.BufferN, e.Null = e.typeforce.Null, e.oneOf = e.typeforce.oneOf;
2240
2240
  })(Le);
2241
- var gn = {}, Te = {};
2242
- Object.defineProperty(Te, "__esModule", { value: !0 });
2243
- Te.BufferReader = Te.BufferWriter = Te.cloneBuffer = Te.reverseBuffer = Te.writeUInt64LE = Te.readUInt64LE = Te.varuint = void 0;
2244
- const rr = Le, { typeforce: Ua } = rr, yn = Su;
2245
- Te.varuint = yn;
2241
+ var gn = {}, Ae = {};
2242
+ Object.defineProperty(Ae, "__esModule", { value: !0 });
2243
+ Ae.BufferReader = Ae.BufferWriter = Ae.cloneBuffer = Ae.reverseBuffer = Ae.writeUInt64LE = Ae.readUInt64LE = Ae.varuint = void 0;
2244
+ const rr = Le, { typeforce: Ua } = rr, yn = xu;
2245
+ Ae.varuint = yn;
2246
2246
  function Ca(e, t) {
2247
2247
  if (typeof e != "number")
2248
2248
  throw new Error("cannot write a non-number as a number");
@@ -2257,24 +2257,24 @@ function La(e, t) {
2257
2257
  let n = e.readUInt32LE(t + 4);
2258
2258
  return n *= 4294967296, Ca(n + r, 9007199254740991), n + r;
2259
2259
  }
2260
- Te.readUInt64LE = La;
2260
+ Ae.readUInt64LE = La;
2261
2261
  function Na(e, t, r) {
2262
2262
  return Ca(t, 9007199254740991), e.writeInt32LE(t & -1, r), e.writeUInt32LE(Math.floor(t / 4294967296), r + 4), r + 8;
2263
2263
  }
2264
- Te.writeUInt64LE = Na;
2265
- function sc(e) {
2264
+ Ae.writeUInt64LE = Na;
2265
+ function ic(e) {
2266
2266
  if (e.length < 1) return e;
2267
2267
  let t = e.length - 1, r = 0;
2268
2268
  for (let n = 0; n < e.length / 2; n++)
2269
2269
  r = e[n], e[n] = e[t], e[t] = r, t--;
2270
2270
  return e;
2271
2271
  }
2272
- Te.reverseBuffer = sc;
2273
- function oc(e) {
2272
+ Ae.reverseBuffer = ic;
2273
+ function sc(e) {
2274
2274
  const t = Buffer.allocUnsafe(e.length);
2275
2275
  return e.copy(t), t;
2276
2276
  }
2277
- Te.cloneBuffer = oc;
2277
+ Ae.cloneBuffer = sc;
2278
2278
  class Us {
2279
2279
  static withCapacity(t) {
2280
2280
  return new Us(Buffer.alloc(t));
@@ -2314,8 +2314,8 @@ class Us {
2314
2314
  throw new Error(`buffer size ${this.buffer.length}, offset ${this.offset}`);
2315
2315
  }
2316
2316
  }
2317
- Te.BufferWriter = Us;
2318
- class ac {
2317
+ Ae.BufferWriter = Us;
2318
+ class oc {
2319
2319
  constructor(t, r = 0) {
2320
2320
  this.buffer = t, this.offset = r, Ua(rr.tuple(rr.Buffer, rr.UInt32), [t, r]);
2321
2321
  }
@@ -2354,8 +2354,8 @@ class ac {
2354
2354
  return r;
2355
2355
  }
2356
2356
  }
2357
- Te.BufferReader = ac;
2358
- var Wt = {}, kr = {}, lt = {}, tt = {};
2357
+ Ae.BufferReader = oc;
2358
+ var Vt = {}, kr = {}, lt = {}, tt = {};
2359
2359
  Object.defineProperty(tt, "__esModule", { value: !0 });
2360
2360
  tt.isBytes = Ha;
2361
2361
  tt.number = ri;
@@ -2398,15 +2398,15 @@ function $a(e, t) {
2398
2398
  if (e.length < r)
2399
2399
  throw new Error(`digestInto() expects output buffer of length at least ${r}`);
2400
2400
  }
2401
- const fc = { number: ri, bool: Fa, bytes: Cs, hash: Ma, exists: Da, output: $a };
2402
- tt.default = fc;
2401
+ const ac = { number: ri, bool: Fa, bytes: Cs, hash: Ma, exists: Da, output: $a };
2402
+ tt.default = ac;
2403
2403
  var mn = {}, pi = {};
2404
2404
  Object.defineProperty(pi, "__esModule", { value: !0 });
2405
2405
  pi.crypto = void 0;
2406
2406
  pi.crypto = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
2407
2407
  (function(e) {
2408
2408
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
2409
- Object.defineProperty(e, "__esModule", { value: !0 }), e.Hash = e.nextTick = e.byteSwapIfBE = e.byteSwap = e.isLE = e.rotl = e.rotr = e.createView = e.u32 = e.u8 = void 0, e.isBytes = n, e.byteSwap32 = d, e.bytesToHex = x, e.hexToBytes = B, e.asyncLoop = k, e.utf8ToBytes = U, e.toBytes = _, e.concatBytes = m, e.checkOpts = M, e.wrapConstructor = $, e.wrapConstructorWithOpts = R, e.wrapXOFConstructorWithOpts = z, e.randomBytes = Z;
2409
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.Hash = e.nextTick = e.byteSwapIfBE = e.byteSwap = e.isLE = e.rotl = e.rotr = e.createView = e.u32 = e.u8 = void 0, e.isBytes = n, e.byteSwap32 = d, e.bytesToHex = E, e.hexToBytes = B, e.asyncLoop = k, e.utf8ToBytes = U, e.toBytes = _, e.concatBytes = m, e.checkOpts = M, e.wrapConstructor = $, e.wrapConstructorWithOpts = R, e.wrapXOFConstructorWithOpts = z, e.randomBytes = Z;
2410
2410
  const t = pi, r = tt;
2411
2411
  function n(C) {
2412
2412
  return C instanceof Uint8Array || C != null && typeof C == "object" && C.constructor.name === "Uint8Array";
@@ -2428,7 +2428,7 @@ pi.crypto = typeof globalThis == "object" && "crypto" in globalThis ? globalThis
2428
2428
  C[H] = (0, e.byteSwap)(C[H]);
2429
2429
  }
2430
2430
  const b = /* @__PURE__ */ Array.from({ length: 256 }, (C, H) => H.toString(16).padStart(2, "0"));
2431
- function x(C) {
2431
+ function E(C) {
2432
2432
  (0, r.bytes)(C);
2433
2433
  let H = "";
2434
2434
  for (let W = 0; W < C.length; W++)
@@ -2451,13 +2451,13 @@ pi.crypto = typeof globalThis == "object" && "crypto" in globalThis ? globalThis
2451
2451
  if (H % 2)
2452
2452
  throw new Error("padded hex string expected, got unpadded hex of length " + H);
2453
2453
  const q = new Uint8Array(W);
2454
- for (let ae = 0, fe = 0; ae < W; ae++, fe += 2) {
2455
- const Ze = I(C.charCodeAt(fe)), Ge = I(C.charCodeAt(fe + 1));
2454
+ for (let fe = 0, ue = 0; fe < W; fe++, ue += 2) {
2455
+ const Ze = I(C.charCodeAt(ue)), Ge = I(C.charCodeAt(ue + 1));
2456
2456
  if (Ze === void 0 || Ge === void 0) {
2457
- const nt = C[fe] + C[fe + 1];
2458
- throw new Error('hex string expected, got non-hex character "' + nt + '" at index ' + fe);
2457
+ const nt = C[ue] + C[ue + 1];
2458
+ throw new Error('hex string expected, got non-hex character "' + nt + '" at index ' + ue);
2459
2459
  }
2460
- q[ae] = Ze * 16 + Ge;
2460
+ q[fe] = Ze * 16 + Ge;
2461
2461
  }
2462
2462
  return q;
2463
2463
  }
@@ -2466,10 +2466,10 @@ pi.crypto = typeof globalThis == "object" && "crypto" in globalThis ? globalThis
2466
2466
  e.nextTick = T;
2467
2467
  async function k(C, H, W) {
2468
2468
  let q = Date.now();
2469
- for (let ae = 0; ae < C; ae++) {
2470
- W(ae);
2471
- const fe = Date.now() - q;
2472
- fe >= 0 && fe < H || (await (0, e.nextTick)(), q += fe);
2469
+ for (let fe = 0; fe < C; fe++) {
2470
+ W(fe);
2471
+ const ue = Date.now() - q;
2472
+ ue >= 0 && ue < H || (await (0, e.nextTick)(), q += ue);
2473
2473
  }
2474
2474
  }
2475
2475
  function U(C) {
@@ -2483,13 +2483,13 @@ pi.crypto = typeof globalThis == "object" && "crypto" in globalThis ? globalThis
2483
2483
  function m(...C) {
2484
2484
  let H = 0;
2485
2485
  for (let q = 0; q < C.length; q++) {
2486
- const ae = C[q];
2487
- (0, r.bytes)(ae), H += ae.length;
2486
+ const fe = C[q];
2487
+ (0, r.bytes)(fe), H += fe.length;
2488
2488
  }
2489
2489
  const W = new Uint8Array(H);
2490
- for (let q = 0, ae = 0; q < C.length; q++) {
2491
- const fe = C[q];
2492
- W.set(fe, ae), ae += fe.length;
2490
+ for (let q = 0, fe = 0; q < C.length; q++) {
2491
+ const ue = C[q];
2492
+ W.set(ue, fe), fe += ue.length;
2493
2493
  }
2494
2494
  return W;
2495
2495
  }
@@ -2500,9 +2500,9 @@ pi.crypto = typeof globalThis == "object" && "crypto" in globalThis ? globalThis
2500
2500
  }
2501
2501
  }
2502
2502
  e.Hash = S;
2503
- const E = {}.toString;
2503
+ const x = {}.toString;
2504
2504
  function M(C, H) {
2505
- if (H !== void 0 && E.call(H) !== "[object Object]")
2505
+ if (H !== void 0 && x.call(H) !== "[object Object]")
2506
2506
  throw new Error("Options should be object or undefined");
2507
2507
  return Object.assign(C, H);
2508
2508
  }
@@ -2511,11 +2511,11 @@ pi.crypto = typeof globalThis == "object" && "crypto" in globalThis ? globalThis
2511
2511
  return H.outputLen = W.outputLen, H.blockLen = W.blockLen, H.create = () => C(), H;
2512
2512
  }
2513
2513
  function R(C) {
2514
- const H = (q, ae) => C(ae).update(_(q)).digest(), W = C({});
2514
+ const H = (q, fe) => C(fe).update(_(q)).digest(), W = C({});
2515
2515
  return H.outputLen = W.outputLen, H.blockLen = W.blockLen, H.create = (q) => C(q), H;
2516
2516
  }
2517
2517
  function z(C) {
2518
- const H = (q, ae) => C(ae).update(_(q)).digest(), W = C({});
2518
+ const H = (q, fe) => C(fe).update(_(q)).digest(), W = C({});
2519
2519
  return H.outputLen = W.outputLen, H.blockLen = W.blockLen, H.create = (q) => C(q), H;
2520
2520
  }
2521
2521
  function Z(C = 32) {
@@ -2529,17 +2529,17 @@ pi.crypto = typeof globalThis == "object" && "crypto" in globalThis ? globalThis
2529
2529
  Object.defineProperty(lt, "__esModule", { value: !0 });
2530
2530
  lt.HashMD = lt.Maj = lt.Chi = void 0;
2531
2531
  const ji = tt, Vr = mn;
2532
- function uc(e, t, r, n) {
2532
+ function fc(e, t, r, n) {
2533
2533
  if (typeof e.setBigUint64 == "function")
2534
2534
  return e.setBigUint64(t, r, n);
2535
2535
  const i = BigInt(32), s = BigInt(4294967295), o = Number(r >> i & s), a = Number(r & s), c = n ? 4 : 0, l = n ? 0 : 4;
2536
2536
  e.setUint32(t + c, o, n), e.setUint32(t + l, a, n);
2537
2537
  }
2538
- const cc = (e, t, r) => e & t ^ ~e & r;
2539
- lt.Chi = cc;
2540
- const hc = (e, t, r) => e & t ^ e & r ^ t & r;
2541
- lt.Maj = hc;
2542
- let lc = class extends Vr.Hash {
2538
+ const uc = (e, t, r) => e & t ^ ~e & r;
2539
+ lt.Chi = uc;
2540
+ const cc = (e, t, r) => e & t ^ e & r ^ t & r;
2541
+ lt.Maj = cc;
2542
+ let hc = class extends Vr.Hash {
2543
2543
  constructor(t, r, n, i) {
2544
2544
  super(), this.blockLen = t, this.outputLen = r, this.padOffset = n, this.isLE = i, this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.buffer = new Uint8Array(t), this.view = (0, Vr.createView)(this.buffer);
2545
2545
  }
@@ -2567,7 +2567,7 @@ let lc = class extends Vr.Hash {
2567
2567
  r[o++] = 128, this.buffer.subarray(o).fill(0), this.padOffset > i - o && (this.process(n, 0), o = 0);
2568
2568
  for (let b = o; b < i; b++)
2569
2569
  r[b] = 0;
2570
- uc(n, i - 8, BigInt(this.length * 8), s), this.process(n, 0);
2570
+ fc(n, i - 8, BigInt(this.length * 8), s), this.process(n, 0);
2571
2571
  const a = (0, Vr.createView)(t), c = this.outputLen;
2572
2572
  if (c % 4)
2573
2573
  throw new Error("_sha2: outputLen should be aligned to 32bit");
@@ -2589,27 +2589,27 @@ let lc = class extends Vr.Hash {
2589
2589
  return t.length = i, t.pos = a, t.finished = s, t.destroyed = o, i % r && t.buffer.set(n), t;
2590
2590
  }
2591
2591
  };
2592
- lt.HashMD = lc;
2592
+ lt.HashMD = hc;
2593
2593
  Object.defineProperty(kr, "__esModule", { value: !0 });
2594
2594
  kr.ripemd160 = kr.RIPEMD160 = void 0;
2595
- const dc = lt, an = mn, pc = /* @__PURE__ */ new Uint8Array([7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8]), ja = /* @__PURE__ */ new Uint8Array(new Array(16).fill(0).map((e, t) => t)), yc = /* @__PURE__ */ ja.map((e) => (9 * e + 5) % 16);
2596
- let Ls = [ja], Ns = [yc];
2595
+ const lc = lt, an = mn, dc = /* @__PURE__ */ new Uint8Array([7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8]), ja = /* @__PURE__ */ new Uint8Array(new Array(16).fill(0).map((e, t) => t)), pc = /* @__PURE__ */ ja.map((e) => (9 * e + 5) % 16);
2596
+ let Ls = [ja], Ns = [pc];
2597
2597
  for (let e = 0; e < 4; e++)
2598
2598
  for (let t of [Ls, Ns])
2599
- t.push(t[e].map((r) => pc[r]));
2599
+ t.push(t[e].map((r) => dc[r]));
2600
2600
  const Ga = /* @__PURE__ */ [
2601
2601
  [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],
2602
2602
  [12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7],
2603
2603
  [13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],
2604
2604
  [14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],
2605
2605
  [15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5]
2606
- ].map((e) => new Uint8Array(e)), bc = /* @__PURE__ */ Ls.map((e, t) => e.map((r) => Ga[t][r])), wc = /* @__PURE__ */ Ns.map((e, t) => e.map((r) => Ga[t][r])), gc = /* @__PURE__ */ new Uint32Array([
2606
+ ].map((e) => new Uint8Array(e)), yc = /* @__PURE__ */ Ls.map((e, t) => e.map((r) => Ga[t][r])), bc = /* @__PURE__ */ Ns.map((e, t) => e.map((r) => Ga[t][r])), wc = /* @__PURE__ */ new Uint32Array([
2607
2607
  0,
2608
2608
  1518500249,
2609
2609
  1859775393,
2610
2610
  2400959708,
2611
2611
  2840853838
2612
- ]), mc = /* @__PURE__ */ new Uint32Array([
2612
+ ]), gc = /* @__PURE__ */ new Uint32Array([
2613
2613
  1352829926,
2614
2614
  1548603684,
2615
2615
  1836072691,
@@ -2620,7 +2620,7 @@ function bo(e, t, r, n) {
2620
2620
  return e === 0 ? t ^ r ^ n : e === 1 ? t & r | ~t & n : e === 2 ? (t | ~r) ^ n : e === 3 ? t & n | r & ~n : t ^ (r | ~n);
2621
2621
  }
2622
2622
  const Un = /* @__PURE__ */ new Uint32Array(16);
2623
- let Wa = class extends dc.HashMD {
2623
+ let Wa = class extends lc.HashMD {
2624
2624
  constructor() {
2625
2625
  super(64, 20, 8, !0), this.h0 = 1732584193, this.h1 = -271733879, this.h2 = -1732584194, this.h3 = 271733878, this.h4 = -1009589776;
2626
2626
  }
@@ -2634,19 +2634,19 @@ let Wa = class extends dc.HashMD {
2634
2634
  process(t, r) {
2635
2635
  for (let p = 0; p < 16; p++, r += 4)
2636
2636
  Un[p] = t.getUint32(r, !0);
2637
- let n = this.h0 | 0, i = n, s = this.h1 | 0, o = s, a = this.h2 | 0, c = a, l = this.h3 | 0, d = l, b = this.h4 | 0, x = b;
2637
+ let n = this.h0 | 0, i = n, s = this.h1 | 0, o = s, a = this.h2 | 0, c = a, l = this.h3 | 0, d = l, b = this.h4 | 0, E = b;
2638
2638
  for (let p = 0; p < 5; p++) {
2639
- const I = 4 - p, B = gc[p], T = mc[p], k = Ls[p], U = Ns[p], _ = bc[p], m = wc[p];
2639
+ const I = 4 - p, B = wc[p], T = gc[p], k = Ls[p], U = Ns[p], _ = yc[p], m = bc[p];
2640
2640
  for (let S = 0; S < 16; S++) {
2641
- const E = (0, an.rotl)(n + bo(p, s, a, l) + Un[k[S]] + B, _[S]) + b | 0;
2642
- n = b, b = l, l = (0, an.rotl)(a, 10) | 0, a = s, s = E;
2641
+ const x = (0, an.rotl)(n + bo(p, s, a, l) + Un[k[S]] + B, _[S]) + b | 0;
2642
+ n = b, b = l, l = (0, an.rotl)(a, 10) | 0, a = s, s = x;
2643
2643
  }
2644
2644
  for (let S = 0; S < 16; S++) {
2645
- const E = (0, an.rotl)(i + bo(I, o, c, d) + Un[U[S]] + T, m[S]) + x | 0;
2646
- i = x, x = d, d = (0, an.rotl)(c, 10) | 0, c = o, o = E;
2645
+ const x = (0, an.rotl)(i + bo(I, o, c, d) + Un[U[S]] + T, m[S]) + E | 0;
2646
+ i = E, E = d, d = (0, an.rotl)(c, 10) | 0, c = o, o = x;
2647
2647
  }
2648
2648
  }
2649
- this.set(this.h1 + a + d | 0, this.h2 + l + x | 0, this.h3 + b + i | 0, this.h4 + n + o | 0, this.h0 + s + c | 0);
2649
+ this.set(this.h1 + a + d | 0, this.h2 + l + E | 0, this.h3 + b + i | 0, this.h4 + n + o | 0, this.h0 + s + c | 0);
2650
2650
  }
2651
2651
  roundClean() {
2652
2652
  Un.fill(0);
@@ -2666,7 +2666,7 @@ const Gi = lt, zn = mn, zr = /* @__PURE__ */ new Uint32Array([
2666
2666
  2562383102,
2667
2667
  271733878,
2668
2668
  3285377520
2669
- ]), Ot = /* @__PURE__ */ new Uint32Array(80);
2669
+ ]), kt = /* @__PURE__ */ new Uint32Array(80);
2670
2670
  class Va extends Gi.HashMD {
2671
2671
  constructor() {
2672
2672
  super(64, 20, 8, !1), this.A = zr[0] | 0, this.B = zr[1] | 0, this.C = zr[2] | 0, this.D = zr[3] | 0, this.E = zr[4] | 0;
@@ -2680,20 +2680,20 @@ class Va extends Gi.HashMD {
2680
2680
  }
2681
2681
  process(t, r) {
2682
2682
  for (let c = 0; c < 16; c++, r += 4)
2683
- Ot[c] = t.getUint32(r, !1);
2683
+ kt[c] = t.getUint32(r, !1);
2684
2684
  for (let c = 16; c < 80; c++)
2685
- Ot[c] = (0, zn.rotl)(Ot[c - 3] ^ Ot[c - 8] ^ Ot[c - 14] ^ Ot[c - 16], 1);
2685
+ kt[c] = (0, zn.rotl)(kt[c - 3] ^ kt[c - 8] ^ kt[c - 14] ^ kt[c - 16], 1);
2686
2686
  let { A: n, B: i, C: s, D: o, E: a } = this;
2687
2687
  for (let c = 0; c < 80; c++) {
2688
2688
  let l, d;
2689
2689
  c < 20 ? (l = (0, Gi.Chi)(i, s, o), d = 1518500249) : c < 40 ? (l = i ^ s ^ o, d = 1859775393) : c < 60 ? (l = (0, Gi.Maj)(i, s, o), d = 2400959708) : (l = i ^ s ^ o, d = 3395469782);
2690
- const b = (0, zn.rotl)(n, 5) + l + a + d + Ot[c] | 0;
2690
+ const b = (0, zn.rotl)(n, 5) + l + a + d + kt[c] | 0;
2691
2691
  a = o, o = s, s = (0, zn.rotl)(i, 30), i = n, n = b;
2692
2692
  }
2693
2693
  n = n + this.A | 0, i = i + this.B | 0, s = s + this.C | 0, o = o + this.D | 0, a = a + this.E | 0, this.set(n, i, s, o, a);
2694
2694
  }
2695
2695
  roundClean() {
2696
- Ot.fill(0);
2696
+ kt.fill(0);
2697
2697
  }
2698
2698
  destroy() {
2699
2699
  this.set(0, 0, 0, 0, 0), this.buffer.fill(0);
@@ -2701,10 +2701,10 @@ class Va extends Gi.HashMD {
2701
2701
  }
2702
2702
  Rr.SHA1 = Va;
2703
2703
  Rr.sha1 = (0, zn.wrapConstructor)(() => new Va());
2704
- var vt = {};
2705
- Object.defineProperty(vt, "__esModule", { value: !0 });
2706
- vt.sha224 = vt.sha256 = vt.SHA256 = void 0;
2707
- const Wi = lt, Xe = mn, _c = /* @__PURE__ */ new Uint32Array([
2704
+ var Et = {};
2705
+ Object.defineProperty(Et, "__esModule", { value: !0 });
2706
+ Et.sha224 = Et.sha256 = Et.SHA256 = void 0;
2707
+ const Wi = lt, Xe = mn, mc = /* @__PURE__ */ new Uint32Array([
2708
2708
  1116352408,
2709
2709
  1899447441,
2710
2710
  3049323471,
@@ -2769,7 +2769,7 @@ const Wi = lt, Xe = mn, _c = /* @__PURE__ */ new Uint32Array([
2769
2769
  2756734187,
2770
2770
  3204031479,
2771
2771
  3329325298
2772
- ]), kt = /* @__PURE__ */ new Uint32Array([
2772
+ ]), Rt = /* @__PURE__ */ new Uint32Array([
2773
2773
  1779033703,
2774
2774
  3144134277,
2775
2775
  1013904242,
@@ -2778,10 +2778,10 @@ const Wi = lt, Xe = mn, _c = /* @__PURE__ */ new Uint32Array([
2778
2778
  2600822924,
2779
2779
  528734635,
2780
2780
  1541459225
2781
- ]), Rt = /* @__PURE__ */ new Uint32Array(64);
2781
+ ]), Ut = /* @__PURE__ */ new Uint32Array(64);
2782
2782
  let Fs = class extends Wi.HashMD {
2783
2783
  constructor() {
2784
- super(64, 32, 8, !1), this.A = kt[0] | 0, this.B = kt[1] | 0, this.C = kt[2] | 0, this.D = kt[3] | 0, this.E = kt[4] | 0, this.F = kt[5] | 0, this.G = kt[6] | 0, this.H = kt[7] | 0;
2784
+ super(64, 32, 8, !1), this.A = Rt[0] | 0, this.B = Rt[1] | 0, this.C = Rt[2] | 0, this.D = Rt[3] | 0, this.E = Rt[4] | 0, this.F = Rt[5] | 0, this.G = Rt[6] | 0, this.H = Rt[7] | 0;
2785
2785
  }
2786
2786
  get() {
2787
2787
  const { A: t, B: r, C: n, D: i, E: s, F: o, G: a, H: c } = this;
@@ -2793,36 +2793,36 @@ let Fs = class extends Wi.HashMD {
2793
2793
  }
2794
2794
  process(t, r) {
2795
2795
  for (let b = 0; b < 16; b++, r += 4)
2796
- Rt[b] = t.getUint32(r, !1);
2796
+ Ut[b] = t.getUint32(r, !1);
2797
2797
  for (let b = 16; b < 64; b++) {
2798
- const x = Rt[b - 15], p = Rt[b - 2], I = (0, Xe.rotr)(x, 7) ^ (0, Xe.rotr)(x, 18) ^ x >>> 3, B = (0, Xe.rotr)(p, 17) ^ (0, Xe.rotr)(p, 19) ^ p >>> 10;
2799
- Rt[b] = B + Rt[b - 7] + I + Rt[b - 16] | 0;
2798
+ const E = Ut[b - 15], p = Ut[b - 2], I = (0, Xe.rotr)(E, 7) ^ (0, Xe.rotr)(E, 18) ^ E >>> 3, B = (0, Xe.rotr)(p, 17) ^ (0, Xe.rotr)(p, 19) ^ p >>> 10;
2799
+ Ut[b] = B + Ut[b - 7] + I + Ut[b - 16] | 0;
2800
2800
  }
2801
2801
  let { A: n, B: i, C: s, D: o, E: a, F: c, G: l, H: d } = this;
2802
2802
  for (let b = 0; b < 64; b++) {
2803
- const x = (0, Xe.rotr)(a, 6) ^ (0, Xe.rotr)(a, 11) ^ (0, Xe.rotr)(a, 25), p = d + x + (0, Wi.Chi)(a, c, l) + _c[b] + Rt[b] | 0, B = ((0, Xe.rotr)(n, 2) ^ (0, Xe.rotr)(n, 13) ^ (0, Xe.rotr)(n, 22)) + (0, Wi.Maj)(n, i, s) | 0;
2803
+ const E = (0, Xe.rotr)(a, 6) ^ (0, Xe.rotr)(a, 11) ^ (0, Xe.rotr)(a, 25), p = d + E + (0, Wi.Chi)(a, c, l) + mc[b] + Ut[b] | 0, B = ((0, Xe.rotr)(n, 2) ^ (0, Xe.rotr)(n, 13) ^ (0, Xe.rotr)(n, 22)) + (0, Wi.Maj)(n, i, s) | 0;
2804
2804
  d = l, l = c, c = a, a = o + p | 0, o = s, s = i, i = n, n = p + B | 0;
2805
2805
  }
2806
2806
  n = n + this.A | 0, i = i + this.B | 0, s = s + this.C | 0, o = o + this.D | 0, a = a + this.E | 0, c = c + this.F | 0, l = l + this.G | 0, d = d + this.H | 0, this.set(n, i, s, o, a, c, l, d);
2807
2807
  }
2808
2808
  roundClean() {
2809
- Rt.fill(0);
2809
+ Ut.fill(0);
2810
2810
  }
2811
2811
  destroy() {
2812
2812
  this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0);
2813
2813
  }
2814
2814
  };
2815
- vt.SHA256 = Fs;
2816
- class vc extends Fs {
2815
+ Et.SHA256 = Fs;
2816
+ class _c extends Fs {
2817
2817
  constructor() {
2818
2818
  super(), this.A = -1056596264, this.B = 914150663, this.C = 812702999, this.D = -150054599, this.E = -4191439, this.F = 1750603025, this.G = 1694076839, this.H = -1090891868, this.outputLen = 28;
2819
2819
  }
2820
2820
  }
2821
- vt.sha256 = (0, Xe.wrapConstructor)(() => new Fs());
2822
- vt.sha224 = (0, Xe.wrapConstructor)(() => new vc());
2821
+ Et.sha256 = (0, Xe.wrapConstructor)(() => new Fs());
2822
+ Et.sha224 = (0, Xe.wrapConstructor)(() => new _c());
2823
2823
  (function(e) {
2824
2824
  Object.defineProperty(e, "__esModule", { value: !0 }), e.taggedHash = e.TAGGED_HASH_PREFIXES = e.TAGS = e.hash256 = e.hash160 = e.sha256 = e.sha1 = e.ripemd160 = void 0;
2825
- const t = kr, r = Rr, n = vt;
2825
+ const t = kr, r = Rr, n = Et;
2826
2826
  function i(d) {
2827
2827
  return Buffer.from((0, t.ripemd160)(Uint8Array.from(d)));
2828
2828
  }
@@ -3456,19 +3456,19 @@ vt.sha224 = (0, Xe.wrapConstructor)(() => new vc());
3456
3456
  return o(Buffer.concat([e.TAGGED_HASH_PREFIXES[d], b]));
3457
3457
  }
3458
3458
  e.taggedHash = l;
3459
- })(Wt);
3460
- var Vi = {}, Et = {};
3461
- Object.defineProperty(Et, "__esModule", { value: !0 });
3462
- Et.encode = Et.decode = Et.check = void 0;
3463
- function Ec(e) {
3459
+ })(Vt);
3460
+ var Vi = {}, xt = {};
3461
+ Object.defineProperty(xt, "__esModule", { value: !0 });
3462
+ xt.encode = xt.decode = xt.check = void 0;
3463
+ function vc(e) {
3464
3464
  if (e.length < 8 || e.length > 72 || e[0] !== 48 || e[1] !== e.length - 2 || e[2] !== 2) return !1;
3465
3465
  const t = e[3];
3466
3466
  if (t === 0 || 5 + t >= e.length || e[4 + t] !== 2) return !1;
3467
3467
  const r = e[5 + t];
3468
3468
  return !(r === 0 || 6 + t + r !== e.length || e[4] & 128 || t > 1 && e[4] === 0 && !(e[5] & 128) || e[t + 6] & 128 || r > 1 && e[t + 6] === 0 && !(e[t + 7] & 128));
3469
3469
  }
3470
- Et.check = Ec;
3471
- function xc(e) {
3470
+ xt.check = vc;
3471
+ function Ec(e) {
3472
3472
  if (e.length < 8) throw new Error("DER sequence length is too short");
3473
3473
  if (e.length > 72) throw new Error("DER sequence length is too long");
3474
3474
  if (e[0] !== 48) throw new Error("Expected DER sequence");
@@ -3493,8 +3493,8 @@ function xc(e) {
3493
3493
  s: e.slice(6 + t)
3494
3494
  };
3495
3495
  }
3496
- Et.decode = xc;
3497
- function Sc(e, t) {
3496
+ xt.decode = Ec;
3497
+ function xc(e, t) {
3498
3498
  const r = e.length, n = t.length;
3499
3499
  if (r === 0) throw new Error("R length is zero");
3500
3500
  if (n === 0) throw new Error("S length is zero");
@@ -3509,7 +3509,7 @@ function Sc(e, t) {
3509
3509
  const i = Buffer.allocUnsafe(6 + r + n);
3510
3510
  return i[0] = 48, i[1] = i.length - 2, i[2] = 2, i[3] = e.length, e.copy(i, 4), i[4 + r] = 2, i[5 + r] = t.length, t.copy(i, 6 + r), i;
3511
3511
  }
3512
- Et.encode = Sc;
3512
+ xt.encode = xc;
3513
3513
  var ir = {};
3514
3514
  Object.defineProperty(ir, "__esModule", { value: !0 });
3515
3515
  ir.REVERSE_OPS = ir.OPS = void 0;
@@ -3641,33 +3641,33 @@ for (const e of Object.keys(ws)) {
3641
3641
  const t = ws[e];
3642
3642
  za[t] = e;
3643
3643
  }
3644
- var $t = {};
3645
- Object.defineProperty($t, "__esModule", { value: !0 });
3646
- $t.decode = $t.encode = $t.encodingLength = void 0;
3647
- const Mt = ir;
3644
+ var jt = {};
3645
+ Object.defineProperty(jt, "__esModule", { value: !0 });
3646
+ jt.decode = jt.encode = jt.encodingLength = void 0;
3647
+ const Dt = ir;
3648
3648
  function qa(e) {
3649
- return e < Mt.OPS.OP_PUSHDATA1 ? 1 : e <= 255 ? 2 : e <= 65535 ? 3 : 5;
3649
+ return e < Dt.OPS.OP_PUSHDATA1 ? 1 : e <= 255 ? 2 : e <= 65535 ? 3 : 5;
3650
3650
  }
3651
- $t.encodingLength = qa;
3652
- function Bc(e, t, r) {
3651
+ jt.encodingLength = qa;
3652
+ function Sc(e, t, r) {
3653
3653
  const n = qa(t);
3654
- return n === 1 ? e.writeUInt8(t, r) : n === 2 ? (e.writeUInt8(Mt.OPS.OP_PUSHDATA1, r), e.writeUInt8(t, r + 1)) : n === 3 ? (e.writeUInt8(Mt.OPS.OP_PUSHDATA2, r), e.writeUInt16LE(t, r + 1)) : (e.writeUInt8(Mt.OPS.OP_PUSHDATA4, r), e.writeUInt32LE(t, r + 1)), n;
3654
+ return n === 1 ? e.writeUInt8(t, r) : n === 2 ? (e.writeUInt8(Dt.OPS.OP_PUSHDATA1, r), e.writeUInt8(t, r + 1)) : n === 3 ? (e.writeUInt8(Dt.OPS.OP_PUSHDATA2, r), e.writeUInt16LE(t, r + 1)) : (e.writeUInt8(Dt.OPS.OP_PUSHDATA4, r), e.writeUInt32LE(t, r + 1)), n;
3655
3655
  }
3656
- $t.encode = Bc;
3657
- function Pc(e, t) {
3656
+ jt.encode = Sc;
3657
+ function Bc(e, t) {
3658
3658
  const r = e.readUInt8(t);
3659
3659
  let n, i;
3660
- if (r < Mt.OPS.OP_PUSHDATA1)
3660
+ if (r < Dt.OPS.OP_PUSHDATA1)
3661
3661
  n = r, i = 1;
3662
- else if (r === Mt.OPS.OP_PUSHDATA1) {
3662
+ else if (r === Dt.OPS.OP_PUSHDATA1) {
3663
3663
  if (t + 2 > e.length) return null;
3664
3664
  n = e.readUInt8(t + 1), i = 2;
3665
- } else if (r === Mt.OPS.OP_PUSHDATA2) {
3665
+ } else if (r === Dt.OPS.OP_PUSHDATA2) {
3666
3666
  if (t + 3 > e.length) return null;
3667
3667
  n = e.readUInt16LE(t + 1), i = 3;
3668
3668
  } else {
3669
3669
  if (t + 5 > e.length) return null;
3670
- if (r !== Mt.OPS.OP_PUSHDATA4) throw new Error("Unexpected opcode");
3670
+ if (r !== Dt.OPS.OP_PUSHDATA4) throw new Error("Unexpected opcode");
3671
3671
  n = e.readUInt32LE(t + 1), i = 5;
3672
3672
  }
3673
3673
  return {
@@ -3676,11 +3676,11 @@ function Pc(e, t) {
3676
3676
  size: i
3677
3677
  };
3678
3678
  }
3679
- $t.decode = Pc;
3679
+ jt.decode = Bc;
3680
3680
  var Ur = {};
3681
3681
  Object.defineProperty(Ur, "__esModule", { value: !0 });
3682
3682
  Ur.encode = Ur.decode = void 0;
3683
- function Ac(e, t, r) {
3683
+ function Pc(e, t, r) {
3684
3684
  t = t || 4, r = r === void 0 ? !0 : r;
3685
3685
  const n = e.length;
3686
3686
  if (n === 0) return 0;
@@ -3696,23 +3696,23 @@ function Ac(e, t, r) {
3696
3696
  i |= e[s] << 8 * s;
3697
3697
  return e[n - 1] & 128 ? -(i & ~(128 << 8 * (n - 1))) : i;
3698
3698
  }
3699
- Ur.decode = Ac;
3700
- function Tc(e) {
3699
+ Ur.decode = Pc;
3700
+ function Ac(e) {
3701
3701
  return e > 2147483647 ? 5 : e > 8388607 ? 4 : e > 32767 ? 3 : e > 127 ? 2 : e > 0 ? 1 : 0;
3702
3702
  }
3703
- function Ic(e) {
3703
+ function Tc(e) {
3704
3704
  let t = Math.abs(e);
3705
- const r = Tc(t), n = Buffer.allocUnsafe(r), i = e < 0;
3705
+ const r = Ac(t), n = Buffer.allocUnsafe(r), i = e < 0;
3706
3706
  for (let s = 0; s < r; ++s)
3707
3707
  n.writeUInt8(t & 255, s), t >>= 8;
3708
3708
  return n[r - 1] & 128 ? n.writeUInt8(i ? 128 : 0, r - 1) : i && (n[r - 1] |= 128), n;
3709
3709
  }
3710
- Ur.encode = Ic;
3710
+ Ur.encode = Tc;
3711
3711
  var Qt = {}, wo;
3712
- function Oc() {
3712
+ function Ic() {
3713
3713
  if (wo) return Qt;
3714
3714
  wo = 1, Object.defineProperty(Qt, "__esModule", { value: !0 }), Qt.encode = Qt.decode = void 0;
3715
- const e = Et, t = qe(), r = Le, { typeforce: n } = r, i = Buffer.alloc(1, 0);
3715
+ const e = xt, t = qe(), r = Le, { typeforce: n } = r, i = Buffer.alloc(1, 0);
3716
3716
  function s(l) {
3717
3717
  let d = 0;
3718
3718
  for (; l[d] === 0; ) ++d;
@@ -3727,8 +3727,8 @@ function Oc() {
3727
3727
  const d = l.readUInt8(l.length - 1);
3728
3728
  if (!(0, t.isDefinedHashType)(d))
3729
3729
  throw new Error("Invalid hashType " + d);
3730
- const b = e.decode(l.slice(0, -1)), x = o(b.r), p = o(b.s);
3731
- return { signature: Buffer.concat([x, p], 64), hashType: d };
3730
+ const b = e.decode(l.slice(0, -1)), E = o(b.r), p = o(b.s);
3731
+ return { signature: Buffer.concat([E, p], 64), hashType: d };
3732
3732
  }
3733
3733
  Qt.decode = a;
3734
3734
  function c(l, d) {
@@ -3742,8 +3742,8 @@ function Oc() {
3742
3742
  throw new Error("Invalid hashType " + d);
3743
3743
  const b = Buffer.allocUnsafe(1);
3744
3744
  b.writeUInt8(d, 0);
3745
- const x = s(l.slice(0, 32)), p = s(l.slice(32, 64));
3746
- return Buffer.concat([e.encode(x, p), b]);
3745
+ const E = s(l.slice(0, 32)), p = s(l.slice(32, 64));
3746
+ return Buffer.concat([e.encode(E, p), b]);
3747
3747
  }
3748
3748
  return Qt.encode = c, Qt;
3749
3749
  }
@@ -3751,14 +3751,14 @@ var go;
3751
3751
  function qe() {
3752
3752
  return go || (go = 1, function(e) {
3753
3753
  Object.defineProperty(e, "__esModule", { value: !0 }), e.signature = e.number = e.isCanonicalScriptSignature = e.isDefinedHashType = e.isCanonicalPubKey = e.toStack = e.fromASM = e.toASM = e.decompile = e.compile = e.countNonPushOnlyOPs = e.isPushOnly = e.OPS = void 0;
3754
- const t = Et, r = ir;
3754
+ const t = xt, r = ir;
3755
3755
  Object.defineProperty(e, "OPS", {
3756
3756
  enumerable: !0,
3757
3757
  get: function() {
3758
3758
  return r.OPS;
3759
3759
  }
3760
3760
  });
3761
- const n = $t, i = Ur, s = Oc(), o = Le, { typeforce: a } = o, c = r.OPS.OP_RESERVED;
3761
+ const n = jt, i = Ur, s = Ic(), o = Le, { typeforce: a } = o, c = r.OPS.OP_RESERVED;
3762
3762
  function l(R) {
3763
3763
  return o.Number(R) && (R === r.OPS.OP_0 || R >= r.OPS.OP_1 && R <= r.OPS.OP_16 || R === r.OPS.OP_1NEGATE);
3764
3764
  }
@@ -3769,10 +3769,10 @@ function qe() {
3769
3769
  return o.Array(R) && R.every(d);
3770
3770
  }
3771
3771
  e.isPushOnly = b;
3772
- function x(R) {
3772
+ function E(R) {
3773
3773
  return R.length - R.filter(d).length;
3774
3774
  }
3775
- e.countNonPushOnlyOPs = x;
3775
+ e.countNonPushOnlyOPs = E;
3776
3776
  function p(R) {
3777
3777
  if (R.length === 0) return r.OPS.OP_0;
3778
3778
  if (R.length === 1) {
@@ -3851,10 +3851,10 @@ function qe() {
3851
3851
  return R = U(R), a(b, R), R.map((z) => T(z) ? z : z === r.OPS.OP_0 ? Buffer.allocUnsafe(0) : i.encode(z - c));
3852
3852
  }
3853
3853
  e.toStack = S;
3854
- function E(R) {
3854
+ function x(R) {
3855
3855
  return o.isPoint(R);
3856
3856
  }
3857
- e.isCanonicalPubKey = E;
3857
+ e.isCanonicalPubKey = x;
3858
3858
  function M(R) {
3859
3859
  const z = R & -129;
3860
3860
  return z > 0 && z < 4;
@@ -3868,26 +3868,26 @@ function qe() {
3868
3868
  }
3869
3869
  Object.defineProperty(gn, "__esModule", { value: !0 });
3870
3870
  gn.Transaction = void 0;
3871
- const xe = Te, Ne = Wt, mo = qe(), kc = qe(), ee = Le, { typeforce: it } = ee;
3871
+ const xe = Ae, Ne = Vt, mo = qe(), Oc = qe(), ee = Le, { typeforce: it } = ee;
3872
3872
  function ft(e) {
3873
3873
  const t = e.length;
3874
3874
  return xe.varuint.encodingLength(t) + t;
3875
3875
  }
3876
- function Rc(e) {
3876
+ function kc(e) {
3877
3877
  const t = e.length;
3878
3878
  return xe.varuint.encodingLength(t) + e.reduce((r, n) => r + ft(n), 0);
3879
3879
  }
3880
- const Ht = Buffer.allocUnsafe(0), _o = [], zi = Buffer.from(
3880
+ const Mt = Buffer.allocUnsafe(0), _o = [], zi = Buffer.from(
3881
3881
  "0000000000000000000000000000000000000000000000000000000000000000",
3882
3882
  "hex"
3883
3883
  ), vo = Buffer.from(
3884
3884
  "0000000000000000000000000000000000000000000000000000000000000001",
3885
3885
  "hex"
3886
- ), Uc = Buffer.from("ffffffffffffffff", "hex"), Cc = {
3887
- script: Ht,
3888
- valueBuffer: Uc
3886
+ ), Rc = Buffer.from("ffffffffffffffff", "hex"), Uc = {
3887
+ script: Mt,
3888
+ valueBuffer: Rc
3889
3889
  };
3890
- function Lc(e) {
3890
+ function Cc(e) {
3891
3891
  return e.value !== void 0;
3892
3892
  }
3893
3893
  class X {
@@ -3950,7 +3950,7 @@ class X {
3950
3950
  ), ee.Null(n) && (n = X.DEFAULT_SEQUENCE), this.ins.push({
3951
3951
  hash: t,
3952
3952
  index: r,
3953
- script: i || Ht,
3953
+ script: i || Mt,
3954
3954
  sequence: n,
3955
3955
  witness: _o
3956
3956
  }) - 1;
@@ -3973,7 +3973,7 @@ class X {
3973
3973
  }
3974
3974
  byteLength(t = !0) {
3975
3975
  const r = t && this.hasWitnesses();
3976
- return (r ? 10 : 8) + xe.varuint.encodingLength(this.ins.length) + xe.varuint.encodingLength(this.outs.length) + this.ins.reduce((n, i) => n + 40 + ft(i.script), 0) + this.outs.reduce((n, i) => n + 8 + ft(i.script), 0) + (r ? this.ins.reduce((n, i) => n + Rc(i.witness), 0) : 0);
3976
+ return (r ? 10 : 8) + xe.varuint.encodingLength(this.ins.length) + xe.varuint.encodingLength(this.outs.length) + this.ins.reduce((n, i) => n + 40 + ft(i.script), 0) + this.outs.reduce((n, i) => n + 8 + ft(i.script), 0) + (r ? this.ins.reduce((n, i) => n + kc(i.witness), 0) : 0);
3977
3977
  }
3978
3978
  clone() {
3979
3979
  const t = new X();
@@ -4007,7 +4007,7 @@ class X {
4007
4007
  arguments
4008
4008
  ), t >= this.ins.length) return vo;
4009
4009
  const i = mo.compile(
4010
- mo.decompile(r).filter((a) => a !== kc.OPS.OP_CODESEPARATOR)
4010
+ mo.decompile(r).filter((a) => a !== Oc.OPS.OP_CODESEPARATOR)
4011
4011
  ), s = this.clone();
4012
4012
  if ((n & 31) === X.SIGHASH_NONE)
4013
4013
  s.outs = [], s.ins.forEach((a, c) => {
@@ -4017,13 +4017,13 @@ class X {
4017
4017
  if (t >= this.outs.length) return vo;
4018
4018
  s.outs.length = t + 1;
4019
4019
  for (let a = 0; a < t; a++)
4020
- s.outs[a] = Cc;
4020
+ s.outs[a] = Uc;
4021
4021
  s.ins.forEach((a, c) => {
4022
4022
  c !== t && (a.sequence = 0);
4023
4023
  });
4024
4024
  }
4025
4025
  n & X.SIGHASH_ANYONECANPAY ? (s.ins = [s.ins[t]], s.ins[0].script = i) : (s.ins.forEach((a) => {
4026
- a.script = Ht;
4026
+ a.script = Mt;
4027
4027
  }), s.ins[t].script = i);
4028
4028
  const o = Buffer.allocUnsafe(s.byteLength(!1) + 4);
4029
4029
  return o.writeInt32LE(n, o.length - 4), s.__toBuffer(o, 0, !1), Ne.hash256(o);
@@ -4040,17 +4040,17 @@ class X {
4040
4040
  ), n.length !== this.ins.length || r.length !== this.ins.length)
4041
4041
  throw new Error("Must supply prevout script and value for all inputs");
4042
4042
  const a = i === X.SIGHASH_DEFAULT ? X.SIGHASH_ALL : i & X.SIGHASH_OUTPUT_MASK, l = (i & X.SIGHASH_INPUT_MASK) === X.SIGHASH_ANYONECANPAY, d = a === X.SIGHASH_NONE, b = a === X.SIGHASH_SINGLE;
4043
- let x = Ht, p = Ht, I = Ht, B = Ht, T = Ht;
4043
+ let E = Mt, p = Mt, I = Mt, B = Mt, T = Mt;
4044
4044
  if (!l) {
4045
4045
  let m = xe.BufferWriter.withCapacity(
4046
4046
  36 * this.ins.length
4047
4047
  );
4048
4048
  this.ins.forEach((S) => {
4049
4049
  m.writeSlice(S.hash), m.writeUInt32(S.index);
4050
- }), x = Ne.sha256(m.end()), m = xe.BufferWriter.withCapacity(
4050
+ }), E = Ne.sha256(m.end()), m = xe.BufferWriter.withCapacity(
4051
4051
  8 * this.ins.length
4052
4052
  ), n.forEach((S) => m.writeUInt64(S)), p = Ne.sha256(m.end()), m = xe.BufferWriter.withCapacity(
4053
- r.map(ft).reduce((S, E) => S + E)
4053
+ r.map(ft).reduce((S, x) => S + x)
4054
4054
  ), r.forEach(
4055
4055
  (S) => m.writeVarSlice(S)
4056
4056
  ), I = Ne.sha256(m.end()), m = xe.BufferWriter.withCapacity(
@@ -4065,13 +4065,13 @@ class X {
4065
4065
  S.writeUInt64(m.value), S.writeVarSlice(m.script), T = Ne.sha256(S.end());
4066
4066
  }
4067
4067
  } else {
4068
- const m = this.outs.map((E) => 8 + ft(E.script)).reduce((E, M) => E + M), S = xe.BufferWriter.withCapacity(m);
4069
- this.outs.forEach((E) => {
4070
- S.writeUInt64(E.value), S.writeVarSlice(E.script);
4068
+ const m = this.outs.map((x) => 8 + ft(x.script)).reduce((x, M) => x + M), S = xe.BufferWriter.withCapacity(m);
4069
+ this.outs.forEach((x) => {
4070
+ S.writeUInt64(x.value), S.writeVarSlice(x.script);
4071
4071
  }), T = Ne.sha256(S.end());
4072
4072
  }
4073
4073
  const k = (s ? 2 : 0) + (o ? 1 : 0), U = 174 - (l ? 49 : 0) - (d ? 32 : 0) + (o ? 32 : 0) + (s ? 37 : 0), _ = xe.BufferWriter.withCapacity(U);
4074
- if (_.writeUInt8(i), _.writeInt32(this.version), _.writeUInt32(this.locktime), _.writeSlice(x), _.writeSlice(p), _.writeSlice(I), _.writeSlice(B), d || b || _.writeSlice(T), _.writeUInt8(k), l) {
4074
+ if (_.writeUInt8(i), _.writeInt32(this.version), _.writeUInt32(this.locktime), _.writeSlice(E), _.writeSlice(p), _.writeSlice(I), _.writeSlice(B), d || b || _.writeSlice(T), _.writeUInt8(k), l) {
4075
4075
  const m = this.ins[t];
4076
4076
  _.writeSlice(m.hash), _.writeUInt32(m.index), _.writeUInt64(n[t]), _.writeVarSlice(r[t]), _.writeUInt32(m.sequence);
4077
4077
  } else
@@ -4098,9 +4098,9 @@ class X {
4098
4098
  }), c = Ne.hash256(s)), !(i & X.SIGHASH_ANYONECANPAY) && (i & 31) !== X.SIGHASH_SINGLE && (i & 31) !== X.SIGHASH_NONE && (s = Buffer.allocUnsafe(4 * this.ins.length), o = new xe.BufferWriter(s, 0), this.ins.forEach((b) => {
4099
4099
  o.writeUInt32(b.sequence);
4100
4100
  }), l = Ne.hash256(s)), (i & 31) !== X.SIGHASH_SINGLE && (i & 31) !== X.SIGHASH_NONE) {
4101
- const b = this.outs.reduce((x, p) => x + 8 + ft(p.script), 0);
4102
- s = Buffer.allocUnsafe(b), o = new xe.BufferWriter(s, 0), this.outs.forEach((x) => {
4103
- o.writeUInt64(x.value), o.writeVarSlice(x.script);
4101
+ const b = this.outs.reduce((E, p) => E + 8 + ft(p.script), 0);
4102
+ s = Buffer.allocUnsafe(b), o = new xe.BufferWriter(s, 0), this.outs.forEach((E) => {
4103
+ o.writeUInt64(E.value), o.writeVarSlice(E.script);
4104
4104
  }), a = Ne.hash256(s);
4105
4105
  } else if ((i & 31) === X.SIGHASH_SINGLE && t < this.outs.length) {
4106
4106
  const b = this.outs[t];
@@ -4141,7 +4141,7 @@ class X {
4141
4141
  return s && (i.writeUInt8(X.ADVANCED_TRANSACTION_MARKER), i.writeUInt8(X.ADVANCED_TRANSACTION_FLAG)), i.writeVarInt(this.ins.length), this.ins.forEach((o) => {
4142
4142
  i.writeSlice(o.hash), i.writeUInt32(o.index), i.writeVarSlice(o.script), i.writeUInt32(o.sequence);
4143
4143
  }), i.writeVarInt(this.outs.length), this.outs.forEach((o) => {
4144
- Lc(o) ? i.writeUInt64(o.value) : i.writeSlice(o.valueBuffer), i.writeVarSlice(o.script);
4144
+ Cc(o) ? i.writeUInt64(o.value) : i.writeSlice(o.valueBuffer), i.writeVarSlice(o.script);
4145
4145
  }), s && this.ins.forEach((o) => {
4146
4146
  i.writeVector(o.witness);
4147
4147
  }), i.writeUInt32(this.locktime), r !== void 0 ? t.slice(r, i.offset) : t;
@@ -4158,11 +4158,11 @@ X.SIGHASH_OUTPUT_MASK = 3;
4158
4158
  X.SIGHASH_INPUT_MASK = 128;
4159
4159
  X.ADVANCED_TRANSACTION_MARKER = 0;
4160
4160
  X.ADVANCED_TRANSACTION_FLAG = 1;
4161
- var se = {}, _n = {};
4161
+ var oe = {}, _n = {};
4162
4162
  Object.defineProperty(_n, "__esModule", { value: !0 });
4163
- const Nc = 9007199254740991;
4163
+ const Lc = 9007199254740991;
4164
4164
  function Hs(e) {
4165
- if (e < 0 || e > Nc || e % 1 !== 0)
4165
+ if (e < 0 || e > Lc || e % 1 !== 0)
4166
4166
  throw new RangeError("value out of range");
4167
4167
  }
4168
4168
  function fn(e, t, r) {
@@ -4259,7 +4259,7 @@ Ce.testnet = {
4259
4259
  var ze = {};
4260
4260
  Object.defineProperty(ze, "__esModule", { value: !0 });
4261
4261
  ze.value = ze.prop = void 0;
4262
- function Fc(e, t, r) {
4262
+ function Nc(e, t, r) {
4263
4263
  Object.defineProperty(e, t, {
4264
4264
  configurable: !0,
4265
4265
  enumerable: !0,
@@ -4277,16 +4277,16 @@ function Fc(e, t, r) {
4277
4277
  }
4278
4278
  });
4279
4279
  }
4280
- ze.prop = Fc;
4281
- function Hc(e) {
4280
+ ze.prop = Nc;
4281
+ function Fc(e) {
4282
4282
  let t;
4283
4283
  return () => (t !== void 0 || (t = e()), t);
4284
4284
  }
4285
- ze.value = Hc;
4285
+ ze.value = Fc;
4286
4286
  Object.defineProperty(yi, "__esModule", { value: !0 });
4287
4287
  yi.p2data = void 0;
4288
- const Mc = Ce, qn = qe(), st = Le, Eo = ze, xo = qn.OPS;
4289
- function Dc(e, t) {
4288
+ const Hc = Ce, qn = qe(), st = Le, Eo = ze, xo = qn.OPS;
4289
+ function Mc(e, t) {
4290
4290
  if (!e.data && !e.output) throw new TypeError("Not enough data");
4291
4291
  t = Object.assign({ validate: !0 }, t || {}), (0, st.typeforce)(
4292
4292
  {
@@ -4298,7 +4298,7 @@ function Dc(e, t) {
4298
4298
  },
4299
4299
  e
4300
4300
  );
4301
- const n = { name: "embed", network: e.network || Mc.bitcoin };
4301
+ const n = { name: "embed", network: e.network || Hc.bitcoin };
4302
4302
  if (Eo.prop(n, "output", () => {
4303
4303
  if (e.data)
4304
4304
  return qn.compile([xo.OP_RETURN].concat(e.data));
@@ -4315,12 +4315,12 @@ function Dc(e, t) {
4315
4315
  }
4316
4316
  return Object.assign(n, e);
4317
4317
  }
4318
- yi.p2data = Dc;
4318
+ yi.p2data = Mc;
4319
4319
  var bi = {};
4320
4320
  Object.defineProperty(bi, "__esModule", { value: !0 });
4321
4321
  bi.p2ms = void 0;
4322
- const $c = Ce, vr = qe(), Ee = Le, Ut = ze, Er = vr.OPS, Cn = Er.OP_RESERVED;
4323
- function jc(e, t) {
4322
+ const Dc = Ce, vr = qe(), Ee = Le, Ct = ze, Er = vr.OPS, Cn = Er.OP_RESERVED;
4323
+ function $c(e, t) {
4324
4324
  if (!e.input && !e.output && !(e.pubkeys && e.m !== void 0) && !e.signatures)
4325
4325
  throw new TypeError("Not enough data");
4326
4326
  t = Object.assign({ validate: !0 }, t || {});
@@ -4343,12 +4343,12 @@ function jc(e, t) {
4343
4343
  },
4344
4344
  e
4345
4345
  );
4346
- const i = { network: e.network || $c.bitcoin };
4346
+ const i = { network: e.network || Dc.bitcoin };
4347
4347
  let s = [], o = !1;
4348
4348
  function a(c) {
4349
4349
  o || (o = !0, s = vr.decompile(c), i.m = s[0] - Cn, i.n = s[s.length - 2] - Cn, i.pubkeys = s.slice(1, -2));
4350
4350
  }
4351
- if (Ut.prop(i, "output", () => {
4351
+ if (Ct.prop(i, "output", () => {
4352
4352
  if (e.m && i.n && e.pubkeys)
4353
4353
  return vr.compile(
4354
4354
  [].concat(
@@ -4358,25 +4358,25 @@ function jc(e, t) {
4358
4358
  Er.OP_CHECKMULTISIG
4359
4359
  )
4360
4360
  );
4361
- }), Ut.prop(i, "m", () => {
4361
+ }), Ct.prop(i, "m", () => {
4362
4362
  if (i.output)
4363
4363
  return a(i.output), i.m;
4364
- }), Ut.prop(i, "n", () => {
4364
+ }), Ct.prop(i, "n", () => {
4365
4365
  if (i.pubkeys)
4366
4366
  return i.pubkeys.length;
4367
- }), Ut.prop(i, "pubkeys", () => {
4367
+ }), Ct.prop(i, "pubkeys", () => {
4368
4368
  if (e.output)
4369
4369
  return a(e.output), i.pubkeys;
4370
- }), Ut.prop(i, "signatures", () => {
4370
+ }), Ct.prop(i, "signatures", () => {
4371
4371
  if (e.input)
4372
4372
  return vr.decompile(e.input).slice(1);
4373
- }), Ut.prop(i, "input", () => {
4373
+ }), Ct.prop(i, "input", () => {
4374
4374
  if (e.signatures)
4375
4375
  return vr.compile([Er.OP_0].concat(e.signatures));
4376
- }), Ut.prop(i, "witness", () => {
4376
+ }), Ct.prop(i, "witness", () => {
4377
4377
  if (i.input)
4378
4378
  return [];
4379
- }), Ut.prop(i, "name", () => {
4379
+ }), Ct.prop(i, "name", () => {
4380
4380
  if (!(!i.m || !i.n))
4381
4381
  return `p2ms(${i.m} of ${i.n})`;
4382
4382
  }), t.validate) {
@@ -4419,12 +4419,12 @@ function jc(e, t) {
4419
4419
  }
4420
4420
  return Object.assign(i, e);
4421
4421
  }
4422
- bi.p2ms = jc;
4422
+ bi.p2ms = $c;
4423
4423
  var wi = {};
4424
4424
  Object.defineProperty(wi, "__esModule", { value: !0 });
4425
4425
  wi.p2pk = void 0;
4426
- const Gc = Ce, xr = qe(), et = Le, _r = ze, So = xr.OPS;
4427
- function Wc(e, t) {
4426
+ const jc = Ce, xr = qe(), et = Le, _r = ze, So = xr.OPS;
4427
+ function Gc(e, t) {
4428
4428
  if (!e.input && !e.output && !e.pubkey && !e.input && !e.signature)
4429
4429
  throw new TypeError("Not enough data");
4430
4430
  t = Object.assign({ validate: !0 }, t || {}), (0, et.typeforce)(
@@ -4437,7 +4437,7 @@ function Wc(e, t) {
4437
4437
  },
4438
4438
  e
4439
4439
  );
4440
- const r = _r.value(() => xr.decompile(e.input)), i = { name: "p2pk", network: e.network || Gc.bitcoin };
4440
+ const r = _r.value(() => xr.decompile(e.input)), i = { name: "p2pk", network: e.network || jc.bitcoin };
4441
4441
  if (_r.prop(i, "output", () => {
4442
4442
  if (e.pubkey)
4443
4443
  return xr.compile([e.pubkey, So.OP_CHECKSIG]);
@@ -4472,9 +4472,9 @@ function Wc(e, t) {
4472
4472
  }
4473
4473
  return Object.assign(i, e);
4474
4474
  }
4475
- wi.p2pk = Wc;
4475
+ wi.p2pk = Gc;
4476
4476
  var gi = {};
4477
- function Vc(e) {
4477
+ function Wc(e) {
4478
4478
  if (e.length >= 255)
4479
4479
  throw new TypeError("Alphabet too long");
4480
4480
  for (var t = new Uint8Array(256), r = 0; r < t.length; r++)
@@ -4494,8 +4494,8 @@ function Vc(e) {
4494
4494
  for (var I = 0, B = 0, T = 0, k = p.length; T !== k && p[T] === 0; )
4495
4495
  T++, I++;
4496
4496
  for (var U = (k - T) * l + 1 >>> 0, _ = new Uint8Array(U); T !== k; ) {
4497
- for (var m = p[T], S = 0, E = U - 1; (m !== 0 || S < B) && E !== -1; E--, S++)
4498
- m += 256 * _[E] >>> 0, _[E] = m % o >>> 0, m = m / o >>> 0;
4497
+ for (var m = p[T], S = 0, x = U - 1; (m !== 0 || S < B) && x !== -1; x--, S++)
4498
+ m += 256 * _[x] >>> 0, _[x] = m % o >>> 0, m = m / o >>> 0;
4499
4499
  if (m !== 0)
4500
4500
  throw new Error("Non-zero carry");
4501
4501
  B = S, T++;
@@ -4523,13 +4523,13 @@ function Vc(e) {
4523
4523
  throw new Error("Non-zero carry");
4524
4524
  T = m, I++;
4525
4525
  }
4526
- for (var E = k - T; E !== k && U[E] === 0; )
4527
- E++;
4528
- for (var M = new Uint8Array(B + (k - E)), $ = B; E !== k; )
4529
- M[$++] = U[E++];
4526
+ for (var x = k - T; x !== k && U[x] === 0; )
4527
+ x++;
4528
+ for (var M = new Uint8Array(B + (k - x)), $ = B; x !== k; )
4529
+ M[$++] = U[x++];
4530
4530
  return M;
4531
4531
  }
4532
- function x(p) {
4532
+ function E(p) {
4533
4533
  var I = b(p);
4534
4534
  if (I)
4535
4535
  return I;
@@ -4538,12 +4538,12 @@ function Vc(e) {
4538
4538
  return {
4539
4539
  encode: d,
4540
4540
  decodeUnsafe: b,
4541
- decode: x
4541
+ decode: E
4542
4542
  };
4543
4543
  }
4544
- var zc = Vc;
4545
- const qc = zc, Kc = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
4546
- var Yc = qc(Kc), Ki = Yc, Xc = function(e) {
4544
+ var Vc = Wc;
4545
+ const zc = Vc, qc = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
4546
+ var Kc = zc(qc), Ki = Kc, Yc = function(e) {
4547
4547
  function t(s) {
4548
4548
  var o = Uint8Array.from(s), a = e(o), c = o.length + 4, l = new Uint8Array(c);
4549
4549
  return l.set(o, 0), l.set(a.subarray(0, 4), o.length), Ki.encode(l, c);
@@ -4568,15 +4568,15 @@ var Yc = qc(Kc), Ki = Yc, Xc = function(e) {
4568
4568
  decode: i,
4569
4569
  decodeUnsafe: n
4570
4570
  };
4571
- }, { sha256: Bo } = vt, Jc = Xc;
4572
- function Qc(e) {
4571
+ }, { sha256: Bo } = Et, Xc = Yc;
4572
+ function Jc(e) {
4573
4573
  return Bo(Bo(e));
4574
4574
  }
4575
- var Ms = Jc(Qc);
4575
+ var Ms = Xc(Jc);
4576
4576
  Object.defineProperty(gi, "__esModule", { value: !0 });
4577
4577
  gi.p2pkh = void 0;
4578
- const Yi = Wt, Zc = Ce, Sr = qe(), Fe = Le, yt = ze, Po = Ms, Ct = Sr.OPS;
4579
- function eh(e, t) {
4578
+ const Yi = Vt, Qc = Ce, Sr = qe(), Fe = Le, bt = ze, Po = Ms, Lt = Sr.OPS;
4579
+ function Zc(e, t) {
4580
4580
  if (!e.address && !e.hash && !e.output && !e.pubkey && !e.input)
4581
4581
  throw new TypeError("Not enough data");
4582
4582
  t = Object.assign({ validate: !0 }, t || {}), (0, Fe.typeforce)(
@@ -4591,37 +4591,37 @@ function eh(e, t) {
4591
4591
  },
4592
4592
  e
4593
4593
  );
4594
- const r = yt.value(() => {
4594
+ const r = bt.value(() => {
4595
4595
  const o = Buffer.from(Po.decode(e.address)), a = o.readUInt8(0), c = o.slice(1);
4596
4596
  return { version: a, hash: c };
4597
- }), n = yt.value(() => Sr.decompile(e.input)), i = e.network || Zc.bitcoin, s = { name: "p2pkh", network: i };
4598
- if (yt.prop(s, "address", () => {
4597
+ }), n = bt.value(() => Sr.decompile(e.input)), i = e.network || Qc.bitcoin, s = { name: "p2pkh", network: i };
4598
+ if (bt.prop(s, "address", () => {
4599
4599
  if (!s.hash) return;
4600
4600
  const o = Buffer.allocUnsafe(21);
4601
4601
  return o.writeUInt8(i.pubKeyHash, 0), s.hash.copy(o, 1), Po.encode(o);
4602
- }), yt.prop(s, "hash", () => {
4602
+ }), bt.prop(s, "hash", () => {
4603
4603
  if (e.output) return e.output.slice(3, 23);
4604
4604
  if (e.address) return r().hash;
4605
4605
  if (e.pubkey || s.pubkey) return Yi.hash160(e.pubkey || s.pubkey);
4606
- }), yt.prop(s, "output", () => {
4606
+ }), bt.prop(s, "output", () => {
4607
4607
  if (s.hash)
4608
4608
  return Sr.compile([
4609
- Ct.OP_DUP,
4610
- Ct.OP_HASH160,
4609
+ Lt.OP_DUP,
4610
+ Lt.OP_HASH160,
4611
4611
  s.hash,
4612
- Ct.OP_EQUALVERIFY,
4613
- Ct.OP_CHECKSIG
4612
+ Lt.OP_EQUALVERIFY,
4613
+ Lt.OP_CHECKSIG
4614
4614
  ]);
4615
- }), yt.prop(s, "pubkey", () => {
4615
+ }), bt.prop(s, "pubkey", () => {
4616
4616
  if (e.input)
4617
4617
  return n()[1];
4618
- }), yt.prop(s, "signature", () => {
4618
+ }), bt.prop(s, "signature", () => {
4619
4619
  if (e.input)
4620
4620
  return n()[0];
4621
- }), yt.prop(s, "input", () => {
4621
+ }), bt.prop(s, "input", () => {
4622
4622
  if (e.pubkey && e.signature)
4623
4623
  return Sr.compile([e.signature, e.pubkey]);
4624
- }), yt.prop(s, "witness", () => {
4624
+ }), bt.prop(s, "witness", () => {
4625
4625
  if (s.input)
4626
4626
  return [];
4627
4627
  }), t.validate) {
@@ -4638,7 +4638,7 @@ function eh(e, t) {
4638
4638
  o = e.hash;
4639
4639
  }
4640
4640
  if (e.output) {
4641
- if (e.output.length !== 25 || e.output[0] !== Ct.OP_DUP || e.output[1] !== Ct.OP_HASH160 || e.output[2] !== 20 || e.output[23] !== Ct.OP_EQUALVERIFY || e.output[24] !== Ct.OP_CHECKSIG)
4641
+ if (e.output.length !== 25 || e.output[0] !== Lt.OP_DUP || e.output[1] !== Lt.OP_HASH160 || e.output[2] !== 20 || e.output[23] !== Lt.OP_EQUALVERIFY || e.output[24] !== Lt.OP_CHECKSIG)
4642
4642
  throw new TypeError("Output is invalid");
4643
4643
  const a = e.output.slice(3, 23);
4644
4644
  if (o.length > 0 && !o.equals(a))
@@ -4669,37 +4669,37 @@ function eh(e, t) {
4669
4669
  }
4670
4670
  return Object.assign(s, e);
4671
4671
  }
4672
- gi.p2pkh = eh;
4672
+ gi.p2pkh = Zc;
4673
4673
  var mi = {};
4674
4674
  Object.defineProperty(mi, "__esModule", { value: !0 });
4675
4675
  mi.p2sh = void 0;
4676
- const Ao = Wt, th = Ce, ut = qe(), ue = Le, ot = ze, To = Ms, qr = ut.OPS;
4677
- function rh(e, t) {
4676
+ const Ao = Vt, eh = Ce, ut = qe(), ce = Le, ot = ze, To = Ms, qr = ut.OPS;
4677
+ function th(e, t) {
4678
4678
  if (!e.address && !e.hash && !e.output && !e.redeem && !e.input)
4679
4679
  throw new TypeError("Not enough data");
4680
- t = Object.assign({ validate: !0 }, t || {}), (0, ue.typeforce)(
4680
+ t = Object.assign({ validate: !0 }, t || {}), (0, ce.typeforce)(
4681
4681
  {
4682
- network: ue.typeforce.maybe(ue.typeforce.Object),
4683
- address: ue.typeforce.maybe(ue.typeforce.String),
4684
- hash: ue.typeforce.maybe(ue.typeforce.BufferN(20)),
4685
- output: ue.typeforce.maybe(ue.typeforce.BufferN(23)),
4686
- redeem: ue.typeforce.maybe({
4687
- network: ue.typeforce.maybe(ue.typeforce.Object),
4688
- output: ue.typeforce.maybe(ue.typeforce.Buffer),
4689
- input: ue.typeforce.maybe(ue.typeforce.Buffer),
4690
- witness: ue.typeforce.maybe(
4691
- ue.typeforce.arrayOf(ue.typeforce.Buffer)
4682
+ network: ce.typeforce.maybe(ce.typeforce.Object),
4683
+ address: ce.typeforce.maybe(ce.typeforce.String),
4684
+ hash: ce.typeforce.maybe(ce.typeforce.BufferN(20)),
4685
+ output: ce.typeforce.maybe(ce.typeforce.BufferN(23)),
4686
+ redeem: ce.typeforce.maybe({
4687
+ network: ce.typeforce.maybe(ce.typeforce.Object),
4688
+ output: ce.typeforce.maybe(ce.typeforce.Buffer),
4689
+ input: ce.typeforce.maybe(ce.typeforce.Buffer),
4690
+ witness: ce.typeforce.maybe(
4691
+ ce.typeforce.arrayOf(ce.typeforce.Buffer)
4692
4692
  )
4693
4693
  }),
4694
- input: ue.typeforce.maybe(ue.typeforce.Buffer),
4695
- witness: ue.typeforce.maybe(
4696
- ue.typeforce.arrayOf(ue.typeforce.Buffer)
4694
+ input: ce.typeforce.maybe(ce.typeforce.Buffer),
4695
+ witness: ce.typeforce.maybe(
4696
+ ce.typeforce.arrayOf(ce.typeforce.Buffer)
4697
4697
  )
4698
4698
  },
4699
4699
  e
4700
4700
  );
4701
4701
  let r = e.network;
4702
- r || (r = e.redeem && e.redeem.network || th.bitcoin);
4702
+ r || (r = e.redeem && e.redeem.network || eh.bitcoin);
4703
4703
  const n = { network: r }, i = ot.value(() => {
4704
4704
  const a = Buffer.from(To.decode(e.address)), c = a.readUInt8(0), l = a.slice(1);
4705
4705
  return { version: c, hash: l };
@@ -4782,8 +4782,8 @@ function rh(e, t) {
4782
4782
  if (d && b)
4783
4783
  throw new TypeError("Input and witness provided");
4784
4784
  if (d) {
4785
- const x = ut.decompile(l.input);
4786
- if (!ut.isPushOnly(x))
4785
+ const E = ut.decompile(l.input);
4786
+ if (!ut.isPushOnly(E))
4787
4787
  throw new TypeError("Non push-only scriptSig");
4788
4788
  }
4789
4789
  }
@@ -4807,15 +4807,15 @@ function rh(e, t) {
4807
4807
  }
4808
4808
  c(e.redeem);
4809
4809
  }
4810
- if (e.witness && e.redeem && e.redeem.witness && !(0, ue.stacksEqual)(e.redeem.witness, e.witness))
4810
+ if (e.witness && e.redeem && e.redeem.witness && !(0, ce.stacksEqual)(e.redeem.witness, e.witness))
4811
4811
  throw new TypeError("Witness and redeem.witness mismatch");
4812
4812
  }
4813
4813
  return Object.assign(n, e);
4814
4814
  }
4815
- mi.p2sh = rh;
4816
- var _i = {}, St = {};
4817
- Object.defineProperty(St, "__esModule", { value: !0 });
4818
- St.bech32m = St.bech32 = void 0;
4815
+ mi.p2sh = th;
4816
+ var _i = {}, Bt = {};
4817
+ Object.defineProperty(Bt, "__esModule", { value: !0 });
4818
+ Bt.bech32m = Bt.bech32 = void 0;
4819
4819
  const ni = "qpzry9x8gf2tvdw0s3jn54khce6mua7l", Ya = {};
4820
4820
  for (let e = 0; e < ni.length; e++) {
4821
4821
  const t = ni.charAt(e);
@@ -4856,15 +4856,15 @@ function Ds(e, t, r, n) {
4856
4856
  }
4857
4857
  return a;
4858
4858
  }
4859
- function nh(e) {
4859
+ function rh(e) {
4860
4860
  return Ds(e, 8, 5, !0);
4861
4861
  }
4862
- function ih(e) {
4862
+ function nh(e) {
4863
4863
  const t = Ds(e, 5, 8, !1);
4864
4864
  if (Array.isArray(t))
4865
4865
  return t;
4866
4866
  }
4867
- function sh(e) {
4867
+ function ih(e) {
4868
4868
  const t = Ds(e, 5, 8, !1);
4869
4869
  if (Array.isArray(t))
4870
4870
  return t;
@@ -4882,17 +4882,17 @@ function Xa(e) {
4882
4882
  throw new Error(l);
4883
4883
  let d = o + "1";
4884
4884
  for (let b = 0; b < a.length; ++b) {
4885
- const x = a[b];
4886
- if (x >> 5)
4885
+ const E = a[b];
4886
+ if (E >> 5)
4887
4887
  throw new Error("Non 5-bit word");
4888
- l = Ar(l) ^ x, d += ni.charAt(x);
4888
+ l = Ar(l) ^ E, d += ni.charAt(E);
4889
4889
  }
4890
4890
  for (let b = 0; b < 6; ++b)
4891
4891
  l = Ar(l);
4892
4892
  l ^= t;
4893
4893
  for (let b = 0; b < 6; ++b) {
4894
- const x = l >> (5 - b) * 5 & 31;
4895
- d += ni.charAt(x);
4894
+ const E = l >> (5 - b) * 5 & 31;
4895
+ d += ni.charAt(E);
4896
4896
  }
4897
4897
  return d;
4898
4898
  }
@@ -4910,18 +4910,18 @@ function Xa(e) {
4910
4910
  return "No separator character for " + o;
4911
4911
  if (d === 0)
4912
4912
  return "Missing prefix for " + o;
4913
- const b = o.slice(0, d), x = o.slice(d + 1);
4914
- if (x.length < 6)
4913
+ const b = o.slice(0, d), E = o.slice(d + 1);
4914
+ if (E.length < 6)
4915
4915
  return "Data too short";
4916
4916
  let p = Io(b);
4917
4917
  if (typeof p == "string")
4918
4918
  return p;
4919
4919
  const I = [];
4920
- for (let B = 0; B < x.length; ++B) {
4921
- const T = x.charAt(B), k = Ya[T];
4920
+ for (let B = 0; B < E.length; ++B) {
4921
+ const T = E.charAt(B), k = Ya[T];
4922
4922
  if (k === void 0)
4923
4923
  return "Unknown character " + T;
4924
- p = Ar(p) ^ k, !(B + 6 >= x.length) && I.push(k);
4924
+ p = Ar(p) ^ k, !(B + 6 >= E.length) && I.push(k);
4925
4925
  }
4926
4926
  return p !== t ? "Invalid checksum for " + o : { prefix: b, words: I };
4927
4927
  }
@@ -4940,17 +4940,17 @@ function Xa(e) {
4940
4940
  decodeUnsafe: i,
4941
4941
  decode: s,
4942
4942
  encode: r,
4943
- toWords: nh,
4944
- fromWordsUnsafe: ih,
4945
- fromWords: sh
4943
+ toWords: rh,
4944
+ fromWordsUnsafe: nh,
4945
+ fromWords: ih
4946
4946
  };
4947
4947
  }
4948
- St.bech32 = Xa("bech32");
4949
- St.bech32m = Xa("bech32m");
4948
+ Bt.bech32 = Xa("bech32");
4949
+ Bt.bech32m = Xa("bech32m");
4950
4950
  Object.defineProperty(_i, "__esModule", { value: !0 });
4951
4951
  _i.p2wpkh = void 0;
4952
- const Xi = Wt, oh = Ce, Kn = qe(), Se = Le, Lt = ze, Ln = St, Oo = Kn.OPS, ah = Buffer.alloc(0);
4953
- function fh(e, t) {
4952
+ const Xi = Vt, sh = Ce, Kn = qe(), Se = Le, Nt = ze, Ln = Bt, Oo = Kn.OPS, oh = Buffer.alloc(0);
4953
+ function ah(e, t) {
4954
4954
  if (!e.address && !e.hash && !e.output && !e.pubkey && !e.witness)
4955
4955
  throw new TypeError("Not enough data");
4956
4956
  t = Object.assign({ validate: !0 }, t || {}), (0, Se.typeforce)(
@@ -4968,36 +4968,36 @@ function fh(e, t) {
4968
4968
  },
4969
4969
  e
4970
4970
  );
4971
- const r = Lt.value(() => {
4971
+ const r = Nt.value(() => {
4972
4972
  const s = Ln.bech32.decode(e.address), o = s.words.shift(), a = Ln.bech32.fromWords(s.words);
4973
4973
  return {
4974
4974
  version: o,
4975
4975
  prefix: s.prefix,
4976
4976
  data: Buffer.from(a)
4977
4977
  };
4978
- }), n = e.network || oh.bitcoin, i = { name: "p2wpkh", network: n };
4979
- if (Lt.prop(i, "address", () => {
4978
+ }), n = e.network || sh.bitcoin, i = { name: "p2wpkh", network: n };
4979
+ if (Nt.prop(i, "address", () => {
4980
4980
  if (!i.hash) return;
4981
4981
  const s = Ln.bech32.toWords(i.hash);
4982
4982
  return s.unshift(0), Ln.bech32.encode(n.bech32, s);
4983
- }), Lt.prop(i, "hash", () => {
4983
+ }), Nt.prop(i, "hash", () => {
4984
4984
  if (e.output) return e.output.slice(2, 22);
4985
4985
  if (e.address) return r().data;
4986
4986
  if (e.pubkey || i.pubkey) return Xi.hash160(e.pubkey || i.pubkey);
4987
- }), Lt.prop(i, "output", () => {
4987
+ }), Nt.prop(i, "output", () => {
4988
4988
  if (i.hash)
4989
4989
  return Kn.compile([Oo.OP_0, i.hash]);
4990
- }), Lt.prop(i, "pubkey", () => {
4990
+ }), Nt.prop(i, "pubkey", () => {
4991
4991
  if (e.pubkey) return e.pubkey;
4992
4992
  if (e.witness)
4993
4993
  return e.witness[1];
4994
- }), Lt.prop(i, "signature", () => {
4994
+ }), Nt.prop(i, "signature", () => {
4995
4995
  if (e.witness)
4996
4996
  return e.witness[0];
4997
- }), Lt.prop(i, "input", () => {
4997
+ }), Nt.prop(i, "input", () => {
4998
4998
  if (i.witness)
4999
- return ah;
5000
- }), Lt.prop(i, "witness", () => {
4999
+ return oh;
5000
+ }), Nt.prop(i, "witness", () => {
5001
5001
  if (e.pubkey && e.signature)
5002
5002
  return [e.signature, e.pubkey];
5003
5003
  }), t.validate) {
@@ -5047,78 +5047,78 @@ function fh(e, t) {
5047
5047
  }
5048
5048
  return Object.assign(i, e);
5049
5049
  }
5050
- _i.p2wpkh = fh;
5050
+ _i.p2wpkh = ah;
5051
5051
  var vi = {};
5052
5052
  Object.defineProperty(vi, "__esModule", { value: !0 });
5053
5053
  vi.p2wsh = void 0;
5054
- const ko = Wt, uh = Ce, mt = qe(), oe = Le, bt = ze, Nn = St, Ro = mt.OPS, Ji = Buffer.alloc(0);
5054
+ const ko = Vt, fh = Ce, _t = qe(), ae = Le, wt = ze, Nn = Bt, Ro = _t.OPS, Ji = Buffer.alloc(0);
5055
5055
  function Fn(e) {
5056
- return !!(Buffer.isBuffer(e) && e.length === 65 && e[0] === 4 && (0, oe.isPoint)(e));
5056
+ return !!(Buffer.isBuffer(e) && e.length === 65 && e[0] === 4 && (0, ae.isPoint)(e));
5057
5057
  }
5058
- function ch(e, t) {
5058
+ function uh(e, t) {
5059
5059
  if (!e.address && !e.hash && !e.output && !e.redeem && !e.witness)
5060
5060
  throw new TypeError("Not enough data");
5061
- t = Object.assign({ validate: !0 }, t || {}), (0, oe.typeforce)(
5061
+ t = Object.assign({ validate: !0 }, t || {}), (0, ae.typeforce)(
5062
5062
  {
5063
- network: oe.typeforce.maybe(oe.typeforce.Object),
5064
- address: oe.typeforce.maybe(oe.typeforce.String),
5065
- hash: oe.typeforce.maybe(oe.typeforce.BufferN(32)),
5066
- output: oe.typeforce.maybe(oe.typeforce.BufferN(34)),
5067
- redeem: oe.typeforce.maybe({
5068
- input: oe.typeforce.maybe(oe.typeforce.Buffer),
5069
- network: oe.typeforce.maybe(oe.typeforce.Object),
5070
- output: oe.typeforce.maybe(oe.typeforce.Buffer),
5071
- witness: oe.typeforce.maybe(
5072
- oe.typeforce.arrayOf(oe.typeforce.Buffer)
5063
+ network: ae.typeforce.maybe(ae.typeforce.Object),
5064
+ address: ae.typeforce.maybe(ae.typeforce.String),
5065
+ hash: ae.typeforce.maybe(ae.typeforce.BufferN(32)),
5066
+ output: ae.typeforce.maybe(ae.typeforce.BufferN(34)),
5067
+ redeem: ae.typeforce.maybe({
5068
+ input: ae.typeforce.maybe(ae.typeforce.Buffer),
5069
+ network: ae.typeforce.maybe(ae.typeforce.Object),
5070
+ output: ae.typeforce.maybe(ae.typeforce.Buffer),
5071
+ witness: ae.typeforce.maybe(
5072
+ ae.typeforce.arrayOf(ae.typeforce.Buffer)
5073
5073
  )
5074
5074
  }),
5075
- input: oe.typeforce.maybe(oe.typeforce.BufferN(0)),
5076
- witness: oe.typeforce.maybe(
5077
- oe.typeforce.arrayOf(oe.typeforce.Buffer)
5075
+ input: ae.typeforce.maybe(ae.typeforce.BufferN(0)),
5076
+ witness: ae.typeforce.maybe(
5077
+ ae.typeforce.arrayOf(ae.typeforce.Buffer)
5078
5078
  )
5079
5079
  },
5080
5080
  e
5081
5081
  );
5082
- const r = bt.value(() => {
5082
+ const r = wt.value(() => {
5083
5083
  const o = Nn.bech32.decode(e.address), a = o.words.shift(), c = Nn.bech32.fromWords(o.words);
5084
5084
  return {
5085
5085
  version: a,
5086
5086
  prefix: o.prefix,
5087
5087
  data: Buffer.from(c)
5088
5088
  };
5089
- }), n = bt.value(() => mt.decompile(e.redeem.input));
5089
+ }), n = wt.value(() => _t.decompile(e.redeem.input));
5090
5090
  let i = e.network;
5091
- i || (i = e.redeem && e.redeem.network || uh.bitcoin);
5091
+ i || (i = e.redeem && e.redeem.network || fh.bitcoin);
5092
5092
  const s = { network: i };
5093
- if (bt.prop(s, "address", () => {
5093
+ if (wt.prop(s, "address", () => {
5094
5094
  if (!s.hash) return;
5095
5095
  const o = Nn.bech32.toWords(s.hash);
5096
5096
  return o.unshift(0), Nn.bech32.encode(i.bech32, o);
5097
- }), bt.prop(s, "hash", () => {
5097
+ }), wt.prop(s, "hash", () => {
5098
5098
  if (e.output) return e.output.slice(2);
5099
5099
  if (e.address) return r().data;
5100
5100
  if (s.redeem && s.redeem.output) return ko.sha256(s.redeem.output);
5101
- }), bt.prop(s, "output", () => {
5101
+ }), wt.prop(s, "output", () => {
5102
5102
  if (s.hash)
5103
- return mt.compile([Ro.OP_0, s.hash]);
5104
- }), bt.prop(s, "redeem", () => {
5103
+ return _t.compile([Ro.OP_0, s.hash]);
5104
+ }), wt.prop(s, "redeem", () => {
5105
5105
  if (e.witness)
5106
5106
  return {
5107
5107
  output: e.witness[e.witness.length - 1],
5108
5108
  input: Ji,
5109
5109
  witness: e.witness.slice(0, -1)
5110
5110
  };
5111
- }), bt.prop(s, "input", () => {
5111
+ }), wt.prop(s, "input", () => {
5112
5112
  if (s.witness)
5113
5113
  return Ji;
5114
- }), bt.prop(s, "witness", () => {
5114
+ }), wt.prop(s, "witness", () => {
5115
5115
  if (e.redeem && e.redeem.input && e.redeem.input.length > 0 && e.redeem.output && e.redeem.output.length > 0) {
5116
- const o = mt.toStack(n());
5116
+ const o = _t.toStack(n());
5117
5117
  return s.redeem = Object.assign({ witness: o }, e.redeem), s.redeem.input = Ji, [].concat(o, e.redeem.output);
5118
5118
  }
5119
5119
  if (e.redeem && e.redeem.output && e.redeem.witness)
5120
5120
  return [].concat(e.redeem.witness, e.redeem.output);
5121
- }), bt.prop(s, "name", () => {
5121
+ }), wt.prop(s, "name", () => {
5122
5122
  const o = ["p2wsh"];
5123
5123
  return s.redeem !== void 0 && s.redeem.name !== void 0 && o.push(s.redeem.name), o.join("-");
5124
5124
  }), t.validate) {
@@ -5151,14 +5151,14 @@ function ch(e, t) {
5151
5151
  if (e.redeem.input && e.redeem.input.length > 0 && e.redeem.witness && e.redeem.witness.length > 0)
5152
5152
  throw new TypeError("Ambiguous witness source");
5153
5153
  if (e.redeem.output) {
5154
- const a = mt.decompile(e.redeem.output);
5154
+ const a = _t.decompile(e.redeem.output);
5155
5155
  if (!a || a.length < 1)
5156
5156
  throw new TypeError("Redeem.output is invalid");
5157
5157
  if (e.redeem.output.byteLength > 3600)
5158
5158
  throw new TypeError(
5159
5159
  "Redeem.output unspendable if larger than 3600 bytes"
5160
5160
  );
5161
- if (mt.countNonPushOnlyOPs(a) > 201)
5161
+ if (_t.countNonPushOnlyOPs(a) > 201)
5162
5162
  throw new TypeError(
5163
5163
  "Redeem.output unspendable with more than 201 non-push ops"
5164
5164
  );
@@ -5167,11 +5167,11 @@ function ch(e, t) {
5167
5167
  throw new TypeError("Hash mismatch");
5168
5168
  o = c;
5169
5169
  }
5170
- if (e.redeem.input && !mt.isPushOnly(n()))
5170
+ if (e.redeem.input && !_t.isPushOnly(n()))
5171
5171
  throw new TypeError("Non push-only scriptSig");
5172
- if (e.witness && e.redeem.witness && !(0, oe.stacksEqual)(e.witness, e.redeem.witness))
5172
+ if (e.witness && e.redeem.witness && !(0, ae.stacksEqual)(e.witness, e.redeem.witness))
5173
5173
  throw new TypeError("Witness and redeem.witness mismatch");
5174
- if (e.redeem.input && n().some(Fn) || e.redeem.output && (mt.decompile(e.redeem.output) || []).some(
5174
+ if (e.redeem.input && n().some(Fn) || e.redeem.output && (_t.decompile(e.redeem.output) || []).some(
5175
5175
  Fn
5176
5176
  ))
5177
5177
  throw new TypeError(
@@ -5182,64 +5182,64 @@ function ch(e, t) {
5182
5182
  const a = e.witness[e.witness.length - 1];
5183
5183
  if (e.redeem && e.redeem.output && !e.redeem.output.equals(a))
5184
5184
  throw new TypeError("Witness and redeem.output mismatch");
5185
- if (e.witness.some(Fn) || (mt.decompile(a) || []).some(Fn))
5185
+ if (e.witness.some(Fn) || (_t.decompile(a) || []).some(Fn))
5186
5186
  throw new TypeError("Witness contains uncompressed pubkey");
5187
5187
  }
5188
5188
  }
5189
5189
  return Object.assign(s, e);
5190
5190
  }
5191
- vi.p2wsh = ch;
5191
+ vi.p2wsh = uh;
5192
5192
  var Kr = {}, sr = {};
5193
5193
  Object.defineProperty(sr, "__esModule", { value: !0 });
5194
5194
  sr.getEccLib = sr.initEccLib = void 0;
5195
5195
  const cn = {};
5196
- function hh(e) {
5197
- e ? e !== cn.eccLib && (dh(e), cn.eccLib = e) : cn.eccLib = e;
5196
+ function ch(e) {
5197
+ e ? e !== cn.eccLib && (lh(e), cn.eccLib = e) : cn.eccLib = e;
5198
5198
  }
5199
- sr.initEccLib = hh;
5200
- function lh() {
5199
+ sr.initEccLib = ch;
5200
+ function hh() {
5201
5201
  if (!cn.eccLib)
5202
5202
  throw new Error(
5203
5203
  "No ECC Library provided. You must call initEccLib() with a valid TinySecp256k1Interface instance"
5204
5204
  );
5205
5205
  return cn.eccLib;
5206
5206
  }
5207
- sr.getEccLib = lh;
5208
- const wt = (e) => Buffer.from(e, "hex");
5209
- function dh(e) {
5207
+ sr.getEccLib = hh;
5208
+ const gt = (e) => Buffer.from(e, "hex");
5209
+ function lh(e) {
5210
5210
  Ye(typeof e.isXOnlyPoint == "function"), Ye(
5211
5211
  e.isXOnlyPoint(
5212
- wt("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798")
5212
+ gt("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798")
5213
5213
  )
5214
5214
  ), Ye(
5215
5215
  e.isXOnlyPoint(
5216
- wt("fffffffffffffffffffffffffffffffffffffffffffffffffffffffeeffffc2e")
5216
+ gt("fffffffffffffffffffffffffffffffffffffffffffffffffffffffeeffffc2e")
5217
5217
  )
5218
5218
  ), Ye(
5219
5219
  e.isXOnlyPoint(
5220
- wt("f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9")
5220
+ gt("f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9")
5221
5221
  )
5222
5222
  ), Ye(
5223
5223
  e.isXOnlyPoint(
5224
- wt("0000000000000000000000000000000000000000000000000000000000000001")
5224
+ gt("0000000000000000000000000000000000000000000000000000000000000001")
5225
5225
  )
5226
5226
  ), Ye(
5227
5227
  !e.isXOnlyPoint(
5228
- wt("0000000000000000000000000000000000000000000000000000000000000000")
5228
+ gt("0000000000000000000000000000000000000000000000000000000000000000")
5229
5229
  )
5230
5230
  ), Ye(
5231
5231
  !e.isXOnlyPoint(
5232
- wt("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f")
5232
+ gt("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f")
5233
5233
  )
5234
- ), Ye(typeof e.xOnlyPointAddTweak == "function"), ph.forEach((t) => {
5235
- const r = e.xOnlyPointAddTweak(wt(t.pubkey), wt(t.tweak));
5236
- t.result === null ? Ye(r === null) : (Ye(r !== null), Ye(r.parity === t.parity), Ye(Buffer.from(r.xOnlyPubkey).equals(wt(t.result))));
5234
+ ), Ye(typeof e.xOnlyPointAddTweak == "function"), dh.forEach((t) => {
5235
+ const r = e.xOnlyPointAddTweak(gt(t.pubkey), gt(t.tweak));
5236
+ t.result === null ? Ye(r === null) : (Ye(r !== null), Ye(r.parity === t.parity), Ye(Buffer.from(r.xOnlyPubkey).equals(gt(t.result))));
5237
5237
  });
5238
5238
  }
5239
5239
  function Ye(e) {
5240
5240
  if (!e) throw new Error("ecc library invalid");
5241
5241
  }
5242
- const ph = [
5242
+ const dh = [
5243
5243
  {
5244
5244
  pubkey: "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",
5245
5245
  tweak: "fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140",
@@ -5262,7 +5262,7 @@ const ph = [
5262
5262
  var $s = {};
5263
5263
  (function(e) {
5264
5264
  Object.defineProperty(e, "__esModule", { value: !0 }), e.tweakKey = e.tapTweakHash = e.tapleafHash = e.findScriptPath = e.toHashTree = e.rootHashFromPath = e.MAX_TAPTREE_DEPTH = e.LEAF_VERSION_TAPSCRIPT = void 0;
5265
- const t = Pt, r = sr, n = Wt, i = Te, s = Le;
5265
+ const t = At, r = sr, n = Vt, i = Ae, s = Le;
5266
5266
  e.LEAF_VERSION_TAPSCRIPT = 192, e.MAX_TAPTREE_DEPTH = 128;
5267
5267
  const o = (B) => "left" in B && "right" in B;
5268
5268
  function a(B, T) {
@@ -5320,7 +5320,7 @@ var $s = {};
5320
5320
  );
5321
5321
  }
5322
5322
  e.tapTweakHash = b;
5323
- function x(B, T) {
5323
+ function E(B, T) {
5324
5324
  if (!t.Buffer.isBuffer(B) || B.length !== 32 || T && T.length !== 32) return null;
5325
5325
  const k = b(B, T), U = (0, r.getEccLib)().xOnlyPointAddTweak(B, k);
5326
5326
  return !U || U.xOnlyPubkey === null ? null : {
@@ -5328,7 +5328,7 @@ var $s = {};
5328
5328
  x: t.Buffer.from(U.xOnlyPubkey)
5329
5329
  };
5330
5330
  }
5331
- e.tweakKey = x;
5331
+ e.tweakKey = E;
5332
5332
  function p(B, T) {
5333
5333
  return n.taggedHash("TapBranch", t.Buffer.concat([B, T]));
5334
5334
  }
@@ -5338,27 +5338,27 @@ var $s = {};
5338
5338
  }
5339
5339
  })($s);
5340
5340
  var He = {}, Uo;
5341
- function yh() {
5341
+ function ph() {
5342
5342
  if (Uo) return He;
5343
5343
  Uo = 1, Object.defineProperty(He, "__esModule", { value: !0 }), He.toOutputScript = He.fromOutputScript = He.toBech32 = He.toBase58Check = He.fromBech32 = He.fromBase58Check = void 0;
5344
- const e = Ce, t = js(), r = qe(), n = Le, i = St, s = Ms, o = 40, a = 2, c = 16, l = 2, d = 80, b = "WARNING: Sending to a future segwit version address can lead to loss of funds. End users MUST be warned carefully in the GUI and asked if they wish to proceed with caution. Wallets should verify the segwit version from the output of fromBech32, then decide when it is safe to use which version of segwit.";
5345
- function x(_, m) {
5344
+ const e = Ce, t = js(), r = qe(), n = Le, i = Bt, s = Ms, o = 40, a = 2, c = 16, l = 2, d = 80, b = "WARNING: Sending to a future segwit version address can lead to loss of funds. End users MUST be warned carefully in the GUI and asked if they wish to proceed with caution. Wallets should verify the segwit version from the output of fromBech32, then decide when it is safe to use which version of segwit.";
5345
+ function E(_, m) {
5346
5346
  const S = _.slice(2);
5347
5347
  if (S.length < a || S.length > o)
5348
5348
  throw new TypeError("Invalid program length for segwit address");
5349
- const E = _[0] - d;
5350
- if (E < l || E > c)
5349
+ const x = _[0] - d;
5350
+ if (x < l || x > c)
5351
5351
  throw new TypeError("Invalid version for segwit address");
5352
5352
  if (_[1] !== S.length)
5353
5353
  throw new TypeError("Invalid script for segwit address");
5354
- return console.warn(b), T(S, E, m.bech32);
5354
+ return console.warn(b), T(S, x, m.bech32);
5355
5355
  }
5356
5356
  function p(_) {
5357
5357
  const m = Buffer.from(s.decode(_));
5358
5358
  if (m.length < 21) throw new TypeError(_ + " is too short");
5359
5359
  if (m.length > 21) throw new TypeError(_ + " is too long");
5360
- const S = m.readUInt8(0), E = m.slice(1);
5361
- return { version: S, hash: E };
5360
+ const S = m.readUInt8(0), x = m.slice(1);
5361
+ return { version: S, hash: x };
5362
5362
  }
5363
5363
  He.fromBase58Check = p;
5364
5364
  function I(_) {
@@ -5370,11 +5370,11 @@ function yh() {
5370
5370
  if (m) {
5371
5371
  if (S = m.words[0], S !== 0) throw new TypeError(_ + " uses wrong encoding");
5372
5372
  } else if (m = i.bech32m.decode(_), S = m.words[0], S === 0) throw new TypeError(_ + " uses wrong encoding");
5373
- const E = i.bech32.fromWords(m.words.slice(1));
5373
+ const x = i.bech32.fromWords(m.words.slice(1));
5374
5374
  return {
5375
5375
  version: S,
5376
5376
  prefix: m.prefix,
5377
- data: Buffer.from(E)
5377
+ data: Buffer.from(x)
5378
5378
  };
5379
5379
  }
5380
5380
  He.fromBech32 = I;
@@ -5388,8 +5388,8 @@ function yh() {
5388
5388
  }
5389
5389
  He.toBase58Check = B;
5390
5390
  function T(_, m, S) {
5391
- const E = i.bech32.toWords(_);
5392
- return E.unshift(m), m === 0 ? i.bech32.encode(S, E) : i.bech32m.encode(S, E);
5391
+ const x = i.bech32.toWords(_);
5392
+ return x.unshift(m), m === 0 ? i.bech32.encode(S, x) : i.bech32m.encode(S, x);
5393
5393
  }
5394
5394
  He.toBech32 = T;
5395
5395
  function k(_, m) {
@@ -5415,7 +5415,7 @@ function yh() {
5415
5415
  } catch {
5416
5416
  }
5417
5417
  try {
5418
- return x(_, m);
5418
+ return E(_, m);
5419
5419
  } catch {
5420
5420
  }
5421
5421
  throw new Error(r.toASM(_) + " has no matching Address");
@@ -5423,7 +5423,7 @@ function yh() {
5423
5423
  He.fromOutputScript = k;
5424
5424
  function U(_, m) {
5425
5425
  m = m || e.bitcoin;
5426
- let S, E;
5426
+ let S, x;
5427
5427
  try {
5428
5428
  S = p(_);
5429
5429
  } catch {
@@ -5435,24 +5435,24 @@ function yh() {
5435
5435
  return t.p2sh({ hash: S.hash }).output;
5436
5436
  } else {
5437
5437
  try {
5438
- E = I(_);
5438
+ x = I(_);
5439
5439
  } catch {
5440
5440
  }
5441
- if (E) {
5442
- if (E.prefix !== m.bech32)
5441
+ if (x) {
5442
+ if (x.prefix !== m.bech32)
5443
5443
  throw new Error(_ + " has an invalid prefix");
5444
- if (E.version === 0) {
5445
- if (E.data.length === 20)
5446
- return t.p2wpkh({ hash: E.data }).output;
5447
- if (E.data.length === 32)
5448
- return t.p2wsh({ hash: E.data }).output;
5449
- } else if (E.version === 1) {
5450
- if (E.data.length === 32)
5451
- return t.p2tr({ pubkey: E.data }).output;
5452
- } else if (E.version >= l && E.version <= c && E.data.length >= a && E.data.length <= o)
5444
+ if (x.version === 0) {
5445
+ if (x.data.length === 20)
5446
+ return t.p2wpkh({ hash: x.data }).output;
5447
+ if (x.data.length === 32)
5448
+ return t.p2wsh({ hash: x.data }).output;
5449
+ } else if (x.version === 1) {
5450
+ if (x.data.length === 32)
5451
+ return t.p2tr({ pubkey: x.data }).output;
5452
+ } else if (x.version >= l && x.version <= c && x.data.length >= a && x.data.length <= o)
5453
5453
  return console.warn(b), r.compile([
5454
- E.version + d,
5455
- E.data
5454
+ x.version + d,
5455
+ x.data
5456
5456
  ]);
5457
5457
  }
5458
5458
  }
@@ -5461,11 +5461,11 @@ function yh() {
5461
5461
  return He.toOutputScript = U, He;
5462
5462
  }
5463
5463
  var Co;
5464
- function bh() {
5464
+ function yh() {
5465
5465
  if (Co) return Kr;
5466
5466
  Co = 1, Object.defineProperty(Kr, "__esModule", { value: !0 }), Kr.p2tr = void 0;
5467
- const e = Pt, t = Ce, r = qe(), n = Le, i = sr, s = $s, o = ze, a = St, c = yh(), l = r.OPS, d = 1, b = 80;
5468
- function x(p, I) {
5467
+ const e = At, t = Ce, r = qe(), n = Le, i = sr, s = $s, o = ze, a = Bt, c = ph(), l = r.OPS, d = 1, b = 80;
5468
+ function E(p, I) {
5469
5469
  if (!p.address && !p.output && !p.pubkey && !p.internalPubkey && !(p.witness && p.witness.length > 1))
5470
5470
  throw new TypeError("Not enough data");
5471
5471
  I = Object.assign({ validate: !0 }, I || {}), (0, n.typeforce)(
@@ -5514,11 +5514,11 @@ function bh() {
5514
5514
  if (m) return m.hash;
5515
5515
  const S = T();
5516
5516
  if (S && S.length > 1) {
5517
- const E = S[S.length - 1], M = E[0] & n.TAPLEAF_VERSION_MASK, $ = S[S.length - 2], R = (0, s.tapleafHash)({
5517
+ const x = S[S.length - 1], M = x[0] & n.TAPLEAF_VERSION_MASK, $ = S[S.length - 2], R = (0, s.tapleafHash)({
5518
5518
  output: $,
5519
5519
  version: M
5520
5520
  });
5521
- return (0, s.rootHashFromPath)(E, R);
5521
+ return (0, s.rootHashFromPath)(x, R);
5522
5522
  }
5523
5523
  return null;
5524
5524
  }), o.prop(_, "output", () => {
@@ -5557,15 +5557,15 @@ function bh() {
5557
5557
  const S = (0, s.tapleafHash)({
5558
5558
  output: p.redeem.output,
5559
5559
  version: _.redeemVersion
5560
- }), E = (0, s.findScriptPath)(m, S);
5561
- if (!E) return;
5560
+ }), x = (0, s.findScriptPath)(m, S);
5561
+ if (!x) return;
5562
5562
  const M = (0, s.tweakKey)(p.internalPubkey, m.hash);
5563
5563
  if (!M) return;
5564
5564
  const $ = e.Buffer.concat(
5565
5565
  [
5566
5566
  e.Buffer.from([_.redeemVersion | M.parity]),
5567
5567
  p.internalPubkey
5568
- ].concat(E)
5568
+ ].concat(x)
5569
5569
  );
5570
5570
  return [p.redeem.output, $];
5571
5571
  }
@@ -5612,7 +5612,7 @@ function bh() {
5612
5612
  if (!(0, s.findScriptPath)(S, M))
5613
5613
  throw new TypeError("Redeem script not in tree");
5614
5614
  }
5615
- const E = T();
5615
+ const x = T();
5616
5616
  if (p.redeem && _.redeem) {
5617
5617
  if (p.redeem.redeemVersion && p.redeem.redeemVersion !== _.redeem.redeemVersion)
5618
5618
  throw new TypeError("Redeem.redeemVersion and witness mismatch");
@@ -5625,12 +5625,12 @@ function bh() {
5625
5625
  if (p.redeem.witness && _.redeem.witness && !(0, n.stacksEqual)(p.redeem.witness, _.redeem.witness))
5626
5626
  throw new TypeError("Redeem.witness and witness mismatch");
5627
5627
  }
5628
- if (E && E.length)
5629
- if (E.length === 1) {
5630
- if (p.signature && !p.signature.equals(E[0]))
5628
+ if (x && x.length)
5629
+ if (x.length === 1) {
5630
+ if (p.signature && !p.signature.equals(x[0]))
5631
5631
  throw new TypeError("Signature mismatch");
5632
5632
  } else {
5633
- const M = E[E.length - 1];
5633
+ const M = x[x.length - 1];
5634
5634
  if (M.length < 33)
5635
5635
  throw new TypeError(
5636
5636
  `The control-block length is too small. Got ${M.length}, expected min 33.`
@@ -5649,7 +5649,7 @@ function bh() {
5649
5649
  throw new TypeError("Internal pubkey mismatch");
5650
5650
  if (!(0, i.getEccLib)().isXOnlyPoint(R))
5651
5651
  throw new TypeError("Invalid internalPubkey for p2tr witness");
5652
- const z = M[0] & n.TAPLEAF_VERSION_MASK, Z = E[E.length - 2], C = (0, s.tapleafHash)({
5652
+ const z = M[0] & n.TAPLEAF_VERSION_MASK, Z = x[x.length - 2], C = (0, s.tapleafHash)({
5653
5653
  output: Z,
5654
5654
  version: z
5655
5655
  }), H = (0, s.rootHashFromPath)(M, C), W = (0, s.tweakKey)(R, H);
@@ -5663,7 +5663,7 @@ function bh() {
5663
5663
  }
5664
5664
  return Object.assign(_, p);
5665
5665
  }
5666
- return Kr.p2tr = x, Kr;
5666
+ return Kr.p2tr = E, Kr;
5667
5667
  }
5668
5668
  var Lo;
5669
5669
  function js() {
@@ -5718,7 +5718,7 @@ function js() {
5718
5718
  return a.p2wsh;
5719
5719
  }
5720
5720
  });
5721
- const c = bh();
5721
+ const c = yh();
5722
5722
  Object.defineProperty(e, "p2tr", {
5723
5723
  enumerable: !0,
5724
5724
  get: function() {
@@ -5727,9 +5727,9 @@ function js() {
5727
5727
  });
5728
5728
  }(qi)), qi;
5729
5729
  }
5730
- Object.defineProperty(se, "__esModule", { value: !0 });
5731
- se.signatureBlocksAction = se.checkInputForSig = se.pubkeyInScript = se.pubkeyPositionInScript = se.witnessStackToScriptWitness = se.isP2TR = se.isP2SHScript = se.isP2WSHScript = se.isP2WPKH = se.isP2PKH = se.isP2PK = se.isP2MS = void 0;
5732
- const No = _n, hn = qe(), Hn = gn, wh = Wt, hr = js();
5730
+ Object.defineProperty(oe, "__esModule", { value: !0 });
5731
+ oe.signatureBlocksAction = oe.checkInputForSig = oe.pubkeyInScript = oe.pubkeyPositionInScript = oe.witnessStackToScriptWitness = oe.isP2TR = oe.isP2SHScript = oe.isP2WSHScript = oe.isP2WPKH = oe.isP2PKH = oe.isP2PK = oe.isP2MS = void 0;
5732
+ const No = _n, hn = qe(), Hn = gn, bh = Vt, hr = js();
5733
5733
  function lr(e) {
5734
5734
  return (t) => {
5735
5735
  try {
@@ -5739,14 +5739,14 @@ function lr(e) {
5739
5739
  }
5740
5740
  };
5741
5741
  }
5742
- se.isP2MS = lr(hr.p2ms);
5743
- se.isP2PK = lr(hr.p2pk);
5744
- se.isP2PKH = lr(hr.p2pkh);
5745
- se.isP2WPKH = lr(hr.p2wpkh);
5746
- se.isP2WSHScript = lr(hr.p2wsh);
5747
- se.isP2SHScript = lr(hr.p2sh);
5748
- se.isP2TR = lr(hr.p2tr);
5749
- function gh(e) {
5742
+ oe.isP2MS = lr(hr.p2ms);
5743
+ oe.isP2PK = lr(hr.p2pk);
5744
+ oe.isP2PKH = lr(hr.p2pkh);
5745
+ oe.isP2WPKH = lr(hr.p2wpkh);
5746
+ oe.isP2WSHScript = lr(hr.p2wsh);
5747
+ oe.isP2SHScript = lr(hr.p2sh);
5748
+ oe.isP2TR = lr(hr.p2tr);
5749
+ function wh(e) {
5750
5750
  let t = Buffer.allocUnsafe(0);
5751
5751
  function r(o) {
5752
5752
  t = Buffer.concat([t, Buffer.from(o)]);
@@ -5763,23 +5763,23 @@ function gh(e) {
5763
5763
  }
5764
5764
  return s(e), t;
5765
5765
  }
5766
- se.witnessStackToScriptWitness = gh;
5766
+ oe.witnessStackToScriptWitness = wh;
5767
5767
  function Ja(e, t) {
5768
- const r = (0, wh.hash160)(e), n = e.slice(1, 33), i = hn.decompile(t);
5768
+ const r = (0, bh.hash160)(e), n = e.slice(1, 33), i = hn.decompile(t);
5769
5769
  if (i === null) throw new Error("Unknown script error");
5770
5770
  return i.findIndex((s) => typeof s == "number" ? !1 : s.equals(e) || s.equals(r) || s.equals(n));
5771
5771
  }
5772
- se.pubkeyPositionInScript = Ja;
5773
- function mh(e, t) {
5772
+ oe.pubkeyPositionInScript = Ja;
5773
+ function gh(e, t) {
5774
5774
  return Ja(e, t) !== -1;
5775
5775
  }
5776
- se.pubkeyInScript = mh;
5777
- function _h(e, t) {
5778
- return vh(e).some(
5776
+ oe.pubkeyInScript = gh;
5777
+ function mh(e, t) {
5778
+ return _h(e).some(
5779
5779
  (n) => Qa(n, hn.signature.decode, t)
5780
5780
  );
5781
5781
  }
5782
- se.checkInputForSig = _h;
5782
+ oe.checkInputForSig = mh;
5783
5783
  function Qa(e, t, r) {
5784
5784
  const { hashType: n } = t(e), i = [];
5785
5785
  switch (n & Hn.Transaction.SIGHASH_ANYONECANPAY && i.push("addInput"), n & 31) {
@@ -5792,32 +5792,32 @@ function Qa(e, t, r) {
5792
5792
  }
5793
5793
  return i.indexOf(r) === -1;
5794
5794
  }
5795
- se.signatureBlocksAction = Qa;
5796
- function vh(e) {
5795
+ oe.signatureBlocksAction = Qa;
5796
+ function _h(e) {
5797
5797
  let t = [];
5798
5798
  if ((e.partialSig || []).length === 0) {
5799
5799
  if (!e.finalScriptSig && !e.finalScriptWitness) return [];
5800
- t = Eh(e);
5800
+ t = vh(e);
5801
5801
  } else
5802
5802
  t = e.partialSig;
5803
5803
  return t.map((r) => r.signature);
5804
5804
  }
5805
- function Eh(e) {
5805
+ function vh(e) {
5806
5806
  const t = e.finalScriptSig ? hn.decompile(e.finalScriptSig) || [] : [], r = e.finalScriptWitness ? hn.decompile(e.finalScriptWitness) || [] : [];
5807
5807
  return t.concat(r).filter((n) => Buffer.isBuffer(n) && hn.isCanonicalScriptSignature(n)).map((n) => ({ signature: n }));
5808
5808
  }
5809
5809
  Object.defineProperty(ge, "__esModule", { value: !0 });
5810
5810
  ge.checkTaprootInputForSigs = ge.tapTreeFromList = ge.tapTreeToList = ge.tweakInternalPubKey = ge.checkTaprootOutputFields = ge.checkTaprootInputFields = ge.isTaprootOutput = ge.isTaprootInput = Yn = ge.serializeTaprootSignature = ge.tapScriptFinalizer = ge.toXOnly = void 0;
5811
- const Gs = Le, xh = gn, Ei = se, Gt = $s, Sh = js(), Bh = se, Ph = (e) => e.length === 32 ? e : e.slice(1, 33);
5812
- ge.toXOnly = Ph;
5813
- function Ah(e, t, r) {
5814
- const n = Vh(
5811
+ const Gs = Le, Eh = gn, Ei = oe, Wt = $s, xh = js(), Sh = oe, Bh = (e) => e.length === 32 ? e : e.slice(1, 33);
5812
+ ge.toXOnly = Bh;
5813
+ function Ph(e, t, r) {
5814
+ const n = Wh(
5815
5815
  t,
5816
5816
  e,
5817
5817
  r
5818
5818
  );
5819
5819
  try {
5820
- const s = Gh(t, n).concat(n.script).concat(n.controlBlock);
5820
+ const s = jh(t, n).concat(n.script).concat(n.controlBlock);
5821
5821
  return {
5822
5822
  finalScriptWitness: (0, Ei.witnessStackToScriptWitness)(s)
5823
5823
  };
@@ -5825,12 +5825,12 @@ function Ah(e, t, r) {
5825
5825
  throw new Error(`Can not finalize taproot input #${e}: ${i}`);
5826
5826
  }
5827
5827
  }
5828
- ge.tapScriptFinalizer = Ah;
5829
- function Th(e, t) {
5828
+ ge.tapScriptFinalizer = Ph;
5829
+ function Ah(e, t) {
5830
5830
  const r = t ? Buffer.from([t]) : Buffer.from([]);
5831
5831
  return Buffer.concat([e, r]);
5832
5832
  }
5833
- var Yn = ge.serializeTaprootSignature = Th;
5833
+ var Yn = ge.serializeTaprootSignature = Ah;
5834
5834
  function Xn(e) {
5835
5835
  return e && !!(e.tapInternalKey || e.tapMerkleRoot || e.tapLeafScript && e.tapLeafScript.length || e.tapBip32Derivation && e.tapBip32Derivation.length || e.witnessUtxo && (0, Ei.isP2TR)(e.witnessUtxo.script));
5836
5836
  }
@@ -5839,96 +5839,96 @@ function Jn(e, t) {
5839
5839
  return e && !!(e.tapInternalKey || e.tapTree || e.tapBip32Derivation && e.tapBip32Derivation.length || t && (0, Ei.isP2TR)(t));
5840
5840
  }
5841
5841
  ge.isTaprootOutput = Jn;
5842
- function Ih(e, t, r) {
5843
- Dh(e, t, r), jh(e, t, r);
5842
+ function Th(e, t, r) {
5843
+ Mh(e, t, r), $h(e, t, r);
5844
5844
  }
5845
- ge.checkTaprootInputFields = Ih;
5846
- function Oh(e, t, r) {
5847
- $h(e, t, r), kh(e, t);
5845
+ ge.checkTaprootInputFields = Th;
5846
+ function Ih(e, t, r) {
5847
+ Dh(e, t, r), Oh(e, t);
5848
5848
  }
5849
- ge.checkTaprootOutputFields = Oh;
5850
- function kh(e, t) {
5849
+ ge.checkTaprootOutputFields = Ih;
5850
+ function Oh(e, t) {
5851
5851
  if (!t.tapTree && !t.tapInternalKey) return;
5852
5852
  const r = t.tapInternalKey || e.tapInternalKey, n = t.tapTree || e.tapTree;
5853
5853
  if (r) {
5854
- const { script: i } = e, s = Rh(r, n);
5854
+ const { script: i } = e, s = kh(r, n);
5855
5855
  if (i && !i.equals(s))
5856
5856
  throw new Error("Error adding output. Script or address missmatch.");
5857
5857
  }
5858
5858
  }
5859
- function Rh(e, t) {
5860
- const r = t && Za(t.leaves), { output: n } = (0, Sh.p2tr)({
5859
+ function kh(e, t) {
5860
+ const r = t && Za(t.leaves), { output: n } = (0, xh.p2tr)({
5861
5861
  internalPubkey: e,
5862
5862
  scriptTree: r
5863
5863
  });
5864
5864
  return n;
5865
5865
  }
5866
- function Uh(e, t) {
5867
- const r = t.tapInternalKey, n = r && (0, Gt.tweakKey)(r, t.tapMerkleRoot);
5866
+ function Rh(e, t) {
5867
+ const r = t.tapInternalKey, n = r && (0, Wt.tweakKey)(r, t.tapMerkleRoot);
5868
5868
  if (!n)
5869
5869
  throw new Error(
5870
5870
  `Cannot tweak tap internal key for input #${e}. Public key: ${r && r.toString("hex")}`
5871
5871
  );
5872
5872
  return n.x;
5873
5873
  }
5874
- ge.tweakInternalPubKey = Uh;
5875
- function Ch(e) {
5874
+ ge.tweakInternalPubKey = Rh;
5875
+ function Uh(e) {
5876
5876
  if (!(0, Gs.isTaptree)(e))
5877
5877
  throw new Error(
5878
5878
  "Cannot convert taptree to tapleaf list. Expecting a tapree structure."
5879
5879
  );
5880
5880
  return gs(e);
5881
5881
  }
5882
- ge.tapTreeToList = Ch;
5882
+ ge.tapTreeToList = Uh;
5883
5883
  function Za(e = []) {
5884
5884
  return e.length === 1 && e[0].depth === 0 ? {
5885
5885
  output: e[0].script,
5886
5886
  version: e[0].leafVersion
5887
- } : Mh(e);
5887
+ } : Hh(e);
5888
5888
  }
5889
5889
  ge.tapTreeFromList = Za;
5890
- function Lh(e, t) {
5891
- return Fh(e).some(
5892
- (n) => (0, Bh.signatureBlocksAction)(n, Nh, t)
5890
+ function Ch(e, t) {
5891
+ return Nh(e).some(
5892
+ (n) => (0, Sh.signatureBlocksAction)(n, Lh, t)
5893
5893
  );
5894
5894
  }
5895
- ge.checkTaprootInputForSigs = Lh;
5896
- function Nh(e) {
5895
+ ge.checkTaprootInputForSigs = Ch;
5896
+ function Lh(e) {
5897
5897
  return {
5898
5898
  signature: e.slice(0, 64),
5899
- hashType: e.slice(64)[0] || xh.Transaction.SIGHASH_DEFAULT
5899
+ hashType: e.slice(64)[0] || Eh.Transaction.SIGHASH_DEFAULT
5900
5900
  };
5901
5901
  }
5902
- function Fh(e) {
5902
+ function Nh(e) {
5903
5903
  const t = [];
5904
5904
  if (e.tapKeySig && t.push(e.tapKeySig), e.tapScriptSig && t.push(...e.tapScriptSig.map((r) => r.signature)), !t.length) {
5905
- const r = Hh(e.finalScriptWitness);
5905
+ const r = Fh(e.finalScriptWitness);
5906
5906
  r && t.push(r);
5907
5907
  }
5908
5908
  return t;
5909
5909
  }
5910
- function Hh(e) {
5910
+ function Fh(e) {
5911
5911
  if (!e) return;
5912
5912
  const t = e.slice(2);
5913
5913
  if (t.length === 64 || t.length === 65) return t;
5914
5914
  }
5915
5915
  function gs(e, t = [], r = 0) {
5916
- if (r > Gt.MAX_TAPTREE_DEPTH)
5916
+ if (r > Wt.MAX_TAPTREE_DEPTH)
5917
5917
  throw new Error("Max taptree depth exceeded.");
5918
5918
  return e ? (0, Gs.isTapleaf)(e) ? (t.push({
5919
5919
  depth: r,
5920
- leafVersion: e.version || Gt.LEAF_VERSION_TAPSCRIPT,
5920
+ leafVersion: e.version || Wt.LEAF_VERSION_TAPSCRIPT,
5921
5921
  script: e.output
5922
5922
  }), t) : (e[0] && gs(e[0], t, r + 1), e[1] && gs(e[1], t, r + 1), t) : [];
5923
5923
  }
5924
- function Mh(e) {
5924
+ function Hh(e) {
5925
5925
  let t;
5926
5926
  for (const r of e)
5927
5927
  if (t = ms(r, t), !t) throw new Error("No room left to insert tapleaf in tree");
5928
5928
  return t;
5929
5929
  }
5930
5930
  function ms(e, t, r = 0) {
5931
- if (r > Gt.MAX_TAPTREE_DEPTH)
5931
+ if (r > Wt.MAX_TAPTREE_DEPTH)
5932
5932
  throw new Error("Max taptree depth exceeded.");
5933
5933
  if (e.depth === r)
5934
5934
  return t ? void 0 : {
@@ -5941,21 +5941,21 @@ function ms(e, t, r = 0) {
5941
5941
  const i = ms(e, t && t[1], r + 1);
5942
5942
  if (i) return [t && t[0], i];
5943
5943
  }
5944
- function Dh(e, t, r) {
5944
+ function Mh(e, t, r) {
5945
5945
  const n = Xn(e) && Tr(t), i = Tr(e) && Xn(t), s = e === t && Xn(t) && Tr(t);
5946
5946
  if (n || i || s)
5947
5947
  throw new Error(
5948
5948
  `Invalid arguments for Psbt.${r}. Cannot use both taproot and non-taproot fields.`
5949
5949
  );
5950
5950
  }
5951
- function $h(e, t, r) {
5951
+ function Dh(e, t, r) {
5952
5952
  const n = Jn(e) && Tr(t), i = Tr(e) && Jn(t), s = e === t && Jn(t) && Tr(t);
5953
5953
  if (n || i || s)
5954
5954
  throw new Error(
5955
5955
  `Invalid arguments for Psbt.${r}. Cannot use both taproot and non-taproot fields.`
5956
5956
  );
5957
5957
  }
5958
- function jh(e, t, r) {
5958
+ function $h(e, t, r) {
5959
5959
  if (t.tapMerkleRoot) {
5960
5960
  const n = (t.tapLeafScript || []).every(
5961
5961
  (s) => Qi(s, t.tapMerkleRoot)
@@ -5975,23 +5975,23 @@ function jh(e, t, r) {
5975
5975
  }
5976
5976
  function Qi(e, t) {
5977
5977
  if (!t) return !0;
5978
- const r = (0, Gt.tapleafHash)({
5978
+ const r = (0, Wt.tapleafHash)({
5979
5979
  output: e.script,
5980
5980
  version: e.leafVersion
5981
5981
  });
5982
- return (0, Gt.rootHashFromPath)(
5982
+ return (0, Wt.rootHashFromPath)(
5983
5983
  e.controlBlock,
5984
5984
  r
5985
5985
  ).equals(t);
5986
5986
  }
5987
- function Gh(e, t) {
5988
- const r = (0, Gt.tapleafHash)({
5987
+ function jh(e, t) {
5988
+ const r = (0, Wt.tapleafHash)({
5989
5989
  output: t.script,
5990
5990
  version: t.leafVersion
5991
5991
  });
5992
- return (e.tapScriptSig || []).filter((n) => n.leafHash.equals(r)).map((n) => Wh(t.script, n)).sort((n, i) => i.positionInScript - n.positionInScript).map((n) => n.signature);
5992
+ return (e.tapScriptSig || []).filter((n) => n.leafHash.equals(r)).map((n) => Gh(t.script, n)).sort((n, i) => i.positionInScript - n.positionInScript).map((n) => n.signature);
5993
5993
  }
5994
- function Wh(e, t) {
5994
+ function Gh(e, t) {
5995
5995
  return Object.assign(
5996
5996
  {
5997
5997
  positionInScript: (0, Ei.pubkeyPositionInScript)(
@@ -6002,13 +6002,13 @@ function Wh(e, t) {
6002
6002
  t
6003
6003
  );
6004
6004
  }
6005
- function Vh(e, t, r) {
6005
+ function Wh(e, t, r) {
6006
6006
  if (!e.tapScriptSig || !e.tapScriptSig.length)
6007
6007
  throw new Error(
6008
6008
  `Can not finalize taproot input #${t}. No tapleaf script signature provided.`
6009
6009
  );
6010
6010
  const n = (e.tapLeafScript || []).sort((i, s) => i.controlBlock.length - s.controlBlock.length).find(
6011
- (i) => zh(i, e.tapScriptSig, r)
6011
+ (i) => Vh(i, e.tapScriptSig, r)
6012
6012
  );
6013
6013
  if (!n)
6014
6014
  throw new Error(
@@ -6016,8 +6016,8 @@ function Vh(e, t, r) {
6016
6016
  );
6017
6017
  return n;
6018
6018
  }
6019
- function zh(e, t, r) {
6020
- const n = (0, Gt.tapleafHash)({
6019
+ function Vh(e, t, r) {
6020
+ const n = (0, Wt.tapleafHash)({
6021
6021
  output: e.script,
6022
6022
  version: e.leafVersion
6023
6023
  });
@@ -6026,7 +6026,7 @@ function zh(e, t, r) {
6026
6026
  function Tr(e) {
6027
6027
  return e && !!(e.redeemScript || e.witnessScript || e.bip32Derivation && e.bip32Derivation.length);
6028
6028
  }
6029
- const Me = {
6029
+ const Ie = {
6030
6030
  secretMismatch: "invalid secret",
6031
6031
  secretHashLenMismatch: "secret hash should be 32 bytes",
6032
6032
  pubkeyLenMismatch: "pubkey should be 32 bytes",
@@ -6040,13 +6040,13 @@ const Me = {
6040
6040
  controlBlockGenerationFailed: "failed to generate control block",
6041
6041
  invalidLeaf: "invalid leaf"
6042
6042
  }, Mn = 192;
6043
- he.initEccLib(nr);
6043
+ se.initEccLib(nr);
6044
6044
  class ln {
6045
6045
  /**
6046
6046
  * Note: redeemerAddress and initiatorAddress should be x-only public key without 02 or 03 prefix
6047
6047
  */
6048
6048
  constructor(t, r, n, i, s, o, a, c) {
6049
- this.secretHash = n, this.redeemerPubkey = i, this.initiatorPubkey = s, this.expiry = o, this.signer = t, this.network = a, this.internalPubkey = ju(), this.initiateAmount = r, this.utxoHashes = c;
6049
+ this.secretHash = n, this.redeemerPubkey = i, this.initiatorPubkey = s, this.expiry = o, this.signer = t, this.network = a, this.internalPubkey = $u(), this.initiateAmount = r, this.utxoHashes = c;
6050
6050
  }
6051
6051
  /**
6052
6052
  * Creates a GardenHTLC instance
@@ -6062,13 +6062,13 @@ class ln {
6062
6062
  * When the signer is the redeemer, only redeem can be done
6063
6063
  */
6064
6064
  static async from(t, r, n, i, s, o, a) {
6065
- n = n.startsWith("0x") ? n.slice(2) : n, gr(n.length === 64, Me.secretHashLenMismatch), gr(
6065
+ n = n.startsWith("0x") ? n.slice(2) : n, gr(n.length === 64, Ie.secretHashLenMismatch), gr(
6066
6066
  i.length === 64 || i.length === 66,
6067
- `initiator ${Me.pubkeyLenMismatch}`
6067
+ `initiator ${Ie.pubkeyLenMismatch}`
6068
6068
  ), gr(
6069
6069
  s.length === 64 || s.length === 66,
6070
- `redeemer ${Me.pubkeyLenMismatch}`
6071
- ), gr(o > 0, Me.zeroOrNegativeExpiry);
6070
+ `redeemer ${Ie.pubkeyLenMismatch}`
6071
+ ), gr(o > 0, Ie.zeroOrNegativeExpiry);
6072
6072
  const c = await t.getNetwork();
6073
6073
  return new ln(
6074
6074
  t,
@@ -6085,12 +6085,12 @@ class ln {
6085
6085
  * Generates a taproot address for receiving the funds
6086
6086
  */
6087
6087
  address() {
6088
- const { address: t } = he.payments.p2tr({
6088
+ const { address: t } = se.payments.p2tr({
6089
6089
  internalPubkey: this.internalPubkey,
6090
6090
  network: this.network,
6091
6091
  scriptTree: this.leaves()
6092
6092
  });
6093
- if (!t) throw new Error(Me.htlcAddressGenerationFailed);
6093
+ if (!t) throw new Error(Ie.htlcAddressGenerationFailed);
6094
6094
  return t;
6095
6095
  }
6096
6096
  /**
@@ -6100,7 +6100,7 @@ class ln {
6100
6100
  return this.address();
6101
6101
  }
6102
6102
  async _buildRawTx(t, r) {
6103
- const n = new he.Transaction();
6103
+ const n = new se.Transaction();
6104
6104
  n.version = 2;
6105
6105
  const i = this.address(), s = await this.signer.getProvider();
6106
6106
  let o = [];
@@ -6120,14 +6120,47 @@ class ln {
6120
6120
  else
6121
6121
  o = await s.getUTXOs(i);
6122
6122
  const a = o.reduce((c, l) => c + l.value, 0);
6123
- if (a === 0) throw new Error(`${i} ${Me.notFunded}`);
6123
+ if (a === 0) throw new Error(`${i} ${Ie.notFunded}`);
6124
6124
  for (let c = 0; c < o.length; c++)
6125
6125
  n.addInput(Buffer.from(o[c].txid, "hex").reverse(), o[c].vout);
6126
6126
  return r ?? (r = await s.suggestFee(i, a, so.MEDIUM)), n.addOutput(
6127
- he.address.toOutputScript(t, this.network),
6127
+ se.address.toOutputScript(t, this.network),
6128
6128
  a - r
6129
6129
  ), { tx: n, usedUtxos: o };
6130
6130
  }
6131
+ async _tempBuildRawTx(t, r) {
6132
+ const n = new se.Transaction();
6133
+ n.version = 2;
6134
+ const i = this.address(), s = await this.signer.getProvider();
6135
+ let o = [];
6136
+ if (this.utxoHashes && this.utxoHashes.length > 0)
6137
+ for (const c of this.utxoHashes) {
6138
+ const l = await s.getTransaction(c);
6139
+ for (let d = 0; d < l.vout.length; d++) {
6140
+ const b = l.vout[d];
6141
+ b.scriptpubkey_address === i && o.push({
6142
+ txid: l.txid,
6143
+ vout: d,
6144
+ value: b.value,
6145
+ status: { confirmed: !1 }
6146
+ });
6147
+ }
6148
+ }
6149
+ else
6150
+ o = await s.getUTXOs(i);
6151
+ const a = o.reduce((c, l) => c + l.value, 0);
6152
+ if (a === 0) throw new Error(`${i} ${Ie.notFunded}`);
6153
+ for (let c = 0; c < o.length; c++)
6154
+ n.addInput(Buffer.from(o[c].txid, "hex").reverse(), o[c].vout);
6155
+ if (n.addOutput(
6156
+ se.address.toOutputScript(t, this.network),
6157
+ a
6158
+ ), r) {
6159
+ const l = (await s.getFeeRates()).economyFee * r, d = a - l;
6160
+ n.outs[0].value = d;
6161
+ }
6162
+ return { tx: n, usedUtxos: o };
6163
+ }
6131
6164
  /**
6132
6165
  * Builds a raw unsigned transaction with utxos from gardenHTLC address
6133
6166
  * and uses signer's address as the output address
@@ -6139,7 +6172,7 @@ class ln {
6139
6172
  * prevout script for the gardenHTLC address
6140
6173
  */
6141
6174
  getOutputScript() {
6142
- return he.address.toOutputScript(this.address(), this.network);
6175
+ return se.address.toOutputScript(this.address(), this.network);
6143
6176
  }
6144
6177
  async init(t) {
6145
6178
  return t ?? (t = await (await this.signer.getProvider()).suggestFee(
@@ -6149,18 +6182,18 @@ class ln {
6149
6182
  )), await this.signer.send(this.address(), this.initiateAmount, t);
6150
6183
  }
6151
6184
  async generateRedeemSACP(t, r, n) {
6152
- const { tx: i, usedUtxos: s } = await this._buildRawTx(r, n), o = this.getOutputScript(), a = he.Transaction.SIGHASH_SINGLE | he.Transaction.SIGHASH_ANYONECANPAY, c = this.leafHash(
6185
+ const { tx: i, usedUtxos: s } = await this._buildRawTx(r, n), o = this.getOutputScript(), a = se.Transaction.SIGHASH_SINGLE | se.Transaction.SIGHASH_ANYONECANPAY, c = this.leafHash(
6153
6186
  1
6154
6187
  /* REDEEM */
6155
6188
  ), l = s.map((b) => b.value), d = Yr(o, s.length);
6156
6189
  for (let b = 0; b < i.ins.length; b++) {
6157
- const x = i.hashForWitnessV1(
6190
+ const E = i.hashForWitnessV1(
6158
6191
  b,
6159
6192
  d,
6160
6193
  l,
6161
6194
  a,
6162
6195
  c
6163
- ), p = await this.signer.signSchnorr(x);
6196
+ ), p = await this.signer.signSchnorr(E);
6164
6197
  i.setWitness(b, [
6165
6198
  Yn(p, a),
6166
6199
  Buffer.from(t, "hex"),
@@ -6174,7 +6207,7 @@ class ln {
6174
6207
  return i.toHex();
6175
6208
  }
6176
6209
  async generateInstantRefundSACP(t, r) {
6177
- const { tx: n, usedUtxos: i } = await this._buildRawTx(t, r), s = this.getOutputScript(), o = he.Transaction.SIGHASH_SINGLE | he.Transaction.SIGHASH_ANYONECANPAY, a = this.leafHash(
6210
+ const { tx: n, usedUtxos: i } = await this._buildRawTx(t, r), s = this.getOutputScript(), o = se.Transaction.SIGHASH_SINGLE | se.Transaction.SIGHASH_ANYONECANPAY, a = this.leafHash(
6178
6211
  2
6179
6212
  /* INSTANT_REFUND */
6180
6213
  ), c = i.map((d) => d.value), l = Yr(s, i.length);
@@ -6185,13 +6218,13 @@ class ln {
6185
6218
  c,
6186
6219
  o,
6187
6220
  a
6188
- ), x = await this.signer.signSchnorr(b);
6221
+ ), E = await this.signer.signSchnorr(b);
6189
6222
  n.setWitness(d, [
6190
6223
  // first is initiator's signature
6191
- Yn(x, o),
6224
+ Yn(E, o),
6192
6225
  // second is redeemer's signature
6193
6226
  // this is then modified by the redeemer to include their signature
6194
- Yn(x, o),
6227
+ Yn(E, o),
6195
6228
  this.instantRefundLeaf(),
6196
6229
  this.generateControlBlockFor(
6197
6230
  2
@@ -6207,17 +6240,17 @@ class ln {
6207
6240
  * Note: If there are multiple UTXOs being spend, there should be a signature for each UTXO in counterPartySigs
6208
6241
  */
6209
6242
  async instantRefund(t, r) {
6210
- gr(t.length > 0, Me.noCounterpartySigs);
6243
+ gr(t.length > 0, Ie.noCounterpartySigs);
6211
6244
  const { tx: n, usedUtxos: i } = await this.buildRawTx(r);
6212
6245
  for (const b of i)
6213
- if (!t.find((x) => x.utxo === b.txid))
6214
- throw new Error(Me.counterPartySigNotFound(b.txid));
6215
- const s = this.getOutputScript(), o = he.Transaction.SIGHASH_DEFAULT, a = this.leafHash(
6246
+ if (!t.find((E) => E.utxo === b.txid))
6247
+ throw new Error(Ie.counterPartySigNotFound(b.txid));
6248
+ const s = this.getOutputScript(), o = se.Transaction.SIGHASH_DEFAULT, a = this.leafHash(
6216
6249
  2
6217
6250
  /* INSTANT_REFUND */
6218
6251
  ), c = i.map((b) => b.value), l = Yr(s, i.length);
6219
6252
  for (let b = 0; b < n.ins.length; b++) {
6220
- const x = n.hashForWitnessV1(
6253
+ const E = n.hashForWitnessV1(
6221
6254
  b,
6222
6255
  l,
6223
6256
  c,
@@ -6225,16 +6258,16 @@ class ln {
6225
6258
  a
6226
6259
  );
6227
6260
  if (!nr.verifySchnorr(
6228
- x,
6261
+ E,
6229
6262
  Buffer.from(this.redeemerPubkey, "hex"),
6230
6263
  Buffer.from(t[b].sig, "hex")
6231
6264
  ))
6232
6265
  throw new Error(
6233
- Me.invalidCounterpartySigForUTXO(t[b].utxo)
6266
+ Ie.invalidCounterpartySigForUTXO(t[b].utxo)
6234
6267
  );
6235
- const p = await this.signer.signSchnorr(x), I = Buffer.from(n.ins[b].hash).reverse().toString("hex"), B = t.find((T) => T.utxo === I);
6268
+ const p = await this.signer.signSchnorr(E), I = Buffer.from(n.ins[b].hash).reverse().toString("hex"), B = t.find((T) => T.utxo === I);
6236
6269
  if (!B)
6237
- throw new Error(Me.counterPartySigNotFound(I));
6270
+ throw new Error(Ie.counterPartySigNotFound(I));
6238
6271
  n.setWitness(b, [
6239
6272
  Buffer.from(B.sig, "hex"),
6240
6273
  p,
@@ -6250,28 +6283,27 @@ class ln {
6250
6283
  /**
6251
6284
  * Reveals the secret and redeems the HTLC
6252
6285
  */
6253
- async redeem(t, r, n) {
6286
+ async redeem(t, r) {
6254
6287
  gr(
6255
- he.crypto.sha256(Buffer.from(t, "hex")).toString("hex") === this.secretHash,
6256
- Me.secretMismatch
6288
+ se.crypto.sha256(Buffer.from(t, "hex")).toString("hex") === this.secretHash,
6289
+ Ie.secretMismatch
6257
6290
  );
6258
- const { tx: i, usedUtxos: s } = await this._buildRawTx(
6259
- r ?? await this.signer.getAddress(),
6291
+ const n = r ?? await this.signer.getAddress(), { tx: i, usedUtxos: s } = await this._tempBuildRawTx(
6260
6292
  n
6261
6293
  ), o = this.leafHash(
6262
6294
  1
6263
6295
  /* REDEEM */
6264
- ), a = s.map((b) => b.value), c = Yr(this.getOutputScript(), s.length), l = he.Transaction.SIGHASH_DEFAULT;
6265
- for (let b = 0; b < i.ins.length; b++) {
6266
- const x = i.hashForWitnessV1(
6267
- b,
6296
+ ), a = s.map((E) => E.value), c = Yr(this.getOutputScript(), s.length), l = se.Transaction.SIGHASH_DEFAULT;
6297
+ for (let E = 0; E < i.ins.length; E++) {
6298
+ const p = i.hashForWitnessV1(
6299
+ E,
6268
6300
  c,
6269
6301
  a,
6270
6302
  l,
6271
6303
  o
6272
- ), p = await this.signer.signSchnorr(x);
6273
- i.setWitness(b, [
6274
- p,
6304
+ ), I = await this.signer.signSchnorr(p);
6305
+ i.setWitness(E, [
6306
+ I,
6275
6307
  Buffer.from(t, "hex"),
6276
6308
  this.redeemLeaf(),
6277
6309
  this.generateControlBlockFor(
@@ -6280,7 +6312,29 @@ class ln {
6280
6312
  )
6281
6313
  ]);
6282
6314
  }
6283
- return await (await this.signer.getProvider()).broadcast(i.toHex());
6315
+ const { tx: d } = await this._tempBuildRawTx(
6316
+ n,
6317
+ i.virtualSize()
6318
+ );
6319
+ for (let E = 0; E < d.ins.length; E++) {
6320
+ const p = d.hashForWitnessV1(
6321
+ E,
6322
+ c,
6323
+ a,
6324
+ l,
6325
+ o
6326
+ ), I = await this.signer.signSchnorr(p);
6327
+ d.setWitness(E, [
6328
+ I,
6329
+ Buffer.from(t, "hex"),
6330
+ this.redeemLeaf(),
6331
+ this.generateControlBlockFor(
6332
+ 1
6333
+ /* REDEEM */
6334
+ )
6335
+ ]);
6336
+ }
6337
+ return await (await this.signer.getProvider()).broadcast(d.toHex());
6284
6338
  }
6285
6339
  /**
6286
6340
  * Refunds the funds back to the initiator if the expiry block height + 1 is reached
@@ -6291,21 +6345,21 @@ class ln {
6291
6345
  r
6292
6346
  ), [s, o] = await this.canRefund(i);
6293
6347
  if (!s)
6294
- throw new Error(Me.htlcNotExpired(o));
6348
+ throw new Error(Ie.htlcNotExpired(o));
6295
6349
  const a = this.leafHash(
6296
6350
  0
6297
6351
  /* REFUND */
6298
- ), c = i.map((x) => x.value), l = Yr(this.getOutputScript(), i.length), d = he.Transaction.SIGHASH_DEFAULT;
6299
- for (let x = 0; x < n.ins.length; x++) {
6300
- n.ins[x].sequence = this.expiry;
6352
+ ), c = i.map((E) => E.value), l = Yr(this.getOutputScript(), i.length), d = se.Transaction.SIGHASH_DEFAULT;
6353
+ for (let E = 0; E < n.ins.length; E++) {
6354
+ n.ins[E].sequence = this.expiry;
6301
6355
  const p = n.hashForWitnessV1(
6302
- x,
6356
+ E,
6303
6357
  l,
6304
6358
  c,
6305
6359
  d,
6306
6360
  a
6307
6361
  ), I = await this.signer.signSchnorr(p);
6308
- n.setWitness(x, [
6362
+ n.setWitness(E, [
6309
6363
  I,
6310
6364
  this.refundLeaf(),
6311
6365
  this.generateControlBlockFor(
@@ -6344,9 +6398,9 @@ class ln {
6344
6398
  r = this.instantRefundLeaf();
6345
6399
  break;
6346
6400
  default:
6347
- throw new Error(Me.invalidLeaf);
6401
+ throw new Error(Ie.invalidLeaf);
6348
6402
  }
6349
- const n = he.payments.p2tr({
6403
+ const n = se.payments.p2tr({
6350
6404
  internalPubkey: this.internalPubkey,
6351
6405
  network: this.network,
6352
6406
  scriptTree: this.leaves(),
@@ -6356,7 +6410,7 @@ class ln {
6356
6410
  }
6357
6411
  });
6358
6412
  if (!n.witness)
6359
- throw new Error(Me.controlBlockGenerationFailed);
6413
+ throw new Error(Ie.controlBlockGenerationFailed);
6360
6414
  return n.witness[n.witness.length - 1];
6361
6415
  }
6362
6416
  /**
@@ -6366,12 +6420,12 @@ class ln {
6366
6420
  */
6367
6421
  leafHash(t) {
6368
6422
  let r = this.redeemLeaf();
6369
- return t === 0 && (r = this.refundLeaf()), t === 2 && (r = this.instantRefundLeaf()), he.crypto.taggedHash("TapLeaf", Ou(r));
6423
+ return t === 0 && (r = this.refundLeaf()), t === 2 && (r = this.instantRefundLeaf()), se.crypto.taggedHash("TapLeaf", Iu(r));
6370
6424
  }
6371
6425
  refundLeaf() {
6372
- return he.script.fromASM(
6426
+ return se.script.fromASM(
6373
6427
  `
6374
- ${he.script.number.encode(this.expiry).toString("hex")}
6428
+ ${se.script.number.encode(this.expiry).toString("hex")}
6375
6429
  OP_CHECKSEQUENCEVERIFY
6376
6430
  OP_DROP
6377
6431
  ${this.initiatorPubkey}
@@ -6380,7 +6434,7 @@ class ln {
6380
6434
  );
6381
6435
  }
6382
6436
  redeemLeaf() {
6383
- return he.script.fromASM(
6437
+ return se.script.fromASM(
6384
6438
  `
6385
6439
  OP_SHA256
6386
6440
  ${this.secretHash}
@@ -6391,7 +6445,7 @@ class ln {
6391
6445
  );
6392
6446
  }
6393
6447
  instantRefundLeaf() {
6394
- return he.script.fromASM(
6448
+ return se.script.fromASM(
6395
6449
  `
6396
6450
  ${this.initiatorPubkey}
6397
6451
  OP_CHECKSIG
@@ -6437,12 +6491,12 @@ class ln {
6437
6491
  );
6438
6492
  switch (t) {
6439
6493
  case 1: {
6440
- const s = Ru(
6494
+ const s = ku(
6441
6495
  i,
6442
6496
  n
6443
6497
  );
6444
6498
  return [
6445
- he.crypto.taggedHash(
6499
+ se.crypto.taggedHash(
6446
6500
  "TapBranch",
6447
6501
  Buffer.concat(s)
6448
6502
  )
@@ -6453,7 +6507,7 @@ class ln {
6453
6507
  case 2:
6454
6508
  return [i, r];
6455
6509
  default:
6456
- throw new Error(Me.invalidLeaf);
6510
+ throw new Error(Ie.invalidLeaf);
6457
6511
  }
6458
6512
  }
6459
6513
  }
@@ -6463,7 +6517,7 @@ function Yr(e, t) {
6463
6517
  r.push(e);
6464
6518
  return r;
6465
6519
  }
6466
- class qh {
6520
+ class zh {
6467
6521
  constructor() {
6468
6522
  this.cache = {};
6469
6523
  }
@@ -6482,6 +6536,17 @@ class qh {
6482
6536
  delete this.cache[`${r}_${t.create_order.create_id}`];
6483
6537
  }
6484
6538
  }
6539
+ class qh {
6540
+ constructor() {
6541
+ this.cache = {};
6542
+ }
6543
+ set(t, r) {
6544
+ this.cache[t] = r;
6545
+ }
6546
+ get(t) {
6547
+ return this.cache[t] || null;
6548
+ }
6549
+ }
6485
6550
  class Kh {
6486
6551
  constructor(t, r) {
6487
6552
  this.url = new dn("/blocknumber/" + r, t);
@@ -6554,7 +6619,7 @@ class Yh {
6554
6619
  return j("GetStrategies: Unexpected error, result is undefined");
6555
6620
  const r = {};
6556
6621
  for (const n of Object.values(t.result)) {
6557
- const i = Cu(
6622
+ const i = Uu(
6558
6623
  n.source_chain,
6559
6624
  n.source_asset.asset,
6560
6625
  n.dest_chain,
@@ -6619,7 +6684,7 @@ var tf = {};
6619
6684
  var _s = { exports: {} }, vs = { exports: {} };
6620
6685
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
6621
6686
  (function(e, t) {
6622
- var r = Pt, n = r.Buffer;
6687
+ var r = At, n = r.Buffer;
6623
6688
  function i(o, a) {
6624
6689
  for (var c in o)
6625
6690
  a[c] = o[c];
@@ -6652,7 +6717,7 @@ function Jh() {
6652
6717
  throw new Error(`Secure random number generation is not supported by this browser.
6653
6718
  Use Chrome, Firefox or Internet Explorer 11`);
6654
6719
  }
6655
- var Qh = je.Buffer, ii = jt.crypto || jt.msCrypto;
6720
+ var Qh = je.Buffer, ii = Gt.crypto || Gt.msCrypto;
6656
6721
  ii && ii.getRandomValues ? _s.exports = Zh : _s.exports = Jh;
6657
6722
  function Zh(e, t) {
6658
6723
  if (e > Xh) throw new RangeError("requested too many random bytes");
@@ -6685,7 +6750,7 @@ typeof Object.create == "function" ? Es.exports = function(t, r) {
6685
6750
  n.prototype = r.prototype, t.prototype = new n(), t.prototype.constructor = t;
6686
6751
  }
6687
6752
  };
6688
- var Ie = Es.exports, xs = { exports: {} }, Ws = { exports: {} }, Ir = typeof Reflect == "object" ? Reflect : null, Ho = Ir && typeof Ir.apply == "function" ? Ir.apply : function(t, r, n) {
6753
+ var Te = Es.exports, xs = { exports: {} }, Ws = { exports: {} }, Ir = typeof Reflect == "object" ? Reflect : null, Ho = Ir && typeof Ir.apply == "function" ? Ir.apply : function(t, r, n) {
6689
6754
  return Function.prototype.apply.call(t, r, n);
6690
6755
  }, Qn;
6691
6756
  Ir && typeof Ir.ownKeys == "function" ? Qn = Ir.ownKeys : Object.getOwnPropertySymbols ? Qn = function(t) {
@@ -6912,7 +6977,7 @@ var hf = Ws.exports, lf = hf.EventEmitter;
6912
6977
  const al = {}, fl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6913
6978
  __proto__: null,
6914
6979
  default: al
6915
- }, Symbol.toStringTag, { value: "Module" })), Vs = /* @__PURE__ */ Wu(fl);
6980
+ }, Symbol.toStringTag, { value: "Module" })), Vs = /* @__PURE__ */ Gu(fl);
6916
6981
  var es, Do;
6917
6982
  function ul() {
6918
6983
  if (Do) return es;
@@ -6968,7 +7033,7 @@ function ul() {
6968
7033
  }
6969
7034
  return (B === "string" ? String : Number)(I);
6970
7035
  }
6971
- var c = Pt, l = c.Buffer, d = Vs, b = d.inspect, x = b && b.custom || "inspect";
7036
+ var c = At, l = c.Buffer, d = Vs, b = d.inspect, E = b && b.custom || "inspect";
6972
7037
  function p(I, B, T) {
6973
7038
  l.prototype.copy.call(I, B, T);
6974
7039
  }
@@ -7066,7 +7131,7 @@ function ul() {
7066
7131
  }
7067
7132
  // Make sure the linked list only shows the minimal necessary information.
7068
7133
  }, {
7069
- key: x,
7134
+ key: E,
7070
7135
  value: function(T, k) {
7071
7136
  return b(this, t(t({}, k), {}, {
7072
7137
  // Only inspect one level.
@@ -7207,11 +7272,11 @@ function vl(e, t) {
7207
7272
  }
7208
7273
  function ts(e) {
7209
7274
  try {
7210
- if (!jt.localStorage) return !1;
7275
+ if (!Gt.localStorage) return !1;
7211
7276
  } catch {
7212
7277
  return !1;
7213
7278
  }
7214
- var t = jt.localStorage[e];
7279
+ var t = Gt.localStorage[e];
7215
7280
  return t == null ? !1 : String(t).toLowerCase() === "true";
7216
7281
  }
7217
7282
  var rs, Go;
@@ -7221,14 +7286,14 @@ function bf() {
7221
7286
  function e(A) {
7222
7287
  var P = this;
7223
7288
  this.next = null, this.entry = null, this.finish = function() {
7224
- dt(P, A);
7289
+ pt(P, A);
7225
7290
  };
7226
7291
  }
7227
7292
  var t;
7228
- $.WritableState = E;
7293
+ $.WritableState = x;
7229
7294
  var r = {
7230
7295
  deprecate: _l
7231
- }, n = lf, i = Pt.Buffer, s = (typeof jt < "u" ? jt : typeof window < "u" ? window : typeof self < "u" ? self : {}).Uint8Array || function() {
7296
+ }, n = lf, i = At.Buffer, s = (typeof Gt < "u" ? Gt : typeof window < "u" ? window : typeof self < "u" ? self : {}).Uint8Array || function() {
7232
7297
  };
7233
7298
  function o(A) {
7234
7299
  return i.from(A);
@@ -7236,24 +7301,24 @@ function bf() {
7236
7301
  function a(A) {
7237
7302
  return i.isBuffer(A) || A instanceof s;
7238
7303
  }
7239
- var c = df, l = yf, d = l.getHighWaterMark, b = dr.codes, x = b.ERR_INVALID_ARG_TYPE, p = b.ERR_METHOD_NOT_IMPLEMENTED, I = b.ERR_MULTIPLE_CALLBACK, B = b.ERR_STREAM_CANNOT_PIPE, T = b.ERR_STREAM_DESTROYED, k = b.ERR_STREAM_NULL_VALUES, U = b.ERR_STREAM_WRITE_AFTER_END, _ = b.ERR_UNKNOWN_ENCODING, m = c.errorOrDestroy;
7240
- Ie($, n);
7304
+ var c = df, l = yf, d = l.getHighWaterMark, b = dr.codes, E = b.ERR_INVALID_ARG_TYPE, p = b.ERR_METHOD_NOT_IMPLEMENTED, I = b.ERR_MULTIPLE_CALLBACK, B = b.ERR_STREAM_CANNOT_PIPE, T = b.ERR_STREAM_DESTROYED, k = b.ERR_STREAM_NULL_VALUES, U = b.ERR_STREAM_WRITE_AFTER_END, _ = b.ERR_UNKNOWN_ENCODING, m = c.errorOrDestroy;
7305
+ Te($, n);
7241
7306
  function S() {
7242
7307
  }
7243
- function E(A, P, F) {
7308
+ function x(A, P, F) {
7244
7309
  t = t || Nr(), A = A || {}, typeof F != "boolean" && (F = P instanceof t), this.objectMode = !!A.objectMode, F && (this.objectMode = this.objectMode || !!A.writableObjectMode), this.highWaterMark = d(this, A, "writableHighWaterMark", F), this.finalCalled = !1, this.needDrain = !1, this.ending = !1, this.ended = !1, this.finished = !1, this.destroyed = !1;
7245
7310
  var G = A.decodeStrings === !1;
7246
7311
  this.decodeStrings = !G, this.defaultEncoding = A.defaultEncoding || "utf8", this.length = 0, this.writing = !1, this.corked = 0, this.sync = !0, this.bufferProcessing = !1, this.onwrite = function(K) {
7247
- ae(P, K);
7312
+ fe(P, K);
7248
7313
  }, this.writecb = null, this.writelen = 0, this.bufferedRequest = null, this.lastBufferedRequest = null, this.pendingcb = 0, this.prefinished = !1, this.errorEmitted = !1, this.emitClose = A.emitClose !== !1, this.autoDestroy = !!A.autoDestroy, this.bufferedRequestCount = 0, this.corkedRequestsFree = new e(this);
7249
7314
  }
7250
- E.prototype.getBuffer = function() {
7315
+ x.prototype.getBuffer = function() {
7251
7316
  for (var P = this.bufferedRequest, F = []; P; )
7252
7317
  F.push(P), P = P.next;
7253
7318
  return F;
7254
7319
  }, function() {
7255
7320
  try {
7256
- Object.defineProperty(E.prototype, "buffer", {
7321
+ Object.defineProperty(x.prototype, "buffer", {
7257
7322
  get: r.deprecate(function() {
7258
7323
  return this.getBuffer();
7259
7324
  }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003")
@@ -7264,7 +7329,7 @@ function bf() {
7264
7329
  var M;
7265
7330
  typeof Symbol == "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] == "function" ? (M = Function.prototype[Symbol.hasInstance], Object.defineProperty($, Symbol.hasInstance, {
7266
7331
  value: function(P) {
7267
- return M.call(this, P) ? !0 : this !== $ ? !1 : P && P._writableState instanceof E;
7332
+ return M.call(this, P) ? !0 : this !== $ ? !1 : P && P._writableState instanceof x;
7268
7333
  }
7269
7334
  })) : M = function(P) {
7270
7335
  return P instanceof this;
@@ -7273,7 +7338,7 @@ function bf() {
7273
7338
  t = t || Nr();
7274
7339
  var P = this instanceof t;
7275
7340
  if (!P && !M.call($, this)) return new $(A);
7276
- this._writableState = new E(A, this, P), this.writable = !0, A && (typeof A.write == "function" && (this._write = A.write), typeof A.writev == "function" && (this._writev = A.writev), typeof A.destroy == "function" && (this._destroy = A.destroy), typeof A.final == "function" && (this._final = A.final)), n.call(this);
7341
+ this._writableState = new x(A, this, P), this.writable = !0, A && (typeof A.write == "function" && (this._write = A.write), typeof A.writev == "function" && (this._writev = A.writev), typeof A.destroy == "function" && (this._destroy = A.destroy), typeof A.final == "function" && (this._final = A.final)), n.call(this);
7277
7342
  }
7278
7343
  $.prototype.pipe = function() {
7279
7344
  m(this, new B());
@@ -7284,7 +7349,7 @@ function bf() {
7284
7349
  }
7285
7350
  function z(A, P, F, G) {
7286
7351
  var K;
7287
- return F === null ? K = new k() : typeof F != "string" && !P.objectMode && (K = new x("chunk", ["string", "Buffer"], F)), K ? (m(A, K), process.nextTick(G, K), !1) : !0;
7352
+ return F === null ? K = new k() : typeof F != "string" && !P.objectMode && (K = new E("chunk", ["string", "Buffer"], F)), K ? (m(A, K), process.nextTick(G, K), !1) : !0;
7288
7353
  }
7289
7354
  $.prototype.write = function(A, P, F) {
7290
7355
  var G = this._writableState, K = !1, w = !G.objectMode && a(A);
@@ -7348,16 +7413,16 @@ function bf() {
7348
7413
  function q(A) {
7349
7414
  A.writing = !1, A.writecb = null, A.length -= A.writelen, A.writelen = 0;
7350
7415
  }
7351
- function ae(A, P) {
7416
+ function fe(A, P) {
7352
7417
  var F = A._writableState, G = F.sync, K = F.writecb;
7353
7418
  if (typeof K != "function") throw new I();
7354
7419
  if (q(F), P) W(A, F, G, P, K);
7355
7420
  else {
7356
7421
  var w = nt(F) || A.destroyed;
7357
- !w && !F.corked && !F.bufferProcessing && F.bufferedRequest && Ge(A, F), G ? process.nextTick(fe, A, F, w, K) : fe(A, F, w, K);
7422
+ !w && !F.corked && !F.bufferProcessing && F.bufferedRequest && Ge(A, F), G ? process.nextTick(ue, A, F, w, K) : ue(A, F, w, K);
7358
7423
  }
7359
7424
  }
7360
- function fe(A, P, F, G) {
7425
+ function ue(A, P, F, G) {
7361
7426
  F || Ze(A, P), P.pendingcb--, G(), We(A, P);
7362
7427
  }
7363
7428
  function Ze(A, P) {
@@ -7386,7 +7451,7 @@ function bf() {
7386
7451
  F(new p("_write()"));
7387
7452
  }, $.prototype._writev = null, $.prototype.end = function(A, P, F) {
7388
7453
  var G = this._writableState;
7389
- return typeof A == "function" ? (F = A, A = null, P = null) : typeof P == "function" && (F = P, P = null), A != null && this.write(A, P), G.corked && (G.corked = 1, this.uncork()), G.ending || At(this, G, F), this;
7454
+ return typeof A == "function" ? (F = A, A = null, P = null) : typeof P == "function" && (F = P, P = null), A != null && this.write(A, P), G.corked && (G.corked = 1, this.uncork()), G.ending || Tt(this, G, F), this;
7390
7455
  }, Object.defineProperty($.prototype, "writableLength", {
7391
7456
  // making it explicit this property is not enumerable
7392
7457
  // because otherwise some prototype manipulation in
@@ -7415,10 +7480,10 @@ function bf() {
7415
7480
  }
7416
7481
  return F;
7417
7482
  }
7418
- function At(A, P, F) {
7483
+ function Tt(A, P, F) {
7419
7484
  P.ending = !0, We(A, P), F && (P.finished ? process.nextTick(F) : A.once("finish", F)), P.ended = !0, A.writable = !1;
7420
7485
  }
7421
- function dt(A, P, F) {
7486
+ function pt(A, P, F) {
7422
7487
  var G = A.entry;
7423
7488
  for (A.entry = null; G; ) {
7424
7489
  var K = G.callback;
@@ -7452,7 +7517,7 @@ function Nr() {
7452
7517
  };
7453
7518
  ns = o;
7454
7519
  var t = gf(), r = bf();
7455
- Ie(o, t);
7520
+ Te(o, t);
7456
7521
  for (var n = e(r.prototype), i = 0; i < n.length; i++) {
7457
7522
  var s = n[i];
7458
7523
  o.prototype[s] || (o.prototype[s] = r.prototype[s]);
@@ -7694,11 +7759,11 @@ function wf(e, t, r) {
7694
7759
  return (!e._readableState || !e._readableState.ended) && (I = new zo()), r.call(e, I);
7695
7760
  if (i && !o)
7696
7761
  return (!e._writableState || !e._writableState.ended) && (I = new zo()), r.call(e, I);
7697
- }, x = function() {
7762
+ }, E = function() {
7698
7763
  e.req.on("finish", a);
7699
7764
  };
7700
- return Fl(e) ? (e.on("complete", a), e.on("abort", b), e.req ? x() : e.on("request", x)) : i && !e._writableState && (e.on("end", s), e.on("close", s)), e.on("end", l), e.on("finish", a), t.error !== !1 && e.on("error", d), e.on("close", b), function() {
7701
- e.removeListener("complete", a), e.removeListener("abort", b), e.removeListener("request", x), e.req && e.req.removeListener("finish", a), e.removeListener("end", s), e.removeListener("close", s), e.removeListener("finish", a), e.removeListener("end", l), e.removeListener("error", d), e.removeListener("close", b);
7765
+ return Fl(e) ? (e.on("complete", a), e.on("abort", b), e.req ? E() : e.on("request", E)) : i && !e._writableState && (e.on("end", s), e.on("close", s)), e.on("end", l), e.on("finish", a), t.error !== !1 && e.on("error", d), e.on("close", b), function() {
7766
+ e.removeListener("complete", a), e.removeListener("abort", b), e.removeListener("request", E), e.req && e.req.removeListener("finish", a), e.removeListener("end", s), e.removeListener("close", s), e.removeListener("finish", a), e.removeListener("end", l), e.removeListener("error", d), e.removeListener("close", b);
7702
7767
  };
7703
7768
  }
7704
7769
  var qs = wf, ss, qo;
@@ -7717,14 +7782,14 @@ function Hl() {
7717
7782
  if (typeof _ != "object" || _ === null) return _;
7718
7783
  var S = _[Symbol.toPrimitive];
7719
7784
  if (S !== void 0) {
7720
- var E = S.call(_, m || "default");
7721
- if (typeof E != "object") return E;
7785
+ var x = S.call(_, m || "default");
7786
+ if (typeof x != "object") return x;
7722
7787
  throw new TypeError("@@toPrimitive must return a primitive value.");
7723
7788
  }
7724
7789
  return (m === "string" ? String : Number)(_);
7725
7790
  }
7726
7791
  var i = qs, s = Symbol("lastResolve"), o = Symbol("lastReject"), a = Symbol("error"), c = Symbol("ended"), l = Symbol("lastPromise"), d = Symbol("handlePromise"), b = Symbol("stream");
7727
- function x(_, m) {
7792
+ function E(_, m) {
7728
7793
  return {
7729
7794
  value: _,
7730
7795
  done: m
@@ -7734,21 +7799,21 @@ function Hl() {
7734
7799
  var m = _[s];
7735
7800
  if (m !== null) {
7736
7801
  var S = _[b].read();
7737
- S !== null && (_[l] = null, _[s] = null, _[o] = null, m(x(S, !1)));
7802
+ S !== null && (_[l] = null, _[s] = null, _[o] = null, m(E(S, !1)));
7738
7803
  }
7739
7804
  }
7740
7805
  function I(_) {
7741
7806
  process.nextTick(p, _);
7742
7807
  }
7743
7808
  function B(_, m) {
7744
- return function(S, E) {
7809
+ return function(S, x) {
7745
7810
  _.then(function() {
7746
7811
  if (m[c]) {
7747
- S(x(void 0, !0));
7812
+ S(E(void 0, !0));
7748
7813
  return;
7749
7814
  }
7750
- m[d](S, E);
7751
- }, E);
7815
+ m[d](S, x);
7816
+ }, x);
7752
7817
  };
7753
7818
  }
7754
7819
  var T = Object.getPrototypeOf(function() {
@@ -7761,20 +7826,20 @@ function Hl() {
7761
7826
  if (S !== null)
7762
7827
  return Promise.reject(S);
7763
7828
  if (this[c])
7764
- return Promise.resolve(x(void 0, !0));
7829
+ return Promise.resolve(E(void 0, !0));
7765
7830
  if (this[b].destroyed)
7766
7831
  return new Promise(function(R, z) {
7767
7832
  process.nextTick(function() {
7768
- m[a] ? z(m[a]) : R(x(void 0, !0));
7833
+ m[a] ? z(m[a]) : R(E(void 0, !0));
7769
7834
  });
7770
7835
  });
7771
- var E = this[l], M;
7772
- if (E)
7773
- M = new Promise(B(E, this));
7836
+ var x = this[l], M;
7837
+ if (x)
7838
+ M = new Promise(B(x, this));
7774
7839
  else {
7775
7840
  var $ = this[b].read();
7776
7841
  if ($ !== null)
7777
- return Promise.resolve(x($, !1));
7842
+ return Promise.resolve(E($, !1));
7778
7843
  M = new Promise(this[d]);
7779
7844
  }
7780
7845
  return this[l] = M, M;
@@ -7783,17 +7848,17 @@ function Hl() {
7783
7848
  return this;
7784
7849
  }), t(e, "return", function() {
7785
7850
  var m = this;
7786
- return new Promise(function(S, E) {
7851
+ return new Promise(function(S, x) {
7787
7852
  m[b].destroy(null, function(M) {
7788
7853
  if (M) {
7789
- E(M);
7854
+ x(M);
7790
7855
  return;
7791
7856
  }
7792
- S(x(void 0, !0));
7857
+ S(E(void 0, !0));
7793
7858
  });
7794
7859
  });
7795
7860
  }), e), T), U = function(m) {
7796
- var S, E = Object.create(k, (S = {}, t(S, b, {
7861
+ var S, x = Object.create(k, (S = {}, t(S, b, {
7797
7862
  value: m,
7798
7863
  writable: !0
7799
7864
  }), t(S, s, {
@@ -7810,20 +7875,20 @@ function Hl() {
7810
7875
  writable: !0
7811
7876
  }), t(S, d, {
7812
7877
  value: function($, R) {
7813
- var z = E[b].read();
7814
- z ? (E[l] = null, E[s] = null, E[o] = null, $(x(z, !1))) : (E[s] = $, E[o] = R);
7878
+ var z = x[b].read();
7879
+ z ? (x[l] = null, x[s] = null, x[o] = null, $(E(z, !1))) : (x[s] = $, x[o] = R);
7815
7880
  },
7816
7881
  writable: !0
7817
7882
  }), S));
7818
- return E[l] = null, i(m, function(M) {
7883
+ return x[l] = null, i(m, function(M) {
7819
7884
  if (M && M.code !== "ERR_STREAM_PREMATURE_CLOSE") {
7820
- var $ = E[o];
7821
- $ !== null && (E[l] = null, E[s] = null, E[o] = null, $(M)), E[a] = M;
7885
+ var $ = x[o];
7886
+ $ !== null && (x[l] = null, x[s] = null, x[o] = null, $(M)), x[a] = M;
7822
7887
  return;
7823
7888
  }
7824
- var R = E[s];
7825
- R !== null && (E[l] = null, E[s] = null, E[o] = null, R(x(void 0, !0))), E[c] = !0;
7826
- }), m.on("readable", I.bind(null, E)), E;
7889
+ var R = x[s];
7890
+ R !== null && (x[l] = null, x[s] = null, x[o] = null, R(E(void 0, !0))), x[c] = !0;
7891
+ }), m.on("readable", I.bind(null, x)), x;
7827
7892
  };
7828
7893
  return ss = U, ss;
7829
7894
  }
@@ -7841,7 +7906,7 @@ function gf() {
7841
7906
  R.ReadableState = $, hf.EventEmitter;
7842
7907
  var t = function(g, N) {
7843
7908
  return g.listeners(N).length;
7844
- }, r = lf, n = Pt.Buffer, i = (typeof jt < "u" ? jt : typeof window < "u" ? window : typeof self < "u" ? self : {}).Uint8Array || function() {
7909
+ }, r = lf, n = At.Buffer, i = (typeof Gt < "u" ? Gt : typeof window < "u" ? window : typeof self < "u" ? self : {}).Uint8Array || function() {
7845
7910
  };
7846
7911
  function s(w) {
7847
7912
  return n.from(w);
@@ -7852,15 +7917,15 @@ function gf() {
7852
7917
  var a = Vs, c;
7853
7918
  a && a.debuglog ? c = a.debuglog("stream") : c = function() {
7854
7919
  };
7855
- var l = ul(), d = df, b = yf, x = b.getHighWaterMark, p = dr.codes, I = p.ERR_INVALID_ARG_TYPE, B = p.ERR_STREAM_PUSH_AFTER_EOF, T = p.ERR_METHOD_NOT_IMPLEMENTED, k = p.ERR_STREAM_UNSHIFT_AFTER_END_EVENT, U, _, m;
7856
- Ie(R, r);
7857
- var S = d.errorOrDestroy, E = ["error", "close", "destroy", "pause", "resume"];
7920
+ var l = ul(), d = df, b = yf, E = b.getHighWaterMark, p = dr.codes, I = p.ERR_INVALID_ARG_TYPE, B = p.ERR_STREAM_PUSH_AFTER_EOF, T = p.ERR_METHOD_NOT_IMPLEMENTED, k = p.ERR_STREAM_UNSHIFT_AFTER_END_EVENT, U, _, m;
7921
+ Te(R, r);
7922
+ var S = d.errorOrDestroy, x = ["error", "close", "destroy", "pause", "resume"];
7858
7923
  function M(w, g, N) {
7859
7924
  if (typeof w.prependListener == "function") return w.prependListener(g, N);
7860
7925
  !w._events || !w._events[g] ? w.on(g, N) : Array.isArray(w._events[g]) ? w._events[g].unshift(N) : w._events[g] = [N, w._events[g]];
7861
7926
  }
7862
7927
  function $(w, g, N) {
7863
- e = e || Nr(), w = w || {}, typeof N != "boolean" && (N = g instanceof e), this.objectMode = !!w.objectMode, N && (this.objectMode = this.objectMode || !!w.readableObjectMode), this.highWaterMark = x(this, w, "readableHighWaterMark", N), this.buffer = new l(), this.length = 0, this.pipes = null, this.pipesCount = 0, this.flowing = null, this.ended = !1, this.endEmitted = !1, this.reading = !1, this.sync = !0, this.needReadable = !1, this.emittedReadable = !1, this.readableListening = !1, this.resumeScheduled = !1, this.paused = !0, this.emitClose = w.emitClose !== !1, this.autoDestroy = !!w.autoDestroy, this.destroyed = !1, this.defaultEncoding = w.defaultEncoding || "utf8", this.awaitDrain = 0, this.readingMore = !1, this.decoder = null, this.encoding = null, w.encoding && (U || (U = si.StringDecoder), this.decoder = new U(w.encoding), this.encoding = w.encoding);
7928
+ e = e || Nr(), w = w || {}, typeof N != "boolean" && (N = g instanceof e), this.objectMode = !!w.objectMode, N && (this.objectMode = this.objectMode || !!w.readableObjectMode), this.highWaterMark = E(this, w, "readableHighWaterMark", N), this.buffer = new l(), this.length = 0, this.pipes = null, this.pipesCount = 0, this.flowing = null, this.ended = !1, this.endEmitted = !1, this.reading = !1, this.sync = !0, this.needReadable = !1, this.emittedReadable = !1, this.readableListening = !1, this.resumeScheduled = !1, this.paused = !0, this.emitClose = w.emitClose !== !1, this.autoDestroy = !!w.autoDestroy, this.destroyed = !1, this.defaultEncoding = w.defaultEncoding || "utf8", this.awaitDrain = 0, this.readingMore = !1, this.decoder = null, this.encoding = null, w.encoding && (U || (U = si.StringDecoder), this.decoder = new U(w.encoding), this.encoding = w.encoding);
7864
7929
  }
7865
7930
  function R(w) {
7866
7931
  if (e = e || Nr(), !(this instanceof R)) return new R(w);
@@ -7890,7 +7955,7 @@ function gf() {
7890
7955
  c("readableAddChunk", g);
7891
7956
  var Y = w._readableState;
7892
7957
  if (g === null)
7893
- Y.reading = !1, ae(w, Y);
7958
+ Y.reading = !1, fe(w, Y);
7894
7959
  else {
7895
7960
  var te;
7896
7961
  if (pe || (te = C(Y, g)), te)
@@ -7910,7 +7975,7 @@ function gf() {
7910
7975
  return !Y.ended && (Y.length < Y.highWaterMark || Y.length === 0);
7911
7976
  }
7912
7977
  function Z(w, g, N, D) {
7913
- g.flowing && g.length === 0 && !g.sync ? (g.awaitDrain = 0, w.emit("data", N)) : (g.length += g.objectMode ? 1 : N.length, D ? g.buffer.unshift(N) : g.buffer.push(N), g.needReadable && fe(w)), Ge(w, g);
7978
+ g.flowing && g.length === 0 && !g.sync ? (g.awaitDrain = 0, w.emit("data", N)) : (g.length += g.objectMode ? 1 : N.length, D ? g.buffer.unshift(N) : g.buffer.push(N), g.needReadable && ue(w)), Ge(w, g);
7914
7979
  }
7915
7980
  function C(w, g) {
7916
7981
  var N;
@@ -7937,7 +8002,7 @@ function gf() {
7937
8002
  c("read", w), w = parseInt(w, 10);
7938
8003
  var g = this._readableState, N = w;
7939
8004
  if (w !== 0 && (g.emittedReadable = !1), w === 0 && g.needReadable && ((g.highWaterMark !== 0 ? g.length >= g.highWaterMark : g.length > 0) || g.ended))
7940
- return c("read: emitReadable", g.length, g.ended), g.length === 0 && g.ended ? F(this) : fe(this), null;
8005
+ return c("read: emitReadable", g.length, g.ended), g.length === 0 && g.ended ? F(this) : ue(this), null;
7941
8006
  if (w = q(w, g), w === 0 && g.ended)
7942
8007
  return g.length === 0 && F(this), null;
7943
8008
  var D = g.needReadable;
@@ -7945,16 +8010,16 @@ function gf() {
7945
8010
  var pe;
7946
8011
  return w > 0 ? pe = P(w, g) : pe = null, pe === null ? (g.needReadable = g.length <= g.highWaterMark, w = 0) : (g.length -= w, g.awaitDrain = 0), g.length === 0 && (g.ended || (g.needReadable = !0), N !== w && g.ended && F(this)), pe !== null && this.emit("data", pe), pe;
7947
8012
  };
7948
- function ae(w, g) {
8013
+ function fe(w, g) {
7949
8014
  if (c("onEofChunk"), !g.ended) {
7950
8015
  if (g.decoder) {
7951
8016
  var N = g.decoder.end();
7952
8017
  N && N.length && (g.buffer.push(N), g.length += g.objectMode ? 1 : N.length);
7953
8018
  }
7954
- g.ended = !0, g.sync ? fe(w) : (g.needReadable = !1, g.emittedReadable || (g.emittedReadable = !0, Ze(w)));
8019
+ g.ended = !0, g.sync ? ue(w) : (g.needReadable = !1, g.emittedReadable || (g.emittedReadable = !0, Ze(w)));
7955
8020
  }
7956
8021
  }
7957
- function fe(w) {
8022
+ function ue(w) {
7958
8023
  var g = w._readableState;
7959
8024
  c("emitReadable", g.needReadable, g.emittedReadable), g.needReadable = !1, g.emittedReadable || (c("emitReadable", g.flowing), g.emittedReadable = !0, process.nextTick(Ze, w));
7960
8025
  }
@@ -7989,19 +8054,19 @@ function gf() {
7989
8054
  break;
7990
8055
  }
7991
8056
  D.pipesCount += 1, c("pipe count=%d opts=%j", D.pipesCount, g);
7992
- var pe = (!g || g.end !== !1) && w !== process.stdout && w !== process.stderr, Y = pe ? Tt : Xt;
8057
+ var pe = (!g || g.end !== !1) && w !== process.stdout && w !== process.stderr, Y = pe ? It : Xt;
7993
8058
  D.endEmitted ? process.nextTick(Y) : N.once("end", Y), w.on("unpipe", te);
7994
8059
  function te(h, f) {
7995
8060
  c("onunpipe"), h === N && f && f.hasUnpiped === !1 && (f.hasUnpiped = !0, br());
7996
8061
  }
7997
- function Tt() {
8062
+ function It() {
7998
8063
  c("onend"), w.end();
7999
8064
  }
8000
8065
  var yr = de(N);
8001
8066
  w.on("drain", yr);
8002
8067
  var $r = !1;
8003
8068
  function br() {
8004
- c("cleanup"), w.removeListener("close", jr), w.removeListener("finish", Ke), w.removeListener("drain", yr), w.removeListener("error", Yt), w.removeListener("unpipe", te), N.removeListener("end", Tt), N.removeListener("end", Xt), N.removeListener("data", Ve), $r = !0, D.awaitDrain && (!w._writableState || w._writableState.needDrain) && yr();
8069
+ c("cleanup"), w.removeListener("close", jr), w.removeListener("finish", Ke), w.removeListener("drain", yr), w.removeListener("error", Yt), w.removeListener("unpipe", te), N.removeListener("end", It), N.removeListener("end", Xt), N.removeListener("data", Ve), $r = !0, D.awaitDrain && (!w._writableState || w._writableState.needDrain) && yr();
8005
8070
  }
8006
8071
  N.on("data", Ve);
8007
8072
  function Ve(h) {
@@ -8051,7 +8116,7 @@ function gf() {
8051
8116
  return te === -1 ? this : (g.pipes.splice(te, 1), g.pipesCount -= 1, g.pipesCount === 1 && (g.pipes = g.pipes[0]), w.emit("unpipe", this, N), this);
8052
8117
  }, R.prototype.on = function(w, g) {
8053
8118
  var N = r.prototype.on.call(this, w, g), D = this._readableState;
8054
- return w === "data" ? (D.readableListening = this.listenerCount("readable") > 0, D.flowing !== !1 && this.resume()) : w === "readable" && !D.endEmitted && !D.readableListening && (D.readableListening = D.needReadable = !0, D.flowing = !1, D.emittedReadable = !1, c("on readable", D.length, D.reading), D.length ? fe(this) : D.reading || process.nextTick(We, this)), N;
8119
+ return w === "data" ? (D.readableListening = this.listenerCount("readable") > 0, D.flowing !== !1 && this.resume()) : w === "readable" && !D.endEmitted && !D.readableListening && (D.readableListening = D.needReadable = !0, D.flowing = !1, D.emittedReadable = !1, c("on readable", D.length, D.reading), D.length ? ue(this) : D.reading || process.nextTick(We, this)), N;
8055
8120
  }, R.prototype.addListener = R.prototype.on, R.prototype.removeListener = function(w, g) {
8056
8121
  var N = r.prototype.removeListener.call(this, w, g);
8057
8122
  return w === "readable" && process.nextTick(ve, this), N;
@@ -8068,12 +8133,12 @@ function gf() {
8068
8133
  }
8069
8134
  R.prototype.resume = function() {
8070
8135
  var w = this._readableState;
8071
- return w.flowing || (c("resume"), w.flowing = !w.readableListening, At(this, w)), w.paused = !1, this;
8136
+ return w.flowing || (c("resume"), w.flowing = !w.readableListening, Tt(this, w)), w.paused = !1, this;
8072
8137
  };
8073
- function At(w, g) {
8074
- g.resumeScheduled || (g.resumeScheduled = !0, process.nextTick(dt, w, g));
8138
+ function Tt(w, g) {
8139
+ g.resumeScheduled || (g.resumeScheduled = !0, process.nextTick(pt, w, g));
8075
8140
  }
8076
- function dt(w, g) {
8141
+ function pt(w, g) {
8077
8142
  c("resume", g.reading), g.reading || w.read(0), g.resumeScheduled = !1, w.emit("resume"), A(w), g.flowing && !g.reading && w.read(0);
8078
8143
  }
8079
8144
  R.prototype.pause = function() {
@@ -8093,18 +8158,18 @@ function gf() {
8093
8158
  g.push(null);
8094
8159
  }), w.on("data", function(te) {
8095
8160
  if (c("wrapped data"), N.decoder && (te = N.decoder.write(te)), !(N.objectMode && te == null) && !(!N.objectMode && (!te || !te.length))) {
8096
- var Tt = g.push(te);
8097
- Tt || (D = !0, w.pause());
8161
+ var It = g.push(te);
8162
+ It || (D = !0, w.pause());
8098
8163
  }
8099
8164
  });
8100
8165
  for (var pe in w)
8101
- this[pe] === void 0 && typeof w[pe] == "function" && (this[pe] = /* @__PURE__ */ function(Tt) {
8166
+ this[pe] === void 0 && typeof w[pe] == "function" && (this[pe] = /* @__PURE__ */ function(It) {
8102
8167
  return function() {
8103
- return w[Tt].apply(w, arguments);
8168
+ return w[It].apply(w, arguments);
8104
8169
  };
8105
8170
  }(pe));
8106
- for (var Y = 0; Y < E.length; Y++)
8107
- w.on(E[Y], this.emit.bind(this, E[Y]));
8171
+ for (var Y = 0; Y < x.length; Y++)
8172
+ w.on(x[Y], this.emit.bind(this, x[Y]));
8108
8173
  return this._read = function(te) {
8109
8174
  c("wrapped _read", te), D && (D = !1, w.resume());
8110
8175
  }, this;
@@ -8171,8 +8236,8 @@ function gf() {
8171
8236
  }
8172
8237
  return as;
8173
8238
  }
8174
- var mf = Bt, Si = dr.codes, Dl = Si.ERR_METHOD_NOT_IMPLEMENTED, $l = Si.ERR_MULTIPLE_CALLBACK, jl = Si.ERR_TRANSFORM_ALREADY_TRANSFORMING, Gl = Si.ERR_TRANSFORM_WITH_LENGTH_0, Bi = Nr();
8175
- Ie(Bt, Bi);
8239
+ var mf = Pt, Si = dr.codes, Dl = Si.ERR_METHOD_NOT_IMPLEMENTED, $l = Si.ERR_MULTIPLE_CALLBACK, jl = Si.ERR_TRANSFORM_ALREADY_TRANSFORMING, Gl = Si.ERR_TRANSFORM_WITH_LENGTH_0, Bi = Nr();
8240
+ Te(Pt, Bi);
8176
8241
  function Wl(e, t) {
8177
8242
  var r = this._transformState;
8178
8243
  r.transforming = !1;
@@ -8183,8 +8248,8 @@ function Wl(e, t) {
8183
8248
  var i = this._readableState;
8184
8249
  i.reading = !1, (i.needReadable || i.length < i.highWaterMark) && this._read(i.highWaterMark);
8185
8250
  }
8186
- function Bt(e) {
8187
- if (!(this instanceof Bt)) return new Bt(e);
8251
+ function Pt(e) {
8252
+ if (!(this instanceof Pt)) return new Pt(e);
8188
8253
  Bi.call(this, e), this._transformState = {
8189
8254
  afterTransform: Wl.bind(this),
8190
8255
  needTransform: !1,
@@ -8200,24 +8265,24 @@ function Vl() {
8200
8265
  Xo(e, t, r);
8201
8266
  }) : Xo(this, null, null);
8202
8267
  }
8203
- Bt.prototype.push = function(e, t) {
8268
+ Pt.prototype.push = function(e, t) {
8204
8269
  return this._transformState.needTransform = !1, Bi.prototype.push.call(this, e, t);
8205
8270
  };
8206
- Bt.prototype._transform = function(e, t, r) {
8271
+ Pt.prototype._transform = function(e, t, r) {
8207
8272
  r(new Dl("_transform()"));
8208
8273
  };
8209
- Bt.prototype._write = function(e, t, r) {
8274
+ Pt.prototype._write = function(e, t, r) {
8210
8275
  var n = this._transformState;
8211
8276
  if (n.writecb = r, n.writechunk = e, n.writeencoding = t, !n.transforming) {
8212
8277
  var i = this._readableState;
8213
8278
  (n.needTransform || i.needReadable || i.length < i.highWaterMark) && this._read(i.highWaterMark);
8214
8279
  }
8215
8280
  };
8216
- Bt.prototype._read = function(e) {
8281
+ Pt.prototype._read = function(e) {
8217
8282
  var t = this._transformState;
8218
8283
  t.writechunk !== null && !t.transforming ? (t.transforming = !0, this._transform(t.writechunk, t.writeencoding, t.afterTransform)) : t.needTransform = !0;
8219
8284
  };
8220
- Bt.prototype._destroy = function(e, t) {
8285
+ Pt.prototype._destroy = function(e, t) {
8221
8286
  Bi.prototype._destroy.call(this, e, function(r) {
8222
8287
  t(r);
8223
8288
  });
@@ -8229,7 +8294,7 @@ function Xo(e, t, r) {
8229
8294
  return e.push(null);
8230
8295
  }
8231
8296
  var zl = bn, _f = mf;
8232
- Ie(bn, _f);
8297
+ Te(bn, _f);
8233
8298
  function bn(e) {
8234
8299
  if (!(this instanceof bn)) return new bn(e);
8235
8300
  _f.call(this, e);
@@ -8299,16 +8364,16 @@ var t0 = e0;
8299
8364
  (function(e, t) {
8300
8365
  t = e.exports = gf(), t.Stream = t, t.Readable = t, t.Writable = bf(), t.Duplex = Nr(), t.Transform = mf, t.PassThrough = zl, t.finished = qs, t.pipeline = t0;
8301
8366
  })(xs, xs.exports);
8302
- var Ef = xs.exports, oi = je.Buffer, xf = Ef.Transform, r0 = Ie;
8367
+ var Ef = xs.exports, oi = je.Buffer, xf = Ef.Transform, r0 = Te;
8303
8368
  function n0(e, t) {
8304
8369
  if (!oi.isBuffer(e) && typeof e != "string")
8305
8370
  throw new TypeError(t + " must be a string or a buffer");
8306
8371
  }
8307
- function Vt(e) {
8372
+ function zt(e) {
8308
8373
  xf.call(this), this._block = oi.allocUnsafe(e), this._blockSize = e, this._blockOffset = 0, this._length = [0, 0, 0, 0], this._finalized = !1;
8309
8374
  }
8310
- r0(Vt, xf);
8311
- Vt.prototype._transform = function(e, t, r) {
8375
+ r0(zt, xf);
8376
+ zt.prototype._transform = function(e, t, r) {
8312
8377
  var n = null;
8313
8378
  try {
8314
8379
  this.update(e, t);
@@ -8317,7 +8382,7 @@ Vt.prototype._transform = function(e, t, r) {
8317
8382
  }
8318
8383
  r(n);
8319
8384
  };
8320
- Vt.prototype._flush = function(e) {
8385
+ zt.prototype._flush = function(e) {
8321
8386
  var t = null;
8322
8387
  try {
8323
8388
  this.push(this.digest());
@@ -8326,7 +8391,7 @@ Vt.prototype._flush = function(e) {
8326
8391
  }
8327
8392
  e(t);
8328
8393
  };
8329
- Vt.prototype.update = function(e, t) {
8394
+ zt.prototype.update = function(e, t) {
8330
8395
  if (n0(e, "Data"), this._finalized) throw new Error("Digest already called");
8331
8396
  oi.isBuffer(e) || (e = oi.from(e, t));
8332
8397
  for (var r = this._block, n = 0; this._blockOffset + e.length - n >= this._blockSize; ) {
@@ -8338,10 +8403,10 @@ Vt.prototype.update = function(e, t) {
8338
8403
  this._length[s] += o, o = this._length[s] / 4294967296 | 0, o > 0 && (this._length[s] -= 4294967296 * o);
8339
8404
  return this;
8340
8405
  };
8341
- Vt.prototype._update = function() {
8406
+ zt.prototype._update = function() {
8342
8407
  throw new Error("_update is not implemented");
8343
8408
  };
8344
- Vt.prototype.digest = function(e) {
8409
+ zt.prototype.digest = function(e) {
8345
8410
  if (this._finalized) throw new Error("Digest already called");
8346
8411
  this._finalized = !0;
8347
8412
  var t = this._digest();
@@ -8349,10 +8414,10 @@ Vt.prototype.digest = function(e) {
8349
8414
  for (var r = 0; r < 4; ++r) this._length[r] = 0;
8350
8415
  return t;
8351
8416
  };
8352
- Vt.prototype._digest = function() {
8417
+ zt.prototype._digest = function() {
8353
8418
  throw new Error("_digest is not implemented");
8354
8419
  };
8355
- var i0 = Vt, s0 = Ie, Sf = i0, o0 = je.Buffer, a0 = new Array(16);
8420
+ var i0 = zt, s0 = Te, Sf = i0, o0 = je.Buffer, a0 = new Array(16);
8356
8421
  function Pi() {
8357
8422
  Sf.call(this, 64), this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878;
8358
8423
  }
@@ -8382,16 +8447,16 @@ function Re(e, t, r, n, i, s, o) {
8382
8447
  function Ue(e, t, r, n, i, s, o) {
8383
8448
  return Ai(e + (r ^ (t | ~n)) + i + s | 0, o) + t | 0;
8384
8449
  }
8385
- var f0 = Pi, ai = je.Buffer, Bf = Ef.Transform, u0 = Ie;
8450
+ var f0 = Pi, ai = je.Buffer, Bf = Ef.Transform, u0 = Te;
8386
8451
  function c0(e, t) {
8387
8452
  if (!ai.isBuffer(e) && typeof e != "string")
8388
8453
  throw new TypeError(t + " must be a string or a buffer");
8389
8454
  }
8390
- function zt(e) {
8455
+ function qt(e) {
8391
8456
  Bf.call(this), this._block = ai.allocUnsafe(e), this._blockSize = e, this._blockOffset = 0, this._length = [0, 0, 0, 0], this._finalized = !1;
8392
8457
  }
8393
- u0(zt, Bf);
8394
- zt.prototype._transform = function(e, t, r) {
8458
+ u0(qt, Bf);
8459
+ qt.prototype._transform = function(e, t, r) {
8395
8460
  var n = null;
8396
8461
  try {
8397
8462
  this.update(e, t);
@@ -8400,7 +8465,7 @@ zt.prototype._transform = function(e, t, r) {
8400
8465
  }
8401
8466
  r(n);
8402
8467
  };
8403
- zt.prototype._flush = function(e) {
8468
+ qt.prototype._flush = function(e) {
8404
8469
  var t = null;
8405
8470
  try {
8406
8471
  this.push(this.digest());
@@ -8409,7 +8474,7 @@ zt.prototype._flush = function(e) {
8409
8474
  }
8410
8475
  e(t);
8411
8476
  };
8412
- zt.prototype.update = function(e, t) {
8477
+ qt.prototype.update = function(e, t) {
8413
8478
  if (c0(e, "Data"), this._finalized) throw new Error("Digest already called");
8414
8479
  ai.isBuffer(e) || (e = ai.from(e, t));
8415
8480
  for (var r = this._block, n = 0; this._blockOffset + e.length - n >= this._blockSize; ) {
@@ -8421,10 +8486,10 @@ zt.prototype.update = function(e, t) {
8421
8486
  this._length[s] += o, o = this._length[s] / 4294967296 | 0, o > 0 && (this._length[s] -= 4294967296 * o);
8422
8487
  return this;
8423
8488
  };
8424
- zt.prototype._update = function() {
8489
+ qt.prototype._update = function() {
8425
8490
  throw new Error("_update is not implemented");
8426
8491
  };
8427
- zt.prototype.digest = function(e) {
8492
+ qt.prototype.digest = function(e) {
8428
8493
  if (this._finalized) throw new Error("Digest already called");
8429
8494
  this._finalized = !0;
8430
8495
  var t = this._digest();
@@ -8432,10 +8497,10 @@ zt.prototype.digest = function(e) {
8432
8497
  for (var r = 0; r < 4; ++r) this._length[r] = 0;
8433
8498
  return t;
8434
8499
  };
8435
- zt.prototype._digest = function() {
8500
+ qt.prototype._digest = function() {
8436
8501
  throw new Error("_digest is not implemented");
8437
8502
  };
8438
- var h0 = zt, us = Pt.Buffer, l0 = Ie, Pf = h0, d0 = new Array(16), Xr = [
8503
+ var h0 = qt, us = At.Buffer, l0 = Te, Pf = h0, d0 = new Array(16), Xr = [
8439
8504
  0,
8440
8505
  1,
8441
8506
  2,
@@ -8766,9 +8831,9 @@ function Ti() {
8766
8831
  l0(Ti, Pf);
8767
8832
  Ti.prototype._update = function() {
8768
8833
  for (var e = d0, t = 0; t < 16; ++t) e[t] = this._block.readInt32LE(t * 4);
8769
- for (var r = this._a | 0, n = this._b | 0, i = this._c | 0, s = this._d | 0, o = this._e | 0, a = this._a | 0, c = this._b | 0, l = this._c | 0, d = this._d | 0, b = this._e | 0, x = 0; x < 80; x += 1) {
8834
+ for (var r = this._a | 0, n = this._b | 0, i = this._c | 0, s = this._d | 0, o = this._e | 0, a = this._a | 0, c = this._b | 0, l = this._c | 0, d = this._d | 0, b = this._e | 0, E = 0; E < 80; E += 1) {
8770
8835
  var p, I;
8771
- x < 16 ? (p = Zo(r, n, i, s, o, e[Xr[x]], en[0], Qr[x]), I = na(a, c, l, d, b, e[Jr[x]], tn[0], Zr[x])) : x < 32 ? (p = ea(r, n, i, s, o, e[Xr[x]], en[1], Qr[x]), I = ra(a, c, l, d, b, e[Jr[x]], tn[1], Zr[x])) : x < 48 ? (p = ta(r, n, i, s, o, e[Xr[x]], en[2], Qr[x]), I = ta(a, c, l, d, b, e[Jr[x]], tn[2], Zr[x])) : x < 64 ? (p = ra(r, n, i, s, o, e[Xr[x]], en[3], Qr[x]), I = ea(a, c, l, d, b, e[Jr[x]], tn[3], Zr[x])) : (p = na(r, n, i, s, o, e[Xr[x]], en[4], Qr[x]), I = Zo(a, c, l, d, b, e[Jr[x]], tn[4], Zr[x])), r = o, o = s, s = or(i, 10), i = n, n = p, a = b, b = d, d = or(l, 10), l = c, c = I;
8836
+ E < 16 ? (p = Zo(r, n, i, s, o, e[Xr[E]], en[0], Qr[E]), I = na(a, c, l, d, b, e[Jr[E]], tn[0], Zr[E])) : E < 32 ? (p = ea(r, n, i, s, o, e[Xr[E]], en[1], Qr[E]), I = ra(a, c, l, d, b, e[Jr[E]], tn[1], Zr[E])) : E < 48 ? (p = ta(r, n, i, s, o, e[Xr[E]], en[2], Qr[E]), I = ta(a, c, l, d, b, e[Jr[E]], tn[2], Zr[E])) : E < 64 ? (p = ra(r, n, i, s, o, e[Xr[E]], en[3], Qr[E]), I = ea(a, c, l, d, b, e[Jr[E]], tn[3], Zr[E])) : (p = na(r, n, i, s, o, e[Xr[E]], en[4], Qr[E]), I = Zo(a, c, l, d, b, e[Jr[E]], tn[4], Zr[E])), r = o, o = s, s = or(i, 10), i = n, n = p, a = b, b = d, d = or(l, 10), l = c, c = I;
8772
8837
  }
8773
8838
  var B = this._b + i + d | 0;
8774
8839
  this._b = this._c + s + b | 0, this._c = this._d + o + a | 0, this._d = this._e + r + c | 0, this._e = this._a + n + l | 0, this._a = B;
@@ -8826,7 +8891,7 @@ Ii.prototype.digest = function(e) {
8826
8891
  Ii.prototype._update = function() {
8827
8892
  throw new Error("_update must be implemented by subclass");
8828
8893
  };
8829
- var Hr = Ii, y0 = Ie, If = Hr, b0 = je.Buffer, w0 = [
8894
+ var Hr = Ii, y0 = Te, If = Hr, b0 = je.Buffer, w0 = [
8830
8895
  1518500249,
8831
8896
  1859775393,
8832
8897
  -1894007588,
@@ -8861,7 +8926,7 @@ En.prototype._hash = function() {
8861
8926
  var e = b0.allocUnsafe(20);
8862
8927
  return e.writeInt32BE(this._a | 0, 0), e.writeInt32BE(this._b | 0, 4), e.writeInt32BE(this._c | 0, 8), e.writeInt32BE(this._d | 0, 12), e.writeInt32BE(this._e | 0, 16), e;
8863
8928
  };
8864
- var E0 = En, x0 = Ie, Of = Hr, S0 = je.Buffer, B0 = [
8929
+ var E0 = En, x0 = Te, Of = Hr, S0 = je.Buffer, B0 = [
8865
8930
  1518500249,
8866
8931
  1859775393,
8867
8932
  -1894007588,
@@ -8899,7 +8964,7 @@ xn.prototype._hash = function() {
8899
8964
  var e = S0.allocUnsafe(20);
8900
8965
  return e.writeInt32BE(this._a | 0, 0), e.writeInt32BE(this._b | 0, 4), e.writeInt32BE(this._c | 0, 8), e.writeInt32BE(this._d | 0, 12), e.writeInt32BE(this._e | 0, 16), e;
8901
8966
  };
8902
- var k0 = xn, R0 = Ie, kf = Hr, U0 = je.Buffer, C0 = [
8967
+ var k0 = xn, R0 = Te, kf = Hr, U0 = je.Buffer, C0 = [
8903
8968
  1116352408,
8904
8969
  1899447441,
8905
8970
  3049323471,
@@ -8994,8 +9059,8 @@ Sn.prototype._update = function(e) {
8994
9059
  for (var t = this._w, r = this._a | 0, n = this._b | 0, i = this._c | 0, s = this._d | 0, o = this._e | 0, a = this._f | 0, c = this._g | 0, l = this._h | 0, d = 0; d < 16; ++d) t[d] = e.readInt32BE(d * 4);
8995
9060
  for (; d < 64; ++d) t[d] = $0(t[d - 2]) + t[d - 7] + D0(t[d - 15]) + t[d - 16] | 0;
8996
9061
  for (var b = 0; b < 64; ++b) {
8997
- var x = l + M0(o) + N0(o, a, c) + C0[b] + t[b] | 0, p = H0(r) + F0(r, n, i) | 0;
8998
- l = c, c = a, a = o, o = s + x | 0, s = i, i = n, n = r, r = x + p | 0;
9062
+ var E = l + M0(o) + N0(o, a, c) + C0[b] + t[b] | 0, p = H0(r) + F0(r, n, i) | 0;
9063
+ l = c, c = a, a = o, o = s + E | 0, s = i, i = n, n = r, r = E + p | 0;
8999
9064
  }
9000
9065
  this._a = r + this._a | 0, this._b = n + this._b | 0, this._c = i + this._c | 0, this._d = s + this._d | 0, this._e = o + this._e | 0, this._f = a + this._f | 0, this._g = c + this._g | 0, this._h = l + this._h | 0;
9001
9066
  };
@@ -9003,7 +9068,7 @@ Sn.prototype._hash = function() {
9003
9068
  var e = U0.allocUnsafe(32);
9004
9069
  return e.writeInt32BE(this._a, 0), e.writeInt32BE(this._b, 4), e.writeInt32BE(this._c, 8), e.writeInt32BE(this._d, 12), e.writeInt32BE(this._e, 16), e.writeInt32BE(this._f, 20), e.writeInt32BE(this._g, 24), e.writeInt32BE(this._h, 28), e;
9005
9070
  };
9006
- var Rf = Sn, j0 = Ie, G0 = Rf, W0 = Hr, V0 = je.Buffer, z0 = new Array(64);
9071
+ var Rf = Sn, j0 = Te, G0 = Rf, W0 = Hr, V0 = je.Buffer, z0 = new Array(64);
9007
9072
  function Oi() {
9008
9073
  this.init(), this._w = z0, W0.call(this, 64, 56);
9009
9074
  }
@@ -9015,7 +9080,7 @@ Oi.prototype._hash = function() {
9015
9080
  var e = V0.allocUnsafe(28);
9016
9081
  return e.writeInt32BE(this._a, 0), e.writeInt32BE(this._b, 4), e.writeInt32BE(this._c, 8), e.writeInt32BE(this._d, 12), e.writeInt32BE(this._e, 16), e.writeInt32BE(this._f, 20), e.writeInt32BE(this._g, 24), e;
9017
9082
  };
9018
- var q0 = Oi, K0 = Ie, Uf = Hr, Y0 = je.Buffer, ia = [
9083
+ var q0 = Oi, K0 = Te, Uf = Hr, Y0 = je.Buffer, ia = [
9019
9084
  1116352408,
9020
9085
  3609767458,
9021
9086
  1899447441,
@@ -9212,22 +9277,22 @@ function Be(e, t) {
9212
9277
  return e >>> 0 < t >>> 0 ? 1 : 0;
9213
9278
  }
9214
9279
  Bn.prototype._update = function(e) {
9215
- for (var t = this._w, r = this._ah | 0, n = this._bh | 0, i = this._ch | 0, s = this._dh | 0, o = this._eh | 0, a = this._fh | 0, c = this._gh | 0, l = this._hh | 0, d = this._al | 0, b = this._bl | 0, x = this._cl | 0, p = this._dl | 0, I = this._el | 0, B = this._fl | 0, T = this._gl | 0, k = this._hl | 0, U = 0; U < 32; U += 2)
9280
+ for (var t = this._w, r = this._ah | 0, n = this._bh | 0, i = this._ch | 0, s = this._dh | 0, o = this._eh | 0, a = this._fh | 0, c = this._gh | 0, l = this._hh | 0, d = this._al | 0, b = this._bl | 0, E = this._cl | 0, p = this._dl | 0, I = this._el | 0, B = this._fl | 0, T = this._gl | 0, k = this._hl | 0, U = 0; U < 32; U += 2)
9216
9281
  t[U] = e.readInt32BE(U * 4), t[U + 1] = e.readInt32BE(U * 4 + 4);
9217
9282
  for (; U < 160; U += 2) {
9218
- var _ = t[U - 30], m = t[U - 15 * 2 + 1], S = J0(_, m), E = Q0(m, _);
9283
+ var _ = t[U - 30], m = t[U - 15 * 2 + 1], S = J0(_, m), x = Q0(m, _);
9219
9284
  _ = t[U - 2 * 2], m = t[U - 2 * 2 + 1];
9220
- var M = Z0(_, m), $ = ed(m, _), R = t[U - 7 * 2], z = t[U - 7 * 2 + 1], Z = t[U - 16 * 2], C = t[U - 16 * 2 + 1], H = E + z | 0, W = S + R + Be(H, E) | 0;
9285
+ var M = Z0(_, m), $ = ed(m, _), R = t[U - 7 * 2], z = t[U - 7 * 2 + 1], Z = t[U - 16 * 2], C = t[U - 16 * 2 + 1], H = x + z | 0, W = S + R + Be(H, x) | 0;
9221
9286
  H = H + $ | 0, W = W + M + Be(H, $) | 0, H = H + C | 0, W = W + Z + Be(H, C) | 0, t[U] = W, t[U + 1] = H;
9222
9287
  }
9223
9288
  for (var q = 0; q < 160; q += 2) {
9224
9289
  W = t[q], H = t[q + 1];
9225
- var ae = oa(r, n, i), fe = oa(d, b, x), Ze = aa(r, d), Ge = aa(d, r), nt = fa(o, I), de = fa(I, o), ve = ia[q], We = ia[q + 1], At = sa(o, a, c), dt = sa(I, B, T), A = k + de | 0, P = l + nt + Be(A, k) | 0;
9226
- A = A + dt | 0, P = P + At + Be(A, dt) | 0, A = A + We | 0, P = P + ve + Be(A, We) | 0, A = A + H | 0, P = P + W + Be(A, H) | 0;
9227
- var F = Ge + fe | 0, G = Ze + ae + Be(F, Ge) | 0;
9228
- l = c, k = T, c = a, T = B, a = o, B = I, I = p + A | 0, o = s + P + Be(I, p) | 0, s = i, p = x, i = n, x = b, n = r, b = d, d = A + F | 0, r = P + G + Be(d, A) | 0;
9290
+ var fe = oa(r, n, i), ue = oa(d, b, E), Ze = aa(r, d), Ge = aa(d, r), nt = fa(o, I), de = fa(I, o), ve = ia[q], We = ia[q + 1], Tt = sa(o, a, c), pt = sa(I, B, T), A = k + de | 0, P = l + nt + Be(A, k) | 0;
9291
+ A = A + pt | 0, P = P + Tt + Be(A, pt) | 0, A = A + We | 0, P = P + ve + Be(A, We) | 0, A = A + H | 0, P = P + W + Be(A, H) | 0;
9292
+ var F = Ge + ue | 0, G = Ze + fe + Be(F, Ge) | 0;
9293
+ l = c, k = T, c = a, T = B, a = o, B = I, I = p + A | 0, o = s + P + Be(I, p) | 0, s = i, p = E, i = n, E = b, n = r, b = d, d = A + F | 0, r = P + G + Be(d, A) | 0;
9229
9294
  }
9230
- this._al = this._al + d | 0, this._bl = this._bl + b | 0, this._cl = this._cl + x | 0, this._dl = this._dl + p | 0, this._el = this._el + I | 0, this._fl = this._fl + B | 0, this._gl = this._gl + T | 0, this._hl = this._hl + k | 0, this._ah = this._ah + r + Be(this._al, d) | 0, this._bh = this._bh + n + Be(this._bl, b) | 0, this._ch = this._ch + i + Be(this._cl, x) | 0, this._dh = this._dh + s + Be(this._dl, p) | 0, this._eh = this._eh + o + Be(this._el, I) | 0, this._fh = this._fh + a + Be(this._fl, B) | 0, this._gh = this._gh + c + Be(this._gl, T) | 0, this._hh = this._hh + l + Be(this._hl, k) | 0;
9295
+ this._al = this._al + d | 0, this._bl = this._bl + b | 0, this._cl = this._cl + E | 0, this._dl = this._dl + p | 0, this._el = this._el + I | 0, this._fl = this._fl + B | 0, this._gl = this._gl + T | 0, this._hl = this._hl + k | 0, this._ah = this._ah + r + Be(this._al, d) | 0, this._bh = this._bh + n + Be(this._bl, b) | 0, this._ch = this._ch + i + Be(this._cl, E) | 0, this._dh = this._dh + s + Be(this._dl, p) | 0, this._eh = this._eh + o + Be(this._el, I) | 0, this._fh = this._fh + a + Be(this._fl, B) | 0, this._gh = this._gh + c + Be(this._gl, T) | 0, this._hh = this._hh + l + Be(this._hl, k) | 0;
9231
9296
  };
9232
9297
  Bn.prototype._hash = function() {
9233
9298
  var e = Y0.allocUnsafe(64);
@@ -9236,7 +9301,7 @@ Bn.prototype._hash = function() {
9236
9301
  }
9237
9302
  return t(this._ah, this._al, 0), t(this._bh, this._bl, 8), t(this._ch, this._cl, 16), t(this._dh, this._dl, 24), t(this._eh, this._el, 32), t(this._fh, this._fl, 40), t(this._gh, this._gl, 48), t(this._hh, this._hl, 56), e;
9238
9303
  };
9239
- var Cf = Bn, td = Ie, rd = Cf, nd = Hr, id = je.Buffer, sd = new Array(160);
9304
+ var Cf = Bn, td = Te, rd = Cf, nd = Hr, id = je.Buffer, sd = new Array(160);
9240
9305
  function ki() {
9241
9306
  this.init(), this._w = sd, nd.call(this, 128, 112);
9242
9307
  }
@@ -9263,7 +9328,7 @@ pr.sha224 = q0;
9263
9328
  pr.sha256 = Rf;
9264
9329
  pr.sha384 = od;
9265
9330
  pr.sha512 = Cf;
9266
- var ad = Af.exports, Lf = je.Buffer, Nf = Vs.Transform, fd = si.StringDecoder, ud = Ie;
9331
+ var ad = Af.exports, Lf = je.Buffer, Nf = Vs.Transform, fd = si.StringDecoder, ud = Te;
9267
9332
  function rt(e) {
9268
9333
  Nf.call(this), this.hashMode = typeof e == "string", this.hashMode ? this[e] = this._finalOrDigest : this.final = this._finalOrDigest, this._final && (this.__final = this._final, this._final = null), this._decoder = null, this._encoding = null;
9269
9334
  }
@@ -9312,7 +9377,7 @@ rt.prototype._toString = function(e, t, r) {
9312
9377
  var n = this._decoder.write(e);
9313
9378
  return r && (n += this._decoder.end()), n;
9314
9379
  };
9315
- var cd = rt, hd = Ie, ld = f0, dd = p0, pd = ad, Ff = cd;
9380
+ var cd = rt, hd = Te, ld = f0, dd = p0, pd = ad, Ff = cd;
9316
9381
  function Ri(e) {
9317
9382
  Ff.call(this, "digest"), this._hash = e;
9318
9383
  }
@@ -9346,8 +9411,8 @@ function bd(e) {
9346
9411
  for (var I = 0, B = 0, T = 0, k = p.length; T !== k && p[T] === 0; )
9347
9412
  T++, I++;
9348
9413
  for (var U = (k - T) * l + 1 >>> 0, _ = new Uint8Array(U); T !== k; ) {
9349
- for (var m = p[T], S = 0, E = U - 1; (m !== 0 || S < B) && E !== -1; E--, S++)
9350
- m += 256 * _[E] >>> 0, _[E] = m % o >>> 0, m = m / o >>> 0;
9414
+ for (var m = p[T], S = 0, x = U - 1; (m !== 0 || S < B) && x !== -1; x--, S++)
9415
+ m += 256 * _[x] >>> 0, _[x] = m % o >>> 0, m = m / o >>> 0;
9351
9416
  if (m !== 0)
9352
9417
  throw new Error("Non-zero carry");
9353
9418
  B = S, T++;
@@ -9375,15 +9440,15 @@ function bd(e) {
9375
9440
  throw new Error("Non-zero carry");
9376
9441
  T = m, I++;
9377
9442
  }
9378
- for (var E = k - T; E !== k && U[E] === 0; )
9379
- E++;
9380
- var M = Dn.allocUnsafe(B + (k - E));
9443
+ for (var x = k - T; x !== k && U[x] === 0; )
9444
+ x++;
9445
+ var M = Dn.allocUnsafe(B + (k - x));
9381
9446
  M.fill(0, 0, B);
9382
- for (var $ = B; E !== k; )
9383
- M[$++] = U[E++];
9447
+ for (var $ = B; x !== k; )
9448
+ M[$++] = U[x++];
9384
9449
  return M;
9385
9450
  }
9386
- function x(p) {
9451
+ function E(p) {
9387
9452
  var I = b(p);
9388
9453
  if (I)
9389
9454
  return I;
@@ -9392,7 +9457,7 @@ function bd(e) {
9392
9457
  return {
9393
9458
  encode: d,
9394
9459
  decodeUnsafe: b,
9395
- decode: x
9460
+ decode: E
9396
9461
  };
9397
9462
  }
9398
9463
  var wd = bd, gd = wd, md = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz", _d = gd(md), cs = _d, vd = je.Buffer, Ed = function(e) {
@@ -9471,35 +9536,35 @@ Object.defineProperty(Ui, "__esModule", { value: !0 });
9471
9536
  Ui.testEcc = void 0;
9472
9537
  const V = (e) => Buffer.from(e, "hex");
9473
9538
  function Id(e) {
9474
- ce(
9539
+ he(
9475
9540
  e.isPoint(
9476
9541
  V("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798")
9477
9542
  )
9478
- ), ce(
9543
+ ), he(
9479
9544
  !e.isPoint(
9480
9545
  V("030000000000000000000000000000000000000000000000000000000000000005")
9481
9546
  )
9482
- ), ce(
9547
+ ), he(
9483
9548
  e.isPrivate(
9484
9549
  V("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798")
9485
9550
  )
9486
- ), ce(
9551
+ ), he(
9487
9552
  e.isPrivate(
9488
9553
  V("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140")
9489
9554
  )
9490
- ), ce(
9555
+ ), he(
9491
9556
  !e.isPrivate(
9492
9557
  V("0000000000000000000000000000000000000000000000000000000000000000")
9493
9558
  )
9494
- ), ce(
9559
+ ), he(
9495
9560
  !e.isPrivate(
9496
9561
  V("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141")
9497
9562
  )
9498
- ), ce(
9563
+ ), he(
9499
9564
  !e.isPrivate(
9500
9565
  V("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364142")
9501
9566
  )
9502
- ), ce(
9567
+ ), he(
9503
9568
  Buffer.from(
9504
9569
  e.privateAdd(
9505
9570
  V("0000000000000000000000000000000000000000000000000000000000000001"),
@@ -9508,12 +9573,12 @@ function Id(e) {
9508
9573
  ).equals(
9509
9574
  V("0000000000000000000000000000000000000000000000000000000000000001")
9510
9575
  )
9511
- ), ce(
9576
+ ), he(
9512
9577
  e.privateAdd(
9513
9578
  V("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd036413e"),
9514
9579
  V("0000000000000000000000000000000000000000000000000000000000000003")
9515
9580
  ) === null
9516
- ), ce(
9581
+ ), he(
9517
9582
  Buffer.from(
9518
9583
  e.privateAdd(
9519
9584
  V("e211078564db65c3ce7704f08262b1f38f1ef412ad15b5ac2d76657a63b2c500"),
@@ -9522,7 +9587,7 @@ function Id(e) {
9522
9587
  ).equals(
9523
9588
  V("9730c2ee69edbb958d42db7460bafa18fef9d955325aec99044c81c8282b0a24")
9524
9589
  )
9525
- ), ce(
9590
+ ), he(
9526
9591
  Buffer.from(
9527
9592
  e.privateNegate(
9528
9593
  V("0000000000000000000000000000000000000000000000000000000000000001")
@@ -9530,7 +9595,7 @@ function Id(e) {
9530
9595
  ).equals(
9531
9596
  V("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140")
9532
9597
  )
9533
- ), ce(
9598
+ ), he(
9534
9599
  Buffer.from(
9535
9600
  e.privateNegate(
9536
9601
  V("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd036413e")
@@ -9538,7 +9603,7 @@ function Id(e) {
9538
9603
  ).equals(
9539
9604
  V("0000000000000000000000000000000000000000000000000000000000000003")
9540
9605
  )
9541
- ), ce(
9606
+ ), he(
9542
9607
  Buffer.from(
9543
9608
  e.privateNegate(
9544
9609
  V("b1121e4088a66a28f5b6b0f5844943ecd9f610196d7bb83b25214b60452c09af")
@@ -9546,7 +9611,7 @@ function Id(e) {
9546
9611
  ).equals(
9547
9612
  V("4eede1bf775995d70a494f0a7bb6bc11e0b8cccd41cce8009ab1132c8b0a3792")
9548
9613
  )
9549
- ), ce(
9614
+ ), he(
9550
9615
  Buffer.from(
9551
9616
  e.pointCompress(
9552
9617
  V(
@@ -9557,7 +9622,7 @@ function Id(e) {
9557
9622
  ).equals(
9558
9623
  V("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798")
9559
9624
  )
9560
- ), ce(
9625
+ ), he(
9561
9626
  Buffer.from(
9562
9627
  e.pointCompress(
9563
9628
  V(
@@ -9570,7 +9635,7 @@ function Id(e) {
9570
9635
  "0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"
9571
9636
  )
9572
9637
  )
9573
- ), ce(
9638
+ ), he(
9574
9639
  Buffer.from(
9575
9640
  e.pointCompress(
9576
9641
  V("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),
@@ -9579,7 +9644,7 @@ function Id(e) {
9579
9644
  ).equals(
9580
9645
  V("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798")
9581
9646
  )
9582
- ), ce(
9647
+ ), he(
9583
9648
  Buffer.from(
9584
9649
  e.pointCompress(
9585
9650
  V("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),
@@ -9590,7 +9655,7 @@ function Id(e) {
9590
9655
  "0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"
9591
9656
  )
9592
9657
  )
9593
- ), ce(
9658
+ ), he(
9594
9659
  Buffer.from(
9595
9660
  e.pointFromScalar(
9596
9661
  V("b1121e4088a66a28f5b6b0f5844943ecd9f610196d7bb83b25214b60452c09af")
@@ -9598,7 +9663,7 @@ function Id(e) {
9598
9663
  ).equals(
9599
9664
  V("02b07ba9dca9523b7ef4bd97703d43d20399eb698e194704791a25ce77a400df99")
9600
9665
  )
9601
- ), ce(
9666
+ ), he(
9602
9667
  e.xOnlyPointAddTweak(
9603
9668
  V("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),
9604
9669
  V("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140")
@@ -9608,18 +9673,18 @@ function Id(e) {
9608
9673
  V("1617d38ed8d8657da4d4761e8057bc396ea9e4b9d29776d4be096016dbd2509b"),
9609
9674
  V("a8397a935f0dfceba6ba9618f6451ef4d80637abf4e6af2669fbc9de6a8fd2ac")
9610
9675
  );
9611
- ce(
9676
+ he(
9612
9677
  Buffer.from(t.xOnlyPubkey).equals(
9613
9678
  V("e478f99dab91052ab39a33ea35fd5e6e4933f4d28023cd597c9a1f6760346adf")
9614
9679
  ) && t.parity === 1
9615
9680
  ), t = e.xOnlyPointAddTweak(
9616
9681
  V("2c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991"),
9617
9682
  V("823c3cd2142744b075a87eade7e1b8678ba308d566226a0056ca2b7a76f86b47")
9618
- ), ce(
9683
+ ), he(
9619
9684
  Buffer.from(t.xOnlyPubkey).equals(
9620
9685
  V("9534f8dc8c6deda2dc007655981c78b49c5d96c778fbf363462a11ec9dfd948c")
9621
9686
  ) && t.parity === 0
9622
- ), ce(
9687
+ ), he(
9623
9688
  Buffer.from(
9624
9689
  e.sign(
9625
9690
  V("5e9f0a0d593efdcf78ac923bc3313e4e7d408d574354ee2b3288c0da9fbba6ed"),
@@ -9630,7 +9695,7 @@ function Id(e) {
9630
9695
  "54c4a33c6423d689378f160a7ff8b61330444abb58fb470f96ea16d99d4a2fed07082304410efa6b2943111b6a4e0aaa7b7db55a07e9861d1fb3cb1f421044a5"
9631
9696
  )
9632
9697
  )
9633
- ), ce(
9698
+ ), he(
9634
9699
  e.verify(
9635
9700
  V("5e9f0a0d593efdcf78ac923bc3313e4e7d408d574354ee2b3288c0da9fbba6ed"),
9636
9701
  V("0379be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),
@@ -9638,7 +9703,7 @@ function Id(e) {
9638
9703
  "54c4a33c6423d689378f160a7ff8b61330444abb58fb470f96ea16d99d4a2fed07082304410efa6b2943111b6a4e0aaa7b7db55a07e9861d1fb3cb1f421044a5"
9639
9704
  )
9640
9705
  )
9641
- ), e.signSchnorr && ce(
9706
+ ), e.signSchnorr && he(
9642
9707
  Buffer.from(
9643
9708
  e.signSchnorr(
9644
9709
  V("7e2d58d8b3bcdf1abadec7829054f90dda9805aab56c77333024b9d0a508b75c"),
@@ -9650,7 +9715,7 @@ function Id(e) {
9650
9715
  "5831aaeed7b44bb74e5eab94ba9d4294c49bcf2a60728d8b4c200f50dd313c1bab745879a5ad954a72c45a91c3a51d3c7adea98d82f8481e0e1e03674a6f3fb7"
9651
9716
  )
9652
9717
  )
9653
- ), e.verifySchnorr && ce(
9718
+ ), e.verifySchnorr && he(
9654
9719
  e.verifySchnorr(
9655
9720
  V("7e2d58d8b3bcdf1abadec7829054f90dda9805aab56c77333024b9d0a508b75c"),
9656
9721
  V("dd308afec5777e13121fa72b9cc1b7cc0139715309b086c960e18fd969774eb8"),
@@ -9661,7 +9726,7 @@ function Id(e) {
9661
9726
  );
9662
9727
  }
9663
9728
  Ui.testEcc = Id;
9664
- function ce(e) {
9729
+ function he(e) {
9665
9730
  if (!e) throw new Error("ecc library invalid");
9666
9731
  }
9667
9732
  Object.defineProperty(Cr, "__esModule", { value: !0 });
@@ -9739,9 +9804,9 @@ function Ud(e) {
9739
9804
  {
9740
9805
  let d = e.sign(c, this.__D);
9741
9806
  const b = Buffer.alloc(32, 0);
9742
- let x = 0;
9807
+ let E = 0;
9743
9808
  for (; d[0] > 127; )
9744
- x++, b.writeUIntLE(x, 0, 6), d = e.sign(c, this.__D, b);
9809
+ E++, b.writeUIntLE(E, 0, 6), d = e.sign(c, this.__D, b);
9745
9810
  return Buffer.from(d);
9746
9811
  }
9747
9812
  }
@@ -9809,7 +9874,7 @@ Cr.ECPairFactory = Ud;
9809
9874
  }
9810
9875
  });
9811
9876
  })(ef);
9812
- const Cd = /* @__PURE__ */ Gu(ef);
9877
+ const Cd = /* @__PURE__ */ ju(ef);
9813
9878
  class fi extends va {
9814
9879
  get isInitialized() {
9815
9880
  return !!this.privKey;
@@ -9890,9 +9955,9 @@ class fi extends va {
9890
9955
  return re(c.toString("hex"));
9891
9956
  }
9892
9957
  }
9893
- class z1 extends va {
9958
+ class q1 extends va {
9894
9959
  constructor(t) {
9895
- super(), this.getOrderThreshold = 20, this.refundSacpCache = /* @__PURE__ */ new Map(), this.environment = t.environment;
9960
+ super(), this.getOrderThreshold = 20, this.refundSacpCache = /* @__PURE__ */ new Map(), this.bitcoinRedeemCache = new qh(), this.environment = t.environment;
9896
9961
  const r = t.environment === Or.MAINNET ? Fo.mainnet : t.environment === Or.TESTNET ? Fo.testnet : void 0;
9897
9962
  if (!r)
9898
9963
  throw new Error(
@@ -9909,7 +9974,7 @@ class z1 extends va {
9909
9974
  url: t.orderbookURl ?? r.orderbook,
9910
9975
  walletClient: t.evmWallet,
9911
9976
  auth: this._auth
9912
- }), this._evmRelay = new Fu(this._orderbookUrl, this._auth), this._secretManager = t.secretManager ?? fi.fromWalletClient(t.evmWallet), this.orderExecutorCache = new qh(), this._evmWallet = t.evmWallet, !t.evmWallet.account)
9977
+ }), this._evmRelay = new Nu(this._orderbookUrl, this._auth), this._secretManager = t.secretManager ?? fi.fromWalletClient(t.evmWallet), this.orderExecutorCache = new zh(), this._evmWallet = t.evmWallet, !t.evmWallet.account)
9913
9978
  throw new Error("Account not found in evmWallet");
9914
9979
  this._blockNumberFetcher = t.blockNumberFetcher ?? new Kh(r.info, t.environment);
9915
9980
  }
@@ -9939,7 +10004,7 @@ class z1 extends va {
9939
10004
  return re(this._btcWallet);
9940
10005
  const t = await this._secretManager.getMasterPrivKey();
9941
10006
  if (t.error) return j(t.error);
9942
- const r = new _u(Lu(this.environment));
10007
+ const r = new _u(Cu(this.environment));
9943
10008
  return this._btcWallet = vu.fromPrivateKey(t.val, r), re(this._btcWallet);
9944
10009
  }
9945
10010
  async swap(t) {
@@ -9967,9 +10032,9 @@ class z1 extends va {
9967
10032
  secret_hash: Zt(a.val.secretHash),
9968
10033
  min_destination_confirmations: t.minDestinationConfirmations ?? 0,
9969
10034
  additional_data: d
9970
- }, x = await this._quote.getAttestedQuote(b);
9971
- if (x.error) return j(x.error);
9972
- const p = await this._orderBook.createOrder(x.val);
10035
+ }, E = await this._quote.getAttestedQuote(b);
10036
+ if (E.error) return j(E.error);
10037
+ const p = await this._orderBook.createOrder(E.val);
9973
10038
  if (p.error) return j(p.error);
9974
10039
  const I = await this.pollOrder(p.val);
9975
10040
  return I.error ? j(I.error) : re(I.val);
@@ -10016,11 +10081,11 @@ class z1 extends va {
10016
10081
  async getAddresses(t) {
10017
10082
  var n;
10018
10083
  switch (On(t)) {
10019
- case It.EVM:
10084
+ case Ot.EVM:
10020
10085
  return this._evmWallet.account ? re(this._evmWallet.account.address) : j("EVM Wallet not found");
10021
- case It.Bitcoin: {
10086
+ case Ot.Bitcoin: {
10022
10087
  const i = await ((n = this._btcWallet) == null ? void 0 : n.getPublicKey());
10023
- return !i || !Uu(i) ? j("Invalid btc public key") : re(Jt(i));
10088
+ return !i || !Ru(i) ? j("Invalid btc public key") : re(Jt(i));
10024
10089
  }
10025
10090
  default:
10026
10091
  return j("Unsupported chain");
@@ -10029,7 +10094,7 @@ class z1 extends va {
10029
10094
  validateAmount(t) {
10030
10095
  if (t == null || t.includes("."))
10031
10096
  return j("Invalid amount ", t);
10032
- const r = new Pu(t);
10097
+ const r = new Bu(t);
10033
10098
  return !r.isInteger() || r.isNaN() || r.lt(0) || r.isLessThanOrEqualTo(0) ? j("Invalid amount ", t) : re(r);
10034
10099
  }
10035
10100
  async pollOrder(t) {
@@ -10065,7 +10130,7 @@ class z1 extends va {
10065
10130
  await this.postRefundSACP(s, a.val);
10066
10131
  }
10067
10132
  switch (o) {
10068
- case Pe.Redeem: {
10133
+ case Me.Redeem: {
10069
10134
  const a = await this._secretManager.generateSecret(
10070
10135
  s.create_order.nonce
10071
10136
  );
@@ -10074,11 +10139,11 @@ class z1 extends va {
10074
10139
  return;
10075
10140
  }
10076
10141
  switch (On(s.destination_swap.chain)) {
10077
- case It.EVM: {
10142
+ case Ot.EVM: {
10078
10143
  await this.evmRedeem(s, a.val.secret);
10079
10144
  break;
10080
10145
  }
10081
- case It.Bitcoin: {
10146
+ case Ot.Bitcoin: {
10082
10147
  const c = this.getWallet(
10083
10148
  s.destination_swap.chain
10084
10149
  );
@@ -10102,9 +10167,9 @@ class z1 extends va {
10102
10167
  }
10103
10168
  break;
10104
10169
  }
10105
- case Pe.Refund: {
10170
+ case Me.Refund: {
10106
10171
  switch (On(s.source_swap.chain)) {
10107
- case It.EVM: {
10172
+ case Ot.EVM: {
10108
10173
  this.emit(
10109
10174
  "error",
10110
10175
  s,
@@ -10112,7 +10177,7 @@ class z1 extends va {
10112
10177
  );
10113
10178
  break;
10114
10179
  }
10115
- case It.Bitcoin: {
10180
+ case Ot.Bitcoin: {
10116
10181
  const a = this.getWallet(s.source_swap.chain);
10117
10182
  if (a.error) {
10118
10183
  this.emit("error", s, a.error);
@@ -10144,7 +10209,7 @@ class z1 extends va {
10144
10209
  );
10145
10210
  }
10146
10211
  async evmRedeem(t, r) {
10147
- if (this.emit("log", t.create_order.create_id, "executing evm redeem"), this.orderExecutorCache.get(t, Pe.Redeem)) {
10212
+ if (this.emit("log", t.create_order.create_id, "executing evm redeem"), this.orderExecutorCache.get(t, Me.Redeem)) {
10148
10213
  this.emit("log", t.create_order.create_id, "already redeemed");
10149
10214
  return;
10150
10215
  }
@@ -10155,24 +10220,30 @@ class z1 extends va {
10155
10220
  if (i.error) {
10156
10221
  this.emit("error", t, i.error), i.error.includes("Order already redeemed") && this.orderExecutorCache.set(
10157
10222
  t,
10158
- Pe.Redeem,
10223
+ Me.Redeem,
10159
10224
  t.destination_swap.redeem_tx_hash
10160
10225
  );
10161
10226
  return;
10162
10227
  }
10163
- this.orderExecutorCache.set(t, Pe.Redeem, i.val), this.emit("success", t, Pe.Redeem, i.val);
10228
+ this.orderExecutorCache.set(t, Me.Redeem, i.val), this.emit("success", t, Me.Redeem, i.val);
10164
10229
  }
10165
10230
  async btcRedeem(t, r, n) {
10166
10231
  var a, c;
10167
- const i = this.orderExecutorCache.get(r, Pe.Redeem), s = (a = r.destination_swap.initiate_tx_hash.split(",").at(-1)) == null ? void 0 : a.split(":").at(0);
10232
+ const i = this.bitcoinRedeemCache.get(r.create_order.create_id), s = (a = r.destination_swap.initiate_tx_hash.split(",").at(-1)) == null ? void 0 : a.split(":").at(0);
10168
10233
  if (!s) {
10169
10234
  this.emit("error", r, "Failed to get initiate_tx_hash");
10170
10235
  return;
10171
10236
  }
10172
10237
  let o = !1;
10173
10238
  if (i)
10174
- if (i.btcRedeemUTXO && i.btcRedeemUTXO !== s)
10239
+ if (i.redeemedFromUTXO && i.redeemedFromUTXO !== s)
10175
10240
  o = !0, this.emit("log", r.create_order.create_id, "rbf btc redeem");
10241
+ else if (i.redeemedAt && Date.now() - i.redeemedAt > 1e3 * 60 * 15)
10242
+ this.emit(
10243
+ "log",
10244
+ r.create_order.create_id,
10245
+ "redeem not confirmed in last 15 minutes"
10246
+ ), o = !0;
10176
10247
  else {
10177
10248
  this.emit(
10178
10249
  "log",
@@ -10181,7 +10252,10 @@ class z1 extends va {
10181
10252
  );
10182
10253
  return;
10183
10254
  }
10184
- else if (r.destination_swap.redeem_tx_hash && !Number(r.destination_swap.redeem_block_number))
10255
+ else if (
10256
+ //check if redeem tx is valid if cache is not found.
10257
+ r.destination_swap.redeem_tx_hash && !Number(r.destination_swap.redeem_block_number)
10258
+ )
10185
10259
  try {
10186
10260
  const l = await (await t.getProvider()).getTransaction(r.destination_swap.redeem_tx_hash);
10187
10261
  let d = !1;
@@ -10191,16 +10265,23 @@ class z1 extends va {
10191
10265
  break;
10192
10266
  }
10193
10267
  if (d) {
10194
- this.orderExecutorCache.set(
10195
- r,
10196
- Pe.Redeem,
10197
- r.destination_swap.redeem_tx_hash,
10198
- s
10199
- ), this.emit(
10268
+ this.emit(
10200
10269
  "log",
10201
10270
  r.create_order.create_id,
10202
10271
  "already a valid redeem"
10203
10272
  );
10273
+ let b = 0;
10274
+ try {
10275
+ const [E] = await (await t.getProvider()).getTransactionTimes([r.destination_swap.redeem_tx_hash]);
10276
+ E !== 0 && (b = E);
10277
+ } catch {
10278
+ b = Date.now();
10279
+ }
10280
+ this.bitcoinRedeemCache.set(r.create_order.create_id, {
10281
+ redeemedFromUTXO: s,
10282
+ redeemedAt: b,
10283
+ redeemTxHash: r.destination_swap.redeem_tx_hash
10284
+ });
10204
10285
  return;
10205
10286
  }
10206
10287
  o = !0;
@@ -10230,14 +10311,18 @@ class z1 extends va {
10230
10311
  "log",
10231
10312
  r.create_order.create_id,
10232
10313
  "rbf: btc redeem success"
10233
- ), this.emit("rbf", r, d)) : this.emit("success", r, Pe.Redeem, d), this.orderExecutorCache.set(r, Pe.Redeem, d, s);
10314
+ ), this.emit("rbf", r, d)) : this.emit("success", r, Me.Redeem, d), this.bitcoinRedeemCache.set(r.create_order.create_id, {
10315
+ redeemedFromUTXO: s,
10316
+ redeemedAt: Date.now(),
10317
+ redeemTxHash: d
10318
+ });
10234
10319
  } catch (l) {
10235
- this.emit("error", r, "Failed btc redeem: " + l);
10320
+ console.log("error", l), this.emit("error", r, "Failed btc redeem: " + l);
10236
10321
  }
10237
10322
  }
10238
10323
  async btcRefund(t, r) {
10239
10324
  var n;
10240
- if (!this.orderExecutorCache.get(r, Pe.Refund)) {
10325
+ if (!this.orderExecutorCache.get(r, Me.Refund)) {
10241
10326
  this.emit("log", r.create_order.create_id, "executing btc refund");
10242
10327
  try {
10243
10328
  const s = await (await ln.from(
@@ -10250,7 +10335,7 @@ class z1 extends va {
10250
10335
  )).refund(
10251
10336
  (n = r.create_order.additional_data) == null ? void 0 : n.bitcoin_optional_recipient
10252
10337
  );
10253
- this.orderExecutorCache.set(r, Pe.Refund, s), this.emit("success", r, Pe.Refund, s);
10338
+ this.orderExecutorCache.set(r, Me.Refund, s), this.emit("success", r, Me.Refund, s);
10254
10339
  } catch (i) {
10255
10340
  this.emit("error", r, "Failed btc refund: " + i);
10256
10341
  }
@@ -10258,9 +10343,9 @@ class z1 extends va {
10258
10343
  }
10259
10344
  getWallet(t) {
10260
10345
  switch (On(t)) {
10261
- case It.EVM:
10346
+ case Ot.EVM:
10262
10347
  return re(this._evmWallet);
10263
- case It.Bitcoin:
10348
+ case Ot.Bitcoin:
10264
10349
  return re(this._btcWallet);
10265
10350
  default:
10266
10351
  return j("Unsupported chain for wallet");
@@ -10341,7 +10426,7 @@ class z1 extends va {
10341
10426
  return re(n);
10342
10427
  }
10343
10428
  }
10344
- function qt(e) {
10429
+ function dt(e) {
10345
10430
  return {
10346
10431
  formatters: void 0,
10347
10432
  fees: void 0,
@@ -10517,7 +10602,7 @@ function Vd(e, t = {}) {
10517
10602
  const r = new Uint8Array(1);
10518
10603
  return r[0] = Number(e), typeof t.size == "number" ? (Dr(r, { size: t.size }), Mr(r, { size: t.size })) : r;
10519
10604
  }
10520
- const gt = {
10605
+ const mt = {
10521
10606
  zero: 48,
10522
10607
  nine: 57,
10523
10608
  A: 65,
@@ -10526,12 +10611,12 @@ const gt = {
10526
10611
  f: 102
10527
10612
  };
10528
10613
  function ha(e) {
10529
- if (e >= gt.zero && e <= gt.nine)
10530
- return e - gt.zero;
10531
- if (e >= gt.A && e <= gt.F)
10532
- return e - (gt.A - 10);
10533
- if (e >= gt.a && e <= gt.f)
10534
- return e - (gt.a - 10);
10614
+ if (e >= mt.zero && e <= mt.nine)
10615
+ return e - mt.zero;
10616
+ if (e >= mt.A && e <= mt.F)
10617
+ return e - (mt.A - 10);
10618
+ if (e >= mt.a && e <= mt.f)
10619
+ return e - (mt.a - 10);
10535
10620
  }
10536
10621
  function ar(e, t = {}) {
10537
10622
  let r = e;
@@ -11134,7 +11219,7 @@ const _p = /* @__PURE__ */ new Uint32Array([
11134
11219
  2756734187,
11135
11220
  3204031479,
11136
11221
  3329325298
11137
- ]), Nt = /* @__PURE__ */ new Uint32Array([
11222
+ ]), Ft = /* @__PURE__ */ new Uint32Array([
11138
11223
  1779033703,
11139
11224
  3144134277,
11140
11225
  1013904242,
@@ -11143,10 +11228,10 @@ const _p = /* @__PURE__ */ new Uint32Array([
11143
11228
  2600822924,
11144
11229
  528734635,
11145
11230
  1541459225
11146
- ]), Ft = /* @__PURE__ */ new Uint32Array(64);
11231
+ ]), Ht = /* @__PURE__ */ new Uint32Array(64);
11147
11232
  class vp extends mp {
11148
11233
  constructor() {
11149
- super(64, 32, 8, !1), this.A = Nt[0] | 0, this.B = Nt[1] | 0, this.C = Nt[2] | 0, this.D = Nt[3] | 0, this.E = Nt[4] | 0, this.F = Nt[5] | 0, this.G = Nt[6] | 0, this.H = Nt[7] | 0;
11234
+ super(64, 32, 8, !1), this.A = Ft[0] | 0, this.B = Ft[1] | 0, this.C = Ft[2] | 0, this.D = Ft[3] | 0, this.E = Ft[4] | 0, this.F = Ft[5] | 0, this.G = Ft[6] | 0, this.H = Ft[7] | 0;
11150
11235
  }
11151
11236
  get() {
11152
11237
  const { A: t, B: r, C: n, D: i, E: s, F: o, G: a, H: c } = this;
@@ -11158,20 +11243,20 @@ class vp extends mp {
11158
11243
  }
11159
11244
  process(t, r) {
11160
11245
  for (let b = 0; b < 16; b++, r += 4)
11161
- Ft[b] = t.getUint32(r, !1);
11246
+ Ht[b] = t.getUint32(r, !1);
11162
11247
  for (let b = 16; b < 64; b++) {
11163
- const x = Ft[b - 15], p = Ft[b - 2], I = at(x, 7) ^ at(x, 18) ^ x >>> 3, B = at(p, 17) ^ at(p, 19) ^ p >>> 10;
11164
- Ft[b] = B + Ft[b - 7] + I + Ft[b - 16] | 0;
11248
+ const E = Ht[b - 15], p = Ht[b - 2], I = at(E, 7) ^ at(E, 18) ^ E >>> 3, B = at(p, 17) ^ at(p, 19) ^ p >>> 10;
11249
+ Ht[b] = B + Ht[b - 7] + I + Ht[b - 16] | 0;
11165
11250
  }
11166
11251
  let { A: n, B: i, C: s, D: o, E: a, F: c, G: l, H: d } = this;
11167
11252
  for (let b = 0; b < 64; b++) {
11168
- const x = at(a, 6) ^ at(a, 11) ^ at(a, 25), p = d + x + wp(a, c, l) + _p[b] + Ft[b] | 0, B = (at(n, 2) ^ at(n, 13) ^ at(n, 22)) + gp(n, i, s) | 0;
11253
+ const E = at(a, 6) ^ at(a, 11) ^ at(a, 25), p = d + E + wp(a, c, l) + _p[b] + Ht[b] | 0, B = (at(n, 2) ^ at(n, 13) ^ at(n, 22)) + gp(n, i, s) | 0;
11169
11254
  d = l, l = c, c = a, a = o + p | 0, o = s, s = i, i = n, n = p + B | 0;
11170
11255
  }
11171
11256
  n = n + this.A | 0, i = i + this.B | 0, s = s + this.C | 0, o = o + this.D | 0, a = a + this.E | 0, c = c + this.F | 0, l = l + this.G | 0, d = d + this.H | 0, this.set(n, i, s, o, a, c, l, d);
11172
11257
  }
11173
11258
  roundClean() {
11174
- Ft.fill(0);
11259
+ Ht.fill(0);
11175
11260
  }
11176
11261
  destroy() {
11177
11262
  this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0);
@@ -11376,9 +11461,9 @@ function Vp(e, t = 24) {
11376
11461
  for (let o = 0; o < 10; o++)
11377
11462
  r[o] = e[o] ^ e[o + 10] ^ e[o + 20] ^ e[o + 30] ^ e[o + 40];
11378
11463
  for (let o = 0; o < 10; o += 2) {
11379
- const a = (o + 8) % 10, c = (o + 2) % 10, l = r[c], d = r[c + 1], b = ma(l, d, 1) ^ r[a], x = _a(l, d, 1) ^ r[a + 1];
11464
+ const a = (o + 8) % 10, c = (o + 2) % 10, l = r[c], d = r[c + 1], b = ma(l, d, 1) ^ r[a], E = _a(l, d, 1) ^ r[a + 1];
11380
11465
  for (let p = 0; p < 50; p += 10)
11381
- e[o + p] ^= b, e[o + p + 1] ^= x;
11466
+ e[o + p] ^= b, e[o + p + 1] ^= E;
11382
11467
  }
11383
11468
  let i = e[2], s = e[3];
11384
11469
  for (let o = 0; o < 24; o++) {
@@ -11602,7 +11687,7 @@ function s1(e, t) {
11602
11687
  function o1(e, t) {
11603
11688
  const { authorizationList: r, chainId: n, gas: i, nonce: s, to: o, value: a, maxFeePerGas: c, maxPriorityFeePerGas: l, accessList: d, data: b } = e;
11604
11689
  e1(e);
11605
- const x = Ni(d), p = kp(r);
11690
+ const E = Ni(d), p = kp(r);
11606
11691
  return An([
11607
11692
  "0x04",
11608
11693
  fr([
@@ -11614,7 +11699,7 @@ function o1(e, t) {
11614
11699
  o ?? "0x",
11615
11700
  a ? J(a) : "0x",
11616
11701
  b ?? "0x",
11617
- x,
11702
+ E,
11618
11703
  p,
11619
11704
  ...Tn(e, t)
11620
11705
  ])
@@ -11623,17 +11708,17 @@ function o1(e, t) {
11623
11708
  function a1(e, t) {
11624
11709
  const { chainId: r, gas: n, nonce: i, to: s, value: o, maxFeePerBlobGas: a, maxFeePerGas: c, maxPriorityFeePerGas: l, accessList: d, data: b } = e;
11625
11710
  t1(e);
11626
- let x = e.blobVersionedHashes, p = e.sidecars;
11627
- if (e.blobs && (typeof x > "u" || typeof p > "u")) {
11628
- const _ = typeof e.blobs[0] == "string" ? e.blobs : e.blobs.map((E) => Kt(E)), m = e.kzg, S = Yf({
11711
+ let E = e.blobVersionedHashes, p = e.sidecars;
11712
+ if (e.blobs && (typeof E > "u" || typeof p > "u")) {
11713
+ const _ = typeof e.blobs[0] == "string" ? e.blobs : e.blobs.map((x) => Kt(x)), m = e.kzg, S = Yf({
11629
11714
  blobs: _,
11630
11715
  kzg: m
11631
11716
  });
11632
- if (typeof x > "u" && (x = Bp({
11717
+ if (typeof E > "u" && (E = Bp({
11633
11718
  commitments: S
11634
11719
  })), typeof p > "u") {
11635
- const E = Xf({ blobs: _, commitments: S, kzg: m });
11636
- p = Op({ blobs: _, commitments: S, proofs: E });
11720
+ const x = Xf({ blobs: _, commitments: S, kzg: m });
11721
+ p = Op({ blobs: _, commitments: S, proofs: x });
11637
11722
  }
11638
11723
  }
11639
11724
  const I = Ni(d), B = [
@@ -11647,13 +11732,13 @@ function a1(e, t) {
11647
11732
  b ?? "0x",
11648
11733
  I,
11649
11734
  a ? J(a) : "0x",
11650
- x ?? [],
11735
+ E ?? [],
11651
11736
  ...Tn(e, t)
11652
11737
  ], T = [], k = [], U = [];
11653
11738
  if (p)
11654
11739
  for (let _ = 0; _ < p.length; _++) {
11655
- const { blob: m, commitment: S, proof: E } = p[_];
11656
- T.push(m), k.push(S), U.push(E);
11740
+ const { blob: m, commitment: S, proof: x } = p[_];
11741
+ T.push(m), k.push(S), U.push(x);
11657
11742
  }
11658
11743
  return An([
11659
11744
  "0x03",
@@ -11664,7 +11749,7 @@ function a1(e, t) {
11664
11749
  function f1(e, t) {
11665
11750
  const { chainId: r, gas: n, nonce: i, to: s, value: o, maxFeePerGas: a, maxPriorityFeePerGas: c, accessList: l, data: d } = e;
11666
11751
  to(e);
11667
- const b = Ni(l), x = [
11752
+ const b = Ni(l), E = [
11668
11753
  J(r),
11669
11754
  i ? J(i) : "0x",
11670
11755
  c ? J(c) : "0x",
@@ -11678,7 +11763,7 @@ function f1(e, t) {
11678
11763
  ];
11679
11764
  return An([
11680
11765
  "0x02",
11681
- fr(x)
11766
+ fr(E)
11682
11767
  ]);
11683
11768
  }
11684
11769
  function u1(e, t) {
@@ -11721,12 +11806,12 @@ function c1(e, t) {
11721
11806
  if (t.v !== p)
11722
11807
  throw new up({ v: t.v });
11723
11808
  return p;
11724
- })(), b = ui(t.r), x = ui(t.s);
11809
+ })(), b = ui(t.r), E = ui(t.s);
11725
11810
  l = [
11726
11811
  ...l,
11727
11812
  J(d),
11728
11813
  b === "0x00" ? "0x" : b,
11729
- x === "0x00" ? "0x" : x
11814
+ E === "0x00" ? "0x" : E
11730
11815
  ];
11731
11816
  } else r > 0 && (l = [
11732
11817
  ...l,
@@ -11827,7 +11912,7 @@ const li = {
11827
11912
  contracts: h1,
11828
11913
  formatters: l1,
11829
11914
  serializers: p1
11830
- }, g1 = /* @__PURE__ */ qt({
11915
+ }, g1 = /* @__PURE__ */ dt({
11831
11916
  id: 42161,
11832
11917
  name: "Arbitrum One",
11833
11918
  nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
@@ -11849,7 +11934,7 @@ const li = {
11849
11934
  blockCreated: 7654707
11850
11935
  }
11851
11936
  }
11852
- }), m1 = /* @__PURE__ */ qt({
11937
+ }), m1 = /* @__PURE__ */ dt({
11853
11938
  id: 421614,
11854
11939
  name: "Arbitrum Sepolia",
11855
11940
  nativeCurrency: {
@@ -11876,7 +11961,7 @@ const li = {
11876
11961
  }
11877
11962
  },
11878
11963
  testnet: !0
11879
- }), sn = 1, _1 = /* @__PURE__ */ qt({
11964
+ }), sn = 1, _1 = /* @__PURE__ */ dt({
11880
11965
  ...li,
11881
11966
  id: 8453,
11882
11967
  name: "Base",
@@ -11923,7 +12008,7 @@ const li = {
11923
12008
  }
11924
12009
  },
11925
12010
  sourceId: sn
11926
- }), on = 11155111, v1 = /* @__PURE__ */ qt({
12011
+ }), on = 11155111, v1 = /* @__PURE__ */ dt({
11927
12012
  ...li,
11928
12013
  id: 84532,
11929
12014
  network: "base-sepolia",
@@ -11972,7 +12057,7 @@ const li = {
11972
12057
  },
11973
12058
  testnet: !0,
11974
12059
  sourceId: on
11975
- }), E1 = /* @__PURE__ */ qt({
12060
+ }), E1 = /* @__PURE__ */ dt({
11976
12061
  id: 80094,
11977
12062
  name: "Berachain",
11978
12063
  nativeCurrency: {
@@ -11996,7 +12081,7 @@ const li = {
11996
12081
  }
11997
12082
  },
11998
12083
  testnet: !1
11999
- }), x1 = /* @__PURE__ */ qt({
12084
+ }), x1 = /* @__PURE__ */ dt({
12000
12085
  id: 80084,
12001
12086
  name: "Berachain bArtio",
12002
12087
  nativeCurrency: {
@@ -12028,7 +12113,24 @@ const li = {
12028
12113
  }
12029
12114
  },
12030
12115
  testnet: !0
12031
- }), S1 = /* @__PURE__ */ qt({
12116
+ }), S1 = /* @__PURE__ */ dt({
12117
+ id: 5115,
12118
+ name: "Citrea Testnet",
12119
+ nativeCurrency: { name: "cBTC", symbol: "cBTC", decimals: 18 },
12120
+ rpcUrls: {
12121
+ default: {
12122
+ http: ["https://rpc.testnet.citrea.xyz"]
12123
+ }
12124
+ },
12125
+ blockExplorers: {
12126
+ default: {
12127
+ name: "Citrea Explorer",
12128
+ url: "https://explorer.testnet.citrea.xyz",
12129
+ apiUrl: "https://explorer.testnet.citrea.xyz/api"
12130
+ }
12131
+ },
12132
+ testnet: !0
12133
+ }), B1 = /* @__PURE__ */ dt({
12032
12134
  id: 1,
12033
12135
  name: "Ethereum",
12034
12136
  nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
@@ -12057,7 +12159,33 @@ const li = {
12057
12159
  blockCreated: 14353601
12058
12160
  }
12059
12161
  }
12060
- }), B1 = /* @__PURE__ */ qt({
12162
+ }), P1 = /* @__PURE__ */ dt({
12163
+ id: 10143,
12164
+ name: "Monad Testnet",
12165
+ nativeCurrency: {
12166
+ name: "Testnet MON Token",
12167
+ symbol: "MON",
12168
+ decimals: 18
12169
+ },
12170
+ rpcUrls: {
12171
+ default: {
12172
+ http: ["https://testnet-rpc.monad.xyz"]
12173
+ }
12174
+ },
12175
+ blockExplorers: {
12176
+ default: {
12177
+ name: "Monad Testnet explorer",
12178
+ url: "https://testnet.monadexplorer.com"
12179
+ }
12180
+ },
12181
+ contracts: {
12182
+ multicall3: {
12183
+ address: "0xcA11bde05977b3631167028862bE2a173976CA11",
12184
+ blockCreated: 251449
12185
+ }
12186
+ },
12187
+ testnet: !0
12188
+ }), A1 = /* @__PURE__ */ dt({
12061
12189
  id: 11155111,
12062
12190
  name: "Sepolia",
12063
12191
  nativeCurrency: { name: "Sepolia Ether", symbol: "ETH", decimals: 18 },
@@ -12085,45 +12213,29 @@ const li = {
12085
12213
  }
12086
12214
  },
12087
12215
  testnet: !0
12088
- }), P1 = {
12089
- ...B1,
12216
+ }), T1 = {
12217
+ ...A1,
12090
12218
  rpcUrls: {
12091
12219
  default: {
12092
12220
  http: ["https://ethereum-sepolia-rpc.publicnode.com"]
12093
12221
  }
12094
12222
  }
12095
- }, A1 = xu({
12096
- id: 5115,
12097
- name: "Citrea Testnet",
12098
- nativeCurrency: { name: "", symbol: "cBTC", decimals: 18 },
12099
- rpcUrls: {
12100
- default: {
12101
- http: ["https://rpc.testnet.citrea.xyz"]
12102
- }
12103
- },
12104
- blockExplorers: {
12105
- default: {
12106
- name: "Citrea Explorer",
12107
- url: "https://explorer.testnet.citrea.xyz",
12108
- apiUrl: "https://explorer.testnet.citrea.xyz/api/v2/"
12109
- }
12110
- },
12111
- testnet: !0
12112
- }), T1 = {
12113
- ethereum: S1,
12223
+ }, I1 = {
12224
+ ethereum: B1,
12114
12225
  arbitrum: g1,
12115
- ethereum_sepolia: P1,
12226
+ ethereum_sepolia: T1,
12116
12227
  arbitrum_sepolia: m1,
12117
12228
  ethereum_localnet: pu,
12118
12229
  arbitrum_localnet: yu,
12119
12230
  base_sepolia: v1,
12120
12231
  base: _1,
12121
12232
  bera_testnet: x1,
12122
- citrea_testnet: A1,
12123
- bera: E1
12124
- }, q1 = async (e, t) => {
12233
+ citrea_testnet: S1,
12234
+ bera: E1,
12235
+ monad_testnet: P1
12236
+ }, K1 = async (e, t) => {
12125
12237
  var n;
12126
- const r = T1[e];
12238
+ const r = I1[e];
12127
12239
  if (r)
12128
12240
  try {
12129
12241
  if (r.id === ((n = t.chain) == null ? void 0 : n.id))
@@ -12139,7 +12251,7 @@ const li = {
12139
12251
  walletClient: i
12140
12252
  });
12141
12253
  } catch (i) {
12142
- if (I1(i))
12254
+ if (O1(i))
12143
12255
  try {
12144
12256
  await t.addChain({ chain: r });
12145
12257
  const s = oo({
@@ -12159,26 +12271,25 @@ const li = {
12159
12271
  }
12160
12272
  else
12161
12273
  return j("Chain not supported");
12162
- }, I1 = (e) => typeof e == "object" && e !== null && "code" in e && e.code === 4902;
12274
+ }, O1 = (e) => typeof e == "object" && e !== null && "code" in e && e.code === 4902;
12163
12275
  export {
12164
12276
  Fo as API,
12165
12277
  Kh as BlockNumberFetcher,
12166
- Fu as EvmRelay,
12167
- z1 as Garden,
12168
- Pe as OrderActions,
12278
+ Nu as EvmRelay,
12279
+ q1 as Garden,
12280
+ Me as OrderActions,
12169
12281
  be as OrderStatus,
12170
12282
  xa as ParseOrderStatus,
12171
12283
  co as ParseSwapStatus,
12172
12284
  Yh as Quote,
12173
12285
  fi as SecretManager,
12174
12286
  we as SwapStatus,
12175
- A1 as citreaTestnet,
12176
- Cu as constructOrderPair,
12177
- T1 as evmToViemChainMap,
12178
- $1 as filterDeadlineExpiredOrders,
12287
+ Uu as constructOrderPair,
12288
+ I1 as evmToViemChainMap,
12289
+ j1 as filterDeadlineExpiredOrders,
12179
12290
  ei as isExpired,
12180
- D1 as parseAction,
12291
+ $1 as parseAction,
12181
12292
  Sa as parseActionFromStatus,
12182
- q1 as switchOrAddNetwork,
12183
- M1 as validateBTCAddress
12293
+ K1 as switchOrAddNetwork,
12294
+ D1 as validateBTCAddress
12184
12295
  };