@babylonlabs-io/ts-sdk 0.76.0 → 0.78.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 (68) hide show
  1. package/dist/{BTCVaultRegistry.abi-z7d_eP22.cjs → BTCVaultRegistry.abi-BJnjzEWD.cjs} +2 -2
  2. package/dist/BTCVaultRegistry.abi-BJnjzEWD.cjs.map +1 -0
  3. package/dist/{BTCVaultRegistry.abi-CJwWI2EO.js → BTCVaultRegistry.abi-BT3eo60h.js} +279 -2
  4. package/dist/BTCVaultRegistry.abi-BT3eo60h.js.map +1 -0
  5. package/dist/{PeginManager-DNimKlmw.js → PeginManager-Cz0Ytdwo.js} +3 -3
  6. package/dist/{PeginManager-DNimKlmw.js.map → PeginManager-Cz0Ytdwo.js.map} +1 -1
  7. package/dist/{PeginManager-DEByBX5R.cjs → PeginManager-DE2lTWMl.cjs} +2 -2
  8. package/dist/{PeginManager-DEByBX5R.cjs.map → PeginManager-DE2lTWMl.cjs.map} +1 -1
  9. package/dist/{buildAndBroadcastReclaim-Cqc6Jiqk.cjs → buildAndBroadcastReclaim-CB5VPETy.cjs} +2 -2
  10. package/dist/{buildAndBroadcastReclaim-Cqc6Jiqk.cjs.map → buildAndBroadcastReclaim-CB5VPETy.cjs.map} +1 -1
  11. package/dist/{buildAndBroadcastReclaim-DCGcupg7.js → buildAndBroadcastReclaim-DD50pVB1.js} +2 -2
  12. package/dist/{buildAndBroadcastReclaim-DCGcupg7.js.map → buildAndBroadcastReclaim-DD50pVB1.js.map} +1 -1
  13. package/dist/index.cjs +1 -1
  14. package/dist/index.js +188 -186
  15. package/dist/{pegin-registration-client-CXK3B_D1.js → pegin-registration-client-7Vbtdypu.js} +287 -224
  16. package/dist/pegin-registration-client-7Vbtdypu.js.map +1 -0
  17. package/dist/pegin-registration-client-CSe1vOum.cjs +2 -0
  18. package/dist/pegin-registration-client-CSe1vOum.cjs.map +1 -0
  19. package/dist/tbv/core/clients/eth/index.cjs +1 -1
  20. package/dist/tbv/core/clients/eth/index.d.ts +1 -0
  21. package/dist/tbv/core/clients/eth/index.d.ts.map +1 -1
  22. package/dist/tbv/core/clients/eth/index.js +14 -12
  23. package/dist/tbv/core/clients/eth/registration-logs-error.d.ts +20 -0
  24. package/dist/tbv/core/clients/eth/registration-logs-error.d.ts.map +1 -0
  25. package/dist/tbv/core/clients/eth/types.d.ts +12 -0
  26. package/dist/tbv/core/clients/eth/types.d.ts.map +1 -1
  27. package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts +19 -0
  28. package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts.map +1 -1
  29. package/dist/tbv/core/clients/index.cjs +1 -1
  30. package/dist/tbv/core/clients/index.js +41 -39
  31. package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts +227 -1
  32. package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts.map +1 -1
  33. package/dist/tbv/core/contracts/index.cjs +1 -1
  34. package/dist/tbv/core/contracts/index.js +1 -1
  35. package/dist/tbv/core/deposit-terms/commissionCeiling.d.ts +3 -2
  36. package/dist/tbv/core/deposit-terms/commissionCeiling.d.ts.map +1 -1
  37. package/dist/tbv/core/index.cjs +1 -1
  38. package/dist/tbv/core/index.js +186 -184
  39. package/dist/tbv/core/managers/index.cjs +1 -1
  40. package/dist/tbv/core/managers/index.js +1 -1
  41. package/dist/tbv/core/services/index.cjs +1 -1
  42. package/dist/tbv/core/services/index.js +1 -1
  43. package/dist/tbv/index.cjs +1 -1
  44. package/dist/tbv/index.js +186 -184
  45. package/dist/tbv/integrations/aave/constants.d.ts +10 -1
  46. package/dist/tbv/integrations/aave/constants.d.ts.map +1 -1
  47. package/dist/tbv/integrations/aave/index.cjs +1 -1
  48. package/dist/tbv/integrations/aave/index.cjs.map +1 -1
  49. package/dist/tbv/integrations/aave/index.d.ts +1 -1
  50. package/dist/tbv/integrations/aave/index.d.ts.map +1 -1
  51. package/dist/tbv/integrations/aave/index.js +101 -100
  52. package/dist/tbv/integrations/aave/index.js.map +1 -1
  53. package/dist/tbv/integrations/aave/utils/healthFactor.d.ts +3 -3
  54. package/dist/tbv/integrations/aave/utils/healthFactor.d.ts.map +1 -1
  55. package/dist/{toRefundInputs-meTyor7r.cjs → toRefundInputs-BH3wkNC4.cjs} +2 -2
  56. package/dist/{toRefundInputs-meTyor7r.cjs.map → toRefundInputs-BH3wkNC4.cjs.map} +1 -1
  57. package/dist/{toRefundInputs-BNSXIymn.js → toRefundInputs-D708M8MA.js} +2 -2
  58. package/dist/{toRefundInputs-BNSXIymn.js.map → toRefundInputs-D708M8MA.js.map} +1 -1
  59. package/dist/{types-BzSOthHH.cjs → types-BN0jOH8K.cjs} +2 -2
  60. package/dist/{types-BzSOthHH.cjs.map → types-BN0jOH8K.cjs.map} +1 -1
  61. package/dist/{types-C5DyrC8F.js → types-BwqkOoJ6.js} +3 -3
  62. package/dist/{types-C5DyrC8F.js.map → types-BwqkOoJ6.js.map} +1 -1
  63. package/package.json +2 -2
  64. package/dist/BTCVaultRegistry.abi-CJwWI2EO.js.map +0 -1
  65. package/dist/BTCVaultRegistry.abi-z7d_eP22.cjs.map +0 -1
  66. package/dist/pegin-registration-client-CXK3B_D1.js.map +0 -1
  67. package/dist/pegin-registration-client-DLsMNm8Z.cjs +0 -2
  68. package/dist/pegin-registration-client-DLsMNm8Z.cjs.map +0 -1
