@babylonlabs-io/ts-sdk 2.0.2 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/dist/{PeginManager-CKf7Bjmj.js → PeginManager-D8WGB8eN.js} +2 -2
  2. package/dist/PeginManager-D8WGB8eN.js.map +1 -0
  3. package/dist/{PeginManager-Dt2Z5ljw.cjs → PeginManager-IgDHy_eU.cjs} +2 -2
  4. package/dist/PeginManager-IgDHy_eU.cjs.map +1 -0
  5. package/dist/{buildAndBroadcastReclaim-B19cyK69.js → buildAndBroadcastReclaim-C55KaRJF.js} +783 -791
  6. package/dist/buildAndBroadcastReclaim-C55KaRJF.js.map +1 -0
  7. package/dist/buildAndBroadcastReclaim-CefzR6i_.cjs +2 -0
  8. package/dist/buildAndBroadcastReclaim-CefzR6i_.cjs.map +1 -0
  9. package/dist/index-D2mybjXD.js +522 -0
  10. package/dist/index-D2mybjXD.js.map +1 -0
  11. package/dist/index-MRdle0fs.cjs +2 -0
  12. package/dist/index-MRdle0fs.cjs.map +1 -0
  13. package/dist/index.cjs +1 -1
  14. package/dist/index.js +215 -214
  15. package/dist/pegin-registration-client-B0j6ugt9.cjs +2 -0
  16. package/dist/pegin-registration-client-B0j6ugt9.cjs.map +1 -0
  17. package/dist/{pegin-registration-client-C5Hktrja.js → pegin-registration-client-ilkV1mLP.js} +103 -88
  18. package/dist/pegin-registration-client-ilkV1mLP.js.map +1 -0
  19. package/dist/primeVpAuth-BDWBKYhv.cjs +2 -0
  20. package/dist/primeVpAuth-BDWBKYhv.cjs.map +1 -0
  21. package/dist/primeVpAuth-D0ZnsjRi.js +805 -0
  22. package/dist/primeVpAuth-D0ZnsjRi.js.map +1 -0
  23. package/dist/state-C4WoNCy1.cjs +2 -0
  24. package/dist/state-C4WoNCy1.cjs.map +1 -0
  25. package/dist/{json-rpc-client-CQLbpuKK.js → state-CFn1rT74.js} +136 -88
  26. package/dist/state-CFn1rT74.js.map +1 -0
  27. package/dist/tbv/core/clients/eth/index.cjs +1 -1
  28. package/dist/tbv/core/clients/eth/index.js +2 -2
  29. package/dist/tbv/core/clients/eth/types.d.ts +12 -5
  30. package/dist/tbv/core/clients/eth/types.d.ts.map +1 -1
  31. package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts +12 -3
  32. package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts.map +1 -1
  33. package/dist/tbv/core/clients/index.cjs +1 -1
  34. package/dist/tbv/core/clients/index.js +52 -51
  35. package/dist/tbv/core/clients/mempool/index.cjs +1 -1
  36. package/dist/tbv/core/clients/mempool/index.cjs.map +1 -1
  37. package/dist/tbv/core/clients/mempool/index.d.ts +1 -1
  38. package/dist/tbv/core/clients/mempool/index.d.ts.map +1 -1
  39. package/dist/tbv/core/clients/mempool/index.js +85 -71
  40. package/dist/tbv/core/clients/mempool/index.js.map +1 -1
  41. package/dist/tbv/core/clients/mempool/mempoolApi.d.ts +10 -0
  42. package/dist/tbv/core/clients/mempool/mempoolApi.d.ts.map +1 -1
  43. package/dist/tbv/core/clients/vault-provider/api.d.ts +17 -13
  44. package/dist/tbv/core/clients/vault-provider/api.d.ts.map +1 -1
  45. package/dist/tbv/core/clients/vault-provider/auth/createAuthenticatedVpClient.d.ts +8 -0
  46. package/dist/tbv/core/clients/vault-provider/auth/createAuthenticatedVpClient.d.ts.map +1 -1
  47. package/dist/tbv/core/clients/vault-provider/auth/index.d.ts +1 -1
  48. package/dist/tbv/core/clients/vault-provider/auth/index.d.ts.map +1 -1
  49. package/dist/tbv/core/clients/vault-provider/auth/primeVpAuth.d.ts +8 -0
  50. package/dist/tbv/core/clients/vault-provider/auth/primeVpAuth.d.ts.map +1 -1
  51. package/dist/tbv/core/clients/vault-provider/auth/tokenProvider.d.ts +18 -2
  52. package/dist/tbv/core/clients/vault-provider/auth/tokenProvider.d.ts.map +1 -1
  53. package/dist/tbv/core/clients/vault-provider/auth/tokenRegistry.d.ts +26 -6
  54. package/dist/tbv/core/clients/vault-provider/auth/tokenRegistry.d.ts.map +1 -1
  55. package/dist/tbv/core/clients/vault-provider/batchAttribution.d.ts +17 -15
  56. package/dist/tbv/core/clients/vault-provider/batchAttribution.d.ts.map +1 -1
  57. package/dist/tbv/core/clients/vault-provider/batchPoll.d.ts +15 -9
  58. package/dist/tbv/core/clients/vault-provider/batchPoll.d.ts.map +1 -1
  59. package/dist/tbv/core/clients/vault-provider/json-rpc-client.d.ts +3 -2
  60. package/dist/tbv/core/clients/vault-provider/json-rpc-client.d.ts.map +1 -1
  61. package/dist/tbv/core/clients/vault-provider/status/index.cjs +1 -1
  62. package/dist/tbv/core/clients/vault-provider/status/index.js +2 -2
  63. package/dist/tbv/core/clients/vault-provider/types.d.ts +36 -23
  64. package/dist/tbv/core/clients/vault-provider/types.d.ts.map +1 -1
  65. package/dist/tbv/core/clients/vault-provider/validators.d.ts +12 -4
  66. package/dist/tbv/core/clients/vault-provider/validators.d.ts.map +1 -1
  67. package/dist/tbv/core/index.cjs +1 -1
  68. package/dist/tbv/core/index.js +216 -215
  69. package/dist/tbv/core/managers/index.cjs +1 -1
  70. package/dist/tbv/core/managers/index.js +1 -1
  71. package/dist/tbv/core/services/deposit/interfaces.d.ts +2 -2
  72. package/dist/tbv/core/services/deposit/interfaces.d.ts.map +1 -1
  73. package/dist/tbv/core/services/deposit/runDepositorPresignFlow.d.ts +3 -1
  74. package/dist/tbv/core/services/deposit/runDepositorPresignFlow.d.ts.map +1 -1
  75. package/dist/tbv/core/services/deposit/submitWotsPublicKey.d.ts +3 -1
  76. package/dist/tbv/core/services/deposit/submitWotsPublicKey.d.ts.map +1 -1
  77. package/dist/tbv/core/services/deposit/waitForPeginStatus.d.ts +11 -2
  78. package/dist/tbv/core/services/deposit/waitForPeginStatus.d.ts.map +1 -1
  79. package/dist/tbv/core/services/index.cjs +1 -1
  80. package/dist/tbv/core/services/index.js +75 -74
  81. package/dist/tbv/core/services/index.js.map +1 -1
  82. package/dist/tbv/core/services/pegout/state.d.ts +10 -5
  83. package/dist/tbv/core/services/pegout/state.d.ts.map +1 -1
  84. package/dist/tbv/index.cjs +1 -1
  85. package/dist/tbv/index.js +216 -215
  86. package/dist/{toRefundInputs-DIIdhjvu.js → toRefundInputs-10RYIfh1.js} +2 -2
  87. package/dist/{toRefundInputs-DIIdhjvu.js.map → toRefundInputs-10RYIfh1.js.map} +1 -1
  88. package/dist/{toRefundInputs-B_GlIXjk.cjs → toRefundInputs-a-0HRyrl.cjs} +2 -2
  89. package/dist/{toRefundInputs-B_GlIXjk.cjs.map → toRefundInputs-a-0HRyrl.cjs.map} +1 -1
  90. package/dist/{types-DJxOEU3P.cjs → types-BueQoMjO.cjs} +2 -2
  91. package/dist/{types-DJxOEU3P.cjs.map → types-BueQoMjO.cjs.map} +1 -1
  92. package/dist/{types-Dz1kVqn6.js → types-DGkejGZH.js} +2 -2
  93. package/dist/{types-Dz1kVqn6.js.map → types-DGkejGZH.js.map} +1 -1
  94. package/package.json +1 -1
  95. package/dist/PeginManager-CKf7Bjmj.js.map +0 -1
  96. package/dist/PeginManager-Dt2Z5ljw.cjs.map +0 -1
  97. package/dist/buildAndBroadcastReclaim-B19cyK69.js.map +0 -1
  98. package/dist/buildAndBroadcastReclaim-DcbsjJdf.cjs +0 -2
  99. package/dist/buildAndBroadcastReclaim-DcbsjJdf.cjs.map +0 -1
  100. package/dist/index-Bnavi_r3.js +0 -521
  101. package/dist/index-Bnavi_r3.js.map +0 -1
  102. package/dist/index-CcdCNFLM.cjs +0 -2
  103. package/dist/index-CcdCNFLM.cjs.map +0 -1
  104. package/dist/json-rpc-client-CQLbpuKK.js.map +0 -1
  105. package/dist/json-rpc-client-DbpFfa_o.cjs +0 -2
  106. package/dist/json-rpc-client-DbpFfa_o.cjs.map +0 -1
  107. package/dist/pegin-registration-client-BdJ6c7si.cjs +0 -2
  108. package/dist/pegin-registration-client-BdJ6c7si.cjs.map +0 -1
  109. package/dist/pegin-registration-client-C5Hktrja.js.map +0 -1
  110. package/dist/primeVpAuth-D21PXgg2.cjs +0 -2
  111. package/dist/primeVpAuth-D21PXgg2.cjs.map +0 -1
  112. package/dist/primeVpAuth-PiUJksAq.js +0 -745
  113. package/dist/primeVpAuth-PiUJksAq.js.map +0 -1
