@berachain/berajs 0.2.10 → 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 (166) hide show
  1. package/dist/{HoneyConfigProvider-Dkj-_a5x.d.ts → HoneyConfigProvider-COOuDNra.d.ts} +1 -1
  2. package/dist/actions/clients/exports.d.ts +5 -21
  3. package/dist/actions/clients/exports.mjs +5 -7
  4. package/dist/actions/exports.d.ts +117 -31
  5. package/dist/actions/exports.mjs +36 -25
  6. package/dist/actions/governance/exports.d.ts +3 -11
  7. package/dist/actions/server/exports.mjs +2 -2
  8. package/dist/chunk-4ML4Y6UN.mjs +46 -0
  9. package/dist/{chunk-7YVNSDXG.mjs → chunk-FGION6F6.mjs} +1 -1
  10. package/dist/{chunk-3JJLQ2JX.mjs → chunk-MKSFQIKC.mjs} +1 -4
  11. package/dist/{chunk-ZLTMIFCZ.mjs → chunk-RFJGL4MF.mjs} +3 -3
  12. package/dist/{chunk-Y6THHG77.mjs → chunk-T43JPYQS.mjs} +1 -1
  13. package/dist/{chunk-WNBWX23Q.mjs → chunk-W2VODV76.mjs} +7 -10
  14. package/dist/{chunk-QBBOWFMH.mjs → chunk-XDG26EG6.mjs} +115 -162
  15. package/dist/{chunk-P5WXXULM.mjs → chunk-YLTWPFCJ.mjs} +3 -18
  16. package/dist/contexts/exports.d.ts +2 -2
  17. package/dist/contexts/exports.mjs +6 -4
  18. package/dist/enum/exports.d.ts +8 -2
  19. package/dist/errors/exports.mjs +2 -2
  20. package/dist/{getApolloClient-BcUTGFUb.d.ts → getApolloClient-MWm_iq4u.d.ts} +4 -5
  21. package/dist/getProposalVotes-DAUrdX2n.d.ts +12 -0
  22. package/dist/{getValidatorQueuedOperatorAddress-DphU3qhE.d.ts → getValidatorQueuedOperatorAddress-Cc05dlO3.d.ts} +8 -59
  23. package/dist/{global.d-BuGDKh4k.d.ts → global.d-CR3zicga.d.ts} +3 -10
  24. package/dist/hooks/exports.d.ts +145 -403
  25. package/dist/hooks/exports.mjs +496 -755
  26. package/dist/hooks/governance/exports.d.ts +24 -19
  27. package/dist/hooks/governance/exports.mjs +43 -53
  28. package/dist/{pol.d-Dw5SQcRX.d.ts → pol.d-CeRgXBL8.d.ts} +18 -4
  29. package/dist/types/exports.d.ts +5 -5
  30. package/dist/{useHoneySwapState-vFmuFF0g.d.ts → useHoneySwapState-twi7NTaO.d.ts} +1 -1
  31. package/dist/utils/exports.d.ts +2 -2
  32. package/dist/utils/exports.mjs +6 -2
  33. package/package.json +8 -7
  34. package/src/actions/bend/getMaxDeposit.ts +28 -2
  35. package/src/actions/clients/exports.ts +0 -1
  36. package/src/actions/clients/fetchBeep.ts +0 -7
  37. package/src/actions/clients/fetchOpenApi.ts +10 -6
  38. package/src/actions/clients/fetchOpenApi.unit.test.ts +20 -14
  39. package/src/actions/clients/getApolloClient.ts +4 -9
  40. package/src/actions/exports.ts +1 -1
  41. package/src/actions/honey/getChartData.ts +14 -14
  42. package/src/actions/honey/getHoney24hVolume.ts +17 -8
  43. package/src/actions/honey/getHoneyTxns.ts +45 -0
  44. package/src/actions/pol/__tests__/rewardVaults.integration.test.ts +3 -3
  45. package/src/actions/pol/getEarnedStakedBeraVault.ts +0 -15
  46. package/src/actions/pol/getGlobalData.ts +10 -29
  47. package/src/actions/pol/getRewardVaults.ts +4 -4
  48. package/src/actions/pol/getSWBeraVaultMetadata.ts +0 -7
  49. package/src/actions/pol/getStakingDailyAssets.ts +0 -14
  50. package/src/actions/validators/getApiEnrichedAllocation.ts +1 -1
  51. package/src/actions/validators/getValidatorIncentiveDistribution.ts +43 -13
  52. package/src/contexts/SwrFallback.tsx +2 -1
  53. package/src/data/contracts.ts +4 -0
  54. package/src/errors/RequestError.ts +3 -3
  55. package/src/errors/getRevertReason.integration.test.ts +5 -1
  56. package/src/hooks/bend/useGetConvertToAssets.ts +3 -11
  57. package/src/hooks/dex/useAggregatorsQuotes.ts +13 -11
  58. package/src/hooks/dex/useAggregatorsRouterFeeBps.ts +2 -7
  59. package/src/hooks/dex/useAllUserPools.ts +8 -13
  60. package/src/hooks/dex/useApiPool.ts +2 -9
  61. package/src/hooks/dex/useGlobalLiquidityAndSwapVolume.ts +1 -2
  62. package/src/hooks/dex/useOnChainPoolData.ts +3 -4
  63. package/src/hooks/dex/usePollPoolCreationRelayerApproval.ts +3 -9
  64. package/src/hooks/dex/usePoolEvents.ts +1 -2
  65. package/src/hooks/dex/usePoolHistoricalData.ts +3 -9
  66. package/src/hooks/dex/usePools.ts +6 -4
  67. package/src/hooks/dex/useSingleAggregatorQuote.ts +6 -18
  68. package/src/hooks/enso/useBendDemultiply.ts +3 -4
  69. package/src/hooks/enso/useBendMultiply.ts +3 -4
  70. package/src/hooks/enso/useBendZapSupply.ts +4 -5
  71. package/src/hooks/enso/useEnsoSwapBundle.ts +2 -2
  72. package/src/hooks/enso/useEnsoUserTokensWithBalances.ts +4 -10
  73. package/src/hooks/enso/useEnsoWalletV2Address.ts +1 -1
  74. package/src/hooks/enso/useIsBendAuthorized.ts +1 -1
  75. package/src/hooks/enso/useZapStakeBera.ts +2 -5
  76. package/src/hooks/exports.ts +1 -0
  77. package/src/hooks/governance/useGetPastVotes.ts +1 -1
  78. package/src/hooks/governance/useHasVoted.ts +1 -1
  79. package/src/hooks/governance/useIsCanceller.ts +1 -1
  80. package/src/hooks/governance/usePollAllProposals.ts +13 -12
  81. package/src/hooks/governance/usePollProposal.ts +7 -10
  82. package/src/hooks/governance/usePollProposalThreshold.ts +2 -7
  83. package/src/hooks/governance/usePollProposalVotes.ts +23 -5
  84. package/src/hooks/governance/usePollUserDelegates.ts +4 -9
  85. package/src/hooks/governance/useProposalFromTx.ts +4 -5
  86. package/src/hooks/governance/useProposalSnapshot.ts +3 -4
  87. package/src/hooks/governance/useProposalState.ts +3 -3
  88. package/src/hooks/governance/useProposalTimelockState.ts +3 -2
  89. package/src/hooks/governance/useQuorum.ts +1 -2
  90. package/src/hooks/honey/useCappedGlobally.ts +4 -12
  91. package/src/hooks/honey/useCappedRelatively.ts +3 -8
  92. package/src/hooks/honey/useCollateralWeights.ts +4 -9
  93. package/src/hooks/honey/useHoney24hVolume.ts +2 -6
  94. package/src/hooks/honey/useHoneyBalances.ts +2 -7
  95. package/src/hooks/honey/useHoneyChartData.ts +4 -12
  96. package/src/hooks/honey/useHoneyVaultsBalance.ts +3 -9
  97. package/src/hooks/honey/useIsBadCollateralAsset.ts +5 -13
  98. package/src/hooks/honey/useIsBasketModeEnabled.ts +5 -13
  99. package/src/hooks/honey/usePythLatestPrices.ts +15 -13
  100. package/src/hooks/perps/usePythUpdateFee.ts +13 -11
  101. package/src/hooks/pol/useAutoclaimedIncentives.ts +2 -8
  102. package/src/hooks/pol/useAutoclaimedIncentivesTxHash.ts +2 -8
  103. package/src/hooks/pol/useBgtIncentiveDistributorPaused.ts +34 -0
  104. package/src/hooks/pol/useBgtUnstakedBalance.ts +3 -8
  105. package/src/hooks/pol/useClaimableFees.ts +2 -6
  106. package/src/hooks/pol/useHighestVaultsAPR.ts +6 -11
  107. package/src/hooks/pol/useOnChainRewardVault.ts +77 -72
  108. package/src/hooks/pol/usePollGlobalData.ts +3 -9
  109. package/src/hooks/pol/usePollMarkets.ts +3 -8
  110. package/src/hooks/pol/useQueuedBeraUnlock.ts +3 -12
  111. package/src/hooks/pol/useRewardTokenToBeraRate.ts +2 -2
  112. package/src/hooks/pol/useRewardVault.ts +9 -8
  113. package/src/hooks/pol/useRewardVaultBalanceFromStakingToken.ts +6 -6
  114. package/src/hooks/pol/useRewardVaultFromToken.ts +24 -30
  115. package/src/hooks/pol/useRewardVaultIncentives.ts +2 -7
  116. package/src/hooks/pol/useRewardVaultRewards.ts +3 -8
  117. package/src/hooks/pol/useRewardVaults.ts +4 -12
  118. package/src/hooks/pol/useStakedAPR.ts +2 -8
  119. package/src/hooks/pol/useStakedData.ts +90 -41
  120. package/src/hooks/pol/useStakedSnapshots.ts +4 -9
  121. package/src/hooks/pol/useStakingVaultsMetadata.ts +1 -1
  122. package/src/hooks/pol/useTotalStakedAmount.ts +2 -8
  123. package/src/hooks/pol/useUserVaultInfo.ts +3 -8
  124. package/src/hooks/pol/useUserVaults.ts +3 -8
  125. package/src/hooks/pol/useVaultAddress.ts +1 -1
  126. package/src/hooks/pol/useVaultHistory.ts +2 -8
  127. package/src/hooks/pol/useVaultValidators.ts +3 -8
  128. package/src/hooks/tokens/useMultipleTokenInformation.ts +3 -8
  129. package/src/hooks/tokens/usePollAllowances.ts +4 -11
  130. package/src/hooks/tokens/usePollBalance.ts +2 -5
  131. package/src/hooks/tokens/usePollWalletBalances.ts +3 -3
  132. package/src/hooks/tokens/useStakingTokenInformation.ts +3 -12
  133. package/src/hooks/tokens/useTokenCurrentPrices.ts +11 -13
  134. package/src/hooks/tokens/useTokenInformation.ts +3 -8
  135. package/src/hooks/tokens/useTokenPrice.ts +2 -1
  136. package/src/hooks/tokens/useTokenPrices.ts +3 -4
  137. package/src/hooks/tokens/useTotalSupply.ts +1 -1
  138. package/src/hooks/tokens/useUnderlyingAsset.ts +1 -2
  139. package/src/hooks/useBlockToTimestamp.ts +1 -2
  140. package/src/hooks/useGetVerifiedAbi.ts +2 -1
  141. package/src/hooks/validators/useAllValidators.ts +3 -9
  142. package/src/hooks/validators/useApiEnrichedAllocation.ts +1 -1
  143. package/src/hooks/validators/useApiValidator.ts +4 -12
  144. package/src/hooks/validators/useBaselineRewardAllocation.ts +1 -2
  145. package/src/hooks/validators/useDailyValidatorBlockStats.ts +2 -4
  146. package/src/hooks/validators/useDefaultRewardAllocation.ts +3 -9
  147. package/src/hooks/validators/useManagedValidatorRole.ts +2 -3
  148. package/src/hooks/validators/useOnChainValidator.ts +4 -11
  149. package/src/hooks/validators/useStakingPoolBatch.ts +4 -10
  150. package/src/hooks/validators/useUserActiveValidators.ts +3 -9
  151. package/src/hooks/validators/useUserBoostsOnValidator.ts +2 -4
  152. package/src/hooks/validators/useUserClaimableIncentives.ts +3 -3
  153. package/src/hooks/validators/useUserStakingPositions.ts +3 -9
  154. package/src/hooks/validators/useValidatorAnalytics.ts +2 -4
  155. package/src/hooks/validators/useValidatorCommission.ts +3 -8
  156. package/src/hooks/validators/useValidatorIncentiveDistribution.ts +4 -6
  157. package/src/hooks/validators/useValidatorQueuedCommission.ts +3 -8
  158. package/src/hooks/validators/useValidatorQueuedOperatorAddress.ts +3 -8
  159. package/src/hooks/validators/useValidatorQueuedRewardAllocation.ts +3 -8
  160. package/src/hooks/validators/useValidatorRewardAllocation.ts +3 -8
  161. package/src/types/global.d.ts +7 -10
  162. package/src/types/pol.d.ts +17 -3
  163. package/dist/polling-BKnyavLI.d.ts +0 -8
  164. package/src/actions/clients/fetchRailwayBackend.ts +0 -34
  165. package/src/actions/pol/getGlobalCuttingBoard.ts +0 -25
  166. package/src/actions/pol/getIncentiveFeeClaimStats.ts +0 -24
