@berachain/berajs 0.2.8-beta.1 → 0.2.8-beta.11

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 (222) hide show
  1. package/dist/RequestError-BRIiJgHk.d.ts +144 -0
  2. package/dist/RequestError-DSUzJ1Iy.d.cts +144 -0
  3. package/dist/abi/exports.cjs.map +1 -1
  4. package/dist/abi/exports.mjs +1 -1
  5. package/dist/actions/exports.cjs +1 -1
  6. package/dist/actions/exports.cjs.map +1 -1
  7. package/dist/actions/exports.d.cts +22 -105
  8. package/dist/actions/exports.d.ts +22 -105
  9. package/dist/actions/exports.mjs +1 -1
  10. package/dist/actions/exports.mjs.map +1 -1
  11. package/dist/actions/governance/exports.cjs +2 -0
  12. package/dist/actions/governance/exports.cjs.map +1 -0
  13. package/dist/actions/governance/exports.d.cts +140 -0
  14. package/dist/actions/governance/exports.d.ts +140 -0
  15. package/dist/actions/governance/exports.mjs +2 -0
  16. package/dist/actions/governance/exports.mjs.map +1 -0
  17. package/dist/chunk-33XNWMPP.cjs +2 -0
  18. package/dist/chunk-33XNWMPP.cjs.map +1 -0
  19. package/dist/chunk-4TALWNXE.cjs +2 -0
  20. package/dist/chunk-4TALWNXE.cjs.map +1 -0
  21. package/dist/chunk-54BTOQE3.cjs +2 -0
  22. package/dist/chunk-54BTOQE3.cjs.map +1 -0
  23. package/dist/chunk-5QAFKFM5.mjs +2 -0
  24. package/dist/chunk-5QAFKFM5.mjs.map +1 -0
  25. package/dist/chunk-6DIA6PXV.cjs +2 -0
  26. package/dist/chunk-6DIA6PXV.cjs.map +1 -0
  27. package/dist/{chunk-NMH7LHPW.cjs → chunk-6JJIZCVY.cjs} +2 -2
  28. package/dist/chunk-6JJIZCVY.cjs.map +1 -0
  29. package/dist/chunk-BE6B4PQF.cjs +2 -0
  30. package/dist/chunk-BE6B4PQF.cjs.map +1 -0
  31. package/dist/chunk-CHFETMC6.cjs +4 -0
  32. package/dist/chunk-CHFETMC6.cjs.map +1 -0
  33. package/dist/{chunk-I7M43BB4.cjs → chunk-D6L7LTA2.cjs} +2 -2
  34. package/dist/chunk-D6L7LTA2.cjs.map +1 -0
  35. package/dist/chunk-DDEQFR3M.cjs.map +1 -1
  36. package/dist/chunk-ENT2OSXT.mjs +2 -0
  37. package/dist/chunk-ENT2OSXT.mjs.map +1 -0
  38. package/dist/{chunk-74QD4JAH.mjs → chunk-GXV2JA36.mjs} +2 -2
  39. package/dist/chunk-GXV2JA36.mjs.map +1 -0
  40. package/dist/chunk-H6ZO4SLB.mjs +4 -0
  41. package/dist/chunk-H6ZO4SLB.mjs.map +1 -0
  42. package/dist/chunk-JDDRTHFG.mjs +2 -0
  43. package/dist/chunk-JDDRTHFG.mjs.map +1 -0
  44. package/dist/{chunk-T5FSQ3YE.mjs → chunk-JDZGYU5T.mjs} +2 -2
  45. package/dist/{chunk-T5FSQ3YE.mjs.map → chunk-JDZGYU5T.mjs.map} +1 -1
  46. package/dist/chunk-JIPSTWKO.mjs +2 -0
  47. package/dist/{chunk-KI66MQ43.mjs.map → chunk-JIPSTWKO.mjs.map} +1 -1
  48. package/dist/chunk-JSTCUTXP.cjs +2 -0
  49. package/dist/chunk-JSTCUTXP.cjs.map +1 -0
  50. package/dist/{chunk-MJZHJFZO.mjs → chunk-JXM5S4IU.mjs} +2 -2
  51. package/dist/chunk-K5L2B4DU.mjs +2 -0
  52. package/dist/{chunk-EFG3OYYQ.mjs.map → chunk-K5L2B4DU.mjs.map} +1 -1
  53. package/dist/chunk-KUQEX7H3.mjs +2 -0
  54. package/dist/chunk-KUQEX7H3.mjs.map +1 -0
  55. package/dist/chunk-NXXMW2O7.mjs +2 -0
  56. package/dist/chunk-NXXMW2O7.mjs.map +1 -0
  57. package/dist/chunk-OIYXOKTT.cjs.map +1 -1
  58. package/dist/chunk-OUD27MU7.cjs.map +1 -1
  59. package/dist/chunk-PRLVZIKD.mjs +2 -0
  60. package/dist/chunk-PRLVZIKD.mjs.map +1 -0
  61. package/dist/chunk-QVIAMSZ6.cjs +2 -0
  62. package/dist/chunk-QVIAMSZ6.cjs.map +1 -0
  63. package/dist/chunk-RCWM55DE.cjs +2 -0
  64. package/dist/chunk-RCWM55DE.cjs.map +1 -0
  65. package/dist/chunk-REWME3FY.cjs +2 -0
  66. package/dist/chunk-REWME3FY.cjs.map +1 -0
  67. package/dist/chunk-RJN36GBU.mjs +2 -0
  68. package/dist/chunk-RJN36GBU.mjs.map +1 -0
  69. package/dist/chunk-RWOICHRW.cjs.map +1 -1
  70. package/dist/chunk-S4CDSVLK.cjs +2 -0
  71. package/dist/chunk-S4CDSVLK.cjs.map +1 -0
  72. package/dist/chunk-WLJHFHKF.mjs +2 -0
  73. package/dist/chunk-WLJHFHKF.mjs.map +1 -0
  74. package/dist/chunk-WRFDB3QJ.cjs.map +1 -1
  75. package/dist/chunk-XNJLSA6P.cjs.map +1 -1
  76. package/dist/chunk-XZC34BHM.cjs +2 -0
  77. package/dist/chunk-XZC34BHM.cjs.map +1 -0
  78. package/dist/chunk-Y2FETC6T.cjs +2 -0
  79. package/dist/chunk-Y2FETC6T.cjs.map +1 -0
  80. package/dist/chunk-ZW2N63FI.mjs +2 -0
  81. package/dist/chunk-ZW2N63FI.mjs.map +1 -0
  82. package/dist/contexts/exports.cjs +1 -1
  83. package/dist/contexts/exports.cjs.map +1 -1
  84. package/dist/contexts/exports.mjs +1 -1
  85. package/dist/contexts/exports.mjs.map +1 -1
  86. package/dist/enum/exports.cjs +1 -1
  87. package/dist/enum/exports.cjs.map +1 -1
  88. package/dist/enum/exports.d.cts +1 -1
  89. package/dist/enum/exports.d.ts +1 -1
  90. package/dist/enum/exports.mjs +1 -1
  91. package/dist/enum/exports.mjs.map +1 -1
  92. package/dist/enum/governance/exports.cjs +2 -0
  93. package/dist/enum/governance/exports.cjs.map +1 -0
  94. package/dist/enum/governance/exports.d.cts +60 -0
  95. package/dist/enum/governance/exports.d.ts +60 -0
  96. package/dist/enum/governance/exports.mjs +2 -0
  97. package/dist/enum/governance/exports.mjs.map +1 -0
  98. package/dist/errors/exports.cjs +1 -1
  99. package/dist/errors/exports.cjs.map +1 -1
  100. package/dist/errors/exports.d.cts +3 -89
  101. package/dist/errors/exports.d.ts +3 -89
  102. package/dist/errors/exports.mjs +1 -1
  103. package/dist/{getValidatorQueuedOperatorAddress-BQXkSFd9.d.cts → getValidatorQueuedOperatorAddress-CPuIw7n5.d.cts} +2 -2
  104. package/dist/{getValidatorQueuedOperatorAddress-DUZOmxLV.d.ts → getValidatorQueuedOperatorAddress-CbZQ0kv2.d.ts} +2 -2
  105. package/dist/{global.d-6aSWIkV_.d.cts → global.d-B9nLZ7ul.d.cts} +3 -239
  106. package/dist/{global.d-SU9Epq0M.d.ts → global.d-ylUk_etZ.d.ts} +3 -239
  107. package/dist/hooks/exports.cjs +3 -3
  108. package/dist/hooks/exports.cjs.map +1 -1
  109. package/dist/hooks/exports.d.cts +19 -198
  110. package/dist/hooks/exports.d.ts +19 -198
  111. package/dist/hooks/exports.mjs +3 -3
  112. package/dist/hooks/exports.mjs.map +1 -1
  113. package/dist/hooks/governance/exports.cjs +2 -0
  114. package/dist/hooks/governance/exports.cjs.map +1 -0
  115. package/dist/hooks/governance/exports.d.cts +181 -0
  116. package/dist/hooks/governance/exports.d.ts +181 -0
  117. package/dist/hooks/governance/exports.mjs +2 -0
  118. package/dist/hooks/governance/exports.mjs.map +1 -0
  119. package/dist/pol.d-o6Iw75bK.d.cts +134 -0
  120. package/dist/pol.d-qR8bGEP5.d.ts +134 -0
  121. package/dist/{txnEnum-CCuQUFlh.d.cts → txnEnum-CwAJN4zV.d.cts} +3 -60
  122. package/dist/{txnEnum-CCuQUFlh.d.ts → txnEnum-CwAJN4zV.d.ts} +3 -60
  123. package/dist/types/exports.cjs.map +1 -1
  124. package/dist/types/exports.d.cts +7 -7
  125. package/dist/types/exports.d.ts +7 -7
  126. package/dist/types/governance/exports.cjs +1 -0
  127. package/dist/types/governance/exports.cjs.map +1 -0
  128. package/dist/types/governance/exports.d.cts +109 -0
  129. package/dist/types/governance/exports.d.ts +109 -0
  130. package/dist/types/governance/exports.mjs +1 -0
  131. package/dist/types/governance/exports.mjs.map +1 -0
  132. package/dist/utils/exports.cjs +1 -1
  133. package/dist/utils/exports.cjs.map +1 -1
  134. package/dist/utils/exports.d.cts +10 -2
  135. package/dist/utils/exports.d.ts +10 -2
  136. package/dist/utils/exports.mjs +1 -1
  137. package/dist/utils/exports.mjs.map +1 -1
  138. package/package.json +49 -8
  139. package/src/actions/clients/BeraApolloClient.ts +9 -0
  140. package/src/actions/clients/getApolloClient.ts +23 -6
  141. package/src/actions/dex/getOnChainPool.ts +1 -1
  142. package/src/actions/enso/getBendMultiplyBundle.ts +9 -2
  143. package/src/actions/enso/util.ts +6 -8
  144. package/src/actions/exports.ts +1 -10
  145. package/src/actions/governance/checkProposalField.ts +108 -54
  146. package/src/actions/governance/computeActualStatus.ts +7 -3
  147. package/src/actions/governance/exports.ts +9 -0
  148. package/src/actions/governance/getAllProposals.ts +15 -8
  149. package/src/actions/governance/getBodyErrors.ts +13 -5
  150. package/src/actions/governance/getDecodedFunctionData.ts +31 -22
  151. package/src/actions/governance/getProposalDetails.ts +8 -4
  152. package/src/actions/governance/getProposalFromTx.ts +19 -10
  153. package/src/actions/governance/getProposalParams.ts +17 -17
  154. package/src/actions/governance/getProposalVotes.ts +7 -3
  155. package/src/actions/governance/getQuorum.ts +7 -7
  156. package/src/actions/governance/parseProposalBody.ts +19 -9
  157. package/src/actions/honey/getChartData.ts +5 -5
  158. package/src/actions/honey/getHoney24hVolume.ts +30 -0
  159. package/src/actions/honey/getHoneyPythPriceOracle.ts +1 -1
  160. package/src/actions/honey/getHoneyRootPriceOracle.ts +1 -1
  161. package/src/actions/pol/getEarnedStakedBeraVault.ts +12 -2
  162. package/src/actions/pol/getRewardVaultBeaconImplementation.ts +1 -1
  163. package/src/actions/pol/getRewardVaultIncentives.ts +2 -2
  164. package/src/actions/pol/getStakingDailyAssets.ts +7 -1
  165. package/src/actions/pol/getTotalStakedAmount.ts +1 -1
  166. package/src/actions/pol/getUserClaimableIncentives.ts +1 -1
  167. package/src/actions/pol/getUserVaultsReward.ts +1 -1
  168. package/src/actions/tokens/getTokenInformation.ts +8 -15
  169. package/src/actions/tokens/getUnderlyingToken.ts +1 -1
  170. package/src/actions/validators/getUserBoosts.ts +1 -1
  171. package/src/enum/exports.ts +0 -1
  172. package/src/enum/governance/exports.ts +1 -0
  173. package/src/enum/txnEnum.ts +2 -0
  174. package/src/errors/BeraError.ts +7 -2
  175. package/src/errors/RequestError.ts +2 -1
  176. package/src/hooks/dex/usePoolHistoricalData.ts +1 -1
  177. package/src/hooks/enso/useBendZapSupply.ts +1 -1
  178. package/src/hooks/exports.ts +1 -15
  179. package/src/hooks/governance/exports.ts +14 -0
  180. package/src/hooks/honey/useHoney24hVolume.ts +16 -0
  181. package/src/hooks/perps/usePythUpdateFee.ts +1 -1
  182. package/src/hooks/validators/useValidatorRewardAllocation.ts +1 -1
  183. package/src/types/exports.ts +0 -1
  184. package/src/types/governance/exports.ts +1 -0
  185. package/src/utils/beraFetch.ts +70 -15
  186. package/src/utils/getErrorResponse.ts +1 -1
  187. package/dist/RequestError-A8XJ6QR9.d.cts +0 -57
  188. package/dist/RequestError-Dk97z8rm.d.ts +0 -57
  189. package/dist/chunk-2EN6PPAW.cjs +0 -2
  190. package/dist/chunk-2EN6PPAW.cjs.map +0 -1
  191. package/dist/chunk-2YBHAMDV.cjs +0 -2
  192. package/dist/chunk-2YBHAMDV.cjs.map +0 -1
  193. package/dist/chunk-57RINXU6.cjs +0 -2
  194. package/dist/chunk-57RINXU6.cjs.map +0 -1
  195. package/dist/chunk-74QD4JAH.mjs.map +0 -1
  196. package/dist/chunk-74WA35RI.cjs +0 -2
  197. package/dist/chunk-74WA35RI.cjs.map +0 -1
  198. package/dist/chunk-7ITWLMO7.cjs +0 -4
  199. package/dist/chunk-7ITWLMO7.cjs.map +0 -1
  200. package/dist/chunk-BEKH5EYT.mjs +0 -2
  201. package/dist/chunk-BEKH5EYT.mjs.map +0 -1
  202. package/dist/chunk-DK42F2ZM.cjs +0 -2
  203. package/dist/chunk-DK42F2ZM.cjs.map +0 -1
  204. package/dist/chunk-EFG3OYYQ.mjs +0 -2
  205. package/dist/chunk-GO5E7UUD.cjs +0 -2
  206. package/dist/chunk-GO5E7UUD.cjs.map +0 -1
  207. package/dist/chunk-I7M43BB4.cjs.map +0 -1
  208. package/dist/chunk-IDFMLLDY.mjs +0 -2
  209. package/dist/chunk-IDFMLLDY.mjs.map +0 -1
  210. package/dist/chunk-JE5GI2OC.mjs +0 -4
  211. package/dist/chunk-JE5GI2OC.mjs.map +0 -1
  212. package/dist/chunk-KI66MQ43.mjs +0 -2
  213. package/dist/chunk-NMH7LHPW.cjs.map +0 -1
  214. package/dist/chunk-NVHV2LDK.cjs +0 -2
  215. package/dist/chunk-NVHV2LDK.cjs.map +0 -1
  216. package/dist/chunk-PLIH6KQM.mjs +0 -2
  217. package/dist/chunk-PLIH6KQM.mjs.map +0 -1
  218. package/dist/chunk-QRAIGQF2.mjs +0 -2
  219. package/dist/chunk-QRAIGQF2.mjs.map +0 -1
  220. package/src/actions/honey/getHoneyGlobalData.ts +0 -21
  221. package/src/hooks/honey/useHoneyGlobalData.ts +0 -23
  222. /package/dist/{chunk-MJZHJFZO.mjs.map → chunk-JXM5S4IU.mjs.map} +0 -0