@@ -1,26 +1,26 @@
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 m = (t, e, o) => pt(t, typeof e != "symbol" ? e + "" : e, o);
4
- import { getAbiItem as _, encodeFunctionData as N, isAddressEqual as gt, zeroAddress as ft } from "viem";
1
+ var lt = Object.defineProperty;
2
+ var dt = (t, e, o) => e in t ? lt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
3
+ var m = (t, e, o) => dt(t, typeof e != "symbol" ? e + "" : e, o);
4
+ import { getAbiItem as _, encodeFunctionData as N, isAddressEqual as pt, zeroAddress as gt } from "viem";
5
5
  import { B as h } from "./BTCVaultRegistry.abi-B0x9_Bza.js";
6
6
  import { B as K, h as T } from "./BTCVaultRegistryKeyEpochs.abi-BWoxwPQv.js";
7
- import { M as H, b as O } from "./constants-D5vORbQE.js";
8
- import { waitForTransactionReceiptSmartAware as mt } from "./tbv/core/utils/eth/index.js";
9
- import { a as C, c as Pt, d as bt } from "./onChainBtcPubkey-CCTdl53s.js";
10
- import { s as Y, b as w, a as yt } from "./secp256k1-D-H9jmd7.js";
11
- import { c as wt, H as Ct, r as E, a as F, h as j, b as R, s as Et } from "./sha2-YqVHJiFj.js";
12
- const v = 25, xt = 9999;
7
+ import { M as O, b as H } from "./constants-D5vORbQE.js";
8
+ import { waitForTransactionReceiptSmartAware as ft } from "./tbv/core/utils/eth/index.js";
9
+ import { a as C, c as mt, d as Pt } from "./onChainBtcPubkey-CCTdl53s.js";
10
+ import { s as Q, b as w, a as bt } from "./secp256k1-D-H9jmd7.js";
11
+ import { c as yt, H as wt, r as E, a as F, h as Y, b as R, s as Ct } from "./sha2-YqVHJiFj.js";
12
+ const v = 25, Et = 9999;
13
13
  function M(t) {
14
- if (!Number.isInteger(t) || t < 0 || t >= H)
14
+ if (!Number.isInteger(t) || t < 0 || t >= O)
15
15
  throw new Error(
16
- `Quoted commissionBps must be an integer in [0, ${H}), got ${t}`
16
+ `Quoted commissionBps must be an integer in [0, ${O}), got ${t}`
17
17
  );
18
18
  return Math.min(
19
19
  t + v,
20
- xt
20
+ Et
21
21
  );
22
22
  }
