@berachain/berajs 0.2.11 → 0.2.12

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 (124) hide show
  1. package/dist/actions/clients/exports.d.ts +5 -21
  2. package/dist/actions/clients/exports.mjs +5 -7
  3. package/dist/actions/exports.d.ts +65 -29
  4. package/dist/actions/exports.mjs +6 -36
  5. package/dist/actions/server/exports.mjs +2 -2
  6. package/dist/{chunk-UD5IUNCW.mjs → chunk-4ML4Y6UN.mjs} +14 -2
  7. package/dist/{chunk-7YVNSDXG.mjs → chunk-FGION6F6.mjs} +1 -1
  8. package/dist/{chunk-3JJLQ2JX.mjs → chunk-MKSFQIKC.mjs} +1 -4
  9. package/dist/{chunk-ZLTMIFCZ.mjs → chunk-RFJGL4MF.mjs} +3 -3
  10. package/dist/{chunk-Y6THHG77.mjs → chunk-T43JPYQS.mjs} +1 -1
  11. package/dist/{chunk-SXUNCX5E.mjs → chunk-W2VODV76.mjs} +3 -7
  12. package/dist/{chunk-VAA2FVPP.mjs → chunk-XDG26EG6.mjs} +90 -183
  13. package/dist/{chunk-MRQGHXAN.mjs → chunk-YLTWPFCJ.mjs} +2 -17
  14. package/dist/contexts/exports.mjs +4 -4
  15. package/dist/errors/exports.mjs +2 -2
  16. package/dist/{getApolloClient-BcUTGFUb.d.ts → getApolloClient-MWm_iq4u.d.ts} +4 -5
  17. package/dist/{getValidatorQueuedOperatorAddress-Cxt-DlL_.d.ts → getValidatorQueuedOperatorAddress-Cc05dlO3.d.ts} +6 -57
  18. package/dist/{global.d-q_LQWQqs.d.ts → global.d-CR3zicga.d.ts} +2 -7
  19. package/dist/hooks/exports.d.ts +109 -318
  20. package/dist/hooks/exports.mjs +102 -345
  21. package/dist/hooks/governance/exports.d.ts +10 -10
  22. package/dist/hooks/governance/exports.mjs +8 -20
  23. package/dist/types/exports.d.ts +1 -1
  24. package/dist/utils/exports.mjs +2 -2
  25. package/package.json +3 -3
  26. package/src/actions/clients/exports.ts +0 -1
  27. package/src/actions/clients/fetchBeep.ts +0 -7
  28. package/src/actions/clients/fetchOpenApi.ts +4 -4
  29. package/src/actions/clients/fetchOpenApi.unit.test.ts +3 -19
  30. package/src/actions/clients/getApolloClient.ts +4 -9
  31. package/src/actions/exports.ts +0 -1
  32. package/src/actions/honey/getChartData.ts +3 -44
  33. package/src/actions/honey/getHoney24hVolume.ts +2 -21
  34. package/src/actions/honey/getHoneyTxns.ts +1 -49
  35. package/src/actions/pol/__tests__/rewardVaults.integration.test.ts +3 -3
  36. package/src/actions/pol/getEarnedStakedBeraVault.ts +0 -15
  37. package/src/actions/pol/getGlobalData.ts +10 -29
  38. package/src/actions/pol/getRewardVaults.ts +4 -4
  39. package/src/actions/pol/getSWBeraVaultMetadata.ts +0 -7
  40. package/src/actions/pol/getStakingDailyAssets.ts +0 -14
  41. package/src/actions/validators/getApiEnrichedAllocation.ts +1 -1
  42. package/src/actions/validators/getValidatorIncentiveDistribution.ts +2 -24
  43. package/src/errors/RequestError.ts +3 -3
  44. package/src/hooks/bend/useGetConvertToAssets.ts +1 -8
  45. package/src/hooks/dex/useAggregatorsQuotes.ts +3 -1
  46. package/src/hooks/dex/useAggregatorsRouterFeeBps.ts +1 -6
  47. package/src/hooks/dex/useAllUserPools.ts +1 -8
  48. package/src/hooks/dex/useApiPool.ts +1 -8
  49. package/src/hooks/dex/useGlobalLiquidityAndSwapVolume.ts +0 -1
  50. package/src/hooks/dex/useOnChainPoolData.ts +2 -3
  51. package/src/hooks/dex/usePollPoolCreationRelayerApproval.ts +1 -7
  52. package/src/hooks/dex/usePoolHistoricalData.ts +1 -6
  53. package/src/hooks/dex/usePools.ts +2 -2
  54. package/src/hooks/enso/useBendZapSupply.ts +1 -1
  55. package/src/hooks/enso/useEnsoSwapBundle.ts +1 -1
  56. package/src/hooks/enso/useEnsoUserTokensWithBalances.ts +1 -5
  57. package/src/hooks/enso/useZapStakeBera.ts +0 -3
  58. package/src/hooks/governance/usePollProposal.ts +4 -7
  59. package/src/hooks/governance/usePollProposalThreshold.ts +1 -6
  60. package/src/hooks/governance/usePollUserDelegates.ts +1 -6
  61. package/src/hooks/governance/useProposalFromTx.ts +3 -5
  62. package/src/hooks/governance/useProposalSnapshot.ts +2 -2
  63. package/src/hooks/governance/useProposalState.ts +2 -2
  64. package/src/hooks/governance/useProposalTimelockState.ts +2 -2
  65. package/src/hooks/honey/useCappedGlobally.ts +1 -6
  66. package/src/hooks/honey/useCappedRelatively.ts +1 -6
  67. package/src/hooks/honey/useCollateralWeights.ts +1 -6
  68. package/src/hooks/honey/useHoney24hVolume.ts +1 -5
  69. package/src/hooks/honey/useHoneyBalances.ts +1 -6
  70. package/src/hooks/honey/useHoneyChartData.ts +3 -11
  71. package/src/hooks/honey/useHoneyVaultsBalance.ts +1 -6
  72. package/src/hooks/honey/useIsBadCollateralAsset.ts +1 -6
  73. package/src/hooks/honey/useIsBasketModeEnabled.ts +1 -6
  74. package/src/hooks/honey/usePythLatestPrices.ts +4 -6
  75. package/src/hooks/pol/useAutoclaimedIncentives.ts +1 -6
  76. package/src/hooks/pol/useAutoclaimedIncentivesTxHash.ts +1 -6
  77. package/src/hooks/pol/useBgtIncentiveDistributorPaused.ts +1 -6
  78. package/src/hooks/pol/useBgtUnstakedBalance.ts +1 -6
  79. package/src/hooks/pol/useClaimableFees.ts +1 -5
  80. package/src/hooks/pol/useHighestVaultsAPR.ts +2 -5
  81. package/src/hooks/pol/usePollGlobalData.ts +1 -6
  82. package/src/hooks/pol/usePollMarkets.ts +1 -6
  83. package/src/hooks/pol/useQueuedBeraUnlock.ts +1 -10
  84. package/src/hooks/pol/useRewardVault.ts +2 -2
  85. package/src/hooks/pol/useRewardVaultBalanceFromStakingToken.ts +2 -2
  86. package/src/hooks/pol/useRewardVaultFromToken.ts +23 -29
  87. package/src/hooks/pol/useRewardVaultIncentives.ts +1 -6
  88. package/src/hooks/pol/useRewardVaultRewards.ts +1 -6
  89. package/src/hooks/pol/useRewardVaults.ts +1 -6
  90. package/src/hooks/pol/useStakedAPR.ts +1 -6
  91. package/src/hooks/pol/useStakedSnapshots.ts +3 -8
  92. package/src/hooks/pol/useTotalStakedAmount.ts +1 -6
  93. package/src/hooks/pol/useUserVaultInfo.ts +1 -6
  94. package/src/hooks/pol/useUserVaults.ts +1 -5
  95. package/src/hooks/pol/useVaultHistory.ts +1 -6
  96. package/src/hooks/pol/useVaultValidators.ts +1 -6
  97. package/src/hooks/tokens/useMultipleTokenInformation.ts +1 -6
  98. package/src/hooks/tokens/usePollAllowances.ts +1 -7
  99. package/src/hooks/tokens/usePollBalance.ts +0 -3
  100. package/src/hooks/tokens/usePollWalletBalances.ts +1 -1
  101. package/src/hooks/tokens/useStakingTokenInformation.ts +1 -10
  102. package/src/hooks/tokens/useTokenInformation.ts +1 -6
  103. package/src/hooks/validators/useAllValidators.ts +1 -6
  104. package/src/hooks/validators/useApiValidator.ts +1 -6
  105. package/src/hooks/validators/useDailyValidatorBlockStats.ts +1 -3
  106. package/src/hooks/validators/useDefaultRewardAllocation.ts +1 -6
  107. package/src/hooks/validators/useManagedValidatorRole.ts +0 -1
  108. package/src/hooks/validators/useOnChainValidator.ts +1 -8
  109. package/src/hooks/validators/useStakingPoolBatch.ts +1 -6
  110. package/src/hooks/validators/useUserActiveValidators.ts +1 -6
  111. package/src/hooks/validators/useUserBoostsOnValidator.ts +1 -3
  112. package/src/hooks/validators/useUserClaimableIncentives.ts +2 -2
  113. package/src/hooks/validators/useUserStakingPositions.ts +1 -8
  114. package/src/hooks/validators/useValidatorAnalytics.ts +1 -3
  115. package/src/hooks/validators/useValidatorCommission.ts +1 -6
  116. package/src/hooks/validators/useValidatorIncentiveDistribution.ts +1 -3
  117. package/src/hooks/validators/useValidatorQueuedCommission.ts +1 -6
  118. package/src/hooks/validators/useValidatorQueuedOperatorAddress.ts +1 -6
  119. package/src/hooks/validators/useValidatorQueuedRewardAllocation.ts +1 -6
  120. package/src/hooks/validators/useValidatorRewardAllocation.ts +1 -6
  121. package/src/types/global.d.ts +5 -7
  122. package/src/actions/clients/fetchRailwayBackend.ts +0 -34
  123. package/src/actions/pol/getGlobalCuttingBoard.ts +0 -25
  124. package/src/actions/pol/getIncentiveFeeClaimStats.ts +0 -24
