@berachain/berajs 0.1.2 → 0.2.1

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 (448) hide show
  1. package/dist/{BeraError-D1HS_rbb.d.cts → BeraError-_mQdkanr.d.cts} +35 -10
  2. package/dist/{BeraError-D1HS_rbb.d.ts → BeraError-_mQdkanr.d.ts} +35 -10
  3. package/dist/HoneyConfigProvider-CK6mOKFH.d.ts +390 -0
  4. package/dist/HoneyConfigProvider-Ca3ouozs.d.cts +390 -0
  5. package/dist/{RequestError-D8AE6xnI.d.cts → RequestError-A8XJ6QR9.d.cts} +1 -1
  6. package/dist/{RequestError-m4jxyM7D.d.ts → RequestError-Dk97z8rm.d.ts} +1 -1
  7. package/dist/abi/exports.cjs +2 -0
  8. package/dist/abi/exports.cjs.map +1 -0
  9. package/dist/abi/{index.d.cts → exports.d.cts} +12369 -9122
  10. package/dist/abi/{index.d.ts → exports.d.ts} +12369 -9122
  11. package/dist/abi/exports.mjs +2 -0
  12. package/dist/abi/exports.mjs.map +1 -0
  13. package/dist/actions/exports.cjs +2 -0
  14. package/dist/actions/exports.cjs.map +1 -0
  15. package/dist/actions/{index.d.cts → exports.d.cts} +79 -107
  16. package/dist/actions/{index.d.ts → exports.d.ts} +79 -107
  17. package/dist/actions/exports.mjs +2 -0
  18. package/dist/actions/exports.mjs.map +1 -0
  19. package/dist/chunk-22J3YJDN.cjs +2 -0
  20. package/dist/chunk-22J3YJDN.cjs.map +1 -0
  21. package/dist/chunk-2LL3P5PN.mjs +2 -0
  22. package/dist/chunk-2LL3P5PN.mjs.map +1 -0
  23. package/dist/chunk-3YXSUBA5.mjs +2 -0
  24. package/dist/chunk-3YXSUBA5.mjs.map +1 -0
  25. package/dist/chunk-55L7STYD.mjs +2 -0
  26. package/dist/chunk-55L7STYD.mjs.map +1 -0
  27. package/dist/chunk-575OK77P.mjs +2 -0
  28. package/dist/chunk-575OK77P.mjs.map +1 -0
  29. package/dist/chunk-6LDOG5RL.cjs +2 -0
  30. package/dist/chunk-6LDOG5RL.cjs.map +1 -0
  31. package/dist/chunk-7LNBSOVV.cjs +2 -0
  32. package/dist/chunk-7LNBSOVV.cjs.map +1 -0
  33. package/dist/chunk-7SMWQ6SN.mjs +2 -0
  34. package/dist/chunk-7SMWQ6SN.mjs.map +1 -0
  35. package/dist/chunk-7WRTK7RJ.mjs +2 -0
  36. package/dist/chunk-7WRTK7RJ.mjs.map +1 -0
  37. package/dist/chunk-A4UDYSB6.mjs +4 -0
  38. package/dist/chunk-A4UDYSB6.mjs.map +1 -0
  39. package/dist/chunk-AX2YQQFQ.mjs +2 -0
  40. package/dist/chunk-AX2YQQFQ.mjs.map +1 -0
  41. package/dist/chunk-C3FHGFLK.mjs +2 -0
  42. package/dist/chunk-C3FHGFLK.mjs.map +1 -0
  43. package/dist/chunk-C6ZGUO4H.cjs +2 -0
  44. package/dist/chunk-C6ZGUO4H.cjs.map +1 -0
  45. package/dist/chunk-CYKCYPFR.cjs +2 -0
  46. package/dist/chunk-CYKCYPFR.cjs.map +1 -0
  47. package/dist/chunk-ECRMUMTA.mjs +2 -0
  48. package/dist/chunk-ECRMUMTA.mjs.map +1 -0
  49. package/dist/chunk-F4BKSBEM.mjs +2 -0
  50. package/dist/chunk-F4BKSBEM.mjs.map +1 -0
  51. package/dist/chunk-FCWDGE62.cjs +2 -0
  52. package/dist/chunk-FCWDGE62.cjs.map +1 -0
  53. package/dist/chunk-FL2N3XHK.cjs +2 -0
  54. package/dist/chunk-FL2N3XHK.cjs.map +1 -0
  55. package/dist/chunk-MUCEYO3E.cjs +4 -0
  56. package/dist/chunk-MUCEYO3E.cjs.map +1 -0
  57. package/dist/chunk-NAXAZJJY.mjs +2 -0
  58. package/dist/chunk-NAXAZJJY.mjs.map +1 -0
  59. package/dist/chunk-OGJMSGB2.mjs +2 -0
  60. package/dist/chunk-OGJMSGB2.mjs.map +1 -0
  61. package/dist/chunk-OIYXOKTT.cjs +2 -0
  62. package/dist/chunk-OIYXOKTT.cjs.map +1 -0
  63. package/dist/chunk-P2Q7CMUD.cjs +2 -0
  64. package/dist/chunk-P2Q7CMUD.cjs.map +1 -0
  65. package/dist/chunk-PKXAW6MO.cjs +2 -0
  66. package/dist/chunk-PKXAW6MO.cjs.map +1 -0
  67. package/dist/chunk-Q3SCM6WL.mjs +2 -0
  68. package/dist/chunk-Q3SCM6WL.mjs.map +1 -0
  69. package/dist/chunk-SWMJQOH6.cjs +2 -0
  70. package/dist/chunk-SWMJQOH6.cjs.map +1 -0
  71. package/dist/chunk-TEBJWAVU.mjs +2 -0
  72. package/dist/chunk-TEBJWAVU.mjs.map +1 -0
  73. package/dist/chunk-THATXCJK.mjs +2 -0
  74. package/dist/chunk-THATXCJK.mjs.map +1 -0
  75. package/dist/chunk-VP7XUOSI.cjs +2 -0
  76. package/dist/chunk-VP7XUOSI.cjs.map +1 -0
  77. package/dist/chunk-VXL2ZZ4X.cjs +2 -0
  78. package/dist/chunk-VXL2ZZ4X.cjs.map +1 -0
  79. package/dist/chunk-WRFDB3QJ.cjs +2 -0
  80. package/dist/chunk-WRFDB3QJ.cjs.map +1 -0
  81. package/dist/chunk-XNJLSA6P.cjs +2 -0
  82. package/dist/chunk-XNJLSA6P.cjs.map +1 -0
  83. package/dist/chunk-YXLFOEZN.mjs +2 -0
  84. package/dist/chunk-YXLFOEZN.mjs.map +1 -0
  85. package/dist/chunk-YZV5LKIP.cjs +2 -0
  86. package/dist/chunk-YZV5LKIP.cjs.map +1 -0
  87. package/dist/contexts/exports.cjs +2 -0
  88. package/dist/contexts/exports.cjs.map +1 -0
  89. package/dist/contexts/{index.d.cts → exports.d.cts} +10 -27
  90. package/dist/contexts/{index.d.ts → exports.d.ts} +10 -27
  91. package/dist/contexts/exports.mjs +2 -0
  92. package/dist/contexts/exports.mjs.map +1 -0
  93. package/dist/{defaultFlags-V-tJs2K8.d.cts → defaultFlags-d0kPbT0i.d.cts} +1 -1
  94. package/dist/{defaultFlags-V-tJs2K8.d.ts → defaultFlags-d0kPbT0i.d.ts} +1 -1
  95. package/dist/dex-C_BB0b0O.d.cts +37 -0
  96. package/dist/dex-C_BB0b0O.d.ts +37 -0
  97. package/dist/enum/exports.cjs +2 -0
  98. package/dist/enum/exports.cjs.map +1 -0
  99. package/dist/enum/exports.d.cts +23 -0
  100. package/dist/enum/exports.d.ts +23 -0
  101. package/dist/enum/exports.mjs +2 -0
  102. package/dist/enum/exports.mjs.map +1 -0
  103. package/dist/errors/exports.cjs +2 -0
  104. package/dist/errors/exports.cjs.map +1 -0
  105. package/dist/errors/exports.d.cts +408 -0
  106. package/dist/errors/exports.d.ts +408 -0
  107. package/dist/errors/exports.mjs +2 -0
  108. package/dist/{getValidatorQueuedOperatorAddress-Ne2zoiiV.d.ts → getValidatorQueuedOperatorAddress-Dstyaomr.d.cts} +125 -15
  109. package/dist/{getValidatorQueuedOperatorAddress-9xY2RUGe.d.cts → getValidatorQueuedOperatorAddress-RW4OMcD1.d.ts} +125 -15
  110. package/dist/global.d-CN6l2b9E.d.cts +473 -0
  111. package/dist/global.d-wYu8G8IQ.d.ts +473 -0
  112. package/dist/honey-CYm0RWf4.d.cts +14 -0
  113. package/dist/honey-CYm0RWf4.d.ts +14 -0
  114. package/dist/hooks/exports.cjs +4 -0
  115. package/dist/hooks/exports.cjs.map +1 -0
  116. package/dist/hooks/{index.d.cts → exports.d.cts} +218 -176
  117. package/dist/hooks/{index.d.ts → exports.d.ts} +218 -176
  118. package/dist/hooks/exports.mjs +4 -0
  119. package/dist/hooks/exports.mjs.map +1 -0
  120. package/dist/{txnEnum-BQKDfaeH.d.cts → txnEnum-BlBYhNRl.d.cts} +75 -1
  121. package/dist/{txnEnum-BQKDfaeH.d.ts → txnEnum-BlBYhNRl.d.ts} +75 -1
  122. package/dist/types/exports.cjs +1 -0
  123. package/dist/types/exports.cjs.map +1 -0
  124. package/dist/types/exports.d.cts +57 -0
  125. package/dist/types/exports.d.ts +57 -0
  126. package/dist/types/exports.mjs +1 -0
  127. package/dist/{useHoneySwapState-C-9BV4VB.d.cts → useHoneySwapState-B-vmIP1b.d.cts} +1 -1
  128. package/dist/{useHoneySwapState-CUY5Sm1b.d.ts → useHoneySwapState-D1DKG_Of.d.ts} +1 -1
  129. package/dist/utils/exports.cjs +2 -0
  130. package/dist/utils/exports.cjs.map +1 -0
  131. package/dist/utils/{index.d.cts → exports.d.cts} +83 -20
  132. package/dist/utils/{index.d.ts → exports.d.ts} +83 -20
  133. package/dist/utils/exports.mjs +2 -0
  134. package/dist/utils/exports.mjs.map +1 -0
  135. package/package.json +19 -20
  136. package/src/abi/{index.ts → exports.ts} +3 -0
  137. package/src/abi/pol/LSTStakerVault.ts +2032 -0
  138. package/src/abi/utils/openChainErrors.ts +71 -30
  139. package/src/abi/utils/thirdwebMinimalAccount.ts +616 -0
  140. package/src/actions/clients/BeraApolloClient.ts +8 -6
  141. package/src/actions/dex/__tests__/aggregators.unit.test.ts +2 -5
  142. package/src/actions/dex/aggregators/base.ts +74 -16
  143. package/src/actions/dex/aggregators/bex.ts +54 -74
  144. package/src/actions/dex/aggregators/bgt.ts +31 -8
  145. package/src/actions/dex/aggregators/{enso.ts → enso/enso.ts} +18 -14
  146. package/src/actions/dex/aggregators/enso/ensoErc4626.debug.test.ts +37 -0
  147. package/src/actions/dex/aggregators/enso/ensoErc4626.ts +176 -0
  148. package/src/actions/dex/aggregators/erc4626.ts +122 -0
  149. package/src/actions/dex/aggregators/fly.ts +59 -53
  150. package/src/actions/dex/aggregators/haiku.ts +52 -54
  151. package/src/actions/dex/aggregators/honey.ts +54 -45
  152. package/src/actions/dex/aggregators/kyberswap.ts +41 -39
  153. package/src/actions/dex/aggregators/oogabooga.ts +47 -46
  154. package/src/actions/dex/aggregators/openOcean.ts +51 -46
  155. package/src/actions/dex/aggregators/wbera.ts +54 -42
  156. package/src/actions/dex/b-sdk.ts +5 -2
  157. package/src/actions/dex/getIsTokenExploited.ts +2 -2
  158. package/src/actions/enso/{zap.ts → getEnsoSwapBundle.ts} +4 -5
  159. package/src/actions/enso/getEnsoUserTokensWithBalances.debug.test.ts +73 -0
  160. package/src/actions/enso/{getEnsoUserToken.ts → getEnsoUserTokensWithBalances.ts} +42 -30
  161. package/src/actions/enso/util.ts +1 -1
  162. package/src/actions/{index.ts → exports.ts} +5 -0
  163. package/src/actions/governance/__tests__/checkProposalField.unit.test.ts +1 -1
  164. package/src/actions/governance/__tests__/getQuorum.integration.test.ts +1 -1
  165. package/src/actions/governance/checkProposalField.ts +1 -1
  166. package/src/actions/governance/computeActualStatus.ts +1 -1
  167. package/src/actions/governance/getBodyErrors.ts +1 -1
  168. package/src/actions/governance/getDecodedFunctionData.ts +1 -4
  169. package/src/actions/governance/getProposalDetails.ts +2 -2
  170. package/src/actions/governance/getProposalFromTx.ts +1 -2
  171. package/src/actions/governance/getProposalParams.ts +7 -8
  172. package/src/actions/governance/getQuorum.ts +1 -2
  173. package/src/actions/honey/getCollateralWeights.ts +1 -1
  174. package/src/actions/honey/getHoneyCollaterals.ts +1 -0
  175. package/src/actions/honey/getHoneyVaultsBalance.ts +51 -55
  176. package/src/actions/honey/getSwapPayload.ts +37 -35
  177. package/src/actions/honey/tests/pyth.integration.test.ts +0 -1
  178. package/src/actions/pol/__tests__/getAllValidators.integration.test.ts +1 -1
  179. package/src/actions/pol/getEarnedStakedBeraVault.ts +31 -0
  180. package/src/actions/pol/getGlobalData.ts +14 -13
  181. package/src/actions/pol/getLSTStakeConfig.ts +67 -0
  182. package/src/actions/pol/getMarkets.ts +1 -1
  183. package/src/actions/pol/getRewardProofsByValidator.ts +1 -1
  184. package/src/actions/pol/getRewardVaultIncentives.ts +3 -5
  185. package/src/actions/pol/getRewardVaults.ts +2 -3
  186. package/src/actions/pol/getSWBeraVaultMetadata.ts +7 -5
  187. package/src/actions/pol/getSWBeraWithdrawal.ts +41 -27
  188. package/src/actions/pol/getStakeWithdrawalCooldown.ts +5 -7
  189. package/src/actions/pol/getStakingDailyAssets.ts +24 -0
  190. package/src/actions/pol/getStakingTokenInformation.ts +3 -4
  191. package/src/actions/pol/getTotalStakedAmount.ts +47 -0
  192. package/src/actions/pol/getUserClaimableIncentives.ts +1 -1
  193. package/src/actions/pol/getUserVaults.ts +8 -6
  194. package/src/actions/pol/getUserVaultsBalance.ts +4 -16
  195. package/src/actions/prices/getTokenCurrentPrices.ts +8 -3
  196. package/src/actions/tokens/getAllowances.ts +68 -41
  197. package/src/actions/tokens/getTokenInformation.ts +4 -1
  198. package/src/actions/tokens/getTokens.ts +1 -1
  199. package/src/actions/tokens/getUnderlyingToken.ts +53 -0
  200. package/src/actions/tokens/getWalletBalances.integration.test.ts +53 -14
  201. package/src/actions/tokens/getWalletBalances.ts +69 -43
  202. package/src/actions/transactions/beraWriteContract.integration.test.ts +18 -6
  203. package/src/actions/transactions/beraWriteContract.ts +3 -3
  204. package/src/actions/validators/getUserActiveValidators.ts +2 -3
  205. package/src/actions/validators/getUserBoostsOnValidator.ts +2 -3
  206. package/src/contexts/BeraFlags/defaultFlags.ts +4 -0
  207. package/src/contexts/SwrFallback.tsx +13 -3
  208. package/src/contexts/TokensProvider.tsx +35 -8
  209. package/src/contexts/block-time-provider.tsx +1 -1
  210. package/src/contexts/{index.ts → exports.ts} +0 -1
  211. package/src/data/contracts.ts +17 -2
  212. package/src/enum/contracts.ts +13 -0
  213. package/src/enum/dex.ts +29 -0
  214. package/src/enum/{index.ts → exports.ts} +3 -0
  215. package/src/enum/governance.ts +61 -0
  216. package/src/enum/honey.ts +12 -0
  217. package/src/enum/txnEnum.ts +1 -0
  218. package/src/errors/BeraError.ts +61 -13
  219. package/src/errors/BeraMonitoring.ts +66 -0
  220. package/src/errors/BeraTracing.ts +79 -0
  221. package/src/errors/BeraTracing.unit.test.ts +198 -0
  222. package/src/errors/RequestError.ts +29 -3
  223. package/src/errors/assert.ts +4 -2
  224. package/src/errors/assert.unit.test.ts +6 -2
  225. package/src/errors/errorMap.ts +19 -8
  226. package/src/errors/{index.ts → exports.ts} +7 -0
  227. package/src/errors/getErrorMessage.ts +67 -9
  228. package/src/errors/getRevertReason.integration.test.ts +18 -6
  229. package/src/errors/getRevertReason.ts +41 -2
  230. package/src/errors/initBeraError.ts +52 -7
  231. package/src/errors/parseViemError.ts +114 -27
  232. package/src/errors/severity.ts +12 -0
  233. package/src/hooks/bend/useGetConvertToAssets.ts +3 -2
  234. package/src/hooks/dex/useAggregatorsQuotes.ts +126 -365
  235. package/src/hooks/dex/useAllUserPools.ts +1 -1
  236. package/src/hooks/dex/useApiPool.ts +1 -1
  237. package/src/hooks/dex/useCreatePool.ts +6 -5
  238. package/src/hooks/dex/useExploitedTokens.ts +1 -1
  239. package/src/hooks/dex/useLiquidityMismatch.ts +2 -5
  240. package/src/hooks/dex/useLpPosition.ts +21 -20
  241. package/src/hooks/dex/useMultipleTokenApprovalsWithSlippage.ts +40 -29
  242. package/src/hooks/dex/usePollPoolCreationRelayerApproval.ts +1 -1
  243. package/src/hooks/dex/usePoolEvents.ts +1 -1
  244. package/src/hooks/dex/usePools.ts +1 -1
  245. package/src/hooks/dex/usePriceImpact.ts +40 -0
  246. package/src/hooks/dex/useSingleAggregatorQuote.ts +350 -0
  247. package/src/hooks/enso/useBendZapSupply.ts +216 -0
  248. package/src/hooks/enso/useEnsoSwapBundle.ts +107 -0
  249. package/src/hooks/enso/useEnsoUserTokensWithBalances.ts +43 -0
  250. package/src/hooks/enso/useZapStakeBera.ts +113 -0
  251. package/src/hooks/{index.ts → exports.ts} +17 -10
  252. package/src/hooks/governance/useCreateProposal.ts +8 -8
  253. package/src/hooks/governance/usePollAllProposals.ts +1 -1
  254. package/src/hooks/governance/usePollProposal.ts +1 -1
  255. package/src/hooks/governance/usePollProposalThreshold.ts +1 -1
  256. package/src/hooks/governance/usePollUserDelegates.ts +1 -1
  257. package/src/hooks/governance/useProposalState.ts +2 -2
  258. package/src/hooks/honey/useCappedGlobally.ts +2 -1
  259. package/src/hooks/honey/useCappedRelatively.ts +1 -1
  260. package/src/hooks/honey/useCollateralWeights.ts +2 -1
  261. package/src/hooks/honey/useHoneyAlerts.ts +11 -11
  262. package/src/hooks/honey/useHoneyBalances.ts +7 -3
  263. package/src/hooks/honey/useHoneyGlobalData.ts +2 -1
  264. package/src/hooks/honey/useHoneySwapState.ts +2 -1
  265. package/src/hooks/honey/useHoneyVaultsBalance.ts +1 -1
  266. package/src/hooks/honey/useIsBadCollateralAsset.ts +2 -1
  267. package/src/hooks/honey/useIsBasketModeEnabled.ts +1 -1
  268. package/src/hooks/honey/usePythLatestPrices.ts +1 -1
  269. package/src/hooks/pol/useOnChainRewardVault.ts +3 -2
  270. package/src/hooks/pol/usePollGlobalData.ts +1 -1
  271. package/src/hooks/pol/usePollMarkets.ts +1 -1
  272. package/src/hooks/pol/useQueuedBeraUnlock.ts +17 -15
  273. package/src/hooks/pol/useRewardTokenToBeraRate.ts +6 -3
  274. package/src/hooks/pol/useRewardVault.ts +1 -1
  275. package/src/hooks/pol/useRewardVaults.ts +1 -1
  276. package/src/hooks/pol/useSWBeraVaultMetadata.ts +35 -0
  277. package/src/hooks/pol/useStakedAPR.ts +38 -0
  278. package/src/hooks/pol/useStakedData.ts +117 -0
  279. package/src/hooks/pol/useStakedSnapshots.ts +52 -0
  280. package/src/hooks/pol/useTotalStakedAmount.ts +30 -0
  281. package/src/hooks/pol/useUserVaultInfo.ts +1 -1
  282. package/src/hooks/pol/useVaultValidators.ts +1 -1
  283. package/src/hooks/tokens/useMultipleTokenInformation.ts +15 -6
  284. package/src/hooks/tokens/usePollAllowances.ts +15 -19
  285. package/src/hooks/tokens/usePollBalance.ts +8 -4
  286. package/src/hooks/tokens/usePollWalletBalances.ts +14 -11
  287. package/src/hooks/tokens/useStakingTokenInformation.ts +2 -1
  288. package/src/hooks/tokens/useTokenCurrentPrice.ts +4 -2
  289. package/src/hooks/tokens/useTokenCurrentPrices.ts +92 -13
  290. package/src/hooks/tokens/useTokenInformation.ts +11 -6
  291. package/src/hooks/tokens/useTokenPrice.ts +21 -0
  292. package/src/hooks/tokens/useTokenPrices.ts +133 -0
  293. package/src/hooks/tokens/useTokens.ts +1 -0
  294. package/src/hooks/tokens/useUnderlyingAsset.ts +23 -0
  295. package/src/hooks/useContractWrite/useBeraContractWrite.ts +2 -1
  296. package/src/hooks/validators/useAllValidators.ts +1 -1
  297. package/src/hooks/validators/useApiValidator.ts +1 -1
  298. package/src/hooks/validators/useDailyValidatorBlockStats.ts +1 -1
  299. package/src/hooks/validators/useManagedValidatorByAccount.ts +1 -1
  300. package/src/hooks/validators/useManagedValidatorRole.ts +1 -1
  301. package/src/hooks/validators/useOnChainValidator.ts +1 -1
  302. package/src/hooks/validators/useStakingPoolBatch.ts +1 -1
  303. package/src/hooks/validators/useUserActiveValidators.ts +1 -1
  304. package/src/hooks/validators/useUserBoostsOnValidator.ts +1 -1
  305. package/src/hooks/validators/useUserClaimableIncentives.ts +8 -8
  306. package/src/hooks/validators/useValidator.ts +1 -1
  307. package/src/hooks/validators/useValidatorAnalytics.ts +1 -1
  308. package/src/hooks/validators/useValidatorCommission.ts +1 -1
  309. package/src/hooks/validators/useValidatorQueuedCommission.ts +1 -1
  310. package/src/hooks/validators/useValidatorQueuedOperatorAddress.ts +1 -1
  311. package/src/hooks/validators/useValidatorQueuedRewardAllocation.ts +1 -1
  312. package/src/hooks/validators/useValidatorRewardAllocation.ts +1 -1
  313. package/src/types/{dex.ts → dex.d.ts} +96 -67
  314. package/src/types/{enso.ts → enso.d.ts} +1 -1
  315. package/src/types/exports.ts +8 -0
  316. package/src/types/{global.ts → global.d.ts} +1 -30
  317. package/src/types/{governance.ts → governance.d.ts} +2 -64
  318. package/src/types/{honeySwap.ts → honeySwap.d.ts} +1 -13
  319. package/src/types/{pol.ts → pol.d.ts} +12 -1
  320. package/src/types/staking.d.ts +22 -0
  321. package/src/utils/createEmitter.ts +122 -0
  322. package/src/utils/createEmitter.unit.test.ts +149 -0
  323. package/src/utils/{index.ts → exports.ts} +3 -2
  324. package/src/utils/filter.ts +34 -0
  325. package/src/utils/formatNumber.ts +1 -1
  326. package/src/utils/formatNumber.unit.test.ts +2 -1
  327. package/src/utils/formatTokenList.ts +4 -10
  328. package/src/utils/getHoneySwapMessage.test.ts +1 -2
  329. package/src/utils/getServerSideClient.ts +4 -5
  330. package/src/utils/isDifferenceExceedingThreshold.ts +1 -1
  331. package/src/utils/layerZeroScan.ts +122 -0
  332. package/src/utils/math.ts +1 -1
  333. package/src/utils/parseWhiskToken.ts +15 -0
  334. package/src/utils/poolNamings.ts +1 -1
  335. package/src/utils/tokens.ts +23 -7
  336. package/dist/HoneyConfigProvider-6PXZJMSU.d.cts +0 -562
  337. package/dist/HoneyConfigProvider-CwDFrt02.d.ts +0 -562
  338. package/dist/abi/index.cjs +0 -2
  339. package/dist/abi/index.cjs.map +0 -1
  340. package/dist/abi/index.mjs +0 -2
  341. package/dist/actions/index.cjs +0 -2
  342. package/dist/actions/index.cjs.map +0 -1
  343. package/dist/actions/index.mjs +0 -2
  344. package/dist/aggregatorsRouter-Cny4B_MB.d.cts +0 -593
  345. package/dist/aggregatorsRouter-Cny4B_MB.d.ts +0 -593
  346. package/dist/chunk-22MQVFHP.cjs +0 -2
  347. package/dist/chunk-22MQVFHP.cjs.map +0 -1
  348. package/dist/chunk-3TKSVFZ3.mjs +0 -2
  349. package/dist/chunk-3TKSVFZ3.mjs.map +0 -1
  350. package/dist/chunk-6VF3RF53.cjs +0 -3
  351. package/dist/chunk-6VF3RF53.cjs.map +0 -1
  352. package/dist/chunk-6W22TFYA.mjs +0 -2
  353. package/dist/chunk-6W22TFYA.mjs.map +0 -1
  354. package/dist/chunk-AMRJ4B36.mjs +0 -2
  355. package/dist/chunk-AMRJ4B36.mjs.map +0 -1
  356. package/dist/chunk-DS2ZDVKU.mjs +0 -2
  357. package/dist/chunk-DS2ZDVKU.mjs.map +0 -1
  358. package/dist/chunk-ED43NYSE.cjs +0 -2
  359. package/dist/chunk-ED43NYSE.cjs.map +0 -1
  360. package/dist/chunk-EU4WFADK.cjs +0 -2
  361. package/dist/chunk-EU4WFADK.cjs.map +0 -1
  362. package/dist/chunk-HCTFDGXL.mjs +0 -2
  363. package/dist/chunk-HCTFDGXL.mjs.map +0 -1
  364. package/dist/chunk-IOSYBHKU.mjs +0 -2
  365. package/dist/chunk-IOSYBHKU.mjs.map +0 -1
  366. package/dist/chunk-JMKLDDKY.cjs +0 -2
  367. package/dist/chunk-JMKLDDKY.cjs.map +0 -1
  368. package/dist/chunk-KMKUXP2S.mjs +0 -3
  369. package/dist/chunk-KMKUXP2S.mjs.map +0 -1
  370. package/dist/chunk-OJXJ6CZ4.mjs +0 -4
  371. package/dist/chunk-OJXJ6CZ4.mjs.map +0 -1
  372. package/dist/chunk-PHIOKO3A.mjs +0 -2
  373. package/dist/chunk-PHIOKO3A.mjs.map +0 -1
  374. package/dist/chunk-QCK474XD.cjs +0 -2
  375. package/dist/chunk-QCK474XD.cjs.map +0 -1
  376. package/dist/chunk-REDXXUK7.cjs +0 -2
  377. package/dist/chunk-REDXXUK7.cjs.map +0 -1
  378. package/dist/chunk-S74ZMG2G.cjs +0 -2
  379. package/dist/chunk-S74ZMG2G.cjs.map +0 -1
  380. package/dist/chunk-TOAXF4YW.cjs +0 -2
  381. package/dist/chunk-TOAXF4YW.cjs.map +0 -1
  382. package/dist/chunk-UZ5CB33M.cjs +0 -2
  383. package/dist/chunk-UZ5CB33M.cjs.map +0 -1
  384. package/dist/chunk-VYWYJR63.mjs +0 -2
  385. package/dist/chunk-VYWYJR63.mjs.map +0 -1
  386. package/dist/chunk-XFPTQMAK.cjs +0 -4
  387. package/dist/chunk-XFPTQMAK.cjs.map +0 -1
  388. package/dist/chunk-YK4NINF5.mjs +0 -2
  389. package/dist/chunk-YK4NINF5.mjs.map +0 -1
  390. package/dist/contexts/index.cjs +0 -2
  391. package/dist/contexts/index.cjs.map +0 -1
  392. package/dist/contexts/index.mjs +0 -2
  393. package/dist/contexts/index.mjs.map +0 -1
  394. package/dist/enum/index.cjs +0 -2
  395. package/dist/enum/index.cjs.map +0 -1
  396. package/dist/enum/index.d.cts +0 -31
  397. package/dist/enum/index.d.ts +0 -31
  398. package/dist/enum/index.mjs +0 -2
  399. package/dist/enum/index.mjs.map +0 -1
  400. package/dist/errors/index.cjs +0 -2
  401. package/dist/errors/index.cjs.map +0 -1
  402. package/dist/errors/index.d.cts +0 -204
  403. package/dist/errors/index.d.ts +0 -204
  404. package/dist/errors/index.mjs +0 -2
  405. package/dist/errors/index.mjs.map +0 -1
  406. package/dist/hooks/index.cjs +0 -4
  407. package/dist/hooks/index.cjs.map +0 -1
  408. package/dist/hooks/index.mjs +0 -4
  409. package/dist/hooks/index.mjs.map +0 -1
  410. package/dist/staking-F9Nx9TKD.d.ts +0 -246
  411. package/dist/staking-f4BpYH7l.d.cts +0 -246
  412. package/dist/types/index.cjs +0 -2
  413. package/dist/types/index.cjs.map +0 -1
  414. package/dist/types/index.d.cts +0 -56
  415. package/dist/types/index.d.ts +0 -56
  416. package/dist/types/index.mjs +0 -2
  417. package/dist/types/index.mjs.map +0 -1
  418. package/dist/utils/index.cjs +0 -2
  419. package/dist/utils/index.cjs.map +0 -1
  420. package/dist/utils/index.mjs +0 -2
  421. package/dist/utils/index.mjs.map +0 -1
  422. package/src/actions/dex/getTransactionCount.ts +0 -29
  423. package/src/actions/enso/bend.ts +0 -143
  424. package/src/actions/enso/getEnsoUserToken.debug.test.ts +0 -57
  425. package/src/contexts/berajsProvider/context.tsx +0 -49
  426. package/src/contexts/berajsProvider/index.ts +0 -2
  427. package/src/contexts/berajsProvider/useBeraJs.ts +0 -18
  428. package/src/hooks/dex/usePollVaultIsPaused.ts +0 -30
  429. package/src/hooks/enso/useBendTransactionRequests.ts +0 -247
  430. package/src/hooks/enso/useEnsoZap.ts +0 -166
  431. package/src/hooks/enso/useZapTransactionRequests.ts +0 -81
  432. package/src/hooks/pol/useEarnedStakedBeraVault.ts +0 -59
  433. package/src/hooks/pol/useStakedBeraSnapshots.ts +0 -27
  434. package/src/hooks/transactions/TransactionStoreContext.tsx +0 -59
  435. package/src/hooks/transactions/transactionStore.ts +0 -275
  436. package/src/hooks/transactions/transactionStore.unit.test.ts +0 -508
  437. package/src/hooks/transactions/useAddRecentTransaction.ts +0 -29
  438. package/src/hooks/transactions/useRecentTransactions.ts +0 -27
  439. package/src/hooks/validators/validatorRoleManager.ts +0 -0
  440. package/src/types/index.ts +0 -8
  441. package/src/types/staking.ts +0 -7
  442. package/src/utils/formatAggregatorsQuotes.ts +0 -57
  443. package/src/utils/formatAggregatorsQuotes.unit.test.ts +0 -191
  444. package/src/utils/sentryBeforeSend.ts +0 -52
  445. /package/dist/{abi/index.mjs.map → errors/exports.mjs.map} +0 -0
  446. /package/dist/{actions/index.mjs.map → types/exports.mjs.map} +0 -0
  447. /package/src/actions/dex/{__tests__ → aggregators}/haiku.integration.test.ts +0 -0
  448. /package/src/types/{bribe-boost.ts → bribe-boost.d.ts} +0 -0
