@babylonlabs-io/ts-sdk 0.26.3 → 0.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/dist/{bitcoin-nOOgeRyl.js → bitcoin-B-Y0DlqR.js} +63 -60
  2. package/dist/bitcoin-B-Y0DlqR.js.map +1 -0
  3. package/dist/bitcoin-DIN0OupO.cjs +2 -0
  4. package/dist/bitcoin-DIN0OupO.cjs.map +1 -0
  5. package/dist/buildAndBroadcastRefund-BEASMFsz.cjs +2 -0
  6. package/dist/buildAndBroadcastRefund-BEASMFsz.cjs.map +1 -0
  7. package/dist/buildAndBroadcastRefund-BzYJv-Fv.js +862 -0
  8. package/dist/buildAndBroadcastRefund-BzYJv-Fv.js.map +1 -0
  9. package/dist/challengeAssert-BM8m9gPM.cjs +2 -0
  10. package/dist/challengeAssert-BM8m9gPM.cjs.map +1 -0
  11. package/dist/{challengeAssert-CH32j5cZ.js → challengeAssert-j2Vwqo0-.js} +135 -120
  12. package/dist/challengeAssert-j2Vwqo0-.js.map +1 -0
  13. package/dist/context-B4fYDTxy.cjs +2 -0
  14. package/dist/context-B4fYDTxy.cjs.map +1 -0
  15. package/dist/{errors-kc6XZy1U.js → context-ktqanzXE.js} +442 -324
  16. package/dist/context-ktqanzXE.js.map +1 -0
  17. package/dist/fundPeginTransaction-DaWoYCgO.cjs +2 -0
  18. package/dist/fundPeginTransaction-DaWoYCgO.cjs.map +1 -0
  19. package/dist/fundPeginTransaction-oV-dNJOU.js +76 -0
  20. package/dist/fundPeginTransaction-oV-dNJOU.js.map +1 -0
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.js +100 -91
  23. package/dist/{payout-DzGsAnhf.js → payout-B_fvQU3q.js} +2 -2
  24. package/dist/{payout-DzGsAnhf.js.map → payout-B_fvQU3q.js.map} +1 -1
  25. package/dist/{payout-RFIh7GLN.cjs → payout-DP6KMFP1.cjs} +2 -2
  26. package/dist/{payout-RFIh7GLN.cjs.map → payout-DP6KMFP1.cjs.map} +1 -1
  27. package/dist/psbtInputFields-CB8hqjQ5.cjs +2 -0
  28. package/dist/psbtInputFields-CB8hqjQ5.cjs.map +1 -0
  29. package/dist/{psbtInputFields-B_cRzwBi.js → psbtInputFields-DeTFSJOq.js} +71 -65
  30. package/dist/psbtInputFields-DeTFSJOq.js.map +1 -0
  31. package/dist/sha2-1XZuToHP.cjs +2 -0
  32. package/dist/sha2-1XZuToHP.cjs.map +1 -0
  33. package/dist/sha2-ZzfZqQSw.js +1123 -0
  34. package/dist/sha2-ZzfZqQSw.js.map +1 -0
  35. package/dist/tbv/core/clients/index.cjs +1 -1
  36. package/dist/tbv/core/clients/index.js +27 -24
  37. package/dist/tbv/core/clients/vault-provider/auth/__tests__/bip322Verify.test.d.ts +17 -0
  38. package/dist/tbv/core/clients/vault-provider/auth/__tests__/bip322Verify.test.d.ts.map +1 -0
  39. package/dist/tbv/core/clients/vault-provider/auth/__tests__/cbor.test.d.ts +15 -0
  40. package/dist/tbv/core/clients/vault-provider/auth/__tests__/cbor.test.d.ts.map +1 -0
  41. package/dist/tbv/core/clients/vault-provider/auth/__tests__/goldenVectors.d.ts +44 -0
  42. package/dist/tbv/core/clients/vault-provider/auth/__tests__/goldenVectors.d.ts.map +1 -0
  43. package/dist/tbv/core/clients/vault-provider/auth/__tests__/serverIdentity.test.d.ts +2 -0
  44. package/dist/tbv/core/clients/vault-provider/auth/__tests__/serverIdentity.test.d.ts.map +1 -0
  45. package/dist/tbv/core/clients/vault-provider/auth/__tests__/tokenProvider.test.d.ts +2 -0
  46. package/dist/tbv/core/clients/vault-provider/auth/__tests__/tokenProvider.test.d.ts.map +1 -0
  47. package/dist/tbv/core/clients/vault-provider/auth/bip322Verify.d.ts +56 -0
  48. package/dist/tbv/core/clients/vault-provider/auth/bip322Verify.d.ts.map +1 -0
  49. package/dist/tbv/core/clients/vault-provider/auth/cbor.d.ts +44 -0
  50. package/dist/tbv/core/clients/vault-provider/auth/cbor.d.ts.map +1 -0
  51. package/dist/tbv/core/clients/vault-provider/auth/index.d.ts +10 -0
  52. package/dist/tbv/core/clients/vault-provider/auth/index.d.ts.map +1 -0
  53. package/dist/tbv/core/clients/vault-provider/auth/serverIdentity.d.ts +68 -0
  54. package/dist/tbv/core/clients/vault-provider/auth/serverIdentity.d.ts.map +1 -0
  55. package/dist/tbv/core/clients/vault-provider/auth/tokenProvider.d.ts +81 -0
  56. package/dist/tbv/core/clients/vault-provider/auth/tokenProvider.d.ts.map +1 -0
  57. package/dist/tbv/core/clients/vault-provider/index.d.ts +2 -1
  58. package/dist/tbv/core/clients/vault-provider/index.d.ts.map +1 -1
  59. package/dist/tbv/core/clients/vault-provider/json-rpc-client.d.ts +66 -1
  60. package/dist/tbv/core/clients/vault-provider/json-rpc-client.d.ts.map +1 -1
  61. package/dist/tbv/core/clients/vault-provider/validators.d.ts.map +1 -1
  62. package/dist/tbv/core/index.cjs +1 -1
  63. package/dist/tbv/core/index.d.ts +3 -0
  64. package/dist/tbv/core/index.d.ts.map +1 -1
  65. package/dist/tbv/core/index.js +96 -87
  66. package/dist/tbv/core/managers/PeginManager.d.ts.map +1 -1
  67. package/dist/tbv/core/primitives/index.cjs +1 -1
  68. package/dist/tbv/core/primitives/index.js +3 -3
  69. package/dist/tbv/core/primitives/psbt/pegin.d.ts +17 -2
  70. package/dist/tbv/core/primitives/psbt/pegin.d.ts.map +1 -1
  71. package/dist/tbv/core/primitives/utils/bitcoin.d.ts +19 -0
  72. package/dist/tbv/core/primitives/utils/bitcoin.d.ts.map +1 -1
  73. package/dist/tbv/core/services/index.cjs +1 -1
  74. package/dist/tbv/core/services/index.js +1 -1
  75. package/dist/tbv/core/utils/fee/__tests__/constants.test.d.ts +2 -0
  76. package/dist/tbv/core/utils/fee/__tests__/constants.test.d.ts.map +1 -0
  77. package/dist/tbv/core/utils/fee/constants.d.ts +30 -9
  78. package/dist/tbv/core/utils/fee/constants.d.ts.map +1 -1
  79. package/dist/tbv/core/utils/index.cjs +1 -1
  80. package/dist/tbv/core/utils/index.js +28 -27
  81. package/dist/tbv/core/utils/utxo/reservation.d.ts +5 -0
  82. package/dist/tbv/core/utils/utxo/reservation.d.ts.map +1 -1
  83. package/dist/tbv/core/vault-secrets/__tests__/context.golden.test.d.ts +34 -0
  84. package/dist/tbv/core/vault-secrets/__tests__/context.golden.test.d.ts.map +1 -0
  85. package/dist/tbv/core/vault-secrets/__tests__/context.test.d.ts +6 -0
  86. package/dist/tbv/core/vault-secrets/__tests__/context.test.d.ts.map +1 -0
  87. package/dist/tbv/core/vault-secrets/__tests__/expand.test.d.ts +10 -0
  88. package/dist/tbv/core/vault-secrets/__tests__/expand.test.d.ts.map +1 -0
  89. package/dist/tbv/core/vault-secrets/__tests__/info.test.d.ts +8 -0
  90. package/dist/tbv/core/vault-secrets/__tests__/info.test.d.ts.map +1 -0
  91. package/dist/tbv/core/vault-secrets/context.d.ts +52 -0
  92. package/dist/tbv/core/vault-secrets/context.d.ts.map +1 -0
  93. package/dist/tbv/core/vault-secrets/expand.d.ts +43 -0
  94. package/dist/tbv/core/vault-secrets/expand.d.ts.map +1 -0
  95. package/dist/tbv/core/vault-secrets/index.d.ts +16 -0
  96. package/dist/tbv/core/vault-secrets/index.d.ts.map +1 -0
  97. package/dist/tbv/core/vault-secrets/info.d.ts +55 -0
  98. package/dist/tbv/core/vault-secrets/info.d.ts.map +1 -0
  99. package/dist/tbv/index.cjs +1 -1
  100. package/dist/tbv/index.js +96 -87
  101. package/dist/vault-registry-reader-BizmBSBV.cjs +2 -0
  102. package/dist/vault-registry-reader-BizmBSBV.cjs.map +1 -0
  103. package/dist/{index-D7s2ilf8.js → vault-registry-reader-CpCOte7w.js} +522 -268
  104. package/dist/vault-registry-reader-CpCOte7w.js.map +1 -0
  105. package/package.json +6 -1
  106. package/dist/bitcoin-CNnPFU6Y.cjs +0 -2
  107. package/dist/bitcoin-CNnPFU6Y.cjs.map +0 -1
  108. package/dist/bitcoin-nOOgeRyl.js.map +0 -1
  109. package/dist/buildAndBroadcastRefund-Ccp-2GWW.js +0 -1334
  110. package/dist/buildAndBroadcastRefund-Ccp-2GWW.js.map +0 -1
  111. package/dist/buildAndBroadcastRefund-Mr3ck5ek.cjs +0 -2
  112. package/dist/buildAndBroadcastRefund-Mr3ck5ek.cjs.map +0 -1
  113. package/dist/challengeAssert-CH32j5cZ.js.map +0 -1
  114. package/dist/challengeAssert-X7V3Ik_Q.cjs +0 -2
  115. package/dist/challengeAssert-X7V3Ik_Q.cjs.map +0 -1
  116. package/dist/errors-DJkMz2Gt.cjs +0 -2
  117. package/dist/errors-DJkMz2Gt.cjs.map +0 -1
  118. package/dist/errors-kc6XZy1U.js.map +0 -1
  119. package/dist/fundPeginTransaction-BLYXxLBv.js +0 -70
  120. package/dist/fundPeginTransaction-BLYXxLBv.js.map +0 -1
  121. package/dist/fundPeginTransaction-DxNOeyNI.cjs +0 -2
  122. package/dist/fundPeginTransaction-DxNOeyNI.cjs.map +0 -1
  123. package/dist/index-CIuXb72l.cjs +0 -2
  124. package/dist/index-CIuXb72l.cjs.map +0 -1
  125. package/dist/index-D7s2ilf8.js.map +0 -1
  126. package/dist/psbtInputFields-B_cRzwBi.js.map +0 -1
  127. package/dist/psbtInputFields-DFwuqxdh.cjs +0 -2
  128. package/dist/psbtInputFields-DFwuqxdh.cjs.map +0 -1
  129. package/dist/types-WrGfwlJd.js +0 -608
  130. package/dist/types-WrGfwlJd.js.map +0 -1
  131. package/dist/types-xU3SBcpH.cjs +0 -2
  132. package/dist/types-xU3SBcpH.cjs.map +0 -1
