@berachain/berajs 0.2.8-beta.9 → 0.2.9

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 (237) hide show
  1. package/dist/{BeraError-_mQdkanr.d.cts → BeraError-7-A5JYy_.d.ts} +31 -2
  2. package/dist/{HoneyConfigProvider-DVP_9KZn.d.ts → HoneyConfigProvider-Dkj-_a5x.d.ts} +1 -1
  3. package/dist/{RequestError-BRIiJgHk.d.ts → RequestError-DBOIV65x.d.ts} +1 -1
  4. package/dist/abi/exports.mjs +4452 -2
  5. package/dist/actions/clients/exports.d.ts +2 -0
  6. package/dist/actions/clients/exports.mjs +12 -0
  7. package/dist/actions/exports.d.ts +104 -189
  8. package/dist/actions/exports.mjs +853 -2
  9. package/dist/actions/governance/exports.d.ts +140 -0
  10. package/dist/actions/governance/exports.mjs +226 -0
  11. package/dist/actions/server/exports.d.ts +13 -0
  12. package/dist/actions/server/exports.mjs +27 -0
  13. package/dist/chunk-3EARVV7K.mjs +414 -0
  14. package/dist/chunk-4Z4AK6SH.mjs +211 -0
  15. package/dist/chunk-75M6TF7M.mjs +25 -0
  16. package/dist/chunk-AFN4CVD3.mjs +326 -0
  17. package/dist/chunk-BGMRHTBQ.mjs +23 -0
  18. package/dist/chunk-CDFWPU2R.mjs +473 -0
  19. package/dist/chunk-CDK4YV3D.mjs +571 -0
  20. package/dist/chunk-DKMAIU74.mjs +62 -0
  21. package/dist/chunk-EXIUPSFN.mjs +86 -0
  22. package/dist/chunk-FFB5LFDW.mjs +35 -0
  23. package/dist/chunk-HQCOU6GY.mjs +243 -0
  24. package/dist/chunk-HSSJKHZ4.mjs +135 -0
  25. package/dist/chunk-J5I45WGQ.mjs +1769 -0
  26. package/dist/chunk-KQUMKB66.mjs +89 -0
  27. package/dist/chunk-NBYLMO2L.mjs +14 -0
  28. package/dist/chunk-NPBQLVL3.mjs +80 -0
  29. package/dist/chunk-O2NQFKJK.mjs +170 -0
  30. package/dist/chunk-QJIXTYTZ.mjs +4054 -0
  31. package/dist/chunk-SGIJVHZO.mjs +12 -0
  32. package/dist/chunk-SZ5C44L5.mjs +35 -0
  33. package/dist/chunk-WXXOISTU.mjs +96 -0
  34. package/dist/chunk-XIYN6AL6.mjs +160 -0
  35. package/dist/contexts/exports.d.ts +2 -2
  36. package/dist/contexts/exports.mjs +85 -2
  37. package/dist/enum/exports.d.ts +1 -1
  38. package/dist/enum/exports.mjs +46 -2
  39. package/dist/enum/governance/exports.d.ts +60 -0
  40. package/dist/enum/governance/exports.mjs +14 -0
  41. package/dist/errors/exports.d.ts +4 -3
  42. package/dist/errors/exports.mjs +48 -2
  43. package/dist/exports-BcUTGFUb.d.ts +40 -0
  44. package/dist/{getValidatorQueuedOperatorAddress-BcyxE9uw.d.ts → getValidatorQueuedOperatorAddress-Dw5KN5sh.d.ts} +2 -2
  45. package/dist/{global.d-5w_lvl2J.d.ts → global.d-BuGDKh4k.d.ts} +4 -240
  46. package/dist/hooks/exports.d.ts +69 -211
  47. package/dist/hooks/exports.mjs +7434 -4
  48. package/dist/hooks/governance/exports.d.ts +181 -0
  49. package/dist/hooks/governance/exports.mjs +888 -0
  50. package/dist/pol.d-CqPA9K6m.d.ts +142 -0
  51. package/dist/{txnEnum-7_o92X3N.d.cts → txnEnum-ByI5dtDi.d.ts} +2 -60
  52. package/dist/types/exports.d.ts +9 -9
  53. package/dist/types/exports.mjs +0 -1
  54. package/dist/types/governance/exports.d.ts +109 -0
  55. package/dist/types/governance/exports.mjs +0 -0
  56. package/dist/{useHoneySwapState-B494PQDl.d.ts → useHoneySwapState-vFmuFF0g.d.ts} +1 -1
  57. package/dist/utils/exports.d.ts +15 -6
  58. package/dist/utils/exports.mjs +825 -2
  59. package/package.json +49 -13
  60. package/src/actions/__test/transports.ts +61 -0
  61. package/src/actions/clients/exports.ts +4 -0
  62. package/src/actions/clients/getApolloClient.ts +58 -23
  63. package/src/actions/clients/getEnsoClient.ts +20 -9
  64. package/src/actions/dex/aggregators/enso/enso.ts +27 -17
  65. package/src/actions/dex/aggregators/enso/ensoErc4626.ts +2 -2
  66. package/src/actions/dex/aggregators/kyberswap.ts +18 -23
  67. package/src/actions/enso/__tests__/getEnsoUserTokensWithBalances.debug.test.ts +3 -6
  68. package/src/actions/exports.ts +4 -9
  69. package/src/actions/governance/exports.ts +9 -0
  70. package/src/actions/governance/getAllProposals.ts +10 -65
  71. package/src/actions/governance/getProposalDetails.ts +6 -33
  72. package/src/actions/governance/getProposalVotes.ts +8 -15
  73. package/src/actions/honey/getChartData.ts +27 -21
  74. package/src/actions/honey/getHoney24hVolume.ts +19 -22
  75. package/src/actions/pol/getAutoclaimedIncentives.ts +30 -0
  76. package/src/actions/pol/getBeraTokenTotalSupply.ts +45 -0
  77. package/src/actions/pol/getBgtIncentiveDistributorPaused.ts +35 -0
  78. package/src/actions/pol/getEarnedStakedBeraVault.ts +7 -11
  79. package/src/actions/pol/getGlobalData.ts +1 -0
  80. package/src/actions/pol/getHeroEarnVaults.ts +62 -0
  81. package/src/actions/pol/getIncentiveFeeClaimStats.ts +19 -38
  82. package/src/actions/pol/getSWBeraVaultMetadata.ts +1 -1
  83. package/src/actions/pol/getStakingDailyAssets.ts +7 -10
  84. package/src/actions/server/exports.ts +1 -0
  85. package/src/actions/server/getDailyValidatorBlockStats.ts +33 -0
  86. package/src/actions/tokens/getWalletBalances.integration.test.ts +3 -6
  87. package/src/actions/transactions/beraWriteContract.integration.test.ts +3 -6
  88. package/src/actions/validators/getDailyValidatorBlockStats.ts +25 -24
  89. package/src/actions/validators/getValidatorAnalytics.ts +20 -21
  90. package/src/actions/validators/getValidatorIncentiveDistribution.ts +33 -0
  91. package/src/enum/contracts.ts +1 -0
  92. package/src/enum/exports.ts +0 -1
  93. package/src/enum/governance/exports.ts +1 -0
  94. package/src/errors/BeraError.ts +47 -7
  95. package/src/errors/BeraTracing.unit.test.ts +65 -0
  96. package/src/errors/RequestError.ts +13 -1
  97. package/src/errors/exports.ts +5 -0
  98. package/src/errors/getRevertReason.integration.test.ts +3 -3
  99. package/src/errors/spanStatus.ts +78 -0
  100. package/src/errors/spanStatus.unit.test.ts +62 -0
  101. package/src/hooks/dex/useCreatePool.ts +1 -88
  102. package/src/hooks/dex/useOnChainPoolData.ts +27 -2
  103. package/src/hooks/dex/usePriceImpact.ts +12 -5
  104. package/src/hooks/enso/useBendDemultiply.ts +9 -1
  105. package/src/hooks/enso/useBendMultiply.ts +9 -1
  106. package/src/hooks/enso/useBendZapSupply.ts +26 -7
  107. package/src/hooks/enso/useEnsoSwapBundle.ts +17 -3
  108. package/src/hooks/enso/useEnsoUserTokensWithBalances.ts +13 -2
  109. package/src/hooks/exports.ts +2 -15
  110. package/src/hooks/governance/exports.ts +14 -0
  111. package/src/hooks/pol/useAutoclaimedIncentives.ts +49 -0
  112. package/src/hooks/pol/useStakedAPR.ts +2 -2
  113. package/src/hooks/pol/useStakedSnapshots.ts +5 -9
  114. package/src/hooks/validators/useValidator.ts +2 -0
  115. package/src/hooks/validators/useValidatorIncentiveDistribution.ts +39 -0
  116. package/src/types/bribe-boost.d.ts +8 -0
  117. package/src/types/exports.ts +0 -1
  118. package/src/types/governance/exports.ts +1 -0
  119. package/src/utils/beraFetch.ts +9 -3
  120. package/src/utils/exports.ts +1 -0
  121. package/src/utils/getServerSideClient.ts +4 -2
  122. package/src/utils/sanitizeRpcUrl.ts +22 -0
  123. package/src/utils/tracedTransport.ts +35 -0
  124. package/dist/BeraError-_mQdkanr.d.ts +0 -94
  125. package/dist/BexStatusProvider-DRymVlQf.d.cts +0 -70
  126. package/dist/HoneyConfigProvider-DfkjmzEf.d.cts +0 -390
  127. package/dist/RequestError-DSUzJ1Iy.d.cts +0 -144
  128. package/dist/abi/exports.cjs +0 -2
  129. package/dist/abi/exports.cjs.map +0 -1
  130. package/dist/abi/exports.d.cts +0 -6574
  131. package/dist/abi/exports.mjs.map +0 -1
  132. package/dist/actions/exports.cjs +0 -2
  133. package/dist/actions/exports.cjs.map +0 -1
  134. package/dist/actions/exports.d.cts +0 -1650
  135. package/dist/actions/exports.mjs.map +0 -1
  136. package/dist/chunk-45HIEVNI.cjs +0 -4
  137. package/dist/chunk-45HIEVNI.cjs.map +0 -1
  138. package/dist/chunk-47ILYVHC.mjs +0 -2
  139. package/dist/chunk-47ILYVHC.mjs.map +0 -1
  140. package/dist/chunk-575OK77P.mjs +0 -2
  141. package/dist/chunk-575OK77P.mjs.map +0 -1
  142. package/dist/chunk-5NVZG5N6.mjs +0 -2
  143. package/dist/chunk-5NVZG5N6.mjs.map +0 -1
  144. package/dist/chunk-6DIA6PXV.cjs +0 -2
  145. package/dist/chunk-6DIA6PXV.cjs.map +0 -1
  146. package/dist/chunk-6JJIZCVY.cjs +0 -2
  147. package/dist/chunk-6JJIZCVY.cjs.map +0 -1
  148. package/dist/chunk-7F72ZH4Q.mjs +0 -2
  149. package/dist/chunk-7F72ZH4Q.mjs.map +0 -1
  150. package/dist/chunk-AUA42YIG.mjs +0 -4
  151. package/dist/chunk-AUA42YIG.mjs.map +0 -1
  152. package/dist/chunk-BC2WX6O6.cjs +0 -2
  153. package/dist/chunk-BC2WX6O6.cjs.map +0 -1
  154. package/dist/chunk-CJOZC5Z2.cjs +0 -2
  155. package/dist/chunk-CJOZC5Z2.cjs.map +0 -1
  156. package/dist/chunk-D6L7LTA2.cjs +0 -2
  157. package/dist/chunk-D6L7LTA2.cjs.map +0 -1
  158. package/dist/chunk-DDEQFR3M.cjs +0 -2
  159. package/dist/chunk-DDEQFR3M.cjs.map +0 -1
  160. package/dist/chunk-GXV2JA36.mjs +0 -2
  161. package/dist/chunk-GXV2JA36.mjs.map +0 -1
  162. package/dist/chunk-ISYNEDET.mjs +0 -2
  163. package/dist/chunk-ISYNEDET.mjs.map +0 -1
  164. package/dist/chunk-JDDRTHFG.mjs +0 -2
  165. package/dist/chunk-JDDRTHFG.mjs.map +0 -1
  166. package/dist/chunk-JDZGYU5T.mjs +0 -2
  167. package/dist/chunk-JDZGYU5T.mjs.map +0 -1
  168. package/dist/chunk-LVOXBZMA.cjs +0 -2
  169. package/dist/chunk-LVOXBZMA.cjs.map +0 -1
  170. package/dist/chunk-MK5NS5B5.mjs +0 -2
  171. package/dist/chunk-MK5NS5B5.mjs.map +0 -1
  172. package/dist/chunk-NAXAZJJY.mjs +0 -2
  173. package/dist/chunk-NAXAZJJY.mjs.map +0 -1
  174. package/dist/chunk-NLVWRMGD.mjs +0 -2
  175. package/dist/chunk-NLVWRMGD.mjs.map +0 -1
  176. package/dist/chunk-OGBD5YOG.mjs +0 -2
  177. package/dist/chunk-OGBD5YOG.mjs.map +0 -1
  178. package/dist/chunk-OGJMSGB2.mjs +0 -2
  179. package/dist/chunk-OGJMSGB2.mjs.map +0 -1
  180. package/dist/chunk-OIYXOKTT.cjs +0 -2
  181. package/dist/chunk-OIYXOKTT.cjs.map +0 -1
  182. package/dist/chunk-OUD27MU7.cjs +0 -2
  183. package/dist/chunk-OUD27MU7.cjs.map +0 -1
  184. package/dist/chunk-PRLVZIKD.mjs +0 -2
  185. package/dist/chunk-PRLVZIKD.mjs.map +0 -1
  186. package/dist/chunk-Q2SNRLW3.cjs +0 -2
  187. package/dist/chunk-Q2SNRLW3.cjs.map +0 -1
  188. package/dist/chunk-REWME3FY.cjs +0 -2
  189. package/dist/chunk-REWME3FY.cjs.map +0 -1
  190. package/dist/chunk-RJN36GBU.mjs +0 -2
  191. package/dist/chunk-RJN36GBU.mjs.map +0 -1
  192. package/dist/chunk-RWOICHRW.cjs +0 -2
  193. package/dist/chunk-RWOICHRW.cjs.map +0 -1
  194. package/dist/chunk-S4CDSVLK.cjs +0 -2
  195. package/dist/chunk-S4CDSVLK.cjs.map +0 -1
  196. package/dist/chunk-SFEULGSX.cjs +0 -2
  197. package/dist/chunk-SFEULGSX.cjs.map +0 -1
  198. package/dist/chunk-WBTS6KFG.mjs +0 -2
  199. package/dist/chunk-WBTS6KFG.mjs.map +0 -1
  200. package/dist/chunk-WRFDB3QJ.cjs +0 -2
  201. package/dist/chunk-WRFDB3QJ.cjs.map +0 -1
  202. package/dist/chunk-XNJLSA6P.cjs +0 -2
  203. package/dist/chunk-XNJLSA6P.cjs.map +0 -1
  204. package/dist/contexts/exports.cjs +0 -2
  205. package/dist/contexts/exports.cjs.map +0 -1
  206. package/dist/contexts/exports.d.cts +0 -66
  207. package/dist/contexts/exports.mjs.map +0 -1
  208. package/dist/defaultFlags-D6KfkTZx.d.cts +0 -10
  209. package/dist/dex-C_BB0b0O.d.cts +0 -37
  210. package/dist/enum/exports.cjs +0 -2
  211. package/dist/enum/exports.cjs.map +0 -1
  212. package/dist/enum/exports.d.cts +0 -23
  213. package/dist/enum/exports.mjs.map +0 -1
  214. package/dist/errors/exports.cjs +0 -2
  215. package/dist/errors/exports.cjs.map +0 -1
  216. package/dist/errors/exports.d.cts +0 -327
  217. package/dist/errors/exports.mjs.map +0 -1
  218. package/dist/getValidatorQueuedOperatorAddress-Cql_D50j.d.cts +0 -562
  219. package/dist/global.d-B7IeayVX.d.cts +0 -474
  220. package/dist/honey-CYm0RWf4.d.cts +0 -14
  221. package/dist/hooks/exports.cjs +0 -4
  222. package/dist/hooks/exports.cjs.map +0 -1
  223. package/dist/hooks/exports.d.cts +0 -1734
  224. package/dist/hooks/exports.mjs.map +0 -1
  225. package/dist/polling-BKnyavLI.d.cts +0 -8
  226. package/dist/txnEnum-7_o92X3N.d.ts +0 -164
  227. package/dist/types/exports.cjs +0 -1
  228. package/dist/types/exports.cjs.map +0 -1
  229. package/dist/types/exports.d.cts +0 -90
  230. package/dist/types/exports.mjs.map +0 -1
  231. package/dist/useHoneySwapState-D6vpv19r.d.cts +0 -32
  232. package/dist/utils/exports.cjs +0 -2
  233. package/dist/utils/exports.cjs.map +0 -1
  234. package/dist/utils/exports.d.cts +0 -420
  235. package/dist/utils/exports.mjs.map +0 -1
  236. package/src/actions/dex/getIsTokenExploited.ts +0 -63
  237. package/src/hooks/dex/useExploitedTokens.ts +0 -57