@@ -1,7 +1,7 @@
1
- import useSWR from "swr";
2
1
  import type { Address } from "viem";
3
2
 
4
3
  import type { GetValidatorAnalyticsQuery } from "@berachain/graphql/pol/subgraph";
4
+ import { useSWR } from "@berachain/utils/pkg/swr";
5
5
 
6
6
  import { getValidatorAnalytics } from "../../actions/validators/getValidatorAnalytics";
7
7
  import { POLLING } from "../../enum/polling";
@@ -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
  }
@@ -1,7 +1,7 @@
1
- import useSWR from "swr";
2
1
  import type { Address, PublicClient } from "viem";
3
2
 
4
3
  import { usePublicClient } from "@berachain/wagmi/hooks";
4
+ import useSWR from "@berachain/utils/pkg/swr";
5
5
 
6
6
  import { getValidatorCommission } from "../../actions/validators/getValidatorCommission";
7
7
  import type {
@@ -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({
@@ -28,12 +28,7 @@ export const useValidatorCommission = (
28
28
  });
29
29
  },
30
30
  {
31
- ...options?.opts,
31
+ ...options,
32
32
  },
33
33
  );
34
-
35
- return {
36
- ...swrResponse,
37
- refresh: () => swrResponse.mutate(),
38
- };
39
34
  };
