@berachain/berajs 0.2.8-beta.8 → 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 (225) 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-DBOIV65x.d.ts +144 -0
  4. package/dist/abi/exports.mjs +3 -4
  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 +108 -187
  8. package/dist/actions/exports.mjs +97 -158
  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-VA3BQ34H.mjs → chunk-3EARVV7K.mjs} +20 -9
  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-7TFV6UKF.mjs → chunk-BGMRHTBQ.mjs} +0 -1
  18. package/dist/{chunk-3M47ZRXT.mjs → chunk-CDFWPU2R.mjs} +73 -17
  19. package/dist/{chunk-GWSTVITN.mjs → chunk-CDK4YV3D.mjs} +0 -1
  20. package/dist/{chunk-KL6YZ5VR.mjs → chunk-DKMAIU74.mjs} +0 -1
  21. package/dist/chunk-EXIUPSFN.mjs +86 -0
  22. package/dist/{chunk-VA5L5FDG.mjs → chunk-FFB5LFDW.mjs} +2 -3
  23. package/dist/{chunk-ZCEFC2TK.mjs → chunk-HQCOU6GY.mjs} +0 -1
  24. package/dist/{chunk-SGZP4O6R.mjs → chunk-HSSJKHZ4.mjs} +11 -11
  25. package/dist/{chunk-7QKRRIHI.mjs → chunk-J5I45WGQ.mjs} +77 -152
  26. package/dist/chunk-KQUMKB66.mjs +89 -0
  27. package/dist/{chunk-JA4DHMTG.mjs → chunk-NBYLMO2L.mjs} +0 -1
  28. package/dist/{chunk-4GFN4LEP.mjs → chunk-NPBQLVL3.mjs} +4 -21
  29. package/dist/{chunk-I3FTWD6I.mjs → chunk-O2NQFKJK.mjs} +1 -1
  30. package/dist/{chunk-2R73G2PO.mjs → chunk-QJIXTYTZ.mjs} +121 -765
  31. package/dist/{chunk-GLWPRM33.mjs → chunk-SGIJVHZO.mjs} +0 -1
  32. package/dist/chunk-SZ5C44L5.mjs +35 -0
  33. package/dist/{chunk-5NMATIH4.mjs → chunk-WXXOISTU.mjs} +1 -35
  34. package/dist/chunk-XIYN6AL6.mjs +160 -0
  35. package/dist/contexts/exports.d.ts +2 -2
  36. package/dist/contexts/exports.mjs +11 -9
  37. package/dist/enum/exports.d.ts +1 -1
  38. package/dist/enum/exports.mjs +3 -16
  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 +5 -90
  42. package/dist/errors/exports.mjs +19 -10
  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 +80 -236
  47. package/dist/hooks/exports.mjs +609 -1508
  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 +24 -7
  58. package/dist/utils/exports.mjs +49 -11
  59. package/package.json +60 -13
  60. package/src/actions/__test/transports.ts +61 -0
  61. package/src/actions/clients/BeraApolloClient.ts +9 -0
  62. package/src/actions/clients/exports.ts +4 -0
  63. package/src/actions/clients/getApolloClient.ts +70 -25
  64. package/src/actions/clients/getEnsoClient.ts +20 -9
  65. package/src/actions/dex/aggregators/base.ts +1 -1
  66. package/src/actions/dex/aggregators/enso/enso.ts +27 -17
  67. package/src/actions/dex/aggregators/enso/ensoErc4626.ts +2 -2
  68. package/src/actions/dex/aggregators/kyberswap.ts +18 -23
  69. package/src/actions/enso/__tests__/getEnsoUserTokensWithBalances.debug.test.ts +3 -6
  70. package/src/actions/exports.ts +5 -10
  71. package/src/actions/governance/exports.ts +9 -0
  72. package/src/actions/governance/getAllProposals.ts +10 -65
  73. package/src/actions/governance/getProposalDetails.ts +6 -33
  74. package/src/actions/governance/getProposalVotes.ts +8 -15
  75. package/src/actions/honey/getChartData.ts +27 -21
  76. package/src/actions/honey/getHoney24hVolume.ts +27 -0
  77. package/src/actions/pol/getAutoclaimedIncentives.ts +30 -0
  78. package/src/actions/pol/getBeraTokenTotalSupply.ts +45 -0
  79. package/src/actions/pol/getBgtIncentiveDistributorPaused.ts +35 -0
  80. package/src/actions/pol/getEarnedStakedBeraVault.ts +15 -9
  81. package/src/actions/pol/getGlobalData.ts +1 -0
  82. package/src/actions/pol/getHeroEarnVaults.ts +62 -0
  83. package/src/actions/pol/getIncentiveFeeClaimStats.ts +19 -38
  84. package/src/actions/pol/getSWBeraVaultMetadata.ts +1 -1
  85. package/src/actions/pol/getStakingDailyAssets.ts +11 -8
  86. package/src/actions/server/exports.ts +1 -0
  87. package/src/actions/server/getDailyValidatorBlockStats.ts +33 -0
  88. package/src/actions/tokens/getWalletBalances.integration.test.ts +3 -6
  89. package/src/actions/transactions/beraWriteContract.integration.test.ts +3 -6
  90. package/src/actions/validators/getDailyValidatorBlockStats.ts +25 -24
  91. package/src/actions/validators/getValidatorAnalytics.ts +20 -21
  92. package/src/actions/validators/getValidatorIncentiveDistribution.ts +33 -0
  93. package/src/data/contracts.ts +5 -0
  94. package/src/enum/contracts.ts +1 -0
  95. package/src/enum/exports.ts +0 -1
  96. package/src/enum/governance/exports.ts +1 -0
  97. package/src/errors/BeraError.ts +47 -7
  98. package/src/errors/BeraTracing.unit.test.ts +65 -0
  99. package/src/errors/RequestError.ts +15 -2
  100. package/src/errors/exports.ts +5 -0
  101. package/src/errors/getRevertReason.integration.test.ts +3 -3
  102. package/src/errors/spanStatus.ts +78 -0
  103. package/src/errors/spanStatus.unit.test.ts +62 -0
  104. package/src/hooks/dex/useCreatePool.ts +1 -88
  105. package/src/hooks/dex/useOnChainPoolData.ts +27 -2
  106. package/src/hooks/dex/usePriceImpact.ts +12 -5
  107. package/src/hooks/enso/useBendDemultiply.ts +9 -1
  108. package/src/hooks/enso/useBendMultiply.ts +9 -1
  109. package/src/hooks/enso/useBendZapSupply.ts +26 -7
  110. package/src/hooks/enso/useEnsoSwapBundle.ts +17 -3
  111. package/src/hooks/enso/useEnsoUserTokensWithBalances.ts +13 -2
  112. package/src/hooks/exports.ts +3 -16
  113. package/src/hooks/governance/exports.ts +14 -0
  114. package/src/hooks/honey/useHoney24hVolume.ts +16 -0
  115. package/src/hooks/pol/useAutoclaimedIncentives.ts +49 -0
  116. package/src/hooks/pol/useStakedAPR.ts +2 -2
  117. package/src/hooks/pol/useStakedSnapshots.ts +5 -9
  118. package/src/hooks/validators/useValidator.ts +2 -0
  119. package/src/hooks/validators/useValidatorIncentiveDistribution.ts +39 -0
  120. package/src/types/bribe-boost.d.ts +8 -0
  121. package/src/types/exports.ts +0 -1
  122. package/src/types/governance/exports.ts +1 -0
  123. package/src/utils/beraFetch.ts +76 -15
  124. package/src/utils/exports.ts +1 -0
  125. package/src/utils/getServerSideClient.ts +4 -2
  126. package/src/utils/sanitizeRpcUrl.ts +22 -0
  127. package/src/utils/tracedTransport.ts +35 -0
  128. package/dist/BeraError-_mQdkanr.d.ts +0 -94
  129. package/dist/BexStatusProvider-DRymVlQf.d.cts +0 -70
  130. package/dist/HoneyConfigProvider-DfkjmzEf.d.cts +0 -390
  131. package/dist/RequestError-A8XJ6QR9.d.cts +0 -57
  132. package/dist/RequestError-Dk97z8rm.d.ts +0 -57
  133. package/dist/abi/exports.cjs +0 -4453
  134. package/dist/abi/exports.cjs.map +0 -1
  135. package/dist/abi/exports.d.cts +0 -6574
  136. package/dist/abi/exports.mjs.map +0 -1
  137. package/dist/actions/exports.cjs +0 -914
  138. package/dist/actions/exports.cjs.map +0 -1
  139. package/dist/actions/exports.d.cts +0 -1644
  140. package/dist/actions/exports.mjs.map +0 -1
  141. package/dist/chunk-2R73G2PO.mjs.map +0 -1
  142. package/dist/chunk-3M47ZRXT.mjs.map +0 -1
  143. package/dist/chunk-4GFN4LEP.mjs.map +0 -1
  144. package/dist/chunk-5N7QQS55.cjs +0 -130
  145. package/dist/chunk-5N7QQS55.cjs.map +0 -1
  146. package/dist/chunk-5NMATIH4.mjs.map +0 -1
  147. package/dist/chunk-7QKRRIHI.mjs.map +0 -1
  148. package/dist/chunk-7TFV6UKF.mjs.map +0 -1
  149. package/dist/chunk-A4FPM7U3.cjs +0 -63
  150. package/dist/chunk-A4FPM7U3.cjs.map +0 -1
  151. package/dist/chunk-BDHINMWQ.cjs +0 -417
  152. package/dist/chunk-BDHINMWQ.cjs.map +0 -1
  153. package/dist/chunk-BEHP54S3.cjs +0 -24
  154. package/dist/chunk-BEHP54S3.cjs.map +0 -1
  155. package/dist/chunk-EGDXV2PT.cjs +0 -36
  156. package/dist/chunk-EGDXV2PT.cjs.map +0 -1
  157. package/dist/chunk-EWBKSMPG.cjs +0 -13
  158. package/dist/chunk-EWBKSMPG.cjs.map +0 -1
  159. package/dist/chunk-F6ZW7ZDD.cjs +0 -403
  160. package/dist/chunk-F6ZW7ZDD.cjs.map +0 -1
  161. package/dist/chunk-FTXTRUYT.cjs +0 -170
  162. package/dist/chunk-FTXTRUYT.cjs.map +0 -1
  163. package/dist/chunk-GLWPRM33.mjs.map +0 -1
  164. package/dist/chunk-GWSTVITN.mjs.map +0 -1
  165. package/dist/chunk-H3Z37RYU.cjs +0 -15
  166. package/dist/chunk-H3Z37RYU.cjs.map +0 -1
  167. package/dist/chunk-I3FTWD6I.mjs.map +0 -1
  168. package/dist/chunk-JA4DHMTG.mjs.map +0 -1
  169. package/dist/chunk-KL6YZ5VR.mjs.map +0 -1
  170. package/dist/chunk-MXWPP6MS.cjs +0 -572
  171. package/dist/chunk-MXWPP6MS.cjs.map +0 -1
  172. package/dist/chunk-SGZP4O6R.mjs.map +0 -1
  173. package/dist/chunk-TDW5SPXR.cjs +0 -244
  174. package/dist/chunk-TDW5SPXR.cjs.map +0 -1
  175. package/dist/chunk-TGK3IXDN.cjs +0 -169
  176. package/dist/chunk-TGK3IXDN.cjs.map +0 -1
  177. package/dist/chunk-TJEW6YCJ.cjs +0 -97
  178. package/dist/chunk-TJEW6YCJ.cjs.map +0 -1
  179. package/dist/chunk-VA3BQ34H.mjs.map +0 -1
  180. package/dist/chunk-VA5L5FDG.mjs.map +0 -1
  181. package/dist/chunk-XSGCRLSD.cjs +0 -1844
  182. package/dist/chunk-XSGCRLSD.cjs.map +0 -1
  183. package/dist/chunk-XV3GG3HC.cjs +0 -135
  184. package/dist/chunk-XV3GG3HC.cjs.map +0 -1
  185. package/dist/chunk-Y5B224UX.cjs +0 -4698
  186. package/dist/chunk-Y5B224UX.cjs.map +0 -1
  187. package/dist/chunk-ZBTRKBSI.mjs +0 -169
  188. package/dist/chunk-ZBTRKBSI.mjs.map +0 -1
  189. package/dist/chunk-ZCEFC2TK.mjs.map +0 -1
  190. package/dist/contexts/exports.cjs +0 -83
  191. package/dist/contexts/exports.cjs.map +0 -1
  192. package/dist/contexts/exports.d.cts +0 -66
  193. package/dist/contexts/exports.mjs.map +0 -1
  194. package/dist/defaultFlags-D6KfkTZx.d.cts +0 -10
  195. package/dist/dex-C_BB0b0O.d.cts +0 -37
  196. package/dist/enum/exports.cjs +0 -59
  197. package/dist/enum/exports.cjs.map +0 -1
  198. package/dist/enum/exports.d.cts +0 -23
  199. package/dist/enum/exports.mjs.map +0 -1
  200. package/dist/errors/exports.cjs +0 -39
  201. package/dist/errors/exports.cjs.map +0 -1
  202. package/dist/errors/exports.d.cts +0 -413
  203. package/dist/errors/exports.mjs.map +0 -1
  204. package/dist/getValidatorQueuedOperatorAddress-Cql_D50j.d.cts +0 -562
  205. package/dist/global.d-B7IeayVX.d.cts +0 -474
  206. package/dist/honey-CYm0RWf4.d.cts +0 -14
  207. package/dist/hooks/exports.cjs +0 -8333
  208. package/dist/hooks/exports.cjs.map +0 -1
  209. package/dist/hooks/exports.d.cts +0 -1748
  210. package/dist/hooks/exports.mjs.map +0 -1
  211. package/dist/polling-BKnyavLI.d.cts +0 -8
  212. package/dist/txnEnum-7_o92X3N.d.ts +0 -164
  213. package/dist/types/exports.cjs +0 -1
  214. package/dist/types/exports.cjs.map +0 -1
  215. package/dist/types/exports.d.cts +0 -90
  216. package/dist/types/exports.mjs.map +0 -1
  217. package/dist/useHoneySwapState-D6vpv19r.d.cts +0 -32
  218. package/dist/utils/exports.cjs +0 -787
  219. package/dist/utils/exports.cjs.map +0 -1
  220. package/dist/utils/exports.d.cts +0 -412
  221. package/dist/utils/exports.mjs.map +0 -1
  222. package/src/actions/dex/getIsTokenExploited.ts +0 -63
  223. package/src/actions/honey/getHoneyGlobalData.ts +0 -21
  224. package/src/hooks/dex/useExploitedTokens.ts +0 -57
  225. package/src/hooks/honey/useHoneyGlobalData.ts +0 -23
