@babylonlabs-io/ts-sdk 2.0.2 → 3.0.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 (45) hide show
  1. package/dist/PeginManager-CKf7Bjmj.js.map +1 -1
  2. package/dist/PeginManager-Dt2Z5ljw.cjs.map +1 -1
  3. package/dist/buildAndBroadcastReclaim-BDc-SK9i.cjs +2 -0
  4. package/dist/buildAndBroadcastReclaim-BDc-SK9i.cjs.map +1 -0
  5. package/dist/{buildAndBroadcastReclaim-B19cyK69.js → buildAndBroadcastReclaim-T5ZFPUpM.js} +284 -301
  6. package/dist/buildAndBroadcastReclaim-T5ZFPUpM.js.map +1 -0
  7. package/dist/{index-Bnavi_r3.js → index-B6w5MM-8.js} +91 -84
  8. package/dist/index-B6w5MM-8.js.map +1 -0
  9. package/dist/index-EHLYplSd.cjs +2 -0
  10. package/dist/index-EHLYplSd.cjs.map +1 -0
  11. package/dist/index.cjs +1 -1
  12. package/dist/index.js +90 -90
  13. package/dist/{primeVpAuth-PiUJksAq.js → primeVpAuth-Bdy_B_Sq.js} +3 -3
  14. package/dist/{primeVpAuth-PiUJksAq.js.map → primeVpAuth-Bdy_B_Sq.js.map} +1 -1
  15. package/dist/primeVpAuth-CQRsu6VB.cjs +2 -0
  16. package/dist/{primeVpAuth-D21PXgg2.cjs.map → primeVpAuth-CQRsu6VB.cjs.map} +1 -1
  17. package/dist/{json-rpc-client-DbpFfa_o.cjs → state-DMFlvLL3.cjs} +2 -2
  18. package/dist/state-DMFlvLL3.cjs.map +1 -0
  19. package/dist/{json-rpc-client-CQLbpuKK.js → state-mE-QfITd.js} +76 -55
  20. package/dist/state-mE-QfITd.js.map +1 -0
  21. package/dist/tbv/core/clients/index.cjs +1 -1
  22. package/dist/tbv/core/clients/index.js +3 -3
  23. package/dist/tbv/core/clients/vault-provider/api.d.ts +2 -1
  24. package/dist/tbv/core/clients/vault-provider/api.d.ts.map +1 -1
  25. package/dist/tbv/core/clients/vault-provider/status/index.cjs +1 -1
  26. package/dist/tbv/core/clients/vault-provider/status/index.js +2 -2
  27. package/dist/tbv/core/index.cjs +1 -1
  28. package/dist/tbv/core/index.js +104 -104
  29. package/dist/tbv/core/services/index.cjs +1 -1
  30. package/dist/tbv/core/services/index.js +75 -74
  31. package/dist/tbv/core/services/index.js.map +1 -1
  32. package/dist/tbv/core/services/pegout/state.d.ts +8 -3
  33. package/dist/tbv/core/services/pegout/state.d.ts.map +1 -1
  34. package/dist/tbv/index.cjs +1 -1
  35. package/dist/tbv/index.js +104 -104
  36. package/package.json +1 -1
  37. package/dist/buildAndBroadcastReclaim-B19cyK69.js.map +0 -1
  38. package/dist/buildAndBroadcastReclaim-DcbsjJdf.cjs +0 -2
  39. package/dist/buildAndBroadcastReclaim-DcbsjJdf.cjs.map +0 -1
  40. package/dist/index-Bnavi_r3.js.map +0 -1
  41. package/dist/index-CcdCNFLM.cjs +0 -2
  42. package/dist/index-CcdCNFLM.cjs.map +0 -1
  43. package/dist/json-rpc-client-CQLbpuKK.js.map +0 -1
  44. package/dist/json-rpc-client-DbpFfa_o.cjs.map +0 -1
  45. package/dist/primeVpAuth-D21PXgg2.cjs +0 -2
