@babylonlabs-io/ts-sdk 0.33.4 → 0.33.5

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 (52) hide show
  1. package/dist/buildAndBroadcastRefund-B332dykQ.cjs +2 -0
  2. package/dist/buildAndBroadcastRefund-B332dykQ.cjs.map +1 -0
  3. package/dist/{buildAndBroadcastRefund-D_QlvCsw.js → buildAndBroadcastRefund-CPjXNaMi.js} +126 -121
  4. package/dist/buildAndBroadcastRefund-CPjXNaMi.js.map +1 -0
  5. package/dist/index.cjs +1 -1
  6. package/dist/index.js +89 -87
  7. package/dist/tbv/core/clients/index.cjs +1 -1
  8. package/dist/tbv/core/clients/index.js +23 -21
  9. package/dist/tbv/core/clients/vault-provider/__tests__/batchAttribution.test.d.ts +2 -0
  10. package/dist/tbv/core/clients/vault-provider/__tests__/batchAttribution.test.d.ts.map +1 -0
  11. package/dist/tbv/core/clients/vault-provider/__tests__/batchPoll.test.d.ts +2 -0
  12. package/dist/tbv/core/clients/vault-provider/__tests__/batchPoll.test.d.ts.map +1 -0
  13. package/dist/tbv/core/clients/vault-provider/api.d.ts +13 -4
  14. package/dist/tbv/core/clients/vault-provider/api.d.ts.map +1 -1
  15. package/dist/tbv/core/clients/vault-provider/batchAttribution.d.ts +45 -0
  16. package/dist/tbv/core/clients/vault-provider/batchAttribution.d.ts.map +1 -0
  17. package/dist/tbv/core/clients/vault-provider/batchPoll.d.ts +55 -0
  18. package/dist/tbv/core/clients/vault-provider/batchPoll.d.ts.map +1 -0
  19. package/dist/tbv/core/clients/vault-provider/index.d.ts +2 -0
  20. package/dist/tbv/core/clients/vault-provider/index.d.ts.map +1 -1
  21. package/dist/tbv/core/clients/vault-provider/json-rpc-client.d.ts +3 -3
  22. package/dist/tbv/core/clients/vault-provider/json-rpc-client.d.ts.map +1 -1
  23. package/dist/tbv/core/clients/vault-provider/types.d.ts +68 -24
  24. package/dist/tbv/core/clients/vault-provider/types.d.ts.map +1 -1
  25. package/dist/tbv/core/clients/vault-provider/validators.d.ts +12 -2
  26. package/dist/tbv/core/clients/vault-provider/validators.d.ts.map +1 -1
  27. package/dist/tbv/core/index.cjs +1 -1
  28. package/dist/tbv/core/index.js +73 -71
  29. package/dist/tbv/core/services/deposit/waitForPeginStatus.d.ts.map +1 -1
  30. package/dist/tbv/core/services/index.cjs +1 -1
  31. package/dist/tbv/core/services/index.js +1 -1
  32. package/dist/tbv/core/services/pegout/state.d.ts +1 -1
  33. package/dist/tbv/index.cjs +1 -1
  34. package/dist/tbv/index.js +73 -71
  35. package/dist/types-DnyyBNcC.cjs +2 -0
  36. package/dist/types-DnyyBNcC.cjs.map +1 -0
  37. package/dist/{types-ByW6nSLj.js → types-TiIjyo2b.js} +32 -30
  38. package/dist/types-TiIjyo2b.js.map +1 -0
  39. package/dist/{vault-registry-reader-WiNVOsnD.js → vault-registry-reader-BDFpXeH7.js} +425 -263
  40. package/dist/vault-registry-reader-BDFpXeH7.js.map +1 -0
  41. package/dist/vault-registry-reader-ejm2UYzk.cjs +2 -0
  42. package/dist/vault-registry-reader-ejm2UYzk.cjs.map +1 -0
  43. package/package.json +1 -1
  44. package/dist/buildAndBroadcastRefund-CIPPpchL.cjs +0 -2
  45. package/dist/buildAndBroadcastRefund-CIPPpchL.cjs.map +0 -1
  46. package/dist/buildAndBroadcastRefund-D_QlvCsw.js.map +0 -1
  47. package/dist/types-ByW6nSLj.js.map +0 -1
  48. package/dist/types-CfCZyfid.cjs +0 -2
  49. package/dist/types-CfCZyfid.cjs.map +0 -1
  50. package/dist/vault-registry-reader-OK2V08tk.cjs +0 -2
  51. package/dist/vault-registry-reader-OK2V08tk.cjs.map +0 -1
  52. package/dist/vault-registry-reader-WiNVOsnD.js.map +0 -1
