@babylonlabs-io/ts-sdk 0.60.0 → 0.62.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 (103) hide show
  1. package/dist/PeginManager-BLBB_vMl.cjs +2 -0
  2. package/dist/PeginManager-BLBB_vMl.cjs.map +1 -0
  3. package/dist/{PeginManager-DKyNgvq1.js → PeginManager-Dj6_tWRA.js} +333 -285
  4. package/dist/PeginManager-Dj6_tWRA.js.map +1 -0
  5. package/dist/{buildAndBroadcastRefund-CoPc7UHA.js → buildAndBroadcastRefund-CH2awK6h.js} +552 -447
  6. package/dist/buildAndBroadcastRefund-CH2awK6h.js.map +1 -0
  7. package/dist/buildAndBroadcastRefund-CYzhA_B8.cjs +2 -0
  8. package/dist/buildAndBroadcastRefund-CYzhA_B8.cjs.map +1 -0
  9. package/dist/errors-D2zp7Vzk.cjs +2 -0
  10. package/dist/errors-D2zp7Vzk.cjs.map +1 -0
  11. package/dist/errors-lMX8Q6zb.js +137 -0
  12. package/dist/errors-lMX8Q6zb.js.map +1 -0
  13. package/dist/index.cjs +1 -1
  14. package/dist/index.js +204 -193
  15. package/dist/index.js.map +1 -1
  16. package/dist/{noPayout-qUEtRKc_.cjs → noPayout-CbxQqBw1.cjs} +2 -2
  17. package/dist/{noPayout-qUEtRKc_.cjs.map → noPayout-CbxQqBw1.cjs.map} +1 -1
  18. package/dist/{noPayout-DuE-UyhQ.js → noPayout-oaUVsEjk.js} +2 -2
  19. package/dist/{noPayout-DuE-UyhQ.js.map → noPayout-oaUVsEjk.js.map} +1 -1
  20. package/dist/parseFundingOutpoints-CIO9Ok1L.cjs +2 -0
  21. package/dist/parseFundingOutpoints-CIO9Ok1L.cjs.map +1 -0
  22. package/dist/parseFundingOutpoints-pBRE11Hr.js +92 -0
  23. package/dist/parseFundingOutpoints-pBRE11Hr.js.map +1 -0
  24. package/dist/{signPsbtsWithFallback-eY1YgV13.js → signPsbtsWithFallback-DC4rUCsy.js} +5 -5
  25. package/dist/signPsbtsWithFallback-DC4rUCsy.js.map +1 -0
  26. package/dist/{signPsbtsWithFallback-Xs4jZw5z.cjs → signPsbtsWithFallback-DbOmw8Ou.cjs} +2 -2
  27. package/dist/signPsbtsWithFallback-DbOmw8Ou.cjs.map +1 -0
  28. package/dist/tbv/core/deposit-terms/__tests__/prePeginApproval.test.d.ts +8 -0
  29. package/dist/tbv/core/deposit-terms/__tests__/prePeginApproval.test.d.ts.map +1 -0
  30. package/dist/tbv/core/deposit-terms/__tests__/rebuildDepositTermsCore.test.d.ts +16 -0
  31. package/dist/tbv/core/deposit-terms/__tests__/rebuildDepositTermsCore.test.d.ts.map +1 -0
  32. package/dist/tbv/core/deposit-terms/commissionCeiling.d.ts +33 -0
  33. package/dist/tbv/core/deposit-terms/commissionCeiling.d.ts.map +1 -0
  34. package/dist/tbv/core/deposit-terms/depositTerms.d.ts +3 -0
  35. package/dist/tbv/core/deposit-terms/depositTerms.d.ts.map +1 -1
  36. package/dist/tbv/core/deposit-terms/index.d.ts +3 -0
  37. package/dist/tbv/core/deposit-terms/index.d.ts.map +1 -1
  38. package/dist/tbv/core/deposit-terms/prePeginApproval.d.ts +37 -0
  39. package/dist/tbv/core/deposit-terms/prePeginApproval.d.ts.map +1 -0
  40. package/dist/tbv/core/deposit-terms/rebuildDepositTermsCore.d.ts +36 -0
  41. package/dist/tbv/core/deposit-terms/rebuildDepositTermsCore.d.ts.map +1 -0
  42. package/dist/tbv/core/index.cjs +1 -1
  43. package/dist/tbv/core/index.js +204 -193
  44. package/dist/tbv/core/index.js.map +1 -1
  45. package/dist/tbv/core/managers/PeginManager.d.ts +16 -0
  46. package/dist/tbv/core/managers/PeginManager.d.ts.map +1 -1
  47. package/dist/tbv/core/managers/__tests__/PeginManager.rebuildDepositTerms.test.d.ts +12 -0
  48. package/dist/tbv/core/managers/__tests__/PeginManager.rebuildDepositTerms.test.d.ts.map +1 -0
  49. package/dist/tbv/core/managers/index.cjs +1 -1
  50. package/dist/tbv/core/managers/index.js +2 -2
  51. package/dist/tbv/core/primitives/index.cjs +1 -1
  52. package/dist/tbv/core/primitives/index.js +2 -2
  53. package/dist/tbv/core/primitives/psbt/assertWasmPeginSizing.d.ts +3 -0
  54. package/dist/tbv/core/primitives/psbt/assertWasmPeginSizing.d.ts.map +1 -1
  55. package/dist/tbv/core/services/deposit/__tests__/peginRegistrationDepth.test.d.ts +2 -0
  56. package/dist/tbv/core/services/deposit/__tests__/peginRegistrationDepth.test.d.ts.map +1 -0
  57. package/dist/tbv/core/services/deposit/index.d.ts +1 -0
  58. package/dist/tbv/core/services/deposit/index.d.ts.map +1 -1
  59. package/dist/tbv/core/services/deposit/peginRegistrationDepth.d.ts +87 -0
  60. package/dist/tbv/core/services/deposit/peginRegistrationDepth.d.ts.map +1 -0
  61. package/dist/tbv/core/services/index.cjs +1 -1
  62. package/dist/tbv/core/services/index.js +48 -42
  63. package/dist/tbv/core/utils/eth/waitForTransactionReceiptSmartAware.d.ts +11 -0
  64. package/dist/tbv/core/utils/eth/waitForTransactionReceiptSmartAware.d.ts.map +1 -1
  65. package/dist/tbv/core/vault-secrets/deriveVaultRoot.d.ts +4 -0
  66. package/dist/tbv/core/vault-secrets/deriveVaultRoot.d.ts.map +1 -1
  67. package/dist/tbv/core/vault-secrets/index.cjs +1 -1
  68. package/dist/tbv/core/vault-secrets/index.d.ts +1 -1
  69. package/dist/tbv/core/vault-secrets/index.d.ts.map +1 -1
  70. package/dist/tbv/core/vault-secrets/index.js +9 -9
  71. package/dist/tbv/core/vault-secrets/index.js.map +1 -1
  72. package/dist/tbv/index.cjs +1 -1
  73. package/dist/tbv/index.js +204 -193
  74. package/dist/tbv/index.js.map +1 -1
  75. package/dist/{verifyScriptPathSchnorrSignature-CYjK4IP_.cjs → verifyScriptPathSchnorrSignature-B8zK1ctE.cjs} +2 -2
  76. package/dist/verifyScriptPathSchnorrSignature-B8zK1ctE.cjs.map +1 -0
  77. package/dist/{verifyScriptPathSchnorrSignature-Bav08_7R.js → verifyScriptPathSchnorrSignature-XsICweGG.js} +2 -1
  78. package/dist/verifyScriptPathSchnorrSignature-XsICweGG.js.map +1 -0
  79. package/dist/waitForTransactionReceiptSmartAware-AgZ-3WV_.cjs.map +1 -1
  80. package/dist/waitForTransactionReceiptSmartAware-lobLm0q0.js.map +1 -1
  81. package/package.json +1 -1
  82. package/dist/PeginManager-DKyNgvq1.js.map +0 -1
  83. package/dist/PeginManager-OXUOsgz2.cjs +0 -2
  84. package/dist/PeginManager-OXUOsgz2.cjs.map +0 -1
  85. package/dist/buildAndBroadcastRefund-BqYlx6rb.cjs +0 -2
  86. package/dist/buildAndBroadcastRefund-BqYlx6rb.cjs.map +0 -1
  87. package/dist/buildAndBroadcastRefund-CoPc7UHA.js.map +0 -1
  88. package/dist/deriveVaultRoot-D0RY5GJc.js +0 -72
  89. package/dist/deriveVaultRoot-D0RY5GJc.js.map +0 -1
  90. package/dist/deriveVaultRoot-p4uGsM7w.cjs +0 -2
  91. package/dist/deriveVaultRoot-p4uGsM7w.cjs.map +0 -1
  92. package/dist/errors-2aF9oRwM.cjs +0 -2
  93. package/dist/errors-2aF9oRwM.cjs.map +0 -1
  94. package/dist/errors-kXGQXKxZ.js +0 -28
  95. package/dist/errors-kXGQXKxZ.js.map +0 -1
  96. package/dist/parseFundingOutpoints-C_-PT9BT.cjs +0 -2
  97. package/dist/parseFundingOutpoints-C_-PT9BT.cjs.map +0 -1
  98. package/dist/parseFundingOutpoints-GSM-IaaK.js +0 -17
  99. package/dist/parseFundingOutpoints-GSM-IaaK.js.map +0 -1
  100. package/dist/signPsbtsWithFallback-Xs4jZw5z.cjs.map +0 -1
  101. package/dist/signPsbtsWithFallback-eY1YgV13.js.map +0 -1
  102. package/dist/verifyScriptPathSchnorrSignature-Bav08_7R.js.map +0 -1
  103. package/dist/verifyScriptPathSchnorrSignature-CYjK4IP_.cjs.map +0 -1
