@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
@@ -0,0 +1,12 @@
1
+ // src/enum/polling.ts
2
+ var POLLING = /* @__PURE__ */ ((POLLING2) => {
3
+ POLLING2[POLLING2["FAST"] = 1e4] = "FAST";
4
+ POLLING2[POLLING2["NORMAL"] = 1e5] = "NORMAL";
5
+ POLLING2[POLLING2["SLOW"] = 18e4] = "SLOW";
6
+ POLLING2[POLLING2["REFRESH_BLOCK_INTERVAL"] = 1e4] = "REFRESH_BLOCK_INTERVAL";
7
+ return POLLING2;
8
+ })(POLLING || {});
9
+
10
+ export {
11
+ POLLING
12
+ };
@@ -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
+ };
@@ -0,0 +1,96 @@
1
+ import {
2
+ BeraError
3
+ } from "./chunk-J5I45WGQ.mjs";
4
+
5
+ // src/errors/NotFoundError.ts
6
+ var NotFoundError = class extends BeraError {
7
+ /**
8
+ * The name of the resource that was not found.
9
+ *
10
+ * @example "Reward vault"
11
+ */
12
+ resource;
13
+ /**
14
+ * The id of the resource that was not found.
15
+ *
16
+ * @example "0x1234567890123456789012345678901234567890"
17
+ */
18
+ id;
19
+ constructor(args) {
20
+ super(args);
21
+ this.name = "NotFoundError";
22
+ this.level = args.level ?? "info";
23
+ this.message = `Resource ${args.resource} with id ${args.id} not found`;
24
+ this.resource = args.resource;
25
+ this.id = args.id;
26
+ }
27
+ };
28
+
29
+ // src/errors/TransactionFailedError.ts
30
+ var TransactionFailedError = class extends BeraError {
31
+ /**
32
+ * The hash of the transaction that failed.
33
+ *
34
+ * Null if the error is due to a simulation failure.
35
+ */
36
+ txHash;
37
+ /**
38
+ * The receipt of the transaction that failed.
39
+ *
40
+ * Null if the error is due to a simulation failure.
41
+ */
42
+ receipt;
43
+ /**
44
+ * The address of the contract that was called.
45
+ */
46
+ to;
47
+ /**
48
+ * The data of the transaction that failed.
49
+ */
50
+ callData;
51
+ /**
52
+ * The block number of the transaction that failed.
53
+ */
54
+ blockNumber = null;
55
+ /**
56
+ * The input of the transaction that failed.
57
+ */
58
+ input;
59
+ /**
60
+ * The function name of the transaction that failed.
61
+ */
62
+ functionName;
63
+ constructor(args) {
64
+ super(args);
65
+ this.name = "TransactionFailedError";
66
+ this.txHash = args.txHash || null;
67
+ this.receipt = args.receipt || null;
68
+ this.to = args.to;
69
+ this.functionName = args.functionName;
70
+ this.blockNumber = args.blockNumber ?? null;
71
+ this.input = args.input;
72
+ if (this.receipt) {
73
+ this.message = `Transaction reverted on chain for reason: ${this.reason}`;
74
+ } else if (this.txHash) {
75
+ this.message = `Transaction reverted after being broadcasted for reason: ${this.reason}`;
76
+ } else {
77
+ this.message = `${this.reason}: ${this.message}`;
78
+ }
79
+ this.tags = {
80
+ ...this.tags,
81
+ "operation.txn.status": args.txHash ? "execution" : "simulation",
82
+ ...args.tags
83
+ };
84
+ if (this.to) {
85
+ this.tags["operation.txn.to"] = this.to;
86
+ }
87
+ if (this.functionName) {
88
+ this.tags["operation.txn.functionName"] = this.functionName;
89
+ }
90
+ }
91
+ };
92
+
93
+ export {
94
+ NotFoundError,
95
+ TransactionFailedError
96
+ };
@@ -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';
@@ -1,2 +1,85 @@
1
- "use client";import{a as i,b as l,c as m,d as c,e as u,f as g,g as R,h as x,i as d,j as F,k as S,l as w,n as B,o as W}from"../chunk-ISYNEDET.mjs";import"../chunk-47ILYVHC.mjs";import"../chunk-NAXAZJJY.mjs";import"../chunk-575OK77P.mjs";import{g as a}from"../chunk-WBTS6KFG.mjs";import"../chunk-MK5NS5B5.mjs";import"../chunk-5NVZG5N6.mjs";import{f as t}from"../chunk-GXV2JA36.mjs";import{useEffect as p}from"react";import{SWRConfig as f}from"swr";import{jsx as s}from"react/jsx-runtime";function k({fallback:r,children:n}){return p(()=>{Object.entries(r).some(([e,o])=>e?!1:(console.warn("SWRFallback",e,o),a.captureException(new t({message:"Empty key in SWRFallback. This will lead to wrong query returns when key is null. Should be reported to SWR.",level:"warning",extra:{key:e,value:o}})),!0))},[r]),s(f,{value:{fallback:r},children:n})}export{i as BeraFlagsProvider,c as BexStateContext,g as BexStatusProvider,x as BlockTimeContext,d as BlockTimeProvider,F as HoneyConfigContext,S as HoneyConfigProvider,k as SWRFallback,B as TokenContext,W as TokensProvider,m as useBeraFlag,l as useBeraFlags,u as useBexStatus,R as useBlockTime,w as useHoneyConfig};
2
- //# sourceMappingURL=exports.mjs.map
1
+ "use client";
2
+ import {
3
+ BeraFlagsProvider,
4
+ BexStateContext,
5
+ BexStatusProvider,
6
+ BlockTimeContext,
7
+ BlockTimeProvider,
8
+ HoneyConfigContext,
9
+ HoneyConfigProvider,
10
+ TokenContext,
11
+ TokensProvider,
12
+ useBeraFlag,
13
+ useBeraFlags,
14
+ useBexStatus,
15
+ useBlockTime,
16
+ useHoneyConfig
17
+ } from "../chunk-3EARVV7K.mjs";
18
+ import "../chunk-HSSJKHZ4.mjs";
19
+ import "../chunk-HQCOU6GY.mjs";
20
+ import "../chunk-SGIJVHZO.mjs";
21
+ import {
22
+ BeraMonitoring
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";
29
+ import {
30
+ BeraError
31
+ } from "../chunk-J5I45WGQ.mjs";
32
+
33
+ // src/contexts/SwrFallback.tsx
34
+ import { useEffect } from "react";
35
+ import { SWRConfig } from "swr";
36
+ import { jsx } from "react/jsx-runtime";
37
+ function SWRFallback({
38
+ fallback,
39
+ children
40
+ }) {
41
+ useEffect(() => {
42
+ Object.entries(fallback).some(([key, value]) => {
43
+ if (!key) {
44
+ console.warn("SWRFallback", key, value);
45
+ BeraMonitoring.captureException(
46
+ new BeraError({
47
+ message: "Empty key in SWRFallback. This will lead to wrong query returns when key is null. Should be reported to SWR.",
48
+ level: "warning",
49
+ extra: {
50
+ key,
51
+ value
52
+ }
53
+ })
54
+ );
55
+ return true;
56
+ } else return false;
57
+ });
58
+ }, [fallback]);
59
+ return /* @__PURE__ */ jsx(
60
+ SWRConfig,
61
+ {
62
+ value: {
63
+ fallback
64
+ },
65
+ children
66
+ }
67
+ );
68
+ }
69
+ export {
70
+ BeraFlagsProvider,
71
+ BexStateContext,
72
+ BexStatusProvider,
73
+ BlockTimeContext,
74
+ BlockTimeProvider,
75
+ HoneyConfigContext,
76
+ HoneyConfigProvider,
77
+ SWRFallback,
78
+ TokenContext,
79
+ TokensProvider,
80
+ useBeraFlag,
81
+ useBeraFlags,
82
+ useBexStatus,
83
+ useBlockTime,
84
+ useHoneyConfig
85
+ };
@@ -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';
@@ -1,2 +1,46 @@
1
- import{a as c,b as f,c as U,d as u,e as a,f as i,g as F,h as L}from"../chunk-JDZGYU5T.mjs";import{a as e,b as p,c as x,d as m,e as n}from"../chunk-OGJMSGB2.mjs";import{a as s}from"../chunk-575OK77P.mjs";var E=.5,d=25,g=60,t=(o=>(o.AUTO="auto",o.CUSTOM="custom",o.DEGEN="degen",o))(t||{}),r=(o=>(o.AUTO="auto",o.CUSTOM="custom",o.INFINITY="infinity",o))(r||{});export{a as Aggregators,c as ContractName,g as DEFAULT_DEADLINE,E as DEFAULT_SLIPPAGE,F as HoneySwapAction,f as OwnershipType,s as POLLING,U as ParameterPreset,u as PoolCreationStep,x as ProposalErrorCodes,e as ProposalState,m as ProposalTypeEnum,d as SLIPPAGE_DEGEN_VALUE,t as SLIPPAGE_MODE,i as SwapReferrer,r as TRANSACTION_MODE,L as TransactionActionType,n as VoteColorMap,p as VoteEnum};
2
- //# sourceMappingURL=exports.mjs.map
1
+ import {
2
+ Aggregators,
3
+ ContractName,
4
+ HoneySwapAction,
5
+ OwnershipType,
6
+ ParameterPreset,
7
+ PoolCreationStep,
8
+ SwapReferrer,
9
+ TransactionActionType
10
+ } from "../chunk-O2NQFKJK.mjs";
11
+ import {
12
+ POLLING
13
+ } from "../chunk-SGIJVHZO.mjs";
14
+
15
+ // src/enum/slippage.ts
16
+ var DEFAULT_SLIPPAGE = 0.5;
17
+ var SLIPPAGE_DEGEN_VALUE = 25;
18
+ var DEFAULT_DEADLINE = 60;
19
+ var SLIPPAGE_MODE = /* @__PURE__ */ ((SLIPPAGE_MODE2) => {
20
+ SLIPPAGE_MODE2["AUTO"] = "auto";
21
+ SLIPPAGE_MODE2["CUSTOM"] = "custom";
22
+ SLIPPAGE_MODE2["DEGEN"] = "degen";
23
+ return SLIPPAGE_MODE2;
24
+ })(SLIPPAGE_MODE || {});
25
+ var TRANSACTION_MODE = /* @__PURE__ */ ((TRANSACTION_MODE2) => {
26
+ TRANSACTION_MODE2["AUTO"] = "auto";
27
+ TRANSACTION_MODE2["CUSTOM"] = "custom";
28
+ TRANSACTION_MODE2["INFINITY"] = "infinity";
29
+ return TRANSACTION_MODE2;
30
+ })(TRANSACTION_MODE || {});
31
+ export {
32
+ Aggregators,
33
+ ContractName,
34
+ DEFAULT_DEADLINE,
35
+ DEFAULT_SLIPPAGE,
36
+ HoneySwapAction,
37
+ OwnershipType,
38
+ POLLING,
39
+ ParameterPreset,
40
+ PoolCreationStep,
41
+ SLIPPAGE_DEGEN_VALUE,
42
+ SLIPPAGE_MODE,
43
+ SwapReferrer,
44
+ TRANSACTION_MODE,
45
+ TransactionActionType
46
+ };
@@ -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,8 +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
- import { E as EmitterMixin } from '../RequestError-BRIiJgHk.js';
5
- export { B as BeraTracing, R as RequestError, S as SpanContext } from '../RequestError-BRIiJgHk.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';
6
7
  import { Hex } from '@berachain-foundation/berancer-sdk';
7
8
  import '@apollo/client';
8
9
 
@@ -1,2 +1,48 @@
1
- import{a as C,b as g}from"../chunk-RJN36GBU.mjs";import{a as m,b as n,c as y,d as a,e as i,f as v,g as e}from"../chunk-WBTS6KFG.mjs";import{a as r}from"../chunk-PRLVZIKD.mjs";import{a as o,b as t,f as p,g as x,h as f}from"../chunk-GXV2JA36.mjs";export{p as BeraError,e as BeraMonitoring,r as BeraTracing,f as InvalidArgumentError,C as NotFoundError,x as RequestError,g as TransactionFailedError,a as assertAddress,v as assertAmount,n as assertDefined,i as assertPositive,y as assertPublicClient,o as findMatchingError,t as getErrorMessage,m as initBeraError};
2
- //# sourceMappingURL=exports.mjs.map
1
+ import {
2
+ NotFoundError,
3
+ TransactionFailedError
4
+ } from "../chunk-WXXOISTU.mjs";
5
+ import {
6
+ BeraMonitoring,
7
+ initBeraError
8
+ } from "../chunk-EXIUPSFN.mjs";
9
+ import {
10
+ assertAddress,
11
+ assertAmount,
12
+ assertDefined,
13
+ assertPositive,
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";
22
+ import {
23
+ BeraError,
24
+ InvalidArgumentError,
25
+ findMatchingError,
26
+ getErrorMessage,
27
+ httpStatusToSpanStatus,
28
+ reasonToSpanStatus
29
+ } from "../chunk-J5I45WGQ.mjs";
30
+ export {
31
+ BeraError,
32
+ BeraMonitoring,
33
+ BeraTracing,
34
+ InvalidArgumentError,
35
+ NotFoundError,
36
+ RequestError,
37
+ TransactionFailedError,
38
+ assertAddress,
39
+ assertAmount,
40
+ assertDefined,
41
+ assertPositive,
42
+ assertPublicClient,
43
+ findMatchingError,
44
+ getErrorMessage,
45
+ httpStatusToSpanStatus,
46
+ initBeraError,
47
+ reasonToSpanStatus
48
+ };
@@ -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;