@berachain/berajs 0.2.9 → 0.2.11

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 (182) hide show
  1. package/dist/{HoneyConfigProvider-Dkj-_a5x.d.ts → HoneyConfigProvider-COOuDNra.d.ts} +1 -1
  2. package/dist/actions/clients/exports.d.ts +77 -1
  3. package/dist/actions/clients/exports.mjs +13 -4
  4. package/dist/actions/exports.d.ts +121 -39
  5. package/dist/actions/exports.mjs +75 -34
  6. package/dist/actions/governance/exports.d.ts +3 -11
  7. package/dist/actions/governance/exports.mjs +3 -3
  8. package/dist/actions/server/exports.mjs +4 -4
  9. package/dist/{chunk-4Z4AK6SH.mjs → chunk-3JJLQ2JX.mjs} +3 -3
  10. package/dist/{chunk-EXIUPSFN.mjs → chunk-7YVNSDXG.mjs} +2 -2
  11. package/dist/{chunk-WXXOISTU.mjs → chunk-AUOPN6NK.mjs} +1 -1
  12. package/dist/{chunk-75M6TF7M.mjs → chunk-DQRH5VE3.mjs} +1 -1
  13. package/dist/{chunk-CDFWPU2R.mjs → chunk-E7YFXBBQ.mjs} +0 -124
  14. package/dist/{chunk-AFN4CVD3.mjs → chunk-GUURQAME.mjs} +1 -1
  15. package/dist/{chunk-KQUMKB66.mjs → chunk-GY6B3PD5.mjs} +1 -1
  16. package/dist/{chunk-HSSJKHZ4.mjs → chunk-HYDP32P6.mjs} +3 -3
  17. package/dist/{chunk-NPBQLVL3.mjs → chunk-IXIBY5FP.mjs} +2 -2
  18. package/dist/{chunk-J5I45WGQ.mjs → chunk-KHXJDYA4.mjs} +7 -0
  19. package/dist/chunk-MRQGHXAN.mjs +54 -0
  20. package/dist/{chunk-FFB5LFDW.mjs → chunk-QVHEM4BG.mjs} +2 -2
  21. package/dist/{chunk-3EARVV7K.mjs → chunk-SXUNCX5E.mjs} +22 -9
  22. package/dist/chunk-UD5IUNCW.mjs +34 -0
  23. package/dist/{chunk-QJIXTYTZ.mjs → chunk-VAA2FVPP.mjs} +162 -41
  24. package/dist/chunk-Y6THHG77.mjs +126 -0
  25. package/dist/{chunk-XIYN6AL6.mjs → chunk-ZLTMIFCZ.mjs} +10 -5
  26. package/dist/contexts/exports.d.ts +2 -2
  27. package/dist/contexts/exports.mjs +11 -9
  28. package/dist/enum/exports.d.ts +8 -2
  29. package/dist/errors/exports.mjs +5 -5
  30. package/dist/getProposalVotes-DAUrdX2n.d.ts +12 -0
  31. package/dist/{getValidatorQueuedOperatorAddress-Dw5KN5sh.d.ts → getValidatorQueuedOperatorAddress-Cxt-DlL_.d.ts} +2 -2
  32. package/dist/{global.d-BuGDKh4k.d.ts → global.d-q_LQWQqs.d.ts} +2 -4
  33. package/dist/hooks/exports.d.ts +114 -164
  34. package/dist/hooks/exports.mjs +535 -522
  35. package/dist/hooks/governance/exports.d.ts +20 -15
  36. package/dist/hooks/governance/exports.mjs +43 -41
  37. package/dist/{pol.d-CqPA9K6m.d.ts → pol.d-CeRgXBL8.d.ts} +33 -8
  38. package/dist/types/exports.d.ts +5 -5
  39. package/dist/{useHoneySwapState-vFmuFF0g.d.ts → useHoneySwapState-twi7NTaO.d.ts} +1 -1
  40. package/dist/utils/exports.d.ts +2 -2
  41. package/dist/utils/exports.mjs +15 -9
  42. package/package.json +9 -8
  43. package/src/actions/bend/getMaxDeposit.ts +28 -2
  44. package/src/actions/clients/exports.ts +3 -0
  45. package/src/actions/clients/fetchBeep.ts +34 -0
  46. package/src/actions/clients/fetchOpenApi.ts +97 -0
  47. package/src/actions/clients/fetchOpenApi.unit.test.ts +245 -0
  48. package/src/actions/clients/fetchRailwayBackend.ts +34 -0
  49. package/src/actions/enso/getEnsoUserTokensWithBalances.ts +18 -0
  50. package/src/actions/exports.ts +2 -0
  51. package/src/actions/honey/getChartData.ts +53 -12
  52. package/src/actions/honey/getHoney24hVolume.ts +34 -6
  53. package/src/actions/honey/getHoneyTxns.ts +93 -0
  54. package/src/actions/honey/getPythLatestPrices.ts +7 -0
  55. package/src/actions/pol/__tests__/rewardVaults.integration.test.ts +1 -1
  56. package/src/actions/pol/getAutoclaimedIncentives.ts +21 -10
  57. package/src/actions/pol/getAutoclaimedIncentivesTxHash.ts +41 -0
  58. package/src/actions/pol/getBgtIncentiveDistributorPaused.ts +5 -12
  59. package/src/actions/pol/getEarnedStakedBeraVault.ts +20 -16
  60. package/src/actions/pol/getRewardVaults.ts +4 -4
  61. package/src/actions/pol/getStakingDailyAssets.ts +18 -14
  62. package/src/actions/validators/getValidatorIncentiveDistribution.ts +64 -12
  63. package/src/actions/validators/utils/getValidatorBoostApy.ts +1 -1
  64. package/src/contexts/SwrFallback.tsx +2 -1
  65. package/src/data/contracts.ts +4 -0
  66. package/src/errors/RequestError.ts +12 -3
  67. package/src/errors/RequestError.unit.test.ts +55 -0
  68. package/src/errors/errorMap.ts +8 -0
  69. package/src/errors/getRevertReason.integration.test.ts +5 -1
  70. package/src/hooks/bend/useGetConvertToAssets.ts +2 -3
  71. package/src/hooks/dex/useAggregatorsQuotes.ts +10 -10
  72. package/src/hooks/dex/useAggregatorsRouterFeeBps.ts +1 -1
  73. package/src/hooks/dex/useAllUserPools.ts +7 -5
  74. package/src/hooks/dex/useApiPool.ts +1 -1
  75. package/src/hooks/dex/useGlobalLiquidityAndSwapVolume.ts +1 -1
  76. package/src/hooks/dex/useOnChainPoolData.ts +1 -1
  77. package/src/hooks/dex/usePollPoolCreationRelayerApproval.ts +2 -2
  78. package/src/hooks/dex/usePoolEvents.ts +1 -2
  79. package/src/hooks/dex/usePoolHistoricalData.ts +2 -3
  80. package/src/hooks/dex/usePools.ts +4 -2
  81. package/src/hooks/dex/useSingleAggregatorQuote.ts +6 -18
  82. package/src/hooks/enso/useBendDemultiply.ts +3 -4
  83. package/src/hooks/enso/useBendMultiply.ts +3 -4
  84. package/src/hooks/enso/useBendZapSupply.ts +3 -4
  85. package/src/hooks/enso/useEnsoSwapBundle.ts +1 -1
  86. package/src/hooks/enso/useEnsoUserTokensWithBalances.ts +3 -5
  87. package/src/hooks/enso/useEnsoWalletV2Address.ts +1 -1
  88. package/src/hooks/enso/useIsBendAuthorized.ts +1 -1
  89. package/src/hooks/enso/useZapStakeBera.ts +2 -2
  90. package/src/hooks/exports.ts +2 -0
  91. package/src/hooks/governance/useGetPastVotes.ts +1 -1
  92. package/src/hooks/governance/useHasVoted.ts +1 -1
  93. package/src/hooks/governance/useIsCanceller.ts +1 -1
  94. package/src/hooks/governance/usePollAllProposals.ts +13 -12
  95. package/src/hooks/governance/usePollProposal.ts +3 -3
  96. package/src/hooks/governance/usePollProposalThreshold.ts +1 -1
  97. package/src/hooks/governance/usePollProposalVotes.ts +23 -5
  98. package/src/hooks/governance/usePollUserDelegates.ts +3 -3
  99. package/src/hooks/governance/useProposalFromTx.ts +2 -1
  100. package/src/hooks/governance/useProposalSnapshot.ts +2 -3
  101. package/src/hooks/governance/useProposalState.ts +2 -2
  102. package/src/hooks/governance/useProposalTimelockState.ts +2 -1
  103. package/src/hooks/governance/useQuorum.ts +1 -2
  104. package/src/hooks/honey/useCappedGlobally.ts +3 -6
  105. package/src/hooks/honey/useCappedRelatively.ts +2 -2
  106. package/src/hooks/honey/useCollateralWeights.ts +3 -3
  107. package/src/hooks/honey/useHoney24hVolume.ts +1 -1
  108. package/src/hooks/honey/useHoneyBalances.ts +1 -1
  109. package/src/hooks/honey/useHoneyChartData.ts +1 -1
  110. package/src/hooks/honey/useHoneyVaultsBalance.ts +2 -3
  111. package/src/hooks/honey/useIsBadCollateralAsset.ts +4 -7
  112. package/src/hooks/honey/useIsBasketModeEnabled.ts +4 -7
  113. package/src/hooks/honey/usePythLatestPrices.ts +13 -9
  114. package/src/hooks/perps/usePythUpdateFee.ts +13 -11
  115. package/src/hooks/pol/useAutoclaimedIncentives.ts +2 -12
  116. package/src/hooks/pol/useAutoclaimedIncentivesTxHash.ts +44 -0
  117. package/src/hooks/pol/useBgtIncentiveDistributorPaused.ts +39 -0
  118. package/src/hooks/pol/useBgtUnstakedBalance.ts +2 -2
  119. package/src/hooks/pol/useClaimableFees.ts +1 -1
  120. package/src/hooks/pol/useHighestVaultsAPR.ts +4 -6
  121. package/src/hooks/pol/useOnChainRewardVault.ts +77 -72
  122. package/src/hooks/pol/usePollGlobalData.ts +2 -3
  123. package/src/hooks/pol/usePollMarkets.ts +2 -2
  124. package/src/hooks/pol/useQueuedBeraUnlock.ts +2 -2
  125. package/src/hooks/pol/useRewardTokenToBeraRate.ts +2 -2
  126. package/src/hooks/pol/useRewardVault.ts +7 -6
  127. package/src/hooks/pol/useRewardVaultBalanceFromStakingToken.ts +4 -4
  128. package/src/hooks/pol/useRewardVaultFromToken.ts +1 -1
  129. package/src/hooks/pol/useRewardVaultIncentives.ts +1 -1
  130. package/src/hooks/pol/useRewardVaultRewards.ts +2 -2
  131. package/src/hooks/pol/useRewardVaults.ts +3 -6
  132. package/src/hooks/pol/useStakedAPR.ts +1 -2
  133. package/src/hooks/pol/useStakedData.ts +90 -41
  134. package/src/hooks/pol/useStakedSnapshots.ts +1 -1
  135. package/src/hooks/pol/useStakingVaultsMetadata.ts +1 -1
  136. package/src/hooks/pol/useTotalStakedAmount.ts +1 -2
  137. package/src/hooks/pol/useUserVaultInfo.ts +2 -2
  138. package/src/hooks/pol/useUserVaults.ts +2 -3
  139. package/src/hooks/pol/useVaultAddress.ts +1 -1
  140. package/src/hooks/pol/useVaultHistory.ts +1 -2
  141. package/src/hooks/pol/useVaultValidators.ts +2 -2
  142. package/src/hooks/tokens/useMultipleTokenInformation.ts +2 -2
  143. package/src/hooks/tokens/usePollAllowances.ts +3 -4
  144. package/src/hooks/tokens/usePollBalance.ts +2 -2
  145. package/src/hooks/tokens/usePollWalletBalances.ts +2 -2
  146. package/src/hooks/tokens/useStakingTokenInformation.ts +2 -2
  147. package/src/hooks/tokens/useTokenCurrentPrices.ts +11 -13
  148. package/src/hooks/tokens/useTokenInformation.ts +2 -2
  149. package/src/hooks/tokens/useTokenPrice.ts +2 -1
  150. package/src/hooks/tokens/useTokenPrices.ts +3 -4
  151. package/src/hooks/tokens/useTotalSupply.ts +1 -1
  152. package/src/hooks/tokens/useUnderlyingAsset.ts +1 -2
  153. package/src/hooks/useBlockToTimestamp.ts +1 -2
  154. package/src/hooks/useGetVerifiedAbi.ts +2 -1
  155. package/src/hooks/validators/useAllValidators.ts +2 -3
  156. package/src/hooks/validators/useApiEnrichedAllocation.ts +1 -1
  157. package/src/hooks/validators/useApiValidator.ts +3 -6
  158. package/src/hooks/validators/useBaselineRewardAllocation.ts +1 -2
  159. package/src/hooks/validators/useDailyValidatorBlockStats.ts +1 -1
  160. package/src/hooks/validators/useDefaultRewardAllocation.ts +2 -3
  161. package/src/hooks/validators/useManagedValidatorRole.ts +2 -2
  162. package/src/hooks/validators/useOnChainValidator.ts +3 -3
  163. package/src/hooks/validators/useStakingPoolBatch.ts +3 -4
  164. package/src/hooks/validators/useUserActiveValidators.ts +2 -3
  165. package/src/hooks/validators/useUserBoostsOnValidator.ts +1 -1
  166. package/src/hooks/validators/useUserClaimableIncentives.ts +1 -1
  167. package/src/hooks/validators/useUserStakingPositions.ts +2 -1
  168. package/src/hooks/validators/useValidator.ts +4 -8
  169. package/src/hooks/validators/useValidatorAnalytics.ts +1 -1
  170. package/src/hooks/validators/useValidatorCommission.ts +2 -2
  171. package/src/hooks/validators/useValidatorIncentiveDistribution.ts +3 -3
  172. package/src/hooks/validators/useValidatorQueuedCommission.ts +2 -2
  173. package/src/hooks/validators/useValidatorQueuedOperatorAddress.ts +2 -2
  174. package/src/hooks/validators/useValidatorQueuedRewardAllocation.ts +2 -2
  175. package/src/hooks/validators/useValidatorRewardAllocation.ts +2 -2
  176. package/src/types/bribe-boost.d.ts +14 -3
  177. package/src/types/global.d.ts +3 -4
  178. package/src/types/pol.d.ts +17 -3
  179. package/src/utils/polyfillAbortSignalAny.ts +53 -0
  180. package/src/utils/polyfillAbortSignalAny.unit.test.ts +81 -0
  181. package/dist/polling-BKnyavLI.d.ts +0 -8
  182. /package/dist/{exports-BcUTGFUb.d.ts → getApolloClient-BcUTGFUb.d.ts} +0 -0
@@ -13,7 +13,9 @@ import {
13
13
  getApiPool,
14
14
  getApiValidator,
15
15
  getAutoclaimedIncentives,
16
+ getAutoclaimedIncentivesTxHash,
16
17
  getBgtAprSimulation,
18
+ getBgtIncentiveDistributorPaused,
17
19
  getBlockTimestamp,
18
20
  getChartData,
19
21
  getCollateralWeights,
@@ -69,8 +71,12 @@ import {
69
71
  getVaultValidators,
70
72
  isBadCollateralAsset,
71
73
  isBasketModeEnabled
72
- } from "../chunk-QJIXTYTZ.mjs";
73
- import "../chunk-4Z4AK6SH.mjs";
74
+ } from "../chunk-VAA2FVPP.mjs";
75
+ import {
76
+ fetchBeep,
77
+ fetchRailwayBackend
78
+ } from "../chunk-MRQGHXAN.mjs";
79
+ import "../chunk-3JJLQ2JX.mjs";
74
80
  import "../chunk-CDK4YV3D.mjs";
75
81
  import {
76
82
  TokenContext,
@@ -79,60 +85,67 @@ import {
79
85
  useBlockTime,
80
86
  useEnsoUserTokensWithBalances,
81
87
  useHoneyConfig
82
- } from "../chunk-3EARVV7K.mjs";
88
+ } from "../chunk-SXUNCX5E.mjs";
89
+ import {
90
+ swr_default,
91
+ useSWR,
92
+ useSWRImmutable
93
+ } from "../chunk-UD5IUNCW.mjs";
83
94
  import {
84
95
  getEnsoClient,
85
96
  getWalletBalances
86
- } from "../chunk-HSSJKHZ4.mjs";
97
+ } from "../chunk-HYDP32P6.mjs";
87
98
  import "../chunk-HQCOU6GY.mjs";
88
99
  import "../chunk-O2NQFKJK.mjs";
89
100
  import "../chunk-SGIJVHZO.mjs";
90
101
  import {
91
102
  TransactionFailedError
92
- } from "../chunk-WXXOISTU.mjs";
103
+ } from "../chunk-AUOPN6NK.mjs";
93
104
  import {
94
105
  BeraMonitoring,
95
106
  initBeraError
96
- } from "../chunk-EXIUPSFN.mjs";
107
+ } from "../chunk-7YVNSDXG.mjs";
97
108
  import {
98
109
  assertAddress,
99
110
  assertAmount,
100
111
  assertDefined,
101
112
  assertPositive,
102
113
  assertPublicClient
103
- } from "../chunk-KQUMKB66.mjs";
114
+ } from "../chunk-GY6B3PD5.mjs";
104
115
  import {
105
116
  computePriceImpact,
106
117
  wrapNativeTokens
107
- } from "../chunk-FFB5LFDW.mjs";
118
+ } from "../chunk-QVHEM4BG.mjs";
108
119
  import {
109
120
  DEFAULT_METAMASK_GAS_LIMIT,
110
- beraFetchJson,
111
121
  bignumber_js_default,
122
+ calculateTimestampFromDays,
112
123
  getPythDefaultUpdateFee,
113
124
  msToSeconds,
114
125
  seconds
115
- } from "../chunk-CDFWPU2R.mjs";
126
+ } from "../chunk-E7YFXBBQ.mjs";
127
+ import {
128
+ beraFetchJson
129
+ } from "../chunk-Y6THHG77.mjs";
116
130
  import "../chunk-BGMRHTBQ.mjs";
117
131
  import {
118
132
  beraToken,
119
133
  getHoneyToken,
120
134
  isToken
121
- } from "../chunk-NPBQLVL3.mjs";
135
+ } from "../chunk-IXIBY5FP.mjs";
122
136
  import {
123
137
  parseBaseArgs
124
- } from "../chunk-75M6TF7M.mjs";
138
+ } from "../chunk-DQRH5VE3.mjs";
125
139
  import "../chunk-SZ5C44L5.mjs";
126
140
  import {
127
141
  RequestError
128
- } from "../chunk-XIYN6AL6.mjs";
142
+ } from "../chunk-ZLTMIFCZ.mjs";
129
143
  import {
130
144
  BeraError,
131
145
  InvalidArgumentError
132
- } from "../chunk-J5I45WGQ.mjs";
146
+ } from "../chunk-KHXJDYA4.mjs";
133
147
 
134
148
  // src/hooks/bend/useGetConvertToAssets.ts
135
- import useSWR from "swr";
136
149
  import { usePublicClient } from "@berachain/wagmi/hooks";
137
150
  var useGetConvertToAssets = ({
138
151
  sharesAmount,
@@ -151,7 +164,7 @@ var useGetConvertToAssets = ({
151
164
  });
152
165
  },
153
166
  {
154
- ...options?.opts
167
+ ...options
155
168
  }
156
169
  );