@@ -1,42 +1,42 @@
1
- var Wt = Object.defineProperty;
2
- var Lt = (s, e, t) => e in s ? Wt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
- var y = (s, e, t) => Lt(s, typeof e != "symbol" ? e + "" : e, t);
4
- import { c as Bt, H as Dt, r as M, a as W, b as ot, u as Xt, d as nt, e as rt, f as it, g as Kt, s as Et } from "./sha2-BYVxyZzX.js";
5
- import * as vt from "bitcoinjs-lib";
6
- import { Transaction as qt, Psbt as at } from "bitcoinjs-lib";
1
+ var Lt = Object.defineProperty;
2
+ var Xt = (s, e, t) => e in s ? Lt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
+ var y = (s, e, t) => Xt(s, typeof e != "symbol" ? e + "" : e, t);
4
+ import { c as vt, H as Kt, r as M, a as W, b as nt, u as qt, d as rt, e as it, f as at, g as Gt, s as Bt } from "./sha2-BYVxyZzX.js";
5
+ import * as Et from "bitcoinjs-lib";
6
+ import { Transaction as At, Psbt as ct } from "bitcoinjs-lib";
7
7
  import { Buffer as j } from "buffer";
8
- import { isAddressEqual as ct, encodeFunctionData as Q, zeroAddress as Gt } from "viem";
8
+ import { isAddressEqual as lt, encodeFunctionData as Q, zeroAddress as zt } from "viem";
9
9
  import { B as H } from "./BTCVaultRegistry.abi-B3BLhpJ4.js";
10
10
  import { h as R } from "./errors-Blc-JWnI.js";
11
- import { expandWotsSeed as zt, expandHashlockSecret as Yt, expandAuthAnchor as jt, deriveVaultId as lt } from "@babylonlabs-io/babylon-tbv-rust-wasm";
12
- import { a as ut, b as Qt, d as ht, f as Zt } from "./verifyScriptPathSchnorrSignature-Bav08_7R.js";
13
- import { b as Jt, e as te, f as ee } from "./peginInput-HQPWZfly.js";
14
- import { u as Z, e as S, p as se, i as dt, h as gt, s as v, k as ft, X as oe } from "./bitcoin-d9eaaZB_.js";
15
- import { M as L, B as ne } from "./constants-GjWXdaqV.js";
11
+ import { expandWotsSeed as Yt, expandHashlockSecret as jt, expandAuthAnchor as Qt, deriveVaultId as ut } from "@babylonlabs-io/babylon-tbv-rust-wasm";
12
+ import { a as ht, b as Zt, d as dt, f as Jt } from "./verifyScriptPathSchnorrSignature-XsICweGG.js";
13
+ import { b as te, e as ee, f as se } from "./peginInput-HQPWZfly.js";
14
+ import { p as oe, h as Z, u as J, e as _, i as gt, s as E, k as ft, X as ne } from "./bitcoin-d9eaaZB_.js";
16
15
  import { c as re } from "./signing-DaLvGwQe.js";
17
16
  import { M as pt } from "./validation-Dj3dqYtl.js";
18
- import { d as ie } from "./deriveVaultRoot-D0RY5GJc.js";
19
- import { c as ae, a as ce, s as mt, b as le } from "./signPsbtsWithFallback-eY1YgV13.js";
17
+ import { p as ie, d as Ct } from "./parseFundingOutpoints-pBRE11Hr.js";
18
+ import { c as ae, b as ce, s as mt, d as le } from "./signPsbtsWithFallback-DC4rUCsy.js";
20
19
  import { s as ue, f as X, i as he, w as bt } from "./waitForTransactionReceiptSmartAware-lobLm0q0.js";
21
20
  import { p as de, f as ge } from "./fundPeginTransaction-B2wyjqp0.js";
22
- import { p as fe, V as pe, i as me } from "./mempoolApi-DC7pID6B.js";
21
+ import { M as D, B as fe } from "./constants-GjWXdaqV.js";
22
+ import { p as pe, V as me, i as be } from "./mempoolApi-DC7pID6B.js";
23
23
  const U = /* @__PURE__ */ BigInt(2 ** 32 - 1), Pt = /* @__PURE__ */ BigInt(32);
