@berachain/berajs 0.1.2 → 0.2.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 (453) 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} +80 -107
  16. package/dist/actions/{index.d.ts → exports.d.ts} +80 -107
  17. package/dist/actions/exports.mjs +2 -0
  18. package/dist/actions/exports.mjs.map +1 -0
  19. package/dist/chunk-575OK77P.mjs +2 -0
  20. package/dist/chunk-575OK77P.mjs.map +1 -0
  21. package/dist/chunk-7GWTHOLO.mjs +2 -0
  22. package/dist/chunk-7GWTHOLO.mjs.map +1 -0
  23. package/dist/chunk-7SC4VD3U.cjs +2 -0
  24. package/dist/chunk-7SC4VD3U.cjs.map +1 -0
  25. package/dist/chunk-BHNQX4XC.mjs +2 -0
  26. package/dist/chunk-BHNQX4XC.mjs.map +1 -0
  27. package/dist/chunk-BOYZVULX.cjs +2 -0
  28. package/dist/chunk-BOYZVULX.cjs.map +1 -0
  29. package/dist/chunk-C3FHGFLK.mjs +2 -0
  30. package/dist/chunk-C3FHGFLK.mjs.map +1 -0
  31. package/dist/chunk-C3G5KXCH.mjs +2 -0
  32. package/dist/chunk-C3G5KXCH.mjs.map +1 -0
  33. package/dist/chunk-CYKCYPFR.cjs +2 -0
  34. package/dist/chunk-CYKCYPFR.cjs.map +1 -0
  35. package/dist/chunk-F4BKSBEM.mjs +2 -0
  36. package/dist/chunk-F4BKSBEM.mjs.map +1 -0
  37. package/dist/chunk-FL2N3XHK.cjs +2 -0
  38. package/dist/chunk-FL2N3XHK.cjs.map +1 -0
  39. package/dist/chunk-G6NA6NSM.mjs +4 -0
  40. package/dist/chunk-G6NA6NSM.mjs.map +1 -0
  41. package/dist/chunk-H2QSRMVS.mjs +2 -0
  42. package/dist/chunk-H2QSRMVS.mjs.map +1 -0
  43. package/dist/chunk-IJM76AWK.cjs +4 -0
  44. package/dist/chunk-IJM76AWK.cjs.map +1 -0
  45. package/dist/chunk-MTS5SZLA.mjs +2 -0
  46. package/dist/chunk-MTS5SZLA.mjs.map +1 -0
  47. package/dist/chunk-MUNAP5TM.cjs +2 -0
  48. package/dist/chunk-MUNAP5TM.cjs.map +1 -0
  49. package/dist/chunk-NAXAZJJY.mjs +2 -0
  50. package/dist/chunk-NAXAZJJY.mjs.map +1 -0
  51. package/dist/chunk-OGJMSGB2.mjs +2 -0
  52. package/dist/chunk-OGJMSGB2.mjs.map +1 -0
  53. package/dist/chunk-OIYXOKTT.cjs +2 -0
  54. package/dist/chunk-OIYXOKTT.cjs.map +1 -0
  55. package/dist/chunk-OS5AJMYJ.cjs +2 -0
  56. package/dist/chunk-OS5AJMYJ.cjs.map +1 -0
  57. package/dist/chunk-Q3SCM6WL.mjs +2 -0
  58. package/dist/chunk-Q3SCM6WL.mjs.map +1 -0
  59. package/dist/chunk-SWMJQOH6.cjs +2 -0
  60. package/dist/chunk-SWMJQOH6.cjs.map +1 -0
  61. package/dist/chunk-TEBJWAVU.mjs +2 -0
  62. package/dist/chunk-TEBJWAVU.mjs.map +1 -0
  63. package/dist/chunk-TJWKS54T.mjs +2 -0
  64. package/dist/chunk-TJWKS54T.mjs.map +1 -0
  65. package/dist/chunk-UQUWMHVF.cjs +2 -0
  66. package/dist/chunk-UQUWMHVF.cjs.map +1 -0
  67. package/dist/chunk-UXUWSRVV.cjs +2 -0
  68. package/dist/chunk-UXUWSRVV.cjs.map +1 -0
  69. package/dist/chunk-VP7XUOSI.cjs +2 -0
  70. package/dist/chunk-VP7XUOSI.cjs.map +1 -0
  71. package/dist/chunk-VXL2ZZ4X.cjs +2 -0
  72. package/dist/chunk-VXL2ZZ4X.cjs.map +1 -0
  73. package/dist/chunk-WRFDB3QJ.cjs +2 -0
  74. package/dist/chunk-WRFDB3QJ.cjs.map +1 -0
  75. package/dist/chunk-WTCBORPB.cjs +2 -0
  76. package/dist/chunk-WTCBORPB.cjs.map +1 -0
  77. package/dist/chunk-XNJLSA6P.cjs +2 -0
  78. package/dist/chunk-XNJLSA6P.cjs.map +1 -0
  79. package/dist/chunk-YQGZMWDT.mjs +2 -0
  80. package/dist/chunk-YQGZMWDT.mjs.map +1 -0
  81. package/dist/chunk-YXLFOEZN.mjs +2 -0
  82. package/dist/chunk-YXLFOEZN.mjs.map +1 -0
  83. package/dist/chunk-ZAKA4TGK.cjs +2 -0
  84. package/dist/chunk-ZAKA4TGK.cjs.map +1 -0
  85. package/dist/chunk-ZQRACIGR.mjs +2 -0
  86. package/dist/chunk-ZQRACIGR.mjs.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.ts → exports.d.cts} +19 -28
  90. package/dist/contexts/{index.d.cts → exports.d.ts} +19 -28
  91. package/dist/contexts/exports.mjs +2 -0
  92. package/dist/contexts/exports.mjs.map +1 -0
  93. package/dist/contracts-CQIPk0Jc.d.cts +74 -0
  94. package/dist/contracts-CQIPk0Jc.d.ts +74 -0
  95. package/dist/{defaultFlags-V-tJs2K8.d.cts → defaultFlags-d0kPbT0i.d.cts} +1 -1
  96. package/dist/{defaultFlags-V-tJs2K8.d.ts → defaultFlags-d0kPbT0i.d.ts} +1 -1
  97. package/dist/dex-C_BB0b0O.d.cts +37 -0
  98. package/dist/dex-C_BB0b0O.d.ts +37 -0
  99. package/dist/enum/exports.cjs +2 -0
  100. package/dist/enum/exports.cjs.map +1 -0
  101. package/dist/enum/exports.d.cts +24 -0
  102. package/dist/enum/exports.d.ts +24 -0
  103. package/dist/enum/exports.mjs +2 -0
  104. package/dist/enum/exports.mjs.map +1 -0
  105. package/dist/errors/exports.cjs +2 -0
  106. package/dist/errors/exports.cjs.map +1 -0
  107. package/dist/errors/exports.d.cts +385 -0
  108. package/dist/errors/exports.d.ts +385 -0
  109. package/dist/errors/exports.mjs +2 -0
  110. package/dist/{getValidatorQueuedOperatorAddress-9xY2RUGe.d.cts → getValidatorQueuedOperatorAddress-BX35p2Lv.d.ts} +125 -15
  111. package/dist/{getValidatorQueuedOperatorAddress-Ne2zoiiV.d.ts → getValidatorQueuedOperatorAddress-It0GsdvQ.d.cts} +125 -15
  112. package/dist/global.d-Ba-NIojH.d.cts +474 -0
  113. package/dist/global.d-By70bEv2.d.ts +474 -0
  114. package/dist/honey-CYm0RWf4.d.cts +14 -0
  115. package/dist/honey-CYm0RWf4.d.ts +14 -0
  116. package/dist/hooks/exports.cjs +4 -0
  117. package/dist/hooks/exports.cjs.map +1 -0
  118. package/dist/hooks/{index.d.cts → exports.d.cts} +223 -173
  119. package/dist/hooks/{index.d.ts → exports.d.ts} +223 -173
  120. package/dist/hooks/exports.mjs +4 -0
  121. package/dist/hooks/exports.mjs.map +1 -0
  122. package/dist/{BexStatusProvider-nS3NcdxI.d.cts → transactionStore-BvStaXf3.d.ts} +41 -1
  123. package/dist/{BexStatusProvider-nS3NcdxI.d.ts → transactionStore-CQrGYSY2.d.cts} +41 -1
  124. package/dist/{txnEnum-BQKDfaeH.d.cts → txnEnum-BYNbCxla.d.cts} +1 -0
  125. package/dist/{txnEnum-BQKDfaeH.d.ts → txnEnum-BYNbCxla.d.ts} +1 -0
  126. package/dist/types/exports.cjs +1 -0
  127. package/dist/types/exports.cjs.map +1 -0
  128. package/dist/types/exports.d.cts +58 -0
  129. package/dist/types/exports.d.ts +58 -0
  130. package/dist/types/exports.mjs +1 -0
  131. package/dist/{useHoneySwapState-C-9BV4VB.d.cts → useHoneySwapState-B-vmIP1b.d.cts} +1 -1
  132. package/dist/{useHoneySwapState-CUY5Sm1b.d.ts → useHoneySwapState-D1DKG_Of.d.ts} +1 -1
  133. package/dist/utils/exports.cjs +2 -0
  134. package/dist/utils/exports.cjs.map +1 -0
  135. package/dist/utils/{index.d.cts → exports.d.cts} +83 -20
  136. package/dist/utils/{index.d.ts → exports.d.ts} +83 -20
  137. package/dist/utils/exports.mjs +2 -0
  138. package/dist/utils/exports.mjs.map +1 -0
  139. package/package.json +16 -17
  140. package/src/abi/{index.ts → exports.ts} +3 -0
  141. package/src/abi/pol/LSTStakerVault.ts +2032 -0
  142. package/src/abi/utils/openChainErrors.ts +71 -30
  143. package/src/abi/utils/thirdwebMinimalAccount.ts +616 -0
  144. package/src/actions/clients/BeraApolloClient.ts +8 -6
  145. package/src/actions/dex/__tests__/aggregators.unit.test.ts +2 -5
  146. package/src/actions/dex/aggregators/base.ts +74 -16
  147. package/src/actions/dex/aggregators/bex.ts +54 -74
  148. package/src/actions/dex/aggregators/bgt.ts +31 -8
  149. package/src/actions/dex/aggregators/{enso.ts → enso/enso.ts} +18 -14
  150. package/src/actions/dex/aggregators/enso/ensoErc4626.debug.test.ts +37 -0
  151. package/src/actions/dex/aggregators/enso/ensoErc4626.ts +176 -0
  152. package/src/actions/dex/aggregators/erc4626.ts +122 -0
  153. package/src/actions/dex/aggregators/fly.ts +59 -53
  154. package/src/actions/dex/aggregators/haiku.ts +52 -54
  155. package/src/actions/dex/aggregators/honey.ts +54 -45
  156. package/src/actions/dex/aggregators/kyberswap.ts +41 -39
  157. package/src/actions/dex/aggregators/oogabooga.ts +47 -46
  158. package/src/actions/dex/aggregators/openOcean.ts +51 -46
  159. package/src/actions/dex/aggregators/wbera.ts +54 -42
  160. package/src/actions/dex/b-sdk.ts +5 -2
  161. package/src/actions/dex/getIsTokenExploited.ts +2 -2
  162. package/src/actions/enso/{zap.ts → getEnsoSwapBundle.ts} +4 -5
  163. package/src/actions/enso/getEnsoUserTokensWithBalances.debug.test.ts +73 -0
  164. package/src/actions/enso/{getEnsoUserToken.ts → getEnsoUserTokensWithBalances.ts} +42 -30
  165. package/src/actions/enso/util.ts +1 -1
  166. package/src/actions/{index.ts → exports.ts} +5 -0
  167. package/src/actions/governance/__tests__/checkProposalField.unit.test.ts +1 -1
  168. package/src/actions/governance/__tests__/getQuorum.integration.test.ts +1 -1
  169. package/src/actions/governance/checkProposalField.ts +1 -1
  170. package/src/actions/governance/computeActualStatus.ts +1 -1
  171. package/src/actions/governance/getBodyErrors.ts +1 -1
  172. package/src/actions/governance/getDecodedFunctionData.ts +1 -4
  173. package/src/actions/governance/getProposalDetails.ts +2 -2
  174. package/src/actions/governance/getProposalFromTx.ts +1 -2
  175. package/src/actions/governance/getProposalParams.ts +7 -8
  176. package/src/actions/governance/getQuorum.ts +1 -2
  177. package/src/actions/honey/getCollateralWeights.ts +1 -1
  178. package/src/actions/honey/getHoneyCollaterals.ts +1 -0
  179. package/src/actions/honey/getHoneyVaultsBalance.ts +51 -55
  180. package/src/actions/honey/getSwapPayload.ts +37 -35
  181. package/src/actions/honey/tests/pyth.integration.test.ts +0 -1
  182. package/src/actions/pol/__tests__/getAllValidators.integration.test.ts +1 -1
  183. package/src/actions/pol/getEarnedStakedBeraVault.ts +31 -0
  184. package/src/actions/pol/getGlobalData.ts +14 -13
  185. package/src/actions/pol/getLSTStakeConfig.ts +67 -0
  186. package/src/actions/pol/getMarkets.ts +1 -1
  187. package/src/actions/pol/getRewardProofsByValidator.ts +1 -1
  188. package/src/actions/pol/getRewardVaultIncentives.ts +3 -5
  189. package/src/actions/pol/getRewardVaults.ts +2 -3
  190. package/src/actions/pol/getSWBeraVaultMetadata.ts +7 -5
  191. package/src/actions/pol/getSWBeraWithdrawal.ts +41 -27
  192. package/src/actions/pol/getStakeWithdrawalCooldown.ts +5 -7
  193. package/src/actions/pol/getStakingDailyAssets.ts +21 -0
  194. package/src/actions/pol/getStakingTokenInformation.ts +3 -4
  195. package/src/actions/pol/getTotalStakedAmount.ts +47 -0
  196. package/src/actions/pol/getUserClaimableIncentives.ts +1 -1
  197. package/src/actions/pol/getUserVaults.ts +8 -6
  198. package/src/actions/pol/getUserVaultsBalance.ts +4 -16
  199. package/src/actions/prices/getTokenCurrentPrices.ts +8 -3
  200. package/src/actions/tokens/getAllowances.ts +68 -41
  201. package/src/actions/tokens/getTokenInformation.ts +4 -1
  202. package/src/actions/tokens/getTokens.ts +1 -1
  203. package/src/actions/tokens/getUnderlyingToken.ts +53 -0
  204. package/src/actions/tokens/getWalletBalances.integration.test.ts +53 -14
  205. package/src/actions/tokens/getWalletBalances.ts +69 -43
  206. package/src/actions/transactions/beraWriteContract.integration.test.ts +18 -6
  207. package/src/actions/transactions/beraWriteContract.ts +3 -3
  208. package/src/actions/validators/getUserActiveValidators.ts +2 -3
  209. package/src/actions/validators/getUserBoostsOnValidator.ts +2 -3
  210. package/src/contexts/BeraFlags/defaultFlags.ts +4 -0
  211. package/src/contexts/SwrFallback.tsx +13 -3
  212. package/src/contexts/TokensProvider.tsx +35 -8
  213. package/src/{hooks/transactions → contexts}/TransactionStoreContext.tsx +32 -4
  214. package/src/contexts/block-time-provider.tsx +1 -1
  215. package/src/contexts/{index.ts → exports.ts} +1 -1
  216. package/src/data/contracts.ts +16 -1
  217. package/src/enum/contracts.ts +13 -0
  218. package/src/enum/dex.ts +29 -0
  219. package/src/enum/{index.ts → exports.ts} +3 -0
  220. package/src/enum/governance.ts +61 -0
  221. package/src/enum/honey.ts +12 -0
  222. package/src/enum/txnEnum.ts +1 -0
  223. package/src/errors/BeraError.ts +50 -11
  224. package/src/errors/BeraMonitoring.ts +66 -0
  225. package/src/errors/BeraTracing.ts +79 -0
  226. package/src/errors/BeraTracing.unit.test.ts +198 -0
  227. package/src/errors/RequestError.ts +2 -2
  228. package/src/errors/assert.ts +4 -2
  229. package/src/errors/assert.unit.test.ts +6 -2
  230. package/src/errors/errorMap.ts +16 -6
  231. package/src/errors/{index.ts → exports.ts} +7 -0
  232. package/src/errors/getErrorMessage.ts +22 -3
  233. package/src/errors/getRevertReason.integration.test.ts +17 -5
  234. package/src/errors/getRevertReason.ts +41 -2
  235. package/src/errors/initBeraError.ts +52 -7
  236. package/src/errors/parseViemError.ts +114 -27
  237. package/src/errors/severity.ts +12 -0
  238. package/src/hooks/bend/useGetConvertToAssets.ts +3 -2
  239. package/src/hooks/dex/useAggregatorsQuotes.ts +126 -365
  240. package/src/hooks/dex/useAllUserPools.ts +1 -1
  241. package/src/hooks/dex/useApiPool.ts +1 -1
  242. package/src/hooks/dex/useCreatePool.ts +6 -5
  243. package/src/hooks/dex/useExploitedTokens.ts +1 -1
  244. package/src/hooks/dex/useLiquidityMismatch.ts +2 -5
  245. package/src/hooks/dex/useLpPosition.ts +21 -20
  246. package/src/hooks/dex/useMultipleTokenApprovalsWithSlippage.ts +40 -29
  247. package/src/hooks/dex/usePollPoolCreationRelayerApproval.ts +1 -1
  248. package/src/hooks/dex/usePoolEvents.ts +1 -1
  249. package/src/hooks/dex/usePools.ts +1 -1
  250. package/src/hooks/dex/usePriceImpact.ts +40 -0
  251. package/src/hooks/dex/useSingleAggregatorQuote.ts +350 -0
  252. package/src/hooks/enso/useBendZapSupply.ts +216 -0
  253. package/src/hooks/enso/useEnsoSwapBundle.ts +107 -0
  254. package/src/hooks/enso/useEnsoUserTokensWithBalances.ts +43 -0
  255. package/src/hooks/enso/useZapStakeBera.ts +113 -0
  256. package/src/hooks/{index.ts → exports.ts} +18 -7
  257. package/src/hooks/governance/useCreateProposal.ts +8 -8
  258. package/src/hooks/governance/usePollAllProposals.ts +1 -1
  259. package/src/hooks/governance/usePollProposal.ts +1 -1
  260. package/src/hooks/governance/usePollProposalThreshold.ts +1 -1
  261. package/src/hooks/governance/usePollUserDelegates.ts +1 -1
  262. package/src/hooks/governance/useProposalState.ts +2 -2
  263. package/src/hooks/honey/useCappedGlobally.ts +2 -1
  264. package/src/hooks/honey/useCappedRelatively.ts +1 -1
  265. package/src/hooks/honey/useCollateralWeights.ts +2 -1
  266. package/src/hooks/honey/useHoneyAlerts.ts +11 -11
  267. package/src/hooks/honey/useHoneyBalances.ts +7 -3
  268. package/src/hooks/honey/useHoneyGlobalData.ts +2 -1
  269. package/src/hooks/honey/useHoneySwapState.ts +2 -1
  270. package/src/hooks/honey/useHoneyVaultsBalance.ts +1 -1
  271. package/src/hooks/honey/useIsBadCollateralAsset.ts +2 -1
  272. package/src/hooks/honey/useIsBasketModeEnabled.ts +1 -1
  273. package/src/hooks/honey/usePythLatestPrices.ts +1 -1
  274. package/src/hooks/pol/useOnChainRewardVault.ts +3 -2
  275. package/src/hooks/pol/usePollGlobalData.ts +1 -1
  276. package/src/hooks/pol/usePollMarkets.ts +1 -1
  277. package/src/hooks/pol/useQueuedBeraUnlock.ts +17 -15
  278. package/src/hooks/pol/useRewardTokenToBeraRate.ts +6 -3
  279. package/src/hooks/pol/useRewardVault.ts +1 -1
  280. package/src/hooks/pol/useRewardVaults.ts +1 -1
  281. package/src/hooks/pol/useSWBeraVaultMetadata.ts +35 -0
  282. package/src/hooks/pol/useStakedAPR.ts +38 -0
  283. package/src/hooks/pol/useStakedData.ts +117 -0
  284. package/src/hooks/pol/useStakedSnapshots.ts +52 -0
  285. package/src/hooks/pol/useTotalStakedAmount.ts +30 -0
  286. package/src/hooks/pol/useUserVaultInfo.ts +1 -1
  287. package/src/hooks/pol/useVaultValidators.ts +1 -1
  288. package/src/hooks/tokens/useMultipleTokenInformation.ts +15 -6
  289. package/src/hooks/tokens/usePollAllowances.ts +15 -19
  290. package/src/hooks/tokens/usePollBalance.ts +8 -4
  291. package/src/hooks/tokens/usePollWalletBalances.ts +14 -11
  292. package/src/hooks/tokens/useStakingTokenInformation.ts +2 -1
  293. package/src/hooks/tokens/useTokenCurrentPrice.ts +4 -2
  294. package/src/hooks/tokens/useTokenCurrentPrices.ts +92 -13
  295. package/src/hooks/tokens/useTokenInformation.ts +11 -6
  296. package/src/hooks/tokens/useTokenPrice.ts +21 -0
  297. package/src/hooks/tokens/useTokenPrices.ts +133 -0
  298. package/src/hooks/tokens/useTokens.ts +1 -0
  299. package/src/hooks/tokens/useUnderlyingAsset.ts +23 -0
  300. package/src/hooks/transactions/transactionStore.ts +86 -65
  301. package/src/hooks/transactions/transactionStore.unit.test.ts +54 -1
  302. package/src/hooks/transactions/useAddRecentTransaction.ts +1 -1
  303. package/src/hooks/transactions/useRecentTransactions.ts +1 -1
  304. package/src/hooks/transactions/useSetTransactionStatus.ts +31 -0
  305. package/src/hooks/useContractWrite/useBeraContractWrite.ts +2 -1
  306. package/src/hooks/validators/useAllValidators.ts +1 -1
  307. package/src/hooks/validators/useApiValidator.ts +1 -1
  308. package/src/hooks/validators/useDailyValidatorBlockStats.ts +1 -1
  309. package/src/hooks/validators/useManagedValidatorByAccount.ts +1 -1
  310. package/src/hooks/validators/useManagedValidatorRole.ts +1 -1
  311. package/src/hooks/validators/useOnChainValidator.ts +1 -1
  312. package/src/hooks/validators/useStakingPoolBatch.ts +1 -1
  313. package/src/hooks/validators/useUserActiveValidators.ts +1 -1
  314. package/src/hooks/validators/useUserBoostsOnValidator.ts +1 -1
  315. package/src/hooks/validators/useUserClaimableIncentives.ts +8 -8
  316. package/src/hooks/validators/useValidator.ts +1 -1
  317. package/src/hooks/validators/useValidatorAnalytics.ts +1 -1
  318. package/src/hooks/validators/useValidatorCommission.ts +1 -1
  319. package/src/hooks/validators/useValidatorQueuedCommission.ts +1 -1
  320. package/src/hooks/validators/useValidatorQueuedOperatorAddress.ts +1 -1
  321. package/src/hooks/validators/useValidatorQueuedRewardAllocation.ts +1 -1
  322. package/src/hooks/validators/useValidatorRewardAllocation.ts +1 -1
  323. package/src/types/{dex.ts → dex.d.ts} +96 -67
  324. package/src/types/{enso.ts → enso.d.ts} +1 -1
  325. package/src/types/exports.ts +8 -0
  326. package/src/types/{global.ts → global.d.ts} +1 -30
  327. package/src/types/{governance.ts → governance.d.ts} +2 -64
  328. package/src/types/{honeySwap.ts → honeySwap.d.ts} +1 -13
  329. package/src/types/{pol.ts → pol.d.ts} +12 -1
  330. package/src/types/staking.d.ts +22 -0
  331. package/src/utils/createEmitter.ts +122 -0
  332. package/src/utils/createEmitter.unit.test.ts +149 -0
  333. package/src/utils/{index.ts → exports.ts} +3 -2
  334. package/src/utils/filter.ts +34 -0
  335. package/src/utils/formatNumber.ts +1 -1
  336. package/src/utils/formatNumber.unit.test.ts +2 -1
  337. package/src/utils/formatTokenList.ts +4 -10
  338. package/src/utils/getHoneySwapMessage.test.ts +1 -2
  339. package/src/utils/getServerSideClient.ts +4 -5
  340. package/src/utils/isDifferenceExceedingThreshold.ts +1 -1
  341. package/src/utils/layerZeroScan.ts +122 -0
  342. package/src/utils/math.ts +1 -1
  343. package/src/utils/parseWhiskToken.ts +15 -0
  344. package/src/utils/poolNamings.ts +1 -1
  345. package/src/utils/tokens.ts +23 -7
  346. package/dist/HoneyConfigProvider-6PXZJMSU.d.cts +0 -562
  347. package/dist/HoneyConfigProvider-CwDFrt02.d.ts +0 -562
  348. package/dist/abi/index.cjs +0 -2
  349. package/dist/abi/index.cjs.map +0 -1
  350. package/dist/abi/index.mjs +0 -2
  351. package/dist/actions/index.cjs +0 -2
  352. package/dist/actions/index.cjs.map +0 -1
  353. package/dist/actions/index.mjs +0 -2
  354. package/dist/aggregatorsRouter-Cny4B_MB.d.cts +0 -593
  355. package/dist/aggregatorsRouter-Cny4B_MB.d.ts +0 -593
  356. package/dist/chunk-22MQVFHP.cjs +0 -2
  357. package/dist/chunk-22MQVFHP.cjs.map +0 -1
  358. package/dist/chunk-3TKSVFZ3.mjs +0 -2
  359. package/dist/chunk-3TKSVFZ3.mjs.map +0 -1
  360. package/dist/chunk-6VF3RF53.cjs +0 -3
  361. package/dist/chunk-6VF3RF53.cjs.map +0 -1
  362. package/dist/chunk-6W22TFYA.mjs +0 -2
  363. package/dist/chunk-6W22TFYA.mjs.map +0 -1
  364. package/dist/chunk-AMRJ4B36.mjs +0 -2
  365. package/dist/chunk-AMRJ4B36.mjs.map +0 -1
  366. package/dist/chunk-DS2ZDVKU.mjs +0 -2
  367. package/dist/chunk-DS2ZDVKU.mjs.map +0 -1
  368. package/dist/chunk-ED43NYSE.cjs +0 -2
  369. package/dist/chunk-ED43NYSE.cjs.map +0 -1
  370. package/dist/chunk-EU4WFADK.cjs +0 -2
  371. package/dist/chunk-EU4WFADK.cjs.map +0 -1
  372. package/dist/chunk-HCTFDGXL.mjs +0 -2
  373. package/dist/chunk-HCTFDGXL.mjs.map +0 -1
  374. package/dist/chunk-IOSYBHKU.mjs +0 -2
  375. package/dist/chunk-IOSYBHKU.mjs.map +0 -1
  376. package/dist/chunk-JMKLDDKY.cjs +0 -2
  377. package/dist/chunk-JMKLDDKY.cjs.map +0 -1
  378. package/dist/chunk-KMKUXP2S.mjs +0 -3
  379. package/dist/chunk-KMKUXP2S.mjs.map +0 -1
  380. package/dist/chunk-OJXJ6CZ4.mjs +0 -4
  381. package/dist/chunk-OJXJ6CZ4.mjs.map +0 -1
  382. package/dist/chunk-PHIOKO3A.mjs +0 -2
  383. package/dist/chunk-PHIOKO3A.mjs.map +0 -1
  384. package/dist/chunk-QCK474XD.cjs +0 -2
  385. package/dist/chunk-QCK474XD.cjs.map +0 -1
  386. package/dist/chunk-REDXXUK7.cjs +0 -2
  387. package/dist/chunk-REDXXUK7.cjs.map +0 -1
  388. package/dist/chunk-S74ZMG2G.cjs +0 -2
  389. package/dist/chunk-S74ZMG2G.cjs.map +0 -1
  390. package/dist/chunk-TOAXF4YW.cjs +0 -2
  391. package/dist/chunk-TOAXF4YW.cjs.map +0 -1
  392. package/dist/chunk-UZ5CB33M.cjs +0 -2
  393. package/dist/chunk-UZ5CB33M.cjs.map +0 -1
  394. package/dist/chunk-VYWYJR63.mjs +0 -2
  395. package/dist/chunk-VYWYJR63.mjs.map +0 -1
  396. package/dist/chunk-XFPTQMAK.cjs +0 -4
  397. package/dist/chunk-XFPTQMAK.cjs.map +0 -1
  398. package/dist/chunk-YK4NINF5.mjs +0 -2
  399. package/dist/chunk-YK4NINF5.mjs.map +0 -1
  400. package/dist/contexts/index.cjs +0 -2
  401. package/dist/contexts/index.cjs.map +0 -1
  402. package/dist/contexts/index.mjs +0 -2
  403. package/dist/contexts/index.mjs.map +0 -1
  404. package/dist/enum/index.cjs +0 -2
  405. package/dist/enum/index.cjs.map +0 -1
  406. package/dist/enum/index.d.cts +0 -31
  407. package/dist/enum/index.d.ts +0 -31
  408. package/dist/enum/index.mjs +0 -2
  409. package/dist/enum/index.mjs.map +0 -1
  410. package/dist/errors/index.cjs +0 -2
  411. package/dist/errors/index.cjs.map +0 -1
  412. package/dist/errors/index.d.cts +0 -204
  413. package/dist/errors/index.d.ts +0 -204
  414. package/dist/errors/index.mjs +0 -2
  415. package/dist/errors/index.mjs.map +0 -1
  416. package/dist/hooks/index.cjs +0 -4
  417. package/dist/hooks/index.cjs.map +0 -1
  418. package/dist/hooks/index.mjs +0 -4
  419. package/dist/hooks/index.mjs.map +0 -1
  420. package/dist/staking-F9Nx9TKD.d.ts +0 -246
  421. package/dist/staking-f4BpYH7l.d.cts +0 -246
  422. package/dist/types/index.cjs +0 -2
  423. package/dist/types/index.cjs.map +0 -1
  424. package/dist/types/index.d.cts +0 -56
  425. package/dist/types/index.d.ts +0 -56
  426. package/dist/types/index.mjs +0 -2
  427. package/dist/types/index.mjs.map +0 -1
  428. package/dist/utils/index.cjs +0 -2
  429. package/dist/utils/index.cjs.map +0 -1
  430. package/dist/utils/index.mjs +0 -2
  431. package/dist/utils/index.mjs.map +0 -1
  432. package/src/actions/dex/getTransactionCount.ts +0 -29
  433. package/src/actions/enso/bend.ts +0 -143
  434. package/src/actions/enso/getEnsoUserToken.debug.test.ts +0 -57
  435. package/src/contexts/berajsProvider/context.tsx +0 -49
  436. package/src/contexts/berajsProvider/index.ts +0 -2
  437. package/src/contexts/berajsProvider/useBeraJs.ts +0 -18
  438. package/src/hooks/dex/usePollVaultIsPaused.ts +0 -30
  439. package/src/hooks/enso/useBendTransactionRequests.ts +0 -247
  440. package/src/hooks/enso/useEnsoZap.ts +0 -166
  441. package/src/hooks/enso/useZapTransactionRequests.ts +0 -81
  442. package/src/hooks/pol/useEarnedStakedBeraVault.ts +0 -59
  443. package/src/hooks/pol/useStakedBeraSnapshots.ts +0 -27
  444. package/src/hooks/validators/validatorRoleManager.ts +0 -0
  445. package/src/types/index.ts +0 -8
  446. package/src/types/staking.ts +0 -7
  447. package/src/utils/formatAggregatorsQuotes.ts +0 -57
  448. package/src/utils/formatAggregatorsQuotes.unit.test.ts +0 -191
  449. package/src/utils/sentryBeforeSend.ts +0 -52
  450. /package/dist/{abi/index.mjs.map → errors/exports.mjs.map} +0 -0
  451. /package/dist/{actions/index.mjs.map → types/exports.mjs.map} +0 -0
  452. /package/src/actions/dex/{__tests__ → aggregators}/haiku.integration.test.ts +0 -0
  453. /package/src/types/{bribe-boost.ts → bribe-boost.d.ts} +0 -0
