@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
@@ -1,12 +1,12 @@
1
1
  import * as react from 'react';
2
2
  import { GovernanceTopic, CustomProposalErrors, CustomProposal } from '../../types/governance/exports.js';
3
3
  import * as _berachain_utils_pkg_swr from '@berachain/utils/pkg/swr';
4
- import { SWRResponse } from '@berachain/utils/pkg/swr';
4
+ import { BeraSwrResponse } from '@berachain/utils/pkg/swr';
5
5
  import { Address } from 'viem';
6
6
  import * as _berachain_graphql_governance from '@berachain/graphql/governance';
7
7
  import { Proposal_Filter, Proposal_OrderBy, OrderDirection, ProposalStatus, ProposalSelectionFragment, ProposalWithVotesFragment, GetProposalVotesQueryVariables } from '@berachain/graphql/governance';
8
8
  import { SWRInfiniteResponse, SWRInfiniteKeyLoader } from '@berachain/utils/pkg/swr/infinite';
9
- import { D as DefaultHookOptions, a as DefaultHookReturnType } from '../../global.d-q_LQWQqs.js';
9
+ import { D as DefaultHookOptions, a as DefaultHookReturnType } from '../../global.d-CR3zicga.js';
10
10
  import * as swr_infinite from 'swr/infinite';
11
11
  import { g as getProposalVotes } from '../../getProposalVotes-DAUrdX2n.js';
12
12
  import * as swr__internal from 'swr/_internal';
@@ -40,16 +40,16 @@ declare const useGetPastVotes: (args: {
40
40
  } | {
41
41
  proposalId: bigint;
42
42
  timepoint?: number | bigint;
43
- })) => _berachain_utils_pkg_swr.SWRResponse<string, any, any>;
43
+ })) => _berachain_utils_pkg_swr.BeraSwrResponse<string, any>;
44
44
 
45
45
  declare const useHasVoted: ({ proposalId, wallet, }: {
46
46
  proposalId: string;
47
47
  wallet?: Address;
48
- }) => _berachain_utils_pkg_swr.SWRResponse<boolean, any, any>;
48
+ }) => _berachain_utils_pkg_swr.BeraSwrResponse<boolean, any>;
49
49
 
50
50
  declare const useIsCanceller: ({ account, ...baseArgs }: {
51
51
  account: Address | undefined;
52
- } & BeraJS.BaseFunctionArgs) => _berachain_utils_pkg_swr.SWRResponse<boolean, any, any>;
52
+ } & BeraJS.BaseFunctionArgs) => _berachain_utils_pkg_swr.BeraSwrResponse<boolean, any>;
53
53
 
54
54
  type UsePollAllProposalsArgs = {
55
55
  topic: string;
@@ -133,7 +133,7 @@ declare const usePollUserDelegates: (options?: DefaultHookOptions) => DefaultHoo
133
133
  currentVotes: string | undefined;
134
134
  }>;
135
135
 
136
- declare const useProposalFromTx: (txHash?: Address) => SWRResponse<ProposalWithVotesFragment | null>;
136
+ declare const useProposalFromTx: (txHash?: Address) => BeraSwrResponse<ProposalWithVotesFragment | null>;
137
137
 
138
138
  /**
139
139
  * Timepoint used to retrieve user’s votes and quorum. If using block
@@ -144,12 +144,12 @@ declare const useProposalFromTx: (txHash?: Address) => SWRResponse<ProposalWithV
144
144
  */
145
145
  declare const useProposalSnapshot: ({ proposalId, }: {
146
146
  proposalId: number | bigint | string | undefined;
147
- }) => SWRResponse<string>;
147
+ }) => BeraSwrResponse<string>;
148
148
 
149
149
  declare const useProposalState: ({ proposalId, governorAddress, }: {
150
150
  proposalId: number | bigint | string | undefined;
151
151
  governorAddress: Address;
152
- }) => SWRResponse<string>;
152
+ }) => BeraSwrResponse<string>;
153
153
 
