@berachain/berajs 0.2.4 → 0.2.6-patch.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (463) hide show
  1. package/README.md +0 -0
  2. package/dist/abi/exports.cjs +1 -1
  3. package/dist/abi/exports.cjs.map +1 -1
  4. package/dist/abi/exports.d.cts +17 -1
  5. package/dist/abi/exports.d.ts +17 -1
  6. package/dist/abi/exports.mjs +1 -1
  7. package/dist/abi/exports.mjs.map +1 -1
  8. package/dist/actions/exports.cjs +1 -1
  9. package/dist/actions/exports.cjs.map +1 -1
  10. package/dist/actions/exports.d.cts +9 -38
  11. package/dist/actions/exports.d.ts +9 -38
  12. package/dist/actions/exports.mjs +1 -1
  13. package/dist/actions/exports.mjs.map +1 -1
  14. package/dist/chunk-2YBHAMDV.cjs +2 -0
  15. package/dist/chunk-2YBHAMDV.cjs.map +1 -0
  16. package/dist/chunk-57RINXU6.cjs +2 -0
  17. package/dist/chunk-57RINXU6.cjs.map +1 -0
  18. package/dist/{chunk-AX2YQQFQ.mjs → chunk-74QD4JAH.mjs} +2 -2
  19. package/dist/chunk-74QD4JAH.mjs.map +1 -0
  20. package/dist/chunk-74WA35RI.cjs +2 -0
  21. package/dist/chunk-74WA35RI.cjs.map +1 -0
  22. package/dist/{chunk-7WRTK7RJ.mjs → chunk-BEKH5EYT.mjs} +2 -2
  23. package/dist/chunk-BEKH5EYT.mjs.map +1 -0
  24. package/dist/{chunk-FCWDGE62.cjs → chunk-CF3LFNXG.cjs} +2 -2
  25. package/dist/chunk-CF3LFNXG.cjs.map +1 -0
  26. package/dist/chunk-COMMLZ3O.mjs +2 -0
  27. package/dist/chunk-COMMLZ3O.mjs.map +1 -0
  28. package/dist/chunk-DDEQFR3M.cjs +2 -0
  29. package/dist/chunk-DDEQFR3M.cjs.map +1 -0
  30. package/dist/{chunk-6LDOG5RL.cjs → chunk-DK42F2ZM.cjs} +2 -2
  31. package/dist/chunk-DK42F2ZM.cjs.map +1 -0
  32. package/dist/{chunk-7SMWQ6SN.mjs → chunk-FM3WDBFH.mjs} +2 -2
  33. package/dist/chunk-FM3WDBFH.mjs.map +1 -0
  34. package/dist/chunk-HWOGQSNL.cjs +4 -0
  35. package/dist/chunk-HWOGQSNL.cjs.map +1 -0
  36. package/dist/chunk-I7M43BB4.cjs +2 -0
  37. package/dist/chunk-I7M43BB4.cjs.map +1 -0
  38. package/dist/chunk-IBJOI5SN.mjs +4 -0
  39. package/dist/chunk-IBJOI5SN.mjs.map +1 -0
  40. package/dist/chunk-IDFMLLDY.mjs +2 -0
  41. package/dist/chunk-IDFMLLDY.mjs.map +1 -0
  42. package/dist/{chunk-YZV5LKIP.cjs → chunk-LNVR4BW6.cjs} +2 -2
  43. package/dist/chunk-LNVR4BW6.cjs.map +1 -0
  44. package/dist/chunk-MJZHJFZO.mjs +2 -0
  45. package/dist/{chunk-YNO7BCCM.mjs.map → chunk-MJZHJFZO.mjs.map} +1 -1
  46. package/dist/chunk-MK5NS5B5.mjs +2 -0
  47. package/dist/chunk-MK5NS5B5.mjs.map +1 -0
  48. package/dist/{chunk-C6ZGUO4H.cjs → chunk-NMH7LHPW.cjs} +2 -2
  49. package/dist/chunk-NMH7LHPW.cjs.map +1 -0
  50. package/dist/chunk-NVHV2LDK.cjs +2 -0
  51. package/dist/chunk-NVHV2LDK.cjs.map +1 -0
  52. package/dist/chunk-OGBD5YOG.mjs +2 -0
  53. package/dist/chunk-OGBD5YOG.mjs.map +1 -0
  54. package/dist/chunk-OIYXOKTT.cjs.map +1 -1
  55. package/dist/chunk-OUD27MU7.cjs.map +1 -1
  56. package/dist/chunk-PLIH6KQM.mjs +2 -0
  57. package/dist/chunk-PLIH6KQM.mjs.map +1 -0
  58. package/dist/chunk-QRAIGQF2.mjs +2 -0
  59. package/dist/chunk-QRAIGQF2.mjs.map +1 -0
  60. package/dist/chunk-RWOICHRW.cjs +2 -0
  61. package/dist/chunk-RWOICHRW.cjs.map +1 -0
  62. package/dist/chunk-T5FSQ3YE.mjs +2 -0
  63. package/dist/chunk-T5FSQ3YE.mjs.map +1 -0
  64. package/dist/chunk-WRFDB3QJ.cjs.map +1 -1
  65. package/dist/chunk-XNJLSA6P.cjs.map +1 -1
  66. package/dist/contexts/exports.cjs +1 -1
  67. package/dist/contexts/exports.cjs.map +1 -1
  68. package/dist/contexts/exports.d.cts +1 -1
  69. package/dist/contexts/exports.d.ts +1 -1
  70. package/dist/contexts/exports.mjs +1 -1
  71. package/dist/contexts/exports.mjs.map +1 -1
  72. package/dist/{defaultFlags-d0kPbT0i.d.cts → defaultFlags-D6KfkTZx.d.cts} +1 -1
  73. package/dist/{defaultFlags-d0kPbT0i.d.ts → defaultFlags-D6KfkTZx.d.ts} +1 -1
  74. package/dist/enum/exports.cjs +1 -1
  75. package/dist/enum/exports.cjs.map +1 -1
  76. package/dist/enum/exports.d.cts +1 -1
  77. package/dist/enum/exports.d.ts +1 -1
  78. package/dist/enum/exports.mjs +1 -1
  79. package/dist/errors/exports.cjs +1 -1
  80. package/dist/errors/exports.cjs.map +1 -1
  81. package/dist/errors/exports.d.cts +8 -3
  82. package/dist/errors/exports.d.ts +8 -3
  83. package/dist/errors/exports.mjs +1 -1
  84. package/dist/{getValidatorQueuedOperatorAddress-DZgrPmZ2.d.cts → getValidatorQueuedOperatorAddress-BdDYHycN.d.cts} +15 -4
  85. package/dist/{getValidatorQueuedOperatorAddress-CqR6cyqC.d.ts → getValidatorQueuedOperatorAddress-CmiPJmsr.d.ts} +15 -4
  86. package/dist/{global.d-BeYWDreg.d.ts → global.d-3GQMgC9k.d.ts} +1 -1
  87. package/dist/{global.d-DghRxpHd.d.cts → global.d-CwT1Phzf.d.cts} +1 -1
  88. package/dist/hooks/exports.cjs +3 -3
  89. package/dist/hooks/exports.cjs.map +1 -1
  90. package/dist/hooks/exports.d.cts +54 -75
  91. package/dist/hooks/exports.d.ts +54 -75
  92. package/dist/hooks/exports.mjs +3 -3
  93. package/dist/hooks/exports.mjs.map +1 -1
  94. package/dist/{txnEnum-DxPRHSJt.d.cts → txnEnum-CCuQUFlh.d.cts} +7 -0
  95. package/dist/{txnEnum-DxPRHSJt.d.ts → txnEnum-CCuQUFlh.d.ts} +7 -0
  96. package/dist/types/exports.cjs.map +1 -1
  97. package/dist/types/exports.d.cts +37 -4
  98. package/dist/types/exports.d.ts +37 -4
  99. package/dist/utils/exports.cjs +1 -1
  100. package/dist/utils/exports.cjs.map +1 -1
  101. package/dist/utils/exports.d.cts +2 -2
  102. package/dist/utils/exports.d.ts +2 -2
  103. package/dist/utils/exports.mjs +1 -1
  104. package/dist/utils/exports.mjs.map +1 -1
  105. package/package.json +25 -25
  106. package/src/abi/enso/ensoWalletV2Factory.ts +9 -0
  107. package/src/abi/exports.ts +1 -0
  108. package/src/abi/pyth/pyth.ts +0 -0
  109. package/src/actions/clients/BeraApolloClient.ts +3 -3
  110. package/src/actions/clients/getApolloClient.ts +5 -5
  111. package/src/actions/clients/getEnsoClient.ts +1 -1
  112. package/src/actions/dex/__tests__/aggregators.unit.test.ts +3 -3
  113. package/src/actions/dex/__tests__/getOnChainPool.unit.test.ts +1 -1
  114. package/src/actions/dex/aggregators/base.ts +12 -8
  115. package/src/actions/dex/aggregators/bex.ts +8 -8
  116. package/src/actions/dex/aggregators/bgt.ts +4 -4
  117. package/src/actions/dex/aggregators/enso/enso.ts +28 -20
  118. package/src/actions/dex/aggregators/enso/ensoErc4626.debug.test.ts +1 -1
  119. package/src/actions/dex/aggregators/enso/ensoErc4626.ts +7 -4
  120. package/src/actions/dex/aggregators/erc4626.ts +10 -6
  121. package/src/actions/dex/aggregators/fly.ts +9 -5
  122. package/src/actions/dex/aggregators/haiku.integration.test.ts +3 -3
  123. package/src/actions/dex/aggregators/haiku.ts +9 -5
  124. package/src/actions/dex/aggregators/honey.ts +15 -15
  125. package/src/actions/dex/aggregators/kyberswap.ts +8 -4
  126. package/src/actions/dex/aggregators/oogabooga.ts +8 -4
  127. package/src/actions/dex/aggregators/openOcean.ts +12 -8
  128. package/src/actions/dex/aggregators/wbera.ts +8 -4
  129. package/src/actions/dex/b-sdk.ts +2 -2
  130. package/src/actions/dex/getAllPools.ts +2 -2
  131. package/src/actions/dex/getApiPool.ts +2 -2
  132. package/src/actions/dex/getGlobalLiquidityAndSwapVolume.ts +2 -2
  133. package/src/actions/dex/getIsTokenExploited.ts +1 -1
  134. package/src/actions/dex/getOnChainPool.ts +3 -3
  135. package/src/actions/dex/getPoolEvents.ts +2 -2
  136. package/src/actions/dex/getPoolHistoricalData.ts +2 -2
  137. package/src/actions/dex/getVaultPausedState.ts +1 -1
  138. package/src/actions/enso/__tests__/getBendDemultiplyBundle.action.unit.test.ts +175 -0
  139. package/src/actions/enso/__tests__/getBendDemultiplyBundle.unit.test.ts +150 -0
  140. package/src/actions/enso/__tests__/getBendMultiplyBundle.action.unit.test.ts +138 -0
  141. package/src/actions/enso/__tests__/getBendMultiplyBundle.unit.test.ts +194 -0
  142. package/src/actions/enso/{getEnsoUserTokensWithBalances.debug.test.ts → __tests__/getEnsoUserTokensWithBalances.debug.test.ts} +3 -3
  143. package/src/actions/enso/__tests__/helpers.ts +42 -0
  144. package/src/actions/enso/__tests__/util.unit.test.ts +95 -0
  145. package/src/actions/enso/flashloan.ts +127 -0
  146. package/src/actions/enso/getBendDemultiplyBundle.ts +325 -0
  147. package/src/actions/enso/getBendMultiplyBundle.ts +348 -0
  148. package/src/actions/enso/getEnsoSwapBundle.ts +2 -2
  149. package/src/actions/enso/getEnsoUserTokensWithBalances.ts +5 -5
  150. package/src/actions/enso/util.ts +150 -5
  151. package/src/actions/exports.ts +0 -2
  152. package/src/actions/governance/__tests__/checkProposalField.unit.test.ts +2 -2
  153. package/src/actions/governance/__tests__/getDecodedFunctionData.integration.test.ts +2 -2
  154. package/src/actions/governance/__tests__/getQuorum.integration.test.ts +2 -2
  155. package/src/actions/governance/checkProposalField.ts +1 -1
  156. package/src/actions/governance/computeActualStatus.ts +1 -1
  157. package/src/actions/governance/getAllProposals.ts +1 -1
  158. package/src/actions/governance/getBodyErrors.ts +1 -1
  159. package/src/actions/governance/getProposalDetails.ts +1 -1
  160. package/src/actions/governance/getProposalFromTx.ts +1 -1
  161. package/src/actions/governance/getProposalParams.ts +3 -3
  162. package/src/actions/governance/getProposalVotes.ts +1 -1
  163. package/src/actions/governance/getQuorum.ts +2 -2
  164. package/src/actions/honey/getCollateralWeights.ts +2 -2
  165. package/src/actions/honey/getGlobalCapLimit.ts +4 -4
  166. package/src/actions/honey/getHoneyCollaterals.ts +5 -5
  167. package/src/actions/honey/getHoneyFees.ts +1 -1
  168. package/src/actions/honey/getHoneyPausedState.ts +1 -1
  169. package/src/actions/honey/getHoneyPreview.ts +3 -3
  170. package/src/actions/honey/getHoneyRootPriceOracle.ts +1 -1
  171. package/src/actions/honey/getHoneyVaultsBalance.ts +2 -2
  172. package/src/actions/honey/getRelativeCapLimit.ts +3 -3
  173. package/src/actions/honey/getSharesWithoutFees.ts +1 -1
  174. package/src/actions/honey/getSwapPayload.ts +6 -6
  175. package/src/actions/honey/isBadCollateralAsset.ts +2 -2
  176. package/src/actions/honey/isBasketModeEnabled.ts +2 -2
  177. package/src/actions/honey/tests/pyth.integration.test.ts +3 -3
  178. package/src/actions/misc/getBlockTimestamp.ts +2 -2
  179. package/src/actions/pol/__tests__/getAllValidators.integration.test.ts +2 -2
  180. package/src/actions/pol/__tests__/rewardVaults.integration.test.ts +1 -1
  181. package/src/actions/pol/getBGTGlobalInfo.ts +2 -2
  182. package/src/actions/pol/getBgtAprSimulation.ts +1 -1
  183. package/src/actions/pol/getBgtAprSimultaion.unit.test.ts +1 -1
  184. package/src/actions/pol/getBgtTokenTotalBoosts.ts +2 -2
  185. package/src/actions/pol/getBgtTokenTotalSupply.ts +2 -2
  186. package/src/actions/pol/getBlockTime.debug.test.ts +13 -0
  187. package/src/actions/pol/getBlockTime.ts +14 -23
  188. package/src/actions/pol/getEarnedStakedBeraVault.ts +3 -3
  189. package/src/actions/pol/getGlobalCuttingBoard.ts +0 -0
  190. package/src/actions/pol/getGlobalData.ts +2 -2
  191. package/src/actions/pol/getIncentiveFeeClaimStats.ts +4 -4
  192. package/src/actions/pol/getLSTStakeConfig.ts +5 -5
  193. package/src/actions/pol/getMarkets.ts +2 -2
  194. package/src/actions/pol/getRewardProofsByValidator.ts +4 -4
  195. package/src/actions/pol/getRewardTokenToBeraRate.ts +1 -1
  196. package/src/actions/pol/getRewardVault.ts +3 -3
  197. package/src/actions/pol/getRewardVaultBeaconImplementation.integration.test.ts +1 -1
  198. package/src/actions/pol/getRewardVaultBeaconImplementation.ts +3 -3
  199. package/src/actions/pol/getRewardVaultDurationConstants.integration.test.ts +1 -1
  200. package/src/actions/pol/getRewardVaultDurationConstants.ts +1 -1
  201. package/src/actions/pol/getRewardVaultFromToken.ts +1 -1
  202. package/src/actions/pol/getRewardVaultIncentives.ts +2 -2
  203. package/src/actions/pol/getRewardVaultRewards.ts +1 -1
  204. package/src/actions/pol/getRewardVaults.ts +1 -1
  205. package/src/actions/pol/getSWBeraVaultMetadata.ts +20 -22
  206. package/src/actions/pol/getSWBeraWithdrawal.ts +4 -4
  207. package/src/actions/pol/getStakedBeraAPR.ts +2 -2
  208. package/src/actions/pol/getStakedBeraSnapshots.ts +2 -2
  209. package/src/actions/pol/getStakingDailyAssets.ts +3 -3
  210. package/src/actions/pol/getStakingTokenInformation.ts +2 -2
  211. package/src/actions/pol/getTotalStakedAmount.ts +1 -1
  212. package/src/actions/pol/getUserClaimableIncentives.ts +4 -4
  213. package/src/actions/pol/getUserVaultInfo.ts +1 -1
  214. package/src/actions/pol/getUserVaults.ts +4 -4
  215. package/src/actions/pol/getUserVaultsBalance.ts +1 -1
  216. package/src/actions/pol/getUserVaultsReward.ts +0 -0
  217. package/src/actions/pol/getVaultHistory.ts +2 -2
  218. package/src/actions/pol/getVaultValidators.ts +1 -1
  219. package/src/actions/pol/getVaultsSupply.ts +0 -0
  220. package/src/actions/prices/__tests__/prices.integration.test.ts +2 -2
  221. package/src/actions/prices/getTokenCurrentPrices.ts +5 -5
  222. package/src/actions/pyth/getHoneyPythFeeds.ts +2 -2
  223. package/src/actions/pyth/getUpdateFee.ts +2 -2
  224. package/src/actions/tokens/getAllowances.ts +2 -2
  225. package/src/actions/tokens/getTokenInformation.ts +2 -2
  226. package/src/actions/tokens/getTokens.ts +3 -3
  227. package/src/actions/tokens/getUnderlyingToken.ts +4 -4
  228. package/src/actions/tokens/getWalletBalances.integration.test.ts +1 -1
  229. package/src/actions/tokens/getWalletBalances.ts +4 -4
  230. package/src/actions/transactions/beraWriteContract.integration.test.ts +6 -6
  231. package/src/actions/transactions/beraWriteContract.ts +12 -12
  232. package/src/actions/validators/getActiveBoostAndCommissionChangeDelay.integration.test.ts +1 -1
  233. package/src/actions/validators/getActiveBoostAndCommissionChangeDelay.ts +1 -1
  234. package/src/actions/validators/getAllValidators.ts +2 -2
  235. package/src/actions/validators/getApiValidator.ts +2 -2
  236. package/src/actions/validators/getBaselineRewardAllocation.ts +1 -1
  237. package/src/actions/validators/getDailyValidatorBlockStats.ts +1 -1
  238. package/src/actions/validators/getDefaultRewardAllocation.ts +1 -1
  239. package/src/actions/validators/getUserActiveValidators.ts +31 -33
  240. package/src/actions/validators/getUserBoosts.ts +12 -8
  241. package/src/actions/validators/getUserBoostsOnValidator.ts +15 -3
  242. package/src/actions/validators/getUserStakingPositions.ts +1 -1
  243. package/src/actions/validators/getValidatorAnalytics.ts +2 -2
  244. package/src/actions/validators/getValidatorCommission.ts +1 -1
  245. package/src/actions/validators/getValidatorEstimatedBgtPerYear.ts +1 -1
  246. package/src/actions/validators/getValidatorOperatorAddress.ts +1 -1
  247. package/src/actions/validators/getValidatorQueuedCommission.ts +1 -1
  248. package/src/actions/validators/getValidatorQueuedOperatorAddress.ts +1 -1
  249. package/src/actions/validators/getValidatorQueuedRewardAllocation.ts +1 -1
  250. package/src/actions/validators/getValidatorRewardAllocation.ts +1 -1
  251. package/src/actions/validators/getValidatorRewardAllocatorAddress.ts +1 -1
  252. package/src/actions/validators/utils/__tests__/validatorUtils.integration.test.ts +4 -4
  253. package/src/contexts/BeraFlags/defaultFlags.ts +4 -0
  254. package/src/contexts/BexStatusProvider.tsx +1 -1
  255. package/src/contexts/HoneyConfigProvider.tsx +3 -3
  256. package/src/contexts/SwrFallback.tsx +2 -2
  257. package/src/contexts/TokensProvider.tsx +3 -3
  258. package/src/contexts/block-time-provider.tsx +1 -1
  259. package/src/contexts/exports.ts +0 -0
  260. package/src/data/contracts.ts +10 -0
  261. package/src/enum/exports.ts +0 -0
  262. package/src/enum/polling.ts +0 -0
  263. package/src/enum/txnEnum.ts +9 -0
  264. package/src/errors/BeraMonitoring.ts +2 -2
  265. package/src/errors/BeraTracing.ts +2 -2
  266. package/src/errors/RequestError.ts +1 -1
  267. package/src/errors/assert.ts +18 -0
  268. package/src/errors/getErrorMessage.ts +0 -0
  269. package/src/errors/getRevertReason.integration.test.ts +7 -7
  270. package/src/errors/getRevertReason.ts +1 -1
  271. package/src/errors/parseViemError.ts +1 -1
  272. package/src/hooks/bend/useGetConvertToAssets.ts +4 -4
  273. package/src/hooks/dex/useAggregatorsQuotes.ts +19 -19
  274. package/src/hooks/dex/useAggregatorsRouterFeeBps.ts +2 -2
  275. package/src/hooks/dex/useAllUserPools.ts +3 -3
  276. package/src/hooks/dex/useApiPool.ts +3 -3
  277. package/src/hooks/dex/useBexStatus.ts +1 -1
  278. package/src/hooks/dex/useCreatePool.ts +9 -9
  279. package/src/hooks/dex/useExploitedTokens.ts +3 -3
  280. package/src/hooks/dex/useGlobalLiquidityAndSwapVolume.ts +1 -1
  281. package/src/hooks/dex/useLiquidityMismatch.ts +3 -3
  282. package/src/hooks/dex/useLpPosition.ts +7 -4
  283. package/src/hooks/dex/useMultipleTokenApprovalsWithSlippage.ts +4 -4
  284. package/src/hooks/dex/useOnChainPoolData.ts +3 -3
  285. package/src/hooks/dex/usePollPoolCreationRelayerApproval.ts +3 -3
  286. package/src/hooks/dex/usePool.ts +7 -40
  287. package/src/hooks/dex/usePoolEvents.ts +2 -2
  288. package/src/hooks/dex/usePoolHistoricalData.ts +6 -3
  289. package/src/hooks/dex/usePools.ts +3 -3
  290. package/src/hooks/dex/usePriceImpact.ts +2 -2
  291. package/src/hooks/dex/useSingleAggregatorQuote.ts +13 -13
  292. package/src/hooks/enso/useBendDemultiply.ts +158 -0
  293. package/src/hooks/enso/useBendMultiply.ts +163 -0
  294. package/src/hooks/enso/useBendZapSupply.ts +7 -7
  295. package/src/hooks/enso/useEnsoSwapBundle.ts +6 -6
  296. package/src/hooks/enso/useEnsoUserTokensWithBalances.ts +5 -5
  297. package/src/hooks/enso/useEnsoWalletV2Address.ts +38 -0
  298. package/src/hooks/enso/useIsBendAuthorized.ts +47 -0
  299. package/src/hooks/enso/useZapStakeBera.ts +4 -4
  300. package/src/hooks/exports.ts +4 -3
  301. package/src/hooks/governance/useCreateProposal.ts +3 -3
  302. package/src/hooks/governance/useGetPastVotes.ts +2 -2
  303. package/src/hooks/governance/useHasVoted.ts +2 -2
  304. package/src/hooks/governance/useIsCanceller.ts +4 -4
  305. package/src/hooks/governance/usePollAllProposals.ts +3 -3
  306. package/src/hooks/governance/usePollProposal.ts +7 -4
  307. package/src/hooks/governance/usePollProposalThreshold.ts +3 -3
  308. package/src/hooks/governance/usePollProposalVotes.ts +1 -1
  309. package/src/hooks/governance/usePollUserDelegates.ts +7 -4
  310. package/src/hooks/governance/useProposalFromTx.ts +1 -1
  311. package/src/hooks/governance/useProposalSnapshot.ts +2 -2
  312. package/src/hooks/governance/useProposalState.ts +2 -2
  313. package/src/hooks/governance/useProposalTimelockState.ts +2 -2
  314. package/src/hooks/governance/useQuorum.ts +1 -1
  315. package/src/hooks/honey/useCappedGlobally.ts +8 -5
  316. package/src/hooks/honey/useCappedRelatively.ts +7 -4
  317. package/src/hooks/honey/useCollateralWeights.ts +8 -5
  318. package/src/hooks/honey/useHoneyAlerts.ts +5 -5
  319. package/src/hooks/honey/useHoneyBalances.ts +7 -7
  320. package/src/hooks/honey/useHoneyChartData.ts +1 -1
  321. package/src/hooks/honey/useHoneySwapState.ts +4 -4
  322. package/src/hooks/honey/useHoneyVaultsBalance.ts +8 -5
  323. package/src/hooks/honey/useIsBadCollateralAsset.ts +9 -6
  324. package/src/hooks/honey/useIsBasketModeEnabled.ts +8 -5
  325. package/src/hooks/honey/usePythLatestPrices.ts +4 -4
  326. package/src/hooks/perps/usePythUpdateFee.ts +4 -4
  327. package/src/hooks/pol/useBgtAprSimulation.ts +1 -1
  328. package/src/hooks/pol/useBgtUnstakedBalance.ts +7 -4
  329. package/src/hooks/pol/useClaimableFees.ts +4 -4
  330. package/src/hooks/pol/useOnChainRewardVault.ts +7 -7
  331. package/src/hooks/pol/usePollGlobalData.ts +9 -3
  332. package/src/hooks/pol/usePollMarkets.ts +5 -2
  333. package/src/hooks/pol/useQueuedBeraUnlock.ts +4 -4
  334. package/src/hooks/pol/useRewardTokenToBeraRate.ts +4 -4
  335. package/src/hooks/pol/useRewardVault.ts +5 -2
  336. package/src/hooks/pol/useRewardVaultBalanceFromStakingToken.ts +2 -2
  337. package/src/hooks/pol/useRewardVaultFromToken.ts +2 -2
  338. package/src/hooks/pol/useRewardVaultIncentives.ts +2 -2
  339. package/src/hooks/pol/useRewardVaultRewards.ts +3 -3
  340. package/src/hooks/pol/useRewardVaults.ts +2 -2
  341. package/src/hooks/pol/useStakedAPR.ts +3 -3
  342. package/src/hooks/pol/useStakedData.ts +10 -10
  343. package/src/hooks/pol/useStakedSnapshots.ts +3 -3
  344. package/src/hooks/pol/useStakingVaultsMetadata.ts +40 -0
  345. package/src/hooks/pol/useTotalStakedAmount.ts +2 -2
  346. package/src/hooks/pol/useUserVaultInfo.ts +8 -5
  347. package/src/hooks/pol/useUserVaults.ts +7 -4
  348. package/src/hooks/pol/useVaultAddress.ts +2 -2
  349. package/src/hooks/pol/useVaultHistory.ts +2 -2
  350. package/src/hooks/pol/useVaultValidators.ts +5 -2
  351. package/src/hooks/tokens/useBeraCurrentPrice.ts +1 -1
  352. package/src/hooks/tokens/useMultipleTokenInformation.ts +7 -4
  353. package/src/hooks/tokens/usePollAllowances.ts +7 -4
  354. package/src/hooks/tokens/usePollBalance.ts +8 -5
  355. package/src/hooks/tokens/usePollWalletBalances.ts +8 -5
  356. package/src/hooks/tokens/useStakingTokenInformation.ts +7 -4
  357. package/src/hooks/tokens/useTokenCurrentPrice.ts +1 -1
  358. package/src/hooks/tokens/useTokenCurrentPrices.ts +6 -6
  359. package/src/hooks/tokens/useTokenInformation.ts +8 -5
  360. package/src/hooks/tokens/useTokenPrice.ts +1 -1
  361. package/src/hooks/tokens/useTokenPrices.ts +4 -4
  362. package/src/hooks/tokens/useTokens.ts +3 -3
  363. package/src/hooks/tokens/useTotalSupply.ts +1 -1
  364. package/src/hooks/tokens/useUnderlyingAsset.ts +3 -3
  365. package/src/hooks/useBlockToTimestamp.ts +5 -5
  366. package/src/hooks/useContractWrite/index.ts +0 -0
  367. package/src/hooks/useContractWrite/stateReducer.ts +0 -0
  368. package/src/hooks/useContractWrite/types.ts +2 -2
  369. package/src/hooks/useContractWrite/useBeraContractWrite.ts +5 -6
  370. package/src/hooks/useGetVerifiedAbi.ts +1 -1
  371. package/src/hooks/usePrevious.ts +0 -0
  372. package/src/hooks/validators/useAllValidators.ts +7 -4
  373. package/src/hooks/validators/useApiEnrichedAllocation.ts +2 -2
  374. package/src/hooks/validators/useApiValidator.ts +5 -2
  375. package/src/hooks/validators/useBaselineRewardAllocation.ts +2 -2
  376. package/src/hooks/validators/useDailyValidatorBlockStats.ts +3 -3
  377. package/src/hooks/validators/useDefaultRewardAllocation.ts +4 -4
  378. package/src/hooks/validators/useManagedValidatorRole.ts +8 -5
  379. package/src/hooks/validators/useOnChainValidator.ts +6 -3
  380. package/src/hooks/validators/useStakingPoolBatch.ts +7 -4
  381. package/src/hooks/validators/useUserActiveValidators.ts +6 -3
  382. package/src/hooks/validators/useUserBoostsOnValidator.ts +3 -3
  383. package/src/hooks/validators/useUserClaimableIncentives.ts +9 -9
  384. package/src/hooks/validators/useUserStakingPositions.ts +1 -1
  385. package/src/hooks/validators/useValidator.ts +1 -1
  386. package/src/hooks/validators/useValidatorAnalytics.ts +3 -3
  387. package/src/hooks/validators/useValidatorCommission.ts +5 -2
  388. package/src/hooks/validators/useValidatorEstimatedBgtPerYear.ts +3 -3
  389. package/src/hooks/validators/useValidatorQueuedCommission.ts +6 -3
  390. package/src/hooks/validators/useValidatorQueuedOperatorAddress.ts +5 -2
  391. package/src/hooks/validators/useValidatorQueuedRewardAllocation.ts +6 -3
  392. package/src/hooks/validators/useValidatorRewardAllocation.ts +2 -2
  393. package/src/types/dex.d.ts +1 -1
  394. package/src/types/enso.d.ts +34 -0
  395. package/src/types/exports.ts +0 -0
  396. package/src/types/global.d.ts +3 -3
  397. package/src/types/governance.d.ts +1 -1
  398. package/src/types/honeySwap.d.ts +3 -3
  399. package/src/types/staking.d.ts +0 -0
  400. package/src/utils/beraFetch.ts +1 -1
  401. package/src/utils/createEmitter.ts +1 -1
  402. package/src/utils/exports.ts +0 -0
  403. package/src/utils/filter.ts +0 -0
  404. package/src/utils/formatIncentivesTokenMap.ts +1 -1
  405. package/src/utils/formatInputTokenValue.ts +0 -0
  406. package/src/utils/formatNumber.ts +0 -0
  407. package/src/utils/getContractName.ts +1 -1
  408. package/src/utils/getHoneySwapMessage.test.ts +1 -1
  409. package/src/utils/getHoneySwapMessage.ts +1 -1
  410. package/src/utils/parseBaseArgs.ts +1 -1
  411. package/src/utils/parseBaseArgs.unit.test.ts +1 -1
  412. package/src/utils/parseWhiskToken.ts +1 -1
  413. package/src/utils/poolNamings.ts +1 -1
  414. package/src/utils/tokens.ts +2 -2
  415. package/src/utils/tokens.unit.test.ts +1 -1
  416. package/src/utils/truncateHash.ts +0 -0
  417. package/.claude/skills/berajs/SKILL.md +0 -222
  418. package/.claude/skills/berajs/references/dex.md +0 -235
  419. package/.claude/skills/berajs/references/pol.md +0 -194
  420. package/.claude/skills/berajs/references/staking.md +0 -198
  421. package/.claude/skills/berajs/references/tokens.md +0 -170
  422. package/LICENSE +0 -21
  423. package/dist/chunk-22J3YJDN.cjs +0 -2
  424. package/dist/chunk-22J3YJDN.cjs.map +0 -1
  425. package/dist/chunk-2LL3P5PN.mjs +0 -2
  426. package/dist/chunk-2LL3P5PN.mjs.map +0 -1
  427. package/dist/chunk-4GU2O2OW.cjs +0 -4
  428. package/dist/chunk-4GU2O2OW.cjs.map +0 -1
  429. package/dist/chunk-55L7STYD.mjs +0 -2
  430. package/dist/chunk-55L7STYD.mjs.map +0 -1
  431. package/dist/chunk-5XWELBWR.mjs +0 -2
  432. package/dist/chunk-5XWELBWR.mjs.map +0 -1
  433. package/dist/chunk-6LDOG5RL.cjs.map +0 -1
  434. package/dist/chunk-7LNBSOVV.cjs +0 -2
  435. package/dist/chunk-7LNBSOVV.cjs.map +0 -1
  436. package/dist/chunk-7SMWQ6SN.mjs.map +0 -1
  437. package/dist/chunk-7WRTK7RJ.mjs.map +0 -1
  438. package/dist/chunk-AX2YQQFQ.mjs.map +0 -1
  439. package/dist/chunk-BS6K7HGH.cjs +0 -2
  440. package/dist/chunk-BS6K7HGH.cjs.map +0 -1
  441. package/dist/chunk-C3FHGFLK.mjs +0 -2
  442. package/dist/chunk-C3FHGFLK.mjs.map +0 -1
  443. package/dist/chunk-C6ZGUO4H.cjs.map +0 -1
  444. package/dist/chunk-FCWDGE62.cjs.map +0 -1
  445. package/dist/chunk-RW3JFPED.mjs +0 -4
  446. package/dist/chunk-RW3JFPED.mjs.map +0 -1
  447. package/dist/chunk-S3EAKCVM.cjs +0 -2
  448. package/dist/chunk-S3EAKCVM.cjs.map +0 -1
  449. package/dist/chunk-SWMJQOH6.cjs +0 -2
  450. package/dist/chunk-SWMJQOH6.cjs.map +0 -1
  451. package/dist/chunk-THATXCJK.mjs +0 -2
  452. package/dist/chunk-THATXCJK.mjs.map +0 -1
  453. package/dist/chunk-VXL2ZZ4X.cjs +0 -2
  454. package/dist/chunk-VXL2ZZ4X.cjs.map +0 -1
  455. package/dist/chunk-YNO7BCCM.mjs +0 -2
  456. package/dist/chunk-YXLFOEZN.mjs +0 -2
  457. package/dist/chunk-YXLFOEZN.mjs.map +0 -1
  458. package/dist/chunk-YZV5LKIP.cjs.map +0 -1
  459. package/src/actions/dex/getSubgraphPool.ts +0 -30
  460. package/src/actions/validators/getManagedValidatorByAccount.ts +0 -32
  461. package/src/hooks/pol/useSWBeraVaultMetadata.ts +0 -35
  462. package/src/hooks/validators/useManagedValidatorByAccount.ts +0 -40
  463. package/src/hooks/validators/useSubgraphUserValidators.ts +0 -36