@@ -0,0 +1,144 @@
1
+ import { ErrorLike } from '@apollo/client';
2
+ import { B as BeraError, I as IBeraErrorArgs } from './BeraError-_mQdkanr.js';
3
+
4
+ interface EventsMap {
5
+ [event: string]: any;
6
+ }
7
+ interface DefaultEvents extends EventsMap {
8
+ [event: string]: (...args: any) => void;
9
+ }
10
+ type Unsubscribe = () => void;
11
+ /**
12
+ * An interface for mixins that expose the `on` function (without the emitter
13
+ * bound to `this`)
14
+ *
15
+ * ```js
16
+ * import { createEmitter } from '~utils/createEmitter'
17
+ *
18
+ * class Ticker implements EmitterMixin<Events> {
19
+ * constructor() {
20
+ * this.emitter = createEmitter()
21
+ * }
22
+ * on(...args) {
23
+ * return this.emitter.on(...args)
24
+ * }
25
+ * tick() {
26
+ * this.emitter.emit('tick')
27
+ * }
28
+ * }
29
+ * ```
30
+ */
31
+ interface EmitterMixin<Events extends EventsMap = DefaultEvents> {
32
+ on<K extends keyof Events>(event: K, cb: Events[K]): Unsubscribe;
33
+ }
34
+
35
+ /**
36
+ * Span context passed to tracing handlers.
37
+ * Compatible with Sentry's StartSpanOptions (name, op, attributes).
38
+ */
39
+ type SpanContext = {
40
+ name: string;
41
+ op: string;
42
+ attributes: Record<string, string | number | boolean | undefined>;
43
+ };
44
+ /**
45
+ * A function that wraps a callback in a tracing span.
46
+ * Compatible with Sentry.startSpan's signature.
47
+ */
48
+ type StartSpanFn = <T>(context: SpanContext, callback: () => Promise<T>) => Promise<T>;
49
+ /**
50
+ * A generic span-tracing module for berajs.
51
+ *
52
+ * Instead of calling Sentry.startSpan directly, berajs calls
53
+ * `BeraTracing.startSpan()`. Consumer apps subscribe via `.on("span", handler)`
54
+ * and forward spans to their tracing provider (Sentry, Datadog, etc.).
55
+ *
56
+ * Multiple handlers are supported and chain in registration order:
57
+ * the first registered handler is the outermost wrapper.
58
+ *
59
+ * @example
60
+ * ```ts
61
+ * // In berajs code:
62
+ * import { BeraTracing } from "./BeraTracing";
63
+ * const result = await BeraTracing.startSpan(
64
+ * { name: "GraphQL query", op: "graphql.query", attributes: {} },
65
+ * () => executeQuery(),
66
+ * );
67
+ *
68
+ * // In app instrumentation:
69
+ * import { BeraTracing } from "@berachain/berajs/errors";
70
+ * BeraTracing.addSpanHandler(Sentry.startSpan);
71
+ * ```
72
+ */
73
+ declare const BeraTracing: {
74
+ /**
75
+ * Execute a callback, wrapping it in all registered span handlers.
76
+ *
77
+ * Handlers chain so each wraps the next. First registered = outermost wrapper.
78
+ * If no handlers are registered, the callback is executed directly.
79
+ */
80
+ startSpan<T>(context: SpanContext, callback: () => Promise<T>): Promise<T>;
81
+ /**
82
+ * Register a span tracing handler.
83
+ *
84
+ * @param _event - Must be "span". Exists for API consistency with BeraMonitoring.
85
+ * @param handler - A StartSpanFn, e.g. Sentry.startSpan.
86
+ * @returns An unsubscribe function to remove the handler.
87
+ */
88
+ addSpanHandler(handler: StartSpanFn): Unsubscribe;
89
+ };
90
+
91
+ /**
92
+ * This is an error class that should be used to handle errors from fetch requests.
93
+ */
94
+ declare class RequestError extends BeraError {
95
+ /**
96
+ * The error response from the request.
97
+ */
98
+ response: Response | ErrorLike | undefined;
99
+ static isCorsError(error: Error): boolean;
100
+ /**
101
+ * The endpoint that was requested.
102
+ */
103
+ endpoint: {
104
+ name?: string;
105
+ url: string;
106
+ type?: "rest" | "graphql" | "rpc";
107
+ };
108
+ /**
109
+ * A list of domains that should have their query params removed.
110
+ */
111
+ private queryRichfulDomains;
112
+ statusCode: number | undefined;
113
+ payload?: object;
114
+ static readonly REASON_MAP: {
115
+ readonly 429: "RATE_LIMITED_429";
116
+ readonly NETWORK_ERROR: "NETWORK_ERROR";
117
+ readonly CORS_ERROR: "CORS";
118
+ };
119
+ constructor(args: IBeraErrorArgs & {
120
+ response: Response | ErrorLike | undefined;
121
+ /**
122
+ * The payload sent to the request.
123
+ */
124
+ payload?: object;
125
+ endpoint: string | URL | {
126
+ name?: string;
127
+ url: string | URL;
128
+ type: "rest" | "graphql" | "rpc";
129
+ };
130
+ statusCode?: number;
131
+ });
132
+ setEndpoint(endpoint: string | URL | {
133
+ name?: string;
134
+ url: string | URL;
135
+ type?: "rest" | "graphql" | "rpc";
136
+ }): {
137
+ name?: string;
138
+ url: string;
139
+ type?: "rest" | "graphql" | "rpc";
140
+ };
141
+ private tryMatchNetworkError;
142
+ }
143
+
144
+ export { BeraTracing as B, type EmitterMixin as E, RequestError as R, type SpanContext as S };
@@ -0,0 +1,144 @@
1
+ import { ErrorLike } from '@apollo/client';
2
+ import { B as BeraError, I as IBeraErrorArgs } from './BeraError-_mQdkanr.cjs';
3
+
4
+ interface EventsMap {
5
+ [event: string]: any;
6
+ }
7
+ interface DefaultEvents extends EventsMap {
8
+ [event: string]: (...args: any) => void;
9
+ }
10
+ type Unsubscribe = () => void;
11
+ /**
12
+ * An interface for mixins that expose the `on` function (without the emitter
13
+ * bound to `this`)
14
+ *
15
+ * ```js
16
+ * import { createEmitter } from '~utils/createEmitter'
17
+ *
18
+ * class Ticker implements EmitterMixin<Events> {
19
+ * constructor() {
20
+ * this.emitter = createEmitter()
21
+ * }
22
+ * on(...args) {
23
+ * return this.emitter.on(...args)
24
+ * }
25
+ * tick() {
26
+ * this.emitter.emit('tick')
27
+ * }
28
+ * }
29
+ * ```
30
+ */
31
+ interface EmitterMixin<Events extends EventsMap = DefaultEvents> {
32
+ on<K extends keyof Events>(event: K, cb: Events[K]): Unsubscribe;
33
+ }
34
+
35
+ /**
36
+ * Span context passed to tracing handlers.
37
+ * Compatible with Sentry's StartSpanOptions (name, op, attributes).
38
+ */
39
+ type SpanContext = {
40
+ name: string;
41
+ op: string;
42
+ attributes: Record<string, string | number | boolean | undefined>;
43
+ };
44
+ /**
45
+ * A function that wraps a callback in a tracing span.
46
+ * Compatible with Sentry.startSpan's signature.
47
+ */
48
+ type StartSpanFn = <T>(context: SpanContext, callback: () => Promise<T>) => Promise<T>;
49
+ /**
50
+ * A generic span-tracing module for berajs.
51
+ *
52
+ * Instead of calling Sentry.startSpan directly, berajs calls
53
+ * `BeraTracing.startSpan()`. Consumer apps subscribe via `.on("span", handler)`
54
+ * and forward spans to their tracing provider (Sentry, Datadog, etc.).
55
+ *
56
+ * Multiple handlers are supported and chain in registration order:
57
+ * the first registered handler is the outermost wrapper.
58
+ *
59
+ * @example
60
+ * ```ts
61
+ * // In berajs code:
62
+ * import { BeraTracing } from "./BeraTracing";
63
+ * const result = await BeraTracing.startSpan(
64
+ * { name: "GraphQL query", op: "graphql.query", attributes: {} },
65
+ * () => executeQuery(),
66
+ * );
67
+ *
68
+ * // In app instrumentation:
69
+ * import { BeraTracing } from "@berachain/berajs/errors";
70
+ * BeraTracing.addSpanHandler(Sentry.startSpan);
71
+ * ```
72
+ */
73
+ declare const BeraTracing: {
74
+ /**
75
+ * Execute a callback, wrapping it in all registered span handlers.
76
+ *
77
+ * Handlers chain so each wraps the next. First registered = outermost wrapper.
78
+ * If no handlers are registered, the callback is executed directly.
79
+ */
80
+ startSpan<T>(context: SpanContext, callback: () => Promise<T>): Promise<T>;
81
+ /**
82
+ * Register a span tracing handler.
83
+ *
84
+ * @param _event - Must be "span". Exists for API consistency with BeraMonitoring.
85
+ * @param handler - A StartSpanFn, e.g. Sentry.startSpan.
86
+ * @returns An unsubscribe function to remove the handler.
87
+ */
88
+ addSpanHandler(handler: StartSpanFn): Unsubscribe;
89
+ };
90
+
91
+ /**
92
+ * This is an error class that should be used to handle errors from fetch requests.
93
+ */
94
+ declare class RequestError extends BeraError {
95
+ /**
96
+ * The error response from the request.
97
+ */
98
+ response: Response | ErrorLike | undefined;
99
+ static isCorsError(error: Error): boolean;
100
+ /**
101
+ * The endpoint that was requested.
102
+ */
103
+ endpoint: {
104
+ name?: string;
105
+ url: string;
106
+ type?: "rest" | "graphql" | "rpc";
107
+ };
108
+ /**
109
+ * A list of domains that should have their query params removed.
110
+ */
111
+ private queryRichfulDomains;
112
+ statusCode: number | undefined;
113
+ payload?: object;
114
+ static readonly REASON_MAP: {
115
+ readonly 429: "RATE_LIMITED_429";
116
+ readonly NETWORK_ERROR: "NETWORK_ERROR";
117
+ readonly CORS_ERROR: "CORS";
118
+ };
119
+ constructor(args: IBeraErrorArgs & {
120
+ response: Response | ErrorLike | undefined;
121
+ /**
122
+ * The payload sent to the request.
123
+ */
124
+ payload?: object;
125
+ endpoint: string | URL | {
126
+ name?: string;
127
+ url: string | URL;
128
+ type: "rest" | "graphql" | "rpc";
129
+ };
130
+ statusCode?: number;
131
+ });
132
+ setEndpoint(endpoint: string | URL | {
133
+ name?: string;
134
+ url: string | URL;
135
+ type?: "rest" | "graphql" | "rpc";
136
+ }): {
137
+ name?: string;
138
+ url: string;
139
+ type?: "rest" | "graphql" | "rpc";
140
+ };
141
+ private tryMatchNetworkError;
142
+ }
143
+
144
+ export { BeraTracing as B, type EmitterMixin as E, RequestError as R, type SpanContext as S };