@berachain/berajs 0.2.13 → 0.3.0

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 (413) hide show
  1. package/dist/actions/clients/BeraApolloClient.d.ts.map +1 -1
  2. package/dist/actions/clients/clientName.d.ts +10 -0
  3. package/dist/actions/clients/clientName.d.ts.map +1 -0
  4. package/dist/actions/clients/exports.d.ts +2 -0
  5. package/dist/actions/clients/exports.d.ts.map +1 -1
  6. package/dist/actions/clients/exports.mjs +26 -7
  7. package/dist/actions/clients/exports.mjs.map +1 -1
  8. package/dist/actions/clients/fetchBeep.d.ts.map +1 -1
  9. package/dist/actions/clients/fetchEnso.d.ts +17 -0
  10. package/dist/actions/clients/fetchEnso.d.ts.map +1 -0
  11. package/dist/actions/clients/fetchLayerzero.d.ts +12 -0
  12. package/dist/actions/clients/fetchLayerzero.d.ts.map +1 -0
  13. package/dist/actions/clients/fetchOpenApi.d.ts +4 -1
  14. package/dist/actions/clients/fetchOpenApi.d.ts.map +1 -1
  15. package/dist/actions/clients/getApolloClient.d.ts.map +1 -1
  16. package/dist/actions/dex/aggregators/base.d.ts +30 -5
  17. package/dist/actions/dex/aggregators/base.d.ts.map +1 -1
  18. package/dist/actions/dex/aggregators/bex.d.ts +11 -1
  19. package/dist/actions/dex/aggregators/bex.d.ts.map +1 -1
  20. package/dist/actions/dex/aggregators/bgt.d.ts +2 -2
  21. package/dist/actions/dex/aggregators/bgt.d.ts.map +1 -1
  22. package/dist/actions/dex/aggregators/enso/enso.d.ts.map +1 -1
  23. package/dist/actions/dex/aggregators/enso/ensoErc4626.d.ts +1 -0
  24. package/dist/actions/dex/aggregators/enso/ensoErc4626.d.ts.map +1 -1
  25. package/dist/actions/dex/aggregators/erc4626.d.ts +2 -2
  26. package/dist/actions/dex/aggregators/erc4626.d.ts.map +1 -1
  27. package/dist/actions/dex/aggregators/fly.d.ts.map +1 -1
  28. package/dist/actions/dex/aggregators/haiku.d.ts +7 -1
  29. package/dist/actions/dex/aggregators/haiku.d.ts.map +1 -1
  30. package/dist/actions/dex/aggregators/honey.d.ts +2 -2
  31. package/dist/actions/dex/aggregators/honey.d.ts.map +1 -1
  32. package/dist/actions/dex/aggregators/kyberswap.d.ts.map +1 -1
  33. package/dist/actions/dex/aggregators/oogabooga.d.ts.map +1 -1
  34. package/dist/actions/dex/aggregators/openOcean.d.ts.map +1 -1
  35. package/dist/actions/dex/aggregators/wbera.d.ts +3 -2
  36. package/dist/actions/dex/aggregators/wbera.d.ts.map +1 -1
  37. package/dist/actions/dex/getAllPools.d.ts.map +1 -1
  38. package/dist/actions/dex/getApiPool.d.ts.map +1 -1
  39. package/dist/actions/enso/getEnsoUserTokensWithBalances.d.ts.map +1 -1
  40. package/dist/actions/enso/util.d.ts +1 -6
  41. package/dist/actions/enso/util.d.ts.map +1 -1
  42. package/dist/actions/exports.d.ts +3 -5
  43. package/dist/actions/exports.d.ts.map +1 -1
  44. package/dist/actions/exports.mjs +31 -50
  45. package/dist/actions/exports.mjs.map +1 -1
  46. package/dist/actions/governance/exports.mjs +3 -3
  47. package/dist/actions/honey/getHoney24hVolume.d.ts +2 -2
  48. package/dist/actions/honey/getHoney24hVolume.d.ts.map +1 -1
  49. package/dist/actions/honey/getHoneyCollaterals.d.ts +1 -1
  50. package/dist/actions/honey/getHoneyCollaterals.d.ts.map +1 -1
  51. package/dist/actions/pol/getEarnedStakedBeraVault.d.ts +0 -23
  52. package/dist/actions/pol/getEarnedStakedBeraVault.d.ts.map +1 -1
  53. package/dist/actions/pol/getLSTStakeConfig.d.ts.map +1 -1
  54. package/dist/actions/pol/getSWBeraVaultMetadata.d.ts +1 -14
  55. package/dist/actions/pol/getSWBeraVaultMetadata.d.ts.map +1 -1
  56. package/dist/actions/pol/getStakedBeraAPY.d.ts +14 -0
  57. package/dist/actions/pol/getStakedBeraAPY.d.ts.map +1 -0
  58. package/dist/actions/pol/getStakedBeraSnapshots.d.ts +14 -4
  59. package/dist/actions/pol/getStakedBeraSnapshots.d.ts.map +1 -1
  60. package/dist/actions/pol/getStakingDailyAssets.d.ts +2 -2
  61. package/dist/actions/pol/getStakingDailyAssets.d.ts.map +1 -1
  62. package/dist/actions/server/exports.mjs +5 -5
  63. package/dist/actions/validators/getActiveBoostAndCommissionChangeDelay.d.ts +1 -1
  64. package/dist/actions/validators/getActiveBoostAndCommissionChangeDelay.d.ts.map +1 -1
  65. package/dist/actions/validators/getUserActiveValidators.d.ts +37 -1
  66. package/dist/actions/validators/getUserActiveValidators.d.ts.map +1 -1
  67. package/dist/actions/validators/getValidatorRewardAllocation.d.ts +4 -0
  68. package/dist/actions/validators/getValidatorRewardAllocation.d.ts.map +1 -1
  69. package/dist/{chunk-ZWTGVIPJ.mjs → chunk-4576RF2K.mjs} +29 -4
  70. package/dist/chunk-4576RF2K.mjs.map +1 -0
  71. package/dist/{chunk-UA3Z47LT.mjs → chunk-5PBYMJRG.mjs} +95 -24
  72. package/dist/chunk-5PBYMJRG.mjs.map +1 -0
  73. package/dist/{chunk-AEN6IJFU.mjs → chunk-7KN7TDUC.mjs} +2 -2
  74. package/dist/chunk-7OESHTBN.mjs +29 -0
  75. package/dist/chunk-7OESHTBN.mjs.map +1 -0
  76. package/dist/{chunk-IFNIPVTZ.mjs → chunk-BSLXKPX4.mjs} +4 -48
  77. package/dist/chunk-BSLXKPX4.mjs.map +1 -0
  78. package/dist/{chunk-PHYZRH4I.mjs → chunk-BZKA6DBM.mjs} +9 -13
  79. package/dist/chunk-BZKA6DBM.mjs.map +1 -0
  80. package/dist/{chunk-LE4CYW7S.mjs → chunk-FWRYUIJK.mjs} +3 -3
  81. package/dist/{chunk-PJRLHTGC.mjs → chunk-HPRLNT6R.mjs} +3 -3
  82. package/dist/chunk-J6GM7HWX.mjs +19 -0
  83. package/dist/chunk-J6GM7HWX.mjs.map +1 -0
  84. package/dist/{chunk-P3YZ7F22.mjs → chunk-LL7XR2H5.mjs} +34 -3
  85. package/dist/chunk-LL7XR2H5.mjs.map +1 -0
  86. package/dist/{chunk-EJIGERYM.mjs → chunk-M3MIGSH3.mjs} +2 -2
  87. package/dist/{chunk-NZAH3SGT.mjs → chunk-MVNQY2D4.mjs} +9 -4
  88. package/dist/chunk-MVNQY2D4.mjs.map +1 -0
  89. package/dist/{chunk-TGN55GKE.mjs → chunk-SC3BSCTN.mjs} +2 -2
  90. package/dist/{chunk-DOZJB6IJ.mjs → chunk-SMBAW7AG.mjs} +394 -344
  91. package/dist/chunk-SMBAW7AG.mjs.map +1 -0
  92. package/dist/{chunk-QQASX4LJ.mjs → chunk-TXWDUJOY.mjs} +2 -2
  93. package/dist/{chunk-EGAB6NFQ.mjs → chunk-UWJQ6UKG.mjs} +2 -2
  94. package/dist/chunk-XO2BFPTB.mjs +50 -0
  95. package/dist/chunk-XO2BFPTB.mjs.map +1 -0
  96. package/dist/{chunk-7TFV6UKF.mjs → chunk-XXKPXNQD.mjs} +1 -2
  97. package/dist/chunk-XXKPXNQD.mjs.map +1 -0
  98. package/dist/{chunk-J3LTASDE.mjs → chunk-ZHV3MQ4F.mjs} +4 -4
  99. package/dist/contexts/BeraFlags/BeraFlags.d.ts +1 -1
  100. package/dist/contexts/BeraFlags/BeraFlags.d.ts.map +1 -1
  101. package/dist/contexts/BeraFlags/defaultFlags.d.ts +2 -2
  102. package/dist/contexts/BeraFlags/defaultFlags.d.ts.map +1 -1
  103. package/dist/contexts/BexStatusProvider.d.ts +1 -1
  104. package/dist/contexts/BexStatusProvider.d.ts.map +1 -1
  105. package/dist/contexts/TokensProvider.d.ts +1 -1
  106. package/dist/contexts/TokensProvider.d.ts.map +1 -1
  107. package/dist/contexts/exports.mjs +9 -9
  108. package/dist/enum/contracts.d.ts +3 -0
  109. package/dist/enum/contracts.d.ts.map +1 -1
  110. package/dist/enum/exports.mjs +6 -4
  111. package/dist/enum/exports.mjs.map +1 -1
  112. package/dist/errors/RequestError.d.ts +19 -0
  113. package/dist/errors/RequestError.d.ts.map +1 -1
  114. package/dist/errors/errorMap.d.ts +4 -3
  115. package/dist/errors/errorMap.d.ts.map +1 -1
  116. package/dist/errors/exports.mjs +5 -5
  117. package/dist/hooks/dex/useAggregatorsQuotes.d.ts.map +1 -1
  118. package/dist/hooks/dex/useAllUserPools.d.ts.map +1 -1
  119. package/dist/hooks/dex/useCrossChainNativeFee.d.ts +32 -0
  120. package/dist/hooks/dex/useCrossChainNativeFee.d.ts.map +1 -0
  121. package/dist/hooks/dex/useOnChainPoolData.d.ts.map +1 -1
  122. package/dist/hooks/dex/usePools.d.ts.map +1 -1
  123. package/dist/hooks/dex/useSingleAggregatorQuote.d.ts.map +1 -1
  124. package/dist/hooks/enso/useBendZapSupply.d.ts +2 -2
  125. package/dist/hooks/enso/useBendZapSupply.d.ts.map +1 -1
  126. package/dist/hooks/enso/useEnsoUserTokensWithBalances.d.ts.map +1 -1
  127. package/dist/hooks/exports.d.ts +2 -5
  128. package/dist/hooks/exports.d.ts.map +1 -1
  129. package/dist/hooks/exports.mjs +590 -905
  130. package/dist/hooks/exports.mjs.map +1 -1
  131. package/dist/hooks/governance/exports.mjs +4 -4
  132. package/dist/hooks/honey/useHoneyChartData.d.ts.map +1 -1
  133. package/dist/hooks/pol/useRewardTokenToBeraRate.d.ts.map +1 -1
  134. package/dist/hooks/pol/useRewardVaultBalanceFromStakingToken.d.ts.map +1 -1
  135. package/dist/hooks/pol/useRewardVaults.d.ts.map +1 -1
  136. package/dist/hooks/pol/useStakedAPY.d.ts +11 -0
  137. package/dist/hooks/pol/useStakedAPY.d.ts.map +1 -0
  138. package/dist/hooks/pol/useStakedData.d.ts +2 -2
  139. package/dist/hooks/pol/useStakedData.d.ts.map +1 -1
  140. package/dist/hooks/pol/useStakingVaultsMetadata.d.ts +0 -1
  141. package/dist/hooks/pol/useStakingVaultsMetadata.d.ts.map +1 -1
  142. package/dist/hooks/tokens/useMultipleTokenInformation.d.ts +30 -0
  143. package/dist/hooks/tokens/useMultipleTokenInformation.d.ts.map +1 -1
  144. package/dist/hooks/tokens/usePollBalance.d.ts.map +1 -1
  145. package/dist/hooks/validators/useUserActiveValidators.d.ts +5 -0
  146. package/dist/hooks/validators/useUserActiveValidators.d.ts.map +1 -1
  147. package/dist/hooks/validators/useValidator.d.ts.map +1 -1
  148. package/dist/hooks/validators/useValidatorIncentiveDistribution.d.ts +3 -4
  149. package/dist/hooks/validators/useValidatorIncentiveDistribution.d.ts.map +1 -1
  150. package/dist/hooks/validators/useValidatorRewardAllocation.d.ts +1 -0
  151. package/dist/hooks/validators/useValidatorRewardAllocation.d.ts.map +1 -1
  152. package/dist/utils/crossChainBridge.d.ts +74 -0
  153. package/dist/utils/crossChainBridge.d.ts.map +1 -0
  154. package/dist/utils/exports.d.ts +1 -1
  155. package/dist/utils/exports.d.ts.map +1 -1
  156. package/dist/utils/exports.mjs +142 -72
  157. package/dist/utils/exports.mjs.map +1 -1
  158. package/dist/utils/getTestClient.d.ts +5 -3
  159. package/dist/utils/getTestClient.d.ts.map +1 -1
  160. package/dist/utils/parseWhiskToken.d.ts.map +1 -1
  161. package/package.json +8 -6
  162. package/src/actions/clients/BeraApolloClient.ts +4 -2
  163. package/src/actions/clients/clientName.ts +17 -0
  164. package/src/actions/clients/clientName.unit.test.ts +39 -0
  165. package/src/actions/clients/exports.ts +2 -0
  166. package/src/actions/clients/fetchBeep.ts +4 -1
  167. package/src/actions/clients/fetchEnso.ts +48 -0
  168. package/src/actions/clients/fetchLayerzero.ts +34 -0
  169. package/src/actions/clients/fetchOpenApi.ts +9 -2
  170. package/src/actions/clients/fetchOpenApi.unit.test.ts +26 -10
  171. package/src/actions/clients/getApolloClient.ts +3 -11
  172. package/src/actions/dex/__tests__/aggregators.unit.test.ts +231 -2
  173. package/src/actions/dex/aggregators/base.ts +75 -17
  174. package/src/actions/dex/aggregators/bex.ts +41 -1
  175. package/src/actions/dex/aggregators/bgt.ts +11 -6
  176. package/src/actions/dex/aggregators/enso/enso.ts +1 -0
  177. package/src/actions/dex/aggregators/enso/ensoErc4626.ts +27 -9
  178. package/src/actions/dex/aggregators/erc4626.ts +19 -5
  179. package/src/actions/dex/aggregators/fly.ts +1 -0
  180. package/src/actions/dex/aggregators/haiku.ts +33 -2
  181. package/src/actions/dex/aggregators/honey.ts +17 -6
  182. package/src/actions/dex/aggregators/kyberswap.ts +1 -0
  183. package/src/actions/dex/aggregators/oogabooga.ts +1 -0
  184. package/src/actions/dex/aggregators/openOcean.ts +1 -0
  185. package/src/actions/dex/aggregators/wbera.ts +17 -11
  186. package/src/actions/enso/getBendMultiplyBundle.ts +1 -1
  187. package/src/actions/enso/getEnsoUserTokensWithBalances.ts +4 -8
  188. package/src/actions/enso/util.ts +0 -59
  189. package/src/actions/exports.ts +3 -5
  190. package/src/actions/honey/getHoney24hVolume.ts +3 -12
  191. package/src/actions/honey/getHoneyCollaterals.ts +1 -1
  192. package/src/actions/pol/getBeraTokenTotalSupply.ts +3 -33
  193. package/src/actions/pol/getLSTStakeConfig.ts +0 -6
  194. package/src/actions/pol/getSWBeraVaultMetadata.ts +2 -106
  195. package/src/actions/pol/getStakedBeraAPY.ts +45 -0
  196. package/src/actions/pol/getStakedBeraSnapshots.ts +18 -34
  197. package/src/actions/validators/getActiveBoostAndCommissionChangeDelay.ts +1 -1
  198. package/src/actions/validators/getUserActiveValidators.ts +116 -54
  199. package/src/actions/validators/getValidatorRewardAllocation.ts +12 -1
  200. package/src/contexts/BeraFlags/BeraFlags.tsx +1 -4
  201. package/src/contexts/BeraFlags/defaultFlags.ts +1 -3
  202. package/src/contexts/BexStatusProvider.tsx +1 -1
  203. package/src/contexts/TokensProvider.tsx +1 -4
  204. package/src/enum/contracts.ts +3 -0
  205. package/src/errors/BeraError.unit.test.ts +23 -0
  206. package/src/errors/RequestError.ts +46 -9
  207. package/src/errors/RequestError.unit.test.ts +54 -0
  208. package/src/errors/errorMap.ts +8 -3
  209. package/src/errors/getErrorMessage.unit.test.ts +32 -0
  210. package/src/hooks/dex/useAggregatorsQuotes.ts +7 -1
  211. package/src/hooks/dex/useCrossChainNativeFee.ts +83 -0
  212. package/src/hooks/dex/useCrossChainNativeFee.unit.test.ts +63 -0
  213. package/src/hooks/dex/useOnChainPoolData.ts +30 -13
  214. package/src/hooks/dex/useSingleAggregatorQuote.ts +4 -2
  215. package/src/hooks/enso/useBendZapSupply.ts +9 -38
  216. package/src/hooks/enso/useEnsoUserTokensWithBalances.ts +10 -2
  217. package/src/hooks/enso/useZapStakeBera.ts +1 -1
  218. package/src/hooks/exports.ts +2 -5
  219. package/src/hooks/pol/useAutoclaimedIncentives.ts +6 -3
  220. package/src/hooks/pol/useAutoclaimedIncentivesTxHash.ts +5 -2
  221. package/src/hooks/pol/useRewardTokenToBeraRate.ts +5 -4
  222. package/src/hooks/pol/useRewardVaultBalanceFromStakingToken.ts +0 -1
  223. package/src/hooks/pol/{useStakedAPR.ts → useStakedAPY.ts} +11 -9
  224. package/src/hooks/pol/useStakedData.ts +13 -14
  225. package/src/hooks/pol/useStakingVaultsMetadata.ts +3 -8
  226. package/src/hooks/tokens/useMultipleTokenInformation.ts +64 -21
  227. package/src/hooks/tokens/useMultipleTokenInformation.unit.test.ts +91 -0
  228. package/src/hooks/tokens/usePollBalance.ts +4 -2
  229. package/src/hooks/validators/useUserActiveValidators.ts +54 -9
  230. package/src/hooks/validators/useValidatorIncentiveDistribution.ts +3 -4
  231. package/src/types/bribeBoost.d.ts +0 -49
  232. package/src/types/dex.d.ts +17 -0
  233. package/src/types/enso.d.ts +1 -27
  234. package/src/types/global.d.ts +7 -0
  235. package/src/types/pol.d.ts +3 -48
  236. package/src/utils/crossChainBridge.ts +290 -0
  237. package/src/utils/crossChainBridge.unit.test.ts +177 -0
  238. package/src/utils/exports.ts +1 -1
  239. package/dist/BeraError-7-A5JYy_.d.ts +0 -123
  240. package/dist/BexStatusProvider-DRymVlQf.d.ts +0 -70
  241. package/dist/HoneyConfigProvider-COOuDNra.d.ts +0 -390
  242. package/dist/RequestError-DkUbo3ro.d.ts +0 -145
  243. package/dist/actions/clients/fetchOpenApi.unit.test.d.ts +0 -2
  244. package/dist/actions/clients/fetchOpenApi.unit.test.d.ts.map +0 -1
  245. package/dist/actions/dex/__tests__/aggregators.unit.test.d.ts +0 -2
  246. package/dist/actions/dex/__tests__/aggregators.unit.test.d.ts.map +0 -1
  247. package/dist/actions/dex/__tests__/allPools.integration.test.d.ts +0 -2
  248. package/dist/actions/dex/__tests__/allPools.integration.test.d.ts.map +0 -1
  249. package/dist/actions/dex/__tests__/getOnChainPool.unit.test.d.ts +0 -2
  250. package/dist/actions/dex/__tests__/getOnChainPool.unit.test.d.ts.map +0 -1
  251. package/dist/actions/dex/aggregators/enso/ensoErc4626.debug.test.d.ts +0 -2
  252. package/dist/actions/dex/aggregators/enso/ensoErc4626.debug.test.d.ts.map +0 -1
  253. package/dist/actions/dex/aggregators/haiku.integration.test.d.ts +0 -2
  254. package/dist/actions/dex/aggregators/haiku.integration.test.d.ts.map +0 -1
  255. package/dist/actions/dex/b-sdk.d.ts +0 -3
  256. package/dist/actions/enso/__tests__/getBendDemultiplyBundle.action.unit.test.d.ts +0 -2
  257. package/dist/actions/enso/__tests__/getBendDemultiplyBundle.action.unit.test.d.ts.map +0 -1
  258. package/dist/actions/enso/__tests__/getBendDemultiplyBundle.unit.test.d.ts +0 -2
  259. package/dist/actions/enso/__tests__/getBendDemultiplyBundle.unit.test.d.ts.map +0 -1
  260. package/dist/actions/enso/__tests__/getBendMultiplyBundle.action.unit.test.d.ts +0 -2
  261. package/dist/actions/enso/__tests__/getBendMultiplyBundle.action.unit.test.d.ts.map +0 -1
  262. package/dist/actions/enso/__tests__/getBendMultiplyBundle.unit.test.d.ts +0 -2
  263. package/dist/actions/enso/__tests__/getBendMultiplyBundle.unit.test.d.ts.map +0 -1
  264. package/dist/actions/enso/__tests__/getEnsoUserTokensWithBalances.debug.test.d.ts +0 -2
  265. package/dist/actions/enso/__tests__/getEnsoUserTokensWithBalances.debug.test.d.ts.map +0 -1
  266. package/dist/actions/enso/__tests__/util.unit.test.d.ts +0 -2
  267. package/dist/actions/enso/__tests__/util.unit.test.d.ts.map +0 -1
  268. package/dist/actions/enso/getEnsoSwapBundle.d.ts +0 -3
  269. package/dist/actions/enso/getEnsoSwapBundle.d.ts.map +0 -1
  270. package/dist/actions/governance/__tests__/checkProposalField.unit.test.d.ts +0 -2
  271. package/dist/actions/governance/__tests__/checkProposalField.unit.test.d.ts.map +0 -1
  272. package/dist/actions/governance/__tests__/getDecodedFunctionData.integration.test.d.ts +0 -2
  273. package/dist/actions/governance/__tests__/getDecodedFunctionData.integration.test.d.ts.map +0 -1
  274. package/dist/actions/governance/__tests__/getQuorum.integration.test.d.ts +0 -2
  275. package/dist/actions/governance/__tests__/getQuorum.integration.test.d.ts.map +0 -1
  276. package/dist/actions/honey/tests/pyth.integration.test.d.ts +0 -2
  277. package/dist/actions/honey/tests/pyth.integration.test.d.ts.map +0 -1
  278. package/dist/actions/pol/__tests__/getAllValidators.integration.test.d.ts +0 -2
  279. package/dist/actions/pol/__tests__/getAllValidators.integration.test.d.ts.map +0 -1
  280. package/dist/actions/pol/__tests__/getValidator.integration.test.d.ts +0 -2
  281. package/dist/actions/pol/__tests__/getValidator.integration.test.d.ts.map +0 -1
  282. package/dist/actions/pol/__tests__/rewardVaults.integration.test.d.ts +0 -2
  283. package/dist/actions/pol/__tests__/rewardVaults.integration.test.d.ts.map +0 -1
  284. package/dist/actions/pol/getBgtAprSimultaion.unit.test.d.ts +0 -2
  285. package/dist/actions/pol/getBgtAprSimultaion.unit.test.d.ts.map +0 -1
  286. package/dist/actions/pol/getBgtIncentiveDistributorPaused.d.ts +0 -10
  287. package/dist/actions/pol/getBgtIncentiveDistributorPaused.d.ts.map +0 -1
  288. package/dist/actions/pol/getBlockTime.debug.test.d.ts +0 -2
  289. package/dist/actions/pol/getBlockTime.debug.test.d.ts.map +0 -1
  290. package/dist/actions/pol/getRewardProofsByValidator.d.ts +0 -9
  291. package/dist/actions/pol/getRewardProofsByValidator.d.ts.map +0 -1
  292. package/dist/actions/pol/getRewardVaultBeaconImplementation.integration.test.d.ts +0 -2
  293. package/dist/actions/pol/getRewardVaultBeaconImplementation.integration.test.d.ts.map +0 -1
  294. package/dist/actions/pol/getRewardVaultDurationConstants.integration.test.d.ts +0 -2
  295. package/dist/actions/pol/getRewardVaultDurationConstants.integration.test.d.ts.map +0 -1
  296. package/dist/actions/pol/getStakedBeraAPR.d.ts +0 -12
  297. package/dist/actions/pol/getStakedBeraAPR.d.ts.map +0 -1
  298. package/dist/actions/pol/getUserClaimableIncentives.d.ts +0 -9
  299. package/dist/actions/pol/getUserClaimableIncentives.d.ts.map +0 -1
  300. package/dist/actions/prices/__tests__/prices.integration.test.d.ts +0 -2
  301. package/dist/actions/prices/__tests__/prices.integration.test.d.ts.map +0 -1
  302. package/dist/actions/tokens/getWalletBalances.integration.test.d.ts +0 -2
  303. package/dist/actions/tokens/getWalletBalances.integration.test.d.ts.map +0 -1
  304. package/dist/actions/transactions/beraWriteContract.integration.test.d.ts +0 -2
  305. package/dist/actions/transactions/beraWriteContract.integration.test.d.ts.map +0 -1
  306. package/dist/actions/validators/getActiveBoostAndCommissionChangeDelay.integration.test.d.ts +0 -2
  307. package/dist/actions/validators/getActiveBoostAndCommissionChangeDelay.integration.test.d.ts.map +0 -1
  308. package/dist/actions/validators/getValidatorAnalytics.d.ts +0 -12
  309. package/dist/actions/validators/getValidatorAnalytics.d.ts.map +0 -1
  310. package/dist/actions/validators/utils/__tests__/validatorUtils.integration.test.d.ts +0 -2
  311. package/dist/actions/validators/utils/__tests__/validatorUtils.integration.test.d.ts.map +0 -1
  312. package/dist/actions/validators/utils/aggregateValidatorIncentives.unit.test.d.ts +0 -2
  313. package/dist/actions/validators/utils/aggregateValidatorIncentives.unit.test.d.ts.map +0 -1
  314. package/dist/chunk-7TFV6UKF.mjs.map +0 -1
  315. package/dist/chunk-BSOWLS3W.mjs +0 -40
  316. package/dist/chunk-BSOWLS3W.mjs.map +0 -1
  317. package/dist/chunk-DOZJB6IJ.mjs.map +0 -1
  318. package/dist/chunk-IFNIPVTZ.mjs.map +0 -1
  319. package/dist/chunk-NZAH3SGT.mjs.map +0 -1
  320. package/dist/chunk-P3YZ7F22.mjs.map +0 -1
  321. package/dist/chunk-PHYZRH4I.mjs.map +0 -1
  322. package/dist/chunk-UA3Z47LT.mjs.map +0 -1
  323. package/dist/chunk-ZWTGVIPJ.mjs.map +0 -1
  324. package/dist/contexts/block-time-provider.d.ts +0 -10
  325. package/dist/defaultFlags-D6KfkTZx.d.ts +0 -10
  326. package/dist/dex-C_BB0b0O.d.ts +0 -37
  327. package/dist/errors/BeraError.unit.test.d.ts +0 -2
  328. package/dist/errors/BeraError.unit.test.d.ts.map +0 -1
  329. package/dist/errors/BeraTracing.unit.test.d.ts +0 -2
  330. package/dist/errors/BeraTracing.unit.test.d.ts.map +0 -1
  331. package/dist/errors/RequestError.unit.test.d.ts +0 -2
  332. package/dist/errors/RequestError.unit.test.d.ts.map +0 -1
  333. package/dist/errors/assert.unit.test.d.ts +0 -2
  334. package/dist/errors/assert.unit.test.d.ts.map +0 -1
  335. package/dist/errors/getRevertReason.integration.test.d.ts +0 -2
  336. package/dist/errors/getRevertReason.integration.test.d.ts.map +0 -1
  337. package/dist/errors/spanStatus.unit.test.d.ts +0 -2
  338. package/dist/errors/spanStatus.unit.test.d.ts.map +0 -1
  339. package/dist/getApolloClient-MWm_iq4u.d.ts +0 -39
  340. package/dist/getProposalVotes-DAUrdX2n.d.ts +0 -12
  341. package/dist/getValidatorQueuedOperatorAddress-N2I7wHd6.d.ts +0 -511
  342. package/dist/global.d-CR3zicga.d.ts +0 -231
  343. package/dist/global.d-CiZJ2eHz.d.ts +0 -231
  344. package/dist/honey-CYm0RWf4.d.ts +0 -14
  345. package/dist/hooks/enso/useEnsoSwapBundle.d.ts +0 -26
  346. package/dist/hooks/enso/useEnsoSwapBundle.d.ts.map +0 -1
  347. package/dist/hooks/pol/useBgtIncentiveDistributorPaused.d.ts +0 -8
  348. package/dist/hooks/pol/useBgtIncentiveDistributorPaused.d.ts.map +0 -1
  349. package/dist/hooks/pol/useStakedAPR.d.ts +0 -11
  350. package/dist/hooks/pol/useStakedAPR.d.ts.map +0 -1
  351. package/dist/hooks/validators/useUserClaimableIncentives.d.ts +0 -8
  352. package/dist/hooks/validators/useUserClaimableIncentives.d.ts.map +0 -1
  353. package/dist/hooks/validators/useValidatorAnalytics.d.ts +0 -11
  354. package/dist/hooks/validators/useValidatorAnalytics.d.ts.map +0 -1
  355. package/dist/pol.d-CeRgXBL8.d.ts +0 -167
  356. package/dist/txnEnum-ByI5dtDi.d.ts +0 -106
  357. package/dist/types/bribe-boost.d.ts +0 -69
  358. package/dist/types/bribeBoost.d.ts +0 -69
  359. package/dist/types/dex.d.ts +0 -225
  360. package/dist/types/enso.d.ts +0 -76
  361. package/dist/types/global.d.ts +0 -198
  362. package/dist/types/governance.d.ts +0 -112
  363. package/dist/types/honeySwap.d.ts +0 -23
  364. package/dist/types/pol.d.ts +0 -78
  365. package/dist/types/staking.d.ts +0 -22
  366. package/dist/useHoneySwapState-CXVWAThr.d.ts +0 -32
  367. package/dist/useHoneySwapState-twi7NTaO.d.ts +0 -32
  368. package/dist/utils/createEmitter.unit.test.d.ts +0 -2
  369. package/dist/utils/createEmitter.unit.test.d.ts.map +0 -1
  370. package/dist/utils/formatIncentivesTokenMap.d.ts +0 -3
  371. package/dist/utils/formatIncentivesTokenMap.d.ts.map +0 -1
  372. package/dist/utils/formatNumber.unit.test.d.ts +0 -2
  373. package/dist/utils/formatNumber.unit.test.d.ts.map +0 -1
  374. package/dist/utils/formatTimestamps.unit.test.d.ts +0 -2
  375. package/dist/utils/formatTimestamps.unit.test.d.ts.map +0 -1
  376. package/dist/utils/getContractName.unit.test.d.ts +0 -2
  377. package/dist/utils/getContractName.unit.test.d.ts.map +0 -1
  378. package/dist/utils/getHoneySwapMessage.test.d.ts +0 -2
  379. package/dist/utils/getHoneySwapMessage.test.d.ts.map +0 -1
  380. package/dist/utils/layerZeroScan.d.ts +0 -39
  381. package/dist/utils/layerZeroScan.d.ts.map +0 -1
  382. package/dist/utils/math.unit.test.d.ts +0 -2
  383. package/dist/utils/math.unit.test.d.ts.map +0 -1
  384. package/dist/utils/parseBaseArgs.unit.test.d.ts +0 -2
  385. package/dist/utils/parseBaseArgs.unit.test.d.ts.map +0 -1
  386. package/dist/utils/polyfillAbortSignalAny.unit.test.d.ts +0 -2
  387. package/dist/utils/polyfillAbortSignalAny.unit.test.d.ts.map +0 -1
  388. package/dist/utils/time.unit.test.d.ts +0 -2
  389. package/dist/utils/time.unit.test.d.ts.map +0 -1
  390. package/dist/utils/tokens.unit.test.d.ts +0 -2
  391. package/dist/utils/tokens.unit.test.d.ts.map +0 -1
  392. package/dist/utils/truncateHash.unit.test.d.ts +0 -2
  393. package/dist/utils/truncateHash.unit.test.d.ts.map +0 -1
  394. package/src/actions/enso/getEnsoSwapBundle.ts +0 -72
  395. package/src/actions/pol/getBgtIncentiveDistributorPaused.ts +0 -28
  396. package/src/actions/pol/getRewardProofsByValidator.ts +0 -49
  397. package/src/actions/pol/getStakedBeraAPR.ts +0 -56
  398. package/src/actions/pol/getUserClaimableIncentives.ts +0 -40
  399. package/src/actions/validators/getValidatorAnalytics.ts +0 -37
  400. package/src/hooks/enso/useEnsoSwapBundle.ts +0 -121
  401. package/src/hooks/pol/useBgtIncentiveDistributorPaused.ts +0 -34
  402. package/src/hooks/validators/useUserClaimableIncentives.ts +0 -148
  403. package/src/hooks/validators/useValidatorAnalytics.ts +0 -37
  404. package/src/utils/formatIncentivesTokenMap.ts +0 -19
  405. package/src/utils/layerZeroScan.ts +0 -124
  406. /package/dist/{chunk-AEN6IJFU.mjs.map → chunk-7KN7TDUC.mjs.map} +0 -0
  407. /package/dist/{chunk-LE4CYW7S.mjs.map → chunk-FWRYUIJK.mjs.map} +0 -0
  408. /package/dist/{chunk-PJRLHTGC.mjs.map → chunk-HPRLNT6R.mjs.map} +0 -0
  409. /package/dist/{chunk-EJIGERYM.mjs.map → chunk-M3MIGSH3.mjs.map} +0 -0
  410. /package/dist/{chunk-TGN55GKE.mjs.map → chunk-SC3BSCTN.mjs.map} +0 -0
  411. /package/dist/{chunk-QQASX4LJ.mjs.map → chunk-TXWDUJOY.mjs.map} +0 -0
  412. /package/dist/{chunk-EGAB6NFQ.mjs.map → chunk-UWJQ6UKG.mjs.map} +0 -0
  413. /package/dist/{chunk-J3LTASDE.mjs.map → chunk-ZHV3MQ4F.mjs.map} +0 -0