@@ -18,6 +18,15 @@ export enum TransactionActionType {
18
18
 
19
19
  DELEGATE = "Delegate",
20
20
  REDELEGATE = "Redelegate",
21
+
22
+ QUEUE_BOOST = "Queue Boost",
23
+ ACTIVATE_BOOST = "Activate Boost",
24
+ QUEUE_UNBOOSTING_ALL = "Queue Drop Boost All",
25
+ UNBOOST = "Drop Boost",
26
+ QUEUE_UNBOOST = "Queue Drop Boost",
27
+ CANCEL_UNBOOST = "Cancel Drop Boost",
28
+ CANCEL_BOOST = "Cancel Boost",
29
+
21
30
  UNBONDING = "Unbonding",
22
31
  CANCEL_UNBONDING = "Cancel Unbonding",
23
32
 
@@ -1,4 +1,4 @@
1
- import { createEmitter, type EmitterMixin } from "~/utils/createEmitter";
1
+ import { createEmitter, type EmitterMixin } from "../utils/createEmitter";
2
2
  import type { BeraError } from "./BeraError";
3
3
  import type { SeverityLevel } from "./severity";
4
4
 
@@ -31,7 +31,7 @@ const _emitter = createEmitter<{ exception: (event: ErrorEvent) => void }>();
31
31
  * @example
32
32
  * ```ts
33
33
  * // In berajs code:
34
- * import { BeraMonitoring } from "~/errors/BeraMonitoring";
34
+ * import { BeraMonitoring } from "./BeraMonitoring";
35
35
  * BeraMonitoring.captureExceptionException(error);
36
36
  *
37
37
  * // In app instrumentation:
@@ -1,4 +1,4 @@
1
- import type { Unsubscribe } from "~/utils/createEmitter";
1
+ import type { Unsubscribe } from "../utils/createEmitter";
2
2
 
3
3
  /**
4
4
  * Span context passed to tracing handlers.
@@ -34,7 +34,7 @@ const _handlers: StartSpanFn[] = [];
34
34
  * @example
35
35
  * ```ts
36
36
  * // In berajs code:
37
- * import { BeraTracing } from "~/errors/BeraTracing";
37
+ * import { BeraTracing } from "./BeraTracing";
38
38
  * const result = await BeraTracing.startSpan(
39
39
  * { name: "GraphQL query", op: "graphql.query", attributes: {} },
40
40
  * () => executeQuery(),
@@ -36,7 +36,7 @@ export class RequestError extends BeraError {
36
36
  // vercel internal proxy
37
37
  "/api/aggregators?aggregator",
38
38
  // bonder endpoints have date-based query params (e.g. ?start=2025-11-28)
39
- mainnet.bonder,
39
+ mainnet.staking,
40
40
  ];
41
41
 
42
42
  statusCode: number | undefined;
@@ -119,6 +119,24 @@ export function assertAddress(
119
119
  });
120
120
  }