@@ -11,8 +11,8 @@ import {
11
11
 
12
12
  import { getApolloClient } from "../clients/getApolloClient";
13
13
 
14
- export interface GetGaugeData {
15
- gaugeList: ApiVaultFragment[];
14
+ export interface GetRewardVaultData {
15
+ rewardVaultList: ApiVaultFragment[];
16
16
  pagination: {
17
17
  currentPage: number;
18
18
  totalCount: number;
@@ -26,7 +26,7 @@ export async function getRewardVaults({
26
26
  }: {
27
27
  filter?: GetVaultsQueryVariables;
28
28
  publicClient?: PublicClient | undefined;
29
- } & BeraJS.BaseFunctionArgs = {}): Promise<GetGaugeData> {
29
+ } & BeraJS.BaseFunctionArgs = {}): Promise<GetRewardVaultData> {
30
30
  const bexApiGraphqlClient = getApolloClient("api", args);
31
31
 
32
32
  const res = await bexApiGraphqlClient.query<
@@ -101,6 +101,6 @@ export async function getRewardVaults({
101
101
 
102
102
  return {
103
103
  pagination: res.data.polGetRewardVaults.pagination,
104
- gaugeList: vaults!,
104
+ rewardVaultList: vaults!,
105
105
  };
106
106
  }
@@ -3,7 +3,6 @@ import { type Address, erc20Abi, erc4626Abi, type PublicClient } from "viem";
3
3
  import BigNumber from "@berachain/utils/pkg/bignumber.js";
4
4
 
5
5
  import { assertPublicClient } from "../../errors/assert";
6
- import { getIncentiveFeeClaimStats } from "./getIncentiveFeeClaimStats";
7
6
  import { getStakeWithdrawalCooldown } from "./getStakeWithdrawalCooldown";
8
7
 
9
8
  export interface VaultMetadata {
@@ -21,8 +20,6 @@ export interface VaultMetadata {
21
20
  };
22
21
  totalWBeraIssued: string;
23
22
  lockPeriod?: number;
24
- totalBuyBacks: number;
25
- totalBuyBacksInLast24Hours: number;
26
23
  address: Address;
27
24
  }
28
25
  /**
@@ -63,7 +60,6 @@ export async function getSWBeraVaultMetadata({
63
60
  tvl24HoursAgo,
64
61
  underlyingTotalSupply,
65
62
  lockPeriod,
66
- incentiveFeeClaimStats,
67
63
  ] = await Promise.all([
68
64
  publicClient.readContract({
69
65
  address,
@@ -123,7 +119,6 @@ export async function getSWBeraVaultMetadata({
123
119
  publicClient,
124
120
  address,
125
121
  }),
126
- getIncentiveFeeClaimStats(),
127
122
  ]);
128
123
  const exchangeRateWindowAgo = new BigNumber(
129
124
  oneShareWorthWindowAgo.toString(),
@@ -157,8 +152,6 @@ export async function getSWBeraVaultMetadata({
157
152
  .dividedBy(1e18)
158
153
  .toString(),
159
154
  lockPeriod,
160
- totalBuyBacks: incentiveFeeClaimStats.sumAllClaims,
161
- totalBuyBacksInLast24Hours: incentiveFeeClaimStats.sumClaimsInLast24Hours,
162
155
  };
163
156
  } catch (error) {
164
157
  console.error("Failed to get SW Bera Vault Metadata", error);
@@ -1,8 +1,6 @@
1
1
  import type { Address } from "viem";
2
2
 
3
- import { parseBaseArgs } from "../../utils/parseBaseArgs";
4
3
  import { fetchBeep } from "../clients/fetchBeep";
5
- import { fetchRailwayBackend } from "../clients/fetchRailwayBackend";
6
4
 
7
5
  export async function getStakingDailyAssets({
8
6
  address,
@@ -11,18 +9,6 @@ export async function getStakingDailyAssets({
11
9
  address: Address;
12
10
  range: 30 | 60 | 90;
13
11
  }) {
14
- const { config } = parseBaseArgs({});
15
-
16
- // TODO(beep): remove this entire block once `beep` is deployed on every
17
- // chain. It is the only legacy-Railway-specific code left here; deleting it
18
- // leaves the `beep` path below as the sole implementation.
19
- if (!config.beep) {
20
- return fetchRailwayBackend("/vaults/{vault}/stats-by-day", {
21
- path: { vault: address },
22
- query: { days: `${range}` },
23
- });
24
- }
25
-
26
12
  // beep backend (next-gen), typed against `@berachain/graphql/beep`.
27
13
  return fetchBeep("/v0/stake/{vault}/stats-by-day", {
28
14
  path: { vault: address },
@@ -24,7 +24,7 @@ export async function getApiEnrichedAllocation({
24
24
  percentage: allocation.percentage,
25
25
  receiver: allocation.receiver,
26
26
  startBlock,
27
- receivingVault: vaults?.gaugeList.find((vault) =>
27
+ receivingVault: vaults?.rewardVaultList.find((vault) =>
28
28
  isAddressEqual(vault.address, allocation.receiver),
29
29
  ),
30
30
  };
@@ -3,12 +3,10 @@ import type { Address } from "viem";
3
3
  import type { ValidatorIncentivesResponse } from "@berachain/graphql/beep";
4
4
 
5
5
  import { BeraError } from "../../errors/BeraError";
6
- import { beraFetchJson } from "../../utils/beraFetch";
7
6
  import { calculateTimestampFromDays } from "../../utils/formatTimestamps";
8
- import { parseBaseArgs } from "../../utils/parseBaseArgs";
9
7
  import { fetchBeep } from "../clients/fetchBeep";
10
8
 
11
- /** Browser-only. Reads from beep when configured, else the subgraph proxy. */
9
+ /** Browser-only. Reads validator incentive distribution from beep. */
12
10
  export async function getValidatorIncentiveDistribution({
13
11
  pubkey,
14
12
  dayRange,
@@ -24,28 +22,8 @@ export async function getValidatorIncentiveDistribution({
24
22
  });
25
23
  }
26
24
 
27
- const { config } = parseBaseArgs({});
28
-
29
- // TODO(beep): remove this entire block (and the subgraph proxy route at
30
- // `/api/pol/validator-incentive-distribution`) once `beep` is deployed on
31
- // every chain. beep then becomes the sole implementation. The route already
32
- // maps the subgraph response into beep's `ValidatorIncentivesResponse` shape,
33
- // so the client consumes a single (beep) type regardless of source.
34
- if (!config.beep) {
35
- const params = new URLSearchParams({
36
- pubkey,
37
- dayRange: String(dayRange),
38
- });
39
- return beraFetchJson<ValidatorIncentivesResponse>({
40
- url: `/api/pol/validator-incentive-distribution?${params}`,
41
- name: "pol-validator-incentive-distribution",
42
- type: "rest",
43
- });
44
- }
45
-
46
25
  // beep backend (next-gen). It is a public (`NEXT_PUBLIC_*`) URL, so it can be
47
- // called directly from the browser; the subgraph above stays behind the proxy
48
- // because it needs server-side auth headers.
26
+ // called directly from the browser no Vercel proxy.
49
27
  //
50
28
  // beep's `after` cursor is in seconds; `calculateTimestampFromDays` returns
51
29
  // microseconds, matching the subgraph's `timestamp_gte`. Pin it to the start
@@ -40,9 +40,9 @@ export class RequestError extends BeraError {
40
40
  "https://open-api.openocean.finance/v4/bera/swap",
41
41
  // vercel internal proxy
42
42
  "/api/aggregators?aggregator",
43
- // bonder endpoints have date-based query params (e.g. ?start=2025-11-28)
44
- mainnet.backend,
45
- // beep (next-gen backend) on testnet — same date-based bonder query params
43
+ // beep (next-gen backend) bonder endpoints have date-based query params
44
+ // (e.g. ?start=2025-11-28) on both networks
45
+ mainnet.beep,
46
46
  bepolia.beep,
47
47
  ];
48
48
 
@@ -15,7 +15,7 @@ export const useGetConvertToAssets = (
15
15
  options?: DefaultHookOptions,
16
16
  ) => {
17
17
  const publicClient = usePublicClient({ chainId: vaultChainId });
18
- const swrResponse = useSWR(
18
+ return useSWR(
19
19
  publicClient && sharesAmount && vaultAddress
20
20
  ? ["useGetConvertToAssets", sharesAmount, vaultAddress, vaultChainId]
21
21
  : null,
@@ -32,11 +32,4 @@ export const useGetConvertToAssets = (
32
32
  ...options,
33
33
  },
34
34
  );
35
-
36
- return {
37
- ...swrResponse,
38
- refresh: () => {
39
- swrResponse.mutate();
40
- },
41
- };
42
35
  };
@@ -258,6 +258,8 @@ export function useAggregatorsQuotes(
258
258
 
259
259
  return {
260
260
  ...data,
261
- refresh: () => results.map((r) => r.mutate()),
261
+ refresh: () => {
262
+ results.map((r) => r.refresh());
263
+ },
262
264
  };
263
265
  }
@@ -12,7 +12,7 @@ export const useAggregatorsRouterFeeBps = () => {
12
12
  const { config } = parseBaseArgs({
13
13
  chainId: publicClient.chain?.id,
14
14
  });
15
- const swrResponse = useSWRImmutable(
15
+ return useSWRImmutable(
16
16
  publicClient &&
17
17
  config.bex.aggregatorsRouter &&
18
18
  config.bex.aggregatorsRouter !== zeroAddress
@@ -27,9 +27,4 @@ export const useAggregatorsRouterFeeBps = () => {
27
27
  return Number(fee);
28
28
  },
29
29
  );
30
-
31
- return {
32
- ...swrResponse,
33
- refresh: swrResponse.mutate,
34
- };
35
30
  };
@@ -17,7 +17,7 @@ export const useAllUserPools = (
17
17
  query: GetPoolsQueryVariables,
18
18
  options?: DefaultHookOptions,
19
19
  ) => {
20
- const swrResponse = useSWR(
20
+ return useSWR(
21
21
  useAllUserPoolsQueryKey({ query }),
22
22
  async ([_, params]) => {
23
23
  return getAllPools({
@@ -30,11 +30,4 @@ export const useAllUserPools = (
30
30
  ...options,
31
31
  },
32
32
  );
33
-
34
- return {
35
- ...swrResponse,
36
- refresh: () => {
37
- swrResponse.mutate();
38
- },
39
- };
40
33
  };
@@ -24,7 +24,7 @@ export function useApiPool({
24
24
  poolId: Hex;
25
25
  account?: Address;
26
26
  }) {
27
- const res = useSWR(
27
+ return useSWR(
28
28
  useApiPoolQueryKey({ poolId, account }),
29
29
  async ([, poolId, account]): Promise<MinimalPoolFragment> => {
30
30
  if (account && !isAddress(account)) {
@@ -43,11 +43,4 @@ export function useApiPool({
43
43
  refreshInterval: POLLING.NORMAL,
44
44
  },
45
45
  );
46
-
47
- return {
48
- ...res,
49
- refresh: () => {
50
- res.mutate();
51
- },
52
- };
53
46
  }
@@ -17,6 +17,5 @@ export const useGlobalLiquidityAndSwapVolume = () => {
17
17
  response.data?.protocolMetricsAggregated.swapVolume24h,
18
18
  ),
19
19
  },
20
- refresh: () => response.mutate(),
21
20
  };
22
21
  };
@@ -65,7 +65,7 @@ export function useOnChainPoolData(poolId: string) {
65
65
  data: poolData,
66
66
  error,
67
67
  isLoading,
68
- mutate,
68
+ refresh: mutate,
69
69
  } = useSWRImmutable(
70
70
  // FIXME: why are we using useSWRImmutable when we fetch tokenSupply and swapFee?
71
71
  publicClient ? QUERY_KEY : null,
@@ -145,7 +145,6 @@ export function useOnChainPoolData(poolId: string) {
145
145
  data: pool,
146
146
  error,
147
147
  isLoading: isLoading || isTokenInformationLoading || isTokenPricesLoading,
148
- mutate,
149
- refresh: () => mutate(),
148
+ refresh: mutate,
150
149
  };
151
150
  }
@@ -29,7 +29,7 @@ export const usePollPoolCreationRelayerApproval = (
29
29
  ] as const)
30
30
  : null;
31
31
 
32
- const swrResponse = useSWR<boolean>(
32
+ return useSWR<boolean>(
33
33
  QUERY_KEY,
34
34
  async ([, account]) => {
35
35
  assertPublicClient(publicClient);
@@ -46,10 +46,4 @@ export const usePollPoolCreationRelayerApproval = (
46
46
  },
47
47
  { ...options },
48
48
  );
49
-
50
- const refreshPoolCreationApproval = () => {
51
- swrResponse.mutate();
52
- };
53
-
54
- return { ...swrResponse, refreshPoolCreationApproval };
55
49
  };
@@ -24,7 +24,7 @@ export const usePoolHistoricalData = (
24
24
  ? (["usePoolHistoricalData", poolId] as const)
25
25
  : null;
26
26
 
27
- const swrResponse = useSWR<
27
+ return useSWR<
28
28
  PoolHistoricalDataFragment[] | undefined,
29
29
  any,
30
30
  typeof QUERY_KEY
@@ -38,9 +38,4 @@ export const usePoolHistoricalData = (
38
38
  },
39
39
  options,
40
40
  );
41
-
42
- return {
43
- ...swrResponse,
44
- refresh: () => void swrResponse.mutate(),
45
- };
46
41
  };
@@ -28,7 +28,7 @@ export const usePools = (
28
28
  const {
29
29
  data: userPools,
30
30
  isLoading: isUserPoolsLoading,
31
- mutate: mutateUserPools,
31
+ refresh: mutateUserPools,
32
32
  } = useAllUserPools({
33
33
  userAddress: account,
34
34
  chain: query.chain,
@@ -37,7 +37,7 @@ export const usePools = (
37
37
  const {
38
38
  data: pools,
39
39
  isLoading: isPoolsLoading,
40
- mutate: mutatePools,
40
+ refresh: mutatePools,
41
41
  error: poolsError,
42
42
  } = useSWR(
43
43
  usePoolsQueryKey({ query }),
@@ -151,7 +151,7 @@ export function useBendZapSupply(
151
151
  isCrossChain,
152
152
  nativeFee,
153
153
  refresh: () => {
154
- swrResponse.mutate();
154
+ swrResponse.refresh();
155
155
  },
156
156
  };
157
157
  }
@@ -114,7 +114,7 @@ export function useEnsoSwapBundle({
114
114
  return {
115
115
  ...swrResponse,
116
116
  refresh: () => {
117
- swrResponse.mutate();
117
+ swrResponse.refresh();
118
118
  refreshBalances();
119
119
  },
120
120
  };
@@ -29,7 +29,7 @@ export function useEnsoUserTokensWithBalances(
29
29
  ] as const)
30
30
  : null;
31
31
 
32
- const swrResponse = useSWR(
32
+ return useSWR(
33
33
  QUERY_KEY,
34
34
  async ([, fromAddress, chainId]): Promise<BalanceToken[]> =>
35
35
  getEnsoUserTokensWithBalances({
@@ -45,8 +45,4 @@ export function useEnsoUserTokensWithBalances(
45
45
  ...options,
46
46
  },
47
47
  );
48
- return {
49
- ...swrResponse,
50
- refresh: () => swrResponse.mutate(),
51
- };
52
48
  }
@@ -106,8 +106,5 @@ export function useZapStakeBera(
106
106
  priceImpactPercentage,
107
107
  isCrossChain: inputToken && tokenOut.chainId !== inputToken?.chainId,
108
108
  },
109
- refresh: () => {
110
- swrResponse.mutate();
111
- },
112
109
  };
113
110
  }
@@ -75,25 +75,22 @@ export const usePollProposal = (
75
75
  switch (swrResponse.data.status) {
76
76
  case ProposalStatus.Pending:
77
77
  if (timestamp >= Number(swrResponse.data.voteStartAt)) {
78
- swrResponse.mutate();
78
+ swrResponse.refresh();
79
79
  }
80
80
  break;
81
81
  case ProposalStatus.Active:
82
82
  if (timestamp >= Number(swrResponse.data.voteEndAt)) {
83
- swrResponse.mutate();
83
+ swrResponse.refresh();
84
84
  }
85
85
  break;
86
86
  case ProposalStatus.InQueue:
87
87
  if (Date.now() / 1000 + 1 >= Number(swrResponse.data.queueEnd)) {
88
- swrResponse.mutate();
88
+ swrResponse.refresh();
89
89
  }
90
90
  break;
91
91
  }
92
92
  }, [swrResponse.data?.status, timestamp]);
93
93
 
94
94
  // const votes = swrResponse.data?.votes.nodes ?? [];
95
- return {
96
- ...swrResponse,
97
- refresh: () => swrResponse?.mutate?.(),
98
- };
95
+ return swrResponse;
99
96
  };
@@ -18,7 +18,7 @@ export const usePollProposalThreshold = (
18
18
  ? (["usePollProposalThreshold", governorAddress] as const)
19
19
  : null;
20
20
 
21
- const swrResponse = useSWR<{ votesThreshold: string }, any, typeof QUERY_KEY>(
21
+ return useSWR<{ votesThreshold: string }, any, typeof QUERY_KEY>(
22
22
  QUERY_KEY,
23
23
  async ([, governorAddress]) => {
24
24
  assertPublicClient(publicClient);
@@ -34,9 +34,4 @@ export const usePollProposalThreshold = (
34
34
  refreshInterval: POLLING.SLOW,
35
35
  },
36
36
  );
37
-
38
- return {
39
- ...swrResponse,
40
- refresh: swrResponse.mutate,
41
- };
42
37
  };
@@ -25,7 +25,7 @@ export const usePollUserDelegates = (
25
25
  ? (["usePollUserDelegates", account] as const)
26
26
  : null;
27
27
 
28
- const swrResponse = useSWR<
28
+ return useSWR<
29
29
  { delegate: Address; currentVotes: string | undefined },
30
30
  any,
31
31
  typeof QUERY_KEY
@@ -66,9 +66,4 @@ export const usePollUserDelegates = (
66
66
  refreshInterval: options?.refreshInterval ?? POLLING.SLOW,
67
67
  },
68
68
  );
69
-
70
- return {
71
- ...swrResponse,
72
- refresh: () => swrResponse?.mutate?.(),
73
- };
74
69
  };
@@ -2,14 +2,14 @@ import type { Address } from "viem";
2
2
 
3
3
  import type { ProposalWithVotesFragment } from "@berachain/graphql/governance";
4
4
  import { usePublicClient, useTransactionReceipt } from "@berachain/wagmi/hooks";
5
- import type { SWRResponse } from "@berachain/utils/pkg/swr";
5
+ import type { BeraSwrResponse } from "@berachain/utils/pkg/swr";
6
6
  import { useSWR } from "@berachain/utils/pkg/swr";
7
7
 
8
8
  import { getProposalFromTx } from "../../actions/governance/getProposalFromTx";
9
9
 
10
10
  export const useProposalFromTx = (
11
11
  txHash?: Address,
12
- ): SWRResponse<ProposalWithVotesFragment | null> => {
12
+ ): BeraSwrResponse<ProposalWithVotesFragment | null> => {
13
13
  const { data: tx } = useTransactionReceipt({
14
14
  hash: txHash,
15
15
  });
@@ -19,7 +19,7 @@ export const useProposalFromTx = (
19
19
  const QUERY_KEY =
20
20
  tx && publicClient ? (["useProposalFromTx", txHash] as const) : null;
21
21
 
22
- const swrResponse = useSWR(QUERY_KEY, async ([, txHash]) => {
22
+ return useSWR(QUERY_KEY, async ([, txHash]) => {
23
23
  if (!tx) {
24
24
  throw new Error("Transaction not found");
25
25
  }
@@ -33,6 +33,4 @@ export const useProposalFromTx = (
33
33
 
34
34
  return getProposalFromTx({ tx, publicClient });
35
35
  });
36
-
37
- return swrResponse;
38
36
  };
@@ -1,7 +1,7 @@
1
1
  import { berachainGovernanceAbi as governanceAbi } from "@berachain/abis/gov/berachainGovernance";
2
2
 
3
3
  import { usePublicClient } from "@berachain/wagmi/hooks";
4
- import type { SWRResponse } from "@berachain/utils/pkg/swr";
4
+ import type { BeraSwrResponse } from "@berachain/utils/pkg/swr";
5
5
  import { useSWRImmutable } from "@berachain/utils/pkg/swr";
6
6
 
7
7
  import { assertPublicClient } from "../../errors/assert";
@@ -18,7 +18,7 @@ export const useProposalSnapshot = ({
18
18
  proposalId,
19
19
  }: {
20
20
  proposalId: number | bigint | string | undefined;
21
- }): SWRResponse<string> => {
21
+ }): BeraSwrResponse<string> => {
22
22
  const publicClient = usePublicClient();
23
23
 
24
24
  const QUERY_KEY =
@@ -3,7 +3,7 @@ import type { Address } from "viem";
3
3
  import { berachainGovernanceAbi as governanceAbi } from "@berachain/abis/gov/berachainGovernance";
4
4
 
5
5
  import { usePublicClient } from "@berachain/wagmi/hooks";
6
- import type { SWRResponse } from "@berachain/utils/pkg/swr";
6
+ import type { BeraSwrResponse } from "@berachain/utils/pkg/swr";
7
7
  import { useSWRImmutable } from "@berachain/utils/pkg/swr";
8
8
 
9
9
  import { ProposalState } from "../../enum/governance";
@@ -26,7 +26,7 @@ export const useProposalState = ({
26
26
  }: {
27
27
  proposalId: number | bigint | string | undefined;
28
28
  governorAddress: Address;
29
- }): SWRResponse<string> => {
29
+ }): BeraSwrResponse<string> => {
30
30
  const publicClient = usePublicClient();
31
31
 
32
32
  const QUERY_KEY =
@@ -3,7 +3,7 @@ import type { Address } from "viem";
3
3
  import { timeLockAbi as governanceTimelockAbi } from "@berachain/abis/gov/timeLock";
4
4
 
5
5
  import { usePublicClient } from "@berachain/wagmi/hooks";
6
- import type { SWRResponse } from "@berachain/utils/pkg/swr";
6
+ import type { BeraSwrResponse } from "@berachain/utils/pkg/swr";
7
7
  import { useSWR } from "@berachain/utils/pkg/swr";
8
8
 
9
9
  import { POLLING } from "../../enum/polling";
@@ -26,7 +26,7 @@ export function useProposalTimelockState({
26
26
  }: {
27
27
  proposalTimelockId: Address | undefined;
28
28
  timelockAddress: Address;
29
- }): SWRResponse<
29
+ }): BeraSwrResponse<
30
30
  (typeof TimelockOperationState)[keyof typeof TimelockOperationState]
31
31
  > {
32
32
  const publicClient = usePublicClient();
@@ -56,7 +56,7 @@ export const useCappedGlobally = (
56
56
  ] as const)
57
57
  : null;
58
58
 
59
- const swrResponse = useSWR(
59
+ return useSWR(
60
60
  QUERY_KEY,
61
61
  async ([
62
62
  _,
@@ -85,9 +85,4 @@ export const useCappedGlobally = (
85
85
  refreshInterval: 0,
86
86
  },
87
87
  );
88
-
89
- return {
90
- ...swrResponse,
91
- refresh: () => void swrResponse.mutate(),
92
- };
93
88
  };
@@ -41,7 +41,7 @@ export const useCappedRelatively = (
41
41
  ] as const)
42
42
  : null;
43
43
 
44
- const swrResponse = useSWR(
44
+ return useSWR(
45
45
  QUERY_KEY,
46
46
  async ([_, asset, amount, collaterals, referenceCollateral]) => {
47
47
  if (isBasketModeEnabled) {
@@ -83,9 +83,4 @@ export const useCappedRelatively = (
83
83
  ...options,
84
84
  },
85
85
  );
86
-
87
- return {
88
- ...swrResponse,
89
- refresh: () => void swrResponse.mutate(),
90
- };
91
86
  };
@@ -29,7 +29,7 @@ export const useCollateralWeights = (
29
29
  ? (["useCollateralWeights", collateralList] as const)
30
30
  : undefined;
31
31
 
32
- const swrResponse = useSWR(
32
+ return useSWR(
33
33
  QUERY_KEY,
34
34
  async ([_, collateralList]) => {
35
35
  assertPublicClient(publicClient);
@@ -44,9 +44,4 @@ export const useCollateralWeights = (
44
44
  refreshInterval: options?.refreshInterval ?? POLLING.NORMAL,
45
45
  },
46
46
  );
47
-
48
- return {
49
- ...swrResponse,
50
- refresh: () => void swrResponse.mutate(),
51
- };
52
47
  };
@@ -8,9 +8,5 @@ export function useHoney24hVolume() {
8
8
  refreshInterval: POLLING.SLOW,
9
9
  });
10
10
 
11
- return {
12
- ...response,
13
-
14
- refresh: () => response.mutate(),
15
- };
11
+ return response;
16
12
  }
@@ -48,7 +48,7 @@ export const useHoneyBalances = (): DefaultHookReturnType<
48
48
  ? (["useHoneyBalances", account, collateralList] as const)
49
49
  : null;
50
50
 
51
- const swrResponse = useSWR(
51
+ return useSWR(
52
52
  QUERY_KEY,
53
53
  async ([_, account, collateralList]) => {
54
54
  assertPublicClient(publicClient);
@@ -75,9 +75,4 @@ export const useHoneyBalances = (): DefaultHookReturnType<
75
75
  refreshInterval: POLLING.FAST,
76
76
  },
77
77
  );
78
-
79
- return {
80
- ...swrResponse,
81
- refresh: () => swrResponse.mutate(),
82
- };
83
78
  };
@@ -3,15 +3,7 @@ import { useSWR } from "@berachain/utils/pkg/swr";
3
3
  import { getChartData } from "../../actions/honey/getChartData";
4
4
 
5
5
  export function useHoneyChartData({ days }: { days: number }) {
6
- const swrResponse = useSWR(
7
- ["useHoneyChartData", days] as const,
8
- async ([_, days]) => {
9
- return await getChartData({ days });
10
- },
11
- );
12
-
13
- return {
14
- ...swrResponse,
15
- refresh: () => swrResponse.mutate(),
16
- };
6
+ return useSWR(["useHoneyChartData", days] as const, async ([_, days]) => {
7
+ return await getChartData({ days });
8
+ });
17
9
  }