@berachain/berajs 0.2.8-beta.9 → 0.2.10

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 (254) 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 +78 -0
  6. package/dist/actions/clients/exports.mjs +21 -0
  7. package/dist/actions/exports.d.ts +154 -207
  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-3JJLQ2JX.mjs +211 -0
  14. package/dist/chunk-7YVNSDXG.mjs +86 -0
  15. package/dist/chunk-AUOPN6NK.mjs +96 -0
  16. package/dist/chunk-BGMRHTBQ.mjs +23 -0
  17. package/dist/chunk-CDK4YV3D.mjs +571 -0
  18. package/dist/chunk-DKMAIU74.mjs +62 -0
  19. package/dist/chunk-DQRH5VE3.mjs +25 -0
  20. package/dist/chunk-E7YFXBBQ.mjs +349 -0
  21. package/dist/chunk-GUURQAME.mjs +326 -0
  22. package/dist/chunk-GY6B3PD5.mjs +89 -0
  23. package/dist/chunk-HQCOU6GY.mjs +243 -0
  24. package/dist/chunk-HYDP32P6.mjs +135 -0
  25. package/dist/chunk-IXIBY5FP.mjs +80 -0
  26. package/dist/chunk-KHXJDYA4.mjs +1776 -0
  27. package/dist/chunk-NBYLMO2L.mjs +14 -0
  28. package/dist/chunk-O2NQFKJK.mjs +170 -0
  29. package/dist/chunk-P5WXXULM.mjs +54 -0
  30. package/dist/chunk-QBBOWFMH.mjs +4129 -0
  31. package/dist/chunk-QVHEM4BG.mjs +35 -0
  32. package/dist/chunk-SGIJVHZO.mjs +12 -0
  33. package/dist/chunk-SZ5C44L5.mjs +35 -0
  34. package/dist/chunk-WNBWX23Q.mjs +426 -0
  35. package/dist/chunk-Y6THHG77.mjs +126 -0
  36. package/dist/chunk-ZLTMIFCZ.mjs +165 -0
  37. package/dist/contexts/exports.d.ts +2 -2
  38. package/dist/contexts/exports.mjs +85 -2
  39. package/dist/enum/exports.d.ts +1 -1
  40. package/dist/enum/exports.mjs +46 -2
  41. package/dist/enum/governance/exports.d.ts +60 -0
  42. package/dist/enum/governance/exports.mjs +14 -0
  43. package/dist/errors/exports.d.ts +4 -3
  44. package/dist/errors/exports.mjs +48 -2
  45. package/dist/getApolloClient-BcUTGFUb.d.ts +40 -0
  46. package/dist/{getValidatorQueuedOperatorAddress-BcyxE9uw.d.ts → getValidatorQueuedOperatorAddress-DphU3qhE.d.ts} +2 -2
  47. package/dist/{global.d-5w_lvl2J.d.ts → global.d-BuGDKh4k.d.ts} +4 -240
  48. package/dist/hooks/exports.d.ts +83 -226
  49. package/dist/hooks/exports.mjs +7463 -4
  50. package/dist/hooks/governance/exports.d.ts +181 -0
  51. package/dist/hooks/governance/exports.mjs +888 -0
  52. package/dist/pol.d-Dw5SQcRX.d.ts +153 -0
  53. package/dist/{txnEnum-7_o92X3N.d.cts → txnEnum-ByI5dtDi.d.ts} +2 -60
  54. package/dist/types/exports.d.ts +9 -9
  55. package/dist/types/exports.mjs +0 -1
  56. package/dist/types/governance/exports.d.ts +109 -0
  57. package/dist/types/governance/exports.mjs +0 -0
  58. package/dist/{useHoneySwapState-B494PQDl.d.ts → useHoneySwapState-vFmuFF0g.d.ts} +1 -1
  59. package/dist/utils/exports.d.ts +15 -6
  60. package/dist/utils/exports.mjs +827 -2
  61. package/package.json +49 -13
  62. package/src/actions/__test/transports.ts +61 -0
  63. package/src/actions/clients/exports.ts +7 -0
  64. package/src/actions/clients/fetchBeep.ts +34 -0
  65. package/src/actions/clients/fetchOpenApi.ts +93 -0
  66. package/src/actions/clients/fetchOpenApi.unit.test.ts +223 -0
  67. package/src/actions/clients/fetchRailwayBackend.ts +34 -0
  68. package/src/actions/clients/getApolloClient.ts +58 -23
  69. package/src/actions/clients/getEnsoClient.ts +20 -9
  70. package/src/actions/dex/aggregators/enso/enso.ts +27 -17
  71. package/src/actions/dex/aggregators/enso/ensoErc4626.ts +2 -2
  72. package/src/actions/dex/aggregators/kyberswap.ts +18 -23
  73. package/src/actions/enso/__tests__/getEnsoUserTokensWithBalances.debug.test.ts +3 -6
  74. package/src/actions/enso/getEnsoUserTokensWithBalances.ts +18 -0
  75. package/src/actions/exports.ts +5 -9
  76. package/src/actions/governance/exports.ts +9 -0
  77. package/src/actions/governance/getAllProposals.ts +10 -65
  78. package/src/actions/governance/getProposalDetails.ts +6 -33
  79. package/src/actions/governance/getProposalVotes.ts +8 -15
  80. package/src/actions/honey/getChartData.ts +27 -21
  81. package/src/actions/honey/getHoney24hVolume.ts +19 -22
  82. package/src/actions/honey/getPythLatestPrices.ts +7 -0
  83. package/src/actions/pol/__tests__/rewardVaults.integration.test.ts +1 -1
  84. package/src/actions/pol/getAutoclaimedIncentives.ts +41 -0
  85. package/src/actions/pol/getAutoclaimedIncentivesTxHash.ts +41 -0
  86. package/src/actions/pol/getBeraTokenTotalSupply.ts +45 -0
  87. package/src/actions/pol/getBgtIncentiveDistributorPaused.ts +28 -0
  88. package/src/actions/pol/getEarnedStakedBeraVault.ts +20 -20
  89. package/src/actions/pol/getGlobalData.ts +1 -0
  90. package/src/actions/pol/getHeroEarnVaults.ts +62 -0
  91. package/src/actions/pol/getIncentiveFeeClaimStats.ts +19 -38
  92. package/src/actions/pol/getRewardVaults.ts +4 -4
  93. package/src/actions/pol/getSWBeraVaultMetadata.ts +1 -1
  94. package/src/actions/pol/getStakingDailyAssets.ts +18 -17
  95. package/src/actions/server/exports.ts +1 -0
  96. package/src/actions/server/getDailyValidatorBlockStats.ts +33 -0
  97. package/src/actions/tokens/getWalletBalances.integration.test.ts +3 -6
  98. package/src/actions/transactions/beraWriteContract.integration.test.ts +3 -6
  99. package/src/actions/validators/getDailyValidatorBlockStats.ts +25 -24
  100. package/src/actions/validators/getValidatorAnalytics.ts +20 -21
  101. package/src/actions/validators/getValidatorIncentiveDistribution.ts +33 -0
  102. package/src/actions/validators/utils/getValidatorBoostApy.ts +1 -1
  103. package/src/enum/contracts.ts +1 -0
  104. package/src/enum/exports.ts +0 -1
  105. package/src/enum/governance/exports.ts +1 -0
  106. package/src/errors/BeraError.ts +47 -7
  107. package/src/errors/BeraTracing.unit.test.ts +65 -0
  108. package/src/errors/RequestError.ts +25 -4
  109. package/src/errors/RequestError.unit.test.ts +55 -0
  110. package/src/errors/errorMap.ts +8 -0
  111. package/src/errors/exports.ts +5 -0
  112. package/src/errors/getRevertReason.integration.test.ts +3 -3
  113. package/src/errors/spanStatus.ts +78 -0
  114. package/src/errors/spanStatus.unit.test.ts +62 -0
  115. package/src/hooks/dex/useCreatePool.ts +1 -88
  116. package/src/hooks/dex/useOnChainPoolData.ts +27 -2
  117. package/src/hooks/dex/usePriceImpact.ts +12 -5
  118. package/src/hooks/enso/useBendDemultiply.ts +9 -1
  119. package/src/hooks/enso/useBendMultiply.ts +9 -1
  120. package/src/hooks/enso/useBendZapSupply.ts +26 -7
  121. package/src/hooks/enso/useEnsoSwapBundle.ts +17 -3
  122. package/src/hooks/enso/useEnsoUserTokensWithBalances.ts +13 -2
  123. package/src/hooks/exports.ts +3 -15
  124. package/src/hooks/governance/exports.ts +14 -0
  125. package/src/hooks/pol/useAutoclaimedIncentives.ts +40 -0
  126. package/src/hooks/pol/useAutoclaimedIncentivesTxHash.ts +45 -0
  127. package/src/hooks/pol/useStakedAPR.ts +2 -2
  128. package/src/hooks/pol/useStakedSnapshots.ts +5 -9
  129. package/src/hooks/validators/useValidator.ts +6 -8
  130. package/src/hooks/validators/useValidatorIncentiveDistribution.ts +39 -0
  131. package/src/types/bribe-boost.d.ts +19 -0
  132. package/src/types/exports.ts +0 -1
  133. package/src/types/governance/exports.ts +1 -0
  134. package/src/utils/beraFetch.ts +9 -3
  135. package/src/utils/exports.ts +1 -0
  136. package/src/utils/getServerSideClient.ts +4 -2
  137. package/src/utils/polyfillAbortSignalAny.ts +53 -0
  138. package/src/utils/polyfillAbortSignalAny.unit.test.ts +81 -0
  139. package/src/utils/sanitizeRpcUrl.ts +22 -0
  140. package/src/utils/tracedTransport.ts +35 -0
  141. package/dist/BeraError-_mQdkanr.d.ts +0 -94
  142. package/dist/BexStatusProvider-DRymVlQf.d.cts +0 -70
  143. package/dist/HoneyConfigProvider-DfkjmzEf.d.cts +0 -390
  144. package/dist/RequestError-DSUzJ1Iy.d.cts +0 -144
  145. package/dist/abi/exports.cjs +0 -2
  146. package/dist/abi/exports.cjs.map +0 -1
  147. package/dist/abi/exports.d.cts +0 -6574
  148. package/dist/abi/exports.mjs.map +0 -1
  149. package/dist/actions/exports.cjs +0 -2
  150. package/dist/actions/exports.cjs.map +0 -1
  151. package/dist/actions/exports.d.cts +0 -1650
  152. package/dist/actions/exports.mjs.map +0 -1
  153. package/dist/chunk-45HIEVNI.cjs +0 -4
  154. package/dist/chunk-45HIEVNI.cjs.map +0 -1
  155. package/dist/chunk-47ILYVHC.mjs +0 -2
  156. package/dist/chunk-47ILYVHC.mjs.map +0 -1
  157. package/dist/chunk-575OK77P.mjs +0 -2
  158. package/dist/chunk-575OK77P.mjs.map +0 -1
  159. package/dist/chunk-5NVZG5N6.mjs +0 -2
  160. package/dist/chunk-5NVZG5N6.mjs.map +0 -1
  161. package/dist/chunk-6DIA6PXV.cjs +0 -2
  162. package/dist/chunk-6DIA6PXV.cjs.map +0 -1
  163. package/dist/chunk-6JJIZCVY.cjs +0 -2
  164. package/dist/chunk-6JJIZCVY.cjs.map +0 -1
  165. package/dist/chunk-7F72ZH4Q.mjs +0 -2
  166. package/dist/chunk-7F72ZH4Q.mjs.map +0 -1
  167. package/dist/chunk-AUA42YIG.mjs +0 -4
  168. package/dist/chunk-AUA42YIG.mjs.map +0 -1
  169. package/dist/chunk-BC2WX6O6.cjs +0 -2
  170. package/dist/chunk-BC2WX6O6.cjs.map +0 -1
  171. package/dist/chunk-CJOZC5Z2.cjs +0 -2
  172. package/dist/chunk-CJOZC5Z2.cjs.map +0 -1
  173. package/dist/chunk-D6L7LTA2.cjs +0 -2
  174. package/dist/chunk-D6L7LTA2.cjs.map +0 -1
  175. package/dist/chunk-DDEQFR3M.cjs +0 -2
  176. package/dist/chunk-DDEQFR3M.cjs.map +0 -1
  177. package/dist/chunk-GXV2JA36.mjs +0 -2
  178. package/dist/chunk-GXV2JA36.mjs.map +0 -1
  179. package/dist/chunk-ISYNEDET.mjs +0 -2
  180. package/dist/chunk-ISYNEDET.mjs.map +0 -1
  181. package/dist/chunk-JDDRTHFG.mjs +0 -2
  182. package/dist/chunk-JDDRTHFG.mjs.map +0 -1
  183. package/dist/chunk-JDZGYU5T.mjs +0 -2
  184. package/dist/chunk-JDZGYU5T.mjs.map +0 -1
  185. package/dist/chunk-LVOXBZMA.cjs +0 -2
  186. package/dist/chunk-LVOXBZMA.cjs.map +0 -1
  187. package/dist/chunk-MK5NS5B5.mjs +0 -2
  188. package/dist/chunk-MK5NS5B5.mjs.map +0 -1
  189. package/dist/chunk-NAXAZJJY.mjs +0 -2
  190. package/dist/chunk-NAXAZJJY.mjs.map +0 -1
  191. package/dist/chunk-NLVWRMGD.mjs +0 -2
  192. package/dist/chunk-NLVWRMGD.mjs.map +0 -1
  193. package/dist/chunk-OGBD5YOG.mjs +0 -2
  194. package/dist/chunk-OGBD5YOG.mjs.map +0 -1
  195. package/dist/chunk-OGJMSGB2.mjs +0 -2
  196. package/dist/chunk-OGJMSGB2.mjs.map +0 -1
  197. package/dist/chunk-OIYXOKTT.cjs +0 -2
  198. package/dist/chunk-OIYXOKTT.cjs.map +0 -1
  199. package/dist/chunk-OUD27MU7.cjs +0 -2
  200. package/dist/chunk-OUD27MU7.cjs.map +0 -1
  201. package/dist/chunk-PRLVZIKD.mjs +0 -2
  202. package/dist/chunk-PRLVZIKD.mjs.map +0 -1
  203. package/dist/chunk-Q2SNRLW3.cjs +0 -2
  204. package/dist/chunk-Q2SNRLW3.cjs.map +0 -1
  205. package/dist/chunk-REWME3FY.cjs +0 -2
  206. package/dist/chunk-REWME3FY.cjs.map +0 -1
  207. package/dist/chunk-RJN36GBU.mjs +0 -2
  208. package/dist/chunk-RJN36GBU.mjs.map +0 -1
  209. package/dist/chunk-RWOICHRW.cjs +0 -2
  210. package/dist/chunk-RWOICHRW.cjs.map +0 -1
  211. package/dist/chunk-S4CDSVLK.cjs +0 -2
  212. package/dist/chunk-S4CDSVLK.cjs.map +0 -1
  213. package/dist/chunk-SFEULGSX.cjs +0 -2
  214. package/dist/chunk-SFEULGSX.cjs.map +0 -1
  215. package/dist/chunk-WBTS6KFG.mjs +0 -2
  216. package/dist/chunk-WBTS6KFG.mjs.map +0 -1
  217. package/dist/chunk-WRFDB3QJ.cjs +0 -2
  218. package/dist/chunk-WRFDB3QJ.cjs.map +0 -1
  219. package/dist/chunk-XNJLSA6P.cjs +0 -2
  220. package/dist/chunk-XNJLSA6P.cjs.map +0 -1
  221. package/dist/contexts/exports.cjs +0 -2
  222. package/dist/contexts/exports.cjs.map +0 -1
  223. package/dist/contexts/exports.d.cts +0 -66
  224. package/dist/contexts/exports.mjs.map +0 -1
  225. package/dist/defaultFlags-D6KfkTZx.d.cts +0 -10
  226. package/dist/dex-C_BB0b0O.d.cts +0 -37
  227. package/dist/enum/exports.cjs +0 -2
  228. package/dist/enum/exports.cjs.map +0 -1
  229. package/dist/enum/exports.d.cts +0 -23
  230. package/dist/enum/exports.mjs.map +0 -1
  231. package/dist/errors/exports.cjs +0 -2
  232. package/dist/errors/exports.cjs.map +0 -1
  233. package/dist/errors/exports.d.cts +0 -327
  234. package/dist/errors/exports.mjs.map +0 -1
  235. package/dist/getValidatorQueuedOperatorAddress-Cql_D50j.d.cts +0 -562
  236. package/dist/global.d-B7IeayVX.d.cts +0 -474
  237. package/dist/honey-CYm0RWf4.d.cts +0 -14
  238. package/dist/hooks/exports.cjs +0 -4
  239. package/dist/hooks/exports.cjs.map +0 -1
  240. package/dist/hooks/exports.d.cts +0 -1734
  241. package/dist/hooks/exports.mjs.map +0 -1
  242. package/dist/polling-BKnyavLI.d.cts +0 -8
  243. package/dist/txnEnum-7_o92X3N.d.ts +0 -164
  244. package/dist/types/exports.cjs +0 -1
  245. package/dist/types/exports.cjs.map +0 -1
  246. package/dist/types/exports.d.cts +0 -90
  247. package/dist/types/exports.mjs.map +0 -1
  248. package/dist/useHoneySwapState-D6vpv19r.d.cts +0 -32
  249. package/dist/utils/exports.cjs +0 -2
  250. package/dist/utils/exports.cjs.map +0 -1
  251. package/dist/utils/exports.d.cts +0 -420
  252. package/dist/utils/exports.mjs.map +0 -1
  253. package/src/actions/dex/getIsTokenExploited.ts +0 -63
  254. package/src/hooks/dex/useExploitedTokens.ts +0 -57
