@babylonlabs-io/ts-sdk 0.33.2 → 0.33.4

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 (147) hide show
  1. package/dist/BTCVaultRegistry.abi-DbJ5lsFJ.js +417 -0
  2. package/dist/BTCVaultRegistry.abi-DbJ5lsFJ.js.map +1 -0
  3. package/dist/BTCVaultRegistry.abi-ZdPpION2.cjs +2 -0
  4. package/dist/BTCVaultRegistry.abi-ZdPpION2.cjs.map +1 -0
  5. package/dist/PayoutManager-C9XHKZ5j.js +200 -0
  6. package/dist/PayoutManager-C9XHKZ5j.js.map +1 -0
  7. package/dist/PayoutManager-DDnNB0mj.cjs +2 -0
  8. package/dist/PayoutManager-DDnNB0mj.cjs.map +1 -0
  9. package/dist/PeginManager-BXg2S1mH.cjs +2 -0
  10. package/dist/PeginManager-BXg2S1mH.cjs.map +1 -0
  11. package/dist/{PeginManager-BtXhdqkm.js → PeginManager-C5HaMAcw.js} +367 -480
  12. package/dist/PeginManager-C5HaMAcw.js.map +1 -0
  13. package/dist/ProtocolParams.abi-BmvHwQJV.cjs +2 -0
  14. package/dist/ProtocolParams.abi-BmvHwQJV.cjs.map +1 -0
  15. package/dist/ProtocolParams.abi-DXu8L0Fn.js +382 -0
  16. package/dist/ProtocolParams.abi-DXu8L0Fn.js.map +1 -0
  17. package/dist/{bitcoin-0_T6KJON.js → bitcoin-B0S8SHCX.js} +24 -20
  18. package/dist/bitcoin-B0S8SHCX.js.map +1 -0
  19. package/dist/bitcoin-B3aqjuMP.cjs +2 -0
  20. package/dist/bitcoin-B3aqjuMP.cjs.map +1 -0
  21. package/dist/buildAndBroadcastRefund-CIPPpchL.cjs +2 -0
  22. package/dist/buildAndBroadcastRefund-CIPPpchL.cjs.map +1 -0
  23. package/dist/buildAndBroadcastRefund-D_QlvCsw.js +777 -0
  24. package/dist/buildAndBroadcastRefund-D_QlvCsw.js.map +1 -0
  25. package/dist/challengeAssert-BzxQmdZy.js +128 -0
  26. package/dist/challengeAssert-BzxQmdZy.js.map +1 -0
  27. package/dist/challengeAssert-Yyyj-EdR.cjs +2 -0
  28. package/dist/challengeAssert-Yyyj-EdR.cjs.map +1 -0
  29. package/dist/errors-9AkghWyk.js +22 -0
  30. package/dist/errors-9AkghWyk.js.map +1 -0
  31. package/dist/errors-BP73_stm.cjs +2 -0
  32. package/dist/errors-BP73_stm.cjs.map +1 -0
  33. package/dist/errors-Bu0H-dZD.cjs +2 -0
  34. package/dist/errors-Bu0H-dZD.cjs.map +1 -0
  35. package/dist/errors-CznAK5NB.js +96 -0
  36. package/dist/errors-CznAK5NB.js.map +1 -0
  37. package/dist/index.cjs +1 -1
  38. package/dist/index.js +156 -146
  39. package/dist/index.js.map +1 -1
  40. package/dist/mempoolApi-CAIge7Nj.js +205 -0
  41. package/dist/mempoolApi-CAIge7Nj.js.map +1 -0
  42. package/dist/mempoolApi-YNkKjQCU.cjs +2 -0
  43. package/dist/mempoolApi-YNkKjQCU.cjs.map +1 -0
  44. package/dist/noPayout-BXeUw0Qq.cjs +2 -0
  45. package/dist/noPayout-BXeUw0Qq.cjs.map +1 -0
  46. package/dist/noPayout-DBX6G96_.js +141 -0
  47. package/dist/noPayout-DBX6G96_.js.map +1 -0
  48. package/dist/payout-BNFMBXS6.js +193 -0
  49. package/dist/payout-BNFMBXS6.js.map +1 -0
  50. package/dist/payout-DQ_fmJUA.cjs +2 -0
  51. package/dist/payout-DQ_fmJUA.cjs.map +1 -0
  52. package/dist/peginInput-C2QPvuhR.js +177 -0
  53. package/dist/peginInput-C2QPvuhR.js.map +1 -0
  54. package/dist/peginInput-tbw9BpZy.cjs +2 -0
  55. package/dist/peginInput-tbw9BpZy.cjs.map +1 -0
  56. package/dist/peginState-BijNNT15.cjs +2 -0
  57. package/dist/peginState-BijNNT15.cjs.map +1 -0
  58. package/dist/peginState-CBAlxgXk.js +51 -0
  59. package/dist/peginState-CBAlxgXk.js.map +1 -0
  60. package/dist/psbtInputFields-2224j2ZY.js +128 -0
  61. package/dist/psbtInputFields-2224j2ZY.js.map +1 -0
  62. package/dist/psbtInputFields-B1lrwYzH.cjs +2 -0
  63. package/dist/psbtInputFields-B1lrwYzH.cjs.map +1 -0
  64. package/dist/reservation-CHUGW0F_.js +142 -0
  65. package/dist/reservation-CHUGW0F_.js.map +1 -0
  66. package/dist/reservation-ho7mjW3X.cjs +2 -0
  67. package/dist/reservation-ho7mjW3X.cjs.map +1 -0
  68. package/dist/signing-Bnsro0hE.cjs +2 -0
  69. package/dist/signing-Bnsro0hE.cjs.map +1 -0
  70. package/dist/signing-DaLvGwQe.js +16 -0
  71. package/dist/signing-DaLvGwQe.js.map +1 -0
  72. package/dist/tbv/core/clients/index.cjs +1 -1
  73. package/dist/tbv/core/clients/index.js +31 -30
  74. package/dist/tbv/core/clients/index.js.map +1 -1
  75. package/dist/tbv/core/contracts/index.cjs +2 -0
  76. package/dist/tbv/core/contracts/index.cjs.map +1 -0
  77. package/dist/tbv/core/contracts/index.js +14 -0
  78. package/dist/tbv/core/contracts/index.js.map +1 -0
  79. package/dist/tbv/core/index.cjs +1 -1
  80. package/dist/tbv/core/index.js +156 -146
  81. package/dist/tbv/core/index.js.map +1 -1
  82. package/dist/tbv/core/managers/PayoutManager.d.ts +8 -4
  83. package/dist/tbv/core/managers/PayoutManager.d.ts.map +1 -1
  84. package/dist/tbv/core/managers/PeginManager.d.ts +15 -1
  85. package/dist/tbv/core/managers/PeginManager.d.ts.map +1 -1
  86. package/dist/tbv/core/managers/index.cjs +2 -0
  87. package/dist/tbv/core/managers/index.cjs.map +1 -0
  88. package/dist/tbv/core/managers/index.js +7 -0
  89. package/dist/tbv/core/managers/index.js.map +1 -0
  90. package/dist/tbv/core/primitives/index.cjs +1 -1
  91. package/dist/tbv/core/primitives/index.js +31 -29
  92. package/dist/tbv/core/primitives/index.js.map +1 -1
  93. package/dist/tbv/core/primitives/utils/bitcoin.d.ts +6 -4
  94. package/dist/tbv/core/primitives/utils/bitcoin.d.ts.map +1 -1
  95. package/dist/tbv/core/services/index.cjs +1 -1
  96. package/dist/tbv/core/services/index.js +28 -27
  97. package/dist/tbv/core/services/index.js.map +1 -1
  98. package/dist/tbv/core/utils/index.cjs +1 -1
  99. package/dist/tbv/core/utils/index.js +21 -20
  100. package/dist/tbv/core/utils/index.js.map +1 -1
  101. package/dist/tbv/index.cjs +1 -1
  102. package/dist/tbv/index.js +156 -146
  103. package/dist/tbv/index.js.map +1 -1
  104. package/dist/testing/index.cjs +1 -1
  105. package/dist/testing/index.js +1 -1
  106. package/dist/types-ByW6nSLj.js +318 -0
  107. package/dist/types-ByW6nSLj.js.map +1 -0
  108. package/dist/types-CfCZyfid.cjs +2 -0
  109. package/dist/types-CfCZyfid.cjs.map +1 -0
  110. package/dist/vault-registry-reader-OK2V08tk.cjs +2 -0
  111. package/dist/vault-registry-reader-OK2V08tk.cjs.map +1 -0
  112. package/dist/{vault-registry-reader-eiBfG4uQ.js → vault-registry-reader-WiNVOsnD.js} +263 -840
  113. package/dist/vault-registry-reader-WiNVOsnD.js.map +1 -0
  114. package/package.json +11 -1
  115. package/dist/PeginManager-BtXhdqkm.js.map +0 -1
  116. package/dist/PeginManager-ztgWQqza.cjs +0 -2
  117. package/dist/PeginManager-ztgWQqza.cjs.map +0 -1
  118. package/dist/bitcoin-0_T6KJON.js.map +0 -1
  119. package/dist/bitcoin-EYBKDtEW.cjs +0 -2
  120. package/dist/bitcoin-EYBKDtEW.cjs.map +0 -1
  121. package/dist/buildAndBroadcastRefund-Ci_pVTNu.js +0 -965
  122. package/dist/buildAndBroadcastRefund-Ci_pVTNu.js.map +0 -1
  123. package/dist/buildAndBroadcastRefund-DKr9hbDn.cjs +0 -2
  124. package/dist/buildAndBroadcastRefund-DKr9hbDn.cjs.map +0 -1
  125. package/dist/challengeAssert-06GLZtV8.cjs +0 -2
  126. package/dist/challengeAssert-06GLZtV8.cjs.map +0 -1
  127. package/dist/challengeAssert-KGVKQh0J.js +0 -298
  128. package/dist/challengeAssert-KGVKQh0J.js.map +0 -1
  129. package/dist/noPayout-BmMd4NNH.js +0 -327
  130. package/dist/noPayout-BmMd4NNH.js.map +0 -1
  131. package/dist/noPayout-Bp2TYA_X.cjs +0 -2
  132. package/dist/noPayout-Bp2TYA_X.cjs.map +0 -1
  133. package/dist/psbtInputFields-BLi7Ta-T.cjs +0 -2
  134. package/dist/psbtInputFields-BLi7Ta-T.cjs.map +0 -1
  135. package/dist/psbtInputFields-DPCFHgGd.js +0 -264
  136. package/dist/psbtInputFields-DPCFHgGd.js.map +0 -1
  137. package/dist/signing-BZigafm0.js +0 -64
  138. package/dist/signing-BZigafm0.js.map +0 -1
  139. package/dist/signing-DHSXjhLM.cjs +0 -2
  140. package/dist/signing-DHSXjhLM.cjs.map +0 -1
  141. package/dist/types-PthVHz5q.cjs +0 -2
  142. package/dist/types-PthVHz5q.cjs.map +0 -1
  143. package/dist/types-SYvSQWnc.js +0 -732
  144. package/dist/types-SYvSQWnc.js.map +0 -1
  145. package/dist/vault-registry-reader-CmDdymw4.cjs +0 -2
  146. package/dist/vault-registry-reader-CmDdymw4.cjs.map +0 -1
  147. package/dist/vault-registry-reader-eiBfG4uQ.js.map +0 -1
