@babylonlabs-io/ts-sdk 0.41.0 → 0.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/dist/ApplicationRegistry.abi-BAPhJch3.cjs +2 -0
  2. package/dist/ApplicationRegistry.abi-BAPhJch3.cjs.map +1 -0
  3. package/dist/{ProtocolParams.abi-C2brDWTI.js → ApplicationRegistry.abi-Dn2qk6JG.js} +90 -90
  4. package/dist/ApplicationRegistry.abi-Dn2qk6JG.js.map +1 -0
  5. package/dist/{PayoutManager-B5bovfkD.cjs → PayoutManager-BwYlPF2C.cjs} +2 -2
  6. package/dist/{PayoutManager-B5bovfkD.cjs.map → PayoutManager-BwYlPF2C.cjs.map} +1 -1
  7. package/dist/{PayoutManager-DChODEOJ.js → PayoutManager-CXDccwDN.js} +2 -2
  8. package/dist/{PayoutManager-DChODEOJ.js.map → PayoutManager-CXDccwDN.js.map} +1 -1
  9. package/dist/{PeginManager-D9ZZ8wx2.js → PeginManager-BezsAEDe.js} +161 -166
  10. package/dist/PeginManager-BezsAEDe.js.map +1 -0
  11. package/dist/PeginManager-D-8vmqzq.cjs +2 -0
  12. package/dist/PeginManager-D-8vmqzq.cjs.map +1 -0
  13. package/dist/{assertPsbtUnsignedTxMatches-r1svclbd.cjs → assertPsbtUnsignedTxMatches-CABhEADu.cjs} +2 -2
  14. package/dist/{assertPsbtUnsignedTxMatches-r1svclbd.cjs.map → assertPsbtUnsignedTxMatches-CABhEADu.cjs.map} +1 -1
  15. package/dist/{assertPsbtUnsignedTxMatches-CzVv57QF.js → assertPsbtUnsignedTxMatches-GHobJP-d.js} +2 -2
  16. package/dist/{assertPsbtUnsignedTxMatches-CzVv57QF.js.map → assertPsbtUnsignedTxMatches-GHobJP-d.js.map} +1 -1
  17. package/dist/{buildAndBroadcastRefund-fIHDHiFh.js → buildAndBroadcastRefund-37Bs7-V1.js} +4 -4
  18. package/dist/{buildAndBroadcastRefund-fIHDHiFh.js.map → buildAndBroadcastRefund-37Bs7-V1.js.map} +1 -1
  19. package/dist/{buildAndBroadcastRefund-Cj8JDI7F.cjs → buildAndBroadcastRefund-DbcNEsOv.cjs} +2 -2
  20. package/dist/{buildAndBroadcastRefund-Cj8JDI7F.cjs.map → buildAndBroadcastRefund-DbcNEsOv.cjs.map} +1 -1
  21. package/dist/{challengeAssert-DLEmAhT0.js → challengeAssert-ChqnvtRg.js} +2 -2
  22. package/dist/{challengeAssert-DLEmAhT0.js.map → challengeAssert-ChqnvtRg.js.map} +1 -1
  23. package/dist/{challengeAssert-rpDaS3fH.cjs → challengeAssert-Cmj_OG6V.cjs} +2 -2
  24. package/dist/{challengeAssert-rpDaS3fH.cjs.map → challengeAssert-Cmj_OG6V.cjs.map} +1 -1
  25. package/dist/{fundPeginTransaction-t-6TsHAY.js → fundPeginTransaction-C11tYf6I.js} +32 -33
  26. package/dist/fundPeginTransaction-C11tYf6I.js.map +1 -0
  27. package/dist/fundPeginTransaction-C8qsXxNV.cjs +2 -0
  28. package/dist/fundPeginTransaction-C8qsXxNV.cjs.map +1 -0
  29. package/dist/index.cjs +1 -1
  30. package/dist/index.js +181 -180
  31. package/dist/mempoolApi-CknccHKg.cjs +2 -0
  32. package/dist/mempoolApi-CknccHKg.cjs.map +1 -0
  33. package/dist/mempoolApi-DI9HISqi.js +451 -0
  34. package/dist/mempoolApi-DI9HISqi.js.map +1 -0
  35. package/dist/{noPayout-CS2wnluA.js → noPayout-BtP-R-b-.js} +2 -2
  36. package/dist/{noPayout-CS2wnluA.js.map → noPayout-BtP-R-b-.js.map} +1 -1
  37. package/dist/{noPayout-B06Z9RTe.cjs → noPayout-DliaHuc6.cjs} +2 -2
  38. package/dist/{noPayout-B06Z9RTe.cjs.map → noPayout-DliaHuc6.cjs.map} +1 -1
  39. package/dist/primeVpAuth-Duds3vAO.cjs +2 -0
  40. package/dist/primeVpAuth-Duds3vAO.cjs.map +1 -0
  41. package/dist/primeVpAuth-qEC9TTO_.js +1136 -0
  42. package/dist/primeVpAuth-qEC9TTO_.js.map +1 -0
  43. package/dist/{reservation-hjXStM03.cjs → reservation-Cwf2u4vu.cjs} +2 -2
  44. package/dist/{reservation-hjXStM03.cjs.map → reservation-Cwf2u4vu.cjs.map} +1 -1
  45. package/dist/{reservation-CB-4FBPk.js → reservation-DNOGLBt4.js} +2 -2
  46. package/dist/{reservation-CB-4FBPk.js.map → reservation-DNOGLBt4.js.map} +1 -1
  47. package/dist/tbv/core/clients/eth/types.d.ts +7 -0
  48. package/dist/tbv/core/clients/eth/types.d.ts.map +1 -1
  49. package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts +8 -0
  50. package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts.map +1 -1
  51. package/dist/tbv/core/clients/index.cjs +1 -1
  52. package/dist/tbv/core/clients/index.js +31 -31
  53. package/dist/tbv/core/contracts/index.cjs +1 -1
  54. package/dist/tbv/core/contracts/index.js +1 -1
  55. package/dist/tbv/core/index.cjs +1 -1
  56. package/dist/tbv/core/index.js +183 -182
  57. package/dist/tbv/core/managers/PeginManager.d.ts.map +1 -1
  58. package/dist/tbv/core/managers/index.cjs +1 -1
  59. package/dist/tbv/core/managers/index.js +2 -2
  60. package/dist/tbv/core/primitives/index.cjs +1 -1
  61. package/dist/tbv/core/primitives/index.d.ts +2 -1
  62. package/dist/tbv/core/primitives/index.d.ts.map +1 -1
  63. package/dist/tbv/core/primitives/index.js +24 -23
  64. package/dist/tbv/core/services/index.cjs +1 -1
  65. package/dist/tbv/core/services/index.js +2 -2
  66. package/dist/tbv/core/utils/fee/constants.d.ts +8 -12
  67. package/dist/tbv/core/utils/fee/constants.d.ts.map +1 -1
  68. package/dist/tbv/core/utils/index.cjs +1 -1
  69. package/dist/tbv/core/utils/index.js +3 -3
  70. package/dist/tbv/index.cjs +1 -1
  71. package/dist/tbv/index.js +183 -182
  72. package/dist/{waitForTransactionReceiptSmartAware-tv1mtSIY.cjs → waitForTransactionReceiptSmartAware-BFMQFEzj.cjs} +2 -2
  73. package/dist/{waitForTransactionReceiptSmartAware-tv1mtSIY.cjs.map → waitForTransactionReceiptSmartAware-BFMQFEzj.cjs.map} +1 -1
  74. package/dist/{waitForTransactionReceiptSmartAware-CmgFXFza.js → waitForTransactionReceiptSmartAware-Dt5VcMK0.js} +2 -2
  75. package/dist/{waitForTransactionReceiptSmartAware-CmgFXFza.js.map → waitForTransactionReceiptSmartAware-Dt5VcMK0.js.map} +1 -1
  76. package/package.json +1 -1
  77. package/dist/PeginManager-D9ZZ8wx2.js.map +0 -1
  78. package/dist/PeginManager-UqbOj2oV.cjs +0 -2
  79. package/dist/PeginManager-UqbOj2oV.cjs.map +0 -1
  80. package/dist/ProtocolParams.abi-C2brDWTI.js.map +0 -1
  81. package/dist/ProtocolParams.abi-DQhcqsNr.cjs +0 -2
  82. package/dist/ProtocolParams.abi-DQhcqsNr.cjs.map +0 -1
  83. package/dist/fundPeginTransaction-BBE3wTjR.cjs +0 -2
  84. package/dist/fundPeginTransaction-BBE3wTjR.cjs.map +0 -1
  85. package/dist/fundPeginTransaction-t-6TsHAY.js.map +0 -1
  86. package/dist/mempoolApi-C7hkVkym.js +0 -214
  87. package/dist/mempoolApi-C7hkVkym.js.map +0 -1
  88. package/dist/mempoolApi-DEAS9wVa.cjs +0 -2
  89. package/dist/mempoolApi-DEAS9wVa.cjs.map +0 -1
  90. package/dist/types-0bvDGR4x.js +0 -1347
  91. package/dist/types-0bvDGR4x.js.map +0 -1
  92. package/dist/types-Be3sAYzr.cjs +0 -2
  93. package/dist/types-Be3sAYzr.cjs.map +0 -1
