@babylonlabs-io/ts-sdk 2.0.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/dist/{PayoutManager-CpfQjtL0.cjs → PayoutManager-B6GFbG3X.cjs} +2 -2
  2. package/dist/{PayoutManager-CpfQjtL0.cjs.map → PayoutManager-B6GFbG3X.cjs.map} +1 -1
  3. package/dist/{PayoutManager-CHTOwj0E.js → PayoutManager-BSwbUQeF.js} +2 -2
  4. package/dist/{PayoutManager-CHTOwj0E.js.map → PayoutManager-BSwbUQeF.js.map} +1 -1
  5. package/dist/{PeginManager-DEldv_Ro.js → PeginManager-CKf7Bjmj.js} +6 -6
  6. package/dist/PeginManager-CKf7Bjmj.js.map +1 -0
  7. package/dist/{PeginManager-6tjlGd0t.cjs → PeginManager-Dt2Z5ljw.cjs} +2 -2
  8. package/dist/PeginManager-Dt2Z5ljw.cjs.map +1 -0
  9. package/dist/{bip322Verify-DSco3Yhl.js → bip322Verify-BXYrHBh8.js} +2 -2
  10. package/dist/{bip322Verify-DSco3Yhl.js.map → bip322Verify-BXYrHBh8.js.map} +1 -1
  11. package/dist/{bip322Verify-B7_gIhRk.cjs → bip322Verify-DLxJR9CQ.cjs} +2 -2
  12. package/dist/{bip322Verify-B7_gIhRk.cjs.map → bip322Verify-DLxJR9CQ.cjs.map} +1 -1
  13. package/dist/buildAndBroadcastReclaim-BDc-SK9i.cjs +2 -0
  14. package/dist/buildAndBroadcastReclaim-BDc-SK9i.cjs.map +1 -0
  15. package/dist/{buildAndBroadcastReclaim-CqO2DoP8.js → buildAndBroadcastReclaim-T5ZFPUpM.js} +943 -732
  16. package/dist/buildAndBroadcastReclaim-T5ZFPUpM.js.map +1 -0
  17. package/dist/{deriveVaultRoot-BwbXmN0x.js → deriveVaultRoot-BcvmER1E.js} +2 -2
  18. package/dist/{deriveVaultRoot-BwbXmN0x.js.map → deriveVaultRoot-BcvmER1E.js.map} +1 -1
  19. package/dist/{deriveVaultRoot-DvhkHzNb.cjs → deriveVaultRoot-C3uqnJto.cjs} +2 -2
  20. package/dist/{deriveVaultRoot-DvhkHzNb.cjs.map → deriveVaultRoot-C3uqnJto.cjs.map} +1 -1
  21. package/dist/{index-DQ5bfoT3.js → index-B6w5MM-8.js} +147 -124
  22. package/dist/index-B6w5MM-8.js.map +1 -0
  23. package/dist/index-EHLYplSd.cjs +2 -0
  24. package/dist/index-EHLYplSd.cjs.map +1 -0
  25. package/dist/index.cjs +1 -1
  26. package/dist/index.js +163 -158
  27. package/dist/{onChainBtcPubkey-BXry_CM4.cjs → onChainBtcPubkey-BlzxYImF.cjs} +2 -2
  28. package/dist/{onChainBtcPubkey-BXry_CM4.cjs.map → onChainBtcPubkey-BlzxYImF.cjs.map} +1 -1
  29. package/dist/{onChainBtcPubkey-C1WqyxPM.js → onChainBtcPubkey-CCTdl53s.js} +2 -2
  30. package/dist/{onChainBtcPubkey-C1WqyxPM.js.map → onChainBtcPubkey-CCTdl53s.js.map} +1 -1
  31. package/dist/{pegin-registration-client-BNV44jzw.cjs → pegin-registration-client-BdJ6c7si.cjs} +2 -2
  32. package/dist/{pegin-registration-client-BNV44jzw.cjs.map → pegin-registration-client-BdJ6c7si.cjs.map} +1 -1
  33. package/dist/{pegin-registration-client-1sZ-74UC.js → pegin-registration-client-C5Hktrja.js} +3 -3
  34. package/dist/{pegin-registration-client-1sZ-74UC.js.map → pegin-registration-client-C5Hktrja.js.map} +1 -1
  35. package/dist/peginState-BU2ONFXF.js +68 -0
  36. package/dist/{peginState-CxDiaKuk.js.map → peginState-BU2ONFXF.js.map} +1 -1
  37. package/dist/peginState-DUv10EJR.cjs +2 -0
  38. package/dist/{peginState-eaQ4IO_R.cjs.map → peginState-DUv10EJR.cjs.map} +1 -1
  39. package/dist/{primeVpAuth-DdfHSC53.js → primeVpAuth-Bdy_B_Sq.js} +5 -5
  40. package/dist/{primeVpAuth-DdfHSC53.js.map → primeVpAuth-Bdy_B_Sq.js.map} +1 -1
  41. package/dist/primeVpAuth-CQRsu6VB.cjs +2 -0
  42. package/dist/{primeVpAuth-BOGKniTl.cjs.map → primeVpAuth-CQRsu6VB.cjs.map} +1 -1
  43. package/dist/{reservation-Cj9F0rP9.js → reservation-DOAHVT3B.js} +2 -2
  44. package/dist/{reservation-Cj9F0rP9.js.map → reservation-DOAHVT3B.js.map} +1 -1
  45. package/dist/{reservation-Dr2HLCxx.cjs → reservation-ECxjZi5t.cjs} +2 -2
  46. package/dist/{reservation-Dr2HLCxx.cjs.map → reservation-ECxjZi5t.cjs.map} +1 -1
  47. package/dist/sha2-Ce6KewYx.cjs +2 -0
  48. package/dist/{sha2-DI0-0SHr.cjs.map → sha2-Ce6KewYx.cjs.map} +1 -1
  49. package/dist/{sha2-CLpQd0Rd.js → sha2-YqVHJiFj.js} +91 -77
  50. package/dist/{sha2-CLpQd0Rd.js.map → sha2-YqVHJiFj.js.map} +1 -1
  51. package/dist/state-DMFlvLL3.cjs +2 -0
  52. package/dist/state-DMFlvLL3.cjs.map +1 -0
  53. package/dist/{json-rpc-client-DuUARJvV.js → state-mE-QfITd.js} +91 -69
  54. package/dist/state-mE-QfITd.js.map +1 -0
  55. package/dist/tbv/core/clients/eth/index.cjs +1 -1
  56. package/dist/tbv/core/clients/eth/index.js +3 -3
  57. package/dist/tbv/core/clients/index.cjs +1 -1
  58. package/dist/tbv/core/clients/index.js +27 -26
  59. package/dist/tbv/core/clients/vault-provider/api.d.ts +2 -1
  60. package/dist/tbv/core/clients/vault-provider/api.d.ts.map +1 -1
  61. package/dist/tbv/core/clients/vault-provider/index.d.ts +1 -1
  62. package/dist/tbv/core/clients/vault-provider/index.d.ts.map +1 -1
  63. package/dist/tbv/core/clients/vault-provider/status/index.cjs +1 -1
  64. package/dist/tbv/core/clients/vault-provider/status/index.d.ts +1 -1
  65. package/dist/tbv/core/clients/vault-provider/status/index.d.ts.map +1 -1
  66. package/dist/tbv/core/clients/vault-provider/status/index.js +10 -9
  67. package/dist/tbv/core/clients/vault-provider/types.d.ts +7 -3
  68. package/dist/tbv/core/clients/vault-provider/types.d.ts.map +1 -1
  69. package/dist/tbv/core/clients/vault-provider/validators.d.ts +8 -0
  70. package/dist/tbv/core/clients/vault-provider/validators.d.ts.map +1 -1
  71. package/dist/tbv/core/index.cjs +1 -1
  72. package/dist/tbv/core/index.js +163 -158
  73. package/dist/tbv/core/managers/index.cjs +1 -1
  74. package/dist/tbv/core/managers/index.js +2 -2
  75. package/dist/tbv/core/services/deposit/__tests__/graphFingerprint.test.d.ts +2 -0
  76. package/dist/tbv/core/services/deposit/__tests__/graphFingerprint.test.d.ts.map +1 -0
  77. package/dist/tbv/core/services/deposit/graphFingerprint.d.ts +115 -0
  78. package/dist/tbv/core/services/deposit/graphFingerprint.d.ts.map +1 -0
  79. package/dist/tbv/core/services/deposit/index.d.ts +2 -1
  80. package/dist/tbv/core/services/deposit/index.d.ts.map +1 -1
  81. package/dist/tbv/core/services/deposit/peginState.d.ts +23 -0
  82. package/dist/tbv/core/services/deposit/peginState.d.ts.map +1 -1
  83. package/dist/tbv/core/services/deposit/runDepositorPresignFlow.d.ts +11 -0
  84. package/dist/tbv/core/services/deposit/runDepositorPresignFlow.d.ts.map +1 -1
  85. package/dist/tbv/core/services/index.cjs +1 -1
  86. package/dist/tbv/core/services/index.js +52 -47
  87. package/dist/tbv/core/services/index.js.map +1 -1
  88. package/dist/tbv/core/services/pegout/state.d.ts +8 -3
  89. package/dist/tbv/core/services/pegout/state.d.ts.map +1 -1
  90. package/dist/tbv/core/utils/index.cjs +1 -1
  91. package/dist/tbv/core/utils/index.js +1 -1
  92. package/dist/tbv/core/vault-secrets/index.cjs +1 -1
  93. package/dist/tbv/core/vault-secrets/index.js +1 -1
  94. package/dist/tbv/index.cjs +1 -1
  95. package/dist/tbv/index.js +163 -158
  96. package/dist/testing/index.cjs +1 -1
  97. package/dist/testing/index.js +1 -1
  98. package/dist/{toRefundInputs-BaN9XluU.cjs → toRefundInputs-B_GlIXjk.cjs} +2 -2
  99. package/dist/{toRefundInputs-BaN9XluU.cjs.map → toRefundInputs-B_GlIXjk.cjs.map} +1 -1
  100. package/dist/{toRefundInputs-mtuuYezp.js → toRefundInputs-DIIdhjvu.js} +5 -5
  101. package/dist/{toRefundInputs-mtuuYezp.js.map → toRefundInputs-DIIdhjvu.js.map} +1 -1
  102. package/dist/{types-BuxreSq4.cjs → types-DJxOEU3P.cjs} +2 -2
  103. package/dist/{types-BuxreSq4.cjs.map → types-DJxOEU3P.cjs.map} +1 -1
  104. package/dist/{types-BdCEoANP.js → types-Dz1kVqn6.js} +2 -2
  105. package/dist/{types-BdCEoANP.js.map → types-Dz1kVqn6.js.map} +1 -1
  106. package/package.json +1 -1
  107. package/dist/PeginManager-6tjlGd0t.cjs.map +0 -1
  108. package/dist/PeginManager-DEldv_Ro.js.map +0 -1
  109. package/dist/buildAndBroadcastReclaim-BwT6Jxp5.cjs +0 -2
  110. package/dist/buildAndBroadcastReclaim-BwT6Jxp5.cjs.map +0 -1
  111. package/dist/buildAndBroadcastReclaim-CqO2DoP8.js.map +0 -1
  112. package/dist/index-CK1Xvq4K.cjs +0 -2
  113. package/dist/index-CK1Xvq4K.cjs.map +0 -1
  114. package/dist/index-DQ5bfoT3.js.map +0 -1
  115. package/dist/json-rpc-client-BiAmg_ho.cjs +0 -2
  116. package/dist/json-rpc-client-BiAmg_ho.cjs.map +0 -1
  117. package/dist/json-rpc-client-DuUARJvV.js.map +0 -1
  118. package/dist/peginState-CxDiaKuk.js +0 -63
  119. package/dist/peginState-eaQ4IO_R.cjs +0 -2
  120. package/dist/primeVpAuth-BOGKniTl.cjs +0 -2
  121. package/dist/sha2-DI0-0SHr.cjs +0 -2
