@berachain/berajs 0.2.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 (59) hide show
  1. package/dist/actions/clients/exports.d.ts +77 -1
  2. package/dist/actions/clients/exports.mjs +13 -4
  3. package/dist/actions/exports.d.ts +59 -27
  4. package/dist/actions/exports.mjs +23 -23
  5. package/dist/actions/governance/exports.mjs +3 -3
  6. package/dist/actions/server/exports.mjs +4 -4
  7. package/dist/{chunk-4Z4AK6SH.mjs → chunk-3JJLQ2JX.mjs} +3 -3
  8. package/dist/{chunk-EXIUPSFN.mjs → chunk-7YVNSDXG.mjs} +2 -2
  9. package/dist/{chunk-WXXOISTU.mjs → chunk-AUOPN6NK.mjs} +1 -1
  10. package/dist/{chunk-75M6TF7M.mjs → chunk-DQRH5VE3.mjs} +1 -1
  11. package/dist/{chunk-CDFWPU2R.mjs → chunk-E7YFXBBQ.mjs} +0 -124
  12. package/dist/{chunk-AFN4CVD3.mjs → chunk-GUURQAME.mjs} +1 -1
  13. package/dist/{chunk-KQUMKB66.mjs → chunk-GY6B3PD5.mjs} +1 -1
  14. package/dist/{chunk-HSSJKHZ4.mjs → chunk-HYDP32P6.mjs} +3 -3
  15. package/dist/{chunk-NPBQLVL3.mjs → chunk-IXIBY5FP.mjs} +2 -2
  16. package/dist/{chunk-J5I45WGQ.mjs → chunk-KHXJDYA4.mjs} +7 -0
  17. package/dist/chunk-P5WXXULM.mjs +54 -0
  18. package/dist/{chunk-QJIXTYTZ.mjs → chunk-QBBOWFMH.mjs} +105 -30
  19. package/dist/{chunk-FFB5LFDW.mjs → chunk-QVHEM4BG.mjs} +2 -2
  20. package/dist/{chunk-3EARVV7K.mjs → chunk-WNBWX23Q.mjs} +17 -5
  21. package/dist/chunk-Y6THHG77.mjs +126 -0
  22. package/dist/{chunk-XIYN6AL6.mjs → chunk-ZLTMIFCZ.mjs} +10 -5
  23. package/dist/contexts/exports.mjs +8 -8
  24. package/dist/errors/exports.mjs +5 -5
  25. package/dist/{getValidatorQueuedOperatorAddress-Dw5KN5sh.d.ts → getValidatorQueuedOperatorAddress-DphU3qhE.d.ts} +1 -1
  26. package/dist/hooks/exports.d.ts +17 -18
  27. package/dist/hooks/exports.mjs +161 -132
  28. package/dist/hooks/governance/exports.mjs +4 -4
  29. package/dist/{pol.d-CqPA9K6m.d.ts → pol.d-Dw5SQcRX.d.ts} +15 -4
  30. package/dist/types/exports.d.ts +1 -1
  31. package/dist/utils/exports.mjs +11 -9
  32. package/package.json +4 -4
  33. package/src/actions/clients/exports.ts +3 -0
  34. package/src/actions/clients/fetchBeep.ts +34 -0
  35. package/src/actions/clients/fetchOpenApi.ts +93 -0
  36. package/src/actions/clients/fetchOpenApi.unit.test.ts +223 -0
  37. package/src/actions/clients/fetchRailwayBackend.ts +34 -0
  38. package/src/actions/enso/getEnsoUserTokensWithBalances.ts +18 -0
  39. package/src/actions/exports.ts +1 -0
  40. package/src/actions/honey/getPythLatestPrices.ts +7 -0
  41. package/src/actions/pol/__tests__/rewardVaults.integration.test.ts +1 -1
  42. package/src/actions/pol/getAutoclaimedIncentives.ts +21 -10
  43. package/src/actions/pol/getAutoclaimedIncentivesTxHash.ts +41 -0
  44. package/src/actions/pol/getBgtIncentiveDistributorPaused.ts +5 -12
  45. package/src/actions/pol/getEarnedStakedBeraVault.ts +20 -16
  46. package/src/actions/pol/getRewardVaults.ts +4 -4
  47. package/src/actions/pol/getStakingDailyAssets.ts +18 -14
  48. package/src/actions/validators/utils/getValidatorBoostApy.ts +1 -1
  49. package/src/errors/RequestError.ts +12 -3
  50. package/src/errors/RequestError.unit.test.ts +55 -0
  51. package/src/errors/errorMap.ts +8 -0
  52. package/src/hooks/exports.ts +1 -0
  53. package/src/hooks/pol/useAutoclaimedIncentives.ts +1 -10
  54. package/src/hooks/pol/useAutoclaimedIncentivesTxHash.ts +45 -0
  55. package/src/hooks/validators/useValidator.ts +4 -8
  56. package/src/types/bribe-boost.d.ts +14 -3
  57. package/src/utils/polyfillAbortSignalAny.ts +53 -0
  58. package/src/utils/polyfillAbortSignalAny.unit.test.ts +81 -0
  59. /package/dist/{exports-BcUTGFUb.d.ts → getApolloClient-BcUTGFUb.d.ts} +0 -0
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  parseBaseArgs
3
- } from "./chunk-75M6TF7M.mjs";
3
+ } from "./chunk-DQRH5VE3.mjs";
4
4
  import {
5
5
  InvalidArgumentError
6
- } from "./chunk-J5I45WGQ.mjs";
6
+ } from "./chunk-KHXJDYA4.mjs";
7
7
 