@@ -1,33 +1,35 @@
1
- import { V as ValidatorRewardAllocation } from '../getValidatorQueuedOperatorAddress-Ne2zoiiV.js';
2
- export { f as GetBgtAprSimulationArgs, h as GetBgtAprSimulationResult, G as GetConvertToAssetsProps, s as GetGaugeData, c as GetHoneyVaultsBalanceResponse, m as GetMarkets, q as GetRewardVaultRewardsReturn, u as GetStakedBeraSnapshotsArgs, x as GetUserVaultsResponse, z as GetVaultHistoryArgs, k as GlobalData, I as IsBadCollateralArgs, e as IsBadCollateralResponse, O as OnChainPool, P as PoolStatus, p as RewardVaultDistributionMode, R as RewardVaultIncentive, S as StakedBeraWithdrawal, D as UserBoostsOnValidator, F as UserStakingPoolPosition, U as UserVault, J as ValidatorQueuedCommission, L as ValidatorQueuedOperatorAddress, N as ValidatorRewardAllocationRaw, Q as ValidatorRewardAllocationUpdate, T as ValidatorRewardAllocationUpdateWithExpiration, B as ValidatorWithUserBoost, W as formatValidatorRewardAllocation, j as getBgtAprSimulation, g as getConvertToAssets, l as getGlobalData, d as getHoneyVaultsBalance, n as getMarkets, a as getOnChainPool, b as getPoolPausedState, o as getRewardVaultIncentives, r as getRewardVaultRewards, t as getRewardVaults, w as getSWBeraWithdrawal, v as getStakedBeraSnapshots, C as getUserActiveValidators, E as getUserBoostsOnValidator, H as getUserStakingPositions, y as getUserVaults, K as getValidatorQueuedCommission, M as getValidatorQueuedOperatorAddress, Y as getValidatorRewardAllocation, A as getVaultHistory, i as isBadCollateralAsset, X as isSameRewardAllocation } from '../getValidatorQueuedOperatorAddress-Ne2zoiiV.js';
1
+ import { V as ValidatorRewardAllocation } from '../getValidatorQueuedOperatorAddress-BX35p2Lv.js';
2
+ export { B as BaseAggregator, f as GetBgtAprSimulationArgs, h as GetBgtAprSimulationResult, G as GetConvertToAssetsProps, s as GetGaugeData, c as GetHoneyVaultsBalanceResponse, m as GetMarkets, q as GetRewardVaultRewardsReturn, x as GetUserVaultsResponse, z as GetVaultHistoryArgs, k as GlobalData, I as IsBadCollateralArgs, e as IsBadCollateralResponse, O as OnChainPool, P as PoolStatus, p as RewardVaultDistributionMode, R as RewardVaultIncentive, S as StakedBeraWithdrawal, E as UserBoostsOnValidator, H as UserStakingPoolPosition, U as UserVault, K as ValidatorQueuedCommission, M as ValidatorQueuedOperatorAddress, Q as ValidatorRewardAllocationRaw, T as ValidatorRewardAllocationUpdate, W as ValidatorRewardAllocationUpdateWithExpiration, C as ValidatorWithUserBoost, u as VaultMetadata, X as formatValidatorRewardAllocation, j as getBgtAprSimulation, g as getConvertToAssets, l as getGlobalData, d as getHoneyVaultsBalance, n as getMarkets, a as getOnChainPool, b as getPoolPausedState, o as getRewardVaultIncentives, r as getRewardVaultRewards, t as getRewardVaults, v as getSWBeraVaultMetadata, w as getSWBeraWithdrawal, D as getUserActiveValidators, F as getUserBoostsOnValidator, J as getUserStakingPositions, y as getUserVaults, L as getValidatorQueuedCommission, N as getValidatorQueuedOperatorAddress, Z as getValidatorRewardAllocation, A as getVaultHistory, i as isBadCollateralAsset, Y as isSameRewardAllocation } from '../getValidatorQueuedOperatorAddress-BX35p2Lv.js';
3
3
  import { Address, PublicClient, AbiParameter, AbiFunction, TransactionReceipt, Abi, ContractFunctionArgs, ContractFunctionName, WalletCallReceipt } from 'viem';
4
4
  import { ApolloClient, OperationVariables, FetchPolicy } from '@apollo/client';
5
5
  export { gql } from '@apollo/client';
6
- import { ChainId, BeraConfig } from '@berachain/config/internal';
7
- import { A as Aggregators, i as IAggregatorArgs, I as IRawAggregatorQuote, a as Token, P as PythLatestUpdates, b as TokenWithMetadata, T as TokenWithOrder, j as PythPriceFeedMap, k as TokenCurrentPriceMap, l as AllowanceToken, M as MinimalERC20, B as BalanceToken, m as IContractWrite } from '../HoneyConfigProvider-CwDFrt02.js';
8
- export { C as CollateralRates, o as CollateralRatesArgs, n as HoneyFeeMap, r as HoneyPreviewArgs, q as HoneyPreviewMethod, t as HoneyPreviewReadResult, s as HoneyPreviewResult, p as getHoneyFees, v as getHoneyPreview, w as getPythLatestPrices } from '../HoneyConfigProvider-CwDFrt02.js';
6
+ import { EnsoClient } from '@ensofinance/sdk';
9
7
  import { PoolState } from '@berachain-foundation/berancer-sdk';
10
8
  export { BalancerApi } from '@berachain-foundation/berancer-sdk';
11
9
  import * as _berachain_graphql_dex_api from '@berachain/graphql/dex/api';
12
10
  import { GetPoolsQueryVariables, GetGlobalLiquidityAndSwapVolumeQuery, GetPoolEventsQuery, GqlChain, PoolHistoricalDataFragment, MinimalPoolFragment } from '@berachain/graphql/dex/api';
13
- import { GqlPoolEventType, GqlChain as GqlChain$1, ApiVaultFragment, ApiValidatorFragment, GetValidatorsQueryVariables, GetValidatorsQuery, ApiRewardAllocationWeightFragment, GetValidatorQuery, ApiValidatorMinimalFragment } from '@berachain/graphql/pol/api';
14
- import { a as ProposalErrorCodes, b as ProposalState, C as CustomProposal, G as GovernanceTopic, c as CustomProposalErrors, B as BribeBoostRewardProof, d as BribeBoostRewardItem, U as UserVaultInfo } from '../staking-F9Nx9TKD.js';
11
+ import { GqlPoolEventType, GqlChain as GqlChain$1, ApiVaultFragment, GqlVaultSnapshotDataRange, GetSWberaVaultSnapshotsQuery, ApiValidatorFragment, GetValidatorsQueryVariables, GetValidatorsQuery, ApiRewardAllocationWeightFragment, GetValidatorQuery, ApiValidatorMinimalFragment } from '@berachain/graphql/pol/api';
12
+ import { a as ProposalErrorCodes, P as ProposalState } from '../contracts-CQIPk0Jc.js';
15
13
  import { ProposalStatus, ProposalSelectionFragment, Proposal_Filter, Proposal_OrderBy, OrderDirection, ProposalWithVotesFragment, GetProposalVotesQueryVariables, GetProposalVotesQuery } from '@berachain/graphql/governance';
16
- import { GetPublicClientReturnType } from '@wagmi/core';
14
+ import { C as CustomProposal, G as GovernanceTopic, a as CustomProposalErrors, S as StakingConfig, B as BribeBoostRewardProof, b as BribeBoostRewardItem, U as UserVaultInfo, I as IContractWrite } from '../global.d-By70bEv2.js';
17
15
  import graymatter from 'gray-matter';
18
16
  import { GetChartDataQuery, GetGlobalDataQuery } from '@berachain/graphql/honey';
17
+ import { b as Token, P as PythLatestUpdates, a as TokenWithMetadata, T as TokenWithOrder, h as PythPriceFeedMap, i as TokenCurrentPriceMap, A as AllowanceQueryItem, j as AllowanceToken, M as MinimalERC20, B as BalanceToken } from '../HoneyConfigProvider-CK6mOKFH.js';
18
+ export { C as CollateralRates, l as CollateralRatesArgs, k as HoneyFeeMap, o as HoneyPreviewArgs, n as HoneyPreviewMethod, q as HoneyPreviewReadResult, p as HoneyPreviewResult, m as getHoneyFees, r as getHoneyPreview, s as getPythLatestPrices } from '../HoneyConfigProvider-CK6mOKFH.js';
19
19
  import { EdgeConfigSchema } from '@berachain/config/internal/edge-config';
