@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
@@ -33,7 +33,7 @@ export function useTokenInformation(
33
33
  args?.address && publicClient && isAddress(args.address)
34
34
  ? (["useTokenInformation", args.address, args.chainId] as const)
35
35
  : null;
36
- const swrResponse = useSWRImmutable<Token | undefined, any, typeof QUERY_KEY>(
36
+ return useSWRImmutable<Token | undefined, any, typeof QUERY_KEY>(
37
37
  QUERY_KEY,
38
38
  async ([_, address, chainId = defaultChainId]) => {
39
39
  if (isToken(address, "BERA")) {
@@ -59,9 +59,4 @@ export function useTokenInformation(
59
59
  },
60
60
  { ...options },
61
61
  );
62
-
63
- return {
64
- ...swrResponse,
65
- refresh: () => swrResponse?.mutate?.(),
66
- };
67
62
  }
@@ -26,7 +26,7 @@ export const useAllValidators = (
26
26
  options?: DefaultHookOptions,
27
27
  ): DefaultHookReturnType<GetValidatorsQuery | undefined> => {
28
28
  const { config } = parseBaseArgs(variables);
29
- const swrResponse = useSWR<GetValidatorsQuery | undefined>(
29
+ return useSWR<GetValidatorsQuery | undefined>(
30
30
  useAllValidatorsQueryKey({ variables }),
31
31
  async ([, variables]) => {
32
32
  const result = await getAllValidators({
@@ -42,9 +42,4 @@ export const useAllValidators = (
42
42
  ...options,
43
43
  },
44
44
  );
45
-
46
- return {
47
- ...swrResponse,
48
- refresh: () => swrResponse.mutate(),
49
- };
50
45
  };
@@ -20,7 +20,7 @@ export const useApiValidator = (
20
20
  options?: DefaultHookOptions,
21
21
  ): UsePollValidatorInfoResponse => {
22
22
  const QUERY_KEY = useApiValidatorQueryKey(id);
23
- const swrResponse = useSWR(
23
+ return useSWR(
24
24
  id ? QUERY_KEY : null,
25
25
  async ([, id]) => {
26
26
  if (!id || !isHex(id)) throw new Error(`Invalid validator ID: ${id}`);
@@ -29,9 +29,4 @@ export const useApiValidator = (
29
29
  },
30
30
  options,
31
31
  );
32
-
33
- return {
34
- ...swrResponse,
35
- refresh: () => swrResponse.mutate(),
36
- };
37
32
  };
@@ -18,7 +18,7 @@ export const useDailyValidatorBlockStats = ({
18
18
  ? (["useDailyValidatorBlockStats", pubKey, first] as const)
19
19
  : null;
20
20
 
21
- const swrResponse = useSWR(
21
+ return useSWR(
22
22
  QUERY_KEY,
23
23
  async ([, pubKey, first]) => {
24
24
  return await getDailyValidatorBlockStats({
@@ -30,6 +30,4 @@ export const useDailyValidatorBlockStats = ({
30
30
  refreshInterval: POLLING.SLOW,
31
31
  },
32
32
  );
33
-
34
- return { ...swrResponse, refresh: () => swrResponse.mutate() };
35
33
  };
@@ -10,7 +10,7 @@ export function useDefaultRewardAllocation(options?: DefaultHookOptions) {
10
10
  const publicClient = usePublicClient();
11
11
  const QUERY_KEY = publicClient ? ["useDefaultRewardAllocation"] : null;
12
12
 
13
- const swrResponse = useSWR<ValidatorRewardAllocation | undefined>(
13
+ return useSWR<ValidatorRewardAllocation | undefined>(
14
14
  QUERY_KEY,
15
15
  async () => {
16
16
  assertPublicClient(publicClient);
@@ -23,9 +23,4 @@ export function useDefaultRewardAllocation(options?: DefaultHookOptions) {
23
23
  ...options,
24
24
  },
25
25
  );
26
-
27
- return {
28
- ...swrResponse,
29
- refresh: () => swrResponse.mutate(),
30
- };
31
26
  }
@@ -117,6 +117,5 @@ export function useManagedValidatorRole(
117
117
  hasRewardAllocatorRole,
118
118
  }
119
119
  : undefined,
120
- refresh: () => swrResponse.mutate(),
121
120
  };
122
121
  }
@@ -21,7 +21,7 @@ export const useOnChainValidator = (
21
21
  ): DefaultHookReturnType<Partial<ApiValidatorFragment>> => {
22
22
  const publicClient = usePublicClient();
23
23
  const QUERY_KEY = pubkey ? (["useOnChainValidator", pubkey] as const) : null;
24
- const swrResponse = useSWR(
24
+ return useSWR(
25
25
  publicClient ? QUERY_KEY : null,
26
26
  async ([, pubkey]) => {
27
27
  assertPublicClient(publicClient);
@@ -60,11 +60,4 @@ export const useOnChainValidator = (
60
60
  },
61
61
  options,
62
62
  );
63
-
64
- return {
65
- ...swrResponse,
66
- refresh: () => {
67
- swrResponse.mutate();
68
- },
69
- };
70
63
  };
@@ -24,7 +24,7 @@ export const useStakingPoolBatch = ({
24
24
  ? (["useStakingPoolBatch", valPubKey] as const)
25
25
  : null;
26
26
 
27
- const swrResponse = useSWR(
27
+ return useSWR(
28
28
  QUERY_KEY,
29
29
  async ([, valPubKey]) => {
30
30
  assertPublicClient(publicClient);
@@ -39,9 +39,4 @@ export const useStakingPoolBatch = ({
39
39
  ...options,
40
40
  },
41
41
  );
42
-
43
- return {
44
- ...swrResponse,
45
- refresh: () => swrResponse.mutate(),
46
- };
47
42
  };
@@ -24,7 +24,7 @@ export const useUserActiveValidators = (
24
24
  ? (["useUserActiveValidators", 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
  return await getUserActiveValidators({
@@ -38,9 +38,4 @@ export const useUserActiveValidators = (
38
38
  keepPreviousData: true,
39
39
  },
40
40
  );
41
-
42
- return {
43
- ...swrResponse,
44
- refresh: () => swrResponse?.mutate?.(),
45
- };
46
41
  };
@@ -27,7 +27,7 @@ export const useUserBoostsOnValidator = ({
27
27
  ? (["useUserBoostsOnValidator", pubkey, account] as const)
28
28
  : null;
29
29
 
30
- const swrResponse = useSWR(
30
+ return useSWR(
31
31
  QUERY_KEY,
32
32
  async ([, pubkey, account]) => {
33
33
  return await getUserBoostsOnValidator({
@@ -40,6 +40,4 @@ export const useUserBoostsOnValidator = ({
40
40
  refreshInterval: POLLING.NORMAL,
41
41
  },
42
42
  );
43
-
44
- return { ...swrResponse, refresh: () => swrResponse.mutate() };
45
43
  };
@@ -136,8 +136,8 @@ export const useUserClaimableIncentives =
136
136
  );
137
137
 
138
138
  const refresh = useCallback(() => {
139
- allRewardsResponse?.mutate();
140
- swrResponse?.mutate();
139
+ allRewardsResponse?.refresh();
140
+ swrResponse?.refresh();
141
141
  }, [allRewardsResponse, swrResponse]);
142
142
 
143
143
  return {
@@ -39,7 +39,7 @@ export const useUserStakingPositions = ({
39
39
  const queryClient = account
40
40
  ? (["useUserStakingPositions", account, validatorAddress] as const)
41
41
  : null;
42
- const swrResponse = useSWRImmutable(
42
+ return useSWRImmutable(
43
43
  queryClient,
44
44
  async ([_, account, validatorAddress]) => {
45
45
  const userStakingPolls = await getUserStakingPositions(account);
@@ -53,11 +53,4 @@ export const useUserStakingPositions = ({
53
53
  return userStakingPolls;
54
54
  },
55
55
  );
56
-
57
- return {
58
- ...swrResponse,
59
- refresh: () => {
60
- swrResponse.mutate();
61
- },
62
- };
63
56
  };
@@ -19,7 +19,7 @@ export function useValidatorAnalytics({
19
19
  ? (["useValidatorAnalytics", pubkey, dayRange] as const)
20
20
  : null;
21
21
 
22
- const swrResponse = useSWR(
22
+ return useSWR(
23
23
  QUERY_KEY,
24
24
  async ([, pubkey, dayRange]) => {
25
25
  return await getValidatorAnalytics({
@@ -31,6 +31,4 @@ export function useValidatorAnalytics({
31
31
  refreshInterval: POLLING.SLOW,
32
32
  },
33
33
  );
34
-
35
- return { ...swrResponse, refresh: () => swrResponse.mutate() };
36
34
  }
@@ -19,7 +19,7 @@ export const useValidatorCommission = (
19
19
  ? (["useValidatorCommission", pubKey] as const)
20
20
  : null;
21
21
 
22
- const swrResponse = useSWR(
22
+ return useSWR(
23
23
  QUERY_KEY,
24
24
  async ([, pubKey]) => {
25
25
  return await getValidatorCommission({
@@ -31,9 +31,4 @@ export const useValidatorCommission = (
31
31
  ...options,
32
32
  },
33
33
  );
34
-
35
- return {
36
- ...swrResponse,
37
- refresh: () => swrResponse.mutate(),
38
- };
39
34
  };
@@ -25,7 +25,7 @@ export function useValidatorIncentiveDistribution({
25
25
  ? (["useValidatorIncentiveDistribution", pubkey, dayRange] as const)
26
26
  : null;
27
27
 
28
- const swrResponse = useSWR(
28
+ return useSWR(
29
29
  QUERY_KEY,
30
30
  async ([, pubkey, dayRange]) => {
31
31
  return await getValidatorIncentiveDistribution({ pubkey, dayRange });
@@ -34,6 +34,4 @@ export function useValidatorIncentiveDistribution({
34
34
  refreshInterval: POLLING.SLOW,
35
35
  },
36
36
  );
37
-
38
- return { ...swrResponse, refresh: () => swrResponse.mutate() };
39
37
  }
@@ -23,7 +23,7 @@ export function useValidatorQueuedCommission(
23
23
  ? (["useValidatorQueuedCommission", pubKey] as const)
24
24
  : null;
25
25
 
26
- const swrResponse = useSWR(
26
+ return useSWR(
27
27
  QUERY_KEY,
28
28
  async ([, pubKey]) => {
29
29
  assertPublicClient(publicClient);
@@ -36,9 +36,4 @@ export function useValidatorQueuedCommission(
36
36
  ...options,
37
37
  },
38
38
  );
39
-
40
- return {
41
- ...swrResponse,
42
- refresh: () => swrResponse.mutate(),
43
- };
44
39
  }
@@ -22,7 +22,7 @@ export const useValidatorQueuedOperatorAddress = (
22
22
  ? (["useValidatorQueuedOperatorAddress", pubKey] as const)
23
23
  : null;
24
24
 
25
- const swrResponse = useSWR(
25
+ return useSWR(
26
26
  QUERY_KEY,
27
27
  async ([, pubKey]) => {
28
28
  return await getValidatorQueuedOperatorAddress({
@@ -34,9 +34,4 @@ export const useValidatorQueuedOperatorAddress = (
34
34
  ...options,
35
35
  },
36
36
  );
37
-
38
- return {
39
- ...swrResponse,
40
- refresh: () => swrResponse.mutate(),
41
- };
42
37
  };
@@ -20,7 +20,7 @@ export const useValidatorQueuedRewardAllocation = (
20
20
  ? (["useValidatorQueuedRewardAllocation", pubKey] as const)
21
21
  : null;
22
22
 
23
- const swrResponse = useSWR(
23
+ return useSWR(
24
24
  QUERY_KEY,
25
25
  async ([, pubKey]) => {
26
26
  return await getValidatorQueuedRewardAllocation({
@@ -32,9 +32,4 @@ export const useValidatorQueuedRewardAllocation = (
32
32
  ...options,
33
33
  },
34
34
  );
35
-
36
- return {
37
- ...swrResponse,
38
- refresh: () => swrResponse.mutate(),
39
- };
40
35
  };
@@ -16,7 +16,7 @@ export function useValidatorRewardAllocation(
16
16
  ? (["useValidatorRewardAllocation", pubKey] as const)
17
17
  : null;
18
18
 
19
- const swrResponse = useSWR(
19
+ return useSWR(
20
20
  QUERY_KEY,
21
21
  async ([, pubKey]) => {
22
22
  return getValidatorRewardAllocation({
@@ -28,9 +28,4 @@ export function useValidatorRewardAllocation(
28
28
  ...options,
29
29
  },
30
30
  );
31
-
32
- return {
33
- ...swrResponse,
34
- refresh: () => swrResponse.mutate(),
35
- };
36
31
  }
@@ -12,7 +12,10 @@ import type {
12
12
 
13
13
  import type { BeraConfig, ChainId } from "@berachain/config";
14
14
 
15
- import type { SWRConfiguration, SWRResponse } from "@berachain/utils/pkg/swr";
15
+ import type {
16
+ BeraSwrResponse,
17
+ SWRConfiguration,
18
+ } from "@berachain/utils/pkg/swr";
16
19
 
17
20
  import type { ContractName } from "../enum/contracts";
18
21
  import type { TransactionActionType } from "../enum/txnEnum";
@@ -23,12 +26,7 @@ import type {
23
26
 
24
27
  export type DefaultHookOptions = SWRConfiguration & { isEnabled?: boolean };
25
28
 
26
- export type DefaultHookReturnType<T = any> = Omit<
27
- SWRResponse<T, any, any>,
28
- "mutate"
29
- > & {
30
- refresh: () => void;
31
- };
29
+ export type DefaultHookReturnType<T = any> = BeraSwrResponse<T, any>;
32
30
 
33
31
  export type IContractWriteFn = <
34
32
  abi extends Abi | undefined = undefined,
@@ -1,34 +0,0 @@
1
- import type { paths } from "@berachain/graphql/api";
2
-
3
- import { parseBaseArgs } from "../../utils/parseBaseArgs";
4
- import {
5
- type DefinedParams,
6
- fetchOpenApi,
7
- type GetPath,
8
- type GetResponse,
9
- } from "./fetchOpenApi";
10
-
11
- /**
12
- * Typed GET against the legacy Railway backend.
13
- *
14
- * The `path`, its path/query params and the response are all type-checked
15
- * against the Railway schema (`@berachain/graphql/api`). The base URL is
16
- * resolved from `config.backend`.
17
- *
18
- * @deprecated The Railway backend is being replaced by beep; prefer
19
- * {@link fetchBeep} where `config.beep` is available.
20
- */
21
- export function fetchRailwayBackend<P extends GetPath<paths>>(
22
- path: P,
23
- params: DefinedParams<paths, P>,
24
- args: BeraJS.BaseFunctionArgs = {},
25
- ): Promise<GetResponse<paths, P>> {
26
- const { config } = parseBaseArgs(args);
27
-
28
- return fetchOpenApi<paths, P>(
29
- config.backend,
30
- path,
31
- params,
32
- "backend-railway",
33
- );
34
- }
@@ -1,25 +0,0 @@
1
- import {
2
- type ApiVaultFragment,
3
- GqlRewardVaultOrderBy,
4
- GqlRewardVaultOrderDirection,
5
- } from "@berachain/graphql/pol/api";
6
-
7
- import { getRewardVaults } from "./getRewardVaults";
8
-
9
- export async function getGlobalCuttingBoard(
10
- threshold: number,
11
- ): Promise<ApiVaultFragment[]> {
12
- const { gaugeList } = await getRewardVaults({
13
- filter: {
14
- // TODO sort by bgt capture percentage
15
- orderBy: GqlRewardVaultOrderBy.Apr,
16
- orderDirection: GqlRewardVaultOrderDirection.Desc,
17
- pageSize: threshold,
18
- where: {
19
- includeNonWhitelisted: false,
20
- },
21
- },
22
- });
23
-
24
- return gaugeList;
25
- }
@@ -1,24 +0,0 @@
1
- import { BeraError } from "../../errors/BeraError";
2
- import { beraFetchJson } from "../../utils/beraFetch";
3
-
4
- export type IncentiveFeeClaimStats = {
5
- sumAllClaims: number;
6
- sumClaimsInLast24Hours: number;
7
- };
8
-
9
- /** Browser-only. Hits `/api/pol/incentive-fee-claims` (server computes totals). */
10
- export async function getIncentiveFeeClaimStats(): Promise<IncentiveFeeClaimStats> {
11
- if (typeof window === "undefined") {
12
- throw new BeraError({
13
- message:
14
- "getIncentiveFeeClaimStats is browser-only; call from a Client Component / SWR hook",
15
- level: "error",
16
- });
17
- }
18
-
19
- return beraFetchJson<IncentiveFeeClaimStats>({
20
- url: "/api/pol/incentive-fee-claims",
21
- name: "pol-incentive-fee-claims",
22
- type: "rest",
23
- });
24
- }