23
- const It = /* @__PURE__ */ Uint8Array.from([
23
+ const xt = /* @__PURE__ */ Uint8Array.from([
24
24
  7,
25
25
  4,
26
26
  13,
@@ -37,25 +37,25 @@ const It = /* @__PURE__ */ Uint8Array.from([
37
37
  14,
38
38
  11,
39
39
  8
40
- ]), Z = Uint8Array.from(new Array(16).fill(0).map((t, e) => e)), Bt = Z.map((t) => (9 * t + 5) % 16), J = /* @__PURE__ */ (() => {
41
- const o = [[Z], [Bt]];
40
+ ]), j = Uint8Array.from(new Array(16).fill(0).map((t, e) => e)), Bt = j.map((t) => (9 * t + 5) % 16), Z = /* @__PURE__ */ (() => {
41
+ const o = [[j], [Bt]];
42
42
  for (let n = 0; n < 4; n++)
43
43
  for (let i of o)
44
- i.push(i[n].map((s) => It[s]));
44
+ i.push(i[n].map((s) => xt[s]));
45
45
  return o;
46
- })(), tt = J[0], et = J[1], ot = /* @__PURE__ */ [
46
+ })(), J = Z[0], tt = Z[1], et = /* @__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)), Tt = /* @__PURE__ */ tt.map((t, e) => t.map((o) => ot[e][o])), Vt = /* @__PURE__ */ et.map((t, e) => t.map((o) => ot[e][o])), At = /* @__PURE__ */ Uint32Array.from([
52
+ ].map((t) => Uint8Array.from(t)), It = /* @__PURE__ */ J.map((t, e) => t.map((o) => et[e][o])), Tt = /* @__PURE__ */ tt.map((t, e) => t.map((o) => et[e][o])), Vt = /* @__PURE__ */ Uint32Array.from([
53
53
  0,
54
54
  1518500249,
55
55
  1859775393,
56
56
  2400959708,
57
57
  2840853838
58
- ]), St = /* @__PURE__ */ Uint32Array.from([
58
+ ]), At = /* @__PURE__ */ Uint32Array.from([
59
59
  1352829926,
60
60
  1548603684,
61
61
  1836072691,
@@ -66,7 +66,7 @@ function U(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 x = /* @__PURE__ */ new Uint32Array(16);
69
- class vt extends Ct {
69
+ class St extends wt {
70
70
  constructor() {
71
71
  super(64, 20, 8, !0);
72
72
  m(this, "h0", 1732584193);
@@ -87,14 +87,14 @@ class vt extends Ct {
87
87
  x[a] = o.getUint32(n, !0);
88
88
  let i = this.h0 | 0, s = i, r = this.h1 | 0, c = r, u = this.h2 | 0, l = u, g = this.h3 | 0, b = g, f = this.h4 | 0, y = f;
89
89
  for (let a = 0; a < 5; a++) {
90
- const d = 4 - a, rt = At[a], at = St[a], ct = tt[a], ut = et[a], ht = Tt[a], lt = Vt[a];
90
+ const d = 4 - a, st = Vt[a], rt = At[a], at = J[a], ct = tt[a], ut = It[a], ht = Tt[a];
91
91
  for (let p = 0; p < 16; p++) {
92
- const B = E(i + U(a, r, u, g) + x[ct[p]] + rt, ht[p]) + f | 0;
93
- i = f, f = g, g = E(u, 10) | 0, u = r, r = B;
92
+ const I = E(i + U(a, r, u, g) + x[at[p]] + st, ut[p]) + f | 0;
93
+ i = f, f = g, g = E(u, 10) | 0, u = r, r = I;
94
94
  }
95
95
  for (let p = 0; p < 16; p++) {
96
- const B = E(s + U(d, c, l, b) + x[ut[p]] + at, lt[p]) + y | 0;
97
- s = y, y = b, b = E(l, 10) | 0, l = c, c = B;
96
+ const I = E(s + U(d, c, l, b) + x[ct[p]] + rt, ht[p]) + y | 0;
97
+ s = y, y = b, b = E(l, 10) | 0, l = c, c = I;
98
98
  }
99
99
  }
100
100
  this.set(this.h1 + u + b | 0, this.h2 + g + y | 0, this.h3 + f + s | 0, this.h4 + i + c | 0, this.h0 + r + l | 0);
@@ -106,37 +106,37 @@ class vt extends Ct {
106
106
  this.destroyed = !0, F(this.buffer), this.set(0, 0, 0, 0, 0);
107
107
  }
108
108
  }
109
- const $t = /* @__PURE__ */ wt(() => new vt()), kt = "5120", $ = "0014", Rt = 20, q = 33, _t = 65, Nt = 2, Kt = 3, Ht = 4;
110
- function nt(t, e) {
109
+ const vt = /* @__PURE__ */ yt(() => new St()), $t = "5120", $ = "0014", kt = 20, q = 33, Rt = 65, _t = 2, Nt = 3, Kt = 4;
110
+ function ot(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
116
  function Ot(t) {
117
- const e = j(t), o = w.utils.lift_x(BigInt(`0x${t}`)), n = w.utils.bytesToNumberBE(
117
+ const e = Y(t), o = w.utils.lift_x(BigInt(`0x${t}`)), n = w.utils.bytesToNumberBE(
118
118
  w.utils.taggedHash("TapTweak", e)
119
119
  );
120
- if (n >= Y.CURVE.n)
120
+ if (n >= Q.CURVE.n)
121
121
  throw new Error("Proof of possession BTC pubkey has an invalid TapTweak");
122
122
  const i = n === 0n ? o : o.add(w.Point.BASE.multiply(n));
123
- return `0x${kt}${R(
123
+ return `0x${$t}${R(
124
124
  w.utils.pointToBytes(i)
125
125
  )}`;
126
126
  }
127
- function Ft(t) {
128
- const e = nt(t, "depositorBtcPubkeyRaw"), o = j(e.slice(2));
127
+ function Ht(t) {
128
+ const e = ot(t, "depositorBtcPubkeyRaw"), o = Y(e.slice(2));
129
129
  if (o.length === 32)
130
130
  return {
131
131
  xOnlyPubkey: C(e, "Payout BTC pubkey")
132
132
  };
133
- const n = o.length === q && (o[0] === Nt || o[0] === Kt), i = o.length === _t && o[0] === Ht;
133
+ const n = o.length === q && (o[0] === _t || o[0] === Nt), i = o.length === Rt && o[0] === Kt;
134
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
+ Q.Point.fromBytes(o);
140
140
  } catch {
141
141
  throw new Error("depositorBtcPubkeyRaw is not a valid BTC pubkey");
142
142
  }
@@ -145,46 +145,46 @@ function Ft(t) {
145
145
  compressedPubkey: n ? o : void 0
146
146
  };
147
147
  }
148
- function Mt(t) {
149
- return `0x${$}${R($t(Et(t)))}`;
148
+ function Ft(t) {
149
+ return `0x${$}${R(vt(Ct(t)))}`;
150
150
  }
151
- function Ut(t, e, o) {
152
- const n = nt(
151
+ function Mt(t, e, o) {
152
+ const n = ot(
153
153
  t,
154
154
  "depositorPayoutScriptPubKey"
155
155
  );
156
- if ((n.length - 2) / 2 > O)
156
+ if ((n.length - 2) / 2 > H)
157
157
  throw new Error(
158
- `depositorPayoutScriptPubKey exceeds ${O} bytes`
158
+ `depositorPayoutScriptPubKey exceeds ${H} bytes`
159
159
  );
160
160
  const i = e.startsWith("0x") || e.startsWith("0X") ? e.slice(2) : e, s = C(
161
161
  `0x${i}`,
162
162
  "Proof of possession BTC pubkey"
163
- ), r = Ft(o);
163
+ ), r = Ht(o);
164
164
  if (r.xOnlyPubkey !== s)
165
165
  throw new Error(
166
166
  "depositorBtcPubkeyRaw does not match the proof of possession BTC pubkey"
167
167
  );
168
168
  if (n === Ot(s))
169
169
  return n;
170
- if (n.startsWith(`0x${$}`) && n.length === 2 + $.length + Rt * 2) {
170
+ if (n.startsWith(`0x${$}`) && n.length === 2 + $.length + kt * 2) {
171
171
  if (!r.compressedPubkey)
172
172
  throw new Error("A P2WPKH payout requires a compressed BTC pubkey");
173
- if (n === Mt(r.compressedPubkey))
173
+ if (n === Ft(r.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
- const V = 65535, D = 1e4, I = 4294967295, W = 255;
181
- function qt(t) {
182
- if (!Number.isInteger(t) || t < 0 || t > I)
180
+ const V = 65535, D = 1e4, B = 4294967295, W = 255;
181
+ function Ut(t) {
182
+ if (!Number.isInteger(t) || t < 0 || t > B)
183
183
  throw new Error(
184
184
  `Invalid offchainParamsVersion from contract: must be a uint32, got ${t}`
185
185
  );
186
186
  }
187
- function Dt(t) {
187
+ function qt(t) {
188
188
  const e = [];
189
189
  if (t.timelockAssert <= 0n && e.push(
190
190
  `timelockAssert must be positive, got ${t.timelockAssert}`
@@ -198,8 +198,8 @@ function Dt(t) {
198
198
  `minPeginFeeRate must be positive, got ${t.minPeginFeeRate}`
199
199
  ), (!Number.isInteger(t.proverCircuitVersion) || t.proverCircuitVersion < 0 || t.proverCircuitVersion > V) && e.push(
200
200
  `proverCircuitVersion must be a uint16, got ${t.proverCircuitVersion}`
201
- ), (!Number.isInteger(t.minPrepeginDepth) || t.minPrepeginDepth <= 0 || t.minPrepeginDepth > I) && e.push(
202
- `minPrepeginDepth must be a uint32 in [1, ${I}], got ${t.minPrepeginDepth}`
201
+ ), (!Number.isInteger(t.minPrepeginDepth) || t.minPrepeginDepth <= 0 || t.minPrepeginDepth > B) && e.push(
202
+ `minPrepeginDepth must be a uint32 in [1, ${B}], got ${t.minPrepeginDepth}`
203
203
  ), t.babeTotalInstances <= 0 && e.push(
204
204
  `babeTotalInstances must be positive, got ${t.babeTotalInstances}`
205
205
  ), t.babeInstancesToFinalize <= 0 && e.push(
@@ -213,7 +213,7 @@ function Dt(t) {
213
213
  `Invalid offchain protocol parameters: ${e.join("; ")}`
214
214
  );
215
215
  }
216
- function Wt(t) {
216
+ function Dt(t) {
217
217
  const e = [];
218
218
  if (t.minimumPegInAmount <= 0n && e.push(
219
219
  `minimumPegInAmount must be positive, got ${t.minimumPegInAmount}`
@@ -231,27 +231,27 @@ function Wt(t) {
231
231
  throw new Error(`Invalid TBV protocol parameters: ${e.join("; ")}`);
232
232
  }
233
233
  function ce(t) {
234
- if (Wt(t), Dt(t.offchainParams), !Number.isInteger(t.offchainParamsVersion) || t.offchainParamsVersion < 0 || t.offchainParamsVersion > I)
234
+ if (Dt(t), qt(t.offchainParams), !Number.isInteger(t.offchainParamsVersion) || t.offchainParamsVersion < 0 || t.offchainParamsVersion > B)
235
235
  throw new Error(
236
236
  `Invalid peg-in configuration: offchainParamsVersion must be a uint32, got ${t.offchainParamsVersion}`
237
237
  );
238
- yt(
238
+ bt(
239
239
  t.activeVaultCoreVersion,
240
240
  "ProtocolParams.activeVaultCoreVersion()"
241
241
  );
242
242
  }
243
- const it = "RegistrationLogsUnavailableError";
244
- class st extends Error {
243
+ const nt = "RegistrationLogsUnavailableError";
244
+ class it extends Error {
245
245
  constructor(o) {
246
246
  super(
247
247
  `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.`
248
248
  );
249
249
  m(this, "blockNumber");
250
- this.name = it, this.blockNumber = o;
250
+ this.name = nt, this.blockNumber = o;
251
251
  }
252
252
  }
253
253
  function ue(t) {
254
- return t instanceof st ? !0 : typeof t != "object" || t === null ? !1 : t.name === it;
254
+ return t instanceof it ? !0 : typeof t != "object" || t === null ? !1 : t.name === nt;
255
255
  }
256
256
  const L = 9999;
257
257
  function X(t) {
@@ -267,7 +267,7 @@ function X(t) {
267
267
  }
268
268
  function A(t) {
269
269
  const e = Number(t.offchainParamsVersion);
270
- return qt(e), {
270
+ return Ut(e), {
271
271
  depositorSignedPeginTx: t.depositorSignedPeginTx,
272
272
  universalChallengersVersion: t.universalChallengersVersion,
273
273
  appVaultKeepersVersion: t.appVaultKeepersVersion,
@@ -282,18 +282,18 @@ function A(t) {
282
282
  vaultCoreVersion: t.vaultCoreVersion
283
283
  };
284
284
  }
285
- const Lt = 1n << 64n, z = 0n, Xt = [
285
+ const Wt = 1n << 64n, Lt = 0n, Xt = [
286
286
  _({ abi: h, name: "PegInSubmitted" }),
287
287
  _({ abi: h, name: "PegInSubmittedV2" })
288
288
  ];
289
289
  function S(t, e, o) {
290
- if (t < 0n || t >= Lt)
290
+ if (t < 0n || t >= Wt)
291
291
  throw new Error(
292
292
  `getBtcVaultProtocolInfo returned ${e}=${t} for vault ${o}, outside the uint64 range — the registry may predate RFC-006`
293
293
  );
294
294
  return t;
295
295
  }
296
- function G(t, e) {
296
+ function z(t, e) {
297
297
  return {
298
298
  vpKeyEpoch: S(t.vpKeyEpoch, "vpKeyEpoch", e),
299
299
  appKeeperKeyEpoch: S(
@@ -332,16 +332,31 @@ class zt {
332
332
  * the brand. Returns 64-char lowercase hex without the `0x` prefix.
333
333
  */
334
334
  async getVaultProviderGenesisBtcPubKey(e, o) {
335
- const n = await this.publicClient.readContract({
335
+ return this.getVaultProviderOperationBtcKeyAtEpoch(
336
+ e,
337
+ Lt,
338
+ o
339
+ );
340
+ }
341
+ /**
342
+ * Read the VP operation key selected by `epoch`.
343
+ *
344
+ * This is public rather than hidden inside `OperationKeyReader` because
345
+ * subject-specific VP authentication needs exactly one participant: the
346
+ * gRPC bootstrap is signed by the key frozen into the vault, while the
347
+ * JSON-RPC bootstrap is signed by the provider's live key.
348
+ */
349
+ async getVaultProviderOperationBtcKeyAtEpoch(e, o, n) {
350
+ const i = await this.publicClient.readContract({
336
351
  address: this.contractAddress,
337
352
  abi: h,
338
353
  functionName: "getOperationBtcKeyAtEpoch",
339
- args: [e, z],
340
- blockNumber: o
354
+ args: [e, o],
355
+ blockNumber: n
341
356
  });
342
357
  return C(
343
- n,
344
- `getOperationBtcKeyAtEpoch (vp=${e}, epoch=${z})`
358
+ i,
359
+ `getOperationBtcKeyAtEpoch (vp=${e}, epoch=${o})`
345
360
  );
346
361
  }
347
362
  /**
@@ -371,9 +386,9 @@ class zt {
371
386
  * rotated, so this returns the same value as
372
387
  * `getVaultProviderGenesisBtcPubKey` until the first rotation.
373
388
  *
374
- * This is the key the VP's server signs its BIP-322 auth tokens with — a
375
- * live per-operator identity, not a per-vault binding, so the auth pin uses
376
- * the current key rather than any vault's frozen epoch.
389
+ * This is the key the VP's server uses for JSON-RPC-subject authentication.
390
+ * The gRPC-subject bootstrap is instead bound to the existing vault's frozen
391
+ * epoch and resolves through `getVaultProviderOperationBtcKeyAtEpoch`.
377
392
  */
378
393
  async getCurrentVaultProviderOperationBtcKey(e) {
379
394
  const o = await this.publicClient.readContract({
@@ -410,7 +425,7 @@ class zt {
410
425
  functionName: "getBtcVaultProtocolInfo",
411
426
  args: [e]
412
427
  });
413
- return G(o, e);
428
+ return z(o, e);
414
429
  }
415
430
  async getVaultKeyEpochsBatch(e) {
416
431
  return e.length === 0 ? [] : (await this.publicClient.multicall({
@@ -422,7 +437,7 @@ class zt {
422
437
  })),
423
438
  allowFailure: !1
424
439
  })).map(
425
- (n, i) => G(n, e[i])
440
+ (n, i) => z(n, e[i])
426
441
  );
427
442
  }
428
443
  async getVaultBasicInfo(e) {
@@ -545,7 +560,7 @@ class zt {
545
560
  strict: !0
546
561
  });
547
562
  if (n.length === 0)
548
- throw new st(o);
563
+ throw new it(o);
549
564
  return e.map((i) => {
550
565
  const s = i.toLowerCase();
551
566
  let r = !1;
@@ -575,7 +590,7 @@ function k(t, e) {
575
590
  throw new Error(`${e} must be a 32-byte hex value`);
576
591
  }
577
592
  const jt = "0x0000000000000000000000000000000000000000000000000000000000000000";
578
- function Q(t) {
593
+ function G(t) {
579
594
  if (k(t, "expectedFingerprint"), t.toLowerCase() === jt)
580
595
  throw new Error(
581
596
  "expectedFingerprint must not be zero: the registry cannot resolve a zero fingerprint, so this submission would always revert"
@@ -594,7 +609,7 @@ class he {
594
609
  ...e,
595
610
  popSignature: { ...e.popSignature }
596
611
  };
597
- this.assertQuotedCommissionPresentWhenRequired(o.quotedCommissionBps), Q(o.expectedFingerprint);
612
+ this.assertQuotedCommissionPresentWhenRequired(o.quotedCommissionBps), G(o.expectedFingerprint);
598
613
  const n = this.assertPopMatchesEthAccount(o.popSignature), i = this.normalizeBtcPubkey(o.popSignature), s = P(
599
614
  o.popSignature.btcPopSignature,
600
615
  "btcPopSignature"
@@ -649,7 +664,7 @@ class he {
649
664
  };
650
665
  if (o.requests.length === 0)
651
666
  throw new Error("Batch pegin requires at least one request");
652
- this.assertQuotedCommissionPresentWhenRequired(o.quotedCommissionBps), Q(o.expectedFingerprint);
667
+ this.assertQuotedCommissionPresentWhenRequired(o.quotedCommissionBps), G(o.expectedFingerprint);
653
668
  const n = this.assertPopMatchesEthAccount(o.popSignature), i = P(
654
669
  o.unsignedPrePeginTx,
655
670
  "unsignedPrePeginTx"
@@ -722,7 +737,7 @@ class he {
722
737
  assertEthAccount(e) {
723
738
  const o = this.config.ethWallet.account;
724
739
  if (!o) throw new Error("Ethereum wallet account not found");
725
- if (!gt(e, o.address))
740
+ if (!pt(e, o.address))
726
741
  throw new Error(
727
742
  `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.`
728
743
  );
@@ -746,17 +761,17 @@ class he {
746
761
  ), s = P(
747
762
  e.depositorSignedPeginTx,
748
763
  "depositorSignedPeginTx"
749
- ), r = Pt(s);
764
+ ), r = mt(s);
750
765
  return {
751
766
  unsignedPrePeginTx: i,
752
767
  depositorSignedPeginTx: s,
753
- payoutScript: Ut(
768
+ payoutScript: Mt(
754
769
  e.depositorPayoutScriptPubKey,
755
770
  n,
756
771
  e.depositorBtcPubkeyRaw
757
772
  ),
758
773
  peginTxHash: r,
759
- vaultId: P(bt(r, o), "vaultId")
774
+ vaultId: P(Pt(r, o), "vaultId")
760
775
  };
761
776
  }
762
777
  async assertVaultDoesNotExist(e, o) {
@@ -765,7 +780,7 @@ class he {
765
780
  abi: h,
766
781
  functionName: "getBtcVaultBasicInfo",
767
782
  args: [e]
768
- })).depositor !== ft)
783
+ })).depositor !== gt)
769
784
  throw new Error(
770
785
  `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.`
771
786
  );
@@ -833,7 +848,7 @@ class he {
833
848
  } catch (l) {
834
849
  T(l);
835
850
  }
836
- const u = await mt({
851
+ const u = await ft({
837
852
  publicClient: this.config.publicClient,
838
853
  walletAddress: i,
839
854
  hash: c,
@@ -848,16 +863,16 @@ class he {
848
863
  }
849
864
  export {
850
865
  v as C,
851
- xt as M,
852
- st as R,
866
+ Et as M,
867
+ it as R,
853
868
  he as V,
854
869
  ce as a,
855
- Wt as b,
870
+ Dt as b,
856
871
  zt as c,
857
872
  M as d,
858
- qt as e,
873
+ Ut as e,
859
874
  ue as i,
860
- $t as r,
861
- Dt as v
875
+ vt as r,
876
+ qt as v
862
877
  };
863
- //# sourceMappingURL=pegin-registration-client-C5Hktrja.js.map
878
+ //# sourceMappingURL=pegin-registration-client-ilkV1mLP.js.map