@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,3 +1,6 @@
1
+ import {
2
+ useSWR
3
+ } from "./chunk-4ML4Y6UN.mjs";
1
4
  import {
2
5
  getBalanceCall,
3
6
  getEnsoClient
@@ -5,7 +8,7 @@ import {
5
8
  import {
6
9
  BeraMonitoring,
7
10
  initBeraError
8
- } from "./chunk-7YVNSDXG.mjs";
11
+ } from "./chunk-FGION6F6.mjs";
9
12
  import {
10
13
  defaultFlags
11
14
  } from "./chunk-BGMRHTBQ.mjs";
@@ -163,7 +166,6 @@ function useHoneyConfig() {
163
166
  }
164
167
 
165
168
  // src/hooks/enso/useEnsoUserTokensWithBalances.ts
166
- import useSWR from "swr";
167
169
  import { useBeraWallet, useConfig } from "@berachain/wagmi/hooks";
168
170
 
169
171
  // src/actions/enso/getEnsoUserTokensWithBalances.ts
@@ -289,14 +291,14 @@ function useEnsoUserTokensWithBalances({ chainId } = {}, options) {
289
291
  const proxyAggregatorsThroughVercel = useBeraFlag(
290
292
  "proxyAggregatorsThroughVercel"
291
293
  );
292
- const isEnabled = !!fromAddress && (options?.opts?.isEnabled ?? true);
294
+ const isEnabled = !!fromAddress;
293
295
  const QUERY_KEY = isEnabled && wagmiConfig ? [
294
296
  "useEnsoUserTokensWithBalances",
295
297
  fromAddress,
296
298
  chainId,
297
299
  proxyAggregatorsThroughVercel ?? false
298
300
  ] : null;
299
- const swrResponse = useSWR(
301
+ return useSWR(
300
302
  QUERY_KEY,
301
303
  async ([, fromAddress2, chainId2]) => getEnsoUserTokensWithBalances({
302
304
  account: fromAddress2,
@@ -308,14 +310,9 @@ function useEnsoUserTokensWithBalances({ chainId } = {}, options) {
308
310
  }),
309
311
  {
310
312
  refreshInterval: 1e5 /* NORMAL */,
311
- isEnabled,
312
- ...options?.opts
313
+ ...options
313
314
  }
314
315
  );
315
- return {
316
- ...swrResponse,
317
- refresh: () => swrResponse.mutate()
318
- };
319
316
  }
320
317
 
321
318
  // src/contexts/TokensProvider.tsx
@@ -1,10 +1,9 @@
1
1
  import {
2
- fetchBeep,
3
- fetchRailwayBackend
4
- } from "./chunk-P5WXXULM.mjs";
2
+ fetchBeep
3
+ } from "./chunk-YLTWPFCJ.mjs";
5
4
  import {
6
5
  getApolloClient
7
- } from "./chunk-3JJLQ2JX.mjs";
6
+ } from "./chunk-MKSFQIKC.mjs";
8
7
  import {
9
8
  pythAbi
10
9
  } from "./chunk-CDK4YV3D.mjs";
@@ -15,7 +14,7 @@ import {
15
14
  import {
16
15
  BeraMonitoring,
17
16
  initBeraError
18
- } from "./chunk-7YVNSDXG.mjs";
17
+ } from "./chunk-FGION6F6.mjs";
19
18
  import {
20
19
  assertAddress,
21
20
  assertDefined,
@@ -37,7 +36,7 @@ import {
37
36
  beraFetch,
38
37
  beraFetchJson,
39
38
  getErrorResponse
40
- } from "./chunk-Y6THHG77.mjs";
39
+ } from "./chunk-T43JPYQS.mjs";
41
40
  import {
42
41
  beraToken,
43
42
  getHoneyToken,
@@ -48,7 +47,7 @@ import {
48
47
  } from "./chunk-DQRH5VE3.mjs";
49
48
  import {
50
49
  RequestError
51
- } from "./chunk-ZLTMIFCZ.mjs";
50
+ } from "./chunk-RFJGL4MF.mjs";
52
51
  import {
53
52
  BeraError,
54
53
  InvalidArgumentError,
@@ -587,13 +586,10 @@ async function getChartData({
587
586
  level: "error"
588
587
  });
589
588
  }
590
- const params = new URLSearchParams({ interval: "day", first: String(days) });
591
- const honeySnapshots = await beraFetchJson({
592
- url: `/api/honey/snapshots?${params}`,
593
- name: "honey-snapshots",
594
- type: "rest"
589
+ return fetchBeep("/v0/honey/snapshots/{interval}", {
590
+ path: { interval: "day" },
591
+ query: { perPage: String(days) }
595
592
  });
596
- return { honeySnapshots };
597
593
  }
598
594
 
599
595
  // src/actions/honey/getCollateralWeights.ts
@@ -928,12 +924,13 @@ async function getHoney24hVolume() {
928
924
  level: "error"
929
925
  });
930
926
  }