@@ -10,4 +10,3 @@ var POLLING = /* @__PURE__ */ ((POLLING2) => {
10
10
  export {
11
11
  POLLING
12
12
  };
13
- //# sourceMappingURL=chunk-GLWPRM33.mjs.map
@@ -0,0 +1,35 @@
1
+ // src/errors/BeraTracing.ts
2
+ var _handlers = [];
3
+ var BeraTracing = {
4
+ /**
5
+ * Execute a callback, wrapping it in all registered span handlers.
6
+ *
7
+ * Handlers chain so each wraps the next. First registered = outermost wrapper.
8
+ * If no handlers are registered, the callback is executed directly.
9
+ */
10
+ startSpan(context, callback) {
11
+ if (_handlers.length === 0) return callback();
12
+ return _handlers.reduceRight(
13
+ (next, handler) => () => handler(context, next),
14
+ callback
15
+ )();
16
+ },
17
+ /**
18
+ * Register a span tracing handler.
19
+ *
20
+ * @param _event - Must be "span". Exists for API consistency with BeraMonitoring.
21
+ * @param handler - A StartSpanFn, e.g. Sentry.startSpan.
22
+ * @returns An unsubscribe function to remove the handler.
23
+ */
24
+ addSpanHandler(handler) {
25
+ _handlers.push(handler);
26
+ return () => {
27
+ const idx = _handlers.indexOf(handler);
28
+ if (idx !== -1) _handlers.splice(idx, 1);
29
+ };
30
+ }
31
+ };
32
+
33
+ export {
34
+ BeraTracing
35
+ };
@@ -1,38 +1,6 @@
1
1
  import {
2
2
  BeraError
3
- } from "./chunk-7QKRRIHI.mjs";
4
-
5
- // src/errors/BeraTracing.ts
6
- var _handlers = [];
7
- var BeraTracing = {
8
- /**
9
- * Execute a callback, wrapping it in all registered span handlers.
10
- *
11
- * Handlers chain so each wraps the next. First registered = outermost wrapper.
12
- * If no handlers are registered, the callback is executed directly.
13
- */
14
- startSpan(context, callback) {
15
- if (_handlers.length === 0) return callback();
16
- return _handlers.reduceRight(
17
- (next, handler) => () => handler(context, next),
18
- callback
19
- )();
20
- },
21
- /**
22
- * Register a span tracing handler.
23
- *
24
- * @param _event - Must be "span". Exists for API consistency with BeraMonitoring.
25
- * @param handler - A StartSpanFn, e.g. Sentry.startSpan.
26
- * @returns An unsubscribe function to remove the handler.
27
- */
28
- addSpanHandler(handler) {
29
- _handlers.push(handler);
30
- return () => {
31
- const idx = _handlers.indexOf(handler);
32
- if (idx !== -1) _handlers.splice(idx, 1);
33
- };
34
- }
35
- };
3
+ } from "./chunk-J5I45WGQ.mjs";
36
4
 
37
5
  // src/errors/NotFoundError.ts
38
6
  var NotFoundError = class extends BeraError {
@@ -123,8 +91,6 @@ var TransactionFailedError = class extends BeraError {
123
91
  };
124
92
 
125
93
  export {
126
- BeraTracing,
127
94
  NotFoundError,
128
95
  TransactionFailedError
129
96
  };
130
- //# sourceMappingURL=chunk-5NMATIH4.mjs.map
@@ -0,0 +1,160 @@
1
+ import {
2
+ BeraError,
3
+ errorMsgMap,
4
+ httpStatusToSpanStatus,
5
+ reasonToSpanStatus
6
+ } from "./chunk-J5I45WGQ.mjs";
7
+
8
+ // src/errors/RequestError.ts
9
+ import { getUriFromLink } from "@berachain/config";
10
+ import { mainnet } from "@berachain/config/mainnet";
11
+ var RequestError = class _RequestError extends BeraError {
12
+ /**
13
+ * The error response from the request.
14
+ */
15
+ response;
16
+ static isCorsError(error) {
17
+ return error.cause instanceof Response && error.cause.type === "cors";
18
+ }
19
+ /**
20
+ * The endpoint that was requested.
21
+ */
22
+ endpoint;
23
+ /**
24
+ * A list of domains that should have their query params removed.
25
+ */
26
+ queryRichfulDomains = [
27
+ mainnet.bex.aggregatorsProxyUrl,
28
+ "https://api.fly.trade/aggregator/quote",
29
+ "https://open-api.openocean.finance/v4/bera/swap",
30
+ // vercel internal proxy
31
+ "/api/aggregators?aggregator",
32
+ // bonder endpoints have date-based query params (e.g. ?start=2025-11-28)
33
+ mainnet.backend
34
+ ];
35
+ statusCode;
36
+ payload;
37
+ static REASON_MAP = {
38
+ 429: "RATE_LIMITED_429",
39
+ NETWORK_ERROR: "NETWORK_ERROR",
40
+ CORS_ERROR: "CORS"
41
+ };
42
+ constructor(args) {
43
+ super(args);
44
+ this.name = "RequestError";
45
+ this.response = args.response;
46
+ this.payload = args.payload;
47
+ this.endpoint = this.setEndpoint(args.endpoint);
48
+ if (!this.message && typeof this.cause === "object" && this.cause !== null) {
49
+ if ("error" in this.cause && typeof this.cause.error === "string") {
50
+ this.message = this.cause.error;
51
+ }
52
+ }
53
+ if (args.statusCode) {
54
+ this.statusCode = args.statusCode;
55
+ } else if (this.response instanceof Response) {
56
+ this.statusCode = this.response.status;
57
+ }
58
+ if (this.statusCode === 429) {
59
+ this.reason = _RequestError.REASON_MAP[429];
60
+ this.displayMessage = errorMsgMap.HTTP.RATE_LIMITED_429.errorMSG;
61
+ this.level = args.level ?? "warning";
62
+ } else {
63
+ const networkError = this.tryMatchNetworkError();
64
+ if (networkError) {
65
+ this.reason = this.reason ?? networkError.reason;
66
+ this.level = args.level ?? "warning";
67
+ this.endpoint.url = this.endpoint.url ?? networkError.url;
68
+ }
69
+ }
70
+ if (!this.spanStatus && this.reason) {
71
+ this.spanStatus = reasonToSpanStatus(this.reason);
72
+ }
73
+ if (!this.spanStatus && this.statusCode) {
74
+ this.spanStatus = httpStatusToSpanStatus(this.statusCode);
75
+ }
76
+ this.tags = {
77
+ ...this.tags,
78
+ "error.statusCode": this.statusCode,
79
+ "operation.type": "query",
80
+ ...args.tags
81
+ };
82
+ let message = "";
83
+ if (this.reason) {
84
+ message += `${this.reason} \u2013 `;
85
+ } else if (this.statusCode && this.statusCode >= 400) {
86
+ message += `HTTP ${this.statusCode} \u2013 `;
87
+ }
88
+ const endpointLabel = this.endpoint.type ? `${this.endpoint.type}(${this.endpoint.url})` : this.endpoint.url;
89
+ this.message = `${message}${endpointLabel}: ${this.message}`;
90
+ }
91
+ setEndpoint(endpoint) {
92
+ if (typeof endpoint === "string" || endpoint instanceof URL) {
93
+ this.endpoint = {
94
+ url: typeof endpoint === "string" ? endpoint : endpoint.toString()
95
+ };
96
+ } else {
97
+ this.endpoint = {
98
+ ...this.endpoint,
99
+ ...endpoint,
100
+ url: endpoint.url.toString()
101
+ };
102
+ }
103
+ if (this.queryRichfulDomains.some(
104
+ (domain) => this.endpoint.url.includes(getUriFromLink(domain))
105
+ )) {
106
+ try {
107
+ const url = new URL(this.endpoint.url);
108
+ url.search = "";
109
+ this.endpoint.url = url.toString();
110
+ } catch {
111
+ }
112
+ }
113
+ this.tags = {
114
+ ...this.tags,
115
+ "operation.source.url": this.endpoint.url,
116
+ "operation.source.name": this.endpoint.name,
117
+ "operation.source.type": this.endpoint.type
118
+ };
119
+ return this.endpoint;
120
+ }
121
+ tryMatchNetworkError() {
122
+ if (this.cause instanceof Error && "message" in this.cause && typeof this.cause.message === "string" || this.cause instanceof TypeError) {
123
+ const message = this.cause.message;
124
+ if (message.startsWith("Network Error")) {
125
+ return {
126
+ reason: _RequestError.REASON_MAP.NETWORK_ERROR,
127
+ message,
128
+ url: this.endpoint.url
129
+ };
130
+ }
131
+ const failedToFetchMatch = message.match(
132
+ /^(?:NetworkError when attempting to fetch resource\.|Failed to fetch|Load failed) \(([a-z0-9-.]+)\)$/
133
+ );
134
+ if (failedToFetchMatch) {
135
+ return {
136
+ reason: _RequestError.REASON_MAP.NETWORK_ERROR,
137
+ message,
138
+ url: failedToFetchMatch[1]
139
+ };
140
+ }
141
+ }
142
+ if (typeof this.cause === "object" && this.cause !== null && "message" in this.cause && typeof this.cause.message === "string") {
143
+ const message = this.cause.message;
144
+ if (message.startsWith(
145
+ "error: canceling statement due to lock timeout occurred in"
146
+ )) {
147
+ return {
148
+ reason: _RequestError.REASON_MAP.NETWORK_ERROR,
149
+ message,
150
+ url: this.endpoint.url
151
+ };
152
+ }
153
+ }
154
+ return false;
155
+ }
156
+ };
157
+
158
+ export {
159
+ RequestError
160
+ };
@@ -4,8 +4,8 @@ import { B as BeraFlags } from '../defaultFlags-D6KfkTZx.js';
4
4
  export { B as BexStateContext, a as BexStatusProvider, b as BexStatusProviderProps, u as useBexStatus } from '../BexStatusProvider-DRymVlQf.js';
5
5
  import * as react from 'react';
6
6
  import react__default, { PropsWithChildren } from 'react';
7
- import { a as TokenWithMetadata, b as Token, B as BalanceToken } from '../HoneyConfigProvider-DVP_9KZn.js';
8
- export { c as HoneyConfigContext, d as HoneyConfigContextReturn, e as HoneyConfigProvider, f as HoneyConfigProviderProps, T as TokenWithOrder, u as useHoneyConfig } from '../HoneyConfigProvider-DVP_9KZn.js';
7
+ import { a as TokenWithMetadata, b as Token, B as BalanceToken } from '../HoneyConfigProvider-Dkj-_a5x.js';
8
+ export { c as HoneyConfigContext, d as HoneyConfigContextReturn, e as HoneyConfigProvider, f as HoneyConfigProviderProps, T as TokenWithOrder, u as useHoneyConfig } from '../HoneyConfigProvider-Dkj-_a5x.js';
9
9
  import '@berachain/config/internal/flags';
10
10
  import 'viem';
11
11
  import '@berachain/graphql/pol/api';
@@ -14,18 +14,21 @@ import {
14
14
  useBexStatus,
15
15
  useBlockTime,
16
16
  useHoneyConfig
17
- } from "../chunk-VA3BQ34H.mjs";
18
- import "../chunk-SGZP4O6R.mjs";
19
- import "../chunk-ZCEFC2TK.mjs";
20
- import "../chunk-GLWPRM33.mjs";
17
+ } from "../chunk-3EARVV7K.mjs";
18
+ import "../chunk-HSSJKHZ4.mjs";
19
+ import "../chunk-HQCOU6GY.mjs";
20
+ import "../chunk-SGIJVHZO.mjs";
21
21
  import {
22
22
  BeraMonitoring
23
- } from "../chunk-ZBTRKBSI.mjs";
24
- import "../chunk-7TFV6UKF.mjs";
25
- import "../chunk-4GFN4LEP.mjs";
23
+ } from "../chunk-EXIUPSFN.mjs";
24
+ import "../chunk-KQUMKB66.mjs";
25
+ import "../chunk-BGMRHTBQ.mjs";
26
+ import "../chunk-NPBQLVL3.mjs";
27
+ import "../chunk-75M6TF7M.mjs";
28
+ import "../chunk-XIYN6AL6.mjs";
26
29
  import {
27
30
  BeraError
28
- } from "../chunk-7QKRRIHI.mjs";
31
+ } from "../chunk-J5I45WGQ.mjs";
29
32
 