@@ -1,4 +1,4 @@
1
- import { formatUnits, parseUnits, zeroAddress } from "viem";
1
+ import { type Address, formatUnits, parseUnits, zeroAddress } from "viem";
2
2
 
3
3
  import { ChainId } from "@berachain/config/internal";
4
4
 
@@ -6,7 +6,11 @@ import aggregatorsRouterAbi from "@berachain/abis/meta-aggregator/metaAggregator
6
6
 
7
7
  import { Aggregators, SwapReferrer } from "../../../enum/dex";
8
8
  import { BeraError } from "../../../errors/BeraError";
9
- import type { IAggregatorArgs, IRawAggregatorQuote } from "../../../types/dex";
9
+ import type {
10
+ IAggregatorArgs,
11
+ IRawAggregatorQuote,
12
+ Token,
13
+ } from "../../../types/dex";
10
14
  import type { IContractWrite } from "../../../types/global";
11
15
  import { BaseAggregator } from "./base";
12
16
 
@@ -21,6 +25,32 @@ class HaikuAggregator extends BaseAggregator {
21
25
  "No route found for the given input or the liquidity is not enough",
22
26
  "Invalid input amount. Please ensure the total amount of input is greater than 0.001 USD",
23
27
  ];
28
+
29
+ getUnsupportedReason({
30
+ tokenIn,
31
+ tokenOut,
32
+ rewardVault,
33
+ }: {
34
+ tokenIn: Token;
35
+ tokenOut: Token;
36
+ rewardVault?: Address;
37
+ }): string | null {
38
+ const base = super.getUnsupportedReason({ tokenIn, tokenOut });
39
+ if (base !== null) {
40
+ return base;
41
+ }
42
+
43
+ // Reward-vault staking zaps go through the restricted `zap-haiku` proxy key,
44
+ // which rejects quotes with a 400 (HUB-9FN/HUB-9FR). That's expected — Haiku
45
+ // isn't provisioned for zaps — so opt out up-front here so the quote hook is
46
+ // never called and no doomed request fires (and no Sentry error).
47
+ if (rewardVault) {
48
+ return `${this.name} does not support reward-vault staking.`;
49
+ }
50
+
51
+ return null;
52
+ }
53
+
24
54
  async getQuote({
25
55
  tokenIn,
26
56
  tokenOut,
@@ -158,6 +188,7 @@ class HaikuAggregator extends BaseAggregator {
158
188
  },
159
189
  ],
160
190
  functionName: "swap",
191
+ extraTags: { aggregator: this.name },
161
192
  abi: aggregatorsRouterAbi,
162
193
  // send full amount to router first, which will deduct the swap fee before executing trade
163
194
  value: isTokenInNative ? BigInt(amount) : BigInt("0"),
@@ -69,7 +69,7 @@ export class HoneyNativeAggregator extends BaseAggregator {
69
69
  );
70
70
  }