@@ -1,8 +1,9 @@
1
1
  import { Address, PublicClient, Hex } from 'viem';
2
- import { GqlPoolType, GlobalDataQuery, ApiVaultFragment, GetVaultsQueryVariables, GqlChain, GqlVaultSnapshotDataRange, GetSWberaVaultSnapshotsQuery, GetVaultHistoryQueryVariables, GetVaultHistoryQuery, ApiValidatorFragment } from '@berachain/graphql/pol/api';
3
- import { h as TokenBalance, a as Token, P as PythLatestUpdates } from './HoneyConfigProvider-6PXZJMSU.cjs';
4
- import { P as ProtocolMetadata } from './staking-f4BpYH7l.cjs';
5
- import { GetPublicClientReturnType } from '@wagmi/core';
2
+ import { BeraConfig, ChainId } from '@berachain/config/internal';
3
+ import { I as IAggregatorArgs, g as IRawAggregatorQuote, b as Token, d as HoneyConfigContextReturn, B as BalanceToken, P as PythLatestUpdates } from './HoneyConfigProvider-CK6mOKFH.js';
4
+ import { A as Aggregators } from './dex-C_BB0b0O.js';
5
+ import { GqlPoolType, GlobalDataQuery, ApiVaultFragment, GetVaultsQueryVariables, GqlChain, GetVaultHistoryQueryVariables, GetVaultHistoryQuery, ApiValidatorFragment } from '@berachain/graphql/pol/api';
6
+ import { P as ProtocolMetadata } from './global.d-wYu8G8IQ.js';
6
7
 