30
33
  // src/contexts/SwrFallback.tsx
31
34
  import { useEffect } from "react";
@@ -80,4 +83,3 @@ export {
80
83
  useBlockTime,
81
84
  useHoneyConfig
82
85
  };
83
- //# sourceMappingURL=exports.mjs.map
@@ -1,4 +1,4 @@
1
- export { C as ContractName, P as ProposalErrorCodes, a as ProposalState, b as ProposalTypeEnum, T as TransactionActionType, V as VoteColorMap, c as VoteEnum } from '../txnEnum-7_o92X3N.js';
1
+ export { C as ContractName, T as TransactionActionType } from '../txnEnum-ByI5dtDi.js';
2
2
  export { A as Aggregators, O as OwnershipType, P as ParameterPreset, a as PoolCreationStep, S as SwapReferrer } from '../dex-C_BB0b0O.js';
3
3
  export { H as HoneySwapAction } from '../honey-CYm0RWf4.js';
4
4
  export { P as POLLING } from '../polling-BKnyavLI.js';
@@ -7,17 +7,10 @@ import {
7
7
  PoolCreationStep,
8
8
  SwapReferrer,
9
9
  TransactionActionType
10
- } from "../chunk-I3FTWD6I.mjs";
11
- import {
12
- ProposalErrorCodes,
13
- ProposalState,
14
- ProposalTypeEnum,
15
- VoteColorMap,
16
- VoteEnum
17
- } from "../chunk-KL6YZ5VR.mjs";
10
+ } from "../chunk-O2NQFKJK.mjs";
18
11
  import {
19
12
  POLLING
20
- } from "../chunk-GLWPRM33.mjs";
13
+ } from "../chunk-SGIJVHZO.mjs";
21
14
 
