@babylonlabs-io/ts-sdk 0.33.4 → 0.33.6

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 (54) 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/auth/serverIdentity.d.ts +12 -3
  16. package/dist/tbv/core/clients/vault-provider/auth/serverIdentity.d.ts.map +1 -1
  17. package/dist/tbv/core/clients/vault-provider/batchAttribution.d.ts +45 -0
  18. package/dist/tbv/core/clients/vault-provider/batchAttribution.d.ts.map +1 -0
  19. package/dist/tbv/core/clients/vault-provider/batchPoll.d.ts +55 -0
  20. package/dist/tbv/core/clients/vault-provider/batchPoll.d.ts.map +1 -0
  21. package/dist/tbv/core/clients/vault-provider/index.d.ts +2 -0
  22. package/dist/tbv/core/clients/vault-provider/index.d.ts.map +1 -1
  23. package/dist/tbv/core/clients/vault-provider/json-rpc-client.d.ts +3 -3
  24. package/dist/tbv/core/clients/vault-provider/json-rpc-client.d.ts.map +1 -1
  25. package/dist/tbv/core/clients/vault-provider/types.d.ts +68 -24
  26. package/dist/tbv/core/clients/vault-provider/types.d.ts.map +1 -1
  27. package/dist/tbv/core/clients/vault-provider/validators.d.ts +12 -2
  28. package/dist/tbv/core/clients/vault-provider/validators.d.ts.map +1 -1
  29. package/dist/tbv/core/index.cjs +1 -1
  30. package/dist/tbv/core/index.js +73 -71
  31. package/dist/tbv/core/services/deposit/waitForPeginStatus.d.ts.map +1 -1
  32. package/dist/tbv/core/services/index.cjs +1 -1
  33. package/dist/tbv/core/services/index.js +1 -1
  34. package/dist/tbv/core/services/pegout/state.d.ts +1 -1
  35. package/dist/tbv/index.cjs +1 -1
  36. package/dist/tbv/index.js +73 -71
  37. package/dist/types-DnyyBNcC.cjs +2 -0
  38. package/dist/types-DnyyBNcC.cjs.map +1 -0
  39. package/dist/{types-ByW6nSLj.js → types-TiIjyo2b.js} +32 -30
  40. package/dist/types-TiIjyo2b.js.map +1 -0
  41. package/dist/vault-registry-reader-DNiXOSYM.cjs +2 -0
  42. package/dist/vault-registry-reader-DNiXOSYM.cjs.map +1 -0
  43. package/dist/{vault-registry-reader-WiNVOsnD.js → vault-registry-reader-PsSxB0JZ.js} +439 -267
  44. package/dist/vault-registry-reader-PsSxB0JZ.js.map +1 -0
  45. package/package.json +1 -1
  46. package/dist/buildAndBroadcastRefund-CIPPpchL.cjs +0 -2
  47. package/dist/buildAndBroadcastRefund-CIPPpchL.cjs.map +0 -1
  48. package/dist/buildAndBroadcastRefund-D_QlvCsw.js.map +0 -1
  49. package/dist/types-ByW6nSLj.js.map +0 -1
  50. package/dist/types-CfCZyfid.cjs +0 -2
  51. package/dist/types-CfCZyfid.cjs.map +0 -1
  52. package/dist/vault-registry-reader-OK2V08tk.cjs +0 -2
  53. package/dist/vault-registry-reader-OK2V08tk.cjs.map +0 -1
  54. 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 S } from "./validation-CxqROCno.js";
