@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
@@ -5,6 +5,7 @@ import {
5
5
  BalancerApi,
6
6
  BaseAggregator,
7
7
  beraWriteContract,
8
+ ensoErc4626,
8
9
  formatValidatorRewardAllocation,
9
10
  getAllPools,
10
11
  getAllValidators,
@@ -15,7 +16,6 @@ import {
15
16
  getAutoclaimedIncentives,
16
17
  getAutoclaimedIncentivesTxHash,
17
18
  getBgtAprSimulation,
18
- getBgtIncentiveDistributorPaused,
19
19
  getBlockTimestamp,
20
20
  getChartData,
21
21
  getCollateralWeights,
@@ -34,7 +34,6 @@ import {
34
34
  getPythLatestPrices,
35
35
  getPythUpdateFee,
36
36
  getRelativeCapLimit,
37
- getRewardProofsByValidator,
38
37
  getRewardTokenToBeraRate,
39
38
  getRewardVault,
40
39
  getRewardVaultEarnedRewards,
@@ -44,20 +43,19 @@ import {
44
43
  getRewardVaults,
45
44
  getSWBeraVaultMetadata,
46
45
  getSWBeraWithdrawal,
47
- getStakedBeraAPR,
46
+ getStakedBeraAPY,
48
47
  getStakedBeraSnapshots,
49
48
  getStakingPoolBatch,
50
49
  getSwapPayload,
51
50
  getTokenCurrentPrices,
52
51
  getTokenInformation,
53
52
  getTotalStakedAmount,
54
- getUserActiveValidators,
53
+ getUserActiveValidatorsApi,
54
+ getUserActiveValidatorsOnChain,
55
55
  getUserBoostsOnValidator,
56
- getUserClaimableIncentives,
57
56
  getUserStakingPositions,
58
57
  getUserVaultInfo,
59
58
  getUserVaults,
60
- getValidatorAnalytics,
61
59
  getValidatorCommission,
62
60
  getValidatorEstimatedBgtPerYear,
63
61
  getValidatorOperatorAddress,
@@ -68,12 +66,13 @@ import {
68
66
  getVaultHistory,
69
67
  getVaultValidators,
70
68
  isBadCollateralAsset,
71
- isBasketModeEnabled
72
- } from "../chunk-DOZJB6IJ.mjs";
73
- import "../chunk-PHYZRH4I.mjs";
69
+ isBasketModeEnabled,
70
+ mergeUserActiveValidators
71
+ } from "../chunk-SMBAW7AG.mjs";
72
+ import "../chunk-BZKA6DBM.mjs";
74
73
  import {
75
74
  fetchBeep
76
- } from "../chunk-BSOWLS3W.mjs";
75
+ } from "../chunk-7OESHTBN.mjs";
77
76
  import "../chunk-GWSTVITN.mjs";
78
77
  import {
79
78
  TokenContext,
@@ -82,7 +81,7 @@ import {
82
81
  useBlockTime,
83
82
  useEnsoUserTokensWithBalances,
84
83
  useHoneyConfig
85
- } from "../chunk-UA3Z47LT.mjs";
84
+ } from "../chunk-5PBYMJRG.mjs";
86
85
  import {
87
86
  swr_default,
88
87
  useSWR,
@@ -91,28 +90,28 @@ import {
91
90
  import {
92
91
  getEnsoClient,
93
92
  getWalletBalances
94
- } from "../chunk-J3LTASDE.mjs";
93
+ } from "../chunk-ZHV3MQ4F.mjs";
95
94
  import "../chunk-ZCEFC2TK.mjs";
96
- import "../chunk-IFNIPVTZ.mjs";
95
+ import "../chunk-BSLXKPX4.mjs";
96
+ import "../chunk-XO2BFPTB.mjs";
97
97
  import "../chunk-GLWPRM33.mjs";
98
98
  import {
99
99
  TransactionFailedError
100
- } from "../chunk-EJIGERYM.mjs";
100
+ } from "../chunk-M3MIGSH3.mjs";
101
101
  import {
102
102
  BeraMonitoring,
103
103
  initBeraError
104
- } from "../chunk-LE4CYW7S.mjs";
104
+ } from "../chunk-FWRYUIJK.mjs";
105
105
  import {
106
106
  assertAddress,
107
- assertAmount,
108
107
  assertDefined,
109
108
  assertPositive,
110
109
  assertPublicClient
111
- } from "../chunk-QQASX4LJ.mjs";
110
+ } from "../chunk-TXWDUJOY.mjs";
112
111
  import {
113
112
  computePriceImpact,
114
113
  wrapNativeTokens
115
- } from "../chunk-AEN6IJFU.mjs";
114
+ } from "../chunk-7KN7TDUC.mjs";
116
115
  import {
117
116
  DEFAULT_METAMASK_GAS_LIMIT,
118
117
  bignumber_js_default,
@@ -123,24 +122,24 @@ import {
123
122
  } from "../chunk-35RACQD4.mjs";
124
123
  import {
125
124
  beraFetchJson
126
- } from "../chunk-ZWTGVIPJ.mjs";
127
- import "../chunk-7TFV6UKF.mjs";
125
+ } from "../chunk-4576RF2K.mjs";
126
+ import "../chunk-XXKPXNQD.mjs";
128
127
  import {
129
128
  beraToken,
130
129
  getHoneyToken,
131
130
  isToken
132
- } from "../chunk-PJRLHTGC.mjs";
131
+ } from "../chunk-HPRLNT6R.mjs";
133
132
  import {
134
133
  parseBaseArgs
135
- } from "../chunk-TGN55GKE.mjs";
134
+ } from "../chunk-SC3BSCTN.mjs";
136
135
  import "../chunk-BMNEN4OK.mjs";
137
136
  import {
138
137
  RequestError
139
- } from "../chunk-P3YZ7F22.mjs";
138
+ } from "../chunk-LL7XR2H5.mjs";
140
139
  import {
141
140
  BeraError,
142
141
  InvalidArgumentError
143
- } from "../chunk-NZAH3SGT.mjs";
142
+ } from "../chunk-MVNQY2D4.mjs";
144
143
 
145
144
  // src/hooks/bend/useGetConvertToAssets.ts
146
145
  import { usePublicClient } from "@berachain/wagmi/hooks";
@@ -174,6 +173,7 @@ import { useBeraWallet as useBeraWallet2, usePublicClient as usePublicClient4 }
174
173
 
175
174
  // src/actions/dex/aggregators/bex.ts
176
175
  import {
176
+ DECIMAL_SCALES,
177
177
  Slippage,
178
178
  Swap,
179
179
  SwapKind,
@@ -192,6 +192,30 @@ var BexAggregator = class extends BaseAggregator {
192
192
  supportedChains = [ChainId.MAINNET, ChainId.BEPOLIA];
193
193
  url = getUriFromLink(this.config.api);
194
194
  type = "graphql";
195
+ /**
196
+ * Opt bex out of tokens it structurally can't route (BGT, or decimals
197
+ * outside b-sdk's supported range) so the quote is never requested and other
198
+ * aggregators still handle it — see `supportsToken` for the specifics.
199
+ */
200
+ getUnsupportedReason(args) {
201
+ const base = super.getUnsupportedReason(args);
202
+ if (base !== null) {
203
+ return base;
204
+ }
205
+ for (const token of [args.tokenIn, args.tokenOut]) {
206
+ if (!this.supportsToken(token)) {
207
+ return `${this.name} can't route ${token.symbol} (BGT or unsupported decimals).`;
208
+ }
209
+ }
210
+ return null;
211
+ }
212
+ supportsToken(token) {
213
+ if (isToken(token.address, "BGT", { config: this.config })) {
214
+ return false;
215
+ }
216
+ const scaleKey = 18 - token.decimals;
217
+ return scaleKey in DECIMAL_SCALES;
218
+ }
195
219
  /**
196
220
  * Helper function to convert zero address to wrapped token address
197
221
  */
@@ -341,7 +365,8 @@ var BexAggregator = class extends BaseAggregator {
341
365
  functionName,
342
366
  abi: balancerVaultAbi,
343
367
  address: callData.to,
344
- value: callData.value || BigInt(0)
368
+ value: callData.value || BigInt(0),
369
+ extraTags: { aggregator: this.name }
345
370
  };
346
371
  }
347
372
  };