22
15
  // src/enum/slippage.ts
23
16
  var DEFAULT_SLIPPAGE = 0.5;
@@ -45,15 +38,9 @@ export {
45
38
  POLLING,
46
39
  ParameterPreset,
47
40
  PoolCreationStep,
48
- ProposalErrorCodes,
49
- ProposalState,
50
- ProposalTypeEnum,
51
41
  SLIPPAGE_DEGEN_VALUE,
52
42
  SLIPPAGE_MODE,
53
43
  SwapReferrer,
54
44
  TRANSACTION_MODE,
55
- TransactionActionType,
56
- VoteColorMap,
57
- VoteEnum
45
+ TransactionActionType
58
46
  };
59
- //# sourceMappingURL=exports.mjs.map
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Maps the proposal state from the governor contract to a more human-readable format.
3
+ * Don't edit this enum manually, it's synced with the governor contract.
4
+ *
5
+ * @see https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/governance/IGovernor.sol
6
+ */
7
+ declare enum ProposalState {
8
+ Pending = 0,
9
+ Active = 1,
10
+ Canceled = 2,
11
+ Defeated = 3,
12
+ Succeeded = 4,
13
+ Queued = 5,
14
+ Expired = 6,
15
+ Executed = 7
16
+ }
17
+ declare enum VoteEnum {
18
+ AGAINST = "no",
19
+ FOR = "yes",
20
+ ABSTAIN = "abstain"
21
+ }
22
+ declare enum ProposalErrorCodes {
23
+ REQUIRED = "Required",
24
+ INVALID_AMOUNT = "Invalid amount",
25
+ NEGATIVE_AMOUNT = "Negative amount",
26
+ INVALID_ADDRESS = "Invalid address",
27
+ INVALID_ACTION = "Invalid action",
28
+ INVALID_ABI = "Invalid ABI",
29
+ MUST_BE_HTTPS = "Must be HTTPS",
30
+ MUST_BE_HTTPS_OR_IPFS = "Must be HTTPS or IPFS",
31
+ INVALID_BASEPATH = "Must be a berachain forum link",
32
+ /**
33
+ * Mainly used when it's not a reward vault
34
+ */
35
+ INVALID_CONTRACT = "This is not a valid contract"
36
+ }
37
+ declare enum ProposalTypeEnum {
38
+ CUSTOM_PROPOSAL = "custom-action",
39
+ WHITELIST_REWARD_VAULT = "whitelist-reward-vault",
40
+ BLACKLIST_REWARD_VAULT = "blacklist-reward-vault",
41
+ ERC20_TRANSFER = "erc20-transfer",
42
+ WHITELIST_REWARD_VAULT_INCENTIVE = "whitelist-reward-vault-incentive"
43
+ }
44
+ declare const VoteColorMap: {
45
+ readonly yes: "#059669";
46
+ readonly 1: "#059669";
47
+ readonly no: "#DC2629";
48
+ readonly 2: "#DC2629";
49
+ readonly veto: "#0284C7";
50
+ readonly 4: "#0284C7";
51
+ readonly abstain: "#78716c";
52
+ readonly 3: "#78716c";
53
+ readonly yes_secondary: "#ECFDF5";
54
+ readonly no_secondary: "#FEF2F2";
55
+ readonly veto_secondary: "#F0F9FF";
56
+ readonly abstain_secondary: "#E7E5E4";
57
+ readonly default: "#57534e";
58
+ };
59
+
60
+ export { ProposalErrorCodes, ProposalState, ProposalTypeEnum, VoteColorMap, VoteEnum };
@@ -0,0 +1,14 @@
1
+ import {
2
+ ProposalErrorCodes,
3
+ ProposalState,
4
+ ProposalTypeEnum,
5
+ VoteColorMap,
6
+ VoteEnum
7
+ } from "../../chunk-DKMAIU74.mjs";
8
+ export {
9
+ ProposalErrorCodes,
10
+ ProposalState,
11
+ ProposalTypeEnum,
12
+ VoteColorMap,
13
+ VoteEnum
14
+ };
@@ -1,7 +1,9 @@
1
1
  import { GetPublicClientReturnType } from '@wagmi/core';