@@ -0,0 +1,165 @@
1
+ import {
2
+ BeraError,
3
+ errorMsgMap,
4
+ httpStatusToSpanStatus,
5
+ reasonToSpanStatus
6
+ } from "./chunk-KHXJDYA4.mjs";
7
+
8
+ // src/errors/RequestError.ts
9
+ import { getUriFromLink } from "@berachain/config";
10
+ import { bepolia } from "@berachain/config/bepolia";
11
+ import { mainnet } from "@berachain/config/mainnet";
12
+ var RequestError = class _RequestError extends BeraError {
13
+ /**
14
+ * The error response from the request.
15
+ */
16
+ response;
17
+ static isCorsError(error) {
18
+ return error.cause instanceof Response && error.cause.type === "cors";
19
+ }
20
+ /**
21
+ * The endpoint that was requested.
22
+ */
23
+ endpoint;
24
+ /**
25
+ * A list of domains that should have their query params removed.
26
+ */
27
+ queryRichfulDomains = [
28
+ mainnet.bex.aggregatorsProxyUrl,
29
+ // covers both /aggregator/quote and /aggregator/transaction?quoteId=...
30
+ // (the transaction endpoint's quoteId would otherwise fragment grouping)
31
+ "https://api.fly.trade/aggregator",
32
+ "https://open-api.openocean.finance/v4/bera/swap",
33
+ // vercel internal proxy
34
+ "/api/aggregators?aggregator",
35
+ // bonder endpoints have date-based query params (e.g. ?start=2025-11-28)
36
+ mainnet.backend,
37
+ // beep (next-gen backend) on testnet — same date-based bonder query params
38
+ bepolia.beep
39
+ ];
40
+ statusCode;
41
+ payload;
42
+ static REASON_MAP = {
43
+ 429: "RATE_LIMITED_429",
44
+ NETWORK_ERROR: "NETWORK_ERROR",
45
+ CORS_ERROR: "CORS"
46
+ };
47
+ constructor(args) {
48
+ super(args);
49
+ this.name = "RequestError";
50
+ this.response = args.response;
51
+ this.payload = args.payload;
52
+ this.endpoint = this.setEndpoint(args.endpoint);
53
+ if (!this.message && typeof this.cause === "object" && this.cause !== null) {
54
+ if ("error" in this.cause && typeof this.cause.error === "string") {
55
+ this.message = this.cause.error;
56
+ }
57
+ }
58
+ if (args.statusCode) {
59
+ this.statusCode = args.statusCode;
60
+ } else if (this.response instanceof Response) {
61
+ this.statusCode = this.response.status;
62
+ }
63
+ if (this.statusCode === 429) {
64
+ this.reason = _RequestError.REASON_MAP[429];
65
+ this.displayMessage = errorMsgMap.HTTP.RATE_LIMITED_429.errorMSG;
66
+ this.level = args.level ?? "warning";
67
+ } else {
68
+ const networkError = this.tryMatchNetworkError();
69
+ if (networkError) {
70
+ this.reason = this.reason ?? networkError.reason;
71
+ this.level = args.level ?? "warning";
72
+ this.endpoint.url = this.endpoint.url ?? networkError.url;
73
+ }
74
+ }
75
+ if (!this.spanStatus && this.reason) {
76
+ this.spanStatus = reasonToSpanStatus(this.reason);
77
+ }
78
+ if (!this.spanStatus && this.statusCode) {
79
+ this.spanStatus = httpStatusToSpanStatus(this.statusCode);
80
+ }
81
+ this.tags = {
82
+ ...this.tags,
83
+ "error.statusCode": this.statusCode,
84
+ "operation.type": "query",
85
+ ...args.tags
86
+ };
87
+ let message = "";
88
+ if (this.reason) {
89
+ message += `${this.reason} \u2013 `;
90
+ } else if (this.statusCode && this.statusCode >= 400) {
91
+ message += `HTTP ${this.statusCode} \u2013 `;
92
+ }
93
+ const endpointLabel = this.endpoint.type ? `${this.endpoint.type}(${this.endpoint.url})` : this.endpoint.url;
94
+ this.message = `${message}${endpointLabel}: ${this.message}`;
95
+ }
96
+ setEndpoint(endpoint) {
97
+ if (typeof endpoint === "string" || endpoint instanceof URL) {
98
+ this.endpoint = {
99
+ url: typeof endpoint === "string" ? endpoint : endpoint.toString()
100
+ };
101
+ } else {
102
+ this.endpoint = {
103
+ ...this.endpoint,
104
+ ...endpoint,
105
+ url: endpoint.url.toString()
106
+ };
107
+ }
108
+ if (this.queryRichfulDomains.some(
109
+ (domain) => this.endpoint.url.includes(getUriFromLink(domain))
110
+ )) {
111
+ try {
112
+ const url = new URL(this.endpoint.url);
113
+ url.search = "";
114
+ this.endpoint.url = url.toString();
115
+ } catch {
116
+ }
117
+ }
118
+ this.tags = {
119
+ ...this.tags,
120
+ "operation.source.url": this.endpoint.url,
121
+ "operation.source.name": this.endpoint.name,
122
+ "operation.source.type": this.endpoint.type
123
+ };
124
+ return this.endpoint;
125
+ }
126
+ tryMatchNetworkError() {
127
+ if (this.cause instanceof Error && "message" in this.cause && typeof this.cause.message === "string" || this.cause instanceof TypeError) {
128
+ const message = this.cause.message;
129
+ if (message.startsWith("Network Error")) {
130
+ return {
131
+ reason: _RequestError.REASON_MAP.NETWORK_ERROR,
132
+ message,
133
+ url: this.endpoint.url
134
+ };
135
+ }
136
+ const failedToFetchMatch = message.match(
137
+ /^(?:NetworkError when attempting to fetch resource\.|Failed to fetch|Load failed)(?: \(([a-z0-9-.]+)\))?$/
138
+ );
139
+ if (failedToFetchMatch) {
140
+ return {
141
+ reason: _RequestError.REASON_MAP.NETWORK_ERROR,
142
+ message,
143
+ url: failedToFetchMatch[1] ?? this.endpoint.url
144
+ };
145
+ }
146
+ }
147
+ if (typeof this.cause === "object" && this.cause !== null && "message" in this.cause && typeof this.cause.message === "string") {
148
+ const message = this.cause.message;
149
+ if (message.startsWith(
150
+ "error: canceling statement due to lock timeout occurred in"
151
+ )) {
152
+ return {
153
+ reason: _RequestError.REASON_MAP.NETWORK_ERROR,
154
+ message,
155
+ url: this.endpoint.url
156
+ };
157
+ }
158
+ }
159
+ return false;
160
+ }
161
+ };
162
+
163
+ export {
164
+ RequestError
165
+ };
@@ -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-WNBWX23Q.mjs";
18
+ import "../chunk-HYDP32P6.mjs";
19
+ import "../chunk-HQCOU6GY.mjs";
20
+ import "../chunk-SGIJVHZO.mjs";
21
+ import {
22
+ BeraMonitoring
23
+ } from "../chunk-7YVNSDXG.mjs";
24
+ import "../chunk-GY6B3PD5.mjs";
25
+ import "../chunk-BGMRHTBQ.mjs";
26
+ import "../chunk-IXIBY5FP.mjs";
27
+ import "../chunk-DQRH5VE3.mjs";
28
+ import "../chunk-ZLTMIFCZ.mjs";
29
+ import {
30
+ BeraError
31
+ } from "../chunk-KHXJDYA4.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-AUOPN6NK.mjs";
5
+ import {
6
+ BeraMonitoring,
7
+ initBeraError
8
+ } from "../chunk-7YVNSDXG.mjs";
9
+ import {
10
+ assertAddress,
11
+ assertAmount,
12
+ assertDefined,
13
+ assertPositive,
14
+ assertPublicClient
15
+ } from "../chunk-GY6B3PD5.mjs";
16
+ import {
17
+ BeraTracing
18
+ } from "../chunk-SZ5C44L5.mjs";
19
+ import {
20
+ RequestError
21
+ } from "../chunk-ZLTMIFCZ.mjs";
22
+ import {
23
+ BeraError,
24
+ InvalidArgumentError,
25
+ findMatchingError,
26
+ getErrorMessage,
27
+ httpStatusToSpanStatus,
28
+ reasonToSpanStatus
29
+ } from "../chunk-KHXJDYA4.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-Dw5SQcRX.js';
7
7
 
8
8
  interface GetConvertToAssetsProps {
9
9
  sharesAmount: bigint;