@@ -355,17 +380,21 @@ var RedeemBgtAggregator = class extends BaseAggregator {
355
380
  name = "RedeemBgt" /* RedeemBgt */;
356
381
  supportedChains = [ChainId2.MAINNET, ChainId2.BEPOLIA];
357
382
  type = "rpc";
358
- checkChainSupport({
383
+ getUnsupportedReason({
359
384
  tokenIn,
360
385
  tokenOut
361
386
  }) {
362
- if (!super.checkChainSupport({ tokenIn, tokenOut })) {
363
- return false;
387
+ const base = super.getUnsupportedReason({ tokenIn, tokenOut });
388
+ if (base !== null) {
389
+ return base;
364
390
  }
365
- return (
391
+ if (
366
392
  // only supported on same chain
367
393
  tokenIn.chainId === tokenOut.chainId && isToken(tokenIn, "BGT", { chainId: tokenIn.chainId }) && isToken(tokenOut, "BERA")
368
- );
394
+ ) {
395
+ return null;
396
+ }
397
+ return `${this.name} only redeems BGT \u2192 BERA on the same chain.`;
369
398
  }
370
399
  // handles native swaps: wrap and unwrap
371
400
  async getQuote({
@@ -487,6 +516,7 @@ var EnsoAggregator = class extends BaseAggregator {
487
516
  }
488
517
  ],
489
518
  functionName: "swap",
519
+ extraTags: { aggregator: this.name },
490
520
  abi: aggregatorsRouterAbi,
491
521
  // send full amount to router first, which will deduct the swap fee before executing trade
492
522
  value: isTokenInNative ? BigInt(amount) : BigInt("0"),
@@ -508,14 +538,25 @@ var ERC4626Aggregator = class extends BaseAggregator {
508
538
  * Returns true when tokenOut is an ERC4626 vault whose underlying asset matches tokenIn,
509
539
  * or when depositing native BERA into swBERA.
510
540
  */
511
- checkChainSupport({
541
+ getUnsupportedReason({
512
542
  tokenIn,
513
543
  tokenOut,
514
544
  underlyingToken
515
545
  }) {
516
- const result = super.checkChainSupport({ tokenIn, tokenOut, underlyingToken }) && !!underlyingToken && underlyingToken?.chainId === tokenOut.chainId && (isToken(underlyingToken, tokenIn) || // this is a special case for the swbera vault
546
+ const base = super.getUnsupportedReason({
547
+ tokenIn,
548
+ tokenOut,
549
+ underlyingToken
550
+ });
551
+ if (base !== null) {
552
+ return base;
553
+ }
554
+ const isVaultDeposit = !!underlyingToken && underlyingToken?.chainId === tokenOut.chainId && (isToken(underlyingToken, tokenIn) || // this is a special case for the swbera vault
517
555
  isToken(tokenIn, "BERA") && isToken(tokenOut, "SWBERA"));
518
- return result;
556
+ if (isVaultDeposit) {
557
+ return null;
558
+ }
559
+ return `${this.name} only deposits a token into its matching ERC4626 vault.`;
519
560
  }
520
561
  /**
521
562
  * Fetches a deposit quote by calling `convertToShares` on the vault.
@@ -559,14 +600,16 @@ var ERC4626Aggregator = class extends BaseAggregator {
559
600
  address: tokenOut.address,
560
601
  functionName: "depositNative",
561
602
  params: [BigInt(amount), account],
562
- value: BigInt(amount)
603
+ value: BigInt(amount),
604
+ extraTags: { aggregator: this.name }
563
605
  } : {
564
606
  abi: erc4626Abi,
565
607
  address: tokenOut.address,
566
608
  functionName: "deposit",
567
609
  contractName: "others.erc4626" /* ERC4626 */,
568
610
  params: [BigInt(amount), account],
569
- value: 0n
611
+ value: 0n,
612
+ extraTags: { aggregator: this.name }
570
613
  }
571
614
  };
572
615
  }
@@ -672,6 +715,7 @@ var FlyAggregator = class extends BaseAggregator {
672
715
  }
673
716
  ],
674
717
  functionName: "swap",
718
+ extraTags: { aggregator: this.name },
675
719
  abi: aggregatorsRouterAbi2,
676
720
  // send full amount to router first, which will deduct the swap fee before executing trade
677
721
  value: isToken(tokenIn, "BERA") ? BigInt(amount) : BigInt("0"),
@@ -697,6 +741,20 @@ var HaikuAggregator = class extends BaseAggregator {
697
741
  "No route found for the given input or the liquidity is not enough",
698
742
  "Invalid input amount. Please ensure the total amount of input is greater than 0.001 USD"
699
743
  ];
744
+ getUnsupportedReason({
745
+ tokenIn,
746
+ tokenOut,
747
+ rewardVault
748
+ }) {
749
+ const base = super.getUnsupportedReason({ tokenIn, tokenOut });
750
+ if (base !== null) {
751
+ return base;
752
+ }
753
+ if (rewardVault) {
754
+ return `${this.name} does not support reward-vault staking.`;
755
+ }
756
+ return null;
757
+ }
700
758
  async getQuote({
701
759
  tokenIn,
702
760
  tokenOut,
@@ -815,6 +873,7 @@ var HaikuAggregator = class extends BaseAggregator {
815
873
  }
816
874
  ],
817
875
  functionName: "swap",
876
+ extraTags: { aggregator: this.name },
818
877
  abi: aggregatorsRouterAbi3,
819
878
  // send full amount to router first, which will deduct the swap fee before executing trade
820
879
  value: isTokenInNative ? BigInt(amount) : BigInt("0"),
@@ -855,16 +914,23 @@ var HoneyNativeAggregator = class extends BaseAggregator {
855
914
  (coll) => isToken(coll.address, isMint ? tokenIn : tokenOut)
856
915
  );
857
916
  }
858
- checkChainSupport({
917
+ getUnsupportedReason({
859
918
  tokenIn,
860
919
  tokenOut,
861
920
  honeyNativeState
862
921
  }) {
863
- return super.checkChainSupport({ tokenIn, tokenOut }) && tokenIn.chainId === tokenOut.chainId && this.isHoneyNativeSwap({
922
+ const base = super.getUnsupportedReason({ tokenIn, tokenOut });
923
+ if (base !== null) {
924
+ return base;
925
+ }
926
+ if (tokenIn.chainId === tokenOut.chainId && this.isHoneyNativeSwap({
864
927
  tokenIn: tokenIn.address,
865
928
  tokenOut: tokenOut.address,
866
929
  honeyNativeState
867
- });
930
+ })) {
931
+ return null;
932
+ }
933
+ return `${this.name} only mints/redeems HONEY against a listed collateral.`;
868
934
  }
869
935
  async getQuote({
870
936
  tokenIn,
@@ -884,7 +950,7 @@ var HoneyNativeAggregator = class extends BaseAggregator {
884
950
  });
885
951
  }
886
952
  assertPublicClient(publicClient);
887
- this.assertChainSupport({ tokenIn, tokenOut });
953
+ this.assertChainSupport({ tokenIn, tokenOut, honeyNativeState });
888
954
  const isMint = isToken(tokenOut, this.honeyToken);
889
955
  const hubOrderedCollaterals = collaterals;
890
956
  const collateral = collaterals.find(
@@ -1094,6 +1160,7 @@ var KyberSwapAggregator = class extends BaseAggregator {
1094
1160
  }
1095
1161
  ],
1096
1162
  functionName: "swap",
1163
+ extraTags: { aggregator: this.name },
1097
1164
  abi: aggregatorsRouterAbi4,
1098
1165
  // send full amount to router first, which will deduct the swap fee before executing trade
1099
1166
  value: isTokenInNative ? BigInt(amount) : BigInt("0"),
@@ -1188,6 +1255,7 @@ var OogaboogaAggregator = class extends BaseAggregator {
1188
1255
  }
1189
1256
  ],
1190
1257
  functionName: "swap",
1258
+ extraTags: { aggregator: this.name },
1191
1259
  abi: aggregatorsRouterAbi5,
1192
1260
  // send full amount to router first, which will deduct the swap fee before executing trade
1193
1261
  value: isTokenInNative ? BigInt(amount) : BigInt("0"),
@@ -1309,6 +1377,7 @@ var OpenOceanAggregator = class extends BaseAggregator {
1309
1377
  }
1310
1378
  ],
1311
1379
  functionName: "swap",
1380
+ extraTags: { aggregator: this.name },
1312
1381
  abi: aggregatorsRouterAbi6,
1313
1382
  // send full amount to router first, which will deduct the swap fee before executing trade
1314
1383
  value: isTokenInNative ? BigInt(amount) : BigInt("0"),
@@ -1327,18 +1396,21 @@ var WBeraAggregator = class extends BaseAggregator {
1327
1396
  name = "Wrap" /* Wrap */;
1328
1397
  supportedChains = [ChainId10.MAINNET, ChainId10.BEPOLIA];
1329
1398
  type = "rpc";
1330
- checkChainSupport({
1399
+ // This aggregator's entire job is BERA↔WBERA, so keep the base same-token
1400
+ // (native-normalized) guard from rejecting it.
1401
+ supportsBeraWrap = true;
1402
+ getUnsupportedReason({
1331
1403
  tokenIn,
1332
1404
  tokenOut
1333
1405
  }) {
1334
- if (
1335
- // same chain
1336
- tokenIn.chainId !== tokenOut.chainId || // must be one of our chains
1337
- !super.checkChainSupport({ tokenIn, tokenOut })
1338
- ) {
1339
- return false;
1406
+ const base = super.getUnsupportedReason({ tokenIn, tokenOut });
1407
+ if (base !== null) {
1408
+ return base;
1340
1409
  }
1341
- return isToken(tokenIn, "BERA") && isToken(tokenOut, "WBERA") || isToken(tokenIn, "WBERA") && isToken(tokenOut, "BERA");
1410
+ if (tokenIn.chainId === tokenOut.chainId && (isToken(tokenIn, "BERA") && isToken(tokenOut, "WBERA") || isToken(tokenIn, "WBERA") && isToken(tokenOut, "BERA"))) {
1411
+ return null;
1412
+ }
1413
+ return `${this.name} only wraps/unwraps between BERA and WBERA on the same chain.`;
1342
1414
  }
1343
1415
  // handles native swaps: wrap and unwrap
1344
1416
  async getQuote({
@@ -1361,13 +1433,15 @@ var WBeraAggregator = class extends BaseAggregator {
1361
1433
  address: this.config.tokens.wbera,
1362
1434
  functionName: "deposit",
1363
1435
  params: [],
1364
- value: BigInt(amount)
1436
+ value: BigInt(amount),
1437
+ extraTags: { aggregator: this.name }
1365
1438
  } : {
1366
1439
  abi: wberaAbi,
1367
1440
  address: this.config.tokens.wbera,
1368
1441
  functionName: "withdraw",
1369
1442
  params: [BigInt(amount)],
1370
- value: BigInt(0)
1443
+ value: BigInt(0),
1444
+ extraTags: { aggregator: this.name }
1371
1445
  };
1372
1446
  }
1373
1447
  };
@@ -1458,12 +1532,13 @@ function getQueryKey({
1458
1532
  if (!Number(args.amount)) {
1459
1533
  return null;
1460
1534
  }
1461
- if (!aggregator.checkChainSupport({
1535
+ if (aggregator.getUnsupportedReason({
1462
1536
  tokenIn: args.tokenIn,
1463
1537
  tokenOut: args.tokenOut,
1464
1538
  underlyingToken: args.underlyingToken,
1465
- honeyNativeState: args.honeyNativeState
1466
- })) {
1539
+ honeyNativeState: args.honeyNativeState,
1540
+ rewardVault: args.rewardVault
1541
+ }) !== null) {
1467
1542
  return null;
1468
1543
  }
1469
1544
  const name = aggregator.name;
@@ -1731,7 +1806,13 @@ function useAggregatorsQuotes(args, options) {
1731
1806
  ...args,
1732
1807
  aggregator: bex
1733
1808
  },
1734
- { ...swrOptions, isEnabled: bexProtocol.isPaused === false }
1809
+ {
1810
+ ...swrOptions,
1811
+ // Compose with the caller's gate (e.g. same-token suppression from
1812
+ // useSwap) instead of overwriting it — otherwise bex fetches whenever
1813
+ // it's unpaused, regardless of isEnabled (HUB-9FQ).
1814
+ isEnabled: (options?.isEnabled ?? true) && bexProtocol.isPaused === false
1815
+ }
1735
1816
  );
1736
1817
  const wberaSwapResult = raw_useSingleAggregatorQuote({
1737
1818
  ...sharedArgs,
@@ -2123,6 +2204,151 @@ function useCreatePool({
2123
2204
  };
2124
2205
  }
2125
2206
 
2207
+ // src/hooks/dex/useCrossChainNativeFee.ts
2208
+ import { formatEther as formatEther3, zeroAddress as zeroAddress13 } from "viem";
2209
+
2210
+ // src/hooks/tokens/usePollBalance.ts
2211
+ import {
2212
+ erc20Abi,
2213
+ formatEther as formatEther2,
2214
+ formatUnits as formatUnits5,
2215
+ isAddress as isAddress3,
2216
+ zeroAddress as zeroAddress12
2217
+ } from "viem";
2218
+ import { defaultChainId as defaultChainId3 } from "@berachain/config/internal";
2219
+ import { useBeraWallet as useBeraWallet3, usePublicClient as usePublicClient6 } from "@berachain/wagmi/hooks";
2220
+
2221
+ // src/hooks/tokens/useTokenInformation.ts
2222
+ import { isAddress as isAddress2, zeroAddress as zeroAddress11 } from "viem";
2223
+ import { defaultChainId as defaultChainId2 } from "@berachain/config/internal";
2224
+ import { usePublicClient as usePublicClient5 } from "@berachain/wagmi/hooks";
2225
+ function useTokenInformation(args, options) {
2226
+ const publicClient = usePublicClient5({
2227
+ chainId: args.chainId
2228
+ });
2229
+ const QUERY_KEY = args?.address && publicClient && isAddress2(args.address) ? ["useTokenInformation", args.address, args.chainId] : null;
2230
+ return useSWRImmutable(
2231
+ QUERY_KEY,
2232
+ async ([_, address, chainId2 = defaultChainId2]) => {
2233
+ if (isToken(address, "BERA")) {
2234
+ return {
2235
+ address: zeroAddress11,
2236
+ decimals: beraToken.decimals,
2237
+ name: beraToken.name,
2238
+ symbol: beraToken.symbol,
2239
+ chainId: chainId2
2240
+ };
2241
+ }
2242
+ assertPublicClient(publicClient);
2243
+ return await getTokenInformation({
2244
+ address,
2245
+ publicClient,
2246
+ chainId: chainId2
2247
+ });
2248
+ },
2249
+ { ...options }
2250
+ );
2251
+ }
2252
+
2253
+ // src/hooks/tokens/usePollBalance.ts
2254
+ function usePollBalance({
2255
+ address: addressString,
2256
+ owner,
2257
+ chainId: chainId2 = defaultChainId3
2258
+ }, options) {
2259
+ let address = addressString;
2260
+ if (isToken(address, "ETH")) {
2261
+ address = zeroAddress12;
2262
+ }
2263
+ const publicClient = usePublicClient6({ chainId: chainId2 });
2264
+ const { address: account } = useBeraWallet3();
2265
+ const assetOwner = owner ?? account;
2266
+ const QUERY_KEY = publicClient && assetOwner && isAddress3(assetOwner) && address && isAddress3(address) ? ["usePollBalance", assetOwner, address, chainId2] : null;
2267
+ const { data: tokenInformation, isLoading: isLoadingTokenInformation } = useTokenInformation({ address, chainId: chainId2 });
2268
+ const isNativeToken = isToken(address, "BERA");
2269
+ const { isLoading, data, error, ...rest } = useSWR(
2270
+ QUERY_KEY,
2271
+ async ([, assetOwner2, address2]) => {
2272
+ assertPublicClient(publicClient);
2273
+ if (!isToken(address2, "BERA")) {
2274
+ return await publicClient.readContract({
2275
+ address: address2,
2276
+ abi: erc20Abi,
2277
+ functionName: "balanceOf",
2278
+ args: [assetOwner2]
2279
+ });
2280
+ }
2281
+ return await publicClient.getBalance({
2282
+ address: assetOwner2
2283
+ });
2284
+ },
2285
+ {
2286
+ refreshInterval: 1e4 /* FAST */,
2287
+ ...options
2288
+ }
2289
+ );
2290
+ const formattedBalance = !error && data ? isToken(address, "BERA") ? formatEther2(data) : tokenInformation && !isLoadingTokenInformation ? formatUnits5(data, tokenInformation.decimals) : void 0 : void 0;
2291
+ const tokenBalance = {
2292
+ chainId: chainId2,
2293
+ balance: data ? {
2294
+ raw: data.toString(),
2295
+ formatted: formattedBalance ?? "0"
2296
+ } : { raw: "0", formatted: "0" },
2297
+ address,
2298
+ decimals: isNativeToken ? beraToken.decimals : tokenInformation?.decimals ?? 0,
2299
+ symbol: isNativeToken ? beraToken.symbol : tokenInformation?.symbol ?? "",
2300
+ name: isNativeToken ? beraToken.name : tokenInformation?.name ?? ""
2301
+ };
2302
+ return {
2303
+ ...rest,
2304
+ isLoading: isNativeToken ? isLoading : isLoading || isLoadingTokenInformation,
2305
+ error,
2306
+ data: tokenBalance
2307
+ };
2308
+ }
2309
+
2310
+ // src/hooks/dex/useCrossChainNativeFee.ts
2311
+ function isNativeFeeInsufficient({
2312
+ isCrossChain,
2313
+ value,
2314
+ nativeBalance,
2315
+ isLoading
2316
+ }) {
2317
+ if (!isCrossChain) return false;
2318
+ return value > 0n && !isLoading && value > nativeBalance;
2319
+ }
2320
+ function useCrossChainNativeFee({
2321
+ srcChainId,
2322
+ value
2323
+ }) {
2324
+ const isCrossChain = srcChainId !== void 0;
2325
+ const { data: nativeBalanceData, isLoading: isNativeBalanceLoading } = usePollBalance(
2326
+ {
2327
+ address: zeroAddress13,
2328
+ chainId: isCrossChain ? srcChainId : void 0
2329
+ },
2330
+ { isEnabled: isCrossChain }
2331
+ );
2332
+ if (!isCrossChain) {
2333
+ return {
2334
+ nativeFee: void 0,
2335
+ hasInsufficientNativeBalance: false,
2336
+ isNativeBalanceLoading: false
2337
+ };
2338
+ }
2339
+ const nativeBalance = BigInt(nativeBalanceData?.balance.raw ?? 0n);
2340
+ return {
2341
+ nativeFee: value > 0n ? formatEther3(value) : void 0,
2342
+ hasInsufficientNativeBalance: isNativeFeeInsufficient({
2343
+ isCrossChain,
2344
+ value,
2345
+ nativeBalance,
2346
+ isLoading: isNativeBalanceLoading
2347
+ }),
2348
+ isNativeBalanceLoading
2349
+ };
2350
+ }
2351
+
2126
2352
  // src/hooks/dex/useGlobalLiquidityAndSwapVolume.ts
2127
2353
  function useGlobalLiquidityAndSwapVolume() {
2128
2354
  const response = useSWR(
@@ -2249,24 +2475,24 @@ function useLiquidityMismatch({
2249
2475
  }
2250
2476
 
2251
2477
  // src/hooks/dex/useLpPosition.ts
2252
- import { formatEther as formatEther3, isAddressEqual } from "viem";
2478
+ import { formatEther as formatEther4, isAddressEqual } from "viem";
2253
2479
 
2254
2480
  // src/hooks/pol/useRewardVaultBalanceFromStakingToken.ts
2255
- import { isAddress as isAddress3, zeroAddress as zeroAddress12 } from "viem";
2481
+ import { isAddress as isAddress5, zeroAddress as zeroAddress15 } from "viem";
2256
2482
  import { rewardVaultAbi } from "@berachain/abis/pol/rewards/rewardVault";
2257
- import { useBeraWallet as useBeraWallet3, usePublicClient as usePublicClient6 } from "@berachain/wagmi/hooks";
2483
+ import { useBeraWallet as useBeraWallet4, usePublicClient as usePublicClient8 } from "@berachain/wagmi/hooks";
2258
2484
 
2259
2485
  // src/hooks/pol/useRewardVaultFromToken.ts
2260
- import { isAddress as isAddress2, zeroAddress as zeroAddress11 } from "viem";
2486
+ import { isAddress as isAddress4, zeroAddress as zeroAddress14 } from "viem";
2261
2487
  import { rewardVaultFactoryAbi } from "@berachain/abis/pol/rewards/rewardVaultFactory";
2262
- import { usePublicClient as usePublicClient5 } from "@berachain/wagmi/hooks";
2488
+ import { usePublicClient as usePublicClient7 } from "@berachain/wagmi/hooks";
2263
2489
  function useRewardVaultFromToken({
2264
2490
  tokenAddress
2265
2491
  }, {
2266
2492
  isEnabled = true
2267
2493
  } = {}) {
2268
- const publicClient = usePublicClient5();
2269
- const QUERY_KEY = publicClient && tokenAddress && isAddress2(tokenAddress) && isEnabled ? ["useRewardVaultFromToken", tokenAddress] : null;
2494
+ const publicClient = usePublicClient7();
2495
+ const QUERY_KEY = publicClient && tokenAddress && isAddress4(tokenAddress) && isEnabled ? ["useRewardVaultFromToken", tokenAddress] : null;
2270
2496
  return useSWRImmutable(
2271
2497
  QUERY_KEY,
2272
2498
  async ([, tokenAddress2]) => {
@@ -2283,7 +2509,7 @@ function useRewardVaultFromToken({
2283
2509
  functionName: "getVault",
2284
2510
  args: [tokenAddress2]
2285
2511
  });
2286
- return res === zeroAddress11 ? void 0 : res;
2512
+ return res === zeroAddress14 ? void 0 : res;
2287
2513
  }
2288
2514
  );
2289
2515
  }
@@ -2293,12 +2519,11 @@ function useRewardVaultBalanceFromStakingToken({
2293
2519
  stakingToken,
2294
2520
  rewardVaultAddress: _rewardVaultAddress
2295
2521
  }, options) {
2296
- const { address: account } = useBeraWallet3();
2297
- const publicClient = usePublicClient6();
2522
+ const { address: account } = useBeraWallet4();
2523
+ const publicClient = usePublicClient8();
2298
2524
  const isEnabled = options?.isEnabled ?? true;
2299
2525
  const {
2300
2526
  data: rewardVaultAddress = _rewardVaultAddress,
2301
- error,
2302
2527
  refresh: mutateRewardVaultAddress,
2303
2528
  isLoading: isLoadingRewardVaultAddress
2304
2529
  } = useRewardVaultFromToken(
@@ -2310,10 +2535,10 @@ function useRewardVaultBalanceFromStakingToken({
2310
2535
  }
2311
2536
  );
2312
2537
  const swrResponse = useSWR(
2313
- rewardVaultAddress && account && publicClient && isAddress3(rewardVaultAddress) && isAddress3(account) ? ["useVaultBalanceFromStakingToken", rewardVaultAddress, account] : null,
2538
+ rewardVaultAddress && account && publicClient && isAddress5(rewardVaultAddress) && isAddress5(account) ? ["useVaultBalanceFromStakingToken", rewardVaultAddress, account] : null,
2314
2539
  async ([, rewardVaultAddress2, account2]) => {
2315
2540
  assertPublicClient(publicClient);
2316
- if (rewardVaultAddress2 === zeroAddress12) {
2541
+ if (rewardVaultAddress2 === zeroAddress15) {
2317
2542
  return {
2318
2543
  address: rewardVaultAddress2,
2319
2544
  balance: 0n
@@ -2342,106 +2567,6 @@ function useRewardVaultBalanceFromStakingToken({
2342
2567
  };
2343
2568
  }
2344
2569
 
2345
- // src/hooks/tokens/usePollBalance.ts
2346
- import {
2347
- erc20Abi,
2348
- formatEther as formatEther2,
2349
- formatUnits as formatUnits5,
2350
- isAddress as isAddress5,
2351
- zeroAddress as zeroAddress14
2352
- } from "viem";
2353
- import { defaultChainId as defaultChainId3 } from "@berachain/config/internal";
2354
- import { useBeraWallet as useBeraWallet4, usePublicClient as usePublicClient8 } from "@berachain/wagmi/hooks";
2355
-
2356
- // src/hooks/tokens/useTokenInformation.ts
2357
- import { isAddress as isAddress4, zeroAddress as zeroAddress13 } from "viem";
2358
- import { defaultChainId as defaultChainId2 } from "@berachain/config/internal";
2359
- import { usePublicClient as usePublicClient7 } from "@berachain/wagmi/hooks";
2360
- function useTokenInformation(args, options) {
2361
- const publicClient = usePublicClient7({
2362
- chainId: args.chainId
2363
- });
2364
- const QUERY_KEY = args?.address && publicClient && isAddress4(args.address) ? ["useTokenInformation", args.address, args.chainId] : null;
2365
- return useSWRImmutable(
2366
- QUERY_KEY,
2367
- async ([_, address, chainId2 = defaultChainId2]) => {
2368
- if (isToken(address, "BERA")) {
2369
- return {
2370
- address: zeroAddress13,
2371
- decimals: beraToken.decimals,
2372
- name: beraToken.name,
2373
- symbol: beraToken.symbol,
2374
- chainId: chainId2
2375
- };
2376
- }
2377
- assertPublicClient(publicClient);
2378
- return await getTokenInformation({
2379
- address,
2380
- publicClient,
2381
- chainId: chainId2
2382
- });
2383
- },
2384
- { ...options }
2385
- );
2386
- }
2387
-
2388
- // src/hooks/tokens/usePollBalance.ts
2389
- function usePollBalance({
2390
- address: addressString,
2391
- owner,
2392
- chainId: chainId2 = defaultChainId3
2393
- }, options) {
2394
- let address = addressString;
2395
- if (isToken(address, "ETH")) {
2396
- address = zeroAddress14;
2397
- }
2398
- const publicClient = usePublicClient8({ chainId: chainId2 });
2399
- const { address: account } = useBeraWallet4();
2400
- const assetOwner = owner ?? account;
2401
- const QUERY_KEY = publicClient && assetOwner && isAddress5(assetOwner) && address && isAddress5(address) ? ["usePollBalance", assetOwner, address, chainId2] : null;
2402
- const { data: tokenInformation, isLoading: isLoadingTokenInformation } = useTokenInformation({ address, chainId: chainId2 });
2403
- const isNativeToken = isToken(address, "BERA");
2404
- const { isLoading, data, error, ...rest } = useSWR(
2405
- QUERY_KEY,
2406
- async ([, assetOwner2, address2]) => {
2407
- assertPublicClient(publicClient);
2408
- if (!isToken(address2, "BERA")) {
2409
- return await publicClient.readContract({
2410
- address: address2,
2411
- abi: erc20Abi,
2412
- functionName: "balanceOf",
2413
- args: [assetOwner2]
2414
- });
2415
- }
2416
- return await publicClient.getBalance({
2417
- address: assetOwner2
2418
- });
2419
- },
2420
- {
2421
- refreshInterval: 1e4 /* FAST */,
2422
- ...options
2423
- }
2424
- );
2425
- const formattedBalance = !error && data ? isToken(address, "BERA") ? formatEther2(data) : tokenInformation && !isLoadingTokenInformation ? formatUnits5(data, tokenInformation.decimals) : void 0 : void 0;
2426
- const tokenBalance = {
2427
- chainId: chainId2,
2428
- balance: data ? {
2429
- raw: data.toString(),
2430
- formatted: formattedBalance ?? "0"
2431
- } : { raw: "0", formatted: "0" },
2432
- address,
2433
- decimals: isNativeToken ? beraToken.decimals : tokenInformation?.decimals ?? 0,
2434
- symbol: isNativeToken ? beraToken.symbol : tokenInformation?.symbol ?? "",
2435
- name: isNativeToken ? beraToken.name : tokenInformation?.name ?? ""
2436
- };
2437
- return {
2438
- ...rest,
2439
- isLoading: isLoading || isNativeToken ? isLoadingTokenInformation : false,
2440
- error: error || !isNativeToken ? error : void 0,
2441
- data: tokenBalance
2442
- };
2443
- }
2444
-
2445
2570
  // src/hooks/dex/useLpPosition.ts
2446
2571
  function useLpPosition({ pool, vaultAddress }, options) {
2447
2572
  const { data: userPosition, ...rest } = usePollBalance({
@@ -2491,9 +2616,9 @@ function useLpPosition({ pool, vaultAddress }, options) {
2491
2616
  balance: {
2492
2617
  raw: userVaultTokenBalance.balance.toString(),
2493
2618
  // Pools always use the 18 decimals
2494
- formatted: formatEther3(userVaultTokenBalance.balance)
2619
+ formatted: formatEther4(userVaultTokenBalance.balance)
2495
2620
  },
2496
- usdValue: Number(formatEther3(userVaultTokenBalance.balance)) * lpTokenPrice
2621
+ usdValue: Number(formatEther4(userVaultTokenBalance.balance)) * lpTokenPrice
2497
2622
  } : void 0
2498
2623
  },
2499
2624
  ...rest,
@@ -2506,7 +2631,7 @@ function useLpPosition({ pool, vaultAddress }, options) {
2506
2631
 
2507
2632
  // src/hooks/dex/useMultipleTokenApprovalsWithSlippage.ts
2508
2633
  import { useMemo as useMemo3 } from "react";
2509
- import { parseUnits as parseUnits4, zeroAddress as zeroAddress15 } from "viem";
2634
+ import { parseUnits as parseUnits4, zeroAddress as zeroAddress16 } from "viem";
2510
2635
 
2511
2636
  // src/hooks/tokens/usePollAllowances.ts
2512
2637
  import { useBeraWallet as useBeraWallet5, useConfig as useConfig2 } from "@berachain/wagmi/hooks";
@@ -2542,7 +2667,7 @@ function calculateMaxAmountIn({
2542
2667
  function useMultipleTokenApprovalsWithSlippage(tokenInput, options) {
2543
2668
  const { slippage } = options ?? {};
2544
2669
  const items = useMemo3(
2545
- () => tokenInput.filter((token) => token.token.address !== zeroAddress15).filter((token) => bignumber_js_default(token.amount.formatted).gt(0)),
2670
+ () => tokenInput.filter((token) => token.token.address !== zeroAddress16).filter((token) => bignumber_js_default(token.amount.formatted).gt(0)),
2546
2671
  [tokenInput]
2547
2672
  );
2548
2673
  const {
@@ -2595,40 +2720,49 @@ function useMultipleTokenApprovalsWithSlippage(tokenInput, options) {
2595
2720
 
2596
2721
  // src/hooks/dex/useOnChainPoolData.ts
2597
2722
  import { useMemo as useMemo5 } from "react";
2598
- import { formatUnits as formatUnits6, isAddress as isAddress8 } from "viem";
2723
+ import { formatUnits as formatUnits6, isAddress as isAddress7 } from "viem";
2599
2724
  import { usePublicClient as usePublicClient10 } from "@berachain/wagmi/hooks";
2600
2725
 
2601
2726
  // src/hooks/tokens/useMultipleTokenInformation.ts
2602
- import { isAddress as isAddress6 } from "viem";
2603
2727
  import { defaultChainId as defaultChainId4 } from "@berachain/config/internal";
2604
2728
  import { usePublicClient as usePublicClient9 } from "@berachain/wagmi/hooks";
2605
- function useMultipleTokenInformation(args, options) {
2606
- const publicClient = usePublicClient9();
2607
- const QUERY_KEY = publicClient && args.addresses ? [
2608
- "useMultipleTokenInformation",
2609
- args.addresses,
2610
- args.chainId ?? defaultChainId4
2611
- ] : null;
2612
- return useSWRImmutable(
2729
+ async function fetchMultipleTokenInformation({
2730
+ addresses,
2731
+ publicClient,
2732
+ chainId: chainId2
2733
+ }) {
2734
+ const settled = await Promise.allSettled(
2735
+ addresses.map(async (address) => {
2736
+ assertAddress(address, "address");
2737
+ const tk = await getTokenInformation({
2738
+ address,
2739
+ publicClient,
2740
+ chainId: chainId2
2741
+ });
2742
+ if (!tk) {
2743
+ throw new Error(`Token ${address} not found`);
2744
+ }
2745
+ return tk;
2746
+ })
2747
+ );
2748
+ return settled.filter((r) => r.status === "fulfilled").map((r) => r.value);
2749
+ }
2750
+ function useMultipleTokenInformation(args, options) {
2751
+ const publicClient = usePublicClient9();
2752
+ const QUERY_KEY = publicClient && args.addresses ? [
2753
+ "useMultipleTokenInformation",
2754
+ args.addresses,
2755
+ args.chainId ?? defaultChainId4
2756
+ ] : null;
2757
+ return useSWRImmutable(
2613
2758
  QUERY_KEY,
2614
2759
  async ([, addresses, chainId2]) => {
2615
2760
  assertPublicClient(publicClient);
2616
- return Promise.all(
2617
- addresses.map(async (address) => {
2618
- if (!address || !isAddress6(address, { strict: false })) {
2619
- throw new Error("Invalid address");
2620
- }
2621
- const tk = await getTokenInformation({
2622
- address,
2623
- publicClient,
2624
- chainId: chainId2
2625
- });
2626
- if (!tk) {
2627
- throw new Error(`Token ${address} not found`);
2628
- }
2629
- return tk;
2630
- })
2631
- );
2761
+ return fetchMultipleTokenInformation({
2762
+ addresses,
2763
+ publicClient,
2764
+ chainId: chainId2
2765
+ });
2632
2766
  },
2633
2767
  { ...options }
2634
2768
  );
@@ -2636,7 +2770,7 @@ function useMultipleTokenInformation(args, options) {
2636
2770
 
2637
2771
  // src/hooks/tokens/useTokenCurrentPrices.ts
2638
2772
  import { useMemo as useMemo4 } from "react";
2639
- import { isAddress as isAddress7, zeroAddress as zeroAddress16 } from "viem";
2773
+ import { isAddress as isAddress6, zeroAddress as zeroAddress17 } from "viem";
2640
2774
  import { defaultChainId as defaultChainId5 } from "@berachain/config/internal";
2641
2775
 
2642
2776
  // src/hooks/tokens/useTokens.ts
@@ -2674,7 +2808,7 @@ function useTokenCurrentPrices({
2674
2808
  const addresses2 = [];
2675
2809
  if (addressIn) {
2676
2810
  addresses2.push(
2677
- ...addressIn.filter((a) => isAddress7(a))
2811
+ ...addressIn.filter((a) => isAddress6(a))
2678
2812
  );
2679
2813
  }
2680
2814
  return addresses2.map((a) => a.toLowerCase());
@@ -2684,7 +2818,7 @@ function useTokenCurrentPrices({
2684
2818
  tokenList?.map((token) => token.address.toLowerCase())
2685
2819
  );
2686
2820
  if (tokenList.some((token) => isToken(token, "WBERA"))) {
2687
- tokenSet.add(zeroAddress16);
2821
+ tokenSet.add(zeroAddress17);
2688
2822
  }
2689
2823
  return beraAddresses?.some((a) => !tokenSet.has(a));
2690
2824
  }, [beraAddresses, tokenList]);
@@ -2746,7 +2880,7 @@ function useTokenCurrentPrices({
2746
2880
  // src/hooks/dex/useOnChainPoolData.ts
2747
2881
  function useOnChainPoolDataQueryKey(args) {
2748
2882
  const address = "poolId" in args ? args.poolId?.slice(0, 42) : args.address;
2749
- const isAddressValid = isAddress8(address);
2883
+ const isAddressValid = isAddress7(address);
2750
2884
  const isValid = isAddressValid;
2751
2885
  return isValid && address ? ["useOnChainPoolData", address] : null;
2752
2886
  }
@@ -2780,18 +2914,15 @@ function useOnChainPoolData(poolId) {
2780
2914
  if (!poolData || !tokenInformation) {
2781
2915
  return void 0;
2782
2916
  }
2783
- const pool2 = {
2784
- address: address.toLowerCase(),
2785
- id: poolId.toLowerCase(),
2786
- type: poolData.type,
2787
- factory: poolData.factory,
2788
- totalShares: poolData.totalSupply,
2789
- totalLiquidity: "0",
2790
- // overwritten below
2791
- swapFee: poolData.swapFee,
2792
- createTime: 0,
2793
- name: poolData.name,
2794
- tokens: tokenInformation.map((token, idx) => ({
2917
+ const infoByAddress = new Map(
2918
+ tokenInformation.map(
2919
+ (token) => [token.address.toLowerCase(), token]
2920
+ )
2921
+ );
2922
+ const tokens = poolData.poolTokens[0].map((rawAddress, idx) => {
2923
+ const token = infoByAddress.get(rawAddress.toLowerCase());
2924
+ if (!token) return null;
2925
+ return {
2795
2926
  address: token.address.toLowerCase(),
2796
2927
  name: token.name,
2797
2928
  decimals: token.decimals,
@@ -2807,7 +2938,23 @@ function useOnChainPoolData(poolId) {
2807
2938
  token,
2808
2939
  latestUSDPrice: tokenPrices?.[token.address]
2809
2940
  }
2810
- })),
2941
+ };
2942
+ });
2943
+ if (tokens.some((token) => token === null)) {
2944
+ return void 0;
2945
+ }
2946
+ const pool2 = {
2947
+ address: address.toLowerCase(),
2948
+ id: poolId.toLowerCase(),
2949
+ type: poolData.type,
2950
+ factory: poolData.factory,
2951
+ totalShares: poolData.totalSupply,
2952
+ totalLiquidity: "0",
2953
+ // overwritten below
2954
+ swapFee: poolData.swapFee,
2955
+ createTime: 0,
2956
+ name: poolData.name,
2957
+ tokens,
2811
2958
  amplificationParameter: poolData?.amplificationParameter && {
2812
2959
  // For example, if value is 300000n and precision is 1000n, the user-set amplification parameter would be 300000n / 1000n = 300n.
2813
2960
  currentFormattedValue: Number(poolData.amplificationParameter[0]) / Number(poolData.amplificationParameter[2])
@@ -3122,10 +3269,10 @@ import {
3122
3269
  ethAddress,
3123
3270
  formatUnits as formatUnits7,
3124
3271
  getAddress,
3125
- zeroAddress as zeroAddress17
3272
+ zeroAddress as zeroAddress18
3126
3273
  } from "viem";
3127
3274
  function toEnsoAddress(address) {
3128
- return address === zeroAddress17 ? ethAddress : address;
3275
+ return address === zeroAddress18 ? ethAddress : address;
3129
3276
  }
3130
3277
  function toBigIntOrUndefined(value) {
3131
3278
  if (value === null || value === void 0) {
@@ -3133,52 +3280,6 @@ function toBigIntOrUndefined(value) {
3133
3280
  }
3134
3281
  return typeof value === "bigint" ? value : BigInt(value);
3135
3282
  }
3136
- async function getTransactionsFromBundle({
3137
- fromAddress,
3138
- amountIn,
3139
- tokenIn,
3140
- chainId: chainId2,
3141
- ensoClient,
3142
- bundle,
3143
- publicClient
3144
- }) {
3145
- const transactions = [];
3146
- if (tokenIn !== ethAddress) {
3147
- const approvalRequest = await ensoClient.getApprovalData({
3148
- fromAddress,
3149
- tokenAddress: tokenIn,
3150
- chainId: chainId2,
3151
- amount: amountIn
3152
- });
3153
- let requiresApproval = true;
3154
- if (publicClient) {
3155
- const currentAllowance = await publicClient.readContract({
3156
- address: tokenIn,
3157
- abi: erc20Abi2,
3158
- functionName: "allowance",
3159
- args: [fromAddress, approvalRequest.spender]
3160
- });
3161
- requiresApproval = currentAllowance < BigInt(amountIn);
3162
- }
3163
- if (requiresApproval) {
3164
- const approvalValue = toBigIntOrUndefined(approvalRequest.tx.value) ?? 0n;
3165
- transactions.push({
3166
- to: approvalRequest.tx.to,
3167
- data: approvalRequest.tx.data,
3168
- value: approvalValue,
3169
- gasLimit: BigInt(approvalRequest.gas)
3170
- });
3171
- }
3172
- }
3173
- const bundleValue = toBigIntOrUndefined(bundle.tx.value) ?? 0n;
3174
- transactions.push({
3175
- to: bundle.tx.to,
3176
- data: bundle.tx.data,
3177
- value: bundleValue,
3178
- gasLimit: BigInt(bundle.gas)
3179
- });
3180
- return transactions;
3181
- }
3182
3283
  async function getEnsoWalletTransactionsWithApproval({
3183
3284
  fromAddress,
3184
3285
  amountIn,
@@ -3813,7 +3914,6 @@ async function getBendMultiplyBundle({
3813
3914
  leverageMultiplier,
3814
3915
  slippage
3815
3916
  });
3816
- const CALLBACK_IDX_ROUTE_LOAN_TO_COLLATERAL = 0;
3817
3917
  const CALLBACK_IDX_BALANCE_COLLATERAL = 1;
3818
3918
  const depositOnlyActions = [
3819
3919
  {
@@ -4039,152 +4139,8 @@ function useBendMultiply({
4039
4139
  }
4040
4140
 
4041
4141
  // src/hooks/enso/useBendZapSupply.ts
4042
- import { formatEther as formatEther4, parseUnits as parseUnits7, zeroAddress as zeroAddress19 } from "viem";
4043
- import { defaultChainId as berachainChainId } from "@berachain/config/internal";
4142
+ import { parseUnits as parseUnits7, zeroAddress as zeroAddress19 } from "viem";
4044
4143
  import { useBeraWallet as useBeraWallet12, usePublicClient as usePublicClient16 } from "@berachain/wagmi/hooks";
4045
-
4046
- // src/actions/dex/aggregators/enso/ensoErc4626.ts
4047
- import { ethAddress as ethAddress2, zeroAddress as zeroAddress18 } from "viem";
4048
- var EnsoErc4626Aggregator = class extends BaseAggregator {
4049
- name = "Enso (Mint)" /* EnsoErc4626 */;
4050
- supportedChains = null;
4051
- type = "rest";
4052
- needsAccountForQuote = true;
4053
- notFoundMessages = [
4054
- "Could not build shortcuts for route",
4055
- "Could not quote shortcuts for route",
4056
- "Swap not found for a required underlying of defi route,",
4057
- "No route found from"
4058
- ];
4059
- async getQuote({
4060
- tokenIn,
4061
- tokenOut,
4062
- amount,
4063
- slippage,
4064
- account = zeroAddress18,
4065
- aggregatorsFeeBps,
4066
- proxyAggregatorsThroughVercel = false,
4067
- rewardVault,
4068
- underlyingToken
4069
- }) {
4070
- this.assertChainSupport({ tokenIn, tokenOut });
4071
- assertAddress(account, "account");
4072
- const ensoClient = getEnsoClient({
4073
- baseURL: proxyAggregatorsThroughVercel ? "/api/enso" : void 0
4074
- });
4075
- if (tokenIn.address === zeroAddress18) tokenIn.address = ethAddress2;
4076
- if (tokenOut.address === zeroAddress18) tokenOut.address = ethAddress2;
4077
- const zapTokenOut = underlyingToken ?? tokenOut;
4078
- const bundleActions = [
4079
- // this is the base route action, which will swap the token in to the zap token out
4080
- // it handles cross-chain swaps and refunds the user if the swap fails
4081
- // this might even be the only action if no underlying token or reward vault is provided
4082
- {
4083
- protocol: "enso",
4084
- action: "route",
4085
- args: {
4086
- tokenIn: tokenIn.address,
4087
- tokenOut: zapTokenOut.address,
4088
- destinationChainId: (
4089
- // must be undefined if the token is the same chain
4090
- tokenIn.chainId === zapTokenOut.chainId ? void 0 : zapTokenOut.chainId
4091
- ),
4092
- refundReceiver: account,
4093
- amountIn: amount,
4094
- slippage: slippage * 100
4095
- // Enso expects slippage in basis points
4096
- }
4097
- }
4098
- ];
4099
- if (underlyingToken) {
4100
- bundleActions.push({
4101
- protocol: "erc4626",
4102
- action: "deposit",
4103
- args: {
4104
- amountIn: { useOutputOfCallAt: 0 },
4105
- tokenIn: underlyingToken.address,
4106
- primaryAddress: tokenOut.address,
4107
- tokenOut: tokenOut.address
4108
- }
4109
- });
4110
- }
4111
- if (rewardVault) {
4112
- const offset = bundleActions.length;
4113
- bundleActions.push(
4114
- {
4115
- protocol: "enso",
4116
- action: "balance",
4117
- args: {
4118
- token: tokenOut.address
4119
- }
4120
- },
4121
- {
4122
- protocol: "erc20",
4123
- action: "approve",
4124
- args: {
4125
- amount: { useOutputOfCallAt: offset },
4126
- spender: rewardVault,
4127
- token: tokenOut.address
4128
- }
4129
- },
4130
- {
4131
- protocol: "enso",
4132
- action: "call",
4133
- args: {
4134
- address: rewardVault,
4135
- args: [account, { useOutputOfCallAt: offset }],
4136
- method: "stakeOnBehalf",
4137
- abi: "function stakeOnBehalf(address account, uint256 amount) external"
4138
- }
4139
- },
4140
- {
4141
- protocol: "enso",
4142
- action: "balance",
4143
- args: {
4144
- token: rewardVault
4145
- }
4146
- }
4147
- );
4148
- }
4149
- const bundle = await ensoClient.getBundleData(
4150
- {
4151
- fromAddress: account,
4152
- receiver: account,
4153
- spender: account,
4154
- chainId: tokenIn.chainId,
4155
- routingStrategy: "router"
4156
- },
4157
- bundleActions
4158
- );
4159
- const tokenOutAddress = rewardVault?.toLowerCase() ?? tokenOut.address.toLowerCase();
4160
- const amountOut = (
4161
- // @ts-expect-error enso has not typed this but is returned sometimes from API.
4162
- bundle.minAmountsOut?.[tokenOutAddress] ?? bundle.amountsOut[tokenOutAddress] ?? "0"
4163
- );
4164
- return {
4165
- amountOut,
4166
- amountIn: amount,
4167
- allowanceRequirements: this.parseAllowanceRequirements({
4168
- tokenIn,
4169
- rawAmount: amount,
4170
- spender: bundle.tx.to
4171
- }),
4172
- name: this.name,
4173
- swapFeeBps: 0,
4174
- priceImpactPercentage: bundle.priceImpact ? bundle.priceImpact / 100 : null,
4175
- getCalldata: () => ({
4176
- address: bundle.tx.to,
4177
- data: bundle.tx.data,
4178
- value: BigInt(bundle.tx.value ?? 0)
4179
- // not returning gas limit because it's usually underestimated by enso.
4180
- // gasLimit: BigInt(bundle.gas),
4181
- })
4182
- };
4183
- }
4184
- };
4185
- var ensoErc4626 = new EnsoErc4626Aggregator();
4186
-
4187
- // src/hooks/enso/useBendZapSupply.ts
4188
4144
  function useBendZapSupply({
4189
4145
  tokenIn,
4190
4146
  loanToken,
@@ -4193,9 +4149,6 @@ function useBendZapSupply({
4193
4149
  amount,
4194
4150
  slippage
4195
4151
  }, options) {
4196
- const { getTokenPrice } = useTokenPrices({
4197
- tokens: tokenIn && loanToken ? [tokenIn, loanToken] : void 0
4198
- });
4199
4152
  const swrResponse = useBendZapSupplyHelper(
4200
4153
  {
4201
4154
  tokenIn,
@@ -4224,21 +4177,12 @@ function useBendZapSupply({
4224
4177
  formattedAmountOut: zapSupplyAmount?.formatted ?? "0"
4225
4178
  }
4226
4179
  );
4227
- const isCrossChain = tokenIn?.chainId && tokenIn.chainId !== berachainChainId;
4228
- const { data: nativeBalanceData, isLoading: isNativeBalanceLoading } = usePollBalance(
4229
- {
4230
- address: zeroAddress19,
4231
- chainId: isCrossChain ? tokenIn?.chainId : void 0
4232
- },
4233
- { isEnabled: !!isCrossChain }
4234
- );
4180
+ const isCrossChain = swrResponse.data?.isCrossChain;
4235
4181
  const transactionValue = swrResponse.data?.getCalldata?.({ account: zeroAddress19 })?.value ?? 0n;
4236
- const nativeBalance = nativeBalanceData?.balance ?? {
4237
- raw: "0",
4238
- formatted: "0"
4239
- };
4240
- const hasInsufficientNativeBalance = isCrossChain && transactionValue > 0n && !isNativeBalanceLoading && transactionValue > BigInt(nativeBalance.raw);
4241
- const nativeFee = isCrossChain && transactionValue > 0n ? formatEther4(transactionValue) : void 0;
4182
+ const { hasInsufficientNativeBalance, nativeFee } = useCrossChainNativeFee({
4183
+ srcChainId: isCrossChain ? swrResponse.data?.srcChainId : void 0,
4184
+ value: transactionValue
4185
+ });
4242
4186
  return {
4243
4187
  ...swrResponse,
4244
4188
  zapSupplyAmount,
@@ -4313,187 +4257,10 @@ function useBendZapSupplyHelper({
4313
4257
  );
4314
4258
  }
4315
4259
 
4316
- // src/hooks/enso/useEnsoSwapBundle.ts
4317
- import { getPublicClient as getPublicClient2 } from "@wagmi/core";
4318
- import { parseUnits as parseUnits8 } from "viem";
4319
- import { defaultChainId as berachainChainId2 } from "@berachain/config/internal";
4320
- import { useBeraWallet as useBeraWallet14, useConfig as useConfig4 } from "@berachain/wagmi/hooks";
4321
-
4322
- // src/actions/enso/getEnsoSwapBundle.ts
4323
- import { ethAddress as ethAddress3, zeroAddress as zeroAddress20 } from "viem";
4324
- async function getEnsoSwapBundle({
4325
- fromAddress,
4326
- amountIn,
4327
- tokenIn,
4328
- tokenOut,
4329
- chainId: chainId2,
4330
- ensoClient,
4331
- destinationChainId,
4332
- slippage,
4333
- publicClient
4334
- }) {
4335
- assertAddress(fromAddress, "fromAddress");
4336
- if (tokenOut === zeroAddress20) tokenOut = ethAddress3;
4337
- const bundleAction = {
4338
- protocol: "enso",
4339
- action: "route",
4340
- args: {
4341
- tokenIn,
4342
- tokenOut,
4343
- amountIn,
4344
- slippage: slippage * 100
4345
- // Enso expects slippage in basis points
4346
- }
4347
- };
4348
- if (destinationChainId && destinationChainId !== chainId2) {
4349
- bundleAction.args = {
4350
- ...bundleAction.args,
4351
- destinationChainId,
4352
- refundReceiver: fromAddress
4353
- };
4354
- }
4355
- const bundle = await ensoClient.getBundleData(
4356
- {
4357
- fromAddress,
4358
- receiver: fromAddress,
4359
- spender: fromAddress,
4360
- chainId: chainId2,
4361
- routingStrategy: "router"
4362
- },
4363
- [bundleAction]
4364
- );
4365
- const transactions = await getTransactionsFromBundle({
4366
- fromAddress,
4367
- amountIn,
4368
- tokenIn,
4369
- chainId: chainId2,
4370
- ensoClient,
4371
- bundle,
4372
- publicClient
4373
- });
4374
- return {
4375
- bundle,
4376
- transactions
4377
- };
4378
- }
4379
-
4380
- // src/hooks/tokens/usePollWalletBalances.ts
4381
- import { useMemo as useMemo9 } from "react";
4382
- import {
4383
- useBeraWallet as useBeraWallet13,
4384
- useConfig as useConfig3,
4385
- usePublicClient as usePublicClient17
4386
- } from "@berachain/wagmi/hooks";
4387
- function usePollWalletBalances(args, options) {
4388
- const publicClient = usePublicClient17();
4389
- const wagmiConfig = useConfig3();
4390
- const { address: connectedAccount } = useBeraWallet13();
4391
- const { tokenList, refresh } = useTokens();
4392
- const wallet = args?.walletAddress ?? connectedAccount;
4393
- const tokens = useMemo9(() => {
4394
- return new Map(
4395
- (args?.tokens ?? tokenList)?.map((t) => [t.address.toLowerCase(), t]) ?? []
4396
- );
4397
- }, [tokenList, args?.tokens]);
4398
- const QUERY_KEY = publicClient && tokenList !== void 0 && wallet ? [
4399
- "usePollWalletBalances",
4400
- wallet,
4401
- // TODO: adding the whole list to the query is very inefficient, we should only add the tokens addresses
4402
- Array.from(tokens.values())
4403
- ] : null;
4404
- const swrResponse = useSWR(
4405
- QUERY_KEY,
4406
- async ([, wallet2, tokenList2]) => {
4407
- return getWalletBalances({
4408
- account: wallet2,
4409
- tokenList: tokenList2,
4410
- wagmiConfig
4411
- });
4412
- },
4413
- {
4414
- refreshInterval: 1e5 /* NORMAL */,
4415
- ...options
4416
- }
4417
- );
4418
- return {
4419
- ...swrResponse,
4420
- refresh: () => {
4421
- swrResponse?.refresh();
4422
- refresh();
4423
- }
4424
- };
4425
- }
4426
-
4427
- // src/hooks/enso/useEnsoSwapBundle.ts
4428
- function useEnsoSwapBundle({
4429
- tokenIn,
4430
- tokenOut,
4431
- amount,
4432
- slippage
4433
- }) {
4434
- const { address: fromAddress } = useBeraWallet14();
4435
- const wagmiConfig = useConfig4();
4436
- const proxyAggregatorsThroughVercel = useBeraFlag(
4437
- "proxyAggregatorsThroughVercel"
4438
- );
4439
- const ensoClient = getEnsoClient({
4440
- baseURL: proxyAggregatorsThroughVercel ? "/api/enso" : void 0
4441
- });
4442
- const { refresh: refreshBalances } = usePollWalletBalances();
4443
- const isEnabled = !!tokenIn && !!tokenOut && !!amount && Number(amount) > 0 && !!slippage && !!fromAddress && !!tokenIn.chainId;
4444
- const QUERY_KEY = isEnabled ? [
4445
- "useEnsoSwapBundle",
4446
- fromAddress,
4447
- tokenIn,
4448
- tokenOut,
4449
- amount,
4450
- slippage,
4451
- proxyAggregatorsThroughVercel ?? false
4452
- ] : null;
4453
- const swrResponse = useSWR(
4454
- QUERY_KEY,
4455
- async ([, fromAddress2, tokenIn2, tokenOut2, amount2, slippage2]) => {
4456
- assertAddress(fromAddress2, "fromAddress");
4457
- assertAddress(tokenIn2?.address, "tokenInAddress");
4458
- assertDefined(tokenIn2?.chainId, "tokenInChainId");
4459
- assertAddress(tokenOut2?.address, "tokenOutAddress");
4460
- assertAmount(amount2, "amount");
4461
- assertAmount(slippage2, "slippage");
4462
- const publicClient = getPublicClient2(wagmiConfig, {
4463
- chainId: tokenIn2.chainId
4464
- });
4465
- assertPublicClient(publicClient);
4466
- const rawAmount = parseUnits8(amount2, tokenIn2.decimals).toString();
4467
- return getEnsoSwapBundle({
4468
- fromAddress: fromAddress2,
4469
- amountIn: rawAmount,
4470
- tokenIn: tokenIn2.address,
4471
- tokenOut: tokenOut2.address,
4472
- chainId: tokenIn2.chainId,
4473
- ensoClient,
4474
- destinationChainId: berachainChainId2,
4475
- slippage: slippage2,
4476
- publicClient
4477
- });
4478
- },
4479
- {
4480
- refreshInterval: 1e5 /* NORMAL */,
4481
- isEnabled
4482
- }
4483
- );
4484
- return {
4485
- ...swrResponse,
4486
- refresh: () => {
4487
- swrResponse.refresh();
4488
- refreshBalances();
4489
- }
4490
- };
4491
- }
4492
-
4493
4260
  // src/hooks/enso/useZapStakeBera.ts
4494
- import { formatUnits as formatUnits9, parseUnits as parseUnits9 } from "viem";
4261
+ import { formatUnits as formatUnits9, parseUnits as parseUnits8 } from "viem";
4495
4262
  import { chainConfigs, defaultChainId as defaultChainId9 } from "@berachain/config/internal";
4496
- import { useBeraWallet as useBeraWallet15 } from "@berachain/wagmi/hooks";
4263
+ import { useBeraWallet as useBeraWallet13 } from "@berachain/wagmi/hooks";
4497
4264
  function useZapStakeBera({
4498
4265
  inputToken,
4499
4266
  amount,
@@ -4501,7 +4268,7 @@ function useZapStakeBera({
4501
4268
  slippage,
4502
4269
  tokenOut
4503
4270
  }, options) {
4504
- const { address: account } = useBeraWallet15();
4271
+ const { address: account } = useBeraWallet13();
4505
4272
  const quoteAccount = account ?? chainConfigs[defaultChainId9].bex.aggregatorsRouterExecutor;
4506
4273
  const isEnabled = !!inputToken && !!amount && Number(amount) > 0 && !!inputToken.chainId && !!underlyingToken && !!slippage;
4507
4274
  const QUERY_KEY = isEnabled ? [
@@ -4524,7 +4291,7 @@ function useZapStakeBera({
4524
4291
  underlyingToken2,
4525
4292
  tokenOut2
4526
4293
  ]) => {
4527
- const rawAmount = parseUnits9(amount2, inputToken2.decimals).toString();
4294
+ const rawAmount = parseUnits8(amount2, inputToken2.decimals).toString();
4528
4295
  return ensoErc4626.getQuote({
4529
4296
  account: quoteAccount2,
4530
4297
  amount: rawAmount,
@@ -4553,13 +4320,13 @@ function useZapStakeBera({
4553
4320
  data: {
4554
4321
  ...swrResponse.data,
4555
4322
  priceImpactPercentage,
4556
- isCrossChain: inputToken && tokenOut.chainId !== inputToken?.chainId
4323
+ isCrossChain: swrResponse.data?.isCrossChain
4557
4324
  }
4558
4325
  };
4559
4326
  }
4560
4327
 
4561
4328
  // src/hooks/honey/useCappedGlobally.ts
4562
- import { usePublicClient as usePublicClient18 } from "@berachain/wagmi/hooks";
4329
+ import { usePublicClient as usePublicClient17 } from "@berachain/wagmi/hooks";
4563
4330
 
4564
4331
  // src/hooks/honey/usePythLatestPrices.ts
4565
4332
  function usePythLatestPrices({
@@ -4584,7 +4351,7 @@ function useCappedGlobally({
4584
4351
  isMint,
4585
4352
  isBasketModeEnabled: isBasketModeEnabled2
4586
4353
  }, options) {
4587
- const publicClient = usePublicClient18();
4354
+ const publicClient = usePublicClient17();
4588
4355
  const { priceFeedMap, flags } = useHoneyConfig();
4589
4356
  const { data: latestPrices } = usePythLatestPrices(
4590
4357
  {
@@ -4633,14 +4400,14 @@ function useCappedGlobally({
4633
4400
  }
4634
4401
 
4635
4402
  // src/hooks/honey/useCappedRelatively.ts
4636
- import { usePublicClient as usePublicClient19 } from "@berachain/wagmi/hooks";
4403
+ import { usePublicClient as usePublicClient18 } from "@berachain/wagmi/hooks";
4637
4404
  function useCappedRelatively({
4638
4405
  asset,
4639
4406
  amount,
4640
4407
  isMint,
4641
4408
  isBasketModeEnabled: isBasketModeEnabled2
4642
4409
  }, options) {
4643
- const publicClient = usePublicClient19();
4410
+ const publicClient = usePublicClient18();
4644
4411
  const { collateralList, referenceCollateral } = useHoneyConfig();
4645
4412
  const QUERY_KEY = asset && amount ? [
4646
4413
  "useCappedRelatively",
@@ -4690,11 +4457,11 @@ function useCappedRelatively({
4690
4457
  }
4691
4458
 
4692
4459
  // src/hooks/honey/useCollateralWeights.ts
4693
- import { usePublicClient as usePublicClient20 } from "@berachain/wagmi/hooks";
4460
+ import { usePublicClient as usePublicClient19 } from "@berachain/wagmi/hooks";
4694
4461
  function useCollateralWeights({
4695
4462
  collateralList
4696
4463
  }, options) {
4697
- const publicClient = usePublicClient20();
4464
+ const publicClient = usePublicClient19();
4698
4465
  const QUERY_KEY = publicClient && collateralList ? ["useCollateralWeights", collateralList] : void 0;
4699
4466
  return useSWR(
4700
4467
  QUERY_KEY,
@@ -4721,19 +4488,19 @@ function useHoney24hVolume() {
4721
4488
  }
4722
4489
 
4723
4490
  // src/hooks/honey/useHoneyAlerts.ts
4724
- import { useMemo as useMemo10 } from "react";
4491
+ import { useMemo as useMemo9 } from "react";
4725
4492
 
4726
4493
  // src/hooks/honey/useHoneyBalances.ts
4727
4494
  import {
4728
- useBeraWallet as useBeraWallet16,
4729
- useConfig as useConfig5,
4730
- usePublicClient as usePublicClient21
4495
+ useBeraWallet as useBeraWallet14,
4496
+ useConfig as useConfig3,
4497
+ usePublicClient as usePublicClient20
4731
4498
  } from "@berachain/wagmi/hooks";
4732
4499
  function useHoneyBalances() {
4733
- const publicClient = usePublicClient21();
4734
- const { address: account } = useBeraWallet16();
4500
+ const publicClient = usePublicClient20();
4501
+ const { address: account } = useBeraWallet14();
4735
4502
  const { collateralList } = useHoneyConfig();
4736
- const wagmiConfig = useConfig5();
4503
+ const wagmiConfig = useConfig3();
4737
4504
  const QUERY_KEY = account && collateralList && publicClient ? ["useHoneyBalances", account, collateralList] : null;
4738
4505
  return useSWR(
4739
4506
  QUERY_KEY,
@@ -4761,9 +4528,9 @@ function useHoneyBalances() {
4761
4528
  }
4762
4529
 
4763
4530
  // src/hooks/honey/useHoneyVaultsBalance.ts
4764
- import { usePublicClient as usePublicClient22 } from "@berachain/wagmi/hooks";
4531
+ import { usePublicClient as usePublicClient21 } from "@berachain/wagmi/hooks";
4765
4532
  function useHoneyVaultsBalance(options) {
4766
- const publicClient = usePublicClient22();
4533
+ const publicClient = usePublicClient21();
4767
4534
  const { collateralList } = useHoneyConfig();
4768
4535
  const QUERY_KEY = collateralList && publicClient ? ["useHoneyVaultsBalance", collateralList] : null;
4769
4536
  return useSWR(
@@ -4780,9 +4547,9 @@ function useHoneyVaultsBalance(options) {
4780
4547
  }
4781
4548
 
4782
4549
  // src/hooks/honey/useIsBadCollateralAsset.ts
4783
- import { usePublicClient as usePublicClient23 } from "@berachain/wagmi/hooks";
4550
+ import { usePublicClient as usePublicClient22 } from "@berachain/wagmi/hooks";
4784
4551
  function useIsBadCollateralAsset({ collateral }, options) {
4785
- const publicClient = usePublicClient23();
4552
+ const publicClient = usePublicClient22();
4786
4553
  const { priceFeedMap, flags } = useHoneyConfig();
4787
4554
  const { data: latestPrices } = usePythLatestPrices(
4788
4555
  {
@@ -4947,7 +4714,7 @@ function useHoneyAlerts({
4947
4714
  const redeemedVaultBalance = vaultsBalances?.find(
4948
4715
  (vault) => vault.address.toLowerCase() === redeemedCollateral.toLowerCase()
4949
4716
  );
4950
- const [isLiquidityDepleted, isLowLiquidity] = useMemo10(() => {
4717
+ const [isLiquidityDepleted, isLowLiquidity] = useMemo9(() => {
4951
4718
  const isDepleted = getIsLiquidityLowerThan({
4952
4719
  lowerThan: 1,
4953
4720
  vaultsBalances,
@@ -4965,7 +4732,7 @@ function useHoneyAlerts({
4965
4732
  const {
4966
4733
  isMore: isRedeemMoreThanLiquidity,
4967
4734
  isRedeemMoreThanLiquidityCollaterals
4968
- } = useMemo10(() => {
4735
+ } = useMemo9(() => {
4969
4736
  return getRedeemMoreThanLiquidity({
4970
4737
  vaultsBalances,
4971
4738
  redeemedVaultBalance,
@@ -4973,7 +4740,7 @@ function useHoneyAlerts({
4973
4740
  collateralList
4974
4741
  });
4975
4742
  }, [vaultsBalances, redeemedVaultBalance, state, collateralList]);
4976
- const isExceedingBalance = useMemo10(
4743
+ const isExceedingBalance = useMemo9(
4977
4744
  () => getExceedingBalance({
4978
4745
  state,
4979
4746
  honeyBalances
@@ -5008,9 +4775,9 @@ import { formatUnits as formatUnits10 } from "viem";
5008
4775
  import { defaultChainId as defaultChainId10 } from "@berachain/config/internal";
5009
4776
 
5010
4777
  // src/hooks/honey/useIsBasketModeEnabled.ts
5011
- import { usePublicClient as usePublicClient24 } from "@berachain/wagmi/hooks";
4778
+ import { usePublicClient as usePublicClient23 } from "@berachain/wagmi/hooks";
5012
4779
  function useIsBasketModeEnabled({ state }, options) {
5013
- const publicClient = usePublicClient24();
4780
+ const publicClient = usePublicClient23();
5014
4781
  const { priceFeedMap, flags, collateralList } = useHoneyConfig();
5015
4782
  const { data: latestPrices } = usePythLatestPrices(
5016
4783
  {
@@ -5184,12 +4951,12 @@ function useHoneySwapState() {
5184
4951
  }
5185
4952
 
5186
4953
  // src/hooks/perps/usePythUpdateFee.ts
5187
- import { usePublicClient as usePublicClient25 } from "@berachain/wagmi/hooks";
4954
+ import { usePublicClient as usePublicClient24 } from "@berachain/wagmi/hooks";
5188
4955
  function usePythUpdateFee({
5189
4956
  pythPriceFeedCalldata,
5190
4957
  tokenListLength
5191
4958
  }, options) {
5192
- const publicClient = usePublicClient25();
4959
+ const publicClient = usePublicClient24();
5193
4960
  const QUERY_KEY = pythPriceFeedCalldata && pythPriceFeedCalldata.length > 0 ? ["usePythUpdateFee", pythPriceFeedCalldata] : null;
5194
4961
  const { data = getPythDefaultUpdateFee(tokenListLength), isLoading } = useSWRImmutable(
5195
4962
  QUERY_KEY,
@@ -5210,11 +4977,11 @@ function usePythUpdateFee({
5210
4977
  }
5211
4978
 
5212
4979
  // src/hooks/pol/useAutoclaimedIncentives.ts
5213
- import { useBeraWallet as useBeraWallet17 } from "@berachain/wagmi/hooks";
4980
+ import { useBeraWallet as useBeraWallet15 } from "@berachain/wagmi/hooks";
5214
4981
  function useAutoclaimedIncentives({
5215
4982
  enabled
5216
4983
  }) {
5217
- const { address: account } = useBeraWallet17();
4984
+ const { address: account } = useBeraWallet15();
5218
4985
  const QUERY_KEY = enabled && account ? ["useAutoclaimedIncentives", account] : null;
5219
4986
  return useSWR(
5220
4987
  QUERY_KEY,
@@ -5228,11 +4995,11 @@ function useAutoclaimedIncentives({
5228
4995
  }
5229
4996
 
5230
4997
  // src/hooks/pol/useAutoclaimedIncentivesTxHash.ts
5231
- import { useBeraWallet as useBeraWallet18 } from "@berachain/wagmi/hooks";
4998
+ import { useBeraWallet as useBeraWallet16 } from "@berachain/wagmi/hooks";
5232
4999
  function useAutoclaimedIncentivesTxHash({
5233
5000
  enabled
5234
5001
  }) {
5235
- const { address: account } = useBeraWallet18();
5002
+ const { address: account } = useBeraWallet16();
5236
5003
  const QUERY_KEY = enabled && account ? ["useAutoclaimedIncentivesTxHash", account] : null;
5237
5004
  return useSWR(
5238
5005
  QUERY_KEY,
@@ -5251,9 +5018,9 @@ function useAutoclaimedIncentivesTxHash({
5251
5018
  }
5252
5019
 
5253
5020
  // src/hooks/pol/useBgtAprSimulation.ts
5254
- import { useMemo as useMemo11 } from "react";
5021
+ import { useMemo as useMemo10 } from "react";
5255
5022
  function useBgtAprSimulation(args) {
5256
- return useMemo11(() => {
5023
+ return useMemo10(() => {
5257
5024
  if (!args) {
5258
5025
  return void 0;
5259
5026
  }
@@ -5261,29 +5028,13 @@ function useBgtAprSimulation(args) {
5261
5028
  }, [args]);
5262
5029
  }
5263
5030
 
5264
- // src/hooks/pol/useBgtIncentiveDistributorPaused.ts
5265
- import { usePublicClient as usePublicClient26 } from "@berachain/wagmi/hooks";
5266
- function useBgtIncentiveDistributorPaused(options) {
5267
- const publicClient = usePublicClient26();
5268
- const QUERY_KEY = publicClient ? ["useBgtIncentiveDistributorPaused", publicClient.chain?.id] : null;
5269
- return swr_default(
5270
- QUERY_KEY,
5271
- async () => getBgtIncentiveDistributorPaused({ publicClient }).catch(() => false),
5272
- {
5273
- revalidateOnFocus: false,
5274
- revalidateOnReconnect: false,
5275
- ...options
5276
- }
5277
- );
5278
- }
5279
-
5280
5031
  // src/hooks/pol/useBgtUnstakedBalance.ts
5281
5032
  import { formatEther as formatEther5 } from "viem";
5282
5033
  import { bgtAbi } from "@berachain/abis/pol/bgt";
5283
- import { useBeraWallet as useBeraWallet19, usePublicClient as usePublicClient27 } from "@berachain/wagmi/hooks";
5034
+ import { useBeraWallet as useBeraWallet17, usePublicClient as usePublicClient25 } from "@berachain/wagmi/hooks";
5284
5035
  function useBgtUnstakedBalance(options) {
5285
- const { address: account } = useBeraWallet19();
5286
- const publicClient = usePublicClient27();
5036
+ const { address: account } = useBeraWallet17();
5037
+ const publicClient = usePublicClient25();
5287
5038
  const QUERY_KEY = account && publicClient ? ["useBgtUnstakedBalance", account] : null;
5288
5039
  return useSWR(
5289
5040
  QUERY_KEY,
@@ -5309,10 +5060,10 @@ function useBgtUnstakedBalance(options) {
5309
5060
 
5310
5061
  // src/hooks/pol/useClaimableFees.ts
5311
5062
  import { formatUnits as formatUnits11 } from "viem";
5312
- import { useBeraWallet as useBeraWallet20, usePublicClient as usePublicClient28 } from "@berachain/wagmi/hooks";
5063
+ import { useBeraWallet as useBeraWallet18, usePublicClient as usePublicClient26 } from "@berachain/wagmi/hooks";
5313
5064
  function useClaimableFees() {
5314
- const { address: account } = useBeraWallet20();
5315
- const publicClient = usePublicClient28();
5065
+ const { address: account } = useBeraWallet18();
5066
+ const publicClient = usePublicClient26();
5316
5067
  const QUERY_KEY = account && publicClient ? ["useClaimableFees", account] : null;
5317
5068
  return useSWR(
5318
5069
  QUERY_KEY,
@@ -5341,7 +5092,7 @@ import {
5341
5092
  } from "@berachain/graphql/pol/api";
5342
5093
 
5343
5094
  // src/hooks/pol/useRewardVaults.ts
5344
- import { usePublicClient as usePublicClient29 } from "@berachain/wagmi/hooks";
5095
+ import { usePublicClient as usePublicClient27 } from "@berachain/wagmi/hooks";
5345
5096
  function useRewardVaultsQueryKey(filter, onChainIncentives = false) {
5346
5097
  return ["useRewardVaults", filter, onChainIncentives];
5347
5098
  }
@@ -5350,7 +5101,7 @@ function useRewardVaults(args, options) {
5350
5101
  args.filter,
5351
5102
  args.onChainIncentives
5352
5103
  );
5353
- const publicClient = usePublicClient29();
5104
+ const publicClient = usePublicClient27();
5354
5105
  return useSWR(
5355
5106
  QUERY_KEY,
5356
5107
  async ([, filter, onChainIncentives]) => {
@@ -5388,9 +5139,9 @@ function useHighestVaultsAPR(where = {}, { isEnabled = true } = {}) {
5388
5139
  }
5389
5140
 
5390
5141
  // src/hooks/pol/usePollGlobalData.ts
5391
- import { usePublicClient as usePublicClient30 } from "@berachain/wagmi/hooks";
5142
+ import { usePublicClient as usePublicClient28 } from "@berachain/wagmi/hooks";
5392
5143
  function usePollGlobalData(options) {
5393
- const publicClient = usePublicClient30();
5144
+ const publicClient = usePublicClient28();
5394
5145
  return useSWR(
5395
5146
  publicClient ? "usePollGlobalData" : null,
5396
5147
  async () => {
@@ -5423,15 +5174,15 @@ function usePollMarkets(options) {
5423
5174
  }
5424
5175
 
5425
5176
  // src/hooks/pol/useQueuedBeraUnlock.ts
5426
- import { isAddress as isAddress9 } from "viem";
5427
- import { usePublicClient as usePublicClient31 } from "@berachain/wagmi/hooks";
5177
+ import { isAddress as isAddress8 } from "viem";
5178
+ import { usePublicClient as usePublicClient29 } from "@berachain/wagmi/hooks";
5428
5179
  function useQueuedBeraUnlock({
5429
5180
  receiptTokenAddresses,
5430
5181
  account,
5431
5182
  version
5432
5183
  }, options) {
5433
- const publicClient = usePublicClient31();
5434
- const QUERY_KEY = receiptTokenAddresses && account && publicClient && isAddress9(account) && version ? [
5184
+ const publicClient = usePublicClient29();
5185
+ const QUERY_KEY = receiptTokenAddresses && account && publicClient && isAddress8(account) && version ? [
5435
5186
  "useQueuedBeraUnlock",
5436
5187
  receiptTokenAddresses,
5437
5188
  account,
@@ -5461,12 +5212,12 @@ function useQueuedBeraUnlock({
5461
5212
 
5462
5213
  // src/hooks/pol/useRewardTokenToBeraRate.ts
5463
5214
  import { defaultChainId as defaultChainId11 } from "@berachain/config/internal";
5464
- import { usePublicClient as usePublicClient32 } from "@berachain/wagmi/hooks";
5215
+ import { usePublicClient as usePublicClient30 } from "@berachain/wagmi/hooks";
5465
5216
  function useRewardTokenToBeraRate({
5466
5217
  address
5467
5218
  }, opt) {
5468
- const QUERY_KEY = address ? ["useRewardTokenToBeraRate", address] : null;
5469
- const publicClient = usePublicClient32({ chainId: defaultChainId11 });
5219
+ const publicClient = usePublicClient30({ chainId: defaultChainId11 });
5220
+ const QUERY_KEY = address && publicClient ? ["useRewardTokenToBeraRate", address] : null;
5470
5221
  return useSWR(
5471
5222
  QUERY_KEY,
5472
5223
  async ([_, address2]) => {
@@ -5484,9 +5235,9 @@ function useRewardTokenToBeraRate({
5484
5235
  }
5485
5236
 
5486
5237
  // src/hooks/pol/useOnChainRewardVault.ts
5487
- import { erc20Abi as erc20Abi4, formatUnits as formatUnits13, isAddress as isAddress10 } from "viem";
5238
+ import { erc20Abi as erc20Abi4, formatUnits as formatUnits13, isAddress as isAddress9 } from "viem";
5488
5239
  import { beraChefAbi } from "@berachain/abis/pol/rewards/beraChef";
5489
- import { usePublicClient as usePublicClient33 } from "@berachain/wagmi/hooks";
5240
+ import { usePublicClient as usePublicClient31 } from "@berachain/wagmi/hooks";
5490
5241
 
5491
5242
  // src/actions/pol/getStakingTokenInformation.ts
5492
5243
  import { erc20Abi as erc20Abi3, formatUnits as formatUnits12 } from "viem";
@@ -5532,12 +5283,12 @@ async function getStakingTokenInformation({
5532
5283
 
5533
5284
  // src/hooks/pol/useOnChainRewardVault.ts
5534
5285
  function useOnChainRewardVaultQueryKey(address) {
5535
- return address && isAddress10(address) ? ["onChainRewardVault", address.toLowerCase()] : null;
5286
+ return address && isAddress9(address) ? ["onChainRewardVault", address.toLowerCase()] : null;
5536
5287
  }
5537
5288
  function useOnChainRewardVault({
5538
5289
  address
5539
5290
  }, opt) {
5540
- const publicClient = usePublicClient33();
5291
+ const publicClient = usePublicClient31();
5541
5292
  const QUERY_KEY = useOnChainRewardVaultQueryKey(address);
5542
5293
  return useSWR(
5543
5294
  publicClient ? QUERY_KEY : null,
@@ -5649,12 +5400,12 @@ function useRewardVault(id, options) {
5649
5400
  }
5650
5401
 
5651
5402
  // src/hooks/pol/useRewardVaultIncentives.ts
5652
- import { usePublicClient as usePublicClient34 } from "@berachain/wagmi/hooks";
5403
+ import { usePublicClient as usePublicClient32 } from "@berachain/wagmi/hooks";
5653
5404
  function useRewardVaultIncentives({
5654
5405
  address,
5655
5406
  stakingToken
5656
5407
  }) {
5657
- const publicClient = usePublicClient34();
5408
+ const publicClient = usePublicClient32();
5658
5409
  const QUERY_KEY = publicClient && address && stakingToken ? ["useRewardVaultIncentives", address, stakingToken] : null;
5659
5410
  return useSWR(QUERY_KEY, async ([, address2, stakingToken2]) => {
5660
5411
  assertPublicClient(publicClient);
@@ -5667,9 +5418,9 @@ function useRewardVaultIncentives({
5667
5418
  }
5668
5419
 
5669
5420
  // src/hooks/pol/useRewardVaultRewards.ts
5670
- import { usePublicClient as usePublicClient35 } from "@berachain/wagmi/hooks";
5421
+ import { usePublicClient as usePublicClient33 } from "@berachain/wagmi/hooks";
5671
5422
  function useRewardVaultRewards(address, options) {
5672
- const publicClient = usePublicClient35();
5423
+ const publicClient = usePublicClient33();
5673
5424
  const QUERY_KEY = publicClient && address ? ["useRewardVaultRewards", address] : null;
5674
5425
  return useSWR(
5675
5426
  QUERY_KEY,
@@ -5705,11 +5456,11 @@ function dailyResolution(data) {
5705
5456
  return dailyData;
5706
5457
  }
5707
5458
 
5708
- // src/hooks/pol/useStakedAPR.ts
5709
- function useStakedAPR({
5459
+ // src/hooks/pol/useStakedAPY.ts
5460
+ function useStakedAPY({
5710
5461
  range
5711
5462
  }) {
5712
- const QUERY_KEY = range ? ["useStakedAPR", range] : null;
5463
+ const QUERY_KEY = range ? ["useStakedAPY", range] : null;
5713
5464
  return useSWR(QUERY_KEY, async ([, range2]) => {
5714
5465
  const unsortedStakedBeraSnapshots = await getStakedBeraSnapshots({
5715
5466
  range: range2
@@ -5719,18 +5470,67 @@ function useStakedAPR({
5719
5470
  );
5720
5471
  return sortedStakedBeraSnapshots.map((item) => ({
5721
5472
  timestamp: item.timestamp,
5722
- apr: item.apr
5473
+ apy: item.apy
5723
5474
  }));
5724
5475
  });
5725
5476
  }
5726
5477
 
5727
5478
  // src/hooks/pol/useStakedData.ts
5728
5479
  import { useMemo as useMemo12 } from "react";
5729
- import { useBeraWallet as useBeraWallet21, usePublicClient as usePublicClient36 } from "@berachain/wagmi/hooks";
5480
+ import { useBeraWallet as useBeraWallet20, usePublicClient as usePublicClient35 } from "@berachain/wagmi/hooks";
5481
+
5482
+ // src/hooks/tokens/usePollWalletBalances.ts
5483
+ import { useMemo as useMemo11 } from "react";
5484
+ import {
5485
+ useBeraWallet as useBeraWallet19,
5486
+ useConfig as useConfig4,
5487
+ usePublicClient as usePublicClient34
5488
+ } from "@berachain/wagmi/hooks";
5489
+ function usePollWalletBalances(args, options) {
5490
+ const publicClient = usePublicClient34();
5491
+ const wagmiConfig = useConfig4();
5492
+ const { address: connectedAccount } = useBeraWallet19();
5493
+ const { tokenList, refresh } = useTokens();
5494
+ const wallet = args?.walletAddress ?? connectedAccount;
5495
+ const tokens = useMemo11(() => {
5496
+ return new Map(
5497
+ (args?.tokens ?? tokenList)?.map((t) => [t.address.toLowerCase(), t]) ?? []
5498
+ );
5499
+ }, [tokenList, args?.tokens]);
5500
+ const QUERY_KEY = publicClient && tokenList !== void 0 && wallet ? [
5501
+ "usePollWalletBalances",
5502
+ wallet,
5503
+ // TODO: adding the whole list to the query is very inefficient, we should only add the tokens addresses
5504
+ Array.from(tokens.values())
5505
+ ] : null;
5506
+ const swrResponse = useSWR(
5507
+ QUERY_KEY,
5508
+ async ([, wallet2, tokenList2]) => {
5509
+ return getWalletBalances({
5510
+ account: wallet2,
5511
+ tokenList: tokenList2,
5512
+ wagmiConfig
5513
+ });
5514
+ },
5515
+ {
5516
+ refreshInterval: 1e5 /* NORMAL */,
5517
+ ...options
5518
+ }
5519
+ );
5520
+ return {
5521
+ ...swrResponse,
5522
+ refresh: () => {
5523
+ swrResponse?.refresh();
5524
+ refresh();
5525
+ }
5526
+ };
5527
+ }
5528
+
5529
+ // src/hooks/pol/useStakedData.ts
5730
5530
  function useStakedData(stakingConfigs) {
5731
5531
  const window2 = useBeraFlag("swberaAprWindow");
5732
- const publicClient = usePublicClient36();
5733
- const { address: account } = useBeraWallet21();
5532
+ const publicClient = usePublicClient35();
5533
+ const { address: account } = useBeraWallet20();
5734
5534
  const receiptTokens = useMemo12(
5735
5535
  () => stakingConfigs.map((config) => config.receiptToken),
5736
5536
  [stakingConfigs]
@@ -5739,11 +5539,10 @@ function useStakedData(stakingConfigs) {
5739
5539
  () => stakingConfigs.map((config) => config.inputTokens[0]),
5740
5540
  [stakingConfigs]
5741
5541
  );
5742
- const aprKey = window2 ? ["useStakedData:apr", window2] : null;
5743
- const { data: apr } = useSWR(
5744
- aprKey,
5745
- async ([, window3]) => getStakedBeraAPR({ window: window3 }),
5746
- { refreshInterval: 1e5 /* NORMAL */ }
5542
+ const apyKey = window2 ? ["useStakedData:apy", window2] : null;
5543
+ const { data: apy } = useSWRImmutable(
5544
+ apyKey,
5545
+ async ([, window3]) => getStakedBeraAPY({ window: window3 })
5747
5546
  );
5748
5547
  const {
5749
5548
  data: walletBalances,
@@ -5811,7 +5610,7 @@ function useStakedData(stakingConfigs) {
5811
5610
  const stakedAmountUsd = inputTokenPrice === void 0 ? void 0 : stakedAmount.multipliedBy(inputTokenPrice).toNumber();
5812
5611
  return {
5813
5612
  token: inputToken,
5814
- apr,
5613
+ apy,
5815
5614
  stakedAmount: stakedAmount.toNumber(),
5816
5615
  stakedAmountUsd,
5817
5616
  earnedAmount: 0,
@@ -5823,7 +5622,7 @@ function useStakedData(stakingConfigs) {
5823
5622
  walletBalances,
5824
5623
  exchangeRates,
5825
5624
  stakingConfigs,
5826
- apr,
5625
+ apy,
5827
5626
  getTokenPrice,
5828
5627
  earningsSettled
5829
5628
  ]);
@@ -5847,14 +5646,14 @@ function useStakedData(stakingConfigs) {
5847
5646
  const earnedAmountUsd = inputTokenPrice === void 0 ? void 0 : earnedAmount.multipliedBy(inputTokenPrice).toNumber();
5848
5647
  return {
5849
5648
  token: inputToken,
5850
- apr,
5649
+ apy,
5851
5650
  stakedAmount: stakedAmount.toNumber(),
5852
5651
  earnedAmount: earnedAmount.toNumber(),
5853
5652
  stakedAmountUsd,
5854
5653
  earnedAmountUsd
5855
5654
  };
5856
5655
  });
5857
- }, [positionsRaw, walletBalances, stakingConfigs, apr, getTokenPrice]);
5656
+ }, [positionsRaw, walletBalances, stakingConfigs, apy, getTokenPrice]);
5858
5657
  return {
5859
5658
  /** Fast path: staked amounts + USD values (no earnings) */
5860
5659
  balances,
@@ -5868,7 +5667,7 @@ function useStakedData(stakingConfigs) {
5868
5667
  /**
5869
5668
  * Hard error: the RPC fast-path could not produce staked balances (wallet
5870
5669
  * balances or exchange-rate reads failed). Price and earnings backend
5871
- * failures are intentionally excluded — those degrade gracefully (USD/APR
5670
+ * failures are intentionally excluded — those degrade gracefully (USD/APY
5872
5671
  * render as "—", earnings stop loading) so RPC-derived amounts still show.
5873
5672
  */
5874
5673
  error: walletBalancesError ?? exchangeRatesError,
@@ -5923,22 +5722,19 @@ function useStakedSnapshots({
5923
5722
  }
5924
5723
 
5925
5724
  // src/hooks/pol/useStakingVaultsMetadata.ts
5926
- import { usePublicClient as usePublicClient37 } from "@berachain/wagmi/hooks";
5725
+ import { usePublicClient as usePublicClient36 } from "@berachain/wagmi/hooks";
5927
5726
  function useStakingVaultsMetadata(vaults = []) {
5928
- const publicClient = usePublicClient37();
5929
- const blockTime = useBlockTime();
5930
- const QUERY_KEY = vaults.length > 0 && publicClient && blockTime ? ["useStakingVaultMetadata", vaults, publicClient, blockTime] : null;
5727
+ const publicClient = usePublicClient36();
5728
+ const QUERY_KEY = vaults.length > 0 && publicClient ? ["useStakingVaultMetadata", vaults] : null;
5931
5729
  return useSWR(
5932
5730
  QUERY_KEY,
5933
- async ([, vaults2, publicClient2, blockTime2]) => {
5934
- assertPublicClient(publicClient2);
5731
+ async ([, vaults2]) => {
5732
+ assertPublicClient(publicClient);
5935
5733
  return Promise.all(
5936
5734
  vaults2.map(
5937
5735
  (vault) => getSWBeraVaultMetadata({
5938
5736
  address: vault.address,
5939
- underlyingAsset: vault.underlyingAsset,
5940
- publicClient: publicClient2,
5941
- blockTime: blockTime2
5737
+ publicClient
5942
5738
  })
5943
5739
  )
5944
5740
  );
@@ -5948,11 +5744,11 @@ function useStakingVaultsMetadata(vaults = []) {
5948
5744
  }
5949
5745
 
5950
5746
  // src/hooks/pol/useTotalStakedAmount.ts
5951
- import { usePublicClient as usePublicClient38 } from "@berachain/wagmi/hooks";
5747
+ import { usePublicClient as usePublicClient37 } from "@berachain/wagmi/hooks";
5952
5748
  function useTotalStakedAmount({
5953
5749
  vaultAddresses
5954
5750
  }) {
5955
- const publicClient = usePublicClient38();
5751
+ const publicClient = usePublicClient37();
5956
5752
  return useSWR(
5957
5753
  vaultAddresses && publicClient ? ["useTotalStakedAmount", vaultAddresses] : null,
5958
5754
  ([, vaultAddresses2]) => {
@@ -5962,10 +5758,10 @@ function useTotalStakedAmount({
5962
5758
  }
5963
5759
 
5964
5760
  // src/hooks/pol/useUserVaultInfo.ts
5965
- import { useBeraWallet as useBeraWallet22, usePublicClient as usePublicClient39 } from "@berachain/wagmi/hooks";
5761
+ import { useBeraWallet as useBeraWallet21, usePublicClient as usePublicClient38 } from "@berachain/wagmi/hooks";
5966
5762
  function useUserVaultInfo(args, options) {
5967
- const { address: account } = useBeraWallet22();
5968
- const publicClient = usePublicClient39();
5763
+ const { address: account } = useBeraWallet21();
5764
+ const publicClient = usePublicClient38();
5969
5765
  const QUERY_KEY = account && publicClient && args.vaultAddress ? ["useUserVaultInfo", account, args.vaultAddress] : null;
5970
5766
  return useSWR(
5971
5767
  QUERY_KEY,
@@ -5985,10 +5781,10 @@ function useUserVaultInfo(args, options) {
5985
5781
  }
5986
5782
 
5987
5783
  // src/hooks/pol/useUserVaults.ts
5988
- import { useBeraWallet as useBeraWallet23, usePublicClient as usePublicClient40 } from "@berachain/wagmi/hooks";
5784
+ import { useBeraWallet as useBeraWallet22, usePublicClient as usePublicClient39 } from "@berachain/wagmi/hooks";
5989
5785
  function useUserVaults(options) {
5990
- const { address: account } = useBeraWallet23();
5991
- const publicClient = usePublicClient40();
5786
+ const { address: account } = useBeraWallet22();
5787
+ const publicClient = usePublicClient39();
5992
5788
  const QUERY_KEY = account && publicClient ? ["useUserVaults", account] : null;
5993
5789
  return useSWR(
5994
5790
  QUERY_KEY,
@@ -6008,9 +5804,9 @@ function useUserVaults(options) {
6008
5804
  }
6009
5805
 
6010
5806
  // src/hooks/pol/useVaultAddress.ts
6011
- import { usePublicClient as usePublicClient41 } from "@berachain/wagmi/hooks";
5807
+ import { usePublicClient as usePublicClient40 } from "@berachain/wagmi/hooks";
6012
5808
  function useVaultAddress(vaultAddress) {
6013
- const publicClient = usePublicClient41();
5809
+ const publicClient = usePublicClient40();
6014
5810
  const QUERY_KEY = vaultAddress && publicClient ? ["useVaultAddress", vaultAddress] : null;
6015
5811
  return useSWR(QUERY_KEY, async ([, vaultAddress2]) => {
6016
5812
  assertPublicClient(publicClient);
@@ -6078,17 +5874,17 @@ function useBeraCurrentPrice(opts) {
6078
5874
  }
6079
5875
 
6080
5876
  // src/hooks/tokens/useStakingTokenInformation.ts
6081
- import { isAddress as isAddress11, zeroAddress as zeroAddress21 } from "viem";
6082
- import { usePublicClient as usePublicClient42 } from "@berachain/wagmi/hooks";
5877
+ import { isAddress as isAddress10, zeroAddress as zeroAddress20 } from "viem";
5878
+ import { usePublicClient as usePublicClient41 } from "@berachain/wagmi/hooks";
6083
5879
  function useStakingTokenInformation(args, options) {
6084
- const publicClient = usePublicClient42();
6085
- const QUERY_KEY = args?.address && publicClient && isAddress11(args.address) ? ["useStakingTokenInformation", args.address] : null;
5880
+ const publicClient = usePublicClient41();
5881
+ const QUERY_KEY = args?.address && publicClient && isAddress10(args.address) ? ["useStakingTokenInformation", args.address] : null;
6086
5882
  return useSWRImmutable(
6087
5883
  QUERY_KEY,
6088
5884
  async ([_, address]) => {
6089
5885
  if (isToken(address, "BERA")) {
6090
5886
  return {
6091
- address: zeroAddress21,
5887
+ address: zeroAddress20,
6092
5888
  decimals: beraToken.decimals,
6093
5889
  name: beraToken.name,
6094
5890
  symbol: beraToken.symbol
@@ -6105,9 +5901,9 @@ function useStakingTokenInformation(args, options) {
6105
5901
 
6106
5902
  // src/hooks/tokens/useTotalSupply.ts
6107
5903
  import { erc20Abi as erc20Abi5 } from "viem";
6108
- import { usePublicClient as usePublicClient43 } from "@berachain/wagmi/hooks";
5904
+ import { usePublicClient as usePublicClient42 } from "@berachain/wagmi/hooks";
6109
5905
  function useTotalSupply({ address }) {
6110
- const publicClient = usePublicClient43();
5906
+ const publicClient = usePublicClient42();
6111
5907
  return useSWR(
6112
5908
  address && publicClient ? ["useTotalSupply", address] : null,
6113
5909
  ([, address2]) => {
@@ -6123,9 +5919,9 @@ function useTotalSupply({ address }) {
6123
5919
  }
6124
5920
 
6125
5921
  // src/hooks/useBlockToTimestamp.ts
6126
- import { useBlockNumber, usePublicClient as usePublicClient44 } from "@berachain/wagmi/hooks";
5922
+ import { useBlockNumber, usePublicClient as usePublicClient43 } from "@berachain/wagmi/hooks";
6127
5923
  function useBlockToTimestamp(inputBlock) {
6128
- const publicClient = usePublicClient44();
5924
+ const publicClient = usePublicClient43();
6129
5925
  const { config } = parseBaseArgs({ chainId: publicClient?.chain.id });
6130
5926
  const { data: currentBlock, isLoading } = useBlockNumber({
6131
5927
  cacheTime: seconds(config.averageBlockTime)
@@ -6154,7 +5950,7 @@ function useBlockToTimestamp(inputBlock) {
6154
5950
 
6155
5951
  // src/hooks/useContractWrite/useBeraContractWrite.ts
6156
5952
  import { useCallback as useCallback2, useReducer as useReducer2 } from "react";
6157
- import { useBeraWagmi as useBeraWagmi3, useConfig as useConfig6 } from "@berachain/wagmi/hooks";
5953
+ import { useBeraWagmi as useBeraWagmi3, useConfig as useConfig5 } from "@berachain/wagmi/hooks";
6158
5954
 
6159
5955
  // src/hooks/useContractWrite/stateReducer.ts
6160
5956
  var initialState = {
@@ -6205,7 +6001,7 @@ function useBeraContractWrite({
6205
6001
  } = {}) {
6206
6002
  const [state, dispatch] = useReducer2(reducer2, initialState);
6207
6003
  const { account, onSmartAccountRejection } = useBeraWagmi3();
6208
- const wagmiConfig = useConfig6();
6004
+ const wagmiConfig = useConfig5();
6209
6005
  const txConfirmationTimeout = account?.wallet?.isContract ? 6e4 * 10 : 12e4;
6210
6006
  const reset = useCallback2(() => {
6211
6007
  dispatch({ type: "confirm_reset" /* RESET */ });
@@ -6280,7 +6076,7 @@ function useBeraContractWrite({
6280
6076
  }
6281
6077
 
6282
6078
  // src/hooks/useGetVerifiedAbi.ts
6283
- import { isAddress as isAddress12, zeroAddress as zeroAddress22 } from "viem";
6079
+ import { isAddress as isAddress11, zeroAddress as zeroAddress21 } from "viem";
6284
6080
  import { chainId } from "@berachain/config/internal";
6285
6081
  async function fetchVerifiedAbi(address) {
6286
6082
  const data = await beraFetchJson({
@@ -6295,8 +6091,8 @@ async function fetchVerifiedAbi(address) {
6295
6091
  }
6296
6092
  function useGetVerifiedAbi(address) {
6297
6093
  return useSWRImmutable(
6298
- address && isAddress12(address) && // Address zero can't be a contract for sure
6299
- address !== zeroAddress22 ? ["useGetVerifiedAbi", address] : null,
6094
+ address && isAddress11(address) && // Address zero can't be a contract for sure
6095
+ address !== zeroAddress21 ? ["useGetVerifiedAbi", address] : null,
6300
6096
  () => address ? fetchVerifiedAbi(address) : Promise.resolve(""),
6301
6097
  {}
6302
6098
  );
@@ -6405,7 +6201,7 @@ function useApiValidator(id, options) {
6405
6201
  }
6406
6202
 
6407
6203
  // src/hooks/validators/useBaselineRewardAllocation.ts
6408
- import { usePublicClient as usePublicClient45 } from "@berachain/wagmi/hooks";
6204
+ import { usePublicClient as usePublicClient44 } from "@berachain/wagmi/hooks";
6409
6205
 
6410
6206
  // src/actions/validators/getBaselineRewardAllocation.ts
6411
6207
  import { rewardAllocatorFactoryAbi as rewardAllocationFactoryAbi } from "@berachain/abis/pol/rewards/rewardAllocatorFactory";
@@ -6427,7 +6223,7 @@ async function getBaselineRewardAllocation({
6427
6223
 
6428
6224
  // src/hooks/validators/useBaselineRewardAllocation.ts
6429
6225
  function useBaselineRewardAllocation() {
6430
- const publicClient = usePublicClient45();
6226
+ const publicClient = usePublicClient44();
6431
6227
  return useSWR(publicClient ? ["baselineRewardAllocation"] : null, () => {
6432
6228
  assertPublicClient(publicClient);
6433
6229
  return getBaselineRewardAllocation({
@@ -6438,10 +6234,10 @@ function useBaselineRewardAllocation() {
6438
6234
 
6439
6235
  // src/hooks/validators/useManagedValidatorRole.ts
6440
6236
  import { useMemo as useMemo13 } from "react";
6441
- import { useBeraWallet as useBeraWallet24, usePublicClient as usePublicClient46 } from "@berachain/wagmi/hooks";
6237
+ import { useBeraWallet as useBeraWallet23, usePublicClient as usePublicClient45 } from "@berachain/wagmi/hooks";
6442
6238
 
6443
6239
  // src/actions/validators/getValidatorRewardAllocatorAddress.ts
6444
- import { zeroAddress as zeroAddress23 } from "viem";
6240
+ import { zeroAddress as zeroAddress22 } from "viem";
6445
6241
  import { beraChefAbi as beraChefAbi2 } from "@berachain/abis/pol/rewards/beraChef";
6446
6242
  async function getValidatorRewardAllocatorAddress({
6447
6243
  client,
@@ -6456,7 +6252,7 @@ async function getValidatorRewardAllocatorAddress({
6456
6252
  functionName: "valRewardAllocator",
6457
6253
  args: [pubKey]
6458
6254
  });
6459
- if (result === zeroAddress23) {
6255
+ if (result === zeroAddress22) {
6460
6256
  return null;
6461
6257
  }
6462
6258
  return result;
@@ -6485,13 +6281,13 @@ function useManagedValidatorRole({
6485
6281
  pubKey,
6486
6282
  account: accountAddress
6487
6283
  }, options) {
6488
- const publicClient = usePublicClient46();
6284
+ const publicClient = usePublicClient45();
6489
6285
  const mockValidatorOperator = useBeraFlag("mockValidatorOperator");
6490
6286
  const mockValidatorRewardAllocator = useBeraFlag(
6491
6287
  "mockValidatorRewardAllocator"
6492
6288
  );
6493
6289
  const QUERY_KEY = publicClient && pubKey ? ["useManagedValidatorRole", pubKey] : null;
6494
- const { address: connectedAccount } = useBeraWallet24();
6290
+ const { address: connectedAccount } = useBeraWallet23();
6495
6291
  const account = accountAddress ?? connectedAccount;
6496
6292
  const swrResponse = useSWR(
6497
6293
  QUERY_KEY,
@@ -6533,12 +6329,12 @@ function useManagedValidatorRole({
6533
6329
  }
6534
6330
 
6535
6331
  // src/hooks/validators/useStakingPoolBatch.ts
6536
- import { usePublicClient as usePublicClient47 } from "@berachain/wagmi/hooks";
6332
+ import { usePublicClient as usePublicClient46 } from "@berachain/wagmi/hooks";
6537
6333
  function useStakingPoolBatch({
6538
6334
  valPubKey,
6539
6335
  options
6540
6336
  }) {
6541
- const publicClient = usePublicClient47();
6337
+ const publicClient = usePublicClient46();
6542
6338
  const QUERY_KEY = publicClient && valPubKey ? ["useStakingPoolBatch", valPubKey] : null;
6543
6339
  return useSWR(
6544
6340
  QUERY_KEY,
@@ -6557,16 +6353,29 @@ function useStakingPoolBatch({
6557
6353
  }
6558
6354
 
6559
6355
  // src/hooks/validators/useUserActiveValidators.ts
6560
- import { useBeraWallet as useBeraWallet25, usePublicClient as usePublicClient48 } from "@berachain/wagmi/hooks";
6356
+ import { useMemo as useMemo14 } from "react";
6357
+ import { useBeraWallet as useBeraWallet24, usePublicClient as usePublicClient47 } from "@berachain/wagmi/hooks";
6561
6358
  function useUserActiveValidators(options) {
6562
- const { address: account } = useBeraWallet25();
6563
- const publicClient = usePublicClient48();
6564
- const QUERY_KEY = publicClient && account ? ["useUserActiveValidators", account] : null;
6565
- return useSWR(
6566
- QUERY_KEY,
6359
+ const { address: account } = useBeraWallet24();
6360
+ const publicClient = usePublicClient47();
6361
+ const apiSwr = useSWR(
6362
+ account ? ["useUserActiveValidatorsApi", account] : null,
6567
6363
  async ([, account2]) => {
6568
- return await getUserActiveValidators({
6364
+ return await getUserActiveValidatorsApi({ account: account2 });
6365
+ },
6366
+ {
6367
+ ...options,
6368
+ refreshInterval: options?.refreshInterval ?? 18e4 /* SLOW */,
6369
+ keepPreviousData: true
6370
+ }
6371
+ );
6372
+ const validators = apiSwr.data;
6373
+ const onChainSwr = useSWR(
6374
+ publicClient && account && validators ? ["useUserActiveValidatorsOnChain", account, validators] : null,
6375
+ async ([, account2, validators2]) => {
6376
+ return await getUserActiveValidatorsOnChain({
6569
6377
  account: account2,
6378
+ validators: validators2,
6570
6379
  publicClient
6571
6380
  });
6572
6381
  },
@@ -6576,16 +6385,35 @@ function useUserActiveValidators(options) {
6576
6385
  keepPreviousData: true
6577
6386
  }
6578
6387
  );
6388
+ const onChainBoosts = onChainSwr.data;
6389
+ const data = useMemo14(() => {
6390
+ if (!validators || !onChainBoosts) return void 0;
6391
+ return mergeUserActiveValidators({ validators, onChainBoosts });
6392
+ }, [validators, onChainBoosts]);
6393
+ return {
6394
+ ...apiSwr,
6395
+ data,
6396
+ isLoading: apiSwr.isLoading || onChainSwr.isLoading,
6397
+ isValidating: apiSwr.isValidating || onChainSwr.isValidating,
6398
+ error: apiSwr.error ?? onChainSwr.error,
6399
+ refresh: () => {
6400
+ apiSwr.refresh();
6401
+ onChainSwr.refresh();
6402
+ },
6403
+ refreshOnChain: () => {
6404
+ onChainSwr.refresh();
6405
+ }
6406
+ };
6579
6407
  }
6580
6408
 
6581
6409
  // src/hooks/validators/useUserBoostsOnValidator.ts
6582
- import { useBeraWallet as useBeraWallet26, usePublicClient as usePublicClient49 } from "@berachain/wagmi/hooks";
6410
+ import { useBeraWallet as useBeraWallet25, usePublicClient as usePublicClient48 } from "@berachain/wagmi/hooks";
6583
6411
  function useUserBoostsOnValidator({
6584
6412
  pubkey,
6585
6413
  ...args
6586
6414
  }) {
6587
- const { address: connectedAccount } = useBeraWallet26();
6588
- const publicClient = usePublicClient49();
6415
+ const { address: connectedAccount } = useBeraWallet25();
6416
+ const publicClient = usePublicClient48();
6589
6417
  const account = args.account ?? connectedAccount;
6590
6418
  const QUERY_KEY = account && pubkey ? ["useUserBoostsOnValidator", pubkey, account] : null;
6591
6419
  return useSWR(
@@ -6603,128 +6431,6 @@ function useUserBoostsOnValidator({
6603
6431
  );
6604
6432
  }
6605
6433
 
6606
- // src/hooks/validators/useUserClaimableIncentives.ts
6607
- import { useCallback as useCallback4, useMemo as useMemo14 } from "react";
6608
- import { useBeraWallet as useBeraWallet27 } from "@berachain/wagmi/hooks";
6609
-
6610
- // src/utils/formatIncentivesTokenMap.ts
6611
- function formatIncentivesTokenMap(allRewards) {
6612
- const tokenMap = /* @__PURE__ */ new Set();
6613
- for (const item of allRewards) {
6614
- if (Array.isArray(item.rewards)) {
6615
- for (const reward of item.rewards) {
6616
- if (reward.token) {
6617
- tokenMap.add(reward.token);
6618
- }
6619
- }
6620
- }
6621
- }
6622
- return tokenMap;
6623
- }
6624
-
6625
- // src/hooks/validators/useUserClaimableIncentives.ts
6626
- function useUserClaimableIncentives() {
6627
- const { address: account } = useBeraWallet27();
6628
- const REWARDS_QUERY_KEY = account ? ["useUserClaimableIncentives", account] : null;
6629
- const allRewardsResponse = useSWR(
6630
- REWARDS_QUERY_KEY,
6631
- async ([, account2]) => {
6632
- if (!account2) {
6633
- throw new BeraError({
6634
- message: "useUserClaimableIncentives needs a logged in account",
6635
- level: "error"
6636
- });
6637
- }
6638
- return await getUserClaimableIncentives({
6639
- account: account2
6640
- });
6641
- },
6642
- {
6643
- revalidateOnFocus: false,
6644
- revalidateOnReconnect: false,
6645
- revalidateIfStale: false,
6646
- refreshInterval: 18e4 /* SLOW */
6647
- }
6648
- );
6649
- const allRewards = allRewardsResponse?.data;
6650
- const tokenMap = useMemo14(() => {
6651
- if (!allRewards) {
6652
- return void 0;
6653
- }
6654
- if (!Array.isArray(allRewards)) {
6655
- BeraMonitoring.captureException(
6656
- new BeraError({
6657
- message: "Incorrect aggregated incentives data receieved.",
6658
- level: "error",
6659
- extra: {
6660
- allRewards,
6661
- account
6662
- }
6663
- })
6664
- );
6665
- return void 0;
6666
- }
6667
- return formatIncentivesTokenMap(allRewards);
6668
- }, [allRewards, account]);
6669
- const QUERY_KEY = account && allRewards ? ["useUserClaimableIncentives", account, allRewards] : null;
6670
- const swrResponse = useSWR(
6671
- QUERY_KEY,
6672
- async ([, account2, allRewards2]) => {
6673
- if (!account2) {
6674
- throw new InvalidArgumentError({
6675
- property: "account",
6676
- value: account2,
6677
- expected: "Address"
6678
- });
6679
- }
6680
- if (!allRewards2) {
6681
- return [];
6682
- }
6683
- if (!Array.isArray(allRewards2)) {
6684
- throw new InvalidArgumentError({
6685
- message: "Incorrect aggregated incentives data receieved to calculate proofs.",
6686
- property: "allRewards",
6687
- value: allRewards2,
6688
- expected: "Array",
6689
- level: "error"
6690
- });
6691
- }
6692
- const validatorsSet = new Set(allRewards2.map((item) => item.validator));
6693
- const validatorAddresses = Array.from(validatorsSet);
6694
- return await Promise.all(
6695
- validatorAddresses.map(async (validator) => {
6696
- const proofsData = await getRewardProofsByValidator({
6697
- account: account2,
6698
- validator,
6699
- page: 1,
6700
- perPage: 1e4
6701
- });
6702
- return {
6703
- ...proofsData,
6704
- validator
6705
- };
6706
- })
6707
- );
6708
- },
6709
- {
6710
- revalidateOnFocus: false,
6711
- revalidateOnReconnect: false,
6712
- revalidateIfStale: false,
6713
- refreshInterval: 18e4 /* SLOW */
6714
- }
6715
- );
6716
- const refresh = useCallback4(() => {
6717
- allRewardsResponse?.refresh();
6718
- swrResponse?.refresh();
6719
- }, [allRewardsResponse, swrResponse]);
6720
- return {
6721
- ...swrResponse,
6722
- isLoading: allRewardsResponse?.isLoading || swrResponse?.isLoading,
6723
- tokenMap,
6724
- refresh
6725
- };
6726
- }
6727
-
6728
6434
  // src/hooks/validators/useUserStakingPositions.ts
6729
6435
  function useUserStakingPositions({
6730
6436
  account,
@@ -6753,9 +6459,9 @@ import { keccak256 as keccak2562 } from "viem";
6753
6459
  import { beaconDepositAbi } from "@berachain/abis/pol/beaconDeposit";
6754
6460
  import { bgtAbi as bgtAbi2 } from "@berachain/abis/pol/bgt";
6755
6461
  import { beraChefAbi as beraChefAbi3 } from "@berachain/abis/pol/rewards/beraChef";
6756
- import { usePublicClient as usePublicClient50 } from "@berachain/wagmi/hooks";
6462
+ import { usePublicClient as usePublicClient49 } from "@berachain/wagmi/hooks";
6757
6463
  function useOnChainValidator({ pubkey }, options) {
6758
- const publicClient = usePublicClient50();
6464
+ const publicClient = usePublicClient49();
6759
6465
  const QUERY_KEY = pubkey ? ["useOnChainValidator", pubkey] : null;
6760
6466
  return useSWR(
6761
6467
  publicClient ? QUERY_KEY : null,
@@ -6838,30 +6544,10 @@ function useValidator({ pubkey }, options) {
6838
6544
  };
6839
6545
  }
6840
6546
 
6841
- // src/hooks/validators/useValidatorAnalytics.ts
6842
- function useValidatorAnalytics({
6843
- pubkey,
6844
- dayRange
6845
- }) {
6846
- const QUERY_KEY = pubkey && dayRange ? ["useValidatorAnalytics", pubkey, dayRange] : null;
6847
- return useSWR(
6848
- QUERY_KEY,
6849
- async ([, pubkey2, dayRange2]) => {
6850
- return await getValidatorAnalytics({
6851
- pubkey: pubkey2,
6852
- dayRange: dayRange2
6853
- });
6854
- },
6855
- {
6856
- refreshInterval: 18e4 /* SLOW */
6857
- }
6858
- );
6859
- }
6860
-
6861
6547
  // src/hooks/validators/useValidatorCommission.ts
6862
- import { usePublicClient as usePublicClient51 } from "@berachain/wagmi/hooks";
6548
+ import { usePublicClient as usePublicClient50 } from "@berachain/wagmi/hooks";
6863
6549
  function useValidatorCommission(pubKey, options) {
6864
- const publicClient = usePublicClient51();
6550
+ const publicClient = usePublicClient50();
6865
6551
  const QUERY_KEY = publicClient && pubKey ? ["useValidatorCommission", pubKey] : null;
6866
6552
  return swr_default(
6867
6553
  QUERY_KEY,
@@ -6946,9 +6632,9 @@ function useValidatorIncentiveDistribution({
6946
6632
  }
6947
6633
 
6948
6634
  // src/hooks/validators/useValidatorQueuedCommission.ts
6949
- import { usePublicClient as usePublicClient52 } from "@berachain/wagmi/hooks";
6635
+ import { usePublicClient as usePublicClient51 } from "@berachain/wagmi/hooks";
6950
6636
  function useValidatorQueuedCommission(pubKey, options) {
6951
- const publicClient = usePublicClient52();
6637
+ const publicClient = usePublicClient51();
6952
6638
  const QUERY_KEY = publicClient && pubKey ? ["useValidatorQueuedCommission", pubKey] : null;
6953
6639
  return useSWR(
6954
6640
  QUERY_KEY,
@@ -6966,9 +6652,9 @@ function useValidatorQueuedCommission(pubKey, options) {
6966
6652
  }
6967
6653
 
6968
6654
  // src/hooks/validators/useValidatorQueuedOperatorAddress.ts
6969
- import { usePublicClient as usePublicClient53 } from "@berachain/wagmi/hooks";
6655
+ import { usePublicClient as usePublicClient52 } from "@berachain/wagmi/hooks";
6970
6656
  function useValidatorQueuedOperatorAddress(pubKey, options) {
6971
- const publicClient = usePublicClient53();
6657
+ const publicClient = usePublicClient52();
6972
6658
  const QUERY_KEY = publicClient && pubKey ? ["useValidatorQueuedOperatorAddress", pubKey] : null;
6973
6659
  return useSWR(
6974
6660
  QUERY_KEY,
@@ -6985,9 +6671,9 @@ function useValidatorQueuedOperatorAddress(pubKey, options) {
6985
6671
  }
6986
6672
 
6987
6673
  // src/hooks/validators/useValidatorQueuedRewardAllocation.ts
6988
- import { usePublicClient as usePublicClient54 } from "@berachain/wagmi/hooks";
6674
+ import { usePublicClient as usePublicClient53 } from "@berachain/wagmi/hooks";
6989
6675
  function useValidatorQueuedRewardAllocation(pubKey, options) {
6990
- const publicClient = usePublicClient54();
6676
+ const publicClient = usePublicClient53();
6991
6677
  const QUERY_KEY = publicClient && pubKey ? ["useValidatorQueuedRewardAllocation", pubKey] : null;
6992
6678
  return useSWR(
6993
6679
  QUERY_KEY,
@@ -7004,9 +6690,9 @@ function useValidatorQueuedRewardAllocation(pubKey, options) {
7004
6690
  }
7005
6691
 
7006
6692
  // src/hooks/validators/useValidatorRewardAllocation.ts
7007
- import { usePublicClient as usePublicClient55 } from "@berachain/wagmi/hooks";
6693
+ import { usePublicClient as usePublicClient54 } from "@berachain/wagmi/hooks";
7008
6694
  function useValidatorRewardAllocation(pubKey, options) {
7009
- const publicClient = usePublicClient55();
6695
+ const publicClient = usePublicClient54();
7010
6696
  const QUERY_KEY = publicClient && pubKey ? ["useValidatorRewardAllocation", pubKey] : null;
7011
6697
  return useSWR(
7012
6698
  QUERY_KEY,
@@ -7024,6 +6710,8 @@ function useValidatorRewardAllocation(pubKey, options) {
7024
6710
  export {
7025
6711
  OracleMode,
7026
6712
  USE_AGGREGATORS_QUOTES_QUERY_KEY,
6713
+ fetchMultipleTokenInformation,
6714
+ isNativeFeeInsufficient,
7027
6715
  reducer,
7028
6716
  useAggregatorsQuotes,
7029
6717
  useAggregatorsRouterFeeBps,
@@ -7047,7 +6735,6 @@ export {
7047
6735
  useBeraCurrentPrice,
7048
6736
  useBexStatus,
7049
6737
  useBgtAprSimulation,
7050
- useBgtIncentiveDistributorPaused,
7051
6738
  useBgtUnstakedBalance,
7052
6739
  useBlockToTimestamp,
7053
6740
  useCappedGlobally,
@@ -7055,7 +6742,7 @@ export {
7055
6742
  useClaimableFees,
7056
6743
  useCollateralWeights,
7057
6744
  useCreatePool,
7058
- useEnsoSwapBundle,
6745
+ useCrossChainNativeFee,
7059
6746
  useEnsoUserTokensWithBalances,
7060
6747
  useGetConvertToAssets,
7061
6748
  useGetVerifiedAbi,
@@ -7104,7 +6791,7 @@ export {
7104
6791
  useRewardVaults,
7105
6792
  useRewardVaultsQueryKey,
7106
6793
  useSingleAggregatorQuote,
7107
- useStakedAPR,
6794
+ useStakedAPY,
7108
6795
  useStakedData,
7109
6796
  useStakedSnapshots,
7110
6797
  useStakingPoolBatch,
@@ -7119,12 +6806,10 @@ export {
7119
6806
  useTotalSupply,
7120
6807
  useUserActiveValidators,
7121
6808
  useUserBoostsOnValidator,
7122
- useUserClaimableIncentives,
7123
6809
  useUserStakingPositions,
7124
6810
  useUserVaultInfo,
7125
6811
  useUserVaults,
7126
6812
  useValidator,
7127
- useValidatorAnalytics,
7128
6813
  useValidatorCommission,
7129
6814
  useValidatorEstimatedBgtPerYear,
7130
6815
  useValidatorIncentiveDistribution,