2
2
  import { Address, PublicClient, TransactionReceipt } from 'viem';
3
- import { B as BeraError, S as SeverityLevel, I as IBeraErrorArgs } from '../BeraError-_mQdkanr.js';
4
- export { R as RequestError } from '../RequestError-Dk97z8rm.js';
3
+ import { B as BeraError, S as SeverityLevel, I as IBeraErrorArgs } from '../BeraError-7-A5JYy_.js';
4
+ export { a as SpanStatusType, h as httpStatusToSpanStatus, r as reasonToSpanStatus } from '../BeraError-7-A5JYy_.js';
5
+ import { E as EmitterMixin } from '../RequestError-DBOIV65x.js';
6
+ export { B as BeraTracing, R as RequestError, S as SpanContext } from '../RequestError-DBOIV65x.js';
5
7
  import { Hex } from '@berachain-foundation/berancer-sdk';
6
8
  import '@apollo/client';
7
9
 
@@ -64,37 +66,6 @@ value: unknown,
64
66
  */
65
67
  property: string): asserts value is string | number;
66
68
 
67
- interface EventsMap {
68
- [event: string]: any;
69
- }
70
- interface DefaultEvents extends EventsMap {
71
- [event: string]: (...args: any) => void;
72
- }
73
- type Unsubscribe = () => void;
74
- /**
75
- * An interface for mixins that expose the `on` function (without the emitter
76
- * bound to `this`)
77
- *
78
- * ```js
79
- * import { createEmitter } from '~utils/createEmitter'
80
- *
81
- * class Ticker implements EmitterMixin<Events> {
82
- * constructor() {
83
- * this.emitter = createEmitter()
84
- * }
85
- * on(...args) {
86
- * return this.emitter.on(...args)
87
- * }
88
- * tick() {
89
- * this.emitter.emit('tick')
90
- * }
91
- * }
92
- * ```
93
- */
94
- interface EmitterMixin<Events extends EventsMap = DefaultEvents> {
95
- on<K extends keyof Events>(event: K, cb: Events[K]): Unsubscribe;
96
- }
97
-
98
69
  /**
99
70
  * Context passed alongside captured exceptions.
100
71
  * Mirrors the subset of Sentry's CaptureContext that berajs actually uses.
@@ -138,62 +109,6 @@ declare const BeraMonitoring: {
138
109
  exception: (event: ErrorEvent) => void;
139
110
  }>;
140
111
 
141
- /**
142
- * Span context passed to tracing handlers.
143
- * Compatible with Sentry's StartSpanOptions (name, op, attributes).
144
- */
145
- type SpanContext = {
146
- name: string;
147
- op: string;
148
- attributes: Record<string, string | number | boolean | undefined>;
149
- };
150
- /**
151
- * A function that wraps a callback in a tracing span.
152
- * Compatible with Sentry.startSpan's signature.
153
- */
154
- type StartSpanFn = <T>(context: SpanContext, callback: () => Promise<T>) => Promise<T>;
155
- /**
156
- * A generic span-tracing module for berajs.
157
- *
158
- * Instead of calling Sentry.startSpan directly, berajs calls
159
- * `BeraTracing.startSpan()`. Consumer apps subscribe via `.on("span", handler)`
160
- * and forward spans to their tracing provider (Sentry, Datadog, etc.).
161
- *
162
- * Multiple handlers are supported and chain in registration order:
163
- * the first registered handler is the outermost wrapper.
164
- *
165
- * @example
166
- * ```ts
167
- * // In berajs code:
168
- * import { BeraTracing } from "./BeraTracing";
169
- * const result = await BeraTracing.startSpan(
170
- * { name: "GraphQL query", op: "graphql.query", attributes: {} },
171
- * () => executeQuery(),
172
- * );
173
- *
174
- * // In app instrumentation:
175
- * import { BeraTracing } from "@berachain/berajs/errors";
176
- * BeraTracing.addSpanHandler(Sentry.startSpan);
177
- * ```
178
- */
179
- declare const BeraTracing: {
180
- /**
181
- * Execute a callback, wrapping it in all registered span handlers.
182
- *
183
- * Handlers chain so each wraps the next. First registered = outermost wrapper.
184
- * If no handlers are registered, the callback is executed directly.
185
- */
186
- startSpan<T>(context: SpanContext, callback: () => Promise<T>): Promise<T>;
187
- /**
188
- * Register a span tracing handler.
189
- *
190
- * @param _event - Must be "span". Exists for API consistency with BeraMonitoring.
191
- * @param handler - A StartSpanFn, e.g. Sentry.startSpan.
192
- * @returns An unsubscribe function to remove the handler.
193
- */
194
- addSpanHandler(handler: StartSpanFn): Unsubscribe;
195
- };
196
-
197
112
  interface MatchedError {
198
113
  /** The error key in the errorMap (e.g. "NOT_ENOUGH_GAS_TOKEN") */
199
114
  key: string;
@@ -410,4 +325,4 @@ declare class TransactionFailedError extends BeraError {
410
325
  });