71
71
 
72
- checkChainSupport({
72
+ getUnsupportedReason({
73
73
  tokenIn,
74
74
  tokenOut,
75
75
  honeyNativeState,
@@ -77,16 +77,24 @@ export class HoneyNativeAggregator extends BaseAggregator {
77
77
  tokenIn: Token;
78
78
  tokenOut: Token;
79
79
  honeyNativeState?: Pick<HoneyConfigContextReturn, "collateralList">;
80
- }): boolean {
81
- return (
82
- super.checkChainSupport({ tokenIn, tokenOut }) &&
80
+ }): string | null {
81
+ const base = super.getUnsupportedReason({ tokenIn, tokenOut });
82
+ if (base !== null) {
83
+ return base;
84
+ }
85
+
86
+ if (
83
87
  tokenIn.chainId === tokenOut.chainId &&
84
88
  this.isHoneyNativeSwap({
85
89
  tokenIn: tokenIn.address,
86
90
  tokenOut: tokenOut.address,
87
91
  honeyNativeState,
88
92
  })
89
- );
93
+ ) {
94
+ return null;
95
+ }
96
+
97
+ return `${this.name} only mints/redeems HONEY against a listed collateral.`;
90
98
  }
91
99
 
92
100
  async getQuote({
@@ -108,7 +116,10 @@ export class HoneyNativeAggregator extends BaseAggregator {
108
116
  }
109
117
  assertPublicClient(publicClient);
110
118
 
111
- this.assertChainSupport({ tokenIn, tokenOut });
119
+ // Pass `honeyNativeState` through — Honey's `getUnsupportedReason` override
120
+ // needs it to confirm this is a valid mint/redeem. Without it the assert
121
+ // always fails with a misleading "chain ID: X and X" error (HUB-9FM).
122
+ this.assertChainSupport({ tokenIn, tokenOut, honeyNativeState });
112
123
 
113
124
  const isMint = isToken(tokenOut, this.honeyToken);
114
125
 
@@ -127,6 +127,7 @@ class KyberSwapAggregator extends BaseAggregator {
127
127
  },
128
128
  ],
129
129
  functionName: "swap",
130
+ extraTags: { aggregator: this.name },
130
131
  abi: aggregatorsRouterAbi,
131
132
  // send full amount to router first, which will deduct the swap fee before executing trade
132
133
  value: isTokenInNative ? BigInt(amount) : BigInt("0"),
@@ -100,6 +100,7 @@ class OogaboogaAggregator extends BaseAggregator {
100
100
  },
101
101
  ],
102
102
  functionName: "swap",
103
+ extraTags: { aggregator: this.name },
103
104
  abi: aggregatorsRouterAbi,
104
105
  // send full amount to router first, which will deduct the swap fee before executing trade
105
106
  value: isTokenInNative ? BigInt(amount) : BigInt("0"),
@@ -136,6 +136,7 @@ class OpenOceanAggregator extends BaseAggregator {
136
136
  },
137
137
  ],
138
138
  functionName: "swap",
139
+ extraTags: { aggregator: this.name },
139
140
  abi: aggregatorsRouterAbi,
140
141
  // send full amount to router first, which will deduct the swap fee before executing trade
141
142
  value: isTokenInNative ? BigInt(amount) : BigInt("0"),
@@ -16,27 +16,31 @@ class WBeraAggregator extends BaseAggregator {
16
16
  name = Aggregators.Wrap;
17
17
  supportedChains = [ChainId.MAINNET, ChainId.BEPOLIA];
18
18
  readonly type = "rpc";
19
+ // This aggregator's entire job is BERA↔WBERA, so keep the base same-token
20
+ // (native-normalized) guard from rejecting it.
21
+ supportsBeraWrap = true;
19
22
 
20
- checkChainSupport({
23
+ getUnsupportedReason({
21
24
  tokenIn,
22
25
  tokenOut,
23
26
  }: {
24
27
  tokenIn: Token;
25
28
  tokenOut: Token;
26
- }): boolean {
29
+ }): string | null {
30
+ const base = super.getUnsupportedReason({ tokenIn, tokenOut });
31
+ if (base !== null) {
32
+ return base;
33
+ }
34
+
27
35
  if (
28
- // same chain
29
- tokenIn.chainId !== tokenOut.chainId ||
30
- // must be one of our chains
31
- !super.checkChainSupport({ tokenIn, tokenOut })
36
+ tokenIn.chainId === tokenOut.chainId &&
37
+ ((isToken(tokenIn, "BERA") && isToken(tokenOut, "WBERA")) ||
38
+ (isToken(tokenIn, "WBERA") && isToken(tokenOut, "BERA")))
32
39
  ) {
33
- return false;
40
+ return null;
34
41
  }
35
42
 
36
- return (
37
- (isToken(tokenIn, "BERA") && isToken(tokenOut, "WBERA")) ||
38
- (isToken(tokenIn, "WBERA") && isToken(tokenOut, "BERA"))
39
- );
43
+ return `${this.name} only wraps/unwraps between BERA and WBERA on the same chain.`;
40
44
  }
41
45
 
42
46
  // handles native swaps: wrap and unwrap
@@ -67,6 +71,7 @@ class WBeraAggregator extends BaseAggregator {
67
71
  functionName: "deposit",
68
72
  params: [],
69
73
  value: BigInt(amount),
74
+ extraTags: { aggregator: this.name },
70
75
  } satisfies Omit<
71
76
  IContractWrite<typeof wberaAbi, "deposit">,
72
77
  "message" | "actionType"
@@ -77,6 +82,7 @@ class WBeraAggregator extends BaseAggregator {
77
82
  functionName: "withdraw",
78
83
  params: [BigInt(amount)],
79
84
  value: BigInt(0),
85
+ extraTags: { aggregator: this.name },
80
86
  } satisfies Omit<
81
87
  IContractWrite<typeof wberaAbi, "withdraw">,
82
88
  "message" | "actionType"
@@ -228,7 +228,7 @@ export async function getBendMultiplyBundle({
228
228
 
229
229
  // -- Callback action indices for `useOutputOfCallAt` references.
230
230
  // These MUST match the array position of each action in the callback below.
231
- const CALLBACK_IDX_ROUTE_LOAN_TO_COLLATERAL = 0;
231
+ // Index 0 is the route-loan-to-collateral action (not referenced by index).
232
232
  const CALLBACK_IDX_BALANCE_COLLATERAL = 1;
233
233
 
234
234
  const depositOnlyActions = [
@@ -52,22 +52,18 @@ export async function getEnsoUserTokensWithBalances({
52
52
  const tokens: BalanceToken[] = ensoBalances.map(
53
53
  (balance) =>
54
54
  ({
55
- name: balance.name,
56
- symbol: balance.symbol,
55
+ name: balance.name ?? "",
56
+ symbol: balance.symbol ?? "",
57
57
  decimals: balance.decimals,
58
58
  address: isToken(balance.token, "ETH")
59
59
  ? beraToken.address
60
60
  : balance.token,
61
- logoURI: balance.logoUri,
61
+ logoURI: balance.logoUri ?? undefined,
62
62
  balance: {
63
63
  raw: balance.amount.toString(),
64
64
  formatted: formatUnits(BigInt(balance.amount), balance.decimals),
65
65
  },
66
-
67
- chainId: Number(
68
- // @ts-expect-error - balance.chainId is defined just not typed by enso
69
- balance.chainId,
70
- ),
66
+ chainId: balance.chainId,
71
67
  price: Number(balance.price),
72
68
  }) as const satisfies BalanceToken,
73
69
  );
@@ -15,7 +15,6 @@ import type { AllowanceQueryItem, Token } from "../../types/dex";
15
15
  import type {
16
16
  GetEnsoWalletTransactionsWithApprovalArgs,
17
17
  GetZapTransactions,
18
- GetZapTransactionsArgs,
19
18
  } from "../../types/enso";
20
19
 
21
20
  /**
@@ -35,64 +34,6 @@ function toBigIntOrUndefined(
35
34
  return typeof value === "bigint" ? value : BigInt(value);
36
35
  }
37
36
 
38
- /**
39
- * Get the zap transactions for a given bundle.
40
- * @returns The zap transaction & approval transaction if required.
41
- */
42
- export async function getTransactionsFromBundle({
43
- fromAddress,
44
- amountIn,
45
- tokenIn,
46
- chainId,
47
- ensoClient,
48
- bundle,
49
- publicClient,
50
- }: GetZapTransactionsArgs): Promise<GetZapTransactions> {
51
- const transactions: GetZapTransactions = [];
52
- /**
53
- * If the token is not the native token, we need to check if approval is required.
54
- */
55
- if (tokenIn !== ethAddress) {
56
- const approvalRequest = await ensoClient.getApprovalData({
57
- fromAddress,
58
- tokenAddress: tokenIn,
59
- chainId,
60
- amount: amountIn,
61
- });
62
-
63
- // check if approval is actually required by checking current allowance
64
- let requiresApproval = true;
65
- if (publicClient) {
66
- const currentAllowance = await publicClient.readContract({
67
- address: tokenIn as Address,
68
- abi: erc20Abi,
69
- functionName: "allowance",
70
- args: [fromAddress, approvalRequest.spender],
71
- });
72
- requiresApproval = currentAllowance < BigInt(amountIn);
73
- }
74
-
75
- // Only add approval transaction if it's actually required
76
- if (requiresApproval) {
77
- const approvalValue = toBigIntOrUndefined(approvalRequest.tx.value) ?? 0n;
78
- transactions.push({
79
- to: approvalRequest.tx.to,
80
- data: approvalRequest.tx.data as `0x${string}`,
81
- value: approvalValue,
82
- gasLimit: BigInt(approvalRequest.gas),
83
- });
84
- }
85
- }
86
- const bundleValue = toBigIntOrUndefined(bundle.tx.value) ?? 0n;
87
- transactions.push({
88
- to: bundle.tx.to,
89
- data: bundle.tx.data as `0x${string}`,
90
- value: bundleValue,
91
- gasLimit: BigInt(bundle.gas),
92
- });
93
- return transactions;
94
- }
95
-
96
37
  /**
97
38
  * Get ensowallet transactions for a bundle with approval handling.
98
39
  * Checks allowance on the ensowallet spender and prepends approval when needed.
@@ -15,6 +15,7 @@ export {
15
15
  } from "./clients/getApolloClient";
16
16
  export * from "./clients/getEnsoClient";
17
17
  export * from "./dex/aggregators/base";
18
+ export { ensoErc4626 } from "./dex/aggregators/enso/ensoErc4626";
18
19
  export * from "./dex/bSdk";
19
20
  export * from "./dex/getAllPools";
20
21
  export * from "./dex/getApiPool";
@@ -47,14 +48,12 @@ export * from "./pol/getAutoclaimedIncentives";
47
48
  export * from "./pol/getAutoclaimedIncentivesTxHash";
48
49
  export * from "./pol/getBeraTokenTotalSupply";
49
50
  export * from "./pol/getBgtAprSimulation";
50
- export * from "./pol/getBgtIncentiveDistributorPaused";
51
51
  export * from "./pol/getBlockTime";
52
52
  export * from "./pol/getEarnedStakedBeraVault";
53
53
  export * from "./pol/getGlobalData";
54
54
  export * from "./pol/getHeroEarnVaults";
55
55
  export * from "./pol/getLSTStakeConfig";
56
56
  export * from "./pol/getMarkets";
57
- export * from "./pol/getRewardProofsByValidator";
58
57
  export * from "./pol/getRewardTokenToBeraRate";
59
58
  export * from "./pol/getRewardVault";
60
59
  export * from "./pol/getRewardVaultDurationConstants";
@@ -64,13 +63,12 @@ export * from "./pol/getRewardVaultIncentives";
64
63
  export * from "./pol/getRewardVaultRewards";
65
64
  export * from "./pol/getRewardVaultStakingToken";
66
65
  export * from "./pol/getRewardVaults";
67
- export * from "./pol/getStakedBeraAPR";
66
+ export * from "./pol/getStakedBeraAPY";
68
67
  export * from "./pol/getStakedBeraSnapshots";
69
68
  export * from "./pol/getStakeWithdrawalCooldown";
70
69
  export * from "./pol/getSWBeraVaultMetadata";
71
70
  export * from "./pol/getSWBeraWithdrawal";
72
71
  export * from "./pol/getTotalStakedAmount";
73
- export * from "./pol/getUserClaimableIncentives";
74
72
  export * from "./pol/getUserVaultInfo";
75
73
  export * from "./pol/getUserVaults";
76
74
  export * from "./pol/getVaultHistory";
@@ -90,9 +88,9 @@ export * from "./validators/getApiValidator";
90
88
  export * from "./validators/getDefaultRewardAllocation";
91
89
  export * from "./validators/getStakingPoolBatch";
92
90
  export * from "./validators/getUserActiveValidators";
91
+ export * from "./validators/getUserBoosts";
93
92
  export * from "./validators/getUserBoostsOnValidator";
94
93
  export * from "./validators/getUserStakingPositions";
95
- export * from "./validators/getValidatorAnalytics";
96
94
  export * from "./validators/getValidatorCommission";
97
95
  export * from "./validators/getValidatorEstimatedBgtPerYear";
98
96
  export * from "./validators/getValidatorOperatorAddress";
@@ -1,25 +1,16 @@
1
1
  import BigNumber from "@berachain/utils/pkg/bignumber.js";
2
2
 
3
- import { BeraError } from "../../errors/BeraError";
4
3
  import { fetchBeep } from "../clients/fetchBeep";
5
4
 
6
5
  /**
7
- * Browser-only. Sums the last 24 hourly honey snapshots into a 24h volume.
6
+ * Sums the last 24 hourly honey snapshots into a 24h volume.
8
7
  *
9
8
  * Reads from the `beep` backend (`fetchBeep`), which exposes `totalVolume` per
10
- * snapshot.
9
+ * snapshot. Safe to call from either the browser or the server.
11
10
  */
12
11
  export async function getHoney24hVolume(): Promise<BigNumber | undefined> {
13
- if (typeof window === "undefined") {
14
- throw new BeraError({
15
- message:
16
- "getHoney24hVolume is browser-only; call from a Client Component / SWR hook",
17
- level: "error",
18
- });
19
- }
20
-
21
12
  // beep backend (next-gen), typed against `@berachain/graphql/beep`. Queried
22
- // directly from the browser — no Vercel proxy.
13
+ // directly, no Vercel proxy.
23
14
  const snapshots = await fetchBeep("/v0/honey/snapshots/{interval}", {
24
15
  path: { interval: "hour" },
25
16
  query: { perPage: "24" },
@@ -1,7 +1,7 @@
1
1
  import type { PublicClient } from "viem";
2
2
 
3
3
  import type { Address } from "@berachain/config";
4
- import type { EdgeConfigSchema } from "@berachain/config/internal/edge-config";
4
+ import type { EdgeConfigSchema } from "@berachain/edge-config";
5
5
 
6
6
  import { honeyFactoryAbi } from "@berachain/abis/honey/honeyFactory";
7
7
 
@@ -1,14 +1,4 @@
1
- import { ChainId } from "@berachain/config";
2
-
3
- import { beraFetchJson } from "../../utils/beraFetch";
4
- import { parseBaseArgs } from "../../utils/parseBaseArgs";
5
-
6
- interface SupplyMonitorBeraStatsResponse {
7
- /** Total BERA supply, in whole BERA units. */
8
- totalSupply: number;
9
- /** Circulating BERA supply, in whole BERA units. */
10
- circulatingSupply: number;
11
- }
1
+ import { fetchBeep } from "../clients/fetchBeep";
12
2
 
13
3
  export type GetBeraTokenTotalSupplyArgs = BeraJS.BaseFunctionArgs;
14
4
 
@@ -19,27 +9,7 @@ export type GetBeraTokenTotalSupplyArgs = BeraJS.BaseFunctionArgs;
19
9
  export async function getBeraTokenTotalSupply(
20
10
  args: GetBeraTokenTotalSupplyArgs = {},
21
11
  ): Promise<string> {
22
- const { config } = parseBaseArgs(args);
23
- // supply-monitor only exposes BERA stats for mainnet/bepolia; returns 0 on other chains.
24
- const network = config.chainId === ChainId.MAINNET ? "mainnet" : "bepolia";
25
-
26
- // `supplyMonitor` is typed as `HttpLink` (string | { uri, name, ... }).
27
- // Both forms are accepted; pick the URL out of whichever shape was used.
28
- const supplyMonitor = config.pol.supplyMonitor;
29
- const baseUrl =
30
- typeof supplyMonitor === "string" ? supplyMonitor : supplyMonitor.uri;
31
-
32
- const data = await beraFetchJson<SupplyMonitorBeraStatsResponse>(
33
- {
34
- url: `${baseUrl}/api/stats/bera?network=${network}`,
35
- name:
36
- typeof supplyMonitor === "string"
37
- ? "supply-monitor-bera"
38
- : supplyMonitor.name,
39
- type: "rest",
40
- },
41
- { cache: "no-store" },
42
- );
12
+ const res = await fetchBeep("/v0/stats/bera", {}, args);
43
13
 
44
- return data.totalSupply.toString();
14
+ return res.totalSupply;
45
15
  }
@@ -5,7 +5,6 @@ import { lstStakerVaultAbi } from "@berachain/abis/pol/lst/lstStakerVault";
5
5
  import { assertPublicClient } from "../../errors/assert";
6
6
  import type { TokenWithMetadata } from "../../types/dex";
7
7
  import type { StakingConfig } from "../../types/staking";
8
- import { parseBaseArgs } from "../../utils/parseBaseArgs";
9
8
  import { isToken } from "../../utils/tokens";
10
9
 
11
10
  export type GetLSTStakeConfigArgs = {
@@ -25,11 +24,6 @@ export async function getLSTStakeConfig({
25
24
  }: GetLSTStakeConfigArgs): Promise<StakingConfig[]> {
26
25
  assertPublicClient(publicClient);
27
26
 
28
- const { config } = parseBaseArgs({
29
- ...args,
30
- chainId: publicClient.chain?.id ?? args.chainId,
31
- });
32
-
33
27
  const lstStakingTokens = tokenList.filter((token) =>
34
28
  lstStakingVaults.includes(token.address),
35
29
  );
@@ -1,4 +1,4 @@
1
- import { type Address, erc20Abi, erc4626Abi, type PublicClient } from "viem";
1
+ import { type Address, erc4626Abi, type PublicClient } from "viem";
2
2
 
3
3
  import BigNumber from "@berachain/utils/pkg/bignumber.js";
4
4
 
@@ -7,150 +7,46 @@ import { getStakeWithdrawalCooldown } from "./getStakeWithdrawalCooldown";
7
7
 
8
8
  export interface VaultMetadata {
9
9
  current: {
10
- exchangeRate: string;
11
- totalSupply: string;
12
10
  totalAssets: string;
13
- tvl: string;
14
11
  };
15
- previous: {
16
- exchangeRate: string;
17
- totalSupply: string;
18
- totalAssets: string;
19
- tvl: string;
20
- };
21
- totalWBeraIssued: string;
22
12
  lockPeriod?: number;
23
13
  address: Address;
24
14
  }
25
15
  /**
26
16
  *
27
17
  * @param address - The address of the vault
28
- * @param underlyingAsset - The address of the vault's underlying asset token
29
18
  * @throws {Error} If the vault is not found
30
19
  * @returns
31
20
  */
32
21
  export async function getSWBeraVaultMetadata({
33
22
  address,
34
- underlyingAsset,
35
23
  publicClient,
36
- blockTime,
37
24
  }: {
38
25
  address: Address;
39
- underlyingAsset: Address;
40
26
  publicClient?: PublicClient;
41
- blockTime: number;
42
27
  }): Promise<VaultMetadata> {
43
28
  assertPublicClient(publicClient);
44
29
 
45
- const hoursWindow = 26; // 26 hours is the window for the vault to ensure at least 1 claim per APR window.
46
30
  try {
47
- const currentBlock = await publicClient.getBlock({ blockTag: "latest" });
48
-
49
- const blocksPerWindow = Math.floor((hoursWindow * 60 * 60) / blockTime); // hoursWindow * 60 minutes * 60 seconds / actual block time
50
- const blockWindowAgo = currentBlock.number - BigInt(blocksPerWindow);
51
-
52
- const [
53
- curretTotalAssets,
54
- currentTotalSupply,
55
- currentOneShareWorth,
56
- currentTVL,
57
- totalAssets24HoursAgo,
58
- totalSupply24HoursAgo,
59
- oneShareWorthWindowAgo,
60
- tvl24HoursAgo,
61
- underlyingTotalSupply,
62
- lockPeriod,
63
- ] = await Promise.all([
64
- publicClient.readContract({
65
- address,
66
- abi: erc4626Abi,
67
- functionName: "totalAssets",
68
- }),
69
- publicClient.readContract({
70
- address,
71
- abi: erc4626Abi,
72
- functionName: "totalSupply",
73
- }),
74
- publicClient.readContract({
75
- address,
76
- abi: erc4626Abi,
77
- functionName: "previewRedeem",
78
- args: [10n ** 18n],
79
- blockNumber: currentBlock.number,
80
- }),
81
- publicClient.readContract({
82
- address: underlyingAsset,
83
- abi: erc20Abi,
84
- functionName: "balanceOf",
85
- args: [address],
86
- }),
31
+ const [curretTotalAssets, lockPeriod] = await Promise.all([
87
32
  publicClient.readContract({
88
33
  address,
89
34
  abi: erc4626Abi,
90
35
  functionName: "totalAssets",
91
- blockNumber: blockWindowAgo,
92
- }),
93
- publicClient.readContract({
94
- address,
95
- abi: erc20Abi,
96
- functionName: "totalSupply",
97
- blockNumber: blockWindowAgo,
98
- }),
99
- publicClient.readContract({
100
- address,
101
- abi: erc4626Abi,
102
- functionName: "previewRedeem",
103
- args: [10n ** 18n],
104
- blockNumber: blockWindowAgo,
105
- }),
106
- publicClient.readContract({
107
- address: underlyingAsset,
108
- abi: erc20Abi,
109
- functionName: "balanceOf",
110
- args: [address],
111
- blockNumber: blockWindowAgo,
112
- }),
113
- publicClient.readContract({
114
- address: underlyingAsset,
115
- abi: erc20Abi,
116
- functionName: "totalSupply",
117
36
  }),
118
37
  getStakeWithdrawalCooldown({
119
38
  publicClient,
120
39
  address,
121
40
  }),
122
41
  ]);
123
- const exchangeRateWindowAgo = new BigNumber(
124
- oneShareWorthWindowAgo.toString(),
125
- );
126
-
127
- const currentExchangeRate = new BigNumber(currentOneShareWorth.toString());
128
42
 
129
43
  return {
130
44
  address,
131
45
  current: {
132
- exchangeRate: currentExchangeRate.toString(),
133
- totalSupply: new BigNumber(currentTotalSupply.toString())
134
- .dividedBy(1e18)
135
- .toString(),
136
46
  totalAssets: new BigNumber(curretTotalAssets.toString())
137
47
  .dividedBy(1e18)
138
48
  .toString(),
139
- tvl: new BigNumber(currentTVL.toString()).dividedBy(1e18).toString(),
140
- },
141
- previous: {
142
- exchangeRate: exchangeRateWindowAgo.toString(),
143
- totalSupply: new BigNumber(totalSupply24HoursAgo.toString())
144
- .dividedBy(1e18)
145
- .toString(),
146
- totalAssets: new BigNumber(totalAssets24HoursAgo.toString())
147
- .dividedBy(1e18)
148
- .toString(),
149
- tvl: new BigNumber(tvl24HoursAgo.toString()).dividedBy(1e18).toString(),
150
49
  },
151
- totalWBeraIssued: new BigNumber(underlyingTotalSupply.toString())
152
- .dividedBy(1e18)
153
- .toString(),
154
50
  lockPeriod,
155
51
  };
156
52
  } catch (error) {
@@ -0,0 +1,45 @@
1
+ import type { paths } from "@berachain/graphql/beep";
2
+
3
+ import { fetchBeep } from "../clients/fetchBeep";
4
+
5
+ type StakedBeraAPYWindow = "DAY" | "WEEK" | "6HOURS" | "12HOURS" | "18HOURS";
6
+
7
+ function getBeepResolutionEnum(
8
+ window: StakedBeraAPYWindow,
9
+ ): paths["/v0/stake/apr"]["get"]["parameters"]["query"]["interval"] {
10
+ switch (window) {
11
+ case "18HOURS":
12
+ return "EIGHTEEN_HOURS";
13
+ case "12HOURS":
14
+ return "TWELVE_HOURS";
15
+ case "6HOURS":
16
+ return "SIX_HOURS";
17
+ case "DAY":
18
+ return "ONE_DAY";
19
+ case "WEEK":
20
+ return "SEVEN_DAYS";
21
+ }
22
+ }
23
+ /**
24
+ *
25
+ * @throws {Error} If the vault is not found
26
+ * @returns
27
+ */
28
+ export async function getStakedBeraAPY({
29
+ window,
30
+ }: {
31
+ /**
32
+ * APY might vary depending on the annualized time window (day or week)
33
+ */
34
+ window: StakedBeraAPYWindow;
35
+ } & BeraJS.BaseFunctionArgs): Promise<number> {
36
+ const { apy } = await fetchBeep("/v0/stake/apr", {
37
+ query: {
38
+ interval: getBeepResolutionEnum(window),
39
+ },
40
+ });
41
+
42
+ // apy can be null if no claims have been made.
43
+ // this happens only on early stages of the protocol when there are no claims yet.
44
+ return apy === null ? 0 : Number(apy);
45
+ }