20
20
  import { p as pythWrapperAbi, h as honeyFactoryAbi } from '../pythWrapper-CBjsmmsK.js';
21
- import { I as IHoneySwapState } from '../useHoneySwapState-CUY5Sm1b.js';
21
+ import { I as IHoneySwapState } from '../useHoneySwapState-D1DKG_Of.js';
22
22
  import { Address as Address$1 } from '@berachain/config';
23
+ import { Config } from '@wagmi/core';
23
24
  import { GetValidatorBlockStatsQuery, GetValidatorByAccountQuery, GetValidatorAnalyticsQuery } from '@berachain/graphql/pol/subgraph';
25
+ import '@berachain/config/internal';
26
+ import '../dex-C_BB0b0O.js';
27
+ import 'swr';
28
+ import '../txnEnum-BYNbCxla.js';
29
+ import '../BeraError-_mQdkanr.js';
24
30
  import 'react/jsx-runtime';
25
31
  import 'react';
26
- import '../aggregatorsRouter-Cny4B_MB.js';
27
- import 'swr';
28
- import '../txnEnum-BQKDfaeH.js';
29
- import '../BeraError-D1HS_rbb.js';
30
- import '@sentry/nextjs';
32
+ import '../honey-CYm0RWf4.js';
31
33
 
32
34
  interface GetMaxDepositProps {
33
35
  vaultAddress: Address;
@@ -60,60 +62,9 @@ declare class BeraApolloClient extends ApolloClient {
60
62
  type GraphqlClient = "honey.subgraph" | "pol.subgraph" | "governance.subgraph" | "blocks.subgraph" | "bex.subgraph" | "api" | "bend.whisk";
61
63
  declare function getApolloClient(clientName: GraphqlClient, { ...args }: BeraJS.BaseFunctionArgs): BeraApolloClient;
62
64
 
63
- declare abstract class BaseAggregator {
64
- abstract name: Aggregators;
65
- abstract supportedChains: ChainId[];
66
- static PATH_NOT_FOUND_REASON: string;
67
- notFoundMessages: string[];
68
- config: BeraConfig;
69
- chainId: ChainId;
70
- constructor(args?: BeraJS.BaseFunctionArgs);
71
- /**
72
- * Identifies the url of the last sent request. Might not have all query params.
73
- * Mainly used for error reporting.
74
- */
75
- url: string;
76
- abstract readonly type: "rest" | "graphql" | "rpc";
77
- abstract getQuote(args: IAggregatorArgs): Promise<IRawAggregatorQuote | undefined> | Promise<IRawAggregatorQuote<false> | undefined>;
78
- /**
79
- * return wbera for native tokens to accomodate the aggregator's router logic
80
- */
81
- protected parseAddresses(tokenIn: string, tokenOut: string): {
82
- tokenInAddress: Address;
83
- tokenOutAddress: Address;
84
- isTokenInNative: boolean;
85
- isTokenOutNative: boolean;
86
- };
87
- /**
88
- * Calculate input amount after fees
89
- */
90
- protected getAmountAfterFees(amount: string, aggregatorsFeeBps?: number): string;
91
- /**
92
- * Formats input data for aggregator swaps
93
- */
94
- protected getInputData({ tokenIn, amountIn, isNative, isPermit2Approval, permit2SpenderAddress, }: {
95
- tokenIn: Address;
96
- amountIn: string;
97
- isNative: boolean;
98
- isPermit2Approval?: boolean;
99
- permit2SpenderAddress?: Address;
100
- }): {
101
- tokenIn: `0x${string}`;
102
- amountIn: bigint;
103
- isNative: boolean;
104
- isPermit2Approval: boolean;
105
- permit2SpenderAddress: `0x${string}`;
106
- };
107
- /**
108
- * Calculate min amount out
109
- */
110
- protected getMinAmountOut(amountOut: string, slippage: number): bigint;
111
- /**
112
- * Check if chain is supported
113
- */
114
- protected checkChainSupport(): void;
115
- protected fetch(url: string | URL, options?: RequestInit): Promise<Response>;
116
- }
65
+ declare function getEnsoClient({ useProxy, ...args }?: BeraJS.BaseFunctionArgs & {
66
+ useProxy?: boolean;
67
+ }): EnsoClient;
117
68
 
118
69
  declare function getAllPools({ textSearch, chain, first, orderBy, orderDirection, skip, fetchPolicy, userAddress, blacklistedPoolIds, ...args }?: Partial<GetPoolsQueryVariables & {
119
70
  fetchPolicy: FetchPolicy;
@@ -688,11 +639,11 @@ declare function getDecodedFunctionData({ address, callData, chainId, publicClie
688
639
 
689
640
  declare function getProposalDetails({ proposalId, ...args }: BeraJS.BaseFunctionArgs & {
690
641
  proposalId: string;
691
- client?: GetPublicClientReturnType;
642
+ client?: PublicClient;
692
643
  }): Promise<ProposalWithVotesFragment | undefined>;
693
644
 
694
645
  declare function getProposalFromTx(args: {
695
- publicClient: PublicClient | GetPublicClientReturnType;
646
+ publicClient: PublicClient | undefined;
696
647
  } & ({
697
648
  tx: TransactionReceipt;
698
649
  } | {
@@ -829,16 +780,17 @@ interface GetSwapPayloadReturn {
829
780
  abi: Abi;
830
781
  functionName: "mint" | "redeem";
831
782
  params: ContractFunctionArgs<typeof pythWrapperAbi, "payable", "mint" | "redeem"> | ContractFunctionArgs<typeof honeyFactoryAbi, "nonpayable", "mint" | "redeem">;
832
- value?: bigint;
783
+ value: bigint;
833
784
  }
834
- declare const getSwapPayload: ({ state, account, publicClient, priceFeedMap, collateralList, isPythWrapperEnabled, ...args }: BeraJS.BaseFunctionArgs & {
785
+ declare const getSwapPayload: ({ state, publicClient, priceFeedMap, collateralList, isPythWrapperEnabled, ...args }: BeraJS.BaseFunctionArgs & {
835
786
  state: Pick<IHoneySwapState, "actionType" | "fromAmount" | "collaterals" | "isBasketModeEnabled">;
836
- account: Address | undefined;
837
787
  collateralList: TokenWithMetadata[];
838
788
  publicClient: PublicClient | undefined;
839
789
  priceFeedMap?: PythPriceFeedMap;
840
790
  isPythWrapperEnabled: boolean;
841
- }) => Promise<GetSwapPayloadReturn>;
791
+ }) => Promise<({ account }: {
792
+ account: Address;
793
+ }) => GetSwapPayloadReturn>;
842
794
 
843
795
  declare function isBasketModeEnabled({ client, isMint, collateralList, latestPrices, isPythWrapperEnabled, ...args }: {
844
796
  client: PublicClient;
@@ -866,11 +818,38 @@ declare function getBlockTime({ defaultBlockTime, blocksSpan, ...args }?: {
866
818
  blocksSpan?: number;
867
819
  } & BeraJS.BaseFunctionArgs): Promise<number>;
868
820
 
821
+ type StakingHistoryData = {
822
+ currentDepositRate: string;
823
+ earningsRealized: string;
824
+ earningsTotal: string;
825
+ };
826
+ type GetEarnedStakedBeraVaultArgs = {
827
+ /**
828
+ * The token that the user has staked
829
+ */
830
+ address: Address;
831
+ /**
832
+ * The account that the user has staked
833
+ */
834
+ account: Address;
835
+ };
836
+ declare function getEarnedStakedBeraVault({ address, account, ...args }: BeraJS.BaseFunctionArgs & GetEarnedStakedBeraVaultArgs): Promise<StakingHistoryData>;
837
+
869
838
  declare function getIncentiveFeeClaimStats({ ...args }: BeraJS.BaseFunctionArgs): Promise<{
870
839
  sumAllClaims: number;
871
840
  sumClaimsInLast24Hours: number;
872
841
  }>;
873
842
 
843
+ type GetLSTStakeConfigArgs = {
844
+ tokenList: TokenWithMetadata[];
845
+ publicClient?: PublicClient;
846
+ lstStakingVaults: Address[];
847
+ } & BeraJS.BaseFunctionArgs;
848
+ /**
849
+ * Builds staking configs from on-chain LST vaults and optional native configs.
850
+ */
851
+ declare function getLSTStakeConfig({ tokenList, publicClient, lstStakingVaults, ...args }: GetLSTStakeConfigArgs): Promise<StakingConfig[]>;
852
+
874
853
  declare function getRewardProofsByValidator({ account, validator, page, perPage, ...args }: {
875
854
  account: Address;
876
855
  validator: Address;
@@ -934,38 +913,32 @@ declare function getStakedBeraAPR({ window, ...args }: {
934
913
  window: "DAY" | "WEEK";
935
914
  } & BeraJS.BaseFunctionArgs): Promise<number>;
936
915
 
937
- declare function getStakeWithdrawalCooldown({ publicClient, ...args }: {
938
- publicClient: PublicClient;
939
- } & BeraJS.BaseFunctionArgs): Promise<number>;
940
-
941
- interface VaultMetadata {
942
- current: {
943
- exchangeRate: string;
944
- totalSupply: string;
945
- totalAssets: string;
946
- tvl: string;
947
- };
948
- previous: {
949
- exchangeRate: string;
950
- totalSupply: string;
951
- totalAssets: string;
952
- tvl: string;
953
- };
954
- totalWBeraIssued: string;
955
- lockPeriod?: number;
956
- totalBuyBacks: number;
957
- totalBuyBacksInLast24Hours: number;
958
- }
916
+ type GetStakedBeraSnapshotsArgs = {
917
+ chain?: GqlChain$1;
918
+ range?: GqlVaultSnapshotDataRange;
919
+ } & BeraJS.BaseFunctionArgs;
959
920
  /**
960
921
  *
961
- * @param address - The address of the vault
962
922
  * @throws {Error} If the vault is not found
963
923
  * @returns
964
924
  */
965
- declare function getSWBeraVaultMetadata({ address, publicClient, ...args }: {
925
+ declare function getStakedBeraSnapshots({ chain, range, ...args }?: GetStakedBeraSnapshotsArgs): Promise<GetSWberaVaultSnapshotsQuery["polGetSWberaVaultSnapshots"]>;
926
+
927
+ declare function getStakeWithdrawalCooldown({ publicClient, address, }: {
928
+ publicClient: PublicClient;
966
929
  address: Address;
930
+ }): Promise<number>;
931
+
932
+ /**
933
+ * Get the total staked amount for a given vault address
934
+ * @param vaultAddresses - The addresses of the vaults to get the total staked amount for
935
+ * @param publicClient - The public client to use to get the total staked amount
936
+ * @returns The total staked amount for the given vault addresses
937
+ */
938
+ declare function getTotalStakedAmount({ vaultAddresses, publicClient, }: {
939
+ vaultAddresses: Address$1[];
967
940
  publicClient?: PublicClient;
968
- } & BeraJS.BaseFunctionArgs): Promise<VaultMetadata>;
941
+ } & BeraJS.BaseFunctionArgs): Promise<Record<Address$1, bigint>>;
969
942
 
970
943
  /**
971
944
  * Server-side function to get user claimable incentives grouped by validator
@@ -1018,20 +991,20 @@ declare function getPythUpdateFee({ client, priceFeedId, ...args }: {
1018
991
  } & BeraJS.BaseFunctionArgs): Promise<bigint>;
1019
992
 
1020
993
  interface GetAllowances {
1021
- tokens: Token[] | undefined;
994
+ items: AllowanceQueryItem[] | undefined;
1022
995
  account: `0x${string}` | undefined;
1023
- spender: string | undefined;
1024
- publicClient: PublicClient | undefined;
996
+ config: Config | undefined;
1025
997
  }
1026
998
  type GetAllowancesResponse = AllowanceToken[] | undefined;
1027
- declare function getAllowances({ tokens, account, spender, publicClient, }: GetAllowances): Promise<GetAllowancesResponse>;
999
+ declare function getAllowances({ items: itemsList, account, config, }: GetAllowances): Promise<GetAllowancesResponse>;
1028
1000
 
1029
1001
  interface GetTokenInformation {
1030
1002
  address: Address;
1031
1003
  publicClient: PublicClient;
1004
+ chainId: number;
1032
1005
  }
1033
1006
  type GetTokenInformationResponse = MinimalERC20 | undefined;
1034
- declare function getTokenInformation({ address, publicClient, }: GetTokenInformation): Promise<GetTokenInformationResponse>;
1007
+ declare function getTokenInformation({ address, publicClient, chainId, }: GetTokenInformation): Promise<GetTokenInformationResponse>;
1035
1008
 
1036
1009
  declare function getTokens({ url, ...args }?: BeraJS.BaseFunctionArgs & {
1037
1010
  url?: string;
@@ -1040,7 +1013,7 @@ declare function getTokens({ url, ...args }?: BeraJS.BaseFunctionArgs & {
1040
1013
  interface GetWalletBalances {
1041
1014
  account: string | undefined;
1042
1015
  tokenList: Token[] | undefined;
1043
- publicClient: PublicClient | undefined;
1016
+ wagmiConfig: Config | undefined;
1044
1017
  }
1045
1018
  /**
1046
1019
  * Returns the payload for the balanceOf call for a given token and account.
@@ -1531,7 +1504,7 @@ declare function getBalanceCall({ token, account, multicallAddress, }: {
1531
1504
  /**
1532
1505
  * fetch the balances of a given wallet address
1533
1506
  */
1534
- declare function getWalletBalances({ account, tokenList, publicClient, }: GetWalletBalances): Promise<BalanceToken[] | undefined>;
1507
+ declare function getWalletBalances({ account, tokenList, wagmiConfig: config, }: GetWalletBalances): Promise<BalanceToken[] | undefined>;
1535
1508
 
1536
1509
  declare function isImpersonateAccount(chainId?: number): boolean;
1537
1510
  declare function beraWriteContract<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>(args: IContractWrite<abi, functionName, params> & {
@@ -1647,4 +1620,4 @@ declare function getValidatorBoostApy({ validator, bgtPrice, }: {
1647
1620
  bgtPrice: number;
1648
1621
  }): number;
1649
1622
 
1650
- export { type ActiveBoostAndCommissionChangeDelay, BaseAggregator, type GetAllowances, type GetAllowancesResponse, type GetTokenInformation, type GetTokenInformationResponse, type GetUserVaultInfoParams, type GetUserVaultsInfo, type GetWalletBalances, MOCKED_PROPOSAL_STATUSES, type PoolDayData, PythLatestUpdates, type RewardVaultDurationConstants, ValidatorRewardAllocation, type VaultMetadata, beraWriteContract, checkProposalField, computeActualStatus, getActiveBoostAndCommissionChangeDelay, getAllPools, getAllProposals, getAllValidators, getAllowances, getApiEnrichedAllocation, getApiPool, getApiValidator, getApolloClient, getBalanceCall, getBlockTime, getBlockTimestamp, getBodyErrors, getChartData, getCollateralWeights, getDailyValidatorBlockStats, getDecodedFunctionData, getDefaultRewardAllocation, getGlobalCapLimit, getGlobalLiquidityAndSwapVolume, getHoneyCollaterals, getHoneyGlobalData, getHoneyPausedState, getHoneyPythFeeds, getHoneyPythOracle, getHoneyRootPriceOracle, getIncentiveFeeClaimStats, getManagedValidatorByAccount, getMaxDeposit, getPoolEvents, getPoolHistoricalData, getPoolState, getProposalDetails, getProposalFromTx, getProposalVotes, getPythUpdateFee, getRelativeCapLimit, getRewardProofsByValidator, getRewardTokenToBeraRate, getRewardVault, getRewardVaultDurationConstants, getRewardVaultFromToken, getRewardVaultStakingToken, getSWBeraVaultMetadata, getStakeWithdrawalCooldown, getStakedBeraAPR, getStakingPoolBatch, getSubgraphPool, getSwapPayload, getTokenCurrentPrices, getTokenInformation, getTokens, getUserClaimableIncentives, getUserVaultInfo, getUserVaultsReward, getValidatorAnalytics, getValidatorBoostApy, getValidatorCommission, getValidatorEstimatedBgtPerYear, getValidatorOperatorAddress, getValidatorQueuedRewardAllocation, getValidatorReturnPerBgt, getVaultPausedState, getVaultValidators, getWalletBalances, isBasketModeEnabled, isDefaultRewardAllocation, isImpersonateAccount, parseProposalBody };
1623
+ export { type ActiveBoostAndCommissionChangeDelay, BeraApolloClient, type GetAllowances, type GetAllowancesResponse, type GetLSTStakeConfigArgs, type GetStakedBeraSnapshotsArgs, type GetTokenInformation, type GetTokenInformationResponse, type GetUserVaultInfoParams, type GetUserVaultsInfo, type GetWalletBalances, MOCKED_PROPOSAL_STATUSES, type PoolDayData, PythLatestUpdates, type RewardVaultDurationConstants, ValidatorRewardAllocation, beraWriteContract, checkProposalField, computeActualStatus, getActiveBoostAndCommissionChangeDelay, getAllPools, getAllProposals, getAllValidators, getAllowances, getApiEnrichedAllocation, getApiPool, getApiValidator, getApolloClient, getBalanceCall, getBlockTime, getBlockTimestamp, getBodyErrors, getChartData, getCollateralWeights, getDailyValidatorBlockStats, getDecodedFunctionData, getDefaultRewardAllocation, getEarnedStakedBeraVault, getEnsoClient, getGlobalCapLimit, getGlobalLiquidityAndSwapVolume, getHoneyCollaterals, getHoneyGlobalData, getHoneyPausedState, getHoneyPythFeeds, getHoneyPythOracle, getHoneyRootPriceOracle, getIncentiveFeeClaimStats, getLSTStakeConfig, getManagedValidatorByAccount, getMaxDeposit, getPoolEvents, getPoolHistoricalData, getPoolState, getProposalDetails, getProposalFromTx, getProposalVotes, getPythUpdateFee, getRelativeCapLimit, getRewardProofsByValidator, getRewardTokenToBeraRate, getRewardVault, getRewardVaultDurationConstants, getRewardVaultFromToken, getRewardVaultStakingToken, getStakeWithdrawalCooldown, getStakedBeraAPR, getStakedBeraSnapshots, getStakingPoolBatch, getSubgraphPool, getSwapPayload, getTokenCurrentPrices, getTokenInformation, getTokens, getTotalStakedAmount, getUserClaimableIncentives, getUserVaultInfo, getUserVaultsReward, getValidatorAnalytics, getValidatorBoostApy, getValidatorCommission, getValidatorEstimatedBgtPerYear, getValidatorOperatorAddress, getValidatorQueuedRewardAllocation, getValidatorReturnPerBgt, getVaultPausedState, getVaultValidators, getWalletBalances, isBasketModeEnabled, isDefaultRewardAllocation, isImpersonateAccount, parseProposalBody };
@@ -0,0 +1,2 @@
1
+ import{a as w,b as B,c as k,d as N}from"../chunk-F4BKSBEM.mjs";import{$ as Ze,A as ke,Aa as St,B as Ne,Ba as Dt,C as Se,Ca as Ft,D as De,Da as Tt,E as Fe,Ea as Rt,F as Te,Fa as vt,G as Re,Ga as It,H as ve,Ha as Mt,I as Ie,Ia as Vt,J as Me,K as Ve,L as Oe,M as We,N as Je,O as Ge,P as _e,Q as He,R as Ee,S as $e,T as qe,U as Le,V as Ue,W as Qe,X as ze,Y as Xe,Z as je,_ as Ke,a as te,aa as Ye,b as J,ba as et,c as h,ca as tt,d as G,da as rt,e as oe,ea as ot,f as ae,fa as at,g as ne,ga as nt,h as ie,ha as it,i as se,ia as st,j as me,ja as mt,k as pe,ka as pt,l as de,la as dt,m as ce,ma as lt,n as ue,na as ft,o as le,oa as yt,p as fe,pa as bt,q as ye,qa as xt,r as be,ra as gt,s as xe,sa as At,t as ge,ta as ht,u as Ae,ua as Ct,v as he,va as Pt,w as Ce,wa as wt,x as Pe,xa as Bt,y as we,ya as kt,z as Be,za as Nt}from"../chunk-G6NA6NSM.mjs";import{a as C,b as P,e as l,i as u,j as A,k as f,l as y}from"../chunk-Q3SCM6WL.mjs";import{a as re,b as ct,c as ut}from"../chunk-ZQRACIGR.mjs";import"../chunk-NAXAZJJY.mjs";import"../chunk-OGJMSGB2.mjs";import"../chunk-7GWTHOLO.mjs";import{b as F,c as b,d as T}from"../chunk-MTS5SZLA.mjs";import{c as S,k as R,p as v}from"../chunk-TJWKS54T.mjs";import{a as m,e as D}from"../chunk-YQGZMWDT.mjs";import"../chunk-C3G5KXCH.mjs";import{formatEther as _}from"viem";async function Jt({vaultAddress:e,publicClient:t}){let r=await t.readContract({address:e,abi:C,functionName:"maxDeposit",args:[e]});return _(r)}import{mapPoolType as H}from"@berachain-foundation/berancer-sdk";var Ht=e=>({type:H(e.type),protocolVersion:e.protocolVersion,tokens:e.tokens.map(t=>({...t,address:t.address})),id:e.id,address:e.address});async function Lt({publicClient:e,...t}){let{config:r}=m(t);return(await e.readContract({address:r.bex.vault,abi:P,functionName:"getPausedState"}))[0]}import{decodeFunctionData as M,erc20Abi as E,pad as $,toFunctionSignature as q,trim as I}from"viem";import{appConfig as L,defaultChainId as U}from"@berachain/config/internal";function Q(e){return e.some(t=>t.name==="implementation"||t.name==="proxyType"||t.type==="constructor"&&t.inputs?.[0]?.name==="implementation")}async function V({contractAddress:e,chainId:t,publicClient:r}){let o=`https://api.etherscan.io/v2/api?module=contract&action=getabi&address=${e}&apikey=${L.apiKeys.private.etherscan}&chainId=${t}`,a=await fetch(o);if(!a.ok)throw new Error(`Failed to fetch ABI: ${a.statusText}`);let n=await a.json();if(n.status==="0")throw new Error(n.result);let p=JSON.parse(n.result);if(!Q(p))return p;let i=await r.getStorageAt({address:e,slot:"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc"});if(!i||I(i)==="0x00")return p;let s=$(I(i),{size:20});return V({contractAddress:s,chainId:t,publicClient:r})}async function z({address:e,callData:t,knownAbi:r,chainId:o,publicClient:a}){try{if(M({data:t,abi:r}))return r}catch{}try{return await V({contractAddress:e,chainId:o,publicClient:a})}catch{}}function X(e,t){try{return M({data:e,abi:t})}catch{return}}function j(e,t){return e.find(r=>r.type==="function"&&r.name===t)}function K(e){if(e)try{return q(e)}catch(t){console.error(t)}}async function Kt({address:e,callData:t,chainId:r=U,publicClient:o}){let a=[...u,...f,...E],n=await z({address:e,callData:t,knownAbi:a,chainId:r,publicClient:o}),p=X(t,n);if(!n||!p)return{args:[]};let i=j(n,p.functionName),s=K(i);return{abiItem:i,functionSignature:s,functionName:p.functionName,args:p.args}}import{formatUnits as x}from"viem";async function rr({client:e,collateralList:t,...r}){let{config:o}=m(r);try{let a={mint:[],redeem:[]};for(let s of t)a.mint.push(e.readContract({address:o.honey.factory,abi:l,functionName:"mintRates",args:[s.address]})),a.redeem.push(e.readContract({address:o.honey.factory,abi:l,functionName:"redeemRates",args:[s.address]}));let[n,p,i]=await Promise.all([Promise.all(a.mint),Promise.all(a.redeem),e.readContract({address:o.honey.factory,abi:l,functionName:"getWeights"})]);return t.reduce((s,d)=>{let c=t.indexOf(d);return s.single[d.address]={mintFee:1-+x(n[c],18),redeemFee:1-+x(p[c],18)},s.basket.mintFee+=s.single[d.address].mintFee*+x(i[c],18),s.basket.redeemFee+=s.single[d.address].redeemFee*+x(i[c],18),s},{single:{},basket:{mintFee:0,redeemFee:0}})}catch(a){throw console.log(a),a}}async function ir({client:e,...t}){let{config:r}=m(t),o=r.honey.token;return await e.readContract({address:o,abi:w,functionName:"paused"})}async function pr({pythOracle:e,publicClient:t}){return await t.readContract({address:e,abi:B,functionName:"pythOracle"})}async function lr({publicClient:e,factory:t,...r}){let{config:o}=m(r);return await e.readContract({address:t??o.honey.factory,abi:l,functionName:"priceOracle"})}import{GetBlocksTimeStamp as Z}from"@berachain/graphql/chain";async function Ar({defaultBlockTime:e,blocksSpan:t,...r}={}){let{config:o}=m(r),a=h("blocks.subgraph",r),n=e??o.averageBlockTime,p=t??Math.floor(v(1)/n),s=(await a.query({query:Z,variables:{skip:p}})).data;return(R(Date.now())-Number(s?.oldest[0]?.timestamp))/(Number(s?.newest[0]?.number)-Number(s?.oldest[0]?.number))}async function kr({tokenList:e,publicClient:t,lstStakingVaults:r,...o}){b(t);let{config:a}=m({...o,chainId:t.chain?.id??o.chainId}),n=e.filter(i=>r.includes(i.address));return n.length===0?[]:(await Promise.all(n.map(async i=>({assetTokenAddress:await t.readContract({address:i.address,abi:N,functionName:"asset"}),stakingToken:i})))).reduce((i,{assetTokenAddress:s,stakingToken:d})=>{let c=e.find(g=>D(g,s));return c&&i.push({id:d.address,receiptToken:d,inputTokens:[c]}),i},[])}var O=[{inputs:[{internalType:"address",name:"initialOwner",type:"address"},{internalType:"address",name:"initialImplementation",type:"address"}],stateMutability:"payable",type:"constructor"},{inputs:[],name:"NewImplementationHasNoCode",type:"error"},{inputs:[],name:"NewOwnerIsZeroAddress",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"oldOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{inputs:[],name:"implementation",outputs:[{internalType:"address",name:"result",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"result",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"}],name:"upgradeTo",outputs:[],stateMutability:"nonpayable",type:"function"}];async function W({publicClient:e,...t}){let{config:r}=m(t),o=r.pol.factory;F(e,"publicClient"),T(r.pol.factory,"factoryAddress");let a=await e.readContract({address:o,abi:y,functionName:"beacon"});return await e.readContract({address:a,abi:O,functionName:"implementation"})}async function Or({publicClient:e,...t}){b(e);let r=await W({publicClient:e,...t}),[o,a]=await Promise.all([e.readContract({address:r,abi:f,functionName:"MIN_REWARD_DURATION"}),e.readContract({address:r,abi:f,functionName:"MAX_REWARD_DURATION"})]);return{minRewardDuration:Number(o),maxRewardDuration:Number(a)}}import{zeroAddress as Y}from"viem";async function Hr({tokenAddress:e,publicClient:t,factoryAddress:r,...o}){let{config:a}=m(o),n=await t.readContract({address:r??a.pol.factory,abi:y,functionName:"getVault",args:[e]});return n===Y?null:n}async function Lr({tokenList:e,publicClient:t,...r}){let{config:o}=m(r);try{let a=await Promise.all(e.map(n=>t.readContract({address:o.honey.pythOracle,abi:k,functionName:"feeds",args:[n]})));return e.reduce((n,p,i)=>({...n,[p]:a[i]}),{})}catch(a){throw console.error("getPythPriceFeedId",a),a}}async function Xr({url:e,...t}={}){let{config:r}=m(t);return(await S({url:e??r.lists.tokenList,type:"rest",name:"GitHub"})).tokens??[]}async function eo({publicClient:e,ui:t,...r}){let{config:o}=m(r),[a,n,p,i,s,d,c,g]=await Promise.all([e.readContract({address:o.pol.beraChef,abi:u,functionName:"MAX_COMMISSION_RATE"}),e.readContract({address:o.pol.beraChef,abi:u,functionName:"commissionChangeDelay"}),e.readContract({address:o.pol.beraChef,abi:u,functionName:"rewardAllocationBlockDelay"}),e.readContract({address:o.pol.beraChef,abi:u,functionName:"maxWeightPerVault"}),e.readContract({address:o.pol.beraChef,abi:u,functionName:"maxNumWeightsPerRewardAllocation"}),e.readContract({address:o.tokens.bgt,abi:A,functionName:"dropBoostDelay"}),e.readContract({address:o.tokens.bgt,abi:A,functionName:"activateBoostDelay"}),e.readContract({address:o.pol.beraChef,abi:u,functionName:"rewardAllocationInactivityBlockSpan"})]);return{maxCommissionRate:Number(a)/1e4,boostDelay:Number(c),unboostDelay:Number(d),commissionChangeDelay:Number(n),rewardAllocationBlockDelay:Number(p),maxWeightPerVault:Number(i)/1e4,maxNumWeightsPerRewardAllocation:Number(s),rewardAllocationInactivityBlockSpan:Number(g),ui:t}}function ee(e){return e?.rewardAllocationWeights?.reduce((t,r)=>{if(!r)return t;let o=r.receivingVault?.activeIncentives.filter(a=>Number(a.remainingAmount)>0).reduce((a,n)=>{let p=Number(n.remainingAmountUsd)/Number(n.remainingAmount);return a+Number(n.incentiveRate)*p},0)??0;return t+o*r.percentage},0)}function ro({validator:e,bgtPrice:t}){let r=Number(e.dynamicData?.activeBoostAmount??0),o=ee(e);return!o||!r?0:o*Number(e.dynamicData?.lastDayDistributedBGTAmount??0)*365/(r*t)}export{ae as BalancerApi,oe as BaseAggregator,J as BeraApolloClient,Fe as HoneyPreviewMethod,fe as MOCKED_PROPOSAL_STATUSES,Je as RewardVaultDistributionMode,ft as beraWriteContract,le as checkProposalField,ye as computeActualStatus,At as formatValidatorRewardAllocation,eo as getActiveBoostAndCommissionChangeDelay,ne as getAllPools,be as getAllProposals,yt as getAllValidators,dt as getAllowances,bt as getApiEnrichedAllocation,ie as getApiPool,xt as getApiValidator,h as getApolloClient,ct as getBalanceCall,_e as getBgtAprSimulation,Ar as getBlockTime,We as getBlockTimestamp,xe as getBodyErrors,Pe as getChartData,we as getCollateralWeights,te as getConvertToAssets,gt as getDailyValidatorBlockStats,Kt as getDecodedFunctionData,wt as getDefaultRewardAllocation,He as getEarnedStakedBeraVault,re as getEnsoClient,Se as getGlobalCapLimit,$e as getGlobalData,se as getGlobalLiquidityAndSwapVolume,ke as getHoneyCollaterals,rr as getHoneyFees,De as getHoneyGlobalData,ir as getHoneyPausedState,Te as getHoneyPreview,Lr as getHoneyPythFeeds,pr as getHoneyPythOracle,lr as getHoneyRootPriceOracle,Re as getHoneyVaultsBalance,qe as getIncentiveFeeClaimStats,kr as getLSTStakeConfig,Bt as getManagedValidatorByAccount,Le as getMarkets,Jt as getMaxDeposit,pe as getOnChainPool,de as getPoolEvents,ce as getPoolHistoricalData,me as getPoolPausedState,Ht as getPoolState,ge as getProposalDetails,he as getProposalFromTx,Ce as getProposalVotes,ve as getPythLatestPrices,Me as getPythUpdateFee,Ie as getRelativeCapLimit,Ue as getRewardProofsByValidator,Qe as getRewardTokenToBeraRate,ze as getRewardVault,Or as getRewardVaultDurationConstants,Hr as getRewardVaultFromToken,Xe as getRewardVaultIncentives,Ge as getRewardVaultRewards,je as getRewardVaultStakingToken,Ee as getRewardVaults,et as getSWBeraVaultMetadata,tt as getSWBeraWithdrawal,Ye as getStakeWithdrawalCooldown,Ke as getStakedBeraAPR,Ze as getStakedBeraSnapshots,kt as getStakingPoolBatch,ue as getSubgraphPool,Ve as getSwapPayload,pt as getTokenCurrentPrices,Be as getTokenInformation,Xr as getTokens,rt as getTotalStakedAmount,St as getUserActiveValidators,Nt as getUserBoostsOnValidator,ot as getUserClaimableIncentives,Dt as getUserStakingPositions,nt as getUserVaultInfo,it as getUserVaults,at as getUserVaultsReward,Ft as getValidatorAnalytics,ro as getValidatorBoostApy,Tt as getValidatorCommission,Rt as getValidatorEstimatedBgtPerYear,vt as getValidatorOperatorAddress,It as getValidatorQueuedCommission,Mt as getValidatorQueuedOperatorAddress,Vt as getValidatorQueuedRewardAllocation,ee as getValidatorReturnPerBgt,Ct as getValidatorRewardAllocation,st as getVaultHistory,Lt as getVaultPausedState,mt as getVaultValidators,ut as getWalletBalances,G as gql,Ne as isBadCollateralAsset,Oe as isBasketModeEnabled,Pt as isDefaultRewardAllocation,lt as isImpersonateAccount,ht as isSameRewardAllocation,Ae as parseProposalBody};
2
+ //# sourceMappingURL=exports.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/actions/bend/getMaxDeposit.ts","../../src/actions/dex/getPoolWithState.ts","../../src/actions/dex/getVaultPausedState.ts","../../src/actions/governance/getDecodedFunctionData.ts","../../src/actions/honey/getHoneyFees.ts","../../src/actions/honey/getHoneyPausedState.ts","../../src/actions/honey/getHoneyPythPriceOracle.ts","../../src/actions/honey/getHoneyRootPriceOracle.ts","../../src/actions/pol/getBlockTime.ts","../../src/actions/pol/getLSTStakeConfig.ts","../../src/abi/utils/upgradableBeacon.ts","../../src/actions/pol/getRewardVaultBeaconImplementation.ts","../../src/actions/pol/getRewardVaultDurationConstants.ts","../../src/actions/pol/getRewardVaultFromToken.ts","../../src/actions/pyth/getHoneyPythFeeds.ts","../../src/actions/tokens/getTokens.ts","../../src/actions/validators/getActiveBoostAndCommissionChangeDelay.ts","../../src/actions/validators/utils/getValidatorBoostApy.ts"],"sourcesContent":["import { type Address, formatEther, type PublicClient } from \"viem\";\n\nimport { metaMorphoAbi } from \"~/abi/bend/metaMorpho\";\n\ninterface GetMaxDepositProps {\n vaultAddress: Address;\n publicClient: PublicClient;\n}\n\nexport async function getMaxDeposit({\n vaultAddress,\n publicClient,\n}: GetMaxDepositProps): Promise<string> {\n const maxDeposit = await publicClient.readContract({\n address: vaultAddress,\n abi: metaMorphoAbi,\n functionName: \"maxDeposit\",\n args: [vaultAddress],\n });\n return formatEther(maxDeposit);\n}\n","import {\n type MinimalToken,\n mapPoolType,\n type PoolState,\n} from \"@berachain-foundation/berancer-sdk\";\nimport type { Address } from \"viem\";\n\nimport type { MinimalPoolFragment } from \"@berachain/graphql/dex/api\";\n\nexport const getPoolState = (apiPool: MinimalPoolFragment): PoolState => {\n return {\n type: mapPoolType(apiPool.type),\n protocolVersion: apiPool.protocolVersion as 1 | 2 | 3,\n tokens: apiPool.tokens.map<MinimalToken>(\n (pt) =>\n ({\n ...pt,\n address: pt.address as Address,\n }) satisfies MinimalToken,\n ),\n id: apiPool.id as Address,\n address: apiPool.address as Address,\n } satisfies PoolState;\n};\n","import type { PublicClient } from \"viem\";\n\nimport { balancerVaultAbi } from \"~/abi/bex/balancerVault\";\nimport { parseBaseArgs } from \"~/utils/parseBaseArgs\";\n\nexport async function getVaultPausedState({\n publicClient,\n ...args\n}: BeraJS.BaseFunctionArgs & {\n publicClient: PublicClient;\n}) {\n const { config } = parseBaseArgs(args);\n\n const vaultPausedState = await publicClient.readContract({\n address: config.bex.vault,\n abi: balancerVaultAbi,\n functionName: \"getPausedState\",\n });\n\n return vaultPausedState[0];\n}\n","import {\n type Abi,\n type AbiFunction,\n type AbiItem,\n type Address,\n decodeFunctionData,\n erc20Abi,\n type PublicClient,\n pad,\n toFunctionSignature,\n trim,\n} from \"viem\";\n\nimport { appConfig, defaultChainId } from \"@berachain/config/internal\";\n\nimport { beraChefAbi } from \"~/abi/pol/beraChef\";\nimport { rewardVaultAbi } from \"~/abi/pol/rewardVault\";\n\n// Function to check if ABI contains proxy-related functions\nfunction isProxyABI(abi: Abi[]): boolean {\n return abi.some(\n (item: any) =>\n item.name === \"implementation\" ||\n item.name === \"proxyType\" ||\n (item.type === \"constructor\" &&\n item.inputs?.[0]?.name === \"implementation\"),\n );\n}\n\n/**\n * {@link https://docs.berascan.com/api-endpoints/contracts}\n */\nasync function _getAbi({\n contractAddress,\n chainId,\n publicClient,\n}: {\n contractAddress: Address;\n chainId: number;\n publicClient: PublicClient;\n}) {\n const url = `https://api.etherscan.io/v2/api?module=contract&action=getabi&address=${contractAddress}&apikey=${appConfig.apiKeys.private.etherscan}&chainId=${chainId}`;\n\n const response = await fetch(url);\n\n if (!response.ok) {\n throw new Error(`Failed to fetch ABI: ${response.statusText}`);\n }\n\n const data = await response.json();\n if (data.status === \"0\") throw new Error(data.result);\n\n const abi = JSON.parse(data.result);\n if (!isProxyABI(abi)) return abi;\n\n const implementationResult = await publicClient.getStorageAt({\n address: contractAddress,\n // bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)).\n slot: \"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc\",\n });\n\n // if implementation is not set, it might be a beacon proxy\n if (!implementationResult || trim(implementationResult) === \"0x00\")\n return abi;\n // storage slot has 32 byes (64 characters) but an address only has 20 bytes (40 characters)\n const implementationAddress = pad(trim(implementationResult), { size: 20 });\n return _getAbi({\n contractAddress: implementationAddress as `0x${string}`,\n chainId,\n publicClient,\n });\n}\n\nasync function _getAbiForCallData({\n address,\n callData,\n knownAbi,\n chainId,\n publicClient,\n}: {\n address: Address;\n callData: `0x${string}`;\n knownAbi: AbiItem[];\n chainId: number;\n publicClient: PublicClient;\n}) {\n try {\n if (decodeFunctionData({ data: callData, abi: knownAbi })) {\n return knownAbi;\n }\n } catch {}\n try {\n return await _getAbi({ contractAddress: address, chainId, publicClient });\n } catch {}\n}\n\nfunction _decodeCallData(callData: `0x${string}`, abi: AbiItem[]) {\n try {\n return decodeFunctionData({ data: callData, abi });\n } catch {\n return undefined;\n }\n}\n\nfunction _findAbiItem(abi: AbiItem[], functionName: string) {\n return abi.find(\n (a: AbiItem) => a.type === \"function\" && a.name === functionName,\n ) as AbiFunction | undefined;\n}\n\nfunction _getFunctionSignature(abiItem: AbiFunction | undefined) {\n if (!abiItem) return;\n try {\n return toFunctionSignature(abiItem);\n } catch (error) {\n console.error(error);\n }\n}\n\n/**\n * Decodes the function data from a given contract address and calldata.\n *\n * This function attempts to decode the provided calldata using a known set of ABIs.\n * If the call data cannot be decoded with the known ABIs, it fetches the ABI from the blockexplorer API.\n *\n * @param address - The contract address.\n * @param callData - The calldata to decode, in hexadecimal format.\n * @returns An object containing the decoded ABI item, function signature, function name, and arguments.\n */\nexport async function getDecodedFunctionData({\n address,\n callData,\n chainId = defaultChainId,\n publicClient,\n}: {\n address: Address;\n callData: `0x${string}`;\n chainId?: number;\n publicClient: PublicClient;\n}) {\n const knownAbi = [...beraChefAbi, ...rewardVaultAbi, ...erc20Abi];\n\n const abi = await _getAbiForCallData({\n address,\n callData,\n knownAbi,\n chainId,\n publicClient,\n });\n\n const decodedData = _decodeCallData(callData, abi);\n\n if (!abi || !decodedData) {\n return { args: [] };\n }\n\n const abiItem = _findAbiItem(abi, decodedData.functionName);\n\n const functionSignature = _getFunctionSignature(abiItem);\n\n return {\n abiItem,\n functionSignature,\n functionName: decodedData.functionName,\n args: decodedData.args as unknown[],\n };\n}\n","import { type Address, formatUnits, type PublicClient } from \"viem\";\n\nimport type { Token } from \"@berachain/graphql/pol/api\";\n\nimport { honeyFactoryAbi } from \"~/abi/honey/honeyFactory\";\nimport { parseBaseArgs } from \"~/utils/parseBaseArgs\";\n\nexport interface CollateralRates {\n mintFee: number;\n redeemFee: number;\n}\n\nexport interface HoneyFeeMap {\n single: Record<Address, CollateralRates>;\n basket: CollateralRates;\n}\n\nexport interface CollateralRatesArgs extends BeraJS.BaseFunctionArgs {\n client: PublicClient;\n collateralList: Token[];\n}\n\n/**\n * Fetches the mint and redeem rates for all collateral tokens and calculates the weighted basket rates\n * @param {Object} params - The parameters object\n * @param {PublicClient} params.client - The Viem public client instance\n * @param {Address[]} params.collateralList - Array of collateral token addresses\n * @returns {Promise<HoneyFeeMap | undefined>} Object containing individual collateral rates and weighted basket rates,\n * or undefined if the operation fails\n */\nexport async function getHoneyFees({\n client,\n collateralList,\n ...args\n}: CollateralRatesArgs): Promise<HoneyFeeMap> {\n const { config } = parseBaseArgs(args);\n\n try {\n // create a list for all the promises needed, fetch the mint and redeem rates for each collateral token\n const promiseList: Record<\"mint\" | \"redeem\", Promise<bigint>[]> = {\n mint: [],\n redeem: [],\n };\n for (const coll of collateralList) {\n promiseList.mint.push(\n client.readContract({\n address: config.honey.factory,\n abi: honeyFactoryAbi,\n functionName: \"mintRates\",\n args: [coll.address as Address],\n }),\n );\n promiseList.redeem.push(\n client.readContract({\n address: config.honey.factory,\n abi: honeyFactoryAbi,\n functionName: \"redeemRates\",\n args: [coll.address as Address],\n }),\n );\n }\n const [mintRates, redeemRates, collateralWeights] = await Promise.all([\n Promise.all(promiseList.mint),\n Promise.all(promiseList.redeem),\n // fetch the collateral weights, needed to calculate the weighted basket rates\n client.readContract({\n address: config.honey.factory,\n abi: honeyFactoryAbi,\n functionName: \"getWeights\",\n }),\n ]);\n\n // calculate the weighted basket rates and the single collateral rates\n\n return collateralList.reduce<HoneyFeeMap>(\n (acc, coll) => {\n const collIdx = collateralList.indexOf(coll);\n acc.single[coll.address as Address] = {\n mintFee: 1 - +formatUnits(mintRates[collIdx], 18),\n redeemFee: 1 - +formatUnits(redeemRates[collIdx], 18),\n };\n acc.basket.mintFee +=\n acc.single[coll.address as Address].mintFee *\n +formatUnits(collateralWeights[collIdx], 18);\n\n acc.basket.redeemFee +=\n acc.single[coll.address as Address].redeemFee *\n +formatUnits(collateralWeights[collIdx], 18);\n return acc;\n },\n {\n single: {},\n basket: { mintFee: 0, redeemFee: 0 },\n },\n );\n } catch (e) {\n console.log(e);\n throw e;\n }\n}\n","import type { PublicClient } from \"viem\";\n\nimport { honeyAbi } from \"~/abi/honey/honey\";\nimport { parseBaseArgs } from \"~/utils/parseBaseArgs\";\n\n/**\n * Gets the pause state of the Honey protocol\n * @returns boolean\n */\nexport async function getHoneyPausedState({\n client,\n ...args\n}: BeraJS.BaseFunctionArgs & {\n client: PublicClient;\n}) {\n const { config } = parseBaseArgs(args);\n const honeyAddress = config.honey.token;\n const honeyPausedState = await client.readContract({\n address: honeyAddress,\n abi: honeyAbi,\n functionName: \"paused\",\n });\n\n return honeyPausedState;\n}\n","import type { Address, PublicClient } from \"viem\";\n\nimport { honeyRootOracleAbi } from \"~/abi/honey/honeyRootOracle\";\n\n/**\n * Gets the address of the Honey Pyth Oracle, which is called by the Honey Root Price Oracle to get the price of the collaterals\n * @returns\n */\nexport async function getHoneyPythOracle({\n pythOracle,\n publicClient,\n}: {\n publicClient: PublicClient;\n pythOracle: Address;\n}) {\n return await publicClient.readContract({\n address: pythOracle,\n abi: honeyRootOracleAbi,\n functionName: \"pythOracle\",\n });\n}\n","import type { Address, PublicClient } from \"viem\";\n\nimport { honeyFactoryAbi } from \"~/abi/honey/honeyFactory\";\nimport { parseBaseArgs } from \"~/utils/parseBaseArgs\";\n\n/**\n * Gets the address of the Honey Root Price Oracle, which keeps the logic to price the collaterals\n */\nexport async function getHoneyRootPriceOracle({\n publicClient,\n factory,\n ...args\n}: BeraJS.BaseFunctionArgs & {\n publicClient: PublicClient;\n factory?: Address;\n}): Promise<Address> {\n const { config } = parseBaseArgs(args);\n return await publicClient.readContract({\n address: factory ?? config.honey.factory,\n abi: honeyFactoryAbi,\n functionName: \"priceOracle\",\n });\n}\n","import {\n GetBlocksTimeStamp,\n type GetBlocksTimeStampQuery,\n type GetBlocksTimeStampQueryVariables,\n} from \"@berachain/graphql/chain\";\n\nimport { parseBaseArgs } from \"~/utils/parseBaseArgs\";\nimport { hoursInSeconds, msToSeconds } from \"~/utils/time\";\nimport { getApolloClient } from \"../clients/getApolloClient\";\n\nexport async function getBlockTime({\n defaultBlockTime,\n blocksSpan,\n ...args\n}: {\n defaultBlockTime?: number;\n blocksSpan?: number;\n} & BeraJS.BaseFunctionArgs = {}): Promise<number> {\n const { config } = parseBaseArgs(args);\n\n const blocksClient = getApolloClient(\"blocks.subgraph\", args);\n\n const blockTime = defaultBlockTime ?? config.averageBlockTime;\n const span = blocksSpan ?? Math.floor(hoursInSeconds(1) / blockTime);\n\n const res = await blocksClient.query<\n GetBlocksTimeStampQuery,\n GetBlocksTimeStampQueryVariables\n >({\n query: GetBlocksTimeStamp,\n variables: {\n skip: span,\n },\n });\n\n const data = res.data;\n\n return (\n // we need to use current timestamp as the latest block might not have been minted (chain halted)\n (msToSeconds(Date.now()) - Number(data?.oldest[0]?.timestamp)) /\n (Number(data?.newest[0]?.number) - Number(data?.oldest[0]?.number))\n );\n}\n","import type { Address, PublicClient } from \"viem\";\n\nimport { lstStakerVaultAbi } from \"~/abi/pol/LSTStakerVault\";\nimport { assertPublicClient } from \"~/errors/assert\";\nimport type { TokenWithMetadata } from \"~/types/dex\";\nimport type { StakingConfig } from \"~/types/staking\";\nimport { parseBaseArgs } from \"~/utils/parseBaseArgs\";\nimport { isToken } from \"~/utils/tokens\";\n\nexport type GetLSTStakeConfigArgs = {\n tokenList: TokenWithMetadata[];\n publicClient?: PublicClient;\n lstStakingVaults: Address[];\n} & BeraJS.BaseFunctionArgs;\n\n/**\n * Builds staking configs from on-chain LST vaults and optional native configs.\n */\nexport async function getLSTStakeConfig({\n tokenList,\n publicClient,\n lstStakingVaults,\n ...args\n}: GetLSTStakeConfigArgs): Promise<StakingConfig[]> {\n assertPublicClient(publicClient);\n\n const { config } = parseBaseArgs({\n ...args,\n chainId: publicClient.chain?.id ?? args.chainId,\n });\n\n const lstStakingTokens = tokenList.filter((token) =>\n lstStakingVaults.includes(token.address),\n );\n\n if (lstStakingTokens.length === 0) {\n return [];\n }\n\n const assets = await Promise.all(\n lstStakingTokens.map(async (stakingToken) => {\n // read the asset token address from the lst staking vault\n const assetTokenAddress = await publicClient.readContract({\n address: stakingToken.address,\n abi: lstStakerVaultAbi,\n functionName: \"asset\",\n });\n return { assetTokenAddress, stakingToken };\n }),\n );\n\n return assets.reduce<StakingConfig[]>(\n (acc, { assetTokenAddress, stakingToken }) => {\n const assetToken = tokenList.find((token) =>\n isToken(token, assetTokenAddress),\n );\n if (!assetToken) return acc;\n acc.push({\n id: stakingToken.address,\n receiptToken: stakingToken,\n inputTokens: [assetToken],\n });\n return acc;\n },\n [],\n );\n}\n","export const upgradableBeaconAbi = [\n {\n inputs: [\n { internalType: \"address\", name: \"initialOwner\", type: \"address\" },\n {\n internalType: \"address\",\n name: \"initialImplementation\",\n type: \"address\",\n },\n ],\n stateMutability: \"payable\",\n type: \"constructor\",\n },\n { inputs: [], name: \"NewImplementationHasNoCode\", type: \"error\" },\n { inputs: [], name: \"NewOwnerIsZeroAddress\", type: \"error\" },\n { inputs: [], name: \"Unauthorized\", type: \"error\" },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"address\",\n name: \"oldOwner\",\n type: \"address\",\n },\n {\n indexed: true,\n internalType: \"address\",\n name: \"newOwner\",\n type: \"address\",\n },\n ],\n name: \"OwnershipTransferred\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"address\",\n name: \"implementation\",\n type: \"address\",\n },\n ],\n name: \"Upgraded\",\n type: \"event\",\n },\n {\n inputs: [],\n name: \"implementation\",\n outputs: [{ internalType: \"address\", name: \"result\", type: \"address\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"owner\",\n outputs: [{ internalType: \"address\", name: \"result\", type: \"address\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"renounceOwnership\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"newOwner\", type: \"address\" }],\n name: \"transferOwnership\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"newImplementation\", type: \"address\" },\n ],\n name: \"upgradeTo\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n] as const;\n","import type { Address, PublicClient } from \"viem\";\n\nimport { rewardVaultFactoryAbi } from \"~/abi/pol/rewardVaultFactory\";\nimport { upgradableBeaconAbi } from \"~/abi/utils/upgradableBeacon\";\nimport { assertAddress, assertDefined } from \"~/errors/assert\";\nimport { parseBaseArgs } from \"~/utils/parseBaseArgs\";\n\n/**\n * Returns the beacon implementation address for all reward vaults.\n */\nexport async function getRewardVaultBeaconImplementation({\n publicClient,\n ...args\n}: BeraJS.BaseFunctionArgs & {\n publicClient: PublicClient;\n}): Promise<Address> {\n const { config } = parseBaseArgs(args);\n const factoryAddress = config.pol.factory;\n assertDefined(publicClient, \"publicClient\");\n assertAddress(config.pol.factory, \"factoryAddress\");\n\n // from the factory contract, we get the beacon address\n const beacon = await publicClient.readContract({\n address: factoryAddress,\n abi: rewardVaultFactoryAbi,\n functionName: \"beacon\",\n });\n\n // from the beacon contract, we get the current implementation address\n return await publicClient.readContract({\n address: beacon,\n abi: upgradableBeaconAbi,\n functionName: \"implementation\",\n });\n}\n","import type { PublicClient } from \"viem\";\n\nimport { rewardVaultAbi } from \"~/abi/pol/rewardVault\";\nimport { assertPublicClient } from \"~/errors/assert\";\nimport { getRewardVaultBeaconImplementation } from \"./getRewardVaultBeaconImplementation\";\n\nexport interface RewardVaultDurationConstants {\n minRewardDuration: number;\n maxRewardDuration: number;\n}\n\n/**\n * Returns the minimum and maximum reward duration constants for all reward vaults.\n */\nexport async function getRewardVaultDurationConstants({\n publicClient,\n ...baseArgs\n}: BeraJS.BaseFunctionArgs & {\n publicClient: PublicClient;\n}): Promise<RewardVaultDurationConstants> {\n assertPublicClient(publicClient);\n\n const beaconImplementation = await getRewardVaultBeaconImplementation({\n publicClient,\n ...baseArgs,\n });\n\n const [minRewardDuration, maxRewardDuration] = await Promise.all([\n publicClient.readContract({\n address: beaconImplementation,\n abi: rewardVaultAbi,\n functionName: \"MIN_REWARD_DURATION\",\n }),\n publicClient.readContract({\n address: beaconImplementation,\n abi: rewardVaultAbi,\n functionName: \"MAX_REWARD_DURATION\",\n }),\n ]);\n\n return {\n minRewardDuration: Number(minRewardDuration),\n maxRewardDuration: Number(maxRewardDuration),\n };\n}\n","import { type Address, type PublicClient, zeroAddress } from \"viem\";\n\nimport { rewardVaultFactoryAbi } from \"~/abi/pol/rewardVaultFactory\";\nimport { parseBaseArgs } from \"~/utils/parseBaseArgs\";\n\nexport async function getRewardVaultFromToken({\n tokenAddress,\n publicClient,\n factoryAddress,\n ...args\n}: {\n tokenAddress: Address;\n publicClient: PublicClient;\n factoryAddress?: Address;\n} & BeraJS.BaseFunctionArgs) {\n const { config } = parseBaseArgs(args);\n\n const vaultAddress = await publicClient.readContract({\n address: factoryAddress ?? config.pol.factory,\n abi: rewardVaultFactoryAbi,\n functionName: \"getVault\",\n args: [tokenAddress],\n });\n\n if (vaultAddress === zeroAddress) {\n return null;\n }\n\n return vaultAddress;\n}\n","import type { PublicClient } from \"viem\";\n\nimport type { Address } from \"@berachain/config\";\n\nimport { pythPriceOracleAbi } from \"~/abi/honey/pythPriceOracle\";\nimport type { PythPriceFeedMap } from \"~/types/honeySwap\";\nimport { parseBaseArgs } from \"~/utils/parseBaseArgs\";\n\n/**\n * Given a list of tokens, it will return the price feed ids for each token according to honey priceOracle\n * @returns\n */\nexport async function getHoneyPythFeeds({\n tokenList,\n publicClient,\n ...args\n}: {\n tokenList: readonly Address[];\n publicClient: PublicClient;\n} & BeraJS.BaseFunctionArgs): Promise<PythPriceFeedMap> {\n const { config } = parseBaseArgs(args);\n\n try {\n const priceFeedIds = await Promise.all(\n tokenList.map((token) =>\n publicClient.readContract({\n address: config.honey.pythOracle,\n abi: pythPriceOracleAbi,\n functionName: \"feeds\",\n args: [token],\n }),\n ),\n );\n\n return tokenList.reduce<PythPriceFeedMap>(\n (acc, token, index) => ({\n ...acc,\n [token]: priceFeedIds[index],\n }),\n {},\n );\n } catch (e) {\n console.error(\"getPythPriceFeedId\", e);\n throw e;\n }\n}\n","import type { TokenWithMetadata } from \"~/types/dex\";\nimport { beraFetchJson } from \"~/utils/beraFetch\";\nimport { parseBaseArgs } from \"~/utils/parseBaseArgs\";\n\nexport async function getTokens({\n url,\n ...args\n}: BeraJS.BaseFunctionArgs & { url?: string } = {}): Promise<\n TokenWithMetadata[]\n> {\n const { config } = parseBaseArgs(args);\n const tokenList = await beraFetchJson<{ tokens: TokenWithMetadata[] }>({\n url: url ?? config.lists.tokenList,\n type: \"rest\",\n name: \"GitHub\",\n });\n\n return tokenList.tokens ?? [];\n}\n","import type { PublicClient } from \"viem\";\n\nimport type { EdgeConfigSchema } from \"@berachain/config/internal/edge-config\";\n\nimport { beraChefAbi } from \"~/abi/pol/beraChef\";\nimport { bgtAbi } from \"~/abi/pol/bgt\";\nimport { parseBaseArgs } from \"~/utils/parseBaseArgs\";\n\nexport interface ActiveBoostAndCommissionChangeDelay {\n boostDelay: number;\n unboostDelay: number;\n commissionChangeDelay: number;\n rewardAllocationBlockDelay: number;\n maxWeightPerVault: number;\n maxNumWeightsPerRewardAllocation: number;\n /**\n * Percentage of the validator's commission rate that can be changed at once.\n *\n * @example 1 => 100%\n */\n maxCommissionRate: number;\n /**\n * The number of blocks after which a reward allocation is considered stale and will fallback\n * to baseline reward allocation.\n *\n */\n rewardAllocationInactivityBlockSpan: number;\n /**\n * The number of hours in advance to warn the operator that the reward allocation is expiring.\n */\n ui: EdgeConfigSchema[\"pol\"][\"automatedRewardAllocation\"];\n}\n\nexport async function getActiveBoostAndCommissionChangeDelay({\n publicClient,\n ui,\n ...args\n}: BeraJS.BaseFunctionArgs &\n Pick<ActiveBoostAndCommissionChangeDelay, \"ui\"> & {\n publicClient: PublicClient;\n }): Promise<ActiveBoostAndCommissionChangeDelay> {\n const { config } = parseBaseArgs(args);\n\n const [\n maxCommissionRate,\n commissionChangeDelay,\n rewardAllocationBlockDelay,\n maxWeightPerVault,\n maxNumWeightsPerRewardAllocation,\n dropBoostDelay,\n activateBoostDelay,\n rewardAllocationInactivityBlockSpan,\n ] = await Promise.all([\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"MAX_COMMISSION_RATE\",\n }),\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"commissionChangeDelay\",\n }),\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"rewardAllocationBlockDelay\",\n }),\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"maxWeightPerVault\",\n }),\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"maxNumWeightsPerRewardAllocation\",\n }),\n publicClient.readContract({\n address: config.tokens.bgt,\n abi: bgtAbi,\n functionName: \"dropBoostDelay\",\n }),\n publicClient.readContract({\n address: config.tokens.bgt,\n abi: bgtAbi,\n functionName: \"activateBoostDelay\",\n }),\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"rewardAllocationInactivityBlockSpan\",\n }),\n ]);\n\n return {\n maxCommissionRate: Number(maxCommissionRate) / 1e4,\n boostDelay: Number(activateBoostDelay),\n unboostDelay: Number(dropBoostDelay),\n commissionChangeDelay: Number(commissionChangeDelay),\n rewardAllocationBlockDelay: Number(rewardAllocationBlockDelay),\n maxWeightPerVault: Number(maxWeightPerVault) / 1e4,\n maxNumWeightsPerRewardAllocation: Number(maxNumWeightsPerRewardAllocation),\n rewardAllocationInactivityBlockSpan: Number(\n rewardAllocationInactivityBlockSpan,\n ),\n ui,\n };\n}\n","import type { ApiValidatorFragment } from \"@berachain/graphql/pol/api\";\n\nexport function getValidatorReturnPerBgt(\n validator: Pick<\n ApiValidatorFragment,\n \"dynamicData\" | \"rewardAllocationWeights\"\n >,\n): number {\n return validator?.rewardAllocationWeights?.reduce((acc, ab) => {\n if (!ab) return acc;\n\n const totalIncentiveValue =\n ab.receivingVault?.activeIncentives\n .filter((inc) => Number(inc.remainingAmount) > 0)\n .reduce((totalIncentiveValue, currIncentive) => {\n const tokenPrice =\n Number(currIncentive.remainingAmountUsd) /\n Number(currIncentive.remainingAmount);\n\n return (\n totalIncentiveValue +\n Number(currIncentive.incentiveRate) * tokenPrice\n );\n }, 0) ?? 0;\n\n return acc + totalIncentiveValue * ab.percentage;\n }, 0);\n}\n\nexport function getValidatorBoostApy({\n validator,\n bgtPrice,\n}: {\n validator: Pick<\n ApiValidatorFragment,\n \"dynamicData\" | \"rewardAllocationWeights\"\n >;\n bgtPrice: number;\n}): number {\n const validatorActiveBoostAmount = Number(\n validator.dynamicData?.activeBoostAmount ?? 0,\n );\n\n const returnPerBgt = getValidatorReturnPerBgt(validator);\n\n if (!returnPerBgt || !validatorActiveBoostAmount) {\n // As of now, a validator cannot send rewards to the vaults if it has no active boost amount\n // If baseRate changes on chain, we should update this function\n return 0;\n }\n\n const boostApy =\n (returnPerBgt *\n Number(validator.dynamicData?.lastDayDistributedBGTAmount ?? 0) *\n 365) /\n (validatorActiveBoostAmount * bgtPrice);\n\n return boostApy;\n}\n"],"mappings":"kvCAAA,OAAuB,eAAAA,MAAsC,OAS7D,eAAsBC,GAAc,CAClC,aAAAC,EACA,aAAAC,CACF,EAAwC,CACtC,IAAMC,EAAa,MAAMD,EAAa,aAAa,CACjD,QAASD,EACT,IAAKG,EACL,aAAc,aACd,KAAM,CAACH,CAAY,CACrB,CAAC,EACD,OAAOI,EAAYF,CAAU,CAC/B,CCpBA,OAEE,eAAAG,MAEK,qCAKA,IAAMC,GAAgBC,IACpB,CACL,KAAMF,EAAYE,EAAQ,IAAI,EAC9B,gBAAiBA,EAAQ,gBACzB,OAAQA,EAAQ,OAAO,IACpBC,IACE,CACC,GAAGA,EACH,QAASA,EAAG,OACd,EACJ,EACA,GAAID,EAAQ,GACZ,QAASA,EAAQ,OACnB,GCjBF,eAAsBE,GAAoB,CACxC,aAAAC,EACA,GAAGC,CACL,EAEG,CACD,GAAM,CAAE,OAAAC,CAAO,EAAIC,EAAcF,CAAI,EAQrC,OANyB,MAAMD,EAAa,aAAa,CACvD,QAASE,EAAO,IAAI,MACpB,IAAKE,EACL,aAAc,gBAChB,CAAC,GAEuB,CAAC,CAC3B,CCpBA,OAKE,sBAAAC,EACA,YAAAC,EAEA,OAAAC,EACA,uBAAAC,EACA,QAAAC,MACK,OAEP,OAAS,aAAAC,EAAW,kBAAAC,MAAsB,6BAM1C,SAASC,EAAWC,EAAqB,CACvC,OAAOA,EAAI,KACRC,GACCA,EAAK,OAAS,kBACdA,EAAK,OAAS,aACbA,EAAK,OAAS,eACbA,EAAK,SAAS,CAAC,GAAG,OAAS,gBACjC,CACF,CAKA,eAAeC,EAAQ,CACrB,gBAAAC,EACA,QAAAC,EACA,aAAAC,CACF,EAIG,CACD,IAAMC,EAAM,yEAAyEH,CAAe,WAAWI,EAAU,QAAQ,QAAQ,SAAS,YAA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,EAEMU,EAAeX,GAAyBC,CAAS,EAEvD,MAAI,CAACU,GAAgB,CAACD,EAGb,EAINC,EACC,OAAOV,EAAU,aAAa,6BAA+B,CAAC,EAC9D,KACDS,EAA6BD,EAGlC","names":["formatEther","getMaxDeposit","vaultAddress","publicClient","maxDeposit","metaMorphoAbi","formatEther","mapPoolType","getPoolState","apiPool","pt","getVaultPausedState","publicClient","args","config","parseBaseArgs","balancerVaultAbi","decodeFunctionData","erc20Abi","pad","toFunctionSignature","trim","appConfig","defaultChainId","isProxyABI","abi","item","_getAbi","contractAddress","chainId","publicClient","url","appConfig","response","data","implementationResult","trim","implementationAddress","pad","_getAbiForCallData","address","callData","knownAbi","decodeFunctionData","_decodeCallData","_findAbiItem","functionName","a","_getFunctionSignature","abiItem","toFunctionSignature","error","getDecodedFunctionData","defaultChainId","beraChefAbi","rewardVaultAbi","erc20Abi","decodedData","functionSignature","formatUnits","getHoneyFees","client","collateralList","args","config","parseBaseArgs","promiseList","coll","honeyFactoryAbi","mintRates","redeemRates","collateralWeights","acc","collIdx","formatUnits","e","getHoneyPausedState","client","args","config","parseBaseArgs","honeyAddress","honeyAbi","getHoneyPythOracle","pythOracle","publicClient","honeyRootOracleAbi","getHoneyRootPriceOracle","publicClient","factory","args","config","parseBaseArgs","honeyFactoryAbi","GetBlocksTimeStamp","getBlockTime","defaultBlockTime","blocksSpan","args","config","parseBaseArgs","blocksClient","getApolloClient","blockTime","span","hoursInSeconds","data","GetBlocksTimeStamp","msToSeconds","getLSTStakeConfig","tokenList","publicClient","lstStakingVaults","args","assertPublicClient","config","parseBaseArgs","lstStakingTokens","token","stakingToken","lstStakerVaultAbi","acc","assetTokenAddress","assetToken","isToken","upgradableBeaconAbi","getRewardVaultBeaconImplementation","publicClient","args","config","parseBaseArgs","factoryAddress","assertDefined","assertAddress","beacon","rewardVaultFactoryAbi","upgradableBeaconAbi","getRewardVaultDurationConstants","publicClient","baseArgs","assertPublicClient","beaconImplementation","getRewardVaultBeaconImplementation","minRewardDuration","maxRewardDuration","rewardVaultAbi","zeroAddress","getRewardVaultFromToken","tokenAddress","publicClient","factoryAddress","args","config","parseBaseArgs","vaultAddress","rewardVaultFactoryAbi","zeroAddress","getHoneyPythFeeds","tokenList","publicClient","args","config","parseBaseArgs","priceFeedIds","token","pythPriceOracleAbi","acc","index","e","getTokens","url","args","config","parseBaseArgs","beraFetchJson","getActiveBoostAndCommissionChangeDelay","publicClient","ui","args","config","parseBaseArgs","maxCommissionRate","commissionChangeDelay","rewardAllocationBlockDelay","maxWeightPerVault","maxNumWeightsPerRewardAllocation","dropBoostDelay","activateBoostDelay","rewardAllocationInactivityBlockSpan","beraChefAbi","bgtAbi","getValidatorReturnPerBgt","validator","acc","ab","totalIncentiveValue","inc","currIncentive","tokenPrice","getValidatorBoostApy","bgtPrice","validatorActiveBoostAmount","returnPerBgt"]}
@@ -0,0 +1,2 @@
1
+ var A=(R=>(R[R.FAST=1e4]="FAST",R[R.NORMAL=1e5]="NORMAL",R[R.SLOW=18e4]="SLOW",R[R.REFRESH_BLOCK_INTERVAL=1e4]="REFRESH_BLOCK_INTERVAL",R))(A||{});export{A as a};
2
+ //# sourceMappingURL=chunk-575OK77P.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/enum/polling.ts"],"sourcesContent":["enum POLLING {\n FAST = 10000, // 10 sec\n NORMAL = 100000, // 100 sec\n SLOW = 180000, // 3 min\n REFRESH_BLOCK_INTERVAL = 10000, // 10 sec\n}\n\nexport { POLLING };\n"],"mappings":"AAAA,IAAKA,OACHA,IAAA,KAAO,KAAP,OACAA,IAAA,OAAS,KAAT,SACAA,IAAA,KAAO,MAAP,OACAA,IAAA,uBAAyB,KAAzB,yBAJGA,OAAA","names":["POLLING"]}
@@ -0,0 +1,2 @@
1
+ import{e as n}from"./chunk-C3G5KXCH.mjs";var r=[],c={startSpan(e,t){return r.length===0?t():r.reduceRight((o,a)=>()=>a(e,o),t)()},addSpanHandler(e){return r.push(e),()=>{let t=r.indexOf(e);t!==-1&&r.splice(t,1)}}};var i=class extends n{resource;id;constructor(t){super(t),this.name="NotFoundError",this.level=t.level??"info",this.message=`Resource ${t.resource} with id ${t.id} not found`,this.resource=t.resource,this.id=t.id}};var s=class extends n{txHash;receipt;to;callData;blockNumber=null;input;functionName;constructor(t){super(t),this.name="TransactionFailedError",this.txHash=t.txHash||null,this.receipt=t.receipt||null,this.to=t.to,this.functionName=t.functionName,this.blockNumber=t.blockNumber??null,this.input=t.input,this.receipt?this.message=`Transaction reverted on chain for reason: ${this.reason}`:this.txHash?this.message=`Transaction reverted after being broadcasted for reason: ${this.reason}`:this.message=`${this.reason}: ${this.message}`,this.tags={...this.tags,"operation.txn.status":t.txHash?"execution":"simulation",...t.tags},this.to&&(this.tags["operation.txn.to"]=this.to),this.functionName&&(this.tags["operation.txn.functionName"]=this.functionName)}};export{c as a,i as b,s as c};
2
+ //# sourceMappingURL=chunk-7GWTHOLO.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/errors/BeraTracing.ts","../src/errors/NotFoundError.ts","../src/errors/TransactionFailedError.ts"],"sourcesContent":["import type { Unsubscribe } from \"~/utils/createEmitter\";\n\n/**\n * Span context passed to tracing handlers.\n * Compatible with Sentry's StartSpanOptions (name, op, attributes).\n */\nexport type SpanContext = {\n name: string;\n op: string;\n attributes: Record<string, string | number | boolean | undefined>;\n};\n\n/**\n * A function that wraps a callback in a tracing span.\n * Compatible with Sentry.startSpan's signature.\n */\ntype StartSpanFn = <T>(\n context: SpanContext,\n callback: () => Promise<T>,\n) => Promise<T>;\n\nconst _handlers: StartSpanFn[] = [];\n\n/**\n * A generic span-tracing module for berajs.\n *\n * Instead of calling Sentry.startSpan directly, berajs calls\n * `BeraTracing.startSpan()`. Consumer apps subscribe via `.on(\"span\", handler)`\n * and forward spans to their tracing provider (Sentry, Datadog, etc.).\n *\n * Multiple handlers are supported and chain in registration order:\n * the first registered handler is the outermost wrapper.\n *\n * @example\n * ```ts\n * // In berajs code:\n * import { BeraTracing } from \"~/errors/BeraTracing\";\n * const result = await BeraTracing.startSpan(\n * { name: \"GraphQL query\", op: \"graphql.query\", attributes: {} },\n * () => executeQuery(),\n * );\n *\n * // In app instrumentation:\n * import { BeraTracing } from \"@berachain/berajs/errors\";\n * BeraTracing.addSpanHandler(Sentry.startSpan);\n * ```\n */\nexport const BeraTracing = {\n /**\n * Execute a callback, wrapping it in all registered span handlers.\n *\n * Handlers chain so each wraps the next. First registered = outermost wrapper.\n * If no handlers are registered, the callback is executed directly.\n */\n startSpan<T>(context: SpanContext, callback: () => Promise<T>): Promise<T> {\n if (_handlers.length === 0) return callback();\n\n // Chain: h1(ctx, () => h2(ctx, () => h3(ctx, () => callback())))\n return _handlers.reduceRight<() => Promise<T>>(\n (next, handler) => () => handler(context, next),\n callback,\n )();\n },\n\n /**\n * Register a span tracing handler.\n *\n * @param _event - Must be \"span\". Exists for API consistency with BeraMonitoring.\n * @param handler - A StartSpanFn, e.g. Sentry.startSpan.\n * @returns An unsubscribe function to remove the handler.\n */\n addSpanHandler(handler: StartSpanFn): Unsubscribe {\n _handlers.push(handler);\n return () => {\n const idx = _handlers.indexOf(handler);\n if (idx !== -1) _handlers.splice(idx, 1);\n };\n },\n};\n","import { BeraError, type IBeraErrorArgs } from \"./BeraError\";\n\nexport interface INotFoundErrorArgs extends IBeraErrorArgs {\n resource: string;\n id: string;\n chainId: number;\n}\n\n/**\n * Error thrown when a resource is not found.\n */\nexport class NotFoundError extends BeraError {\n /**\n * The name of the resource that was not found.\n *\n * @example \"Reward vault\"\n */\n resource: string;\n /**\n * The id of the resource that was not found.\n *\n * @example \"0x1234567890123456789012345678901234567890\"\n */\n id: string;\n\n constructor(args: INotFoundErrorArgs) {\n super(args);\n this.name = \"NotFoundError\";\n this.level = args.level ?? \"info\";\n this.message = `Resource ${args.resource} with id ${args.id} not found`;\n this.resource = args.resource;\n this.id = args.id;\n }\n}\n","import type { Hex } from \"@berachain-foundation/berancer-sdk\";\nimport type { Address, TransactionReceipt } from \"viem\";\n\nimport { BeraError, type IBeraErrorArgs } from \"./BeraError\";\n\n/**\n * This error is generally thrown by beraWriteContract when a transaction or simulation fails.\n */\nexport class TransactionFailedError extends BeraError {\n /**\n * The hash of the transaction that failed.\n *\n * Null if the error is due to a simulation failure.\n */\n txHash: string | null;\n\n /**\n * The receipt of the transaction that failed.\n *\n * Null if the error is due to a simulation failure.\n */\n receipt: TransactionReceipt | null;\n\n /**\n * The address of the contract that was called.\n */\n to: Address | undefined;\n\n /**\n * The data of the transaction that failed.\n */\n callData: Hex | undefined;\n\n /**\n * The block number of the transaction that failed.\n */\n blockNumber: bigint | null = null;\n\n /**\n * The input of the transaction that failed.\n */\n input: object;\n\n /**\n * The function name of the transaction that failed.\n */\n functionName: string | undefined;\n\n constructor(\n args: IBeraErrorArgs & {\n txHash?: string;\n receipt?: TransactionReceipt;\n to?: Address;\n blockNumber?: bigint;\n functionName?: string;\n input: object;\n },\n ) {\n super(args);\n this.name = \"TransactionFailedError\";\n this.txHash = args.txHash || null;\n this.receipt = args.receipt || null;\n this.to = args.to;\n this.functionName = args.functionName;\n this.blockNumber = args.blockNumber ?? null;\n this.input = args.input;\n\n if (this.receipt) {\n // If we have a receipt, transaction reverted on chain\n this.message = `Transaction reverted on chain for reason: ${this.reason}`;\n } else if (this.txHash) {\n // If we have a tx hash, transaction reverted after being broadcasted but we never got a receipt\n // Might happen for network reasons\n this.message = `Transaction reverted after being broadcasted for reason: ${this.reason}`;\n } else {\n this.message = `${this.reason}: ${this.message}`;\n }\n\n this.tags = {\n ...this.tags,\n \"operation.txn.status\": args.txHash ? \"execution\" : \"simulation\",\n ...args.tags,\n };\n\n if (this.to) {\n this.tags[\"operation.txn.to\"] = this.to;\n }\n\n if (this.functionName) {\n this.tags[\"operation.txn.functionName\"] = this.functionName;\n }\n }\n}\n"],"mappings":"yCAqBA,IAAMA,EAA2B,CAAC,EA0BrBC,EAAc,CAOzB,UAAaC,EAAsBC,EAAwC,CACzE,OAAI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","callback","next","handler","idx","NotFoundError","BeraError","args","TransactionFailedError","BeraError","args"]}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2;var u="Something went wrong. Please try again later.",p={ERC20:{NOT_ENOUGH_BALANCE:{reasons:["NotEnoughBalance"],errorMSG:"You do not have enough balance to perform this action."},InsufficientBalance:{reasons:["InsufficientBalance"],errorMSG:"Insufficient token balance"},INSUFFICIENT_ALLOWANCE:{reasons:["0x13be252b","InsufficientAllowance","ERC20InsufficientAllowance"],errorMSG:"You do not have enough allowance to perform this action."},SIGNATURE_EXPIRED:{reasons:["SignatureExpired"],errorMSG:"Transaction took too long to complete. Please try again."}},HTTP:{RATE_LIMITED_429:{reasons:["429"],errorMSG:"Too many requests. Please try again later."}},ENSO:{COULD_NOT_BUILD_SHORTCUT:{keywords:["Could not build shortcuts for route","Could not quote shortcuts for route"],errorMSG:"There was an error building the zap route. Try with lower amounts."},NOT_ENOUGH_LIQUIDITY:{keywords:["Swap not found for a required underlying of defi route, please make sure your amountIn is within an acceptable range"],errorMSG:"The amount you\u2019re trying to swap might be too high. Please make sure that your amount is within an acceptable range."},NO_ROUTE_FOUND:{keywords:["No route found from"],errorMSG:"No swap route found for the given tokens."}},RPC:{INSUFFICIENT_FUNDS:{reasons:["InsufficientFundsError"],keywords:["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."],errorMSG:"Insufficient BERA balance to perform this action."},GAS_PRICE:{keywords:["gasLimit"],errorMSG:"It seems an RPC error has occurred while estimating gas. Please try your request later."},JSON_RPC:{keywords:["JSON-RPC"],errorMSG:"It seems an RPC error has occurred. Please try your request one more later."},NOT_ENOUGH_GAS:{keywords:["insufficient funds for gas * price + value:"],errorMSG:"Gas balance is insufficient to cover the transaction cost."},HASH:{keywords:["hash"],errorMSG:"It seems an RPC error has occurred. Please check if your transaction was finalized. If not, please try again."},USER_REJECTION:{reasons:["UserRejectedRequestError"],keywords:["User denied transaction signature"],errorMSG:"You rejected the transaction."},SMART_UPGRADE_REJECTION:{reasons:["AtomicReadyWalletRejectedUpgradeError"],errorMSG:"You've declined to upgrade to batch transactions for now, try again for the traditional method."},CHAIN_MISMATCH:{reasons:["ChainMismatchError"],errorMSG:"Wallet seems to be on the wrong chain, please refresh the page and try again."}},EIP7702:{SESSION_KEY_EXPIRED:{reasons:["SessionKeyExpired"],errorMSG:"Session key has expired. Please create a new one."},CALL_POLICY_VIOLATED:{reasons:["CallPolicyViolated"],errorMSG:"Call policy violated. Please check your call policies."}},HONEY:{BLACKLISTED_WALLET:{reasons:["BlacklistedWallet","0x265693b4"],errorMSG:"Your wallet is blacklisted from minting or redeeming HONEY."},LIQUIDITY_ERROR:{reasons:["0x4656425a"],errorMSG:"You are trying to redeem more than the liquidity available in the vault."}},BEX:{SLIPPAGE_EXCEEDED:{reasons:["SlippageExceeded","TooMuchSlippage"],errorMSG:"Price changed while executing the transaction and exceeded the allowed slippage."},BAL000:{reasons:["BAL#000"],errorMSG:"Addition overflow occurred during calculation. (BEX#000)"},BAL001:{reasons:["BAL#001"],errorMSG:"Subtraction overflow occurred during calculation. (BEX#001)"},BAL002:{reasons:["BAL#002"],errorMSG:"Subtraction underflow occurred during calculation. (BEX#002)"},BAL003:{reasons:["BAL#003"],errorMSG:"Multiplication overflow occurred during calculation. (BEX#003)"},BAL004:{reasons:["BAL#004"],errorMSG:"Attempted division by zero. (BEX#004)"},BAL005:{reasons:["BAL#005"],errorMSG:"Multiplication overflow during FixedPoint Division. (BEX#005)"},BAL006:{reasons:["BAL#006"],errorMSG:"Invalid x in ExpMath.pow(x, y). (BEX#006)"},BAL007:{reasons:["BAL#007"],errorMSG:"Invalid y in ExpMath.pow(x, y). (BEX#007)"},BAL008:{reasons:["BAL#008"],errorMSG:"In LogExpMath.pow(x, y), error computing x^y as exp(y * ln(x)). (BEX#008)"},BAL009:{reasons:["BAL#009"],errorMSG:"In LogExpMath.exp(x) = e^x; x out of bounds. (BEX#009)"},BAL100:{reasons:["BAL#100"],errorMSG:"Value is out of acceptable bounds. (BEX#100)"},BAL101:{reasons:["BAL#101"],errorMSG:"Tokens must be sorted in address order on pool registration. (BEX#101)"},BAL102:{reasons:["BAL#102"],errorMSG:"Tokens must be sorted in address order on pool registration. (BEX#102)"},BAL103:{reasons:["BAL#103"],errorMSG:"Parallel array inputs must have the same length. (BEX#103)"},BAL104:{reasons:["BAL#104"],errorMSG:"Address to be interpreted as a token cannot be 0. (BEX#104)"},BAL105:{reasons:["BAL#105"],errorMSG:"Insufficient byte length. (BEX#105)"},BAL200:{reasons:["BAL#200"],errorMSG:"All pools must contain at least two tokens. (BEX#200)"},BAL201:{reasons:["BAL#201"],errorMSG:"Token count exceeds the maximum for a given pool type. (BEX#201)"},BAL202:{reasons:["BAL#202"],errorMSG:"Swap fee percentage exceeds the maximum allowed. (BEX#202)"},BAL203:{reasons:["BAL#203"],errorMSG:"Swap fee percentage is below the minimum allowed. (BEX#203)"},BAL204:{reasons:["BAL#204"],errorMSG:"Pool initialization failed: a small amount of BPT is minted to the zero address to maintain mathematical consistency. If initial balances are too low, the initialization process may fail. (BEX#204)"},BAL205:{reasons:["BAL#205"],errorMSG:"User attempted to execute a callback intended for the vault contract. (BEX#205)"},BAL206:{reasons:["BAL#206"],errorMSG:"Pools must be initialized with a special 'Init' join, before they can be joined by LPs. (BEX#206)"},BAL207:{reasons:["BAL#207"],errorMSG:"Slippage/front-running protection check failed on a pool exit. (BEX#207)"},BAL208:{reasons:["BAL#208"],errorMSG:"Minimum BPT output amount not met. (BEX#208)"},BAL209:{reasons:["BAL#209"],errorMSG:"Slippage/front-running protection check failed on a pool join. (BEX#209)"},BAL210:{reasons:["BAL#210"],errorMSG:"Pools with oracles are limited to two tokens. A pool with the TWO_TOKEN specialization must have exactly two tokens. (BEX#210)"},BAL211:{reasons:["BAL#211"],errorMSG:"The pool factory is disabled and new pools cannot be created at this time. (BEX#211)"},BAL300:{reasons:["BAL#300"],errorMSG:"The amplification parameter is below the minimum allowed. (BEX#300)"},BAL301:{reasons:["BAL#301"],errorMSG:"The amplification parameter exceeds the maximum allowed. (BEX#301)"},BAL302:{reasons:["BAL#302"],errorMSG:"The weight parameter is below the minimum allowed. (BEX#302)"},BAL303:{reasons:["BAL#303"],errorMSG:"The number of stable tokens exceeds the maximum allowed. (BEX#303)"},BAL304:{reasons:["BAL#304"],errorMSG:"The amount of tokens in would unbalance the pool. (BEX#304)"},BAL305:{reasons:["BAL#305"],errorMSG:"The amount of tokens out would unbalance the pool. (BEX#305)"},BAL306:{reasons:["BAL#306"],errorMSG:"Disproportionate pool exit would unbalance the pool. (BEX#306)"},BAL307:{reasons:["BAL#307"],errorMSG:"Disproportionate pool join would unbalance the pool. (BEX#307)"},BAL308:{reasons:["BAL#308"],errorMSG:"Normalized weights do not add to 1.0 exactly. (BEX#308)"},BAL309:{reasons:["BAL#309"],errorMSG:"Invalid token provided for operation. (BEX#309)"},BAL310:{reasons:["BAL#310"],errorMSG:"Unhandled pool join operation for this pool type. (BEX#310)"},BAL311:{reasons:["BAL#311"],errorMSG:"Pool balances must be > 0. (BEX#311)"},BAL312:{reasons:["BAL#312"],errorMSG:"Invalid query for oracle data ('ago' timestamp was not in the past). (BEX#312)"},BAL313:{reasons:["BAL#313"],errorMSG:"Oracle has no data to query. (BEX#313)"},BAL314:{reasons:["BAL#314"],errorMSG:"Oracle query data is before its earliest data sample. (BEX#314)"},BAL315:{reasons:["BAL#315"],errorMSG:"Cannot query an oracle sample outside the buffer of 1024. (BEX#315)"},BAL316:{reasons:["BAL#316"],errorMSG:"Oracle query window must have non-zero duration. (BEX#316)"},BAL317:{reasons:["BAL#317"],errorMSG:"Amplification parameter change has less than the minimum duration. (BEX#317)"},BAL318:{reasons:["BAL#318"],errorMSG:"Cannot start an amplification parameter update if one is already ongoing. (BEX#318)"},BAL319:{reasons:["BAL#319"],errorMSG:"The requested amplification parameter change is too fast (cannot halve or double over less than a day). (BEX#319)"},BAL320:{reasons:["BAL#320"],errorMSG:"Cannot cancel an update if there isn't one already ongoing. (BEX#320)"},BAL321:{reasons:["BAL#321"],errorMSG:"Stable pool invariant calculation did not converge. (BEX#321)"},BAL322:{reasons:["BAL#322"],errorMSG:"Stable pool balance calculation did not converge. (BEX#322)"},BAL323:{reasons:["BAL#323"],errorMSG:"Relayer must be a valid contract. (BEX#323)"},BAL324:{reasons:["BAL#324"],errorMSG:"Base pool relayer was not called correctly. (BEX#324)"},BAL325:{reasons:["BAL#325"],errorMSG:"Rebalancing relayer operation re-entered unexpectedly. (BEX#325)"},BAL326:{reasons:["BAL#326"],errorMSG:"Detected time travel in gradual updates (start > end time in a gradual weights update). (BEX#326)"},BAL327:{reasons:["BAL#327"],errorMSG:"Swaps are disabled for this pool. (BEX#327)"},BAL328:{reasons:["BAL#328"],errorMSG:"Caller is not the owner of the LBP. (BEX#328)"},BAL329:{reasons:["BAL#329"],errorMSG:"Rate returned from a rateProvider must fit within 128 bits. (BEX#329)"},BAL330:{reasons:["BAL#330"],errorMSG:"Investment pools only allow proportional joins and exits when swaps are disabled (to prevent unbalancing the pool). (BEX#330)"},BAL331:{reasons:["BAL#331"],errorMSG:"Gradual weight update duration too short (minimum 1 day). (BEX#331)"},BAL332:{reasons:["BAL#332"],errorMSG:"Invalid Linear Pool operating range. (BEX#332)"},BAL333:{reasons:["BAL#333"],errorMSG:"Linear Pool max balance must fit in 112 bits. (BEX#333)"},BAL334:{reasons:["BAL#334"],errorMSG:"Unhandled pool join/exit operation for linear pool type. (BEX#334)"},BAL335:{reasons:["BAL#335"],errorMSG:"Cannot reset Linear Pool targets if pool is unbalanced. (BEX#335)"},BAL336:{reasons:["BAL#336"],errorMSG:"Unhandled pool exit operation for this pool type. (BEX#336)"},BAL337:{reasons:["BAL#337"],errorMSG:"Management fees can only be collected by the pool owner. (BEX#337)"},BAL338:{reasons:["BAL#338"],errorMSG:"Management swap fee percentage exceeded the maximum. (BEX#338)"},BAL339:{reasons:["BAL#339"],errorMSG:"Unhandled pool join/exit operation for managed pool type. (BEX#339)"},BAL340:{reasons:["BAL#340"],errorMSG:"Unhandled pool join/exit operation for phantom pool type. (BEX#340)"},BAL341:{reasons:["BAL#341"],errorMSG:"Token does not have a valid rate provider. (BEX#341)"},BAL342:{reasons:["BAL#342"],errorMSG:"Invalid pool initialization parameters provided. (BEX#342)"},BAL343:{reasons:["BAL#343"],errorMSG:"Value is out of the new target range for the operation. (BEX#343)"},BAL344:{reasons:["BAL#344"],errorMSG:"This feature is currently disabled. (BEX#344)"},BAL345:{reasons:["BAL#345"],errorMSG:"The pool controller is uninitialized. (BEX#345)"},BAL346:{reasons:["BAL#346"],errorMSG:"Cannot set swap fee during an ongoing fee change. (BEX#346)"},BAL347:{reasons:["BAL#347"],errorMSG:"Cannot set swap fee during pending fee changes. (BEX#347)"},BAL348:{reasons:["BAL#348"],errorMSG:"Cannot change tokens during a weight change. (BEX#348)"},BAL349:{reasons:["BAL#349"],errorMSG:"Cannot change tokens during pending weight changes. (BEX#349)"},BAL350:{reasons:["BAL#350"],errorMSG:"Weight parameter exceeds the maximum allowed. (BEX#350)"},BAL351:{reasons:["BAL#351"],errorMSG:"Unauthorized join operation. (BEX#351)"},BAL352:{reasons:["BAL#352"],errorMSG:"Management AUM fee percentage exceeded the maximum allowed. (BEX#352)"},BAL353:{reasons:["BAL#353"],errorMSG:"Fractional target values are not supported. (BEX#353)"},BAL354:{reasons:["BAL#354"],errorMSG:"Adding or removing BPT is not allowed in this context. (BEX#354)"},BAL355:{reasons:["BAL#355"],errorMSG:"Invalid circuit breaker bounds configuration. (BEX#355)"},BAL356:{reasons:["BAL#356"],errorMSG:"The circuit breaker has been triggered. (BEX#356)"},BAL357:{reasons:["BAL#357"],errorMSG:"Malicious query detected and reverted. (BEX#357)"},BAL358:{reasons:["BAL#358"],errorMSG:"Joins and exits are currently disabled for this pool. (BEX#358)"},BAL400:{reasons:["BAL#400"],errorMSG:"Reentrancy detected. (BEX#400)"},BAL401:{reasons:["BAL#401"],errorMSG:"The sender is not allowed to perform this action. (BEX#401)"},BAL402:{reasons:["BAL#402"],errorMSG:"The contract is currently paused. (BEX#402)"},BAL403:{reasons:["BAL#403"],errorMSG:"The pause window has expired. (BEX#403)"},BAL404:{reasons:["BAL#404"],errorMSG:"The maximum pause window duration has been exceeded. (BEX#404)"},BAL405:{reasons:["BAL#405"],errorMSG:"The maximum buffer period duration has been exceeded. (BEX#405)"},BAL406:{reasons:["BAL#406"],errorMSG:"The account has insufficient balance. (BEX#406)"},BAL407:{reasons:["BAL#407"],errorMSG:"The account has insufficient allowance. (BEX#407)"},BAL408:{reasons:["BAL#408"],errorMSG:"ERC20: Transfer from zero address. (BEX#408)"},BAL409:{reasons:["BAL#409"],errorMSG:"ERC20: Transfer to zero address. (BEX#409)"},BAL410:{reasons:["BAL#410"],errorMSG:"ERC20: Mint to zero address. (BEX#410)"},BAL411:{reasons:["BAL#411"],errorMSG:"ERC20: Burn from zero address. (BEX#411)"},BAL412:{reasons:["BAL#412"],errorMSG:"ERC20: Approve from zero address. (BEX#412)"},BAL413:{reasons:["BAL#413"],errorMSG:"ERC20: Approve to zero address. (BEX#413)"},BAL414:{reasons:["BAL#414"],errorMSG:"ERC20: Transfer exceeds allowance. (BEX#414)"},BAL415:{reasons:["BAL#415"],errorMSG:"ERC20: Decreased allowance below zero. (BEX#415)"},BAL416:{reasons:["BAL#416"],errorMSG:"ERC20: Transfer exceeds balance. (BEX#416)"},BAL417:{reasons:["BAL#417"],errorMSG:"ERC20: Burn exceeds allowance. (BEX#417)"},BAL418:{reasons:["BAL#418"],errorMSG:"SafeERC20: Call failed. (BEX#418)"},BAL419:{reasons:["BAL#419"],errorMSG:"Address has insufficient balance. (BEX#419)"},BAL420:{reasons:["BAL#420"],errorMSG:"Address cannot send value. (BEX#420)"},BAL421:{reasons:["BAL#421"],errorMSG:"SafeCast: Value cannot fit into int256. (BEX#421)"},BAL422:{reasons:["BAL#422"],errorMSG:"AccessControl: Grant sender is not an admin. (BEX#422)"},BAL423:{reasons:["BAL#423"],errorMSG:"AccessControl: Revoke sender is not an admin. (BEX#423)"},BAL424:{reasons:["BAL#424"],errorMSG:"AccessControl: Renounce sender not allowed for accounts other than self. (BEX#424)"},BAL425:{reasons:["BAL#425"],errorMSG:"Buffer period has expired. (BEX#425)"},BAL426:{reasons:["BAL#426"],errorMSG:"Caller is not the owner. (BEX#426)"},BAL427:{reasons:["BAL#427"],errorMSG:"New owner cannot be zero address. (BEX#427)"},BAL428:{reasons:["BAL#428"],errorMSG:"Code deployment failed. (BEX#428)"},BAL429:{reasons:["BAL#429"],errorMSG:"Call to non-contract address. (BEX#429)"},BAL430:{reasons:["BAL#430"],errorMSG:"Low-level call failed. (BEX#430)"},BAL431:{reasons:["BAL#431"],errorMSG:"The contract is not paused. (BEX#431)"},BAL432:{reasons:["BAL#432"],errorMSG:"Address is already allowlisted. (BEX#432)"},BAL433:{reasons:["BAL#433"],errorMSG:"Address is not allowlisted. (BEX#433)"},BAL434:{reasons:["BAL#434"],errorMSG:"ERC20: Burn exceeds balance. (BEX#434)"},BAL435:{reasons:["BAL#435"],errorMSG:"Invalid operation. (BEX#435)"},BAL436:{reasons:["BAL#436"],errorMSG:"Codec overflow detected. (BEX#436)"},BAL437:{reasons:["BAL#437"],errorMSG:"The system is in recovery mode. (BEX#437)"},BAL438:{reasons:["BAL#438"],errorMSG:"The system is not in recovery mode. (BEX#438)"},BAL439:{reasons:["BAL#439"],errorMSG:"Induced failure. (BEX#439)"},BAL440:{reasons:["BAL#440"],errorMSG:"Expired signature. (BEX#440)"},BAL441:{reasons:["BAL#441"],errorMSG:"Malformed signature. (BEX#441)"},BAL442:{reasons:["BAL#442"],errorMSG:"SafeCast: Value cannot fit into uint64. (BEX#442)"},BAL443:{reasons:["BAL#443"],errorMSG:"Unhandled fee type. (BEX#443)"},BAL444:{reasons:["BAL#444"],errorMSG:"ERC20: Burn from zero address. (BEX#444)"},BAL500:{reasons:["BAL#500"],errorMSG:"Invalid pool ID. (BEX#500)"},BAL501:{reasons:["BAL#501"],errorMSG:"Caller is not the pool. (BEX#501)"},BAL502:{reasons:["BAL#502"],errorMSG:"Sender is not the asset manager. (BEX#502)"},BAL503:{reasons:["BAL#503"],errorMSG:"User does not allow the relayer. (BEX#503)"},BAL504:{reasons:["BAL#504"],errorMSG:"Invalid signature. (BEX#504)"},BAL505:{reasons:["BAL#505"],errorMSG:"Exit would yield fewer than the minimum tokens out. (BEX#505)"},BAL506:{reasons:["BAL#506"],errorMSG:"Join would cost more than the maximum tokens in. (BEX#506)"},BAL507:{reasons:["BAL#507"],errorMSG:"Swap violates user-supplied limits. (BEX#507)"},BAL508:{reasons:["BAL#508"],errorMSG:"Swap transaction not mined within the deadline. (BEX#508)"},BAL509:{reasons:["BAL#509"],errorMSG:"Cannot swap the same token. (BEX#509)"},BAL510:{reasons:["BAL#510"],errorMSG:"Unknown amount in the first swap of a batch. (BEX#510)"},BAL511:{reasons:["BAL#511"],errorMSG:"Malconstructed multihop swap. (BEX#511)"},BAL512:{reasons:["BAL#512"],errorMSG:"Internal balance overflow. (BEX#512)"},BAL513:{reasons:["BAL#513"],errorMSG:"Insufficient internal balance. (BEX#513)"},BAL514:{reasons:["BAL#514"],errorMSG:"Invalid BERA internal balance. (BEX#514)"},BAL515:{reasons:["BAL#515"],errorMSG:"Flashloan must repay the loan in the same transaction. (BEX#515)"},BAL516:{reasons:["BAL#516"],errorMSG:"Insufficient BERA balance. (BEX#516)"},BAL517:{reasons:["BAL#517"],errorMSG:"Unallocated BERA. (BEX#517)"},BAL518:{reasons:["BAL#518"],errorMSG:"Relayers cannot receive BERA directly (only through the Vault). (BEX#518)"},BAL519:{reasons:["BAL#519"],errorMSG:"Cannot use BERA sentinel for internal balance. (BEX#519)"},BAL520:{reasons:["BAL#520"],errorMSG:"Tokens mismatch. (BEX#520)"},BAL521:{reasons:["BAL#521"],errorMSG:"Token is not registered. (BEX#521)"},BAL522:{reasons:["BAL#522"],errorMSG:"Token is already registered. (BEX#522)"},BAL523:{reasons:["BAL#523"],errorMSG:"Tokens are already set. (BEX#523)"},BAL524:{reasons:["BAL#524"],errorMSG:"Tokens length must be 2. (BEX#524)"},BAL525:{reasons:["BAL#525"],errorMSG:"Nonzero token balance detected. (BEX#525)"},BAL526:{reasons:["BAL#526"],errorMSG:"Balance total overflow detected. (BEX#526)"},BAL527:{reasons:["BAL#527"],errorMSG:"Pool has no tokens. (BEX#527)"},BAL528:{reasons:["BAL#528"],errorMSG:"Insufficient flash loan balance. (BEX#528)"},BAL600:{reasons:["BAL#600"],errorMSG:"Swap fee percentage is too high. (BEX#600)"},BAL601:{reasons:["BAL#601"],errorMSG:"Flash loan fee percentage is too high. (BEX#601)"},BAL602:{reasons:["BAL#602"],errorMSG:"Insufficient flash loan fee amount. (BEX#602)"},BAL700:{reasons:["BAL#700"],errorMSG:"Splitter fee percentage is too high. (BEX#700)"},BAL998:{reasons:["BAL#998"],errorMSG:"Unimplemented functionality. (BEX#998)"},BAL999:{reasons:["BAL#999"],errorMSG:"An unexpected error occurred. (BEX#999)"},NO_SWAP_PATHS:{keywords:["No swap paths returned"],errorMSG:"No swap paths were found."}},AGGREGATOR:{NOT_ENOUGH_LIQUIDITY:{keywords:["Not enough liquidity"],errorMSG:"Not enough liquidity. Try a lower amount."}},POL:{REWARD_VAULT_FACTORY:{reasons:["VaultAlreadyExists"],errorMSG:"Failed to create action. An action already exists with this staking token."},NOT_REWARD_VAULT_MANAGER:{reasons:["NotRewardVaultManager"],errorMSG:"You are not the manager of this action."},NOT_INCENTIVE_MANAGER:{reasons:["NotIncentiveManager"],errorMSG:"You are not the incentive manager of this token."},DURATION_CHANGE_NOT_ALLOWED:{reasons:["DurationChangeNotAllowed"],errorMSG:"You cannot change the duration of this action."},INVALID_PROOF:{reasons:["InvalidProof"],errorMSG:"Tokens already claimed or invalid proof."},CONTRACT_PAUSED:{reasons:["EnforcedPause"],errorMSG:"The contract you're interacting with is temporarily paused."},DISTRIBUTION_PAUSED:{reasons:["DistributionEnforcedPause"],errorMSG:"Distribution is temporarily paused."},INVALID_VALIDATOR_COMMISSION:{reasons:["InvalidCommissionValue"],errorMSG:"Invalid commission percentage."},NOT_REWARD_ALLOCATOR:{reasons:["NotRewardAllocator"],errorMSG:"You are not the reward allocator of this validator."},NOT_OPERATOR:{reasons:["NotOperator"],errorMSG:"You are not the operator of this validator."},INVALID_REWARD_ALLOCATION:{reasons:["InvalidRewardAllocationWeights"],errorMSG:"Invalid reward allocation weights."},NOT_REWARD_DURATION_MANAGER:{reasons:["NotRewardDurationManager"],errorMSG:"You are not the reward duration manager of this validator."}},BEND:{INSUFFICIENT_POSITION:{keywords:["insufficient position"],errorMSG:"Insufficient position"},INSUFFICIENT_LIQUIDITY:{keywords:["insufficient liquidity on market"],errorMSG:"Insufficient liquidity on market."},ALL_CAPS_REACHED:{reasons:["AllCapsReached"],errorMSG:"All caps reached on vault."},AboveMaxTimelock:{reasons:["AboveMaxTimelock"],errorMSG:"Above max timelock"},AddressEmptyCode:{reasons:["AddressEmptyCode"],errorMSG:"Address empty code"},AddressInsufficientBalance:{reasons:["AddressInsufficientBalance"],errorMSG:"Address insufficient balance"},AllCapsReached:{reasons:["AllCapsReached"],errorMSG:"All caps reached"},AlreadyPending:{reasons:["AlreadyPending"],errorMSG:"Already pending"},AlreadySet:{reasons:["AlreadySet"],errorMSG:"Already set"},BelowMinTimelock:{reasons:["BelowMinTimelock"],errorMSG:"Below min timelock"},DuplicateMarket:{reasons:["DuplicateMarket"],errorMSG:"Duplicate market"},ECDSAInvalidSignature:{reasons:["ECDSAInvalidSignature"],errorMSG:"Invalid ECDSA signature"},ECDSAInvalidSignatureLength:{reasons:["ECDSAInvalidSignatureLength"],errorMSG:"Invalid ECDSA signature length"},ECDSAInvalidSignatureS:{reasons:["ECDSAInvalidSignatureS"],errorMSG:"Invalid ECDSA signature S value"},ERC20InsufficientBalance:{reasons:["ERC20InsufficientBalance"],errorMSG:"ERC20 insufficient balance"},ERC20InvalidApprover:{reasons:["ERC20InvalidApprover"],errorMSG:"ERC20 invalid approver"},ERC20InvalidReceiver:{reasons:["ERC20InvalidReceiver"],errorMSG:"ERC20 invalid receiver"},ERC20InvalidSender:{reasons:["ERC20InvalidSender"],errorMSG:"ERC20 invalid sender"},ERC20InvalidSpender:{reasons:["ERC20InvalidSpender"],errorMSG:"ERC20 invalid spender"},ERC2612ExpiredSignature:{reasons:["ERC2612ExpiredSignature"],errorMSG:"ERC2612 expired signature"},ERC2612InvalidSigner:{reasons:["ERC2612InvalidSigner"],errorMSG:"ERC2612 invalid signer"},ERC4626ExceededMaxDeposit:{reasons:["ERC4626ExceededMaxDeposit"],errorMSG:"ERC4626 exceeded max deposit"},ERC4626ExceededMaxMint:{reasons:["ERC4626ExceededMaxMint"],errorMSG:"ERC4626 exceeded max mint"},ERC4626ExceededMaxRedeem:{reasons:["ERC4626ExceededMaxRedeem"],errorMSG:"ERC4626 exceeded max redeem"},ERC4626ExceededMaxWithdraw:{reasons:["ERC4626ExceededMaxWithdraw"],errorMSG:"ERC4626 exceeded max withdraw"},FailedInnerCall:{reasons:["FailedInnerCall"],errorMSG:"Failed inner call"},InconsistentAsset:{reasons:["InconsistentAsset"],errorMSG:"Inconsistent asset"},InconsistentReallocation:{reasons:["InconsistentReallocation"],errorMSG:"Inconsistent reallocation"},InvalidAccountNonce:{reasons:["InvalidAccountNonce"],errorMSG:"Invalid account nonce"},InvalidMarketRemovalNonZeroCap:{reasons:["InvalidMarketRemovalNonZeroCap"],errorMSG:"Invalid market removal (non-zero cap)"},InvalidMarketRemovalNonZeroSupply:{reasons:["InvalidMarketRemovalNonZeroSupply"],errorMSG:"Invalid market removal (non-zero supply)"},InvalidMarketRemovalTimelockNotElapsed:{reasons:["InvalidMarketRemovalTimelockNotElapsed"],errorMSG:"Invalid market removal (timelock not elapsed)"},InvalidShortString:{reasons:["InvalidShortString"],errorMSG:"Invalid short string"},MarketNotCreated:{reasons:["MarketNotCreated"],errorMSG:"Market not created"},MarketNotEnabled:{reasons:["MarketNotEnabled"],errorMSG:"Market not enabled"},MathOverflowedMulDiv:{reasons:["MathOverflowedMulDiv"],errorMSG:"Math overflow"},MaxFeeExceeded:{reasons:["MaxFeeExceeded"],errorMSG:"Max fee exceeded"},MaxQueueLengthExceeded:{reasons:["MaxQueueLengthExceeded"],errorMSG:"Max queue length exceeded"},NoPendingValue:{reasons:["NoPendingValue"],errorMSG:"No pending value"},NonZeroCap:{reasons:["NonZeroCap"],errorMSG:"Non-zero cap"},NotAllocatorRole:{reasons:["NotAllocatorRole"],errorMSG:"Not allocator role"},NotCuratorNorGuardianRole:{reasons:["NotCuratorNorGuardianRole"],errorMSG:"Not curator or guardian role"},NotCuratorRole:{reasons:["NotCuratorRole"],errorMSG:"Not curator role"},NotEnoughLiquidity:{reasons:["NotEnoughLiquidity"],errorMSG:"Not enough liquidity"},NotGuardianRole:{reasons:["NotGuardianRole"],errorMSG:"Not guardian role"},OwnableInvalidOwner:{reasons:["OwnableInvalidOwner"],errorMSG:"Invalid owner"},OwnableUnauthorizedAccount:{reasons:["OwnableUnauthorizedAccount"],errorMSG:"Unauthorized account"},PendingCap:{reasons:["PendingCap"],errorMSG:"Pending cap"},PendingRemoval:{reasons:["PendingRemoval"],errorMSG:"Pending removal"},SafeCastOverflowedUintDowncast:{reasons:["SafeCastOverflowedUintDowncast"],errorMSG:"SafeCast overflow"},SafeERC20FailedOperation:{reasons:["SafeERC20FailedOperation"],errorMSG:"SafeERC20 failed operation"},StringTooLong:{reasons:["StringTooLong"],errorMSG:"String too long"},SupplyCapExceeded:{reasons:["SupplyCapExceeded"],errorMSG:"Supply cap exceeded"},TimelockNotElapsed:{reasons:["TimelockNotElapsed"],errorMSG:"Timelock not elapsed"},UnauthorizedMarket:{reasons:["UnauthorizedMarket"],errorMSG:"Unauthorized market"},ZeroAddress:{reasons:["ZeroAddress"],errorMSG:"Zero address"},ZeroFeeRecipient:{reasons:["ZeroFeeRecipient"],errorMSG:"Zero fee recipient"}}};function A({reason:o,message:r}){for(let n in p){let a=p[n];for(let c in a){let s=a[c];if(o&&_optionalChain([s, 'optionalAccess', _2 => _2.reasons, 'optionalAccess', _3 => _3.some, 'call', _4 => _4(l=>l===o)])||_optionalChain([s, 'optionalAccess', _5 => _5.keywords, 'optionalAccess', _6 => _6.some, 'call', _7 => _7(l=>_optionalChain([r, 'optionalAccess', _8 => _8.includes, 'call', _9 => _9(l.toLowerCase().trim())]))]))return s.errorMSG}}return u}var _viem = require('viem');var _internal = require('@berachain/config/internal');var E=[{inputs:[],name:"AlreadyInitiated",type:"error"},{inputs:[],name:"EmptyBundle",type:"error"},{inputs:[],name:"IncorrectReenterHash",type:"error"},{inputs:[],name:"MissingExpectedReenter",type:"error"}];var L=[{inputs:[],name:"AllowanceOverflow",type:"error"},{inputs:[],name:"AllowanceUnderflow",type:"error"},{inputs:[],name:"ETHTransferFailed",type:"error"},{inputs:[],name:"InsufficientAllowance",type:"error"},{inputs:[],name:"InsufficientBalance",type:"error"},{inputs:[],name:"InvalidPermit",type:"error"},{inputs:[],name:"Permit2AllowanceIsFixedAtInfinity",type:"error"},{inputs:[],name:"PermitExpired",type:"error"},{inputs:[],name:"TotalSupplyOverflow",type:"error"},{name:"AllowanceOverflow",type:"error",inputs:[]},{name:"AllowanceUnderflow",type:"error",inputs:[]},{name:"InsufficientAllowance",type:"error",inputs:[]},{name:"InsufficientBalance",type:"error",inputs:[]},{name:"InvalidPermit",type:"error",inputs:[]},{name:"Permit2AllowanceIsFixedAtInfinity",type:"error",inputs:[]},{name:"PermitExpired",type:"error",inputs:[]},{name:"TotalSupplyOverflow",type:"error",inputs:[]},{name:"ECDSAInvalidSignature",type:"error",inputs:[]},{name:"ECDSAInvalidSignatureLength",type:"error",inputs:[{type:"uint256"}]},{name:"ECDSAInvalidSignatureS",type:"error",inputs:[{type:"bytes32"}]},{name:"ERC20InsufficientAllowance",type:"error",inputs:[{type:"address"},{type:"uint256"},{type:"uint256"}]},{name:"ERC20InsufficientBalance",type:"error",inputs:[{type:"address"},{type:"uint256"},{type:"uint256"}]},{name:"ERC20InvalidApprover",type:"error",inputs:[{type:"address"}]},{name:"ERC20InvalidReceiver",type:"error",inputs:[{type:"address"}]},{name:"ERC20InvalidSender",type:"error",inputs:[{type:"address"}]},{name:"ERC20InvalidSpender",type:"error",inputs:[{type:"address"}]},{name:"ERC2612ExpiredSignature",type:"error",inputs:[{type:"uint256"}]},{name:"ERC2612InvalidSigner",type:"error",inputs:[{type:"address"},{type:"address"}]},{name:"InvalidAccountNonce",type:"error",inputs:[{type:"address"},{type:"uint256"}]},{name:"InvalidShortString",type:"error",inputs:[]},{name:"StringTooLong",type:"error",inputs:[{type:"string"}]}];var m=[{name:"AllowanceExpired",type:"error",inputs:[{type:"uint256"}]},{name:"AssetNotRegistered",type:"error",inputs:[{type:"address"}]},{name:"ERC20InsufficientAllowance",type:"error",inputs:[{type:"address"},{type:"uint256"},{type:"uint256"}]},{name:"ERC4626ExceededMaxWithdraw",type:"error",inputs:[{type:"address"},{type:"uint256"},{type:"uint256"}]},{name:"ERC721NonexistentToken",type:"error",inputs:[{type:"uint256"}]},{name:"ExecutionFailed",type:"error",inputs:[{type:"uint256"},{type:"address"},{type:"string"}]},{name:"ExpiredTransaction",type:"error",inputs:[]},{name:"FailedToCallFunction",type:"error",inputs:[{type:"bytes"}]},{name:"InsufficientAmountOut",type:"error",inputs:[]},{name:"MinimalOutputBalanceViolation",type:"error",inputs:[{type:"address"},{type:"uint256"}]},{name:"NotPegged",type:"error",inputs:[{type:"address"}]},{name:"RedeemMoreThanMax",type:"error",inputs:[]},{name:"SignatureExpired",type:"error",inputs:[{type:"uint256"}]},{name:"SlippageExceeded",type:"error",inputs:[{type:"uint256"},{type:"uint256"}]},{name:"SlippageExceeded",type:"error",inputs:[]},{name:"StalePrice",type:"error",inputs:[]},{name:"TooMuchSlippage",type:"error",inputs:[{type:"address"},{type:"uint256"},{type:"uint256"}]},{name:"TransferFromFailed",type:"error",inputs:[]},{name:"UnexpectedBasketModeStatus",type:"error",inputs:[]},{name:"zeroAmountRequired",type:"error",inputs:[]}];var S=[...L,...E,...m];function h(o){return o instanceof _viem.BaseError||o instanceof Error&&"shortMessage"in o&&"message"in o&&"details"in o}function t(o,r,n){return o instanceof n||o.name===r}function O(o){return o.errorName==="Error"&&Array.isArray(o.args)&&_optionalChain([o, 'access', _10 => _10.args, 'optionalAccess', _11 => _11.at, 'call', _12 => _12(0)])?_optionalChain([o, 'access', _13 => _13.args, 'optionalAccess', _14 => _14.at, 'call', _15 => _15(0)]):o.errorName}function M({error:o,abi:r,revertIfUnknown:n=!0}){if(!h(o)){if(n)throw o;return o instanceof _viem.BaseError?{reason:o.shortMessage,rootCause:o}:{reason:o.message,rootCause:o}}let e=o;for(;h(e);){if(t(e,"ContractFunctionExecutionError",_viem.ContractFunctionExecutionError)){e=e.cause;continue}if(t(e,"TransactionExecutionError",_viem.TransactionExecutionError)&&e.cause instanceof _viem.AtomicReadyWalletRejectedUpgradeError)return{reason:"AtomicReadyWalletRejectedUpgradeError",rootCause:e.cause};if(t(e,"RpcRequestError",_viem.RpcRequestError)){if(!e.data){if(typeof e.cause=="object"&&e.cause&&"message"in e.cause&&typeof e.cause.message=="string")return{reason:e.cause.message,rootCause:e.cause};throw new Error("No data",{cause:e})}let a=_viem.decodeErrorResult.call(void 0, {data:e.data,abi:[...S,..._nullishCoalesce(r, () => ([]))]});return{reason:_nullishCoalesce(O(a), () => (e.shortMessage)),rootCause:e}}if(t(e,"ContractFunctionRevertedError",_viem.ContractFunctionRevertedError))return{reason:_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(e.reason, () => (e.signature)), () => (_optionalChain([e, 'access', _16 => _16.data, 'optionalAccess', _17 => _17.errorName]))), () => (e.shortMessage)),rootCause:e};if(t(e,"UserRejectedRequestError",_viem.UserRejectedRequestError))return{reason:"UserRejectedRequestError",rootCause:e};if(t(e,"HttpRequestError",_viem.HttpRequestError))return{reason:`HttpRequestError(status:${e.status})`,rootCause:e,isRequestError:!0};if(!e.cause)return{reason:e.name,rootCause:e};e=e.cause}if(!n)return{reason:void 0,rootCause:e};throw new Error("UnknownErrorInGetRevertReason",{cause:e})}function f(o){switch(o){case"UserRejectedRequestError":case 4001:return"UserRejectedRequestError";default:return`RPC_ERROR_${o}`}}var i= (_class =class o extends Error{__init() {this.reason=null}__init2() {this._tags={}}set tags(r){this._tags=r}get tags(){return{...this._tags,"error.displayMessage":this.displayMessage,"error.reason":this.reason,"error.level":this.level}}__init3() {this.level="error"}__init4() {this.extra={}}constructor({message:r,displayMessage:n,cause:e,reason:a,level:c,abi:s,tags:l,chainId:R,fingerprint:v}){let d=r;if(d||(e instanceof _viem.BaseError?d=e.shortMessage:(e instanceof Error||typeof e=="object"&&e!==null&&"message"in e&&typeof e.message=="string")&&(d=e.message)),super(d,{cause:e});_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);,this.name="BeraError",this.fingerprint=v,this.cause=e,this.chainId=R,a)this.reason=a;else if(e instanceof Error)try{let w=M({error:e,revertIfUnknown:!0,abi:s});this.reason=_nullishCoalesce(_optionalChain([w, 'optionalAccess', _18 => _18.reason]), () => (null))}catch (e2){}c?this.level=c:this.reason===f("UserRejectedRequestError")?this.level="info":this.level="error";let B=n;this.cause instanceof o&&this.cause.displayMessage!==u&&(B=this.cause.displayMessage),B||(B=A(this)),this.displayMessage=_nullishCoalesce(B, () => (u)),this.tags={...this.tags,...l},!_internal.appConfig.env.isProduction&&process.env.NODE_ENV!=="test"&&(console.group("BeraError thrown"),console.debug("Level",this.level),console.debug("Reason",this.reason),console.debug("Message",this.message),console.debug("Display Message",this.displayMessage),console.debug("Cause",this.cause),console.groupEnd())}}, _class);var _mainnet = require('@berachain/config/mainnet');var y= (_class2 =class o extends i{static isCorsError(r){return r.cause instanceof Response&&r.cause.type==="cors"}__init5() {this.queryRichfulDomains=[_mainnet.mainnet.bex.aggregatorsProxyUrl,"https://api.fly.trade/aggregator/quote","https://open-api.openocean.finance/v4/bera/swap","/api/aggregators?aggregator"]}static __initStatic() {this.REASON_MAP={429:"RATE_LIMITED_429",NETWORK_ERROR:"NETWORK_ERROR",CORS_ERROR:"CORS"}}constructor(r){if(super(r);_class2.prototype.__init5.call(this);,this.name="RequestError",this.response=r.response,this.payload=r.payload,this.endpoint=this.setEndpoint(r.endpoint),!this.message&&typeof this.cause=="object"&&this.cause!==null&&"error"in this.cause&&typeof this.cause.error=="string"&&(this.message=this.cause.error),r.statusCode?this.statusCode=r.statusCode:this.response instanceof Response&&(this.statusCode=this.response.status),this.statusCode===429)this.reason=o.REASON_MAP[429],this.displayMessage=p.HTTP.RATE_LIMITED_429.errorMSG,this.level=_nullishCoalesce(r.level, () => ("warning"));else{let e=this.tryMatchNetworkError();e&&(this.reason=_nullishCoalesce(this.reason, () => (e.reason)),this.level=_nullishCoalesce(r.level, () => ("warning")),this.endpoint.url=_nullishCoalesce(this.endpoint.url, () => (e.url)))}this.tags={...this.tags,"error.statusCode":this.statusCode,"operation.type":"query",...r.tags};let n="";this.reason?n+=`${this.reason} \u2013 `:this.statusCode&&this.statusCode>=400&&(n+=`HTTP ${this.statusCode} \u2013 `),this.message=`${n}${this.endpoint.type}(${this.endpoint.url}): ${this.message}`}setEndpoint(r){if(typeof r=="string"||r instanceof URL?this.endpoint={url:typeof r=="string"?r:r.toString()}:this.endpoint={...this.endpoint,...r,url:r.url.toString()},this.queryRichfulDomains.some(n=>this.endpoint.url.includes(n)))try{let n=new URL(this.endpoint.url);n.search="",this.endpoint.url=n.toString()}catch (e3){}return this.tags={...this.tags,"operation.source.url":this.endpoint.url,"operation.source.name":this.endpoint.name,"operation.source.type":this.endpoint.type},this.endpoint}tryMatchNetworkError(){if(this.cause instanceof Error&&"message"in this.cause&&typeof this.cause.message=="string"||this.cause instanceof TypeError){let r=this.cause.message;if(r.startsWith("Network Error"))return{reason:o.REASON_MAP.NETWORK_ERROR,message:r,url:this.endpoint.url};let n=r.match(/^(?:NetworkError when attempting to fetch resource\.|Failed to fetch|Load failed) \(([a-z0-9-.]+)\)$/);if(n)return{reason:o.REASON_MAP.NETWORK_ERROR,message:r,url:n[1]}}return!1}}, _class2.__initStatic(), _class2);var G=class extends i{constructor(r){super(r),this.level=_nullishCoalesce(r.level, () => ("warning")),this.name="InvalidArgumentError",this.property=r.property,this.value=r.value,this.expected=r.expected,this.message=`Invalid argument: ${this.property} ${this.isMissing?"is missing":`is invalid, expected ${this.expected}`}`,r.reason||(this.reason=`${this.name}.${this.property}.${this.isInvalid?"invalid":"missing"}`)}get isMissing(){return this.value===void 0}get isInvalid(){return this.value!==void 0}};exports.a = A; exports.b = S; exports.c = O; exports.d = M; exports.e = i; exports.f = y; exports.g = G;
2
+ //# sourceMappingURL=chunk-7SC4VD3U.cjs.map