@@ -1,7 +1,7 @@
1
- import useSWR from "swr";
2
1
  import type { Address } from "viem";
3
2
 
4
- import type { GetValidatorIncentiveDistributionQuery } from "@berachain/graphql/pol/subgraph";
3
+ import type { ValidatorIncentivesResponse } from "@berachain/graphql/beep";
4
+ import { useSWR } from "@berachain/utils/pkg/swr";
5
5
 
6
6
  import { getValidatorIncentiveDistribution } from "../../actions/validators/getValidatorIncentiveDistribution";
7
7
  import { POLLING } from "../../enum/polling";
@@ -19,13 +19,13 @@ export function useValidatorIncentiveDistribution({
19
19
  }: {
20
20
  pubkey: Address | undefined;
21
21
  dayRange: number;
22
- }): DefaultHookReturnType<GetValidatorIncentiveDistributionQuery> {
22
+ }): DefaultHookReturnType<ValidatorIncentivesResponse> {
23
23
  const QUERY_KEY =
24
24
  pubkey && dayRange
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
  }
@@ -1,7 +1,7 @@
1
- import useSWR from "swr";
2
1
  import type { Address } from "viem";
3
2
 
4
3
  import { usePublicClient } from "@berachain/wagmi/hooks";
4
+ import { useSWR } from "@berachain/utils/pkg/swr";
5
5
 
