@babylonlabs-io/ts-sdk 0.39.2 → 0.39.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/dist/PayoutManager-B5bovfkD.cjs +2 -0
  2. package/dist/PayoutManager-B5bovfkD.cjs.map +1 -0
  3. package/dist/{PayoutManager-D29D-K-V.js → PayoutManager-DChODEOJ.js} +75 -97
  4. package/dist/PayoutManager-DChODEOJ.js.map +1 -0
  5. package/dist/{PeginManager-DXrfY4d6.js → PeginManager-B1qjHs90.js} +83 -81
  6. package/dist/PeginManager-B1qjHs90.js.map +1 -0
  7. package/dist/{PeginManager-zkTJOy_U.cjs → PeginManager-Dof0ZO1S.cjs} +2 -2
  8. package/dist/PeginManager-Dof0ZO1S.cjs.map +1 -0
  9. package/dist/assertPsbtUnsignedTxMatches-CzVv57QF.js +404 -0
  10. package/dist/assertPsbtUnsignedTxMatches-CzVv57QF.js.map +1 -0
  11. package/dist/assertPsbtUnsignedTxMatches-r1svclbd.cjs +2 -0
  12. package/dist/assertPsbtUnsignedTxMatches-r1svclbd.cjs.map +1 -0
  13. package/dist/buildAndBroadcastRefund-Cj8JDI7F.cjs +2 -0
  14. package/dist/buildAndBroadcastRefund-Cj8JDI7F.cjs.map +1 -0
  15. package/dist/{buildAndBroadcastRefund-CjWAle7m.js → buildAndBroadcastRefund-fIHDHiFh.js} +421 -394
  16. package/dist/buildAndBroadcastRefund-fIHDHiFh.js.map +1 -0
  17. package/dist/{challengeAssert-CBp4mEs0.js → challengeAssert-DLEmAhT0.js} +7 -7
  18. package/dist/{challengeAssert-CBp4mEs0.js.map → challengeAssert-DLEmAhT0.js.map} +1 -1
  19. package/dist/{challengeAssert-CNRdpCzm.cjs → challengeAssert-rpDaS3fH.cjs} +2 -2
  20. package/dist/{challengeAssert-CNRdpCzm.cjs.map → challengeAssert-rpDaS3fH.cjs.map} +1 -1
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.js +172 -173
  23. package/dist/noPayout-B06Z9RTe.cjs +2 -0
  24. package/dist/noPayout-B06Z9RTe.cjs.map +1 -0
  25. package/dist/noPayout-CS2wnluA.js +154 -0
  26. package/dist/noPayout-CS2wnluA.js.map +1 -0
  27. package/dist/tbv/core/index.cjs +1 -1
  28. package/dist/tbv/core/index.js +174 -175
  29. package/dist/tbv/core/managers/PayoutManager.d.ts +9 -15
  30. package/dist/tbv/core/managers/PayoutManager.d.ts.map +1 -1
  31. package/dist/tbv/core/managers/PeginManager.d.ts +7 -2
  32. package/dist/tbv/core/managers/PeginManager.d.ts.map +1 -1
  33. package/dist/tbv/core/managers/index.cjs +1 -1
  34. package/dist/tbv/core/managers/index.js +2 -2
  35. package/dist/tbv/core/primitives/index.cjs +1 -1
  36. package/dist/tbv/core/primitives/index.d.ts +1 -1
  37. package/dist/tbv/core/primitives/index.d.ts.map +1 -1
  38. package/dist/tbv/core/primitives/index.js +19 -20
  39. package/dist/tbv/core/primitives/psbt/constants.d.ts +16 -0
  40. package/dist/tbv/core/primitives/psbt/constants.d.ts.map +1 -1
  41. package/dist/tbv/core/primitives/psbt/noPayout.d.ts +3 -2
  42. package/dist/tbv/core/primitives/psbt/noPayout.d.ts.map +1 -1
  43. package/dist/tbv/core/primitives/psbt/payout.d.ts +24 -15
  44. package/dist/tbv/core/primitives/psbt/payout.d.ts.map +1 -1
  45. package/dist/tbv/core/primitives/psbt/pegin.d.ts +3 -1
  46. package/dist/tbv/core/primitives/psbt/pegin.d.ts.map +1 -1
  47. package/dist/tbv/core/primitives/psbt/refund.d.ts.map +1 -1
  48. package/dist/tbv/core/services/deposit/runDepositorPresignFlow.d.ts +2 -0
  49. package/dist/tbv/core/services/deposit/runDepositorPresignFlow.d.ts.map +1 -1
  50. package/dist/tbv/core/services/deposit/signDepositorGraph.d.ts.map +1 -1
  51. package/dist/tbv/core/services/index.cjs +1 -1
  52. package/dist/tbv/core/services/index.js +2 -2
  53. package/dist/tbv/core/services/refund/buildAndBroadcastRefund.d.ts +27 -0
  54. package/dist/tbv/core/services/refund/buildAndBroadcastRefund.d.ts.map +1 -1
  55. package/dist/tbv/core/services/refund/index.d.ts +1 -1
  56. package/dist/tbv/core/services/refund/index.d.ts.map +1 -1
  57. package/dist/tbv/index.cjs +1 -1
  58. package/dist/tbv/index.js +174 -175
  59. package/package.json +3 -3
  60. package/dist/PayoutManager-D29D-K-V.js.map +0 -1
  61. package/dist/PayoutManager-DERMRuUU.cjs +0 -2
  62. package/dist/PayoutManager-DERMRuUU.cjs.map +0 -1
  63. package/dist/PeginManager-DXrfY4d6.js.map +0 -1
  64. package/dist/PeginManager-zkTJOy_U.cjs.map +0 -1
  65. package/dist/assertPsbtUnsignedTxMatches-fNkAaZZm.cjs +0 -2
  66. package/dist/assertPsbtUnsignedTxMatches-fNkAaZZm.cjs.map +0 -1
  67. package/dist/assertPsbtUnsignedTxMatches-mTAnLhCz.js +0 -340
  68. package/dist/assertPsbtUnsignedTxMatches-mTAnLhCz.js.map +0 -1
  69. package/dist/buildAndBroadcastRefund-CjWAle7m.js.map +0 -1
  70. package/dist/buildAndBroadcastRefund-CzKOUR75.cjs +0 -2
  71. package/dist/buildAndBroadcastRefund-CzKOUR75.cjs.map +0 -1
  72. package/dist/noPayout-jtZsoOzY.cjs +0 -2
  73. package/dist/noPayout-jtZsoOzY.cjs.map +0 -1
  74. package/dist/noPayout-qbaSEKGC.js +0 -145
  75. package/dist/noPayout-qbaSEKGC.js.map +0 -1