@@ -1,7 +1,7 @@
1
1
  var qt = Object.defineProperty;
2
2
  var zt = (n, t, e) => t in n ? qt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
3
  var x = (n, t, e) => zt(n, typeof t != "symbol" ? t + "" : t, e);
4
- import { s as it, c as It, H as Yt, r as M, a as X, b as lt, u as jt, d as ut, e as ht, f as dt, g as Zt } from "./sha2-BYVxyZzX.js";
4
+ import { s as it, c as It, H as Yt, r as V, a as W, b as lt, u as jt, d as ut, e as ht, f as dt, g as Zt } from "./sha2-BYVxyZzX.js";
5
5
  import * as Ct from "bitcoinjs-lib";
6
6
  import { Transaction as Qt, Psbt as gt } from "bitcoinjs-lib";
7
7
  import { Buffer as J } from "buffer";
@@ -9,41 +9,41 @@ import { isAddressEqual as ft, encodeFunctionData as tt, zeroAddress as Jt } fro
9
9
  import { B as I } from "./BTCVaultRegistry.abi-Cq9-JlqT.js";
10
10
  import { h as H } from "./errors-CznAK5NB.js";
11
11
  import { expandWotsSeed as te, expandHashlockSecret as ee, expandAuthAnchor as ne, deriveVaultId as pt } from "@babylonlabs-io/babylon-tbv-rust-wasm";
12
- import { b as mt, a as se, d as bt } from "./assertPsbtUnsignedTxMatches-CzVv57QF.js";
12
+ import { b as mt, a as se, d as Pt } from "./assertPsbtUnsignedTxMatches-GHobJP-d.js";
13
13
  import { b as oe, e as re, f as ie } from "./peginInput-BPRB9tUi.js";
14
- import { u as K, h as et, e as v, p as ae, i as Pt, s as T, j as wt, X as ce } from "./bitcoin-B5aNKtsk.js";
14
+ import { u as X, h as et, e as v, p as ae, i as bt, s as T, j as wt, X as ce } from "./bitcoin-B5aNKtsk.js";
15
15
  import { c as le } from "./signing-DaLvGwQe.js";
16
16
  import { M as yt } from "./validation-CxqROCno.js";
17
- import { c as ue, a as he } from "./PayoutManager-DChODEOJ.js";
18
- import { s as de, f as z, i as ge, w as xt } from "./waitForTransactionReceiptSmartAware-CmgFXFza.js";
19
- import { p as fe, f as pe } from "./fundPeginTransaction-t-6TsHAY.js";
20
- import { p as me, h as be } from "./mempoolApi-C7hkVkym.js";
21
- const N = /* @__PURE__ */ BigInt(2 ** 32 - 1), kt = /* @__PURE__ */ BigInt(32);
22
- function Pe(n, t = !1) {
23
- return t ? { h: Number(n & N), l: Number(n >> kt & N) } : { h: Number(n >> kt & N) | 0, l: Number(n & N) | 0 };
24
- }
17
+ import { c as ue, a as he } from "./PayoutManager-CXDccwDN.js";
18
+ import { s as de, f as q, i as ge, w as xt } from "./waitForTransactionReceiptSmartAware-Dt5VcMK0.js";
19
+ import { p as fe, f as pe } from "./fundPeginTransaction-C11tYf6I.js";
20
+ import { p as me, V as Pe, h as be } from "./mempoolApi-DI9HISqi.js";
21
+ const M = /* @__PURE__ */ BigInt(2 ** 32 - 1), kt = /* @__PURE__ */ BigInt(32);
25
22
  function we(n, t = !1) {
23
+ return t ? { h: Number(n & M), l: Number(n >> kt & M) } : { h: Number(n >> kt & M) | 0, l: Number(n & M) | 0 };
24
+ }
25
+ function ye(n, t = !1) {
26
26
  const e = n.length;
27
27
  let s = new Uint32Array(e), o = new Uint32Array(e);
28
28
  for (let r = 0; r < e; r++) {
29
- const { h: i, l: a } = Pe(n[r], t);
29
+ const { h: i, l: a } = we(n[r], t);
30
30
  [s[r], o[r]] = [i, a];
31
31
  }
32
32
  return [s, o];
33
33
  }
34
- const ye = (n, t, e) => n << e | t >>> 32 - e, xe = (n, t, e) => t << e | n >>> 32 - e, ke = (n, t, e) => t << e - 32 | n >>> 64 - e, Ee = (n, t, e) => n << e - 32 | t >>> 64 - e, U = 32, Y = 32, nt = 36, Ht = 32, D = 4, Te = D + U + D + Ht;
34
+ const xe = (n, t, e) => n << e | t >>> 32 - e, ke = (n, t, e) => t << e | n >>> 32 - e, Ee = (n, t, e) => t << e - 32 | n >>> 64 - e, Te = (n, t, e) => n << e - 32 | t >>> 64 - e, U = 32, z = 32, nt = 36, Ht = 32, K = 4, _e = K + U + K + Ht;
35
35
  function st(n, t, e) {
36
36
  n[t] = e >>> 24 & 255, n[t + 1] = e >>> 16 & 255, n[t + 2] = e >>> 8 & 255, n[t + 3] = e & 255;
37
37
  }