package/dist/tbv/index.js CHANGED
@@ -1,156 +1,166 @@
1
- import { h as e, g as t, d as r, a as o, b as i, c as n, e as l, f as u } from "../challengeAssert-KGVKQh0J.js";
2
- import { computeMinClaimValue as P, deriveVaultId as p } from "@babylonlabs-io/babylon-tbv-rust-wasm";
3
- import { a as T, d as S, c as E, b as A, f as R, e as g } from "../noPayout-BmMd4NNH.js";
4
- import { d as m, a as x, e as b, f as I, g as f, h as C, i as v, b as U, p as O, s as V, t as F, u as h, v as y } from "../bitcoin-0_T6KJON.js";
5
- import { C as D, P as B, a as M, c as H, g as L } from "../signing-BZigafm0.js";
6
- import { B as W, H as X, K, M as w, T as G } from "../validation-CxqROCno.js";
7
- import { B as J, C as Z, P as j, R as q, a as z, m as Q, h as $, n as aa, i as sa, l as ea, k as ta, r as ra, b as oa, s as ia, v as na, g as la, d as ua, c as da, j as Pa, e as pa, f as ca, w as Ta } from "../buildAndBroadcastRefund-Ci_pVTNu.js";
8
- import { B as Ea, D as Aa, F as Ra, L as ga, M as _a, P as ma, b as xa, a as ba, S as Ia, T as fa, W as Ca, f as va, c as Ua, p as Oa, r as Va } from "../fundPeginTransaction-oV-dNJOU.js";
9
- import { B as ha, U as ya, a as Na, f as Da, c as Ba, e as Ma, g as Ha, i as La, h as ka, s as Wa, b as Xa, d as Ka, v as wa } from "../psbtInputFields-DPCFHgGd.js";
10
- import { C as Ya, P as Ja, V as Za, k as ja, l as qa, c as za, m as Qa, d as $a, b as as, f as ss, j as es, e as ts, g as rs, h as os, i as is, a as ns, p as ls } from "../PeginManager-BtXhdqkm.js";
11
- import { A as ds, M as Ps, P as ps, S as cs, V as Ts, n as Ss, o as Es, q as As, s as Rs, h as gs, j as _s, l as ms, g as xs, a as bs, b as Is, c as fs, d as Cs, e as vs, f as Us, m as Os, p as Vs, r as Fs, v as hs, i as ys, k as Ns } from "../vault-registry-reader-eiBfG4uQ.js";
12
- import { B as Bs, D as Ms, b as Hs, J as Ls, a as ks, d as Ws, P as Xs, R as Ks, c as ws, V as Gs } from "../types-SYvSQWnc.js";
1
+ import { a as s, b as t, c as r } from "../challengeAssert-BzxQmdZy.js";
2
+ import { computeMinClaimValue as i, deriveVaultId as n } from "@babylonlabs-io/babylon-tbv-rust-wasm";
3
+ import { c as u, a as d, b as p, e as P, f as c } from "../peginInput-C2QPvuhR.js";
4
+ import { a as S, b as E } from "../noPayout-DBX6G96_.js";
5
+ import { a as R, b as g, c as m, e as _ } from "../payout-BNFMBXS6.js";
6
+ import { d as f, a as b, e as I, f as v, g as C, h as U, i as O, b as V, p as F, s as y, t as h, u as N, v as D } from "../bitcoin-B0S8SHCX.js";
7
+ import { c as M } from "../signing-DaLvGwQe.js";
8
+ import { B as L, H as k, K as W, M as X, T as K } from "../validation-CxqROCno.js";
9
+ import { P as G, V as Y, f as J, g as Z, c as z, h as j, d as q, e as Q, a as $, b as aa } from "../PeginManager-C5HaMAcw.js";
10
+ import { P as sa, c as ta, v as ra } from "../PayoutManager-C9XHKZ5j.js";
11
+ import { A as ia, P as na } from "../ProtocolParams.abi-DXu8L0Fn.js";
12
+ import { B as ua } from "../BTCVaultRegistry.abi-DbJ5lsFJ.js";
13
+ import { C as pa, e as Pa, g as ca, h as Ta, i as Sa } from "../errors-CznAK5NB.js";
14
+ import { B as Aa, D as Ra, F as ga, L as ma, M as _a, P as xa, b as fa, a as ba, S as Ia, T as va, W as Ca, f as Ua, c as Oa, p as Va, r as Fa } from "../fundPeginTransaction-oV-dNJOU.js";
15
+ import { U as ha, a as Na, c as Da, e as Ba, s as Ma, v as Ha } from "../reservation-CHUGW0F_.js";
16
+ import { B as ka, c as Wa, g as Xa, d as Ka, b as wa, s as Ga, a as Ya } from "../psbtInputFields-2224j2ZY.js";
17
+ import { M as Za, g as za, a as ja, b as qa, c as Qa, d as $a, e as ae, f as ee, p as se } from "../mempoolApi-CAIge7Nj.js";
18
+ import { S as re, V as oe, f as ie, g as ne, h as le, i as ue, a as de, c as pe, e as Pe, p as ce, r as Te, v as Se, b as Ee, d as Ae } from "../vault-registry-reader-WiNVOsnD.js";
19
+ import { D as ge, b as me, J as _e, a as xe, d as fe, P as be, R as Ie, c as ve, V as Ce } from "../types-ByW6nSLj.js";
20
+ import { i as Oe, p as Ve } from "../errors-9AkghWyk.js";
21
+ import { B as ye, C as he, R as Ne, a as De, k as Be, l as Me, i as He, j as Le, h as ke, r as We, b as Xe, s as Ke, v as we, g as Ge, d as Ye, c as Je, e as Ze, f as ze, w as je } from "../buildAndBroadcastRefund-D_QlvCsw.js";
22
+ import { C as Qe, P as $e, c as as, g as es } from "../peginState-CBAlxgXk.js";
13
23
  export {
14
- ds as ApplicationRegistryABI,
15
- J as BIP68NotMatureError,
16
- W as BITCOIN_ADDRESS_RE,
17
- Bs as BTCVaultRegistryABI,
18
- Ea as BTC_DUST_SAT,
19
- ha as BitcoinScriptType,
20
- Ya as CONTRACT_ERRORS,
21
- Z as ClaimerPegoutStatusValue,
22
- D as ContractStatus,
23
- Aa as DUST_THRESHOLD,
24
- Ms as DaemonStatus,
25
- Ra as FEE_SAFETY_MARGIN,
26
- X as HEX_RE,
27
- Hs as JSON_RPC_ERROR_CODES,
28
- Ls as JsonRpcClient,
29
- ks as JsonRpcError,
30
- K as KNOWN_SCRIPT_PREFIXES,
31
- ga as LOW_RATE_ESTIMATION_ACCURACY_BUFFER,
24
+ ia as ApplicationRegistryABI,
25
+ ye as BIP68NotMatureError,
26
+ L as BITCOIN_ADDRESS_RE,
27
+ ua as BTCVaultRegistryABI,
28
+ Aa as BTC_DUST_SAT,
29
+ ka as BitcoinScriptType,
30
+ pa as CONTRACT_ERRORS,
31
+ he as ClaimerPegoutStatusValue,
32
+ Qe as ContractStatus,
33
+ Ra as DUST_THRESHOLD,
34
+ ge as DaemonStatus,
35
+ ga as FEE_SAFETY_MARGIN,
36
+ k as HEX_RE,
37
+ me as JSON_RPC_ERROR_CODES,
38
+ _e as JsonRpcClient,
39
+ xe as JsonRpcError,
40
+ W as KNOWN_SCRIPT_PREFIXES,
41
+ ma as LOW_RATE_ESTIMATION_ACCURACY_BUFFER,
32
42
  _a as MAX_NON_LEGACY_OUTPUT_SIZE,
33
- w as MAX_REASONABLE_FEE_SATS,
34
- Ps as MEMPOOL_API_URLS,
35
- ma as P2TR_INPUT_SIZE,
36
- xa as PEGIN_AUTH_ANCHOR_OUTPUTS,
43
+ X as MAX_REASONABLE_FEE_SATS,
44
+ Za as MEMPOOL_API_URLS,
45
+ xa as P2TR_INPUT_SIZE,
46
+ fa as PEGIN_AUTH_ANCHOR_OUTPUTS,
37
47
  ba as PEGIN_FIXED_OUTPUTS,
38
- Ws as POST_WOTS_STATUSES,
39
- Xs as PRE_DEPOSITOR_SIGNATURES_STATES,
40
- j as PayoutManager,
41
- B as PeginAction,
42
- Ja as PeginManager,
43
- ps as ProtocolParamsABI,
44
- q as REFUND_VSIZE,
45
- Ks as RpcErrorCode,
48
+ fe as POST_WOTS_STATUSES,
49
+ be as PRE_DEPOSITOR_SIGNATURES_STATES,
50
+ sa as PayoutManager,
51
+ $e as PeginAction,
52
+ G as PeginManager,
53
+ na as ProtocolParamsABI,
54
+ Ne as REFUND_VSIZE,
55
+ Ie as RpcErrorCode,
46
56
  Ia as SPLIT_TX_FEE_SAFETY_MULTIPLIER,
47
- cs as ServerIdentityError,
48
- G as TXID_RE,
49
- fa as TX_BUFFER_SIZE_OVERHEAD,
50
- ya as UtxoNotAvailableError,
51
- Za as VAULT_APP_NAME,
52
- ws as VP_TERMINAL_STATUSES,
53
- Gs as VP_TRANSIENT_STATUSES,
54
- Ts as VaultProviderRpcClient,
55
- Ss as ViemProtocolParamsReader,
56
- Es as ViemUniversalChallengerReader,
57
- As as ViemVaultKeeperReader,
58
- Rs as ViemVaultRegistryReader,
59
- gs as VpResponseValidationError,
60
- _s as VpTokenRegistry,
57
+ re as ServerIdentityError,
58
+ K as TXID_RE,
59
+ va as TX_BUFFER_SIZE_OVERHEAD,
60
+ ha as UtxoNotAvailableError,
61
+ Y as VAULT_APP_NAME,
62
+ ve as VP_TERMINAL_STATUSES,
63
+ Ce as VP_TRANSIENT_STATUSES,
64
+ oe as VaultProviderRpcClient,
65
+ ie as ViemProtocolParamsReader,
66
+ ne as ViemUniversalChallengerReader,
67
+ le as ViemVaultKeeperReader,
68
+ ue as ViemVaultRegistryReader,
69
+ de as VpResponseValidationError,
70
+ pe as VpTokenRegistry,
61
71
  Ca as WALLET_RELAY_FEE_RATE_THRESHOLD,
62
- z as activateVault,
63
- T as assertPayoutOutputMatchesRegistered,
72
+ De as activateVault,
73
+ R as assertPayoutOutputMatchesRegistered,
64
74
  Na as assertUtxosAvailable,
65
- Q as buildAndBroadcastRefund,
66
- e as buildChallengeAssertPsbt,
75
+ Be as buildAndBroadcastRefund,
76
+ s as buildChallengeAssertPsbt,
67
77
  t as buildDepositorPayoutPsbt,
68
- ja as buildFundingOutpointsCommitment,
78
+ J as buildFundingOutpointsCommitment,
69
79
  S as buildNoPayoutPsbt,
70
- E as buildPayoutPsbt,
71
- r as buildPeginInputPsbt,
72
- o as buildPeginTxFromFundedPrePegin,
73
- i as buildPrePeginPsbt,
74
- A as buildRefundPsbt,
75
- qa as buildVaultContext,
76
- Da as calculateBtcTxHash,
77
- M as canPerformAction,
78
- Ba as collectReservedUtxoRefs,
79
- $ as computeHashlock,
80
- P as computeMinClaimValue,
81
- n as computeNumLocalChallengers,
82
- za as computeWotsBlockPublicKeysHash,
83
- ms as createAuthenticatedVpClient,
84
- R as createPayoutScript,
85
- H as createTaprootScriptPathSignOptions,
86
- m as deriveNativeSegwitAddress,
87
- x as deriveTaprootAddress,
88
- p as deriveVaultId,
89
- Qa as deriveVaultRoot,
90
- $a as deriveWotsBlocksFromSeed,
91
- b as ensureHexPrefix,
92
- aa as estimateRefundFeeSats,
93
- as as expandAuthAnchor,
94
- ss as expandHashlockSecret,
95
- es as expandWotsSeed,
96
- ts as extractErrorData,
97
- Ma as extractInputsFromTransaction,
98
- g as extractPayoutSignature,
99
- l as extractPeginInputSignature,
100
- u as finalizePeginInputPsbt,
101
- I as formatSatoshisToBtc,
102
- va as fundPeginTransaction,
103
- xs as getAddressTxs,
104
- bs as getAddressUtxos,
105
- rs as getContractErrorMessage,
106
- Ha as getDustThreshold,
107
- Is as getMempoolApiUrl,
108
- f as getNetwork,
109
- fs as getNetworkFees,
110
- L as getPeginProtocolState,
111
- La as getPsbtInputFields,
112
- ka as getScriptType,
113
- Cs as getTxHex,
114
- vs as getTxInfo,
115
- Us as getUtxoInfo,
116
- os as handleContractError,
117
- C as hexToUint8Array,
118
- v as isAddressFromPublicKey,
119
- sa as isDepositAmountValid,
120
- is as isKnownContractError,
121
- ea as isPegoutTerminalStatus,
122
- ta as isRecognizedPegoutStatus,
123
- U as isValidHex,
124
- ns as isWotsMismatchError,
125
- ls as parseFundingOutpointsFromTx,
126
- Ua as parseUnfundedWasmTransaction,
127
- Oa as peginOutputCount,
128
- Os as primeVpTokenRegistry,
129
- O as processPublicKeyToXOnly,
130
- Vs as pushTx,
131
- Va as rateBasedTxBufferFee,
132
- Fs as resolveProtocolAddresses,
133
- ra as runDepositorPresignFlow,
134
- Wa as selectUtxosForDeposit,
135
- Xa as selectUtxosForPegin,
136
- Ka as shouldAddChangeOutput,
137
- oa as signDepositorGraph,
138
- V as stripHexPrefix,
139
- ia as submitWotsPublicKey,
140
- F as toXOnly,
141
- h as uint8ArrayToHex,
142
- na as validateDepositAmount,
143
- la as validateMultiVaultDepositInputs,
144
- ua as validateProviderSelection,
145
- da as validateRemainingCapacity,
146
- hs as validateRequestDepositorClaimerArtifactsResponse,
147
- Pa as validateSecretAgainstHashlock,
148
- wa as validateUtxosAvailable,
149
- pa as validateVaultAmounts,
150
- ca as validateVaultProviderPubkey,
151
- y as validateWalletPubkey,
152
- ys as verifyServerIdentity,
153
- Ns as vpTokenRegistry,
154
- Ta as waitForPeginStatus
80
+ g as buildPayoutPsbt,
81
+ u as buildPeginInputPsbt,
82
+ d as buildPeginTxFromFundedPrePegin,
83
+ p as buildPrePeginPsbt,
84
+ E as buildRefundPsbt,
85
+ Z as buildVaultContext,
86
+ Wa as calculateBtcTxHash,
87
+ as as canPerformAction,
88
+ Da as collectReservedUtxoRefs,
89
+ ta as computeHashlock,
90
+ i as computeMinClaimValue,
91
+ r as computeNumLocalChallengers,
92
+ z as computeWotsBlockPublicKeysHash,
93
+ Pe as createAuthenticatedVpClient,
94
+ m as createPayoutScript,
95
+ M as createTaprootScriptPathSignOptions,
96
+ f as deriveNativeSegwitAddress,
97
+ b as deriveTaprootAddress,
98
+ n as deriveVaultId,
99
+ j as deriveVaultRoot,
100
+ q as deriveWotsBlocksFromSeed,
101
+ I as ensureHexPrefix,
102
+ Me as estimateRefundFeeSats,
103
+ Q as expandAuthAnchor,
104
+ $ as expandHashlockSecret,
105
+ aa as expandWotsSeed,
106
+ Pa as extractErrorData,
107
+ Ba as extractInputsFromTransaction,
108
+ _ as extractPayoutSignature,
109
+ P as extractPeginInputSignature,
110
+ c as finalizePeginInputPsbt,
111
+ v as formatSatoshisToBtc,
112
+ Ua as fundPeginTransaction,
113
+ za as getAddressTxs,
114
+ ja as getAddressUtxos,
115
+ ca as getContractErrorMessage,
116
+ Xa as getDustThreshold,
117
+ qa as getMempoolApiUrl,
118
+ C as getNetwork,
119
+ Qa as getNetworkFees,
120
+ es as getPeginProtocolState,
121
+ Ka as getPsbtInputFields,
122
+ wa as getScriptType,
123
+ $a as getTxHex,
124
+ ae as getTxInfo,
125
+ ee as getUtxoInfo,
126
+ Ta as handleContractError,
127
+ U as hexToUint8Array,
128
+ O as isAddressFromPublicKey,
129
+ He as isDepositAmountValid,
130
+ Sa as isKnownContractError,
131
+ Le as isPegoutTerminalStatus,
132
+ ke as isRecognizedPegoutStatus,
133
+ V as isValidHex,
134
+ Oe as isWotsMismatchError,
135
+ Ve as parseFundingOutpointsFromTx,
136
+ Oa as parseUnfundedWasmTransaction,
137
+ Va as peginOutputCount,
138
+ ce as primeVpTokenRegistry,
139
+ F as processPublicKeyToXOnly,
140
+ se as pushTx,
141
+ Fa as rateBasedTxBufferFee,
142
+ Te as resolveProtocolAddresses,
143
+ We as runDepositorPresignFlow,
144
+ Ma as selectUtxosForDeposit,
145
+ Ga as selectUtxosForPegin,
146
+ Ya as shouldAddChangeOutput,
147
+ Xe as signDepositorGraph,
148
+ y as stripHexPrefix,
149
+ Ke as submitWotsPublicKey,
150
+ h as toXOnly,
151
+ N as uint8ArrayToHex,
152
+ we as validateDepositAmount,
153
+ Ge as validateMultiVaultDepositInputs,
154
+ Ye as validateProviderSelection,
155
+ Je as validateRemainingCapacity,
156
+ Se as validateRequestDepositorClaimerArtifactsResponse,
157
+ ra as validateSecretAgainstHashlock,
158
+ Ha as validateUtxosAvailable,
159
+ Ze as validateVaultAmounts,
160
+ ze as validateVaultProviderPubkey,
161
+ D as validateWalletPubkey,
162
+ Ee as verifyServerIdentity,
163
+ Ae as vpTokenRegistry,
164
+ je as waitForPeginStatus
155
165
  };