154
154
  declare const TimelockOperationState: {
155
155
  readonly 0: "unset";
@@ -164,7 +164,7 @@ declare const TimelockOperationState: {
164
164
  declare function useProposalTimelockState({ proposalTimelockId, timelockAddress, }: {
165
165
  proposalTimelockId: Address | undefined;
166
166
  timelockAddress: Address;
167
- }): SWRResponse<(typeof TimelockOperationState)[keyof typeof TimelockOperationState]>;
167
+ }): BeraSwrResponse<(typeof TimelockOperationState)[keyof typeof TimelockOperationState]>;
168
168
 
169
169
  /**
170
170
  * Queries the quorum for a given timestamp.
@@ -178,9 +178,9 @@ declare function useQuorum({ at }: {
178
178
  }): {
179
179
  data: number | undefined;
180
180
  error: any;
181
- mutate: _berachain_utils_pkg_swr.KeyedMutator<string>;
182
181
  isValidating: boolean;
183
182
  isLoading: swr__internal.IsLoadingResponse<Data, Config>;
183
+ refresh: () => void;
184
184
  };
185
185
 
186
186
  export { type UsePollProposalResponse, useCreateProposal, useGetPastVotes, useHasVoted, useIsCanceller, usePollAllProposals, usePollAllProposalsQueryKey, usePollProposal, usePollProposalThreshold, usePollProposalVotes, usePollProposalVotesQueryKey, usePollUserDelegates, useProposalFromTx, useProposalSnapshot, useProposalState, useProposalTimelockState, useQuorum };
@@ -10,7 +10,7 @@ import "../../chunk-DKMAIU74.mjs";
10
10
  import {
11
11
  useSWR,
12
12
  useSWRImmutable
13
- } from "../../chunk-UD5IUNCW.mjs";
13
+ } from "../../chunk-4ML4Y6UN.mjs";
14
14
  import "../../chunk-SGIJVHZO.mjs";
15
15
  import {
16
16
  assertPublicClient
@@ -603,25 +603,22 @@ var usePollProposal = (proposalId, options) => {
603
603
  switch (swrResponse.data.status) {
604
604
  case ProposalStatus2.Pending:
605
605
  if (timestamp >= Number(swrResponse.data.voteStartAt)) {
606
- swrResponse.mutate();
606
+ swrResponse.refresh();
607
607
  }
608
608
  break;
609
609
  case ProposalStatus2.Active:
610
610
  if (timestamp >= Number(swrResponse.data.voteEndAt)) {
611
- swrResponse.mutate();
611
+ swrResponse.refresh();
612
612
  }
613
613
  break;
614
614
  case ProposalStatus2.InQueue:
615
615
  if (Date.now() / 1e3 + 1 >= Number(swrResponse.data.queueEnd)) {
616
- swrResponse.mutate();
616
+ swrResponse.refresh();
617
617
  }
618
618
  break;
619
619
  }
620
620
  }, [swrResponse.data?.status, timestamp]);
621
- return {
622
- ...swrResponse,
623
- refresh: () => swrResponse?.mutate?.()
624
- };
621
+ return swrResponse;
625
622
  };
626
623
 
627
624
  // src/hooks/governance/usePollProposalThreshold.ts
@@ -631,7 +628,7 @@ import { usePublicClient as usePublicClient6 } from "@berachain/wagmi/hooks";
631
628
  var usePollProposalThreshold = (governorAddress) => {
632
629
  const publicClient = usePublicClient6();
633
630
  const QUERY_KEY = publicClient ? ["usePollProposalThreshold", governorAddress] : null;
634
- const swrResponse = useSWR(
631
+ return useSWR(
635
632
  QUERY_KEY,
636
633
  async ([, governorAddress2]) => {
637
634
  assertPublicClient(publicClient);
@@ -646,10 +643,6 @@ var usePollProposalThreshold = (governorAddress) => {
646
643
  refreshInterval: 18e4 /* SLOW */
647
644
  }
648
645
  );
649
- return {
650
- ...swrResponse,
651
- refresh: swrResponse.mutate
652
- };
653
646
  };
654
647
 
655
648
  // src/hooks/governance/usePollProposalVotes.ts