38
- function _e(n) {
39
- if (n.txid.length !== Y)
38
+ function Be(n) {
39
+ if (n.txid.length !== z)
40
40
  throw new Error(
41
- `outpoint.txid must be exactly ${Y} bytes, got ${n.txid.length}`
41
+ `outpoint.txid must be exactly ${z} bytes, got ${n.txid.length}`
42
42
  );
43
43
  if (!Number.isInteger(n.vout) || n.vout < 0 || n.vout > 4294967295)
44
44
  throw new Error(`outpoint.vout must be a u32, got ${n.vout}`);
45
45
  const t = new Uint8Array(nt);
46
- return t.set(n.txid, 0), st(t, Y, n.vout), t;
46
+ return t.set(n.txid, 0), st(t, z, n.vout), t;
47
47
  }
48
48
  function Et(n, t) {
49
49
  const e = Math.min(n.length, t.length);
@@ -51,12 +51,12 @@ function Et(n, t) {
51
51
  if (n[s] !== t[s]) return n[s] - t[s];
52
52
  return n.length - t.length;
53
53
  }
54
- function Be(n) {
54
+ function ve(n) {
55
55
  if (n.length === 0)
56
56
  throw new Error(
57
57
  "buildFundingOutpointsCommitment: outpoints must be non-empty"
58
58
  );
59
- const t = n.map(_e);
59
+ const t = n.map(Be);
60
60
  t.sort(Et);
61
61
  for (let s = 1; s < t.length; s++)
62
62
  if (Et(t[s - 1], t[s]) === 0)
@@ -68,18 +68,18 @@ function Be(n) {
68
68
  e.set(t[s], s * nt);
69
69
  return it(e);
70
70
  }
71
- function ve(n) {
71
+ function Se(n) {
72
72
  if (n.depositorBtcPubkey.length !== U)
73
73
  throw new Error(
74
74
  `vaultContext: depositorBtcPubkey must be exactly ${U} bytes, got ${n.depositorBtcPubkey.length}`
75
75
  );
76
- const t = Be(n.fundingOutpoints), e = new Uint8Array(Te);
76
+ const t = ve(n.fundingOutpoints), e = new Uint8Array(_e);
77
77
  let s = 0;
78
- return st(e, s, U), s += D, e.set(n.depositorBtcPubkey, s), s += U, st(e, s, Ht), s += D, e.set(t, s), e;
78
+ return st(e, s, U), s += K, e.set(n.depositorBtcPubkey, s), s += U, st(e, s, Ht), s += K, e.set(t, s), e;
79
79
  }
80
- const Se = "babylon-btc-vault", Ot = 32, Tt = Ot * 2, Ae = /^[0-9a-f]+$/;
81
- async function Ie(n, t) {
82
- const e = ve(t), s = K(e), o = await n.deriveContextHash(Se, s);
80
+ const Ae = "babylon-btc-vault", Ot = 32, Tt = Ot * 2, Ie = /^[0-9a-f]+$/;
81
+ async function Ce(n, t) {
82
+ const e = Se(t), s = X(e), o = await n.deriveContextHash(Ae, s);
83
83
  if (typeof o != "string")
84
84
  throw new Error(
85
85
  `deriveVaultRoot: wallet must return a string, got ${typeof o}`
@@ -88,13 +88,13 @@ async function Ie(n, t) {
88
88
  throw new Error(
89
89
  `deriveVaultRoot: wallet must return a ${Tt}-character hex string (${Ot} bytes), got length ${o.length}`
90
90
  );
91
- if (!Ae.test(o))
91
+ if (!Ie.test(o))
92
92
  throw new Error(
93
93
  "deriveVaultRoot: wallet must return lowercase hex per derive-context-hash.md §2.1; got value with non-lowercase or non-hex characters"
94
94
  );
95
95
  return et(o);
96
96
  }
97
- const Ce = /* @__PURE__ */ Uint8Array.from([
97
+ const He = /* @__PURE__ */ Uint8Array.from([
98
98
  7,
99
99
  4,
100
100
  13,
@@ -111,25 +111,25 @@ const Ce = /* @__PURE__ */ Uint8Array.from([
111
111
  14,
112
112
  11,
113
113
  8
114
- ]), Rt = Uint8Array.from(new Array(16).fill(0).map((n, t) => t)), He = Rt.map((n) => (9 * n + 5) % 16), $t = /* @__PURE__ */ (() => {
115
- const e = [[Rt], [He]];
114
+ ]), Rt = Uint8Array.from(new Array(16).fill(0).map((n, t) => t)), Oe = Rt.map((n) => (9 * n + 5) % 16), $t = /* @__PURE__ */ (() => {
115
+ const e = [[Rt], [Oe]];
116
116
  for (let s = 0; s < 4; s++)
117
117
  for (let o of e)
118
- o.push(o[s].map((r) => Ce[r]));
118
+ o.push(o[s].map((r) => He[r]));
119
119
  return e;
120
- })(), Ut = $t[0], Mt = $t[1], Nt = /* @__PURE__ */ [
120
+ })(), Ut = $t[0], Vt = $t[1], Mt = /* @__PURE__ */ [
121
121
  [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],
122
122
  [12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7],
123
123
  [13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],
124
124
  [14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],
125
125
  [15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5]
126
- ].map((n) => Uint8Array.from(n)), Oe = /* @__PURE__ */ Ut.map((n, t) => n.map((e) => Nt[t][e])), Re = /* @__PURE__ */ Mt.map((n, t) => n.map((e) => Nt[t][e])), $e = /* @__PURE__ */ Uint32Array.from([
126
+ ].map((n) => Uint8Array.from(n)), Re = /* @__PURE__ */ Ut.map((n, t) => n.map((e) => Mt[t][e])), $e = /* @__PURE__ */ Vt.map((n, t) => n.map((e) => Mt[t][e])), Ue = /* @__PURE__ */ Uint32Array.from([
127
127
  0,
128
128
  1518500249,
129
129
  1859775393,
130
130
  2400959708,
131
131
  2840853838
132
- ]), Ue = /* @__PURE__ */ Uint32Array.from([
132
+ ]), Ve = /* @__PURE__ */ Uint32Array.from([
133
133
  1352829926,
134
134
  1548603684,
135
135
  1836072691,
@@ -139,7 +139,7 @@ const Ce = /* @__PURE__ */ Uint8Array.from([
139
139
  function _t(n, t, e, s) {
140
140
  return n === 0 ? t ^ e ^ s : n === 1 ? t & e | ~t & s : n === 2 ? (t | ~e) ^ s : n === 3 ? t & s | e & ~s : t ^ (e | ~s);
141
141
  }
142
- const V = /* @__PURE__ */ new Uint32Array(16);
142
+ const N = /* @__PURE__ */ new Uint32Array(16);
143
143
  class Me extends Yt {
144
144
  constructor() {
145
145
  super(64, 20, 8, !0);
@@ -158,50 +158,50 @@ class Me extends Yt {
158
158
  }
159
159
  process(e, s) {
160
160
  for (let g = 0; g < 16; g++, s += 4)
161
- V[g] = e.getUint32(s, !0);
162
- let o = this.h0 | 0, r = o, i = this.h1 | 0, a = i, c = this.h2 | 0, u = c, l = this.h3 | 0, m = l, b = this.h4 | 0, P = b;
161
+ N[g] = e.getUint32(s, !0);
162
+ let o = this.h0 | 0, r = o, i = this.h1 | 0, a = i, c = this.h2 | 0, u = c, l = this.h3 | 0, m = l, P = this.h4 | 0, b = P;
163
163
  for (let g = 0; g < 5; g++) {
164
- const f = 4 - g, k = $e[g], S = Ue[g], E = Ut[g], p = Mt[g], w = Oe[g], y = Re[g];
164
+ const f = 4 - g, k = Ue[g], S = Ve[g], E = Ut[g], p = Vt[g], w = Re[g], y = $e[g];
165
165
  for (let h = 0; h < 16; h++) {
166
- const d = M(o + _t(g, i, c, l) + V[E[h]] + k, w[h]) + b | 0;
167
- o = b, b = l, l = M(c, 10) | 0, c = i, i = d;
166
+ const d = V(o + _t(g, i, c, l) + N[E[h]] + k, w[h]) + P | 0;
167
+ o = P, P = l, l = V(c, 10) | 0, c = i, i = d;
168
168
  }
169
169
  for (let h = 0; h < 16; h++) {
170
- const d = M(r + _t(f, a, u, m) + V[p[h]] + S, y[h]) + P | 0;
171
- r = P, P = m, m = M(u, 10) | 0, u = a, a = d;
170
+ const d = V(r + _t(f, a, u, m) + N[p[h]] + S, y[h]) + b | 0;
171
+ r = b, b = m, m = V(u, 10) | 0, u = a, a = d;
172
172
  }
173
173
  }
174
- this.set(this.h1 + c + m | 0, this.h2 + l + P | 0, this.h3 + b + r | 0, this.h4 + o + a | 0, this.h0 + i + u | 0);
174
+ this.set(this.h1 + c + m | 0, this.h2 + l + b | 0, this.h3 + P + r | 0, this.h4 + o + a | 0, this.h0 + i + u | 0);
175
175
  }
176
176
  roundClean() {
177
- X(V);
177
+ W(N);
178
178
  }
179
179
  destroy() {
180
- this.destroyed = !0, X(this.buffer), this.set(0, 0, 0, 0, 0);
180
+ this.destroyed = !0, W(this.buffer), this.set(0, 0, 0, 0, 0);
181
181
  }
182
182
  }
183
- const Ne = /* @__PURE__ */ It(() => new Me()), Ve = BigInt(0), R = BigInt(1), Fe = BigInt(2), Le = BigInt(7), We = BigInt(256), Xe = BigInt(113), Vt = [], Ft = [], Lt = [];
183
+ const Ne = /* @__PURE__ */ It(() => new Me()), Fe = BigInt(0), R = BigInt(1), Le = BigInt(2), We = BigInt(7), Xe = BigInt(256), Ke = BigInt(113), Nt = [], Ft = [], Lt = [];
184
184
  for (let n = 0, t = R, e = 1, s = 0; n < 24; n++) {
185
- [e, s] = [s, (2 * e + 3 * s) % 5], Vt.push(2 * (5 * s + e)), Ft.push((n + 1) * (n + 2) / 2 % 64);
186
- let o = Ve;
185
+ [e, s] = [s, (2 * e + 3 * s) % 5], Nt.push(2 * (5 * s + e)), Ft.push((n + 1) * (n + 2) / 2 % 64);
186
+ let o = Fe;
187
187
  for (let r = 0; r < 7; r++)
188
- t = (t << R ^ (t >> Le) * Xe) % We, t & Fe && (o ^= R << (R << BigInt(r)) - R);
188
+ t = (t << R ^ (t >> We) * Ke) % Xe, t & Le && (o ^= R << (R << BigInt(r)) - R);
189
189
  Lt.push(o);
190
190
  }
191
- const Wt = we(Lt, !0), Ke = Wt[0], De = Wt[1], Bt = (n, t, e) => e > 32 ? ke(n, t, e) : ye(n, t, e), vt = (n, t, e) => e > 32 ? Ee(n, t, e) : xe(n, t, e);
192
- function Ge(n, t = 24) {
191
+ const Wt = ye(Lt, !0), De = Wt[0], Ge = Wt[1], Bt = (n, t, e) => e > 32 ? Ee(n, t, e) : xe(n, t, e), vt = (n, t, e) => e > 32 ? Te(n, t, e) : ke(n, t, e);
192
+ function qe(n, t = 24) {
193
193
  const e = new Uint32Array(10);
194
194
  for (let s = 24 - t; s < 24; s++) {
195
195
  for (let i = 0; i < 10; i++)
196
196
  e[i] = n[i] ^ n[i + 10] ^ n[i + 20] ^ n[i + 30] ^ n[i + 40];
197
197
  for (let i = 0; i < 10; i += 2) {
198
- const a = (i + 8) % 10, c = (i + 2) % 10, u = e[c], l = e[c + 1], m = Bt(u, l, 1) ^ e[a], b = vt(u, l, 1) ^ e[a + 1];
199
- for (let P = 0; P < 50; P += 10)
200
- n[i + P] ^= m, n[i + P + 1] ^= b;
198
+ const a = (i + 8) % 10, c = (i + 2) % 10, u = e[c], l = e[c + 1], m = Bt(u, l, 1) ^ e[a], P = vt(u, l, 1) ^ e[a + 1];
199
+ for (let b = 0; b < 50; b += 10)
200
+ n[i + b] ^= m, n[i + b + 1] ^= P;
201
201
  }
202
202
  let o = n[2], r = n[3];
203
203
  for (let i = 0; i < 24; i++) {
204
- const a = Ft[i], c = Bt(o, r, a), u = vt(o, r, a), l = Vt[i];
204
+ const a = Ft[i], c = Bt(o, r, a), u = vt(o, r, a), l = Nt[i];
205
205
  o = n[l], r = n[l + 1], n[l] = c, n[l + 1] = u;
206
206
  }
207
207
  for (let i = 0; i < 50; i += 10) {
@@ -210,9 +210,9 @@ function Ge(n, t = 24) {
210
210
  for (let a = 0; a < 10; a++)
211
211
  n[i + a] ^= ~e[(a + 2) % 10] & e[(a + 4) % 10];
212
212
  }
213
- n[0] ^= Ke[s], n[1] ^= De[s];
213
+ n[0] ^= De[s], n[1] ^= Ge[s];
214
214
  }
215
- X(e);
215
+ W(e);
216
216
  }
217
217
  class at {
218
218
  // NOTE: we accept arguments in bytes instead of bits here.
@@ -236,7 +236,7 @@ class at {
236
236
  return this._cloneInto();
237
237
  }
238
238
  keccak() {
239
- ut(this.state32), Ge(this.state32, this.rounds), ut(this.state32), this.posOut = 0, this.pos = 0;
239
+ ut(this.state32), qe(this.state32, this.rounds), ut(this.state32), this.posOut = 0, this.pos = 0;
240
240
  }
241
241
  update(t) {
242
242
  ht(this), dt(t);
@@ -283,30 +283,30 @@ class at {
283
283
  return this.digestInto(new Uint8Array(this.outputLen));
284
284
  }
285
285
  destroy() {
286
- this.destroyed = !0, X(this.state);
286
+ this.destroyed = !0, W(this.state);
287
287
  }
288
288
  _cloneInto(t) {
289
289
  const { blockLen: e, suffix: s, outputLen: o, rounds: r, enableXOF: i } = this;
290
290
  return t || (t = new at(e, s, o, i, r)), t.state32.set(this.state32), t.pos = this.pos, t.posOut = this.posOut, t.finished = this.finished, t.rounds = r, t.suffix = s, t.outputLen = o, t.enableXOF = i, t.destroyed = this.destroyed, t;
291
291
  }
292
292
  }
293
- const qe = (n, t, e, s = {}) => It(() => new at(t, n, e), s), ze = /* @__PURE__ */ qe(1, 136, 32), St = 64, _ = 20, ot = 4, Xt = 2, Ye = 0, je = 1, F = [64, 64], Ze = (n) => Array.from(n).map((t) => t.toString(16).padStart(2, "0")).join("");
293
+ const ze = (n, t, e, s = {}) => It(() => new at(t, n, e), s), Ye = /* @__PURE__ */ ze(1, 136, 32), St = 64, _ = 20, ot = 4, Xt = 2, je = 0, Ze = 1, F = [64, 64], Qe = (n) => Array.from(n).map((t) => t.toString(16).padStart(2, "0")).join("");
294
294
  function ct(n) {
295
295
  return Ne(it(n));
296
296
  }
297
297
  function Kt(n) {
298
298
  return (1 << n) - 1;
299
299
  }
300
- function Qe(n) {
300
+ function Je(n) {
301
301
  let t = 1;
302
302
  for (; t * t < n + 1; ) t++;
303
303
  return Math.max(t, 2);
304
304
  }
305
- function Je(n) {
305
+ function tn(n) {
306
306
  const t = ot, e = n * Kt(t);
307
- return { d: t, n, checksum_radix: Qe(e) };
307
+ return { d: t, n, checksum_radix: Je(e) };
308
308
  }
309
- function j(n, t) {
309
+ function Y(n, t) {
310
310
  const e = [];
311
311
  let s = t;
312
312
  for (; s > 0; )
@@ -317,28 +317,28 @@ function j(n, t) {
317
317
  o[n.length + r] = e[r];
318
318
  return ct(o);
319
319
  }
320
- function Z(n, t) {
320
+ function j(n, t) {
321
321
  let e = n;
322
322
  for (let s = 0; s < t; s++)
323
323
  e = ct(e);
324
324
  return e;
325
325
  }
326
- function tn(n, t) {
326
+ function en(n, t) {
327
327
  const e = Kt(t.d), s = t.checksum_radix - 1, o = Math.floor(t.n * e / t.checksum_radix), r = [];
328
328
  for (let l = 0; l < t.n; l++) {
329
- const m = j(n, l + Xt), b = Z(m, e);
330
- r.push(Array.from(b));
329
+ const m = Y(n, l + Xt), P = j(m, e);
330
+ r.push(Array.from(P));
331
331
  }
332
- const i = j(
332
+ const i = Y(
333
333
  n,
334
- Ye
335
- ), a = Z(
334
+ je
335
+ ), a = j(
336
336
  i,
337
337
  s
338
- ), c = j(
338
+ ), c = Y(
339
339
  n,
340
- je
341
- ), u = Z(
340
+ Ze
341
+ ), u = j(
342
342
  c,
343
343
  o
344
344
  );
@@ -349,7 +349,7 @@ function tn(n, t) {
349
349
  checksum_minor_terminal: Array.from(a)
350
350
  };
351
351
  }
352
- async function en(n) {
352
+ async function nn(n) {
353
353
  try {
354
354
  if (n.length !== St)
355
355
  throw new Error(
@@ -357,11 +357,11 @@ async function en(n) {
357
357
  );
358
358
  const t = [];
359
359
  for (let e = 0; e < F.length; e++) {
360
- const s = F[e], o = Je(s), r = new Uint8Array(n.length + 1);
360
+ const s = F[e], o = tn(s), r = new Uint8Array(n.length + 1);
361
361
  r.set(n), r[n.length] = e;
362
362
  const i = ct(r);
363
363
  try {
364
- const a = tn(i, o);
364
+ const a = en(i, o);
365
365
  if (a.config.d !== ot)
366
366
  throw new Error(
367
367
  `Block ${e}: expected d=${ot}, got d=${a.config.d}`
@@ -401,7 +401,7 @@ async function en(n) {
401
401
  n.fill(0);
402
402
  }
403
403
  }
404
- function Q(n, t, e) {
404
+ function Z(n, t, e) {
405
405
  if (n.length !== _)
406
406
  throw new Error(
407
407
  `Block ${t} ${e}: expected ${_} bytes, got ${n.length}`
@@ -414,14 +414,14 @@ function Q(n, t, e) {
414
414
  );
415
415
  }
416
416
  }
417
- function nn(n) {
417
+ function sn(n) {
418
418
  if (n.length === 0)
419
419
  throw new Error("Public keys array must not be empty");
420
420
  for (let r = 0; r < n.length; r++) {
421
421
  const i = n[r];
422
- Q(i.checksum_minor_terminal, r, "checksum_minor_terminal"), Q(i.checksum_major_terminal, r, "checksum_major_terminal");
422
+ Z(i.checksum_minor_terminal, r, "checksum_minor_terminal"), Z(i.checksum_major_terminal, r, "checksum_major_terminal");
423
423
  for (let a = 0; a < i.message_terminals.length; a++)
424
- Q(i.message_terminals[a], r, `message_terminal[${a}]`);
424
+ Z(i.message_terminals[a], r, `message_terminal[${a}]`);
425
425
  }
426
426
  let t = 0;
427
427
  for (const r of n)
@@ -433,23 +433,23 @@ function nn(n) {
433
433
  for (const i of r.message_terminals)
434
434
  e.set(i, s), s += _;
435
435
  }
436
- const o = ze(e);
437
- return `0x${Ze(o)}`;
436
+ const o = Ye(e);
437
+ return `0x${Qe(o)}`;
438
438
  }
439
- async function sn(n, t) {
439
+ async function on(n, t) {
440
440
  const e = [], s = [], o = [], r = [];
441
441
  try {
442
442
  for (let i = 0; i < t; i++) {
443
443
  const a = await te(n, i);
444
444
  try {
445
- const u = await en(a);
446
- e.push(u), s.push(nn(u));
445
+ const u = await nn(a);
446
+ e.push(u), s.push(sn(u));
447
447
  } finally {
448
448
  a.fill(0);
449
449
  }
450
450
  const c = await ee(n, i);
451
451
  try {
452
- const u = K(c);
452
+ const u = X(c);
453
453
  o.push(u), r.push(ue(v(u)).slice(2));
454
454
  } finally {
455
455
  c.fill(0);
@@ -460,33 +460,33 @@ async function sn(n, t) {
460
460
  }
461
461
  return { perVaultWotsKeys: e, wotsPkHashes: s, htlcSecretHexes: o, hashlocks: r };
462
462
  }
463
- const on = /^0x[0-9a-f]+$/i, rn = /^[0-9a-f]+$/i, an = /^[A-Za-z0-9+/]+={0,2}$/;
463
+ const rn = /^0x[0-9a-f]+$/i, an = /^[0-9a-f]+$/i, cn = /^[A-Za-z0-9+/]+={0,2}$/;
464
464
  function $(n) {
465
465
  if (typeof n != "string" || n.length === 0)
466
466
  throw new Error("BTC wallet returned empty public key");
467
467
  return ae(n).toLowerCase();
468
468
  }
469
- function cn(n) {
469
+ function ln(n) {
470
470
  if (typeof n != "string" || n.length === 0)
471
471
  throw new Error("BTC wallet returned empty BIP-322 signature");
472
472
  if (n.startsWith("0x") || n.startsWith("0X")) {
473
- if (!on.test(n) || n.length < 4 || n.length % 2 !== 0)
473
+ if (!rn.test(n) || n.length < 4 || n.length % 2 !== 0)
474
474
  throw new Error("BTC wallet returned malformed hex BIP-322 signature");
475
475
  return n.toLowerCase();
476
476
  }
477
- if (rn.test(n)) {
477
+ if (an.test(n)) {
478
478
  if (n.length % 2 !== 0)
479
479
  throw new Error("BTC wallet returned malformed hex BIP-322 signature");
480
480
  return `0x${n.toLowerCase()}`;
481
481
  }
482
- if (!an.test(n) || n.length % 4 !== 0)
482
+ if (!cn.test(n) || n.length % 4 !== 0)
483
483
  throw new Error("BTC wallet returned malformed base64 BIP-322 signature");
484
484
  const t = J.from(n, "base64");
485
485
  if (t.length === 0 || t.toString("base64") !== n)
486
486
  throw new Error("BTC wallet returned malformed base64 BIP-322 signature");
487
487
  return `0x${t.toString("hex")}`;
488
488
  }
489
- async function ln(n, t, e) {
489
+ async function un(n, t, e) {
490
490
  if (typeof n.signPsbts == "function") {
491
491
  const o = await n.signPsbts(t, e);
492
492
  if (o.length !== t.length)
@@ -502,8 +502,8 @@ async function ln(n, t, e) {
502
502
  }
503
503
  return s;
504
504
  }
505
- const Dt = 0, L = 25, rt = 9999, W = "00".repeat(32);
506
- function un(n, t) {
505
+ const Dt = 0, L = 25, rt = 9999, Q = "00".repeat(32);
506
+ function hn(n, t) {
507
507
  const e = {
508
508
  bitcoin: "bc",
509
509
  testnet: "tb",
@@ -517,7 +517,7 @@ function un(n, t) {
517
517
  return !1;
518
518
  }
519
519
  }
520
- function hn(n, t, e, s) {
520
+ function dn(n, t, e, s) {
521
521
  const o = e == null ? void 0 : e[`${n}:${t}`];
522
522
  return o ? Promise.resolve({
523
523
  txid: n,
@@ -527,7 +527,7 @@ function hn(n, t, e, s) {
527
527
  }) : be(n, t, s);
528
528
  }
529
529
  const At = 12e4;
530
- class $n {
530
+ class Un {
531
531
  /**
532
532
  * Creates a new PeginManager instance.
533
533
  *
@@ -550,7 +550,7 @@ class $n {
550
550
  if (t.amounts.length === 0)
551
551
  throw new Error("amounts must contain at least one entry");
552
552
  const e = await this.config.btcWallet.getPublicKeyHex(), s = $(e);
553
- if (!Pt(
553
+ if (!bt(
554
554
  t.changeAddress,
555
555
  e,
556
556
  this.config.btcNetwork
@@ -563,7 +563,7 @@ class $n {
563
563
  txid: et(f.txid),
564
564
  vout: f.vout
565
565
  })
566
- ), i = await Ie(this.config.btcWallet, {
566
+ ), i = await Ce(this.config.btcWallet, {
567
567
  depositorBtcPubkey: et(s),
568
568
  fundingOutpoints: r
569
569
  });
@@ -571,17 +571,17 @@ class $n {
571
571
  try {
572
572
  const f = await ne(i);
573
573
  try {
574
- a = K(f), c = K(it(f));
574
+ a = X(f), c = X(it(f));
575
575
  } finally {
576
576
  f.fill(0);
577
577
  }
578
578
  } catch (f) {
579
579
  throw i.fill(0), f;
580
580
  }
581
- const u = await sn(i, t.amounts.length), { perVaultWotsKeys: l, wotsPkHashes: m, htlcSecretHexes: b, hashlocks: P } = u, g = await this.preparePeginCommit({
581
+ const u = await on(i, t.amounts.length), { perVaultWotsKeys: l, wotsPkHashes: m, htlcSecretHexes: P, hashlocks: b } = u, g = await this.preparePeginCommit({
582
582
  depositorBtcPubkeyRaw: e,
583
583
  depositorBtcPubkey: s,
584
- hashlocks: P,
584
+ hashlocks: b,
585
585
  authAnchorHash: c,
586
586
  sizing: o,
587
587
  params: t
@@ -606,7 +606,7 @@ class $n {
606
606
  derivedSecrets: {
607
607
  perVaultWotsKeys: l,
608
608
  wotsPkHashes: m,
609
- htlcSecretHexes: b,
609
+ htlcSecretHexes: P,
610
610
  authAnchorHex: a
611
611
  }
612
612
  };
@@ -629,7 +629,7 @@ class $n {
629
629
  */
630
630
  async prepareSizing(t, e) {
631
631
  const s = e.amounts.map(
632
- () => W
632
+ () => Q
633
633
  ), o = e.vaultKeeperBtcPubkeys.length, r = await mt({
634
634
  depositorPubkey: t,
635
635
  vaultProviderPubkey: T(e.vaultProviderBtcPubkey),
@@ -644,15 +644,12 @@ class $n {
644
644
  councilQuorum: e.councilQuorum,
645
645
  councilSize: e.councilSize,
646
646
  network: this.config.btcNetwork,
647
- authAnchorHash: W
647
+ authAnchorHash: Q
648
648
  }), i = de(
649
649
  [...e.availableUTXOs],
650
650
  r.totalOutputValue,
651
651
  e.mempoolFeeRate,
652
- fe(
653
- r.htlcValues.length,
654
- W
655
- )
652
+ fe(r.htlcValues.length, !0)
656
653
  );
657
654
  return {
658
655
  selectedUTXOs: i.selectedUTXOs,
@@ -669,7 +666,7 @@ class $n {
669
666
  authAnchorHash: r,
670
667
  sizing: i,
671
668
  params: a
672
- } = t, c = W.toLowerCase();
669
+ } = t, c = Q.toLowerCase();
673
670
  for (let d = 0; d < o.length; d++)
674
671
  if (o[d].toLowerCase() === c)
675
672
  throw new Error(
@@ -679,7 +676,7 @@ class $n {
679
676
  throw new Error(
680
677
  "preparePeginCommit refusing to build with sizing-pass placeholder auth-anchor hash — internal substitution bug"
681
678
  );
682
- const u = T(a.vaultProviderBtcPubkey), l = a.vaultKeeperBtcPubkeys.map(T), m = a.universalChallengerBtcPubkeys.map(T), b = l.length, P = {
679
+ const u = T(a.vaultProviderBtcPubkey), l = a.vaultKeeperBtcPubkeys.map(T), m = a.universalChallengerBtcPubkeys.map(T), P = l.length, b = {
683
680
  depositorPubkey: s,
684
681
  vaultProviderPubkey: u,
685
682
  vaultKeeperPubkeys: l,
@@ -689,21 +686,21 @@ class $n {
689
686
  pegInAmounts: a.amounts,
690
687
  feeRate: a.protocolFeeRate,
691
688
  minPeginFeeRate: a.minPeginFeeRate,
692
- numLocalChallengers: b,
689
+ numLocalChallengers: P,
693
690
  councilQuorum: a.councilQuorum,
694
691
  councilSize: a.councilSize,
695
692
  network: this.config.btcNetwork,
696
693
  authAnchorHash: r
697
- }, g = await mt(P), f = wt(this.config.btcNetwork), k = pe({
694
+ }, g = await mt(b), f = wt(this.config.btcNetwork), k = pe({
698
695
  unfundedTxHex: g.psbtHex,
699
696
  selectedUTXOs: i.selectedUTXOs,
700
697
  changeAddress: a.changeAddress,
701
698
  changeAmount: i.changeAmount,
702
699
  network: f
703
- }), S = T(z(k)), E = [], p = [], w = [];
700
+ }), S = T(q(k)), E = [], p = [], w = [];
704
701
  for (let d = 0; d < o.length; d++) {
705
702
  const B = await se({
706
- prePeginParams: P,
703
+ prePeginParams: b,
707
704
  timelockPegin: a.timelockPegin,
708
705
  fundedPrePeginTxHex: k,
709
706
  htlcVout: d
@@ -722,13 +719,13 @@ class $n {
722
719
  le(e, 1)
723
720
  );
724
721
  }
725
- const y = await ln(
722
+ const y = await un(
726
723
  this.config.btcWallet,
727
724
  p,
728
725
  w
729
726
  ), h = [];
730
727
  for (let d = 0; d < y.length; d++) {
731
- bt({
728
+ Pt({
732
729
  requestedPsbtHex: p[d],
733
730
  returnedPsbtHex: y[d]
734
731
  });
@@ -777,24 +774,24 @@ class $n {
777
774
  "hex"
778
775
  ), c = this.config.mempoolApiUrl, u = r.ins.map((p) => {
779
776
  const w = J.from(p.hash).reverse().toString("hex"), y = p.index;
780
- return hn(w, y, t.localPrevouts, c).then(
777
+ return dn(w, y, t.localPrevouts, c).then(
781
778
  (h) => ({ input: p, utxoData: h, txid: w, vout: y })
782
779
  );
783
780
  }), l = await Promise.all(u), m = l.reduce(
784
781
  (p, w) => p + BigInt(w.utxoData.value),
785
782
  0n
786
- ), b = r.outs.reduce(
783
+ ), P = r.outs.reduce(
787
784
  (p, w) => p + BigInt(w.value),
788
785
  0n
789
786
  );
790
- if (m < b)
787
+ if (m < P)
791
788
  throw new Error(
792
- `UTXO value mismatch: total input value (${m} sat) is less than total output value (${b} sat). This may indicate the mempool API returned manipulated UTXO data.`
789
+ `UTXO value mismatch: total input value (${m} sat) is less than total output value (${P} sat). This may indicate the mempool API returned manipulated UTXO data.`
793
790
  );
794
- const P = m - b;
795
- if (P > yt)
791
+ const b = m - P;
792
+ if (b > yt)
796
793
  throw new Error(
797
- `Implied transaction fee (${P} sat) exceeds maximum reasonable fee (${yt} sat). This may indicate manipulated UTXO data.`
794
+ `Implied transaction fee (${b} sat) exceeds maximum reasonable fee (${yt} sat). This may indicate manipulated UTXO data.`
798
795
  );
799
796
  for (const { input: p, utxoData: w, txid: y, vout: h } of l) {
800
797
  const d = ge(
@@ -817,7 +814,7 @@ class $n {
817
814
  value: p.value
818
815
  });
819
816
  const g = i.toHex(), f = await this.config.btcWallet.signPsbt(g);
820
- bt({
817
+ Pt({
821
818
  requestedPsbtHex: g,
822
819
  returnedPsbtHex: f
823
820
  });
@@ -877,10 +874,10 @@ class $n {
877
874
  throw new Error(
878
875
  `Proof of possession was signed for ${u.depositorEthAddress} but the Ethereum wallet is currently connected to ${l}. Reconnect the original account or call signProofOfPossession() again.`
879
876
  );
880
- const m = await this.assertPopMatchesBtcWallet(u), b = u.btcPopSignature, P = v(u.depositorBtcPubkey), g = v(e), f = v(s), k = a ?? await this.config.btcWallet.getAddress(), S = this.resolvePayoutScriptPubKey(
877
+ const m = await this.assertPopMatchesBtcWallet(u), P = u.btcPopSignature, b = v(u.depositorBtcPubkey), g = v(e), f = v(s), k = a ?? await this.config.btcWallet.getAddress(), S = this.resolvePayoutScriptPubKey(
881
878
  m,
882
879
  k
883
- ), E = z(f), p = await pt(
880
+ ), E = q(f), p = await pt(
884
881
  T(E),
885
882
  T(l)
886
883
  ), w = v(p);
@@ -911,8 +908,8 @@ class $n {
911
908
  functionName: "submitPeginRequest",
912
909
  args: [
913
910
  l,
914
- P,
915
911
  b,
912
+ P,
916
913
  g,
917
914
  f,
918
915
  o,
@@ -934,9 +931,9 @@ class $n {
934
931
  } catch (O) {
935
932
  H(O);
936
933
  }
937
- let G;
934
+ let D;
938
935
  try {
939
- G = await this.config.ethWallet.sendTransaction({
936
+ D = await this.config.ethWallet.sendTransaction({
940
937
  to: this.config.vaultContracts.btcVaultRegistry,
941
938
  data: A,
942
939
  value: d,
@@ -947,18 +944,18 @@ class $n {
947
944
  } catch (O) {
948
945
  H(O);
949
946
  }
950
- const q = await xt({
947
+ const G = await xt({
951
948
  publicClient: h,
952
949
  walletAddress: this.config.ethWallet.account.address,
953
- hash: G,
950
+ hash: D,
954
951
  timeout: At
955
952
  });
956
- return q.status === "reverted" && H(
953
+ return G.status === "reverted" && H(
957
954
  new Error(
958
- `Transaction reverted. Hash: ${q.transactionHash}. Check the transaction on block explorer for details.`
955
+ `Transaction reverted. Hash: ${G.transactionHash}. Check the transaction on block explorer for details.`
959
956
  )
960
957
  ), {
961
- ethTxHash: q.transactionHash,
958
+ ethTxHash: G.transactionHash,
962
959
  vaultId: w,
963
960
  peginTxHash: E
964
961
  };
@@ -993,7 +990,7 @@ class $n {
993
990
  for (const h of o) {
994
991
  const d = v(
995
992
  h.depositorSignedPeginTx
996
- ), B = z(d), A = await pt(
993
+ ), B = q(d), A = await pt(
997
994
  T(B),
998
995
  T(i)
999
996
  ), C = v(A);
@@ -1004,9 +1001,9 @@ class $n {
1004
1001
  l.push({ vaultId: C, peginTxHash: B });
1005
1002
  }
1006
1003
  const m = this.config.publicClient;
1007
- let b;
1004
+ let P;
1008
1005
  try {
1009
- b = await m.readContract({
1006
+ P = await m.readContract({
1010
1007
  address: this.config.vaultContracts.btcVaultRegistry,
1011
1008
  abi: I,
1012
1009
  functionName: "getPegInFee",
@@ -1018,7 +1015,7 @@ class $n {
1018
1015
  { cause: h }
1019
1016
  );
1020
1017
  }
1021
- const P = b * BigInt(o.length), g = await this.resolveMaxAcceptableCommissionBps(
1018
+ const b = P * BigInt(o.length), g = await this.resolveMaxAcceptableCommissionBps(
1022
1019
  e,
1023
1020
  t.quotedCommissionBps
1024
1021
  ), f = v(
@@ -1050,7 +1047,7 @@ class $n {
1050
1047
  p = await m.estimateGas({
1051
1048
  to: this.config.vaultContracts.btcVaultRegistry,
1052
1049
  data: E,
1053
- value: P,
1050
+ value: b,
1054
1051
  account: this.config.ethWallet.account.address
1055
1052
  });
1056
1053
  } catch (h) {
@@ -1061,7 +1058,7 @@ class $n {
1061
1058
  w = await this.config.ethWallet.sendTransaction({
1062
1059
  to: this.config.vaultContracts.btcVaultRegistry,
1063
1060
  data: E,
1064
- value: P,
1061
+ value: b,
1065
1062
  account: this.config.ethWallet.account,
1066
1063
  chain: this.config.ethChain,
1067
1064
  gas: p
@@ -1089,12 +1086,10 @@ class $n {
1089
1086
  async resolveMaxAcceptableCommissionBps(t, e) {
1090
1087
  let s;
1091
1088
  try {
1092
- s = await this.config.publicClient.readContract({
1093
- address: this.config.vaultContracts.btcVaultRegistry,
1094
- abi: I,
1095
- functionName: "getVaultProviderCommission",
1096
- args: [t]
1097
- });
1089
+ s = await new Pe(
1090
+ this.config.publicClient,
1091
+ this.config.vaultContracts.btcVaultRegistry
1092
+ ).getVaultProviderCommission(t);
1098
1093
  } catch (o) {
1099
1094
  throw new Error(
1100
1095
  "Failed to query vault provider commission from the contract. Please check your network connection and that the contract address is correct.",
@@ -1154,12 +1149,12 @@ class $n {
1154
1149
  * on-chain payout-script registration.
1155
1150
  */
1156
1151
  resolvePayoutScriptPubKey(t, e) {
1157
- if (!Pt(
1152
+ if (!bt(
1158
1153
  e,
1159
1154
  t,
1160
1155
  this.config.btcNetwork
1161
1156
  ))
1162
- throw T(t).length === ce && un(e, this.config.btcNetwork) ? new Error(
1157
+ throw T(t).length === ce && hn(e, this.config.btcNetwork) ? new Error(
1163
1158
  `BTC payout address "${e}" is a P2WPKH (Native SegWit) address, but the connected wallet only exposes an x-only public key. P2WPKH validation requires a compressed key with known y-parity. Use a P2TR (Taproot) payout address instead.`
1164
1159
  ) : new Error(
1165
1160
  `BTC payout address "${e}" is not derived from the connected wallet's public key. The payout sink must be controlled by the same key that signs the pegin; refusing to register a mismatched address.`
@@ -1189,7 +1184,7 @@ class $n {
1189
1184
  "bip322-simple"
1190
1185
  );
1191
1186
  return {
1192
- btcPopSignature: cn(r),
1187
+ btcPopSignature: ln(r),
1193
1188
  depositorEthAddress: t,
1194
1189
  depositorBtcPubkey: e
1195
1190
  };
@@ -1227,29 +1222,29 @@ class $n {
1227
1222
  return this.config.vaultContracts.btcVaultRegistry;
1228
1223
  }
1229
1224
  }
1230
- const dn = 80, gn = 250, fn = 300, pn = 22, Gt = "ab";
1231
- function mn(n, t) {
1232
- const e = Gt.repeat(fn), s = T(n).toLowerCase(), o = t.toString(16).padStart(8, "0"), r = `${s}${o}`, i = e.slice(r.length);
1225
+ const gn = 80, fn = 250, pn = 300, mn = 22, Gt = "ab";
1226
+ function Pn(n, t) {
1227
+ const e = Gt.repeat(pn), s = T(n).toLowerCase(), o = t.toString(16).padStart(8, "0"), r = `${s}${o}`, i = e.slice(r.length);
1233
1228
  return `0x${r}${i}`;
1234
1229
  }
1235
1230
  function bn(n, t) {
1236
1231
  const e = (s) => `0x${Gt.repeat(s)}`;
1237
1232
  return {
1238
1233
  depositorBtcPubKey: e(32),
1239
- btcPopSignature: e(dn),
1240
- unsignedPrePeginTx: e(gn),
1241
- depositorSignedPeginTx: mn(
1234
+ btcPopSignature: e(gn),
1235
+ unsignedPrePeginTx: e(fn),
1236
+ depositorSignedPeginTx: Pn(
1242
1237
  n,
1243
1238
  t
1244
1239
  ),
1245
1240
  hashlock: e(32),
1246
1241
  htlcVout: t,
1247
1242
  referralCode: Dt,
1248
- depositorPayoutBtcAddress: e(pn),
1243
+ depositorPayoutBtcAddress: e(mn),
1249
1244
  depositorWotsPkHash: e(32)
1250
1245
  };
1251
1246
  }
1252
- async function Un(n) {
1247
+ async function Vn(n) {
1253
1248
  const { publicClient: t, btcVaultRegistry: e, depositorEthAddress: s, vaultProvider: o, batchSize: r } = n;
1254
1249
  if (r <= 0)
1255
1250
  throw new Error(
@@ -1281,13 +1276,13 @@ async function Un(n) {
1281
1276
  });
1282
1277
  }
1283
1278
  export {
1284
- $n as P,
1285
- Se as V,
1286
- ve as a,
1287
- Be as b,
1288
- nn as c,
1289
- en as d,
1290
- Un as e,
1291
- Ie as f
1279
+ Un as P,
1280
+ Ae as V,
1281
+ Se as a,
1282
+ ve as b,
1283
+ sn as c,
1284
+ nn as d,
1285
+ Vn as e,
1286
+ Ce as f
1292
1287
  };
1293
- //# sourceMappingURL=PeginManager-D9ZZ8wx2.js.map
1288
+ //# sourceMappingURL=PeginManager-BezsAEDe.js.map