8
8
  // src/utils/tokens.ts
9
9
  import { ethAddress, isAddress, zeroAddress } from "viem";
@@ -61,6 +61,13 @@ var errorMsgMap = {
61
61
  keywords: ["nonce too low: next nonce"],
62
62
  errorMSG: "Nonce is too low. Your wallet might have unconfirmed transactions."
63
63
  },
64
+ REPLACEMENT_UNDERPRICED: {
65
+ // Transient resubmission issue (gas bump too low). Not function-specific —
66
+ // normalizing the raw RPC string to this key collapses the per-function
67
+ // Sentry groups (functionName is still kept as a tag).
68
+ keywords: ["replacement transaction underpriced"],
69
+ errorMSG: "Your wallet tried to replace a pending transaction without raising the gas enough. Please wait for the previous transaction to finish, or try again."
70
+ },
64
71
  GAS_PRICE: {
65
72
  keywords: ["gasLimit"],
66
73
  errorMSG: "It seems an RPC error has occurred while estimating gas. Please try your request later."
@@ -0,0 +1,54 @@
1
+ import {
2
+ beraFetchJson
3
+ } from "./chunk-Y6THHG77.mjs";
4
+ import {
5
+ parseBaseArgs
6
+ } from "./chunk-DQRH5VE3.mjs";
7
+
8
+ // src/actions/clients/fetchOpenApi.ts
9
+ import { getUriFromLink } from "@berachain/config";
10
+ function fetchOpenApi(link, path, params, fallbackName) {
11
+ const { path: pathParams, query } = params;
12
+ const pathStr = path;
13
+ const resolvedPath = pathStr.replace(/\{([^}]+)\}/g, (_, key) => {
14
+ const value = pathParams?.[key];
15
+ if (value === void 0) {
16
+ throw new Error(
17
+ `fetchOpenApi: missing path param "${key}" for "${pathStr}"`
18
+ );
19
+ }
20
+ return encodeURIComponent(String(value));
21
+ });
22
+ const search = query ? new URLSearchParams(
23
+ Object.entries(query).map(([k, v]) => [k, String(v)])
24
+ ).toString() : "";
25
+ const url = `${getUriFromLink(link)}${resolvedPath}${search ? `?${search}` : ""}`;
26
+ const name = typeof link === "string" ? fallbackName : link.name;
27
+ return beraFetchJson({ url, name, type: "rest" });
28
+ }
29
+
30
+ // src/actions/clients/fetchBeep.ts
31
+ function fetchBeep(path, params, args = {}) {
32
+ const { config } = parseBaseArgs(args);
33
+ if (!config.beep) {
34
+ throw new Error("fetchBeep: `beep` backend is not configured.");
35
+ }
36
+ return fetchOpenApi(config.beep, path, params, "beep");
37
+ }
38
+
39
+ // src/actions/clients/fetchRailwayBackend.ts
40
+ function fetchRailwayBackend(path, params, args = {}) {
41
+ const { config } = parseBaseArgs(args);
42
+ return fetchOpenApi(
43
+ config.backend,
44
+ path,
45
+ params,
46
+ "backend-railway"
47
+ );
48
+ }
49
+
50
+ export {
51
+ fetchOpenApi,
52
+ fetchBeep,
53
+ fetchRailwayBackend
54
+ };
@@ -1,55 +1,61 @@
1
+ import {
2
+ fetchBeep,
3
+ fetchRailwayBackend
4
+ } from "./chunk-P5WXXULM.mjs";
1
5
  import {
2
6
  getApolloClient
3
- } from "./chunk-4Z4AK6SH.mjs";
7
+ } from "./chunk-3JJLQ2JX.mjs";
4
8
  import {
5
9
  pythAbi
6
10
  } from "./chunk-CDK4YV3D.mjs";