@@ -1,55 +1,55 @@
1
- var it = Object.defineProperty;
2
- var ut = (e, t, r) => t in e ? it(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var O = (e, t, r) => ut(e, typeof t != "symbol" ? t + "" : t, r);
1
+ var at = Object.defineProperty;
2
+ var it = (e, t, r) => t in e ? at(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var O = (e, t, r) => it(e, typeof t != "symbol" ? t + "" : t, r);
4
4
  import { B as Ne } from "./BTCVaultRegistry.abi-B0x9_Bza.js";
5
- import { e as He, s as f, i as ct, c as $, v as lt, u as Ke, p as j, f as V } from "./bitcoin-C-TuHb-v.js";
6
- import { v as ht, d as De, s as pt, P as dt, a as gt } from "./PayoutManager-BSwbUQeF.js";
5
+ import { e as He, s as f, i as ut, c as $, v as ct, u as Ke, p as j, f as V } from "./bitcoin-C-TuHb-v.js";
6
+ import { v as lt, d as De, s as ht, P as pt, a as dt } from "./PayoutManager-BSwbUQeF.js";
7
7
  import { Buffer as I } from "buffer";
8
- import { b as ft, a as M, c as yt } from "./signing-Dhr2t0Z6.js";
9
- import { buildClaimPsbt as bt, buildAssertClaimerPsbt as mt, buildPayoutClaimerPsbt as Pt, buildWronglyChallengedPsbts as vt, buildPayoutDepositorPsbt as wt, finalizeClaimTx as xt, buildWatchtowerArtifacts as Et, extractTapScriptSig as kt, expandWotsSeed as _t, wotsKeypairFromSeed as Tt, validateWotsKeypairAgainstGraph as $t, verifyWatchtowerArtifacts as At, deriveVaultId as Ct } from "./tbv/core/wasm/index.js";
10
- import { p as Me, P as le, f as St, i as F, g as U, j as L } from "./verifyScriptPathSchnorrSignature-CpjSTfMj.js";
8
+ import { b as gt, a as M, c as ft } from "./signing-Dhr2t0Z6.js";
9
+ import { buildClaimPsbt as yt, buildAssertClaimerPsbt as bt, buildPayoutClaimerPsbt as mt, buildWronglyChallengedPsbts as Pt, buildPayoutDepositorPsbt as vt, finalizeClaimTx as wt, buildWatchtowerArtifacts as xt, extractTapScriptSig as Et, expandWotsSeed as kt, wotsKeypairFromSeed as _t, validateWotsKeypairAgainstGraph as Tt, verifyWatchtowerArtifacts as $t, deriveVaultId as Ct } from "./tbv/core/wasm/index.js";
10
+ import { p as Me, P as le, f as At, i as F, g as U, j as L } from "./verifyScriptPathSchnorrSignature-CpjSTfMj.js";
11
11
  import { Psbt as Fe, Transaction as B } from "bitcoinjs-lib";
12
12
  import { m as he, n as pe, N as q, o as de, D as ge } from "./constants-D5vORbQE.js";
13
- import { d as It } from "./deriveVaultRoot-BcvmER1E.js";
14
- import { d as Rt, a as fe } from "./onChainBtcPubkey-CCTdl53s.js";
15
- import { zeroAddress as Bt, isAddress as Vt, isAddressEqual as Ot } from "viem";
16
- import { D as R, c as Nt, b as Ht, R as Kt, d as Ue } from "./json-rpc-client-CQLbpuKK.js";
17
- import { h as ye, b as Dt, s as Mt, j as Ft } from "./sha2-YqVHJiFj.js";
18
- import { d as Ut, c as Lt, b as Gt, f as Le, e as Xt, a as jt } from "./noPayout-qBXWKwav.js";
19
- import { a as qt } from "./secp256k1-D-H9jmd7.js";
20
- const zt = /^0x[0-9a-fA-F]{64}$/, Wt = /^0x[0-9a-fA-F]{40}$/, Yt = /^0x([0-9a-fA-F]{2})*$/;
13
+ import { d as St } from "./deriveVaultRoot-BcvmER1E.js";
14
+ import { d as It, a as fe } from "./onChainBtcPubkey-CCTdl53s.js";
15
+ import { zeroAddress as Rt, isAddress as Bt, isAddressEqual as Vt } from "viem";
16
+ import { D as R, c as Ot, b as Nt, R as Ht, d as Ue } from "./state-mE-QfITd.js";
17
+ import { h as ye, b as Kt, s as Dt, j as Mt } from "./sha2-YqVHJiFj.js";
18
+ import { d as Ft, c as Ut, b as Lt, f as Le, e as Gt, a as Xt } from "./noPayout-qBXWKwav.js";
19
+ import { a as jt } from "./secp256k1-D-H9jmd7.js";
20
+ const qt = /^0x[0-9a-fA-F]{64}$/, zt = /^0x[0-9a-fA-F]{40}$/, Wt = /^0x([0-9a-fA-F]{2})*$/;
21
21
  function z(e, t) {
22
22
  if (e.length !== 66)
23
23
  throw new Error(
24
24
  `${t} must be 32 bytes (66 hex chars with 0x prefix), got length ${e.length}`
25
25
  );
26
- if (!zt.test(e))
26
+ if (!qt.test(e))
27
27
  throw new Error(
28
28
  `${t} must contain only hex characters after the 0x prefix`
29
29
  );
30
30
  }
31
- function Qt(e, t) {
32
- if (!Wt.test(e))
31
+ function Yt(e, t) {
32
+ if (!zt.test(e))
33
33
  throw new Error(
34
34
  `${t} must be a 20-byte 0x-prefixed hex address (42 chars)`
35
35
  );
36
36
  }
37
- function Jt(e, t) {
38
- if (!Yt.test(e))
37
+ function Qt(e, t) {
38
+ if (!Wt.test(e))
39
39
  throw new Error(
40
40
  `${t} must be a 0x-prefixed hex string with an even number of hex chars`
41
41
  );
42
42
  }
43
43
  function Ge(e) {
44
- Qt(e.btcVaultRegistryAddress, "btcVaultRegistryAddress"), z(e.vaultId, "vaultId");
44
+ Yt(e.btcVaultRegistryAddress, "btcVaultRegistryAddress"), z(e.vaultId, "vaultId");
45
45
  const t = He(e.secret);
46
- if (z(t, "secret"), e.hashlock !== void 0 && (z(e.hashlock, "hashlock"), !ht(t, e.hashlock)))
46
+ if (z(t, "secret"), e.hashlock !== void 0 && (z(e.hashlock, "hashlock"), !lt(t, e.hashlock)))
47
47
  throw new Error(
48
48
  "Invalid secret: SHA256(secret) does not match the provided hashlock"
49
49
  );
50
50
  return t;
51
51
  }
52
- async function Oo(e) {
52
+ async function Bo(e) {
53
53
  const {
54
54
  btcVaultRegistryAddress: t,
55
55
  vaultId: r,
@@ -65,14 +65,14 @@ async function Oo(e) {
65
65
  secret: e.secret,
66
66
  hashlock: o
67
67
  });
68
- return Jt(n, "activationMetadata"), a({
68
+ return Qt(n, "activationMetadata"), a({
69
69
  address: t,
70
70
  abi: Ne,
71
71
  functionName: "activateVaultWithSecret",
72
72
  args: [r, i, n]
73
73
  });
74
74
  }
75
- async function No(e) {
75
+ async function Vo(e) {
76
76
  const { btcVaultRegistryAddress: t, vaultId: r, hashlock: o, writeContract: n, signal: a } = e;
77
77
  a == null || a.throwIfAborted();
78
78
  const s = Ge({
@@ -88,14 +88,14 @@ async function No(e) {
88
88
  args: [r, s]
89
89
  });
90
90
  }
91
- class Zt extends Error {
91
+ class Jt extends Error {
92
92
  constructor(t, r) {
93
93
  super(
94
94
  "Transaction graph's challenger set does not match the vault's (local ∪ universal)" + (t.length > 0 ? ` (missing: ${t.join(", ")})` : "") + (r.length > 0 ? ` (unexpected: ${r.join(", ")})` : "") + ". Refusing to sign an incomplete or padded challenger set."
95
95
  ), this.missing = t, this.unexpected = r, this.name = "ChallengerSetMismatchError";
96
96
  }
97
97
  }
98
- function er(e) {
98
+ function Zt(e) {
99
99
  const t = Me({
100
100
  claimerBtcPubkey: e.depositorBtcPubkey,
101
101
  depositorBtcPubkey: e.depositorBtcPubkey,
@@ -113,27 +113,27 @@ function er(e) {
113
113
  );
114
114
  const s = [...t, ...r], i = new Set(s), u = s.filter((h) => !a.has(h)), c = n.filter((h) => !i.has(h));
115
115
  if (u.length > 0 || c.length > 0)
116
- throw new Zt(u, c);
116
+ throw new Jt(u, c);
117
117
  }
118
118
  function be(e) {
119
119
  return f(e).toLowerCase();
120
120
  }
121
121
  const Xe = 0;
122
- class tr extends Error {
122
+ class er extends Error {
123
123
  constructor(t, r) {
124
124
  super(
125
125
  `Payout transaction output ${Xe} pays ${r}, not the vault's registered payout script ${t}. Refusing to sign a payout to another destination.`
126
126
  ), this.expectedScriptHex = t, this.actualScriptHex = r, this.name = "PayoutDestinationError";
127
127
  }
128
128
  }
129
- function rr(e) {
129
+ function tr(e) {
130
130
  let t;
131
131
  try {
132
132
  t = Fe.fromBase64(e.payoutPsbtBase64);
133
133
  } catch (u) {
134
134
  throw new Error("Payout PSBT cannot be parsed.", { cause: u });
135
135
  }
136
- const { version: r, locktime: o, outs: n } = or(t);
136
+ const { version: r, locktime: o, outs: n } = rr(t);
137
137
  if (r !== he || o !== pe)
138
138
  throw new Error(
139
139
  `Payout transaction has version ${r} and locktime ${o}, expected ${he} and ${pe}.`
@@ -151,14 +151,14 @@ function rr(e) {
151
151
  );
152
152
  const s = n[Xe].script.toString("hex").toLowerCase();
153
153
  if (!I.from(s, "hex").equals(I.from(a, "hex")))
154
- throw new tr(a, s);
154
+ throw new er(a, s);
155
155
  const i = n[q - 1];
156
156
  if (i.value !== de)
157
157
  throw new Error(
158
158
  `Payout CPFP anchor value ${i.value} sats must equal ${de} sats.`
159
159
  );
160
160
  }
161
- function or(e) {
161
+ function rr(e) {
162
162
  return {
163
163
  version: e.version,
164
164
  locktime: e.locktime,
@@ -169,14 +169,14 @@ function or(e) {
169
169
  };
170
170
  }
171
171
  const je = 0;
172
- class nr extends Error {
172
+ class or extends Error {
173
173
  constructor(t, r, o) {
174
174
  super(
175
175
  `Transaction graph does not belong to vault ${t}: its Claim spends PegIn ${o}, which derives vault ${r}. Refusing to sign for a graph served for another vault.`
176
176
  ), this.expectedVaultId = t, this.derivedVaultId = r, this.peginTxid = o, this.name = "VaultIdBindingError";
177
177
  }
178
178
  }
179
- function sr(e) {
179
+ function nr(e) {
180
180
  let t;
181
181
  try {
182
182
  t = Fe.fromBase64(e);
@@ -188,7 +188,7 @@ function sr(e) {
188
188
  throw new Error("Claim PSBT carries no PegIn input to bind the vault to.");
189
189
  return ze(r.hash);
190
190
  }
191
- function ar(e) {
191
+ function sr(e) {
192
192
  const t = e.ins[je];
193
193
  if (!t)
194
194
  throw new Error(
@@ -198,10 +198,10 @@ function ar(e) {
198
198
  }
199
199
  function qe(e) {
200
200
  const t = G(
201
- Rt(e.peginTxid, e.depositorEthAddress)
201
+ It(e.peginTxid, e.depositorEthAddress)
202
202
  ), r = G(e.expectedVaultId);
203
203
  if (t !== r)
204
- throw new nr(r, t, e.peginTxid);
204
+ throw new or(r, t, e.peginTxid);
205
205
  }
206
206
  function G(e) {
207
207
  return `0x${(e.startsWith("0x") ? e.slice(2) : e).toLowerCase()}`;
@@ -209,29 +209,29 @@ function G(e) {
209
209
  function ze(e) {
210
210
  return I.from(e).reverse().toString("hex");
211
211
  }
212
- const ir = 0, ur = 0, cr = 1, lr = 0, hr = 0;
213
- async function Ho(e) {
212
+ const ar = 0, ir = 0, ur = 1, cr = 0, lr = 0;
213
+ async function Oo(e) {
214
214
  const { txGraphVersion: t } = e.vault, r = e.source.txGraphJson, [o, n, a, s] = await Promise.all([
215
+ yt(t, r),
215
216
  bt(t, r),
216
217
  mt(t, r),
217
- Pt(t, r),
218
- vt(t, r)
218
+ Pt(t, r)
219
219
  ]);
220
220
  qe({
221
- peginTxid: sr(o),
221
+ peginTxid: nr(o),
222
222
  depositorEthAddress: e.vault.depositorEthAddress,
223
223
  expectedVaultId: e.vault.vaultId
224
224
  });
225
- const i = await wt(
225
+ const i = await vt(
226
226
  t,
227
227
  r
228
228
  );
229
229
  for (const x of [a, i])
230
- rr({
230
+ tr({
231
231
  payoutPsbtBase64: x,
232
232
  registeredPayoutScriptPubKey: e.vault.registeredPayoutScriptPubKey
233
233
  });
234
- er({
234
+ Zt({
235
235
  graphChallengerPubkeys: Object.keys(s),
236
236
  depositorBtcPubkey: e.depositorPublicKey,
237
237
  vaultProviderBtcPubkey: e.vault.vaultProviderBtcPubkey,
@@ -239,18 +239,18 @@ async function Ho(e) {
239
239
  universalChallengerBtcPubkeys: e.vault.universalChallengerBtcPubkeys
240
240
  });
241
241
  const u = [
242
- { psbtBase64: o, inputIndex: ir },
243
- { psbtBase64: n, inputIndex: ur },
244
- { psbtBase64: a, inputIndex: cr },
242
+ { psbtBase64: o, inputIndex: ar },
243
+ { psbtBase64: n, inputIndex: ir },
244
+ { psbtBase64: a, inputIndex: ur },
245
245
  {
246
246
  psbtBase64: i,
247
- inputIndex: lr
247
+ inputIndex: cr
248
248
  }
249
249
  ], c = Object.keys(s);
250
250
  for (const x of c)
251
251
  for (const w of s[x])
252
- u.push({ psbtBase64: w, inputIndex: hr });
253
- const h = await dr(
252
+ u.push({ psbtBase64: w, inputIndex: lr });
253
+ const h = await pr(
254
254
  e.btcWallet,
255
255
  e.depositorPublicKey,
256
256
  e.btcNetwork,
@@ -265,12 +265,12 @@ async function Ho(e) {
265
265
  l + w
266
266
  ), l += w;
267
267
  }
268
- const m = await xt(
268
+ const m = await wt(
269
269
  t,
270
270
  r,
271
271
  p
272
272
  );
273
- return Et({
273
+ return xt({
274
274
  txGraphVersion: t,
275
275
  graphJson: r,
276
276
  signedClaimTxHex: m,
@@ -294,29 +294,29 @@ function me(e) {
294
294
  `Public key must be 33-byte compressed or 32-byte x-only hex, got ${t.length / 2} bytes.`
295
295
  );
296
296
  }
297
- async function pr(e, t, r) {
297
+ async function hr(e, t, r) {
298
298
  const o = await e.getPublicKeyHex();
299
299
  if (me(o) !== me(t))
300
300
  throw new Error(
301
301
  "Connected wallet does not hold the vault's depositor key. Select the account that made the deposit, then try again."
302
302
  );
303
303
  const n = await e.getAddress();
304
- if (!ct(n, t, r))
304
+ if (!ut(n, t, r))
305
305
  throw new Error(
306
306
  `Connected wallet reports address "${n}", which is not derived from the vault's depositor key. Select the account that made the deposit, then try again.`
307
307
  );
308
308
  return n;
309
309
  }
310
- async function dr(e, t, r, o) {
311
- const n = await pr(
310
+ async function pr(e, t, r, o) {
311
+ const n = await hr(
312
312
  e,
313
313
  t,
314
314
  r
315
315
  ), a = await De(
316
316
  e,
317
- o.map((s) => gr(s.psbtBase64)),
317
+ o.map((s) => dr(s.psbtBase64)),
318
318
  o.map(
319
- (s) => ft(
319
+ (s) => gt(
320
320
  t,
321
321
  s.inputIndex,
322
322
  n
@@ -325,31 +325,31 @@ async function dr(e, t, r, o) {
325
325
  );
326
326
  return Promise.all(
327
327
  a.map(
328
- (s, i) => kt(fr(s), o[i].inputIndex)
328
+ (s, i) => Et(gr(s), o[i].inputIndex)
329
329
  )
330
330
  );
331
331
  }
332
- function gr(e) {
332
+ function dr(e) {
333
333
  return I.from(e, "base64").toString("hex");
334
334
  }
335
- function fr(e) {
335
+ function gr(e) {
336
336
  return I.from(e, "hex").toString("base64");
337
337
  }
338
- async function Ko(e) {
339
- const t = await It(e.btcWallet, e.vaultContext);
338
+ async function No(e) {
339
+ const t = await St(e.btcWallet, e.vaultContext);
340
340
  let r;
341
341
  try {
342
- r = await _t(t, e.htlcVout);
342
+ r = await kt(t, e.htlcVout);
343
343
  } finally {
344
344
  t.fill(0);
345
345
  }
346
346
  let o;
347
347
  try {
348
- o = await Tt(r);
348
+ o = await _t(r);
349
349
  } finally {
350
350
  r.fill(0);
351
351
  }
352
- return yr(o.pk_hash, e.expectedWotsPkHash), await $t(
352
+ return fr(o.pk_hash, e.expectedWotsPkHash), await Tt(
353
353
  e.txGraphVersion,
354
354
  o.keypair,
355
355
  e.txGraphJson
@@ -358,7 +358,7 @@ async function Ko(e) {
358
358
  pkHash: o.pk_hash
359
359
  };
360
360
  }
361
- function yr(e, t) {
361
+ function fr(e, t) {
362
362
  if (D(e) !== D(t))
363
363
  throw new Error(
364
364
  `Derived WOTS public-key hash ${D(e)} does not match the vault's on-chain depositorWotsPkHash ${D(t)}. The wallet, the HTLC output index, or the derivation itself is not the one this vault was created with.`
@@ -367,22 +367,22 @@ function yr(e, t) {
367
367
  function D(e) {
368
368
  return `0x${(e.startsWith("0x") ? e.slice(2) : e).toLowerCase()}`;
369
369
  }
370
- const br = 3;
371
- class mr extends Error {
370
+ const yr = 3;
371
+ class br extends Error {
372
372
  constructor(t, r) {
373
373
  super(
374
374
  `Artifacts belong to vault ${r}, not ${t}. Select the artifacts file saved for this vault.`
375
375
  ), this.expectedVaultId = t, this.actualVaultId = r, this.name = "ArtifactsVaultMismatchError";
376
376
  }
377
377
  }
378
- function Pr(e) {
378
+ function mr(e) {
379
379
  let t;
380
380
  try {
381
381
  t = JSON.parse(e);
382
382
  } catch (s) {
383
383
  throw new Error("Artifacts file is not valid JSON.", { cause: s });
384
384
  }
385
- const r = Pe(t.vault_id, "vault_id"), o = vr(Pe(t.claim_tx, "claim_tx")), n = W(
385
+ const r = Pe(t.vault_id, "vault_id"), o = Pr(Pe(t.claim_tx, "claim_tx")), n = W(
386
386
  t.prover_circuit_version,
387
387
  "prover_circuit_version"
388
388
  ), a = t.claimable_event_block_number === void 0 ? 0n : BigInt(
@@ -395,24 +395,24 @@ function Pr(e) {
395
395
  vaultCoreVersion: t.vault_core_version === void 0 ? void 0 : W(t.vault_core_version, "vault_core_version"),
396
396
  vaultId: r,
397
397
  claimTxid: o.getId(),
398
- peginTxid: ar(o),
398
+ peginTxid: sr(o),
399
399
  proverCircuitVersion: n,
400
400
  claimableEventBlockNumber: a,
401
401
  babeSessionChallengerPubkeys: Object.keys(
402
- wr(t.babe_sessions, "babe_sessions")
402
+ vr(t.babe_sessions, "babe_sessions")
403
403
  )
404
404
  };
405
405
  }
406
- async function Do(e) {
407
- const t = Pr(e.artifactsJson), r = G(e.expectedVaultId), o = G(t.vaultId);
406
+ async function Ho(e) {
407
+ const t = mr(e.artifactsJson), r = G(e.expectedVaultId), o = G(t.vaultId);
408
408
  if (r !== o)
409
- throw new mr(r, o);
409
+ throw new br(r, o);
410
410
  qe({
411
411
  peginTxid: t.peginTxid,
412
412
  depositorEthAddress: e.depositorEthAddress,
413
413
  expectedVaultId: r
414
414
  });
415
- const n = e.txGraphVersion ?? br;
415
+ const n = e.txGraphVersion ?? yr;
416
416
  if (t.vaultCoreVersion !== void 0 && t.vaultCoreVersion !== n)
417
417
  throw new Error(
418
418
  `Artifacts record vault core version ${t.vaultCoreVersion}, but verification was asked for version ${n}.`
@@ -421,9 +421,9 @@ async function Do(e) {
421
421
  throw new Error(
422
422
  "Artifacts carry no claimable event block number. They were assembled before the Ethereum withdrawal was initiated; assemble them again."
423
423
  );
424
- return await At(n, e.artifactsJson), t;
424
+ return await $t(n, e.artifactsJson), t;
425
425
  }
426
- function vr(e) {
426
+ function Pr(e) {
427
427
  try {
428
428
  return B.fromHex(e);
429
429
  } catch (t) {
@@ -442,13 +442,13 @@ function W(e, t) {
442
442
  throw new Error(`Artifacts file is missing a usable "${t}".`);
443
443
  return e;
444
444
  }
445
- function wr(e, t) {
445
+ function vr(e, t) {
446
446
  if (e === void 0) return {};
447
447
  if (typeof e != "object" || e === null || Array.isArray(e))
448
448
  throw new Error(`Artifacts file is missing a usable "${t}".`);
449
449
  return e;
450
450
  }
451
- const xr = 8, Er = 6e3, kr = 10 * 6e4, _r = 10;
451
+ const wr = 8, xr = 6e3, Er = 10 * 6e4, kr = 10;
452
452
  class We extends Error {
453
453
  constructor(t) {
454
454
  super(t), this.name = "PeginRegistrationMissingError";
@@ -459,24 +459,24 @@ class Ye extends Error {
459
459
  super(t), this.name = "PeginRegistrationNotFinalError";
460
460
  }
461
461
  }
462
- function Tr(e) {
462
+ function _r(e) {
463
463
  return e instanceof We || e instanceof Error && e.name === "PeginRegistrationMissingError";
464
464
  }
465
- function Mo(e) {
465
+ function Ko(e) {
466
466
  return e instanceof Ye || e instanceof Error && e.name === "PeginRegistrationNotFinalError";
467
467
  }
468
468
  function ve(e) {
469
469
  const { currentBlock: t, createdAtBlock: r } = e, o = t - r + 1n;
470
470
  return o < 0n ? 0 : Number(o);
471
471
  }
472
- async function Fo(e) {
472
+ async function Do(e) {
473
473
  const {
474
474
  vaultRegistryReader: t,
475
475
  getBlockNumber: r,
476
476
  vaultIds: o,
477
- required: n = xr,
478
- pollIntervalMs: a = Er,
479
- timeoutMs: s = kr,
477
+ required: n = wr,
478
+ pollIntervalMs: a = xr,
479
+ timeoutMs: s = Er,
480
480
  signal: i,
481
481
  onProgress: u
482
482
  } = e;
@@ -499,10 +499,10 @@ async function Fo(e) {
499
499
  const d = await r(), g = await Promise.all(
500
500
  o.map((y) => t.getVaultBasicInfo(y))
501
501
  ), b = g.findIndex(
502
- (y) => y.depositor === Bt || y.createdAt === 0n
502
+ (y) => y.depositor === Rt || y.createdAt === 0n
503
503
  );
504
504
  if (b !== -1) {
505
- if (l += 1, !h && l > _r)
505
+ if (l += 1, !h && l > kr)
506
506
  throw new We(
507
507
  `Vault ${o[b]} is still not visible on-chain after ${l} reads — the registration does not exist.`
508
508
  );
@@ -526,7 +526,7 @@ async function Fo(e) {
526
526
  return { confirmations: m, basicInfo: y };
527
527
  }
528
528
  } catch (d) {
529
- if (Tr(d))
529
+ if (_r(d))
530
530
  throw d;
531
531
  console.warn(
532
532
  `Registration-depth read failed (retrying in ${a}ms): ` + (d instanceof Error ? d.message : String(d))
@@ -546,7 +546,7 @@ async function Fo(e) {
546
546
  });
547
547
  }
548
548
  }
549
- const $r = /^(?:[0-9a-f]{2})*$/, Ar = /^[0-9a-f]{64}$/, Cr = /^([0-9a-f]{64}):(0|[1-9][0-9]*)$/, Sr = -2147483648, Ir = 2147483647, Y = 4294967295, we = 2, xe = 2;
549
+ const Tr = /^(?:[0-9a-f]{2})*$/, $r = /^[0-9a-f]{64}$/, Cr = /^([0-9a-f]{64}):(0|[1-9][0-9]*)$/, Ar = -2147483648, Sr = 2147483647, Y = 4294967295, we = 2, xe = 2;
550
550
  class v extends Error {
551
551
  constructor(t) {
552
552
  super(t), this.name = "GraphFingerprintError";
@@ -563,7 +563,7 @@ function K(e, t) {
563
563
  throw new v(`Graph tx ${t} is not an array`);
564
564
  return e;
565
565
  }
566
- function C(e, t) {
566
+ function A(e, t) {
567
567
  if (e === null || typeof e != "object" || Array.isArray(e))
568
568
  throw new v(`Graph tx ${t} is not an object`);
569
569
  return e;
@@ -576,33 +576,33 @@ function N(e, t, r, o) {
576
576
  return e;
577
577
  }
578
578
  function Q(e, t) {
579
- if (typeof e != "string" || !$r.test(e))
579
+ if (typeof e != "string" || !Tr.test(e))
580
580
  throw new v(
581
581
  `Graph tx ${t} is not lowercase hex without a prefix`
582
582
  );
583
583
  return I.from(e, "hex");
584
584
  }
585
585
  function X(e, t) {
586
- if (typeof e != "string" || !Ar.test(e))
586
+ if (typeof e != "string" || !$r.test(e))
587
587
  throw new v(
588
588
  `Graph ${t} is not 32 bytes of lowercase hex`
589
589
  );
590
590
  return e;
591
591
  }
592
592
  function Ee(e, t) {
593
- const r = C(e, t), o = new B();
593
+ const r = A(e, t), o = new B();
594
594
  return o.version = N(
595
595
  E(r, "version", t),
596
596
  `${t}.version`,
597
- Sr,
598
- Ir
597
+ Ar,
598
+ Sr
599
599
  ), o.locktime = N(
600
600
  E(r, "lock_time", t),
601
601
  `${t}.lock_time`,
602
602
  0,
603
603
  Y
604
604
  ), K(E(r, "input", t), `${t}.input`).forEach((n, a) => {
605
- const s = `${t}.input[${a}]`, i = C(n, s), u = E(i, "previous_output", s), c = typeof u == "string" && Cr.exec(u);
605
+ const s = `${t}.input[${a}]`, i = A(n, s), u = E(i, "previous_output", s), c = typeof u == "string" && Cr.exec(u);
606
606
  if (!c)
607
607
  throw new v(
608
608
  `Graph tx ${s}.previous_output is not "<txid>:<vout>"`
@@ -618,7 +618,7 @@ function Ee(e, t) {
618
618
  `${s}.witness`
619
619
  ).map((l, p) => Q(l, `${s}.witness[${p}]`));
620
620
  }), K(E(r, "output", t), `${t}.output`).forEach((n, a) => {
621
- const s = `${t}.output[${a}]`, i = C(n, s);
621
+ const s = `${t}.output[${a}]`, i = A(n, s);
622
622
  o.addOutput(
623
623
  Q(E(i, "script_pubkey", s), `${s}.script_pubkey`),
624
624
  N(E(i, "value", s), `${s}.value`, 0, Number.MAX_SAFE_INTEGER)
@@ -641,7 +641,7 @@ function H(e, t) {
641
641
  );
642
642
  return o;
643
643
  }
644
- function Rr(e, t) {
644
+ function Ir(e, t) {
645
645
  const [r, ...o] = e.ins;
646
646
  if (!r || o.length > 0)
647
647
  throw new v(
@@ -676,16 +676,16 @@ function Qe(e) {
676
676
  r.push(ye(a), o.nopayoutTx);
677
677
  for (const s of o.outputLabelHashes)
678
678
  r.push(ye(X(s, "output_label_hashes entry")));
679
- }), Dt(Mt(Ft(...r)));
679
+ }), Kt(Dt(Mt(...r)));
680
680
  }
681
- function Br(e) {
681
+ function Rr(e) {
682
682
  const t = f(e.peginTxid).toLowerCase(), r = H(e.peginTxHex, "pegin_tx");
683
683
  if (r.getId() !== t)
684
684
  throw new v(
685
685
  `Presign pegin_tx hashes to ${r.getId()}, expected ${t}`
686
686
  );
687
687
  const o = H(e.claimTxHex, "claim_tx");
688
- Rr(o, t);
688
+ Ir(o, t);
689
689
  const n = (a) => new Uint8Array(a.toBuffer());
690
690
  return Qe({
691
691
  peginTx: n(r),
@@ -701,8 +701,8 @@ function Br(e) {
701
701
  }))
702
702
  });
703
703
  }
704
- function Vr(e) {
705
- const t = (o) => Ee(C(E(e, o, "graph"), o).tx, o), r = C(
704
+ function Br(e) {
705
+ const t = (o) => Ee(A(E(e, o, "graph"), o).tx, o), r = A(
706
706
  E(e, "challenger_subgraphs", "graph"),
707
707
  "challenger_subgraphs"
708
708
  );
@@ -712,11 +712,11 @@ function Vr(e) {
712
712
  assertTx: t("assert_tx"),
713
713
  payoutTx: t("payout_tx"),
714
714
  challengers: Object.entries(r).map(([o, n]) => {
715
- const a = `challenger_subgraphs[${o}]`, s = C(n, a);
715
+ const a = `challenger_subgraphs[${o}]`, s = A(n, a);
716
716
  return {
717
717
  pubkey: o,
718
718
  nopayoutTx: Ee(
719
- C(E(s, "nopayout_tx", a), `${a}.nopayout_tx`).tx,
719
+ A(E(s, "nopayout_tx", a), `${a}.nopayout_tx`).tx,
720
720
  `${a}.nopayout_tx`
721
721
  ),
722
722
  outputLabelHashes: K(
@@ -729,8 +729,8 @@ function Vr(e) {
729
729
  })
730
730
  });
731
731
  }
732
- function Or(e) {
733
- const t = C(
732
+ function Vr(e) {
733
+ const t = A(
734
734
  E(e, "challenger_pubkeys", "graph"),
735
735
  "challenger_pubkeys"
736
736
  ), r = /* @__PURE__ */ new Set();
@@ -748,22 +748,22 @@ function Or(e) {
748
748
  });
749
749
  return r;
750
750
  }
751
- function Uo(e, t) {
752
- const r = Vr(e);
751
+ function Mo(e, t) {
752
+ const r = Br(e);
753
753
  if (r !== t)
754
754
  throw new v(
755
755
  `Graph fingerprint ${r} does not match the presign fingerprint ${t}`
756
756
  );
757
757
  const o = Object.keys(
758
- C(e.challenger_subgraphs, "challenger_subgraphs")
759
- ), n = Or(e);
758
+ A(e.challenger_subgraphs, "challenger_subgraphs")
759
+ ), n = Vr(e);
760
760
  if (o.length !== n.size || o.some((a) => !n.has(a)))
761
761
  throw new v(
762
762
  `Graph challenger_subgraphs keys ${o.join(", ")} do not match challenger_pubkeys ${[...n].join(", ")}`
763
763
  );
764
764
  }
765
- const Nr = 1;
766
- function Hr(e, t, r) {
765
+ const Or = 1;
766
+ function Nr(e, t, r) {
767
767
  const o = r.map(
768
768
  (l) => f(l).toLowerCase()
769
769
  ), n = t.filter((l) => o.includes(l));
@@ -784,7 +784,7 @@ function Hr(e, t, r) {
784
784
  "Depositor graph challenger set does not match expected (local ∪ universal)" + (c.length > 0 ? ` (missing: ${c.join(", ")})` : "") + (h.length > 0 ? ` (unexpected: ${h.join(", ")})` : "")
785
785
  );
786
786
  }
787
- function Kr(e, t) {
787
+ function Hr(e, t) {
788
788
  const r = e.ins[t];
789
789
  return Ke(new Uint8Array(r.hash).slice().reverse());
790
790
  }
@@ -794,25 +794,25 @@ function J(e, t, r, o, n) {
794
794
  throw new Error(
795
795
  `NoPayout (challenger ${n}) input ${t} expected to spend ${o} vout 0, got vout ${a.index}`
796
796
  );
797
- const s = r.getId(), i = Kr(e, t);
797
+ const s = r.getId(), i = Hr(e, t);
798
798
  if (i !== s)
799
799
  throw new Error(
800
800
  `NoPayout (challenger ${n}) input ${t} does not reference ${o} (expected txid ${s}, got ${i})`
801
801
  );
802
802
  }
803
- async function Dr(e, t, r) {
803
+ async function Kr(e, t, r) {
804
804
  const o = [], n = [], a = [], s = Me({
805
805
  claimerBtcPubkey: r.depositorBtcPubkey,
806
806
  depositorBtcPubkey: r.depositorBtcPubkey,
807
807
  vaultProviderBtcPubkey: r.vaultProviderBtcPubkey,
808
808
  vaultKeeperBtcPubkeys: r.vaultKeeperBtcPubkeys
809
809
  });
810
- Hr(
810
+ Nr(
811
811
  e.challenger_presign_data,
812
812
  s,
813
813
  r.universalChallengerBtcPubkeys
814
814
  );
815
- const i = await St({
815
+ const i = await At({
816
816
  vaultCoreVersion: r.vaultCoreVersion,
817
817
  vkClaimerPayoutScriptPubKeys: r.vkClaimerPayoutScriptPubKeys,
818
818
  vpCommissionScriptPubKey: r.vpCommissionScriptPubKey,
@@ -828,7 +828,7 @@ async function Dr(e, t, r) {
828
828
  network: r.network,
829
829
  claimerBtcPubkey: r.depositorBtcPubkey,
830
830
  registeredPayoutScriptPubKey: r.registeredPayoutScriptPubKey,
831
- commissionBps: Nr,
831
+ commissionBps: Or,
832
832
  protocolFeeRate: r.protocolFeeRate,
833
833
  councilMembers: r.councilMembers,
834
834
  councilQuorum: r.councilQuorum
@@ -843,7 +843,7 @@ async function Dr(e, t, r) {
843
843
  f(e.assert_tx.tx_hex)
844
844
  );
845
845
  for (const h of e.challenger_presign_data) {
846
- const l = f(h.challenger_pubkey), p = o.length, d = await Mr({
846
+ const l = f(h.challenger_pubkey), p = o.length, d = await Dr({
847
847
  challenger: h,
848
848
  challengerPubkey: l,
849
849
  claimerPubkey: u,
@@ -863,7 +863,7 @@ async function Dr(e, t, r) {
863
863
  }
864
864
  return { psbtHexes: o, signOptions: n, challengerEntries: a };
865
865
  }
866
- async function Mr(e) {
866
+ async function Dr(e) {
867
867
  const {
868
868
  challenger: t,
869
869
  challengerPubkey: r,
@@ -872,7 +872,7 @@ async function Mr(e) {
872
872
  assertTxParsed: a,
873
873
  ctx: s
874
874
  } = e;
875
- Ut(
875
+ Ft(
876
876
  t.nopayout_tx.tx_hex,
877
877
  r,
878
878
  s.network
@@ -915,7 +915,7 @@ async function Mr(e) {
915
915
  script_pubkey: Ke(new Uint8Array(l.script)),
916
916
  value: l.value
917
917
  }));
918
- return Lt({
918
+ return Ut({
919
919
  noPayoutTxHex: t.nopayout_tx.tx_hex,
920
920
  challengerPubkey: r,
921
921
  prevouts: h,
@@ -930,7 +930,7 @@ async function Mr(e) {
930
930
  }
931
931
  });
932
932
  }
933
- function Fr(e, t, r) {
933
+ function Mr(e, t, r) {
934
934
  F(e[0]);
935
935
  const n = U(
936
936
  e[0].returnedPsbtHex,
@@ -965,11 +965,11 @@ function Fr(e, t, r) {
965
965
  per_challenger: a
966
966
  };
967
967
  }
968
- async function Ur(e) {
969
- const { depositorGraph: t, btcWallet: r, signingContext: o } = e, n = await r.getPublicKeyHex(), { depositorPubkey: a } = lt(
968
+ async function Fr(e) {
969
+ const { depositorGraph: t, btcWallet: r, signingContext: o } = e, n = await r.getPublicKeyHex(), { depositorPubkey: a } = ct(
970
970
  n,
971
971
  f(o.depositorBtcPubkey)
972
- ), { psbtHexes: s, signOptions: i, challengerEntries: u } = await Dr(
972
+ ), { psbtHexes: s, signOptions: i, challengerEntries: u } = await Kr(
973
973
  t,
974
974
  n,
975
975
  o
@@ -981,20 +981,20 @@ async function Ur(e) {
981
981
  requestedPsbtHex: l,
982
982
  returnedPsbtHex: c[p]
983
983
  }));
984
- return Fr(
984
+ return Mr(
985
985
  h,
986
986
  u,
987
987
  a
988
988
  );
989
989
  }
990
- const Lr = 1e4;
990
+ const Ur = 1e4;
991
991
  async function Je(e) {
992
992
  const {
993
993
  statusReader: t,
994
994
  peginTxid: r,
995
995
  targetStatuses: o,
996
996
  timeoutMs: n,
997
- pollIntervalMs: a = Lr,
997
+ pollIntervalMs: a = Ur,
998
998
  signal: s
999
999
  } = e, i = Date.now();
1000
1000
  for (; ; ) {
@@ -1018,12 +1018,12 @@ async function Je(e) {
1018
1018
  const c = u.status;
1019
1019
  if (o.has(c) || c === R.ACTIVATED)
1020
1020
  return c;
1021
- if (c === R.EXPIRED || Nt.has(c))
1021
+ if (c === R.EXPIRED || Ot.has(c))
1022
1022
  throw new Error(
1023
1023
  `Pegin ${r.slice(0, 8)}… reached terminal status "${c}" while waiting for ${[...o].join(", ")}`
1024
1024
  );
1025
1025
  } catch (u) {
1026
- if (!(u instanceof Ht && u.code === Kt.PEGIN_NOT_FOUND))
1026
+ if (!(u instanceof Nt && u.code === Ht.PEGIN_NOT_FOUND))
1027
1027
  throw u;
1028
1028
  }
1029
1029
  await new Promise((u, c) => {
@@ -1040,16 +1040,16 @@ async function Je(e) {
1040
1040
  });
1041
1041
  }
1042
1042
  }
1043
- const Gr = 1200 * 1e3, Ze = /* @__PURE__ */ new Set([
1043
+ const Lr = 1200 * 1e3, Ze = /* @__PURE__ */ new Set([
1044
1044
  R.PENDING_ACKS,
1045
1045
  R.PENDING_ACTIVATION,
1046
1046
  R.ACTIVATED_PENDING_BROADCAST,
1047
1047
  R.ACTIVATED
1048
- ]), Xr = /* @__PURE__ */ new Set([
1048
+ ]), Gr = /* @__PURE__ */ new Set([
1049
1049
  R.PENDING_DEPOSITOR_SIGNATURES,
1050
1050
  ...Ze
1051
1051
  ]);
1052
- function jr(e) {
1052
+ function Xr(e) {
1053
1053
  return e.map((t) => ({
1054
1054
  claimerPubkeyXOnly: j(t.claimer_pubkey),
1055
1055
  payoutTxHex: t.payout_tx.tx_hex,
@@ -1059,7 +1059,7 @@ function jr(e) {
1059
1059
  function S(e) {
1060
1060
  return j(e).toLowerCase();
1061
1061
  }
1062
- function qr(e, t) {
1062
+ function jr(e, t) {
1063
1063
  const r = (u, c, h) => {
1064
1064
  throw new Error(
1065
1065
  `Deposit terms ${u} (${String(c)}) does not match the vault's version-locked signing context (${String(h)}); refusing to sign payouts against terms that describe a different graph.`
@@ -1097,7 +1097,7 @@ function qr(e, t) {
1097
1097
  t.vaultProviderBtcPubkey
1098
1098
  );
1099
1099
  }
1100
- function zr(e, t, r, o) {
1100
+ function qr(e, t, r, o) {
1101
1101
  const n = S(o), a = [
1102
1102
  S(t),
1103
1103
  ...r.map(S)
@@ -1143,8 +1143,8 @@ function ke(e, t) {
1143
1143
  vpCommissionScriptPubKey: t.vpCommissionScriptPubKey
1144
1144
  };
1145
1145
  }
1146
- async function Wr(e, t, r, o) {
1147
- const n = new dt({
1146
+ async function zr(e, t, r, o) {
1147
+ const n = new pt({
1148
1148
  network: t.network,
1149
1149
  btcWallet: e
1150
1150
  }), a = r.length;
@@ -1171,7 +1171,7 @@ async function Wr(e, t, r, o) {
1171
1171
  };
1172
1172
  return o == null || o(a, a), i;
1173
1173
  }
1174
- async function Lo(e) {
1174
+ async function Fo(e) {
1175
1175
  const {
1176
1176
  statusReader: t,
1177
1177
  presignClient: r,
@@ -1180,20 +1180,20 @@ async function Lo(e) {
1180
1180
  depositorPk: a,
1181
1181
  signingContext: s,
1182
1182
  depositTerms: i,
1183
- timeoutMs: u = Gr,
1183
+ timeoutMs: u = Lr,
1184
1184
  signal: c,
1185
1185
  onProgress: h,
1186
1186
  recordGraphFingerprint: l
1187
1187
  } = e, p = await Je({
1188
1188
  statusReader: t,
1189
1189
  peginTxid: n,
1190
- targetStatuses: Xr,
1190
+ targetStatuses: Gr,
1191
1191
  timeoutMs: u,
1192
1192
  signal: c
1193
1193
  });
1194
1194
  if (Ze.has(p))
1195
1195
  return;
1196
- if (c == null || c.throwIfAborted(), i !== void 0 && qr(i, s), pt(o)) {
1196
+ if (c == null || c.throwIfAborted(), i !== void 0 && jr(i, s), ht(o)) {
1197
1197
  if (!i)
1198
1198
  throw new Error(
1199
1199
  "runDepositorPresignFlow: this wallet requires approved deposit terms but none were provided. Fresh deposits must pass PreparePeginResult.depositTerms; resume flows must rebuild them from on-chain state (the vault app's rebuildDepositTerms)."
@@ -1208,7 +1208,7 @@ async function Lo(e) {
1208
1208
  c
1209
1209
  );
1210
1210
  c == null || c.throwIfAborted();
1211
- const g = Br({
1211
+ const g = Rr({
1212
1212
  peginTxid: n,
1213
1213
  peginTxHex: s.peginTxHex,
1214
1214
  claimTxHex: d.depositor_graph.claim_tx.tx_hex,
@@ -1216,7 +1216,7 @@ async function Lo(e) {
1216
1216
  payoutTxHex: d.depositor_graph.payout_tx.tx_hex,
1217
1217
  challengers: d.depositor_graph.challenger_presign_data
1218
1218
  }), b = S(a);
1219
- zr(
1219
+ qr(
1220
1220
  d.txs,
1221
1221
  s.vaultProviderBtcPubkey,
1222
1222
  s.vaultKeeperBtcPubkeys,
@@ -1224,14 +1224,14 @@ async function Lo(e) {
1224
1224
  );
1225
1225
  const y = d.txs.filter(
1226
1226
  (_) => S(_.claimer_pubkey) !== b
1227
- ), m = jr(y), x = await Wr(
1227
+ ), m = Xr(y), x = await zr(
1228
1228
  o,
1229
1229
  s,
1230
1230
  m,
1231
1231
  h
1232
1232
  );
1233
1233
  c == null || c.throwIfAborted();
1234
- const w = await Ur({
1234
+ const w = await Fr({
1235
1235
  depositorGraph: d.depositor_graph,
1236
1236
  btcWallet: o,
1237
1237
  signingContext: {
@@ -1264,25 +1264,25 @@ async function Lo(e) {
1264
1264
  c
1265
1265
  );
1266
1266
  }
1267
- const Yr = 300 * 1e3, Qr = /* @__PURE__ */ new Set([
1267
+ const Wr = 300 * 1e3, Yr = /* @__PURE__ */ new Set([
1268
1268
  R.PENDING_DEPOSITOR_WOTS_PK,
1269
1269
  ...Ue
1270
1270
  ]);
1271
- async function Go(e) {
1271
+ async function Uo(e) {
1272
1272
  const {
1273
1273
  statusReader: t,
1274
1274
  wotsSubmitter: r,
1275
1275
  peginTxid: o,
1276
1276
  depositorPk: n,
1277
1277
  wotsPublicKeys: a,
1278
- timeoutMs: s = Yr,
1278
+ timeoutMs: s = Wr,
1279
1279
  signal: i
1280
1280
  } = e;
1281
1281
  i == null || i.throwIfAborted();
1282
1282
  const u = await Je({
1283
1283
  statusReader: t,
1284
1284
  peginTxid: o,
1285
- targetStatuses: Qr,
1285
+ targetStatuses: Yr,
1286
1286
  timeoutMs: s,
1287
1287
  signal: i
1288
1288
  });
@@ -1298,7 +1298,7 @@ async function Go(e) {
1298
1298
  function Z(e) {
1299
1299
  return e.registration || e.operation;
1300
1300
  }
1301
- function Jr(e, t, r) {
1301
+ function Qr(e, t, r) {
1302
1302
  const o = $(e);
1303
1303
  return {
1304
1304
  registration: o === $(t),
@@ -1318,7 +1318,7 @@ function ee(e) {
1318
1318
  function Te(e, t) {
1319
1319
  return e.length === t.length && e.every((r, o) => r === t[o]);
1320
1320
  }
1321
- async function Xo(e) {
1321
+ async function Lo(e) {
1322
1322
  const {
1323
1323
  vaultProviderEthAddress: t,
1324
1324
  hintBtcPubkey: r,
@@ -1349,7 +1349,7 @@ function te(e, t, r) {
1349
1349
  rotated: a !== n
1350
1350
  };
1351
1351
  }
1352
- function Zr(e) {
1352
+ function Jr(e) {
1353
1353
  const t = /* @__PURE__ */ new Map();
1354
1354
  for (const r of e) {
1355
1355
  const o = t.get(r.operationBtcPubkey);
@@ -1377,7 +1377,7 @@ function et(e, t, r) {
1377
1377
  ), a = e.universalChallengers.map(
1378
1378
  (s, i) => te("universal challenger", s, t.universalChallengers[i])
1379
1379
  );
1380
- return Zr([
1380
+ return Jr([
1381
1381
  o,
1382
1382
  ...n,
1383
1383
  ...a
@@ -1392,14 +1392,14 @@ function et(e, t, r) {
1392
1392
  query: e
1393
1393
  };
1394
1394
  }
1395
- async function eo(e) {
1395
+ async function Zr(e) {
1396
1396
  const t = await e.operationKeyReader.getCurrentOperationKeys(
1397
1397
  e.query,
1398
1398
  e.blockNumber
1399
1399
  );
1400
1400
  return et(e.query, t, { mode: "current" });
1401
1401
  }
1402
- async function to(e) {
1402
+ async function eo(e) {
1403
1403
  const t = await e.operationKeyReader.getOperationKeysAtEpochs(
1404
1404
  e.query,
1405
1405
  e.epochs
@@ -1414,11 +1414,11 @@ class oe extends Error {
1414
1414
  super(t), this.name = "ApplicationEntryPointMismatchError";
1415
1415
  }
1416
1416
  }
1417
- function jo(e) {
1417
+ function Go(e) {
1418
1418
  return e instanceof oe || e instanceof Error && e.name === "ApplicationEntryPointMismatchError";
1419
1419
  }
1420
1420
  const $e = (e) => e.map($).sort();
1421
- async function qo(e) {
1421
+ async function Xo(e) {
1422
1422
  const {
1423
1423
  vaultRegistryReader: t,
1424
1424
  vaultKeeperReader: r,
@@ -1449,11 +1449,11 @@ async function qo(e) {
1449
1449
  o.getLatestUniversalChallengersVersion(p),
1450
1450
  o.getCurrentUcKeyEpoch(p)
1451
1451
  ]);
1452
- if (!Vt(a, { strict: !1 }))
1452
+ if (!Bt(a, { strict: !1 }))
1453
1453
  throw new oe(
1454
1454
  `The application entry point this deposit was prepared for is not a valid address: ${a}`
1455
1455
  );
1456
- if (!Ot(d, a))
1456
+ if (!Vt(d, a))
1457
1457
  throw new oe(
1458
1458
  `Vault provider ${n} is registered to application ${d}, but this deposit was prepared for ${a}. Refusing to build: the vault keeper roster, its version, and the keeper key epoch would all resolve against a different application than the one selected.`
1459
1459
  );
@@ -1482,7 +1482,7 @@ async function qo(e) {
1482
1482
  vaultProvider: $(g),
1483
1483
  vaultKeepers: $e(w.map((T) => T.btcPubKey)),
1484
1484
  universalChallengers: $e(k.map((T) => T.btcPubKey))
1485
- }, A = await eo({
1485
+ }, C = await Zr({
1486
1486
  operationKeyReader: c,
1487
1487
  query: {
1488
1488
  vaultProviderEthAddress: n,
@@ -1493,12 +1493,12 @@ async function qo(e) {
1493
1493
  },
1494
1494
  blockNumber: p
1495
1495
  }), P = {
1496
- vaultProvider: A.vaultProvider.operationBtcPubkey,
1497
- vaultKeepers: [...A.vaultKeeperOperationKeysSorted],
1496
+ vaultProvider: C.vaultProvider.operationBtcPubkey,
1497
+ vaultKeepers: [...C.vaultKeeperOperationKeysSorted],
1498
1498
  universalChallengers: [
1499
- ...A.universalChallengerOperationKeysSorted
1499
+ ...C.universalChallengerOperationKeysSorted
1500
1500
  ]
1501
- }, se = Jr(
1501
+ }, se = Qr(
1502
1502
  s,
1503
1503
  _.vaultProvider,
1504
1504
  P.vaultProvider
@@ -1523,8 +1523,8 @@ async function qo(e) {
1523
1523
  throw new Error(
1524
1524
  `Universal challenger BTC pubkeys (v${b}) indexer set does not match ProtocolParams on-chain set. Refresh and try again.`
1525
1525
  );
1526
- const ue = [se, ae, ie], at = ue.some((T) => T.registration && !T.operation), ce = ue.some((T) => T.operation && !T.registration);
1527
- if (at && ce) {
1526
+ const ue = [se, ae, ie], st = ue.some((T) => T.registration && !T.operation), ce = ue.some((T) => T.operation && !T.registration);
1527
+ if (st && ce) {
1528
1528
  const T = `Indexer participant hints are internally inconsistent for vault provider ${n}: some roles match the registration keys while others match the rotated operation keys.`;
1529
1529
  throw l == null || l(T), new Error(`${T} Refresh and try again.`);
1530
1530
  }
@@ -1539,13 +1539,13 @@ async function qo(e) {
1539
1539
  appKeeperKeyEpoch: x,
1540
1540
  ucKeyEpoch: y,
1541
1541
  registrationKeys: _,
1542
- participantKeys: A
1542
+ participantKeys: C
1543
1543
  };
1544
1544
  }
1545
- function ro(e) {
1545
+ function to(e) {
1546
1546
  return /^[0-9a-fA-F]{64}$/.test(e);
1547
1547
  }
1548
- function zo(e) {
1548
+ function jo(e) {
1549
1549
  const {
1550
1550
  amountSats: t,
1551
1551
  minDeposit: r,
@@ -1556,7 +1556,7 @@ function zo(e) {
1556
1556
  } = e;
1557
1557
  return !(t <= 0n || t < r || o && o > 0n && t > o || a == null || s == null || t + a + s > n);
1558
1558
  }
1559
- function Wo(e, t, r) {
1559
+ function qo(e, t, r) {
1560
1560
  return e <= 0n ? {
1561
1561
  valid: !1,
1562
1562
  error: "Deposit amount must be greater than zero"
@@ -1568,7 +1568,7 @@ function Wo(e, t, r) {
1568
1568
  error: `Maximum deposit is ${V(r)} BTC`
1569
1569
  } : { valid: !0 };
1570
1570
  }
1571
- function Yo(e) {
1571
+ function zo(e) {
1572
1572
  const { amount: t, effectiveRemaining: r } = e;
1573
1573
  return r === null ? { valid: !0 } : r === 0n ? {
1574
1574
  valid: !1,
@@ -1578,7 +1578,7 @@ function Yo(e) {
1578
1578
  error: `Vault size exceeds remaining capacity (${V(r)} BTC)`
1579
1579
  } : { valid: !0 };
1580
1580
  }
1581
- function Qo(e, t) {
1581
+ function Wo(e, t) {
1582
1582
  if (!e || e.length === 0)
1583
1583
  return {
1584
1584
  valid: !1,
@@ -1594,7 +1594,7 @@ function Qo(e, t) {
1594
1594
  error: "Invalid vault provider selected"
1595
1595
  } : { valid: !0 };
1596
1596
  }
1597
- function oo(e, t, r) {
1597
+ function ro(e, t, r) {
1598
1598
  if (!e || e.length === 0)
1599
1599
  return {
1600
1600
  valid: !1,
@@ -1620,30 +1620,30 @@ function oo(e, t, r) {
1620
1620
  }
1621
1621
  return { valid: !0 };
1622
1622
  }
1623
- function no(e) {
1623
+ function oo(e) {
1624
1624
  const t = f(e);
1625
- return ro(t) ? { valid: !0 } : {
1625
+ return to(t) ? { valid: !0 } : {
1626
1626
  valid: !1,
1627
1627
  error: "Invalid pubkey format: must be 64 hex characters (32-byte x-only public key, no 0x prefix)"
1628
1628
  };
1629
1629
  }
1630
- function so(e) {
1630
+ function no(e) {
1631
1631
  if (!e || e.length === 0)
1632
1632
  throw new Error(
1633
1633
  "No vault keepers available. The system requires at least one vault keeper to create a deposit."
1634
1634
  );
1635
1635
  }
1636
- function ao(e) {
1636
+ function so(e) {
1637
1637
  if (!e || e.length === 0)
1638
1638
  throw new Error(
1639
1639
  "No universal challengers available. The system requires at least one universal challenger to create a deposit."
1640
1640
  );
1641
1641
  }
1642
- function io(e) {
1642
+ function ao(e) {
1643
1643
  if (e.length === 0)
1644
1644
  throw new Error("No spendable UTXOs available");
1645
1645
  }
1646
- function Jo(e) {
1646
+ function Yo(e) {
1647
1647
  const {
1648
1648
  vaultAmounts: t,
1649
1649
  confirmedUTXOs: r,
@@ -1652,30 +1652,30 @@ function Jo(e) {
1652
1652
  universalChallengerBtcPubkeys: a,
1653
1653
  minDeposit: s,
1654
1654
  maxDeposit: i
1655
- } = e, u = oo(
1655
+ } = e, u = ro(
1656
1656
  t,
1657
1657
  s,
1658
1658
  i
1659
1659
  );
1660
1660
  if (!u.valid)
1661
1661
  throw new Error(u.error);
1662
- const c = no(o);
1662
+ const c = oo(o);
1663
1663
  if (!c.valid)
1664
1664
  throw new Error(c.error);
1665
- so(n), ao(a), io(r);
1665
+ no(n), so(a), ao(r);
1666
1666
  }
1667
1667
  class tt extends Error {
1668
1668
  constructor(t) {
1669
1669
  super(t), this.name = "ParticipantKeyDriftError";
1670
1670
  }
1671
1671
  }
1672
- function Zo(e) {
1672
+ function Qo(e) {
1673
1673
  return e instanceof tt || e instanceof Error && e.name === "ParticipantKeyDriftError";
1674
1674
  }
1675
- function Ae(e, t, r) {
1675
+ function Ce(e, t, r) {
1676
1676
  return t.length === r.length && t.every((o, n) => o === r[n]) ? null : `${e} expected [${t.join(", ")}], got [${r.join(", ")}]`;
1677
1677
  }
1678
- async function en(e) {
1678
+ async function Jo(e) {
1679
1679
  const { vaultRegistryReader: t, operationKeyReader: r, vaultIds: o, expected: n } = e, a = n.query;
1680
1680
  if (o.length === 0) return;
1681
1681
  const s = await t.getVaultKeyEpochsBatch(o), i = [];
@@ -1683,7 +1683,7 @@ async function en(e) {
1683
1683
  const h = o[u];
1684
1684
  let l;
1685
1685
  try {
1686
- l = await to({
1686
+ l = await eo({
1687
1687
  operationKeyReader: r,
1688
1688
  query: a,
1689
1689
  epochs: c
@@ -1697,13 +1697,13 @@ async function en(e) {
1697
1697
  l.vaultProvider.operationBtcPubkey !== n.vaultProvider.operationBtcPubkey && i.push(
1698
1698
  `vault ${h}: vault provider key expected ${n.vaultProvider.operationBtcPubkey}, got ${l.vaultProvider.operationBtcPubkey}`
1699
1699
  );
1700
- const p = Ae(
1700
+ const p = Ce(
1701
1701
  `vault ${h}: vault keeper keys`,
1702
1702
  n.vaultKeeperOperationKeysSorted,
1703
1703
  l.vaultKeeperOperationKeysSorted
1704
1704
  );
1705
1705
  p && i.push(p);
1706
- const d = Ae(
1706
+ const d = Ce(
1707
1707
  `vault ${h}: universal challenger keys`,
1708
1708
  n.universalChallengerOperationKeysSorted,
1709
1709
  l.universalChallengerOperationKeysSorted
@@ -1720,10 +1720,10 @@ class rt extends Error {
1720
1720
  super(t), this.name = "RegisteredVaultVersionMismatchError";
1721
1721
  }
1722
1722
  }
1723
- function tn(e) {
1723
+ function Zo(e) {
1724
1724
  return e instanceof rt || e instanceof Error && e.name === "RegisteredVaultVersionMismatchError";
1725
1725
  }
1726
- async function rn(e) {
1726
+ async function en(e) {
1727
1727
  const {
1728
1728
  vaultRegistryReader: t,
1729
1729
  vaultIds: r,
@@ -1748,21 +1748,7 @@ async function rn(e) {
1748
1748
  `Aborting BTC broadcast: signer-set or offchain-params versions changed during registration (${u.join("; ")}). The Pre-PegIn was not broadcast; the registered ETH vault will time out per protocol rules.`
1749
1749
  );
1750
1750
  }
1751
- var ot = /* @__PURE__ */ ((e) => (e.CLAIM_EVENT_RECEIVED = "ClaimEventReceived", e.CLAIM_BROADCAST = "ClaimBroadcast", e.ASSERT_BROADCAST = "AssertBroadcast", e.PAYOUT_BROADCAST = "PayoutBroadcast", e.PAYOUT_BLOCKED = "PayoutBlocked", e))(ot || {});
1752
- const uo = /* @__PURE__ */ new Set([
1753
- "PayoutBroadcast",
1754
- "PayoutBlocked"
1755
- /* PAYOUT_BLOCKED */
1756
- ]);
1757
- function on(e) {
1758
- return Object.values(ot).includes(
1759
- e
1760
- );
1761
- }
1762
- function nn(e) {
1763
- return !!e && uo.has(e);
1764
- }
1765
- class co extends Error {
1751
+ class io extends Error {
1766
1752
  constructor(r, o) {
1767
1753
  super(`Refund not yet mature (BIP68 not final): ${o.message}`);
1768
1754
  O(this, "vaultId");
@@ -1770,21 +1756,21 @@ class co extends Error {
1770
1756
  this.name = "BIP68NotMatureError", this.vaultId = r, this.cause = o;
1771
1757
  }
1772
1758
  }
1773
- const lo = /^0x[0-9a-fA-F]{64}$/, ho = /^(?:0x)?(?:[0-9a-fA-F]{2})+$/, nt = /^(?:0x)?(?:[0-9a-fA-F]{64}|[0-9a-fA-F]{66})$/, st = 160, Ce = 2e3, Se = 10n, Ie = 100n;
1774
- function sn(e) {
1759
+ const uo = /^0x[0-9a-fA-F]{64}$/, co = /^(?:0x)?(?:[0-9a-fA-F]{2})+$/, ot = /^(?:0x)?(?:[0-9a-fA-F]{64}|[0-9a-fA-F]{66})$/, nt = 160, Ae = 2e3, Se = 10n, Ie = 100n;
1760
+ function tn(e) {
1775
1761
  if (!Number.isFinite(e) || e <= 0)
1776
1762
  throw new Error(
1777
1763
  `feeRateSatsVb must be a positive finite number, got ${e}`
1778
1764
  );
1779
- return BigInt(Math.ceil(e * st));
1765
+ return BigInt(Math.ceil(e * nt));
1780
1766
  }
1781
- const po = 1, go = /non-BIP68-final/i;
1767
+ const lo = 1, ho = /non-BIP68-final/i;
1782
1768
  function ne(e, t) {
1783
1769
  if (e.length !== 66)
1784
1770
  throw new Error(
1785
1771
  `${t} must be 32 bytes (66 hex chars with 0x prefix), got length ${e.length}`
1786
1772
  );
1787
- if (!lo.test(e))
1773
+ if (!uo.test(e))
1788
1774
  throw new Error(
1789
1775
  `${t} must contain only hex characters after the 0x prefix`
1790
1776
  );
@@ -1793,7 +1779,7 @@ function re(e, t) {
1793
1779
  if (!Number.isInteger(e) || e < 0)
1794
1780
  throw new Error(`${t} must be a non-negative integer, got ${e}`);
1795
1781
  }
1796
- function fo(e) {
1782
+ function po(e) {
1797
1783
  if (ne(e.hashlock, "hashlock"), !Number.isInteger(e.htlcVout) || e.htlcVout < 0)
1798
1784
  throw new Error(
1799
1785
  `htlcVout must be a non-negative integer, got ${e.htlcVout}`
@@ -1827,24 +1813,24 @@ function fo(e) {
1827
1813
  if (re(e.offchainParamsVersion, "offchainParamsVersion"), re(e.appVaultKeepersVersion, "appVaultKeepersVersion"), re(
1828
1814
  e.universalChallengersVersion,
1829
1815
  "universalChallengersVersion"
1830
- ), qt(
1816
+ ), jt(
1831
1817
  e.vaultCoreVersion,
1832
1818
  "VaultRefundData.vaultCoreVersion"
1833
1819
  ), typeof e.unsignedPrePeginTxHex != "string" || e.unsignedPrePeginTxHex.length === 0)
1834
1820
  throw new Error("unsignedPrePeginTxHex must be a non-empty hex string");
1835
- if (!ho.test(e.unsignedPrePeginTxHex))
1821
+ if (!co.test(e.unsignedPrePeginTxHex))
1836
1822
  throw new Error(
1837
1823
  "unsignedPrePeginTxHex must be a hex byte string (optional 0x prefix, even length)"
1838
1824
  );
1839
- if (!e.depositorBtcPubkey || !nt.test(e.depositorBtcPubkey))
1825
+ if (!e.depositorBtcPubkey || !ot.test(e.depositorBtcPubkey))
1840
1826
  throw new Error(
1841
1827
  "depositorBtcPubkey must be 32 or 33 bytes of hex (optional 0x prefix)"
1842
1828
  );
1843
1829
  if (typeof e.amount != "bigint" || e.amount <= 0n)
1844
1830
  throw new Error(`amount must be a positive bigint, got ${e.amount}`);
1845
1831
  }
1846
- function yo(e) {
1847
- if (!e.vaultProviderPubkey || !nt.test(e.vaultProviderPubkey))
1832
+ function go(e) {
1833
+ if (!e.vaultProviderPubkey || !ot.test(e.vaultProviderPubkey))
1848
1834
  throw new Error("vaultProviderPubkey must be 32 or 33 bytes of hex");
1849
1835
  if (e.vaultKeeperPubkeys.length === 0)
1850
1836
  throw new Error("vaultKeeperPubkeys must be non-empty");
@@ -1869,7 +1855,7 @@ function yo(e) {
1869
1855
  `councilQuorum (${e.councilQuorum}) must be in [1, councilSize=${e.councilSize}]`
1870
1856
  );
1871
1857
  }
1872
- async function an(e) {
1858
+ async function rn(e) {
1873
1859
  const {
1874
1860
  vaultId: t,
1875
1861
  readVault: r,
@@ -1881,15 +1867,15 @@ async function an(e) {
1881
1867
  } = e;
1882
1868
  i == null || i.throwIfAborted(), ne(t, "vaultId");
1883
1869
  const u = await r();
1884
- fo(u), i == null || i.throwIfAborted();
1870
+ po(u), i == null || i.throwIfAborted();
1885
1871
  const c = await o(u);
1886
- if (yo(c), i == null || i.throwIfAborted(), !Number.isFinite(n) || n <= 0)
1872
+ if (go(c), i == null || i.throwIfAborted(), !Number.isFinite(n) || n <= 0)
1887
1873
  throw new Error(`feeRate must be a positive number, got ${n}`);
1888
- if (n > Ce)
1874
+ if (n > Ae)
1889
1875
  throw new Error(
1890
- `feeRate ${n} sat/vB exceeds refund safety cap ${Ce} sat/vB; refusing to sign refund.`
1876
+ `feeRate ${n} sat/vB exceeds refund safety cap ${Ae} sat/vB; refusing to sign refund.`
1891
1877
  );
1892
- const h = BigInt(Math.ceil(n * st)), l = u.amount * Se / Ie;
1878
+ const h = BigInt(Math.ceil(n * nt)), l = u.amount * Se / Ie;
1893
1879
  if (h > l)
1894
1880
  throw new Error(
1895
1881
  `Refund fee ${h} sats exceeds the per-vault safety cap of ${l} sats (${Se}/${Ie} of vault.amount=${u.amount}); refusing to sign refund.`
@@ -1897,7 +1883,7 @@ async function an(e) {
1897
1883
  i == null || i.throwIfAborted();
1898
1884
  const p = j(
1899
1885
  u.depositorBtcPubkey
1900
- ), d = f(u.unsignedPrePeginTxHex), g = gt(d);
1886
+ ), d = f(u.unsignedPrePeginTxHex), g = dt(d);
1901
1887
  if (g !== void 0 && g.vout !== u.batch.length)
1902
1888
  throw new Error(
1903
1889
  `Auth-anchor OP_RETURN at vout ${g.vout} does not match batch size (${u.batch.length} HTLC outputs expect the anchor at vout ${u.batch.length}). Refund refused — sibling HTLC vector is incomplete.`
@@ -1915,7 +1901,7 @@ async function an(e) {
1915
1901
  throw new Error(
1916
1902
  `Funded Pre-PegIn tx has ${y.outs.length} outputs but batch requires at least ${u.batch.length} HTLC outputs. Refund refused — funded tx shape disagrees with sibling vector.`
1917
1903
  );
1918
- const { psbtHex: m } = await Gt({
1904
+ const { psbtHex: m } = await Lt({
1919
1905
  prePeginParams: {
1920
1906
  vaultCoreVersion: u.vaultCoreVersion,
1921
1907
  depositorPubkey: p,
@@ -1951,7 +1937,7 @@ async function an(e) {
1951
1937
  i == null || i.throwIfAborted();
1952
1938
  const x = M(
1953
1939
  u.depositorBtcPubkey,
1954
- po
1940
+ lo
1955
1941
  ), w = await a(m, x);
1956
1942
  F({
1957
1943
  requestedPsbtHex: m,
@@ -1968,16 +1954,16 @@ async function an(e) {
1968
1954
  signerXOnlyPubkeyHex: p,
1969
1955
  inputIndex: k
1970
1956
  });
1971
- const A = Le({
1957
+ const C = Le({
1972
1958
  requestedPsbtHex: m,
1973
1959
  signaturesHex: [_],
1974
1960
  signerXOnlyPubkeyHex: p
1975
1961
  });
1976
1962
  i == null || i.throwIfAborted();
1977
1963
  try {
1978
- return await s(A);
1964
+ return await s(C);
1979
1965
  } catch (P) {
1980
- throw P instanceof Error && go.test(P.message) ? new co(t, P) : P;
1966
+ throw P instanceof Error && ho.test(P.message) ? new io(t, P) : P;
1981
1967
  }
1982
1968
  }
1983
1969
  class Re extends Error {
@@ -1990,10 +1976,10 @@ class Re extends Error {
1990
1976
  this.name = "ReclaimUneconomicalError", this.feeSats = o, this.sweptTotalSats = n;
1991
1977
  }
1992
1978
  }
1993
- const Be = 2e3, Ve = 25n, Oe = 100n, un = 10n;
1994
- async function bo(e, t, r) {
1979
+ const Be = 2e3, Ve = 25n, Oe = 100n, on = 10n;
1980
+ async function fo(e, t, r) {
1995
1981
  for (let o = 0; o < e.length; o++) {
1996
- const n = yt(e[o].depositorSignedPeginTxHex), a = He(
1982
+ const n = ft(e[o].depositorSignedPeginTxHex), a = He(
1997
1983
  await Ct(
1998
1984
  f(n),
1999
1985
  f(r)
@@ -2005,7 +1991,7 @@ async function bo(e, t, r) {
2005
1991
  );
2006
1992
  }
2007
1993
  }
2008
- async function cn(e) {
1994
+ async function nn(e) {
2009
1995
  const {
2010
1996
  vaultIds: t,
2011
1997
  depositorEthAddress: r,
@@ -2031,12 +2017,12 @@ async function cn(e) {
2031
2017
  throw new Error(
2032
2018
  `readVaults returned ${c.length} reserves for ${t.length} vault id(s); refusing to sweep a set that does not match the request.`
2033
2019
  );
2034
- await bo(c, t, r), u == null || u.throwIfAborted();
2020
+ await fo(c, t, r), u == null || u.throwIfAborted();
2035
2021
  const h = j(o), l = c.map((k) => ({
2036
2022
  depositorSignedPeginTxHex: k.depositorSignedPeginTxHex,
2037
2023
  observed: k.observed,
2038
2024
  expectedValue: k.expectedClaimValue
2039
- })), p = Xt(a, l.length), d = l.reduce((k, _) => k + _.expectedValue, 0n), g = d * Ve / Oe;
2025
+ })), p = Gt(a, l.length), d = l.reduce((k, _) => k + _.expectedValue, 0n), g = d * Ve / Oe;
2040
2026
  if (p > g)
2041
2027
  throw new Re(
2042
2028
  `Reclaim fee ${p} sats exceeds ${Ve}/${Oe} of the swept total (${d} sats, cap ${g} sats). The reserve is not at risk — it stays where it is until fee rates fall.`,
@@ -2044,7 +2030,7 @@ async function cn(e) {
2044
2030
  d
2045
2031
  );
2046
2032
  u == null || u.throwIfAborted();
2047
- const { psbtHex: b } = jt({
2033
+ const { psbtHex: b } = Xt({
2048
2034
  depositorPubkey: h,
2049
2035
  inputs: l,
2050
2036
  feeSats: p
@@ -2059,17 +2045,17 @@ async function cn(e) {
2059
2045
  returnedPsbtHex: m
2060
2046
  });
2061
2047
  const x = l.map((k, _) => {
2062
- const A = U(
2048
+ const C = U(
2063
2049
  m,
2064
2050
  h,
2065
2051
  _
2066
2052
  );
2067
2053
  return L({
2068
2054
  requestedPsbtHex: b,
2069
- signatureHex: A,
2055
+ signatureHex: C,
2070
2056
  signerXOnlyPubkeyHex: h,
2071
2057
  inputIndex: _
2072
- }), A;
2058
+ }), C;
2073
2059
  }), w = Le({
2074
2060
  requestedPsbtHex: b,
2075
2061
  signaturesHex: x,
@@ -2078,70 +2064,67 @@ async function cn(e) {
2078
2064
  return u == null || u.throwIfAborted(), i(w);
2079
2065
  }
2080
2066
  export {
2081
- an as $,
2082
- mr as A,
2083
- Qo as B,
2084
- Zt as C,
2085
- br as D,
2086
- Yo as E,
2087
- oo as F,
2067
+ Se as $,
2068
+ br as A,
2069
+ Wo as B,
2070
+ Jt as C,
2071
+ yr as D,
2072
+ zo as E,
2073
+ ro as F,
2088
2074
  v as G,
2089
- no as H,
2075
+ oo as H,
2090
2076
  tt as I,
2091
- Zo as J,
2092
- en as K,
2093
- tn as L,
2094
- rn as M,
2077
+ Qo as J,
2078
+ Jo as K,
2079
+ Zo as L,
2080
+ en as M,
2095
2081
  Je as N,
2096
- Xo as O,
2097
- tr as P,
2082
+ Lo as O,
2083
+ er as P,
2098
2084
  Z as Q,
2099
2085
  rt as R,
2100
- Jr as S,
2086
+ Qr as S,
2101
2087
  _e as T,
2102
- eo as U,
2103
- nr as V,
2104
- to as W,
2105
- ot as X,
2106
- on as Y,
2107
- nn as Z,
2108
- co as _,
2109
- Oo as a,
2110
- sn as a0,
2111
- Ie as a1,
2112
- Se as a2,
2113
- Ce as a3,
2114
- st as a4,
2115
- Re as a5,
2116
- cn as a6,
2117
- Oe as a7,
2118
- Ve as a8,
2119
- Be as a9,
2120
- un as aa,
2121
- No as b,
2122
- Ho as c,
2123
- Ko as d,
2124
- Do as e,
2125
- er as f,
2126
- rr as g,
2088
+ Zr as U,
2089
+ or as V,
2090
+ eo as W,
2091
+ io as X,
2092
+ rn as Y,
2093
+ tn as Z,
2094
+ Ie as _,
2095
+ Bo as a,
2096
+ Ae as a0,
2097
+ nt as a1,
2098
+ Re as a2,
2099
+ nn as a3,
2100
+ Oe as a4,
2101
+ Ve as a5,
2102
+ Be as a6,
2103
+ on as a7,
2104
+ Vo as b,
2105
+ Oo as c,
2106
+ No as d,
2107
+ Ho as e,
2108
+ Zt as f,
2109
+ tr as g,
2127
2110
  qe as h,
2128
- xr as i,
2111
+ wr as i,
2129
2112
  We as j,
2130
2113
  Ye as k,
2131
- Tr as l,
2132
- Mo as m,
2133
- Uo as n,
2134
- Vr as o,
2135
- Ur as p,
2136
- Go as q,
2137
- Lo as r,
2138
- Pr as s,
2114
+ _r as l,
2115
+ Ko as m,
2116
+ Mo as n,
2117
+ Br as o,
2118
+ Fr as p,
2119
+ Uo as q,
2120
+ Fo as r,
2121
+ mr as s,
2139
2122
  oe as t,
2140
- jo as u,
2141
- qo as v,
2142
- Fo as w,
2143
- zo as x,
2144
- Wo as y,
2145
- Jo as z
2123
+ Go as u,
2124
+ Xo as v,
2125
+ Do as w,
2126
+ jo as x,
2127
+ qo as y,
2128
+ Yo as z
2146
2129
  };
2147
- //# sourceMappingURL=buildAndBroadcastReclaim-B19cyK69.js.map
2130
+ //# sourceMappingURL=buildAndBroadcastReclaim-T5ZFPUpM.js.map