@@ -1,26 +1,26 @@
1
- var ut = Object.defineProperty;
2
- var ht = (t, e, o) => e in t ? ut(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
3
- var w = (t, e, o) => ht(t, typeof e != "symbol" ? e + "" : e, o);
4
- import { isAddress as lt, keccak256 as dt, encodeAbiParameters as pt, encodeFunctionData as N, isAddressEqual as ft, zeroAddress as gt } from "viem";
5
- import { B as f } from "./BTCVaultRegistry.abi-CJwWI2EO.js";
6
- import { B as H, h as T } from "./BTCVaultRegistryKeyEpochs.abi-D8cIbMtH.js";
7
- import { M as K, b as O } from "./constants-D5vORbQE.js";
8
- import { waitForTransactionReceiptSmartAware as mt } from "./tbv/core/utils/eth/index.js";
9
- import { a as x } from "./onChainBtcPubkey-C-6UWpD8.js";
10
- import { s as Y, b as C, a as Pt } from "./secp256k1-D-H9jmd7.js";
11
- import { c as bt, H as yt, r as E, a as F, h as j, b as _, s as S } from "./sha2-CLpQd0Rd.js";
12
- const k = 25, wt = 9999;
13
- function M(t) {
14
- if (!Number.isInteger(t) || t < 0 || t >= K)
1
+ var dt = Object.defineProperty;
2
+ var pt = (t, e, o) => e in t ? dt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
3
+ var y = (t, e, o) => pt(t, typeof e != "symbol" ? e + "" : e, o);
4
+ import { isAddress as gt, keccak256 as ft, encodeAbiParameters as mt, getAbiItem as N, encodeFunctionData as H, isAddressEqual as Pt, zeroAddress as bt } from "viem";
5
+ import { B as g } from "./BTCVaultRegistry.abi-BT3eo60h.js";
6
+ import { B as K, h as T } from "./BTCVaultRegistryKeyEpochs.abi-D8cIbMtH.js";
7
+ import { M as O, b as M } from "./constants-D5vORbQE.js";
8
+ import { waitForTransactionReceiptSmartAware as yt } from "./tbv/core/utils/eth/index.js";
9
+ import { a as C } from "./onChainBtcPubkey-C-6UWpD8.js";
10
+ import { s as j, b as E, a as wt } from "./secp256k1-D-H9jmd7.js";
11
+ import { c as Et, H as Ct, r as x, a as F, h as J, b as _, s as S } from "./sha2-CLpQd0Rd.js";
12
+ const k = 25, xt = 9999;
13
+ function U(t) {
14
+ if (!Number.isInteger(t) || t < 0 || t >= O)
15
15
  throw new Error(
16
- `Quoted commissionBps must be an integer in [0, ${K}), got ${t}`
16
+ `Quoted commissionBps must be an integer in [0, ${O}), got ${t}`
17
17
  );
18
18
  return Math.min(
19
19
  t + k,
20
- wt
20
+ xt
21
21
  );
22
22
  }
23
- const Ct = /* @__PURE__ */ Uint8Array.from([
23
+ const It = /* @__PURE__ */ Uint8Array.from([
24
24
  7,
25
25
  4,
26
26
  13,
@@ -37,25 +37,25 @@ const Ct = /* @__PURE__ */ Uint8Array.from([
37
37
  14,
38
38
  11,
39
39
  8
40
- ]), J = Uint8Array.from(new Array(16).fill(0).map((t, e) => e)), xt = J.map((t) => (9 * t + 5) % 16), Z = /* @__PURE__ */ (() => {
41
- const o = [[J], [xt]];
40
+ ]), Z = Uint8Array.from(new Array(16).fill(0).map((t, e) => e)), Bt = Z.map((t) => (9 * t + 5) % 16), tt = /* @__PURE__ */ (() => {
41
+ const o = [[Z], [Bt]];
42
42
  for (let n = 0; n < 4; n++)
43
- for (let s of o)
44
- s.push(s[n].map((a) => Ct[a]));
43
+ for (let i of o)
44
+ i.push(i[n].map((a) => It[a]));
45
45
  return o;
46
- })(), tt = Z[0], et = Z[1], ot = /* @__PURE__ */ [
46
+ })(), et = tt[0], ot = tt[1], nt = /* @__PURE__ */ [
47
47
  [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],
48
48
  [12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7],
49
49
  [13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],
50
50
  [14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],
51
51
  [15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5]
52
- ].map((t) => Uint8Array.from(t)), Et = /* @__PURE__ */ tt.map((t, e) => t.map((o) => ot[e][o])), It = /* @__PURE__ */ et.map((t, e) => t.map((o) => ot[e][o])), Bt = /* @__PURE__ */ Uint32Array.from([
52
+ ].map((t) => Uint8Array.from(t)), $t = /* @__PURE__ */ et.map((t, e) => t.map((o) => nt[e][o])), Tt = /* @__PURE__ */ ot.map((t, e) => t.map((o) => nt[e][o])), vt = /* @__PURE__ */ Uint32Array.from([
53
53
  0,
54
54
  1518500249,
55
55
  1859775393,
56
56
  2400959708,
57
57
  2840853838
58
- ]), $t = /* @__PURE__ */ Uint32Array.from([
58
+ ]), At = /* @__PURE__ */ Uint32Array.from([
59
59
  1352829926,
60
60
  1548603684,
61
61
  1836072691,
@@ -66,38 +66,38 @@ function q(t, e, o, n) {
66
66
  return t === 0 ? e ^ o ^ n : t === 1 ? e & o | ~e & n : t === 2 ? (e | ~o) ^ n : t === 3 ? e & n | o & ~n : e ^ (o | ~n);
67
67
  }
68
68
  const I = /* @__PURE__ */ new Uint32Array(16);
69
- class Tt extends yt {
69
+ class Vt extends Ct {
70
70
  constructor() {
71
71
  super(64, 20, 8, !0);
72
- w(this, "h0", 1732584193);
73
- w(this, "h1", -271733879);
74
- w(this, "h2", -1732584194);
75
- w(this, "h3", 271733878);
76
- w(this, "h4", -1009589776);
72
+ y(this, "h0", 1732584193);
73
+ y(this, "h1", -271733879);
74
+ y(this, "h2", -1732584194);
75
+ y(this, "h3", 271733878);
76
+ y(this, "h4", -1009589776);
77
77
  }
78
78
  get() {
79
- const { h0: o, h1: n, h2: s, h3: a, h4: c } = this;
80
- return [o, n, s, a, c];
79
+ const { h0: o, h1: n, h2: i, h3: a, h4: c } = this;
80
+ return [o, n, i, a, c];
81
81
  }
82
- set(o, n, s, a, c) {
83
- this.h0 = o | 0, this.h1 = n | 0, this.h2 = s | 0, this.h3 = a | 0, this.h4 = c | 0;
82
+ set(o, n, i, a, c) {
83
+ this.h0 = o | 0, this.h1 = n | 0, this.h2 = i | 0, this.h3 = a | 0, this.h4 = c | 0;
84
84
  }
85
85
  process(o, n) {
86
86
  for (let r = 0; r < 16; r++, n += 4)
87
87
  I[r] = o.getUint32(n, !0);
88
- let s = this.h0 | 0, a = s, c = this.h1 | 0, l = c, d = this.h2 | 0, p = d, g = this.h3 | 0, P = g, i = this.h4 | 0, h = i;
88
+ let i = this.h0 | 0, a = i, c = this.h1 | 0, h = c, d = this.h2 | 0, p = d, f = this.h3 | 0, P = f, s = this.h4 | 0, l = s;
89
89
  for (let r = 0; r < 5; r++) {
90
- const u = 4 - r, b = Bt[r], st = $t[r], it = tt[r], rt = et[r], at = Et[r], ct = It[r];
90
+ const u = 4 - r, b = vt[r], at = At[r], ct = et[r], ut = ot[r], ht = $t[r], lt = Tt[r];
91
91
  for (let m = 0; m < 16; m++) {
92
- const $ = E(s + q(r, c, d, g) + I[it[m]] + b, at[m]) + i | 0;
93
- s = i, i = g, g = E(d, 10) | 0, d = c, c = $;
92
+ const $ = x(i + q(r, c, d, f) + I[ct[m]] + b, ht[m]) + s | 0;
93
+ i = s, s = f, f = x(d, 10) | 0, d = c, c = $;
94
94
  }
95
95
  for (let m = 0; m < 16; m++) {
96
- const $ = E(a + q(u, l, p, P) + I[rt[m]] + st, ct[m]) + h | 0;
97
- a = h, h = P, P = E(p, 10) | 0, p = l, l = $;
96
+ const $ = x(a + q(u, h, p, P) + I[ut[m]] + at, lt[m]) + l | 0;
97
+ a = l, l = P, P = x(p, 10) | 0, p = h, h = $;
98
98
  }
99
99
  }
100
- this.set(this.h1 + d + P | 0, this.h2 + g + h | 0, this.h3 + i + a | 0, this.h4 + s + l | 0, this.h0 + c + p | 0);
100
+ this.set(this.h1 + d + P | 0, this.h2 + f + l | 0, this.h3 + s + a | 0, this.h4 + i + h | 0, this.h0 + c + p | 0);
101
101
  }
102
102
  roundClean() {
103
103
  F(I);
@@ -106,37 +106,37 @@ class Tt extends yt {
106
106
  this.destroyed = !0, F(this.buffer), this.set(0, 0, 0, 0, 0);
107
107
  }
108
108
  }
109
- const vt = /* @__PURE__ */ bt(() => new Tt()), At = "5120", R = "0014", Vt = 20, W = 33, St = 65, kt = 2, Rt = 3, _t = 4;
110
- function nt(t, e) {
109
+ const St = /* @__PURE__ */ Et(() => new Vt()), kt = "5120", R = "0014", Rt = 20, W = 33, _t = 65, Nt = 2, Ht = 3, Kt = 4;
110
+ function it(t, e) {
111
111
  const o = t.startsWith("0x") || t.startsWith("0X") ? t.slice(2) : t;
112
112
  if (!/^(?:[0-9a-fA-F]{2})+$/.test(o))
113
113
  throw new Error(`${e} must be non-empty, even-length hex`);
114
114
  return `0x${o.toLowerCase()}`;
115
115
  }
116
- function Nt(t) {
117
- const e = j(t), o = C.utils.lift_x(BigInt(`0x${t}`)), n = C.utils.bytesToNumberBE(
118
- C.utils.taggedHash("TapTweak", e)
116
+ function Ot(t) {
117
+ const e = J(t), o = E.utils.lift_x(BigInt(`0x${t}`)), n = E.utils.bytesToNumberBE(
118
+ E.utils.taggedHash("TapTweak", e)
119
119
  );
120
- if (n >= Y.CURVE.n)
120
+ if (n >= j.CURVE.n)
121
121
  throw new Error("Proof of possession BTC pubkey has an invalid TapTweak");
122
- const s = n === 0n ? o : o.add(C.Point.BASE.multiply(n));
123
- return `0x${At}${_(
124
- C.utils.pointToBytes(s)
122
+ const i = n === 0n ? o : o.add(E.Point.BASE.multiply(n));
123
+ return `0x${kt}${_(
124
+ E.utils.pointToBytes(i)
125
125
  )}`;
126
126
  }
127
- function Ht(t) {
128
- const e = nt(t, "depositorBtcPubkeyRaw"), o = j(e.slice(2));
127
+ function Mt(t) {
128
+ const e = it(t, "depositorBtcPubkeyRaw"), o = J(e.slice(2));
129
129
  if (o.length === 32)
130
130
  return {
131
- xOnlyPubkey: x(e, "Payout BTC pubkey")
131
+ xOnlyPubkey: C(e, "Payout BTC pubkey")
132
132
  };
133
- const n = o.length === W && (o[0] === kt || o[0] === Rt), s = o.length === St && o[0] === _t;
134
- if (!n && !s)
133
+ const n = o.length === W && (o[0] === Nt || o[0] === Ht), i = o.length === _t && o[0] === Kt;
134
+ if (!n && !i)
135
135
  throw new Error(
136
136
  "depositorBtcPubkeyRaw must be x-only, compressed, or uncompressed"
137
137
  );
138
138
  try {
139
- Y.Point.fromBytes(o);
139
+ j.Point.fromBytes(o);
140
140
  } catch {
141
141
  throw new Error("depositorBtcPubkeyRaw is not a valid BTC pubkey");
142
142
  }
@@ -145,123 +145,123 @@ function Ht(t) {
145
145
  compressedPubkey: n ? o : void 0
146
146
  };
147
147
  }
148
- function Kt(t) {
149
- return `0x${R}${_(vt(S(t)))}`;
148
+ function Ft(t) {
149
+ return `0x${R}${_(St(S(t)))}`;
150
150
  }
151
- function Ot(t, e, o) {
152
- const n = nt(
151
+ function Ut(t, e, o) {
152
+ const n = it(
153
153
  t,
154
154
  "depositorPayoutScriptPubKey"
155
155
  );
156
- if ((n.length - 2) / 2 > O)
156
+ if ((n.length - 2) / 2 > M)
157
157
  throw new Error(
158
- `depositorPayoutScriptPubKey exceeds ${O} bytes`
158
+ `depositorPayoutScriptPubKey exceeds ${M} bytes`
159
159
  );
160
- const s = e.startsWith("0x") || e.startsWith("0X") ? e.slice(2) : e, a = x(
161
- `0x${s}`,
160
+ const i = e.startsWith("0x") || e.startsWith("0X") ? e.slice(2) : e, a = C(
161
+ `0x${i}`,
162
162
  "Proof of possession BTC pubkey"
163
- ), c = Ht(o);
163
+ ), c = Mt(o);
164
164
  if (c.xOnlyPubkey !== a)
165
165
  throw new Error(
166
166
  "depositorBtcPubkeyRaw does not match the proof of possession BTC pubkey"
167
167
  );
168
- if (n === Nt(a))
168
+ if (n === Ot(a))
169
169
  return n;
170
- if (n.startsWith(`0x${R}`) && n.length === 2 + R.length + Vt * 2) {
170
+ if (n.startsWith(`0x${R}`) && n.length === 2 + R.length + Rt * 2) {
171
171
  if (!c.compressedPubkey)
172
172
  throw new Error("A P2WPKH payout requires a compressed BTC pubkey");
173
- if (n === Kt(c.compressedPubkey))
173
+ if (n === Ft(c.compressedPubkey))
174
174
  return n;
175
175
  }
176
176
  throw new Error(
177
177
  "depositorPayoutScriptPubKey does not match the proof of possession BTC pubkey"
178
178
  );
179
179
  }
180
- function Ft(t, e) {
180
+ function qt(t, e) {
181
181
  const o = t.startsWith("0x") ? t.slice(2) : t;
182
182
  if (o.length === 0 || o.length % 2 !== 0)
183
183
  throw new Error(`${e} must be non-empty, even-length hex`);
184
184
  if (!/^[0-9a-fA-F]+$/.test(o))
185
185
  throw new Error(`${e} contains non-hex characters`);
186
186
  const n = new Uint8Array(o.length / 2);
187
- for (let s = 0; s < n.length; s++)
188
- n[s] = Number.parseInt(o.slice(s * 2, s * 2 + 2), 16);
187
+ for (let i = 0; i < n.length; i++)
188
+ n[i] = Number.parseInt(o.slice(i * 2, i * 2 + 2), 16);
189
189
  return n;
190
190
  }
191
- function Mt(t) {
191
+ function Wt(t) {
192
192
  return Array.from(t, (e) => e.toString(16).padStart(2, "0")).join(
193
193
  ""
194
194
  );
195
195
  }
196
- function qt(t) {
196
+ function Dt(t) {
197
197
  const e = new Uint8Array(
198
- t.reduce((n, s) => n + s.length, 0)
198
+ t.reduce((n, i) => n + i.length, 0)
199
199
  );
200
200
  let o = 0;
201
201
  for (const n of t)
202
202
  e.set(n, o), o += n.length;
203
203
  return e;
204
204
  }
205
- function Wt(t) {
205
+ function Lt(t) {
206
206
  let e = 0;
207
- const o = (i, h) => {
208
- if (!Number.isSafeInteger(i) || i < 0)
209
- throw new Error(`Invalid ${h} length ${i}`);
210
- if (e + i > t.length)
211
- throw new Error(`Truncated Bitcoin transaction while reading ${h}`);
212
- const r = t.slice(e, e + i);
213
- return e += i, r;
214
- }, n = (i, h) => {
215
- const r = o(i, h);
207
+ const o = (s, l) => {
208
+ if (!Number.isSafeInteger(s) || s < 0)
209
+ throw new Error(`Invalid ${l} length ${s}`);
210
+ if (e + s > t.length)
211
+ throw new Error(`Truncated Bitcoin transaction while reading ${l}`);
212
+ const r = t.slice(e, e + s);
213
+ return e += s, r;
214
+ }, n = (s, l) => {
215
+ const r = o(s, l);
216
216
  let u = 0n;
217
217
  for (let b = r.length - 1; b >= 0; b--)
218
218
  u = u << 8n | BigInt(r[b]);
219
219
  return u;
220
- }, s = (i) => {
221
- const h = e, r = o(1, i)[0];
220
+ }, i = (s) => {
221
+ const l = e, r = o(1, s)[0];
222
222
  let u;
223
223
  if (r < 253)
224
224
  u = BigInt(r);
225
225
  else if (r === 253) {
226
- if (u = n(2, i), u < 0xfdn) throw new Error(`Non-canonical ${i}`);
226
+ if (u = n(2, s), u < 0xfdn) throw new Error(`Non-canonical ${s}`);
227
227
  } else if (r === 254) {
228
- if (u = n(4, i), u <= 0xffffn) throw new Error(`Non-canonical ${i}`);
229
- } else if (u = n(8, i), u <= 0xffffffffn) throw new Error(`Non-canonical ${i}`);
228
+ if (u = n(4, s), u <= 0xffffn) throw new Error(`Non-canonical ${s}`);
229
+ } else if (u = n(8, s), u <= 0xffffffffn) throw new Error(`Non-canonical ${s}`);
230
230
  if (u > BigInt(Number.MAX_SAFE_INTEGER))
231
- throw new Error(`${i} exceeds JavaScript's safe integer range`);
231
+ throw new Error(`${s} exceeds JavaScript's safe integer range`);
232
232
  return {
233
- encoded: t.slice(h, e),
233
+ encoded: t.slice(l, e),
234
234
  value: Number(u)
235
235
  };
236
236
  }, a = o(4, "version"), c = t[e] === 0 && t[e + 1] === 1;
237
237
  c && (e += 2);
238
- const l = s("input count"), d = [];
239
- for (let i = 0; i < l.value; i++) {
240
- const h = e;
241
- o(32, `input ${i} previous transaction hash`), o(4, `input ${i} previous output index`);
242
- const r = s(`input ${i} script length`);
243
- o(r.value, `input ${i} script`), o(4, `input ${i} sequence`), d.push(t.slice(h, e));
244
- }
245
- const p = s("output count"), g = [];
246
- for (let i = 0; i < p.value; i++) {
247
- const h = e;
248
- o(8, `output ${i} value`);
249
- const r = s(`output ${i} script length`);
250
- o(r.value, `output ${i} script`), g.push(t.slice(h, e));
238
+ const h = i("input count"), d = [];
239
+ for (let s = 0; s < h.value; s++) {
240
+ const l = e;
241
+ o(32, `input ${s} previous transaction hash`), o(4, `input ${s} previous output index`);
242
+ const r = i(`input ${s} script length`);
243
+ o(r.value, `input ${s} script`), o(4, `input ${s} sequence`), d.push(t.slice(l, e));
244
+ }
245
+ const p = i("output count"), f = [];
246
+ for (let s = 0; s < p.value; s++) {
247
+ const l = e;
248
+ o(8, `output ${s} value`);
249
+ const r = i(`output ${s} script length`);
250
+ o(r.value, `output ${s} script`), f.push(t.slice(l, e));
251
251
  }
252
252
  if (c) {
253
- let i = !1;
254
- for (let h = 0; h < l.value; h++) {
255
- const r = s(`input ${h} witness item count`);
256
- i || (i = r.value > 0);
253
+ let s = !1;
254
+ for (let l = 0; l < h.value; l++) {
255
+ const r = i(`input ${l} witness item count`);
256
+ s || (s = r.value > 0);
257
257
  for (let u = 0; u < r.value; u++) {
258
- const b = s(
259
- `input ${h} witness item ${u} length`
258
+ const b = i(
259
+ `input ${l} witness item ${u} length`
260
260
  );
261
- o(b.value, `input ${h} witness item ${u}`);
261
+ o(b.value, `input ${l} witness item ${u}`);
262
262
  }
263
263
  }
264
- if (!i)
264
+ if (!s)
265
265
  throw new Error("Bitcoin transaction has superfluous witness marker");
266
266
  }
267
267
  const P = o(4, "locktime");
@@ -269,43 +269,43 @@ function Wt(t) {
269
269
  throw new Error(
270
270
  `Bitcoin transaction has ${t.length - e} trailing byte(s)`
271
271
  );
272
- return qt([
272
+ return Dt([
273
273
  a,
274
- l.encoded,
274
+ h.encoded,
275
275
  ...d,
276
276
  p.encoded,
277
- ...g,
277
+ ...f,
278
278
  P
279
279
  ]);
280
280
  }
281
- function Ut(t) {
282
- const e = Wt(
283
- Ft(t, "transactionHex")
281
+ function Xt(t) {
282
+ const e = Lt(
283
+ qt(t, "transactionHex")
284
284
  ), o = S(S(e));
285
- return o.reverse(), `0x${Mt(o)}`;
285
+ return o.reverse(), `0x${Wt(o)}`;
286
286
  }
287
- function Dt(t, e) {
287
+ function zt(t, e) {
288
288
  const o = t.startsWith("0x") ? t : `0x${t}`;
289
289
  if (!/^0x[0-9a-fA-F]{64}$/.test(o))
290
290
  throw new Error("peginTxHash must be a 32-byte hex value");
291
291
  const n = e.startsWith("0x") ? e : `0x${e}`;
292
- if (!lt(n, { strict: !0 }))
292
+ if (!gt(n, { strict: !0 }))
293
293
  throw new Error(`Invalid depositor Ethereum address: ${e}`);
294
- return dt(
295
- pt(
294
+ return ft(
295
+ mt(
296
296
  [{ type: "bytes32" }, { type: "address" }],
297
297
  [o, n]
298
298
  )
299
299
  ).slice(2);
300
300
  }
301
- const v = 65535, U = 1e4, B = 4294967295, D = 255;
302
- function Xt(t) {
301
+ const v = 65535, D = 1e4, B = 4294967295, L = 255;
302
+ function Gt(t) {
303
303
  if (!Number.isInteger(t) || t < 0 || t > B)
304
304
  throw new Error(
305
305
  `Invalid offchainParamsVersion from contract: must be a uint32, got ${t}`
306
306
  );
307
307
  }
308
- function zt(t) {
308
+ function Qt(t) {
309
309
  const e = [];
310
310
  if (t.timelockAssert <= 0n && e.push(
311
311
  `timelockAssert must be positive, got ${t.timelockAssert}`
@@ -327,14 +327,14 @@ function zt(t) {
327
327
  `babeInstancesToFinalize must be positive, got ${t.babeInstancesToFinalize}`
328
328
  ), t.babeInstancesToFinalize > t.babeTotalInstances && e.push(
329
329
  `babeInstancesToFinalize (${t.babeInstancesToFinalize}) exceeds babeTotalInstances (${t.babeTotalInstances})`
330
- ), (t.minVpCommissionBps < 0 || t.minVpCommissionBps > U) && e.push(
331
- `minVpCommissionBps must be in [0, ${U}], got ${t.minVpCommissionBps}`
330
+ ), (t.minVpCommissionBps < 0 || t.minVpCommissionBps > D) && e.push(
331
+ `minVpCommissionBps must be in [0, ${D}], got ${t.minVpCommissionBps}`
332
332
  ), e.length > 0)
333
333
  throw new Error(
334
334
  `Invalid offchain protocol parameters: ${e.join("; ")}`
335
335
  );
336
336
  }
337
- function Lt(t) {
337
+ function Yt(t) {
338
338
  const e = [];
339
339
  if (t.minimumPegInAmount <= 0n && e.push(
340
340
  `minimumPegInAmount must be positive, got ${t.minimumPegInAmount}`
@@ -344,23 +344,36 @@ function Lt(t) {
344
344
  `pegInAckTimeout must be positive, got ${t.pegInAckTimeout}`
345
345
  ), t.pegInActivationTimeout <= 0n && e.push(
346
346
  `pegInActivationTimeout must be positive, got ${t.pegInActivationTimeout}`
347
- ), (!Number.isInteger(t.maxHtlcOutputCount) || t.maxHtlcOutputCount <= 0 || t.maxHtlcOutputCount > D) && e.push(
348
- `maxHtlcOutputCount must be an integer in [1, ${D}], got ${t.maxHtlcOutputCount}`
347
+ ), (!Number.isInteger(t.maxHtlcOutputCount) || t.maxHtlcOutputCount <= 0 || t.maxHtlcOutputCount > L) && e.push(
348
+ `maxHtlcOutputCount must be an integer in [1, ${L}], got ${t.maxHtlcOutputCount}`
349
349
  ), (typeof t.expiredPegInGraceBlocks != "bigint" || t.expiredPegInGraceBlocks <= 0n) && e.push(
350
350
  `expiredPegInGraceBlocks must be a positive bigint, got ${t.expiredPegInGraceBlocks}`
351
351
  ), e.length > 0)
352
352
  throw new Error(`Invalid TBV protocol parameters: ${e.join("; ")}`);
353
353
  }
354
- function ue(t) {
355
- if (Lt(t), zt(t.offchainParams), !Number.isInteger(t.offchainParamsVersion) || t.offchainParamsVersion < 0 || t.offchainParamsVersion > B)
354
+ function pe(t) {
355
+ if (Yt(t), Qt(t.offchainParams), !Number.isInteger(t.offchainParamsVersion) || t.offchainParamsVersion < 0 || t.offchainParamsVersion > B)
356
356
  throw new Error(
357
357
  `Invalid peg-in configuration: offchainParamsVersion must be a uint32, got ${t.offchainParamsVersion}`
358
358
  );
359
- Pt(
359
+ wt(
360
360
  t.activeVaultCoreVersion,
361
361
  "ProtocolParams.activeVaultCoreVersion()"
362
362
  );
363
363
  }
364
+ const st = "RegistrationLogsUnavailableError";
365
+ class rt extends Error {
366
+ constructor(o) {
367
+ super(
368
+ `The Ethereum node returned no registration logs for block ${o}, which holds a vault registration; the node may not have indexed that block yet. Try again.`
369
+ );
370
+ y(this, "blockNumber");
371
+ this.name = st, this.blockNumber = o;
372
+ }
373
+ }
374
+ function ge(t) {
375
+ return t instanceof rt ? !0 : typeof t != "object" || t === null ? !1 : t.name === st;
376
+ }
364
377
  const X = 9999;
365
378
  function z(t) {
366
379
  return {
@@ -375,7 +388,7 @@ function z(t) {
375
388
  }
376
389
  function A(t) {
377
390
  const e = Number(t.offchainParamsVersion);
378
- return Xt(e), {
391
+ return Gt(e), {
379
392
  depositorSignedPeginTx: t.depositorSignedPeginTx,
380
393
  universalChallengersVersion: t.universalChallengersVersion,
381
394
  appVaultKeepersVersion: t.appVaultKeepersVersion,
@@ -390,9 +403,12 @@ function A(t) {
390
403
  vaultCoreVersion: t.vaultCoreVersion
391
404
  };
392
405
  }
393
- const Qt = 1n << 64n, L = 0n;
406
+ const jt = 1n << 64n, G = 0n, Jt = [
407
+ N({ abi: g, name: "PegInSubmitted" }),
408
+ N({ abi: g, name: "PegInSubmittedV2" })
409
+ ];
394
410
  function V(t, e, o) {
395
- if (t < 0n || t >= Qt)
411
+ if (t < 0n || t >= jt)
396
412
  throw new Error(
397
413
  `getBtcVaultProtocolInfo returned ${e}=${t} for vault ${o}, outside the uint64 range — the registry may predate RFC-006`
398
414
  );
@@ -409,7 +425,7 @@ function Q(t, e) {
409
425
  ucKeyEpoch: V(t.ucKeyEpoch, "ucKeyEpoch", e)
410
426
  };
411
427
  }
412
- class Gt {
428
+ class Zt {
413
429
  constructor(e, o) {
414
430
  this.publicClient = e, this.contractAddress = o;
415
431
  }
@@ -439,14 +455,14 @@ class Gt {
439
455
  async getVaultProviderGenesisBtcPubKey(e, o) {
440
456
  const n = await this.publicClient.readContract({
441
457
  address: this.contractAddress,
442
- abi: f,
458
+ abi: g,
443
459
  functionName: "getOperationBtcKeyAtEpoch",
444
- args: [e, L],
460
+ args: [e, G],
445
461
  blockNumber: o
446
462
  });
447
- return x(
463
+ return C(
448
464
  n,
449
- `getOperationBtcKeyAtEpoch (vp=${e}, epoch=${L})`
465
+ `getOperationBtcKeyAtEpoch (vp=${e}, epoch=${G})`
450
466
  );
451
467
  }
452
468
  /**
@@ -463,11 +479,11 @@ class Gt {
463
479
  async getCurrentVaultProviderOperationBtcKey(e) {
464
480
  const o = await this.publicClient.readContract({
465
481
  address: this.contractAddress,
466
- abi: f,
482
+ abi: g,
467
483
  functionName: "getCurrentOperationBtcKey",
468
484
  args: [e]
469
485
  });
470
- return x(
486
+ return C(
471
487
  o,
472
488
  `getCurrentOperationBtcKey (vp=${e})`
473
489
  );
@@ -491,7 +507,7 @@ class Gt {
491
507
  async getVaultKeyEpochs(e) {
492
508
  const o = await this.publicClient.readContract({
493
509
  address: this.contractAddress,
494
- abi: H,
510
+ abi: K,
495
511
  functionName: "getBtcVaultProtocolInfo",
496
512
  args: [e]
497
513
  });
@@ -501,19 +517,19 @@ class Gt {
501
517
  return e.length === 0 ? [] : (await this.publicClient.multicall({
502
518
  contracts: e.map((n) => ({
503
519
  address: this.contractAddress,
504
- abi: H,
520
+ abi: K,
505
521
  functionName: "getBtcVaultProtocolInfo",
506
522
  args: [n]
507
523
  })),
508
524
  allowFailure: !1
509
525
  })).map(
510
- (n, s) => Q(n, e[s])
526
+ (n, i) => Q(n, e[i])
511
527
  );
512
528
  }
513
529
  async getVaultBasicInfo(e) {
514
530
  const o = await this.publicClient.readContract({
515
531
  address: this.contractAddress,
516
- abi: f,
532
+ abi: g,
517
533
  functionName: "getBtcVaultBasicInfo",
518
534
  args: [e]
519
535
  });
@@ -522,7 +538,7 @@ class Gt {
522
538
  async getVaultProtocolInfo(e) {
523
539
  const o = await this.publicClient.readContract({
524
540
  address: this.contractAddress,
525
- abi: f,
541
+ abi: g,
526
542
  functionName: "getBtcVaultProtocolInfo",
527
543
  args: [e]
528
544
  });
@@ -532,16 +548,16 @@ class Gt {
532
548
  return e.length === 0 ? [] : (await this.publicClient.multicall({
533
549
  contracts: e.map((n) => ({
534
550
  address: this.contractAddress,
535
- abi: f,
551
+ abi: g,
536
552
  functionName: "getBtcVaultProtocolInfo",
537
553
  args: [n]
538
554
  })),
539
555
  allowFailure: !1
540
- })).map((n, s) => {
556
+ })).map((n, i) => {
541
557
  const a = n;
542
558
  if (!a.depositorSignedPeginTx || a.depositorSignedPeginTx === "0x")
543
559
  throw new Error(
544
- `Vault ${e[s]} not found on-chain or has no pegin transaction`
560
+ `Vault ${e[i]} not found on-chain or has no pegin transaction`
545
561
  );
546
562
  return A(a);
547
563
  });
@@ -553,7 +569,7 @@ class Gt {
553
569
  async getPegInFee(e) {
554
570
  return await this.publicClient.readContract({
555
571
  address: this.contractAddress,
556
- abi: f,
572
+ abi: g,
557
573
  functionName: "getPegInFee",
558
574
  args: [e]
559
575
  });
@@ -568,7 +584,7 @@ class Gt {
568
584
  async getVaultProviderCommission(e) {
569
585
  const o = await this.publicClient.readContract({
570
586
  address: this.contractAddress,
571
- abi: f,
587
+ abi: g,
572
588
  functionName: "getVaultProviderCommission",
573
589
  args: [e]
574
590
  });
@@ -583,42 +599,87 @@ class Gt {
583
599
  contracts: [
584
600
  {
585
601
  address: this.contractAddress,
586
- abi: f,
602
+ abi: g,
587
603
  functionName: "getBtcVaultBasicInfo",
588
604
  args: [e]
589
605
  },
590
606
  {
591
607
  address: this.contractAddress,
592
- abi: f,
608
+ abi: g,
593
609
  functionName: "getBtcVaultProtocolInfo",
594
610
  args: [e]
595
611
  }
596
612
  ],
597
613
  allowFailure: !1
598
- }), s = z(o), a = A(n);
614
+ }), i = z(o), a = A(n);
599
615
  if (!a.depositorSignedPeginTx || a.depositorSignedPeginTx === "0x")
600
616
  throw new Error(
601
617
  `Vault ${e} not found on-chain or has no pegin transaction`
602
618
  );
603
- return { basic: s, protocol: a };
619
+ return { basic: i, protocol: a };
620
+ }
621
+ /**
622
+ * Read the depositor's commission ceiling (`maxAcceptableCommissionBps`)
623
+ * for vaults registered in the same block, from their `PegInSubmittedV2`
624
+ * logs. Returned in `vaultIds` order.
625
+ *
626
+ * The contract bound-checks the ceiling and discards it (PeginLogic.sol,
627
+ * `VaultProviderCommissionExceeded`), so the registration log is its only
628
+ * on-chain source. One query at exactly `createdAt` — the `block.number`
629
+ * stamped at registration — so no block-range scan is needed and public-RPC
630
+ * range caps do not apply. Vault ids are matched case-insensitively.
631
+ *
632
+ * @throws {RegistrationLogsUnavailableError} (transient, retry) when the
633
+ * node answers with no registration logs for the block at all.
634
+ * @throws when a vault has only its `PegInSubmitted` log — registrations
635
+ * that predate the V2 event (vault-contracts-aave-v4 #548) never emitted
636
+ * the ceiling — no registration log in its own `createdAt` block, or more
637
+ * than one V2 log.
638
+ */
639
+ async getMaxAcceptableCommissionBpsBatch(e, o) {
640
+ if (e.length === 0) return [];
641
+ const n = await this.publicClient.getLogs({
642
+ address: this.contractAddress,
643
+ events: Jt,
644
+ fromBlock: o,
645
+ toBlock: o,
646
+ strict: !0
647
+ });
648
+ if (n.length === 0)
649
+ throw new rt(o);
650
+ return e.map((i) => {
651
+ const a = i.toLowerCase();
652
+ let c = !1;
653
+ const h = [];
654
+ for (const d of n)
655
+ d.args.vaultId.toLowerCase() === a && (c = !0, d.eventName === "PegInSubmittedV2" && h.push(d.args.maxAcceptableCommissionBps));
656
+ if (h.length === 1) return h[0];
657
+ throw h.length > 1 ? new Error(
658
+ `Expected one PegInSubmittedV2 log for vault ${i} at block ${o}, found ${h.length} PegInSubmittedV2 logs`
659
+ ) : c ? new Error(
660
+ `Vault ${i} was registered before the registry emitted the depositor's commission ceiling (no PegInSubmittedV2 log at block ${o}), so the ceiling cannot be recovered on-chain`
661
+ ) : new Error(
662
+ `Vault ${i} has no registration log at its on-chain registration block ${o}`
663
+ );
664
+ });
604
665
  }
605
666
  }
606
- const Yt = 0, jt = 255, Jt = 12e4;
607
- function y(t, e) {
667
+ const te = 0, ee = 255, oe = 12e4;
668
+ function w(t, e) {
608
669
  const o = t.startsWith("0x") ? t : t.startsWith("0X") ? `0x${t.slice(2)}` : `0x${t}`;
609
670
  if (!/^0x(?:[0-9a-fA-F]{2})+$/.test(o))
610
671
  throw new Error(`${e} must be non-empty, even-length hex`);
611
672
  return o;
612
673
  }
613
- function G(t, e) {
674
+ function Y(t, e) {
614
675
  if (!/^0x[0-9a-fA-F]{64}$/.test(t))
615
676
  throw new Error(`${e} must be a 32-byte hex value`);
616
677
  }
617
- function Zt(t) {
618
- if (!Number.isInteger(t) || t < 0 || t > jt)
678
+ function ne(t) {
679
+ if (!Number.isInteger(t) || t < 0 || t > ee)
619
680
  throw new Error(`htlcVout must be a uint8, got ${t}`);
620
681
  }
621
- class he {
682
+ class fe {
622
683
  constructor(e) {
623
684
  this.config = e;
624
685
  }
@@ -628,27 +689,27 @@ class he {
628
689
  popSignature: { ...e.popSignature }
629
690
  };
630
691
  this.assertQuotedCommissionPresentWhenRequired(o.quotedCommissionBps);
631
- const n = this.assertPopMatchesEthAccount(o.popSignature), s = this.normalizeBtcPubkey(o.popSignature), a = y(
692
+ const n = this.assertPopMatchesEthAccount(o.popSignature), i = this.normalizeBtcPubkey(o.popSignature), a = w(
632
693
  o.popSignature.btcPopSignature,
633
694
  "btcPopSignature"
634
695
  ), c = this.normalizeRequest(
635
696
  o,
636
697
  n,
637
- s
698
+ i
638
699
  );
639
700
  await this.assertVaultDoesNotExist(
640
701
  c.vaultId,
641
702
  c.peginTxHash
642
703
  );
643
- const l = await this.readPeginFee(o.vaultProvider), d = await this.resolveMaxAcceptableCommissionBps(
704
+ const h = await this.readPeginFee(o.vaultProvider), d = await this.resolveMaxAcceptableCommissionBps(
644
705
  o.vaultProvider,
645
706
  o.quotedCommissionBps
646
- ), p = N({
647
- abi: f,
707
+ ), p = H({
708
+ abi: g,
648
709
  functionName: "submitPeginRequest",
649
710
  args: [
650
711
  n,
651
- s,
712
+ i,
652
713
  a,
653
714
  c.unsignedPrePeginTx,
654
715
  c.depositorSignedPeginTx,
@@ -663,7 +724,7 @@ class he {
663
724
  return {
664
725
  ethTxHash: await this.sendAndWait(
665
726
  p,
666
- l,
727
+ h,
667
728
  !1,
668
729
  n
669
730
  ),
@@ -680,13 +741,13 @@ class he {
680
741
  if (o.requests.length === 0)
681
742
  throw new Error("Batch pegin requires at least one request");
682
743
  this.assertQuotedCommissionPresentWhenRequired(o.quotedCommissionBps);
683
- const n = this.assertPopMatchesEthAccount(o.popSignature), s = y(
744
+ const n = this.assertPopMatchesEthAccount(o.popSignature), i = w(
684
745
  o.unsignedPrePeginTx,
685
746
  "unsignedPrePeginTx"
686
- ), a = this.normalizeBtcPubkey(o.popSignature), c = y(
747
+ ), a = this.normalizeBtcPubkey(o.popSignature), c = w(
687
748
  o.popSignature.btcPopSignature,
688
749
  "btcPopSignature"
689
- ), l = [], d = [], p = /* @__PURE__ */ new Set();
750
+ ), h = [], d = [], p = /* @__PURE__ */ new Set();
690
751
  for (const r of o.requests) {
691
752
  const u = this.normalizeRequest(
692
753
  {
@@ -700,37 +761,37 @@ class he {
700
761
  );
701
762
  if (p.has(u.vaultId))
702
763
  throw new Error(`Duplicate vault in batch: ${u.vaultId}`);
703
- p.add(u.vaultId), l.push({
764
+ p.add(u.vaultId), h.push({
704
765
  vaultId: u.vaultId,
705
766
  peginTxHash: u.peginTxHash
706
767
  }), d.push({
707
768
  depositorBtcPubKey: a,
708
769
  btcPopSignature: c,
709
- unsignedPrePeginTx: s,
770
+ unsignedPrePeginTx: i,
710
771
  depositorSignedPeginTx: u.depositorSignedPeginTx,
711
772
  hashlock: r.hashlock,
712
773
  htlcVout: r.htlcVout,
713
- referralCode: Yt,
774
+ referralCode: te,
714
775
  depositorPayoutBtcAddress: u.payoutScript,
715
776
  depositorWotsPkHash: r.depositorWotsPkHash
716
777
  });
717
778
  }
718
- for (const r of l)
779
+ for (const r of h)
719
780
  await this.assertVaultDoesNotExist(r.vaultId, r.peginTxHash);
720
- const g = await this.readPeginFee(o.vaultProvider), P = await this.resolveMaxAcceptableCommissionBps(
781
+ const f = await this.readPeginFee(o.vaultProvider), P = await this.resolveMaxAcceptableCommissionBps(
721
782
  o.vaultProvider,
722
783
  o.quotedCommissionBps
723
- ), i = N({
724
- abi: f,
784
+ ), s = H({
785
+ abi: g,
725
786
  functionName: "submitPeginRequestBatch",
726
787
  args: [n, o.vaultProvider, P, d]
727
788
  });
728
789
  return { ethTxHash: await this.sendAndWait(
729
- i,
730
- g * BigInt(o.requests.length),
790
+ s,
791
+ f * BigInt(o.requests.length),
731
792
  !0,
732
793
  n
733
- ), vaults: l };
794
+ ), vaults: h };
734
795
  }
735
796
  assertQuotedCommissionPresentWhenRequired(e) {
736
797
  if (e === void 0 && this.config.requireQuotedCommissionBps)
@@ -744,46 +805,46 @@ class he {
744
805
  assertEthAccount(e) {
745
806
  const o = this.config.ethWallet.account;
746
807
  if (!o) throw new Error("Ethereum wallet account not found");
747
- if (!ft(e, o.address))
808
+ if (!Pt(e, o.address))
748
809
  throw new Error(
749
810
  `Proof of possession was signed for ${e} but the Ethereum wallet is currently connected to ${o.address}. Reconnect the original account or sign a new proof of possession.`
750
811
  );
751
812
  return o.address;
752
813
  }
753
814
  normalizeBtcPubkey(e) {
754
- return `0x${x(
755
- y(e.depositorBtcPubkey, "Proof of possession BTC pubkey"),
815
+ return `0x${C(
816
+ w(e.depositorBtcPubkey, "Proof of possession BTC pubkey"),
756
817
  "Proof of possession BTC pubkey"
757
818
  )}`;
758
819
  }
759
820
  normalizeRequest(e, o, n) {
760
- G(e.hashlock, "hashlock"), G(e.depositorWotsPkHash, "depositorWotsPkHash"), Zt(e.htlcVout);
761
- const s = y(
821
+ Y(e.hashlock, "hashlock"), Y(e.depositorWotsPkHash, "depositorWotsPkHash"), ne(e.htlcVout);
822
+ const i = w(
762
823
  e.unsignedPrePeginTx,
763
824
  "unsignedPrePeginTx"
764
- ), a = y(
825
+ ), a = w(
765
826
  e.depositorSignedPeginTx,
766
827
  "depositorSignedPeginTx"
767
- ), c = Ut(a);
828
+ ), c = Xt(a);
768
829
  return {
769
- unsignedPrePeginTx: s,
830
+ unsignedPrePeginTx: i,
770
831
  depositorSignedPeginTx: a,
771
- payoutScript: Ot(
832
+ payoutScript: Ut(
772
833
  e.depositorPayoutScriptPubKey,
773
834
  n,
774
835
  e.depositorBtcPubkeyRaw
775
836
  ),
776
837
  peginTxHash: c,
777
- vaultId: y(Dt(c, o), "vaultId")
838
+ vaultId: w(zt(c, o), "vaultId")
778
839
  };
779
840
  }
780
841
  async assertVaultDoesNotExist(e, o) {
781
842
  if ((await this.config.publicClient.readContract({
782
843
  address: this.config.btcVaultRegistry,
783
- abi: f,
844
+ abi: g,
784
845
  functionName: "getBtcVaultBasicInfo",
785
846
  args: [e]
786
- })).depositor !== gt)
847
+ })).depositor !== bt)
787
848
  throw new Error(
788
849
  `Vault already exists (ID: ${e}, peginTxHash: ${o}). 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.`
789
850
  );
@@ -792,7 +853,7 @@ class he {
792
853
  try {
793
854
  return await this.config.publicClient.readContract({
794
855
  address: this.config.btcVaultRegistry,
795
- abi: f,
856
+ abi: g,
796
857
  functionName: "getPegInFee",
797
858
  args: [e]
798
859
  });
@@ -806,14 +867,14 @@ class he {
806
867
  async resolveMaxAcceptableCommissionBps(e, o) {
807
868
  let n;
808
869
  try {
809
- n = await new Gt(
870
+ n = await new Zt(
810
871
  this.config.publicClient,
811
872
  this.config.btcVaultRegistry
812
873
  ).getVaultProviderCommission(e);
813
- } catch (s) {
874
+ } catch (i) {
814
875
  throw new Error(
815
876
  "Failed to query vault provider commission from the contract. Please check your network connection and contract address.",
816
- { cause: s }
877
+ { cause: i }
817
878
  );
818
879
  }
819
880
  if (o !== void 0) {
@@ -821,12 +882,12 @@ class he {
821
882
  throw new Error(
822
883
  `Vault provider commission changed since quote: quoted ${o} bps, chain currently reports ${n} bps (allowed drift ${k} bps). Please refresh and try again.`
823
884
  );
824
- return M(o);
885
+ return U(o);
825
886
  }
826
- return M(n);
887
+ return U(n);
827
888
  }
828
- async sendAndWait(e, o, n, s) {
829
- let a = this.assertEthAccount(s), c;
889
+ async sendAndWait(e, o, n, i) {
890
+ let a = this.assertEthAccount(i), c;
830
891
  try {
831
892
  c = await this.config.publicClient.estimateGas({
832
893
  to: this.config.btcVaultRegistry,
@@ -837,10 +898,10 @@ class he {
837
898
  } catch (p) {
838
899
  T(p);
839
900
  }
840
- a = this.assertEthAccount(s);
841
- let l;
901
+ a = this.assertEthAccount(i);
902
+ let h;
842
903
  try {
843
- l = await this.config.ethWallet.sendTransaction({
904
+ h = await this.config.ethWallet.sendTransaction({
844
905
  to: this.config.btcVaultRegistry,
845
906
  data: e,
846
907
  value: o,
@@ -851,11 +912,11 @@ class he {
851
912
  } catch (p) {
852
913
  T(p);
853
914
  }
854
- const d = await mt({
915
+ const d = await yt({
855
916
  publicClient: this.config.publicClient,
856
- walletAddress: s,
857
- hash: l,
858
- timeout: this.config.receiptTimeoutMs ?? Jt
917
+ walletAddress: i,
918
+ hash: h,
919
+ timeout: this.config.receiptTimeoutMs ?? oe
859
920
  });
860
921
  return d.status === "reverted" && T(
861
922
  new Error(
@@ -866,17 +927,19 @@ class he {
866
927
  }
867
928
  export {
868
929
  k as C,
869
- wt as M,
870
- Yt as N,
871
- he as V,
872
- ue as a,
873
- Lt as b,
874
- Gt as c,
875
- Dt as d,
876
- M as e,
877
- Ut as f,
878
- Xt as g,
879
- vt as r,
880
- zt as v
930
+ xt as M,
931
+ te as N,
932
+ rt as R,
933
+ fe as V,
934
+ pe as a,
935
+ Yt as b,
936
+ Zt as c,
937
+ zt as d,
938
+ U as e,
939
+ Xt as f,
940
+ Gt as g,
941
+ ge as i,
942
+ St as r,
943
+ Qt as v
881
944
  };
882
- //# sourceMappingURL=pegin-registration-client-CXK3B_D1.js.map
945
+ //# sourceMappingURL=pegin-registration-client-7Vbtdypu.js.map