7
11
  import {
8
12
  NotFoundError,
9
13
  TransactionFailedError
10
- } from "./chunk-WXXOISTU.mjs";
14
+ } from "./chunk-AUOPN6NK.mjs";
11
15
  import {
12
16
  BeraMonitoring,
13
17
  initBeraError
14
- } from "./chunk-EXIUPSFN.mjs";
18
+ } from "./chunk-7YVNSDXG.mjs";
15
19
  import {
16
20
  assertAddress,
17
21
  assertDefined,
18
22
  assertPublicClient
19
- } from "./chunk-KQUMKB66.mjs";
23
+ } from "./chunk-GY6B3PD5.mjs";
20
24
  import {
21
25
  CAP_LIMIT_BUFFER,
22
26
  DEFAULT_METAMASK_GAS_LIMIT,
23
- beraFetch,
24
- beraFetchJson,
25
27
  bignumber_js_default,
26
28
  formatTimeLeft,
27
- getErrorResponse,
28
29
  getPythDefaultUpdateFee,
29
30
  getSafeNumber,
30
31
  getTestClient,
31
32
  msToSeconds,
32
33
  seconds,
33
34
  yearsInSeconds
34
- } from "./chunk-CDFWPU2R.mjs";
35
+ } from "./chunk-E7YFXBBQ.mjs";
36
+ import {
37
+ beraFetch,
38
+ beraFetchJson,
39
+ getErrorResponse
40
+ } from "./chunk-Y6THHG77.mjs";
35
41
  import {
36
42
  beraToken,
37
43
  getHoneyToken,
38
44
  isToken
39
- } from "./chunk-NPBQLVL3.mjs";
45
+ } from "./chunk-IXIBY5FP.mjs";
40
46
  import {
41
47
  parseBaseArgs
42
- } from "./chunk-75M6TF7M.mjs";
48
+ } from "./chunk-DQRH5VE3.mjs";
43
49
  import {
44
50
  RequestError
45
- } from "./chunk-XIYN6AL6.mjs";
51
+ } from "./chunk-ZLTMIFCZ.mjs";
46
52
  import {
47
53
  BeraError,
48
54
  InvalidArgumentError,
49
55
  commonAbiErrors,
50
56
  parseDecodedError,
51
57
  parseViemError
52
- } from "./chunk-J5I45WGQ.mjs";
58
+ } from "./chunk-KHXJDYA4.mjs";
53
59
 