@@ -0,0 +1,1123 @@
1
+ var re = Object.defineProperty;
2
+ var ae = (e, t, n) => t in e ? re(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var l = (e, t, n) => ae(e, typeof t != "symbol" ? t + "" : t, n);
4
+ const Ke = [
5
+ {
6
+ type: "function",
7
+ name: "submitPeginRequest",
8
+ inputs: [
9
+ {
10
+ name: "depositor",
11
+ type: "address",
12
+ internalType: "address"
13
+ },
14
+ {
15
+ name: "depositorBtcPubKey",
16
+ type: "bytes32",
17
+ internalType: "bytes32"
18
+ },
19
+ {
20
+ name: "btcPopSignature",
21
+ type: "bytes",
22
+ internalType: "bytes"
23
+ },
24
+ {
25
+ name: "unsignedPrePeginTx",
26
+ type: "bytes",
27
+ internalType: "bytes"
28
+ },
29
+ {
30
+ name: "depositorSignedPeginTx",
31
+ type: "bytes",
32
+ internalType: "bytes"
33
+ },
34
+ {
35
+ name: "vaultProvider",
36
+ type: "address",
37
+ internalType: "address"
38
+ },
39
+ {
40
+ name: "hashlock",
41
+ type: "bytes32",
42
+ internalType: "bytes32"
43
+ },
44
+ {
45
+ name: "htlcVout",
46
+ type: "uint8",
47
+ internalType: "uint8"
48
+ },
49
+ {
50
+ name: "depositorPayoutBtcAddress",
51
+ type: "bytes",
52
+ internalType: "bytes"
53
+ },
54
+ {
55
+ name: "depositorWotsPkHash",
56
+ type: "bytes32",
57
+ internalType: "bytes32"
58
+ }
59
+ ],
60
+ outputs: [
61
+ {
62
+ name: "",
63
+ type: "bytes32",
64
+ internalType: "bytes32"
65
+ }
66
+ ],
67
+ stateMutability: "payable"
68
+ },
69
+ {
70
+ type: "function",
71
+ name: "submitPeginRequest",
72
+ inputs: [
73
+ {
74
+ name: "depositor",
75
+ type: "address",
76
+ internalType: "address"
77
+ },
78
+ {
79
+ name: "depositorBtcPubKey",
80
+ type: "bytes32",
81
+ internalType: "bytes32"
82
+ },
83
+ {
84
+ name: "btcPopSignature",
85
+ type: "bytes",
86
+ internalType: "bytes"
87
+ },
88
+ {
89
+ name: "unsignedPrePeginTx",
90
+ type: "bytes",
91
+ internalType: "bytes"
92
+ },
93
+ {
94
+ name: "depositorSignedPeginTx",
95
+ type: "bytes",
96
+ internalType: "bytes"
97
+ },
98
+ {
99
+ name: "vaultProvider",
100
+ type: "address",
101
+ internalType: "address"
102
+ },
103
+ {
104
+ name: "hashlock",
105
+ type: "bytes32",
106
+ internalType: "bytes32"
107
+ },
108
+ {
109
+ name: "htlcVout",
110
+ type: "uint8",
111
+ internalType: "uint8"
112
+ },
113
+ {
114
+ name: "referralCode",
115
+ type: "uint32",
116
+ internalType: "uint32"
117
+ },
118
+ {
119
+ name: "depositorPayoutBtcAddress",
120
+ type: "bytes",
121
+ internalType: "bytes"
122
+ },
123
+ {
124
+ name: "depositorWotsPkHash",
125
+ type: "bytes32",
126
+ internalType: "bytes32"
127
+ }
128
+ ],
129
+ outputs: [
130
+ {
131
+ name: "",
132
+ type: "bytes32",
133
+ internalType: "bytes32"
134
+ }
135
+ ],
136
+ stateMutability: "payable"
137
+ },
138
+ {
139
+ type: "function",
140
+ name: "submitPeginRequestBatch",
141
+ inputs: [
142
+ { name: "depositor", type: "address", internalType: "address" },
143
+ { name: "vaultProvider", type: "address", internalType: "address" },
144
+ {
145
+ name: "requests",
146
+ type: "tuple[]",
147
+ internalType: "struct IBTCVaultRegistry.BatchPeginRequest[]",
148
+ components: [
149
+ { name: "depositorBtcPubKey", type: "bytes32", internalType: "bytes32" },
150
+ { name: "btcPopSignature", type: "bytes", internalType: "bytes" },
151
+ { name: "unsignedPrePeginTx", type: "bytes", internalType: "bytes" },
152
+ { name: "depositorSignedPeginTx", type: "bytes", internalType: "bytes" },
153
+ { name: "hashlock", type: "bytes32", internalType: "bytes32" },
154
+ { name: "htlcVout", type: "uint8", internalType: "uint8" },
155
+ { name: "referralCode", type: "uint32", internalType: "uint32" },
156
+ { name: "depositorPayoutBtcAddress", type: "bytes", internalType: "bytes" },
157
+ { name: "depositorWotsPkHash", type: "bytes32", internalType: "bytes32" }
158
+ ]
159
+ }
160
+ ],
161
+ outputs: [
162
+ { name: "vaultIds", type: "bytes32[]", internalType: "bytes32[]" }
163
+ ],
164
+ stateMutability: "payable"
165
+ },
166
+ {
167
+ type: "function",
168
+ name: "activateVaultWithSecret",
169
+ inputs: [
170
+ {
171
+ name: "vaultId",
172
+ type: "bytes32",
173
+ internalType: "bytes32"
174
+ },
175
+ {
176
+ name: "s",
177
+ type: "bytes32",
178
+ internalType: "bytes32"
179
+ },
180
+ {
181
+ name: "activationMetadata",
182
+ type: "bytes",
183
+ internalType: "bytes"
184
+ }
185
+ ],
186
+ outputs: [],
187
+ stateMutability: "nonpayable"
188
+ },
189
+ {
190
+ type: "function",
191
+ name: "getPegInFee",
192
+ inputs: [
193
+ {
194
+ name: "vaultProvider",
195
+ type: "address",
196
+ internalType: "address"
197
+ }
198
+ ],
199
+ outputs: [
200
+ {
201
+ name: "totalFee",
202
+ type: "uint256",
203
+ internalType: "uint256"
204
+ }
205
+ ],
206
+ stateMutability: "view"
207
+ },
208
+ {
209
+ type: "function",
210
+ name: "getBtcVaultBasicInfo",
211
+ inputs: [
212
+ {
213
+ name: "vaultId",
214
+ type: "bytes32",
215
+ internalType: "bytes32"
216
+ }
217
+ ],
218
+ outputs: [
219
+ { name: "depositor", type: "address", internalType: "address" },
220
+ { name: "depositorBtcPubKey", type: "bytes32", internalType: "bytes32" },
221
+ { name: "amount", type: "uint256", internalType: "uint256" },
222
+ { name: "vaultProvider", type: "address", internalType: "address" },
223
+ { name: "status", type: "uint8", internalType: "enum IBTCVaultRegistry.BTCVaultStatus" },
224
+ { name: "applicationEntryPoint", type: "address", internalType: "address" },
225
+ { name: "createdAt", type: "uint256", internalType: "uint256" }
226
+ ],
227
+ stateMutability: "view"
228
+ },
229
+ {
230
+ type: "error",
231
+ name: "InvalidPeginFee",
232
+ inputs: [
233
+ {
234
+ name: "provided",
235
+ type: "uint256",
236
+ internalType: "uint256"
237
+ },
238
+ {
239
+ name: "required",
240
+ type: "uint256",
241
+ internalType: "uint256"
242
+ }
243
+ ]
244
+ },
245
+ {
246
+ type: "error",
247
+ name: "InvalidSecret",
248
+ inputs: []
249
+ },
250
+ {
251
+ type: "error",
252
+ name: "ActivationDeadlineExpired",
253
+ inputs: []
254
+ },
255
+ {
256
+ type: "error",
257
+ name: "InvalidHashlock",
258
+ inputs: []
259
+ },
260
+ {
261
+ type: "error",
262
+ name: "DuplicateHashlock",
263
+ inputs: []
264
+ },
265
+ {
266
+ type: "error",
267
+ name: "CapExceeded",
268
+ inputs: []
269
+ },
270
+ {
271
+ type: "error",
272
+ name: "InvalidOutputIndex",
273
+ inputs: []
274
+ },
275
+ {
276
+ type: "error",
277
+ name: "PeginSignaturesIncomplete",
278
+ inputs: []
279
+ },
280
+ {
281
+ type: "function",
282
+ name: "getBtcVaultProtocolInfo",
283
+ inputs: [
284
+ {
285
+ name: "vaultId",
286
+ type: "bytes32",
287
+ internalType: "bytes32"
288
+ }
289
+ ],
290
+ outputs: [
291
+ {
292
+ name: "depositorSignedPeginTx",
293
+ type: "bytes",
294
+ internalType: "bytes"
295
+ },
296
+ {
297
+ name: "universalChallengersVersion",
298
+ type: "uint16",
299
+ internalType: "uint16"
300
+ },
301
+ {
302
+ name: "appVaultKeepersVersion",
303
+ type: "uint16",
304
+ internalType: "uint16"
305
+ },
306
+ {
307
+ name: "offchainParamsVersion",
308
+ type: "uint16",
309
+ internalType: "uint16"
310
+ },
311
+ {
312
+ name: "verifiedAt",
313
+ type: "uint256",
314
+ internalType: "uint256"
315
+ },
316
+ {
317
+ name: "depositorWotsPkHash",
318
+ type: "bytes32",
319
+ internalType: "bytes32"
320
+ },
321
+ {
322
+ name: "hashlock",
323
+ type: "bytes32",
324
+ internalType: "bytes32"
325
+ },
326
+ {
327
+ name: "htlcVout",
328
+ type: "uint8",
329
+ internalType: "uint8"
330
+ },
331
+ {
332
+ name: "depositorPopSignature",
333
+ type: "bytes",
334
+ internalType: "bytes"
335
+ },
336
+ {
337
+ name: "prePeginTxHash",
338
+ type: "bytes32",
339
+ internalType: "bytes32"
340
+ },
341
+ {
342
+ name: "vaultProviderCommissionBps",
343
+ type: "uint16",
344
+ internalType: "uint16"
345
+ }
346
+ ],
347
+ stateMutability: "view"
348
+ },
349
+ {
350
+ type: "function",
351
+ name: "protocolParams",
352
+ inputs: [],
353
+ outputs: [
354
+ {
355
+ name: "",
356
+ type: "address",
357
+ internalType: "contract IProtocolParams"
358
+ }
359
+ ],
360
+ stateMutability: "view"
361
+ },
362
+ {
363
+ type: "function",
364
+ name: "applicationRegistry",
365
+ inputs: [],
366
+ outputs: [
367
+ {
368
+ name: "",
369
+ type: "address",
370
+ internalType: "contract IApplicationRegistry"
371
+ }
372
+ ],
373
+ stateMutability: "view"
374
+ }
375
+ ];
376
+ class L extends Error {
377
+ constructor(t, n, s = "local", i) {
378
+ super(n), this.code = t, this.source = s, this.data = i, this.name = "JsonRpcError";
379
+ }
380
+ }
381
+ const v = {
382
+ TIMEOUT: -32e3,
383
+ NETWORK: -32001,
384
+ /** VP proxy: request timed out at proxy level */
385
+ PROXY_TIMEOUT: -32002,
386
+ /** VP proxy: VP unreachable / DNS failure / response too large */
387
+ PROXY_UNAVAILABLE: -32003,
388
+ /** SDK client: response missing "result" field (malformed JSON-RPC) */
389
+ INVALID_RESPONSE: -32700
390
+ }, oe = "2.0", ce = 3, le = 1e3, ue = /* @__PURE__ */ new Set([
391
+ 408,
392
+ // Request Timeout
393
+ 429,
394
+ // Too Many Requests
395
+ 500,
396
+ // Internal Server Error
397
+ 502,
398
+ // Bad Gateway
399
+ 503,
400
+ // Service Unavailable
401
+ 504
402
+ // Gateway Timeout
403
+ ]), de = /* @__PURE__ */ new Set([
404
+ "vaultProvider_getPeginStatus",
405
+ "vaultProvider_getPegoutStatus",
406
+ "vaultProvider_requestDepositorPresignTransactions"
407
+ ]);
408
+ function be(e) {
409
+ return de.has(e);
410
+ }
411
+ const ye = "auth_expired";
412
+ function pe(e) {
413
+ if (!(e instanceof L) || e.source !== "wire") return !1;
414
+ const t = e.data;
415
+ return t === null || typeof t != "object" ? !1 : t.kind === ye;
416
+ }
417
+ class qe {
418
+ constructor(t) {
419
+ l(this, "baseUrl");
420
+ l(this, "timeout");
421
+ l(this, "headers");
422
+ l(this, "requestId", 0);
423
+ l(this, "retries");
424
+ l(this, "retryDelay");
425
+ l(this, "retryableFor");
426
+ l(this, "tokenProvider");
427
+ this.baseUrl = t.baseUrl.replace(/\/$/, ""), this.timeout = t.timeout, this.headers = {
428
+ "Content-Type": "application/json",
429
+ ...t.headers
430
+ }, this.retries = t.retries ?? ce, this.retryDelay = t.retryDelay ?? le, this.retryableFor = t.retryableFor ?? be, this.tokenProvider = t.tokenProvider;
431
+ }
432
+ async buildHeaders(t) {
433
+ const n = { ...this.headers };
434
+ if (this.tokenProvider) {
435
+ const s = await this.tokenProvider.getToken(t);
436
+ s && (n.Authorization = `Bearer ${s}`);
437
+ }
438
+ return n;
439
+ }
440
+ /**
441
+ * Make a JSON-RPC request with optional retry for safe methods.
442
+ *
443
+ * If the request fails with a wire-origin `auth_expired` error and a
444
+ * `tokenProvider` is configured, the client invalidates its cached
445
+ * token and retries the request once with a freshly-acquired bearer.
446
+ *
447
+ * @param method - The RPC method name
448
+ * @param params - The method parameters
449
+ * @param signal - Optional AbortSignal for caller-controlled cancellation
450
+ * @returns The result from the RPC method
451
+ * @throws JsonRpcError if the RPC call fails
452
+ */
453
+ async call(t, n, s) {
454
+ try {
455
+ return await this.callOnce(t, n, s);
456
+ } catch (i) {
457
+ if (this.tokenProvider && pe(i))
458
+ return this.tokenProvider.invalidate(), await this.callOnce(t, n, s);
459
+ throw i;
460
+ }
461
+ }
462
+ async callOnce(t, n, s) {
463
+ const i = await this.fetchWithRetry(t, n, s);
464
+ let r;
465
+ try {
466
+ r = await i.json();
467
+ } catch {
468
+ throw new L(
469
+ v.INVALID_RESPONSE,
470
+ "Invalid JSON-RPC response: body is not valid JSON",
471
+ "local"
472
+ );
473
+ }
474
+ if (r === null || typeof r != "object" || Array.isArray(r))
475
+ throw new L(
476
+ v.INVALID_RESPONSE,
477
+ `Invalid JSON-RPC response: expected an object, got ${typeof r}`,
478
+ "local"
479
+ );
480
+ const a = r;
481
+ if ("error" in a && a.error != null) {
482
+ const c = a.error;
483
+ throw new L(
484
+ c.code ?? v.INVALID_RESPONSE,
485
+ c.message ?? "Unknown RPC error",
486
+ "wire",
487
+ c.data
488
+ );
489
+ }
490
+ if (!("result" in a))
491
+ throw new L(
492
+ v.INVALID_RESPONSE,
493
+ 'Invalid JSON-RPC response: missing "result" field',
494
+ "local"
495
+ );
496
+ return a.result;
497
+ }
498
+ /**
499
+ * Make a JSON-RPC request returning the raw Response (unparsed body).
500
+ *
501
+ * Bearer tokens are injected identically to `call`. **Reactive refresh
502
+ * is NOT performed here** — the response body may be unbounded (e.g.
503
+ * claimer-artifact downloads), so the client refuses to parse it to
504
+ * detect auth errors. Callers relying on token-expired retries for
505
+ * large downloads must read the body themselves and re-invoke
506
+ * `callRaw` after `tokenProvider.invalidate()`.
507
+ */
508
+ async callRaw(t, n, s) {
509
+ return this.fetchWithRetry(t, n, s);
510
+ }
511
+ async fetchWithRetry(t, n, s) {
512
+ const i = ++this.requestId, r = this.retryableFor(t) ? this.retries : 0, c = JSON.stringify({
513
+ jsonrpc: oe,
514
+ method: t,
515
+ params: [n],
516
+ id: i
517
+ });
518
+ let u = null;
519
+ for (let b = 0; b <= r; b++) {
520
+ const h = new AbortController(), o = setTimeout(
521
+ () => h.abort(),
522
+ this.timeout
523
+ ), d = s ? fe(s, h.signal) : null, x = d ? d.signal : h.signal;
524
+ try {
525
+ const y = await this.buildHeaders(t), p = await fetch(this.baseUrl, {
526
+ method: "POST",
527
+ headers: y,
528
+ body: c,
529
+ signal: x
530
+ });
531
+ if (clearTimeout(o), d == null || d.cleanup(), !p.ok) {
532
+ if (b < r && ue.has(p.status)) {
533
+ const O = this.retryDelay * Math.pow(2, b);
534
+ await this.sleep(O, s);
535
+ continue;
536
+ }
537
+ throw new Error(
538
+ `HTTP error: ${p.status} ${p.statusText}`
539
+ );
540
+ }
541
+ return p;
542
+ } catch (y) {
543
+ if (clearTimeout(o), d == null || d.cleanup(), u = y instanceof Error ? y : new Error(String(y)), s != null && s.aborted)
544
+ throw new Error("Request aborted");
545
+ if (y instanceof Error && y.name === "AbortError") {
546
+ if (b < r) {
547
+ const p = this.retryDelay * Math.pow(2, b);
548
+ await this.sleep(p, s);
549
+ continue;
550
+ }
551
+ throw new L(
552
+ v.TIMEOUT,
553
+ `Request timeout after ${this.timeout}ms (${r + 1} attempts)`,
554
+ "local"
555
+ );
556
+ }
557
+ if (y instanceof TypeError) {
558
+ if (b < r) {
559
+ const p = this.retryDelay * Math.pow(2, b);
560
+ await this.sleep(p, s);
561
+ continue;
562
+ }
563
+ throw new L(
564
+ v.NETWORK,
565
+ `Network error: ${y.message} (${r + 1} attempts)`,
566
+ "local"
567
+ );
568
+ }
569
+ throw y;
570
+ }
571
+ }
572
+ throw u || new Error("Unknown error after retries");
573
+ }
574
+ sleep(t, n) {
575
+ return new Promise((s, i) => {
576
+ if (n != null && n.aborted) {
577
+ i(new Error("Request aborted"));
578
+ return;
579
+ }
580
+ const r = setTimeout(() => {
581
+ n == null || n.removeEventListener("abort", a), s();
582
+ }, t), a = () => {
583
+ clearTimeout(r), i(new Error("Request aborted"));
584
+ };
585
+ n == null || n.addEventListener("abort", a, { once: !0 });
586
+ });
587
+ }
588
+ getBaseUrl() {
589
+ return this.baseUrl;
590
+ }
591
+ }
592
+ function fe(e, t) {
593
+ if (e.aborted) return { signal: e, cleanup: () => {
594
+ } };
595
+ if (t.aborted) return { signal: t, cleanup: () => {
596
+ } };
597
+ const n = new AbortController(), s = () => {
598
+ t.removeEventListener("abort", i), n.abort();
599
+ }, i = () => {
600
+ e.removeEventListener("abort", s), n.abort();
601
+ };
602
+ e.addEventListener("abort", s, { once: !0 }), t.addEventListener("abort", i, { once: !0 });
603
+ const r = () => {
604
+ e.removeEventListener("abort", s), t.removeEventListener("abort", i);
605
+ };
606
+ return { signal: n.signal, cleanup: r };
607
+ }
608
+ var he = /* @__PURE__ */ ((e) => (e.PENDING_INGESTION = "PendingIngestion", e.PENDING_DEPOSITOR_WOTS_PK = "PendingDepositorWotsPK", e.PENDING_BABE_SETUP = "PendingBabeSetup", e.PENDING_CHALLENGER_PRESIGNING = "PendingChallengerPresigning", e.PENDING_PEGIN_SIGS_AVAILABILITY = "PendingPeginSigsAvailability", e.PENDING_PRE_PEGIN_CONFIRMATIONS = "PendingPrePegInConfirmations", e.PENDING_DEPOSITOR_SIGNATURES = "PendingDepositorSignatures", e.PENDING_ACKS = "PendingACKs", e.PENDING_ACTIVATION = "PendingActivation", e.ACTIVATED = "Activated", e.EXPIRED = "Expired", e.CLAIM_POSTED = "ClaimPosted", e.PEGGED_OUT = "PeggedOut", e))(he || {});
609
+ const $e = [
610
+ "PendingIngestion",
611
+ "PendingBabeSetup",
612
+ "PendingChallengerPresigning",
613
+ "PendingPeginSigsAvailability",
614
+ "PendingPrePegInConfirmations"
615
+ /* PENDING_PRE_PEGIN_CONFIRMATIONS */
616
+ ], xe = [
617
+ "PendingACKs",
618
+ "PendingActivation",
619
+ "Activated"
620
+ /* ACTIVATED */
621
+ ], Te = /* @__PURE__ */ new Set([
622
+ "PendingBabeSetup",
623
+ "PendingChallengerPresigning",
624
+ "PendingPeginSigsAvailability",
625
+ "PendingPrePegInConfirmations",
626
+ ...xe
627
+ ]), Je = /* @__PURE__ */ new Set([
628
+ "Expired",
629
+ "ClaimPosted",
630
+ "PeggedOut"
631
+ /* PEGGED_OUT */
632
+ ]), je = /* @__PURE__ */ new Set([
633
+ ...Te,
634
+ "PendingDepositorSignatures"
635
+ /* PENDING_DEPOSITOR_SIGNATURES */
636
+ ]);
637
+ var Pe = /* @__PURE__ */ ((e) => (e[e.DATABASE_ERROR = -32005] = "DATABASE_ERROR", e[e.PRESIGN_ERROR = -32006] = "PRESIGN_ERROR", e[e.JSON_SERIALIZATION_ERROR = -32007] = "JSON_SERIALIZATION_ERROR", e[e.TX_GRAPH_ERROR = -32008] = "TX_GRAPH_ERROR", e[e.INVALID_GRAPH = -32009] = "INVALID_GRAPH", e[e.VALIDATION_ERROR = -32010] = "VALIDATION_ERROR", e[e.NOT_FOUND = -32011] = "NOT_FOUND", e[e.INTERNAL_ERROR = -32603] = "INTERNAL_ERROR", e))(Pe || {});
638
+ function Ae(e) {
639
+ return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
640
+ }
641
+ function Y(e, t = "") {
642
+ if (!Number.isSafeInteger(e) || e < 0) {
643
+ const n = t && `"${t}" `;
644
+ throw new Error(`${n}expected integer >= 0, got ${e}`);
645
+ }
646
+ }
647
+ function J(e, t, n = "") {
648
+ const s = Ae(e), i = e == null ? void 0 : e.length, r = t !== void 0;
649
+ if (!s || r && i !== t) {
650
+ const a = n && `"${n}" `, c = r ? ` of length ${t}` : "", u = s ? `length=${i}` : `type=${typeof e}`;
651
+ throw new Error(a + "expected Uint8Array" + c + ", got " + u);
652
+ }
653
+ return e;
654
+ }
655
+ function Ye(e) {
656
+ if (typeof e != "function" || typeof e.create != "function")
657
+ throw new Error("Hash must wrapped by utils.createHasher");
658
+ Y(e.outputLen), Y(e.blockLen);
659
+ }
660
+ function X(e, t = !0) {
661
+ if (e.destroyed)
662
+ throw new Error("Hash instance has been destroyed");
663
+ if (t && e.finished)
664
+ throw new Error("Hash#digest() has already been called");
665
+ }
666
+ function me(e, t) {
667
+ J(e, void 0, "digestInto() output");
668
+ const n = t.outputLen;
669
+ if (e.length < n)
670
+ throw new Error('"digestInto() output" expected to be of length >=' + n);
671
+ }
672
+ function Xe(e) {
673
+ return new Uint32Array(e.buffer, e.byteOffset, Math.floor(e.byteLength / 4));
674
+ }
675
+ function U(...e) {
676
+ for (let t = 0; t < e.length; t++)
677
+ e[t].fill(0);
678
+ }
679
+ function $(e) {
680
+ return new DataView(e.buffer, e.byteOffset, e.byteLength);
681
+ }
682
+ function A(e, t) {
683
+ return e << 32 - t | e >>> t;
684
+ }
685
+ function ze(e, t) {
686
+ return e << t | e >>> 32 - t >>> 0;
687
+ }
688
+ const Ee = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
689
+ function ge(e) {
690
+ return e << 24 & 4278190080 | e << 8 & 16711680 | e >>> 8 & 65280 | e >>> 24 & 255;
691
+ }
692
+ function Ie(e) {
693
+ for (let t = 0; t < e.length; t++)
694
+ e[t] = ge(e[t]);
695
+ return e;
696
+ }
697
+ const Ze = Ee ? (e) => e : Ie;
698
+ function Se(e) {
699
+ if (typeof e != "string")
700
+ throw new Error("string expected");
701
+ return new Uint8Array(new TextEncoder().encode(e));
702
+ }
703
+ function Qe(e, t = "") {
704
+ return typeof e == "string" ? Se(e) : J(e, void 0, t);
705
+ }
706
+ function et(e, t) {
707
+ if (t !== void 0 && {}.toString.call(t) !== "[object Object]")
708
+ throw new Error("options must be object or undefined");
709
+ return Object.assign(e, t);
710
+ }
711
+ function ee(e, t = {}) {
712
+ const n = (i, r) => e(r).update(i).digest(), s = e(void 0);
713
+ return n.outputLen = s.outputLen, n.blockLen = s.blockLen, n.create = (i) => e(i), Object.assign(n, t), Object.freeze(n);
714
+ }
715
+ const te = (e) => ({
716
+ oid: Uint8Array.from([6, 9, 96, 134, 72, 1, 101, 3, 4, 2, e])
717
+ });
718
+ function _e(e, t, n) {
719
+ return e & t ^ ~e & n;
720
+ }
721
+ function Re(e, t, n) {
722
+ return e & t ^ e & n ^ t & n;
723
+ }
724
+ class ne {
725
+ constructor(t, n, s, i) {
726
+ l(this, "blockLen");
727
+ l(this, "outputLen");
728
+ l(this, "padOffset");
729
+ l(this, "isLE");
730
+ // For partial updates less than block size
731
+ l(this, "buffer");
732
+ l(this, "view");
733
+ l(this, "finished", !1);
734
+ l(this, "length", 0);
735
+ l(this, "pos", 0);
736
+ l(this, "destroyed", !1);
737
+ this.blockLen = t, this.outputLen = n, this.padOffset = s, this.isLE = i, this.buffer = new Uint8Array(t), this.view = $(this.buffer);
738
+ }
739
+ update(t) {
740
+ X(this), J(t);
741
+ const { view: n, buffer: s, blockLen: i } = this, r = t.length;
742
+ for (let a = 0; a < r; ) {
743
+ const c = Math.min(i - this.pos, r - a);
744
+ if (c === i) {
745
+ const u = $(t);
746
+ for (; i <= r - a; a += i)
747
+ this.process(u, a);
748
+ continue;
749
+ }
750
+ s.set(t.subarray(a, a + c), this.pos), this.pos += c, a += c, this.pos === i && (this.process(n, 0), this.pos = 0);
751
+ }
752
+ return this.length += t.length, this.roundClean(), this;
753
+ }
754
+ digestInto(t) {
755
+ X(this), me(t, this), this.finished = !0;
756
+ const { buffer: n, view: s, blockLen: i, isLE: r } = this;
757
+ let { pos: a } = this;
758
+ n[a++] = 128, U(this.buffer.subarray(a)), this.padOffset > i - a && (this.process(s, 0), a = 0);
759
+ for (let o = a; o < i; o++)
760
+ n[o] = 0;
761
+ s.setBigUint64(i - 8, BigInt(this.length * 8), r), this.process(s, 0);
762
+ const c = $(t), u = this.outputLen;
763
+ if (u % 4)
764
+ throw new Error("_sha2: outputLen must be aligned to 32bit");
765
+ const b = u / 4, h = this.get();
766
+ if (b > h.length)
767
+ throw new Error("_sha2: outputLen bigger than state");
768
+ for (let o = 0; o < b; o++)
769
+ c.setUint32(4 * o, h[o], r);
770
+ }
771
+ digest() {
772
+ const { buffer: t, outputLen: n } = this;
773
+ this.digestInto(t);
774
+ const s = t.slice(0, n);
775
+ return this.destroy(), s;
776
+ }
777
+ _cloneInto(t) {
778
+ t || (t = new this.constructor()), t.set(...this.get());
779
+ const { blockLen: n, buffer: s, length: i, finished: r, destroyed: a, pos: c } = this;
780
+ return t.destroyed = a, t.finished = r, t.length = i, t.pos = c, i % n && t.buffer.set(s), t;
781
+ }
782
+ clone() {
783
+ return this._cloneInto();
784
+ }
785
+ }
786
+ const _ = /* @__PURE__ */ Uint32Array.from([
787
+ 1779033703,
788
+ 3144134277,
789
+ 1013904242,
790
+ 2773480762,
791
+ 1359893119,
792
+ 2600822924,
793
+ 528734635,
794
+ 1541459225
795
+ ]), T = /* @__PURE__ */ Uint32Array.from([
796
+ 1779033703,
797
+ 4089235720,
798
+ 3144134277,
799
+ 2227873595,
800
+ 1013904242,
801
+ 4271175723,
802
+ 2773480762,
803
+ 1595750129,
804
+ 1359893119,
805
+ 2917565137,
806
+ 2600822924,
807
+ 725511199,
808
+ 528734635,
809
+ 4215389547,
810
+ 1541459225,
811
+ 327033209
812
+ ]), V = /* @__PURE__ */ BigInt(2 ** 32 - 1), z = /* @__PURE__ */ BigInt(32);
813
+ function we(e, t = !1) {
814
+ return t ? { h: Number(e & V), l: Number(e >> z & V) } : { h: Number(e >> z & V) | 0, l: Number(e & V) | 0 };
815
+ }
816
+ function Ne(e, t = !1) {
817
+ const n = e.length;
818
+ let s = new Uint32Array(n), i = new Uint32Array(n);
819
+ for (let r = 0; r < n; r++) {
820
+ const { h: a, l: c } = we(e[r], t);
821
+ [s[r], i[r]] = [a, c];
822
+ }
823
+ return [s, i];
824
+ }
825
+ const Z = (e, t, n) => e >>> n, Q = (e, t, n) => e << 32 - n | t >>> n, B = (e, t, n) => e >>> n | t << 32 - n, H = (e, t, n) => e << 32 - n | t >>> n, k = (e, t, n) => e << 64 - n | t >>> n - 32, M = (e, t, n) => e >>> n - 32 | t << 64 - n, tt = (e, t, n) => e << n | t >>> 32 - n, nt = (e, t, n) => t << n | e >>> 32 - n, st = (e, t, n) => t << n - 32 | e >>> 64 - n, it = (e, t, n) => e << n - 32 | t >>> 64 - n;
826
+ function g(e, t, n, s) {
827
+ const i = (t >>> 0) + (s >>> 0);
828
+ return { h: e + n + (i / 2 ** 32 | 0) | 0, l: i | 0 };
829
+ }
830
+ const Oe = (e, t, n) => (e >>> 0) + (t >>> 0) + (n >>> 0), Le = (e, t, n, s) => t + n + s + (e / 2 ** 32 | 0) | 0, ve = (e, t, n, s) => (e >>> 0) + (t >>> 0) + (n >>> 0) + (s >>> 0), Be = (e, t, n, s, i) => t + n + s + i + (e / 2 ** 32 | 0) | 0, He = (e, t, n, s, i) => (e >>> 0) + (t >>> 0) + (n >>> 0) + (s >>> 0) + (i >>> 0), De = (e, t, n, s, i, r) => t + n + s + i + r + (e / 2 ** 32 | 0) | 0, Ue = /* @__PURE__ */ Uint32Array.from([
831
+ 1116352408,
832
+ 1899447441,
833
+ 3049323471,
834
+ 3921009573,
835
+ 961987163,
836
+ 1508970993,
837
+ 2453635748,
838
+ 2870763221,
839
+ 3624381080,
840
+ 310598401,
841
+ 607225278,
842
+ 1426881987,
843
+ 1925078388,
844
+ 2162078206,
845
+ 2614888103,
846
+ 3248222580,
847
+ 3835390401,
848
+ 4022224774,
849
+ 264347078,
850
+ 604807628,
851
+ 770255983,
852
+ 1249150122,
853
+ 1555081692,
854
+ 1996064986,
855
+ 2554220882,
856
+ 2821834349,
857
+ 2952996808,
858
+ 3210313671,
859
+ 3336571891,
860
+ 3584528711,
861
+ 113926993,
862
+ 338241895,
863
+ 666307205,
864
+ 773529912,
865
+ 1294757372,
866
+ 1396182291,
867
+ 1695183700,
868
+ 1986661051,
869
+ 2177026350,
870
+ 2456956037,
871
+ 2730485921,
872
+ 2820302411,
873
+ 3259730800,
874
+ 3345764771,
875
+ 3516065817,
876
+ 3600352804,
877
+ 4094571909,
878
+ 275423344,
879
+ 430227734,
880
+ 506948616,
881
+ 659060556,
882
+ 883997877,
883
+ 958139571,
884
+ 1322822218,
885
+ 1537002063,
886
+ 1747873779,
887
+ 1955562222,
888
+ 2024104815,
889
+ 2227730452,
890
+ 2361852424,
891
+ 2428436474,
892
+ 2756734187,
893
+ 3204031479,
894
+ 3329325298
895
+ ]), R = /* @__PURE__ */ new Uint32Array(64);
896
+ class Ce extends ne {
897
+ constructor(t) {
898
+ super(64, t, 8, !1);
899
+ }
900
+ get() {
901
+ const { A: t, B: n, C: s, D: i, E: r, F: a, G: c, H: u } = this;
902
+ return [t, n, s, i, r, a, c, u];
903
+ }
904
+ // prettier-ignore
905
+ set(t, n, s, i, r, a, c, u) {
906
+ this.A = t | 0, this.B = n | 0, this.C = s | 0, this.D = i | 0, this.E = r | 0, this.F = a | 0, this.G = c | 0, this.H = u | 0;
907
+ }
908
+ process(t, n) {
909
+ for (let o = 0; o < 16; o++, n += 4)
910
+ R[o] = t.getUint32(n, !1);
911
+ for (let o = 16; o < 64; o++) {
912
+ const d = R[o - 15], x = R[o - 2], y = A(d, 7) ^ A(d, 18) ^ d >>> 3, p = A(x, 17) ^ A(x, 19) ^ x >>> 10;
913
+ R[o] = p + R[o - 7] + y + R[o - 16] | 0;
914
+ }
915
+ let { A: s, B: i, C: r, D: a, E: c, F: u, G: b, H: h } = this;
916
+ for (let o = 0; o < 64; o++) {
917
+ const d = A(c, 6) ^ A(c, 11) ^ A(c, 25), x = h + d + _e(c, u, b) + Ue[o] + R[o] | 0, p = (A(s, 2) ^ A(s, 13) ^ A(s, 22)) + Re(s, i, r) | 0;
918
+ h = b, b = u, u = c, c = a + x | 0, a = r, r = i, i = s, s = x + p | 0;
919
+ }
920
+ s = s + this.A | 0, i = i + this.B | 0, r = r + this.C | 0, a = a + this.D | 0, c = c + this.E | 0, u = u + this.F | 0, b = b + this.G | 0, h = h + this.H | 0, this.set(s, i, r, a, c, u, b, h);
921
+ }
922
+ roundClean() {
923
+ U(R);
924
+ }
925
+ destroy() {
926
+ this.set(0, 0, 0, 0, 0, 0, 0, 0), U(this.buffer);
927
+ }
928
+ }
929
+ class Ge extends Ce {
930
+ constructor() {
931
+ super(32);
932
+ // We cannot use array here since array allows indexing by variable
933
+ // which means optimizer/compiler cannot use registers.
934
+ l(this, "A", _[0] | 0);
935
+ l(this, "B", _[1] | 0);
936
+ l(this, "C", _[2] | 0);
937
+ l(this, "D", _[3] | 0);
938
+ l(this, "E", _[4] | 0);
939
+ l(this, "F", _[5] | 0);
940
+ l(this, "G", _[6] | 0);
941
+ l(this, "H", _[7] | 0);
942
+ }
943
+ }
944
+ const se = Ne([
945
+ "0x428a2f98d728ae22",
946
+ "0x7137449123ef65cd",
947
+ "0xb5c0fbcfec4d3b2f",
948
+ "0xe9b5dba58189dbbc",
949
+ "0x3956c25bf348b538",
950
+ "0x59f111f1b605d019",
951
+ "0x923f82a4af194f9b",
952
+ "0xab1c5ed5da6d8118",
953
+ "0xd807aa98a3030242",
954
+ "0x12835b0145706fbe",
955
+ "0x243185be4ee4b28c",
956
+ "0x550c7dc3d5ffb4e2",
957
+ "0x72be5d74f27b896f",
958
+ "0x80deb1fe3b1696b1",
959
+ "0x9bdc06a725c71235",
960
+ "0xc19bf174cf692694",
961
+ "0xe49b69c19ef14ad2",
962
+ "0xefbe4786384f25e3",
963
+ "0x0fc19dc68b8cd5b5",
964
+ "0x240ca1cc77ac9c65",
965
+ "0x2de92c6f592b0275",
966
+ "0x4a7484aa6ea6e483",
967
+ "0x5cb0a9dcbd41fbd4",
968
+ "0x76f988da831153b5",
969
+ "0x983e5152ee66dfab",
970
+ "0xa831c66d2db43210",
971
+ "0xb00327c898fb213f",
972
+ "0xbf597fc7beef0ee4",
973
+ "0xc6e00bf33da88fc2",
974
+ "0xd5a79147930aa725",
975
+ "0x06ca6351e003826f",
976
+ "0x142929670a0e6e70",
977
+ "0x27b70a8546d22ffc",
978
+ "0x2e1b21385c26c926",
979
+ "0x4d2c6dfc5ac42aed",
980
+ "0x53380d139d95b3df",
981
+ "0x650a73548baf63de",
982
+ "0x766a0abb3c77b2a8",
983
+ "0x81c2c92e47edaee6",
984
+ "0x92722c851482353b",
985
+ "0xa2bfe8a14cf10364",
986
+ "0xa81a664bbc423001",
987
+ "0xc24b8b70d0f89791",
988
+ "0xc76c51a30654be30",
989
+ "0xd192e819d6ef5218",
990
+ "0xd69906245565a910",
991
+ "0xf40e35855771202a",
992
+ "0x106aa07032bbd1b8",
993
+ "0x19a4c116b8d2d0c8",
994
+ "0x1e376c085141ab53",
995
+ "0x2748774cdf8eeb99",
996
+ "0x34b0bcb5e19b48a8",
997
+ "0x391c0cb3c5c95a63",
998
+ "0x4ed8aa4ae3418acb",
999
+ "0x5b9cca4f7763e373",
1000
+ "0x682e6ff3d6b2b8a3",
1001
+ "0x748f82ee5defb2fc",
1002
+ "0x78a5636f43172f60",
1003
+ "0x84c87814a1f0ab72",
1004
+ "0x8cc702081a6439ec",
1005
+ "0x90befffa23631e28",
1006
+ "0xa4506cebde82bde9",
1007
+ "0xbef9a3f7b2c67915",
1008
+ "0xc67178f2e372532b",
1009
+ "0xca273eceea26619c",
1010
+ "0xd186b8c721c0c207",
1011
+ "0xeada7dd6cde0eb1e",
1012
+ "0xf57d4f7fee6ed178",
1013
+ "0x06f067aa72176fba",
1014
+ "0x0a637dc5a2c898a6",
1015
+ "0x113f9804bef90dae",
1016
+ "0x1b710b35131c471b",
1017
+ "0x28db77f523047d84",
1018
+ "0x32caab7b40c72493",
1019
+ "0x3c9ebe0a15c9bebc",
1020
+ "0x431d67c49c100d4c",
1021
+ "0x4cc5d4becb3e42b6",
1022
+ "0x597f299cfc657e2a",
1023
+ "0x5fcb6fab3ad6faec",
1024
+ "0x6c44198c4a475817"
1025
+ ].map((e) => BigInt(e))), Ve = se[0], ke = se[1], w = /* @__PURE__ */ new Uint32Array(80), N = /* @__PURE__ */ new Uint32Array(80);
1026
+ class Me extends ne {
1027
+ constructor(t) {
1028
+ super(128, t, 16, !1);
1029
+ }
1030
+ // prettier-ignore
1031
+ get() {
1032
+ const { Ah: t, Al: n, Bh: s, Bl: i, Ch: r, Cl: a, Dh: c, Dl: u, Eh: b, El: h, Fh: o, Fl: d, Gh: x, Gl: y, Hh: p, Hl: P } = this;
1033
+ return [t, n, s, i, r, a, c, u, b, h, o, d, x, y, p, P];
1034
+ }
1035
+ // prettier-ignore
1036
+ set(t, n, s, i, r, a, c, u, b, h, o, d, x, y, p, P) {
1037
+ this.Ah = t | 0, this.Al = n | 0, this.Bh = s | 0, this.Bl = i | 0, this.Ch = r | 0, this.Cl = a | 0, this.Dh = c | 0, this.Dl = u | 0, this.Eh = b | 0, this.El = h | 0, this.Fh = o | 0, this.Fl = d | 0, this.Gh = x | 0, this.Gl = y | 0, this.Hh = p | 0, this.Hl = P | 0;
1038
+ }
1039
+ process(t, n) {
1040
+ for (let f = 0; f < 16; f++, n += 4)
1041
+ w[f] = t.getUint32(n), N[f] = t.getUint32(n += 4);
1042
+ for (let f = 16; f < 80; f++) {
1043
+ const I = w[f - 15] | 0, S = N[f - 15] | 0, F = B(I, S, 1) ^ B(I, S, 8) ^ Z(I, S, 7), W = H(I, S, 1) ^ H(I, S, 8) ^ Q(I, S, 7), m = w[f - 2] | 0, E = N[f - 2] | 0, C = B(m, E, 19) ^ k(m, E, 61) ^ Z(m, E, 6), K = H(m, E, 19) ^ M(m, E, 61) ^ Q(m, E, 6), G = ve(W, K, N[f - 7], N[f - 16]), q = Be(G, F, C, w[f - 7], w[f - 16]);
1044
+ w[f] = q | 0, N[f] = G | 0;
1045
+ }
1046
+ let { Ah: s, Al: i, Bh: r, Bl: a, Ch: c, Cl: u, Dh: b, Dl: h, Eh: o, El: d, Fh: x, Fl: y, Gh: p, Gl: P, Hh: O, Hl: D } = this;
1047
+ for (let f = 0; f < 80; f++) {
1048
+ const I = B(o, d, 14) ^ B(o, d, 18) ^ k(o, d, 41), S = H(o, d, 14) ^ H(o, d, 18) ^ M(o, d, 41), F = o & x ^ ~o & p, W = d & y ^ ~d & P, m = He(D, S, W, ke[f], N[f]), E = De(m, O, I, F, Ve[f], w[f]), C = m | 0, K = B(s, i, 28) ^ k(s, i, 34) ^ k(s, i, 39), G = H(s, i, 28) ^ M(s, i, 34) ^ M(s, i, 39), q = s & r ^ s & c ^ r & c, ie = i & a ^ i & u ^ a & u;
1049
+ O = p | 0, D = P | 0, p = x | 0, P = y | 0, x = o | 0, y = d | 0, { h: o, l: d } = g(b | 0, h | 0, E | 0, C | 0), b = c | 0, h = u | 0, c = r | 0, u = a | 0, r = s | 0, a = i | 0;
1050
+ const j = Oe(C, G, ie);
1051
+ s = Le(j, E, K, q), i = j | 0;
1052
+ }
1053
+ ({ h: s, l: i } = g(this.Ah | 0, this.Al | 0, s | 0, i | 0)), { h: r, l: a } = g(this.Bh | 0, this.Bl | 0, r | 0, a | 0), { h: c, l: u } = g(this.Ch | 0, this.Cl | 0, c | 0, u | 0), { h: b, l: h } = g(this.Dh | 0, this.Dl | 0, b | 0, h | 0), { h: o, l: d } = g(this.Eh | 0, this.El | 0, o | 0, d | 0), { h: x, l: y } = g(this.Fh | 0, this.Fl | 0, x | 0, y | 0), { h: p, l: P } = g(this.Gh | 0, this.Gl | 0, p | 0, P | 0), { h: O, l: D } = g(this.Hh | 0, this.Hl | 0, O | 0, D | 0), this.set(s, i, r, a, c, u, b, h, o, d, x, y, p, P, O, D);
1054
+ }
1055
+ roundClean() {
1056
+ U(w, N);
1057
+ }
1058
+ destroy() {
1059
+ U(this.buffer), this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
1060
+ }
1061
+ }
1062
+ class Fe extends Me {
1063
+ constructor() {
1064
+ super(64);
1065
+ l(this, "Ah", T[0] | 0);
1066
+ l(this, "Al", T[1] | 0);
1067
+ l(this, "Bh", T[2] | 0);
1068
+ l(this, "Bl", T[3] | 0);
1069
+ l(this, "Ch", T[4] | 0);
1070
+ l(this, "Cl", T[5] | 0);
1071
+ l(this, "Dh", T[6] | 0);
1072
+ l(this, "Dl", T[7] | 0);
1073
+ l(this, "Eh", T[8] | 0);
1074
+ l(this, "El", T[9] | 0);
1075
+ l(this, "Fh", T[10] | 0);
1076
+ l(this, "Fl", T[11] | 0);
1077
+ l(this, "Gh", T[12] | 0);
1078
+ l(this, "Gl", T[13] | 0);
1079
+ l(this, "Hh", T[14] | 0);
1080
+ l(this, "Hl", T[15] | 0);
1081
+ }
1082
+ }
1083
+ const rt = /* @__PURE__ */ ee(
1084
+ () => new Ge(),
1085
+ /* @__PURE__ */ te(1)
1086
+ ), at = /* @__PURE__ */ ee(
1087
+ () => new Fe(),
1088
+ /* @__PURE__ */ te(3)
1089
+ );
1090
+ export {
1091
+ Ke as B,
1092
+ he as D,
1093
+ ne as H,
1094
+ qe as J,
1095
+ $e as P,
1096
+ Pe as R,
1097
+ Te as V,
1098
+ L as a,
1099
+ v as b,
1100
+ Je as c,
1101
+ je as d,
1102
+ Ye as e,
1103
+ J as f,
1104
+ U as g,
1105
+ X as h,
1106
+ ee as i,
1107
+ Ne as j,
1108
+ Y as k,
1109
+ Ze as l,
1110
+ me as m,
1111
+ tt as n,
1112
+ nt as o,
1113
+ st as p,
1114
+ it as q,
1115
+ ze as r,
1116
+ rt as s,
1117
+ $ as t,
1118
+ Xe as u,
1119
+ et as v,
1120
+ Qe as w,
1121
+ at as x
1122
+ };
1123
+ //# sourceMappingURL=sha2-ZzfZqQSw.js.map