@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
@@ -1,55 +1,61 @@
1
+ import {
2
+ fetchBeep,
3
+ fetchRailwayBackend
4
+ } from "./chunk-MRQGHXAN.mjs";
1
5
  import {
2
6
  getApolloClient
3
- } from "./chunk-4Z4AK6SH.mjs";
7
+ } from "./chunk-3JJLQ2JX.mjs";
4
8
  import {
5
9
  pythAbi
6
10
  } from "./chunk-CDK4YV3D.mjs";
7
11
  import {
8
12
  NotFoundError,
9
13
  TransactionFailedError
10
- } from "./chunk-WXXOISTU.mjs";
14
+ } from "./chunk-AUOPN6NK.mjs";
11
15
  import {
12
16
  BeraMonitoring,
13
17
  initBeraError
14
- } from "./chunk-EXIUPSFN.mjs";
18
+ } from "./chunk-7YVNSDXG.mjs";
15
19
  import {
16
20
  assertAddress,
17
21
  assertDefined,
18
22
  assertPublicClient
19
- } from "./chunk-KQUMKB66.mjs";
23
+ } from "./chunk-GY6B3PD5.mjs";
20
24
  import {
21
25
  CAP_LIMIT_BUFFER,
22
26
  DEFAULT_METAMASK_GAS_LIMIT,
23
- beraFetch,
24
- beraFetchJson,
25
27
  bignumber_js_default,
26
28
  formatTimeLeft,
27
- getErrorResponse,
28
29
  getPythDefaultUpdateFee,
29
30
  getSafeNumber,
30
31
  getTestClient,
31
32
  msToSeconds,
32
33
  seconds,
33
34
  yearsInSeconds
34
- } from "./chunk-CDFWPU2R.mjs";
35
+ } from "./chunk-E7YFXBBQ.mjs";
36
+ import {
37
+ beraFetch,
38
+ beraFetchJson,
39
+ getErrorResponse
40
+ } from "./chunk-Y6THHG77.mjs";
35
41
  import {
36
42
  beraToken,
37
43
  getHoneyToken,
38
44
  isToken
39
- } from "./chunk-NPBQLVL3.mjs";
45
+ } from "./chunk-IXIBY5FP.mjs";
40
46
  import {
41
47
  parseBaseArgs
42
- } from "./chunk-75M6TF7M.mjs";
48
+ } from "./chunk-DQRH5VE3.mjs";
43
49
  import {
44
50
  RequestError
45
- } from "./chunk-XIYN6AL6.mjs";
51
+ } from "./chunk-ZLTMIFCZ.mjs";
46
52
  import {
47
53
  BeraError,
48
54
  InvalidArgumentError,
49
55
  commonAbiErrors,
50
56
  parseDecodedError,
51
57
  parseViemError
52
- } from "./chunk-J5I45WGQ.mjs";
58
+ } from "./chunk-KHXJDYA4.mjs";
53
59
 
54
60
  // src/actions/bend/getConvertToAssets.ts
55
61
  import { formatEther } from "viem";
@@ -581,13 +587,32 @@ async function getChartData({
581
587
  level: "error"
582
588
  });
583
589
  }
584
- const params = new URLSearchParams({ interval: "day", first: String(days) });
585
- const honeySnapshots = await beraFetchJson({
586
- url: `/api/honey/snapshots?${params}`,
587
- name: "honey-snapshots",
588
- type: "rest"
590
+ const { config } = parseBaseArgs({});
591
+ if (!config.beep) {
592
+ const params = new URLSearchParams({
593
+ interval: "day",
594
+ first: String(days)
595
+ });
596
+ const snapshots = await beraFetchJson({
597
+ url: `/api/honey/snapshots?${params}`,
598
+ name: "honey-snapshots",
599
+ type: "rest"
600
+ });
601
+ return snapshots.map(fromHoneySnapshot);
602
+ }
603
+ return fetchBeep("/v0/honey/snapshots/{interval}", {
604
+ path: { interval: "day" },
605
+ query: { perPage: String(days) }
589
606
  });
590
- return { honeySnapshots };
607
+ }
608
+ function fromHoneySnapshot(snapshot) {
609
+ return {
610
+ timestamp: Math.floor(Number(snapshot.timestamp) / 1e6),
611
+ mintVolume: snapshot.mintVolume,
612
+ redeemVolume: snapshot.redeemVolume,
613
+ totalVolume: snapshot.totalVolume,
614
+ totalSupply: snapshot.totalSupply
615
+ };
591
616
  }
592
617
 
593
618
  // src/actions/honey/getCollateralWeights.ts
@@ -922,12 +947,23 @@ async function getHoney24hVolume() {
922
947
  level: "error"
923
948
  });