@@ -1,48 +1,52 @@
1
- var G = Object.defineProperty;
2
- var N = (s, e, t) => e in s ? G(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
- var V = (s, e, t) => N(s, typeof e != "symbol" ? e + "" : e, t);
4
- import { D as O, a as H, e as M } from "./json-rpc-client-DuUARJvV.js";
1
+ var N = Object.defineProperty;
2
+ var H = (s, e, t) => e in s ? N(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
+ var V = (s, e, t) => H(s, typeof e != "symbol" ? e + "" : e, t);
4
+ import { D as O, a as I, n as U, e as X } from "./state-mE-QfITd.js";
5
5
  import { C as A } from "./constants-D5vORbQE.js";
6
- import { H as q, X as k, C as D } from "./validation-OSC0xTHB.js";
7
- const R = new Set(Object.values(O)), I = 200;
6
+ import { H as M, X as R, C as k } from "./validation-OSC0xTHB.js";
7
+ const D = new Set(Object.values(O)), q = 200;
8
8
  function a(s) {
9
9
  var e;
10
- return ((e = JSON.stringify(s)) == null ? void 0 : e.slice(0, I)) ?? "undefined";
10
+ return ((e = JSON.stringify(s)) == null ? void 0 : e.slice(0, q)) ?? "undefined";
11
11
  }
12
- const X = "The vault provider returned an unexpected response. Please try again or contact support.";
12
+ const T = "VP response validation failed: unrecognized status";
13
+ function pe(s) {
14
+ return s.startsWith(T);
15
+ }
16
+ const z = "The vault provider returned an unexpected response. Please try again or contact support.";
13
17
  class n extends Error {
14
18
  constructor(t) {
15
- super(X);
19
+ super(z);
16
20
  V(this, "detail");
17
21
  this.name = "VpResponseValidationError", this.detail = t;
18
22
  }
19
23
  }
20
- const b = 64;
24
+ const y = 64, C = 64;
21
25
  function f(s) {
22
- return typeof s == "string" && s.length > 0 && q.test(s);
26
+ return typeof s == "string" && s.length > 0 && M.test(s);
23
27
  }
24
- function C(s) {
28
+ function L(s) {
25
29
  return typeof s == "string" && s.length > 0;
26
30
  }
27
- function T(s, e) {
31
+ function F(s, e) {
28
32
  if (!f(s))
29
33
  throw new n(
30
34
  `VP response validation failed: "${e}" must be a non-empty hex string, got ${a(s)}`
31
35
  );
32
36
  }
33
37
  function u(s, e) {
34
- if (!C(s))
38
+ if (!L(s))
35
39
  throw new n(
36
40
  `VP response validation failed: "${e}" must be a non-empty string, got ${a(s)}`
37
41
  );
38
42
  }
39
- function j(s, e) {
40
- if (!f(s) || s.length !== k && s.length !== D)
43
+ function E(s, e) {
44
+ if (!f(s) || s.length !== R && s.length !== k)
41
45
  throw new n(
42
- `VP response validation failed: "${e}" must be a ${k} or ${D}-char hex string (BTC pubkey), got ${a(s)}`
46
+ `VP response validation failed: "${e}" must be a ${R} or ${k}-char hex string (BTC pubkey), got ${a(s)}`
43
47
  );
44
48
  }
45
- function U(s) {
49
+ function W(s) {
46
50
  const e = s.presigning;
47
51
  if (e == null) return;
48
52
  if (typeof e != "object" || Array.isArray(e))
@@ -69,23 +73,23 @@ function B(s) {
69
73
  "VP response validation failed: getPeginStatus response is not an object"
70
74
  );
71
75
  const e = s;
72
- if (!f(e.pegin_txid) || e.pegin_txid.length !== b)
76
+ if (!f(e.pegin_txid) || e.pegin_txid.length !== y)
73
77
  throw new n(
74
- `VP response validation failed: "pegin_txid" must be a ${b}-char hex string (txid), got ${a(e.pegin_txid)}`
78
+ `VP response validation failed: "pegin_txid" must be a ${y}-char hex string (txid), got ${a(e.pegin_txid)}`
75
79
  );
76
80
  if (typeof e.status != "string")
77
81
  throw new n(
78
82
  'VP response validation failed: "status" must be a string'
79
83
  );
80
- if (!R.has(e.status))
84
+ if (!D.has(e.status))
81
85
  throw new n(
82
- `VP response validation failed: unrecognized status "${e.status}". Expected one of: ${[...R].join(", ")}`
86
+ `${T} ${a(e.status)}. Expected one of: ${[...D].join(", ")}`
83
87
  );
84
88
  if (e.progress === null || typeof e.progress != "object" || Array.isArray(e.progress))
85
89
  throw new n(
86
90
  'VP response validation failed: "progress" must be an object'
87
91
  );
88
- if (U(e.progress), typeof e.health_info != "string")
92
+ if (W(e.progress), typeof e.health_info != "string")
89
93
  throw new n(
90
94
  'VP response validation failed: "health_info" must be a string'
91
95
  );
@@ -94,7 +98,7 @@ function B(s) {
94
98
  `VP response validation failed: "last_error" must be a string if present, got ${a(e.last_error)}`
95
99
  );
96
100
  }
97
- function z(s) {
101
+ function K(s) {
98
102
  if (s === null || typeof s != "object")
99
103
  throw new n(
100
104
  "VP response validation failed: requestDepositorPresignTransactions response is not an object"
@@ -105,31 +109,31 @@ function z(s) {
105
109
  'VP response validation failed: "txs" must be an array'
106
110
  );
107
111
  for (let t = 0; t < e.txs.length; t++)
108
- F(e.txs[t], `txs[${t}]`);
112
+ Y(e.txs[t], `txs[${t}]`);
109
113
  if (e.depositor_graph === null || typeof e.depositor_graph != "object")
110
114
  throw new n(
111
115
  'VP response validation failed: "depositor_graph" must be an object'
112
116
  );
113
- se(
117
+ ae(
114
118
  e.depositor_graph
115
119
  );
116
120
  }
117
- function g(s, e) {
121
+ function h(s, e) {
118
122
  if (s === null || typeof s != "object")
119
123
  throw new n(
120
124
  `VP response validation failed: "${e}" must be an object`
121
125
  );
122
- T(s.tx_hex, `${e}.tx_hex`);
126
+ F(s.tx_hex, `${e}.tx_hex`);
123
127
  }
124
- function F(s, e) {
128
+ function Y(s, e) {
125
129
  if (s === null || typeof s != "object")
126
130
  throw new n(
127
131
  `VP response validation failed: "${e}" must be an object`
128
132
  );
129
133
  const t = s;
130
- j(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`), u(t.payout_psbt, `${e}.payout_psbt`);
134
+ E(t.claimer_pubkey, `${e}.claimer_pubkey`), h(t.claim_tx, `${e}.claim_tx`), h(t.assert_tx, `${e}.assert_tx`), h(t.payout_tx, `${e}.payout_tx`), u(t.payout_psbt, `${e}.payout_psbt`);
131
135
  }
132
- function K(s, e) {
136
+ function J(s, e) {
133
137
  if (s === null || typeof s != "object")
134
138
  throw new n(
135
139
  `VP response validation failed: "${e}" must be an object`
@@ -137,19 +141,19 @@ function K(s, e) {
137
141
  const t = s;
138
142
  u(t.wots_pks_json, `${e}.wots_pks_json`), u(t.gc_wots_keys_json, `${e}.gc_wots_keys_json`);
139
143
  }
140
- function W(s, e) {
144
+ function Z(s, e) {
141
145
  if (s === null || typeof s != "object")
142
146
  throw new n(
143
147
  `VP response validation failed: "${e}" must be an object`
144
148
  );
145
149
  const t = s;
146
- if (j(t.challenger_pubkey, `${e}.challenger_pubkey`), g(
150
+ if (E(t.challenger_pubkey, `${e}.challenger_pubkey`), h(
147
151
  t.challenge_assert_x_tx,
148
152
  `${e}.challenge_assert_x_tx`
149
- ), g(
153
+ ), h(
150
154
  t.challenge_assert_y_tx,
151
155
  `${e}.challenge_assert_y_tx`
152
- ), g(t.nopayout_tx, `${e}.nopayout_tx`), u(t.nopayout_psbt, `${e}.nopayout_psbt`), !Array.isArray(t.challenge_assert_connectors))
156
+ ), h(t.nopayout_tx, `${e}.nopayout_tx`), u(t.nopayout_psbt, `${e}.nopayout_psbt`), !Array.isArray(t.challenge_assert_connectors))
153
157
  throw new n(
154
158
  `VP response validation failed: "${e}.challenge_assert_connectors" must be an array`
155
159
  );
@@ -158,7 +162,7 @@ function W(s, e) {
158
162
  `VP response validation failed: "${e}.challenge_assert_connectors" must have exactly ${A} entries, got ${t.challenge_assert_connectors.length}`
159
163
  );
160
164
  for (let r = 0; r < t.challenge_assert_connectors.length; r++)
161
- K(
165
+ J(
162
166
  t.challenge_assert_connectors[r],
163
167
  `${e}.challenge_assert_connectors[${r}]`
164
168
  );
@@ -166,19 +170,21 @@ function W(s, e) {
166
170
  throw new n(
167
171
  `VP response validation failed: "${e}.output_label_hashes" must be an array`
168
172
  );
169
- for (let r = 0; r < t.output_label_hashes.length; r++)
170
- T(
171
- t.output_label_hashes[r],
172
- `${e}.output_label_hashes[${r}]`
173
- );
173
+ for (let r = 0; r < t.output_label_hashes.length; r++) {
174
+ const o = t.output_label_hashes[r];
175
+ if (!f(o) || o.length !== C)
176
+ throw new n(
177
+ `VP response validation failed: "${e}.output_label_hashes[${r}]" must be a ${C}-char hex string, got ${a(o)}`
178
+ );
179
+ }
174
180
  }
175
- function Y(s) {
181
+ function Q(s) {
176
182
  if (s === null || typeof s != "object")
177
183
  throw new n(
178
184
  "VP response validation failed: requestDepositorClaimerArtifacts response is not an object"
179
185
  );
180
186
  const e = s;
181
- if (!C(e.tx_graph_json))
187
+ if (!L(e.tx_graph_json))
182
188
  throw new n(
183
189
  `VP response validation failed: "tx_graph_json" must be a non-empty string, got ${a(e.tx_graph_json)}`
184
190
  );
@@ -198,26 +204,26 @@ function Y(s) {
198
204
  'VP response validation failed: "babe_sessions" must contain at least one challenger entry'
199
205
  );
200
206
  for (const [r, o] of t) {
201
- if (j(r, `babe_sessions["${r}"]`), o === null || typeof o != "object")
207
+ if (E(r, `babe_sessions["${r}"]`), o === null || typeof o != "object")
202
208
  throw new n(
203
209
  `VP response validation failed: "babe_sessions.${r}" must be an object`
204
210
  );
205
- const c = o;
206
- if (!f(c.decryptor_artifacts_hex))
211
+ const l = o;
212
+ if (!f(l.decryptor_artifacts_hex))
207
213
  throw new n(
208
- `VP response validation failed: "babe_sessions.${r}.decryptor_artifacts_hex" must be a non-empty hex string, got ${a(c.decryptor_artifacts_hex)}`
214
+ `VP response validation failed: "babe_sessions.${r}.decryptor_artifacts_hex" must be a non-empty hex string, got ${a(l.decryptor_artifacts_hex)}`
209
215
  );
210
216
  }
211
217
  }
212
- function J(s) {
218
+ function ee(s) {
213
219
  if (s === null || typeof s != "object")
214
220
  throw new n(
215
221
  "VP response validation failed: pegout status payload is not an object"
216
222
  );
217
223
  const e = s;
218
- if (!f(e.pegin_txid) || e.pegin_txid.length !== b)
224
+ if (!f(e.pegin_txid) || e.pegin_txid.length !== y)
219
225
  throw new n(
220
- `VP response validation failed: "pegin_txid" must be a ${b}-char hex string (txid), got ${a(e.pegin_txid)}`
226
+ `VP response validation failed: "pegin_txid" must be a ${y}-char hex string (txid), got ${a(e.pegin_txid)}`
221
227
  );
222
228
  if (typeof e.found != "boolean")
223
229
  throw new n(
@@ -228,16 +234,16 @@ function J(s) {
228
234
  throw new n(
229
235
  `VP response validation failed: "claimer" must be an object or null, got ${a(e.claimer)}`
230
236
  );
231
- Z(e.claimer);
237
+ te(e.claimer);
232
238
  }
233
239
  if (!Array.isArray(e.challengers))
234
240
  throw new n(
235
241
  `VP response validation failed: "challengers" must be an array, got ${a(e.challengers)}`
236
242
  );
237
243
  for (let t = 0; t < e.challengers.length; t++)
238
- Q(e.challengers[t], t);
244
+ se(e.challengers[t], t);
239
245
  }
240
- function Z(s) {
246
+ function te(s) {
241
247
  if (u(s.status, "claimer.status"), typeof s.failed != "boolean")
242
248
  throw new n(
243
249
  `VP response validation failed: "claimer.failed" must be a boolean, got ${a(s.failed)}`
@@ -251,7 +257,7 @@ function Z(s) {
251
257
  `VP response validation failed: "claimer.updated_at" must be a number, got ${a(s.updated_at)}`
252
258
  );
253
259
  }
254
- function Q(s, e) {
260
+ function se(s, e) {
255
261
  if (s === null || typeof s != "object")
256
262
  throw new n(
257
263
  `VP response validation failed: "challengers[${e}]" must be an object, got ${a(s)}`
@@ -278,17 +284,17 @@ function $(s, e) {
278
284
  `VP response validation failed: "${e}" must be a string or null, got ${a(s)}`
279
285
  );
280
286
  }
281
- function ee(s) {
282
- L(s, "batchGetPeginStatus", (e) => {
287
+ function ne(s) {
288
+ G(s, "batchGetPeginStatus", (e) => {
283
289
  e.result !== null && B(e.result);
284
290
  });
285
291
  }
286
- function te(s) {
287
- L(s, "batchGetPegoutStatus", (e) => {
288
- e.result !== null && J(e.result);
292
+ function re(s) {
293
+ G(s, "batchGetPegoutStatus", (e) => {
294
+ e.result !== null && ee(e.result);
289
295
  });
290
296
  }
291
- function L(s, e, t) {
297
+ function G(s, e, t) {
292
298
  if (s === null || typeof s != "object")
293
299
  throw new n(
294
300
  `VP response validation failed: ${e} response is not an object`
@@ -299,15 +305,15 @@ function L(s, e, t) {
299
305
  `VP response validation failed: "${e}.results" must be an array, got ${a(r.results)}`
300
306
  );
301
307
  for (let o = 0; o < r.results.length; o++) {
302
- const c = r.results[o];
303
- if (c === null || typeof c != "object")
308
+ const l = r.results[o];
309
+ if (l === null || typeof l != "object")
304
310
  throw new n(
305
- `VP response validation failed: "${e}.results[${o}]" must be an object, got ${a(c)}`
311
+ `VP response validation failed: "${e}.results[${o}]" must be an object, got ${a(l)}`
306
312
  );
307
- const i = c;
308
- if (!f(i.pegin_txid) || i.pegin_txid.length !== b)
313
+ const i = l;
314
+ if (!f(i.pegin_txid) || i.pegin_txid.length !== y)
309
315
  throw new n(
310
- `VP response validation failed: "${e}.results[${o}].pegin_txid" must be a ${b}-char hex string, got ${a(i.pegin_txid)}`
316
+ `VP response validation failed: "${e}.results[${o}].pegin_txid" must be a ${y}-char hex string, got ${a(i.pegin_txid)}`
311
317
  );
312
318
  if (i.error !== null && typeof i.error != "string")
313
319
  throw new n(
@@ -321,16 +327,25 @@ function L(s, e, t) {
321
327
  throw new n(
322
328
  `VP response validation failed: "${e}.results[${o}]" has both "result" and "error" populated`
323
329
  );
324
- t(i, o);
330
+ try {
331
+ t(i, o);
332
+ } catch (d) {
333
+ if (!(d instanceof n)) throw d;
334
+ r.results[o] = {
335
+ pegin_txid: i.pegin_txid,
336
+ result: null,
337
+ error: d.detail
338
+ };
339
+ }
325
340
  }
326
341
  }
327
- function se(s) {
328
- if (g(s.claim_tx, "depositor_graph.claim_tx"), g(s.assert_tx, "depositor_graph.assert_tx"), g(s.payout_tx, "depositor_graph.payout_tx"), u(s.payout_psbt, "depositor_graph.payout_psbt"), !Array.isArray(s.challenger_presign_data))
342
+ function ae(s) {
343
+ if (h(s.claim_tx, "depositor_graph.claim_tx"), h(s.assert_tx, "depositor_graph.assert_tx"), h(s.payout_tx, "depositor_graph.payout_tx"), u(s.payout_psbt, "depositor_graph.payout_psbt"), !Array.isArray(s.challenger_presign_data))
329
344
  throw new n(
330
345
  'VP response validation failed: "depositor_graph.challenger_presign_data" must be an array'
331
346
  );
332
347
  for (let e = 0; e < s.challenger_presign_data.length; e++)
333
- W(
348
+ Z(
334
349
  s.challenger_presign_data[e],
335
350
  `depositor_graph.challenger_presign_data[${e}]`
336
351
  );
@@ -339,13 +354,13 @@ function se(s) {
339
354
  'VP response validation failed: "depositor_graph.offchain_params_version" must be a number'
340
355
  );
341
356
  }
342
- const ne = 6e4;
343
- class ce {
357
+ const oe = 6e4;
358
+ class de {
344
359
  constructor(e, t) {
345
360
  V(this, "client");
346
361
  const r = {
347
362
  baseUrl: e,
348
- timeout: (t == null ? void 0 : t.timeout) ?? ne,
363
+ timeout: (t == null ? void 0 : t.timeout) ?? oe,
349
364
  retries: t == null ? void 0 : t.retries,
350
365
  retryDelay: t == null ? void 0 : t.retryDelay,
351
366
  retryableFor: t == null ? void 0 : t.retryableFor,
@@ -353,7 +368,7 @@ class ce {
353
368
  tokenProvider: t == null ? void 0 : t.tokenProvider,
354
369
  maxResponseBytes: t == null ? void 0 : t.maxResponseBytes
355
370
  };
356
- this.client = new H(r);
371
+ this.client = new I(r);
357
372
  }
358
373
  /**
359
374
  * Request the payout/claim/assert transactions that the depositor
@@ -361,7 +376,7 @@ class ce {
361
376
  */
362
377
  async requestDepositorPresignTransactions(e, t) {
363
378
  const r = await this.client.call("vaultProvider_requestDepositorPresignTransactions", e, t);
364
- return z(r), r;
379
+ return K(r), r;
365
380
  }
366
381
  /**
367
382
  * Submit the depositor's pre-signatures for the payout transactions
@@ -392,7 +407,7 @@ class ce {
392
407
  */
393
408
  async requestDepositorClaimerArtifacts(e, t) {
394
409
  const r = await this.client.call("vaultProvider_requestDepositorClaimerArtifacts", e, t);
395
- return Y(r), r;
410
+ return Q(r), r;
396
411
  }
397
412
  /** Get the current pegin status from the vault provider daemon. */
398
413
  async getPeginStatus(e, t) {
@@ -410,86 +425,93 @@ class ce {
410
425
  */
411
426
  async batchGetPeginStatus(e, t) {
412
427
  const r = await this.client.call("vaultProvider_batchGetPeginStatus", e, t);
413
- return ee(r), r;
428
+ return ne(r), r;
414
429
  }
415
430
  /**
416
431
  * Get pegout status for many txids in one round trip. Same per-result
417
- * envelope semantics as `batchGetPeginStatus`.
432
+ * envelope semantics as `batchGetPeginStatus`. A legacy claimer status
433
+ * from an older daemon is replaced with its current name.
418
434
  */
419
435
  async batchGetPegoutStatus(e, t) {
436
+ var o;
420
437
  const r = await this.client.call("vaultProvider_batchGetPegoutStatus", e, t);
421
- return te(r), r;
438
+ re(r);
439
+ for (const l of r.results) {
440
+ const i = (o = l.result) == null ? void 0 : o.claimer;
441
+ i && (i.status = U(i.status));
442
+ }
443
+ return r;
422
444
  }
423
445
  }
424
- function re(s, e) {
446
+ function ie(s, e) {
425
447
  const t = /* @__PURE__ */ new Set();
426
448
  for (const p of s)
427
449
  t.add(p.toLowerCase());
428
- const r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), c = [], i = [];
450
+ const r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), l = [], i = [];
429
451
  for (const p of e) {
430
- const d = p.pegin_txid.toLowerCase();
431
- if (!t.has(d)) {
432
- i.push(d);
452
+ const g = p.pegin_txid.toLowerCase();
453
+ if (!t.has(g)) {
454
+ i.push(g);
433
455
  continue;
434
456
  }
435
- if (o.has(d)) {
436
- c.push(d);
457
+ if (o.has(g)) {
458
+ l.push(g);
437
459
  continue;
438
460
  }
439
- o.add(d), r.set(d, { result: p.result, error: p.error });
461
+ o.add(g), r.set(g, { result: p.result, error: p.error });
440
462
  }
441
- const y = [];
463
+ const d = [];
442
464
  for (const p of t)
443
- o.has(p) || y.push(p);
444
- return { byTxid: r, missing: y, unexpected: i, duplicate: c };
465
+ o.has(p) || d.push(p);
466
+ return { byTxid: r, missing: d, unexpected: i, duplicate: l };
445
467
  }
446
- async function ue(s) {
468
+ async function ge(s) {
447
469
  const {
448
470
  items: e,
449
471
  getTxid: t,
450
472
  batchCall: r,
451
473
  onItem: o,
452
- onMissing: c,
474
+ onMissing: l,
453
475
  onDuplicate: i,
454
- onDuplicateBatch: y,
476
+ onDuplicateBatch: d,
455
477
  onWholeBatchError: p,
456
- onUnexpected: d,
457
- batchSize: w = M
478
+ onUnexpected: g,
479
+ batchSize: m = X
458
480
  } = s;
459
- if (!Number.isInteger(w) || w <= 0)
481
+ if (!Number.isInteger(m) || m <= 0)
460
482
  throw new Error(
461
- `batchPollByProvider: batchSize must be a positive integer, got ${w}`
483
+ `batchPollByProvider: batchSize must be a positive integer, got ${m}`
462
484
  );
463
- for (let m = 0; m < e.length; m += w) {
464
- const E = e.slice(m, m + w), P = /* @__PURE__ */ new Map(), v = [];
465
- for (const l of E) {
466
- const _ = t(l).toLowerCase();
467
- P.set(_, l), v.push(_);
485
+ for (let w = 0; w < e.length; w += m) {
486
+ const S = e.slice(w, w + m), P = /* @__PURE__ */ new Map(), v = [];
487
+ for (const c of S) {
488
+ const _ = t(c).toLowerCase();
489
+ P.set(_, c), v.push(_);
468
490
  }
469
- let h;
491
+ let b;
470
492
  try {
471
- const l = await r(v);
472
- h = re(v, l.results);
473
- } catch (l) {
474
- p(E, l);
493
+ const c = await r(v);
494
+ b = ie(v, c.results);
495
+ } catch (c) {
496
+ p(S, c);
475
497
  continue;
476
498
  }
477
- d && h.unexpected.length > 0 && d(h.unexpected);
478
- const x = new Set(h.duplicate);
479
- for (const l of x) {
480
- const _ = P.get(l);
499
+ g && b.unexpected.length > 0 && g(b.unexpected);
500
+ const x = new Set(b.duplicate);
501
+ for (const c of x) {
502
+ const _ = P.get(c);
481
503
  _ && i(_);
482
504
  }
483
- y && x.size > 0 && y(x.size);
484
- for (const l of h.missing) {
485
- const _ = P.get(l);
486
- _ && c(_);
505
+ d && x.size > 0 && d(x.size);
506
+ for (const c of b.missing) {
507
+ const _ = P.get(c);
508
+ _ && l(_);
487
509
  }
488
- for (const [l, _] of h.byTxid) {
489
- if (x.has(l)) continue;
490
- const S = P.get(l);
491
- S && o(S, {
492
- pegin_txid: l,
510
+ for (const [c, _] of b.byTxid) {
511
+ if (x.has(c)) continue;
512
+ const j = P.get(c);
513
+ j && o(j, {
514
+ pegin_txid: c,
493
515
  result: _.result,
494
516
  error: _.error
495
517
  });
@@ -497,9 +519,10 @@ async function ue(s) {
497
519
  }
498
520
  }
499
521
  export {
500
- ce as V,
522
+ de as V,
501
523
  n as a,
502
- ue as b,
503
- Y as v
524
+ ge as b,
525
+ pe as i,
526
+ Q as v
504
527
  };
505
- //# sourceMappingURL=index-DQ5bfoT3.js.map
528
+ //# sourceMappingURL=index-B6w5MM-8.js.map