@@ -1,54 +1,54 @@
1
- var Z = Object.defineProperty;
2
- var Q = (n, e, t) => e in n ? Z(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var c = (n, e, t) => Q(n, typeof e != "symbol" ? e + "" : e, t);
4
- import { D as ee, J as F } from "./types-ByW6nSLj.js";
5
- import { X as v, C as I, s as w, S as te, h as ne } from "./bitcoin-B0S8SHCX.js";
6
- import { H as _ } from "./validation-CxqROCno.js";
7
- import * as k from "@bitcoin-js/tiny-secp256k1-asmjs";
8
- import { payments as re, Transaction as C } from "bitcoinjs-lib";
9
- import { Buffer as f } from "buffer";
10
- import { s as H } from "./sha2-6wN58S6R.js";
11
- import { B as y } from "./BTCVaultRegistry.abi-DbJ5lsFJ.js";
12
- import { P as h, A as $ } from "./ProtocolParams.abi-DXu8L0Fn.js";
13
- const O = new Set(Object.values(ee)), se = 200;
14
- function o(n) {
1
+ var ce = Object.defineProperty;
2
+ var le = (n, e, t) => e in n ? ce(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var h = (n, e, t) => le(n, typeof e != "symbol" ? e + "" : e, t);
4
+ import { D as ue, J as Y, e as de } from "./types-TiIjyo2b.js";
5
+ import { X as B, C as K, s as C, S as pe, h as he } from "./bitcoin-B0S8SHCX.js";
6
+ import { H as k } from "./validation-CxqROCno.js";
7
+ import * as N from "@bitcoin-js/tiny-secp256k1-asmjs";
8
+ import { payments as ge, Transaction as D } from "bitcoinjs-lib";
9
+ import { Buffer as x } from "buffer";
10
+ import { s as G } from "./sha2-6wN58S6R.js";
11
+ import { B as S } from "./BTCVaultRegistry.abi-DbJ5lsFJ.js";
12
+ import { P as b, A as O } from "./ProtocolParams.abi-DXu8L0Fn.js";
13
+ const F = new Set(Object.values(ue)), fe = 200;
14
+ function c(n) {
15
15
  var e;
16
- return ((e = JSON.stringify(n)) == null ? void 0 : e.slice(0, se)) ?? "undefined";
16
+ return ((e = JSON.stringify(n)) == null ? void 0 : e.slice(0, fe)) ?? "undefined";
17
17
  }
18
- const ie = "The vault provider returned an unexpected response. Please try again or contact support.";
18
+ const _e = "The vault provider returned an unexpected response. Please try again or contact support.";
19
19
  class s extends Error {
20
20
  constructor(t) {
21
- super(ie);
22
- c(this, "detail");
21
+ super(_e);
22
+ h(this, "detail");
23
23
  this.name = "VpResponseValidationError", this.detail = t;
24
24
  }
25
25
  }
26
- const x = 64;
27
- function m(n) {
28
- return typeof n == "string" && n.length > 0 && _.test(n);
26
+ const V = 64;
27
+ function P(n) {
28
+ return typeof n == "string" && n.length > 0 && k.test(n);
29
29
  }
30
- function M(n) {
30
+ function Z(n) {
31
31
  return typeof n == "string" && n.length > 0;
32
32
  }
33
- function X(n, e) {
34
- if (!m(n))
33
+ function Q(n, e) {
34
+ if (!P(n))
35
35
  throw new s(
36
- `VP response validation failed: "${e}" must be a non-empty hex string, got ${o(n)}`
36
+ `VP response validation failed: "${e}" must be a non-empty hex string, got ${c(n)}`
37
37
  );
38
38
  }
39
- function b(n, e) {
40
- if (!M(n))
39
+ function g(n, e) {
40
+ if (!Z(n))
41
41
  throw new s(
42
- `VP response validation failed: "${e}" must be a non-empty string, got ${o(n)}`
42
+ `VP response validation failed: "${e}" must be a non-empty string, got ${c(n)}`
43
43
  );
44
44
  }
45
- function G(n, e) {
46
- if (!m(n) || n.length !== v && n.length !== I)
45
+ function ee(n, e) {
46
+ if (!P(n) || n.length !== B && n.length !== K)
47
47
  throw new s(
48
- `VP response validation failed: "${e}" must be a ${v} or ${I}-char hex string (BTC pubkey), got ${o(n)}`
48
+ `VP response validation failed: "${e}" must be a ${B} or ${K}-char hex string (BTC pubkey), got ${c(n)}`
49
49
  );
50
50
  }
51
- function ae(n) {
51
+ function me(n) {
52
52
  const e = n.presigning;
53
53
  if (e == null) return;
54
54
  if (typeof e != "object" || Array.isArray(e))
@@ -58,49 +58,49 @@ function ae(n) {
58
58
  const t = e;
59
59
  if (t.depositor_graph_created !== void 0 && typeof t.depositor_graph_created != "boolean")
60
60
  throw new s(
61
- `VP response validation failed: "progress.presigning.depositor_graph_created" must be a boolean if present, got ${o(t.depositor_graph_created)}`
61
+ `VP response validation failed: "progress.presigning.depositor_graph_created" must be a boolean if present, got ${c(t.depositor_graph_created)}`
62
62
  );
63
63
  if (t.vk_challenger_presigning_completed !== void 0 && typeof t.vk_challenger_presigning_completed != "number")
64
64
  throw new s(
65
- `VP response validation failed: "progress.presigning.vk_challenger_presigning_completed" must be a number if present, got ${o(t.vk_challenger_presigning_completed)}`
65
+ `VP response validation failed: "progress.presigning.vk_challenger_presigning_completed" must be a number if present, got ${c(t.vk_challenger_presigning_completed)}`
66
66
  );
67
67
  if (t.vk_challenger_presigning_total !== void 0 && typeof t.vk_challenger_presigning_total != "number")
68
68
  throw new s(
69
- `VP response validation failed: "progress.presigning.vk_challenger_presigning_total" must be a number if present, got ${o(t.vk_challenger_presigning_total)}`
69
+ `VP response validation failed: "progress.presigning.vk_challenger_presigning_total" must be a number if present, got ${c(t.vk_challenger_presigning_total)}`
70
70
  );
71
71
  }
72
- function oe(n) {
72
+ function te(n) {
73
73
  if (n === null || typeof n != "object")
74
74
  throw new s(
75
75
  "VP response validation failed: getPeginStatus response is not an object"
76
76
  );
77
77
  const e = n;
78
- if (!m(e.pegin_txid) || e.pegin_txid.length !== x)
78
+ if (!P(e.pegin_txid) || e.pegin_txid.length !== V)
79
79
  throw new s(
80
- `VP response validation failed: "pegin_txid" must be a ${x}-char hex string (txid), got ${o(e.pegin_txid)}`
80
+ `VP response validation failed: "pegin_txid" must be a ${V}-char hex string (txid), got ${c(e.pegin_txid)}`
81
81
  );
82
82
  if (typeof e.status != "string")
83
83
  throw new s(
84
84
  'VP response validation failed: "status" must be a string'
85
85
  );
86
- if (!O.has(e.status))
86
+ if (!F.has(e.status))
87
87
  throw new s(
88
- `VP response validation failed: unrecognized status "${e.status}". Expected one of: ${[...O].join(", ")}`
88
+ `VP response validation failed: unrecognized status "${e.status}". Expected one of: ${[...F].join(", ")}`
89
89
  );
90
90
  if (e.progress === null || typeof e.progress != "object" || Array.isArray(e.progress))
91
91
  throw new s(
92
92
  'VP response validation failed: "progress" must be an object'
93
93
  );
94
- if (ae(e.progress), typeof e.health_info != "string")
94
+ if (me(e.progress), typeof e.health_info != "string")
95
95
  throw new s(
96
96
  'VP response validation failed: "health_info" must be a string'
97
97
  );
98
98
  if (e.last_error !== void 0 && typeof e.last_error != "string")
99
99
  throw new s(
100
- `VP response validation failed: "last_error" must be a string if present, got ${o(e.last_error)}`
100
+ `VP response validation failed: "last_error" must be a string if present, got ${c(e.last_error)}`
101
101
  );
102
102
  }
103
- function ce(n) {
103
+ function be(n) {
104
104
  if (n === null || typeof n != "object")
105
105
  throw new s(
106
106
  "VP response validation failed: requestDepositorPresignTransactions response is not an object"
@@ -111,56 +111,56 @@ function ce(n) {
111
111
  'VP response validation failed: "txs" must be an array'
112
112
  );
113
113
  for (let t = 0; t < e.txs.length; t++)
114
- le(e.txs[t], `txs[${t}]`);
114
+ ye(e.txs[t], `txs[${t}]`);
115
115
  if (e.depositor_graph === null || typeof e.depositor_graph != "object")
116
116
  throw new s(
117
117
  'VP response validation failed: "depositor_graph" must be an object'
118
118
  );
119
- ge(
119
+ $e(
120
120
  e.depositor_graph
121
121
  );
122
122
  }
123
- function g(n, e) {
123
+ function y(n, e) {
124
124
  if (n === null || typeof n != "object")
125
125
  throw new s(
126
126
  `VP response validation failed: "${e}" must be an object`
127
127
  );
128
- X(n.tx_hex, `${e}.tx_hex`);
128
+ Q(n.tx_hex, `${e}.tx_hex`);
129
129
  }
130
- function le(n, e) {
130
+ function ye(n, e) {
131
131
  if (n === null || typeof n != "object")
132
132
  throw new s(
133
133
  `VP response validation failed: "${e}" must be an object`
134
134
  );
135
135
  const t = n;
136
- G(t.claimer_pubkey, `${e}.claimer_pubkey`), g(t.claim_tx, `${e}.claim_tx`), g(t.assert_tx, `${e}.assert_tx`), g(t.payout_tx, `${e}.payout_tx`), b(t.payout_psbt, `${e}.payout_psbt`);
136
+ ee(t.claimer_pubkey, `${e}.claimer_pubkey`), y(t.claim_tx, `${e}.claim_tx`), y(t.assert_tx, `${e}.assert_tx`), y(t.payout_tx, `${e}.payout_tx`), g(t.payout_psbt, `${e}.payout_psbt`);
137
137
  }
138
- function ue(n, e) {
138
+ function we(n, e) {
139
139
  if (n === null || typeof n != "object")
140
140
  throw new s(
141
141
  `VP response validation failed: "${e}" must be an object`
142
142
  );
143
143
  const t = n;
144
- b(t.wots_pks_json, `${e}.wots_pks_json`), b(t.gc_wots_keys_json, `${e}.gc_wots_keys_json`);
144
+ g(t.wots_pks_json, `${e}.wots_pks_json`), g(t.gc_wots_keys_json, `${e}.gc_wots_keys_json`);
145
145
  }
146
- function de(n, e) {
146
+ function Pe(n, e) {
147
147
  if (n === null || typeof n != "object")
148
148
  throw new s(
149
149
  `VP response validation failed: "${e}" must be an object`
150
150
  );
151
151
  const t = n;
152
- if (G(t.challenger_pubkey, `${e}.challenger_pubkey`), g(
152
+ if (ee(t.challenger_pubkey, `${e}.challenger_pubkey`), y(
153
153
  t.challenge_assert_x_tx,
154
154
  `${e}.challenge_assert_x_tx`
155
- ), g(
155
+ ), y(
156
156
  t.challenge_assert_y_tx,
157
157
  `${e}.challenge_assert_y_tx`
158
- ), g(t.nopayout_tx, `${e}.nopayout_tx`), b(t.nopayout_psbt, `${e}.nopayout_psbt`), !Array.isArray(t.challenge_assert_connectors))
158
+ ), y(t.nopayout_tx, `${e}.nopayout_tx`), g(t.nopayout_psbt, `${e}.nopayout_psbt`), !Array.isArray(t.challenge_assert_connectors))
159
159
  throw new s(
160
160
  `VP response validation failed: "${e}.challenge_assert_connectors" must be an array`
161
161
  );
162
162
  for (let r = 0; r < t.challenge_assert_connectors.length; r++)
163
- ue(
163
+ we(
164
164
  t.challenge_assert_connectors[r],
165
165
  `${e}.challenge_assert_connectors[${r}]`
166
166
  );
@@ -169,24 +169,24 @@ function de(n, e) {
169
169
  `VP response validation failed: "${e}.output_label_hashes" must be an array`
170
170
  );
171
171
  for (let r = 0; r < t.output_label_hashes.length; r++)
172
- X(
172
+ Q(
173
173
  t.output_label_hashes[r],
174
174
  `${e}.output_label_hashes[${r}]`
175
175
  );
176
176
  }
177
- function pe(n) {
177
+ function ve(n) {
178
178
  if (n === null || typeof n != "object")
179
179
  throw new s(
180
180
  "VP response validation failed: requestDepositorClaimerArtifacts response is not an object"
181
181
  );
182
182
  const e = n;
183
- if (!M(e.tx_graph_json))
183
+ if (!Z(e.tx_graph_json))
184
184
  throw new s(
185
- `VP response validation failed: "tx_graph_json" must be a non-empty string, got ${o(e.tx_graph_json)}`
185
+ `VP response validation failed: "tx_graph_json" must be a non-empty string, got ${c(e.tx_graph_json)}`
186
186
  );
187
- if (!m(e.verifying_key_hex))
187
+ if (!P(e.verifying_key_hex))
188
188
  throw new s(
189
- `VP response validation failed: "verifying_key_hex" must be a non-empty hex string, got ${o(e.verifying_key_hex)}`
189
+ `VP response validation failed: "verifying_key_hex" must be a non-empty hex string, got ${c(e.verifying_key_hex)}`
190
190
  );
191
191
  if (e.babe_sessions === null || typeof e.babe_sessions != "object")
192
192
  throw new s(
@@ -200,60 +200,138 @@ function pe(n) {
200
200
  `VP response validation failed: "babe_sessions.${t}" must be an object`
201
201
  );
202
202
  const i = r;
203
- if (!m(i.decryptor_artifacts_hex))
203
+ if (!P(i.decryptor_artifacts_hex))
204
204
  throw new s(
205
- `VP response validation failed: "babe_sessions.${t}.decryptor_artifacts_hex" must be a non-empty hex string, got ${o(i.decryptor_artifacts_hex)}`
205
+ `VP response validation failed: "babe_sessions.${t}.decryptor_artifacts_hex" must be a non-empty hex string, got ${c(i.decryptor_artifacts_hex)}`
206
206
  );
207
207
  }
208
208
  }
209
- function he(n) {
209
+ function xe(n) {
210
210
  if (n === null || typeof n != "object")
211
211
  throw new s(
212
- "VP response validation failed: getPegoutStatus response is not an object"
212
+ "VP response validation failed: pegout status payload is not an object"
213
213
  );
214
214
  const e = n;
215
- if (!m(e.pegin_txid) || e.pegin_txid.length !== x)
215
+ if (!P(e.pegin_txid) || e.pegin_txid.length !== V)
216
216
  throw new s(
217
- `VP response validation failed: "pegin_txid" must be a ${x}-char hex string (txid), got ${o(e.pegin_txid)}`
217
+ `VP response validation failed: "pegin_txid" must be a ${V}-char hex string (txid), got ${c(e.pegin_txid)}`
218
218
  );
219
219
  if (typeof e.found != "boolean")
220
220
  throw new s(
221
- `VP response validation failed: "found" must be a boolean, got ${o(e.found)}`
221
+ `VP response validation failed: "found" must be a boolean, got ${c(e.found)}`
222
222
  );
223
- if (e.claimer !== void 0) {
224
- if (e.claimer === null || typeof e.claimer != "object")
223
+ if (e.claimer !== null) {
224
+ if (typeof e.claimer != "object")
225
225
  throw new s(
226
- 'VP response validation failed: "claimer" must be an object if present'
226
+ `VP response validation failed: "claimer" must be an object or null, got ${c(e.claimer)}`
227
227
  );
228
- const t = e.claimer;
229
- if (typeof t.status != "string")
228
+ Ve(e.claimer);
229
+ }
230
+ if (!Array.isArray(e.challengers))
231
+ throw new s(
232
+ `VP response validation failed: "challengers" must be an array, got ${c(e.challengers)}`
233
+ );
234
+ for (let t = 0; t < e.challengers.length; t++)
235
+ Ae(e.challengers[t], t);
236
+ }
237
+ function Ve(n) {
238
+ if (g(n.status, "claimer.status"), typeof n.failed != "boolean")
239
+ throw new s(
240
+ `VP response validation failed: "claimer.failed" must be a boolean, got ${c(n.failed)}`
241
+ );
242
+ if (g(n.claim_txid, "claimer.claim_txid"), g(n.claimer_pubkey, "claimer.claimer_pubkey"), g(n.assert_txid, "claimer.assert_txid"), n.challenger_pubkey !== null && typeof n.challenger_pubkey != "string")
243
+ throw new s(
244
+ `VP response validation failed: "claimer.challenger_pubkey" must be a string or null, got ${c(n.challenger_pubkey)}`
245
+ );
246
+ if (typeof n.created_at != "number")
247
+ throw new s(
248
+ `VP response validation failed: "claimer.created_at" must be a number, got ${c(n.created_at)}`
249
+ );
250
+ if (typeof n.updated_at != "number")
251
+ throw new s(
252
+ `VP response validation failed: "claimer.updated_at" must be a number, got ${c(n.updated_at)}`
253
+ );
254
+ }
255
+ function Ae(n, e) {
256
+ if (n === null || typeof n != "object")
257
+ throw new s(
258
+ `VP response validation failed: "challengers[${e}]" must be an object, got ${c(n)}`
259
+ );
260
+ const t = n;
261
+ if (g(t.status, `challengers[${e}].status`), g(t.claim_txid, `challengers[${e}].claim_txid`), g(t.claimer_pubkey, `challengers[${e}].claimer_pubkey`), E(t.assert_txid, `challengers[${e}].assert_txid`), E(
262
+ t.challenge_assert_x_txid,
263
+ `challengers[${e}].challenge_assert_x_txid`
264
+ ), E(
265
+ t.challenge_assert_y_txid,
266
+ `challengers[${e}].challenge_assert_y_txid`
267
+ ), E(t.nopayout_txid, `challengers[${e}].nopayout_txid`), typeof t.created_at != "number")
268
+ throw new s(
269
+ `VP response validation failed: "challengers[${e}].created_at" must be a number, got ${c(t.created_at)}`
270
+ );
271
+ if (typeof t.updated_at != "number")
272
+ throw new s(
273
+ `VP response validation failed: "challengers[${e}].updated_at" must be a number, got ${c(t.updated_at)}`
274
+ );
275
+ }
276
+ function E(n, e) {
277
+ if (n !== null && typeof n != "string")
278
+ throw new s(
279
+ `VP response validation failed: "${e}" must be a string or null, got ${c(n)}`
280
+ );
281
+ }
282
+ function ke(n) {
283
+ ne(n, "batchGetPeginStatus", (e) => {
284
+ e.result !== null && te(e.result);
285
+ });
286
+ }
287
+ function Se(n) {
288
+ ne(n, "batchGetPegoutStatus", (e) => {
289
+ e.result !== null && xe(e.result);
290
+ });
291
+ }
292
+ function ne(n, e, t) {
293
+ if (n === null || typeof n != "object")
294
+ throw new s(
295
+ `VP response validation failed: ${e} response is not an object`
296
+ );
297
+ const r = n;
298
+ if (!Array.isArray(r.results))
299
+ throw new s(
300
+ `VP response validation failed: "${e}.results" must be an array, got ${c(r.results)}`
301
+ );
302
+ for (let i = 0; i < r.results.length; i++) {
303
+ const a = r.results[i];
304
+ if (a === null || typeof a != "object")
230
305
  throw new s(
231
- `VP response validation failed: "claimer.status" must be a string, got ${o(t.status)}`
306
+ `VP response validation failed: "${e}.results[${i}]" must be an object, got ${c(a)}`
232
307
  );
233
- if (typeof t.failed != "boolean")
308
+ const o = a;
309
+ if (!P(o.pegin_txid) || o.pegin_txid.length !== V)
234
310
  throw new s(
235
- `VP response validation failed: "claimer.failed" must be a boolean, got ${o(t.failed)}`
311
+ `VP response validation failed: "${e}.results[${i}].pegin_txid" must be a ${V}-char hex string, got ${c(o.pegin_txid)}`
236
312
  );
237
- }
238
- if (e.challenger !== void 0) {
239
- if (e.challenger === null || typeof e.challenger != "object")
313
+ if (o.error !== null && typeof o.error != "string")
314
+ throw new s(
315
+ `VP response validation failed: "${e}.results[${i}].error" must be a string or null, got ${c(o.error)}`
316
+ );
317
+ if (o.result === null && o.error === null)
240
318
  throw new s(
241
- 'VP response validation failed: "challenger" must be an object if present'
319
+ `VP response validation failed: "${e}.results[${i}]" has neither "result" nor "error" populated`
242
320
  );
243
- const t = e.challenger;
244
- if (typeof t.status != "string")
321
+ if (o.result !== null && o.error !== null)
245
322
  throw new s(
246
- `VP response validation failed: "challenger.status" must be a string, got ${o(t.status)}`
323
+ `VP response validation failed: "${e}.results[${i}]" has both "result" and "error" populated`
247
324
  );
325
+ t(o, i);
248
326
  }
249
327
  }
250
- function ge(n) {
251
- if (g(n.claim_tx, "depositor_graph.claim_tx"), g(n.assert_tx, "depositor_graph.assert_tx"), g(n.payout_tx, "depositor_graph.payout_tx"), b(n.payout_psbt, "depositor_graph.payout_psbt"), !Array.isArray(n.challenger_presign_data))
328
+ function $e(n) {
329
+ if (y(n.claim_tx, "depositor_graph.claim_tx"), y(n.assert_tx, "depositor_graph.assert_tx"), y(n.payout_tx, "depositor_graph.payout_tx"), g(n.payout_psbt, "depositor_graph.payout_psbt"), !Array.isArray(n.challenger_presign_data))
252
330
  throw new s(
253
331
  'VP response validation failed: "depositor_graph.challenger_presign_data" must be an array'
254
332
  );
255
333
  for (let e = 0; e < n.challenger_presign_data.length; e++)
256
- de(
334
+ Pe(
257
335
  n.challenger_presign_data[e],
258
336
  `depositor_graph.challenger_presign_data[${e}]`
259
337
  );
@@ -262,13 +340,13 @@ function ge(n) {
262
340
  'VP response validation failed: "depositor_graph.offchain_params_version" must be a number'
263
341
  );
264
342
  }
265
- const fe = 6e4;
266
- class me {
343
+ const Te = 6e4;
344
+ class Ce {
267
345
  constructor(e, t) {
268
- c(this, "client");
346
+ h(this, "client");
269
347
  const r = {
270
348
  baseUrl: e,
271
- timeout: (t == null ? void 0 : t.timeout) ?? fe,
349
+ timeout: (t == null ? void 0 : t.timeout) ?? Te,
272
350
  retries: t == null ? void 0 : t.retries,
273
351
  retryDelay: t == null ? void 0 : t.retryDelay,
274
352
  retryableFor: t == null ? void 0 : t.retryableFor,
@@ -276,7 +354,7 @@ class me {
276
354
  tokenProvider: t == null ? void 0 : t.tokenProvider,
277
355
  maxResponseBytes: t == null ? void 0 : t.maxResponseBytes
278
356
  };
279
- this.client = new F(r);
357
+ this.client = new Y(r);
280
358
  }
281
359
  /**
282
360
  * Request the payout/claim/assert transactions that the depositor
@@ -284,7 +362,7 @@ class me {
284
362
  */
285
363
  async requestDepositorPresignTransactions(e, t) {
286
364
  const r = await this.client.call("vaultProvider_requestDepositorPresignTransactions", e, t);
287
- return ce(r), r;
365
+ return be(r), r;
288
366
  }
289
367
  /**
290
368
  * Submit the depositor's pre-signatures for the payout transactions
@@ -315,7 +393,7 @@ class me {
315
393
  */
316
394
  async requestDepositorClaimerArtifacts(e, t) {
317
395
  const r = await this.client.call("vaultProvider_requestDepositorClaimerArtifacts", e, t);
318
- return pe(r), r;
396
+ return ve(r), r;
319
397
  }
320
398
  /** Get the current pegin status from the vault provider daemon. */
321
399
  async getPeginStatus(e, t) {
@@ -324,66 +402,149 @@ class me {
324
402
  e,
325
403
  t
326
404
  );
327
- return oe(r), r;
405
+ return te(r), r;
328
406
  }
329
- /** Get the current pegout status from the vault provider daemon. */
330
- async getPegoutStatus(e, t) {
331
- const r = await this.client.call(
332
- "vaultProvider_getPegoutStatus",
333
- e,
334
- t
407
+ /**
408
+ * Get pegin status for many txids in one round trip. Per-result envelope
409
+ * isolates per-pegin failures from the overall RPC. Caller must chunk
410
+ * inputs at `VP_BATCH_MAX_SIZE`.
411
+ */
412
+ async batchGetPeginStatus(e, t) {
413
+ const r = await this.client.call("vaultProvider_batchGetPeginStatus", e, t);
414
+ return ke(r), r;
415
+ }
416
+ /**
417
+ * Get pegout status for many txids in one round trip. Same per-result
418
+ * envelope semantics as `batchGetPeginStatus`.
419
+ */
420
+ async batchGetPegoutStatus(e, t) {
421
+ const r = await this.client.call("vaultProvider_batchGetPegoutStatus", e, t);
422
+ return Se(r), r;
423
+ }
424
+ }
425
+ function Ee(n, e) {
426
+ const t = /* @__PURE__ */ new Set();
427
+ for (const d of n)
428
+ t.add(d.toLowerCase());
429
+ const r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set(), a = [], o = [];
430
+ for (const d of e) {
431
+ const l = d.pegin_txid.toLowerCase();
432
+ if (!t.has(l)) {
433
+ o.push(l);
434
+ continue;
435
+ }
436
+ if (i.has(l)) {
437
+ a.push(l);
438
+ continue;
439
+ }
440
+ i.add(l), r.set(l, { result: d.result, error: d.error });
441
+ }
442
+ const u = [];
443
+ for (const d of t)
444
+ i.has(d) || u.push(d);
445
+ return { byTxid: r, missing: u, unexpected: o, duplicate: a };
446
+ }
447
+ async function et(n) {
448
+ const {
449
+ items: e,
450
+ getTxid: t,
451
+ batchCall: r,
452
+ onItem: i,
453
+ onMissing: a,
454
+ onDuplicate: o,
455
+ onDuplicateBatch: u,
456
+ onWholeBatchError: d,
457
+ onUnexpected: l,
458
+ batchSize: m = de
459
+ } = n;
460
+ if (!Number.isInteger(m) || m <= 0)
461
+ throw new Error(
462
+ `batchPollByProvider: batchSize must be a positive integer, got ${m}`
335
463
  );
336
- return he(r), r;
464
+ for (let w = 0; w < e.length; w += m) {
465
+ const A = e.slice(w, w + m), $ = /* @__PURE__ */ new Map(), j = [];
466
+ for (const p of A) {
467
+ const f = t(p).toLowerCase();
468
+ $.set(f, p), j.push(f);
469
+ }
470
+ let v;
471
+ try {
472
+ const p = await r(j);
473
+ v = Ee(j, p.results);
474
+ } catch (p) {
475
+ d(A, p);
476
+ continue;
477
+ }
478
+ l && v.unexpected.length > 0 && l(v.unexpected);
479
+ const T = new Set(v.duplicate);
480
+ for (const p of T) {
481
+ const f = $.get(p);
482
+ f && o(f);
483
+ }
484
+ u && T.size > 0 && u(T.size);
485
+ for (const p of v.missing) {
486
+ const f = $.get(p);
487
+ f && a(f);
488
+ }
489
+ for (const [p, f] of v.byTxid) {
490
+ if (T.has(p)) continue;
491
+ const M = $.get(p);
492
+ M && i(M, {
493
+ pegin_txid: p,
494
+ result: f.result,
495
+ error: f.error
496
+ });
497
+ }
337
498
  }
338
499
  }
339
- const _e = "BIP0322-signed-message", ye = "TapTweak", q = 32, be = 64;
340
- function W(n, e) {
341
- const t = new TextEncoder().encode(n), r = H(t), i = new Uint8Array(r.length * 2 + e.length);
342
- return i.set(r, 0), i.set(r, r.length), i.set(e, r.length * 2), H(i);
500
+ const Ie = "BIP0322-signed-message", Be = "TapTweak", re = 32, Re = 64;
501
+ function se(n, e) {
502
+ const t = new TextEncoder().encode(n), r = G(t), i = new Uint8Array(r.length * 2 + e.length);
503
+ return i.set(r, 0), i.set(r, r.length), i.set(e, r.length * 2), G(i);
343
504
  }
344
- function we(n) {
345
- if (n.length !== q) return null;
346
- const e = W(ye, n), t = k.xOnlyPointAddTweak(n, e);
505
+ function He(n) {
506
+ if (n.length !== re) return null;
507
+ const e = se(Be, n), t = N.xOnlyPointAddTweak(n, e);
347
508
  return t ? t.xOnlyPubkey : null;
348
509
  }
349
- function Pe(n, e, t) {
350
- if (e.length !== q || t.length !== be) return !1;
510
+ function Ne(n, e, t) {
511
+ if (e.length !== re || t.length !== Re) return !1;
351
512
  try {
352
- const r = W(_e, n), i = re.p2tr({
353
- internalPubkey: f.from(e)
513
+ const r = se(Ie, n), i = ge.p2tr({
514
+ internalPubkey: x.from(e)
354
515
  });
355
516
  if (!i.output) return !1;
356
- const a = i.output, l = 0, p = new C();
357
- p.version = 0, p.locktime = 0;
358
- const S = f.concat([
359
- f.from([0, 32]),
360
- f.from(r)
517
+ const a = i.output, o = 0, u = new D();
518
+ u.version = 0, u.locktime = 0;
519
+ const d = x.concat([
520
+ x.from([0, 32]),
521
+ x.from(r)
361
522
  ]);
362
- p.addInput(
363
- f.alloc(32, 0),
523
+ u.addInput(
524
+ x.alloc(32, 0),
364
525
  // prev_txid = 0x0000...0000
365
526
  4294967295,
366
527
  // prev_vout = 0xFFFFFFFF
367
528
  0,
368
529
  // sequence = 0
369
- S
370
- ), p.addOutput(a, l);
371
- const d = new C();
372
- d.version = 0, d.locktime = 0;
373
- const T = p.getHash();
374
- d.addInput(T, 0, 0), d.addOutput(f.from([106]), l);
375
- const N = d.hashForWitnessV1(
530
+ d
531
+ ), u.addOutput(a, o);
532
+ const l = new D();
533
+ l.version = 0, l.locktime = 0;
534
+ const m = u.getHash();
535
+ l.addInput(m, 0, 0), l.addOutput(x.from([106]), o);
536
+ const w = l.hashForWitnessV1(
376
537
  0,
377
538
  [a],
378
- [l],
379
- C.SIGHASH_DEFAULT
380
- ), R = we(e);
381
- return R ? k.verifySchnorr(N, R, t) : !1;
539
+ [o],
540
+ D.SIGHASH_DEFAULT
541
+ ), A = He(e);
542
+ return A ? N.verifySchnorr(w, A, t) : !1;
382
543
  } catch {
383
544
  return !1;
384
545
  }
385
546
  }
386
- function A(n, e) {
547
+ function R(n, e) {
387
548
  const t = (n & 7) << 5, r = typeof e == "bigint" ? e : BigInt(e);
388
549
  if (r < 0n) throw new Error("cborHead: negative argument");
389
550
  if (r < 24n) return new Uint8Array([t | Number(r)]);
@@ -408,139 +569,139 @@ function A(n, e) {
408
569
  i[1 + a] = Number(r >> BigInt((7 - a) * 8)) & 255;
409
570
  return i;
410
571
  }
411
- function J(...n) {
572
+ function ie(...n) {
412
573
  const e = n.reduce((i, a) => i + a.length, 0), t = new Uint8Array(e);
413
574
  let r = 0;
414
575
  for (const i of n)
415
576
  t.set(i, r), r += i.length;
416
577
  return t;
417
578
  }
418
- function j(n) {
419
- const t = [A(4, n.length)];
579
+ function X(n) {
580
+ const t = [R(4, n.length)];
420
581
  for (const r of n)
421
- t.push(A(0, r));
422
- return J(...t);
582
+ t.push(R(0, r));
583
+ return ie(...t);
423
584
  }
424
- function ve(n, e, t) {
585
+ function je(n, e, t) {
425
586
  if (!Number.isSafeInteger(t) || t < 0)
426
587
  throw new Error(
427
588
  `encodeServerIdentityPayload: expires_at must be a non-negative safe integer, got ${t}`
428
589
  );
429
- const r = A(4, 3), i = j(n), a = j(e), l = A(0, t);
430
- return J(r, i, a, l);
590
+ const r = R(4, 3), i = X(n), a = X(e), o = R(0, t);
591
+ return ie(r, i, a, o);
431
592
  }
432
- const xe = new TextEncoder().encode(
593
+ const De = new TextEncoder().encode(
433
594
  "btc-auth.server-identity.v1"
434
595
  );
435
- class u extends Error {
596
+ class _ extends Error {
436
597
  constructor(e, t) {
437
598
  super(e), this.reason = t, this.name = "ServerIdentityError";
438
599
  }
439
600
  }
440
- function P(n) {
601
+ function I(n) {
441
602
  const e = new Uint8Array(n.length / 2);
442
603
  for (let t = 0; t < e.length; t++)
443
604
  e[t] = parseInt(n.slice(t * 2, t * 2 + 2), 16);
444
605
  return e;
445
606
  }
446
- function Ae(n) {
447
- const { proof: e, pinnedServerPubkey: t, now: r } = n, i = w(t).toLowerCase();
448
- if (i.length !== v || !_.test(i))
449
- throw new u(
607
+ function Oe(n) {
608
+ const { proof: e, pinnedServerPubkey: t, now: r } = n, i = C(t).toLowerCase();
609
+ if (i.length !== B || !k.test(i))
610
+ throw new _(
450
611
  `pinnedServerPubkey must be 32-byte hex; got ${i.length} chars`,
451
612
  "invalid_pubkey_encoding"
452
613
  );
453
- const a = w(e.server_pubkey).toLowerCase();
454
- if (a.length !== v || !_.test(a))
455
- throw new u(
614
+ const a = C(e.server_pubkey).toLowerCase();
615
+ if (a.length !== B || !k.test(a))
616
+ throw new _(
456
617
  `server_pubkey must be 32-byte hex; got ${a.length} chars`,
457
618
  "invalid_pubkey_encoding"
458
619
  );
459
620
  if (a !== i)
460
- throw new u(
621
+ throw new _(
461
622
  `server_pubkey does not match pinned value: expected ${i}, got ${a}`,
462
623
  "pinned_pubkey_mismatch"
463
624
  );
464
625
  if (!Number.isSafeInteger(e.expires_at))
465
- throw new u(
626
+ throw new _(
466
627
  `expires_at must be a finite integer; got ${JSON.stringify(e.expires_at)}`,
467
628
  "invalid_expires_at"
468
629
  );
469
630
  if (!Number.isSafeInteger(r))
470
- throw new u(
631
+ throw new _(
471
632
  `now must be a finite integer; got ${JSON.stringify(r)}`,
472
633
  "invalid_expires_at"
473
634
  );
474
635
  if (e.expires_at <= r)
475
- throw new u(
636
+ throw new _(
476
637
  `server identity proof expired at ${e.expires_at}, now ${r}`,
477
638
  "expired"
478
639
  );
479
- const l = w(e.ephemeral_pubkey).toLowerCase();
480
- if (l.length !== I || !_.test(l))
481
- throw new u(
482
- `ephemeral_pubkey must be 33-byte compressed hex; got ${l.length} chars`,
640
+ const o = C(e.ephemeral_pubkey).toLowerCase();
641
+ if (o.length !== K || !k.test(o))
642
+ throw new _(
643
+ `ephemeral_pubkey must be 33-byte compressed hex; got ${o.length} chars`,
483
644
  "invalid_ephemeral_pubkey"
484
645
  );
485
- const p = l.slice(0, 2);
486
- if (p !== "02" && p !== "03")
487
- throw new u(
488
- `ephemeral_pubkey must be compressed (prefix 02/03); got ${p}`,
646
+ const u = o.slice(0, 2);
647
+ if (u !== "02" && u !== "03")
648
+ throw new _(
649
+ `ephemeral_pubkey must be compressed (prefix 02/03); got ${u}`,
489
650
  "invalid_ephemeral_pubkey"
490
651
  );
491
- const S = P(l);
492
- if (!k.isPoint(S))
493
- throw new u(
652
+ const d = I(o);
653
+ if (!N.isPoint(d))
654
+ throw new _(
494
655
  "ephemeral_pubkey is not a valid secp256k1 point",
495
656
  "invalid_ephemeral_pubkey"
496
657
  );
497
- const d = w(e.signature).toLowerCase();
498
- if (d.length !== te || !_.test(d))
499
- throw new u(
500
- `signature must be 64-byte Schnorr hex; got ${d.length} chars`,
658
+ const l = C(e.signature).toLowerCase();
659
+ if (l.length !== pe || !k.test(l))
660
+ throw new _(
661
+ `signature must be 64-byte Schnorr hex; got ${l.length} chars`,
501
662
  "invalid_signature_encoding"
502
663
  );
503
- const T = ve(
504
- xe,
505
- P(l),
664
+ const m = je(
665
+ De,
666
+ I(o),
506
667
  e.expires_at
507
668
  );
508
- if (!Pe(T, P(a), P(d)))
509
- throw new u(
669
+ if (!Ne(m, I(a), I(l)))
670
+ throw new _(
510
671
  "BIP-322 signature verification failed — ephemeral key is not attested by pinned server pubkey",
511
672
  "signature_verification_failed"
512
673
  );
513
674
  }
514
- const Ve = /* @__PURE__ */ new Set([
675
+ const Ue = /* @__PURE__ */ new Set([
515
676
  "vaultProvider_submitDepositorWotsKey",
516
677
  "vaultProvider_submitDepositorPresignatures",
517
678
  "vaultProvider_requestDepositorPresignTransactions"
518
- ]), ke = 6e4, B = "auth_createDepositorToken";
519
- function Y(n, e) {
520
- return new F({
679
+ ]), Ke = 6e4, L = "auth_createDepositorToken";
680
+ function ae(n, e) {
681
+ return new Y({
521
682
  baseUrl: n,
522
- timeout: ke,
683
+ timeout: Ke,
523
684
  headers: e,
524
- retryableFor: (t) => t === B
685
+ retryableFor: (t) => t === L
525
686
  });
526
687
  }
527
- const D = 4102444800, Se = 30;
528
- class Te {
688
+ const q = 4102444800, Le = 30;
689
+ class Me {
529
690
  constructor(e) {
530
691
  // `client` is the only mutable field — see `setClient`. The
531
692
  // identity-bearing fields (peginTxid/authAnchorHex/pinnedServerPubkey)
532
693
  // remain readonly and are checked against re-registration in the
533
694
  // registry's `getOrCreate`.
534
- c(this, "client");
535
- c(this, "peginTxid");
536
- c(this, "authAnchorHex");
537
- c(this, "pinnedServerPubkey");
538
- c(this, "authGatedMethods");
539
- c(this, "refreshSkewSecs");
540
- c(this, "now");
541
- c(this, "cached", null);
542
- c(this, "inFlight", null);
543
- this.client = e.client, this.peginTxid = e.peginTxid, this.authAnchorHex = e.authAnchorHex, this.pinnedServerPubkey = e.pinnedServerPubkey, this.authGatedMethods = e.authGatedMethods, this.refreshSkewSecs = e.refreshSkewSecs ?? Se, this.now = e.now ?? (() => Math.floor(Date.now() / 1e3));
695
+ h(this, "client");
696
+ h(this, "peginTxid");
697
+ h(this, "authAnchorHex");
698
+ h(this, "pinnedServerPubkey");
699
+ h(this, "authGatedMethods");
700
+ h(this, "refreshSkewSecs");
701
+ h(this, "now");
702
+ h(this, "cached", null);
703
+ h(this, "inFlight", null);
704
+ this.client = e.client, this.peginTxid = e.peginTxid, this.authAnchorHex = e.authAnchorHex, this.pinnedServerPubkey = e.pinnedServerPubkey, this.authGatedMethods = e.authGatedMethods, this.refreshSkewSecs = e.refreshSkewSecs ?? Le, this.now = e.now ?? (() => Math.floor(Date.now() / 1e3));
544
705
  }
545
706
  /**
546
707
  * Return a bearer token for `method`, or `null` if `method` is not
@@ -555,7 +716,7 @@ class Te {
555
716
  * guard. Returning `null` here breaks that recursion deterministically.
556
717
  */
557
718
  async getToken(e) {
558
- if (e === B || !this.authGatedMethods.has(e)) return null;
719
+ if (e === L || !this.authGatedMethods.has(e)) return null;
559
720
  const t = this.cached;
560
721
  return t && this.now() + this.refreshSkewSecs < t.expiresAt ? t.token : (await this.acquireSingleFlight()).token;
561
722
  }
@@ -582,11 +743,11 @@ class Te {
582
743
  if (e) return e;
583
744
  const t = (async () => {
584
745
  try {
585
- const r = await this.client.call(B, {
746
+ const r = await this.client.call(L, {
586
747
  pegin_txid: this.peginTxid,
587
748
  auth_anchor: this.authAnchorHex
588
749
  });
589
- if (Ae({
750
+ if (Oe({
590
751
  proof: r.server_identity,
591
752
  pinnedServerPubkey: this.pinnedServerPubkey,
592
753
  now: this.now()
@@ -595,9 +756,9 @@ class Te {
595
756
  `VpTokenProvider: invalid token in acquire response (expected non-empty string, got ${typeof r.token})`
596
757
  );
597
758
  const i = this.now();
598
- if (!Number.isSafeInteger(r.expires_at) || r.expires_at <= i || r.expires_at > D)
759
+ if (!Number.isSafeInteger(r.expires_at) || r.expires_at <= i || r.expires_at > q)
599
760
  throw new Error(
600
- `VpTokenProvider: invalid expires_at in acquire response (got ${JSON.stringify(r.expires_at)}; must be a safe integer in (${i}, ${D}])`
761
+ `VpTokenProvider: invalid expires_at in acquire response (got ${JSON.stringify(r.expires_at)}; must be a safe integer in (${i}, ${q}])`
601
762
  );
602
763
  const a = {
603
764
  token: r.token,
@@ -611,9 +772,9 @@ class Te {
611
772
  return this.inFlight = t, t;
612
773
  }
613
774
  }
614
- class Ce {
775
+ class Ge {
615
776
  constructor() {
616
- c(this, "entries", /* @__PURE__ */ new Map());
777
+ h(this, "entries", /* @__PURE__ */ new Map());
617
778
  }
618
779
  /**
619
780
  * Return the cached `VpTokenProvider` for `peginTxid` if one exists
@@ -635,12 +796,12 @@ class Ce {
635
796
  );
636
797
  return t.provider.setClient(e.client), t.provider;
637
798
  }
638
- const r = new Te({
799
+ const r = new Me({
639
800
  client: e.client,
640
801
  peginTxid: e.peginTxid,
641
802
  authAnchorHex: e.authAnchorHex,
642
803
  pinnedServerPubkey: e.pinnedServerPubkey,
643
- authGatedMethods: Ve
804
+ authGatedMethods: Ue
644
805
  });
645
806
  return this.entries.set(e.peginTxid, {
646
807
  provider: r,
@@ -674,42 +835,42 @@ class Ce {
674
835
  return this.entries.size;
675
836
  }
676
837
  }
677
- const z = new Ce();
678
- function De(n) {
838
+ const oe = new Ge();
839
+ function tt(n) {
679
840
  var r;
680
- const e = Y(
841
+ const e = ae(
681
842
  n.baseUrl,
682
843
  (r = n.options) == null ? void 0 : r.headers
683
- ), t = z.getOrCreate({
844
+ ), t = oe.getOrCreate({
684
845
  client: e,
685
846
  peginTxid: n.peginTxid,
686
847
  authAnchorHex: n.authAnchorHex,
687
848
  pinnedServerPubkey: n.pinnedServerPubkey
688
849
  });
689
- return new me(n.baseUrl, {
850
+ return new Ce(n.baseUrl, {
690
851
  ...n.options,
691
852
  tokenProvider: t
692
853
  });
693
854
  }
694
- function Ue(n) {
695
- z.getOrCreate({
696
- client: Y(n.baseUrl, n.headers),
855
+ function nt(n) {
856
+ oe.getOrCreate({
857
+ client: ae(n.baseUrl, n.headers),
697
858
  peginTxid: n.peginTxid,
698
859
  authAnchorHex: n.authAnchorHex,
699
860
  pinnedServerPubkey: n.pinnedServerPubkey
700
861
  });
701
862
  }
702
- async function Ke(n, e) {
863
+ async function rt(n, e) {
703
864
  const [t, r] = await n.multicall({
704
865
  contracts: [
705
866
  {
706
867
  address: e,
707
- abi: y,
868
+ abi: S,
708
869
  functionName: "protocolParams"
709
870
  },
710
871
  {
711
872
  address: e,
712
- abi: y,
873
+ abi: S,
713
874
  functionName: "applicationRegistry"
714
875
  }
715
876
  ],
@@ -720,8 +881,8 @@ async function Ke(n, e) {
720
881
  applicationRegistry: r
721
882
  };
722
883
  }
723
- const U = 65535;
724
- function E(n) {
884
+ const W = 65535;
885
+ function U(n) {
725
886
  return {
726
887
  timelockAssert: n.timelockAssert,
727
888
  timelockChallengeAssert: n.timelockChallengeAssert,
@@ -738,7 +899,7 @@ function E(n) {
738
899
  minPrepeginDepth: n.minPrepeginDepth
739
900
  };
740
901
  }
741
- function K(n) {
902
+ function z(n) {
742
903
  return {
743
904
  minimumPegInAmount: n.minimumPegInAmount,
744
905
  maxPegInAmount: n.maxPegInAmount,
@@ -747,52 +908,52 @@ function K(n) {
747
908
  maxHtlcOutputCount: n.maxHtlcOutputCount
748
909
  };
749
910
  }
750
- function L(n) {
751
- if (n > BigInt(U))
911
+ function J(n) {
912
+ if (n > BigInt(W))
752
913
  throw new Error(
753
- `timelockAssert value ${n} exceeds uint16 max (${U})`
914
+ `timelockAssert value ${n} exceeds uint16 max (${W})`
754
915
  );
755
916
  return Number(n);
756
917
  }
757
- class Le {
918
+ class st {
758
919
  constructor(e, t) {
759
920
  this.publicClient = e, this.contractAddress = t;
760
921
  }
761
922
  async getTBVProtocolParams() {
762
923
  const e = await this.publicClient.readContract({
763
924
  address: this.contractAddress,
764
- abi: h,
925
+ abi: b,
765
926
  functionName: "getTBVProtocolParams"
766
927
  });
767
- return K(e);
928
+ return z(e);
768
929
  }
769
930
  async getLatestOffchainParams() {
770
931
  const e = await this.publicClient.readContract({
771
932
  address: this.contractAddress,
772
- abi: h,
933
+ abi: b,
773
934
  functionName: "getLatestOffchainParams"
774
935
  });
775
- return E(e);
936
+ return U(e);
776
937
  }
777
938
  async getOffchainParamsByVersion(e) {
778
939
  const t = await this.publicClient.readContract({
779
940
  address: this.contractAddress,
780
- abi: h,
941
+ abi: b,
781
942
  functionName: "getOffchainParamsByVersion",
782
943
  args: [e]
783
944
  });
784
- return E(t);
945
+ return U(t);
785
946
  }
786
947
  async getLatestOffchainParamsVersion() {
787
948
  return await this.publicClient.readContract({
788
949
  address: this.contractAddress,
789
- abi: h,
950
+ abi: b,
790
951
  functionName: "latestOffchainParamsVersion"
791
952
  });
792
953
  }
793
954
  async getTimelockPeginByVersion(e) {
794
955
  const t = await this.getOffchainParamsByVersion(e);
795
- return L(t.timelockAssert);
956
+ return J(t.timelockAssert);
796
957
  }
797
958
  /**
798
959
  * Read TBV protocol params and latest offchain params atomically via multicall.
@@ -803,97 +964,97 @@ class Le {
803
964
  contracts: [
804
965
  {
805
966
  address: this.contractAddress,
806
- abi: h,
967
+ abi: b,
807
968
  functionName: "getTBVProtocolParams"
808
969
  },
809
970
  {
810
971
  address: this.contractAddress,
811
- abi: h,
972
+ abi: b,
812
973
  functionName: "getLatestOffchainParams"
813
974
  }
814
975
  ],
815
976
  allowFailure: !1
816
- }), t = K(e[0]), r = E(e[1]);
977
+ }), t = z(e[0]), r = U(e[1]);
817
978
  return {
818
979
  minimumPegInAmount: t.minimumPegInAmount,
819
980
  maxPegInAmount: t.maxPegInAmount,
820
981
  pegInAckTimeout: t.pegInAckTimeout,
821
982
  pegInActivationTimeout: t.pegInActivationTimeout,
822
983
  maxHtlcOutputCount: t.maxHtlcOutputCount,
823
- timelockPegin: L(r.timelockAssert),
984
+ timelockPegin: J(r.timelockAssert),
824
985
  timelockRefund: r.tRefund,
825
986
  minVpCommissionBps: r.minVpCommissionBps,
826
987
  offchainParams: r
827
988
  };
828
989
  }
829
990
  }
830
- function V(n) {
991
+ function H(n) {
831
992
  return n.map((e) => ({
832
993
  ethAddress: e.ethAddress,
833
994
  btcPubKey: e.btcPubKey
834
995
  }));
835
996
  }
836
- class Fe {
997
+ class it {
837
998
  constructor(e, t) {
838
999
  this.publicClient = e, this.contractAddress = t;
839
1000
  }
840
1001
  async getVaultKeepersByVersion(e, t) {
841
1002
  const r = await this.publicClient.readContract({
842
1003
  address: this.contractAddress,
843
- abi: $,
1004
+ abi: O,
844
1005
  functionName: "getVaultKeepersByVersion",
845
1006
  args: [e, t]
846
1007
  });
847
- return V(r);
1008
+ return H(r);
848
1009
  }
849
1010
  async getCurrentVaultKeepers(e) {
850
1011
  const t = await this.publicClient.readContract({
851
1012
  address: this.contractAddress,
852
- abi: $,
1013
+ abi: O,
853
1014
  functionName: "getCurrentVaultKeepers",
854
1015
  args: [e]
855
1016
  });
856
- return V(t);
1017
+ return H(t);
857
1018
  }
858
1019
  async getCurrentVaultKeepersVersion(e) {
859
1020
  return await this.publicClient.readContract({
860
1021
  address: this.contractAddress,
861
- abi: $,
1022
+ abi: O,
862
1023
  functionName: "getCurrentVaultKeepersVersion",
863
1024
  args: [e]
864
1025
  });
865
1026
  }
866
1027
  }
867
- class Me {
1028
+ class at {
868
1029
  constructor(e, t) {
869
1030
  this.publicClient = e, this.contractAddress = t;
870
1031
  }
871
1032
  async getUniversalChallengersByVersion(e) {
872
1033
  const t = await this.publicClient.readContract({
873
1034
  address: this.contractAddress,
874
- abi: h,
1035
+ abi: b,
875
1036
  functionName: "getUniversalChallengersByVersion",
876
1037
  args: [e]
877
1038
  });
878
- return V(t);
1039
+ return H(t);
879
1040
  }
880
1041
  async getCurrentUniversalChallengers() {
881
1042
  const e = await this.publicClient.readContract({
882
1043
  address: this.contractAddress,
883
- abi: h,
1044
+ abi: b,
884
1045
  functionName: "getCurrentUniversalChallengers"
885
1046
  });
886
- return V(e);
1047
+ return H(e);
887
1048
  }
888
1049
  async getLatestUniversalChallengersVersion() {
889
1050
  return await this.publicClient.readContract({
890
1051
  address: this.contractAddress,
891
- abi: h,
1052
+ abi: b,
892
1053
  functionName: "latestUniversalChallengersVersion"
893
1054
  });
894
1055
  }
895
1056
  }
896
- class Xe {
1057
+ class ot {
897
1058
  constructor(e, t) {
898
1059
  this.publicClient = e, this.contractAddress = t;
899
1060
  }
@@ -906,7 +1067,7 @@ class Xe {
906
1067
  async getVaultProviderBtcPubKey(e) {
907
1068
  const r = (await this.publicClient.readContract({
908
1069
  address: this.contractAddress,
909
- abi: y,
1070
+ abi: S,
910
1071
  functionName: "getVaultProviderBTCKey",
911
1072
  args: [e]
912
1073
  })).toLowerCase();
@@ -915,7 +1076,7 @@ class Xe {
915
1076
  `getVaultProviderBTCKey returned an unexpected value (vp=${e}, length ${r.length}, prefix "${r.slice(0, 2)}")`
916
1077
  );
917
1078
  const i = r.slice(2);
918
- if (!k.isXOnlyPoint(ne(i)))
1079
+ if (!N.isXOnlyPoint(he(i)))
919
1080
  throw new Error(
920
1081
  `getVaultProviderBTCKey returned a value that is not on the secp256k1 curve (vp=${e})`
921
1082
  );
@@ -924,7 +1085,7 @@ class Xe {
924
1085
  async getVaultBasicInfo(e) {
925
1086
  const t = await this.publicClient.readContract({
926
1087
  address: this.contractAddress,
927
- abi: y,
1088
+ abi: S,
928
1089
  functionName: "getBtcVaultBasicInfo",
929
1090
  args: [e]
930
1091
  });
@@ -941,7 +1102,7 @@ class Xe {
941
1102
  async getVaultProtocolInfo(e) {
942
1103
  const t = await this.publicClient.readContract({
943
1104
  address: this.contractAddress,
944
- abi: y,
1105
+ abi: S,
945
1106
  functionName: "getBtcVaultProtocolInfo",
946
1107
  args: [e]
947
1108
  });
@@ -972,19 +1133,20 @@ class Xe {
972
1133
  }
973
1134
  }
974
1135
  export {
975
- u as S,
976
- me as V,
1136
+ _ as S,
1137
+ Ce as V,
977
1138
  s as a,
978
- Ae as b,
979
- Ce as c,
980
- z as d,
981
- De as e,
982
- Le as f,
983
- Me as g,
984
- Fe as h,
985
- Xe as i,
986
- Ue as p,
987
- Ke as r,
988
- pe as v
1139
+ et as b,
1140
+ Oe as c,
1141
+ Ge as d,
1142
+ oe as e,
1143
+ tt as f,
1144
+ st as g,
1145
+ at as h,
1146
+ it as i,
1147
+ ot as j,
1148
+ nt as p,
1149
+ rt as r,
1150
+ ve as v
989
1151
  };
990
- //# sourceMappingURL=vault-registry-reader-WiNVOsnD.js.map
1152
+ //# sourceMappingURL=vault-registry-reader-BDFpXeH7.js.map