157
170
  return {
@@ -1379,7 +1392,6 @@ var WBeraAggregator = class extends BaseAggregator {
1379
1392
  var wberaSwap = new WBeraAggregator();
1380
1393
 
1381
1394
  // src/hooks/tokens/useUnderlyingAsset.ts
1382
- import useSWRImmutable from "swr/immutable";
1383
1395
  import { useConfig } from "@berachain/wagmi/hooks";
1384
1396
 
1385
1397
  // src/actions/tokens/getUnderlyingToken.ts
@@ -1426,7 +1438,6 @@ function useUnderlyingAsset({ token }) {
1426
1438
  }
1427
1439
 
1428
1440
  // src/hooks/dex/useAggregatorsRouterFeeBps.ts
1429
- import useSWRImmutable2 from "swr/immutable";
1430
1441
  import { zeroAddress as zeroAddress8 } from "viem";
1431
1442
  import aggregatorsRouterAbi7 from "@berachain/abis/meta-aggregator/metaAggregatorV2";
1432
1443
  import { usePublicClient as usePublicClient2 } from "@berachain/wagmi/hooks";
@@ -1435,7 +1446,7 @@ var useAggregatorsRouterFeeBps = () => {
1435
1446
  const { config } = parseBaseArgs({
1436
1447
  chainId: publicClient.chain?.id
1437
1448
  });
1438
- const swrResponse = useSWRImmutable2(
1449
+ const swrResponse = useSWRImmutable(
1439
1450
  publicClient && config.bex.aggregatorsRouter && config.bex.aggregatorsRouter !== zeroAddress8 ? ["useAggregatorsRouterFeeBps", config.bex.aggregatorsRouter] : null,
1440
1451
  async ([, aggregatorsRouter]) => {
1441
1452
  const fee = await publicClient.readContract({
@@ -1453,7 +1464,6 @@ var useAggregatorsRouterFeeBps = () => {
1453
1464
  };
1454
1465
 
1455
1466
  // src/hooks/dex/useSingleAggregatorQuote.ts
1456
- import useSWR2 from "swr";
1457
1467
  import { parseUnits as parseUnits2, zeroAddress as zeroAddress9 } from "viem";
1458
1468
  import { useBeraWallet, usePublicClient as usePublicClient3 } from "@berachain/wagmi/hooks";
1459
1469
  var USE_AGGREGATORS_QUOTES_QUERY_KEY = "useAggregatorsQuotes";
@@ -1462,13 +1472,9 @@ function getQueryKey({
1462
1472
  account,
1463
1473
  args,
1464
1474
  feeBps,
1465
- options,
1466
1475
  activeAggregators,
1467
1476
  isMAEnabled
1468
1477
  }) {
1469
- if (options?.opts?.isEnabled !== void 0 && !options?.opts?.isEnabled) {
1470
- return null;
1471
- }
1472
1478
  if (!Number(args.amount)) {
1473
1479
  return null;
1474
1480
  }
@@ -1566,13 +1572,12 @@ function raw_useSingleAggregatorQuote({
1566
1572
  isMAEnabled,
1567
1573
  ...args
1568
1574
  }, options) {
1569
- return useSWR2(
1575
+ return useSWR(
1570
1576
  getQueryKey({
1571
1577
  aggregator: args.aggregator,
1572
1578
  account,
1573
1579
  args,
1574
1580
  feeBps,
1575
- options,
1576
1581
  activeAggregators,
1577
1582
  isMAEnabled
1578
1583
  }),
@@ -1581,7 +1586,7 @@ function raw_useSingleAggregatorQuote({
1581
1586
  proxyAggregatorsThroughVercel,
1582
1587
  publicClient
1583
1588
  }),
1584
- options?.opts
1589
+ options
1585
1590
  );
1586
1591
  }
1587
1592
  function getAggregatorsSWROptions(options) {
@@ -1589,16 +1594,10 @@ function getAggregatorsSWROptions(options) {
1589
1594
  refreshInterval: 1e4 /* FAST */,
1590
1595
  // every 10s
1591
1596
  errorRetryCount: 3,
1592
- ...options?.opts,
1597
+ ...options,
1593
1598
  // biome-ignore lint/nursery/useMaxParams: the function is defined in the SWRConfiguration type
1594
1599
  onErrorRetry(err, key, config, revalidate, revalidateOpts) {
1595
- options?.opts?.onErrorRetry?.(
1596
- err,
1597
- key,
1598
- config,
1599
- revalidate,
1600
- revalidateOpts
1601
- );
1600
+ options?.onErrorRetry?.(err, key, config, revalidate, revalidateOpts);
1602
1601
  if (err instanceof BeraError) {
1603
1602
  if (err.reason === BaseAggregator.PATH_NOT_FOUND_REASON) {
1604
1603
  return;
@@ -1644,7 +1643,7 @@ function useSingleAggregatorQuote(args, options) {
1644
1643
  publicClient,
1645
1644
  proxyAggregatorsThroughVercel
1646
1645
  },
1647
- { ...options, opts: getAggregatorsSWROptions(options) }
1646
+ getAggregatorsSWROptions(options)
1648
1647
  );
1649
1648
  }
1650
1649
 
@@ -1695,7 +1694,7 @@ function useAggregatorsQuotes(args, options) {
1695
1694
  ...args,
1696
1695
  aggregator: oogabooga
1697
1696
  },
1698
- { opts: swrOptions }
1697
+ swrOptions
1699
1698
  );
1700
1699
  const flyResult = raw_useSingleAggregatorQuote(
1701
1700
  {
@@ -1703,7 +1702,7 @@ function useAggregatorsQuotes(args, options) {
1703
1702
  ...args,
1704
1703
  aggregator: fly
1705
1704
  },
1706
- { opts: swrOptions }
1705
+ swrOptions
1707
1706
  );
1708
1707
  const erc4626Result = raw_useSingleAggregatorQuote(
1709
1708
  {
@@ -1711,7 +1710,7 @@ function useAggregatorsQuotes(args, options) {
1711
1710
  ...args,
1712
1711
  aggregator: erc4626Deposit
1713
1712
  },
1714
- { opts: swrOptions }
1713
+ swrOptions
1715
1714
  );
1716
1715
  const kyberswapResult = raw_useSingleAggregatorQuote(
1717
1716
  {
@@ -1719,7 +1718,7 @@ function useAggregatorsQuotes(args, options) {
1719
1718
  ...args,
1720
1719
  aggregator: kyberswap
1721
1720
  },
1722
- { opts: swrOptions }
1721
+ swrOptions
1723
1722
  );
1724
1723
  const openOceanResult = raw_useSingleAggregatorQuote(
1725
1724
  {
@@ -1727,7 +1726,7 @@ function useAggregatorsQuotes(args, options) {
1727
1726
  ...args,
1728
1727
  aggregator: openOcean
1729
1728
  },
1730
- { opts: swrOptions }
1729
+ swrOptions
1731
1730
  );
1732
1731
  const haikuResult = raw_useSingleAggregatorQuote(
1733
1732
  {
@@ -1735,7 +1734,7 @@ function useAggregatorsQuotes(args, options) {
1735
1734
  ...args,
1736
1735
  aggregator: haiku
1737
1736
  },
1738
- { opts: swrOptions }
1737
+ swrOptions
1739
1738
  );
1740
1739
  const ensoResult = raw_useSingleAggregatorQuote(
1741
1740
  {
@@ -1743,7 +1742,7 @@ function useAggregatorsQuotes(args, options) {
1743
1742
  ...args,
1744
1743
  aggregator: enso
1745
1744
  },
1746
- { opts: swrOptions }
1745
+ swrOptions
1747
1746
  );
1748
1747
  const { protocol: bexProtocol } = useBexStatus();
1749
1748
  const bexResult = raw_useSingleAggregatorQuote(
@@ -1752,7 +1751,7 @@ function useAggregatorsQuotes(args, options) {
1752
1751
  ...args,
1753
1752
  aggregator: bex
1754
1753
  },
1755
- { opts: { ...swrOptions, isEnabled: bexProtocol.isPaused === false } }
1754
+ { ...swrOptions, isEnabled: bexProtocol.isPaused === false }
1756
1755
  );
1757
1756
  const wberaSwapResult = raw_useSingleAggregatorQuote({
1758
1757
  ...sharedArgs,
@@ -1765,7 +1764,7 @@ function useAggregatorsQuotes(args, options) {
1765
1764
  ...args,
1766
1765
  aggregator: bgtRedeem
1767
1766
  },
1768
- { opts: swrOptions }
1767
+ swrOptions
1769
1768
  );
1770
1769
  const honeyResult = raw_useSingleAggregatorQuote(
1771
1770
  {
@@ -1773,7 +1772,7 @@ function useAggregatorsQuotes(args, options) {
1773
1772
  ...args,
1774
1773
  aggregator: honeyNative
1775
1774
  },
1776
- { opts: swrOptions }
1775
+ swrOptions
1777
1776
  );
1778
1777
  const results = isWrapOrUnwrap ? [wberaSwapResult] : isBgtRedeem ? [bgtRedeemResult] : [
1779
1778
  oogaBogaResult,
@@ -1807,21 +1806,23 @@ function useAggregatorsQuotes(args, options) {
1807
1806
  }
1808
1807
 
1809
1808
  // src/hooks/dex/useAllUserPools.ts
1810
- import useSWR3 from "swr";
1811
1809
  var useAllUserPoolsQueryKey = ({
1812
1810
  query
1813
1811
  } = {}) => {
1814
1812
  return ["useAllUserPools", query];
1815
1813
  };
1816
1814
  var useAllUserPools = (query, options) => {
1817
- const swrResponse = useSWR3(
1815
+ const swrResponse = useSWR(
1818
1816
  useAllUserPoolsQueryKey({ query }),
1819
1817
  async ([_, params]) => {
1820
- return getAllPools({ ...params, fetchPolicy: "no-cache" });
1818
+ return getAllPools({
1819
+ ...params,
1820
+ fetchPolicy: "no-cache"
1821
+ });
1821
1822
  },
1822
1823
  {
1823
1824
  refreshInterval: 18e4 /* SLOW */,
1824
- ...options?.opts
1825
+ ...options
1825
1826
  }
1826
1827
  );
1827
1828
  return {
@@ -1833,7 +1834,6 @@ var useAllUserPools = (query, options) => {
1833
1834
  };
1834
1835
 
1835
1836
  // src/hooks/dex/useApiPool.ts
1836
- import useSWR4 from "swr";
1837
1837
  import { isAddress } from "viem";
1838
1838
  var useApiPoolQueryKey = ({
1839
1839
  poolId,
@@ -1845,7 +1845,7 @@ function useApiPool({
1845
1845
  poolId,
1846
1846
  account
1847
1847
  }) {
1848
- const res = useSWR4(
1848
+ const res = useSWR(
1849
1849
  useApiPoolQueryKey({ poolId, account }),
1850
1850
  async ([, poolId2, account2]) => {
1851
1851
  if (account2 && !isAddress(account2)) {
@@ -2150,9 +2150,8 @@ var useCreatePool = ({
2150
2150
  };
2151
2151
 
2152
2152
  // src/hooks/dex/useGlobalLiquidityAndSwapVolume.ts
2153
- import useSWR5 from "swr";
2154
2153
  var useGlobalLiquidityAndSwapVolume = () => {
2155
- const response = useSWR5(
2154
+ const response = useSWR(
2156
2155
  "useGlobalLiquidityAndSwapVolume",
2157
2156
  async () => getGlobalLiquidityAndSwapVolume()
2158
2157
  );
@@ -2280,13 +2279,11 @@ var useLiquidityMismatch = ({
2280
2279
  import { formatEther as formatEther3, isAddressEqual } from "viem";
2281
2280
 
2282
2281
  // src/hooks/pol/useRewardVaultBalanceFromStakingToken.ts
2283
- import useSWR6 from "swr";
2284
2282
  import { isAddress as isAddress3, zeroAddress as zeroAddress13 } from "viem";
2285
2283
  import { rewardVaultAbi } from "@berachain/abis/pol/rewards/rewardVault";
2286
2284
  import { useBeraWallet as useBeraWallet3, usePublicClient as usePublicClient6 } from "@berachain/wagmi/hooks";
2287
2285
 
2288
2286
  // src/hooks/pol/useRewardVaultFromToken.ts
2289
- import useSWRImmutable3 from "swr/immutable";
2290
2287
  import { isAddress as isAddress2, zeroAddress as zeroAddress12 } from "viem";
2291
2288
  import { rewardVaultFactoryAbi } from "@berachain/abis/pol/rewards/rewardVaultFactory";
2292
2289
  import { usePublicClient as usePublicClient5 } from "@berachain/wagmi/hooks";
@@ -2297,7 +2294,7 @@ var useRewardVaultFromToken = ({
2297
2294
  } = {}) => {
2298
2295
  const publicClient = usePublicClient5();
2299
2296
  const QUERY_KEY = publicClient && tokenAddress && isAddress2(tokenAddress) && isEnabled ? ["useRewardVaultFromToken", tokenAddress] : null;
2300
- const swrResponse = useSWRImmutable3(QUERY_KEY, async ([, tokenAddress2]) => {
2297
+ const swrResponse = useSWRImmutable(QUERY_KEY, async ([, tokenAddress2]) => {
2301
2298
  if (!tokenAddress2) {
2302
2299
  throw new Error("useRewardVaultFromToken needs a valid token address");
2303
2300
  }
@@ -2326,7 +2323,7 @@ var useRewardVaultBalanceFromStakingToken = ({
2326
2323
  }, options) => {
2327
2324
  const { address: account } = useBeraWallet3();
2328
2325
  const publicClient = usePublicClient6();
2329
- const isEnabled = options?.opts?.isEnabled ?? true;
2326
+ const isEnabled = options?.isEnabled ?? true;
2330
2327
  const {
2331
2328
  data: rewardVaultAddress = _rewardVaultAddress,
2332
2329
  error,
@@ -2340,8 +2337,8 @@ var useRewardVaultBalanceFromStakingToken = ({
2340
2337
  isEnabled: !_rewardVaultAddress && isEnabled
2341
2338
  }
2342
2339
  );
2343
- const swrResponse = useSWR6(
2344
- rewardVaultAddress && account && publicClient && isAddress3(rewardVaultAddress) && isAddress3(account) && isEnabled ? ["useVaultBalanceFromStakingToken", rewardVaultAddress, account] : null,
2340
+ const swrResponse = useSWR(
2341
+ rewardVaultAddress && account && publicClient && isAddress3(rewardVaultAddress) && isAddress3(account) ? ["useVaultBalanceFromStakingToken", rewardVaultAddress, account] : null,
2345
2342
  async ([, rewardVaultAddress2, account2]) => {
2346
2343
  assertPublicClient(publicClient);
2347
2344
  if (rewardVaultAddress2 === zeroAddress13) {
@@ -2360,7 +2357,8 @@ var useRewardVaultBalanceFromStakingToken = ({
2360
2357
  address: rewardVaultAddress2,
2361
2358
  balance
2362
2359
  };
2363
- }
2360
+ },
2361
+ options
2364
2362
  );
2365
2363
  return {
2366
2364
  ...swrResponse,
@@ -2373,7 +2371,6 @@ var useRewardVaultBalanceFromStakingToken = ({
2373
2371
  };
2374
2372
 
2375
2373
  // src/hooks/tokens/usePollBalance.ts
2376
- import useSWR7 from "swr";
2377
2374
  import {
2378
2375
  erc20Abi,
2379
2376
  formatEther as formatEther2,
@@ -2385,7 +2382,6 @@ import { defaultChainId as defaultChainId3 } from "@berachain/config/internal";
2385
2382
  import { useBeraWallet as useBeraWallet4, usePublicClient as usePublicClient8 } from "@berachain/wagmi/hooks";
2386
2383
 
2387
2384
  // src/hooks/tokens/useTokenInformation.ts
2388
- import useSWRImmutable4 from "swr/immutable";
2389
2385
  import { isAddress as isAddress4, zeroAddress as zeroAddress14 } from "viem";
2390
2386
  import { defaultChainId as defaultChainId2 } from "@berachain/config/internal";
2391
2387
  import { usePublicClient as usePublicClient7 } from "@berachain/wagmi/hooks";
@@ -2394,7 +2390,7 @@ function useTokenInformation(args, options) {
2394
2390
  chainId: args.chainId
2395
2391
  });
2396
2392
  const QUERY_KEY = args?.address && publicClient && isAddress4(args.address) ? ["useTokenInformation", args.address, args.chainId] : null;
2397
- const swrResponse = useSWRImmutable4(
2393
+ const swrResponse = useSWRImmutable(
2398
2394
  QUERY_KEY,
2399
2395
  async ([_, address, chainId2 = defaultChainId2]) => {
2400
2396
  if (isToken(address, "BERA")) {
@@ -2413,7 +2409,7 @@ function useTokenInformation(args, options) {
2413
2409
  chainId: chainId2
2414
2410
  });
2415
2411
  },
2416
- { ...options?.opts }
2412
+ { ...options }
2417
2413
  );
2418
2414
  return {
2419
2415
  ...swrResponse,
@@ -2434,10 +2430,10 @@ function usePollBalance({
2434
2430
  const publicClient = usePublicClient8({ chainId: chainId2 });
2435
2431
  const { address: account } = useBeraWallet4();
2436
2432
  const assetOwner = owner ?? account;
2437
- const QUERY_KEY = (options?.opts?.isEnabled ?? true) && publicClient && assetOwner && isAddress5(assetOwner) && address && isAddress5(address) ? ["usePollBalance", assetOwner, address, chainId2] : null;
2433
+ const QUERY_KEY = publicClient && assetOwner && isAddress5(assetOwner) && address && isAddress5(address) ? ["usePollBalance", assetOwner, address, chainId2] : null;
2438
2434
  const { data: tokenInformation, isLoading: isLoadingTokenInformation } = useTokenInformation({ address, chainId: chainId2 });
2439
2435
  const isNativeToken = isToken(address, "BERA");
2440
- const { isLoading, data, error, ...rest } = useSWR7(
2436
+ const { isLoading, data, error, ...rest } = useSWR(
2441
2437
  QUERY_KEY,
2442
2438
  async ([, assetOwner2, address2]) => {
2443
2439
  assertPublicClient(publicClient);
@@ -2454,7 +2450,8 @@ function usePollBalance({
2454
2450
  });
2455
2451
  },
2456
2452
  {
2457
- refreshInterval: 1e4 /* FAST */
2453
+ refreshInterval: 1e4 /* FAST */,
2454
+ ...options
2458
2455
  }
2459
2456
  );
2460
2457
  const formattedBalance = !error && data ? isToken(address, "BERA") ? formatEther2(data) : tokenInformation && !isLoadingTokenInformation ? formatUnits5(data, tokenInformation.decimals) : void 0 : void 0;
@@ -2547,13 +2544,12 @@ import { useMemo as useMemo3 } from "react";
2547
2544
  import { parseUnits as parseUnits4, zeroAddress as zeroAddress16 } from "viem";
2548
2545
 
2549
2546
  // src/hooks/tokens/usePollAllowances.ts
2550
- import useSWR8 from "swr";
2551
2547
  import { useBeraWallet as useBeraWallet5, useConfig as useConfig2 } from "@berachain/wagmi/hooks";
2552
2548
  function usePollAllowances(args, options) {
2553
2549
  const config = useConfig2();
2554
2550
  const { address: account } = useBeraWallet5();
2555
2551
  const QUERY_KEY = config && account && args?.items ? ["usePollAllowances", account, args?.items] : null;
2556
- const swrResponse = useSWR8(
2552
+ const swrResponse = useSWR(
2557
2553
  QUERY_KEY,
2558
2554
  async ([, account2, items]) => {
2559
2555
  return getAllowances({
@@ -2563,8 +2559,8 @@ function usePollAllowances(args, options) {
2563
2559
  });
2564
2560
  },
2565
2561
  {
2566
- ...options?.opts,
2567
- refreshInterval: options?.opts?.refreshInterval ?? 1e5 /* NORMAL */
2562
+ ...options,
2563
+ refreshInterval: options?.refreshInterval ?? 1e5 /* NORMAL */
2568
2564
  }
2569
2565
  );
2570
2566
  return {
@@ -2638,12 +2634,10 @@ function useMultipleTokenApprovalsWithSlippage(tokenInput, options) {
2638
2634
 
2639
2635
  // src/hooks/dex/useOnChainPoolData.ts
2640
2636
  import { useMemo as useMemo5 } from "react";
2641
- import useSWRImmutable6 from "swr/immutable";
2642
2637
  import { formatUnits as formatUnits6, isAddress as isAddress8 } from "viem";
2643
2638
  import { usePublicClient as usePublicClient10 } from "@berachain/wagmi/hooks";
2644
2639
 
2645
2640
  // src/hooks/tokens/useMultipleTokenInformation.ts
2646
- import useSWRImmutable5 from "swr/immutable";
2647
2641
  import { isAddress as isAddress6 } from "viem";
2648
2642
  import { defaultChainId as defaultChainId4 } from "@berachain/config/internal";
2649
2643
  import { usePublicClient as usePublicClient9 } from "@berachain/wagmi/hooks";
@@ -2654,7 +2648,7 @@ function useMultipleTokenInformation(args, options) {
2654
2648
  args.addresses,
2655
2649
  args.chainId ?? defaultChainId4
2656
2650
  ] : null;
2657
- const swrResponse = useSWRImmutable5(
2651
+ const swrResponse = useSWRImmutable(
2658
2652
  QUERY_KEY,
2659
2653
  async ([, addresses, chainId2]) => {
2660
2654
  assertPublicClient(publicClient);
@@ -2675,7 +2669,7 @@ function useMultipleTokenInformation(args, options) {
2675
2669
  })
2676
2670
  );
2677
2671
  },
2678
- { ...options?.opts }
2672
+ { ...options }
2679
2673
  );
2680
2674
  return {
2681
2675
  ...swrResponse,
@@ -2685,7 +2679,6 @@ function useMultipleTokenInformation(args, options) {
2685
2679
 
2686
2680
  // src/hooks/tokens/useTokenCurrentPrices.ts
2687
2681
  import { useMemo as useMemo4 } from "react";
2688
- import useSWR9 from "swr";
2689
2682
  import { isAddress as isAddress7, zeroAddress as zeroAddress17 } from "viem";
2690
2683
  import { defaultChainId as defaultChainId5 } from "@berachain/config/internal";
2691
2684
 
@@ -2716,10 +2709,8 @@ function useTokens() {
2716
2709
  function useTokenCurrentPrices({
2717
2710
  addressIn
2718
2711
  } = {}, options = {
2719
- opts: {
2720
- refreshInterval: 1e5 /* NORMAL */,
2721
- revalidateOnFocus: true
2722
- }
2712
+ refreshInterval: 1e5 /* NORMAL */,
2713
+ revalidateOnFocus: true
2723
2714
  }) {
2724
2715
  const { tokenList, ensoTokens } = useTokens();
2725
2716
  const beraAddresses = useMemo4(() => {
@@ -2741,16 +2732,16 @@ function useTokenCurrentPrices({
2741
2732
  return beraAddresses?.some((a) => !tokenSet.has(a));
2742
2733
  }, [beraAddresses, tokenList]);
2743
2734
  const addresses = hasAddressesNotInTokenList ? beraAddresses : tokenList.map((token) => token.address);
2744
- const QUERY_KEY = addresses && (options.opts?.isEnabled ?? true) ? [
2735
+ const QUERY_KEY = addresses ? [
2745
2736
  "useTokenCurrentPrices",
2746
2737
  addresses.map((a) => a.toLowerCase())
2747
2738
  ] : null;
2748
- const apiResponse = useSWR9(
2739
+ const apiResponse = useSWR(
2749
2740
  QUERY_KEY,
2750
2741
  async ([, addresses2]) => {
2751
2742
  return getTokenCurrentPrices({ addressIn: addresses2 });
2752
2743
  },
2753
- options.opts
2744
+ options
2754
2745
  );
2755
2746
  const ensoMatchingPrices = useMemo4(() => {
2756
2747
  if (!ensoTokens) return {};
@@ -2811,7 +2802,7 @@ function useOnChainPoolData(poolId) {
2811
2802
  error,
2812
2803
  isLoading,
2813
2804
  mutate
2814
- } = useSWRImmutable6(
2805
+ } = useSWRImmutable(
2815
2806
  // FIXME: why are we using useSWRImmutable when we fetch tokenSupply and swapFee?
2816
2807
  publicClient ? QUERY_KEY : null,
2817
2808
  async ([, poolId2]) => {
@@ -2885,7 +2876,6 @@ function useOnChainPoolData(poolId) {
2885
2876
  }
2886
2877
 
2887
2878
  // src/hooks/dex/usePollPoolCreationRelayerApproval.ts
2888
- import useSWR10 from "swr";
2889
2879
  import { vaultAbi as balancerVaultAbi2 } from "@berachain/abis/bex/vault";
2890
2880
  import { useBeraWallet as useBeraWallet6, usePublicClient as usePublicClient11 } from "@berachain/wagmi/hooks";
2891
2881
  var usePollPoolCreationRelayerApproval = (options) => {
@@ -2896,7 +2886,7 @@ var usePollPoolCreationRelayerApproval = (options) => {
2896
2886
  account,
2897
2887
  publicClient.chain.id
2898
2888
  ] : null;
2899
- const swrResponse = useSWR10(
2889
+ const swrResponse = useSWR(
2900
2890
  QUERY_KEY,
2901
2891
  async ([, account2]) => {
2902
2892
  assertPublicClient(publicClient);
@@ -2909,7 +2899,7 @@ var usePollPoolCreationRelayerApproval = (options) => {
2909
2899
  });
2910
2900
  return approved;
2911
2901
  },
2912
- { ...options?.opts }
2902
+ { ...options }
2913
2903
  );
2914
2904
  const refreshPoolCreationApproval = () => {
2915
2905
  swrResponse.mutate();
@@ -2938,12 +2928,11 @@ function usePool({ poolId }) {
2938
2928
  }
2939
2929
 
2940
2930
  // src/hooks/dex/usePoolEvents.ts
2941
- import useSWRImmutable7 from "swr/immutable";
2942
2931
  var usePoolEvents = ({
2943
2932
  poolId,
2944
2933
  typeInArray
2945
2934
  }) => {
2946
- return useSWRImmutable7(
2935
+ return useSWRImmutable(
2947
2936
  poolId ? ["usePoolEvents", poolId, typeInArray] : null,
2948
2937
  async ([, poolId2, typeInArray2]) => getPoolEvents({ poolId: poolId2, typeInArray: typeInArray2 }),
2949
2938
  {
@@ -2953,11 +2942,10 @@ var usePoolEvents = ({
2953
2942
  };
2954
2943
 
2955
2944
  // src/hooks/dex/usePoolHistoricalData.ts
2956
- import useSWR11 from "swr";
2957
2945
  var usePoolHistoricalData = ({ poolId, ...baseArgs }, options) => {
2958
2946
  const { config } = parseBaseArgs(baseArgs);
2959
2947
  const QUERY_KEY = poolId ? ["usePoolHistoricalData", poolId] : null;
2960
- const swrResponse = useSWR11(
2948
+ const swrResponse = useSWR(
2961
2949
  QUERY_KEY,
2962
2950
  async ([, poolId2]) => {
2963
2951
  return getPoolHistoricalData({
@@ -2965,7 +2953,7 @@ var usePoolHistoricalData = ({ poolId, ...baseArgs }, options) => {
2965
2953
  chain: config.bex.chainName
2966
2954
  });
2967
2955
  },
2968
- options?.opts
2956
+ options
2969
2957
  );
2970
2958
  return {
2971
2959
  ...swrResponse,
@@ -2975,7 +2963,6 @@ var usePoolHistoricalData = ({ poolId, ...baseArgs }, options) => {
2975
2963
 
2976
2964
  // src/hooks/dex/usePools.ts
2977
2965
  import { useMemo as useMemo6 } from "react";
2978
- import useSWR12 from "swr";
2979
2966
  import { useBeraWallet as useBeraWallet7 } from "@berachain/wagmi/hooks";
2980
2967
  var usePoolsQueryKey = ({
2981
2968
  query
@@ -2995,15 +2982,16 @@ var usePools = (query, options) => {
2995
2982
  const {
2996
2983
  data: pools,
2997
2984
  isLoading: isPoolsLoading,
2998
- mutate: mutatePools
2999
- } = useSWR12(
2985
+ mutate: mutatePools,
2986
+ error: poolsError
2987
+ } = useSWR(
3000
2988
  usePoolsQueryKey({ query }),
3001
2989
  async ([_, query2]) => {
3002
2990
  return getAllPools(query2);
3003
2991
  },
3004
2992
  {
3005
2993
  refreshInterval: 18e4 /* SLOW */,
3006
- ...options?.opts
2994
+ ...options
3007
2995
  }
3008
2996
  );
3009
2997
  const mergedPools = useMemo6(() => {
@@ -3027,6 +3015,7 @@ var usePools = (query, options) => {
3027
3015
  pools: mergedPools ?? [],
3028
3016
  walletPools: pools?.pools ?? [],
3029
3017
  isLoading: isPoolsLoading || isUserPoolsLoading,
3018
+ error: poolsError,
3030
3019
  refresh: () => {
3031
3020
  mutatePools();
3032
3021
  mutateUserPools();
@@ -3044,10 +3033,8 @@ import { defaultChainId as defaultChainId6 } from "@berachain/config/internal";
3044
3033
  function useTokenPrices({
3045
3034
  tokens
3046
3035
  } = {}, options = {
3047
- opts: {
3048
- refreshInterval: 1e5 /* NORMAL */,
3049
- revalidateOnFocus: true
3050
- }
3036
+ refreshInterval: 1e5 /* NORMAL */,
3037
+ revalidateOnFocus: true
3051
3038
  }) {
3052
3039
  const { ensoTokens } = useTokens();
3053
3040
  const apiResponse = useTokenCurrentPrices(
@@ -3118,6 +3105,7 @@ function useTokenPrices({
3118
3105
  );
3119
3106
  return {
3120
3107
  isLoading: apiResponse.isLoading,
3108
+ error: apiResponse.error,
3121
3109
  data,
3122
3110
  priceMap,
3123
3111
  getTokenPrice
@@ -3161,7 +3149,6 @@ function usePriceImpact({
3161
3149
  }
3162
3150
 
3163
3151
  // src/hooks/enso/useBendDemultiply.ts
3164
- import useSWR15 from "swr";
3165
3152
  import { parseUnits as parseUnits5 } from "viem";
3166
3153
  import { defaultChainId as defaultChainId7 } from "@berachain/config/internal";
3167
3154
  import {
@@ -3598,7 +3585,6 @@ async function getBendDemultiplyBundle({
3598
3585
  }
3599
3586
 
3600
3587
  // src/hooks/enso/useEnsoWalletV2Address.ts
3601
- import useSWR13 from "swr";
3602
3588
  import { getAddress as getAddress3 } from "viem";
3603
3589
  import { useBeraWallet as useBeraWallet8, usePublicClient as usePublicClient12 } from "@berachain/wagmi/hooks";
3604
3590
  function useEnsoWalletV2Address({ chainId: chainId2 }) {
@@ -3607,7 +3593,7 @@ function useEnsoWalletV2Address({ chainId: chainId2 }) {
3607
3593
  const { config } = parseBaseArgs({});
3608
3594
  const ensoWalletV2Factory = config.enso.walletV2Factory;
3609
3595
  const QUERY_KEY = fromAddress && ensoWalletV2Factory ? ["useEnsoWalletV2Address", fromAddress, ensoWalletV2Factory] : null;
3610
- return useSWR13(
3596
+ return useSWR(
3611
3597
  QUERY_KEY,
3612
3598
  async ([_, accountAddress, factory]) => {
3613
3599
  assertPublicClient(publicClient);
@@ -3622,7 +3608,6 @@ function useEnsoWalletV2Address({ chainId: chainId2 }) {
3622
3608
  }
3623
3609
 
3624
3610
  // src/hooks/enso/useIsBendAuthorized.ts
3625
- import useSWR14 from "swr";
3626
3611
  import { useBeraWallet as useBeraWallet9, usePublicClient as usePublicClient13 } from "@berachain/wagmi/hooks";
3627
3612
  function useIsBendAuthorized({
3628
3613
  chainId: chainId2,
@@ -3637,7 +3622,7 @@ function useIsBendAuthorized({
3637
3622
  primaryAddress,
3638
3623
  ensoWalletV2Address
3639
3624
  ] : null;
3640
- return useSWR14(
3625
+ return useSWR(
3641
3626
  QUERY_KEY,
3642
3627
  async ([_, accountAddress, primaryAddress2, ensoWalletV2Address2]) => {
3643
3628
  assertPublicClient(publicClient);
@@ -3680,7 +3665,7 @@ function useBendDemultiply({
3680
3665
  const proxyAggregatorsThroughVercel = useBeraFlag(
3681
3666
  "proxyAggregatorsThroughVercel"
3682
3667
  );
3683
- const QUERY_KEY = collateralToken && loanToken && marketId && primaryAddress && repayAmount && ensoWalletV2Address && isAuthorized !== void 0 && collateralToken.address !== loanToken.address && Number(repayAmount) > 0 && slippage !== void 0 && collateralPriceInLoanAsset !== void 0 && currentCollateral && currentDebt && Number(currentDebt) > 0 && fromAddress && (options?.opts?.isEnabled ?? true) ? [
3668
+ const QUERY_KEY = collateralToken && loanToken && marketId && primaryAddress && repayAmount && ensoWalletV2Address && isAuthorized !== void 0 && collateralToken.address !== loanToken.address && Number(repayAmount) > 0 && slippage !== void 0 && collateralPriceInLoanAsset !== void 0 && currentCollateral && currentDebt && Number(currentDebt) > 0 && fromAddress ? [
3684
3669
  "useBendDemultiply",
3685
3670
  fromAddress,
3686
3671
  collateralToken,
@@ -3697,7 +3682,7 @@ function useBendDemultiply({
3697
3682
  isAuthorized,
3698
3683
  proxyAggregatorsThroughVercel ?? false
3699
3684
  ] : null;
3700
- return useSWR15(
3685
+ return useSWR(
3701
3686
  QUERY_KEY,
3702
3687
  async ([
3703
3688
  _,
@@ -3750,14 +3735,13 @@ function useBendDemultiply({
3750
3735
  });
3751
3736
  },
3752
3737
  {
3753
- ...options?.opts,
3738
+ ...options,
3754
3739
  refreshInterval: 1e5 /* NORMAL */
3755
3740
  }
3756
3741
  );
3757
3742
  }
3758
3743
 
3759
3744
  // src/hooks/enso/useBendMultiply.ts
3760
- import useSWR16 from "swr";
3761
3745
  import { parseUnits as parseUnits6 } from "viem";
3762
3746
  import { defaultChainId as defaultChainId8 } from "@berachain/config/internal";
3763
3747
  import {
@@ -4027,7 +4011,7 @@ function useBendMultiply({
4027
4011
  const proxyAggregatorsThroughVercel = useBeraFlag(
4028
4012
  "proxyAggregatorsThroughVercel"
4029
4013
  );
4030
- const QUERY_KEY = collateralToken && loanToken && marketId && primaryAddress && ensoWalletV2Address && isAuthorized !== void 0 && collateralToken.address !== loanToken.address && slippage !== void 0 && leverageMultiplier !== void 0 && formattedCollateralPriceInLoanAsset !== void 0 && (Number(formattedSupplyCollateralAmount ?? 0) > 0 || leverageMultiplier > 1 && (Number(formattedCurrentCollateralAmount ?? 0) > 0 || Number(formattedSupplyCollateralAmount ?? 0) > 0)) && fromAddress && (options?.opts?.isEnabled ?? true) ? [
4014
+ const QUERY_KEY = collateralToken && loanToken && marketId && primaryAddress && ensoWalletV2Address && isAuthorized !== void 0 && collateralToken.address !== loanToken.address && slippage !== void 0 && leverageMultiplier !== void 0 && formattedCollateralPriceInLoanAsset !== void 0 && (Number(formattedSupplyCollateralAmount ?? 0) > 0 || leverageMultiplier > 1 && (Number(formattedCurrentCollateralAmount ?? 0) > 0 || Number(formattedSupplyCollateralAmount ?? 0) > 0)) && fromAddress ? [
4031
4015
  "useBendMultiply",
4032
4016
  fromAddress,
4033
4017
  collateralToken,
@@ -4045,7 +4029,7 @@ function useBendMultiply({
4045
4029
  isAuthorized,
4046
4030
  proxyAggregatorsThroughVercel ?? false
4047
4031
  ] : null;
4048
- return useSWR16(
4032
+ return useSWR(
4049
4033
  QUERY_KEY,
4050
4034
  async ([
4051
4035
  _,
@@ -4100,14 +4084,13 @@ function useBendMultiply({
4100
4084
  });
4101
4085
  },
4102
4086
  {
4103
- ...options?.opts,
4087
+ ...options,
4104
4088
  refreshInterval: 1e5 /* NORMAL */
4105
4089
  }
4106
4090
  );
4107
4091
  }
4108
4092
 
4109
4093
  // src/hooks/enso/useBendZapSupply.ts
4110
- import useSWR17 from "swr";
4111
4094
  import { formatEther as formatEther4, parseUnits as parseUnits7, zeroAddress as zeroAddress20 } from "viem";
4112
4095
  import { defaultChainId as berachainChainId } from "@berachain/config/internal";
4113
4096
  import { useBeraWallet as useBeraWallet12, usePublicClient as usePublicClient16 } from "@berachain/wagmi/hooks";
@@ -4299,7 +4282,7 @@ function useBendZapSupply({
4299
4282
  address: zeroAddress20,
4300
4283
  chainId: isCrossChain ? tokenIn?.chainId : void 0
4301
4284
  },
4302
- { opts: { isEnabled: !!isCrossChain } }
4285
+ { isEnabled: !!isCrossChain }
4303
4286
  );
4304
4287
  const transactionValue = swrResponse.data?.getCalldata?.({ account: zeroAddress20 })?.value ?? 0n;
4305
4288
  const nativeBalance = nativeBalanceData?.balance ?? {
@@ -4335,7 +4318,7 @@ function useBendZapSupplyHelper({
4335
4318
  const proxyAggregatorsThroughVercel = useBeraFlag(
4336
4319
  "proxyAggregatorsThroughVercel"
4337
4320
  );
4338
- const isEnabled = (options?.opts?.isEnabled ?? true) && !!tokenIn && !!loanToken && !!bendVault && !!amount && !!fromAddress && !isToken(loanToken.address, tokenIn.address) && tokenIn.chainId && Number(amount) > 0 && !!slippage;
4321
+ const isEnabled = !!tokenIn && !!loanToken && !!bendVault && !!amount && !!fromAddress && !isToken(loanToken.address, tokenIn.address) && tokenIn.chainId && Number(amount) > 0 && !!slippage;
4339
4322
  const publicClientBeraChain = usePublicClient16();
4340
4323
  const QUERY_KEY = isEnabled ? [
4341
4324
  "useBendZapSupply",
@@ -4348,7 +4331,7 @@ function useBendZapSupplyHelper({
4348
4331
  slippage,
4349
4332
  proxyAggregatorsThroughVercel ?? false
4350
4333
  ] : null;
4351
- return useSWR17(
4334
+ return useSWR(
4352
4335
  QUERY_KEY,
4353
4336
  async ([
4354
4337
  ,
@@ -4376,7 +4359,7 @@ function useBendZapSupplyHelper({
4376
4359
  });
4377
4360
  },
4378
4361
  {
4379
- ...options?.opts,
4362
+ ...options,
4380
4363
  refreshInterval: 1e5 /* NORMAL */
4381
4364
  }
4382
4365
  );
@@ -4384,7 +4367,6 @@ function useBendZapSupplyHelper({
4384
4367
 
4385
4368
  // src/hooks/enso/useEnsoSwapBundle.ts
4386
4369
  import { getPublicClient as getPublicClient2 } from "@wagmi/core";
4387
- import useSWR19 from "swr";
4388
4370
  import { parseUnits as parseUnits8 } from "viem";
4389
4371
  import { defaultChainId as berachainChainId2 } from "@berachain/config/internal";
4390
4372
  import { useBeraWallet as useBeraWallet14, useConfig as useConfig4 } from "@berachain/wagmi/hooks";
@@ -4455,7 +4437,6 @@ async function getEnsoSwapBundle({
4455
4437
 
4456
4438
  // src/hooks/tokens/usePollWalletBalances.ts
4457
4439
  import { useMemo as useMemo9 } from "react";
4458
- import useSWR18 from "swr";
4459
4440
  import {
4460
4441
  useBeraWallet as useBeraWallet13,
4461
4442
  useConfig as useConfig3,
@@ -4478,7 +4459,7 @@ function usePollWalletBalances(args, options) {
4478
4459
  // TODO: adding the whole list to the query is very inefficient, we should only add the tokens addresses
4479
4460
  Array.from(tokens.values())
4480
4461
  ] : null;
4481
- const swrResponse = useSWR18(
4462
+ const swrResponse = useSWR(
4482
4463
  QUERY_KEY,
4483
4464
  async ([, wallet2, tokenList2]) => {
4484
4465
  return getWalletBalances({
@@ -4489,7 +4470,7 @@ function usePollWalletBalances(args, options) {
4489
4470
  },
4490
4471
  {
4491
4472
  refreshInterval: 1e5 /* NORMAL */,
4492
- ...options?.opts
4473
+ ...options
4493
4474
  }
4494
4475
  );
4495
4476
  return {
@@ -4527,7 +4508,7 @@ function useEnsoSwapBundle({
4527
4508
  slippage,
4528
4509
  proxyAggregatorsThroughVercel ?? false
4529
4510
  ] : null;
4530
- const swrResponse = useSWR19(
4511
+ const swrResponse = useSWR(
4531
4512
  QUERY_KEY,
4532
4513
  async ([, fromAddress2, tokenIn2, tokenOut2, amount2, slippage2]) => {
4533
4514
  assertAddress(fromAddress2, "fromAddress");
@@ -4568,7 +4549,6 @@ function useEnsoSwapBundle({
4568
4549
  }
4569
4550
 
4570
4551
  // src/hooks/enso/useZapStakeBera.ts
4571
- import useSWR20 from "swr";
4572
4552
  import { formatUnits as formatUnits9, parseUnits as parseUnits9 } from "viem";
4573
4553
  import { chainConfigs, defaultChainId as defaultChainId9 } from "@berachain/config/internal";
4574
4554
  import { useBeraWallet as useBeraWallet15 } from "@berachain/wagmi/hooks";
@@ -4591,7 +4571,7 @@ function useZapStakeBera({
4591
4571
  underlyingToken,
4592
4572
  tokenOut
4593
4573
  ] : null;
4594
- const swrResponse = useSWR20(
4574
+ const swrResponse = useSWR(
4595
4575
  QUERY_KEY,
4596
4576
  async ([
4597
4577
  ,
@@ -4613,7 +4593,7 @@ function useZapStakeBera({
4613
4593
  });
4614
4594
  },
4615
4595
  {
4616
- ...options?.opts,
4596
+ ...options,
4617
4597
  refreshInterval: 1e5 /* NORMAL */
4618
4598
  }
4619
4599
  );
@@ -4640,20 +4620,22 @@ function useZapStakeBera({
4640
4620
  }
4641
4621
 
4642
4622
  // src/hooks/honey/useCappedGlobally.ts
4643
- import useSWR22 from "swr";
4644
4623
  import { usePublicClient as usePublicClient18 } from "@berachain/wagmi/hooks";
4645
4624
 
4646
4625
  // src/hooks/honey/usePythLatestPrices.ts
4647
- import useSWR21 from "swr";
4648
4626
  function usePythLatestPrices({
4649
4627
  priceFeedMap
4650
4628
  }, options) {
4651
4629
  const priceFeedIds = priceFeedMap ? Object.values(priceFeedMap) : null;
4652
- const QUERY_KEY = (options?.opts?.isEnabled ?? true) && priceFeedIds ? ["usePythLatestPrices", priceFeedIds] : null;
4653
- const swrResponse = useSWR21(QUERY_KEY, async ([_, priceFeeds]) => {
4654
- const data = await getPythLatestPrices({ priceFeedId: priceFeeds });
4655
- return data;
4656
- });
4630
+ const QUERY_KEY = priceFeedIds ? ["usePythLatestPrices", priceFeedIds] : null;
4631
+ const swrResponse = useSWR(
4632
+ QUERY_KEY,
4633
+ async ([_, priceFeeds]) => {
4634
+ const data = await getPythLatestPrices({ priceFeedId: priceFeeds });
4635
+ return data;
4636
+ },
4637
+ options
4638
+ );
4657
4639
  return swrResponse;
4658
4640
  }
4659
4641
 
@@ -4671,9 +4653,7 @@ var useCappedGlobally = ({
4671
4653
  priceFeedMap: asset?.address && priceFeedMap ? { [asset.address]: priceFeedMap[asset.address] } : void 0
4672
4654
  },
4673
4655
  {
4674
- opts: {
4675
- isEnabled: flags.isPythWrapperEnabled && !!asset?.address
4676
- }
4656
+ isEnabled: flags.isPythWrapperEnabled && !!asset?.address
4677
4657
  }
4678
4658
  );
4679
4659
  const QUERY_KEY = amount && asset && (flags.isPythWrapperEnabled && !!latestPrices?.prices.length || !flags.isPythWrapperEnabled) ? [
@@ -4684,7 +4664,7 @@ var useCappedGlobally = ({
4684
4664
  flags.isPythWrapperEnabled,
4685
4665
  isBasketModeEnabled2
4686
4666
  ] : null;
4687
- const swrResponse = useSWR22(
4667
+ const swrResponse = useSWR(
4688
4668
  QUERY_KEY,
4689
4669
  async ([
4690
4670
  _,
@@ -4708,7 +4688,7 @@ var useCappedGlobally = ({
4708
4688
  });
4709
4689
  },
4710
4690
  {
4711
- ...options?.opts,
4691
+ ...options,
4712
4692
  refreshInterval: 0
4713
4693
  }
4714
4694
  );
@@ -4719,7 +4699,6 @@ var useCappedGlobally = ({
4719
4699
  };
4720
4700
 
4721
4701
  // src/hooks/honey/useCappedRelatively.ts
4722
- import useSWR23 from "swr";
4723
4702
  import { usePublicClient as usePublicClient19 } from "@berachain/wagmi/hooks";
4724
4703
  var useCappedRelatively = ({
4725
4704
  asset,
@@ -4736,7 +4715,7 @@ var useCappedRelatively = ({
4736
4715
  collateralList,
4737
4716
  referenceCollateral
4738
4717
  ] : null;
4739
- const swrResponse = useSWR23(
4718
+ const swrResponse = useSWR(
4740
4719
  QUERY_KEY,
4741
4720
  async ([_, asset2, amount2, collaterals, referenceCollateral2]) => {
4742
4721
  if (isBasketModeEnabled2) {
@@ -4771,7 +4750,7 @@ var useCappedRelatively = ({
4771
4750
  },
4772
4751
  {
4773
4752
  refreshInterval: 0,
4774
- ...options?.opts
4753
+ ...options
4775
4754
  }
4776
4755
  );
4777
4756
  return {
@@ -4781,14 +4760,13 @@ var useCappedRelatively = ({
4781
4760
  };
4782
4761
 
4783
4762
  // src/hooks/honey/useCollateralWeights.ts
4784
- import useSWR24 from "swr";
4785
4763
  import { usePublicClient as usePublicClient20 } from "@berachain/wagmi/hooks";
4786
4764
  var useCollateralWeights = ({
4787
4765
  collateralList
4788
4766
  }, options) => {
4789
4767
  const publicClient = usePublicClient20();
4790
4768
  const QUERY_KEY = publicClient && collateralList ? ["useCollateralWeights", collateralList] : void 0;
4791
- const swrResponse = useSWR24(
4769
+ const swrResponse = useSWR(
4792
4770
  QUERY_KEY,
4793
4771
  async ([_, collateralList2]) => {
4794
4772
  assertPublicClient(publicClient);
@@ -4798,8 +4776,8 @@ var useCollateralWeights = ({
4798
4776
  });
4799
4777
  },
4800
4778
  {
4801
- ...options?.opts,
4802
- refreshInterval: options?.opts?.refreshInterval ?? 1e5 /* NORMAL */
4779
+ ...options,
4780
+ refreshInterval: options?.refreshInterval ?? 1e5 /* NORMAL */
4803
4781
  }
4804
4782
  );
4805
4783
  return {
@@ -4809,9 +4787,8 @@ var useCollateralWeights = ({
4809
4787
  };
4810
4788
 
4811
4789
  // src/hooks/honey/useHoney24hVolume.ts
4812
- import useSWR25 from "swr";
4813
4790
  function useHoney24hVolume() {
4814
- const response = useSWR25(["useHoney24hVolume"], () => getHoney24hVolume(), {
4791
+ const response = useSWR(["useHoney24hVolume"], () => getHoney24hVolume(), {
4815
4792
  refreshInterval: 18e4 /* SLOW */
4816
4793
  });
4817
4794
  return {
@@ -4824,7 +4801,6 @@ function useHoney24hVolume() {
4824
4801
  import { useMemo as useMemo10 } from "react";
4825
4802
 
4826
4803
  // src/hooks/honey/useHoneyBalances.ts
4827
- import useSWR26 from "swr";
4828
4804
  import {
4829
4805
  useBeraWallet as useBeraWallet16,
4830
4806
  useConfig as useConfig5,
@@ -4836,7 +4812,7 @@ var useHoneyBalances = () => {
4836
4812
  const { collateralList } = useHoneyConfig();
4837
4813
  const wagmiConfig = useConfig5();
4838
4814
  const QUERY_KEY = account && collateralList && publicClient ? ["useHoneyBalances", account, collateralList] : null;
4839
- const swrResponse = useSWR26(
4815
+ const swrResponse = useSWR(
4840
4816
  QUERY_KEY,
4841
4817
  async ([_, account2, collateralList2]) => {
4842
4818
  assertPublicClient(publicClient);
@@ -4866,13 +4842,12 @@ var useHoneyBalances = () => {
4866
4842
  };
4867
4843
 
4868
4844
  // src/hooks/honey/useHoneyVaultsBalance.ts
4869
- import useSWR27 from "swr";
4870
4845
  import { usePublicClient as usePublicClient22 } from "@berachain/wagmi/hooks";
4871
4846
  var useHoneyVaultsBalance = (options) => {
4872
4847
  const publicClient = usePublicClient22();
4873
4848
  const { collateralList } = useHoneyConfig();
4874
4849
  const QUERY_KEY = collateralList && publicClient ? ["useHoneyVaultsBalance", collateralList] : null;
4875
- const swrResponse = useSWR27(
4850
+ const swrResponse = useSWR(
4876
4851
  QUERY_KEY,
4877
4852
  async ([_, collateralList2]) => {
4878
4853
  assertPublicClient(publicClient);
@@ -4881,7 +4856,7 @@ var useHoneyVaultsBalance = (options) => {
4881
4856
  collateralList: collateralList2
4882
4857
  });
4883
4858
  },
4884
- { ...options?.opts, refreshInterval: 1e5 /* NORMAL */ }
4859
+ { ...options, refreshInterval: 1e5 /* NORMAL */ }
4885
4860
  );
4886
4861
  return {
4887
4862
  ...swrResponse,
@@ -4890,7 +4865,6 @@ var useHoneyVaultsBalance = (options) => {
4890
4865
  };
4891
4866
 
4892
4867
  // src/hooks/honey/useIsBadCollateralAsset.ts
4893
- import useSWR28 from "swr";
4894
4868
  import { usePublicClient as usePublicClient23 } from "@berachain/wagmi/hooks";
4895
4869
  var useIsBadCollateralAsset = ({ collateral }, options) => {
4896
4870
  const publicClient = usePublicClient23();
@@ -4902,9 +4876,7 @@ var useIsBadCollateralAsset = ({ collateral }, options) => {
4902
4876
  } : void 0
4903
4877
  },
4904
4878
  {
4905
- opts: {
4906
- isEnabled: flags.isPythWrapperEnabled && !!collateral?.address
4907
- }
4879
+ isEnabled: flags.isPythWrapperEnabled && !!collateral?.address
4908
4880
  }
4909
4881
  );
4910
4882
  const QUERY_KEY = publicClient && collateral && (flags.isPythWrapperEnabled && !!latestPrices?.prices.length || !flags.isPythWrapperEnabled) ? [
@@ -4913,7 +4885,7 @@ var useIsBadCollateralAsset = ({ collateral }, options) => {
4913
4885
  latestPrices,
4914
4886
  flags.isPythWrapperEnabled
4915
4887
  ] : null;
4916
- const swrResponse = useSWR28(
4888
+ const swrResponse = useSWR(
4917
4889
  QUERY_KEY,
4918
4890
  async ([_, collateral2, latestPrices2, isPythWrapperEnabled]) => {
4919
4891
  assertPublicClient(publicClient);
@@ -4925,8 +4897,8 @@ var useIsBadCollateralAsset = ({ collateral }, options) => {
4925
4897
  });
4926
4898
  },
4927
4899
  {
4928
- ...options?.opts,
4929
- refreshInterval: options?.opts?.refreshInterval ?? 1e5 /* NORMAL */
4900
+ ...options,
4901
+ refreshInterval: options?.refreshInterval ?? 1e5 /* NORMAL */
4930
4902
  }
4931
4903
  );
4932
4904
  return {
@@ -5113,9 +5085,8 @@ var useHoneyAlerts = ({
5113
5085
  };
5114
5086
 
5115
5087
  // src/hooks/honey/useHoneyChartData.ts
5116
- import useSWR29 from "swr";
5117
5088
  function useHoneyChartData({ days }) {
5118
- const swrResponse = useSWR29(
5089
+ const swrResponse = useSWR(
5119
5090
  ["useHoneyChartData", days],
5120
5091
  async ([_, days2]) => {
5121
5092
  return await getChartData({ days: days2 });
@@ -5133,7 +5104,6 @@ import { formatUnits as formatUnits10 } from "viem";
5133
5104
  import { defaultChainId as defaultChainId10 } from "@berachain/config/internal";
5134
5105
 
5135
5106
  // src/hooks/honey/useIsBasketModeEnabled.ts
5136
- import useSWR30 from "swr";
5137
5107
  import { usePublicClient as usePublicClient24 } from "@berachain/wagmi/hooks";
5138
5108
  function useIsBasketModeEnabled({ state }, options) {
5139
5109
  const publicClient = usePublicClient24();
@@ -5143,9 +5113,7 @@ function useIsBasketModeEnabled({ state }, options) {
5143
5113
  priceFeedMap
5144
5114
  },
5145
5115
  {
5146
- opts: {
5147
- isEnabled: flags.isPythWrapperEnabled && !!collateralList.length
5148
- }
5116
+ isEnabled: flags.isPythWrapperEnabled && !!collateralList.length
5149
5117
  }
5150
5118
  );
5151
5119
  const isMint = state.actionType === "mint";
@@ -5156,7 +5124,7 @@ function useIsBasketModeEnabled({ state }, options) {
5156
5124
  flags.isPythWrapperEnabled,
5157
5125
  collateralList
5158
5126
  ] : null;
5159
- const swrResponse = useSWR30(
5127
+ const swrResponse = useSWR(
5160
5128
  QUERY_KEY,
5161
5129
  async ([_, isMint2, latestPrices2, isPythWrapperEnabled, collateralList2]) => {
5162
5130
  assertPublicClient(publicClient);
@@ -5170,8 +5138,8 @@ function useIsBasketModeEnabled({ state }, options) {
5170
5138
  return isActive;
5171
5139
  },
5172
5140
  {
5173
- ...options?.opts,
5174
- refreshInterval: options?.opts?.refreshInterval ?? 1e4 /* FAST */
5141
+ ...options,
5142
+ refreshInterval: options?.refreshInterval ?? 1e4 /* FAST */
5175
5143
  }
5176
5144
  );
5177
5145
  return {
@@ -5317,21 +5285,24 @@ var useHoneySwapState = () => {
5317
5285
  };
5318
5286
 
5319
5287
  // src/hooks/perps/usePythUpdateFee.ts
5320
- import useSWRImmutable8 from "swr/immutable";
5321
5288
  import { usePublicClient as usePublicClient25 } from "@berachain/wagmi/hooks";
5322
5289
  var usePythUpdateFee = ({
5323
5290
  pythPriceFeedCalldata,
5324
5291
  tokenListLength
5325
5292
  }, options) => {
5326
5293
  const publicClient = usePublicClient25();
5327
- const QUERY_KEY = (options?.opts?.isEnabled ?? true) && pythPriceFeedCalldata && pythPriceFeedCalldata.length > 0 ? ["usePythUpdateFee", pythPriceFeedCalldata] : null;
5328
- const { data = getPythDefaultUpdateFee(tokenListLength), isLoading } = useSWRImmutable8(QUERY_KEY, async ([_, pythPriceFeedCalldata2]) => {
5329
- assertPublicClient(publicClient);
5330
- return getPythUpdateFee({
5331
- client: publicClient,
5332
- priceFeedId: pythPriceFeedCalldata2
5333
- });
5334
- });
5294
+ const QUERY_KEY = pythPriceFeedCalldata && pythPriceFeedCalldata.length > 0 ? ["usePythUpdateFee", pythPriceFeedCalldata] : null;
5295
+ const { data = getPythDefaultUpdateFee(tokenListLength), isLoading } = useSWRImmutable(
5296
+ QUERY_KEY,
5297
+ async ([_, pythPriceFeedCalldata2]) => {
5298
+ assertPublicClient(publicClient);
5299
+ return getPythUpdateFee({
5300
+ client: publicClient,
5301
+ priceFeedId: pythPriceFeedCalldata2
5302
+ });
5303
+ },
5304
+ options
5305
+ );
5335
5306
  return {
5336
5307
  QUERY_KEY,
5337
5308
  data,
@@ -5340,24 +5311,15 @@ var usePythUpdateFee = ({
5340
5311
  };
5341
5312
 
5342
5313
  // src/hooks/pol/useAutoclaimedIncentives.ts
5343
- import useSWR31 from "swr";
5344
5314
  import { useBeraWallet as useBeraWallet17 } from "@berachain/wagmi/hooks";
5345
5315
  function useAutoclaimedIncentives({
5346
5316
  enabled
5347
5317
  }) {
5348
5318
  const { address: account } = useBeraWallet17();
5349
5319
  const QUERY_KEY = enabled && account ? ["useAutoclaimedIncentives", account] : null;
5350
- const swrResponse = useSWR31(
5320
+ const swrResponse = useSWR(
5351
5321
  QUERY_KEY,
5352
- async ([, account2]) => {
5353
- if (!account2) {
5354
- throw new BeraError({
5355
- message: "useAutoclaimedIncentives needs a logged in account",
5356
- level: "error"
5357
- });
5358
- }
5359
- return await getAutoclaimedIncentives({ account: account2 });
5360
- },
5322
+ async ([, account2]) => getAutoclaimedIncentives({ account: account2 }),
5361
5323
  {
5362
5324
  revalidateOnFocus: false,
5363
5325
  revalidateOnReconnect: false,
@@ -5370,6 +5332,33 @@ function useAutoclaimedIncentives({
5370
5332
  };
5371
5333
  }
5372
5334
 
5335
+ // src/hooks/pol/useAutoclaimedIncentivesTxHash.ts
5336
+ import { useBeraWallet as useBeraWallet18 } from "@berachain/wagmi/hooks";
5337
+ function useAutoclaimedIncentivesTxHash({
5338
+ enabled
5339
+ }) {
5340
+ const { address: account } = useBeraWallet18();
5341
+ const QUERY_KEY = enabled && account ? ["useAutoclaimedIncentivesTxHash", account] : null;
5342
+ const swrResponse = useSWR(
5343
+ QUERY_KEY,
5344
+ async ([, account2]) => getAutoclaimedIncentivesTxHash({ account: account2 }),
5345
+ {
5346
+ // txhashes flip from absent → present as the bot processes each token,
5347
+ // so we need to actually poll. Cadence matches the bot's tx cadence
5348
+ // (minutes, not seconds) and lets the user watch pending → claimed
5349
+ // transitions without reloading the page.
5350
+ refreshInterval: 1e5 /* NORMAL */,
5351
+ revalidateOnFocus: true,
5352
+ revalidateOnReconnect: true,
5353
+ revalidateIfStale: false
5354
+ }
5355
+ );
5356
+ return {
5357
+ ...swrResponse,
5358
+ refresh: () => swrResponse?.mutate?.()
5359
+ };
5360
+ }
5361
+
5373
5362
  // src/hooks/pol/useBgtAprSimulation.ts
5374
5363
  import { useMemo as useMemo11 } from "react";
5375
5364
  function useBgtAprSimulation(args) {
@@ -5381,16 +5370,35 @@ function useBgtAprSimulation(args) {
5381
5370
  }, [args]);
5382
5371
  }
5383
5372
 
5373
+ // src/hooks/pol/useBgtIncentiveDistributorPaused.ts
5374
+ import { usePublicClient as usePublicClient26 } from "@berachain/wagmi/hooks";
5375
+ function useBgtIncentiveDistributorPaused(options) {
5376
+ const publicClient = usePublicClient26();
5377
+ const QUERY_KEY = publicClient ? ["useBgtIncentiveDistributorPaused", publicClient.chain?.id] : null;
5378
+ const swrResponse = swr_default(
5379
+ QUERY_KEY,
5380
+ async () => getBgtIncentiveDistributorPaused({ publicClient }).catch(() => false),
5381
+ {
5382
+ revalidateOnFocus: false,
5383
+ revalidateOnReconnect: false,
5384
+ ...options
5385
+ }
5386
+ );
5387
+ return {
5388
+ ...swrResponse,
5389
+ refresh: () => swrResponse?.mutate?.()
5390
+ };
5391
+ }
5392
+
5384
5393
  // src/hooks/pol/useBgtUnstakedBalance.ts
5385
- import useSWR32 from "swr";
5386
5394
  import { formatEther as formatEther5 } from "viem";
5387
5395
  import { bgtAbi } from "@berachain/abis/pol/bgt";
5388
- import { useBeraWallet as useBeraWallet18, usePublicClient as usePublicClient26 } from "@berachain/wagmi/hooks";
5396
+ import { useBeraWallet as useBeraWallet19, usePublicClient as usePublicClient27 } from "@berachain/wagmi/hooks";
5389
5397
  var useBgtUnstakedBalance = (options) => {
5390
- const { address: account } = useBeraWallet18();
5391
- const publicClient = usePublicClient26();
5398
+ const { address: account } = useBeraWallet19();
5399
+ const publicClient = usePublicClient27();
5392
5400
  const QUERY_KEY = account && publicClient ? ["useBgtUnstakedBalance", account] : null;
5393
- const swrResponse = useSWR32(
5401
+ const swrResponse = useSWR(
5394
5402
  QUERY_KEY,
5395
5403
  async ([, account2]) => {
5396
5404
  assertPublicClient(publicClient);
@@ -5407,7 +5415,7 @@ var useBgtUnstakedBalance = (options) => {
5407
5415
  },
5408
5416
  {
5409
5417
  ...options,
5410
- refreshInterval: options?.opts?.refreshInterval ?? 1e5 /* NORMAL */
5418
+ refreshInterval: options?.refreshInterval ?? 1e5 /* NORMAL */
5411
5419
  }
5412
5420
  );
5413
5421
  return {
@@ -5417,14 +5425,13 @@ var useBgtUnstakedBalance = (options) => {
5417
5425
  };
5418
5426
 
5419
5427
  // src/hooks/pol/useClaimableFees.ts
5420
- import useSWR33 from "swr";
5421
5428
  import { formatUnits as formatUnits11 } from "viem";
5422
- import { useBeraWallet as useBeraWallet19, usePublicClient as usePublicClient27 } from "@berachain/wagmi/hooks";
5429
+ import { useBeraWallet as useBeraWallet20, usePublicClient as usePublicClient28 } from "@berachain/wagmi/hooks";
5423
5430
  var useClaimableFees = () => {
5424
- const { address: account } = useBeraWallet19();
5425
- const publicClient = usePublicClient27();
5431
+ const { address: account } = useBeraWallet20();
5432
+ const publicClient = usePublicClient28();
5426
5433
  const QUERY_KEY = account && publicClient ? ["useClaimableFees", account] : null;
5427
- const swrResponse = useSWR33(
5434
+ const swrResponse = useSWR(
5428
5435
  QUERY_KEY,
5429
5436
  async ([, account2]) => {
5430
5437
  assertPublicClient(publicClient);
@@ -5455,8 +5462,7 @@ import {
5455
5462
  } from "@berachain/graphql/pol/api";
5456
5463
 
5457
5464
  // src/hooks/pol/useRewardVaults.ts
5458
- import useSWR34 from "swr";
5459
- import { usePublicClient as usePublicClient28 } from "@berachain/wagmi/hooks";
5465
+ import { usePublicClient as usePublicClient29 } from "@berachain/wagmi/hooks";
5460
5466
  var useRewardVaultsQueryKey = (filter, onChainIncentives = false) => {
5461
5467
  return ["useRewardVaults", filter, onChainIncentives];
5462
5468
  };
@@ -5465,18 +5471,16 @@ var useRewardVaults = (args, options) => {
5465
5471
  args.filter,
5466
5472
  args.onChainIncentives
5467
5473
  );
5468
- const publicClient = usePublicClient28();
5469
- const swrResponse = useSWR34(
5470
- options?.opts?.isEnabled ?? true ? QUERY_KEY : null,
5474
+ const publicClient = usePublicClient29();
5475
+ const swrResponse = useSWR(
5476
+ QUERY_KEY,
5471
5477
  async ([, filter, onChainIncentives]) => {
5472
5478
  return await getRewardVaults({
5473
5479
  filter,
5474
5480
  publicClient: onChainIncentives ? publicClient : void 0
5475
5481
  });
5476
5482
  },
5477
- {
5478
- ...options?.opts
5479
- }
5483
+ options
5480
5484
  );
5481
5485
  return {
5482
5486
  ...swrResponse,
@@ -5496,12 +5500,10 @@ var useHighestVaultsAPR = (where = {}, { isEnabled = true } = {}) => {
5496
5500
  }
5497
5501
  },
5498
5502
  {
5499
- opts: {
5500
- refreshInterval: 0,
5501
- revalidateOnFocus: false,
5502
- refreshWhenOffline: false,
5503
- isEnabled
5504
- }
5503
+ refreshInterval: 0,
5504
+ revalidateOnFocus: false,
5505
+ refreshWhenOffline: false,
5506
+ isEnabled
5505
5507
  }
5506
5508
  );
5507
5509
  return {
@@ -5512,11 +5514,10 @@ var useHighestVaultsAPR = (where = {}, { isEnabled = true } = {}) => {
5512
5514
  };
5513
5515
 
5514
5516
  // src/hooks/pol/usePollGlobalData.ts
5515
- import useSWR35 from "swr";
5516
- import { usePublicClient as usePublicClient29 } from "@berachain/wagmi/hooks";
5517
+ import { usePublicClient as usePublicClient30 } from "@berachain/wagmi/hooks";
5517
5518
  var usePollGlobalData = (options) => {
5518
- const publicClient = usePublicClient29();
5519
- const swrResponse = useSWR35(
5519
+ const publicClient = usePublicClient30();
5520
+ const swrResponse = useSWR(
5520
5521
  publicClient ? "usePollGlobalData" : null,
5521
5522
  async () => {
5522
5523
  assertPublicClient(publicClient);
@@ -5524,7 +5525,7 @@ var usePollGlobalData = (options) => {
5524
5525
  },
5525
5526
  {
5526
5527
  revalidateOnFocus: false,
5527
- ...options?.opts
5528
+ ...options
5528
5529
  }
5529
5530
  );
5530
5531
  return {
@@ -5534,20 +5535,19 @@ var usePollGlobalData = (options) => {
5534
5535
  };
5535
5536
 
5536
5537
  // src/hooks/pol/usePollMarkets.ts
5537
- import useSWRImmutable9 from "swr/immutable";
5538
5538
  var usePollMarketsQueryKey = () => {
5539
5539
  return "usePollMarkets";
5540
5540
  };
5541
5541
  var usePollMarkets = (options) => {
5542
5542
  const QUERY_KEY = usePollMarketsQueryKey();
5543
- const swrResponse = useSWRImmutable9(
5543
+ const swrResponse = useSWRImmutable(
5544
5544
  QUERY_KEY,
5545
5545
  async () => {
5546
5546
  const res = await getMarkets();
5547
5547
  return res;
5548
5548
  },
5549
5549
  {
5550
- ...options?.opts
5550
+ ...options
5551
5551
  }
5552
5552
  );
5553
5553
  return {
@@ -5557,22 +5557,21 @@ var usePollMarkets = (options) => {
5557
5557
  };
5558
5558
 
5559
5559
  // src/hooks/pol/useQueuedBeraUnlock.ts
5560
- import useSWRImmutable10 from "swr/immutable";
5561
5560
  import { isAddress as isAddress9 } from "viem";
5562
- import { usePublicClient as usePublicClient30 } from "@berachain/wagmi/hooks";
5561
+ import { usePublicClient as usePublicClient31 } from "@berachain/wagmi/hooks";
5563
5562
  function useQueuedBeraUnlock({
5564
5563
  receiptTokenAddresses,
5565
5564
  account,
5566
5565
  version
5567
5566
  }, options) {
5568
- const publicClient = usePublicClient30();
5567
+ const publicClient = usePublicClient31();
5569
5568
  const QUERY_KEY = receiptTokenAddresses && account && publicClient && isAddress9(account) && version ? [
5570
5569
  "useQueuedBeraUnlock",
5571
5570
  receiptTokenAddresses,
5572
5571
  account,
5573
5572
  version
5574
5573
  ] : null;
5575
- const swrResponse = useSWRImmutable10(
5574
+ const swrResponse = useSWRImmutable(
5576
5575
  QUERY_KEY,
5577
5576
  async ([, receiptTokenAddresses2, account2, version2]) => {
5578
5577
  assertPublicClient(publicClient);
@@ -5589,7 +5588,7 @@ function useQueuedBeraUnlock({
5589
5588
  },
5590
5589
  {
5591
5590
  refreshInterval: 1e4 /* FAST */,
5592
- ...options?.opts
5591
+ ...options
5593
5592
  }
5594
5593
  );
5595
5594
  return {
@@ -5599,16 +5598,15 @@ function useQueuedBeraUnlock({
5599
5598
  }
5600
5599
 
5601
5600
  // src/hooks/pol/useRewardTokenToBeraRate.ts
5602
- import useSWR36 from "swr";
5603
5601
  import { isAddress as isAddress10 } from "viem";
5604
5602
  import { defaultChainId as defaultChainId11 } from "@berachain/config/internal";
5605
- import { usePublicClient as usePublicClient31 } from "@berachain/wagmi/hooks";
5603
+ import { usePublicClient as usePublicClient32 } from "@berachain/wagmi/hooks";
5606
5604
  var useRewardTokenToBeraRate = ({
5607
5605
  address
5608
5606
  }, opt) => {
5609
5607
  const QUERY_KEY = address ? ["useRewardTokenToBeraRate", address] : null;
5610
- const publicClient = usePublicClient31({ chainId: defaultChainId11 });
5611
- return useSWR36(
5608
+ const publicClient = usePublicClient32({ chainId: defaultChainId11 });
5609
+ return useSWR(
5612
5610
  QUERY_KEY,
5613
5611
  async ([_, address2]) => {
5614
5612
  if (!address2 || !isAddress10(address2)) {
@@ -5625,19 +5623,15 @@ var useRewardTokenToBeraRate = ({
5625
5623
  });
5626
5624
  },
5627
5625
  {
5628
- ...opt?.opts
5626
+ ...opt
5629
5627
  }
5630
5628
  );
5631
5629
  };
5632
5630
 
5633
- // src/hooks/pol/useRewardVault.ts
5634
- import useSWR38 from "swr";
5635
-
5636
5631
  // src/hooks/pol/useOnChainRewardVault.ts
5637
- import useSWR37 from "swr";
5638
5632
  import { erc20Abi as erc20Abi4, formatUnits as formatUnits13, isAddress as isAddress11 } from "viem";
5639
5633
  import { beraChefAbi } from "@berachain/abis/pol/rewards/beraChef";
5640
- import { usePublicClient as usePublicClient32 } from "@berachain/wagmi/hooks";
5634
+ import { usePublicClient as usePublicClient33 } from "@berachain/wagmi/hooks";
5641
5635
 
5642
5636
  // src/actions/pol/getStakingTokenInformation.ts
5643
5637
  import { erc20Abi as erc20Abi3, formatUnits as formatUnits12 } from "viem";
@@ -5686,98 +5680,102 @@ var useOnChainRewardVaultQueryKey = (address) => address && isAddress11(address)
5686
5680
  var useOnChainRewardVault = ({
5687
5681
  address
5688
5682
  }, opt) => {
5689
- const publicClient = usePublicClient32();
5690
- const isEnabled = opt.opts?.isEnabled ?? true;
5683
+ const publicClient = usePublicClient33();
5691
5684
  const QUERY_KEY = useOnChainRewardVaultQueryKey(address);
5692
- return useSWR37(isEnabled && publicClient ? QUERY_KEY : null, async ([, address2]) => {
5693
- assertPublicClient(publicClient);
5694
- const { config } = parseBaseArgs({
5695
- chainId: publicClient.chain.id
5696
- });
5697
- const stakingTokenAddress = await getRewardVaultStakingToken({
5698
- address: address2,
5699
- publicClient
5700
- });
5701
- const [incentives, isWhitelisted, stakingTokenAmount] = await Promise.all([
5702
- getRewardVaultIncentives({
5685
+ return useSWR(
5686
+ publicClient ? QUERY_KEY : null,
5687
+ async ([, address2]) => {
5688
+ assertPublicClient(publicClient);
5689
+ const { config } = parseBaseArgs({
5690
+ chainId: publicClient.chain.id
5691
+ });
5692
+ const stakingTokenAddress = await getRewardVaultStakingToken({
5703
5693
  address: address2,
5704
- stakingToken: stakingTokenAddress,
5705
5694
  publicClient
5706
- }),
5707
- publicClient.readContract({
5708
- address: config.pol.beraChef,
5709
- abi: beraChefAbi,
5710
- functionName: "isWhitelistedVault",
5711
- args: [address2]
5712
- }),
5713
- publicClient.readContract({
5714
- address: stakingTokenAddress,
5715
- abi: erc20Abi4,
5716
- functionName: "balanceOf",
5717
- args: [address2]
5718
- })
5719
- ]);
5720
- const [stakingToken, incentiveTokens] = await Promise.all([
5721
- getStakingTokenInformation({
5722
- address: stakingTokenAddress,
5723
- publicClient
5724
- }),
5725
- Promise.all(
5726
- incentives.map(
5727
- (add) => getTokenInformation({
5728
- address: add.token,
5729
- chainId: publicClient.chain.id,
5695
+ });
5696
+ const [incentives, isWhitelisted, stakingTokenAmount] = await Promise.all(
5697
+ [
5698
+ getRewardVaultIncentives({
5699
+ address: address2,
5700
+ stakingToken: stakingTokenAddress,
5730
5701
  publicClient
5702
+ }),
5703
+ publicClient.readContract({
5704
+ address: config.pol.beraChef,
5705
+ abi: beraChefAbi,
5706
+ functionName: "isWhitelistedVault",
5707
+ args: [address2]
5708
+ }),
5709
+ publicClient.readContract({
5710
+ address: stakingTokenAddress,
5711
+ abi: erc20Abi4,
5712
+ functionName: "balanceOf",
5713
+ args: [address2]
5731
5714
  })
5715
+ ]
5716
+ );
5717
+ const [stakingToken, incentiveTokens] = await Promise.all([
5718
+ getStakingTokenInformation({
5719
+ address: stakingTokenAddress,
5720
+ publicClient
5721
+ }),
5722
+ Promise.all(
5723
+ incentives.map(
5724
+ (add) => getTokenInformation({
5725
+ address: add.token,
5726
+ chainId: publicClient.chain.id,
5727
+ publicClient
5728
+ })
5729
+ )
5732
5730
  )
5733
- )
5734
- ]);
5735
- if (!stakingToken) {
5736
- throw new Error("Staking token not found");
5737
- }
5738
- return {
5739
- id: address2,
5740
- address: address2,
5741
- vaultAddress: address2,
5742
- stakingToken: {
5743
- address: stakingTokenAddress,
5744
- name: stakingToken.name ?? "",
5745
- symbol: stakingToken.symbol ?? "",
5746
- decimals: stakingToken.decimals ?? 0
5747
- },
5748
- stakingTokenAmount: formatUnits13(
5749
- stakingTokenAmount,
5750
- stakingToken.decimals ?? 18
5751
- ),
5752
- isVaultWhitelisted: isWhitelisted,
5753
- activeIncentives: incentives.map((incentive, idx) => ({
5754
- active: !!incentive.remainingAmount,
5755
- remainingAmount: incentive.remainingAmount,
5756
- remainingAmountUsd: "0",
5757
- incentiveRate: incentive.incentiveRate,
5758
- incentiveRateUsd: "0",
5759
- tokenAddress: incentive.token,
5760
- token: incentiveTokens[idx]
5761
- }))
5762
- };
5763
- });
5731
+ ]);
5732
+ if (!stakingToken) {
5733
+ throw new Error("Staking token not found");
5734
+ }
5735
+ return {
5736
+ id: address2,
5737
+ address: address2,
5738
+ vaultAddress: address2,
5739
+ stakingToken: {
5740
+ address: stakingTokenAddress,
5741
+ name: stakingToken.name ?? "",
5742
+ symbol: stakingToken.symbol ?? "",
5743
+ decimals: stakingToken.decimals ?? 0
5744
+ },
5745
+ stakingTokenAmount: formatUnits13(
5746
+ stakingTokenAmount,
5747
+ stakingToken.decimals ?? 18
5748
+ ),
5749
+ isVaultWhitelisted: isWhitelisted,
5750
+ activeIncentives: incentives.map((incentive, idx) => ({
5751
+ active: !!incentive.remainingAmount,
5752
+ remainingAmount: incentive.remainingAmount,
5753
+ remainingAmountUsd: "0",
5754
+ incentiveRate: incentive.incentiveRate,
5755
+ incentiveRateUsd: "0",
5756
+ tokenAddress: incentive.token,
5757
+ token: incentiveTokens[idx]
5758
+ }))
5759
+ };
5760
+ },
5761
+ opt
5762
+ );
5764
5763
  };
5765
5764
 
5766
5765
  // src/hooks/pol/useRewardVault.ts
5767
5766
  var useRewardVaultQueryKey = (address) => address ? ["useRewardVault", address.toLowerCase()] : null;
5768
5767
  var useRewardVault = (id, options) => {
5769
5768
  const QUERY_KEY = useRewardVaultQueryKey(id);
5770
- const swrResponse = useSWR38(
5769
+ const { isEnabled: _isEnabled, ...swrOptions } = options ?? {};
5770
+ const swrResponse = useSWR(
5771
5771
  QUERY_KEY,
5772
5772
  async ([_, id2]) => getRewardVault({ address: id2 }),
5773
- {
5774
- ...options?.opts
5775
- }
5773
+ swrOptions
5776
5774
  );
5777
- const isOnChainEnabled = options?.opts?.isEnabled ?? ((!!swrResponse.error || !swrResponse.isLoading) && !swrResponse.data);
5775
+ const isOnChainEnabled = options?.isEnabled ?? ((!!swrResponse.error || !swrResponse.isLoading) && !swrResponse.data);
5778
5776
  const onChainRewardVault = useOnChainRewardVault(
5779
5777
  { address: id },
5780
- { opts: { ...options?.opts, isEnabled: isOnChainEnabled } }
5778
+ { ...options, isEnabled: isOnChainEnabled }
5781
5779
  );
5782
5780
  return {
5783
5781
  data: onChainRewardVault.data ?? swrResponse.data,
@@ -5792,15 +5790,14 @@ var useRewardVault = (id, options) => {
5792
5790
  };
5793
5791
 
5794
5792
  // src/hooks/pol/useRewardVaultIncentives.ts
5795
- import useSWR39 from "swr";
5796
- import { usePublicClient as usePublicClient33 } from "@berachain/wagmi/hooks";
5793
+ import { usePublicClient as usePublicClient34 } from "@berachain/wagmi/hooks";
5797
5794
  function useRewardVaultIncentives({
5798
5795
  address,
5799
5796
  stakingToken
5800
5797
  }) {
5801
- const publicClient = usePublicClient33();
5798
+ const publicClient = usePublicClient34();
5802
5799
  const QUERY_KEY = publicClient && address && stakingToken ? ["useRewardVaultIncentives", address, stakingToken] : null;
5803
- const swrResponse = useSWR39(QUERY_KEY, async ([, address2, stakingToken2]) => {
5800
+ const swrResponse = useSWR(QUERY_KEY, async ([, address2, stakingToken2]) => {
5804
5801
  assertPublicClient(publicClient);
5805
5802
  return await getRewardVaultIncentives({
5806
5803
  address: address2,
@@ -5815,19 +5812,18 @@ function useRewardVaultIncentives({
5815
5812
  }
5816
5813
 
5817
5814
  // src/hooks/pol/useRewardVaultRewards.ts
5818
- import useSWR40 from "swr";
5819
- import { usePublicClient as usePublicClient34 } from "@berachain/wagmi/hooks";
5815
+ import { usePublicClient as usePublicClient35 } from "@berachain/wagmi/hooks";
5820
5816
  var useRewardVaultRewards = (address, options) => {
5821
- const publicClient = usePublicClient34();
5817
+ const publicClient = usePublicClient35();
5822
5818
  const QUERY_KEY = publicClient && address ? ["useRewardVaultRewards", address] : null;
5823
- const swrResponse = useSWR40(
5819
+ const swrResponse = useSWR(
5824
5820
  QUERY_KEY,
5825
5821
  async ([, address2]) => {
5826
5822
  assertPublicClient(publicClient);
5827
5823
  return await getRewardVaultRewards(address2, publicClient);
5828
5824
  },
5829
5825
  {
5830
- ...options?.opts
5826
+ ...options
5831
5827
  }
5832
5828
  );
5833
5829
  return {
@@ -5836,9 +5832,6 @@ var useRewardVaultRewards = (address, options) => {
5836
5832
  };
5837
5833
  };
5838
5834
 
5839
- // src/hooks/pol/useStakedAPR.ts
5840
- import useSWR41 from "swr";
5841
-
5842
5835
  // src/utils/filter.ts
5843
5836
  var dailyResolution = (data) => {
5844
5837
  const dailyData = [];
@@ -5866,7 +5859,7 @@ function useStakedAPR({
5866
5859
  range
5867
5860
  }) {
5868
5861
  const QUERY_KEY = range ? ["useStakedAPR", range] : null;
5869
- const swrResponse = useSWR41(QUERY_KEY, async ([, range2]) => {
5862
+ const swrResponse = useSWR(QUERY_KEY, async ([, range2]) => {
5870
5863
  const unsortedStakedBeraSnapshots = await getStakedBeraSnapshots({
5871
5864
  range: range2
5872
5865
  });
@@ -5886,12 +5879,11 @@ function useStakedAPR({
5886
5879
 
5887
5880
  // src/hooks/pol/useStakedData.ts
5888
5881
  import { useMemo as useMemo12 } from "react";
5889
- import useSWR42 from "swr";
5890
- import { useBeraWallet as useBeraWallet20, usePublicClient as usePublicClient35 } from "@berachain/wagmi/hooks";
5882
+ import { useBeraWallet as useBeraWallet21, usePublicClient as usePublicClient36 } from "@berachain/wagmi/hooks";
5891
5883
  var useStakedData = (stakingConfigs) => {
5892
5884
  const window2 = useBeraFlag("swberaAprWindow");
5893
- const publicClient = usePublicClient35();
5894
- const { address: account } = useBeraWallet20();
5885
+ const publicClient = usePublicClient36();
5886
+ const { address: account } = useBeraWallet21();
5895
5887
  const receiptTokens = useMemo12(
5896
5888
  () => stakingConfigs.map((config) => config.receiptToken),
5897
5889
  [stakingConfigs]
@@ -5901,15 +5893,21 @@ var useStakedData = (stakingConfigs) => {
5901
5893
  [stakingConfigs]
5902
5894
  );
5903
5895
  const aprKey = window2 ? ["useStakedData:apr", window2] : null;
5904
- const { data: apr } = useSWR42(
5896
+ const { data: apr } = useSWR(
5905
5897
  aprKey,
5906
5898
  async ([, window3]) => getStakedBeraAPR({ window: window3 }),
5907
5899
  { refreshInterval: 1e5 /* NORMAL */ }
5908
5900
  );
5909
- const { data: walletBalances, isLoading: isLoadingBalances } = usePollWalletBalances({ tokens: receiptTokens });
5910
- const { getTokenPrice } = useTokenPrices({ tokens: inputTokens });
5901
+ const {
5902
+ data: walletBalances,
5903
+ isLoading: isLoadingBalances,
5904
+ error: walletBalancesError
5905
+ } = usePollWalletBalances({ tokens: receiptTokens });
5906
+ const { getTokenPrice } = useTokenPrices({
5907
+ tokens: inputTokens
5908
+ });
5911
5909
  const exchangeRatesKey = publicClient && receiptTokens.length > 0 ? ["useStakedData:exchangeRates", receiptTokens] : null;
5912
- const { data: exchangeRates } = useSWR42(
5910
+ const { data: exchangeRates, error: exchangeRatesError } = useSWR(
5913
5911
  exchangeRatesKey,
5914
5912
  async ([, receiptTokens2]) => {
5915
5913
  assertPublicClient(publicClient);
@@ -5924,33 +5922,13 @@ var useStakedData = (stakingConfigs) => {
5924
5922
  },
5925
5923
  { refreshInterval: 1e5 /* NORMAL */ }
5926
5924
  );
5927
- const balances = useMemo12(() => {
5928
- if (!walletBalances || !exchangeRates) return void 0;
5929
- return stakingConfigs.map((config, i) => {
5930
- const inputToken = config.inputTokens[0];
5931
- const stakedBalance = walletBalances.find((b) => b.address === config.receiptToken.address)?.balance.raw ?? "0";
5932
- const exchangeRate = exchangeRates[i] ?? 0;
5933
- const inputTokenPrice = getTokenPrice(inputToken) ?? 0;
5934
- const total = new bignumber_js_default(stakedBalance).multipliedBy(exchangeRate);
5935
- const stakedAmount = total.dividedBy(10 ** inputToken.decimals);
5936
- const stakedAmountUsd = stakedAmount.multipliedBy(inputTokenPrice);
5937
- return {
5938
- token: inputToken,
5939
- apr: apr ?? 0,
5940
- stakedAmount: stakedAmount.toNumber(),
5941
- stakedAmountUsd: stakedAmountUsd.toNumber(),
5942
- earnedAmount: 0,
5943
- earnedAmountUsd: 0,
5944
- isLoadingEarnings: true
5945
- };
5946
- });
5947
- }, [walletBalances, exchangeRates, stakingConfigs, apr, getTokenPrice]);
5948
5925
  const positionsKey = account && publicClient && stakingConfigs.length > 0 ? ["useStakedData:positions", account, stakingConfigs] : null;
5949
5926
  const {
5950
5927
  data: positionsRaw,
5928
+ error: positionsError,
5951
5929
  isLoading: isLoadingPositions,
5952
5930
  isValidating: isValidatingPositions
5953
- } = useSWR42(
5931
+ } = useSWR(
5954
5932
  positionsKey,
5955
5933
  async ([, account2, stakingConfigs2]) => {
5956
5934
  assertPublicClient(publicClient);
@@ -5973,13 +5951,42 @@ var useStakedData = (stakingConfigs) => {
5973
5951
  },
5974
5952
  { refreshInterval: 1e4 /* FAST */ }
5975
5953
  );
5954
+ const earningsSettled = !!positionsRaw || !!positionsError;
5955
+ const balances = useMemo12(() => {
5956
+ if (!walletBalances || !exchangeRates) return void 0;
5957
+ return stakingConfigs.map((config, i) => {
5958
+ const inputToken = config.inputTokens[0];
5959
+ const stakedBalance = walletBalances.find((b) => b.address === config.receiptToken.address)?.balance.raw ?? "0";
5960
+ const exchangeRate = exchangeRates[i] ?? 0;
5961
+ const inputTokenPrice = getTokenPrice(inputToken);
5962
+ const total = new bignumber_js_default(stakedBalance).multipliedBy(exchangeRate);
5963
+ const stakedAmount = total.dividedBy(10 ** inputToken.decimals);
5964
+ const stakedAmountUsd = inputTokenPrice === void 0 ? void 0 : stakedAmount.multipliedBy(inputTokenPrice).toNumber();
5965
+ return {
5966
+ token: inputToken,
5967
+ apr,
5968
+ stakedAmount: stakedAmount.toNumber(),
5969
+ stakedAmountUsd,
5970
+ earnedAmount: 0,
5971
+ earnedAmountUsd: earningsSettled ? void 0 : 0,
5972
+ isLoadingEarnings: !earningsSettled
5973
+ };
5974
+ });
5975
+ }, [
5976
+ walletBalances,
5977
+ exchangeRates,
5978
+ stakingConfigs,
5979
+ apr,
5980
+ getTokenPrice,
5981
+ earningsSettled
5982
+ ]);
5976
5983
  const data = useMemo12(() => {
5977
5984
  if (!positionsRaw || !walletBalances) return void 0;
5978
5985
  return stakingConfigs.map((config, i) => {
5979
5986
  const inputToken = config.inputTokens[0];
5980
5987
  const stakingToken = config.receiptToken;
5981
5988
  const { earnings, exchangeRate: exchangeRateRaw } = positionsRaw[i];
5982
- const inputTokenPrice = getTokenPrice(inputToken) ?? 0;
5989
+ const inputTokenPrice = getTokenPrice(inputToken);
5983
5990
  const stakedBalance = walletBalances.find((b) => b.address === stakingToken.address)?.balance.raw ?? "0";
5984
5991
  const exchangeRate = exchangeRateRaw ?? 0;
5985
5992
  const unrealisedGains = new bignumber_js_default(earnings.earningsTotal).minus(
@@ -5989,15 +5996,15 @@ var useStakedData = (stakingConfigs) => {
5989
5996
  const deposited = total.minus(unrealisedGains);
5990
5997
  const stakedAmount = deposited.dividedBy(10 ** inputToken.decimals);
5991
5998
  const earnedAmount = unrealisedGains.dividedBy(10 ** inputToken.decimals);
5992
- const stakedAmountUsd = stakedAmount.multipliedBy(inputTokenPrice);
5993
- const earnedAmountUsd = earnedAmount.multipliedBy(inputTokenPrice);
5999
+ const stakedAmountUsd = inputTokenPrice === void 0 ? void 0 : stakedAmount.multipliedBy(inputTokenPrice).toNumber();
6000
+ const earnedAmountUsd = inputTokenPrice === void 0 ? void 0 : earnedAmount.multipliedBy(inputTokenPrice).toNumber();
5994
6001
  return {
5995
6002
  token: inputToken,
5996
- apr: apr ?? 0,
6003
+ apr,
5997
6004
  stakedAmount: stakedAmount.toNumber(),
5998
6005
  earnedAmount: earnedAmount.toNumber(),
5999
- stakedAmountUsd: stakedAmountUsd.toNumber(),
6000
- earnedAmountUsd: earnedAmountUsd.toNumber()
6006
+ stakedAmountUsd,
6007
+ earnedAmountUsd
6001
6008
  };
6002
6009
  });
6003
6010
  }, [positionsRaw, walletBalances, stakingConfigs, apr, getTokenPrice]);
@@ -6010,25 +6017,40 @@ var useStakedData = (stakingConfigs) => {
6010
6017
  isLoading: isLoadingBalances && isLoadingPositions,
6011
6018
  isLoadingBalances,
6012
6019
  isLoadingPositions,
6013
- isValidatingPositions
6020
+ isValidatingPositions,
6021
+ /**
6022
+ * Hard error: the RPC fast-path could not produce staked balances (wallet
6023
+ * balances or exchange-rate reads failed). Price and earnings backend
6024
+ * failures are intentionally excluded — those degrade gracefully (USD/APR
6025
+ * render as "—", earnings stop loading) so RPC-derived amounts still show.
6026
+ */
6027
+ error: walletBalancesError ?? exchangeRatesError,
6028
+ /** Set when the earnings (slow path) request failed. */
6029
+ positionsError,
6030
+ /**
6031
+ * True once the earnings (slow path) request has settled — resolved or
6032
+ * errored. Consumers should stop showing an earnings loading state once
6033
+ * this is true, even if `data` never arrives (backend outage).
6034
+ */
6035
+ earningsSettled
6014
6036
  };
6015
6037
  };
6016
6038
 
6017
- // src/hooks/pol/useStakedSnapshots.ts
6018
- import useSWR43 from "swr";
6019
-
6020
6039
  // src/actions/pol/getStakingDailyAssets.ts
6021
- import { getUriFromLink as getUriFromLink2 } from "@berachain/config";
6022
6040
  async function getStakingDailyAssets({
6023
6041
  address,
6024
6042
  range
6025
6043
  }) {
6026
6044
  const { config } = parseBaseArgs({});
6027
- const url = `${getUriFromLink2(config.backend)}/vaults/${address}/stats-by-day?days=${range}`;
6028
- return beraFetchJson({
6029
- url,
6030
- name: typeof config.backend === "string" ? "backend-railway" : config.backend.name,
6031
- type: "rest"
6045
+ if (!config.beep) {
6046
+ return fetchRailwayBackend("/vaults/{vault}/stats-by-day", {
6047
+ path: { vault: address },
6048
+ query: { days: `${range}` }
6049
+ });
6050
+ }
6051
+ return fetchBeep("/v0/stake/{vault}/stats-by-day", {
6052
+ path: { vault: address },
6053
+ query: { days: `${range}` }
6032
6054
  });
6033
6055
  }
6034
6056
 
@@ -6038,7 +6060,7 @@ function useStakedSnapshots({
6038
6060
  addresses
6039
6061
  }) {
6040
6062
  const QUERY_KEY = range ? ["useStakedSnapshots", range, addresses] : null;
6041
- const swrResponse = useSWR43(QUERY_KEY, async ([, range2, addresses2]) => {
6063
+ const swrResponse = useSWR(QUERY_KEY, async ([, range2, addresses2]) => {
6042
6064
  const [...sortedStakingDailyAssetsArray] = await Promise.all([
6043
6065
  ...addresses2.map(async (address) => {
6044
6066
  const unstakingDailyAssets = await getStakingDailyAssets({
@@ -6065,13 +6087,12 @@ function useStakedSnapshots({
6065
6087
  }
6066
6088
 
6067
6089
  // src/hooks/pol/useStakingVaultsMetadata.ts
6068
- import useSWR44 from "swr";
6069
- import { usePublicClient as usePublicClient36 } from "@berachain/wagmi/hooks";
6090
+ import { usePublicClient as usePublicClient37 } from "@berachain/wagmi/hooks";
6070
6091
  var useStakingVaultsMetadata = (vaults = []) => {
6071
- const publicClient = usePublicClient36();
6092
+ const publicClient = usePublicClient37();
6072
6093
  const blockTime = useBlockTime();
6073
6094
  const QUERY_KEY = vaults.length > 0 && publicClient && blockTime ? ["useStakingVaultMetadata", vaults, publicClient, blockTime] : null;
6074
- return useSWR44(
6095
+ return useSWR(
6075
6096
  QUERY_KEY,
6076
6097
  async ([, vaults2, publicClient2, blockTime2]) => {
6077
6098
  assertPublicClient(publicClient2);
@@ -6091,13 +6112,12 @@ var useStakingVaultsMetadata = (vaults = []) => {
6091
6112
  };
6092
6113
 
6093
6114
  // src/hooks/pol/useTotalStakedAmount.ts
6094
- import useSWR45 from "swr";
6095
- import { usePublicClient as usePublicClient37 } from "@berachain/wagmi/hooks";
6115
+ import { usePublicClient as usePublicClient38 } from "@berachain/wagmi/hooks";
6096
6116
  function useTotalStakedAmount({
6097
6117
  vaultAddresses
6098
6118
  }) {
6099
- const publicClient = usePublicClient37();
6100
- const swrResponse = useSWR45(
6119
+ const publicClient = usePublicClient38();
6120
+ const swrResponse = useSWR(
6101
6121
  vaultAddresses && publicClient ? ["useTotalStakedAmount", vaultAddresses] : null,
6102
6122
  ([, vaultAddresses2]) => {
6103
6123
  return getTotalStakedAmount({ vaultAddresses: vaultAddresses2, publicClient });
@@ -6110,13 +6130,12 @@ function useTotalStakedAmount({
6110
6130
  }
6111
6131
 
6112
6132
  // src/hooks/pol/useUserVaultInfo.ts
6113
- import useSWR46 from "swr";
6114
- import { useBeraWallet as useBeraWallet21, usePublicClient as usePublicClient38 } from "@berachain/wagmi/hooks";
6133
+ import { useBeraWallet as useBeraWallet22, usePublicClient as usePublicClient39 } from "@berachain/wagmi/hooks";
6115
6134
  var useUserVaultInfo = (args, options) => {
6116
- const { address: account } = useBeraWallet21();
6117
- const publicClient = usePublicClient38();
6135
+ const { address: account } = useBeraWallet22();
6136
+ const publicClient = usePublicClient39();
6118
6137
  const QUERY_KEY = account && publicClient && args.vaultAddress ? ["useUserVaultInfo", account, args.vaultAddress] : null;
6119
- const swrResponse = useSWR46(
6138
+ const swrResponse = useSWR(
6120
6139
  QUERY_KEY,
6121
6140
  async ([, account2, vaultAddress]) => {
6122
6141
  assertPublicClient(publicClient);
@@ -6128,7 +6147,7 @@ var useUserVaultInfo = (args, options) => {
6128
6147
  },
6129
6148
  {
6130
6149
  ...options,
6131
- refreshInterval: options?.opts?.refreshInterval ?? 1e5 /* NORMAL */
6150
+ refreshInterval: options?.refreshInterval ?? 1e5 /* NORMAL */
6132
6151
  }
6133
6152
  );
6134
6153
  return {
@@ -6138,13 +6157,12 @@ var useUserVaultInfo = (args, options) => {
6138
6157
  };
6139
6158
 
6140
6159
  // src/hooks/pol/useUserVaults.ts
6141
- import useSWR47 from "swr";
6142
- import { useBeraWallet as useBeraWallet22, usePublicClient as usePublicClient39 } from "@berachain/wagmi/hooks";
6160
+ import { useBeraWallet as useBeraWallet23, usePublicClient as usePublicClient40 } from "@berachain/wagmi/hooks";
6143
6161
  var useUserVaults = (options) => {
6144
- const { address: account } = useBeraWallet22();
6145
- const publicClient = usePublicClient39();
6162
+ const { address: account } = useBeraWallet23();
6163
+ const publicClient = usePublicClient40();
6146
6164
  const QUERY_KEY = account && publicClient ? ["useUserVaults", account] : null;
6147
- const swrResponse = useSWR47(
6165
+ const swrResponse = useSWR(
6148
6166
  QUERY_KEY,
6149
6167
  async ([, account2]) => {
6150
6168
  assertPublicClient(publicClient);
@@ -6155,7 +6173,7 @@ var useUserVaults = (options) => {
6155
6173
  },
6156
6174
  {
6157
6175
  ...options,
6158
- refreshInterval: options?.opts?.refreshInterval ?? 1e5 /* NORMAL */,
6176
+ refreshInterval: options?.refreshInterval ?? 1e5 /* NORMAL */,
6159
6177
  keepPreviousData: true
6160
6178
  }
6161
6179
  );
@@ -6166,12 +6184,11 @@ var useUserVaults = (options) => {
6166
6184
  };
6167
6185
 
6168
6186
  // src/hooks/pol/useVaultAddress.ts
6169
- import useSWR48 from "swr";
6170
- import { usePublicClient as usePublicClient40 } from "@berachain/wagmi/hooks";
6187
+ import { usePublicClient as usePublicClient41 } from "@berachain/wagmi/hooks";
6171
6188
  var useVaultAddress = (vaultAddress) => {
6172
- const publicClient = usePublicClient40();
6189
+ const publicClient = usePublicClient41();
6173
6190
  const QUERY_KEY = vaultAddress && publicClient ? ["useVaultAddress", vaultAddress] : null;
6174
- return useSWR48(QUERY_KEY, async ([, vaultAddress2]) => {
6191
+ return useSWR(QUERY_KEY, async ([, vaultAddress2]) => {
6175
6192
  assertPublicClient(publicClient);
6176
6193
  const [stakeToken] = await Promise.all([
6177
6194
  getRewardVaultStakingToken({
@@ -6184,14 +6201,13 @@ var useVaultAddress = (vaultAddress) => {
6184
6201
  };
6185
6202
 
6186
6203
  // src/hooks/pol/useVaultHistory.ts
6187
- import useSWR49 from "swr";
6188
6204
  var useVaultHistory = ({
6189
6205
  vault,
6190
6206
  range,
6191
6207
  resolution
6192
6208
  }) => {
6193
6209
  const QUERY_KEY = vault ? ["useVaultHistory", vault, range, resolution] : null;
6194
- const swrResponse = useSWR49(
6210
+ const swrResponse = useSWR(
6195
6211
  QUERY_KEY,
6196
6212
  ([, vault2, range2, resolution2]) => getVaultHistory({ vault: vault2, range: range2, resolution: resolution2 })
6197
6213
  );
@@ -6202,10 +6218,9 @@ var useVaultHistory = ({
6202
6218
  };
6203
6219
 
6204
6220
  // src/hooks/pol/useVaultValidators.ts
6205
- import useSWR50 from "swr";
6206
6221
  var useVaultValidators = (id, options) => {
6207
6222
  const QUERY_KEY = id ? ["useVaultValidators", id] : null;
6208
- const swrResponse = useSWR50(
6223
+ const swrResponse = useSWR(
6209
6224
  QUERY_KEY,
6210
6225
  async ([, address]) => {
6211
6226
  return await getVaultValidators({
@@ -6213,7 +6228,7 @@ var useVaultValidators = (id, options) => {
6213
6228
  });
6214
6229
  },
6215
6230
  {
6216
- ...options?.opts
6231
+ ...options
6217
6232
  }
6218
6233
  );
6219
6234
  return {
@@ -6245,13 +6260,12 @@ function useBeraCurrentPrice(opts) {
6245
6260
  }
6246
6261
 
6247
6262
  // src/hooks/tokens/useStakingTokenInformation.ts
6248
- import useSWRImmutable11 from "swr/immutable";
6249
6263
  import { isAddress as isAddress12, zeroAddress as zeroAddress23 } from "viem";
6250
- import { usePublicClient as usePublicClient41 } from "@berachain/wagmi/hooks";
6264
+ import { usePublicClient as usePublicClient42 } from "@berachain/wagmi/hooks";
6251
6265
  var useStakingTokenInformation = (args, options) => {
6252
- const publicClient = usePublicClient41();
6266
+ const publicClient = usePublicClient42();
6253
6267
  const QUERY_KEY = args?.address && publicClient && isAddress12(args.address) ? ["useStakingTokenInformation", args.address] : null;
6254
- const swrResponse = useSWRImmutable11(
6268
+ const swrResponse = useSWRImmutable(
6255
6269
  QUERY_KEY,
6256
6270
  async ([_, address]) => {
6257
6271
  if (isToken(address, "BERA")) {
@@ -6267,7 +6281,7 @@ var useStakingTokenInformation = (args, options) => {
6267
6281
  publicClient
6268
6282
  });
6269
6283
  },
6270
- { ...options?.opts }
6284
+ { ...options }
6271
6285
  );
6272
6286
  return {
6273
6287
  ...swrResponse,
@@ -6277,23 +6291,23 @@ var useStakingTokenInformation = (args, options) => {
6277
6291
 
6278
6292
  // src/hooks/tokens/useTokenPrice.ts
6279
6293
  function useTokenPrice({ token }, options) {
6280
- const { isLoading, priceMap } = useTokenPrices(
6294
+ const { isLoading, error, priceMap } = useTokenPrices(
6281
6295
  { tokens: token ? [token] : void 0 },
6282
6296
  options
6283
6297
  );
6284
6298
  return {
6285
6299
  data: token ? priceMap[token.chainId]?.[token.address.toLowerCase()] : void 0,
6286
- isLoading
6300
+ isLoading,
6301
+ error
6287
6302
  };
6288
6303
  }
6289
6304
 
6290
6305
  // src/hooks/tokens/useTotalSupply.ts
6291
- import useSWR51 from "swr";
6292
6306
  import { erc20Abi as erc20Abi5 } from "viem";
6293
- import { usePublicClient as usePublicClient42 } from "@berachain/wagmi/hooks";
6307
+ import { usePublicClient as usePublicClient43 } from "@berachain/wagmi/hooks";
6294
6308
  function useTotalSupply({ address }) {
6295
- const publicClient = usePublicClient42();
6296
- return useSWR51(
6309
+ const publicClient = usePublicClient43();
6310
+ return useSWR(
6297
6311
  address && publicClient ? ["useTotalSupply", address] : null,
6298
6312
  ([, address2]) => {
6299
6313
  assertPublicClient(publicClient);
@@ -6308,15 +6322,14 @@ function useTotalSupply({ address }) {
6308
6322
  }
6309
6323
 
6310
6324
  // src/hooks/useBlockToTimestamp.ts
6311
- import useSWRImmutable12 from "swr/immutable";
6312
- import { useBlockNumber, usePublicClient as usePublicClient43 } from "@berachain/wagmi/hooks";
6325
+ import { useBlockNumber, usePublicClient as usePublicClient44 } from "@berachain/wagmi/hooks";
6313
6326
  function useBlockToTimestamp(inputBlock) {
6314
- const publicClient = usePublicClient43();
6327
+ const publicClient = usePublicClient44();
6315
6328
  const { config } = parseBaseArgs({ chainId: publicClient?.chain.id });
6316
6329
  const { data: currentBlock, isLoading } = useBlockNumber({
6317
6330
  cacheTime: seconds(config.averageBlockTime)
6318
6331
  });
6319
- const { data: block } = useSWRImmutable12(
6332
+ const { data: block } = useSWRImmutable(
6320
6333
  currentBlock && publicClient && Number(inputBlock) > 0 ? ["useBlockToTimestamp", inputBlock, currentBlock] : null,
6321
6334
  async ([, inputBlock2, currentBlock2]) => {
6322
6335
  assertPublicClient(publicClient);
@@ -6467,7 +6480,6 @@ function useBeraContractWrite({
6467
6480
  var useBeraContractWrite_default = useBeraContractWrite;
6468
6481
 
6469
6482
  // src/hooks/useGetVerifiedAbi.ts
6470
- import useSWRImmutable13 from "swr/immutable";
6471
6483
  import { isAddress as isAddress13, zeroAddress as zeroAddress24 } from "viem";
6472
6484
  import { chainId } from "@berachain/config/internal";
6473
6485
  async function fetchVerifiedAbi(address) {
@@ -6482,7 +6494,7 @@ async function fetchVerifiedAbi(address) {
6482
6494
  return data.result;
6483
6495
  }
6484
6496
  var useGetVerifiedAbi = (address) => {
6485
- return useSWRImmutable13(
6497
+ return useSWRImmutable(
6486
6498
  address && isAddress13(address) && // Address zero can't be a contract for sure
6487
6499
  address !== zeroAddress24 ? ["useGetVerifiedAbi", address] : null,
6488
6500
  () => address ? fetchVerifiedAbi(address) : Promise.resolve(""),
@@ -6538,7 +6550,6 @@ function usePrevious(value) {
6538
6550
  }
6539
6551
 
6540
6552
  // src/hooks/validators/useAllValidators.ts
6541
- import useSWR52 from "swr";
6542
6553
  var useAllValidatorsQueryKey = ({
6543
6554
  variables
6544
6555
  } = {}) => {
@@ -6546,7 +6557,7 @@ var useAllValidatorsQueryKey = ({
6546
6557
  };
6547
6558
  var useAllValidators = (variables, options) => {
6548
6559
  const { config } = parseBaseArgs(variables);
6549
- const swrResponse = useSWR52(
6560
+ const swrResponse = useSWR(
6550
6561
  useAllValidatorsQueryKey({ variables }),
6551
6562
  async ([, variables2]) => {
6552
6563
  const result = await getAllValidators({
@@ -6559,7 +6570,7 @@ var useAllValidators = (variables, options) => {
6559
6570
  },
6560
6571
  {
6561
6572
  refreshInterval: 18e4 /* SLOW */,
6562
- ...options?.opts
6573
+ ...options
6563
6574
  }
6564
6575
  );
6565
6576
  return {
@@ -6569,11 +6580,10 @@ var useAllValidators = (variables, options) => {
6569
6580
  };
6570
6581
 
6571
6582
  // src/hooks/validators/useApiEnrichedAllocation.ts
6572
- import useSWR53 from "swr";
6573
6583
  function useApiEnrichedAllocation({
6574
6584
  allocation
6575
6585
  }) {
6576
- return useSWR53(
6586
+ return useSWR(
6577
6587
  allocation ? ["useApiEnrichedAllocation", allocation] : null,
6578
6588
  ([, allocation2]) => {
6579
6589
  return getApiEnrichedAllocation({ allocation: allocation2 });
@@ -6582,21 +6592,17 @@ function useApiEnrichedAllocation({
6582
6592
  }
6583
6593
 
6584
6594
  // src/hooks/validators/useApiValidator.ts
6585
- import useSWR54 from "swr";
6586
6595
  import { isHex } from "viem";
6587
6596
  var useApiValidatorQueryKey = (id) => id ? ["useApiValidator", id] : null;
6588
6597
  var useApiValidator = (id, options) => {
6589
6598
  const QUERY_KEY = useApiValidatorQueryKey(id);
6590
- const isEnabled = options?.opts?.isEnabled ?? true;
6591
- const swrResponse = useSWR54(
6592
- isEnabled && id ? QUERY_KEY : null,
6599
+ const swrResponse = useSWR(
6600
+ id ? QUERY_KEY : null,
6593
6601
  async ([, id2]) => {
6594
6602
  if (!id2 || !isHex(id2)) throw new Error(`Invalid validator ID: ${id2}`);
6595
6603
  return getApiValidator({ id: id2 });
6596
6604
  },
6597
- {
6598
- ...options?.opts
6599
- }
6605
+ options
6600
6606
  );
6601
6607
  return {
6602
6608
  ...swrResponse,
@@ -6605,8 +6611,7 @@ var useApiValidator = (id, options) => {
6605
6611
  };
6606
6612
 
6607
6613
  // src/hooks/validators/useBaselineRewardAllocation.ts
6608
- import useSWR55 from "swr";
6609
- import { usePublicClient as usePublicClient44 } from "@berachain/wagmi/hooks";
6614
+ import { usePublicClient as usePublicClient45 } from "@berachain/wagmi/hooks";
6610
6615
 
6611
6616
  // src/actions/validators/getBaselineRewardAllocation.ts
6612
6617
  import { rewardAllocatorFactoryAbi as rewardAllocationFactoryAbi } from "@berachain/abis/pol/rewards/rewardAllocatorFactory";
@@ -6628,8 +6633,8 @@ async function getBaselineRewardAllocation({
6628
6633
 
6629
6634
  // src/hooks/validators/useBaselineRewardAllocation.ts
6630
6635
  function useBaselineRewardAllocation() {
6631
- const publicClient = usePublicClient44();
6632
- return useSWR55(publicClient ? ["baselineRewardAllocation"] : null, () => {
6636
+ const publicClient = usePublicClient45();
6637
+ return useSWR(publicClient ? ["baselineRewardAllocation"] : null, () => {
6633
6638
  assertPublicClient(publicClient);
6634
6639
  return getBaselineRewardAllocation({
6635
6640
  publicClient
@@ -6638,13 +6643,12 @@ function useBaselineRewardAllocation() {
6638
6643
  }
6639
6644
 
6640
6645
  // src/hooks/validators/useDailyValidatorBlockStats.ts
6641
- import useSWR56 from "swr";
6642
6646
  var useDailyValidatorBlockStats = ({
6643
6647
  pubKey,
6644
6648
  first = 1
6645
6649
  }) => {
6646
6650
  const QUERY_KEY = pubKey ? ["useDailyValidatorBlockStats", pubKey, first] : null;
6647
- const swrResponse = useSWR56(
6651
+ const swrResponse = useSWR(
6648
6652
  QUERY_KEY,
6649
6653
  async ([, pubKey2, first2]) => {
6650
6654
  return await getDailyValidatorBlockStats({
@@ -6660,12 +6664,11 @@ var useDailyValidatorBlockStats = ({
6660
6664
  };
6661
6665
 
6662
6666
  // src/hooks/validators/useDefaultRewardAllocation.ts
6663
- import useSWR57 from "swr";
6664
- import { usePublicClient as usePublicClient45 } from "@berachain/wagmi/hooks";
6667
+ import { usePublicClient as usePublicClient46 } from "@berachain/wagmi/hooks";
6665
6668
  function useDefaultRewardAllocation(options) {
6666
- const publicClient = usePublicClient45();
6669
+ const publicClient = usePublicClient46();
6667
6670
  const QUERY_KEY = publicClient ? ["useDefaultRewardAllocation"] : null;
6668
- const swrResponse = useSWR57(
6671
+ const swrResponse = useSWR(
6669
6672
  QUERY_KEY,
6670
6673
  async () => {
6671
6674
  assertPublicClient(publicClient);
@@ -6674,7 +6677,7 @@ function useDefaultRewardAllocation(options) {
6674
6677
  });
6675
6678
  },
6676
6679
  {
6677
- ...options?.opts
6680
+ ...options
6678
6681
  }
6679
6682
  );
6680
6683
  return {
@@ -6685,8 +6688,7 @@ function useDefaultRewardAllocation(options) {
6685
6688
 
6686
6689
  // src/hooks/validators/useManagedValidatorRole.ts
6687
6690
  import { useMemo as useMemo13 } from "react";
6688
- import useSWR58 from "swr";
6689
- import { useBeraWallet as useBeraWallet23, usePublicClient as usePublicClient46 } from "@berachain/wagmi/hooks";
6691
+ import { useBeraWallet as useBeraWallet24, usePublicClient as usePublicClient47 } from "@berachain/wagmi/hooks";
6690
6692
 
6691
6693
  // src/actions/validators/getValidatorRewardAllocatorAddress.ts
6692
6694
  import { zeroAddress as zeroAddress25 } from "viem";
@@ -6733,15 +6735,15 @@ function useManagedValidatorRole({
6733
6735
  pubKey,
6734
6736
  account: accountAddress
6735
6737
  }, options) {
6736
- const publicClient = usePublicClient46();
6738
+ const publicClient = usePublicClient47();
6737
6739
  const mockValidatorOperator = useBeraFlag("mockValidatorOperator");
6738
6740
  const mockValidatorRewardAllocator = useBeraFlag(
6739
6741
  "mockValidatorRewardAllocator"
6740
6742
  );
6741
6743
  const QUERY_KEY = publicClient && pubKey ? ["useManagedValidatorRole", pubKey] : null;
6742
- const { address: connectedAccount } = useBeraWallet23();
6744
+ const { address: connectedAccount } = useBeraWallet24();
6743
6745
  const account = accountAddress ?? connectedAccount;
6744
- const swrResponse = useSWR58(
6746
+ const swrResponse = useSWR(
6745
6747
  QUERY_KEY,
6746
6748
  async ([, pubKey2]) => {
6747
6749
  assertPublicClient(publicClient);
@@ -6761,7 +6763,7 @@ function useManagedValidatorRole({
6761
6763
  };
6762
6764
  },
6763
6765
  {
6764
- ...options?.opts
6766
+ ...options
6765
6767
  }
6766
6768
  );
6767
6769
  const hasOperatorRole = useMemo13(() => {
@@ -6782,18 +6784,16 @@ function useManagedValidatorRole({
6782
6784
  }
6783
6785
 
6784
6786
  // src/hooks/validators/useOnChainValidator.ts
6785
- import useSWR59 from "swr";
6786
6787
  import { keccak256 as keccak2562 } from "viem";
6787
6788
  import { beaconDepositAbi } from "@berachain/abis/pol/beaconDeposit";
6788
6789
  import { bgtAbi as bgtAbi2 } from "@berachain/abis/pol/bgt";
6789
6790
  import { beraChefAbi as beraChefAbi3 } from "@berachain/abis/pol/rewards/beraChef";
6790
- import { usePublicClient as usePublicClient47 } from "@berachain/wagmi/hooks";
6791
+ import { usePublicClient as usePublicClient48 } from "@berachain/wagmi/hooks";
6791
6792
  var useOnChainValidator = ({ pubkey }, options) => {
6792
- const publicClient = usePublicClient47();
6793
+ const publicClient = usePublicClient48();
6793
6794
  const QUERY_KEY = pubkey ? ["useOnChainValidator", pubkey] : null;
6794
- const isEnabled = options.opts?.isEnabled ?? true;
6795
- const swrResponse = useSWR59(
6796
- isEnabled && publicClient ? QUERY_KEY : null,
6795
+ const swrResponse = useSWR(
6796
+ publicClient ? QUERY_KEY : null,
6797
6797
  async ([, pubkey2]) => {
6798
6798
  assertPublicClient(publicClient);
6799
6799
  const { config } = parseBaseArgs({
@@ -6825,7 +6825,8 @@ var useOnChainValidator = ({ pubkey }, options) => {
6825
6825
  operator,
6826
6826
  votingPower: Number(boostees)
6827
6827
  };
6828
- }
6828
+ },
6829
+ options
6829
6830
  );
6830
6831
  return {
6831
6832
  ...swrResponse,
@@ -6836,16 +6837,14 @@ var useOnChainValidator = ({ pubkey }, options) => {
6836
6837
  };
6837
6838
 
6838
6839
  // src/hooks/validators/useStakingPoolBatch.ts
6839
- import useSWR60 from "swr";
6840
- import { usePublicClient as usePublicClient48 } from "@berachain/wagmi/hooks";
6840
+ import { usePublicClient as usePublicClient49 } from "@berachain/wagmi/hooks";
6841
6841
  var useStakingPoolBatch = ({
6842
6842
  valPubKey,
6843
6843
  options
6844
6844
  }) => {
6845
- const publicClient = usePublicClient48();
6846
- const isEnabled = options?.opts?.isEnabled ?? true;
6847
- const QUERY_KEY = isEnabled && publicClient && valPubKey ? ["useStakingPoolBatch", valPubKey] : null;
6848
- const swrResponse = useSWR60(
6845
+ const publicClient = usePublicClient49();
6846
+ const QUERY_KEY = publicClient && valPubKey ? ["useStakingPoolBatch", valPubKey] : null;
6847
+ const swrResponse = useSWR(
6849
6848
  QUERY_KEY,
6850
6849
  async ([, valPubKey2]) => {
6851
6850
  assertPublicClient(publicClient);
@@ -6856,7 +6855,7 @@ var useStakingPoolBatch = ({
6856
6855
  },
6857
6856
  {
6858
6857
  refreshInterval: 1e4 /* FAST */,
6859
- ...options?.opts
6858
+ ...options
6860
6859
  }
6861
6860
  );
6862
6861
  return {
@@ -6866,13 +6865,12 @@ var useStakingPoolBatch = ({
6866
6865
  };
6867
6866
 
6868
6867
  // src/hooks/validators/useUserActiveValidators.ts
6869
- import useSWR61 from "swr";
6870
- import { useBeraWallet as useBeraWallet24, usePublicClient as usePublicClient49 } from "@berachain/wagmi/hooks";
6868
+ import { useBeraWallet as useBeraWallet25, usePublicClient as usePublicClient50 } from "@berachain/wagmi/hooks";
6871
6869
  var useUserActiveValidators = (options) => {
6872
- const { address: account } = useBeraWallet24();
6873
- const publicClient = usePublicClient49();
6870
+ const { address: account } = useBeraWallet25();
6871
+ const publicClient = usePublicClient50();
6874
6872
  const QUERY_KEY = publicClient && account ? ["useUserActiveValidators", account] : null;
6875
- const swrResponse = useSWR61(
6873
+ const swrResponse = useSWR(
6876
6874
  QUERY_KEY,
6877
6875
  async ([, account2]) => {
6878
6876
  return await getUserActiveValidators({
@@ -6882,7 +6880,7 @@ var useUserActiveValidators = (options) => {
6882
6880
  },
6883
6881
  {
6884
6882
  ...options,
6885
- refreshInterval: options?.opts?.refreshInterval ?? 18e4 /* SLOW */,
6883
+ refreshInterval: options?.refreshInterval ?? 18e4 /* SLOW */,
6886
6884
  keepPreviousData: true
6887
6885
  }
6888
6886
  );
@@ -6893,17 +6891,16 @@ var useUserActiveValidators = (options) => {
6893
6891
  };
6894
6892
 
6895
6893
  // src/hooks/validators/useUserBoostsOnValidator.ts
6896
- import useSWR62 from "swr";
6897
- import { useBeraWallet as useBeraWallet25, usePublicClient as usePublicClient50 } from "@berachain/wagmi/hooks";
6894
+ import { useBeraWallet as useBeraWallet26, usePublicClient as usePublicClient51 } from "@berachain/wagmi/hooks";
6898
6895
  var useUserBoostsOnValidator = ({
6899
6896
  pubkey,
6900
6897
  ...args
6901
6898
  }) => {
6902
- const { address: connectedAccount } = useBeraWallet25();
6903
- const publicClient = usePublicClient50();
6899
+ const { address: connectedAccount } = useBeraWallet26();
6900
+ const publicClient = usePublicClient51();
6904
6901
  const account = args.account ?? connectedAccount;
6905
6902
  const QUERY_KEY = account && pubkey ? ["useUserBoostsOnValidator", pubkey, account] : null;
6906
- const swrResponse = useSWR62(
6903
+ const swrResponse = useSWR(
6907
6904
  QUERY_KEY,
6908
6905
  async ([, pubkey2, account2]) => {
6909
6906
  return await getUserBoostsOnValidator({
@@ -6921,8 +6918,7 @@ var useUserBoostsOnValidator = ({
6921
6918
 
6922
6919
  // src/hooks/validators/useUserClaimableIncentives.ts
6923
6920
  import { useCallback as useCallback4, useMemo as useMemo14 } from "react";
6924
- import useSWR63 from "swr";
6925
- import { useBeraWallet as useBeraWallet26 } from "@berachain/wagmi/hooks";
6921
+ import { useBeraWallet as useBeraWallet27 } from "@berachain/wagmi/hooks";
6926
6922
 
6927
6923
  // src/utils/formatIncentivesTokenMap.ts
6928
6924
  var formatIncentivesTokenMap = (allRewards) => {
@@ -6941,9 +6937,9 @@ var formatIncentivesTokenMap = (allRewards) => {
6941
6937
 
6942
6938
  // src/hooks/validators/useUserClaimableIncentives.ts
6943
6939
  var useUserClaimableIncentives = () => {
6944
- const { address: account } = useBeraWallet26();
6940
+ const { address: account } = useBeraWallet27();
6945
6941
  const REWARDS_QUERY_KEY = account ? ["useUserClaimableIncentives", account] : null;
6946
- const allRewardsResponse = useSWR63(
6942
+ const allRewardsResponse = useSWR(
6947
6943
  REWARDS_QUERY_KEY,
6948
6944
  async ([, account2]) => {
6949
6945
  if (!account2) {
@@ -6984,7 +6980,7 @@ var useUserClaimableIncentives = () => {
6984
6980
  return formatIncentivesTokenMap(allRewards);
6985
6981
  }, [allRewards, account]);
6986
6982
  const QUERY_KEY = account && allRewards ? ["useUserClaimableIncentives", account, allRewards] : null;
6987
- const swrResponse = useSWR63(
6983
+ const swrResponse = useSWR(
6988
6984
  QUERY_KEY,
6989
6985
  async ([, account2, allRewards2]) => {
6990
6986
  if (!account2) {
@@ -7043,13 +7039,12 @@ var useUserClaimableIncentives = () => {
7043
7039
  };
7044
7040
 
7045
7041
  // src/hooks/validators/useUserStakingPositions.ts
7046
- import useSWRImmutable14 from "swr/immutable";
7047
7042
  var useUserStakingPositions = ({
7048
7043
  account,
7049
7044
  validatorAddress
7050
7045
  }) => {
7051
7046
  const queryClient = account ? ["useUserStakingPositions", account, validatorAddress] : null;
7052
- const swrResponse = useSWRImmutable14(
7047
+ const swrResponse = useSWRImmutable(
7053
7048
  queryClient,
7054
7049
  async ([_, account2, validatorAddress2]) => {
7055
7050
  const userStakingPolls = await getUserStakingPositions(account2);
@@ -7092,12 +7087,10 @@ function useValidator({ pubkey }, options) {
7092
7087
  dynamicData: {
7093
7088
  activeBoostAmount: onChainValidator?.dynamicData?.activeBoostAmount ?? indexerValidator?.dynamicData?.activeBoostAmount ?? "",
7094
7089
  queuedBoostAmount: indexerValidator?.dynamicData?.queuedBoostAmount ?? "",
7095
- usersActiveBoostCount: indexerValidator?.dynamicData?.usersActiveBoostCount ?? 0,
7096
- usersQueuedBoostCount: indexerValidator?.dynamicData?.usersQueuedBoostCount ?? 0,
7097
- allTimeDistributedBGTAmount: indexerValidator?.dynamicData?.allTimeDistributedBGTAmount ?? "0",
7090
+ allTimeDistributedRewards: indexerValidator?.dynamicData?.allTimeDistributedRewards ?? "0",
7098
7091
  rewardRate: onChainValidator?.dynamicData?.rewardRate ?? indexerValidator?.dynamicData?.rewardRate ?? "",
7099
7092
  stakedBeraAmount: indexerValidator?.dynamicData?.stakedBeraAmount ?? "",
7100
- lastDayDistributedBGTAmount: indexerValidator?.dynamicData?.lastDayDistributedBGTAmount ?? "",
7093
+ lastDayDistributedRewards: indexerValidator?.dynamicData?.lastDayDistributedRewards ?? "",
7101
7094
  lastDayProposedBlockCount: indexerValidator?.dynamicData?.lastDayProposedBlockCount ?? 0,
7102
7095
  activeBoostAmountRank: indexerValidator?.dynamicData?.activeBoostAmountRank ?? 0,
7103
7096
  boostApr: indexerValidator?.dynamicData?.boostApr ?? // todo: remove 'as' once BE has migrated types
@@ -7116,13 +7109,12 @@ function useValidator({ pubkey }, options) {
7116
7109
  }
7117
7110
 
7118
7111
  // src/hooks/validators/useValidatorAnalytics.ts
7119
- import useSWR64 from "swr";
7120
7112
  function useValidatorAnalytics({
7121
7113
  pubkey,
7122
7114
  dayRange
7123
7115
  }) {
7124
7116
  const QUERY_KEY = pubkey && dayRange ? ["useValidatorAnalytics", pubkey, dayRange] : null;
7125
- const swrResponse = useSWR64(
7117
+ const swrResponse = useSWR(
7126
7118
  QUERY_KEY,
7127
7119
  async ([, pubkey2, dayRange2]) => {
7128
7120
  return await getValidatorAnalytics({
@@ -7138,12 +7130,11 @@ function useValidatorAnalytics({
7138
7130
  }
7139
7131
 
7140
7132
  // src/hooks/validators/useValidatorCommission.ts
7141
- import useSWR65 from "swr";
7142
- import { usePublicClient as usePublicClient51 } from "@berachain/wagmi/hooks";
7133
+ import { usePublicClient as usePublicClient52 } from "@berachain/wagmi/hooks";
7143
7134
  var useValidatorCommission = (pubKey, options) => {
7144
- const publicClient = usePublicClient51();
7135
+ const publicClient = usePublicClient52();
7145
7136
  const QUERY_KEY = publicClient && pubKey ? ["useValidatorCommission", pubKey] : null;
7146
- const swrResponse = useSWR65(
7137
+ const swrResponse = swr_default(
7147
7138
  QUERY_KEY,
7148
7139
  async ([, pubKey2]) => {
7149
7140
  return await getValidatorCommission({
@@ -7152,7 +7143,7 @@ var useValidatorCommission = (pubKey, options) => {
7152
7143
  });
7153
7144
  },
7154
7145
  {
7155
- ...options?.opts
7146
+ ...options
7156
7147
  }
7157
7148
  );
7158
7149
  return {
@@ -7175,9 +7166,6 @@ var useValidatorEstimatedBgtPerYear = (validator) => {
7175
7166
  };
7176
7167
  };
7177
7168
 
7178
- // src/hooks/validators/useValidatorIncentiveDistribution.ts
7179
- import useSWR66 from "swr";
7180
-
7181
7169
  // src/actions/validators/getValidatorIncentiveDistribution.ts
7182
7170
  async function getValidatorIncentiveDistribution({
7183
7171
  pubkey,
@@ -7189,15 +7177,42 @@ async function getValidatorIncentiveDistribution({
7189
7177
  level: "error"
7190
7178
  });
7191
7179
  }
7192
- const params = new URLSearchParams({
7193
- pubkey,
7194
- dayRange: String(dayRange)
7195
- });
7196
- return beraFetchJson({
7197
- url: `/api/pol/validator-incentive-distribution?${params}`,
7198
- name: "pol-validator-incentive-distribution",
7199
- type: "rest"
7200
- });
7180
+ const { config } = parseBaseArgs({});
7181
+ if (!config.beep) {
7182
+ const params = new URLSearchParams({
7183
+ pubkey,
7184
+ dayRange: String(dayRange)
7185
+ });
7186
+ return beraFetchJson({
7187
+ url: `/api/pol/validator-incentive-distribution?${params}`,
7188
+ name: "pol-validator-incentive-distribution",
7189
+ type: "rest"
7190
+ });
7191
+ }
7192
+ const SECONDS_PER_DAY = 86400;
7193
+ const after = String(
7194
+ Math.floor(
7195
+ calculateTimestampFromDays(dayRange) / 1e6 / SECONDS_PER_DAY
7196
+ ) * SECONDS_PER_DAY
7197
+ );
7198
+ const PER_PAGE = 1e3;
7199
+ const rows = [];
7200
+ let page = 1;
7201
+ while (true) {
7202
+ const pageRows = await fetchBeep("/v0/validators/{pubkey}/incentives", {
7203
+ path: { pubkey },
7204
+ query: {
7205
+ interval: "day",
7206
+ after,
7207
+ page: String(page),
7208
+ perPage: String(PER_PAGE)
7209
+ }
7210
+ });
7211
+ rows.push(...pageRows);
7212
+ if (pageRows.length < PER_PAGE) break;
7213
+ page++;
7214
+ }
7215
+ return rows;
7201
7216
  }
7202
7217
 
7203
7218
  // src/hooks/validators/useValidatorIncentiveDistribution.ts
@@ -7206,7 +7221,7 @@ function useValidatorIncentiveDistribution({
7206
7221
  dayRange
7207
7222
  }) {
7208
7223
  const QUERY_KEY = pubkey && dayRange ? ["useValidatorIncentiveDistribution", pubkey, dayRange] : null;
7209
- const swrResponse = useSWR66(
7224
+ const swrResponse = useSWR(
7210
7225
  QUERY_KEY,
7211
7226
  async ([, pubkey2, dayRange2]) => {
7212
7227
  return await getValidatorIncentiveDistribution({ pubkey: pubkey2, dayRange: dayRange2 });
@@ -7219,12 +7234,11 @@ function useValidatorIncentiveDistribution({
7219
7234
  }
7220
7235
 
7221
7236
  // src/hooks/validators/useValidatorQueuedCommission.ts
7222
- import useSWR67 from "swr";
7223
- import { usePublicClient as usePublicClient52 } from "@berachain/wagmi/hooks";
7237
+ import { usePublicClient as usePublicClient53 } from "@berachain/wagmi/hooks";
7224
7238
  function useValidatorQueuedCommission(pubKey, options) {
7225
- const publicClient = usePublicClient52();
7239
+ const publicClient = usePublicClient53();
7226
7240
  const QUERY_KEY = publicClient && pubKey ? ["useValidatorQueuedCommission", pubKey] : null;
7227
- const swrResponse = useSWR67(
7241
+ const swrResponse = useSWR(
7228
7242
  QUERY_KEY,
7229
7243
  async ([, pubKey2]) => {
7230
7244
  assertPublicClient(publicClient);
@@ -7234,7 +7248,7 @@ function useValidatorQueuedCommission(pubKey, options) {
7234
7248
  });
7235
7249
  },
7236
7250
  {
7237
- ...options?.opts
7251
+ ...options
7238
7252
  }
7239
7253
  );
7240
7254
  return {
@@ -7244,12 +7258,11 @@ function useValidatorQueuedCommission(pubKey, options) {
7244
7258
  }
7245
7259
 
7246
7260
  // src/hooks/validators/useValidatorQueuedOperatorAddress.ts
7247
- import useSWR68 from "swr";
7248
- import { usePublicClient as usePublicClient53 } from "@berachain/wagmi/hooks";
7261
+ import { usePublicClient as usePublicClient54 } from "@berachain/wagmi/hooks";
7249
7262
  var useValidatorQueuedOperatorAddress = (pubKey, options) => {
7250
- const publicClient = usePublicClient53();
7263
+ const publicClient = usePublicClient54();
7251
7264
  const QUERY_KEY = publicClient && pubKey ? ["useValidatorQueuedOperatorAddress", pubKey] : null;
7252
- const swrResponse = useSWR68(
7265
+ const swrResponse = useSWR(
7253
7266
  QUERY_KEY,
7254
7267
  async ([, pubKey2]) => {
7255
7268
  return await getValidatorQueuedOperatorAddress({
@@ -7258,7 +7271,7 @@ var useValidatorQueuedOperatorAddress = (pubKey, options) => {
7258
7271
  });
7259
7272
  },
7260
7273
  {
7261
- ...options?.opts
7274
+ ...options
7262
7275
  }
7263
7276
  );
7264
7277
  return {
@@ -7268,12 +7281,11 @@ var useValidatorQueuedOperatorAddress = (pubKey, options) => {
7268
7281
  };
7269
7282
 
7270
7283
  // src/hooks/validators/useValidatorQueuedRewardAllocation.ts
7271
- import useSWR69 from "swr";
7272
- import { usePublicClient as usePublicClient54 } from "@berachain/wagmi/hooks";
7284
+ import { usePublicClient as usePublicClient55 } from "@berachain/wagmi/hooks";
7273
7285
  var useValidatorQueuedRewardAllocation = (pubKey, options) => {
7274
- const publicClient = usePublicClient54();
7286
+ const publicClient = usePublicClient55();
7275
7287
  const QUERY_KEY = publicClient && pubKey ? ["useValidatorQueuedRewardAllocation", pubKey] : null;
7276
- const swrResponse = useSWR69(
7288
+ const swrResponse = useSWR(
7277
7289
  QUERY_KEY,
7278
7290
  async ([, pubKey2]) => {
7279
7291
  return await getValidatorQueuedRewardAllocation({
@@ -7282,7 +7294,7 @@ var useValidatorQueuedRewardAllocation = (pubKey, options) => {
7282
7294
  });
7283
7295
  },
7284
7296
  {
7285
- ...options?.opts
7297
+ ...options
7286
7298
  }
7287
7299
  );
7288
7300
  return {
@@ -7292,12 +7304,11 @@ var useValidatorQueuedRewardAllocation = (pubKey, options) => {
7292
7304
  };
7293
7305
 
7294
7306
  // src/hooks/validators/useValidatorRewardAllocation.ts
7295
- import useSWR70 from "swr";
7296
- import { usePublicClient as usePublicClient55 } from "@berachain/wagmi/hooks";
7307
+ import { usePublicClient as usePublicClient56 } from "@berachain/wagmi/hooks";
7297
7308
  function useValidatorRewardAllocation(pubKey, options) {
7298
- const publicClient = usePublicClient55();
7309
+ const publicClient = usePublicClient56();
7299
7310
  const QUERY_KEY = publicClient && pubKey ? ["useValidatorRewardAllocation", pubKey] : null;
7300
- const swrResponse = useSWR70(
7311
+ const swrResponse = useSWR(
7301
7312
  QUERY_KEY,
7302
7313
  async ([, pubKey2]) => {
7303
7314
  return getValidatorRewardAllocation({
@@ -7306,7 +7317,7 @@ function useValidatorRewardAllocation(pubKey, options) {
7306
7317
  });
7307
7318
  },
7308
7319
  {
7309
- ...options?.opts
7320
+ ...options
7310
7321
  }
7311
7322
  );
7312
7323
  return {
@@ -7330,6 +7341,7 @@ export {
7330
7341
  useApiValidator,
7331
7342
  useApiValidatorQueryKey,
7332
7343
  useAutoclaimedIncentives,
7344
+ useAutoclaimedIncentivesTxHash,
7333
7345
  useBaselineRewardAllocation,
7334
7346
  useBendDemultiply,
7335
7347
  useBendMultiply,
@@ -7339,6 +7351,7 @@ export {
7339
7351
  useBeraCurrentPrice,
7340
7352
  useBexStatus,
7341
7353
  useBgtAprSimulation,
7354
+ useBgtIncentiveDistributorPaused,
7342
7355
  useBgtUnstakedBalance,
7343
7356
  useBlockToTimestamp,
7344
7357
  useCappedGlobally,