54
60
  // src/actions/bend/getConvertToAssets.ts
55
61
  import { formatEther } from "viem";
@@ -1089,7 +1095,40 @@ async function getHoneyVaultsBalance({
1089
1095
  // src/actions/honey/getPythLatestPrices.ts
1090
1096
  import { HermesClient } from "@pythnetwork/hermes-client";
1091
1097
  import { formatUnits as formatUnits4 } from "viem";
1098
+
1099
+ // src/utils/polyfillAbortSignalAny.ts
1100
+ function polyfillAbortSignalAny() {
1101
+ if (typeof AbortSignal === "undefined") return;
1102
+ if (typeof AbortSignal.any === "function") return;
1103
+ AbortSignal.any = (signals) => {
1104
+ const controller = new AbortController();
1105
+ for (const signal of signals) {
1106
+ if (signal.aborted) {
1107
+ controller.abort(signal.reason);
1108
+ return controller.signal;
1109
+ }
1110
+ }
1111
+ const listeners = [];
1112
+ const cleanup = () => {
1113
+ for (let i = 0; i < signals.length; i++) {
1114
+ signals[i].removeEventListener("abort", listeners[i]);
1115
+ }
1116
+ };
1117
+ for (const signal of signals) {
1118
+ const onAbort = () => {
1119
+ if (!controller.signal.aborted) controller.abort(signal.reason);
1120
+ cleanup();
1121
+ };
1122
+ listeners.push(onAbort);
1123
+ signal.addEventListener("abort", onAbort);
1124
+ }
1125
+ return controller.signal;
1126
+ };
1127
+ }
1128
+
1129
+ // src/actions/honey/getPythLatestPrices.ts
1092
1130
  var pythEndpoint = "https://hermes.pyth.network";
1131
+ polyfillAbortSignalAny();
1093
1132
  async function getPythLatestPrices({
1094
1133
  priceFeedId
1095
1134
  }) {
@@ -1317,14 +1356,44 @@ async function getAutoclaimedIncentives({
1317
1356
  ...args
1318
1357
  }) {
1319
1358
  const { config } = parseBaseArgs(args);
1320
- return beraFetchJson(
1321
- {
1322
- url: `${config.pol.bribeBoostApi}/api/v1/wallets/${account.toLowerCase()}/autoclaimed`,
1323
- name: "pol-autoclaimed-incentives",
1324
- type: "rest"
1325
- },
1326
- { cache: "no-store" }
1327
- );
1359
+ try {
1360
+ return await beraFetchJson(
1361
+ {
1362
+ url: `${config.pol.bribeBoostApi}/api/v1/wallets/${account.toLowerCase()}/autoclaimed`,
1363
+ name: "pol-autoclaimed-incentives",
1364
+ type: "rest"
1365
+ },
1366
+ { cache: "no-store" }
1367
+ );
1368
+ } catch (error) {
1369
+ if (error instanceof RequestError && error.statusCode === 404) {
1370
+ return null;
1371
+ }
1372
+ throw error;
1373
+ }
1374
+ }
1375
+
1376
+ // src/actions/pol/getAutoclaimedIncentivesTxHash.ts
1377
+ async function getAutoclaimedIncentivesTxHash({
1378
+ account,
1379
+ ...args
1380
+ }) {
1381
+ const { config } = parseBaseArgs(args);
1382
+ try {
1383
+ return await beraFetchJson(
1384
+ {
1385
+ url: `${config.pol.bribeBoostApi}/api/v1/wallets/${account.toLowerCase()}/autoclaimed/txhash`,
1386
+ name: "pol-autoclaimed-incentives-txhash",
1387
+ type: "rest"
1388
+ },
1389
+ { cache: "no-store" }
1390
+ );
1391
+ } catch (error) {
1392
+ if (error instanceof RequestError && error.statusCode === 404) {
1393
+ return null;
1394
+ }
1395
+ throw error;
1396
+ }
1328
1397
  }
1329
1398
 
1330
1399
  // src/actions/pol/getRewardVaultRewards.ts
@@ -1483,19 +1552,24 @@ function getBgtAprSimulation({
1483
1552
  }
1484
1553
 
1485
1554
  // src/actions/pol/getEarnedStakedBeraVault.ts
1486
- import { getUriFromLink } from "@berachain/config";
1487
1555
  async function getEarnedStakedBeraVault({
1488
1556
  address,
1489
1557
  account,
1490
1558
  ...args
1491
1559
  }) {
1492
1560
  const { config } = parseBaseArgs(args);
1493
- const url = `${getUriFromLink(config.backend)}/vaults/${address}/earnings/${account}`;
1494
- return beraFetchJson({
1495
- url,
1496
- name: typeof config.backend === "string" ? "backend-railway" : config.backend.name,
1497
- type: "rest"
1498
- });
1561
+ if (!config.beep) {
1562
+ return fetchRailwayBackend(
1563
+ "/vaults/{vault}/earnings/{owner}",
1564
+ { path: { vault: address, owner: account } },
1565
+ args
1566
+ );
1567
+ }
1568
+ return fetchBeep(
1569
+ "/v0/stake/{vault}/earnings/{owner}",
1570
+ { path: { vault: address, owner: account } },
1571
+ args
1572
+ );
1499
1573
  }
1500
1574
 
1501
1575
  // src/actions/pol/getRewardVaults.ts
@@ -1547,11 +1621,11 @@ async function getRewardVaults({
1547
1621
  ...vault,
1548
1622
  dynamicData: {
1549
1623
  ...vault.dynamicData,
1550
- allTimeReceivedBGTAmount: vault.dynamicData?.allTimeReceivedBGTAmount ?? "0",
1551
- bgtCapturePercentage: vault.dynamicData?.bgtCapturePercentage ?? "0",
1624
+ allTimeRewards: vault.dynamicData?.allTimeRewards ?? "0",
1625
+ rewardCapturePercentage: vault.dynamicData?.rewardCapturePercentage ?? 0,
1552
1626
  activeIncentivesValueUsd: totalIncentiveInUsdc.toString(),
1553
1627
  activeIncentivesRateUsd: vault.dynamicData?.activeIncentivesRateUsd ?? "0",
1554
- bgtCapturePerBlock: vault.dynamicData?.bgtCapturePerBlock ?? "0"
1628
+ rewardCapturePerBlock: vault.dynamicData?.rewardCapturePerBlock ?? 0
1555
1629
  },
1556
1630
  activeIncentives: incentivesArray
1557
1631
  };
@@ -4002,6 +4076,7 @@ export {
4002
4076
  isBasketModeEnabled,
4003
4077
  getBlockTimestamp,
4004
4078
  getAutoclaimedIncentives,
4079
+ getAutoclaimedIncentivesTxHash,
4005
4080
  RewardVaultDistributionMode,
4006
4081
  getRewardVaultRewards,
4007
4082
  getBgtAprSimulation,
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  bignumber_js_default
3
- } from "./chunk-CDFWPU2R.mjs";
3
+ } from "./chunk-E7YFXBBQ.mjs";
4
4
  import {
5
5
  isToken,
6
6
  wBeraToken
7
- } from "./chunk-NPBQLVL3.mjs";
7
+ } from "./chunk-IXIBY5FP.mjs";
8
8
 
9
9
  // src/utils/tokenWrapping.ts
10
10
  function wrapNativeToken(token) {
@@ -1,25 +1,25 @@
1
1
  import {
2
2
  getBalanceCall,
3
3
  getEnsoClient
4
- } from "./chunk-HSSJKHZ4.mjs";
4
+ } from "./chunk-HYDP32P6.mjs";
5
5
  import {
6
6
  BeraMonitoring,
7
7
  initBeraError
8
- } from "./chunk-EXIUPSFN.mjs";
8
+ } from "./chunk-7YVNSDXG.mjs";
9
9
  import {
10
10
  defaultFlags
11
11
  } from "./chunk-BGMRHTBQ.mjs";
12
12
  import {
13
13
  beraToken,
14
14
  isToken
15
- } from "./chunk-NPBQLVL3.mjs";
15
+ } from "./chunk-IXIBY5FP.mjs";
16
16
  import {
17
17
  parseBaseArgs
18
- } from "./chunk-75M6TF7M.mjs";
18
+ } from "./chunk-DQRH5VE3.mjs";
19
19
  import {
20
20
  BeraError,
21
21
  InvalidArgumentError
22
- } from "./chunk-J5I45WGQ.mjs";
22
+ } from "./chunk-KHXJDYA4.mjs";
23
23
 