6
6
  import {
7
7
  getValidatorQueuedCommission,
@@ -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);
@@ -33,12 +33,7 @@ export function useValidatorQueuedCommission(
33
33
  });
34
34
  },
35
35
  {
36
- ...options?.opts,
36
+ ...options,
37
37
  },
38
38
  );
39
-
40
- return {
41
- ...swrResponse,
42
- refresh: () => swrResponse.mutate(),
43
- };
44
39
  }
@@ -1,7 +1,7 @@
1
- import useSWR from "swr";
2
1
  import type { Address, PublicClient } from "viem";
3
2
 
4
3
  import { usePublicClient } from "@berachain/wagmi/hooks";
4
+ import { useSWR } from "@berachain/utils/pkg/swr";
5
5
 
6
6
  import {
7
7
  getValidatorQueuedOperatorAddress,
@@ -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({
@@ -31,12 +31,7 @@ export const useValidatorQueuedOperatorAddress = (
31
31
  });
32
32
  },
33
33
  {
34
- ...options?.opts,
34
+ ...options,
35
35
  },
36
36
  );
37
-
38
- return {
39
- ...swrResponse,
40
- refresh: () => swrResponse.mutate(),
41
- };
42
37
  };
@@ -1,7 +1,7 @@
1
- import useSWR from "swr";
2
1
  import type { Address, PublicClient } from "viem";
3
2
 
4
3
  import { usePublicClient } from "@berachain/wagmi/hooks";
4
+ import { useSWR } from "@berachain/utils/pkg/swr";
5
5
 
6
6
  import { getValidatorQueuedRewardAllocation } from "../../actions/validators/getValidatorQueuedRewardAllocation";