@@ -695,7 +688,7 @@ var usePollUserDelegates = (options) => {
695
688
  const { address: account } = useBeraWallet3();
696
689
  const publicClient = usePublicClient7();
697
690
  const QUERY_KEY = account ? ["usePollUserDelegates", account] : null;
698
- const swrResponse = useSWR(
691
+ return useSWR(
699
692
  QUERY_KEY,
700
693
  async ([, account2]) => {
701
694
  assertPublicClient(publicClient);
@@ -729,10 +722,6 @@ var usePollUserDelegates = (options) => {
729
722
  refreshInterval: options?.refreshInterval ?? 18e4 /* SLOW */
730
723
  }
731
724
  );
732
- return {
733
- ...swrResponse,
734
- refresh: () => swrResponse?.mutate?.()
735
- };
736
725
  };
737
726
 
738
727
  // src/hooks/governance/useProposalFromTx.ts
@@ -743,7 +732,7 @@ var useProposalFromTx = (txHash) => {
743
732
  });
744
733
  const publicClient = usePublicClient8();
745
734
  const QUERY_KEY = tx && publicClient ? ["useProposalFromTx", txHash] : null;
746
- const swrResponse = useSWR(QUERY_KEY, async ([, txHash2]) => {
735
+ return useSWR(QUERY_KEY, async ([, txHash2]) => {
747
736
  if (!tx) {
748
737
  throw new Error("Transaction not found");
749
738
  }
@@ -752,7 +741,6 @@ var useProposalFromTx = (txHash) => {
752
741
  }
753
742
  return getProposalFromTx({ tx, publicClient });
754
743
  });
755
- return swrResponse;
756
744
  };
757
745
 
758
746
  // src/hooks/governance/useProposalState.ts
@@ -3,7 +3,7 @@ import { M as MinimalERC20 } from '../HoneyConfigProvider-COOuDNra.js';
3
3
  export { A as AllowanceQueryItem, j as AllowanceToken, B as BalanceToken, x as BexStatus, y as Calldata, H as HoneySwapActions, I as IAggregatorArgs, z as IAggregatorQuote, g as IRawAggregatorQuote, v as IUserPosition, h as PythPriceFeedMap, S as SwapRequest, b as Token, i as TokenCurrentPriceMap, w as TokenPriceInfo, t as TokenWithAmount, a as TokenWithMetadata, D as TokenWithPrice } from '../HoneyConfigProvider-COOuDNra.js';
4
4
  import { BundleData, EnsoClient } from '@ensofinance/sdk';
5
5
  import { TransactionRequest, Address, Hex, PublicClient } from 'viem';
6
- export { D as DefaultHookOptions, a as DefaultHookReturnType, I as IContractWrite, c as IContractWriteFn } from '../global.d-q_LQWQqs.js';
6
+ export { D as DefaultHookOptions, a as DefaultHookReturnType, I as IContractWrite, c as IContractWriteFn } from '../global.d-CR3zicga.js';
7
7
  import '@berachain/graphql/pol/api';
8
8
  import 'react/jsx-runtime';
9
9
  import 'react';
@@ -38,7 +38,7 @@ import {
38
38
  beraFetch,
39
39
  beraFetchJson,
40
40
  sanitizeRpcUrl
41
- } from "../chunk-Y6THHG77.mjs";
41
+ } from "../chunk-T43JPYQS.mjs";
42
42
  import {
43
43
  defaultFlags
44
44
  } from "../chunk-BGMRHTBQ.mjs";
@@ -56,7 +56,7 @@ import {
56
56
  } from "../chunk-SZ5C44L5.mjs";
57
57
  import {
58
58
  RequestError
59
- } from "../chunk-ZLTMIFCZ.mjs";
59
+ } from "../chunk-RFJGL4MF.mjs";
60
60
  import {
61
61
  BeraError,
62
62
  InvalidArgumentError
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@berachain/berajs",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "sideEffects": false,
5
5
  "files": [
6
6
  "dist",
@@ -13,8 +13,8 @@
13
13
  "@apollo/client": "4.1.6",
14
14
  "@berachain-foundation/berancer-sdk": "1.1.7",
15
15
  "@berachain/abis": "0.1.3-beta.0",
16
- "@berachain/config": "0.1.20",
17
- "@berachain/graphql": "0.5.1",
16
+ "@berachain/config": "0.1.21",
17
+ "@berachain/graphql": "0.5.2",
18
18
  "@ensofinance/sdk": "2.3.1",
19
19
  "@pythnetwork/hermes-client": "2.0.0",
20
20
  "@wagmi/core": "2.22.1",
@@ -1,6 +1,5 @@
1
1
  export { fetchBeep } from "./fetchBeep";
2
2
  export { fetchOpenApi } from "./fetchOpenApi";
3
- export { fetchRailwayBackend } from "./fetchRailwayBackend";
4
3
  export {
5
4
  getApolloClient,
6
5
  gql,
@@ -15,9 +15,6 @@ import {
15
15
  * against the beep schema (`@berachain/graphql/beep`), so route shapes (e.g.
16
16
  * the `/v0/stake/*` namespace) can never drift out of sync with the backend.
17
17
  * The base URL is resolved from `config.beep`.
18
- *
19
- * @throws if `config.beep` is not set for the active chain. Callers should only
20
- * reach for beep when `config.beep` is non-null.
21
18
  */
22
19
  export function fetchBeep<P extends GetPath<paths>>(
23
20
  path: P,
@@ -26,9 +23,5 @@ export function fetchBeep<P extends GetPath<paths>>(
26
23
  ): Promise<GetResponse<paths, P>> {
27
24
  const { config } = parseBaseArgs(args);
28
25
 
29
- if (!config.beep) {
30
- throw new Error("fetchBeep: `beep` backend is not configured.");
31
- }
32
-
33
26
  return fetchOpenApi<paths, P>(config.beep, path, params, "beep");
34
27
  }
@@ -5,9 +5,9 @@ import { beraFetchJson } from "../../utils/beraFetch";
5
5
 
6
6
  /**
7
7
  * A minimal, fully-typed GET helper for our `openapi-typescript`-generated
8
- * backends. Both backends serve only GETs, so rather than a full OpenAPI client
9
- * we type a single `fetchOpenApi` against a schema's `paths` and wrap it per
10
- * backend (`fetchBeep`, `fetchRailwayBackend`).
8
+ * `beep` backend. beep serves only GETs, so rather than a full OpenAPI client
9
+ * we type a single `fetchOpenApi` against a schema's `paths` and wrap it
10
+ * (`fetchBeep`).
11
11
  *
12
12
  * The `path`, its path/query params and the response body are all type-checked
13
13
  * against the schema, so route shapes can never drift out of sync with the
@@ -56,7 +56,7 @@ export type DefinedParams<Paths extends AnyPaths, P extends GetPath<Paths>> = {
56
56
  * @param params Path and query params, typed from the schema for `path`.
57
57
  * @param fallbackName Monitoring name to use when `link` is a bare string.
58
58
  */
59
- // biome-ignore lint/complexity/useMaxParams: internal helper; the wrappers (fetchBeep / fetchRailwayBackend) are the public surface.
59
+ // biome-ignore lint/complexity/useMaxParams: internal helper; the wrapper (fetchBeep) is the public surface.
60
60
  export function fetchOpenApi<Paths extends AnyPaths, P extends GetPath<Paths>>(
61
61
  link: HttpLink,
62
62
  path: P,
@@ -10,7 +10,6 @@ import {
10
10
 
11
11
  import type { HttpLink } from "@berachain/config";
12
12
  import { bepolia } from "@berachain/config/bepolia";
13
- import { mainnet } from "@berachain/config/mainnet";
14
13
 
15
14
  import type {
16
15
  paths as beepPaths,
@@ -169,26 +168,11 @@ describe("fetchBeep", () => {
169
168
  }),
170
169
  );
171
170
  });
172
-
173
- it("throws when config.beep is not set (e.g. a chain not yet migrated)", () => {
174
- // Construct the no-beep case explicitly rather than relying on a real
175
- // chain config: `mainnet.beep` is env-gated, so it may be set in some
176
- // environments.
177
- const configWithoutBeep = { ...mainnet, beep: null };
178
-
179
- expect(() =>
180
- fetchBeep(
181
- "/v0/stake/{vault}/earnings/{owner}",
182
- { path: { vault: VAULT, owner: OWNER } },
183
- { config: configWithoutBeep },
184
- ),
185
- ).toThrow(/`beep` backend is not configured/);
186
- });
187
171
  });
188
172
 
189
- // Type-only assertions. The bodies are never executed at runtime (they would
190
- // hit the `beep` not-configured throw); they exist so `tsc` validates inference
191
- // and the `@ts-expect-error` lines. `expectTypeOf` is purely compile-time.
173
+ // Type-only assertions. The bodies are never executed at runtime; they exist so
174
+ // `tsc` validates inference and the `@ts-expect-error` lines. `expectTypeOf` is
175
+ // purely compile-time.
192
176
  describe("fetchBeep types", () => {
193
177
  it("infers the response type per path", () => {
194
178
  const _assert = () => {
@@ -82,15 +82,13 @@ function getClient(
82
82
 
83
83
  /**
84
84
  * Browser-reachable Apollo client factory for `api` and Bend's `whisk`
85
- * endpoints. Subgraph clients (honey/pol) are server-only; browser data
86
- * access goes through the typed `/api/honey/*` and `/api/pol/*` REST
87
- * endpoints. Same auth shape as bend.whiskApi — non-public env values only
88
- * resolve server-side.
85
+ * endpoints. The pol subgraph client is server-only; browser data access goes
86
+ * through the typed `/api/pol/*` REST endpoints. Same auth shape as
87
+ * bend.whiskApi — non-public env values only resolve server-side.
89
88
  */
90
- type GraphqlClient = "api" | "bend.whisk" | "honey.subgraph" | "pol.subgraph";
89
+ type GraphqlClient = "api" | "bend.whisk" | "pol.subgraph";
91
90
 
92
91
  const SUBGRAPH_CLIENTS = [
93
- "honey.subgraph",
94
92
  "pol.subgraph",
95
93
  ] as const satisfies readonly GraphqlClient[];
96
94
 
@@ -152,9 +150,6 @@ export function getApolloClient(
152
150
  }
153
151
  return store(cacheKey, getClient(config.bend.whiskApi));
154
152
 
155
- case "honey.subgraph":
156
- return store(cacheKey, getClient(config.honey.subgraph));
157
-
158
153
  case "pol.subgraph":
159
154
  return store(cacheKey, getClient(config.pol.subgraph));
160
155
  }
@@ -52,7 +52,6 @@ export * from "./pol/getBlockTime";
52
52
  export * from "./pol/getEarnedStakedBeraVault";
53
53
  export * from "./pol/getGlobalData";
54
54
  export * from "./pol/getHeroEarnVaults";
55
- export * from "./pol/getIncentiveFeeClaimStats";
56
55
  export * from "./pol/getLSTStakeConfig";
57
56
  export * from "./pol/getMarkets";
58
57
  export * from "./pol/getRewardProofsByValidator";
@@ -1,20 +1,15 @@
1
1
  import type { HoneySnapshotResponse } from "@berachain/graphql/beep";
2
- import type { GetSnapshotsQuery } from "@berachain/graphql/honey";
3
2
 
4
3
  import { BeraError } from "../../errors/BeraError";
5
- import { beraFetchJson } from "../../utils/beraFetch";
6
- import { parseBaseArgs } from "../../utils/parseBaseArgs";
7
4
  import { fetchBeep } from "../clients/fetchBeep";
8
5
 
9
6
  /**
10
7
  * Browser-only. Returns daily honey snapshots in the `beep` response shape
11
8
  * (`HoneySnapshotResponse`) the chart consumes.
12
9
  *
13
- * Reads from the `beep` backend (`fetchBeep`) when configured, falling back to
14
- * the legacy honey subgraph proxied through `/api/honey/snapshots` (whose
15
- * GraphQL result is adapted into the beep shape) otherwise. Server callers must
16
- * compose the upstream query directly (this action is not server-safe — `fetch`
17
- * against a relative URL has no origin off-browser).
10
+ * Reads from the `beep` backend (`fetchBeep`). Server callers must compose the
11
+ * upstream query directly (this action is not server-safe — `fetch` against a
12
+ * relative URL has no origin off-browser).
18
13
  */
19
14
  export async function getChartData({
20
15
  days,
@@ -29,24 +24,6 @@ export async function getChartData({
29
24
  });
30
25
  }
31
26
 
32
- const { config } = parseBaseArgs({});
33
-
34
- // TODO(beep): remove this entire block once `beep` is deployed on every
35
- // chain. It is the only legacy honey-subgraph code left here; deleting it
36
- // leaves the `beep` path below as the sole implementation.
37
- if (!config.beep) {
38
- const params = new URLSearchParams({
39
- interval: "day",
40
- first: String(days),
41
- });
42
- const snapshots = await beraFetchJson<GetSnapshotsQuery["honeySnapshots"]>({
43
- url: `/api/honey/snapshots?${params}`,
44
- name: "honey-snapshots",
45
- type: "rest",
46
- });
47
- return snapshots.map(fromHoneySnapshot);
48
- }
49
-
50
27
  // beep backend (next-gen), typed against `@berachain/graphql/beep`. Queried
51
28
  // directly from the browser — no Vercel proxy.
52
29
  return fetchBeep("/v0/honey/snapshots/{interval}", {
@@ -54,21 +31,3 @@ export async function getChartData({
54
31
  query: { perPage: String(days) },
55
32
  });
56
33
  }
57
-
58
- /**
59
- * Adapt a legacy subgraph snapshot into the beep `HoneySnapshotResponse` shape.
60
- *
61
- * The subgraph reports `timestamp` in microseconds; beep (and every consumer)
62
- * expects seconds, so scale microseconds → seconds.
63
- */
64
- function fromHoneySnapshot(
65
- snapshot: GetSnapshotsQuery["honeySnapshots"][number],
66
- ): HoneySnapshotResponse[number] {
67
- return {
68
- timestamp: Math.floor(Number(snapshot.timestamp) / 1_000_000),
69
- mintVolume: snapshot.mintVolume,
70
- redeemVolume: snapshot.redeemVolume,
71
- totalVolume: snapshot.totalVolume,
72
- totalSupply: snapshot.totalSupply,
73
- };
74
- }
@@ -1,17 +1,13 @@
1
- import type { GetSnapshotsQuery } from "@berachain/graphql/honey";
2
1
  import BigNumber from "@berachain/utils/pkg/bignumber.js";
3
2
 
4
3
  import { BeraError } from "../../errors/BeraError";
5
- import { beraFetchJson } from "../../utils/beraFetch";
6
- import { parseBaseArgs } from "../../utils/parseBaseArgs";
7
4
  import { fetchBeep } from "../clients/fetchBeep";
8
5
 
9
6
  /**
10
7
  * Browser-only. Sums the last 24 hourly honey snapshots into a 24h volume.
11
8
  *
12
- * Reads from the `beep` backend (`fetchBeep`) when configured, falling back to
13
- * the legacy honey subgraph proxied through `/api/honey/snapshots` otherwise.
14
- * Both backends expose `totalVolume` per snapshot, so the sum is shape-agnostic.
9
+ * Reads from the `beep` backend (`fetchBeep`), which exposes `totalVolume` per
10
+ * snapshot.
15
11
  */
16
12
  export async function getHoney24hVolume(): Promise<BigNumber | undefined> {
17
13
  if (typeof window === "undefined") {
@@ -22,21 +18,6 @@ export async function getHoney24hVolume(): Promise<BigNumber | undefined> {
22
18
  });
23
19
  }
24
20
 
25
- const { config } = parseBaseArgs({});
26
-
27
- // TODO(beep): remove this entire block once `beep` is deployed on every
28
- // chain. It is the only legacy honey-subgraph code left here; deleting it
29
- // leaves the `beep` path below as the sole implementation.
30
- if (!config.beep) {
31
- const params = new URLSearchParams({ interval: "hour", first: "24" });
32
- const snapshots = await beraFetchJson<GetSnapshotsQuery["honeySnapshots"]>({
33
- url: `/api/honey/snapshots?${params}`,
34
- name: "honey-snapshots",
35
- type: "rest",
36
- });
37
- return sumTotalVolume(snapshots);
38
- }
39
-
40
21
  // beep backend (next-gen), typed against `@berachain/graphql/beep`. Queried
41
22
  // directly from the browser — no Vercel proxy.
42
23
  const snapshots = await fetchBeep("/v0/honey/snapshots/{interval}", {
@@ -1,9 +1,6 @@
1
1
  import type { HoneyTransactionsLatestResponse } from "@berachain/graphql/beep";
2
- import type { GetHoneyTxnQuery } from "@berachain/graphql/honey";
3
2
 
4
3
  import { BeraError } from "../../errors/BeraError";
5
- import { beraFetchJson } from "../../utils/beraFetch";
6
- import { parseBaseArgs } from "../../utils/parseBaseArgs";
7
4
  import { fetchBeep } from "../clients/fetchBeep";
8
5
 
9
6
  type HoneyTxn = HoneyTransactionsLatestResponse[number];
@@ -23,9 +20,7 @@ interface GetHoneyTxnsArgs {
23
20
  * Browser-only. Returns a page of honey transactions in the `beep` response
24
21
  * shape (`HoneyTransactionsLatestResponse`) the transactions table consumes.
25
22
  *
26
- * Reads from the `beep` backend (`fetchBeep`) when configured, falling back to
27
- * the legacy honey subgraph proxied through `/api/honey/txns` (whose GraphQL
28
- * result is adapted into the beep shape) otherwise.
23
+ * Reads from the `beep` backend (`fetchBeep`).
29
24
  */
30
25
  export async function getHoneyTxns({
31
26
  index,
@@ -40,26 +35,6 @@ export async function getHoneyTxns({
40
35
  });
41
36
  }
42
37
 
43
- const { config } = parseBaseArgs({});
44
-
45
- // TODO(beep): remove this entire block once `beep` is deployed on every
46
- // chain. It is the only legacy honey-subgraph code left here; deleting it
47
- // leaves the `beep` path below as the sole implementation.
48
- if (!config.beep) {
49
- const params = new URLSearchParams({
50
- skip: String(index * limit),
51
- limit: String(limit),
52
- });
53
- if (txnType) params.set("type", txnType);
54
-
55
- const txns = await beraFetchJson<GetHoneyTxnQuery["honeyTxns"]>({
56
- url: `/api/honey/txns?${params}`,
57
- name: "honey-txns",
58
- type: "rest",
59
- });
60
- return txns.map(fromHoneyTxn);
61
- }
62
-
63
38
  // beep backend (next-gen), typed against `@berachain/graphql/beep`. Queried
64
39
  // directly from the browser — no Vercel proxy. beep's `page` is 1-indexed and
65
40
  // filters server-side by `type`; `fetchOpenApi` omits `type` when `txnType`
@@ -68,26 +43,3 @@ export async function getHoneyTxns({
68
43
  query: { page: String(index + 1), perPage: String(limit), type: txnType },
69
44
  });
70
45
  }
71
-
72
- /**
73
- * Adapt a legacy subgraph transaction into the beep `HoneyTransactionsLatest`
74
- * shape: nested `chainTransaction.txHash` → flat `txHash`, `collateral` →
75
- * `collaterals` (`collateral`/`collateralAmount` → `address`/`amount`).
76
- *
77
- * The subgraph reports `timestamp` in seconds (matching beep), so it passes
78
- * through as a number. A subgraph txn always carries a `type` in practice.
79
- */
80
- function fromHoneyTxn(txn: GetHoneyTxnQuery["honeyTxns"][number]): HoneyTxn {
81
- return {
82
- txHash: txn.chainTransaction.txHash,
83
- type: (txn.type ?? "MINT") as HoneyTxnType,
84
- collaterals: txn.collateral.map((collateral) => ({
85
- address: collateral.collateral,
86
- amount: collateral.collateralAmount,
87
- })),
88
- to: txn.to,
89
- from: txn.from,
90
- honeyAmount: txn.honeyAmount,
91
- timestamp: Number(txn.timestamp),
92
- };
93
- }
@@ -16,14 +16,14 @@ describe("rewardVaults", async () => {
16
16
  throw new Error("Failed to fetch vaults");
17
17
  }
18
18
 
19
- const { gaugeList } = result;
19
+ const { rewardVaultList } = result;
20
20
 
21
21
  it("should return vaults", () => {
22
- expect(gaugeList.length).toBeGreaterThan(0);
22
+ expect(rewardVaultList.length).toBeGreaterThan(0);
23
23
  });
24
24
 
25
25
  it("should have consistent data", () => {
26
- const totalBgtCatpure = gaugeList.reduce(
26
+ const totalBgtCatpure = rewardVaultList.reduce(
27
27
  (acc, vault) =>
28
28
  acc + Number(vault.dynamicData?.rewardCapturePercentage ?? 0),
29
29
  0,
@@ -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
  type GetEarnedStakedBeraVaultArgs = {
8
6
  /**
@@ -19,19 +17,6 @@ export async function getEarnedStakedBeraVault({
19
17
  account,
20
18
  ...args
21
19
  }: BeraJS.BaseFunctionArgs & GetEarnedStakedBeraVaultArgs) {
22
- const { config } = parseBaseArgs(args);
23
-
24
- // TODO(beep): remove this entire block once `beep` is deployed on every
25
- // chain. It is the only legacy-Railway-specific code left here; deleting it
26
- // leaves the `beep` path below as the sole implementation.
27
- if (!config.beep) {
28
- return fetchRailwayBackend(
29
- "/vaults/{vault}/earnings/{owner}",
30
- { path: { vault: address, owner: account } },
31
- args,
32
- );
33
- }
34
-
35
20
  // beep backend (next-gen), typed against `@berachain/graphql/beep`.
36
21
  return fetchBeep(
37
22
  "/v0/stake/{vault}/earnings/{owner}",
@@ -1,16 +1,12 @@
1
1
  import type { PublicClient } from "viem";
2
2
 
3
- import type { ApiVaultFragment } from "@berachain/graphql/pol/api";
4
-
5
3
  import { BeraMonitoring } from "../../errors/BeraMonitoring";
6
4
  import { initBeraError } from "../../errors/initBeraError";
7
5
  import { type GlobalInfo, getBGTGlobalInfo } from "./getBGTGlobalInfo";
8
6
  import { getBgtTokenTotalBoosts } from "./getBgtTokenTotalBoosts";
9
7
  import { getBgtTokenTotalSupply } from "./getBgtTokenTotalSupply";
10
- import { getGlobalCuttingBoard } from "./getGlobalCuttingBoard";
11
8
 
12
9
  export interface GlobalData extends GlobalInfo {
13
- globalCuttingBoard: ApiVaultFragment[] | undefined;
14
10
  bgtTotalSupply: string | undefined;
15
11
  bgtTotalBoosts: string | undefined;
16
12
  }
@@ -18,21 +14,16 @@ export interface GlobalData extends GlobalInfo {
18
14
  export async function getGlobalData(
19
15
  publicClient: PublicClient,
20
16
  ): Promise<GlobalData> {
21
- const [
22
- globalDataRes,
23
- globalCuttingBoardRes,
24
- bgtTotalSupplyRes,
25
- bgtTotalBoostsRes,
26
- ] = await Promise.allSettled([
27
- getBGTGlobalInfo(),
28
- getGlobalCuttingBoard(300),
29
- getBgtTokenTotalSupply({
30
- publicClient,
31
- }),
32
- getBgtTokenTotalBoosts({
33
- publicClient,
34
- }),
35
- ]);
17
+ const [globalDataRes, bgtTotalSupplyRes, bgtTotalBoostsRes] =
18
+ await Promise.allSettled([
19
+ getBGTGlobalInfo(),
20
+ getBgtTokenTotalSupply({
21
+ publicClient,
22
+ }),
23
+ getBgtTokenTotalBoosts({
24
+ publicClient,
25
+ }),
26
+ ]);
36
27
 
37
28
  if (globalDataRes.status === "rejected") {
38
29
  BeraMonitoring.captureException(
@@ -40,12 +31,6 @@ export async function getGlobalData(
40
31
  );
41
32
  }
42
33
 
43
- if (globalCuttingBoardRes.status === "rejected") {
44
- BeraMonitoring.captureException(
45
- initBeraError({ cause: globalCuttingBoardRes.reason, level: "warning" }),
46
- );
47
- }
48
-
49
34
  if (bgtTotalSupplyRes.status === "rejected") {
50
35
  BeraMonitoring.captureException(
51
36
  initBeraError({ cause: bgtTotalSupplyRes.reason, level: "warning" }),
@@ -63,10 +48,6 @@ export async function getGlobalData(
63
48
  bgtTotalSupplyRes.status === "fulfilled"
64
49
  ? bgtTotalSupplyRes.value
65
50
  : undefined,
66
- globalCuttingBoard:
67
- globalCuttingBoardRes.status === "fulfilled"
68
- ? globalCuttingBoardRes.value
69
- : [],
70
51
  bgtTotalBoosts:
71
52
  bgtTotalBoostsRes.status === "fulfilled"
72
53
  ? bgtTotalBoostsRes.value