24
24
  // src/contexts/BeraFlags/BeraFlags.tsx
25
25
  import { createContext, useContext } from "react";
@@ -180,6 +180,18 @@ async function getEnsoUserTokensWithBalances({
180
180
  chainId: chainId ?? "all",
181
181
  eoaAddress: account
182
182
  });
183
+ if (!Array.isArray(ensoBalances)) {
184
+ BeraMonitoring.captureException(
185
+ new InvalidArgumentError({
186
+ property: "ensoBalances",
187
+ value: ensoBalances,
188
+ expected: "BalanceToken[]",
189
+ chainId: typeof chainId === "number" ? chainId : void 0,
190
+ extra: { account, chainId }
191
+ })
192
+ );
193
+ return [];
194
+ }
183
195
  const tokens = ensoBalances.map(
184
196
  (balance) => ({
185
197
  name: balance.name,
@@ -0,0 +1,126 @@
1
+ import {
2
+ BeraTracing
3
+ } from "./chunk-SZ5C44L5.mjs";
4
+ import {
5
+ RequestError
6
+ } from "./chunk-ZLTMIFCZ.mjs";
7
+
8
+ // src/utils/getErrorResponse.ts
9
+ async function getErrorResponse(response) {
10
+ const contentType = response.headers.get("content-type");
11
+ if (contentType?.includes("application/json")) {
12
+ return response.json();
13
+ } else {
14
+ const text = await response.text();
15
+ try {
16
+ return JSON.parse(text);
17
+ } catch {
18
+ return {
19
+ message: "Unknown error, can't decode response into JSON",
20
+ cause: text
21
+ };
22
+ }
23
+ }
24
+ }
25
+
26
+ // src/utils/sanitizeRpcUrl.ts
27
+ function sanitizeRpcUrl(url) {
28
+ if (!url) return "";
29
+ try {
30
+ const parsed = new URL(url);
31
+ if (parsed.hostname.endsWith(".quiknode.pro")) {
32
+ parsed.pathname = "/";
33
+ parsed.search = "";
34
+ return parsed.toString();
35
+ }
36
+ return url;
37
+ } catch {
38
+ return url;
39
+ }
40
+ }
41
+
42
+ // src/utils/beraFetch.ts
43
+ async function beraFetch(endpoint, options, spanContext) {
44
+ try {
45
+ let spanUrl = sanitizeRpcUrl(
46
+ typeof endpoint === "string" || endpoint instanceof URL ? endpoint.toString() : endpoint.url.toString()
47
+ ).replace(/0x[a-fA-F0-9]{40}/g, ":address");
48
+ if (spanContext?.keepQueryParams !== true && URL.canParse(spanUrl)) {
49
+ const queryParams = new URL(spanUrl).searchParams;
50
+ if (Array.isArray(spanContext?.keepQueryParams)) {
51
+ const searchParams = new URLSearchParams();
52
+ for (const param of spanContext.keepQueryParams) {
53
+ searchParams.set(param, queryParams.get(param) ?? "");
54
+ }
55
+ const newUrl = new URL(spanUrl);
56
+ newUrl.search = searchParams.toString();
57
+ spanUrl = newUrl.toString();
58
+ } else {
59
+ const newUrl = new URL(spanUrl);
60
+ newUrl.search = "";
61
+ spanUrl = newUrl.toString();
62
+ }
63
+ }
64
+ const endpointName = typeof endpoint === "string" || endpoint instanceof URL ? void 0 : endpoint.name;
65
+ return await BeraTracing.startSpan(
66
+ {
67
+ op: "beraFetch",
68
+ name: endpointName ? `beraFetch ${endpointName}` : "beraFetch",
69
+ attributes: typeof endpoint === "string" || endpoint instanceof URL ? {
70
+ "operation.source.url": spanUrl,
71
+ ...spanContext?.attributes
72
+ } : {
73
+ "operation.source.url": spanUrl,
74
+ "operation.source.type": endpoint.type,
75
+ "operation.source.name": endpoint.name,
76
+ ...spanContext?.attributes
77
+ }
78
+ },
79
+ async () => {
80
+ const response = await fetch(
81
+ typeof endpoint === "string" || endpoint instanceof URL ? endpoint : endpoint.url,
82
+ {
83
+ ...options
84
+ }
85
+ );
86
+ if (!response.ok) {
87
+ const error = await getErrorResponse(response);
88
+ throw new RequestError({
89
+ cause: error,
90
+ // @to-do import getErrorResponse logic in this function
91
+ // when it's removed from other places
92
+ response,
93
+ endpoint
94
+ });
95
+ }
96
+ return response;
97
+ }
98
+ );
99
+ } catch (error) {
100
+ if (error instanceof RequestError) {
101
+ throw error;
102
+ }
103
+ throw new RequestError({
104
+ cause: error,
105
+ endpoint,
106
+ response: void 0
107
+ });
108
+ }
109
+ }
110
+ async function beraFetchJson(endpoint, options) {
111
+ const response = await beraFetch(endpoint, {
112
+ ...options,
113
+ headers: {
114
+ Accept: "application/json",
115
+ ...options?.headers
116
+ }
117
+ });
118
+ return response.json();
119
+ }
120
+
121
+ export {
122
+ getErrorResponse,
123
+ sanitizeRpcUrl,
124
+ beraFetch,
125
+ beraFetchJson
126
+ };
@@ -3,10 +3,11 @@ import {
3
3
  errorMsgMap,
4
4
  httpStatusToSpanStatus,
5
5
  reasonToSpanStatus
6
- } from "./chunk-J5I45WGQ.mjs";
6
+ } from "./chunk-KHXJDYA4.mjs";
7
7
 
8
8
  // src/errors/RequestError.ts
9
9
  import { getUriFromLink } from "@berachain/config";
10
+ import { bepolia } from "@berachain/config/bepolia";
10
11
  import { mainnet } from "@berachain/config/mainnet";
11
12
  var RequestError = class _RequestError extends BeraError {
12
13
  /**
@@ -25,12 +26,16 @@ var RequestError = class _RequestError extends BeraError {
25
26
  */
26
27
  queryRichfulDomains = [
27
28
  mainnet.bex.aggregatorsProxyUrl,
28
- "https://api.fly.trade/aggregator/quote",
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",
29
32
  "https://open-api.openocean.finance/v4/bera/swap",
30
33
  // vercel internal proxy
31
34
  "/api/aggregators?aggregator",
32
35
  // bonder endpoints have date-based query params (e.g. ?start=2025-11-28)
33
- mainnet.backend
36
+ mainnet.backend,
37
+ // beep (next-gen backend) on testnet — same date-based bonder query params
38
+ bepolia.beep
34
39
  ];
35
40
  statusCode;
36
41
  payload;
@@ -129,13 +134,13 @@ var RequestError = class _RequestError extends BeraError {
129
134
  };
130
135
  }
131
136
  const failedToFetchMatch = message.match(
132
- /^(?:NetworkError when attempting to fetch resource\.|Failed to fetch|Load failed) \(([a-z0-9-.]+)\)$/
137
+ /^(?:NetworkError when attempting to fetch resource\.|Failed to fetch|Load failed)(?: \(([a-z0-9-.]+)\))?$/
133
138
  );
134
139
  if (failedToFetchMatch) {
135
140
  return {
136
141
  reason: _RequestError.REASON_MAP.NETWORK_ERROR,
137
142
  message,
138
- url: failedToFetchMatch[1]
143
+ url: failedToFetchMatch[1] ?? this.endpoint.url
139
144
  };
140
145
  }
141
146
  }
@@ -14,21 +14,21 @@ import {
14
14
  useBexStatus,
15
15
  useBlockTime,
16
16
  useHoneyConfig
17
- } from "../chunk-3EARVV7K.mjs";
18
- import "../chunk-HSSJKHZ4.mjs";
17
+ } from "../chunk-WNBWX23Q.mjs";
18
+ import "../chunk-HYDP32P6.mjs";
19
19
  import "../chunk-HQCOU6GY.mjs";