924
949
  }
925
- const params = new URLSearchParams({ interval: "hour", first: "24" });
926
- const snapshots = await beraFetchJson({
927
- url: `/api/honey/snapshots?${params}`,
928
- name: "honey-snapshots",
929
- type: "rest"
950
+ const { config } = parseBaseArgs({});
951
+ if (!config.beep) {
952
+ const params = new URLSearchParams({ interval: "hour", first: "24" });
953
+ const snapshots2 = await beraFetchJson({
954
+ url: `/api/honey/snapshots?${params}`,
955
+ name: "honey-snapshots",
956
+ type: "rest"
957
+ });
958
+ return sumTotalVolume(snapshots2);
959
+ }
960
+ const snapshots = await fetchBeep("/v0/honey/snapshots/{interval}", {
961
+ path: { interval: "hour" },
962
+ query: { perPage: "24" }
930
963
  });
964
+ return sumTotalVolume(snapshots);
965
+ }
966
+ function sumTotalVolume(snapshots) {
931
967
  return snapshots.reduce(
932
968
  (acc, curr) => new bignumber_js_default(curr.totalVolume).plus(acc),
933
969
  new bignumber_js_default(0)
@@ -1089,7 +1125,40 @@ async function getHoneyVaultsBalance({
1089
1125
  // src/actions/honey/getPythLatestPrices.ts
1090
1126
  import { HermesClient } from "@pythnetwork/hermes-client";
1091
1127
  import { formatUnits as formatUnits4 } from "viem";
1128
+
1129
+ // src/utils/polyfillAbortSignalAny.ts
1130
+ function polyfillAbortSignalAny() {
1131
+ if (typeof AbortSignal === "undefined") return;
1132
+ if (typeof AbortSignal.any === "function") return;
1133
+ AbortSignal.any = (signals) => {
1134
+ const controller = new AbortController();
1135
+ for (const signal of signals) {
1136
+ if (signal.aborted) {
1137
+ controller.abort(signal.reason);
1138
+ return controller.signal;
1139
+ }
1140
+ }
1141
+ const listeners = [];
1142
+ const cleanup = () => {
1143
+ for (let i = 0; i < signals.length; i++) {
1144
+ signals[i].removeEventListener("abort", listeners[i]);
1145
+ }
1146
+ };
1147
+ for (const signal of signals) {
1148
+ const onAbort = () => {
1149
+ if (!controller.signal.aborted) controller.abort(signal.reason);
1150
+ cleanup();
1151
+ };
1152
+ listeners.push(onAbort);
1153
+ signal.addEventListener("abort", onAbort);
1154
+ }
1155
+ return controller.signal;
1156
+ };
1157
+ }
1158
+
1159
+ // src/actions/honey/getPythLatestPrices.ts
1092
1160
  var pythEndpoint = "https://hermes.pyth.network";
1161
+ polyfillAbortSignalAny();
1093
1162
  async function getPythLatestPrices({
1094
1163
  priceFeedId
1095
1164
  }) {
@@ -1317,14 +1386,44 @@ async function getAutoclaimedIncentives({
1317
1386
  ...args
1318
1387
  }) {
1319
1388
  const { config } = parseBaseArgs(args);
1320
- return beraFetchJson(
1321
- {
1322
- url: `${config.pol.bribeBoostApi}/api/v1/wallets/${account.toLowerCase()}/autoclaimed`,
1323
- name: "pol-autoclaimed-incentives",
1324
- type: "rest"
1325
- },
1326
- { cache: "no-store" }
1327
- );
1389
+ try {
1390
+ return await beraFetchJson(
1391
+ {
1392
+ url: `${config.pol.bribeBoostApi}/api/v1/wallets/${account.toLowerCase()}/autoclaimed`,
1393
+ name: "pol-autoclaimed-incentives",
1394
+ type: "rest"
1395
+ },
1396
+ { cache: "no-store" }
1397
+ );
1398
+ } catch (error) {
1399
+ if (error instanceof RequestError && error.statusCode === 404) {
1400
+ return null;
1401
+ }
1402
+ throw error;
1403
+ }
1404
+ }
1405
+
1406
+ // src/actions/pol/getAutoclaimedIncentivesTxHash.ts
1407
+ async function getAutoclaimedIncentivesTxHash({
1408
+ account,
1409
+ ...args
1410
+ }) {
1411
+ const { config } = parseBaseArgs(args);
1412
+ try {
1413
+ return await beraFetchJson(
1414
+ {
1415
+ url: `${config.pol.bribeBoostApi}/api/v1/wallets/${account.toLowerCase()}/autoclaimed/txhash`,
1416
+ name: "pol-autoclaimed-incentives-txhash",
1417
+ type: "rest"
1418
+ },
1419
+ { cache: "no-store" }
1420
+ );
1421
+ } catch (error) {
1422
+ if (error instanceof RequestError && error.statusCode === 404) {
1423
+ return null;
1424
+ }
1425
+ throw error;
1426
+ }
1328
1427
  }
1329
1428
 
1330
1429
  // src/actions/pol/getRewardVaultRewards.ts
@@ -1482,20 +1581,40 @@ function getBgtAprSimulation({
1482
1581
  };
1483
1582
  }
1484
1583
 
1584
+ // src/actions/pol/getBgtIncentiveDistributorPaused.ts
1585
+ import { bgtIncentiveDistributorAbi } from "@berachain/abis/pol/rewards/bgtIncentiveDistributor";
1586
+ async function getBgtIncentiveDistributorPaused({
1587
+ publicClient,
1588
+ ...args
1589
+ }) {
1590
+ assertPublicClient(publicClient);
1591
+ const { config } = parseBaseArgs(args);
1592
+ return publicClient.readContract({
1593
+ address: config.pol.bgtIncentiveDistributor,
1594
+ abi: bgtIncentiveDistributorAbi,
1595
+ functionName: "paused"
1596
+ });
1597
+ }
1598
+
1485
1599
  // src/actions/pol/getEarnedStakedBeraVault.ts
1486
- import { getUriFromLink } from "@berachain/config";
1487
1600
  async function getEarnedStakedBeraVault({
1488
1601
  address,
1489
1602
  account,
1490
1603
  ...args
1491
1604
  }) {
1492
1605
  const { config } = parseBaseArgs(args);
1493
- const url = `${getUriFromLink(config.backend)}/vaults/${address}/earnings/${account}`;
1494
- return beraFetchJson({
1495
- url,
1496
- name: typeof config.backend === "string" ? "backend-railway" : config.backend.name,
1497
- type: "rest"
1498
- });
1606
+ if (!config.beep) {
1607
+ return fetchRailwayBackend(
1608
+ "/vaults/{vault}/earnings/{owner}",
1609
+ { path: { vault: address, owner: account } },
1610
+ args
1611
+ );
1612
+ }
1613
+ return fetchBeep(
1614
+ "/v0/stake/{vault}/earnings/{owner}",
1615
+ { path: { vault: address, owner: account } },
1616
+ args
1617
+ );
1499
1618
  }
1500
1619
 
1501
1620
  // src/actions/pol/getRewardVaults.ts
@@ -1547,11 +1666,11 @@ async function getRewardVaults({
1547
1666
  ...vault,
1548
1667
  dynamicData: {
1549
1668
  ...vault.dynamicData,
1550
- allTimeReceivedBGTAmount: vault.dynamicData?.allTimeReceivedBGTAmount ?? "0",
1551
- bgtCapturePercentage: vault.dynamicData?.bgtCapturePercentage ?? "0",
1669
+ allTimeRewards: vault.dynamicData?.allTimeRewards ?? "0",
1670
+ rewardCapturePercentage: vault.dynamicData?.rewardCapturePercentage ?? 0,
1552
1671
  activeIncentivesValueUsd: totalIncentiveInUsdc.toString(),
1553
1672
  activeIncentivesRateUsd: vault.dynamicData?.activeIncentivesRateUsd ?? "0",
1554
- bgtCapturePerBlock: vault.dynamicData?.bgtCapturePerBlock ?? "0"
1673
+ rewardCapturePerBlock: vault.dynamicData?.rewardCapturePerBlock ?? 0
1555
1674
  },
1556
1675
  activeIncentives: incentivesArray
1557
1676
  };
@@ -4002,9 +4121,11 @@ export {
4002
4121
  isBasketModeEnabled,
4003
4122
  getBlockTimestamp,
4004
4123
  getAutoclaimedIncentives,
4124
+ getAutoclaimedIncentivesTxHash,
4005
4125
  RewardVaultDistributionMode,
4006
4126
  getRewardVaultRewards,
4007
4127
  getBgtAprSimulation,
4128
+ getBgtIncentiveDistributorPaused,
4008
4129
  getEarnedStakedBeraVault,
4009
4130
  getRewardVaults,
4010
4131
  getGlobalData,
@@ -0,0 +1,126 @@
1
+ import {
2
+ BeraTracing
3
+ } from "./chunk-SZ5C44L5.mjs";
4
+ import {
5
+ RequestError
6
+ } from "./chunk-ZLTMIFCZ.mjs";
7
+
8
+ // src/utils/getErrorResponse.ts
9
+ async function getErrorResponse(response) {
10
+ const contentType = response.headers.get("content-type");
11
+ if (contentType?.includes("application/json")) {
12
+ return response.json();
13
+ } else {
14
+ const text = await response.text();
15
+ try {
16
+ return JSON.parse(text);
17
+ } catch {
18
+ return {
19
+ message: "Unknown error, can't decode response into JSON",
20
+ cause: text
21
+ };
22
+ }
23
+ }
24
+ }
25
+
26
+ // src/utils/sanitizeRpcUrl.ts
27
+ function sanitizeRpcUrl(url) {
28
+ if (!url) return "";
29
+ try {
30
+ const parsed = new URL(url);
31
+ if (parsed.hostname.endsWith(".quiknode.pro")) {
32
+ parsed.pathname = "/";
33
+ parsed.search = "";
34
+ return parsed.toString();
35
+ }
36
+ return url;
37
+ } catch {
38
+ return url;
39
+ }
40
+ }
41
+
42
+ // src/utils/beraFetch.ts
43
+ async function beraFetch(endpoint, options, spanContext) {
44
+ try {
45
+ let spanUrl = sanitizeRpcUrl(
46
+ typeof endpoint === "string" || endpoint instanceof URL ? endpoint.toString() : endpoint.url.toString()
47
+ ).replace(/0x[a-fA-F0-9]{40}/g, ":address");
48
+ if (spanContext?.keepQueryParams !== true && URL.canParse(spanUrl)) {
49
+ const queryParams = new URL(spanUrl).searchParams;
50
+ if (Array.isArray(spanContext?.keepQueryParams)) {
51
+ const searchParams = new URLSearchParams();
52
+ for (const param of spanContext.keepQueryParams) {
53
+ searchParams.set(param, queryParams.get(param) ?? "");
54
+ }
55
+ const newUrl = new URL(spanUrl);
56
+ newUrl.search = searchParams.toString();
57
+ spanUrl = newUrl.toString();
58
+ } else {
59
+ const newUrl = new URL(spanUrl);
60
+ newUrl.search = "";
61
+ spanUrl = newUrl.toString();
62
+ }
63
+ }
64
+ const endpointName = typeof endpoint === "string" || endpoint instanceof URL ? void 0 : endpoint.name;
65
+ return await BeraTracing.startSpan(
66
+ {
67
+ op: "beraFetch",
68
+ name: endpointName ? `beraFetch ${endpointName}` : "beraFetch",
69
+ attributes: typeof endpoint === "string" || endpoint instanceof URL ? {
70
+ "operation.source.url": spanUrl,
71
+ ...spanContext?.attributes
72
+ } : {
73
+ "operation.source.url": spanUrl,
74
+ "operation.source.type": endpoint.type,
75
+ "operation.source.name": endpoint.name,
76
+ ...spanContext?.attributes
77
+ }
78
+ },
79
+ async () => {
80
+ const response = await fetch(
81
+ typeof endpoint === "string" || endpoint instanceof URL ? endpoint : endpoint.url,
82
+ {
83
+ ...options
84
+ }
85
+ );
86
+ if (!response.ok) {
87
+ const error = await getErrorResponse(response);
88
+ throw new RequestError({
89
+ cause: error,
90
+ // @to-do import getErrorResponse logic in this function
91
+ // when it's removed from other places
92
+ response,
93
+ endpoint
94
+ });
95
+ }
96
+ return response;
97
+ }
98
+ );
99
+ } catch (error) {
100
+ if (error instanceof RequestError) {
101
+ throw error;
102
+ }
103
+ throw new RequestError({
104
+ cause: error,
105
+ endpoint,
106
+ response: void 0
107
+ });
108
+ }
109
+ }
110
+ async function beraFetchJson(endpoint, options) {
111
+ const response = await beraFetch(endpoint, {
112
+ ...options,
113
+ headers: {
114
+ Accept: "application/json",
115
+ ...options?.headers
116
+ }
117
+ });
118
+ return response.json();
119
+ }
120
+
121
+ export {
122
+ getErrorResponse,
123
+ sanitizeRpcUrl,
124
+ beraFetch,
125
+ beraFetchJson
126
+ };
@@ -3,10 +3,11 @@ import {
3
3
  errorMsgMap,
4
4
  httpStatusToSpanStatus,
5
5
  reasonToSpanStatus
6
- } from "./chunk-J5I45WGQ.mjs";
6
+ } from "./chunk-KHXJDYA4.mjs";
7
7
 
8
8
  // src/errors/RequestError.ts
9
9
  import { getUriFromLink } from "@berachain/config";
10
+ import { bepolia } from "@berachain/config/bepolia";
10
11
  import { mainnet } from "@berachain/config/mainnet";
11
12
  var RequestError = class _RequestError extends BeraError {
12
13
  /**
@@ -25,12 +26,16 @@ var RequestError = class _RequestError extends BeraError {
25
26
  */
26
27
  queryRichfulDomains = [
27
28
  mainnet.bex.aggregatorsProxyUrl,
28
- "https://api.fly.trade/aggregator/quote",
29
+ // covers both /aggregator/quote and /aggregator/transaction?quoteId=...
30
+ // (the transaction endpoint's quoteId would otherwise fragment grouping)
31
+ "https://api.fly.trade/aggregator",
29
32
  "https://open-api.openocean.finance/v4/bera/swap",
30
33
  // vercel internal proxy
31
34
  "/api/aggregators?aggregator",
32
35
  // bonder endpoints have date-based query params (e.g. ?start=2025-11-28)
33
- mainnet.backend
36
+ mainnet.backend,
37
+ // beep (next-gen backend) on testnet — same date-based bonder query params
38
+ bepolia.beep
34
39
  ];
35
40
  statusCode;
36
41
  payload;
@@ -129,13 +134,13 @@ var RequestError = class _RequestError extends BeraError {
129
134
  };
130
135
  }
131
136
  const failedToFetchMatch = message.match(
132
- /^(?:NetworkError when attempting to fetch resource\.|Failed to fetch|Load failed) \(([a-z0-9-.]+)\)$/
137
+ /^(?:NetworkError when attempting to fetch resource\.|Failed to fetch|Load failed)(?: \(([a-z0-9-.]+)\))?$/
133
138
  );
134
139
  if (failedToFetchMatch) {
135
140
  return {
136
141
  reason: _RequestError.REASON_MAP.NETWORK_ERROR,
137
142
  message,
138
- url: failedToFetchMatch[1]
143
+ url: failedToFetchMatch[1] ?? this.endpoint.url
139
144
  };
140
145
  }
141
146
  }
@@ -4,8 +4,8 @@ import { B as BeraFlags } from '../defaultFlags-D6KfkTZx.js';
4
4
  export { B as BexStateContext, a as BexStatusProvider, b as BexStatusProviderProps, u as useBexStatus } from '../BexStatusProvider-DRymVlQf.js';
5
5
  import * as react from 'react';
6
6
  import react__default, { PropsWithChildren } from 'react';
7
- import { a as TokenWithMetadata, b as Token, B as BalanceToken } from '../HoneyConfigProvider-Dkj-_a5x.js';
8
- export { c as HoneyConfigContext, d as HoneyConfigContextReturn, e as HoneyConfigProvider, f as HoneyConfigProviderProps, T as TokenWithOrder, u as useHoneyConfig } from '../HoneyConfigProvider-Dkj-_a5x.js';
7
+ import { a as TokenWithMetadata, b as Token, B as BalanceToken } from '../HoneyConfigProvider-COOuDNra.js';
8
+ export { c as HoneyConfigContext, d as HoneyConfigContextReturn, e as HoneyConfigProvider, f as HoneyConfigProviderProps, T as TokenWithOrder, u as useHoneyConfig } from '../HoneyConfigProvider-COOuDNra.js';
9
9
  import '@berachain/config/internal/flags';
10
10
  import 'viem';
11
11
  import '@berachain/graphql/pol/api';
@@ -14,25 +14,27 @@ import {
14
14
  useBexStatus,
15
15
  useBlockTime,
16
16
  useHoneyConfig
17
- } from "../chunk-3EARVV7K.mjs";
18
- import "../chunk-HSSJKHZ4.mjs";
17
+ } from "../chunk-SXUNCX5E.mjs";
18
+ import {
19
+ SWRConfig
20
+ } from "../chunk-UD5IUNCW.mjs";
21
+ import "../chunk-HYDP32P6.mjs";
19
22
  import "../chunk-HQCOU6GY.mjs";
20
23
  import "../chunk-SGIJVHZO.mjs";
21
24
  import {
22
25
  BeraMonitoring
23
- } from "../chunk-EXIUPSFN.mjs";
24
- import "../chunk-KQUMKB66.mjs";
26
+ } from "../chunk-7YVNSDXG.mjs";
27
+ import "../chunk-GY6B3PD5.mjs";
25
28
  import "../chunk-BGMRHTBQ.mjs";
26
- import "../chunk-NPBQLVL3.mjs";
27
- import "../chunk-75M6TF7M.mjs";
28
- import "../chunk-XIYN6AL6.mjs";
29
+ import "../chunk-IXIBY5FP.mjs";
30
+ import "../chunk-DQRH5VE3.mjs";
31
+ import "../chunk-ZLTMIFCZ.mjs";
29
32
  import {
30
33
  BeraError
31
- } from "../chunk-J5I45WGQ.mjs";
34
+ } from "../chunk-KHXJDYA4.mjs";
32
35
 
33
36
  // src/contexts/SwrFallback.tsx
34
37
  import { useEffect } from "react";
35
- import { SWRConfig } from "swr";
36
38
  import { jsx } from "react/jsx-runtime";
37
39
  function SWRFallback({
38
40
  fallback,
@@ -1,7 +1,13 @@
1
1
  export { C as ContractName, T as TransactionActionType } from '../txnEnum-ByI5dtDi.js';
2
2
  export { A as Aggregators, O as OwnershipType, P as ParameterPreset, a as PoolCreationStep, S as SwapReferrer } from '../dex-C_BB0b0O.js';
3
3
  export { H as HoneySwapAction } from '../honey-CYm0RWf4.js';
4
- export { P as POLLING } from '../polling-BKnyavLI.js';
4
+
5
+ declare enum POLLING {
6
+ FAST = 10000,// 10 sec
7
+ NORMAL = 100000,// 100 sec
8
+ SLOW = 180000,// 3 min
9
+ REFRESH_BLOCK_INTERVAL = 10000
10
+ }
5
11
 
6
12
  declare const DEFAULT_SLIPPAGE: 0.5;
7
13
  declare const SLIPPAGE_DEGEN_VALUE: 25;
@@ -20,4 +26,4 @@ declare enum TRANSACTION_MODE {
20
26
  INFINITY = "infinity"
21
27
  }
22
28
 
23
- export { DEFAULT_DEADLINE, DEFAULT_SLIPPAGE, SLIPPAGE_DEGEN_VALUE, SLIPPAGE_MODE, TRANSACTION_MODE };
29
+ export { DEFAULT_DEADLINE, DEFAULT_SLIPPAGE, POLLING, SLIPPAGE_DEGEN_VALUE, SLIPPAGE_MODE, TRANSACTION_MODE };
@@ -1,24 +1,24 @@
1
1
  import {
2
2
  NotFoundError,
3
3
  TransactionFailedError
4
- } from "../chunk-WXXOISTU.mjs";
4
+ } from "../chunk-AUOPN6NK.mjs";
5
5
  import {
6
6
  BeraMonitoring,
7
7
  initBeraError
8
- } from "../chunk-EXIUPSFN.mjs";
8
+ } from "../chunk-7YVNSDXG.mjs";
9
9
  import {
10
10
  assertAddress,
11
11
  assertAmount,
12
12
  assertDefined,
13
13
  assertPositive,
14
14
  assertPublicClient
15
- } from "../chunk-KQUMKB66.mjs";
15
+ } from "../chunk-GY6B3PD5.mjs";
16
16
  import {
17
17
  BeraTracing
18
18
  } from "../chunk-SZ5C44L5.mjs";
19
19
  import {
20
20
  RequestError
21
- } from "../chunk-XIYN6AL6.mjs";
21
+ } from "../chunk-ZLTMIFCZ.mjs";
22
22
  import {
23
23
  BeraError,
24
24
  InvalidArgumentError,
@@ -26,7 +26,7 @@ import {
26
26
  getErrorMessage,
27
27
  httpStatusToSpanStatus,
28
28
  reasonToSpanStatus
29
- } from "../chunk-J5I45WGQ.mjs";
29
+ } from "../chunk-KHXJDYA4.mjs";
30
30
  export {
31
31
  BeraError,
32
32
  BeraMonitoring,
@@ -0,0 +1,12 @@
1
+ import { GetProposalVotesQueryVariables, GetProposalVotesQuery } from '@berachain/graphql/governance';
2
+
3
+ type GetProposalVotesArgs = BeraJS.BaseFunctionArgs & {
4
+ /** GraphQL variables forwarded to the GetProposalVotes query */
5
+ variables: GetProposalVotesQueryVariables;
6
+ };
7
+ /** Fetches the votes for a proposal from the subgraph */
8
+ declare function getProposalVotes(_args: GetProposalVotesArgs): Promise<{
9
+ data: GetProposalVotesQuery;
10
+ }>;
11
+
12
+ export { type GetProposalVotesArgs as G, getProposalVotes as g };
@@ -1,9 +1,9 @@
1
1
  import { Address, PublicClient, Hex } from 'viem';
2
2
  import { BeraConfig, ChainId } from '@berachain/config/internal';
3
- import { I as IAggregatorArgs, g as IRawAggregatorQuote, b as Token, d as HoneyConfigContextReturn, B as BalanceToken, P as PythLatestUpdates } from './HoneyConfigProvider-Dkj-_a5x.js';
3
+ import { I as IAggregatorArgs, g as IRawAggregatorQuote, b as Token, d as HoneyConfigContextReturn, B as BalanceToken, P as PythLatestUpdates } from './HoneyConfigProvider-COOuDNra.js';
4
4
  import { A as Aggregators } from './dex-C_BB0b0O.js';
5
5
  import { GqlPoolType, GlobalDataQuery, ApiVaultFragment, GetVaultsQueryVariables, GqlChain, GetVaultHistoryQueryVariables, GetVaultHistoryQuery, ApiValidatorInListFragment } from '@berachain/graphql/pol/api';
6
- import { P as ProtocolMetadata } from './pol.d-CqPA9K6m.js';
6
+ import { P as ProtocolMetadata } from './pol.d-CeRgXBL8.js';
7
7
 
8
8
  interface GetConvertToAssetsProps {
9
9
  sharesAmount: bigint;
@@ -1,7 +1,7 @@
1
1
  import { Config, GetWalletClientReturnType } from '@wagmi/core';
2
- import { SWRResponse, SWRConfiguration } from 'swr';
3
2
  import { Abi, ContractFunctionName, ContractFunctionArgs, TransactionReceipt, WalletCallReceipt, Hex, Account, Address } from 'viem';
4
3
  import { ChainId, BeraConfig } from '@berachain/config';
4
+ import { SWRResponse, SWRConfiguration } from '@berachain/utils/pkg/swr';
5
5
  import { T as TransactionActionType, C as ContractName } from './txnEnum-ByI5dtDi.js';
6
6
  import { B as BeraError } from './BeraError-7-A5JYy_.js';
7
7
 
@@ -55,9 +55,7 @@ interface IUseContractWriteArgs<abi extends Abi | undefined = undefined, functio
55
55
  onWarning?: (e: BeraError, writeArgs: Omit<IContractWrite<abi, functionName, params>, TxnEventKeys>) => void;
56
56
  }
57
57
 
58
- type DefaultHookOptions = {
59
- opts?: SWRConfiguration & { isEnabled?: boolean };
60
- };
58
+ type DefaultHookOptions = SWRConfiguration & { isEnabled?: boolean };
61
59
 
62
60
  type DefaultHookReturnType<T = any> = Omit<
63
61
  SWRResponse<T, any, any>,