156
166
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,2 +1,2 @@
1
- "use strict";var d=Object.defineProperty;var l=(i,t,e)=>t in i?d(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var r=(i,t,e)=>l(i,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../sha2-CsTynrfJ.cjs"),o=require("buffer"),g=require("../bitcoin-EYBKDtEW.cjs"),q=require("../shared/index.cjs"),f=async(i,t)=>{const e=new TextEncoder,n=e.encode(i),s=e.encode(t),a=new Uint8Array(4+n.length+4+s.length),c=new DataView(a.buffer);return c.setUint32(0,n.length),a.set(n,4),c.setUint32(4+n.length,s.length),a.set(s,4+n.length+4),g.uint8ArrayToHex(u.sha256(a))},h={publicKeyHex:"a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2",address:"tb1pqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkx6jks",network:q.BitcoinNetworks.SIGNET,shouldFailSigning:!1,deriveContextHash:f};class b{constructor(t={}){r(this,"config");this.config={...h,...t.publicKeyHex?{publicKeyHex:t.publicKeyHex}:{},...t.address?{address:t.address}:{},...t.network!==void 0?{network:t.network}:{},...t.shouldFailSigning!==void 0?{shouldFailSigning:t.shouldFailSigning}:{},...t.deriveContextHash?{deriveContextHash:t.deriveContextHash}:{}}}async getPublicKeyHex(){return this.config.publicKeyHex}async getAddress(){return this.config.address}async signPsbt(t){if(this.config.shouldFailSigning)throw new Error("Mock signing failed");if(!t||t.length===0)throw new Error("Invalid PSBT: empty hex string");return t+"deadbeef"}async signPsbts(t,e){const n=[];for(const s of t){const a=await this.signPsbt(s);n.push(a)}return n}async signMessage(t,e){if(this.config.shouldFailSigning)throw new Error("Mock signing failed");if(!t||t.length===0)throw new Error("Invalid message: empty string");return o.Buffer.from(`mock-signature-${e}-${t}-${this.config.publicKeyHex}`).toString("base64")}async getNetwork(){return this.config.network}async deriveContextHash(t,e){return this.config.deriveContextHash(t,e)}updateConfig(t){this.config={...this.config,...t}}reset(){this.config={...h}}}class y{constructor(t={}){r(this,"account");r(this,"chain");r(this,"shouldFailOperations");r(this,"transactionDelay");r(this,"nonce",0);this.account={address:t.address||"0x742d35cc6634c0532925a3b844bc9e7595f0beb0"},this.chain={id:t.chainId??11155111},this.shouldFailOperations=t.shouldFailOperations??!1,this.transactionDelay=t.transactionDelay??0,this.signMessage=this.signMessage.bind(this),this.sendTransaction=this.sendTransaction.bind(this)}async signMessage(t){const e=t.message,n=t.account||this.account.address;if(this.shouldFailOperations)throw new Error("Mock signing failed");if(!e||e.length===0)throw new Error("Invalid message: empty string");const s=`personal_sign:${e}-${n}-${this.chain.id}`;return`0x${o.Buffer.from(s).toString("hex").slice(0,130).padEnd(130,"0")}`}async sendTransaction(t){var s;if(this.shouldFailOperations)throw new Error("Mock transaction failed");if(!t.to)throw new Error("Invalid transaction: missing 'to' address");this.transactionDelay>0&&await new Promise(a=>setTimeout(a,this.transactionDelay)),this.nonce++;const e=JSON.stringify({from:this.account.address,to:t.to,value:((s=t.value)==null?void 0:s.toString())||"0",nonce:this.nonce,chainId:this.chain.id});return`0x${o.Buffer.from(e).toString("hex").slice(0,64).padEnd(64,"0")}`}updateConfig(t){t.address!==void 0&&(this.account.address=t.address),t.chainId!==void 0&&(this.chain.id=t.chainId),t.shouldFailOperations!==void 0&&(this.shouldFailOperations=t.shouldFailOperations),t.transactionDelay!==void 0&&(this.transactionDelay=t.transactionDelay)}reset(){this.account.address="0x742d35cc6634c0532925a3b844bc9e7595f0beb0",this.chain.id=11155111,this.shouldFailOperations=!1,this.transactionDelay=0,this.nonce=0}getCurrentNonce(){return this.nonce}}exports.MockBitcoinWallet=b;exports.MockEthereumWallet=y;
1
+ "use strict";var d=Object.defineProperty;var l=(i,t,e)=>t in i?d(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var r=(i,t,e)=>l(i,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../sha2-CsTynrfJ.cjs"),o=require("buffer"),g=require("../bitcoin-B3aqjuMP.cjs"),q=require("../shared/index.cjs"),f=async(i,t)=>{const e=new TextEncoder,n=e.encode(i),s=e.encode(t),a=new Uint8Array(4+n.length+4+s.length),c=new DataView(a.buffer);return c.setUint32(0,n.length),a.set(n,4),c.setUint32(4+n.length,s.length),a.set(s,4+n.length+4),g.uint8ArrayToHex(u.sha256(a))},h={publicKeyHex:"a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2",address:"tb1pqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkx6jks",network:q.BitcoinNetworks.SIGNET,shouldFailSigning:!1,deriveContextHash:f};class b{constructor(t={}){r(this,"config");this.config={...h,...t.publicKeyHex?{publicKeyHex:t.publicKeyHex}:{},...t.address?{address:t.address}:{},...t.network!==void 0?{network:t.network}:{},...t.shouldFailSigning!==void 0?{shouldFailSigning:t.shouldFailSigning}:{},...t.deriveContextHash?{deriveContextHash:t.deriveContextHash}:{}}}async getPublicKeyHex(){return this.config.publicKeyHex}async getAddress(){return this.config.address}async signPsbt(t){if(this.config.shouldFailSigning)throw new Error("Mock signing failed");if(!t||t.length===0)throw new Error("Invalid PSBT: empty hex string");return t+"deadbeef"}async signPsbts(t,e){const n=[];for(const s of t){const a=await this.signPsbt(s);n.push(a)}return n}async signMessage(t,e){if(this.config.shouldFailSigning)throw new Error("Mock signing failed");if(!t||t.length===0)throw new Error("Invalid message: empty string");return o.Buffer.from(`mock-signature-${e}-${t}-${this.config.publicKeyHex}`).toString("base64")}async getNetwork(){return this.config.network}async deriveContextHash(t,e){return this.config.deriveContextHash(t,e)}updateConfig(t){this.config={...this.config,...t}}reset(){this.config={...h}}}class y{constructor(t={}){r(this,"account");r(this,"chain");r(this,"shouldFailOperations");r(this,"transactionDelay");r(this,"nonce",0);this.account={address:t.address||"0x742d35cc6634c0532925a3b844bc9e7595f0beb0"},this.chain={id:t.chainId??11155111},this.shouldFailOperations=t.shouldFailOperations??!1,this.transactionDelay=t.transactionDelay??0,this.signMessage=this.signMessage.bind(this),this.sendTransaction=this.sendTransaction.bind(this)}async signMessage(t){const e=t.message,n=t.account||this.account.address;if(this.shouldFailOperations)throw new Error("Mock signing failed");if(!e||e.length===0)throw new Error("Invalid message: empty string");const s=`personal_sign:${e}-${n}-${this.chain.id}`;return`0x${o.Buffer.from(s).toString("hex").slice(0,130).padEnd(130,"0")}`}async sendTransaction(t){var s;if(this.shouldFailOperations)throw new Error("Mock transaction failed");if(!t.to)throw new Error("Invalid transaction: missing 'to' address");this.transactionDelay>0&&await new Promise(a=>setTimeout(a,this.transactionDelay)),this.nonce++;const e=JSON.stringify({from:this.account.address,to:t.to,value:((s=t.value)==null?void 0:s.toString())||"0",nonce:this.nonce,chainId:this.chain.id});return`0x${o.Buffer.from(e).toString("hex").slice(0,64).padEnd(64,"0")}`}updateConfig(t){t.address!==void 0&&(this.account.address=t.address),t.chainId!==void 0&&(this.chain.id=t.chainId),t.shouldFailOperations!==void 0&&(this.shouldFailOperations=t.shouldFailOperations),t.transactionDelay!==void 0&&(this.transactionDelay=t.transactionDelay)}reset(){this.account.address="0x742d35cc6634c0532925a3b844bc9e7595f0beb0",this.chain.id=11155111,this.shouldFailOperations=!1,this.transactionDelay=0,this.nonce=0}getCurrentNonce(){return this.nonce}}exports.MockBitcoinWallet=b;exports.MockEthereumWallet=y;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -3,7 +3,7 @@ var l = (e, t, s) => t in e ? d(e, t, { enumerable: !0, configurable: !0, writab
3
3
  var o = (e, t, s) => l(e, typeof t != "symbol" ? t + "" : t, s);
4
4
  import { s as g } from "../sha2-6wN58S6R.js";
5
5
  import { Buffer as r } from "buffer";
6
- import { u } from "../bitcoin-0_T6KJON.js";
6
+ import { u } from "../bitcoin-B0S8SHCX.js";
7
7
  import { BitcoinNetworks as q } from "../shared/index.js";
8
8
  const f = async (e, t) => {
9
9
  const s = new TextEncoder(), n = s.encode(e), i = s.encode(t), a = new Uint8Array(4 + n.length + 4 + i.length), c = new DataView(a.buffer);
@@ -0,0 +1,318 @@
1
+ var O = Object.defineProperty;
2
+ var S = (e, t, r) => t in e ? O(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var P = (e, t, r) => S(e, typeof t != "symbol" ? t + "" : t, r);
4
+ class R extends Error {
5
+ constructor(t, r, n = "local", o) {
6
+ super(r), this.code = t, this.source = n, this.data = o, this.name = "JsonRpcError";
7
+ }
8
+ }
9
+ const T = {
10
+ TIMEOUT: -32e3,
11
+ NETWORK: -32001,
12
+ /** VP proxy: request timed out at proxy level */
13
+ PROXY_TIMEOUT: -32002,
14
+ /** VP proxy: VP unreachable / DNS failure / response too large */
15
+ PROXY_UNAVAILABLE: -32003,
16
+ /** SDK client: response missing "result" field (malformed JSON-RPC) */
17
+ INVALID_RESPONSE: -32700,
18
+ /** SDK client: response body exceeded the configured byte limit */
19
+ RESPONSE_TOO_LARGE: -32701
20
+ }, w = "2.0", y = 3, b = 1e3, f = 2 * 1024 * 1024, p = /* @__PURE__ */ new Set([
21
+ "vaultProvider_requestDepositorClaimerArtifacts"
22
+ ]), v = /* @__PURE__ */ new Set([
23
+ 408,
24
+ // Request Timeout
25
+ 429,
26
+ // Too Many Requests
27
+ 500,
28
+ // Internal Server Error
29
+ 502,
30
+ // Bad Gateway
31
+ 503,
32
+ // Service Unavailable
33
+ 504
34
+ // Gateway Timeout
35
+ ]), D = /* @__PURE__ */ new Set([
36
+ "vaultProvider_getPeginStatus",
37
+ "vaultProvider_getPegoutStatus",
38
+ "vaultProvider_requestDepositorPresignTransactions"
39
+ ]);
40
+ function L(e) {
41
+ return D.has(e);
42
+ }
43
+ const g = "auth_expired";
44
+ function m(e) {
45
+ if (!(e instanceof R) || e.source !== "wire") return !1;
46
+ const t = e.data;
47
+ return t === null || typeof t != "object" ? !1 : t.kind === g;
48
+ }
49
+ class F {
50
+ constructor(t) {
51
+ P(this, "baseUrl");
52
+ P(this, "timeout");
53
+ P(this, "headers");
54
+ P(this, "requestId", 0);
55
+ P(this, "retries");
56
+ P(this, "retryDelay");
57
+ P(this, "maxResponseBytes");
58
+ P(this, "retryableFor");
59
+ P(this, "tokenProvider");
60
+ if (this.baseUrl = t.baseUrl.replace(/\/$/, ""), this.timeout = t.timeout, this.headers = {
61
+ "Content-Type": "application/json",
62
+ ...t.headers
63
+ }, this.retries = t.retries ?? y, this.retryDelay = t.retryDelay ?? b, this.maxResponseBytes = t.maxResponseBytes ?? f, !Number.isFinite(this.maxResponseBytes) || this.maxResponseBytes <= 0)
64
+ throw new Error("maxResponseBytes must be a positive finite number");
65
+ this.retryableFor = t.retryableFor ?? L, this.tokenProvider = t.tokenProvider;
66
+ }
67
+ async buildHeaders(t) {
68
+ const r = { ...this.headers };
69
+ if (this.tokenProvider) {
70
+ const n = await this.tokenProvider.getToken(t);
71
+ n && (r.Authorization = `Bearer ${n}`);
72
+ }
73
+ return r;
74
+ }
75
+ /**
76
+ * Make a JSON-RPC request with optional retry for safe methods.
77
+ *
78
+ * If the request fails with a wire-origin `auth_expired` error and a
79
+ * `tokenProvider` is configured, the client invalidates its cached
80
+ * token and retries the request once with a freshly-acquired bearer.
81
+ *
82
+ * @param method - The RPC method name
83
+ * @param params - The method parameters
84
+ * @param signal - Optional AbortSignal for caller-controlled cancellation
85
+ * @returns The result from the RPC method
86
+ * @throws JsonRpcError if the RPC call fails
87
+ */
88
+ async call(t, r, n) {
89
+ try {
90
+ return await this.callOnce(t, r, n);
91
+ } catch (o) {
92
+ if (this.tokenProvider && m(o))
93
+ return this.tokenProvider.invalidate(), await this.callOnce(t, r, n);
94
+ throw o;
95
+ }
96
+ }
97
+ async callOnce(t, r, n) {
98
+ const o = await this.fetchWithRetry(t, r, n);
99
+ let s;
100
+ try {
101
+ const i = p.has(t) ? await o.text() : await G(o, this.maxResponseBytes);
102
+ s = JSON.parse(i);
103
+ } catch (i) {
104
+ throw i instanceof R ? i : new R(
105
+ T.INVALID_RESPONSE,
106
+ "Invalid JSON-RPC response: body is not valid JSON",
107
+ "local"
108
+ );
109
+ }
110
+ if (s === null || typeof s != "object" || Array.isArray(s))
111
+ throw new R(
112
+ T.INVALID_RESPONSE,
113
+ `Invalid JSON-RPC response: expected an object, got ${typeof s}`,
114
+ "local"
115
+ );
116
+ const a = s;
117
+ if ("error" in a && a.error != null) {
118
+ const i = a.error;
119
+ throw new R(
120
+ i.code ?? T.INVALID_RESPONSE,
121
+ i.message ?? "Unknown RPC error",
122
+ "wire",
123
+ i.data
124
+ );
125
+ }
126
+ if (!("result" in a))
127
+ throw new R(
128
+ T.INVALID_RESPONSE,
129
+ 'Invalid JSON-RPC response: missing "result" field',
130
+ "local"
131
+ );
132
+ return a.result;
133
+ }
134
+ /**
135
+ * Make a JSON-RPC request returning the raw Response (unparsed body).
136
+ *
137
+ * Bearer tokens are injected identically to `call`. **Reactive refresh
138
+ * is NOT performed here** — the response body may be unbounded (e.g.
139
+ * claimer-artifact downloads), so the client refuses to parse it to
140
+ * detect auth errors. Callers relying on token-expired retries for
141
+ * large downloads must read the body themselves and re-invoke
142
+ * `callRaw` after `tokenProvider.invalidate()`.
143
+ */
144
+ async callRaw(t, r, n) {
145
+ return this.fetchWithRetry(t, r, n);
146
+ }
147
+ async fetchWithRetry(t, r, n) {
148
+ const o = ++this.requestId, s = this.retryableFor(t) ? this.retries : 0, i = JSON.stringify({
149
+ jsonrpc: w,
150
+ method: t,
151
+ params: [r],
152
+ id: o
153
+ });
154
+ let d = null;
155
+ for (let u = 0; u <= s; u++) {
156
+ const _ = new AbortController(), A = setTimeout(
157
+ () => _.abort(),
158
+ this.timeout
159
+ ), l = n ? U(n, _.signal) : null, N = l ? l.signal : _.signal;
160
+ try {
161
+ const E = await this.buildHeaders(t), c = await fetch(this.baseUrl, {
162
+ method: "POST",
163
+ headers: E,
164
+ body: i,
165
+ signal: N
166
+ });
167
+ if (clearTimeout(A), l == null || l.cleanup(), !c.ok) {
168
+ if (u < s && v.has(c.status)) {
169
+ const I = this.retryDelay * Math.pow(2, u);
170
+ await this.sleep(I, n);
171
+ continue;
172
+ }
173
+ throw new Error(
174
+ `HTTP error: ${c.status} ${c.statusText}`
175
+ );
176
+ }
177
+ return c;
178
+ } catch (E) {
179
+ if (clearTimeout(A), l == null || l.cleanup(), d = E instanceof Error ? E : new Error(String(E)), n != null && n.aborted)
180
+ throw new Error("Request aborted");
181
+ if (E instanceof Error && E.name === "AbortError") {
182
+ if (u < s) {
183
+ const c = this.retryDelay * Math.pow(2, u);
184
+ await this.sleep(c, n);
185
+ continue;
186
+ }
187
+ throw new R(
188
+ T.TIMEOUT,
189
+ `Request timeout after ${this.timeout}ms (${s + 1} attempts)`,
190
+ "local"
191
+ );
192
+ }
193
+ if (E instanceof TypeError) {
194
+ if (u < s) {
195
+ const c = this.retryDelay * Math.pow(2, u);
196
+ await this.sleep(c, n);
197
+ continue;
198
+ }
199
+ throw new R(
200
+ T.NETWORK,
201
+ `Network error: ${E.message} (${s + 1} attempts)`,
202
+ "local"
203
+ );
204
+ }
205
+ throw E;
206
+ }
207
+ }
208
+ throw d || new Error("Unknown error after retries");
209
+ }
210
+ sleep(t, r) {
211
+ return new Promise((n, o) => {
212
+ if (r != null && r.aborted) {
213
+ o(new Error("Request aborted"));
214
+ return;
215
+ }
216
+ const s = setTimeout(() => {
217
+ r == null || r.removeEventListener("abort", a), n();
218
+ }, t), a = () => {
219
+ clearTimeout(s), o(new Error("Request aborted"));
220
+ };
221
+ r == null || r.addEventListener("abort", a, { once: !0 });
222
+ });
223
+ }
224
+ getBaseUrl() {
225
+ return this.baseUrl;
226
+ }
227
+ }
228
+ function U(e, t) {
229
+ if (e.aborted) return { signal: e, cleanup: () => {
230
+ } };
231
+ if (t.aborted) return { signal: t, cleanup: () => {
232
+ } };
233
+ const r = new AbortController(), n = () => {
234
+ t.removeEventListener("abort", o), r.abort();
235
+ }, o = () => {
236
+ e.removeEventListener("abort", n), r.abort();
237
+ };
238
+ e.addEventListener("abort", n, { once: !0 }), t.addEventListener("abort", o, { once: !0 });
239
+ const s = () => {
240
+ e.removeEventListener("abort", n), t.removeEventListener("abort", o);
241
+ };
242
+ return { signal: r.signal, cleanup: s };
243
+ }
244
+ async function G(e, t) {
245
+ const r = e.headers.get("content-length");
246
+ if (r !== null) {
247
+ const i = Number(r);
248
+ if (Number.isFinite(i) && i > t)
249
+ throw h(t);
250
+ }
251
+ if (!e.body)
252
+ return "";
253
+ const n = e.body.getReader(), o = new TextDecoder();
254
+ let s = 0, a = "";
255
+ try {
256
+ for (; ; ) {
257
+ const { done: i, value: d } = await n.read();
258
+ if (i) break;
259
+ if (d) {
260
+ if (s += d.byteLength, s > t)
261
+ throw await n.cancel(), h(t);
262
+ a += o.decode(d, { stream: !0 });
263
+ }
264
+ }
265
+ } finally {
266
+ n.releaseLock();
267
+ }
268
+ return a + o.decode();
269
+ }
270
+ function h(e) {
271
+ return new R(
272
+ T.RESPONSE_TOO_LARGE,
273
+ `JSON-RPC response exceeds maximum size of ${e} bytes`,
274
+ "local"
275
+ );
276
+ }
277
+ var x = /* @__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))(x || {});
278
+ const M = [
279
+ "PendingIngestion",
280
+ "PendingBabeSetup",
281
+ "PendingChallengerPresigning",
282
+ "PendingPeginSigsAvailability",
283
+ "PendingPrePegInConfirmations"
284
+ /* PENDING_PRE_PEGIN_CONFIRMATIONS */
285
+ ], B = [
286
+ "PendingACKs",
287
+ "PendingActivation",
288
+ "Activated"
289
+ /* ACTIVATED */
290
+ ], k = /* @__PURE__ */ new Set([
291
+ "PendingBabeSetup",
292
+ "PendingChallengerPresigning",
293
+ "PendingPeginSigsAvailability",
294
+ "PendingPrePegInConfirmations",
295
+ ...B
296
+ ]), H = /* @__PURE__ */ new Set([
297
+ "Expired",
298
+ "ClaimPosted",
299
+ "PeggedOut"
300
+ /* PEGGED_OUT */
301
+ ]), q = /* @__PURE__ */ new Set([
302
+ ...k,
303
+ "PendingDepositorSignatures"
304
+ /* PENDING_DEPOSITOR_SIGNATURES */
305
+ ]);
306
+ var C = /* @__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))(C || {});
307
+ export {
308
+ x as D,
309
+ F as J,
310
+ M as P,
311
+ C as R,
312
+ k as V,
313
+ R as a,
314
+ T as b,
315
+ H as c,
316
+ q as d
317
+ };
318
+ //# sourceMappingURL=types-ByW6nSLj.js.map