@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
@@ -23,7 +23,7 @@ export const useHoneyVaultsBalance = (
23
23
  ? (["useHoneyVaultsBalance", collateralList] as const)
24
24
  : null;
25
25
 
26
- const swrResponse = useSWR(
26
+ return useSWR(
27
27
  QUERY_KEY,
28
28
  async ([_, collateralList]) => {
29
29
  assertPublicClient(publicClient);
@@ -35,9 +35,4 @@ export const useHoneyVaultsBalance = (
35
35
  },
36
36
  { ...options, refreshInterval: POLLING.NORMAL },
37
37
  );
38
-
39
- return {
40
- ...swrResponse,
41
- refresh: () => void swrResponse.mutate(),
42
- };
43
38
  };
@@ -49,7 +49,7 @@ export const useIsBadCollateralAsset = (
49
49
  ] as const)
50
50
  : null;
51
51
 
52
- const swrResponse = useSWR(
52
+ return useSWR(
53
53
  QUERY_KEY,
54
54
  async ([_, collateral, latestPrices, isPythWrapperEnabled]) => {
55
55
  assertPublicClient(publicClient);
@@ -66,9 +66,4 @@ export const useIsBadCollateralAsset = (
66
66
  refreshInterval: options?.refreshInterval ?? POLLING.NORMAL,
67
67
  },
68
68
  );
69
-
70
- return {
71
- ...swrResponse,
72
- refresh: () => void swrResponse.mutate(),
73
- };
74
69
  };
@@ -42,7 +42,7 @@ export function useIsBasketModeEnabled(
42
42
  ] as const)
43
43
  : null;
44
44
 
45
- const swrResponse = useSWR(
45
+ return useSWR(
46
46
  QUERY_KEY,
47
47
  async ([_, isMint, latestPrices, isPythWrapperEnabled, collateralList]) => {
48
48
  assertPublicClient(publicClient);
@@ -62,9 +62,4 @@ export function useIsBasketModeEnabled(
62
62
  refreshInterval: options?.refreshInterval ?? POLLING.FAST,
63
63
  },
64
64
  );
65
- return {
66
- ...swrResponse,
67
- data: swrResponse.data,
68
- refresh: () => void swrResponse.mutate(),
69
- };
70
65
  }
@@ -1,4 +1,4 @@
1
- import type { SWRResponse } from "@berachain/utils/pkg/swr";
1
+ import type { BeraSwrResponse } from "@berachain/utils/pkg/swr";
2
2
  import { useSWR } from "@berachain/utils/pkg/swr";
3
3
 
4
4
  import type { PythLatestUpdates } from "../../actions/honey/getPythLatestPrices";
@@ -10,7 +10,7 @@ import type { PythPriceFeedMap } from "../../types/honeySwap";
10
10
  * Hook to fetch the latest Pyth price updates for specified pair addresses
11
11
  * @param {Object} params - The parameters object
12
12
  * @param {Address[] | undefined} params.pairMainAddress - Array of pair addresses to fetch price updates for
13
- * @returns {SWRResponse<PythLatestUpdates>} SWR response containing the latest Pyth price updates
13
+ * @returns {BeraSwrResponse<PythLatestUpdates>} SWR response containing the latest Pyth price updates
14
14
  * @example
15
15
  * ```ts
16
16
  * const { data, error } = usePythLatestPrices({
@@ -25,14 +25,14 @@ export function usePythLatestPrices(
25
25
  priceFeedMap: PythPriceFeedMap | undefined;
26
26
  },
27
27
  options?: DefaultHookOptions,
28
- ): SWRResponse<PythLatestUpdates> {
28
+ ): BeraSwrResponse<PythLatestUpdates> {
29
29
  const priceFeedIds = priceFeedMap ? Object.values(priceFeedMap) : null;
30
30
 
31
31
  const QUERY_KEY = priceFeedIds
32
32
  ? (["usePythLatestPrices", priceFeedIds] as const)
33
33
  : null;
34
34
 
35
- const swrResponse = useSWR(
35
+ return useSWR(
36
36
  QUERY_KEY,
37
37
  async ([_, priceFeeds]) => {
38
38
  const data = await getPythLatestPrices({ priceFeedId: priceFeeds });
@@ -40,6 +40,4 @@ export function usePythLatestPrices(
40
40
  },
41
41
  options,
42
42
  );
43
-
44
- return swrResponse;
45
43
  }
@@ -22,7 +22,7 @@ export function useAutoclaimedIncentives({
22
22
  ? (["useAutoclaimedIncentives", account] as const)
23
23
  : null;
24
24
 
25
- const swrResponse = useSWR(
25
+ return useSWR(
26
26
  QUERY_KEY,
27
27
  async ([, account]) => getAutoclaimedIncentives({ account }),
28
28
  {
@@ -31,9 +31,4 @@ export function useAutoclaimedIncentives({
31
31
  revalidateIfStale: false,
32
32
  },
33
33
  );
34
-
35
- return {
36
- ...swrResponse,
37
- refresh: () => swrResponse?.mutate?.(),
38
- };
39
34
  }
@@ -22,7 +22,7 @@ export function useAutoclaimedIncentivesTxHash({
22
22
  ? (["useAutoclaimedIncentivesTxHash", account] as const)
23
23
  : null;
24
24
 
25
- const swrResponse = useSWR(
25
+ return useSWR(
26
26
  QUERY_KEY,
27
27
  async ([, account]) => getAutoclaimedIncentivesTxHash({ account }),
28
28
  {
@@ -36,9 +36,4 @@ export function useAutoclaimedIncentivesTxHash({
36
36
  revalidateIfStale: false,
37
37
  },
38
38
  );
39
-
40
- return {
41
- ...swrResponse,
42
- refresh: () => swrResponse?.mutate?.(),
43
- };
44
39
  }
@@ -21,7 +21,7 @@ export function useBgtIncentiveDistributorPaused(
21
21
  ? (["useBgtIncentiveDistributorPaused", publicClient.chain?.id] as const)
22
22
  : null;
23
23
 
24
- const swrResponse = useSWR(
24
+ return useSWR(
25
25
  QUERY_KEY,
26
26
  async () =>
27
27
  getBgtIncentiveDistributorPaused({ publicClient }).catch(() => false),
@@ -31,9 +31,4 @@ export function useBgtIncentiveDistributorPaused(
31
31
  ...options,
32
32
  },
33
33
  );
34
-
35
- return {
36
- ...swrResponse,
37
- refresh: () => swrResponse?.mutate?.(),
38
- };
39
34
  }
@@ -24,7 +24,7 @@ export const useBgtUnstakedBalance = (
24
24
  ? (["useBgtUnstakedBalance", account] as const)
25
25
  : null;
26
26
 
27
- const swrResponse = useSWR(
27
+ return useSWR(
28
28
  QUERY_KEY,
29
29
  async ([, account]) => {
30
30
  assertPublicClient(publicClient);
@@ -46,9 +46,4 @@ export const useBgtUnstakedBalance = (
46
46
  refreshInterval: options?.refreshInterval ?? POLLING.NORMAL,
47
47
  },
48
48
  );
49
-
50
- return {
51
- ...swrResponse,
52
- refresh: () => swrResponse.mutate(),
53
- };
54
49
  };
@@ -13,7 +13,7 @@ export const useClaimableFees = () => {
13
13
  const publicClient = usePublicClient();
14
14
  const QUERY_KEY =
15
15
  account && publicClient ? (["useClaimableFees", account] as const) : null;
16
- const swrResponse = useSWR(
16
+ return useSWR(
17
17
  QUERY_KEY,
18
18
  async ([, account]) => {
19
19
  assertPublicClient(publicClient);
@@ -31,8 +31,4 @@ export const useClaimableFees = () => {
31
31
  refreshInterval: POLLING.SLOW * 2,
32
32
  },
33
33
  );
34
- return {
35
- ...swrResponse,
36
- refresh: () => swrResponse?.mutate?.(),
37
- };
38
34
  };
@@ -14,8 +14,7 @@ import { useRewardVaults } from "./useRewardVaults";
14
14
  *
15
15
  * @returns {Object} An object containing:
16
16
  * - highestApr: The highest APR value from the reward vaults
17
- * - refresh: Function to manually refresh the data
18
- * - ...swrResponse: All properties from the underlying SWR response
17
+ * - isLoading: Loading state
19
18
  *
20
19
  * @example
21
20
  * const { highestApr } = useHighestVaultsAPR({
@@ -28,7 +27,6 @@ export const useHighestVaultsAPR = (
28
27
  ): {
29
28
  highestApr: GqlRewardVaultDynamicData["apr"] | undefined;
30
29
  isLoading: boolean;
31
- refresh: () => void;
32
30
  } => {
33
31
  const swrResponse = useRewardVaults(
34
32
  {
@@ -49,7 +47,6 @@ export const useHighestVaultsAPR = (
49
47
 
50
48
  return {
51
49
  isLoading: swrResponse.isLoading,
52
- highestApr: swrResponse.data?.gaugeList[0].dynamicData?.apr,
53
- refresh: swrResponse.mutate,
50
+ highestApr: swrResponse.data?.rewardVaultList[0].dynamicData?.apr,
54
51
  };
55
52
  };
@@ -16,7 +16,7 @@ export const usePollGlobalData = (
16
16
  ): DefaultHookReturnType<GlobalData> => {
17
17
  const publicClient = usePublicClient();
18
18
 
19
- const swrResponse = useSWR<GlobalData>(
19
+ return useSWR<GlobalData>(
20
20
  publicClient ? "usePollGlobalData" : null,
21
21
  async () => {
22
22
  assertPublicClient(publicClient);
@@ -28,9 +28,4 @@ export const usePollGlobalData = (
28
28
  ...options,
29
29
  },
30
30
  );
31
-
32
- return {
33
- ...swrResponse,
34
- refresh: swrResponse.mutate,
35
- };
36
31
  };
@@ -17,7 +17,7 @@ export const usePollMarkets = (
17
17
  options?: DefaultHookOptions,
18
18
  ): UsePollMarketsResponse => {
19
19
  const QUERY_KEY = usePollMarketsQueryKey();
20
- const swrResponse = useSWRImmutable<GetMarkets, any, typeof QUERY_KEY>(
20
+ return useSWRImmutable<GetMarkets, any, typeof QUERY_KEY>(
21
21
  QUERY_KEY,
22
22
  async () => {
23
23
  const res = await getMarkets();
@@ -27,9 +27,4 @@ export const usePollMarkets = (
27
27
  ...options,
28
28
  },
29
29
  );
30
-
31
- return {
32
- ...swrResponse,
33
- refresh: () => swrResponse.mutate(),
34
- };
35
30
  };
@@ -39,11 +39,7 @@ export function useQueuedBeraUnlock(
39
39
  ] as const)
40
40
  : null;
41
41
 
42
- const swrResponse = useSWRImmutable<
43
- StakedBeraWithdrawal[],
44
- any,
45
- typeof QUERY_KEY
46
- >(
42
+ return useSWRImmutable<StakedBeraWithdrawal[], any, typeof QUERY_KEY>(
47
43
  QUERY_KEY,
48
44
  async ([, receiptTokenAddresses, account, version]) => {
49
45
  assertPublicClient(publicClient);
@@ -64,9 +60,4 @@ export function useQueuedBeraUnlock(
64
60
  ...options,
65
61
  },
66
62
  );
67
-
68
- return {
69
- ...swrResponse,
70
- refresh: () => swrResponse.mutate(),
71
- };
72
63
  }
@@ -48,8 +48,8 @@ export const useRewardVault = (
48
48
  isLoading: onChainRewardVault.isLoading || swrResponse.isLoading,
49
49
  isValidating: onChainRewardVault.isValidating ?? swrResponse.isValidating,
50
50
  refresh: () => {
51
- swrResponse.mutate();
52
- onChainRewardVault.mutate();
51
+ swrResponse.refresh();
52
+ onChainRewardVault.refresh();
53
53
  },
54
54
  };
55
55
  };
@@ -27,7 +27,7 @@ export const useRewardVaultBalanceFromStakingToken = (
27
27
  const {
28
28
  data: rewardVaultAddress = _rewardVaultAddress,
29
29
  error,
30
- mutate: mutateRewardVaultAddress,
30
+ refresh: mutateRewardVaultAddress,
31
31
  isLoading: isLoadingRewardVaultAddress,
32
32
  } = useRewardVaultFromToken(
33
33
  {
@@ -76,7 +76,7 @@ export const useRewardVaultBalanceFromStakingToken = (
76
76
  ...swrResponse,
77
77
  refresh: () => {
78
78
  mutateRewardVaultAddress();
79
- swrResponse.mutate();
79
+ swrResponse.refresh();
80
80
  },
81
81
  isLoading: swrResponse.isLoading || isLoadingRewardVaultAddress,
82
82
  };
@@ -27,33 +27,27 @@ export const useRewardVaultFromToken = (
27
27
  ? ["useRewardVaultFromToken", tokenAddress]
28
28
  : null;
29
29
 
30
- const swrResponse = useSWRImmutable<
31
- Address | undefined,
32
- any,
33
- typeof QUERY_KEY
34
- >(QUERY_KEY, async ([, tokenAddress]) => {
35
- if (!tokenAddress) {
36
- throw new Error("useRewardVaultFromToken needs a valid token address");
37
- }
38
-
39
- assertPublicClient(publicClient);
40
-
41
- const { config } = parseBaseArgs({
42
- chainId: publicClient.chain.id,
43
- });
44
-
45
- const res = await publicClient.readContract({
46
- address: config.pol.factory,
47
- abi: rewardVaultFactoryAbi,
48
- functionName: "getVault",
49
- args: [tokenAddress],
50
- });
51
-
52
- return res === zeroAddress ? undefined : res;
53
- });
54
-
55
- return {
56
- ...swrResponse,
57
- refresh: () => swrResponse.mutate(),
58
- };
30
+ return useSWRImmutable<Address | undefined, any, typeof QUERY_KEY>(
31
+ QUERY_KEY,
32
+ async ([, tokenAddress]) => {
33
+ if (!tokenAddress) {
34
+ throw new Error("useRewardVaultFromToken needs a valid token address");
35
+ }
36
+
37
+ assertPublicClient(publicClient);
38
+
39
+ const { config } = parseBaseArgs({
40
+ chainId: publicClient.chain.id,
41
+ });
42
+
43
+ const res = await publicClient.readContract({
44
+ address: config.pol.factory,
45
+ abi: rewardVaultFactoryAbi,
46
+ functionName: "getVault",
47
+ args: [tokenAddress],
48
+ });
49
+
50
+ return res === zeroAddress ? undefined : res;
51
+ },
52
+ );
59
53
  };
@@ -20,7 +20,7 @@ export function useRewardVaultIncentives({
20
20
  ? (["useRewardVaultIncentives", address, stakingToken] as const)
21
21
  : null;
22
22
 
23
- const swrResponse = useSWR(QUERY_KEY, async ([, address, stakingToken]) => {
23
+ return useSWR(QUERY_KEY, async ([, address, stakingToken]) => {
24
24
  assertPublicClient(publicClient);
25
25
 
26
26
  return await getRewardVaultIncentives({
@@ -29,9 +29,4 @@ export function useRewardVaultIncentives({
29
29
  publicClient,
30
30
  });
31
31
  });
32
-
33
- return {
34
- ...swrResponse,
35
- refresh: () => swrResponse?.mutate?.(),
36
- };
37
32
  }
@@ -18,7 +18,7 @@ export const useRewardVaultRewards = (
18
18
  ? (["useRewardVaultRewards", address] as const)
19
19
  : null;
20
20
 
21
- const swrResponse = useSWR(
21
+ return useSWR(
22
22
  QUERY_KEY,
23
23
  async ([, address]) => {
24
24
  assertPublicClient(publicClient);
@@ -29,9 +29,4 @@ export const useRewardVaultRewards = (
29
29
  ...options,
30
30
  },
31
31
  );
32
-
33
- return {
34
- ...swrResponse,
35
- refresh: () => swrResponse?.mutate?.(),
36
- };
37
32
  };
@@ -24,7 +24,7 @@ export const useRewardVaults = (
24
24
  args.onChainIncentives,
25
25
  );
26
26
  const publicClient = usePublicClient();
27
- const swrResponse = useSWR(
27
+ return useSWR(
28
28
  QUERY_KEY,
29
29
  async ([, filter, onChainIncentives]) => {
30
30
  return await getRewardVaults({
@@ -34,9 +34,4 @@ export const useRewardVaults = (
34
34
  },
35
35
  options,
36
36
  );
37
-
38
- return {
39
- ...swrResponse,
40
- refresh: swrResponse.mutate,
41
- };
42
37
  };
@@ -15,7 +15,7 @@ export function useStakedAPR({
15
15
  range: GqlVaultSnapshotDataRange;
16
16
  }): DefaultHookReturnType<UseStakedAPR> {
17
17
  const QUERY_KEY = range ? (["useStakedAPR", range] as const) : null;
18
- const swrResponse = useSWR(QUERY_KEY, async ([, range]) => {
18
+ return useSWR(QUERY_KEY, async ([, range]) => {
19
19
  const unsortedStakedBeraSnapshots = await getStakedBeraSnapshots({
20
20
  range,
21
21
  });
@@ -29,9 +29,4 @@ export function useStakedAPR({
29
29
  apr: item.apr,
30
30
  }));
31
31
  });
32
-
33
- return {
34
- ...swrResponse,
35
- refresh: () => swrResponse.mutate(),
36
- };
37
32
  }
@@ -1,13 +1,13 @@
1
1
  import type { Address } from "viem";
2
2
 
3
- import type { VaultStatsByDayResponse } from "@berachain/graphql/api";
3
+ import type { StakeStatsByDayResponse } from "@berachain/graphql/beep";
4
4
  import { useSWR } from "@berachain/utils/pkg/swr";
5
5
 
6
6
  import { getStakingDailyAssets } from "../../actions/pol/getStakingDailyAssets";
7
7
  import type { DefaultHookReturnType } from "../../types/global";
8
8
  import { dailyResolution } from "../../utils/filter";
9
9
 
10
- type UseStakedBeraSnapshot = Record<Address, VaultStatsByDayResponse>;
10
+ type UseStakedBeraSnapshot = Record<Address, StakeStatsByDayResponse>;
11
11
  export function useStakedSnapshots({
12
12
  range,
13
13
  addresses,
@@ -18,7 +18,7 @@ export function useStakedSnapshots({
18
18
  const QUERY_KEY = range
19
19
  ? (["useStakedSnapshots", range, addresses] as const)
20
20
  : null;
21
- const swrResponse = useSWR(QUERY_KEY, async ([, range, addresses]) => {
21
+ return useSWR(QUERY_KEY, async ([, range, addresses]) => {
22
22
  const [...sortedStakingDailyAssetsArray] = await Promise.all([
23
23
  ...addresses.map(async (address) => {
24
24
  const unstakingDailyAssets = await getStakingDailyAssets({
@@ -40,9 +40,4 @@ export function useStakedSnapshots({
40
40
  {} as UseStakedBeraSnapshot,
41
41
  );
42
42
  });
43
-
44
- return {
45
- ...swrResponse,
46
- refresh: () => swrResponse.mutate(),
47
- };
48
43
  }
@@ -13,7 +13,7 @@ export function useTotalStakedAmount({
13
13
  }): DefaultHookReturnType<Record<Address, bigint>> {
14
14
  const publicClient = usePublicClient();
15
15
 
16
- const swrResponse = useSWR(
16
+ return useSWR(
17
17
  vaultAddresses && publicClient
18
18
  ? ["useTotalStakedAmount", vaultAddresses]
19
19
  : null,
@@ -21,9 +21,4 @@ export function useTotalStakedAmount({
21
21
  return getTotalStakedAmount({ vaultAddresses, publicClient });
22
22
  },
23
23
  );
24
-
25
- return {
26
- ...swrResponse,
27
- refresh: () => swrResponse.mutate(),
28
- };
29
24
  }
@@ -25,7 +25,7 @@ export const useUserVaultInfo = (
25
25
  ? (["useUserVaultInfo", account, args.vaultAddress] as const)
26
26
  : null;
27
27
 
28
- const swrResponse = useSWR(
28
+ return useSWR(
29
29
  QUERY_KEY,
30
30
  async ([, account, vaultAddress]) => {
31
31
  assertPublicClient(publicClient);
@@ -41,9 +41,4 @@ export const useUserVaultInfo = (
41
41
  refreshInterval: options?.refreshInterval ?? POLLING.NORMAL,
42
42
  },
43
43
  );
44
-
45
- return {
46
- ...swrResponse,
47
- refresh: () => swrResponse.mutate(),
48
- };
49
44
  };
@@ -19,7 +19,7 @@ export const useUserVaults = (
19
19
  const publicClient = usePublicClient();
20
20
  const QUERY_KEY =
21
21
  account && publicClient ? (["useUserVaults", account] as const) : null;
22
- const swrResponse = useSWR<GetUserVaultsResponse, unknown, typeof QUERY_KEY>(
22
+ return useSWR<GetUserVaultsResponse, unknown, typeof QUERY_KEY>(
23
23
  QUERY_KEY,
24
24
  async ([, account]) => {
25
25
  assertPublicClient(publicClient);
@@ -35,8 +35,4 @@ export const useUserVaults = (
35
35
  keepPreviousData: true,
36
36
  },
37
37
  );
38
- return {
39
- ...swrResponse,
40
- refresh: () => swrResponse?.mutate?.(),
41
- };
42
38
  };
@@ -17,12 +17,7 @@ export const useVaultHistory = ({
17
17
  const QUERY_KEY = vault
18
18
  ? (["useVaultHistory", vault, range, resolution] as const)
19
19
  : null;
20
- const swrResponse = useSWR(QUERY_KEY, ([, vault, range, resolution]) =>
20
+ return useSWR(QUERY_KEY, ([, vault, range, resolution]) =>
21
21
  getVaultHistory({ vault, range, resolution }),
22
22
  );
23
-
24
- return {
25
- ...swrResponse,
26
- refresh: () => swrResponse.mutate(),
27
- };
28
23
  };
@@ -17,7 +17,7 @@ export const useVaultValidators = (
17
17
  options?: DefaultHookOptions,
18
18
  ): UsePollValidatorInfoResponse => {
19
19
  const QUERY_KEY = id ? (["useVaultValidators", id] as const) : null;
20
- const swrResponse = useSWR(
20
+ return useSWR(
21
21
  QUERY_KEY,
22
22
  async ([, address]) => {
23
23
  return await getVaultValidators({
@@ -28,9 +28,4 @@ export const useVaultValidators = (
28
28
  ...options,
29
29
  },
30
30
  );
31
-
32
- return {
33
- ...swrResponse,
34
- refresh: () => swrResponse.mutate(),
35
- };
36
31
  };
@@ -36,7 +36,7 @@ export function useMultipleTokenInformation(
36
36
  ] as const)
37
37
  : null;
38
38
 
39
- const swrResponse = useSWRImmutable<Token[], unknown, typeof QUERY_KEY>(
39
+ return useSWRImmutable<Token[], unknown, typeof QUERY_KEY>(
40
40
  QUERY_KEY,
41
41
  async ([, addresses, chainId]) => {
42
42
  // We already checked for publicClient in the QUERY_KEY
@@ -66,9 +66,4 @@ export function useMultipleTokenInformation(
66
66
  },
67
67
  { ...options },
68
68
  );
69
-
70
- return {
71
- ...swrResponse,
72
- refresh: () => swrResponse?.mutate?.(),
73
- };
74
69
  }
@@ -35,7 +35,7 @@ export function usePollAllowances(
35
35
  ? (["usePollAllowances", account, args?.items] as const)
36
36
  : null;
37
37
 
38
- const swrResponse = useSWR(
38
+ return useSWR(
39
39
  QUERY_KEY,
40
40
  async ([, account, items]) => {
41
41
  return getAllowances({
@@ -49,10 +49,4 @@ export function usePollAllowances(
49
49
  refreshInterval: options?.refreshInterval ?? POLLING.NORMAL,
50
50
  },
51
51
  );
52
-
53
- return {
54
- ...swrResponse,
55
-
56
- refresh: () => swrResponse?.mutate?.(),
57
- };
58
52
  }
@@ -110,9 +110,6 @@ export function usePollBalance(
110
110
 
111
111
  return {
112
112
  ...rest,
113
- refresh: () => {
114
- rest.mutate();
115
- },
116
113
  isLoading: isLoading || isNativeToken ? isLoadingTokenInformation : false,
117
114
  error: error || !isNativeToken ? error : undefined,
118
115
  data: tokenBalance,
@@ -74,7 +74,7 @@ export function usePollWalletBalances(
74
74
  return {
75
75
  ...swrResponse,
76
76
  refresh: () => {
77
- swrResponse?.mutate?.();
77
+ swrResponse?.refresh();
78
78
  refresh();
79
79
  },
80
80
  };
@@ -27,11 +27,7 @@ export const useStakingTokenInformation = (
27
27
  args?.address && publicClient && isAddress(args.address)
28
28
  ? (["useStakingTokenInformation", args.address] as const)
29
29
  : null;
30
- const swrResponse = useSWRImmutable<
31
- Partial<Token> | undefined,
32
- any,
33
- typeof QUERY_KEY
34
- >(
30
+ return useSWRImmutable<Partial<Token> | undefined, any, typeof QUERY_KEY>(
35
31
  QUERY_KEY,
36
32
  async ([_, address]) => {
37
33
  if (isToken(address, "BERA")) {
@@ -50,9 +46,4 @@ export const useStakingTokenInformation = (
50
46
  },
51
47
  { ...options },
52
48
  );
53
-
54
- return {
55
- ...swrResponse,
56
- refresh: () => swrResponse?.mutate?.(),
57
- };
58
49
  };