24
- function be(s, e = !1) {
24
+ function Pe(s, e = !1) {
25
25
  return e ? { h: Number(s & U), l: Number(s >> Pt & U) } : { h: Number(s >> Pt & U) | 0, l: Number(s & U) | 0 };
26
26
  }
27
- function Pe(s, e = !1) {
27
+ function we(s, e = !1) {
28
28
  const t = s.length;
29
29
  let o = new Uint32Array(t), n = new Uint32Array(t);
30
30
  for (let r = 0; r < t; r++) {
31
- const { h: i, l: a } = be(s[r], e);
31
+ const { h: i, l: a } = Pe(s[r], e);
32
32
  [o[r], n[r]] = [i, a];
33
33
  }
34
34
  return [o, n];
35
35
  }
36
- const we = (s, e, t) => s << t | e >>> 32 - t, xe = (s, e, t) => e << t | s >>> 32 - t, ye = (s, e, t) => e << t - 32 | s >>> 64 - t, ke = (s, e, t) => s << t - 32 | e >>> 64 - t, Te = 64;
36
+ const xe = (s, e, t) => s << t | e >>> 32 - t, ye = (s, e, t) => e << t | s >>> 32 - t, ke = (s, e, t) => e << t - 32 | s >>> 64 - t, Te = (s, e, t) => s << t - 32 | e >>> 64 - t, ve = 64;
37
37
  function Be(s) {
38
38
  const e = s.prepeginTxid.toLowerCase();
39
- if (!/^[0-9a-f]+$/.test(e) || e.length !== Te)
39
+ if (!/^[0-9a-f]+$/.test(e) || e.length !== ve)
40
40
  throw new Error(
41
41
  `buildDepositTerms: prepeginTxid must be 64 hex chars, got "${s.prepeginTxid}"`
42
42
  );
@@ -44,11 +44,11 @@ function Be(s) {
44
44
  throw new Error("buildDepositTerms: at least one pegin amount is required");
45
45
  if (s.timelockPegin <= 0 || s.timelockAssert <= 0 || s.timelockRefund <= 0)
46
46
  throw new Error("buildDepositTerms: timelocks must be positive");
47
- if (!Number.isInteger(s.maxAcceptableCommissionBps) || s.maxAcceptableCommissionBps < 0 || s.maxAcceptableCommissionBps >= L)
47
+ if (!Number.isInteger(s.maxAcceptableCommissionBps) || s.maxAcceptableCommissionBps < 0 || s.maxAcceptableCommissionBps >= D)
48
48
  throw new Error(
49
- `buildDepositTerms: maxAcceptableCommissionBps must be an integer in [0, ${L}), got ${s.maxAcceptableCommissionBps}`
49
+ `buildDepositTerms: maxAcceptableCommissionBps must be an integer in [0, ${D}), got ${s.maxAcceptableCommissionBps}`
50
50
  );
51
- const t = BigInt(ne), o = s.peginAmounts.map(
51
+ const t = BigInt(fe), o = s.peginAmounts.map(
52
52
  (n, r) => ({
53
53
  htlcVout: r,
54
54
  vaultProviderBtcPubkey: s.vaultProviderBtcPubkey,
@@ -75,7 +75,74 @@ function Be(s) {
75
75
  vaults: o
76
76
  };
77
77
  }
78
- const Ee = /* @__PURE__ */ Uint8Array.from([
78
+ const tt = 25, _t = 9999;
79
+ function K(s) {
80
+ if (!Number.isInteger(s) || s < 0 || s >= D)
81
+ throw new Error(
82
+ `Quoted commissionBps must be an integer in [0, ${D}), got ${s}`
83
+ );
84
+ return Math.min(
85
+ s + tt,
86
+ _t
87
+ );
88
+ }
89
+ const Ee = /^0x[0-9a-f]+$/i, Ae = /^[0-9a-f]+$/i, Ce = /^[A-Za-z0-9+/]+={0,2}$/;
90
+ function $(s) {
91
+ if (typeof s != "string" || s.length === 0)
92
+ throw new Error("BTC wallet returned empty public key");
93
+ return oe(s).toLowerCase();
94
+ }
95
+ function _e(s) {
96
+ if (typeof s != "string" || s.length === 0)
97
+ throw new Error("BTC wallet returned empty BIP-322 signature");
98
+ if (s.startsWith("0x") || s.startsWith("0X")) {
99
+ if (!Ee.test(s) || s.length < 4 || s.length % 2 !== 0)
100
+ throw new Error("BTC wallet returned malformed hex BIP-322 signature");
101
+ return s.toLowerCase();
102
+ }
103
+ if (Ae.test(s)) {
104
+ if (s.length % 2 !== 0)
105
+ throw new Error("BTC wallet returned malformed hex BIP-322 signature");
106
+ return `0x${s.toLowerCase()}`;
107
+ }
108
+ if (!Ce.test(s) || s.length % 4 !== 0)
109
+ throw new Error("BTC wallet returned malformed base64 BIP-322 signature");
110
+ const e = j.from(s, "base64");
111
+ if (e.length === 0 || e.toString("base64") !== s)
112
+ throw new Error("BTC wallet returned malformed base64 BIP-322 signature");
113
+ return `0x${e.toString("hex")}`;
114
+ }
115
+ async function Se(s) {
116
+ const { wallet: e, depositTerms: t, fundedPrePeginTxHex: o, depositorBtcPubkey: n } = s, r = typeof e.approveDepositTerms == "function" ? e.approveDepositTerms : void 0;
117
+ if (!r && !t)
118
+ return;
119
+ const i = o.startsWith("0x") ? o.slice(2) : o, c = At.fromHex(i).getId();
120
+ if (t && t.prepeginTxid.replace(/^0x/, "").toLowerCase() !== c)
121
+ throw new Error(
122
+ `Deposit terms do not match the transaction being broadcast: terms are for prepeginTxid ${t.prepeginTxid}, but this transaction is ${c}.`
123
+ );
124
+ if (!r)
125
+ return;
126
+ if (!t)
127
+ throw new Error(
128
+ "This wallet requires approved deposit terms before signing the Pre-PegIn transaction, but none were provided. Pass PreparePeginResult.depositTerms (fresh flows) or a resume rebuild."
129
+ );
130
+ if (typeof e.deriveContextHash != "function")
131
+ throw new Error(
132
+ "A deposit-approval wallet must also implement deriveContextHash, but this one does not."
133
+ );
134
+ const l = ie(o);
135
+ (await Ct(
136
+ { deriveContextHash: e.deriveContextHash.bind(e) },
137
+ {
138
+ depositorBtcPubkey: Z(
139
+ $(n)
140
+ ),
141
+ fundingOutpoints: l
142
+ }
143
+ )).fill(0), await r(t);
144
+ }
145
+ const Ie = /* @__PURE__ */ Uint8Array.from([
79
146
  7,
80
147
  4,
81
148
  13,
@@ -92,25 +159,25 @@ const Ee = /* @__PURE__ */ Uint8Array.from([
92
159
  14,
93
160
  11,
94
161
  8
95
- ]), At = Uint8Array.from(new Array(16).fill(0).map((s, e) => e)), ve = At.map((s) => (9 * s + 5) % 16), _t = /* @__PURE__ */ (() => {
96
- const t = [[At], [ve]];
162
+ ]), St = Uint8Array.from(new Array(16).fill(0).map((s, e) => e)), He = St.map((s) => (9 * s + 5) % 16), It = /* @__PURE__ */ (() => {
163
+ const t = [[St], [He]];
97
164
  for (let o = 0; o < 4; o++)
98
165
  for (let n of t)
99
- n.push(n[o].map((r) => Ee[r]));
166
+ n.push(n[o].map((r) => Ie[r]));
100
167
  return t;
101
- })(), St = _t[0], Ct = _t[1], It = /* @__PURE__ */ [
168
+ })(), Ht = It[0], Rt = It[1], $t = /* @__PURE__ */ [
102
169
  [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],
103
170
  [12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7],
104
171
  [13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],
105
172
  [14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],
106
173
  [15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5]
107
- ].map((s) => Uint8Array.from(s)), Ae = /* @__PURE__ */ St.map((s, e) => s.map((t) => It[e][t])), _e = /* @__PURE__ */ Ct.map((s, e) => s.map((t) => It[e][t])), Se = /* @__PURE__ */ Uint32Array.from([
174
+ ].map((s) => Uint8Array.from(s)), Re = /* @__PURE__ */ Ht.map((s, e) => s.map((t) => $t[e][t])), $e = /* @__PURE__ */ Rt.map((s, e) => s.map((t) => $t[e][t])), Oe = /* @__PURE__ */ Uint32Array.from([
108
175
  0,
109
176
  1518500249,
110
177
  1859775393,
111
178
  2400959708,
112
179
  2840853838
113
- ]), Ce = /* @__PURE__ */ Uint32Array.from([
180
+ ]), Ve = /* @__PURE__ */ Uint32Array.from([
114
181
  1352829926,
115
182
  1548603684,
116
183
  1836072691,
@@ -121,7 +188,7 @@ function wt(s, e, t, o) {
121
188
  return s === 0 ? e ^ t ^ o : s === 1 ? e & t | ~e & o : s === 2 ? (e | ~t) ^ o : s === 3 ? e & o | t & ~o : e ^ (t | ~o);
122
189
  }
123
190
  const F = /* @__PURE__ */ new Uint32Array(16);
124
- class Ie extends Dt {
191
+ class Me extends Kt {
125
192
  constructor() {
126
193
  super(64, 20, 8, !0);
127
194
  y(this, "h0", 1732584193);
@@ -140,19 +207,19 @@ class Ie extends Dt {
140
207
  process(t, o) {
141
208
  for (let d = 0; d < 16; d++, o += 4)
142
209
  F[d] = t.getUint32(o, !0);
143
- let n = this.h0 | 0, r = n, i = this.h1 | 0, a = i, c = this.h2 | 0, u = c, l = this.h3 | 0, m = l, P = this.h4 | 0, w = P;
210
+ let n = this.h0 | 0, r = n, i = this.h1 | 0, a = i, c = this.h2 | 0, l = c, u = this.h3 | 0, m = u, P = this.h4 | 0, w = P;
144
211
  for (let d = 0; d < 5; d++) {
145
- const E = 4 - d, k = Se[d], f = Ce[d], A = St[d], p = Ct[d], b = Ae[d], T = _e[d];
212
+ const B = 4 - d, k = Oe[d], f = Ve[d], A = Ht[d], p = Rt[d], b = Re[d], T = $e[d];
146
213
  for (let h = 0; h < 16; h++) {
147
- const x = M(n + wt(d, i, c, l) + F[A[h]] + k, b[h]) + P | 0;
148
- n = P, P = l, l = M(c, 10) | 0, c = i, i = x;
214
+ const x = M(n + wt(d, i, c, u) + F[A[h]] + k, b[h]) + P | 0;
215
+ n = P, P = u, u = M(c, 10) | 0, c = i, i = x;
149
216
  }
150
217
  for (let h = 0; h < 16; h++) {
151
- const x = M(r + wt(E, a, u, m) + F[p[h]] + f, T[h]) + w | 0;
152
- r = w, w = m, m = M(u, 10) | 0, u = a, a = x;
218
+ const x = M(r + wt(B, a, l, m) + F[p[h]] + f, T[h]) + w | 0;
219
+ r = w, w = m, m = M(l, 10) | 0, l = a, a = x;
153
220
  }
154
221
  }
155
- this.set(this.h1 + c + m | 0, this.h2 + l + w | 0, this.h3 + P + r | 0, this.h4 + n + a | 0, this.h0 + i + u | 0);
222
+ this.set(this.h1 + c + m | 0, this.h2 + u + w | 0, this.h3 + P + r | 0, this.h4 + n + a | 0, this.h0 + i + l | 0);
156
223
  }
157
224
  roundClean() {
158
225
  W(F);
@@ -161,29 +228,29 @@ class Ie extends Dt {
161
228
  this.destroyed = !0, W(this.buffer), this.set(0, 0, 0, 0, 0);
162
229
  }
163
230
  }
164
- const He = /* @__PURE__ */ Bt(() => new Ie()), Re = BigInt(0), O = BigInt(1), $e = BigInt(2), Oe = BigInt(7), Ve = BigInt(256), Me = BigInt(113), Ht = [], Rt = [], $t = [];
165
- for (let s = 0, e = O, t = 1, o = 0; s < 24; s++) {
166
- [t, o] = [o, (2 * t + 3 * o) % 5], Ht.push(2 * (5 * o + t)), Rt.push((s + 1) * (s + 2) / 2 % 64);
167
- let n = Re;
231
+ const Ue = /* @__PURE__ */ vt(() => new Me()), Fe = BigInt(0), V = BigInt(1), Ne = BigInt(2), We = BigInt(7), De = BigInt(256), Le = BigInt(113), Ot = [], Vt = [], Mt = [];
232
+ for (let s = 0, e = V, t = 1, o = 0; s < 24; s++) {
233
+ [t, o] = [o, (2 * t + 3 * o) % 5], Ot.push(2 * (5 * o + t)), Vt.push((s + 1) * (s + 2) / 2 % 64);
234
+ let n = Fe;
168
235
  for (let r = 0; r < 7; r++)
169
- e = (e << O ^ (e >> Oe) * Me) % Ve, e & $e && (n ^= O << (O << BigInt(r)) - O);
170
- $t.push(n);
236
+ e = (e << V ^ (e >> We) * Le) % De, e & Ne && (n ^= V << (V << BigInt(r)) - V);
237
+ Mt.push(n);
171
238
  }
172
- const Ot = Pe($t, !0), Ue = Ot[0], Fe = Ot[1], xt = (s, e, t) => t > 32 ? ye(s, e, t) : we(s, e, t), yt = (s, e, t) => t > 32 ? ke(s, e, t) : xe(s, e, t);
173
- function Ne(s, e = 24) {
239
+ const Ut = we(Mt, !0), Xe = Ut[0], Ke = Ut[1], xt = (s, e, t) => t > 32 ? ke(s, e, t) : xe(s, e, t), yt = (s, e, t) => t > 32 ? Te(s, e, t) : ye(s, e, t);
240
+ function qe(s, e = 24) {
174
241
  const t = new Uint32Array(10);
175
242
  for (let o = 24 - e; o < 24; o++) {
176
243
  for (let i = 0; i < 10; i++)
177
244
  t[i] = s[i] ^ s[i + 10] ^ s[i + 20] ^ s[i + 30] ^ s[i + 40];
178
245
  for (let i = 0; i < 10; i += 2) {
179
- const a = (i + 8) % 10, c = (i + 2) % 10, u = t[c], l = t[c + 1], m = xt(u, l, 1) ^ t[a], P = yt(u, l, 1) ^ t[a + 1];
246
+ const a = (i + 8) % 10, c = (i + 2) % 10, l = t[c], u = t[c + 1], m = xt(l, u, 1) ^ t[a], P = yt(l, u, 1) ^ t[a + 1];
180
247
  for (let w = 0; w < 50; w += 10)
181
248
  s[i + w] ^= m, s[i + w + 1] ^= P;
182
249
  }
183
250
  let n = s[2], r = s[3];
184
251
  for (let i = 0; i < 24; i++) {
185
- const a = Rt[i], c = xt(n, r, a), u = yt(n, r, a), l = Ht[i];
186
- n = s[l], r = s[l + 1], s[l] = c, s[l + 1] = u;
252
+ const a = Vt[i], c = xt(n, r, a), l = yt(n, r, a), u = Ot[i];
253
+ n = s[u], r = s[u + 1], s[u] = c, s[u + 1] = l;
187
254
  }
188
255
  for (let i = 0; i < 50; i += 10) {
189
256
  for (let a = 0; a < 10; a++)
@@ -191,11 +258,11 @@ function Ne(s, e = 24) {
191
258
  for (let a = 0; a < 10; a++)
192
259
  s[i + a] ^= ~t[(a + 2) % 10] & t[(a + 4) % 10];
193
260
  }
194
- s[0] ^= Ue[o], s[1] ^= Fe[o];
261
+ s[0] ^= Xe[o], s[1] ^= Ke[o];
195
262
  }
196
263
  W(t);
197
264
  }
198
- class et {
265
+ class st {
199
266
  // NOTE: we accept arguments in bytes instead of bits here.
200
267
  constructor(e, t, o, n = !1, r = 24) {
201
268
  y(this, "state");
@@ -209,18 +276,18 @@ class et {
209
276
  y(this, "outputLen");
210
277
  y(this, "enableXOF", !1);
211
278
  y(this, "rounds");
212
- if (this.blockLen = e, this.suffix = t, this.outputLen = o, this.enableXOF = n, this.rounds = r, ot(o, "outputLen"), !(0 < e && e < 200))
279
+ if (this.blockLen = e, this.suffix = t, this.outputLen = o, this.enableXOF = n, this.rounds = r, nt(o, "outputLen"), !(0 < e && e < 200))
213
280
  throw new Error("only keccak-f1600 function is supported");
214
- this.state = new Uint8Array(200), this.state32 = Xt(this.state);
281
+ this.state = new Uint8Array(200), this.state32 = qt(this.state);
215
282
  }
216
283
  clone() {
217
284
  return this._cloneInto();
218
285
  }
219
286
  keccak() {
220
- nt(this.state32), Ne(this.state32, this.rounds), nt(this.state32), this.posOut = 0, this.pos = 0;
287
+ rt(this.state32), qe(this.state32, this.rounds), rt(this.state32), this.posOut = 0, this.pos = 0;
221
288
  }
222
289
  update(e) {
223
- rt(this), it(e);
290
+ it(this), at(e);
224
291
  const { blockLen: t, state: o } = this, n = e.length;
225
292
  for (let r = 0; r < n; ) {
226
293
  const i = Math.min(t - this.pos, n - r);
@@ -238,7 +305,7 @@ class et {
238
305
  e[o] ^= t, (t & 128) !== 0 && o === n - 1 && this.keccak(), e[n - 1] ^= 128, this.keccak();
239
306
  }
240
307
  writeInto(e) {
241
- rt(this, !1), it(e), this.finish();
308
+ it(this, !1), at(e), this.finish();
242
309
  const t = this.state, { blockLen: o } = this;
243
310
  for (let n = 0, r = e.length; n < r; ) {
244
311
  this.posOut >= o && this.keccak();
@@ -253,10 +320,10 @@ class et {
253
320
  return this.writeInto(e);
254
321
  }
255
322
  xof(e) {
256
- return ot(e), this.xofInto(new Uint8Array(e));
323
+ return nt(e), this.xofInto(new Uint8Array(e));
257
324
  }
258
325
  digestInto(e) {
259
- if (Kt(e, this), this.finished)
326
+ if (Gt(e, this), this.finished)
260
327
  throw new Error("digest() was already called");
261
328
  return this.writeInto(e), this.destroy(), e;
262
329
  }
@@ -268,26 +335,26 @@ class et {
268
335
  }
269
336
  _cloneInto(e) {
270
337
  const { blockLen: t, suffix: o, outputLen: n, rounds: r, enableXOF: i } = this;
271
- return e || (e = new et(t, o, n, i, r)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = r, e.suffix = o, e.outputLen = n, e.enableXOF = i, e.destroyed = this.destroyed, e;
338
+ return e || (e = new st(t, o, n, i, r)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = r, e.suffix = o, e.outputLen = n, e.enableXOF = i, e.destroyed = this.destroyed, e;
272
339
  }
273
340
  }
274
- const We = (s, e, t, o = {}) => Bt(() => new et(e, s, t), o), Le = /* @__PURE__ */ We(1, 136, 32), kt = 64, _ = 20, J = 4, Vt = 2, De = 0, Xe = 1, N = [64, 64], Ke = (s) => Array.from(s).map((e) => e.toString(16).padStart(2, "0")).join("");
275
- function st(s) {
276
- return He(Et(s));
341
+ const Ge = (s, e, t, o = {}) => vt(() => new st(e, s, t), o), ze = /* @__PURE__ */ Ge(1, 136, 32), kt = 64, C = 20, et = 4, Ft = 2, Ye = 0, je = 1, N = [64, 64], Qe = (s) => Array.from(s).map((e) => e.toString(16).padStart(2, "0")).join("");
342
+ function ot(s) {
343
+ return Ue(Bt(s));
277
344
  }
278
- function Mt(s) {
345
+ function Nt(s) {
279
346
  return (1 << s) - 1;
280
347
  }
281
- function qe(s) {
348
+ function Ze(s) {
282
349
  let e = 1;
283
350
  for (; e * e < s + 1; ) e++;
284
351
  return Math.max(e, 2);
285
352
  }
286
- function Ge(s) {
287
- const e = J, t = s * Mt(e);
288
- return { d: e, n: s, checksum_radix: qe(t) };
353
+ function Je(s) {
354
+ const e = et, t = s * Nt(e);
355
+ return { d: e, n: s, checksum_radix: Ze(t) };
289
356
  }
290
- function K(s, e) {
357
+ function q(s, e) {
291
358
  const t = [];
292
359
  let o = e;
293
360
  for (; o > 0; )
@@ -296,41 +363,41 @@ function K(s, e) {
296
363
  n.set(s);
297
364
  for (let r = 0; r < t.length; r++)
298
365
  n[s.length + r] = t[r];
299
- return st(n);
366
+ return ot(n);
300
367
  }
301
- function q(s, e) {
368
+ function G(s, e) {
302
369
  let t = s;
303
370
  for (let o = 0; o < e; o++)
304
- t = st(t);
371
+ t = ot(t);
305
372
  return t;
306
373
  }
307
- function ze(s, e) {
308
- const t = Mt(e.d), o = e.checksum_radix - 1, n = Math.floor(e.n * t / e.checksum_radix), r = [];
309
- for (let l = 0; l < e.n; l++) {
310
- const m = K(s, l + Vt), P = q(m, t);
374
+ function ts(s, e) {
375
+ const t = Nt(e.d), o = e.checksum_radix - 1, n = Math.floor(e.n * t / e.checksum_radix), r = [];
376
+ for (let u = 0; u < e.n; u++) {
377
+ const m = q(s, u + Ft), P = G(m, t);
311
378
  r.push(Array.from(P));
312
379
  }
313
- const i = K(
380
+ const i = q(
314
381
  s,
315
- De
316
- ), a = q(
382
+ Ye
383
+ ), a = G(
317
384
  i,
318
385
  o
319
- ), c = K(
386
+ ), c = q(
320
387
  s,
321
- Xe
322
- ), u = q(
388
+ je
389
+ ), l = G(
323
390
  c,
324
391
  n
325
392
  );
326
393
  return {
327
394
  config: e,
328
395
  message_terminals: r,
329
- checksum_major_terminal: Array.from(u),
396
+ checksum_major_terminal: Array.from(l),
330
397
  checksum_minor_terminal: Array.from(a)
331
398
  };
332
399
  }
333
- async function Ye(s) {
400
+ async function es(s) {
334
401
  try {
335
402
  if (s.length !== kt)
336
403
  throw new Error(
@@ -338,14 +405,14 @@ async function Ye(s) {
338
405
  );
339
406
  const e = [];
340
407
  for (let t = 0; t < N.length; t++) {
341
- const o = N[t], n = Ge(o), r = new Uint8Array(s.length + 1);
408
+ const o = N[t], n = Je(o), r = new Uint8Array(s.length + 1);
342
409
  r.set(s), r[s.length] = t;
343
- const i = st(r);
410
+ const i = ot(r);
344
411
  try {
345
- const a = ze(i, n);
346
- if (a.config.d !== J)
412
+ const a = ts(i, n);
413
+ if (a.config.d !== et)
347
414
  throw new Error(
348
- `Block ${t}: expected d=${J}, got d=${a.config.d}`
415
+ `Block ${t}: expected d=${et}, got d=${a.config.d}`
349
416
  );
350
417
  if (a.config.n !== o)
351
418
  throw new Error(
@@ -356,17 +423,17 @@ async function Ye(s) {
356
423
  `Block ${t}: expected ${o} message terminals, got ${a.message_terminals.length}`
357
424
  );
358
425
  for (let c = 0; c < a.message_terminals.length; c++)
359
- if (a.message_terminals[c].length !== _)
426
+ if (a.message_terminals[c].length !== C)
360
427
  throw new Error(
361
- `Block ${t} terminal ${c}: expected ${_} bytes, got ${a.message_terminals[c].length}`
428
+ `Block ${t} terminal ${c}: expected ${C} bytes, got ${a.message_terminals[c].length}`
362
429
  );
363
- if (a.checksum_minor_terminal.length !== _)
430
+ if (a.checksum_minor_terminal.length !== C)
364
431
  throw new Error(
365
- `Block ${t} checksum_minor: expected ${_} bytes`
432
+ `Block ${t} checksum_minor: expected ${C} bytes`
366
433
  );
367
- if (a.checksum_major_terminal.length !== _)
434
+ if (a.checksum_major_terminal.length !== C)
368
435
  throw new Error(
369
- `Block ${t} checksum_major: expected ${_} bytes`
436
+ `Block ${t} checksum_major: expected ${C} bytes`
370
437
  );
371
438
  e.push(a);
372
439
  } finally {
@@ -382,10 +449,10 @@ async function Ye(s) {
382
449
  s.fill(0);
383
450
  }
384
451
  }
385
- function G(s, e, t) {
386
- if (s.length !== _)
452
+ function z(s, e, t) {
453
+ if (s.length !== C)
387
454
  throw new Error(
388
- `Block ${e} ${t}: expected ${_} bytes, got ${s.length}`
455
+ `Block ${e} ${t}: expected ${C} bytes, got ${s.length}`
389
456
  );
390
457
  for (let o = 0; o < s.length; o++) {
391
458
  const n = s[o];
@@ -395,43 +462,43 @@ function G(s, e, t) {
395
462
  );
396
463
  }
397
464
  }
398
- function je(s) {
465
+ function ss(s) {
399
466
  if (s.length === 0)
400
467
  throw new Error("Public keys array must not be empty");
401
468
  for (let r = 0; r < s.length; r++) {
402
469
  const i = s[r];
403
- G(i.checksum_minor_terminal, r, "checksum_minor_terminal"), G(i.checksum_major_terminal, r, "checksum_major_terminal");
470
+ z(i.checksum_minor_terminal, r, "checksum_minor_terminal"), z(i.checksum_major_terminal, r, "checksum_major_terminal");
404
471
  for (let a = 0; a < i.message_terminals.length; a++)
405
- G(i.message_terminals[a], r, `message_terminal[${a}]`);
472
+ z(i.message_terminals[a], r, `message_terminal[${a}]`);
406
473
  }
407
474
  let e = 0;
408
475
  for (const r of s)
409
- e += Vt + r.message_terminals.length;
410
- const t = new Uint8Array(e * _);
476
+ e += Ft + r.message_terminals.length;
477
+ const t = new Uint8Array(e * C);
411
478
  let o = 0;
412
479
  for (const r of s) {
413
- t.set(r.checksum_minor_terminal, o), o += _, t.set(r.checksum_major_terminal, o), o += _;
480
+ t.set(r.checksum_minor_terminal, o), o += C, t.set(r.checksum_major_terminal, o), o += C;
414
481
  for (const i of r.message_terminals)
415
- t.set(i, o), o += _;
482
+ t.set(i, o), o += C;
416
483
  }
417
- const n = Le(t);
418
- return `0x${Ke(n)}`;
484
+ const n = ze(t);
485
+ return `0x${Qe(n)}`;
419
486
  }
420
- async function Qe(s, e) {
487
+ async function os(s, e) {
421
488
  const t = [], o = [], n = [], r = [];
422
489
  try {
423
490
  for (let i = 0; i < e; i++) {
424
- const a = await zt(s, i);
491
+ const a = await Yt(s, i);
425
492
  try {
426
- const u = await Ye(a);
427
- t.push(u), o.push(je(u));
493
+ const l = await es(a);
494
+ t.push(l), o.push(ss(l));
428
495
  } finally {
429
496
  a.fill(0);
430
497
  }
431
- const c = await Yt(s, i);
498
+ const c = await jt(s, i);
432
499
  try {
433
- const u = Z(c);
434
- n.push(u), r.push(ae(S(u)).slice(2));
500
+ const l = J(c);
501
+ n.push(l), r.push(ae(_(l)).slice(2));
435
502
  } finally {
436
503
  c.fill(0);
437
504
  }
@@ -441,45 +508,8 @@ async function Qe(s, e) {
441
508
  }
442
509
  return { perVaultWotsKeys: t, wotsPkHashes: o, htlcSecretHexes: n, hashlocks: r };
443
510
  }
444
- const Ze = /^0x[0-9a-f]+$/i, Je = /^[0-9a-f]+$/i, ts = /^[A-Za-z0-9+/]+={0,2}$/;
445
- function V(s) {
446
- if (typeof s != "string" || s.length === 0)
447
- throw new Error("BTC wallet returned empty public key");
448
- return se(s).toLowerCase();
449
- }
450
- function es(s) {
451
- if (typeof s != "string" || s.length === 0)
452
- throw new Error("BTC wallet returned empty BIP-322 signature");
453
- if (s.startsWith("0x") || s.startsWith("0X")) {
454
- if (!Ze.test(s) || s.length < 4 || s.length % 2 !== 0)
455
- throw new Error("BTC wallet returned malformed hex BIP-322 signature");
456
- return s.toLowerCase();
457
- }
458
- if (Je.test(s)) {
459
- if (s.length % 2 !== 0)
460
- throw new Error("BTC wallet returned malformed hex BIP-322 signature");
461
- return `0x${s.toLowerCase()}`;
462
- }
463
- if (!ts.test(s) || s.length % 4 !== 0)
464
- throw new Error("BTC wallet returned malformed base64 BIP-322 signature");
465
- const e = j.from(s, "base64");
466
- if (e.length === 0 || e.toString("base64") !== s)
467
- throw new Error("BTC wallet returned malformed base64 BIP-322 signature");
468
- return `0x${e.toString("hex")}`;
469
- }
470
- const Ut = 0, tt = 25, Ft = 9999;
471
- function z(s) {
472
- if (!Number.isInteger(s) || s < 0 || s >= L)
473
- throw new Error(
474
- `Quoted commissionBps must be an integer in [0, ${L}), got ${s}`
475
- );
476
- return Math.min(
477
- s + tt,
478
- Ft
479
- );
480
- }
481
- const Y = "00".repeat(32);
482
- function ss(s, e) {
511
+ const Wt = 0, Y = "00".repeat(32);
512
+ function ns(s, e) {
483
513
  const t = {
484
514
  bitcoin: "bc",
485
515
  testnet: "tb",
@@ -487,23 +517,23 @@ function ss(s, e) {
487
517
  regtest: "bcrt"
488
518
  };
489
519
  try {
490
- const o = vt.address.fromBech32(s);
520
+ const o = Et.address.fromBech32(s);
491
521
  return o.prefix === t[e] && o.version === 0 && o.data.length === 20;
492
522
  } catch {
493
523
  return !1;
494
524
  }
495
525
  }
496
- function os(s, e, t, o) {
526
+ function rs(s, e, t, o) {
497
527
  const n = t == null ? void 0 : t[`${s}:${e}`];
498
528
  return n ? Promise.resolve({
499
529
  txid: s,
500
530
  vout: e,
501
531
  value: n.value,
502
532
  scriptPubKey: n.scriptPubKey
503
- }) : me(s, e, o);
533
+ }) : be(s, e, o);
504
534
  }
505
535
  const Tt = 12e4;
506
- class Ss {
536
+ class Is {
507
537
  /**
508
538
  * Creates a new PeginManager instance.
509
539
  *
@@ -526,8 +556,8 @@ class Ss {
526
556
  async preparePegin(e) {
527
557
  if (e.amounts.length === 0)
528
558
  throw new Error("amounts must contain at least one entry");
529
- const t = await this.config.btcWallet.getPublicKeyHex(), o = V(t);
530
- if (!dt(
559
+ const t = await this.config.btcWallet.getPublicKeyHex(), o = $(t);
560
+ if (!gt(
531
561
  e.changeAddress,
532
562
  t,
533
563
  this.config.btcNetwork
@@ -537,25 +567,25 @@ class Ss {
537
567
  );
538
568
  const n = await this.prepareSizing(o, e), r = n.selectedUTXOs.map(
539
569
  (f) => ({
540
- txid: gt(f.txid),
570
+ txid: Z(f.txid),
541
571
  vout: f.vout
542
572
  })
543
- ), i = await ie(this.config.btcWallet, {
544
- depositorBtcPubkey: gt(o),
573
+ ), i = await Ct(this.config.btcWallet, {
574
+ depositorBtcPubkey: Z(o),
545
575
  fundingOutpoints: r
546
576
  });
547
577
  let a, c;
548
578
  try {
549
- const f = await jt(i);
579
+ const f = await Qt(i);
550
580
  try {
551
- a = Z(f), c = Z(Et(f));
581
+ a = J(f), c = J(Bt(f));
552
582
  } finally {
553
583
  f.fill(0);
554
584
  }
555
585
  } catch (f) {
556
586
  throw i.fill(0), f;
557
587
  }
558
- const u = await Qe(i, e.amounts.length), { perVaultWotsKeys: l, wotsPkHashes: m, htlcSecretHexes: P, hashlocks: w } = u, d = await this.preparePeginCommit({
588
+ const l = await os(i, e.amounts.length), { perVaultWotsKeys: u, wotsPkHashes: m, htlcSecretHexes: P, hashlocks: w } = l, d = await this.preparePeginCommit({
559
589
  depositorBtcPubkeyRaw: t,
560
590
  depositorBtcPubkey: o,
561
591
  hashlocks: w,
@@ -573,7 +603,7 @@ class Ss {
573
603
  e.amounts.length,
574
604
  c
575
605
  );
576
- const { depositTerms: E, ...k } = d;
606
+ const { depositTerms: B, ...k } = d;
577
607
  return {
578
608
  transaction: {
579
609
  ...k,
@@ -583,12 +613,12 @@ class Ss {
583
613
  },
584
614
  depositorBtcPubkey: o,
585
615
  derivedSecrets: {
586
- perVaultWotsKeys: l,
616
+ perVaultWotsKeys: u,
587
617
  wotsPkHashes: m,
588
618
  htlcSecretHexes: P,
589
619
  authAnchorHex: a
590
620
  },
591
- depositTerms: E
621
+ depositTerms: B
592
622
  };
593
623
  }
594
624
  /**
@@ -610,12 +640,12 @@ class Ss {
610
640
  async prepareSizing(e, t) {
611
641
  const o = t.amounts.map(
612
642
  () => Y
613
- ), n = t.vaultKeeperBtcPubkeys.length, r = await ut({
643
+ ), n = t.vaultKeeperBtcPubkeys.length, r = await ht({
614
644
  vaultCoreVersion: t.vaultCoreVersion,
615
645
  depositorPubkey: e,
616
- vaultProviderPubkey: v(t.vaultProviderBtcPubkey),
617
- vaultKeeperPubkeys: t.vaultKeeperBtcPubkeys.map(v),
618
- universalChallengerPubkeys: t.universalChallengerBtcPubkeys.map(v),
646
+ vaultProviderPubkey: E(t.vaultProviderBtcPubkey),
647
+ vaultKeeperPubkeys: t.vaultKeeperBtcPubkeys.map(E),
648
+ universalChallengerPubkeys: t.universalChallengerBtcPubkeys.map(E),
619
649
  hashlocks: o,
620
650
  timelockRefund: t.timelockRefund,
621
651
  pegInAmounts: t.amounts,
@@ -657,13 +687,13 @@ class Ss {
657
687
  throw new Error(
658
688
  "preparePeginCommit refusing to build with sizing-pass placeholder auth-anchor hash — internal substitution bug"
659
689
  );
660
- const u = v(
690
+ const l = E(
661
691
  a.vaultProviderBtcPubkey
662
- ), l = a.vaultKeeperBtcPubkeys.map(v), m = a.universalChallengerBtcPubkeys.map(v), P = l.length, w = {
692
+ ), u = a.vaultKeeperBtcPubkeys.map(E), m = a.universalChallengerBtcPubkeys.map(E), P = u.length, w = {
663
693
  vaultCoreVersion: a.vaultCoreVersion,
664
694
  depositorPubkey: o,
665
- vaultProviderPubkey: u,
666
- vaultKeeperPubkeys: l,
695
+ vaultProviderPubkey: l,
696
+ vaultKeeperPubkeys: u,
667
697
  universalChallengerPubkeys: m,
668
698
  hashlocks: n,
669
699
  timelockRefund: a.timelockRefund,
@@ -675,39 +705,39 @@ class Ss {
675
705
  councilSize: a.councilSize,
676
706
  network: this.config.btcNetwork,
677
707
  authAnchorHash: r
678
- }, d = await ut(w), E = ft(this.config.btcNetwork), k = ge({
708
+ }, d = await ht(w), B = ft(this.config.btcNetwork), k = ge({
679
709
  unfundedTxHex: d.psbtHex,
680
710
  selectedUTXOs: i.selectedUTXOs,
681
711
  changeAddress: a.changeAddress,
682
712
  changeAmount: i.changeAmount,
683
- network: E
684
- }), f = i.selectedUTXOs.reduce((g, B) => g + BigInt(B.value), 0n) - d.totalOutputValue - i.changeAmount;
713
+ network: B
714
+ }), f = i.selectedUTXOs.reduce((g, v) => g + BigInt(v.value), 0n) - d.totalOutputValue - i.changeAmount;
685
715
  if (f !== i.fee)
686
716
  throw new Error(
687
717
  `Pre-PegIn funded fee ${f} does not match the sizing-pass fee ${i.fee}; refusing to publish a deposit-terms fee bound the funded transaction does not pay.`
688
718
  );
689
- const A = v(
719
+ const A = E(
690
720
  X(k)
691
721
  ), p = [], b = [], T = [];
692
722
  for (let g = 0; g < n.length; g++) {
693
- const B = await Qt({
723
+ const v = await Zt({
694
724
  prePeginParams: w,
695
725
  timelockPegin: a.timelockPegin,
696
726
  fundedPrePeginTxHex: k,
697
727
  htlcVout: g
698
- }), I = await Jt({
728
+ }), I = await te({
699
729
  vaultCoreVersion: a.vaultCoreVersion,
700
- peginTxHex: B.txHex,
730
+ peginTxHex: v.txHex,
701
731
  fundedPrePeginTxHex: k,
702
732
  depositorPubkey: o,
703
- vaultProviderPubkey: u,
704
- vaultKeeperPubkeys: l,
733
+ vaultProviderPubkey: l,
734
+ vaultKeeperPubkeys: u,
705
735
  universalChallengerPubkeys: m,
706
736
  hashlock: n[g],
707
737
  timelockRefund: a.timelockRefund,
708
738
  network: this.config.btcNetwork
709
739
  });
710
- p.push(B), b.push(I.psbtHex), T.push(
740
+ p.push(v), b.push(I.psbtHex), T.push(
711
741
  re(t, 1)
712
742
  );
713
743
  }
@@ -719,10 +749,10 @@ class Ss {
719
749
  timelockRefund: a.timelockRefund,
720
750
  prepeginTxid: A,
721
751
  prepeginMaxFee: i.fee,
722
- vaultProviderBtcPubkey: u,
723
- vaultKeeperBtcPubkeys: l,
752
+ vaultProviderBtcPubkey: l,
753
+ vaultKeeperBtcPubkeys: u,
724
754
  universalChallengerBtcPubkeys: m,
725
- maxAcceptableCommissionBps: z(
755
+ maxAcceptableCommissionBps: K(
726
756
  a.commissionBps
727
757
  ),
728
758
  peginAmounts: a.amounts,
@@ -734,36 +764,36 @@ class Ss {
734
764
  this.config.btcWallet,
735
765
  b,
736
766
  T
737
- ), C = [];
767
+ ), S = [];
738
768
  for (let g = 0; g < x.length; g++) {
739
- ht({
769
+ dt({
740
770
  requestedPsbtHex: b[g],
741
771
  returnedPsbtHex: x[g]
742
772
  });
743
- const B = te(
773
+ const v = ee(
744
774
  x[g],
745
775
  o
746
776
  );
747
- Zt({
777
+ Jt({
748
778
  requestedPsbtHex: b[g],
749
- signatureHex: B,
779
+ signatureHex: v,
750
780
  signerXOnlyPubkeyHex: o,
751
781
  inputIndex: 0
752
782
  });
753
- const I = ee(x[g]);
754
- C.push({
783
+ const I = se(x[g]);
784
+ S.push({
755
785
  htlcVout: g,
756
786
  htlcValue: d.htlcValues[g],
757
787
  peginTxHex: I,
758
788
  peginTxid: p[g].txid,
759
- peginInputSignature: B,
789
+ peginInputSignature: v,
760
790
  vaultScriptPubKey: p[g].vaultScriptPubKey
761
791
  });
762
792
  }
763
793
  return {
764
794
  fundedPrePeginTxHex: k,
765
795
  prePeginTxid: A,
766
- perVault: C,
796
+ perVault: S,
767
797
  depositTerms: h
768
798
  };
769
799
  }
@@ -778,25 +808,33 @@ class Ss {
778
808
  * 5. Finalizes and extracts the transaction
779
809
  * 6. Broadcasts via mempool API
780
810
  *
811
+ * IMPORTANT — this method does NOT gate on Ethereum finality. Committing
812
+ * BTC to the HTLC while the peg-in registration is still reorg-exposed can
813
+ * strand the deposit: the vault record disappears from the chain while the
814
+ * BTC stays locked until the HTLC refund timelock. Callers must await
815
+ * `waitForPeginRegistrationDepth` for the registered vault(s) before calling
816
+ * this. The gate is not applied here because the params carry no vault ID —
817
+ * adding one would be a breaking signature change.
818
+ *
781
819
  * @param params - Transaction hex and depositor public key
782
820
  * @returns The broadcasted Bitcoin transaction ID
783
821
  * @throws Error if signing or broadcasting fails
784
822
  */
785
823
  async signAndBroadcast(e) {
786
- const { fundedPrePeginTxHex: t, depositorBtcPubkey: o } = e, n = t.startsWith("0x") ? t.slice(2) : t, r = qt.fromHex(n);
824
+ const { fundedPrePeginTxHex: t, depositorBtcPubkey: o } = e, n = t.startsWith("0x") ? t.slice(2) : t, r = At.fromHex(n);
787
825
  if (r.ins.length === 0)
788
826
  throw new Error("Transaction has no inputs");
789
- const i = new at();
827
+ const i = new ct();
790
828
  i.setVersion(r.version), i.setLocktime(r.locktime);
791
829
  const a = j.from(
792
- V(o),
830
+ $(o),
793
831
  "hex"
794
- ), c = this.config.mempoolApiUrl, u = r.ins.map((p) => {
832
+ ), c = this.config.mempoolApiUrl, l = r.ins.map((p) => {
795
833
  const b = j.from(p.hash).reverse().toString("hex"), T = p.index;
796
- return os(b, T, e.localPrevouts, c).then(
834
+ return rs(b, T, e.localPrevouts, c).then(
797
835
  (h) => ({ input: p, utxoData: h, txid: b, vout: T })
798
836
  );
799
- }), l = await Promise.all(u), m = l.reduce(
837
+ }), u = await Promise.all(l), m = u.reduce(
800
838
  (p, b) => p + BigInt(b.utxoData.value),
801
839
  0n
802
840
  ), P = r.outs.reduce(
@@ -812,7 +850,7 @@ class Ss {
812
850
  throw new Error(
813
851
  `Implied transaction fee (${w} sat) exceeds maximum reasonable fee (${pt} sat). This may indicate manipulated UTXO data.`
814
852
  );
815
- for (const { input: p, utxoData: b, txid: T, vout: h } of l) {
853
+ for (const { input: p, utxoData: b, txid: T, vout: h } of u) {
816
854
  const x = he(
817
855
  {
818
856
  value: b.value,
@@ -832,12 +870,18 @@ class Ss {
832
870
  script: p.script,
833
871
  value: p.value
834
872
  });
835
- const d = i.toHex(), E = await this.config.btcWallet.signPsbt(d);
836
- ht({
873
+ await Se({
874
+ wallet: this.config.btcWallet,
875
+ depositTerms: e.depositTerms,
876
+ fundedPrePeginTxHex: t,
877
+ depositorBtcPubkey: o
878
+ });
879
+ const d = i.toHex(), B = await this.config.btcWallet.signPsbt(d);
880
+ dt({
837
881
  requestedPsbtHex: d,
838
- returnedPsbtHex: E
882
+ returnedPsbtHex: B
839
883
  });
840
- const k = at.fromHex(E);
884
+ const k = ct.fromHex(B);
841
885
  try {
842
886
  k.finalizeAllInputs();
843
887
  } catch (p) {
@@ -849,7 +893,7 @@ class Ss {
849
893
  );
850
894
  }
851
895
  const f = k.extractTransaction().toHex();
852
- return await fe(f, c);
896
+ return await pe(f, c);
853
897
  }
854
898
  /**
855
899
  * Registers a peg-in on Ethereum by calling the BTCVaultRegistry contract.
@@ -884,24 +928,24 @@ class Ss {
884
928
  htlcVout: i,
885
929
  depositorPayoutBtcAddress: a,
886
930
  depositorWotsPkHash: c,
887
- popSignature: u
931
+ popSignature: l
888
932
  } = e;
889
933
  if (!this.config.ethWallet.account)
890
934
  throw new Error("Ethereum wallet account not found");
891
- const l = this.config.ethWallet.account.address;
892
- if (!ct(u.depositorEthAddress, l))
935
+ const u = this.config.ethWallet.account.address;
936
+ if (!lt(l.depositorEthAddress, u))
893
937
  throw new Error(
894
- `Proof of possession was signed for ${u.depositorEthAddress} but the Ethereum wallet is currently connected to ${l}. Reconnect the original account or call signProofOfPossession() again.`
938
+ `Proof of possession was signed for ${l.depositorEthAddress} but the Ethereum wallet is currently connected to ${u}. Reconnect the original account or call signProofOfPossession() again.`
895
939
  );
896
- const m = await this.assertPopMatchesBtcWallet(u), P = u.btcPopSignature, w = S(
897
- u.depositorBtcPubkey
898
- ), d = S(t), E = S(o), k = a ?? await this.config.btcWallet.getAddress(), f = this.resolvePayoutScriptPubKey(
940
+ const m = await this.assertPopMatchesBtcWallet(l), P = l.btcPopSignature, w = _(
941
+ l.depositorBtcPubkey
942
+ ), d = _(t), B = _(o), k = a ?? await this.config.btcWallet.getAddress(), f = this.resolvePayoutScriptPubKey(
899
943
  m,
900
944
  k
901
- ), A = X(E), p = await lt(
902
- v(A),
903
- v(l)
904
- ), b = S(p);
945
+ ), A = X(B), p = await ut(
946
+ E(A),
947
+ E(u)
948
+ ), b = _(p);
905
949
  if (await this.checkVaultExists(b))
906
950
  throw new Error(
907
951
  `Vault already exists (ID: ${b}, peginTxHash: ${A}). Vault IDs are derived from the pegin transaction hash and depositor address. To create a new vault, use different UTXOs or a different amount to generate a unique transaction.`
@@ -915,42 +959,42 @@ class Ss {
915
959
  functionName: "getPegInFee",
916
960
  args: [n]
917
961
  });
918
- } catch ($) {
962
+ } catch (O) {
919
963
  throw new Error(
920
964
  "Failed to query pegin fee from the contract. Please check your network connection and that the contract address is correct.",
921
- { cause: $ }
965
+ { cause: O }
922
966
  );
923
967
  }
924
- const C = await this.resolveMaxAcceptableCommissionBps(
968
+ const S = await this.resolveMaxAcceptableCommissionBps(
925
969
  n,
926
970
  e.quotedCommissionBps
927
971
  ), g = Q({
928
972
  abi: H,
929
973
  functionName: "submitPeginRequest",
930
974
  args: [
931
- l,
975
+ u,
932
976
  w,
933
977
  P,
934
978
  d,
935
- E,
979
+ B,
936
980
  n,
937
- C,
981
+ S,
938
982
  r,
939
983
  i,
940
984
  f,
941
985
  c
942
986
  ]
943
987
  });
944
- let B;
988
+ let v;
945
989
  try {
946
- B = await h.estimateGas({
990
+ v = await h.estimateGas({
947
991
  to: this.config.vaultContracts.btcVaultRegistry,
948
992
  data: g,
949
993
  value: x,
950
994
  account: this.config.ethWallet.account.address
951
995
  });
952
- } catch ($) {
953
- R($);
996
+ } catch (O) {
997
+ R(O);
954
998
  }
955
999
  let I;
956
1000
  try {
@@ -960,23 +1004,23 @@ class Ss {
960
1004
  value: x,
961
1005
  account: this.config.ethWallet.account,
962
1006
  chain: this.config.ethChain,
963
- gas: B
1007
+ gas: v
964
1008
  });
965
- } catch ($) {
966
- R($);
1009
+ } catch (O) {
1010
+ R(O);
967
1011
  }
968
- const D = await bt({
1012
+ const L = await bt({
969
1013
  publicClient: h,
970
1014
  walletAddress: this.config.ethWallet.account.address,
971
1015
  hash: I,
972
1016
  timeout: Tt
973
1017
  });
974
- return D.status === "reverted" && R(
1018
+ return L.status === "reverted" && R(
975
1019
  new Error(
976
- `Transaction reverted. Hash: ${D.transactionHash}. Check the transaction on block explorer for details.`
1020
+ `Transaction reverted. Hash: ${L.transactionHash}. Check the transaction on block explorer for details.`
977
1021
  )
978
1022
  ), {
979
- ethTxHash: D.transactionHash,
1023
+ ethTxHash: L.transactionHash,
980
1024
  vaultId: b,
981
1025
  peginTxHash: A
982
1026
  };
@@ -998,28 +1042,28 @@ class Ss {
998
1042
  if (!this.config.ethWallet.account)
999
1043
  throw new Error("Ethereum wallet account not found");
1000
1044
  const i = this.config.ethWallet.account.address;
1001
- if (!ct(r.depositorEthAddress, i))
1045
+ if (!lt(r.depositorEthAddress, i))
1002
1046
  throw new Error(
1003
1047
  `Proof of possession was signed for ${r.depositorEthAddress} but the Ethereum wallet is currently connected to ${i}. Reconnect the original account or call signProofOfPossession() again.`
1004
1048
  );
1005
- const a = await this.assertPopMatchesBtcWallet(r), c = r.btcPopSignature, u = n.map(
1049
+ const a = await this.assertPopMatchesBtcWallet(r), c = r.btcPopSignature, l = n.map(
1006
1050
  (h) => this.resolvePayoutScriptPubKey(
1007
1051
  a,
1008
1052
  h.depositorPayoutBtcAddress
1009
1053
  )
1010
- ), l = [];
1054
+ ), u = [];
1011
1055
  for (const h of n) {
1012
- const x = S(
1056
+ const x = _(
1013
1057
  h.depositorSignedPeginTx
1014
- ), C = X(x), g = await lt(
1015
- v(C),
1016
- v(i)
1017
- ), B = S(g);
1018
- if (await this.checkVaultExists(B))
1058
+ ), S = X(x), g = await ut(
1059
+ E(S),
1060
+ E(i)
1061
+ ), v = _(g);
1062
+ if (await this.checkVaultExists(v))
1019
1063
  throw new Error(
1020
- `Vault already exists (ID: ${B}, peginTxHash: ${C}). To create a new vault, use different UTXOs or a different amount.`
1064
+ `Vault already exists (ID: ${v}, peginTxHash: ${S}). To create a new vault, use different UTXOs or a different amount.`
1021
1065
  );
1022
- l.push({ vaultId: B, peginTxHash: C });
1066
+ u.push({ vaultId: v, peginTxHash: S });
1023
1067
  }
1024
1068
  const m = this.config.publicClient;
1025
1069
  let P;
@@ -1039,19 +1083,19 @@ class Ss {
1039
1083
  const w = P * BigInt(n.length), d = await this.resolveMaxAcceptableCommissionBps(
1040
1084
  t,
1041
1085
  e.quotedCommissionBps
1042
- ), E = S(
1086
+ ), B = _(
1043
1087
  r.depositorBtcPubkey
1044
- ), k = S(o), f = n.map((h, x) => ({
1045
- depositorBtcPubKey: E,
1088
+ ), k = _(o), f = n.map((h, x) => ({
1089
+ depositorBtcPubKey: B,
1046
1090
  btcPopSignature: c,
1047
1091
  unsignedPrePeginTx: k,
1048
- depositorSignedPeginTx: S(
1092
+ depositorSignedPeginTx: _(
1049
1093
  h.depositorSignedPeginTx
1050
1094
  ),
1051
1095
  hashlock: h.hashlock,
1052
1096
  htlcVout: h.htlcVout,
1053
- referralCode: Ut,
1054
- depositorPayoutBtcAddress: u[x],
1097
+ referralCode: Wt,
1098
+ depositorPayoutBtcAddress: l[x],
1055
1099
  depositorWotsPkHash: h.depositorWotsPkHash
1056
1100
  })), A = Q({
1057
1101
  abi: H,
@@ -1099,7 +1143,7 @@ class Ss {
1099
1143
  )
1100
1144
  ), {
1101
1145
  ethTxHash: T.transactionHash,
1102
- vaults: l
1146
+ vaults: u
1103
1147
  };
1104
1148
  }
1105
1149
  // Anchor to quoted+headroom when supplied (refuse if chain drifted past it);
@@ -1111,7 +1155,7 @@ class Ss {
1111
1155
  );
1112
1156
  let o;
1113
1157
  try {
1114
- o = await new pe(
1158
+ o = await new me(
1115
1159
  this.config.publicClient,
1116
1160
  this.config.vaultContracts.btcVaultRegistry
1117
1161
  ).getVaultProviderCommission(e);
@@ -1126,9 +1170,9 @@ class Ss {
1126
1170
  throw new Error(
1127
1171
  `Vault provider commission changed since quote: quoted ${t} bps, chain currently reports ${o} bps (allowed drift ${tt} bps). Please refresh to see the new commission and try again.`
1128
1172
  );
1129
- return z(t);
1173
+ return K(t);
1130
1174
  }
1131
- return z(o);
1175
+ return K(o);
1132
1176
  }
1133
1177
  /**
1134
1178
  * Check if a vault already exists for a given vault ID.
@@ -1149,7 +1193,7 @@ class Ss {
1149
1193
  abi: H,
1150
1194
  functionName: "getBtcVaultBasicInfo",
1151
1195
  args: [e]
1152
- })).depositor !== Gt;
1196
+ })).depositor !== zt;
1153
1197
  }
1154
1198
  /**
1155
1199
  * Resolve the BTC scriptPubKey to register as the depositor's payout sink.
@@ -1168,19 +1212,19 @@ class Ss {
1168
1212
  * on-chain payout-script registration.
1169
1213
  */
1170
1214
  resolvePayoutScriptPubKey(e, t) {
1171
- if (!dt(
1215
+ if (!gt(
1172
1216
  t,
1173
1217
  e,
1174
1218
  this.config.btcNetwork
1175
1219
  ))
1176
- throw v(e).length === oe && ss(t, this.config.btcNetwork) ? new Error(
1220
+ throw E(e).length === ne && ns(t, this.config.btcNetwork) ? new Error(
1177
1221
  `BTC payout address "${t}" is a P2WPKH (Native SegWit) address, but the connected wallet only exposes an x-only public key. P2WPKH validation requires a compressed key with known y-parity. Use a P2TR (Taproot) payout address instead.`
1178
1222
  ) : new Error(
1179
1223
  `BTC payout address "${t}" is not derived from the connected wallet's public key. The payout sink must be controlled by the same key that signs the pegin; refusing to register a mismatched address.`
1180
1224
  );
1181
1225
  const o = ft(this.config.btcNetwork);
1182
1226
  try {
1183
- return `0x${vt.address.toOutputScript(t, o).toString("hex")}`;
1227
+ return `0x${Et.address.toOutputScript(t, o).toString("hex")}`;
1184
1228
  } catch {
1185
1229
  throw new Error(
1186
1230
  `Invalid BTC payout address: "${t}". Please provide a valid Bitcoin address for the ${this.config.btcNetwork} network.`
@@ -1196,14 +1240,14 @@ class Ss {
1196
1240
  async signProofOfPossession() {
1197
1241
  if (!this.config.ethWallet.account)
1198
1242
  throw new Error("Ethereum wallet account not found");
1199
- const e = this.config.ethWallet.account.address, t = V(
1243
+ const e = this.config.ethWallet.account.address, t = $(
1200
1244
  await this.config.btcWallet.getPublicKeyHex()
1201
1245
  ), o = this.config.vaultContracts.btcVaultRegistry, n = `${e.toLowerCase()}:${this.config.ethChain.id}:pegin:${o.toLowerCase()}`, r = await this.config.btcWallet.signMessage(
1202
1246
  n,
1203
1247
  "bip322-simple"
1204
1248
  );
1205
1249
  return {
1206
- btcPopSignature: es(r),
1250
+ btcPopSignature: _e(r),
1207
1251
  depositorEthAddress: e,
1208
1252
  depositorBtcPubkey: t
1209
1253
  };
@@ -1217,7 +1261,7 @@ class Ss {
1217
1261
  * substitute the opposite-parity P2WPKH address.
1218
1262
  */
1219
1263
  async assertPopMatchesBtcWallet(e) {
1220
- const t = await this.config.btcWallet.getPublicKeyHex(), o = V(t), n = V(e.depositorBtcPubkey);
1264
+ const t = await this.config.btcWallet.getPublicKeyHex(), o = $(t), n = $(e.depositorBtcPubkey);
1221
1265
  if (o !== n)
1222
1266
  throw new Error(
1223
1267
  `Proof of possession was signed with BTC pubkey ${n} but the BTC wallet is currently connected to ${o}. Reconnect the original wallet or call signProofOfPossession() again.`
@@ -1241,29 +1285,29 @@ class Ss {
1241
1285
  return this.config.vaultContracts.btcVaultRegistry;
1242
1286
  }
1243
1287
  }
1244
- const ns = 80, rs = 250, is = 300, as = 22, Nt = "ab";
1245
- function cs(s, e) {
1246
- const t = Nt.repeat(is), o = v(s).toLowerCase(), n = e.toString(16).padStart(8, "0"), r = `${o}${n}`, i = t.slice(r.length);
1288
+ const is = 80, as = 250, cs = 300, ls = 22, Dt = "ab";
1289
+ function us(s, e) {
1290
+ const t = Dt.repeat(cs), o = E(s).toLowerCase(), n = e.toString(16).padStart(8, "0"), r = `${o}${n}`, i = t.slice(r.length);
1247
1291
  return `0x${r}${i}`;
1248
1292
  }
1249
- function ls(s, e) {
1250
- const t = (o) => `0x${Nt.repeat(o)}`;
1293
+ function hs(s, e) {
1294
+ const t = (o) => `0x${Dt.repeat(o)}`;
1251
1295
  return {
1252
1296
  depositorBtcPubKey: t(32),
1253
- btcPopSignature: t(ns),
1254
- unsignedPrePeginTx: t(rs),
1255
- depositorSignedPeginTx: cs(
1297
+ btcPopSignature: t(is),
1298
+ unsignedPrePeginTx: t(as),
1299
+ depositorSignedPeginTx: us(
1256
1300
  s,
1257
1301
  e
1258
1302
  ),
1259
1303
  hashlock: t(32),
1260
1304
  htlcVout: e,
1261
- referralCode: Ut,
1262
- depositorPayoutBtcAddress: t(as),
1305
+ referralCode: Wt,
1306
+ depositorPayoutBtcAddress: t(ls),
1263
1307
  depositorWotsPkHash: t(32)
1264
1308
  };
1265
1309
  }
1266
- async function Cs(s) {
1310
+ async function Hs(s) {
1267
1311
  const {
1268
1312
  publicClient: e,
1269
1313
  btcVaultRegistry: t,
@@ -1282,29 +1326,33 @@ async function Cs(s) {
1282
1326
  args: [n]
1283
1327
  }) * BigInt(r), c = Array.from(
1284
1328
  { length: r },
1285
- (l, m) => ls(o, m)
1286
- ), u = Q({
1329
+ (u, m) => hs(o, m)
1330
+ ), l = Q({
1287
1331
  abi: H,
1288
1332
  functionName: "submitPeginRequestBatch",
1289
1333
  args: [
1290
1334
  o,
1291
1335
  n,
1292
- Ft,
1336
+ _t,
1293
1337
  c
1294
1338
  ]
1295
1339
  });
1296
1340
  return e.estimateGas({
1297
1341
  to: t,
1298
- data: u,
1342
+ data: l,
1299
1343
  value: a,
1300
1344
  account: o
1301
1345
  });
1302
1346
  }
1303
1347
  export {
1304
- Ss as P,
1348
+ tt as C,
1349
+ _t as M,
1350
+ Is as P,
1351
+ K as a,
1305
1352
  Be as b,
1306
- je as c,
1307
- Ye as d,
1308
- Cs as e
1353
+ ss as c,
1354
+ es as d,
1355
+ Hs as e,
1356
+ Se as f
1309
1357
  };
1310
- //# sourceMappingURL=PeginManager-DKyNgvq1.js.map
1358
+ //# sourceMappingURL=PeginManager-Dj6_tWRA.js.map