@@ -9,24 +9,24 @@ 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, f as bt } from "./assertPsbtUnsignedTxMatches-mTAnLhCz.js";
12
+ import { b as mt, a as se, d as bt } from "./assertPsbtUnsignedTxMatches-CzVv57QF.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 wt, s as T, j as Pt, X as ce } from "./bitcoin-B5aNKtsk.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";
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-D29D-K-V.js";
17
+ import { c as ue, a as he } from "./PayoutManager-DChODEOJ.js";
18
18
  import { s as de, f as z, i as ge, w as xt } from "./waitForTransactionReceiptSmartAware-CmgFXFza.js";
19
19
  import { p as fe, f as pe } from "./fundPeginTransaction-t-6TsHAY.js";
20
20
  import { p as me, f as be } from "./mempoolApi-CAIge7Nj.js";
21
21
  const N = /* @__PURE__ */ BigInt(2 ** 32 - 1), kt = /* @__PURE__ */ BigInt(32);
22
- function we(n, t = !1) {
22
+ function Pe(n, t = !1) {
23
23
  return t ? { h: Number(n & N), l: Number(n >> kt & N) } : { h: Number(n >> kt & N) | 0, l: Number(n & N) | 0 };
24
24
  }
25
- function Pe(n, t = !1) {
25
+ function we(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 } = we(n[r], t);
29
+ const { h: i, l: a } = Pe(n[r], t);
30
30
  [s[r], o[r]] = [i, a];
31
31
  }
32
32
  return [s, o];
@@ -111,19 +111,19 @@ const Ce = /* @__PURE__ */ Uint8Array.from([
111
111
  14,
112
112
  11,
113
113
  8
114
- ]), $t = Uint8Array.from(new Array(16).fill(0).map((n, t) => t)), He = $t.map((n) => (9 * n + 5) % 16), Rt = /* @__PURE__ */ (() => {
115
- const e = [[$t], [He]];
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]];
116
116
  for (let s = 0; s < 4; s++)
117
117
  for (let o of e)
118
118
  o.push(o[s].map((r) => Ce[r]));
119
119
  return e;
120
- })(), Ut = Rt[0], Mt = Rt[1], Nt = /* @__PURE__ */ [
120
+ })(), Ut = $t[0], Mt = $t[1], Nt = /* @__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])), $e = /* @__PURE__ */ Mt.map((n, t) => n.map((e) => Nt[t][e])), Re = /* @__PURE__ */ Uint32Array.from([
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([
127
127
  0,
128
128
  1518500249,
129
129
  1859775393,
@@ -159,19 +159,19 @@ class Me extends Yt {
159
159
  process(e, s) {
160
160
  for (let g = 0; g < 16; g++, s += 4)
161
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, w = b;
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;
163
163
  for (let g = 0; g < 5; g++) {
164
- const f = 4 - g, k = Re[g], S = Ue[g], E = Ut[g], p = Mt[g], P = Oe[g], y = $e[g];
164
+ const f = 4 - g, k = $e[g], S = Ue[g], E = Ut[g], p = Mt[g], w = Oe[g], y = Re[g];
165
165
  for (let h = 0; h < 16; h++) {
166
- const d = M(o + _t(g, i, c, l) + V[E[h]] + k, P[h]) + b | 0;
166
+ const d = M(o + _t(g, i, c, l) + V[E[h]] + k, w[h]) + b | 0;
167
167
  o = b, b = l, l = M(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]) + w | 0;
171
- r = w, w = m, m = M(u, 10) | 0, u = a, a = d;
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;
172
172
  }
173
173
  }
174
- this.set(this.h1 + c + m | 0, this.h2 + l + w | 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 + P | 0, this.h3 + b + r | 0, this.h4 + o + a | 0, this.h0 + i + u | 0);
175
175
  }
176
176
  roundClean() {
177
177
  X(V);
@@ -180,15 +180,15 @@ class Me extends Yt {
180
180
  this.destroyed = !0, X(this.buffer), this.set(0, 0, 0, 0, 0);
181
181
  }
182
182
  }
183
- const Ne = /* @__PURE__ */ It(() => new Me()), Ve = BigInt(0), $ = BigInt(1), Le = BigInt(2), We = BigInt(7), Fe = BigInt(256), Xe = BigInt(113), Vt = [], Lt = [], Wt = [];
184
- for (let n = 0, t = $, e = 1, s = 0; n < 24; n++) {
185
- [e, s] = [s, (2 * e + 3 * s) % 5], Vt.push(2 * (5 * s + e)), Lt.push((n + 1) * (n + 2) / 2 % 64);
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 = [];
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
186
  let o = Ve;
187
187
  for (let r = 0; r < 7; r++)
188
- t = (t << $ ^ (t >> We) * Xe) % Fe, t & Le && (o ^= $ << ($ << BigInt(r)) - $);
189
- Wt.push(o);
188
+ t = (t << R ^ (t >> Le) * Xe) % We, t & Fe && (o ^= R << (R << BigInt(r)) - R);
189
+ Lt.push(o);
190
190
  }
191
- const Ft = Pe(Wt, !0), Ke = Ft[0], De = Ft[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);
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
192
  function Ge(n, t = 24) {
193
193
  const e = new Uint32Array(10);
194
194
  for (let s = 24 - t; s < 24; s++) {
@@ -196,12 +196,12 @@ function Ge(n, t = 24) {
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
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 w = 0; w < 50; w += 10)
200
- n[i + w] ^= m, n[i + w + 1] ^= b;
199
+ for (let P = 0; P < 50; P += 10)
200
+ n[i + P] ^= m, n[i + P + 1] ^= b;
201
201
  }
202
202
  let o = n[2], r = n[3];
203
203
  for (let i = 0; i < 24; i++) {
204
- const a = Lt[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 = Vt[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) {
@@ -290,7 +290,7 @@ class at {
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, L = [64, 64], Ze = (n) => Array.from(n).map((t) => t.toString(16).padStart(2, "0")).join("");
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("");
294
294
  function ct(n) {
295
295
  return Ne(it(n));
296
296
  }
@@ -356,8 +356,8 @@ async function en(n) {
356
356
  `WOTS seed must be exactly ${St} bytes, got ${n.length}`
357
357
  );
358
358
  const t = [];
359
- for (let e = 0; e < L.length; e++) {
360
- const s = L[e], o = Je(s), r = new Uint8Array(n.length + 1);
359
+ for (let e = 0; e < F.length; e++) {
360
+ const s = F[e], o = Je(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 {
@@ -392,9 +392,9 @@ async function en(n) {
392
392
  r.fill(0), i.fill(0);
393
393
  }
394
394
  }
395
- if (t.length !== L.length)
395
+ if (t.length !== F.length)
396
396
  throw new Error(
397
- `Expected ${L.length} blocks, got ${t.length}`
397
+ `Expected ${F.length} blocks, got ${t.length}`
398
398
  );
399
399
  return t;
400
400
  } finally {
@@ -461,7 +461,7 @@ async function sn(n, t) {
461
461
  return { perVaultWotsKeys: e, wotsPkHashes: s, htlcSecretHexes: o, hashlocks: r };
462
462
  }
463
463
  const on = /^0x[0-9a-f]+$/i, rn = /^[0-9a-f]+$/i, an = /^[A-Za-z0-9+/]+={0,2}$/;
464
- function R(n) {
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();
@@ -502,7 +502,7 @@ async function ln(n, t, e) {
502
502
  }
503
503
  return s;
504
504
  }
505
- const Dt = 0, W = 25, rt = 9999, F = "00".repeat(32);
505
+ const Dt = 0, L = 25, rt = 9999, W = "00".repeat(32);
506
506
  function un(n, t) {
507
507
  const e = {
508
508
  bitcoin: "bc",
@@ -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 Rn {
530
+ class $n {
531
531
  /**
532
532
  * Creates a new PeginManager instance.
533
533
  *
@@ -549,8 +549,8 @@ class Rn {
549
549
  async preparePegin(t) {
550
550
  if (t.amounts.length === 0)
551
551
  throw new Error("amounts must contain at least one entry");
552
- const e = await this.config.btcWallet.getPublicKeyHex(), s = R(e);
553
- if (!wt(
552
+ const e = await this.config.btcWallet.getPublicKeyHex(), s = $(e);
553
+ if (!Pt(
554
554
  t.changeAddress,
555
555
  e,
556
556
  this.config.btcNetwork
@@ -578,10 +578,10 @@ class Rn {
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: w } = u, g = await this.preparePeginCommit({
581
+ const u = await sn(i, t.amounts.length), { perVaultWotsKeys: l, wotsPkHashes: m, htlcSecretHexes: b, hashlocks: P } = u, g = await this.preparePeginCommit({
582
582
  depositorBtcPubkeyRaw: e,
583
583
  depositorBtcPubkey: s,
584
- hashlocks: w,
584
+ hashlocks: P,
585
585
  authAnchorHash: c,
586
586
  sizing: o,
587
587
  params: t
@@ -629,7 +629,7 @@ class Rn {
629
629
  */
630
630
  async prepareSizing(t, e) {
631
631
  const s = e.amounts.map(
632
- () => F
632
+ () => W
633
633
  ), o = e.vaultKeeperBtcPubkeys.length, r = await mt({
634
634
  depositorPubkey: t,
635
635
  vaultProviderPubkey: T(e.vaultProviderBtcPubkey),
@@ -639,18 +639,19 @@ class Rn {
639
639
  timelockRefund: e.timelockRefund,
640
640
  pegInAmounts: e.amounts,
641
641
  feeRate: e.protocolFeeRate,
642
+ minPeginFeeRate: e.minPeginFeeRate,
642
643
  numLocalChallengers: o,
643
644
  councilQuorum: e.councilQuorum,
644
645
  councilSize: e.councilSize,
645
646
  network: this.config.btcNetwork,
646
- authAnchorHash: F
647
+ authAnchorHash: W
647
648
  }), i = de(
648
649
  [...e.availableUTXOs],
649
650
  r.totalOutputValue,
650
651
  e.mempoolFeeRate,
651
652
  fe(
652
653
  r.htlcValues.length,
653
- F
654
+ W
654
655
  )
655
656
  );
656
657
  return {
@@ -668,7 +669,7 @@ class Rn {
668
669
  authAnchorHash: r,
669
670
  sizing: i,
670
671
  params: a
671
- } = t, c = F.toLowerCase();
672
+ } = t, c = W.toLowerCase();
672
673
  for (let d = 0; d < o.length; d++)
673
674
  if (o[d].toLowerCase() === c)
674
675
  throw new Error(
@@ -678,7 +679,7 @@ class Rn {
678
679
  throw new Error(
679
680
  "preparePeginCommit refusing to build with sizing-pass placeholder auth-anchor hash — internal substitution bug"
680
681
  );
681
- const u = T(a.vaultProviderBtcPubkey), l = a.vaultKeeperBtcPubkeys.map(T), m = a.universalChallengerBtcPubkeys.map(T), b = l.length, w = {
682
+ const u = T(a.vaultProviderBtcPubkey), l = a.vaultKeeperBtcPubkeys.map(T), m = a.universalChallengerBtcPubkeys.map(T), b = l.length, P = {
682
683
  depositorPubkey: s,
683
684
  vaultProviderPubkey: u,
684
685
  vaultKeeperPubkeys: l,
@@ -687,21 +688,22 @@ class Rn {
687
688
  timelockRefund: a.timelockRefund,
688
689
  pegInAmounts: a.amounts,
689
690
  feeRate: a.protocolFeeRate,
691
+ minPeginFeeRate: a.minPeginFeeRate,
690
692
  numLocalChallengers: b,
691
693
  councilQuorum: a.councilQuorum,
692
694
  councilSize: a.councilSize,
693
695
  network: this.config.btcNetwork,
694
696
  authAnchorHash: r
695
- }, g = await mt(w), f = Pt(this.config.btcNetwork), k = pe({
697
+ }, g = await mt(P), f = wt(this.config.btcNetwork), k = pe({
696
698
  unfundedTxHex: g.psbtHex,
697
699
  selectedUTXOs: i.selectedUTXOs,
698
700
  changeAddress: a.changeAddress,
699
701
  changeAmount: i.changeAmount,
700
702
  network: f
701
- }), S = T(z(k)), E = [], p = [], P = [];
703
+ }), S = T(z(k)), E = [], p = [], w = [];
702
704
  for (let d = 0; d < o.length; d++) {
703
705
  const B = await se({
704
- prePeginParams: w,
706
+ prePeginParams: P,
705
707
  timelockPegin: a.timelockPegin,
706
708
  fundedPrePeginTxHex: k,
707
709
  htlcVout: d
@@ -716,14 +718,14 @@ class Rn {
716
718
  timelockRefund: a.timelockRefund,
717
719
  network: this.config.btcNetwork
718
720
  });
719
- E.push(B), p.push(A.psbtHex), P.push(
721
+ E.push(B), p.push(A.psbtHex), w.push(
720
722
  le(e, 1)
721
723
  );
722
724
  }
723
725
  const y = await ln(
724
726
  this.config.btcWallet,
725
727
  p,
726
- P
728
+ w
727
729
  ), h = [];
728
730
  for (let d = 0; d < y.length; d++) {
729
731
  bt({
@@ -771,34 +773,34 @@ class Rn {
771
773
  const i = new gt();
772
774
  i.setVersion(r.version), i.setLocktime(r.locktime);
773
775
  const a = J.from(
774
- R(s),
776
+ $(s),
775
777
  "hex"
776
778
  ), c = this.config.mempoolApiUrl, u = r.ins.map((p) => {
777
- const P = J.from(p.hash).reverse().toString("hex"), y = p.index;
778
- return hn(P, y, t.localPrevouts, c).then(
779
- (h) => ({ input: p, utxoData: h, txid: P, vout: y })
779
+ const w = J.from(p.hash).reverse().toString("hex"), y = p.index;
780
+ return hn(w, y, t.localPrevouts, c).then(
781
+ (h) => ({ input: p, utxoData: h, txid: w, vout: y })
780
782
  );
781
783
  }), l = await Promise.all(u), m = l.reduce(
782
- (p, P) => p + BigInt(P.utxoData.value),
784
+ (p, w) => p + BigInt(w.utxoData.value),
783
785
  0n
784
786
  ), b = r.outs.reduce(
785
- (p, P) => p + BigInt(P.value),
787
+ (p, w) => p + BigInt(w.value),
786
788
  0n
787
789
  );
788
790
  if (m < b)
789
791
  throw new Error(
790
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.`
791
793
  );
792
- const w = m - b;
793
- if (w > yt)
794
+ const P = m - b;
795
+ if (P > yt)
794
796
  throw new Error(
795
- `Implied transaction fee (${w} sat) exceeds maximum reasonable fee (${yt} sat). This may indicate manipulated UTXO data.`
797
+ `Implied transaction fee (${P} sat) exceeds maximum reasonable fee (${yt} sat). This may indicate manipulated UTXO data.`
796
798
  );
797
- for (const { input: p, utxoData: P, txid: y, vout: h } of l) {
799
+ for (const { input: p, utxoData: w, txid: y, vout: h } of l) {
798
800
  const d = ge(
799
801
  {
800
- value: P.value,
801
- scriptPubKey: P.scriptPubKey
802
+ value: w.value,
803
+ scriptPubKey: w.scriptPubKey
802
804
  },
803
805
  a
804
806
  );
@@ -875,16 +877,16 @@ class Rn {
875
877
  throw new Error(
876
878
  `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.`
877
879
  );
878
- const m = await this.assertPopMatchesBtcWallet(u), b = u.btcPopSignature, w = v(u.depositorBtcPubkey), g = v(e), f = v(s), k = a ?? await this.config.btcWallet.getAddress(), S = this.resolvePayoutScriptPubKey(
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(
879
881
  m,
880
882
  k
881
883
  ), E = z(f), p = await pt(
882
884
  T(E),
883
885
  T(l)
884
- ), P = v(p);
885
- if (await this.checkVaultExists(P))
886
+ ), w = v(p);
887
+ if (await this.checkVaultExists(w))
886
888
  throw new Error(
887
- `Vault already exists (ID: ${P}, peginTxHash: ${E}). Vault IDs are derived from the pegin transaction hash and depositor address. To create a new vault, use different UTXOs or a different amount to generate a unique transaction.`
889
+ `Vault already exists (ID: ${w}, peginTxHash: ${E}). Vault IDs are derived from the pegin transaction hash and depositor address. To create a new vault, use different UTXOs or a different amount to generate a unique transaction.`
888
890
  );
889
891
  const h = this.config.publicClient;
890
892
  let d;
@@ -909,7 +911,7 @@ class Rn {
909
911
  functionName: "submitPeginRequest",
910
912
  args: [
911
913
  l,
912
- w,
914
+ P,
913
915
  b,
914
916
  g,
915
917
  f,
@@ -957,7 +959,7 @@ class Rn {
957
959
  )
958
960
  ), {
959
961
  ethTxHash: q.transactionHash,
960
- vaultId: P,
962
+ vaultId: w,
961
963
  peginTxHash: E
962
964
  };
963
965
  }
@@ -1016,7 +1018,7 @@ class Rn {
1016
1018
  { cause: h }
1017
1019
  );
1018
1020
  }
1019
- const w = b * BigInt(o.length), g = await this.resolveMaxAcceptableCommissionBps(
1021
+ const P = b * BigInt(o.length), g = await this.resolveMaxAcceptableCommissionBps(
1020
1022
  e,
1021
1023
  t.quotedCommissionBps
1022
1024
  ), f = v(
@@ -1048,18 +1050,18 @@ class Rn {
1048
1050
  p = await m.estimateGas({
1049
1051
  to: this.config.vaultContracts.btcVaultRegistry,
1050
1052
  data: E,
1051
- value: w,
1053
+ value: P,
1052
1054
  account: this.config.ethWallet.account.address
1053
1055
  });
1054
1056
  } catch (h) {
1055
1057
  H(h);
1056
1058
  }
1057
- let P;
1059
+ let w;
1058
1060
  try {
1059
- P = await this.config.ethWallet.sendTransaction({
1061
+ w = await this.config.ethWallet.sendTransaction({
1060
1062
  to: this.config.vaultContracts.btcVaultRegistry,
1061
1063
  data: E,
1062
- value: w,
1064
+ value: P,
1063
1065
  account: this.config.ethWallet.account,
1064
1066
  chain: this.config.ethChain,
1065
1067
  gas: p
@@ -1070,7 +1072,7 @@ class Rn {
1070
1072
  const y = await xt({
1071
1073
  publicClient: m,
1072
1074
  walletAddress: this.config.ethWallet.account.address,
1073
- hash: P,
1075
+ hash: w,
1074
1076
  timeout: At
1075
1077
  });
1076
1078
  return y.status === "reverted" && H(
@@ -1100,17 +1102,17 @@ class Rn {
1100
1102
  );
1101
1103
  }
1102
1104
  if (e !== void 0) {
1103
- if (s > e + W)
1105
+ if (s > e + L)
1104
1106
  throw new Error(
1105
- `Vault provider commission changed since quote: quoted ${e} bps, chain currently reports ${s} bps (allowed drift ${W} bps). Please refresh to see the new commission and try again.`
1107
+ `Vault provider commission changed since quote: quoted ${e} bps, chain currently reports ${s} bps (allowed drift ${L} bps). Please refresh to see the new commission and try again.`
1106
1108
  );
1107
1109
  return Math.min(
1108
- e + W,
1110
+ e + L,
1109
1111
  rt
1110
1112
  );
1111
1113
  }
1112
1114
  return Math.min(
1113
- s + W,
1115
+ s + L,
1114
1116
  rt
1115
1117
  );
1116
1118
  }
@@ -1152,7 +1154,7 @@ class Rn {
1152
1154
  * on-chain payout-script registration.
1153
1155
  */
1154
1156
  resolvePayoutScriptPubKey(t, e) {
1155
- if (!wt(
1157
+ if (!Pt(
1156
1158
  e,
1157
1159
  t,
1158
1160
  this.config.btcNetwork
@@ -1162,7 +1164,7 @@ class Rn {
1162
1164
  ) : new Error(
1163
1165
  `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.`
1164
1166
  );
1165
- const s = Pt(this.config.btcNetwork);
1167
+ const s = wt(this.config.btcNetwork);
1166
1168
  try {
1167
1169
  return `0x${Ct.address.toOutputScript(e, s).toString("hex")}`;
1168
1170
  } catch {
@@ -1180,7 +1182,7 @@ class Rn {
1180
1182
  async signProofOfPossession() {
1181
1183
  if (!this.config.ethWallet.account)
1182
1184
  throw new Error("Ethereum wallet account not found");
1183
- const t = this.config.ethWallet.account.address, e = R(
1185
+ const t = this.config.ethWallet.account.address, e = $(
1184
1186
  await this.config.btcWallet.getPublicKeyHex()
1185
1187
  ), s = this.config.vaultContracts.btcVaultRegistry, o = `${t.toLowerCase()}:${this.config.ethChain.id}:pegin:${s.toLowerCase()}`, r = await this.config.btcWallet.signMessage(
1186
1188
  o,
@@ -1201,7 +1203,7 @@ class Rn {
1201
1203
  * substitute the opposite-parity P2WPKH address.
1202
1204
  */
1203
1205
  async assertPopMatchesBtcWallet(t) {
1204
- const e = await this.config.btcWallet.getPublicKeyHex(), s = R(e), o = R(t.depositorBtcPubkey);
1206
+ const e = await this.config.btcWallet.getPublicKeyHex(), s = $(e), o = $(t.depositorBtcPubkey);
1205
1207
  if (s !== o)
1206
1208
  throw new Error(
1207
1209
  `Proof of possession was signed with BTC pubkey ${o} but the BTC wallet is currently connected to ${s}. Reconnect the original wallet or call signProofOfPossession() again.`
@@ -1279,7 +1281,7 @@ async function Un(n) {
1279
1281
  });
1280
1282
  }
1281
1283
  export {
1282
- Rn as P,
1284
+ $n as P,
1283
1285
  Se as V,
1284
1286
  ve as a,
1285
1287
  Be as b,
@@ -1288,4 +1290,4 @@ export {
1288
1290
  Un as e,
1289
1291
  Ie as f
1290
1292
  };
1291
- //# sourceMappingURL=PeginManager-DXrfY4d6.js.map
1293
+ //# sourceMappingURL=PeginManager-B1qjHs90.js.map