@babylonlabs-io/ts-sdk 0.25.0 → 0.26.1

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 (56) hide show
  1. package/dist/{buildAndBroadcastRefund-D7NCbgtv.js → buildAndBroadcastRefund-Ccp-2GWW.js} +146 -145
  2. package/dist/buildAndBroadcastRefund-Ccp-2GWW.js.map +1 -0
  3. package/dist/buildAndBroadcastRefund-Mr3ck5ek.cjs +2 -0
  4. package/dist/buildAndBroadcastRefund-Mr3ck5ek.cjs.map +1 -0
  5. package/dist/{errors-B3TOmE31.cjs → errors-BqKsTgDW.cjs} +2 -2
  6. package/dist/{errors-B3TOmE31.cjs.map → errors-BqKsTgDW.cjs.map} +1 -1
  7. package/dist/{errors-rJcuN2m_.js → errors-b6sBSfA6.js} +6 -6
  8. package/dist/{errors-rJcuN2m_.js.map → errors-b6sBSfA6.js.map} +1 -1
  9. package/dist/{index-BAECy2oz.cjs → index-CIuXb72l.cjs} +2 -2
  10. package/dist/{index-BAECy2oz.cjs.map → index-CIuXb72l.cjs.map} +1 -1
  11. package/dist/{index-DLtpqdlu.js → index-D7s2ilf8.js} +2 -2
  12. package/dist/{index-DLtpqdlu.js.map → index-D7s2ilf8.js.map} +1 -1
  13. package/dist/index.cjs +1 -1
  14. package/dist/index.js +6 -6
  15. package/dist/{psbtInputFields-r1ss6WLU.js → psbtInputFields-1dXR4hLk.js} +2 -2
  16. package/dist/{psbtInputFields-r1ss6WLU.js.map → psbtInputFields-1dXR4hLk.js.map} +1 -1
  17. package/dist/{psbtInputFields-05ZrwRzf.cjs → psbtInputFields-tnAR8tG5.cjs} +2 -2
  18. package/dist/{psbtInputFields-05ZrwRzf.cjs.map → psbtInputFields-tnAR8tG5.cjs.map} +1 -1
  19. package/dist/shared/index.cjs.map +1 -1
  20. package/dist/shared/index.js.map +1 -1
  21. package/dist/shared/wallets/interfaces/BitcoinWallet.d.ts +17 -1
  22. package/dist/shared/wallets/interfaces/BitcoinWallet.d.ts.map +1 -1
  23. package/dist/{signing-DeWVBl7m.js → signing-BZigafm0.js} +2 -2
  24. package/dist/{signing-DeWVBl7m.js.map → signing-BZigafm0.js.map} +1 -1
  25. package/dist/{signing-cl-lowxV.cjs → signing-DHSXjhLM.cjs} +2 -2
  26. package/dist/{signing-cl-lowxV.cjs.map → signing-DHSXjhLM.cjs.map} +1 -1
  27. package/dist/tbv/core/clients/index.cjs +1 -1
  28. package/dist/tbv/core/clients/index.js +2 -2
  29. package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts +6 -6
  30. package/dist/tbv/core/index.cjs +1 -1
  31. package/dist/tbv/core/index.js +6 -6
  32. package/dist/tbv/core/services/index.cjs +1 -1
  33. package/dist/tbv/core/services/index.js +2 -2
  34. package/dist/tbv/core/utils/index.cjs +1 -1
  35. package/dist/tbv/core/utils/index.js +2 -2
  36. package/dist/tbv/core/utils/signing.d.ts +1 -1
  37. package/dist/tbv/index.cjs +1 -1
  38. package/dist/tbv/index.js +6 -6
  39. package/dist/tbv/integrations/aave/clients/index.d.ts +1 -1
  40. package/dist/tbv/integrations/aave/clients/index.d.ts.map +1 -1
  41. package/dist/tbv/integrations/aave/clients/query.d.ts +0 -9
  42. package/dist/tbv/integrations/aave/clients/query.d.ts.map +1 -1
  43. package/dist/tbv/integrations/aave/index.cjs +1 -1
  44. package/dist/tbv/integrations/aave/index.cjs.map +1 -1
  45. package/dist/tbv/integrations/aave/index.d.ts +1 -1
  46. package/dist/tbv/integrations/aave/index.d.ts.map +1 -1
  47. package/dist/tbv/integrations/aave/index.js +69 -78
  48. package/dist/tbv/integrations/aave/index.js.map +1 -1
  49. package/dist/{types-DWjaqVfP.js → types-WrGfwlJd.js} +7 -7
  50. package/dist/{types-DWjaqVfP.js.map → types-WrGfwlJd.js.map} +1 -1
  51. package/dist/{types-B-p4dhEH.cjs → types-xU3SBcpH.cjs} +2 -2
  52. package/dist/{types-B-p4dhEH.cjs.map → types-xU3SBcpH.cjs.map} +1 -1
  53. package/package.json +1 -1
  54. package/dist/buildAndBroadcastRefund-BDGGbGeK.cjs +0 -2
  55. package/dist/buildAndBroadcastRefund-BDGGbGeK.cjs.map +0 -1
  56. package/dist/buildAndBroadcastRefund-D7NCbgtv.js.map +0 -1