20
20
  import "../chunk-SGIJVHZO.mjs";
21
21
  import {
22
22
  BeraMonitoring
23
- } from "../chunk-EXIUPSFN.mjs";
24
- import "../chunk-KQUMKB66.mjs";
23
+ } from "../chunk-7YVNSDXG.mjs";
24
+ import "../chunk-GY6B3PD5.mjs";
25
25
  import "../chunk-BGMRHTBQ.mjs";
26
- import "../chunk-NPBQLVL3.mjs";
27
- import "../chunk-75M6TF7M.mjs";
28
- import "../chunk-XIYN6AL6.mjs";
26
+ import "../chunk-IXIBY5FP.mjs";
27
+ import "../chunk-DQRH5VE3.mjs";
28
+ import "../chunk-ZLTMIFCZ.mjs";
29
29
  import {
30
30
  BeraError
31
- } from "../chunk-J5I45WGQ.mjs";
31
+ } from "../chunk-KHXJDYA4.mjs";
32
32
 
33
33
  // src/contexts/SwrFallback.tsx
34
34
  import { useEffect } from "react";
@@ -1,24 +1,24 @@
1
1
  import {
2
2
  NotFoundError,
3
3
  TransactionFailedError
4
- } from "../chunk-WXXOISTU.mjs";
4
+ } from "../chunk-AUOPN6NK.mjs";
5
5
  import {
6
6
  BeraMonitoring,
7
7
  initBeraError
8
- } from "../chunk-EXIUPSFN.mjs";
8
+ } from "../chunk-7YVNSDXG.mjs";
9
9
  import {
10
10
  assertAddress,
11
11
  assertAmount,
12
12
  assertDefined,
13
13
  assertPositive,
14
14
  assertPublicClient
15
- } from "../chunk-KQUMKB66.mjs";
15
+ } from "../chunk-GY6B3PD5.mjs";
16
16
  import {
17
17
  BeraTracing
18
18
  } from "../chunk-SZ5C44L5.mjs";
19
19
  import {
20
20
  RequestError
21
- } from "../chunk-XIYN6AL6.mjs";
21
+ } from "../chunk-ZLTMIFCZ.mjs";
22
22
  import {
23
23
  BeraError,
24
24
  InvalidArgumentError,
@@ -26,7 +26,7 @@ import {
26
26
  getErrorMessage,
27
27
  httpStatusToSpanStatus,
28
28
  reasonToSpanStatus
29
- } from "../chunk-J5I45WGQ.mjs";
29
+ } from "../chunk-KHXJDYA4.mjs";
30
30
  export {
31
31
  BeraError,
32
32
  BeraMonitoring,
@@ -3,7 +3,7 @@ import { BeraConfig, ChainId } from '@berachain/config/internal';
3
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 './pol.d-CqPA9K6m.js';
6
+ import { P as ProtocolMetadata } from './pol.d-Dw5SQcRX.js';
7
7
 
8
8
  interface GetConvertToAssetsProps {
9
9
  sharesAmount: bigint;