7
8
  interface GetConvertToAssetsProps {
8
9
  sharesAmount: bigint;
@@ -14,6 +15,90 @@ declare function getConvertToAssets({ sharesAmount, vaultAddress, publicClient,
14
15
  formatted: string;
15
16
  }>;
16
17
 
18
+ declare abstract class BaseAggregator {
19
+ abstract name: Aggregators;
20
+ /**
21
+ * Supported chains for the aggregator.
22
+ * If null, the aggregator is supported on all chains.
23
+ */
24
+ abstract supportedChains: number[] | null;
25
+ static PATH_NOT_FOUND_REASON: string;
26
+ needsAccountForQuote: boolean;
27
+ notFoundMessages: string[];
28
+ config: BeraConfig;
29
+ chainId: ChainId;
30
+ constructor(args?: BeraJS.BaseFunctionArgs);
31
+ /**
32
+ * Identifies the url of the last sent request. Might not have all query params.
33
+ * Mainly used for error reporting.
34
+ */
35
+ url: string;
36
+ abstract readonly type: "rest" | "graphql" | "rpc";
37
+ abstract getQuote(args: IAggregatorArgs): Promise<IRawAggregatorQuote | undefined> | Promise<IRawAggregatorQuote | undefined>;
38
+ /**
39
+ * return wbera for native tokens to accomodate the aggregator's router logic
40
+ */
41
+ protected parseAddresses(tokenIn: string, tokenOut: string): {
42
+ tokenInAddress: Address;
43
+ tokenOutAddress: Address;
44
+ isTokenInNative: boolean;
45
+ isTokenOutNative: boolean;
46
+ };
47
+ /**
48
+ * Calculate input amount after fees.
49
+ *
50
+ * @returns Amount in wad format
51
+ */
52
+ protected getAmountAfterFees(amount: string, aggregatorsFeeBps?: number): string;
53
+ /**
54
+ * Formats input data for aggregator swaps
55
+ */
56
+ protected getInputData({ tokenIn, amountIn, isNative, isPermit2Approval, permit2SpenderAddress, }: {
57
+ tokenIn: Address;
58
+ amountIn: string;
59
+ isNative: boolean;
60
+ isPermit2Approval?: boolean;
61
+ permit2SpenderAddress?: Address | null;
62
+ }): {
63
+ tokenIn: `0x${string}`;
64
+ amountIn: bigint;
65
+ isNative: boolean;
66
+ isPermit2Approval: boolean;
67
+ permit2SpenderAddress: `0x${string}`;
68
+ };
69
+ /**
70
+ * Calculate min amount out
71
+ */
72
+ protected getMinAmountOut(amountOut: string, slippage: number): bigint;
73
+ protected parseAllowanceRequirements({ tokenIn, rawAmount, spender, }: {
74
+ tokenIn: Token;
75
+ rawAmount: string;
76
+ spender: Address;
77
+ }): {
78
+ token: Token;
79
+ amount: {
80
+ raw: string;
81
+ formatted: string;
82
+ };
83
+ spender: `0x${string}`;
84
+ }[];
85
+ /**
86
+ * Check if chain is supported
87
+ */
88
+ checkChainSupport({ tokenIn, tokenOut, }: {
89
+ tokenIn: Token;
90
+ tokenOut: Token;
91
+ honeyNativeState?: Pick<HoneyConfigContextReturn, "collateralList">;
92
+ underlyingToken?: Token | null;
93
+ }): boolean;
94
+ assertChainSupport({ tokenIn, tokenOut, underlyingToken, }: {
95
+ tokenIn: Token;
96
+ tokenOut: Token;
97
+ underlyingToken?: Token | null;
98
+ }): void;
99
+ protected fetch(url: string | URL, options?: RequestInit): Promise<Response>;
100
+ }
101
+
17
102
  interface PoolStatus {
18
103
  isPoolInRecoveryMode: boolean;
19
104
  isPoolPaused: boolean;
@@ -67,7 +152,7 @@ interface GetVaultsBalancesArgs extends BeraJS.BaseFunctionArgs {
67
152
  collateralList: Token[];
68
153
  honeyFactoryAddress?: Address;
69
154
  }
70
- interface GetHoneyVaultsBalanceResponse extends TokenBalance {
155
+ interface GetHoneyVaultsBalanceResponse extends BalanceToken {
71
156
  vault: Address;
72
157
  }
73
158
  declare function getHoneyVaultsBalance({ client, collateralList, honeyFactoryAddress, ...args }: GetVaultsBalancesArgs): Promise<GetHoneyVaultsBalanceResponse[]>;
@@ -269,24 +354,44 @@ interface GetGaugeData {
269
354
  }
270
355
  declare function getRewardVaults({ filter, publicClient, ...args }?: {
271
356
  filter?: GetVaultsQueryVariables;
272
- publicClient?: GetPublicClientReturnType;
357
+ publicClient?: PublicClient | undefined;
273
358
  } & BeraJS.BaseFunctionArgs): Promise<GetGaugeData>;
274
359
 
275
- type GetStakedBeraSnapshotsArgs = {
276
- chain?: GqlChain;
277
- range?: GqlVaultSnapshotDataRange;
278
- } & BeraJS.BaseFunctionArgs;
360
+ interface VaultMetadata {
361
+ current: {
362
+ exchangeRate: string;
363
+ totalSupply: string;
364
+ totalAssets: string;
365
+ tvl: string;
366
+ };
367
+ previous: {
368
+ exchangeRate: string;
369
+ totalSupply: string;
370
+ totalAssets: string;
371
+ tvl: string;
372
+ };
373
+ totalWBeraIssued: string;
374
+ lockPeriod?: number;
375
+ totalBuyBacks: number;
376
+ totalBuyBacksInLast24Hours: number;
377
+ }
279
378
  /**
280
379
  *
380
+ * @param address - The address of the vault
281
381
  * @throws {Error} If the vault is not found
282
382
  * @returns
283
383
  */
284
- declare function getStakedBeraSnapshots({ chain, range, ...args }?: GetStakedBeraSnapshotsArgs): Promise<GetSWberaVaultSnapshotsQuery["polGetSWberaVaultSnapshots"]>;
384
+ declare function getSWBeraVaultMetadata({ address, publicClient, blockTime, ...args }: {
385
+ address: Address;
386
+ publicClient?: PublicClient;
387
+ blockTime: number;
388
+ } & BeraJS.BaseFunctionArgs): Promise<VaultMetadata>;
285
389
 
286
390
  /**
287
391
  * Interface representing a staked BERA withdrawal request
288
392
  */
289
393
  interface StakedBeraWithdrawal {
394
+ receiptTokenAddress: Address;
290
395
  withdrawalAmount?: bigint;
291
396
  timeRemaining?: string;
292
397
  withdrawalRequestId?: bigint;
@@ -304,7 +409,12 @@ interface StakedBeraWithdrawal {
304
409
  * @param version - The version of the stake vault contract ("V1" or "V2")
305
410
  * @returns Promise resolving to an array of withdrawal request information
306
411
  */
307
- declare function getSWBeraWithdrawal(contractAddress: Address, accountAddress: Address, publicClient: PublicClient, version: "V1" | "V2"): Promise<StakedBeraWithdrawal[]>;
412
+ declare function getSWBeraWithdrawal({ contractAddress, accountAddress, publicClient, version, }: {
413
+ contractAddress: Address;
414
+ accountAddress: Address;
415
+ publicClient: PublicClient;
416
+ version: "V1" | "V2";
417
+ }): Promise<StakedBeraWithdrawal[]>;
308
418
 
309
419
  interface UserVault {
310
420
  unclaimedBgt: string;
@@ -392,7 +502,7 @@ type UserBoostsOnValidator = {
392
502
  declare function getUserBoostsOnValidator({ account, pubkey, publicClient, ...args }: {
393
503
  account: Address;
394
504
  pubkey: Address;
395
- publicClient: GetPublicClientReturnType;
505
+ publicClient: PublicClient | undefined;
396
506
  } & BeraJS.BaseFunctionArgs): Promise<UserBoostsOnValidator>;
397
507
 
398
508
  type ValidatorWithUserBoost = ApiValidatorFragment & {
@@ -400,7 +510,7 @@ type ValidatorWithUserBoost = ApiValidatorFragment & {
400
510
  };
401
511
  declare function getUserActiveValidators({ account, publicClient, chain, ...args }: {
402
512
  account: string;
403
- publicClient?: GetPublicClientReturnType;
513
+ publicClient?: PublicClient | undefined;
404
514
  chain?: GqlChain;
405
515
  } & BeraJS.BaseFunctionArgs): Promise<ValidatorWithUserBoost[] | undefined>;
406
516
 
@@ -437,4 +547,4 @@ declare function getValidatorQueuedOperatorAddress({ client, pubKey, ...args }:
437
547
  pubKey: Address;
438
548
  } & BeraJS.BaseFunctionArgs): Promise<ValidatorQueuedOperatorAddress | undefined>;
439
549
 
440
- export { getVaultHistory as A, type ValidatorWithUserBoost as B, getUserActiveValidators as C, type UserBoostsOnValidator as D, getUserBoostsOnValidator as E, type UserStakingPoolPosition as F, type GetConvertToAssetsProps as G, getUserStakingPositions as H, type IsBadCollateralArgs as I, type ValidatorQueuedCommission as J, getValidatorQueuedCommission as K, type ValidatorQueuedOperatorAddress as L, getValidatorQueuedOperatorAddress as M, type ValidatorRewardAllocationRaw as N, type OnChainPool as O, type PoolStatus as P, type ValidatorRewardAllocationUpdate as Q, type RewardVaultIncentive as R, type StakedBeraWithdrawal as S, type ValidatorRewardAllocationUpdateWithExpiration as T, type UserVault as U, type ValidatorRewardAllocation as V, formatValidatorRewardAllocation as W, isSameRewardAllocation as X, getValidatorRewardAllocation as Y, getOnChainPool as a, getPoolPausedState as b, type GetHoneyVaultsBalanceResponse as c, getHoneyVaultsBalance as d, type IsBadCollateralResponse as e, type GetBgtAprSimulationArgs as f, getConvertToAssets as g, type GetBgtAprSimulationResult as h, isBadCollateralAsset as i, getBgtAprSimulation as j, type GlobalData as k, getGlobalData as l, type GetMarkets as m, getMarkets as n, getRewardVaultIncentives as o, RewardVaultDistributionMode as p, type GetRewardVaultRewardsReturn as q, getRewardVaultRewards as r, type GetGaugeData as s, getRewardVaults as t, type GetStakedBeraSnapshotsArgs as u, getStakedBeraSnapshots as v, getSWBeraWithdrawal as w, type GetUserVaultsResponse as x, getUserVaults as y, type GetVaultHistoryArgs as z };
550
+ export { getVaultHistory as A, BaseAggregator as B, type ValidatorWithUserBoost as C, getUserActiveValidators as D, type UserBoostsOnValidator as E, getUserBoostsOnValidator as F, type GetConvertToAssetsProps as G, type UserStakingPoolPosition as H, type IsBadCollateralArgs as I, getUserStakingPositions as J, type ValidatorQueuedCommission as K, getValidatorQueuedCommission as L, type ValidatorQueuedOperatorAddress as M, getValidatorQueuedOperatorAddress as N, type OnChainPool as O, type PoolStatus as P, type ValidatorRewardAllocationRaw as Q, type RewardVaultIncentive as R, type StakedBeraWithdrawal as S, type ValidatorRewardAllocationUpdate as T, type UserVault as U, type ValidatorRewardAllocation as V, type ValidatorRewardAllocationUpdateWithExpiration as W, formatValidatorRewardAllocation as X, isSameRewardAllocation as Y, getValidatorRewardAllocation as Z, getOnChainPool as a, getPoolPausedState as b, type GetHoneyVaultsBalanceResponse as c, getHoneyVaultsBalance as d, type IsBadCollateralResponse as e, type GetBgtAprSimulationArgs as f, getConvertToAssets as g, type GetBgtAprSimulationResult as h, isBadCollateralAsset as i, getBgtAprSimulation as j, type GlobalData as k, getGlobalData as l, type GetMarkets as m, getMarkets as n, getRewardVaultIncentives as o, RewardVaultDistributionMode as p, type GetRewardVaultRewardsReturn as q, getRewardVaultRewards as r, type GetGaugeData as s, getRewardVaults as t, type VaultMetadata as u, getSWBeraVaultMetadata as v, getSWBeraWithdrawal as w, type GetUserVaultsResponse as x, getUserVaults as y, type GetVaultHistoryArgs as z };
@@ -0,0 +1,473 @@
1
+ import { Address, Hex, AbiFunction, Abi, ContractFunctionName, ContractFunctionArgs, TransactionReceipt, WalletCallReceipt, Account } from 'viem';
2
+ import { ProposalWithVotesFragment, ProposalVoteFragment } from '@berachain/graphql/governance';
3
+ import { b as ProposalTypeEnum, a as ProposalErrorCodes, T as TransactionActionType, C as ContractName } from './txnEnum-BlBYhNRl.cjs';
4
+ import { a as TokenWithMetadata, b as Token } from './HoneyConfigProvider-Ca3ouozs.cjs';
5
+ import { ApiValidatorFragment } from '@berachain/graphql/pol/api';
6
+ import { Config, GetWalletClientReturnType } from '@wagmi/core';
7
+ import { SWRConfiguration, SWRResponse } from 'swr';
8
+ import { ChainId, BeraConfig } from '@berachain/config';
9
+ import { B as BeraError } from './BeraError-_mQdkanr.cjs';
10
+
11
+ type Proposal = ProposalWithVotesFragment;
12
+
13
+ type Vote = ProposalVoteFragment;
14
+
15
+ type Voter = Address;
16
+
17
+ type ProposalVotes = {
18
+ yes: number;
19
+ no: number;
20
+ abstain: number;
21
+ };
22
+
23
+ type PROPOSAL_GENRE = "berahub" | "honey" | "bend" | "berps" | "general";
24
+
25
+ type CustomProposalActionErrors = {
26
+ type?: null | ProposalErrorCodes;
27
+ target?: null | ProposalErrorCodes;
28
+ value?: null | ProposalErrorCodes;
29
+ ABI?: null | ProposalErrorCodes;
30
+ functionSignature?: null | ProposalErrorCodes;
31
+ args?: (null | ProposalErrorCodes)[];
32
+ vault?: null | ProposalErrorCodes;
33
+ isFriend?: null | ProposalErrorCodes;
34
+ to?: null | ProposalErrorCodes;
35
+ amount?: null | ProposalErrorCodes;
36
+ minIncentiveRate?: null | ProposalErrorCodes;
37
+ managerAddress?: null | ProposalErrorCodes;
38
+ input?: null | ProposalErrorCodes;
39
+ token?: null | ProposalErrorCodes;
40
+ rawCalldata?: null | ProposalErrorCodes;
41
+ message?: null | ProposalErrorCodes;
42
+ } | null;
43
+
44
+ type CustomProposalErrors = {
45
+ title?: null | ProposalErrorCodes;
46
+ description?: null | ProposalErrorCodes;
47
+ forumLink?: null | ProposalErrorCodes;
48
+ actions?: CustomProposalActionErrors[];
49
+ };
50
+
51
+ type GovernanceTopic = {
52
+ id: PROPOSAL_GENRE;
53
+ color: string;
54
+ icon: React.ReactNode;
55
+ iconBackground?: string;
56
+ name: string;
57
+ slug: string;
58
+ forumLink: string;
59
+ description?: string;
60
+ comingSoon?: boolean;
61
+ };
62
+ type CustomProposal = {
63
+ title: string;
64
+ description: any;
65
+ actions: ProposalAction[];
66
+ forumLink: string;
67
+ topic: Set<PROPOSAL_GENRE>;
68
+ };
69
+
70
+ type SafeProposalAction = {
71
+ value: bigint;
72
+ target: "" | Address;
73
+ } & (
74
+ | {
75
+ type: ProposalTypeEnum.CUSTOM_PROPOSAL;
76
+ input: "ABI" | "rawCalldata" | "message";
77
+ ABI: string;
78
+ _isVerifiedAbi?: boolean;
79
+ functionSignature: string;
80
+ args: string[];
81
+ rawCalldata: Hex;
82
+ message: string;
83
+ }
84
+ | {
85
+ type:
86
+ | ProposalTypeEnum.WHITELIST_REWARD_VAULT
87
+ | ProposalTypeEnum.BLACKLIST_REWARD_VAULT;
88
+ vault: Address;
89
+ }
90
+ | {
91
+ type: ProposalTypeEnum.ERC20_TRANSFER;
92
+ to: Address;
93
+ amount: string;
94
+ }
95
+ | {
96
+ type: ProposalTypeEnum.WHITELIST_REWARD_VAULT_INCENTIVE;
97
+ vault: Address;
98
+ token: Address;
99
+ minIncentiveRate: string;
100
+ managerAddress: Address;
101
+ }
102
+ );
103
+
104
+ type ProposalAction = Partial<SafeProposalAction> & {
105
+ type: SafeProposalAction["type"];
106
+ };
107
+
108
+ type VerifiedAbi = {
109
+ abiItem?: AbiFunction;
110
+ functionName?: string;
111
+ args: readonly unknown[];
112
+ functionSignature?: string;
113
+ };
114
+
115
+ interface ProtocolMetadata {
116
+ name: string;
117
+ logoURI: string;
118
+ url: string;
119
+ description: string;
120
+ tags?: string[];
121
+ }
122
+
123
+ /**
124
+ * Configuration for a single staking option.
125
+ * Maps receipt tokens to their accepted input tokens.
126
+ */
127
+ type StakingConfig = {
128
+ /** Unique identifier for this staking config */
129
+ id: string;
130
+ /** The token received when staking (e.g., sWBERA, siBERA) */
131
+ receiptToken: TokenWithMetadata;
132
+ /** Tokens that can be staked to receive the receipt token */
133
+ inputTokens: TokenWithMetadata[];
134
+ };
135
+
136
+ interface BribeBoostReward {
137
+ token: string;
138
+ total_unclaimed: string;
139
+ }
140
+
141
+ interface BribeBoostRewardItem {
142
+ rewards: BribeBoostReward[];
143
+ validator: string;
144
+ }
145
+
146
+ interface BribeBoostRewardProof {
147
+ validator?: string;
148
+ pagination: {
149
+ next: number;
150
+ previous: number;
151
+ record_per_page: number;
152
+ current_page: number;
153
+ total_page: number;
154
+ };
155
+ rewards:
156
+ | {
157
+ id: string;
158
+ dist_id: string;
159
+ token: Address;
160
+ recipient: string;
161
+ amount: string;
162
+ merkle_proof: string[];
163
+ available_at: number;
164
+ }[]
165
+ | null;
166
+ }
167
+
168
+ interface BribeBoostValidatorApr {
169
+ id: string;
170
+ boost_total_bgt: string;
171
+ rewards_total_usd: string;
172
+ daily_rate: string;
173
+ apr: string;
174
+ apy: string;
175
+ tokens: Address[]; // Confirm this type with backend real data
176
+ validator: string;
177
+ start_block: number;
178
+ end_block: number;
179
+ start_timestamp: number;
180
+ end_timestamp: number;
181
+ created_at: string;
182
+ updated_at: string;
183
+ }
184
+
185
+ type IncentiveReward = {
186
+ tokenMetadata: Token | undefined;
187
+ tokenPrice: number;
188
+ tokenValue: number;
189
+ id: string;
190
+ dist_id: string;
191
+ token: string;
192
+ recipient: string;
193
+ formattedAmount: string;
194
+ amount: string;
195
+ merkle_proof: string[];
196
+ available_at: number;
197
+ };
198
+ interface IncentiveRewardChunksWithValidatorData {
199
+ validator: ApiValidatorFragment | undefined;
200
+ maxTimestamp: number | undefined;
201
+ minTimestamp: number | undefined;
202
+ totalValue: number;
203
+ tokenTotals: {
204
+ chainId: number;
205
+ address: Address;
206
+ amount: number;
207
+ value: number;
208
+ metadata: Token | undefined;
209
+ }[];
210
+ rewards: IncentiveReward[];
211
+ isCurrent: boolean;
212
+ }
213
+
214
+ interface AggregatedTokenTotals {
215
+ address: Address;
216
+ amount: number;
217
+ value: number;
218
+ metadata: Token | undefined;
219
+ chainId: number;
220
+ }
221
+
222
+ type ClaimedIncentives = Record<string, string>;
223
+
224
+ type ClaimedIncentivesLocalState = Record<string, ClaimedIncentives>;
225
+
226
+ interface UserVaultInfo {
227
+ balance: bigint;
228
+ delegatedBalance: bigint;
229
+ withdrawableBalance: bigint;
230
+ rewards: string;
231
+ percentage: string;
232
+ }
233
+
234
+ type StakedBeraAsset = {
235
+ token: TokenWithMetadata;
236
+ apr: number;
237
+ stakedAmount: number;
238
+ stakedAmountUsd: number;
239
+ earnedAmount: number;
240
+ earnedAmountUsd: number;
241
+ };
242
+
243
+ interface UseContractWriteApi {
244
+ isLoading: boolean;
245
+ isSubmitting: boolean;
246
+ isSuccess: boolean;
247
+ isError: boolean;
248
+ write: IContractWriteFn;
249
+ reset: () => void;
250
+ }
251
+ type PropagatedArgs<args> = Omit<args, TxnEventKeys | "contractName"> & {
252
+ contractName?: string;
253
+ };
254
+ type TxnEventKeys = "onSuccess" | "onError" | "onLoading" | "onSubmission" | "onWarning";
255
+ interface IUseContractWriteArgs<abi extends Abi | undefined = undefined, functionName extends abi extends Abi ? ContractFunctionName<abi> : never = abi extends Abi ? ContractFunctionName<abi> : never, params extends abi extends Abi ? ContractFunctionArgs<abi, "payable" | "nonpayable", functionName> : never = abi extends Abi ? ContractFunctionArgs<abi, "payable" | "nonpayable", functionName> : never> {
256
+ onSuccess?: (receipts: TransactionReceipt | WalletCallReceipt<bigint, "success" | "reverted">,
257
+ /**
258
+ * Arguments that were used to call the write function.
259
+ */
260
+ writeArgs: PropagatedArgs<IContractWrite<abi, functionName, params>>) => void;
261
+ onError?: (e: BeraError,
262
+ /**
263
+ * Arguments that were used to call the write function.
264
+ */
265
+ writeArgs: PropagatedArgs<IContractWrite<abi, functionName, params>>) => void;
266
+ onLoading?: (
267
+ /**
268
+ * Arguments that were used to call the write function.
269
+ */
270
+ writeArgs: PropagatedArgs<IContractWrite<abi, functionName, params>>) => void;
271
+ onSubmission?: (
272
+ /**
273
+ * @param args.id If request is a batch call, this will be the id of the request to the wallet provider
274
+ * @param args.txHash If request is a single transaction, this will be the hash of the transaction to wait for
275
+ */
276
+ args: {
277
+ txHash: Hex;
278
+ id?: never;
279
+ } | {
280
+ id: string;
281
+ txHash?: never;
282
+ },
283
+ /**
284
+ * Arguments that were used to call the write function.
285
+ */
286
+ writeArgs: PropagatedArgs<IContractWrite<abi, functionName, params>>) => void;
287
+ /**
288
+ * Callback function executed when a transaction encounters a warning. Transaction will still be submitted.
289
+ */
290
+ onWarning?: (e: BeraError, writeArgs: Omit<IContractWrite<abi, functionName, params>, TxnEventKeys>) => void;
291
+ }
292
+
293
+ type DefaultHookOptions = {
294
+ opts?: SWRConfiguration & { isEnabled?: boolean };
295
+ };
296
+
297
+ type DefaultHookReturnType<T = any> = Omit<
298
+ SWRResponse<T, any, any>,
299
+ "mutate"
300
+ > & {
301
+ refresh: () => void;
302
+ };
303
+
304
+ type IContractWriteFn = <
305
+ abi extends Abi | undefined = undefined,
306
+ functionName extends abi extends Abi
307
+ ? ContractFunctionName<abi>
308
+ : never = abi extends Abi ? ContractFunctionName<abi> : never,
309
+ params extends abi extends Abi
310
+ ? ContractFunctionArgs<abi, "payable" | "nonpayable", functionName>
311
+ : never = abi extends Abi
312
+ ? ContractFunctionArgs<abi, "payable" | "nonpayable", functionName>
313
+ : never,
314
+ >(
315
+ props: IContractWrite<abi, functionName, params>,
316
+ ) => Promise<
317
+ | TransactionReceipt
318
+ | WalletCallReceipt<bigint, "success" | "reverted">
319
+ | undefined
320
+ >;
321
+
322
+ /**
323
+ * Posthog must be able to serialize this. BigInts are not supported.
324
+ */
325
+ type AllowedEventData = number | string | boolean | null | undefined;
326
+
327
+ type EventData = Record<
328
+ string,
329
+ | AllowedEventData
330
+ | AllowedEventData[]
331
+ | Record<
332
+ string,
333
+ | AllowedEventData
334
+ | AllowedEventData[]
335
+ | Record<string, AllowedEventData | AllowedEventData[]>
336
+ >
337
+ >;
338
+
339
+ type IContractWrite<
340
+ abi extends Abi | undefined = undefined,
341
+ functionName extends abi extends Abi
342
+ ? ContractFunctionName<abi>
343
+ : never = abi extends Abi ? ContractFunctionName<abi> : never,
344
+ params extends abi extends Abi
345
+ ? ContractFunctionArgs<abi, "payable" | "nonpayable", functionName>
346
+ : never = abi extends Abi
347
+ ? ContractFunctionArgs<abi, "payable" | "nonpayable", functionName>
348
+ : never,
349
+ > = {
350
+ /**
351
+ * A message that will be shown to user while the transaction is pending.
352
+ *
353
+ * @example "Sending approvals"
354
+ */
355
+ message: string;
356
+ /**
357
+ * The chain ID of the transaction.
358
+ *
359
+ * @default berachainChainId
360
+ */
361
+ chainId?: ChainId;
362
+ /**
363
+ * The type of transaction to be performed. It will be stored in the transaction history.
364
+ *
365
+ * Generally uses infinite tense.
366
+ * @example TransactionActionType.APPROVAL => "Approve tokens"
367
+ */
368
+ actionType: TransactionActionType;
369
+ txnName?: string;
370
+ gasLimit?: bigint;
371
+ account?: Account | Address;
372
+ /**
373
+ * Wheter the transaction can be sent by any account. Before setting this to true, make sure smart contract doesn't rely on `msg.sender`.
374
+ *
375
+ * Only transaction with permissionless flag set to true can be sent with overriden account.
376
+ * Everything else will throw an error.
377
+ */
378
+ permissionless?: boolean;
379
+ /**
380
+ * The event to be tracked more specifically.
381
+ * If not provided, the event will be tracked with the message and actionType.
382
+ */
383
+ track?: {
384
+ eventName: string;
385
+ eventData?: EventData;
386
+ };
387
+
388
+ /**
389
+ * A wagmi config used to get wallet clients, switch chains, etc.
390
+ *
391
+ * This is preferred over providing clients as state updates are kept synched in this config object w/o re-rendering.
392
+ */
393
+ wagmiConfig?: Config;
394
+
395
+ /**
396
+ * walletClient should only be provided for tests or scripts.
397
+ *
398
+ * Wagmi Config is preferred.
399
+ */
400
+ walletClient?: GetWalletClientReturnType | undefined;
401
+ /**
402
+ * The name of the contract to be used for the transaction. By default, it will be devrel's contract mapping.
403
+ * Custom values will be ignored if the address is already mapped in the devrel's contract mapping.
404
+ *
405
+ * @example "pol.rewardVault"
406
+ */
407
+ contractName?: ContractName;
408
+ /**
409
+ * This is a canonical list of ABIs that will be used to parse the error.
410
+ *
411
+ * This is an useful way to parse errors when providing raw data with no ABI.
412
+ */
413
+ errorsAbi?: Abi;
414
+ } & IUseContractWriteArgs<abi, functionName, params> &
415
+ (abi extends Abi
416
+ ? {
417
+ abi: abi;
418
+ functionName: functionName;
419
+ params: params;
420
+ address: Address;
421
+ calls?: never;
422
+ value?: bigint;
423
+ }
424
+ :
425
+ | {
426
+ data: Hex;
427
+ address: Address;
428
+ value?: bigint;
429
+ calls?: never;
430
+ }
431
+ | {
432
+ value: bigint;
433
+ address: Address;
434
+ data?: Hex;
435
+ calls?: never;
436
+ }
437
+ | {
438
+ value?: never;
439
+ address?: never;
440
+ calls: (Omit<
441
+ IContractWrite,
442
+ | "calls"
443
+ | "gasLimit"
444
+ | "account"
445
+ | "address"
446
+ | "message"
447
+ | "actionType"
448
+ | TxnEventKeys
449
+ > & {
450
+ address: Address;
451
+ })[];
452
+ });
453
+
454
+ declare global {
455
+ export namespace BeraJS {
456
+ export type BaseFunctionArgs = {
457
+ /**
458
+ * If only chainId is provided, config will be inferred from it
459
+ *
460
+ * @default `import { defaultChainId } from "@berachain/config/internal";`
461
+ */
462
+ chainId?: ChainId;
463
+ /**
464
+ * A config to infer the default values of the other arguments
465
+ *
466
+ * @default chainConfigs[chainId]
467
+ */
468
+ config?: BeraConfig;
469
+ };
470
+ }
471
+ }
472
+
473
+ export type { AggregatedTokenTotals as A, BribeBoostRewardProof as B, CustomProposal as C, DefaultHookOptions as D, GovernanceTopic as G, IContractWrite as I, ProtocolMetadata as P, StakingConfig as S, TxnEventKeys as T, UserVaultInfo as U, Vote as V, CustomProposalErrors as a, BribeBoostRewardItem as b, DefaultHookReturnType as c, StakedBeraAsset as d, IUseContractWriteArgs as e, UseContractWriteApi as f, BribeBoostReward as g, BribeBoostValidatorApr as h, IContractWriteFn as i, Proposal as j, Voter as k, ProposalVotes as l, PROPOSAL_GENRE as m, CustomProposalActionErrors as n, SafeProposalAction as o, ProposalAction as p, VerifiedAbi as q, IncentiveReward as r, IncentiveRewardChunksWithValidatorData as s, ClaimedIncentives as t, ClaimedIncentivesLocalState as u };