411
326
  }
412
327
 
413
- export { BeraError, BeraMonitoring, BeraTracing, type CaptureContext, type ErrorEvent, IBeraErrorArgs, type IInvalidArgumentErrorArgs, type INotFoundErrorArgs, InvalidArgumentError, type MatchedError, NotFoundError, SeverityLevel, type SpanContext, TransactionFailedError, assertAddress, assertAmount, assertDefined, assertPositive, assertPublicClient, findMatchingError, getErrorMessage, initBeraError };
328
+ 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,24 +1,32 @@
1
1
  import {
2
- BeraTracing,
3
2
  NotFoundError,
4
3
  TransactionFailedError
5
- } from "../chunk-5NMATIH4.mjs";
4
+ } from "../chunk-WXXOISTU.mjs";
6
5
  import {
7
6
  BeraMonitoring,
7
+ initBeraError
8
+ } from "../chunk-EXIUPSFN.mjs";
9
+ import {
8
10
  assertAddress,
9
11
  assertAmount,
10
12
  assertDefined,
11
13
  assertPositive,
12
- assertPublicClient,
13
- initBeraError
14
- } from "../chunk-ZBTRKBSI.mjs";
14
+ assertPublicClient
15
+ } from "../chunk-KQUMKB66.mjs";
16
+ import {
17
+ BeraTracing
18
+ } from "../chunk-SZ5C44L5.mjs";
19
+ import {
20
+ RequestError
21
+ } from "../chunk-XIYN6AL6.mjs";
15
22
  import {
16
23
  BeraError,
17
24
  InvalidArgumentError,
18
- RequestError,
19
25
  findMatchingError,
20
- getErrorMessage
21
- } from "../chunk-7QKRRIHI.mjs";
26
+ getErrorMessage,
27
+ httpStatusToSpanStatus,
28
+ reasonToSpanStatus
29
+ } from "../chunk-J5I45WGQ.mjs";
22
30
  export {
23
31
  BeraError,
24
32
  BeraMonitoring,
@@ -34,6 +42,7 @@ export {
34
42
  assertPublicClient,
35
43
  findMatchingError,
36
44
  getErrorMessage,
37
- initBeraError
45
+ httpStatusToSpanStatus,
46
+ initBeraError,
47
+ reasonToSpanStatus
38
48
  };
39
- //# sourceMappingURL=exports.mjs.map
@@ -0,0 +1,40 @@
1
+ import { ApolloClient, OperationVariables } from '@apollo/client';
2
+
3
+ /**
4
+ * This is a wrapper around the ApolloClient that throws a BeraError if the query returns an error or no data.
5
+ *
6
+ * It's mostly a typescript helper that keeps data always defined since we use errorPolicy: "none" by default.
7
+ * Such setting will throw an error if the query returns an error, rather than returning an object with undefined data and an error property.
8
+ */
9
+ declare class BeraApolloClient extends ApolloClient {
10
+ /**
11
+ * The URL of the endpoint. Used for error reporting only.
12
+ */
13
+ protected url: string;
14
+ protected serviceName: string;
15
+ constructor(options: ApolloClient.Options & {
16
+ /**
17
+ * The URL of the endpoint. Used for error reporting only.
18
+ */
19
+ url: string;
20
+ /**
21
+ * The name of the graphql service. Used for error reporting only.
22
+ */
23
+ name: string;
24
+ });
25
+ query<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: Omit<ApolloClient.QueryOptions<TData, TVariables>, "errorPolicy">): Promise<{
26
+ data: TData;
27
+ }>;
28
+ }
29
+
30
+ /**
31
+ * Browser-reachable Apollo client factory for `api` and Bend's `whisk`
32
+ * endpoints. Subgraph clients (honey/pol) are server-only; browser data
33
+ * access goes through the typed `/api/honey/*` and `/api/pol/*` REST
34
+ * endpoints. Same auth shape as bend.whiskApi — non-public env values only
35
+ * resolve server-side.
36
+ */
37
+ type GraphqlClient = "api" | "bend.whisk" | "honey.subgraph" | "pol.subgraph";
38
+ declare function getApolloClient(clientName: GraphqlClient, { ...args }: BeraJS.BaseFunctionArgs): BeraApolloClient;
39
+
40
+ export { BeraApolloClient as B, getApolloClient as g };
@@ -1,9 +1,9 @@
1
1
  import { Address, PublicClient, Hex } from 'viem';
2
2
  import { BeraConfig, ChainId } from '@berachain/config/internal';
3
- import { I as IAggregatorArgs, g as IRawAggregatorQuote, b as Token, d as HoneyConfigContextReturn, B as BalanceToken, P as PythLatestUpdates } from './HoneyConfigProvider-DVP_9KZn.js';
3
+ import { I as IAggregatorArgs, g as IRawAggregatorQuote, b as Token, d as HoneyConfigContextReturn, B as BalanceToken, P as PythLatestUpdates } from './HoneyConfigProvider-Dkj-_a5x.js';
4
4
  import { A as Aggregators } from './dex-C_BB0b0O.js';
5
5
  import { GqlPoolType, GlobalDataQuery, ApiVaultFragment, GetVaultsQueryVariables, GqlChain, GetVaultHistoryQueryVariables, GetVaultHistoryQuery, ApiValidatorInListFragment } from '@berachain/graphql/pol/api';
6
- import { P as ProtocolMetadata } from './global.d-5w_lvl2J.js';
6
+ import { P as ProtocolMetadata } from './pol.d-CqPA9K6m.js';
7
7
 
8
8
  interface GetConvertToAssetsProps {
9
9
  sharesAmount: bigint;