931
- const params = new URLSearchParams({ interval: "hour", first: "24" });
932
- const snapshots = await beraFetchJson({
933
- url: `/api/honey/snapshots?${params}`,
934
- name: "honey-snapshots",
935
- type: "rest"
927
+ const snapshots = await fetchBeep("/v0/honey/snapshots/{interval}", {
928
+ path: { interval: "hour" },
929
+ query: { perPage: "24" }
936
930
  });
931
+ return sumTotalVolume(snapshots);
932
+ }
933
+ function sumTotalVolume(snapshots) {
937
934
  return snapshots.reduce(
938
935
  (acc, curr) => new bignumber_js_default(curr.totalVolume).plus(acc),
939
936
  new bignumber_js_default(0)
@@ -1551,20 +1548,27 @@ function getBgtAprSimulation({
1551
1548
  };
1552
1549
  }
1553
1550
 
1551
+ // src/actions/pol/getBgtIncentiveDistributorPaused.ts
1552
+ import { bgtIncentiveDistributorAbi } from "@berachain/abis/pol/rewards/bgtIncentiveDistributor";
1553
+ async function getBgtIncentiveDistributorPaused({
1554
+ publicClient,
1555
+ ...args
1556
+ }) {
1557
+ assertPublicClient(publicClient);
1558
+ const { config } = parseBaseArgs(args);
1559
+ return publicClient.readContract({
1560
+ address: config.pol.bgtIncentiveDistributor,
1561
+ abi: bgtIncentiveDistributorAbi,
1562
+ functionName: "paused"
1563
+ });
1564
+ }
1565
+
1554
1566
  // src/actions/pol/getEarnedStakedBeraVault.ts
1555
1567
  async function getEarnedStakedBeraVault({
1556
1568
  address,
1557
1569
  account,
1558
1570
  ...args
1559
1571
  }) {
1560
- const { config } = parseBaseArgs(args);
1561
- if (!config.beep) {
1562
- return fetchRailwayBackend(
1563
- "/vaults/{vault}/earnings/{owner}",
1564
- { path: { vault: address, owner: account } },
1565
- args
1566
- );
1567
- }
1568
1572
  return fetchBeep(
1569
1573
  "/v0/stake/{vault}/earnings/{owner}",
1570
1574
  { path: { vault: address, owner: account } },
@@ -1572,70 +1576,6 @@ async function getEarnedStakedBeraVault({
1572
1576
  );
1573
1577
  }
1574
1578
 
1575
- // src/actions/pol/getRewardVaults.ts
1576
- import { formatUnits as formatUnits6 } from "viem";
1577
- import { rewardVaultAbi as rewardVaultAbi2 } from "@berachain/abis/pol/rewards/rewardVault";
1578
- import {
1579
- GetVaults
1580
- } from "@berachain/graphql/pol/api";
1581
- async function getRewardVaults({
1582
- filter,
1583
- publicClient,
1584
- ...args
1585
- } = {}) {
1586
- const bexApiGraphqlClient = getApolloClient("api", args);
1587
- const res = await bexApiGraphqlClient.query({
1588
- query: GetVaults,
1589
- variables: filter
1590
- });
1591
- const incentives = await Promise.allSettled(
1592
- res.data.polGetRewardVaults.vaults.map(async (vault) => {
1593
- if (!publicClient) return void 0;
1594
- return Promise.allSettled(
1595
- vault.activeIncentives.map(
1596
- (incentive) => publicClient.readContract({
1597
- abi: rewardVaultAbi2,
1598
- address: vault.address,
1599
- functionName: "incentives",
1600
- args: [incentive.tokenAddress]
1601
- })
1602
- )
1603
- );
1604
- })
1605
- );
1606
- const vaults = res.data.polGetRewardVaults.vaults.map((vault, index) => {
1607
- let totalIncentiveInUsdc = 0;
1608
- const incentivesArray = vault.activeIncentives.map((apiIncentive, incIdx) => {
1609
- const tokenPrice = Number(apiIncentive.remainingAmountUsd) && Number(apiIncentive.remainingAmount) ? Number(apiIncentive.remainingAmountUsd) / Number(apiIncentive.remainingAmount) : 0;
1610
- const remainingAmount = incentives[index]?.status === "fulfilled" && incentives[index]?.value?.[incIdx]?.status === "fulfilled" ? formatUnits6(
1611
- BigInt(incentives[index].value[incIdx].value[2]),
1612
- apiIncentive.token.decimals
1613
- ) : apiIncentive.remainingAmount;
1614
- totalIncentiveInUsdc += Number(remainingAmount) * Number(tokenPrice);
1615
- return {
1616
- ...apiIncentive,
1617
- remainingAmount
1618
- };
1619
- });
1620
- return {
1621
- ...vault,
1622
- dynamicData: {
1623
- ...vault.dynamicData,
1624
- allTimeRewards: vault.dynamicData?.allTimeRewards ?? "0",
1625
- rewardCapturePercentage: vault.dynamicData?.rewardCapturePercentage ?? 0,
1626
- activeIncentivesValueUsd: totalIncentiveInUsdc.toString(),
1627
- activeIncentivesRateUsd: vault.dynamicData?.activeIncentivesRateUsd ?? "0",
1628
- rewardCapturePerBlock: vault.dynamicData?.rewardCapturePerBlock ?? 0
1629
- },
1630
- activeIncentives: incentivesArray
1631
- };
1632
- });
1633
- return {
1634
- pagination: res.data.polGetRewardVaults.pagination,
1635
- gaugeList: vaults
1636
- };
1637
- }
1638
-
1639
1579
  // src/actions/pol/getBGTGlobalInfo.ts
1640
1580
  import {
1641
1581
  GlobalData
@@ -1702,36 +1642,10 @@ async function getBgtTokenTotalSupply({
1702
1642
  }
1703
1643
  }
1704
1644
 
1705
- // src/actions/pol/getGlobalCuttingBoard.ts
1706
- import {
1707
- GqlRewardVaultOrderBy,
1708
- GqlRewardVaultOrderDirection
1709
- } from "@berachain/graphql/pol/api";
1710
- async function getGlobalCuttingBoard(threshold) {
1711
- const { gaugeList } = await getRewardVaults({
1712
- filter: {
1713
- // TODO sort by bgt capture percentage
1714
- orderBy: GqlRewardVaultOrderBy.Apr,
1715
- orderDirection: GqlRewardVaultOrderDirection.Desc,
1716
- pageSize: threshold,
1717
- where: {
1718
- includeNonWhitelisted: false
1719
- }
1720
- }
1721
- });
1722
- return gaugeList;
1723
- }
1724
-
1725
1645
  // src/actions/pol/getGlobalData.ts
1726
1646
  async function getGlobalData(publicClient) {
1727
- const [
1728
- globalDataRes,
1729
- globalCuttingBoardRes,
1730
- bgtTotalSupplyRes,
1731
- bgtTotalBoostsRes
1732
- ] = await Promise.allSettled([
1647
+ const [globalDataRes, bgtTotalSupplyRes, bgtTotalBoostsRes] = await Promise.allSettled([
1733
1648
  getBGTGlobalInfo(),
1734
- getGlobalCuttingBoard(300),
1735
1649
  getBgtTokenTotalSupply({
1736
1650
  publicClient
1737
1651
  }),
@@ -1744,11 +1658,6 @@ async function getGlobalData(publicClient) {
1744
1658
  initBeraError({ cause: globalDataRes.reason, level: "warning" })
1745
1659
  );
1746
1660
  }
1747
- if (globalCuttingBoardRes.status === "rejected") {
1748
- BeraMonitoring.captureException(
1749
- initBeraError({ cause: globalCuttingBoardRes.reason, level: "warning" })
1750
- );
1751
- }
1752
1661
  if (bgtTotalSupplyRes.status === "rejected") {
1753
1662
  BeraMonitoring.captureException(
1754
1663
  initBeraError({ cause: bgtTotalSupplyRes.reason, level: "warning" })
@@ -1761,27 +1670,11 @@ async function getGlobalData(publicClient) {
1761
1670
  }
1762
1671
  return {
1763
1672
  bgtTotalSupply: bgtTotalSupplyRes.status === "fulfilled" ? bgtTotalSupplyRes.value : void 0,
1764
- globalCuttingBoard: globalCuttingBoardRes.status === "fulfilled" ? globalCuttingBoardRes.value : [],
1765
1673
  bgtTotalBoosts: bgtTotalBoostsRes.status === "fulfilled" ? bgtTotalBoostsRes.value : void 0,
1766
1674
  ...globalDataRes.status === "fulfilled" ? globalDataRes.value : {}
1767
1675
  };
1768
1676
  }
1769
1677
 
1770
- // src/actions/pol/getIncentiveFeeClaimStats.ts
1771
- async function getIncentiveFeeClaimStats() {
1772
- if (typeof window === "undefined") {
1773
- throw new BeraError({
1774
- message: "getIncentiveFeeClaimStats is browser-only; call from a Client Component / SWR hook",
1775
- level: "error"
1776
- });
1777
- }
1778
- return beraFetchJson({
1779
- url: "/api/pol/incentive-fee-claims",
1780
- name: "pol-incentive-fee-claims",
1781
- type: "rest"
1782
- });
1783
- }
1784
-
1785
1678
  // src/actions/pol/getMarkets.ts
1786
1679
  async function getMarkets(args = {}) {
1787
1680
  const { config } = parseBaseArgs(args);
@@ -1840,7 +1733,7 @@ async function getRewardProofsByValidator({
1840
1733
  }
1841
1734
 
1842
1735
  // src/actions/pol/getRewardTokenToBeraRate.ts
1843
- import { formatUnits as formatUnits7, parseUnits as parseUnits5 } from "viem";
1736
+ import { formatUnits as formatUnits6, parseUnits as parseUnits5 } from "viem";
1844
1737
  import { wberaStakerVaultAbi as stakeBeraVaultAbi } from "@berachain/abis/pol/wberaStakerVault";
1845
1738
  async function getRewardTokenToBeraRate({
1846
1739
  address,
@@ -1852,7 +1745,7 @@ async function getRewardTokenToBeraRate({
1852
1745
  abi: stakeBeraVaultAbi,
1853
1746
  functionName: "previewRedeem",
1854
1747
  args: [parseUnits5("1", 18)]
1855
- }).then((rate) => Number(formatUnits7(rate, 18))).catch(() => 0);
1748
+ }).then((rate) => Number(formatUnits6(rate, 18))).catch(() => 0);
1856
1749
  }
1857
1750
 
1858
1751
  // src/actions/pol/getRewardVault.ts
@@ -1888,9 +1781,9 @@ async function getRewardVault({
1888
1781
  import { isSameAddress } from "@berachain-foundation/berancer-sdk";
1889
1782
  import {
1890
1783
  erc20Abi as erc20Abi4,
1891
- formatUnits as formatUnits8
1784
+ formatUnits as formatUnits7
1892
1785
  } from "viem";
1893
- import { rewardVaultAbi as rewardVaultAbi3 } from "@berachain/abis/pol/rewards/rewardVault";
1786
+ import { rewardVaultAbi as rewardVaultAbi2 } from "@berachain/abis/pol/rewards/rewardVault";
1894
1787
  function multicallResult(result, fallback) {
1895
1788
  return result.status === "success" ? result.result : fallback;
1896
1789
  }
@@ -1901,7 +1794,7 @@ async function getRewardVaultIncentives({
1901
1794
  }) {
1902
1795
  const whitelistedTokens = await publicClient.readContract({
1903
1796
  address,
1904
- abi: rewardVaultAbi3,
1797
+ abi: rewardVaultAbi2,
1905
1798
  functionName: "getWhitelistedTokens"
1906
1799
  });
1907
1800
  const hasStakingTokenAsIncentiveToken = whitelistedTokens.findIndex(
@@ -1909,7 +1802,7 @@ async function getRewardVaultIncentives({
1909
1802
  ) !== -1;
1910
1803
  const totalSupply = hasStakingTokenAsIncentiveToken ? await publicClient.readContract({
1911
1804
  address,
1912
- abi: rewardVaultAbi3,
1805
+ abi: rewardVaultAbi2,
1913
1806
  functionName: "totalSupply"
1914
1807
  }) : 0n;
1915
1808
  const incentives = await Promise.allSettled(
@@ -1919,7 +1812,7 @@ async function getRewardVaultIncentives({
1919
1812
  contracts: [
1920
1813
  {
1921
1814
  address,
1922
- abi: rewardVaultAbi3,
1815
+ abi: rewardVaultAbi2,
1923
1816
  functionName: "incentives",
1924
1817
  args: [token]
1925
1818
  },
@@ -1962,16 +1855,16 @@ async function getRewardVaultIncentives({
1962
1855
  return {
1963
1856
  token,
1964
1857
  manager,
1965
- minIncentiveRate: formatUnits8(minIncentiveRate, decimalsResult),
1966
- incentiveRate: formatUnits8(incentiveRate, decimalsResult),
1967
- remainingAmount: formatUnits8(remainingAmount, decimalsResult),
1858
+ minIncentiveRate: formatUnits7(minIncentiveRate, decimalsResult),
1859
+ incentiveRate: formatUnits7(incentiveRate, decimalsResult),
1860
+ remainingAmount: formatUnits7(remainingAmount, decimalsResult),
1968
1861
  name: multicallResult(name, void 0),
1969
1862
  symbol: multicallResult(symbol, void 0),
1970
1863
  decimals: decimalsResult,
1971
- pendingAmount: isSameAddress(stakingToken, token) ? formatUnits8(
1864
+ pendingAmount: isSameAddress(stakingToken, token) ? formatUnits7(
1972
1865
  multicallResult(totalBalance, 0n) - totalSupply - remainingAmount,
1973
1866
  decimalsResult
1974
- ) : formatUnits8(
1867
+ ) : formatUnits7(
1975
1868
  multicallResult(totalBalance, 0n) - remainingAmount,
1976
1869
  decimalsResult
1977
1870
  )
@@ -1998,19 +1891,83 @@ async function getRewardVaultIncentives({
1998
1891
  }
1999
1892
 
2000
1893
  // src/actions/pol/getRewardVaultStakingToken.ts
2001
- import { rewardVaultAbi as rewardVaultAbi4 } from "@berachain/abis/pol/rewards/rewardVault";
1894
+ import { rewardVaultAbi as rewardVaultAbi3 } from "@berachain/abis/pol/rewards/rewardVault";
2002
1895
  async function getRewardVaultStakingToken({
2003
1896
  address,
2004
1897
  publicClient
2005
1898
  }) {
2006
1899
  const vaultAddress = await publicClient.readContract({
2007
1900
  address,
2008
- abi: rewardVaultAbi4,
1901
+ abi: rewardVaultAbi3,
2009
1902
  functionName: "stakeToken"
2010
1903
  });
2011
1904
  return vaultAddress;
2012
1905
  }
2013
1906
 
1907
+ // src/actions/pol/getRewardVaults.ts
1908
+ import { formatUnits as formatUnits8 } from "viem";
1909
+ import { rewardVaultAbi as rewardVaultAbi4 } from "@berachain/abis/pol/rewards/rewardVault";
1910
+ import {
1911
+ GetVaults
1912
+ } from "@berachain/graphql/pol/api";
1913
+ async function getRewardVaults({
1914
+ filter,
1915
+ publicClient,
1916
+ ...args
1917
+ } = {}) {
1918
+ const bexApiGraphqlClient = getApolloClient("api", args);
1919
+ const res = await bexApiGraphqlClient.query({
1920
+ query: GetVaults,
1921
+ variables: filter
1922
+ });
1923
+ const incentives = await Promise.allSettled(
1924
+ res.data.polGetRewardVaults.vaults.map(async (vault) => {
1925
+ if (!publicClient) return void 0;
1926
+ return Promise.allSettled(
1927
+ vault.activeIncentives.map(
1928
+ (incentive) => publicClient.readContract({
1929
+ abi: rewardVaultAbi4,
1930
+ address: vault.address,
1931
+ functionName: "incentives",
1932
+ args: [incentive.tokenAddress]
1933
+ })
1934
+ )
1935
+ );
1936
+ })
1937
+ );
1938
+ const vaults = res.data.polGetRewardVaults.vaults.map((vault, index) => {
1939
+ let totalIncentiveInUsdc = 0;
1940
+ const incentivesArray = vault.activeIncentives.map((apiIncentive, incIdx) => {
1941
+ const tokenPrice = Number(apiIncentive.remainingAmountUsd) && Number(apiIncentive.remainingAmount) ? Number(apiIncentive.remainingAmountUsd) / Number(apiIncentive.remainingAmount) : 0;
1942
+ const remainingAmount = incentives[index]?.status === "fulfilled" && incentives[index]?.value?.[incIdx]?.status === "fulfilled" ? formatUnits8(
1943
+ BigInt(incentives[index].value[incIdx].value[2]),
1944
+ apiIncentive.token.decimals
1945
+ ) : apiIncentive.remainingAmount;
1946
+ totalIncentiveInUsdc += Number(remainingAmount) * Number(tokenPrice);
1947
+ return {
1948
+ ...apiIncentive,
1949
+ remainingAmount
1950
+ };
1951
+ });
1952
+ return {
1953
+ ...vault,
1954
+ dynamicData: {
1955
+ ...vault.dynamicData,
1956
+ allTimeRewards: vault.dynamicData?.allTimeRewards ?? "0",
1957
+ rewardCapturePercentage: vault.dynamicData?.rewardCapturePercentage ?? 0,
1958
+ activeIncentivesValueUsd: totalIncentiveInUsdc.toString(),
1959
+ activeIncentivesRateUsd: vault.dynamicData?.activeIncentivesRateUsd ?? "0",
1960
+ rewardCapturePerBlock: vault.dynamicData?.rewardCapturePerBlock ?? 0
1961
+ },
1962
+ activeIncentives: incentivesArray
1963
+ };
1964
+ });
1965
+ return {
1966
+ pagination: res.data.polGetRewardVaults.pagination,
1967
+ rewardVaultList: vaults
1968
+ };
1969
+ }
1970
+
2014
1971
  // src/actions/pol/getStakedBeraAPR.ts
2015
1972
  import {
2016
1973
  GetSWberaVaultMetadata,
@@ -2109,8 +2066,7 @@ async function getSWBeraVaultMetadata({
2109
2066
  oneShareWorthWindowAgo,
2110
2067
  tvl24HoursAgo,
2111
2068
  underlyingTotalSupply,
2112
- lockPeriod,
2113
- incentiveFeeClaimStats
2069
+ lockPeriod
2114
2070
  ] = await Promise.all([
2115
2071
  publicClient.readContract({
2116
2072
  address,
@@ -2169,8 +2125,7 @@ async function getSWBeraVaultMetadata({
2169
2125
  getStakeWithdrawalCooldown({
2170
2126
  publicClient,
2171
2127
  address
2172
- }),
2173
- getIncentiveFeeClaimStats()
2128
+ })
2174
2129
  ]);
2175
2130
  const exchangeRateWindowAgo = new bignumber_js_default(
2176
2131
  oneShareWorthWindowAgo.toString()
@@ -2191,9 +2146,7 @@ async function getSWBeraVaultMetadata({
2191
2146
  tvl: new bignumber_js_default(tvl24HoursAgo.toString()).dividedBy(1e18).toString()
2192
2147
  },
2193
2148
  totalWBeraIssued: new bignumber_js_default(underlyingTotalSupply.toString()).dividedBy(1e18).toString(),
2194
- lockPeriod,
2195
- totalBuyBacks: incentiveFeeClaimStats.sumAllClaims,
2196
- totalBuyBacksInLast24Hours: incentiveFeeClaimStats.sumClaimsInLast24Hours
2149
+ lockPeriod
2197
2150
  };
2198
2151
  } catch (error) {
2199
2152
  console.error("Failed to get SW Bera Vault Metadata", error);
@@ -3423,7 +3376,7 @@ async function getApiEnrichedAllocation({
3423
3376
  percentage: allocation2.percentage,
3424
3377
  receiver: allocation2.receiver,
3425
3378
  startBlock,
3426
- receivingVault: vaults?.gaugeList.find(
3379
+ receivingVault: vaults?.rewardVaultList.find(
3427
3380
  (vault) => isAddressEqual(vault.address, allocation2.receiver)
3428
3381
  )
3429
3382
  };
@@ -4080,16 +4033,16 @@ export {
4080
4033
  RewardVaultDistributionMode,
4081
4034
  getRewardVaultRewards,
4082
4035
  getBgtAprSimulation,
4036
+ getBgtIncentiveDistributorPaused,
4083
4037
  getEarnedStakedBeraVault,
4084
- getRewardVaults,
4085
4038
  getGlobalData,
4086
- getIncentiveFeeClaimStats,
4087
4039
  getMarkets,
4088
4040
  getRewardProofsByValidator,
4089
4041
  getRewardTokenToBeraRate,
4090
4042
  getRewardVault,
4091
4043
  getRewardVaultIncentives,
4092
4044
  getRewardVaultStakingToken,
4045
+ getRewardVaults,
4093
4046
  getStakedBeraAPR,
4094
4047
  getStakedBeraSnapshots,
4095
4048
  getStakeWithdrawalCooldown,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  beraFetchJson
3
- } from "./chunk-Y6THHG77.mjs";
3
+ } from "./chunk-T43JPYQS.mjs";
4
4
  import {
5
5
  parseBaseArgs
6
6
  } from "./chunk-DQRH5VE3.mjs";
@@ -20,7 +20,7 @@ function fetchOpenApi(link, path, params, fallbackName) {
20
20
  return encodeURIComponent(String(value));
21
21
  });
22
22
  const search = query ? new URLSearchParams(
23
- Object.entries(query).map(([k, v]) => [k, String(v)])
23
+ Object.entries(query).filter(([, v]) => v !== void 0).map(([k, v]) => [k, String(v)])
24
24
  ).toString() : "";
25
25
  const url = `${getUriFromLink(link)}${resolvedPath}${search ? `?${search}` : ""}`;
26
26
  const name = typeof link === "string" ? fallbackName : link.name;
@@ -30,25 +30,10 @@ function fetchOpenApi(link, path, params, fallbackName) {
30
30
  // src/actions/clients/fetchBeep.ts
31
31
  function fetchBeep(path, params, args = {}) {
32
32
  const { config } = parseBaseArgs(args);
33
- if (!config.beep) {
34
- throw new Error("fetchBeep: `beep` backend is not configured.");
35
- }
36
33
  return fetchOpenApi(config.beep, path, params, "beep");
37
34
  }
38
35
 
39
- // src/actions/clients/fetchRailwayBackend.ts
40
- function fetchRailwayBackend(path, params, args = {}) {
41
- const { config } = parseBaseArgs(args);
42
- return fetchOpenApi(
43
- config.backend,
44
- path,
45
- params,
46
- "backend-railway"
47
- );
48
- }
49
-
50
36
  export {
51
37
  fetchOpenApi,
52
- fetchBeep,
53
- fetchRailwayBackend
38
+ fetchBeep
54
39
  };
@@ -4,8 +4,8 @@ import { B as BeraFlags } from '../defaultFlags-D6KfkTZx.js';
4
4
  export { B as BexStateContext, a as BexStatusProvider, b as BexStatusProviderProps, u as useBexStatus } from '../BexStatusProvider-DRymVlQf.js';
5
5
  import * as react from 'react';
6
6
  import react__default, { PropsWithChildren } from 'react';
7
- import { a as TokenWithMetadata, b as Token, B as BalanceToken } from '../HoneyConfigProvider-Dkj-_a5x.js';
8
- export { c as HoneyConfigContext, d as HoneyConfigContextReturn, e as HoneyConfigProvider, f as HoneyConfigProviderProps, T as TokenWithOrder, u as useHoneyConfig } from '../HoneyConfigProvider-Dkj-_a5x.js';
7
+ import { a as TokenWithMetadata, b as Token, B as BalanceToken } from '../HoneyConfigProvider-COOuDNra.js';
8
+ export { c as HoneyConfigContext, d as HoneyConfigContextReturn, e as HoneyConfigProvider, f as HoneyConfigProviderProps, T as TokenWithOrder, u as useHoneyConfig } from '../HoneyConfigProvider-COOuDNra.js';
9
9
  import '@berachain/config/internal/flags';
10
10
  import 'viem';
11
11
  import '@berachain/graphql/pol/api';
@@ -14,25 +14,27 @@ import {
14
14
  useBexStatus,
15
15
  useBlockTime,
16
16
  useHoneyConfig
17
- } from "../chunk-WNBWX23Q.mjs";
17
+ } from "../chunk-W2VODV76.mjs";
18
+ import {
19
+ SWRConfig
20
+ } from "../chunk-4ML4Y6UN.mjs";
18
21
  import "../chunk-HYDP32P6.mjs";
19
22
  import "../chunk-HQCOU6GY.mjs";
20
23
  import "../chunk-SGIJVHZO.mjs";
21
24
  import {
22
25
  BeraMonitoring
23
- } from "../chunk-7YVNSDXG.mjs";
26
+ } from "../chunk-FGION6F6.mjs";
24
27
  import "../chunk-GY6B3PD5.mjs";
25
28
  import "../chunk-BGMRHTBQ.mjs";
26
29
  import "../chunk-IXIBY5FP.mjs";
27
30
  import "../chunk-DQRH5VE3.mjs";
28
- import "../chunk-ZLTMIFCZ.mjs";
31
+ import "../chunk-RFJGL4MF.mjs";
29
32
  import {
30
33
  BeraError
31
34
  } from "../chunk-KHXJDYA4.mjs";
32
35
 
33
36
  // src/contexts/SwrFallback.tsx
34
37
  import { useEffect } from "react";
35
- import { SWRConfig } from "swr";
36
38
  import { jsx } from "react/jsx-runtime";
37
39
  function SWRFallback({
38
40
  fallback,
@@ -1,7 +1,13 @@
1
1
  export { C as ContractName, T as TransactionActionType } from '../txnEnum-ByI5dtDi.js';
2
2
  export { A as Aggregators, O as OwnershipType, P as ParameterPreset, a as PoolCreationStep, S as SwapReferrer } from '../dex-C_BB0b0O.js';
3
3
  export { H as HoneySwapAction } from '../honey-CYm0RWf4.js';
4
- export { P as POLLING } from '../polling-BKnyavLI.js';
4
+
5
+ declare enum POLLING {
6
+ FAST = 10000,// 10 sec
7
+ NORMAL = 100000,// 100 sec
8
+ SLOW = 180000,// 3 min
9
+ REFRESH_BLOCK_INTERVAL = 10000
10
+ }
5
11
 
6
12
  declare const DEFAULT_SLIPPAGE: 0.5;
7
13
  declare const SLIPPAGE_DEGEN_VALUE: 25;
@@ -20,4 +26,4 @@ declare enum TRANSACTION_MODE {
20
26
  INFINITY = "infinity"
21
27
  }
22
28
 
23
- export { DEFAULT_DEADLINE, DEFAULT_SLIPPAGE, SLIPPAGE_DEGEN_VALUE, SLIPPAGE_MODE, TRANSACTION_MODE };
29
+ export { DEFAULT_DEADLINE, DEFAULT_SLIPPAGE, POLLING, SLIPPAGE_DEGEN_VALUE, SLIPPAGE_MODE, TRANSACTION_MODE };
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  BeraMonitoring,
7
7
  initBeraError
8
- } from "../chunk-7YVNSDXG.mjs";
8
+ } from "../chunk-FGION6F6.mjs";
9
9
  import {
10
10
  assertAddress,
11
11
  assertAmount,
@@ -18,7 +18,7 @@ import {
18
18
  } from "../chunk-SZ5C44L5.mjs";
19
19
  import {
20
20
  RequestError
21
- } from "../chunk-ZLTMIFCZ.mjs";
21
+ } from "../chunk-RFJGL4MF.mjs";
22
22
  import {
23
23
  BeraError,
24
24
  InvalidArgumentError,
@@ -29,12 +29,11 @@ declare class BeraApolloClient extends ApolloClient {
29
29
 
30
30
  /**
31
31
  * Browser-reachable Apollo client factory for `api` and Bend's `whisk`
32
- * endpoints. Subgraph clients (honey/pol) are server-only; browser data
33
- * access goes through the typed `/api/honey/*` and `/api/pol/*` REST
34
- * endpoints. Same auth shape as bend.whiskApi — non-public env values only
35
- * resolve server-side.
32
+ * endpoints. The pol subgraph client is server-only; browser data access goes
33
+ * through the typed `/api/pol/*` REST endpoints. Same auth shape as
34
+ * bend.whiskApi — non-public env values only resolve server-side.
36
35
  */
37
- type GraphqlClient = "api" | "bend.whisk" | "honey.subgraph" | "pol.subgraph";
36
+ type GraphqlClient = "api" | "bend.whisk" | "pol.subgraph";
38
37
  declare function getApolloClient(clientName: GraphqlClient, { ...args }: BeraJS.BaseFunctionArgs): BeraApolloClient;
39
38
 
40
39
  export { BeraApolloClient as B, getApolloClient as g };