7
+ import * as N from "@bitcoin-js/tiny-secp256k1-asmjs";
8
+ import { payments as ge, Transaction as O } from "bitcoinjs-lib";
9
+ import { Buffer as V } from "buffer";
10
+ import { s as F } from "./sha2-6wN58S6R.js";
11
+ import { B as k } from "./BTCVaultRegistry.abi-DbJ5lsFJ.js";
12
+ import { P as b, A as D } from "./ProtocolParams.abi-DXu8L0Fn.js";
13
+ const G = 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 A = 64;
27
+ function P(n) {
28
+ return typeof n == "string" && n.length > 0 && S.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 _(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 !== A)
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 ${A}-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 (!G.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: ${[...G].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`), _(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
+ _(t.wots_pks_json, `${e}.wots_pks_json`), _(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`), _(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 xe(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 ve(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 !== A)
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 ${A}-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 (_(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 (_(n.claim_txid, "claimer.claim_txid"), _(n.claimer_pubkey, "claimer.claimer_pubkey"), _(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 (_(t.status, `challengers[${e}].status`), _(t.claim_txid, `challengers[${e}].claim_txid`), _(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 Se(n) {
283
+ ne(n, "batchGetPeginStatus", (e) => {
284
+ e.result !== null && te(e.result);
285
+ });
286
+ }
287
+ function ke(n) {
288
+ ne(n, "batchGetPegoutStatus", (e) => {
289
+ e.result !== null && ve(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 !== A)
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 ${A}-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")
240
314
  throw new s(
241
- 'VP response validation failed: "challenger" must be an object if present'
315
+ `VP response validation failed: "${e}.results[${i}].error" must be a string or null, got ${c(o.error)}`
242
316
  );
243
- const t = e.challenger;
244
- if (typeof t.status != "string")
317
+ if (o.result === null && o.error === null)
245
318
  throw new s(
246
- `VP response validation failed: "challenger.status" must be a string, got ${o(t.status)}`
319
+ `VP response validation failed: "${e}.results[${i}]" has neither "result" nor "error" populated`
247
320
  );
321
+ if (o.result !== null && o.error !== null)
322
+ throw new s(
323
+ `VP response validation failed: "${e}.results[${i}]" has both "result" and "error" populated`
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"), _(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 xe(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 Se(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 ke(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 u = d.pegin_txid.toLowerCase();
432
+ if (!t.has(u)) {
433
+ o.push(u);
434
+ continue;
435
+ }
436
+ if (i.has(u)) {
437
+ a.push(u);
438
+ continue;
439
+ }
440
+ i.add(u), r.set(u, { result: d.result, error: d.error });
441
+ }
442
+ const l = [];
443
+ for (const d of t)
444
+ i.has(d) || l.push(d);
445
+ return { byTxid: r, missing: l, unexpected: o, duplicate: a };
446
+ }
447
+ async function tt(n) {
448
+ const {
449
+ items: e,
450
+ getTxid: t,
451
+ batchCall: r,
452
+ onItem: i,
453
+ onMissing: a,
454
+ onDuplicate: o,
455
+ onDuplicateBatch: l,
456
+ onWholeBatchError: d,
457
+ onUnexpected: u,
458
+ batchSize: f = de
459
+ } = n;
460
+ if (!Number.isInteger(f) || f <= 0)
461
+ throw new Error(
462
+ `batchPollByProvider: batchSize must be a positive integer, got ${f}`
335
463
  );
336
- return he(r), r;
464
+ for (let w = 0; w < e.length; w += f) {
465
+ const x = e.slice(w, w + f), $ = /* @__PURE__ */ new Map(), j = [];
466
+ for (const p of x) {
467
+ const m = t(p).toLowerCase();
468
+ $.set(m, p), j.push(m);
469
+ }
470
+ let v;
471
+ try {
472
+ const p = await r(j);
473
+ v = Ee(j, p.results);
474
+ } catch (p) {
475
+ d(x, p);
476
+ continue;
477
+ }
478
+ u && v.unexpected.length > 0 && u(v.unexpected);
479
+ const T = new Set(v.duplicate);
480
+ for (const p of T) {
481
+ const m = $.get(p);
482
+ m && o(m);
483
+ }
484
+ l && T.size > 0 && l(T.size);
485
+ for (const p of v.missing) {
486
+ const m = $.get(p);
487
+ m && a(m);
488
+ }
489
+ for (const [p, m] of v.byTxid) {
490
+ if (T.has(p)) continue;
491
+ const M = $.get(p);
492
+ M && i(M, {
493
+ pegin_txid: p,
494
+ result: m.result,
495
+ error: m.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 = F(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), F(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: V.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, l = new O();
518
+ l.version = 0, l.locktime = 0;
519
+ const d = V.concat([
520
+ V.from([0, 32]),
521
+ V.from(r)
361
522
  ]);
362
- p.addInput(
363
- f.alloc(32, 0),
523
+ l.addInput(
524
+ V.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
+ ), l.addOutput(a, o);
532
+ const u = new O();
533
+ u.version = 0, u.locktime = 0;
534
+ const f = l.getHash();
535
+ u.addInput(f, 0, 0), u.addOutput(V.from([106]), o);
536
+ const w = u.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
+ O.SIGHASH_DEFAULT
541
+ ), x = He(e);
542
+ return x ? N.verifySchnorr(w, x, 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,149 @@ 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 Oe = new TextEncoder().encode(
433
594
  "btc-auth.server-identity.v1"
434
- );
435
- class u extends Error {
595
+ ), De = 2 * 3600;
596
+ class g 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(
450
- `pinnedServerPubkey must be 32-byte hex; got ${i.length} chars`,
607
+ function Ue(n) {
608
+ const { proof: e, pinnedServerPubkey: t, now: r } = n, i = n.maxLifetimeSecs ?? De, a = C(t).toLowerCase();
609
+ if (a.length !== B || !S.test(a))
610
+ throw new g(
611
+ `pinnedServerPubkey must be 32-byte hex; got ${a.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(
456
- `server_pubkey must be 32-byte hex; got ${a.length} chars`,
614
+ const o = C(e.server_pubkey).toLowerCase();
615
+ if (o.length !== B || !S.test(o))
616
+ throw new g(
617
+ `server_pubkey must be 32-byte hex; got ${o.length} chars`,
457
618
  "invalid_pubkey_encoding"
458
619
  );
459
- if (a !== i)
460
- throw new u(
461
- `server_pubkey does not match pinned value: expected ${i}, got ${a}`,
620
+ if (o !== a)
621
+ throw new g(
622
+ `server_pubkey does not match pinned value: expected ${a}, got ${o}`,
462
623
  "pinned_pubkey_mismatch"
463
624
  );
464
625
  if (!Number.isSafeInteger(e.expires_at))
465
- throw new u(
626
+ throw new g(
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 g(
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 g(
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(
640
+ if (!Number.isSafeInteger(i) || i <= 0)
641
+ throw new g(
642
+ `maxLifetimeSecs must be a positive safe integer; got ${JSON.stringify(i)}`,
643
+ "invalid_max_lifetime"
644
+ );
645
+ if (e.expires_at - r > i)
646
+ throw new g(
647
+ `server identity proof expires too far in the future: expires_at=${e.expires_at}, now=${r}, max lifetime=${i}s`,
648
+ "expires_too_far"
649
+ );
650
+ const l = C(e.ephemeral_pubkey).toLowerCase();
651
+ if (l.length !== K || !S.test(l))
652
+ throw new g(
482
653
  `ephemeral_pubkey must be 33-byte compressed hex; got ${l.length} chars`,
483
654
  "invalid_ephemeral_pubkey"
484
655
  );
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}`,
656
+ const d = l.slice(0, 2);
657
+ if (d !== "02" && d !== "03")
658
+ throw new g(
659
+ `ephemeral_pubkey must be compressed (prefix 02/03); got ${d}`,
489
660
  "invalid_ephemeral_pubkey"
490
661
  );
491
- const S = P(l);
492
- if (!k.isPoint(S))
493
- throw new u(
662
+ const u = I(l);
663
+ if (!N.isPoint(u))
664
+ throw new g(
494
665
  "ephemeral_pubkey is not a valid secp256k1 point",
495
666
  "invalid_ephemeral_pubkey"
496
667
  );
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`,
668
+ const f = C(e.signature).toLowerCase();
669
+ if (f.length !== pe || !S.test(f))
670
+ throw new g(
671
+ `signature must be 64-byte Schnorr hex; got ${f.length} chars`,
501
672
  "invalid_signature_encoding"
502
673
  );
503
- const T = ve(
504
- xe,
505
- P(l),
674
+ const w = je(
675
+ Oe,
676
+ I(l),
506
677
  e.expires_at
507
678
  );
508
- if (!Pe(T, P(a), P(d)))
509
- throw new u(
679
+ if (!Ne(w, I(o), I(f)))
680
+ throw new g(
510
681
  "BIP-322 signature verification failed — ephemeral key is not attested by pinned server pubkey",
511
682
  "signature_verification_failed"
512
683
  );
513
684
  }
514
- const Ve = /* @__PURE__ */ new Set([
685
+ const Ke = /* @__PURE__ */ new Set([
515
686
  "vaultProvider_submitDepositorWotsKey",
516
687
  "vaultProvider_submitDepositorPresignatures",
517
688
  "vaultProvider_requestDepositorPresignTransactions"
518
- ]), ke = 6e4, B = "auth_createDepositorToken";
519
- function Y(n, e) {
520
- return new F({
689
+ ]), Le = 6e4, L = "auth_createDepositorToken";
690
+ function ae(n, e) {
691
+ return new Y({
521
692
  baseUrl: n,
522
- timeout: ke,
693
+ timeout: Le,
523
694
  headers: e,
524
- retryableFor: (t) => t === B
695
+ retryableFor: (t) => t === L
525
696
  });
526
697
  }
527
- const D = 4102444800, Se = 30;
528
- class Te {
698
+ const q = 4102444800, Me = 30;
699
+ class Fe {
529
700
  constructor(e) {
530
701
  // `client` is the only mutable field — see `setClient`. The
531
702
  // identity-bearing fields (peginTxid/authAnchorHex/pinnedServerPubkey)
532
703
  // remain readonly and are checked against re-registration in the
533
704
  // 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));
705
+ h(this, "client");
706
+ h(this, "peginTxid");
707
+ h(this, "authAnchorHex");
708
+ h(this, "pinnedServerPubkey");
709
+ h(this, "authGatedMethods");
710
+ h(this, "refreshSkewSecs");
711
+ h(this, "now");
712
+ h(this, "cached", null);
713
+ h(this, "inFlight", null);
714
+ this.client = e.client, this.peginTxid = e.peginTxid, this.authAnchorHex = e.authAnchorHex, this.pinnedServerPubkey = e.pinnedServerPubkey, this.authGatedMethods = e.authGatedMethods, this.refreshSkewSecs = e.refreshSkewSecs ?? Me, this.now = e.now ?? (() => Math.floor(Date.now() / 1e3));
544
715
  }
545
716
  /**
546
717
  * Return a bearer token for `method`, or `null` if `method` is not
@@ -555,7 +726,7 @@ class Te {
555
726
  * guard. Returning `null` here breaks that recursion deterministically.
556
727
  */
557
728
  async getToken(e) {
558
- if (e === B || !this.authGatedMethods.has(e)) return null;
729
+ if (e === L || !this.authGatedMethods.has(e)) return null;
559
730
  const t = this.cached;
560
731
  return t && this.now() + this.refreshSkewSecs < t.expiresAt ? t.token : (await this.acquireSingleFlight()).token;
561
732
  }
@@ -582,11 +753,11 @@ class Te {
582
753
  if (e) return e;
583
754
  const t = (async () => {
584
755
  try {
585
- const r = await this.client.call(B, {
756
+ const r = await this.client.call(L, {
586
757
  pegin_txid: this.peginTxid,
587
758
  auth_anchor: this.authAnchorHex
588
759
  });
589
- if (Ae({
760
+ if (Ue({
590
761
  proof: r.server_identity,
591
762
  pinnedServerPubkey: this.pinnedServerPubkey,
592
763
  now: this.now()
@@ -595,9 +766,9 @@ class Te {
595
766
  `VpTokenProvider: invalid token in acquire response (expected non-empty string, got ${typeof r.token})`
596
767
  );
597
768
  const i = this.now();
598
- if (!Number.isSafeInteger(r.expires_at) || r.expires_at <= i || r.expires_at > D)
769
+ if (!Number.isSafeInteger(r.expires_at) || r.expires_at <= i || r.expires_at > q)
599
770
  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}])`
771
+ `VpTokenProvider: invalid expires_at in acquire response (got ${JSON.stringify(r.expires_at)}; must be a safe integer in (${i}, ${q}])`
601
772
  );
602
773
  const a = {
603
774
  token: r.token,
@@ -611,9 +782,9 @@ class Te {
611
782
  return this.inFlight = t, t;
612
783
  }
613
784
  }
614
- class Ce {
785
+ class Ge {
615
786
  constructor() {
616
- c(this, "entries", /* @__PURE__ */ new Map());
787
+ h(this, "entries", /* @__PURE__ */ new Map());
617
788
  }
618
789
  /**
619
790
  * Return the cached `VpTokenProvider` for `peginTxid` if one exists
@@ -635,12 +806,12 @@ class Ce {
635
806
  );
636
807
  return t.provider.setClient(e.client), t.provider;
637
808
  }
638
- const r = new Te({
809
+ const r = new Fe({
639
810
  client: e.client,
640
811
  peginTxid: e.peginTxid,
641
812
  authAnchorHex: e.authAnchorHex,
642
813
  pinnedServerPubkey: e.pinnedServerPubkey,
643
- authGatedMethods: Ve
814
+ authGatedMethods: Ke
644
815
  });
645
816
  return this.entries.set(e.peginTxid, {
646
817
  provider: r,
@@ -674,42 +845,42 @@ class Ce {
674
845
  return this.entries.size;
675
846
  }
676
847
  }
677
- const z = new Ce();
678
- function De(n) {
848
+ const oe = new Ge();
849
+ function nt(n) {
679
850
  var r;
680
- const e = Y(
851
+ const e = ae(
681
852
  n.baseUrl,
682
853
  (r = n.options) == null ? void 0 : r.headers
683
- ), t = z.getOrCreate({
854
+ ), t = oe.getOrCreate({
684
855
  client: e,
685
856
  peginTxid: n.peginTxid,
686
857
  authAnchorHex: n.authAnchorHex,
687
858
  pinnedServerPubkey: n.pinnedServerPubkey
688
859
  });
689
- return new me(n.baseUrl, {
860
+ return new Ce(n.baseUrl, {
690
861
  ...n.options,
691
862
  tokenProvider: t
692
863
  });
693
864
  }
694
- function Ue(n) {
695
- z.getOrCreate({
696
- client: Y(n.baseUrl, n.headers),
865
+ function rt(n) {
866
+ oe.getOrCreate({
867
+ client: ae(n.baseUrl, n.headers),
697
868
  peginTxid: n.peginTxid,
698
869
  authAnchorHex: n.authAnchorHex,
699
870
  pinnedServerPubkey: n.pinnedServerPubkey
700
871
  });
701
872
  }
702
- async function Ke(n, e) {
873
+ async function st(n, e) {
703
874
  const [t, r] = await n.multicall({
704
875
  contracts: [
705
876
  {
706
877
  address: e,
707
- abi: y,
878
+ abi: k,
708
879
  functionName: "protocolParams"
709
880
  },
710
881
  {
711
882
  address: e,
712
- abi: y,
883
+ abi: k,
713
884
  functionName: "applicationRegistry"
714
885
  }
715
886
  ],
@@ -720,8 +891,8 @@ async function Ke(n, e) {
720
891
  applicationRegistry: r
721
892
  };
722
893
  }
723
- const U = 65535;
724
- function E(n) {
894
+ const W = 65535;
895
+ function U(n) {
725
896
  return {
726
897
  timelockAssert: n.timelockAssert,
727
898
  timelockChallengeAssert: n.timelockChallengeAssert,
@@ -738,7 +909,7 @@ function E(n) {
738
909
  minPrepeginDepth: n.minPrepeginDepth
739
910
  };
740
911
  }
741
- function K(n) {
912
+ function z(n) {
742
913
  return {
743
914
  minimumPegInAmount: n.minimumPegInAmount,
744
915
  maxPegInAmount: n.maxPegInAmount,
@@ -747,52 +918,52 @@ function K(n) {
747
918
  maxHtlcOutputCount: n.maxHtlcOutputCount
748
919
  };
749
920
  }
750
- function L(n) {
751
- if (n > BigInt(U))
921
+ function J(n) {
922
+ if (n > BigInt(W))
752
923
  throw new Error(
753
- `timelockAssert value ${n} exceeds uint16 max (${U})`
924
+ `timelockAssert value ${n} exceeds uint16 max (${W})`
754
925
  );
755
926
  return Number(n);
756
927
  }
757
- class Le {
928
+ class it {
758
929
  constructor(e, t) {
759
930
  this.publicClient = e, this.contractAddress = t;
760
931
  }
761
932
  async getTBVProtocolParams() {
762
933
  const e = await this.publicClient.readContract({
763
934
  address: this.contractAddress,
764
- abi: h,
935
+ abi: b,
765
936
  functionName: "getTBVProtocolParams"
766
937
  });
767
- return K(e);
938
+ return z(e);
768
939
  }
769
940
  async getLatestOffchainParams() {
770
941
  const e = await this.publicClient.readContract({
771
942
  address: this.contractAddress,
772
- abi: h,
943
+ abi: b,
773
944
  functionName: "getLatestOffchainParams"
774
945
  });
775
- return E(e);
946
+ return U(e);
776
947
  }
777
948
  async getOffchainParamsByVersion(e) {
778
949
  const t = await this.publicClient.readContract({
779
950
  address: this.contractAddress,
780
- abi: h,
951
+ abi: b,
781
952
  functionName: "getOffchainParamsByVersion",
782
953
  args: [e]
783
954
  });
784
- return E(t);
955
+ return U(t);
785
956
  }
786
957
  async getLatestOffchainParamsVersion() {
787
958
  return await this.publicClient.readContract({
788
959
  address: this.contractAddress,
789
- abi: h,
960
+ abi: b,
790
961
  functionName: "latestOffchainParamsVersion"
791
962
  });
792
963
  }
793
964
  async getTimelockPeginByVersion(e) {
794
965
  const t = await this.getOffchainParamsByVersion(e);
795
- return L(t.timelockAssert);
966
+ return J(t.timelockAssert);
796
967
  }
797
968
  /**
798
969
  * Read TBV protocol params and latest offchain params atomically via multicall.
@@ -803,97 +974,97 @@ class Le {
803
974
  contracts: [
804
975
  {
805
976
  address: this.contractAddress,
806
- abi: h,
977
+ abi: b,
807
978
  functionName: "getTBVProtocolParams"
808
979
  },
809
980
  {
810
981
  address: this.contractAddress,
811
- abi: h,
982
+ abi: b,
812
983
  functionName: "getLatestOffchainParams"
813
984
  }
814
985
  ],
815
986
  allowFailure: !1
816
- }), t = K(e[0]), r = E(e[1]);
987
+ }), t = z(e[0]), r = U(e[1]);
817
988
  return {
818
989
  minimumPegInAmount: t.minimumPegInAmount,
819
990
  maxPegInAmount: t.maxPegInAmount,
820
991
  pegInAckTimeout: t.pegInAckTimeout,
821
992
  pegInActivationTimeout: t.pegInActivationTimeout,
822
993
  maxHtlcOutputCount: t.maxHtlcOutputCount,
823
- timelockPegin: L(r.timelockAssert),
994
+ timelockPegin: J(r.timelockAssert),
824
995
  timelockRefund: r.tRefund,
825
996
  minVpCommissionBps: r.minVpCommissionBps,
826
997
  offchainParams: r
827
998
  };
828
999
  }
829
1000
  }
830
- function V(n) {
1001
+ function H(n) {
831
1002
  return n.map((e) => ({
832
1003
  ethAddress: e.ethAddress,
833
1004
  btcPubKey: e.btcPubKey
834
1005
  }));
835
1006
  }
836
- class Fe {
1007
+ class at {
837
1008
  constructor(e, t) {
838
1009
  this.publicClient = e, this.contractAddress = t;
839
1010
  }
840
1011
  async getVaultKeepersByVersion(e, t) {
841
1012
  const r = await this.publicClient.readContract({
842
1013
  address: this.contractAddress,
843
- abi: $,
1014
+ abi: D,
844
1015
  functionName: "getVaultKeepersByVersion",
845
1016
  args: [e, t]
846
1017
  });
847
- return V(r);
1018
+ return H(r);
848
1019
  }
849
1020
  async getCurrentVaultKeepers(e) {
850
1021
  const t = await this.publicClient.readContract({
851
1022
  address: this.contractAddress,
852
- abi: $,
1023
+ abi: D,
853
1024
  functionName: "getCurrentVaultKeepers",
854
1025
  args: [e]
855
1026
  });
856
- return V(t);
1027
+ return H(t);
857
1028
  }
858
1029
  async getCurrentVaultKeepersVersion(e) {
859
1030
  return await this.publicClient.readContract({
860
1031
  address: this.contractAddress,
861
- abi: $,
1032
+ abi: D,
862
1033
  functionName: "getCurrentVaultKeepersVersion",
863
1034
  args: [e]
864
1035
  });
865
1036
  }
866
1037
  }
867
- class Me {
1038
+ class ot {
868
1039
  constructor(e, t) {
869
1040
  this.publicClient = e, this.contractAddress = t;
870
1041
  }
871
1042
  async getUniversalChallengersByVersion(e) {
872
1043
  const t = await this.publicClient.readContract({
873
1044
  address: this.contractAddress,
874
- abi: h,
1045
+ abi: b,
875
1046
  functionName: "getUniversalChallengersByVersion",
876
1047
  args: [e]
877
1048
  });
878
- return V(t);
1049
+ return H(t);
879
1050
  }
880
1051
  async getCurrentUniversalChallengers() {
881
1052
  const e = await this.publicClient.readContract({
882
1053
  address: this.contractAddress,
883
- abi: h,
1054
+ abi: b,
884
1055
  functionName: "getCurrentUniversalChallengers"
885
1056
  });
886
- return V(e);
1057
+ return H(e);
887
1058
  }
888
1059
  async getLatestUniversalChallengersVersion() {
889
1060
  return await this.publicClient.readContract({
890
1061
  address: this.contractAddress,
891
- abi: h,
1062
+ abi: b,
892
1063
  functionName: "latestUniversalChallengersVersion"
893
1064
  });
894
1065
  }
895
1066
  }
896
- class Xe {
1067
+ class ct {
897
1068
  constructor(e, t) {
898
1069
  this.publicClient = e, this.contractAddress = t;
899
1070
  }
@@ -906,7 +1077,7 @@ class Xe {
906
1077
  async getVaultProviderBtcPubKey(e) {
907
1078
  const r = (await this.publicClient.readContract({
908
1079
  address: this.contractAddress,
909
- abi: y,
1080
+ abi: k,
910
1081
  functionName: "getVaultProviderBTCKey",
911
1082
  args: [e]
912
1083
  })).toLowerCase();
@@ -915,7 +1086,7 @@ class Xe {
915
1086
  `getVaultProviderBTCKey returned an unexpected value (vp=${e}, length ${r.length}, prefix "${r.slice(0, 2)}")`
916
1087
  );
917
1088
  const i = r.slice(2);
918
- if (!k.isXOnlyPoint(ne(i)))
1089
+ if (!N.isXOnlyPoint(he(i)))
919
1090
  throw new Error(
920
1091
  `getVaultProviderBTCKey returned a value that is not on the secp256k1 curve (vp=${e})`
921
1092
  );
@@ -924,7 +1095,7 @@ class Xe {
924
1095
  async getVaultBasicInfo(e) {
925
1096
  const t = await this.publicClient.readContract({
926
1097
  address: this.contractAddress,
927
- abi: y,
1098
+ abi: k,
928
1099
  functionName: "getBtcVaultBasicInfo",
929
1100
  args: [e]
930
1101
  });
@@ -941,7 +1112,7 @@ class Xe {
941
1112
  async getVaultProtocolInfo(e) {
942
1113
  const t = await this.publicClient.readContract({
943
1114
  address: this.contractAddress,
944
- abi: y,
1115
+ abi: k,
945
1116
  functionName: "getBtcVaultProtocolInfo",
946
1117
  args: [e]
947
1118
  });
@@ -972,19 +1143,20 @@ class Xe {
972
1143
  }
973
1144
  }
974
1145
  export {
975
- u as S,
976
- me as V,
1146
+ g as S,
1147
+ Ce as V,
977
1148
  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
1149
+ tt as b,
1150
+ Ue as c,
1151
+ Ge as d,
1152
+ oe as e,
1153
+ nt as f,
1154
+ it as g,
1155
+ ot as h,
1156
+ at as i,
1157
+ ct as j,
1158
+ rt as p,
1159
+ st as r,
1160
+ xe as v
989
1161
  };
990
- //# sourceMappingURL=vault-registry-reader-WiNVOsnD.js.map
1162
+ //# sourceMappingURL=vault-registry-reader-PsSxB0JZ.js.map