7
7
  import type { ValidatorRewardAllocation } from "../../actions/validators/getValidatorRewardAllocation";
@@ -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({
@@ -29,12 +29,7 @@ export const useValidatorQueuedRewardAllocation = (
29
29
  });
30
30
  },
31
31
  {
32
- ...options?.opts,
32
+ ...options,
33
33
  },
34
34
  );
35
-
36
- return {
37
- ...swrResponse,
38
- refresh: () => swrResponse.mutate(),
39
- };
40
35
  };
@@ -1,7 +1,7 @@
1
- import useSWR from "swr";
2
1
  import type { Address, PublicClient } from "viem";
3
2
 
4
3
  import { usePublicClient } from "@berachain/wagmi/hooks";
4
+ import { useSWR } from "@berachain/utils/pkg/swr";
5
5
 
6
6
  import { getValidatorRewardAllocation } from "../../actions/validators/getValidatorRewardAllocation";
7
7
  import type { DefaultHookOptions } from "../../types/global";
@@ -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({
@@ -25,12 +25,7 @@ export function useValidatorRewardAllocation(
25
25
  });
26
26
  },
27
27
  {
28
- ...options?.opts,
28
+ ...options,
29
29
  },
30
30
  );
31
-
32
- return {
33
- ...swrResponse,
34
- refresh: () => swrResponse.mutate(),
35
- };
36
31
  }
@@ -1,5 +1,4 @@
1
1
  import type { Config, GetWalletClientReturnType } from "@wagmi/core";
2
- import type { SWRConfiguration, SWRResponse } from "swr";
3
2
  import type {
4
3
  Abi,
5
4
  Account,
@@ -13,6 +12,11 @@ import type {
13
12
 
14
13
  import type { BeraConfig, ChainId } from "@berachain/config";
15
14
 
15
+ import type {
16
+ BeraSwrResponse,
17
+ SWRConfiguration,
18
+ } from "@berachain/utils/pkg/swr";
19
+
16
20
  import type { ContractName } from "../enum/contracts";
17
21
  import type { TransactionActionType } from "../enum/txnEnum";
18
22
  import type {
@@ -20,16 +24,9 @@ import type {
20
24
  TxnEventKeys,
21
25
  } from "../hooks/useContractWrite/types";
22
26
 
23
- export type DefaultHookOptions = {
24
- opts?: SWRConfiguration & { isEnabled?: boolean };
25
- };
27
+ export type DefaultHookOptions = SWRConfiguration & { isEnabled?: boolean };
26
28
 
27
- export type DefaultHookReturnType<T = any> = Omit<
28
- SWRResponse<T, any, any>,
29
- "mutate"
30
- > & {
31
- refresh: () => void;
32
- };
29
+ export type DefaultHookReturnType<T = any> = BeraSwrResponse<T, any>;
33
30
 
34
31
  export type IContractWriteFn = <
35
32
  abi extends Abi | undefined = undefined,
@@ -55,10 +55,24 @@ export interface UserVaultInfo {
55
55
 
56
56
  export type StakedBeraAsset = {
57
57
  token: TokenWithMetadata;
58
- apr: number;
58
+ /**
59
+ * Staking APR, or `undefined` when unavailable (e.g. the APR backend is
60
+ * down). `undefined` lets the UI render a "—" placeholder instead of a
61
+ * misleading "0%".
62
+ */
63
+ apr: number | undefined;
59
64
  stakedAmount: number;
60
- stakedAmountUsd: number;
65
+ /**
66
+ * USD value of the staked amount, or `undefined` when the token price is
67
+ * unavailable (e.g. the price backend is down). `undefined` lets the UI
68
+ * render a "—" placeholder instead of a misleading "$0.00".
69
+ */
70
+ stakedAmountUsd: number | undefined;
61
71
  earnedAmount: number;
62
- earnedAmountUsd: number;
72
+ /**
73
+ * USD value of the earned amount, or `undefined` when the token price is
74
+ * unavailable. See {@link stakedAmountUsd}.
75
+ */
76
+ earnedAmountUsd: number | undefined;
63
77
  isLoadingEarnings?: boolean;
64
78
  };
@@ -1,8 +0,0 @@
1
- declare enum POLLING {
2
- FAST = 10000,// 10 sec
3
- NORMAL = 100000,// 100 sec
4
- SLOW = 180000,// 3 min
5
- REFRESH_BLOCK_INTERVAL = 10000
6
- }
7
-
8
- export { POLLING as P };
@@ -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
- }