@@ -1,15 +1,15 @@
1
- var ke = Object.defineProperty;
2
- var Be = (e, t, r) => t in e ? ke(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var f = (e, t, r) => Be(e, typeof t != "symbol" ? t + "" : t, r);
4
- import { B as He, c as _e, a as Ie, R as Ce, d as be, D as O } from "./types-DWjaqVfP.js";
5
- import { v as ne, b as Le, s as w, e as $e, p as M, f as L } from "./bitcoin-nOOgeRyl.js";
6
- import * as Re from "bitcoinjs-lib";
7
- import { Transaction as Oe, Psbt as ee } from "bitcoinjs-lib";
8
- import { Buffer as xe } from "buffer";
9
- import { c as G } from "./signing-DeWVBl7m.js";
1
+ var Be = Object.defineProperty;
2
+ var He = (e, t, r) => t in e ? Be(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var f = (e, t, r) => He(e, typeof t != "symbol" ? t + "" : t, r);
4
+ import { B as _e, c as Ie, a as Ce, R as Le, d as xe, D as O } from "./types-WrGfwlJd.js";
5
+ import { v as ne, b as $e, s as w, e as Re, p as G, f as L } from "./bitcoin-nOOgeRyl.js";
6
+ import * as Oe from "bitcoinjs-lib";
7
+ import { Transaction as Ne, Psbt as ee } from "bitcoinjs-lib";
8
+ import { Buffer as pe } from "buffer";
9
+ import { c as N } from "./signing-BZigafm0.js";
10
10
  import "@babylonlabs-io/babylon-tbv-rust-wasm";
11
- import { a as se, e as W, b as Ne } from "./payout-DzGsAnhf.js";
12
- class Ue {
11
+ import { a as se, e as W, b as Ue } from "./payout-DzGsAnhf.js";
12
+ class De {
13
13
  /**
14
14
  * Creates a new PayoutManager instance.
15
15
  *
@@ -61,7 +61,7 @@ class Ue {
61
61
  network: this.config.network
62
62
  }), c = await this.config.btcWallet.signPsbt(
63
63
  s.psbtHex,
64
- G(r, 1)
64
+ N(r, 1)
65
65
  );
66
66
  return {
67
67
  signature: W(c, n),
@@ -120,7 +120,7 @@ class Ue {
120
120
  timelockPegin: o.timelockPegin,
121
121
  network: this.config.network
122
122
  });
123
- n.push(h.psbtHex), s.push(G(r, 1));
123
+ n.push(h.psbtHex), s.push(N(r, 1));
124
124
  }
125
125
  const a = await this.config.btcWallet.signPsbts(
126
126
  n,
@@ -158,14 +158,14 @@ class Ue {
158
158
  * @throws Error if the largest output does not pay to the registered address
159
159
  */
160
160
  validatePayoutOutputs(t, r) {
161
- if (!Le(r))
161
+ if (!$e(r))
162
162
  throw new Error(
163
163
  "Invalid registeredPayoutScriptPubKey: not valid hex"
164
164
  );
165
- const n = xe.from(
165
+ const n = pe.from(
166
166
  w(r),
167
167
  "hex"
168
- ), s = Oe.fromHex(w(t));
168
+ ), s = Ne.fromHex(w(t));
169
169
  if (s.outs.length === 0)
170
170
  throw new Error("Payout transaction has no outputs");
171
171
  if (!s.outs.reduce(
@@ -176,7 +176,7 @@ class Ue {
176
176
  );
177
177
  }
178
178
  }
179
- function De(e) {
179
+ function Ve(e) {
180
180
  return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
181
181
  }
182
182
  function oe(e, t = "") {
@@ -186,7 +186,7 @@ function oe(e, t = "") {
186
186
  }
187
187
  }
188
188
  function te(e, t, r = "") {
189
- const n = De(e), s = e == null ? void 0 : e.length, c = t !== void 0;
189
+ const n = Ve(e), s = e == null ? void 0 : e.length, c = t !== void 0;
190
190
  if (!n || c && s !== t) {
191
191
  const a = r && `"${r}" `, i = c ? ` of length ${t}` : "", o = n ? `length=${s}` : `type=${typeof e}`;
192
192
  throw new Error(a + "expected Uint8Array" + i + ", got " + o);
@@ -204,7 +204,7 @@ function ie(e, t = !0) {
204
204
  if (t && e.finished)
205
205
  throw new Error("Hash#digest() has already been called");
206
206
  }
207
- function Ve(e, t) {
207
+ function Fe(e, t) {
208
208
  te(e, void 0, "digestInto() output");
209
209
  const r = t.outputLen;
210
210
  if (e.length < r)
@@ -213,7 +213,7 @@ function Ve(e, t) {
213
213
  function sr(e) {
214
214
  return new Uint32Array(e.buffer, e.byteOffset, Math.floor(e.byteLength / 4));
215
215
  }
216
- function N(...e) {
216
+ function U(...e) {
217
217
  for (let t = 0; t < e.length; t++)
218
218
  e[t].fill(0);
219
219
  }
@@ -226,43 +226,43 @@ function m(e, t) {
226
226
  function or(e, t) {
227
227
  return e << t | e >>> 32 - t >>> 0;
228
228
  }
229
- const Fe = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
230
- function Ke(e) {
229
+ const Ke = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
230
+ function Me(e) {
231
231
  return e << 24 & 4278190080 | e << 8 & 16711680 | e >>> 8 & 65280 | e >>> 24 & 255;
232
232
  }
233
- function Me(e) {
233
+ function Ge(e) {
234
234
  for (let t = 0; t < e.length; t++)
235
- e[t] = Ke(e[t]);
235
+ e[t] = Me(e[t]);
236
236
  return e;
237
237
  }
238
- const ir = Fe ? (e) => e : Me;
239
- function Ge(e) {
238
+ const ir = Ke ? (e) => e : Ge;
239
+ function We(e) {
240
240
  if (typeof e != "string")
241
241
  throw new Error("string expected");
242
242
  return new Uint8Array(new TextEncoder().encode(e));
243
243
  }
244
244
  function ar(e, t = "") {
245
- return typeof e == "string" ? Ge(e) : te(e, void 0, t);
245
+ return typeof e == "string" ? We(e) : te(e, void 0, t);
246
246
  }
247
247
  function cr(e, t) {
248
248
  if (t !== void 0 && {}.toString.call(t) !== "[object Object]")
249
249
  throw new Error("options must be object or undefined");
250
250
  return Object.assign(e, t);
251
251
  }
252
- function pe(e, t = {}) {
252
+ function ge(e, t = {}) {
253
253
  const r = (s, c) => e(c).update(s).digest(), n = e(void 0);
254
254
  return r.outputLen = n.outputLen, r.blockLen = n.blockLen, r.create = (s) => e(s), Object.assign(r, t), Object.freeze(r);
255
255
  }
256
- const ge = (e) => ({
256
+ const ye = (e) => ({
257
257
  oid: Uint8Array.from([6, 9, 96, 134, 72, 1, 101, 3, 4, 2, e])
258
258
  });
259
- function We(e, t, r) {
259
+ function ze(e, t, r) {
260
260
  return e & t ^ ~e & r;
261
261
  }
262
- function ze(e, t, r) {
262
+ function Xe(e, t, r) {
263
263
  return e & t ^ e & r ^ t & r;
264
264
  }
265
- class ye {
265
+ class we {
266
266
  constructor(t, r, n, s) {
267
267
  f(this, "blockLen");
268
268
  f(this, "outputLen");
@@ -293,10 +293,10 @@ class ye {
293
293
  return this.length += t.length, this.roundClean(), this;
294
294
  }
295
295
  digestInto(t) {
296
- ie(this), Ve(t, this), this.finished = !0;
296
+ ie(this), Fe(t, this), this.finished = !0;
297
297
  const { buffer: r, view: n, blockLen: s, isLE: c } = this;
298
298
  let { pos: a } = this;
299
- r[a++] = 128, N(this.buffer.subarray(a)), this.padOffset > s - a && (this.process(n, 0), a = 0);
299
+ r[a++] = 128, U(this.buffer.subarray(a)), this.padOffset > s - a && (this.process(n, 0), a = 0);
300
300
  for (let l = a; l < s; l++)
301
301
  r[l] = 0;
302
302
  n.setBigUint64(s - 8, BigInt(this.length * 8), c), this.process(n, 0);
@@ -350,25 +350,25 @@ const B = /* @__PURE__ */ Uint32Array.from([
350
350
  4215389547,
351
351
  1541459225,
352
352
  327033209
353
- ]), V = /* @__PURE__ */ BigInt(2 ** 32 - 1), ae = /* @__PURE__ */ BigInt(32);
354
- function Xe(e, t = !1) {
355
- return t ? { h: Number(e & V), l: Number(e >> ae & V) } : { h: Number(e >> ae & V) | 0, l: Number(e & V) | 0 };
356
- }
353
+ ]), F = /* @__PURE__ */ BigInt(2 ** 32 - 1), ae = /* @__PURE__ */ BigInt(32);
357
354
  function je(e, t = !1) {
355
+ return t ? { h: Number(e & F), l: Number(e >> ae & F) } : { h: Number(e >> ae & F) | 0, l: Number(e & F) | 0 };
356
+ }
357
+ function Ye(e, t = !1) {
358
358
  const r = e.length;
359
359
  let n = new Uint32Array(r), s = new Uint32Array(r);
360
360
  for (let c = 0; c < r; c++) {
361
- const { h: a, l: i } = Xe(e[c], t);
361
+ const { h: a, l: i } = je(e[c], t);
362
362
  [n[c], s[c]] = [a, i];
363
363
  }
364
364
  return [n, s];
365
365
  }
366
- const ce = (e, t, r) => e >>> r, ue = (e, t, r) => e << 32 - r | t >>> r, $ = (e, t, r) => e >>> r | t << 32 - r, R = (e, t, r) => e << 32 - r | t >>> r, F = (e, t, r) => e << 64 - r | t >>> r - 32, K = (e, t, r) => e >>> r - 32 | t << 64 - r, ur = (e, t, r) => e << r | t >>> 32 - r, lr = (e, t, r) => t << r | e >>> 32 - r, fr = (e, t, r) => t << r - 32 | e >>> 64 - r, hr = (e, t, r) => e << r - 32 | t >>> 64 - r;
366
+ const ce = (e, t, r) => e >>> r, ue = (e, t, r) => e << 32 - r | t >>> r, $ = (e, t, r) => e >>> r | t << 32 - r, R = (e, t, r) => e << 32 - r | t >>> r, K = (e, t, r) => e << 64 - r | t >>> r - 32, M = (e, t, r) => e >>> r - 32 | t << 64 - r, ur = (e, t, r) => e << r | t >>> 32 - r, lr = (e, t, r) => t << r | e >>> 32 - r, fr = (e, t, r) => t << r - 32 | e >>> 64 - r, hr = (e, t, r) => e << r - 32 | t >>> 64 - r;
367
367
  function S(e, t, r, n) {
368
368
  const s = (t >>> 0) + (n >>> 0);
369
369
  return { h: e + r + (s / 2 ** 32 | 0) | 0, l: s | 0 };
370
370
  }
371
- const Ye = (e, t, r) => (e >>> 0) + (t >>> 0) + (r >>> 0), qe = (e, t, r, n) => t + r + n + (e / 2 ** 32 | 0) | 0, Qe = (e, t, r, n) => (e >>> 0) + (t >>> 0) + (r >>> 0) + (n >>> 0), Je = (e, t, r, n, s) => t + r + n + s + (e / 2 ** 32 | 0) | 0, Ze = (e, t, r, n, s) => (e >>> 0) + (t >>> 0) + (r >>> 0) + (n >>> 0) + (s >>> 0), et = (e, t, r, n, s, c) => t + r + n + s + c + (e / 2 ** 32 | 0) | 0, tt = /* @__PURE__ */ Uint32Array.from([
371
+ const qe = (e, t, r) => (e >>> 0) + (t >>> 0) + (r >>> 0), Qe = (e, t, r, n) => t + r + n + (e / 2 ** 32 | 0) | 0, Je = (e, t, r, n) => (e >>> 0) + (t >>> 0) + (r >>> 0) + (n >>> 0), Ze = (e, t, r, n, s) => t + r + n + s + (e / 2 ** 32 | 0) | 0, et = (e, t, r, n, s) => (e >>> 0) + (t >>> 0) + (r >>> 0) + (n >>> 0) + (s >>> 0), tt = (e, t, r, n, s, c) => t + r + n + s + c + (e / 2 ** 32 | 0) | 0, rt = /* @__PURE__ */ Uint32Array.from([
372
372
  1116352408,
373
373
  1899447441,
374
374
  3049323471,
@@ -434,7 +434,7 @@ const Ye = (e, t, r) => (e >>> 0) + (t >>> 0) + (r >>> 0), qe = (e, t, r, n) =>
434
434
  3204031479,
435
435
  3329325298
436
436
  ]), H = /* @__PURE__ */ new Uint32Array(64);
437
- class rt extends ye {
437
+ class nt extends we {
438
438
  constructor(t) {
439
439
  super(64, t, 8, !1);
440
440
  }
@@ -455,19 +455,19 @@ class rt extends ye {
455
455
  }
456
456
  let { A: n, B: s, C: c, D: a, E: i, F: o, G: u, H: h } = this;
457
457
  for (let l = 0; l < 64; l++) {
458
- const d = m(i, 6) ^ m(i, 11) ^ m(i, 25), x = h + d + We(i, o, u) + tt[l] + H[l] | 0, p = (m(n, 2) ^ m(n, 13) ^ m(n, 22)) + ze(n, s, c) | 0;
458
+ const d = m(i, 6) ^ m(i, 11) ^ m(i, 25), x = h + d + ze(i, o, u) + rt[l] + H[l] | 0, p = (m(n, 2) ^ m(n, 13) ^ m(n, 22)) + Xe(n, s, c) | 0;
459
459
  h = u, u = o, o = i, i = a + x | 0, a = c, c = s, s = n, n = x + p | 0;
460
460
  }
461
461
  n = n + this.A | 0, s = s + this.B | 0, c = c + this.C | 0, a = a + this.D | 0, i = i + this.E | 0, o = o + this.F | 0, u = u + this.G | 0, h = h + this.H | 0, this.set(n, s, c, a, i, o, u, h);
462
462
  }
463
463
  roundClean() {
464
- N(H);
464
+ U(H);
465
465
  }
466
466
  destroy() {
467
- this.set(0, 0, 0, 0, 0, 0, 0, 0), N(this.buffer);
467
+ this.set(0, 0, 0, 0, 0, 0, 0, 0), U(this.buffer);
468
468
  }
469
469
  }
470
- class nt extends rt {
470
+ class st extends nt {
471
471
  constructor() {
472
472
  super(32);
473
473
  // We cannot use array here since array allows indexing by variable
@@ -482,7 +482,7 @@ class nt extends rt {
482
482
  f(this, "H", B[7] | 0);
483
483
  }
484
484
  }
485
- const we = je([
485
+ const Pe = Ye([
486
486
  "0x428a2f98d728ae22",
487
487
  "0x7137449123ef65cd",
488
488
  "0xb5c0fbcfec4d3b2f",
@@ -563,8 +563,8 @@ const we = je([
563
563
  "0x597f299cfc657e2a",
564
564
  "0x5fcb6fab3ad6faec",
565
565
  "0x6c44198c4a475817"
566
- ].map((e) => BigInt(e))), st = we[0], ot = we[1], _ = /* @__PURE__ */ new Uint32Array(80), I = /* @__PURE__ */ new Uint32Array(80);
567
- class it extends ye {
566
+ ].map((e) => BigInt(e))), ot = Pe[0], it = Pe[1], _ = /* @__PURE__ */ new Uint32Array(80), I = /* @__PURE__ */ new Uint32Array(80);
567
+ class at extends we {
568
568
  constructor(t) {
569
569
  super(128, t, 16, !1);
570
570
  }
@@ -581,26 +581,26 @@ class it extends ye {
581
581
  for (let b = 0; b < 16; b++, r += 4)
582
582
  _[b] = t.getUint32(r), I[b] = t.getUint32(r += 4);
583
583
  for (let b = 16; b < 80; b++) {
584
- const v = _[b - 15] | 0, k = I[b - 15] | 0, z = $(v, k, 1) ^ $(v, k, 8) ^ ce(v, k, 7), X = R(v, k, 1) ^ R(v, k, 8) ^ ue(v, k, 7), E = _[b - 2] | 0, T = I[b - 2] | 0, U = $(E, T, 19) ^ F(E, T, 61) ^ ce(E, T, 6), j = R(E, T, 19) ^ K(E, T, 61) ^ ue(E, T, 6), D = Qe(X, j, I[b - 7], I[b - 16]), Y = Je(D, z, U, _[b - 7], _[b - 16]);
585
- _[b] = Y | 0, I[b] = D | 0;
584
+ const v = _[b - 15] | 0, k = I[b - 15] | 0, z = $(v, k, 1) ^ $(v, k, 8) ^ ce(v, k, 7), X = R(v, k, 1) ^ R(v, k, 8) ^ ue(v, k, 7), E = _[b - 2] | 0, T = I[b - 2] | 0, D = $(E, T, 19) ^ K(E, T, 61) ^ ce(E, T, 6), j = R(E, T, 19) ^ M(E, T, 61) ^ ue(E, T, 6), V = Je(X, j, I[b - 7], I[b - 16]), Y = Ze(V, z, D, _[b - 7], _[b - 16]);
585
+ _[b] = Y | 0, I[b] = V | 0;
586
586
  }
587
587
  let { Ah: n, Al: s, Bh: c, Bl: a, Ch: i, Cl: o, Dh: u, Dl: h, Eh: l, El: d, Fh: x, Fl: y, Gh: p, Gl: g, Hh: A, Hl: C } = this;
588
588
  for (let b = 0; b < 80; b++) {
589
- const v = $(l, d, 14) ^ $(l, d, 18) ^ F(l, d, 41), k = R(l, d, 14) ^ R(l, d, 18) ^ K(l, d, 41), z = l & x ^ ~l & p, X = d & y ^ ~d & g, E = Ze(C, k, X, ot[b], I[b]), T = et(E, A, v, z, st[b], _[b]), U = E | 0, j = $(n, s, 28) ^ F(n, s, 34) ^ F(n, s, 39), D = R(n, s, 28) ^ K(n, s, 34) ^ K(n, s, 39), Y = n & c ^ n & i ^ c & i, ve = s & a ^ s & o ^ a & o;
590
- A = p | 0, C = g | 0, p = x | 0, g = y | 0, x = l | 0, y = d | 0, { h: l, l: d } = S(u | 0, h | 0, T | 0, U | 0), u = i | 0, h = o | 0, i = c | 0, o = a | 0, c = n | 0, a = s | 0;
591
- const re = Ye(U, D, ve);
592
- n = qe(re, T, j, Y), s = re | 0;
589
+ const v = $(l, d, 14) ^ $(l, d, 18) ^ K(l, d, 41), k = R(l, d, 14) ^ R(l, d, 18) ^ M(l, d, 41), z = l & x ^ ~l & p, X = d & y ^ ~d & g, E = et(C, k, X, it[b], I[b]), T = tt(E, A, v, z, ot[b], _[b]), D = E | 0, j = $(n, s, 28) ^ K(n, s, 34) ^ K(n, s, 39), V = R(n, s, 28) ^ M(n, s, 34) ^ M(n, s, 39), Y = n & c ^ n & i ^ c & i, ke = s & a ^ s & o ^ a & o;
590
+ A = p | 0, C = g | 0, p = x | 0, g = y | 0, x = l | 0, y = d | 0, { h: l, l: d } = S(u | 0, h | 0, T | 0, D | 0), u = i | 0, h = o | 0, i = c | 0, o = a | 0, c = n | 0, a = s | 0;
591
+ const re = qe(D, V, ke);
592
+ n = Qe(re, T, j, Y), s = re | 0;
593
593
  }
594
594
  ({ h: n, l: s } = S(this.Ah | 0, this.Al | 0, n | 0, s | 0)), { h: c, l: a } = S(this.Bh | 0, this.Bl | 0, c | 0, a | 0), { h: i, l: o } = S(this.Ch | 0, this.Cl | 0, i | 0, o | 0), { h: u, l: h } = S(this.Dh | 0, this.Dl | 0, u | 0, h | 0), { h: l, l: d } = S(this.Eh | 0, this.El | 0, l | 0, d | 0), { h: x, l: y } = S(this.Fh | 0, this.Fl | 0, x | 0, y | 0), { h: p, l: g } = S(this.Gh | 0, this.Gl | 0, p | 0, g | 0), { h: A, l: C } = S(this.Hh | 0, this.Hl | 0, A | 0, C | 0), this.set(n, s, c, a, i, o, u, h, l, d, x, y, p, g, A, C);
595
595
  }
596
596
  roundClean() {
597
- N(_, I);
597
+ U(_, I);
598
598
  }
599
599
  destroy() {
600
- N(this.buffer), this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
600
+ U(this.buffer), this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
601
601
  }
602
602
  }
603
- class at extends it {
603
+ class ct extends at {
604
604
  constructor() {
605
605
  super(64);
606
606
  f(this, "Ah", P[0] | 0);
@@ -621,14 +621,14 @@ class at extends it {
621
621
  f(this, "Hl", P[15] | 0);
622
622
  }
623
623
  }
624
- const ct = /* @__PURE__ */ pe(
625
- () => new nt(),
626
- /* @__PURE__ */ ge(1)
627
- ), dr = /* @__PURE__ */ pe(
628
- () => new at(),
629
- /* @__PURE__ */ ge(3)
624
+ const ut = /* @__PURE__ */ ge(
625
+ () => new st(),
626
+ /* @__PURE__ */ ye(1)
627
+ ), dr = /* @__PURE__ */ ge(
628
+ () => new ct(),
629
+ /* @__PURE__ */ ye(3)
630
630
  ), le = 66;
631
- function Pe(e) {
631
+ function me(e) {
632
632
  if (!e.startsWith("0x") && !e.startsWith("0X"))
633
633
  throw new Error("Expected 0x-prefixed hex string");
634
634
  const t = e.slice(2);
@@ -641,7 +641,7 @@ function Pe(e) {
641
641
  r[n] = parseInt(t.slice(n * 2, n * 2 + 2), 16);
642
642
  return r;
643
643
  }
644
- function ut(e) {
644
+ function lt(e) {
645
645
  return `0x${Array.from(e).map((t) => t.toString(16).padStart(2, "0")).join("")}`;
646
646
  }
647
647
  function Z(e, t) {
@@ -650,33 +650,33 @@ function Z(e, t) {
650
650
  `${t} must be exactly 32 bytes (${le} hex chars with 0x prefix), got ${e.length}`
651
651
  );
652
652
  }
653
- function lt(e) {
653
+ function ft(e) {
654
654
  Z(e, "Secret");
655
- const t = Pe(e), r = ct(t);
656
- return ut(r);
655
+ const t = me(e), r = ut(t);
656
+ return lt(r);
657
657
  }
658
- function ft(e, t) {
659
- return Z(e, "Secret"), Z(t, "Hashlock"), Pe(t), lt(e).toLowerCase() === t.toLowerCase();
658
+ function ht(e, t) {
659
+ return Z(e, "Secret"), Z(t, "Hashlock"), me(t), ft(e).toLowerCase() === t.toLowerCase();
660
660
  }
661
- const ht = /^0x[0-9a-fA-F]{64}$/, dt = /^0x[0-9a-fA-F]{40}$/, bt = /^0x([0-9a-fA-F]{2})*$/;
661
+ const dt = /^0x[0-9a-fA-F]{64}$/, bt = /^0x[0-9a-fA-F]{40}$/, xt = /^0x([0-9a-fA-F]{2})*$/;
662
662
  function Q(e, t) {
663
663
  if (e.length !== 66)
664
664
  throw new Error(
665
665
  `${t} must be 32 bytes (66 hex chars with 0x prefix), got length ${e.length}`
666
666
  );
667
- if (!ht.test(e))
667
+ if (!dt.test(e))
668
668
  throw new Error(
669
669
  `${t} must contain only hex characters after the 0x prefix`
670
670
  );
671
671
  }
672
- function xt(e, t) {
673
- if (!dt.test(e))
672
+ function pt(e, t) {
673
+ if (!bt.test(e))
674
674
  throw new Error(
675
675
  `${t} must be a 20-byte 0x-prefixed hex address (42 chars)`
676
676
  );
677
677
  }
678
- function pt(e, t) {
679
- if (!bt.test(e))
678
+ function gt(e, t) {
679
+ if (!xt.test(e))
680
680
  throw new Error(
681
681
  `${t} must be a 0x-prefixed hex string with an even number of hex chars`
682
682
  );
@@ -690,27 +690,27 @@ async function br(e) {
690
690
  writeContract: c,
691
691
  signal: a
692
692
  } = e;
693
- a == null || a.throwIfAborted(), xt(t, "btcVaultRegistryAddress"), Q(r, "vaultId");
694
- const i = $e(e.secret);
695
- if (Q(i, "secret"), n !== void 0 && (Q(n, "hashlock"), !ft(i, n)))
693
+ a == null || a.throwIfAborted(), pt(t, "btcVaultRegistryAddress"), Q(r, "vaultId");
694
+ const i = Re(e.secret);
695
+ if (Q(i, "secret"), n !== void 0 && (Q(n, "hashlock"), !ht(i, n)))
696
696
  throw new Error(
697
697
  "Invalid secret: SHA256(secret) does not match the provided hashlock"
698
698
  );
699
- return pt(s, "activationMetadata"), c({
699
+ return gt(s, "activationMetadata"), c({
700
700
  address: t,
701
- abi: He,
701
+ abi: _e,
702
702
  functionName: "activateVaultWithSecret",
703
703
  args: [r, i, s]
704
704
  });
705
705
  }
706
- const gt = 1e4;
707
- async function me(e) {
706
+ const yt = 1e4;
707
+ async function Ee(e) {
708
708
  const {
709
709
  statusReader: t,
710
710
  peginTxid: r,
711
711
  targetStatuses: n,
712
712
  timeoutMs: s,
713
- pollIntervalMs: c = gt,
713
+ pollIntervalMs: c = yt,
714
714
  signal: a
715
715
  } = e, i = Date.now();
716
716
  for (; ; ) {
@@ -729,12 +729,12 @@ async function me(e) {
729
729
  )).status;
730
730
  if (n.has(u))
731
731
  return u;
732
- if (_e.has(u) && !n.has(u))
732
+ if (Ie.has(u) && !n.has(u))
733
733
  throw new Error(
734
734
  `Pegin ${r.slice(0, 8)}… reached terminal status "${u}" while waiting for ${[...n].join(", ")}`
735
735
  );
736
736
  } catch (o) {
737
- if (!(o instanceof Ie && o.code === Ce.NOT_FOUND || o instanceof Error && o.message.includes("PegIn not found")))
737
+ if (!(o instanceof Ce && o.code === Le.NOT_FOUND || o instanceof Error && o.message.includes("PegIn not found")))
738
738
  throw o;
739
739
  }
740
740
  await new Promise((o, u) => {
@@ -751,9 +751,9 @@ async function me(e) {
751
751
  });
752
752
  }
753
753
  }
754
- const yt = 300 * 1e3, wt = /* @__PURE__ */ new Set([
754
+ const wt = 300 * 1e3, Pt = /* @__PURE__ */ new Set([
755
755
  O.PENDING_DEPOSITOR_WOTS_PK,
756
- ...be
756
+ ...xe
757
757
  ]);
758
758
  async function xr(e) {
759
759
  const {
@@ -762,18 +762,18 @@ async function xr(e) {
762
762
  peginTxid: n,
763
763
  depositorPk: s,
764
764
  wotsPublicKeys: c,
765
- timeoutMs: a = yt,
765
+ timeoutMs: a = wt,
766
766
  signal: i
767
767
  } = e;
768
768
  i == null || i.throwIfAborted();
769
- const o = await me({
769
+ const o = await Ee({
770
770
  statusReader: t,
771
771
  peginTxid: n,
772
- targetStatuses: wt,
772
+ targetStatuses: Pt,
773
773
  timeoutMs: a,
774
774
  signal: i
775
775
  });
776
- be.has(o) || (i == null || i.throwIfAborted(), await r.submitDepositorWotsKey(
776
+ xe.has(o) || (i == null || i.throwIfAborted(), await r.submitDepositorWotsKey(
777
777
  {
778
778
  pegin_txid: n,
779
779
  depositor_pk: s,
@@ -782,7 +782,7 @@ async function xr(e) {
782
782
  i
783
783
  ));
784
784
  }
785
- const Pt = 1;
785
+ const fe = 1;
786
786
  function mt(e, t, r) {
787
787
  const n = ee.fromBase64(e), s = n.data.getTransaction().toString("hex").toLowerCase(), c = w(t).toLowerCase();
788
788
  if (s !== c)
@@ -797,31 +797,32 @@ function Et(e) {
797
797
  delete r.tapBip32Derivation, delete r.tapMerkleRoot;
798
798
  return t;
799
799
  }
800
- function fe(e, t, r) {
800
+ function he(e, t, r) {
801
801
  if (!e)
802
802
  throw new Error(`Missing ${r} PSBT`);
803
803
  const n = mt(e, t, r);
804
804
  return Et(n).toHex();
805
805
  }
806
806
  function Tt(e, t) {
807
- const r = [], n = [], s = [], c = G(
808
- t,
809
- Pt
810
- ), a = fe(
807
+ const r = [], n = [], s = [], c = he(
811
808
  e.payout_psbt,
812
809
  e.payout_tx.tx_hex,
813
810
  "depositor payout"
814
811
  );
815
- r.push(a), n.push(c);
816
- for (const i of e.challenger_presign_data) {
817
- const o = w(i.challenger_pubkey), u = r.length, h = fe(
818
- i.nopayout_psbt,
819
- i.nopayout_tx.tx_hex,
820
- `nopayout (challenger ${o})`
812
+ r.push(c), n.push(
813
+ N(t, fe)
814
+ );
815
+ for (const a of e.challenger_presign_data) {
816
+ const i = w(a.challenger_pubkey), o = r.length, u = he(
817
+ a.nopayout_psbt,
818
+ a.nopayout_tx.tx_hex,
819
+ `nopayout (challenger ${i})`
821
820
  );
822
- r.push(h), n.push(c), s.push({
823
- challengerPubkey: o,
824
- noPayoutIdx: u
821
+ r.push(u), n.push(
822
+ N(t, fe)
823
+ ), s.push({
824
+ challengerPubkey: i,
825
+ noPayoutIdx: o
825
826
  });
826
827
  }
827
828
  return { psbtHexes: r, signOptions: n, challengerEntries: s };
@@ -869,24 +870,24 @@ async function vt(e) {
869
870
  s
870
871
  );
871
872
  }
872
- const kt = 1200 * 1e3, Ee = /* @__PURE__ */ new Set([
873
+ const kt = 1200 * 1e3, Te = /* @__PURE__ */ new Set([
873
874
  O.PENDING_ACKS,
874
875
  O.PENDING_ACTIVATION,
875
876
  O.ACTIVATED
876
877
  ]), Bt = /* @__PURE__ */ new Set([
877
878
  O.PENDING_DEPOSITOR_SIGNATURES,
878
- ...Ee
879
+ ...Te
879
880
  ]);
880
881
  function Ht(e) {
881
882
  return e.map((t) => ({
882
- claimerPubkeyXOnly: M(t.claimer_pubkey),
883
+ claimerPubkeyXOnly: G(t.claimer_pubkey),
883
884
  payoutTxHex: t.payout_tx.tx_hex,
884
885
  assertTxHex: t.assert_tx.tx_hex
885
886
  }));
886
887
  }
887
888
  function _t(e) {
888
- const { output: t } = Re.payments.p2tr({
889
- internalPubkey: xe.from(e, "hex")
889
+ const { output: t } = Oe.payments.p2tr({
890
+ internalPubkey: pe.from(e, "hex")
890
891
  });
891
892
  if (!t)
892
893
  throw new Error("Failed to derive BIP-86 P2TR scriptPubKey");
@@ -908,7 +909,7 @@ function It(e, t) {
908
909
  );
909
910
  return `0x${_t(r)}`;
910
911
  }
911
- function he(e, t) {
912
+ function de(e, t) {
912
913
  return {
913
914
  payoutTxHex: e.payoutTxHex,
914
915
  peginTxHex: t.peginTxHex,
@@ -925,7 +926,7 @@ function he(e, t) {
925
926
  };
926
927
  }
927
928
  async function Ct(e, t, r, n) {
928
- const s = new Ue({
929
+ const s = new De({
929
930
  network: t.network,
930
931
  btcWallet: e
931
932
  }), c = r.length;
@@ -933,14 +934,14 @@ async function Ct(e, t, r, n) {
933
934
  let a;
934
935
  if (s.supportsBatchSigning())
935
936
  a = (await s.signPayoutTransactionsBatch(
936
- r.map((u) => he(u, t))
937
+ r.map((u) => de(u, t))
937
938
  )).map((u) => u.payoutSignature);
938
939
  else {
939
940
  a = [];
940
941
  for (let o = 0; o < r.length; o++) {
941
942
  n == null || n(o, c);
942
943
  const u = await s.signPayoutTransaction(
943
- he(r[o], t)
944
+ de(r[o], t)
944
945
  );
945
946
  a.push(u.signature);
946
947
  }
@@ -963,14 +964,14 @@ async function pr(e) {
963
964
  timeoutMs: i = kt,
964
965
  signal: o,
965
966
  onProgress: u
966
- } = e, h = await me({
967
+ } = e, h = await Ee({
967
968
  statusReader: t,
968
969
  peginTxid: s,
969
970
  targetStatuses: Bt,
970
971
  timeoutMs: i,
971
972
  signal: o
972
973
  });
973
- if (Ee.has(h))
974
+ if (Te.has(h))
974
975
  return;
975
976
  o == null || o.throwIfAborted();
976
977
  const l = await r.requestDepositorPresignTransactions(
@@ -981,8 +982,8 @@ async function pr(e) {
981
982
  o
982
983
  );
983
984
  o == null || o.throwIfAborted();
984
- const d = M(c), x = l.txs.filter(
985
- (C) => M(C.claimer_pubkey) !== d
985
+ const d = G(c), x = l.txs.filter(
986
+ (C) => G(C.claimer_pubkey) !== d
986
987
  ), y = Ht(x), p = await Ct(
987
988
  n,
988
989
  a,
@@ -1140,14 +1141,14 @@ function mr(e) {
1140
1141
  throw new Error(d.error);
1141
1142
  Ot(s), Nt(c), Ut(r);
1142
1143
  }
1143
- var Te = /* @__PURE__ */ ((e) => (e.CLAIM_EVENT_RECEIVED = "ClaimEventReceived", e.CLAIM_BROADCAST = "ClaimBroadcast", e.ASSERT_BROADCAST = "AssertBroadcast", e.CHALLENGE_ASSERT_OBSERVED = "ChallengeAssertObserved", e.WRONGLY_CHALLENGED_BROADCAST = "WronglyChallengedBroadcast", e.PAYOUT_BROADCAST = "PayoutBroadcast", e.FAILED = "Failed", e))(Te || {});
1144
+ var Se = /* @__PURE__ */ ((e) => (e.CLAIM_EVENT_RECEIVED = "ClaimEventReceived", e.CLAIM_BROADCAST = "ClaimBroadcast", e.ASSERT_BROADCAST = "AssertBroadcast", e.CHALLENGE_ASSERT_OBSERVED = "ChallengeAssertObserved", e.WRONGLY_CHALLENGED_BROADCAST = "WronglyChallengedBroadcast", e.PAYOUT_BROADCAST = "PayoutBroadcast", e.FAILED = "Failed", e))(Se || {});
1144
1145
  const Dt = /* @__PURE__ */ new Set([
1145
1146
  "PayoutBroadcast",
1146
1147
  "Failed"
1147
1148
  /* FAILED */
1148
1149
  ]);
1149
1150
  function Er(e) {
1150
- return Object.values(Te).includes(
1151
+ return Object.values(Se).includes(
1151
1152
  e
1152
1153
  );
1153
1154
  }
@@ -1162,8 +1163,8 @@ class Vt extends Error {
1162
1163
  this.name = "BIP68NotMatureError", this.vaultId = r, this.cause = n;
1163
1164
  }
1164
1165
  }
1165
- const Ft = /^0x[0-9a-fA-F]{64}$/, Kt = /^(?:0x)?(?:[0-9a-fA-F]{2})+$/, Se = /^(?:0x)?(?:[0-9a-fA-F]{64}|[0-9a-fA-F]{66})$/, Mt = 160, Gt = 1, de = 65535, Wt = /non-BIP68-final/i;
1166
- function Ae(e, t) {
1166
+ const Ft = /^0x[0-9a-fA-F]{64}$/, Kt = /^(?:0x)?(?:[0-9a-fA-F]{2})+$/, Ae = /^(?:0x)?(?:[0-9a-fA-F]{64}|[0-9a-fA-F]{66})$/, Mt = 160, Gt = 1, be = 65535, Wt = /non-BIP68-final/i;
1167
+ function ve(e, t) {
1167
1168
  if (e.length !== 66)
1168
1169
  throw new Error(
1169
1170
  `${t} must be 32 bytes (66 hex chars with 0x prefix), got length ${e.length}`
@@ -1178,9 +1179,9 @@ function J(e, t) {
1178
1179
  throw new Error(`${t} must be a non-negative integer, got ${e}`);
1179
1180
  }
1180
1181
  function zt(e) {
1181
- if (Ae(e.hashlock, "hashlock"), !Number.isInteger(e.htlcVout) || e.htlcVout < 0 || e.htlcVout > de)
1182
+ if (ve(e.hashlock, "hashlock"), !Number.isInteger(e.htlcVout) || e.htlcVout < 0 || e.htlcVout > be)
1182
1183
  throw new Error(
1183
- `htlcVout must be an integer 0-${de}, got ${e.htlcVout}`
1184
+ `htlcVout must be an integer 0-${be}, got ${e.htlcVout}`
1184
1185
  );
1185
1186
  if (J(e.offchainParamsVersion, "offchainParamsVersion"), J(e.appVaultKeepersVersion, "appVaultKeepersVersion"), J(
1186
1187
  e.universalChallengersVersion,
@@ -1191,7 +1192,7 @@ function zt(e) {
1191
1192
  throw new Error(
1192
1193
  "unsignedPrePeginTxHex must be a hex byte string (optional 0x prefix, even length)"
1193
1194
  );
1194
- if (!e.depositorBtcPubkey || !Se.test(e.depositorBtcPubkey))
1195
+ if (!e.depositorBtcPubkey || !Ae.test(e.depositorBtcPubkey))
1195
1196
  throw new Error(
1196
1197
  "depositorBtcPubkey must be 32 or 33 bytes of hex (optional 0x prefix)"
1197
1198
  );
@@ -1199,7 +1200,7 @@ function zt(e) {
1199
1200
  throw new Error(`amount must be a positive bigint, got ${e.amount}`);
1200
1201
  }
1201
1202
  function Xt(e) {
1202
- if (!e.vaultProviderPubkey || !Se.test(e.vaultProviderPubkey))
1203
+ if (!e.vaultProviderPubkey || !Ae.test(e.vaultProviderPubkey))
1203
1204
  throw new Error("vaultProviderPubkey must be 32 or 33 bytes of hex");
1204
1205
  if (e.vaultKeeperPubkeys.length === 0)
1205
1206
  throw new Error("vaultKeeperPubkeys must be non-empty");
@@ -1241,7 +1242,7 @@ async function Sr(e) {
1241
1242
  broadcastTx: a,
1242
1243
  signal: i
1243
1244
  } = e;
1244
- i == null || i.throwIfAborted(), Ae(t, "vaultId");
1245
+ i == null || i.throwIfAborted(), ve(t, "vaultId");
1245
1246
  const o = await r();
1246
1247
  zt(o), i == null || i.throwIfAborted();
1247
1248
  const u = await n(o);
@@ -1249,9 +1250,9 @@ async function Sr(e) {
1249
1250
  throw new Error(`feeRate must be a positive number, got ${s}`);
1250
1251
  const h = BigInt(Math.ceil(s * Mt));
1251
1252
  i == null || i.throwIfAborted();
1252
- const l = M(
1253
+ const l = G(
1253
1254
  o.depositorBtcPubkey
1254
- ), { psbtHex: d } = await Ne({
1255
+ ), { psbtHex: d } = await Ue({
1255
1256
  prePeginParams: {
1256
1257
  depositorPubkey: l,
1257
1258
  vaultProviderPubkey: w(u.vaultProviderPubkey),
@@ -1276,7 +1277,7 @@ async function Sr(e) {
1276
1277
  hashlock: w(o.hashlock)
1277
1278
  });
1278
1279
  i == null || i.throwIfAborted();
1279
- const x = G(
1280
+ const x = N(
1280
1281
  o.depositorBtcPubkey,
1281
1282
  Gt
1282
1283
  ), y = await c(d, x), p = jt(y);
@@ -1290,19 +1291,19 @@ async function Sr(e) {
1290
1291
  export {
1291
1292
  ir as A,
1292
1293
  Vt as B,
1293
- Te as C,
1294
- Ve as D,
1294
+ Se as C,
1295
+ Fe as D,
1295
1296
  ur as E,
1296
1297
  lr as F,
1297
1298
  fr as G,
1298
- ye as H,
1299
+ we as H,
1299
1300
  hr as I,
1300
1301
  q as J,
1301
1302
  cr as K,
1302
1303
  ar as L,
1303
1304
  dr as M,
1304
- ct as N,
1305
- Ue as P,
1305
+ ut as N,
1306
+ De as P,
1306
1307
  br as a,
1307
1308
  vt as b,
1308
1309
  wr as c,
@@ -1310,24 +1311,24 @@ export {
1310
1311
  $t as e,
1311
1312
  Rt as f,
1312
1313
  mr as g,
1313
- lt as h,
1314
+ ft as h,
1314
1315
  gr as i,
1315
- ft as j,
1316
+ ht as j,
1316
1317
  Er as k,
1317
1318
  Tr as l,
1318
1319
  Sr as m,
1319
1320
  nr as n,
1320
1321
  te as o,
1321
1322
  pr as p,
1322
- N as q,
1323
+ U as q,
1323
1324
  ie as r,
1324
1325
  xr as s,
1325
- pe as t,
1326
+ ge as t,
1326
1327
  or as u,
1327
1328
  yr as v,
1328
- me as w,
1329
- je as x,
1329
+ Ee as w,
1330
+ Ye as x,
1330
1331
  oe as y,
1331
1332
  sr as z
1332
1333
  };
1333
- //# sourceMappingURL=buildAndBroadcastRefund-D7NCbgtv.js.map
1334
+ //# sourceMappingURL=buildAndBroadcastRefund-Ccp-2GWW.js.map