121
121
 
122
+ /**
123
+ * Asserts that a value is positive (> 0).
124
+ * @throws An InvalidArgumentError if the value is not positive.
125
+ */
126
+ export function assertPositive(
127
+ value: string | bigint | number,
128
+ property: string,
129
+ ): void {
130
+ const isPositive = typeof value === "bigint" ? value > 0n : Number(value) > 0;
131
+ if (!isPositive) {
132
+ throw new InvalidArgumentError({
133
+ property,
134
+ value,
135
+ expected: "positive amount",
136
+ });
137
+ }
138
+ }
139
+
122
140
  /**
123
141
  * Asserts that a value is a number greater than 0.
124
142
  * @throws An InvalidArgumentError if the value is undefined, null, not a string or number, or not a number greater than 0.
File without changes
@@ -29,13 +29,13 @@ import { rewardVaultAbi } from "@berachain/abis/pol/rewards/rewardVault";
29
29
 
30
30
  import { getConfig } from "@berachain/wagmi/config";
31
31
 
32
- import { beraWriteContract } from "~/actions/transactions/beraWriteContract";
33
- import { ContractName } from "~/enum/contracts";
34
- import { TransactionActionType } from "~/enum/txnEnum";
35
- import type { IContractWrite } from "~/types/global";
36
- import { getServerSidePublicClient } from "~/utils/getServerSideClient";
37
- import { parseBaseArgs } from "~/utils/parseBaseArgs";
38
- import { anvilMnemonic } from "~/utils/test-utils";
32
+ import { beraWriteContract } from "../actions/transactions/beraWriteContract";
33
+ import { ContractName } from "../enum/contracts";
34
+ import { TransactionActionType } from "../enum/txnEnum";
35
+ import type { IContractWrite } from "../types/global";
36
+ import { getServerSidePublicClient } from "../utils/getServerSideClient";
37
+ import { parseBaseArgs } from "../utils/parseBaseArgs";
38
+ import { anvilMnemonic } from "../utils/test-utils";
39
39
  import { BeraError } from "./BeraError";
40
40
  import { errorMsgMap, GENERAL_ERROR } from "./errorMap";
41
41
  import { getErrorMessage } from "./getErrorMessage";
@@ -7,7 +7,7 @@ import {
7
7
  type PublicClient,
8
8
  } from "viem";
9
9
 
10
- import { commonAbiErrors } from "~/abi/utils/commonAbiErrors";
10
+ import { commonAbiErrors } from "../abi/utils/commonAbiErrors";
11
11
  import { InvalidArgumentError } from "./InvalidArgumentError";
12
12
  import { parseViemError } from "./parseViemError";
13
13
  import { TransactionFailedError } from "./TransactionFailedError";
@@ -13,7 +13,7 @@ import {
13
13
  UserRejectedRequestError,
14
14
  } from "viem";
15
15
 
16
- import { commonAbiErrors } from "~/abi/utils/commonAbiErrors";
16
+ import { commonAbiErrors } from "../abi/utils/commonAbiErrors";
17
17
 
18
18
  /**
19
19
  * Duck-type check for viem's BaseError.
@@ -2,10 +2,10 @@ import useSWR from "swr";
2
2
 
3
3
  import { usePublicClient } from "@berachain/wagmi/hooks";
4
4
 
5
- import type { GetConvertToAssetsProps } from "~/actions/bend/getConvertToAssets";
6
- import { getConvertToAssets } from "~/actions/bend/getConvertToAssets";
7
- import { assertPublicClient } from "~/errors/assert";
8
- import type { DefaultHookOptions } from "~/types/global";
5
+ import type { GetConvertToAssetsProps } from "../../actions/bend/getConvertToAssets";
6
+ import { getConvertToAssets } from "../../actions/bend/getConvertToAssets";
7
+ import { assertPublicClient } from "../../errors/assert";
8
+ import type { DefaultHookOptions } from "../../types/global";
9
9
 
10
10
  export const useGetConvertToAssets = (
11
11
  {
@@ -5,26 +5,26 @@ import { defaultChainId } from "@berachain/config/internal";
5
5
 
6
6
  import { useBeraWallet, usePublicClient } from "@berachain/wagmi/hooks";
7
7
 
8
- import { bex } from "~/actions/dex/aggregators/bex";
9
- import { bgtRedeem } from "~/actions/dex/aggregators/bgt";
10
- import { enso } from "~/actions/dex/aggregators/enso/enso";
11
- import { erc4626Deposit } from "~/actions/dex/aggregators/erc4626";
12
- import { fly } from "~/actions/dex/aggregators/fly";
13
- import { haiku } from "~/actions/dex/aggregators/haiku";
14
- import { honeyNative } from "~/actions/dex/aggregators/honey";
15
- import { kyberswap } from "~/actions/dex/aggregators/kyberswap";
16
- import { oogabooga } from "~/actions/dex/aggregators/oogabooga";
17
- import { openOcean } from "~/actions/dex/aggregators/openOcean";
18
- import { wberaSwap } from "~/actions/dex/aggregators/wbera";
19
- import { useBeraFlag } from "~/contexts/BeraFlags/BeraFlags";
20
- import type { HoneyConfigContextReturn } from "~/contexts/HoneyConfigProvider";
21
- import type { SwapReferrer } from "~/enum/dex";
22
- import { useAggregatorsRouterFeeBps } from "~/hooks/dex/useAggregatorsRouterFeeBps";
23
- import type { IRawAggregatorQuote, MinimalERC20 } from "~/types/dex";
24
- import type { DefaultHookOptions } from "~/types/global";
25
- import { parseBaseArgs } from "~/utils/parseBaseArgs";
26
- import { isToken } from "~/utils/tokens";
8
+ import { bex } from "../../actions/dex/aggregators/bex";
9
+ import { bgtRedeem } from "../../actions/dex/aggregators/bgt";
10
+ import { enso } from "../../actions/dex/aggregators/enso/enso";
11
+ import { erc4626Deposit } from "../../actions/dex/aggregators/erc4626";
12
+ import { fly } from "../../actions/dex/aggregators/fly";
13
+ import { haiku } from "../../actions/dex/aggregators/haiku";
14
+ import { honeyNative } from "../../actions/dex/aggregators/honey";
15
+ import { kyberswap } from "../../actions/dex/aggregators/kyberswap";
16
+ import { oogabooga } from "../../actions/dex/aggregators/oogabooga";
17
+ import { openOcean } from "../../actions/dex/aggregators/openOcean";
18
+ import { wberaSwap } from "../../actions/dex/aggregators/wbera";
19
+ import { useBeraFlag } from "../../contexts/BeraFlags/BeraFlags";
20
+ import type { HoneyConfigContextReturn } from "../../contexts/HoneyConfigProvider";
21
+ import type { SwapReferrer } from "../../enum/dex";
22
+ import type { IRawAggregatorQuote, MinimalERC20 } from "../../types/dex";
23
+ import type { DefaultHookOptions } from "../../types/global";
24
+ import { parseBaseArgs } from "../../utils/parseBaseArgs";
25
+ import { isToken } from "../../utils/tokens";
27
26
  import { useUnderlyingAsset } from "../tokens/useUnderlyingAsset";
27
+ import { useAggregatorsRouterFeeBps } from "./useAggregatorsRouterFeeBps";
28
28
  import { useBexStatus } from "./useBexStatus";
29
29
  import {
30
30
  getAggregatorsSWROptions,
@@ -1,11 +1,11 @@
1
1
  import useSWRImmutable from "swr/immutable";
2
2
  import { type PublicClient, zeroAddress } from "viem";
3
3
 
4
- import { metaAggregatorAbi as aggregatorsRouterAbi } from "@berachain/abis/meta-aggregator/metaAggregator";
4
+ import aggregatorsRouterAbi from "@berachain/abis/meta-aggregator/metaAggregatorV2";
5
5
 
6
6
  import { usePublicClient } from "@berachain/wagmi/hooks";
7
7
 
8
- import { parseBaseArgs } from "~/utils/parseBaseArgs";
8
+ import { parseBaseArgs } from "../../utils/parseBaseArgs";
9
9
 
10
10
  export const useAggregatorsRouterFeeBps = () => {
11
11
  const publicClient = usePublicClient() as PublicClient;
@@ -2,9 +2,9 @@ import useSWR from "swr";
2
2
 
3
3
  import type { GetPoolsQueryVariables } from "@berachain/graphql/dex/api";
4
4
 
5
- import { getAllPools } from "~/actions/dex/getAllPools";
6
- import { POLLING } from "~/enum/polling";
7
- import type { DefaultHookOptions } from "~/types/global";
5
+ import { getAllPools } from "../../actions/dex/getAllPools";
6
+ import { POLLING } from "../../enum/polling";
7
+ import type { DefaultHookOptions } from "../../types/global";
8
8
 
9
9
  export const useAllUserPoolsQueryKey = ({
10
10
  query,
@@ -3,9 +3,9 @@ import { type Address, type Hex, isAddress } from "viem";
3
3
 
4
4
  import type { MinimalPoolFragment } from "@berachain/graphql/dex/api";
5
5
 
6
- import { getApiPool } from "~/actions/dex/getApiPool";
7
- import { POLLING } from "~/enum/polling";
8
- import { InvalidArgumentError } from "~/errors/InvalidArgumentError";
6
+ import { getApiPool } from "../../actions/dex/getApiPool";
7
+ import { POLLING } from "../../enum/polling";
8
+ import { InvalidArgumentError } from "../../errors/InvalidArgumentError";
9
9
 
10
10
  export const useApiPoolQueryKey = ({
11
11
  poolId,
@@ -1 +1 @@
1
- export { useBexStatus } from "~/contexts/BexStatusProvider";
1
+ export { useBexStatus } from "../../contexts/BexStatusProvider";
@@ -17,15 +17,15 @@ import {
17
17
  type SubgraphPoolFragment,
18
18
  } from "@berachain/graphql/dex/subgraph";
19
19
 
20
- import { getApolloClient } from "~/actions/clients/getApolloClient";
21
- import { TransactionActionType } from "~/enum/txnEnum";
22
- import type { Token, TokenWithAmount } from "~/types/dex";
23
- import type { IContractWrite } from "~/types/global";
24
- import { DEFAULT_METAMASK_GAS_LIMIT } from "~/utils/constants";
25
- import { parseBaseArgs } from "~/utils/parseBaseArgs";
26
- import { generatePoolName, generatePoolSymbol } from "~/utils/poolNamings";
27
- import { isToken } from "~/utils/tokens";
28
- import { wrapNativeTokens } from "~/utils/tokenWrapping";
20
+ import { getApolloClient } from "../../actions/clients/getApolloClient";
21
+ import { TransactionActionType } from "../../enum/txnEnum";
22
+ import type { Token, TokenWithAmount } from "../../types/dex";
23
+ import type { IContractWrite } from "../../types/global";
24
+ import { DEFAULT_METAMASK_GAS_LIMIT } from "../../utils/constants";
25
+ import { parseBaseArgs } from "../../utils/parseBaseArgs";
26
+ import { generatePoolName, generatePoolSymbol } from "../../utils/poolNamings";
27
+ import { isToken } from "../../utils/tokens";
28
+ import { wrapNativeTokens } from "../../utils/tokenWrapping";
29
29
 
30
30
  const DEFAULT_WEIGHTS_DUPLICATION_THRESHOLD = 0.005;
31
31
  interface UseCreatePoolProps extends BeraJS.BaseFunctionArgs {
@@ -3,9 +3,9 @@ import type { Address } from "viem";
3
3
 
4
4
  import { usePublicClient } from "@berachain/wagmi/hooks";
5
5
 
6
- import { getIsTokenExploited } from "~/actions/dex/getIsTokenExploited";
7
- import { assertPublicClient } from "~/errors/assert";
8
- import type { Token } from "~/types/dex";
6
+ import { getIsTokenExploited } from "../../actions/dex/getIsTokenExploited";
7
+ import { assertPublicClient } from "../../errors/assert";
8
+ import type { Token } from "../../types/dex";
9
9
 
10
10
  export const useExploitedTokensQueryKey = (tokens: Token[] | undefined) => {
11
11
  const filteredTokens = tokens?.filter((token) => token.address);
@@ -1,6 +1,6 @@
1
1
  import useSWR from "swr";
2
2
 
3
- import { getGlobalLiquidityAndSwapVolume } from "~/actions/dex/getGlobalLiquidityAndSwapVolume";
3
+ import { getGlobalLiquidityAndSwapVolume } from "../../actions/dex/getGlobalLiquidityAndSwapVolume";
4
4
 
5
5
  export const useGlobalLiquidityAndSwapVolume = () => {
6
6
  const response = useSWR("useGlobalLiquidityAndSwapVolume", async () =>
@@ -1,9 +1,9 @@
1
1
  import { useEffect, useState } from "react";
2
2
  import { PoolType } from "@berachain-foundation/berancer-sdk";
3
3
 
4
- import { PoolCreationStep } from "~/enum/dex";
5
- import type { TokenCurrentPriceMap, TokenWithAmount } from "~/types/dex";
6
- import { wrapNativeTokens } from "~/utils/tokenWrapping";
4
+ import { PoolCreationStep } from "../../enum/dex";
5
+ import type { TokenCurrentPriceMap, TokenWithAmount } from "../../types/dex";
6
+ import { wrapNativeTokens } from "../../utils/tokenWrapping";
7
7
  import { type Oracle, OracleMode } from "./useCreatePool";
8
8
 
9
9
  const DEFAULT_LIQUIDITY_MISMATCH_TOLERANCE_PERCENT = 0.05; // 5%
@@ -3,10 +3,13 @@ import { type Address, formatEther, isAddressEqual } from "viem";
3
3
  import type { MinimalPoolFragment } from "@berachain/graphql/dex/api";
4
4
  import BigNumber from "@berachain/utils/pkg/bignumber.js";
5
5
 
6
- import { useRewardVaultBalanceFromStakingToken } from "~/hooks/pol/useRewardVaultBalanceFromStakingToken";
7
- import { usePollBalance } from "~/hooks/tokens/usePollBalance";
8
- import type { IUserPosition } from "~/types/dex";
9
- import type { DefaultHookOptions, DefaultHookReturnType } from "~/types/global";
6
+ import type { IUserPosition } from "../../types/dex";
7
+ import type {
8
+ DefaultHookOptions,
9
+ DefaultHookReturnType,
10
+ } from "../../types/global";
11
+ import { useRewardVaultBalanceFromStakingToken } from "../pol/useRewardVaultBalanceFromStakingToken";
12
+ import { usePollBalance } from "../tokens/usePollBalance";
10
13
 
11
14
  type IUseLpPositionArgs = {
12
15
  pool: MinimalPoolFragment | undefined;
@@ -5,10 +5,10 @@ import { parseUnits, zeroAddress } from "viem";
5
5
 
6
6
  import BigNumber from "@berachain/utils/pkg/bignumber.js";
7
7
 
8
- import { BeraError } from "~/errors/BeraError";
9
- import { usePollAllowances } from "~/hooks/tokens/usePollAllowances";
10
- import type { AllowanceQueryItem, AllowanceToken } from "~/types/dex";
11
- import { isToken } from "~/utils/tokens";
8
+ import { BeraError } from "../../errors/BeraError";
9
+ import type { AllowanceQueryItem, AllowanceToken } from "../../types/dex";
10
+ import { isToken } from "../../utils/tokens";
11
+ import { usePollAllowances } from "../tokens/usePollAllowances";
12
12
 
13
13
  type NeedsApprovalToken = AllowanceToken & {
14
14
  maxAmountIn: bigint;
@@ -5,9 +5,9 @@ import { type Address, formatUnits, isAddress } from "viem";
5
5
  import type { SubgraphPoolFragment } from "@berachain/graphql/dex/subgraph";
6
6
  import { usePublicClient } from "@berachain/wagmi/hooks";
7
7
 
8
- import { getOnChainPool } from "~/actions/dex/getOnChainPool";
9
- import { useMultipleTokenInformation } from "~/hooks/tokens/useMultipleTokenInformation";
10
- import { useTokenCurrentPrices } from "~/hooks/tokens/useTokenCurrentPrices";
8
+ import { getOnChainPool } from "../../actions/dex/getOnChainPool";
9
+ import { useMultipleTokenInformation } from "../tokens/useMultipleTokenInformation";
10
+ import { useTokenCurrentPrices } from "../tokens/useTokenCurrentPrices";
11
11
 
12
12
  export function useOnChainPoolDataQueryKey(
13
13
  args: { poolId: string } | { address: Address },
@@ -5,9 +5,9 @@ import { vaultAbi as balancerVaultAbi } from "@berachain/abis/bex/vault";
5
5
 
6
6
  import { useBeraWallet, usePublicClient } from "@berachain/wagmi/hooks";
7
7
 
8
- import { assertPublicClient } from "~/errors/assert";
9
- import type { DefaultHookOptions } from "~/types/global";
10
- import { parseBaseArgs } from "~/utils/parseBaseArgs";
8
+ import { assertPublicClient } from "../../errors/assert";
9
+ import type { DefaultHookOptions } from "../../types/global";
10
+ import { parseBaseArgs } from "../../utils/parseBaseArgs";
11
11
 
12
12
  /**
13
13
  * Hook for fetching relayer approval status with SWR
@@ -1,59 +1,26 @@
1
- import { useMemo } from "react";
2
- import useSWR from "swr";
3
1
  import type { Hex } from "viem";
4
2
 
5
- import { getSubgraphPool } from "~/actions/dex/getSubgraphPool";
6
- import { POLLING } from "~/enum/polling";
7
3
  import { useApiPool } from "./useApiPool";
8
4
  import { useOnChainPoolData } from "./useOnChainPoolData";
9
5
 
10
- export function useSubgraphPoolQueryKey({ poolId }: { poolId: string }) {
11
- return poolId ? ["usePool-subgraph", poolId] : null;
12
- }
13
-
14
- export const usePool = ({ poolId }: { poolId: Hex }) => {
15
- const bexSubgraphPool = useSWR(
16
- useSubgraphPoolQueryKey({ poolId }),
17
- async ([, poolId]) => getSubgraphPool({ poolId }),
18
- {
19
- refreshInterval: POLLING.NORMAL,
20
- },
21
- );
22
-
6
+ export function usePool({ poolId }: { poolId: Hex }) {
23
7
  const balancerApiPool = useApiPool({ poolId });
24
8
 
25
9
  const {
26
10
  data: onChainPool,
27
11
  isLoading: isOnChainPoolLoading,
28
12
  refresh: refreshOnChainPool,
13
+ error: onChainPoolError,
29
14
  } = useOnChainPoolData(poolId);
30
15
 
31
- const pool = useMemo(() => {
32
- // Until we load the data from the subgraph we'll push up the on-chain data.
33
- if (!bexSubgraphPool.data) return onChainPool;
34
-
35
- const merge = { ...bexSubgraphPool.data };
36
-
37
- if (onChainPool) {
38
- merge.swapFee = onChainPool.swapFee;
39
- merge.totalShares = onChainPool.totalShares;
40
- merge.createTime = onChainPool.createTime ?? merge.createTime;
41
- }
42
-
43
- return merge;
44
- }, [onChainPool, bexSubgraphPool]);
45
-
46
16
  return {
47
- data: [pool, balancerApiPool.data, onChainPool] as const,
48
- isLoading:
49
- balancerApiPool.isLoading ||
50
- bexSubgraphPool.isLoading ||
51
- isOnChainPoolLoading,
52
- isError: balancerApiPool.error || bexSubgraphPool.error,
17
+ data: [undefined, balancerApiPool.data, onChainPool] as const,
18
+ isLoading: balancerApiPool.isLoading || isOnChainPoolLoading,
19
+ isError: balancerApiPool.error || onChainPoolError,
53
20
  refresh: () => {
54
21
  balancerApiPool.refresh();
55
- bexSubgraphPool.mutate();
22
+
56
23
  refreshOnChainPool();
57
24
  },
58
25
  };
59
- };
26
+ }
@@ -2,8 +2,8 @@ import useSWRImmutable from "swr/immutable";
2
2
 
3
3
  import type { GqlPoolEventType } from "@berachain/graphql/dex/api";
4
4
 
5
- import { getPoolEvents } from "~/actions/dex/getPoolEvents";
6
- import { POLLING } from "~/enum/polling";
5
+ import { getPoolEvents } from "../../actions/dex/getPoolEvents";
6
+ import { POLLING } from "../../enum/polling";
7
7
 
8
8
  export const usePoolEvents = ({
9
9
  poolId,
@@ -5,9 +5,12 @@ import type {
5
5
  PoolHistoricalDataFragment,
6
6
  } from "@berachain/graphql/dex/api";
7
7
 
8
- import { getPoolHistoricalData } from "~/actions/dex/getPoolHistoricalData";
9
- import type { DefaultHookOptions, DefaultHookReturnType } from "~/types/global";
10
- import { parseBaseArgs } from "~/utils/parseBaseArgs";
8
+ import { getPoolHistoricalData } from "../../actions/dex/getPoolHistoricalData";
9
+ import type {
10
+ DefaultHookOptions,
11
+ DefaultHookReturnType,
12
+ } from "../../types/global";
13
+ import { parseBaseArgs } from "../../utils/parseBaseArgs";
11
14
 
12
15
  type UsePoolHistoricalDataArgs = {
13
16
  poolId: string | undefined;
@@ -4,9 +4,9 @@ import useSWR from "swr";
4
4
  import type { GetPoolsQueryVariables } from "@berachain/graphql/dex/api";
5
5
  import { useBeraWallet } from "@berachain/wagmi/hooks";
6
6
 
7
- import { getAllPools } from "~/actions/dex/getAllPools";
8
- import { POLLING } from "~/enum/polling";
9
- import type { DefaultHookOptions } from "~/types/global";
7
+ import { getAllPools } from "../../actions/dex/getAllPools";
8
+ import { POLLING } from "../../enum/polling";
9
+ import type { DefaultHookOptions } from "../../types/global";
10
10
  import { useAllUserPools } from "./useAllUserPools";
11
11
 
12
12
  export const usePoolsQueryKey = ({
@@ -1,7 +1,7 @@
1
1
  import { useMemo } from "react";
2
2
 
3
- import type { Token } from "~/types/dex";
4
- import { computePriceImpact } from "~/utils/math";
3
+ import type { Token } from "../../types/dex";
4
+ import { computePriceImpact } from "../../utils/math";
5
5
  import { useTokenPrices } from "../tokens/useTokenPrices";
6
6
 
7
7
  export function usePriceImpact({
@@ -3,22 +3,22 @@ import { type Address, type PublicClient, parseUnits, zeroAddress } from "viem";
3
3
 
4
4
  import { useBeraWallet, usePublicClient } from "@berachain/wagmi/hooks";
5
5
 
6
- import { BaseAggregator } from "~/actions/dex/aggregators/base";
7
- import { useBeraFlag } from "~/contexts/BeraFlags/BeraFlags";
6
+ import { BaseAggregator } from "../../actions/dex/aggregators/base";
7
+ import { useBeraFlag } from "../../contexts/BeraFlags/BeraFlags";
8
8
  import type {
9
9
  HoneyConfigContextReturn,
10
10
  TokenWithOrder,
11
- } from "~/contexts/HoneyConfigProvider";
12
- import { Aggregators, type SwapReferrer } from "~/enum/dex";
13
- import { POLLING } from "~/enum/polling";
14
- import { BeraError } from "~/errors/BeraError";
15
- import { RequestError } from "~/errors/RequestError";
16
- import { useAggregatorsRouterFeeBps } from "~/hooks/dex/useAggregatorsRouterFeeBps";
17
- import type { MinimalERC20 } from "~/types/dex";
18
- import type { DefaultHookOptions } from "~/types/global";
19
- import { parseBaseArgs } from "~/utils/parseBaseArgs";
20
- import { seconds } from "~/utils/time";
21
- import { isToken } from "~/utils/tokens";
11
+ } from "../../contexts/HoneyConfigProvider";
12
+ import { Aggregators, type SwapReferrer } from "../../enum/dex";
13
+ import { POLLING } from "../../enum/polling";
14
+ import { BeraError } from "../../errors/BeraError";
15
+ import { RequestError } from "../../errors/RequestError";
16
+ import type { MinimalERC20 } from "../../types/dex";
17
+ import type { DefaultHookOptions } from "../../types/global";
18
+ import { parseBaseArgs } from "../../utils/parseBaseArgs";
19
+ import { seconds } from "../../utils/time";
20
+ import { isToken } from "../../utils/tokens";
21
+ import { useAggregatorsRouterFeeBps } from "./useAggregatorsRouterFeeBps";
22
22
 
23
23
  export type IUseAggregatorsQuotesArgs = BeraJS.BaseFunctionArgs & {
24
24
  tokenIn: MinimalERC20;