@@ -1,327 +0,0 @@
1
- import { GetPublicClientReturnType } from '@wagmi/core';
2
- import { Address, PublicClient, TransactionReceipt } from 'viem';
3
- import { B as BeraError, S as SeverityLevel, I as IBeraErrorArgs } from '../BeraError-_mQdkanr.cjs';
4
- import { E as EmitterMixin } from '../RequestError-DSUzJ1Iy.cjs';
5
- export { B as BeraTracing, R as RequestError, S as SpanContext } from '../RequestError-DSUzJ1Iy.cjs';
6
- import { Hex } from '@berachain-foundation/berancer-sdk';
7
- import '@apollo/client';
8
-
9
- /**
10
- * Asserts that a value is defined.
11
- * @throws An InvalidArgumentError if the value is undefined or null.
12
- */
13
- declare function assertDefined<T>(
14
- /**
15
- * The value to assert.
16
- */
17
- value: T,
18
- /**
19
- * The property name.
20
- */
21
- property: string): asserts value is NonNullable<T>;
22
- /**
23
- * Asserts that a value is a PublicClient.
24
- * @throws An InvalidArgumentError if the value is undefined or not a PublicClient.
25
- */
26
- declare function assertPublicClient(
27
- /**
28
- * The value to assert.
29
- */
30
- value: // it's important to have both types here because it helps with typescript build performance
31
- PublicClient | GetPublicClientReturnType | undefined,
32
- /**
33
- * The property name.
34
- */
35
- property?: string): asserts value is PublicClient;
36
- /**
37
- * Asserts that a value is an address (20 bytes).
38
- * @throws An InvalidArgumentError if the value is undefined, null, not a string, or not an address.
39
- */
40
- declare function assertAddress(
41
- /**
42
- * The value to assert.
43
- */
44
- value: string | undefined | null,
45
- /**
46
- * The property name.
47
- */
48
- property: string): asserts value is Address;
49
- /**
50
- * Asserts that a value is positive (> 0).
51
- * @throws An InvalidArgumentError if the value is not positive.
52
- */
53
- declare function assertPositive(value: string | bigint | number, property: string): void;
54
- /**
55
- * Asserts that a value is a number greater than 0.
56
- * @throws An InvalidArgumentError if the value is undefined, null, not a string or number, or not a number greater than 0.
57
- */
58
- declare function assertAmount(
59
- /**
60
- * The value to assert.
61
- */
62
- value: unknown,
63
- /**
64
- * The property name.
65
- */
66
- property: string): asserts value is string | number;
67
-
68
- /**
69
- * Context passed alongside captured exceptions.
70
- * Mirrors the subset of Sentry's CaptureContext that berajs actually uses.
71
- */
72
- interface CaptureContext {
73
- level: SeverityLevel;
74
- extra?: Record<string, unknown>;
75
- tags?: Record<string, string | number | boolean | null | undefined>;
76
- fingerprint?: string[];
77
- data?: Record<string, unknown>;
78
- }
79
- interface ErrorEvent {
80
- exception: BeraError;
81
- timestamp: number;
82
- }
83
- /**
84
- * A generic error reporter for berajs.
85
- *
86
- * Instead of calling Sentry.captureException directly, berajs calls
87
- * `BeraMonitoring.captureException()`. Consumer apps subscribe via `.on()` and
88
- * forward events to their monitoring provider (Sentry, Datadog, etc.).
89
- *
90
- * @example
91
- * ```ts
92
- * // In berajs code:
93
- * import { BeraMonitoring } from "./BeraMonitoring";
94
- * BeraMonitoring.captureExceptionException(error);
95
- *
96
- * // In app instrumentation:
97
- * import { BeraMonitoring } from "@berachain/berajs/errors";
98
- * BeraMonitoring.on((event) => {
99
- * if (event.type === "exception") {
100
- * Sentry.captureException(event.exception);
101
- * }
102
- * });
103
- * ```
104
- */
105
- declare const BeraMonitoring: {
106
- captureException: (exception: BeraError) => void;
107
- } & EmitterMixin<{
108
- exception: (event: ErrorEvent) => void;
109
- }>;
110
-
111
- interface MatchedError {
112
- /** The error key in the errorMap (e.g. "NOT_ENOUGH_GAS_TOKEN") */
113
- key: string;
114
- /** The category in the errorMap (e.g. "RPC", "BEX") */
115
- category: string;
116
- /** The user-friendly display message */
117
- errorMSG: string;
118
- /** Whether the match was by exact reason (true) or keyword (false) */
119
- matchedByReason: boolean;
120
- }
121
- /**
122
- * Finds the matching error entry in errorMap by reason or message.
123
- *
124
- * ## Matching priority:
125
- * 1. **Exact reason match** (preferred): checks `errorType.reasons` for an exact string match.
126
- * 2. **Keyword fallback**: checks `errorType.keywords` for case-insensitive substring matches in `message`.
127
- *
128
- * @returns The matched error entry with key and category, or null if no match found.
129
- */
130
- declare function findMatchingError({ reason, message, }: {
131
- reason?: string | null;
132
- message?: string;
133
- }): MatchedError | null;
134
- /**
135
- * Resolves a user-friendly displayMessage by matching `reason` and `message` against `errorMap.ts`.
136
- *
137
- * This is the bridge between the automatic reason detection pipeline (parseViemError) and
138
- * the user-facing error messages. Called by the BeraError constructor.
139
- *
140
- * ## Matching priority:
141
- * 1. **Exact reason match** (preferred): checks `errorType.reasons` for an exact string match.
142
- * This is the most reliable path — contract revert reasons like "NotEnoughBalance" or "BAL#508"
143
- * are matched deterministically.
144
- * 2. **Keyword fallback**: checks `errorType.keywords` for case-insensitive substring matches in `message`.
145
- * Use sparingly — keyword matching can cause false positives (e.g. "InsufficientBalance"
146
- * keyword would also match "InsufficientBalanceToPayPythFee").
147
- * 3. **GENERAL_ERROR fallback**: "Something went wrong. Please try again later."
148
- *
149
- * To ensure new contract errors get good displayMessages, add their reason to `errorMap.ts`.
150
- * The reason is auto-detected by parseViemError — you only need to map it to a message here.
151
- */
152
- declare function getErrorMessage({ reason, message, }: {
153
- reason?: string | null;
154
- message?: string;
155
- }): string;
156
-
157
- interface IInvalidArgumentErrorArgs extends IBeraErrorArgs {
158
- /**
159
- * The name of the argument that is invalid.
160
- */
161
- property: string;
162
- /**
163
- * The value of the argument that is invalid.
164
- */
165
- value: unknown;
166
- /**
167
- * The expected type of the value as a string, eg. string, number, boolean, etc.
168
- */
169
- expected: string;
170
- }
171
- /**
172
- * Error thrown when argument validation fails. (e.g. an argument is missing or invalid)
173
- *
174
- * Default level is "warning".
175
- *
176
- * @example ```ts
177
- * if (!publicClient) {
178
- * throw new InvalidArgumentError({
179
- * property: "publicClient",
180
- * value: publicClient,
181
- * expected: "PublicClient",
182
- * });
183
- * }
184
- * if (!address || !isAddress(address)) {
185
- * throw new InvalidArgumentError({
186
- * property: "address",
187
- * value: address,
188
- * expected: "Address",
189
- * });
190
- * }
191
- * ```
192
- *
193
- */
194
- declare class InvalidArgumentError extends BeraError {
195
- /**
196
- * The name of the argument that is invalid.
197
- */
198
- property: string;
199
- /**
200
- * The value of the argument that is invalid.
201
- */
202
- value: unknown;
203
- /**
204
- * The expected value of the argument.
205
- */
206
- expected: string;
207
- constructor(args: IInvalidArgumentErrorArgs);
208
- get isMissing(): boolean;
209
- /**
210
- * Whether the argument is defined but invalid.
211
- */
212
- get isInvalid(): boolean;
213
- }
214
-
215
- /**
216
- * The preferred way to normalize any unknown error into a BeraError.
217
- *
218
- * This function acts as a smart factory that picks the correct BeraError subclass:
219
- *
220
- * 1. If `cause` is already a `BeraError`, returns it as-is (no double-wrapping).
221
- * 2. If `cause` is a viem `BaseError`, runs `parseViemError` to classify it:
222
- * - If the root cause is an `HttpRequestError` (RPC transport failure), wraps it
223
- * in a `RequestError` with the endpoint URL extracted from the error.
224
- * 3. Otherwise, wraps in a new `BeraError` — which triggers the automatic reason
225
- * detection pipeline in the BeraError constructor (parseViemError → errorMap → displayMessage).
226
- *
227
- * **Use this instead of `new BeraError({ cause })` when you don't know the error type.**
228
- * It ensures RequestErrors are correctly classified (important for Sentry filtering
229
- * and fingerprinting — RequestErrors are skipped from transaction error grouping).
230
- *
231
- * @example
232
- * ```ts
233
- * try {
234
- * await someOperation();
235
- * } catch (error) {
236
- * // Normalizes to the right subclass, reason auto-detected
237
- * throw initBeraError({ cause: error });
238
- * }
239
- * ```
240
- *
241
- * @example
242
- * ```ts
243
- * // Reporting to Sentry without rethrowing
244
- * catch (error) {
245
- * captureException(initBeraError({ cause: error }));
246
- * }
247
- * ```
248
- */
249
- declare function initBeraError({ cause: error, level, }: {
250
- cause: unknown;
251
- /**
252
- * The severity level of the error, only used if the error is not a BeraError.
253
- */
254
- level?: SeverityLevel;
255
- }): BeraError;
256
-
257
- interface INotFoundErrorArgs extends IBeraErrorArgs {
258
- resource: string;
259
- id: string;
260
- chainId: number;
261
- }
262
- /**
263
- * Error thrown when a resource is not found.
264
- */
265
- declare class NotFoundError extends BeraError {
266
- /**
267
- * The name of the resource that was not found.
268
- *
269
- * @example "Reward vault"
270
- */
271
- resource: string;
272
- /**
273
- * The id of the resource that was not found.
274
- *
275
- * @example "0x1234567890123456789012345678901234567890"
276
- */
277
- id: string;
278
- constructor(args: INotFoundErrorArgs);
279
- }
280
-
281
- /**
282
- * This error is generally thrown by beraWriteContract when a transaction or simulation fails.
283
- */
284
- declare class TransactionFailedError extends BeraError {
285
- /**
286
- * The hash of the transaction that failed.
287
- *
288
- * Null if the error is due to a simulation failure.
289
- */
290
- txHash: string | null;
291
- /**
292
- * The receipt of the transaction that failed.
293
- *
294
- * Null if the error is due to a simulation failure.
295
- */
296
- receipt: TransactionReceipt | null;
297
- /**
298
- * The address of the contract that was called.
299
- */
300
- to: Address | undefined;
301
- /**
302
- * The data of the transaction that failed.
303
- */
304
- callData: Hex | undefined;
305
- /**
306
- * The block number of the transaction that failed.
307
- */
308
- blockNumber: bigint | null;
309
- /**
310
- * The input of the transaction that failed.
311
- */
312
- input: object;
313
- /**
314
- * The function name of the transaction that failed.
315
- */
316
- functionName: string | undefined;
317
- constructor(args: IBeraErrorArgs & {
318
- txHash?: string;
319
- receipt?: TransactionReceipt;
320
- to?: Address;
321
- blockNumber?: bigint;
322
- functionName?: string;
323
- input: object;
324
- });
325
- }
326
-
327
- export { BeraError, BeraMonitoring, type CaptureContext, type ErrorEvent, IBeraErrorArgs, type IInvalidArgumentErrorArgs, type INotFoundErrorArgs, InvalidArgumentError, type MatchedError, NotFoundError, SeverityLevel, TransactionFailedError, assertAddress, assertAmount, assertDefined, assertPositive, assertPublicClient, findMatchingError, getErrorMessage, initBeraError };
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}