@berachain/berajs 0.2.13 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/clients/BeraApolloClient.d.ts.map +1 -1
- package/dist/actions/clients/clientName.d.ts +10 -0
- package/dist/actions/clients/clientName.d.ts.map +1 -0
- package/dist/actions/clients/exports.d.ts +2 -0
- package/dist/actions/clients/exports.d.ts.map +1 -1
- package/dist/actions/clients/exports.mjs +26 -7
- package/dist/actions/clients/exports.mjs.map +1 -1
- package/dist/actions/clients/fetchBeep.d.ts.map +1 -1
- package/dist/actions/clients/fetchEnso.d.ts +17 -0
- package/dist/actions/clients/fetchEnso.d.ts.map +1 -0
- package/dist/actions/clients/fetchLayerzero.d.ts +12 -0
- package/dist/actions/clients/fetchLayerzero.d.ts.map +1 -0
- package/dist/actions/clients/fetchOpenApi.d.ts +4 -1
- package/dist/actions/clients/fetchOpenApi.d.ts.map +1 -1
- package/dist/actions/clients/getApolloClient.d.ts.map +1 -1
- package/dist/actions/dex/aggregators/base.d.ts +30 -5
- package/dist/actions/dex/aggregators/base.d.ts.map +1 -1
- package/dist/actions/dex/aggregators/bex.d.ts +11 -1
- package/dist/actions/dex/aggregators/bex.d.ts.map +1 -1
- package/dist/actions/dex/aggregators/bgt.d.ts +2 -2
- package/dist/actions/dex/aggregators/bgt.d.ts.map +1 -1
- package/dist/actions/dex/aggregators/enso/enso.d.ts.map +1 -1
- package/dist/actions/dex/aggregators/enso/ensoErc4626.d.ts +1 -0
- package/dist/actions/dex/aggregators/enso/ensoErc4626.d.ts.map +1 -1
- package/dist/actions/dex/aggregators/erc4626.d.ts +2 -2
- package/dist/actions/dex/aggregators/erc4626.d.ts.map +1 -1
- package/dist/actions/dex/aggregators/fly.d.ts.map +1 -1
- package/dist/actions/dex/aggregators/haiku.d.ts +7 -1
- package/dist/actions/dex/aggregators/haiku.d.ts.map +1 -1
- package/dist/actions/dex/aggregators/honey.d.ts +2 -2
- package/dist/actions/dex/aggregators/honey.d.ts.map +1 -1
- package/dist/actions/dex/aggregators/kyberswap.d.ts.map +1 -1
- package/dist/actions/dex/aggregators/oogabooga.d.ts.map +1 -1
- package/dist/actions/dex/aggregators/openOcean.d.ts.map +1 -1
- package/dist/actions/dex/aggregators/wbera.d.ts +3 -2
- package/dist/actions/dex/aggregators/wbera.d.ts.map +1 -1
- package/dist/actions/dex/getAllPools.d.ts.map +1 -1
- package/dist/actions/dex/getApiPool.d.ts.map +1 -1
- package/dist/actions/enso/getEnsoUserTokensWithBalances.d.ts.map +1 -1
- package/dist/actions/enso/util.d.ts +1 -6
- package/dist/actions/enso/util.d.ts.map +1 -1
- package/dist/actions/exports.d.ts +3 -5
- package/dist/actions/exports.d.ts.map +1 -1
- package/dist/actions/exports.mjs +31 -50
- package/dist/actions/exports.mjs.map +1 -1
- package/dist/actions/governance/exports.mjs +3 -3
- package/dist/actions/honey/getHoney24hVolume.d.ts +2 -2
- package/dist/actions/honey/getHoney24hVolume.d.ts.map +1 -1
- package/dist/actions/honey/getHoneyCollaterals.d.ts +1 -1
- package/dist/actions/honey/getHoneyCollaterals.d.ts.map +1 -1
- package/dist/actions/pol/getEarnedStakedBeraVault.d.ts +0 -23
- package/dist/actions/pol/getEarnedStakedBeraVault.d.ts.map +1 -1
- package/dist/actions/pol/getLSTStakeConfig.d.ts.map +1 -1
- package/dist/actions/pol/getSWBeraVaultMetadata.d.ts +1 -14
- package/dist/actions/pol/getSWBeraVaultMetadata.d.ts.map +1 -1
- package/dist/actions/pol/getStakedBeraAPY.d.ts +14 -0
- package/dist/actions/pol/getStakedBeraAPY.d.ts.map +1 -0
- package/dist/actions/pol/getStakedBeraSnapshots.d.ts +14 -4
- package/dist/actions/pol/getStakedBeraSnapshots.d.ts.map +1 -1
- package/dist/actions/pol/getStakingDailyAssets.d.ts +2 -2
- package/dist/actions/pol/getStakingDailyAssets.d.ts.map +1 -1
- package/dist/actions/server/exports.mjs +5 -5
- package/dist/actions/validators/getActiveBoostAndCommissionChangeDelay.d.ts +1 -1
- package/dist/actions/validators/getActiveBoostAndCommissionChangeDelay.d.ts.map +1 -1
- package/dist/actions/validators/getUserActiveValidators.d.ts +37 -1
- package/dist/actions/validators/getUserActiveValidators.d.ts.map +1 -1
- package/dist/actions/validators/getValidatorRewardAllocation.d.ts +4 -0
- package/dist/actions/validators/getValidatorRewardAllocation.d.ts.map +1 -1
- package/dist/{chunk-ZWTGVIPJ.mjs → chunk-4576RF2K.mjs} +29 -4
- package/dist/chunk-4576RF2K.mjs.map +1 -0
- package/dist/{chunk-UA3Z47LT.mjs → chunk-5PBYMJRG.mjs} +95 -24
- package/dist/chunk-5PBYMJRG.mjs.map +1 -0
- package/dist/{chunk-AEN6IJFU.mjs → chunk-7KN7TDUC.mjs} +2 -2
- package/dist/chunk-7OESHTBN.mjs +29 -0
- package/dist/chunk-7OESHTBN.mjs.map +1 -0
- package/dist/{chunk-IFNIPVTZ.mjs → chunk-BSLXKPX4.mjs} +4 -48
- package/dist/chunk-BSLXKPX4.mjs.map +1 -0
- package/dist/{chunk-PHYZRH4I.mjs → chunk-BZKA6DBM.mjs} +9 -13
- package/dist/chunk-BZKA6DBM.mjs.map +1 -0
- package/dist/{chunk-LE4CYW7S.mjs → chunk-FWRYUIJK.mjs} +3 -3
- package/dist/{chunk-PJRLHTGC.mjs → chunk-HPRLNT6R.mjs} +3 -3
- package/dist/chunk-J6GM7HWX.mjs +19 -0
- package/dist/chunk-J6GM7HWX.mjs.map +1 -0
- package/dist/{chunk-P3YZ7F22.mjs → chunk-LL7XR2H5.mjs} +34 -3
- package/dist/chunk-LL7XR2H5.mjs.map +1 -0
- package/dist/{chunk-EJIGERYM.mjs → chunk-M3MIGSH3.mjs} +2 -2
- package/dist/{chunk-NZAH3SGT.mjs → chunk-MVNQY2D4.mjs} +9 -4
- package/dist/chunk-MVNQY2D4.mjs.map +1 -0
- package/dist/{chunk-TGN55GKE.mjs → chunk-SC3BSCTN.mjs} +2 -2
- package/dist/{chunk-DOZJB6IJ.mjs → chunk-SMBAW7AG.mjs} +394 -344
- package/dist/chunk-SMBAW7AG.mjs.map +1 -0
- package/dist/{chunk-QQASX4LJ.mjs → chunk-TXWDUJOY.mjs} +2 -2
- package/dist/{chunk-EGAB6NFQ.mjs → chunk-UWJQ6UKG.mjs} +2 -2
- package/dist/chunk-XO2BFPTB.mjs +50 -0
- package/dist/chunk-XO2BFPTB.mjs.map +1 -0
- package/dist/{chunk-7TFV6UKF.mjs → chunk-XXKPXNQD.mjs} +1 -2
- package/dist/chunk-XXKPXNQD.mjs.map +1 -0
- package/dist/{chunk-J3LTASDE.mjs → chunk-ZHV3MQ4F.mjs} +4 -4
- package/dist/contexts/BeraFlags/BeraFlags.d.ts +1 -1
- package/dist/contexts/BeraFlags/BeraFlags.d.ts.map +1 -1
- package/dist/contexts/BeraFlags/defaultFlags.d.ts +2 -2
- package/dist/contexts/BeraFlags/defaultFlags.d.ts.map +1 -1
- package/dist/contexts/BexStatusProvider.d.ts +1 -1
- package/dist/contexts/BexStatusProvider.d.ts.map +1 -1
- package/dist/contexts/TokensProvider.d.ts +1 -1
- package/dist/contexts/TokensProvider.d.ts.map +1 -1
- package/dist/contexts/exports.mjs +9 -9
- package/dist/enum/contracts.d.ts +3 -0
- package/dist/enum/contracts.d.ts.map +1 -1
- package/dist/enum/exports.mjs +6 -4
- package/dist/enum/exports.mjs.map +1 -1
- package/dist/errors/RequestError.d.ts +19 -0
- package/dist/errors/RequestError.d.ts.map +1 -1
- package/dist/errors/errorMap.d.ts +4 -3
- package/dist/errors/errorMap.d.ts.map +1 -1
- package/dist/errors/exports.mjs +5 -5
- package/dist/hooks/dex/useAggregatorsQuotes.d.ts.map +1 -1
- package/dist/hooks/dex/useAllUserPools.d.ts.map +1 -1
- package/dist/hooks/dex/useCrossChainNativeFee.d.ts +32 -0
- package/dist/hooks/dex/useCrossChainNativeFee.d.ts.map +1 -0
- package/dist/hooks/dex/useOnChainPoolData.d.ts.map +1 -1
- package/dist/hooks/dex/usePools.d.ts.map +1 -1
- package/dist/hooks/dex/useSingleAggregatorQuote.d.ts.map +1 -1
- package/dist/hooks/enso/useBendZapSupply.d.ts +2 -2
- package/dist/hooks/enso/useBendZapSupply.d.ts.map +1 -1
- package/dist/hooks/enso/useEnsoUserTokensWithBalances.d.ts.map +1 -1
- package/dist/hooks/exports.d.ts +2 -5
- package/dist/hooks/exports.d.ts.map +1 -1
- package/dist/hooks/exports.mjs +590 -905
- package/dist/hooks/exports.mjs.map +1 -1
- package/dist/hooks/governance/exports.mjs +4 -4
- package/dist/hooks/honey/useHoneyChartData.d.ts.map +1 -1
- package/dist/hooks/pol/useRewardTokenToBeraRate.d.ts.map +1 -1
- package/dist/hooks/pol/useRewardVaultBalanceFromStakingToken.d.ts.map +1 -1
- package/dist/hooks/pol/useRewardVaults.d.ts.map +1 -1
- package/dist/hooks/pol/useStakedAPY.d.ts +11 -0
- package/dist/hooks/pol/useStakedAPY.d.ts.map +1 -0
- package/dist/hooks/pol/useStakedData.d.ts +2 -2
- package/dist/hooks/pol/useStakedData.d.ts.map +1 -1
- package/dist/hooks/pol/useStakingVaultsMetadata.d.ts +0 -1
- package/dist/hooks/pol/useStakingVaultsMetadata.d.ts.map +1 -1
- package/dist/hooks/tokens/useMultipleTokenInformation.d.ts +30 -0
- package/dist/hooks/tokens/useMultipleTokenInformation.d.ts.map +1 -1
- package/dist/hooks/tokens/usePollBalance.d.ts.map +1 -1
- package/dist/hooks/validators/useUserActiveValidators.d.ts +5 -0
- package/dist/hooks/validators/useUserActiveValidators.d.ts.map +1 -1
- package/dist/hooks/validators/useValidator.d.ts.map +1 -1
- package/dist/hooks/validators/useValidatorIncentiveDistribution.d.ts +3 -4
- package/dist/hooks/validators/useValidatorIncentiveDistribution.d.ts.map +1 -1
- package/dist/hooks/validators/useValidatorRewardAllocation.d.ts +1 -0
- package/dist/hooks/validators/useValidatorRewardAllocation.d.ts.map +1 -1
- package/dist/utils/crossChainBridge.d.ts +74 -0
- package/dist/utils/crossChainBridge.d.ts.map +1 -0
- package/dist/utils/exports.d.ts +1 -1
- package/dist/utils/exports.d.ts.map +1 -1
- package/dist/utils/exports.mjs +142 -72
- package/dist/utils/exports.mjs.map +1 -1
- package/dist/utils/getTestClient.d.ts +5 -3
- package/dist/utils/getTestClient.d.ts.map +1 -1
- package/dist/utils/parseWhiskToken.d.ts.map +1 -1
- package/package.json +8 -6
- package/src/actions/clients/BeraApolloClient.ts +4 -2
- package/src/actions/clients/clientName.ts +17 -0
- package/src/actions/clients/clientName.unit.test.ts +39 -0
- package/src/actions/clients/exports.ts +2 -0
- package/src/actions/clients/fetchBeep.ts +4 -1
- package/src/actions/clients/fetchEnso.ts +48 -0
- package/src/actions/clients/fetchLayerzero.ts +34 -0
- package/src/actions/clients/fetchOpenApi.ts +9 -2
- package/src/actions/clients/fetchOpenApi.unit.test.ts +26 -10
- package/src/actions/clients/getApolloClient.ts +3 -11
- package/src/actions/dex/__tests__/aggregators.unit.test.ts +231 -2
- package/src/actions/dex/aggregators/base.ts +75 -17
- package/src/actions/dex/aggregators/bex.ts +41 -1
- package/src/actions/dex/aggregators/bgt.ts +11 -6
- package/src/actions/dex/aggregators/enso/enso.ts +1 -0
- package/src/actions/dex/aggregators/enso/ensoErc4626.ts +27 -9
- package/src/actions/dex/aggregators/erc4626.ts +19 -5
- package/src/actions/dex/aggregators/fly.ts +1 -0
- package/src/actions/dex/aggregators/haiku.ts +33 -2
- package/src/actions/dex/aggregators/honey.ts +17 -6
- package/src/actions/dex/aggregators/kyberswap.ts +1 -0
- package/src/actions/dex/aggregators/oogabooga.ts +1 -0
- package/src/actions/dex/aggregators/openOcean.ts +1 -0
- package/src/actions/dex/aggregators/wbera.ts +17 -11
- package/src/actions/enso/getBendMultiplyBundle.ts +1 -1
- package/src/actions/enso/getEnsoUserTokensWithBalances.ts +4 -8
- package/src/actions/enso/util.ts +0 -59
- package/src/actions/exports.ts +3 -5
- package/src/actions/honey/getHoney24hVolume.ts +3 -12
- package/src/actions/honey/getHoneyCollaterals.ts +1 -1
- package/src/actions/pol/getBeraTokenTotalSupply.ts +3 -33
- package/src/actions/pol/getLSTStakeConfig.ts +0 -6
- package/src/actions/pol/getSWBeraVaultMetadata.ts +2 -106
- package/src/actions/pol/getStakedBeraAPY.ts +45 -0
- package/src/actions/pol/getStakedBeraSnapshots.ts +18 -34
- package/src/actions/validators/getActiveBoostAndCommissionChangeDelay.ts +1 -1
- package/src/actions/validators/getUserActiveValidators.ts +116 -54
- package/src/actions/validators/getValidatorRewardAllocation.ts +12 -1
- package/src/contexts/BeraFlags/BeraFlags.tsx +1 -4
- package/src/contexts/BeraFlags/defaultFlags.ts +1 -3
- package/src/contexts/BexStatusProvider.tsx +1 -1
- package/src/contexts/TokensProvider.tsx +1 -4
- package/src/enum/contracts.ts +3 -0
- package/src/errors/BeraError.unit.test.ts +23 -0
- package/src/errors/RequestError.ts +46 -9
- package/src/errors/RequestError.unit.test.ts +54 -0
- package/src/errors/errorMap.ts +8 -3
- package/src/errors/getErrorMessage.unit.test.ts +32 -0
- package/src/hooks/dex/useAggregatorsQuotes.ts +7 -1
- package/src/hooks/dex/useCrossChainNativeFee.ts +83 -0
- package/src/hooks/dex/useCrossChainNativeFee.unit.test.ts +63 -0
- package/src/hooks/dex/useOnChainPoolData.ts +30 -13
- package/src/hooks/dex/useSingleAggregatorQuote.ts +4 -2
- package/src/hooks/enso/useBendZapSupply.ts +9 -38
- package/src/hooks/enso/useEnsoUserTokensWithBalances.ts +10 -2
- package/src/hooks/enso/useZapStakeBera.ts +1 -1
- package/src/hooks/exports.ts +2 -5
- package/src/hooks/pol/useAutoclaimedIncentives.ts +6 -3
- package/src/hooks/pol/useAutoclaimedIncentivesTxHash.ts +5 -2
- package/src/hooks/pol/useRewardTokenToBeraRate.ts +5 -4
- package/src/hooks/pol/useRewardVaultBalanceFromStakingToken.ts +0 -1
- package/src/hooks/pol/{useStakedAPR.ts → useStakedAPY.ts} +11 -9
- package/src/hooks/pol/useStakedData.ts +13 -14
- package/src/hooks/pol/useStakingVaultsMetadata.ts +3 -8
- package/src/hooks/tokens/useMultipleTokenInformation.ts +64 -21
- package/src/hooks/tokens/useMultipleTokenInformation.unit.test.ts +91 -0
- package/src/hooks/tokens/usePollBalance.ts +4 -2
- package/src/hooks/validators/useUserActiveValidators.ts +54 -9
- package/src/hooks/validators/useValidatorIncentiveDistribution.ts +3 -4
- package/src/types/bribeBoost.d.ts +0 -49
- package/src/types/dex.d.ts +17 -0
- package/src/types/enso.d.ts +1 -27
- package/src/types/global.d.ts +7 -0
- package/src/types/pol.d.ts +3 -48
- package/src/utils/crossChainBridge.ts +290 -0
- package/src/utils/crossChainBridge.unit.test.ts +177 -0
- package/src/utils/exports.ts +1 -1
- package/dist/BeraError-7-A5JYy_.d.ts +0 -123
- package/dist/BexStatusProvider-DRymVlQf.d.ts +0 -70
- package/dist/HoneyConfigProvider-COOuDNra.d.ts +0 -390
- package/dist/RequestError-DkUbo3ro.d.ts +0 -145
- package/dist/actions/clients/fetchOpenApi.unit.test.d.ts +0 -2
- package/dist/actions/clients/fetchOpenApi.unit.test.d.ts.map +0 -1
- package/dist/actions/dex/__tests__/aggregators.unit.test.d.ts +0 -2
- package/dist/actions/dex/__tests__/aggregators.unit.test.d.ts.map +0 -1
- package/dist/actions/dex/__tests__/allPools.integration.test.d.ts +0 -2
- package/dist/actions/dex/__tests__/allPools.integration.test.d.ts.map +0 -1
- package/dist/actions/dex/__tests__/getOnChainPool.unit.test.d.ts +0 -2
- package/dist/actions/dex/__tests__/getOnChainPool.unit.test.d.ts.map +0 -1
- package/dist/actions/dex/aggregators/enso/ensoErc4626.debug.test.d.ts +0 -2
- package/dist/actions/dex/aggregators/enso/ensoErc4626.debug.test.d.ts.map +0 -1
- package/dist/actions/dex/aggregators/haiku.integration.test.d.ts +0 -2
- package/dist/actions/dex/aggregators/haiku.integration.test.d.ts.map +0 -1
- package/dist/actions/dex/b-sdk.d.ts +0 -3
- package/dist/actions/enso/__tests__/getBendDemultiplyBundle.action.unit.test.d.ts +0 -2
- package/dist/actions/enso/__tests__/getBendDemultiplyBundle.action.unit.test.d.ts.map +0 -1
- package/dist/actions/enso/__tests__/getBendDemultiplyBundle.unit.test.d.ts +0 -2
- package/dist/actions/enso/__tests__/getBendDemultiplyBundle.unit.test.d.ts.map +0 -1
- package/dist/actions/enso/__tests__/getBendMultiplyBundle.action.unit.test.d.ts +0 -2
- package/dist/actions/enso/__tests__/getBendMultiplyBundle.action.unit.test.d.ts.map +0 -1
- package/dist/actions/enso/__tests__/getBendMultiplyBundle.unit.test.d.ts +0 -2
- package/dist/actions/enso/__tests__/getBendMultiplyBundle.unit.test.d.ts.map +0 -1
- package/dist/actions/enso/__tests__/getEnsoUserTokensWithBalances.debug.test.d.ts +0 -2
- package/dist/actions/enso/__tests__/getEnsoUserTokensWithBalances.debug.test.d.ts.map +0 -1
- package/dist/actions/enso/__tests__/util.unit.test.d.ts +0 -2
- package/dist/actions/enso/__tests__/util.unit.test.d.ts.map +0 -1
- package/dist/actions/enso/getEnsoSwapBundle.d.ts +0 -3
- package/dist/actions/enso/getEnsoSwapBundle.d.ts.map +0 -1
- package/dist/actions/governance/__tests__/checkProposalField.unit.test.d.ts +0 -2
- package/dist/actions/governance/__tests__/checkProposalField.unit.test.d.ts.map +0 -1
- package/dist/actions/governance/__tests__/getDecodedFunctionData.integration.test.d.ts +0 -2
- package/dist/actions/governance/__tests__/getDecodedFunctionData.integration.test.d.ts.map +0 -1
- package/dist/actions/governance/__tests__/getQuorum.integration.test.d.ts +0 -2
- package/dist/actions/governance/__tests__/getQuorum.integration.test.d.ts.map +0 -1
- package/dist/actions/honey/tests/pyth.integration.test.d.ts +0 -2
- package/dist/actions/honey/tests/pyth.integration.test.d.ts.map +0 -1
- package/dist/actions/pol/__tests__/getAllValidators.integration.test.d.ts +0 -2
- package/dist/actions/pol/__tests__/getAllValidators.integration.test.d.ts.map +0 -1
- package/dist/actions/pol/__tests__/getValidator.integration.test.d.ts +0 -2
- package/dist/actions/pol/__tests__/getValidator.integration.test.d.ts.map +0 -1
- package/dist/actions/pol/__tests__/rewardVaults.integration.test.d.ts +0 -2
- package/dist/actions/pol/__tests__/rewardVaults.integration.test.d.ts.map +0 -1
- package/dist/actions/pol/getBgtAprSimultaion.unit.test.d.ts +0 -2
- package/dist/actions/pol/getBgtAprSimultaion.unit.test.d.ts.map +0 -1
- package/dist/actions/pol/getBgtIncentiveDistributorPaused.d.ts +0 -10
- package/dist/actions/pol/getBgtIncentiveDistributorPaused.d.ts.map +0 -1
- package/dist/actions/pol/getBlockTime.debug.test.d.ts +0 -2
- package/dist/actions/pol/getBlockTime.debug.test.d.ts.map +0 -1
- package/dist/actions/pol/getRewardProofsByValidator.d.ts +0 -9
- package/dist/actions/pol/getRewardProofsByValidator.d.ts.map +0 -1
- package/dist/actions/pol/getRewardVaultBeaconImplementation.integration.test.d.ts +0 -2
- package/dist/actions/pol/getRewardVaultBeaconImplementation.integration.test.d.ts.map +0 -1
- package/dist/actions/pol/getRewardVaultDurationConstants.integration.test.d.ts +0 -2
- package/dist/actions/pol/getRewardVaultDurationConstants.integration.test.d.ts.map +0 -1
- package/dist/actions/pol/getStakedBeraAPR.d.ts +0 -12
- package/dist/actions/pol/getStakedBeraAPR.d.ts.map +0 -1
- package/dist/actions/pol/getUserClaimableIncentives.d.ts +0 -9
- package/dist/actions/pol/getUserClaimableIncentives.d.ts.map +0 -1
- package/dist/actions/prices/__tests__/prices.integration.test.d.ts +0 -2
- package/dist/actions/prices/__tests__/prices.integration.test.d.ts.map +0 -1
- package/dist/actions/tokens/getWalletBalances.integration.test.d.ts +0 -2
- package/dist/actions/tokens/getWalletBalances.integration.test.d.ts.map +0 -1
- package/dist/actions/transactions/beraWriteContract.integration.test.d.ts +0 -2
- package/dist/actions/transactions/beraWriteContract.integration.test.d.ts.map +0 -1
- package/dist/actions/validators/getActiveBoostAndCommissionChangeDelay.integration.test.d.ts +0 -2
- package/dist/actions/validators/getActiveBoostAndCommissionChangeDelay.integration.test.d.ts.map +0 -1
- package/dist/actions/validators/getValidatorAnalytics.d.ts +0 -12
- package/dist/actions/validators/getValidatorAnalytics.d.ts.map +0 -1
- package/dist/actions/validators/utils/__tests__/validatorUtils.integration.test.d.ts +0 -2
- package/dist/actions/validators/utils/__tests__/validatorUtils.integration.test.d.ts.map +0 -1
- package/dist/actions/validators/utils/aggregateValidatorIncentives.unit.test.d.ts +0 -2
- package/dist/actions/validators/utils/aggregateValidatorIncentives.unit.test.d.ts.map +0 -1
- package/dist/chunk-7TFV6UKF.mjs.map +0 -1
- package/dist/chunk-BSOWLS3W.mjs +0 -40
- package/dist/chunk-BSOWLS3W.mjs.map +0 -1
- package/dist/chunk-DOZJB6IJ.mjs.map +0 -1
- package/dist/chunk-IFNIPVTZ.mjs.map +0 -1
- package/dist/chunk-NZAH3SGT.mjs.map +0 -1
- package/dist/chunk-P3YZ7F22.mjs.map +0 -1
- package/dist/chunk-PHYZRH4I.mjs.map +0 -1
- package/dist/chunk-UA3Z47LT.mjs.map +0 -1
- package/dist/chunk-ZWTGVIPJ.mjs.map +0 -1
- package/dist/contexts/block-time-provider.d.ts +0 -10
- package/dist/defaultFlags-D6KfkTZx.d.ts +0 -10
- package/dist/dex-C_BB0b0O.d.ts +0 -37
- package/dist/errors/BeraError.unit.test.d.ts +0 -2
- package/dist/errors/BeraError.unit.test.d.ts.map +0 -1
- package/dist/errors/BeraTracing.unit.test.d.ts +0 -2
- package/dist/errors/BeraTracing.unit.test.d.ts.map +0 -1
- package/dist/errors/RequestError.unit.test.d.ts +0 -2
- package/dist/errors/RequestError.unit.test.d.ts.map +0 -1
- package/dist/errors/assert.unit.test.d.ts +0 -2
- package/dist/errors/assert.unit.test.d.ts.map +0 -1
- package/dist/errors/getRevertReason.integration.test.d.ts +0 -2
- package/dist/errors/getRevertReason.integration.test.d.ts.map +0 -1
- package/dist/errors/spanStatus.unit.test.d.ts +0 -2
- package/dist/errors/spanStatus.unit.test.d.ts.map +0 -1
- package/dist/getApolloClient-MWm_iq4u.d.ts +0 -39
- package/dist/getProposalVotes-DAUrdX2n.d.ts +0 -12
- package/dist/getValidatorQueuedOperatorAddress-N2I7wHd6.d.ts +0 -511
- package/dist/global.d-CR3zicga.d.ts +0 -231
- package/dist/global.d-CiZJ2eHz.d.ts +0 -231
- package/dist/honey-CYm0RWf4.d.ts +0 -14
- package/dist/hooks/enso/useEnsoSwapBundle.d.ts +0 -26
- package/dist/hooks/enso/useEnsoSwapBundle.d.ts.map +0 -1
- package/dist/hooks/pol/useBgtIncentiveDistributorPaused.d.ts +0 -8
- package/dist/hooks/pol/useBgtIncentiveDistributorPaused.d.ts.map +0 -1
- package/dist/hooks/pol/useStakedAPR.d.ts +0 -11
- package/dist/hooks/pol/useStakedAPR.d.ts.map +0 -1
- package/dist/hooks/validators/useUserClaimableIncentives.d.ts +0 -8
- package/dist/hooks/validators/useUserClaimableIncentives.d.ts.map +0 -1
- package/dist/hooks/validators/useValidatorAnalytics.d.ts +0 -11
- package/dist/hooks/validators/useValidatorAnalytics.d.ts.map +0 -1
- package/dist/pol.d-CeRgXBL8.d.ts +0 -167
- package/dist/txnEnum-ByI5dtDi.d.ts +0 -106
- package/dist/types/bribe-boost.d.ts +0 -69
- package/dist/types/bribeBoost.d.ts +0 -69
- package/dist/types/dex.d.ts +0 -225
- package/dist/types/enso.d.ts +0 -76
- package/dist/types/global.d.ts +0 -198
- package/dist/types/governance.d.ts +0 -112
- package/dist/types/honeySwap.d.ts +0 -23
- package/dist/types/pol.d.ts +0 -78
- package/dist/types/staking.d.ts +0 -22
- package/dist/useHoneySwapState-CXVWAThr.d.ts +0 -32
- package/dist/useHoneySwapState-twi7NTaO.d.ts +0 -32
- package/dist/utils/createEmitter.unit.test.d.ts +0 -2
- package/dist/utils/createEmitter.unit.test.d.ts.map +0 -1
- package/dist/utils/formatIncentivesTokenMap.d.ts +0 -3
- package/dist/utils/formatIncentivesTokenMap.d.ts.map +0 -1
- package/dist/utils/formatNumber.unit.test.d.ts +0 -2
- package/dist/utils/formatNumber.unit.test.d.ts.map +0 -1
- package/dist/utils/formatTimestamps.unit.test.d.ts +0 -2
- package/dist/utils/formatTimestamps.unit.test.d.ts.map +0 -1
- package/dist/utils/getContractName.unit.test.d.ts +0 -2
- package/dist/utils/getContractName.unit.test.d.ts.map +0 -1
- package/dist/utils/getHoneySwapMessage.test.d.ts +0 -2
- package/dist/utils/getHoneySwapMessage.test.d.ts.map +0 -1
- package/dist/utils/layerZeroScan.d.ts +0 -39
- package/dist/utils/layerZeroScan.d.ts.map +0 -1
- package/dist/utils/math.unit.test.d.ts +0 -2
- package/dist/utils/math.unit.test.d.ts.map +0 -1
- package/dist/utils/parseBaseArgs.unit.test.d.ts +0 -2
- package/dist/utils/parseBaseArgs.unit.test.d.ts.map +0 -1
- package/dist/utils/polyfillAbortSignalAny.unit.test.d.ts +0 -2
- package/dist/utils/polyfillAbortSignalAny.unit.test.d.ts.map +0 -1
- package/dist/utils/time.unit.test.d.ts +0 -2
- package/dist/utils/time.unit.test.d.ts.map +0 -1
- package/dist/utils/tokens.unit.test.d.ts +0 -2
- package/dist/utils/tokens.unit.test.d.ts.map +0 -1
- package/dist/utils/truncateHash.unit.test.d.ts +0 -2
- package/dist/utils/truncateHash.unit.test.d.ts.map +0 -1
- package/src/actions/enso/getEnsoSwapBundle.ts +0 -72
- package/src/actions/pol/getBgtIncentiveDistributorPaused.ts +0 -28
- package/src/actions/pol/getRewardProofsByValidator.ts +0 -49
- package/src/actions/pol/getStakedBeraAPR.ts +0 -56
- package/src/actions/pol/getUserClaimableIncentives.ts +0 -40
- package/src/actions/validators/getValidatorAnalytics.ts +0 -37
- package/src/hooks/enso/useEnsoSwapBundle.ts +0 -121
- package/src/hooks/pol/useBgtIncentiveDistributorPaused.ts +0 -34
- package/src/hooks/validators/useUserClaimableIncentives.ts +0 -148
- package/src/hooks/validators/useValidatorAnalytics.ts +0 -37
- package/src/utils/formatIncentivesTokenMap.ts +0 -19
- package/src/utils/layerZeroScan.ts +0 -124
- /package/dist/{chunk-AEN6IJFU.mjs.map → chunk-7KN7TDUC.mjs.map} +0 -0
- /package/dist/{chunk-LE4CYW7S.mjs.map → chunk-FWRYUIJK.mjs.map} +0 -0
- /package/dist/{chunk-PJRLHTGC.mjs.map → chunk-HPRLNT6R.mjs.map} +0 -0
- /package/dist/{chunk-EJIGERYM.mjs.map → chunk-M3MIGSH3.mjs.map} +0 -0
- /package/dist/{chunk-TGN55GKE.mjs.map → chunk-SC3BSCTN.mjs.map} +0 -0
- /package/dist/{chunk-QQASX4LJ.mjs.map → chunk-TXWDUJOY.mjs.map} +0 -0
- /package/dist/{chunk-EGAB6NFQ.mjs.map → chunk-UWJQ6UKG.mjs.map} +0 -0
- /package/dist/{chunk-J3LTASDE.mjs.map → chunk-ZHV3MQ4F.mjs.map} +0 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { formatEther, zeroAddress } from "viem";
|
|
4
|
+
|
|
5
|
+
import { usePollBalance } from "../tokens/usePollBalance";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Whether the source-chain native balance fails to cover the tx value.
|
|
9
|
+
*
|
|
10
|
+
* Same-chain zaps never qualify: their tx `value` is the native amount being
|
|
11
|
+
* swapped (e.g. BERA → HONEY), not a bridge fee, so treating it as a fee would
|
|
12
|
+
* always flag the balance short. Extracted (and exported) so the branch is
|
|
13
|
+
* unit-testable without a React renderer.
|
|
14
|
+
*/
|
|
15
|
+
export function isNativeFeeInsufficient({
|
|
16
|
+
isCrossChain,
|
|
17
|
+
value,
|
|
18
|
+
nativeBalance,
|
|
19
|
+
isLoading,
|
|
20
|
+
}: {
|
|
21
|
+
isCrossChain: boolean;
|
|
22
|
+
value: bigint;
|
|
23
|
+
nativeBalance: bigint;
|
|
24
|
+
isLoading: boolean;
|
|
25
|
+
}): boolean {
|
|
26
|
+
if (!isCrossChain) return false;
|
|
27
|
+
return value > 0n && !isLoading && value > nativeBalance;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Cross-chain zaps pay the LayerZero bridge fee out of the source-chain native
|
|
32
|
+
* balance (it's baked into the tx `value`). This polls that native balance and
|
|
33
|
+
* reports whether it covers the fee, so the shared warning/gas-reserve UI stops
|
|
34
|
+
* being copy-pasted per call site. Only polls when a cross-chain route exists —
|
|
35
|
+
* `srcChainId` is passed undefined otherwise.
|
|
36
|
+
*/
|
|
37
|
+
export function useCrossChainNativeFee({
|
|
38
|
+
srcChainId,
|
|
39
|
+
value,
|
|
40
|
+
}: {
|
|
41
|
+
/** Source chain the tx (and bridge fee) lives on. Undefined ⇒ not cross-chain, no poll. */
|
|
42
|
+
srcChainId: number | undefined;
|
|
43
|
+
/** The tx value in wei, including the bridge fee. */
|
|
44
|
+
value: bigint;
|
|
45
|
+
}): {
|
|
46
|
+
nativeFee?: string;
|
|
47
|
+
hasInsufficientNativeBalance: boolean;
|
|
48
|
+
isNativeBalanceLoading: boolean;
|
|
49
|
+
} {
|
|
50
|
+
const isCrossChain = srcChainId !== undefined;
|
|
51
|
+
|
|
52
|
+
const { data: nativeBalanceData, isLoading: isNativeBalanceLoading } =
|
|
53
|
+
usePollBalance(
|
|
54
|
+
{
|
|
55
|
+
address: zeroAddress,
|
|
56
|
+
chainId: isCrossChain ? srcChainId : undefined,
|
|
57
|
+
},
|
|
58
|
+
{ isEnabled: isCrossChain },
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
// For a same-chain zap the tx `value` is the native amount being swapped, not
|
|
62
|
+
// a bridge fee — so there's no fee to display or check.
|
|
63
|
+
if (!isCrossChain) {
|
|
64
|
+
return {
|
|
65
|
+
nativeFee: undefined,
|
|
66
|
+
hasInsufficientNativeBalance: false,
|
|
67
|
+
isNativeBalanceLoading: false,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const nativeBalance = BigInt(nativeBalanceData?.balance.raw ?? 0n);
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
nativeFee: value > 0n ? formatEther(value) : undefined,
|
|
75
|
+
hasInsufficientNativeBalance: isNativeFeeInsufficient({
|
|
76
|
+
isCrossChain,
|
|
77
|
+
value,
|
|
78
|
+
nativeBalance,
|
|
79
|
+
isLoading: isNativeBalanceLoading,
|
|
80
|
+
}),
|
|
81
|
+
isNativeBalanceLoading,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { describe, expect, test } from "vitest";
|
|
2
|
+
|
|
3
|
+
import { isNativeFeeInsufficient } from "./useCrossChainNativeFee";
|
|
4
|
+
|
|
5
|
+
describe("isNativeFeeInsufficient", () => {
|
|
6
|
+
// Regression (PR #1965 review): a same-chain native-in zap (e.g. BERA → HONEY)
|
|
7
|
+
// has a non-zero tx value that is the swap amount, not a bridge fee. It must
|
|
8
|
+
// never be flagged as insufficient native balance.
|
|
9
|
+
test("same-chain zap is never insufficient, even with a large value", () => {
|
|
10
|
+
expect(
|
|
11
|
+
isNativeFeeInsufficient({
|
|
12
|
+
isCrossChain: false,
|
|
13
|
+
value: 10n ** 18n,
|
|
14
|
+
nativeBalance: 0n,
|
|
15
|
+
isLoading: false,
|
|
16
|
+
}),
|
|
17
|
+
).toBe(false);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
test("cross-chain: insufficient when value exceeds native balance", () => {
|
|
21
|
+
expect(
|
|
22
|
+
isNativeFeeInsufficient({
|
|
23
|
+
isCrossChain: true,
|
|
24
|
+
value: 2n,
|
|
25
|
+
nativeBalance: 1n,
|
|
26
|
+
isLoading: false,
|
|
27
|
+
}),
|
|
28
|
+
).toBe(true);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test("cross-chain: sufficient when balance covers the fee", () => {
|
|
32
|
+
expect(
|
|
33
|
+
isNativeFeeInsufficient({
|
|
34
|
+
isCrossChain: true,
|
|
35
|
+
value: 1n,
|
|
36
|
+
nativeBalance: 5n,
|
|
37
|
+
isLoading: false,
|
|
38
|
+
}),
|
|
39
|
+
).toBe(false);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test("cross-chain: not flagged while the balance is still loading", () => {
|
|
43
|
+
expect(
|
|
44
|
+
isNativeFeeInsufficient({
|
|
45
|
+
isCrossChain: true,
|
|
46
|
+
value: 2n,
|
|
47
|
+
nativeBalance: 0n,
|
|
48
|
+
isLoading: true,
|
|
49
|
+
}),
|
|
50
|
+
).toBe(false);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test("cross-chain: zero value is never insufficient", () => {
|
|
54
|
+
expect(
|
|
55
|
+
isNativeFeeInsufficient({
|
|
56
|
+
isCrossChain: true,
|
|
57
|
+
value: 0n,
|
|
58
|
+
nativeBalance: 0n,
|
|
59
|
+
isLoading: false,
|
|
60
|
+
}),
|
|
61
|
+
).toBe(false);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
@@ -93,17 +93,16 @@ export function useOnChainPoolData(poolId: string) {
|
|
|
93
93
|
return undefined;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
tokens: tokenInformation.map((token, idx) => ({
|
|
96
|
+
const infoByAddress = new Map(
|
|
97
|
+
tokenInformation.map(
|
|
98
|
+
(token) => [token.address.toLowerCase(), token] as const,
|
|
99
|
+
),
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
const tokens = poolData.poolTokens[0].map((rawAddress, idx) => {
|
|
103
|
+
const token = infoByAddress.get(rawAddress.toLowerCase());
|
|
104
|
+
if (!token) return null;
|
|
105
|
+
return {
|
|
107
106
|
address: token.address.toLowerCase() as Address,
|
|
108
107
|
name: token.name,
|
|
109
108
|
decimals: token.decimals,
|
|
@@ -115,11 +114,29 @@ export function useOnChainPoolData(poolId: string) {
|
|
|
115
114
|
token.decimals,
|
|
116
115
|
),
|
|
117
116
|
token: {
|
|
118
|
-
__typename: "Token",
|
|
117
|
+
__typename: "Token" as const,
|
|
119
118
|
token,
|
|
120
119
|
latestUSDPrice: tokenPrices?.[token.address],
|
|
121
120
|
},
|
|
122
|
-
}
|
|
121
|
+
};
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// A pool token whose metadata couldn't be resolved leaves the pool incomplete;
|
|
125
|
+
if (tokens.some((token) => token === null)) {
|
|
126
|
+
return undefined;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const pool: OnChainPoolFragment = {
|
|
130
|
+
address: address.toLowerCase() as Address,
|
|
131
|
+
id: poolId.toLowerCase() as string,
|
|
132
|
+
type: poolData.type,
|
|
133
|
+
factory: poolData.factory,
|
|
134
|
+
totalShares: poolData.totalSupply,
|
|
135
|
+
totalLiquidity: "0", // overwritten below
|
|
136
|
+
swapFee: poolData.swapFee,
|
|
137
|
+
createTime: 0,
|
|
138
|
+
name: poolData.name,
|
|
139
|
+
tokens: tokens as NonNullable<(typeof tokens)[number]>[],
|
|
123
140
|
amplificationParameter: poolData?.amplificationParameter && {
|
|
124
141
|
// For example, if value is 300000n and precision is 1000n, the user-set amplification parameter would be 300000n / 1000n = 300n.
|
|
125
142
|
currentFormattedValue:
|
|
@@ -86,13 +86,15 @@ function getQueryKey({
|
|
|
86
86
|
if (!Number(args.amount)) {
|
|
87
87
|
return null;
|
|
88
88
|
}
|
|
89
|
+
|
|
89
90
|
if (
|
|
90
|
-
|
|
91
|
+
aggregator.getUnsupportedReason({
|
|
91
92
|
tokenIn: args.tokenIn,
|
|
92
93
|
tokenOut: args.tokenOut,
|
|
93
94
|
underlyingToken: args.underlyingToken,
|
|
94
95
|
honeyNativeState: args.honeyNativeState,
|
|
95
|
-
|
|
96
|
+
rewardVault: args.rewardVault,
|
|
97
|
+
}) !== null
|
|
96
98
|
) {
|
|
97
99
|
return null;
|
|
98
100
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { type Address,
|
|
4
|
-
|
|
5
|
-
import { defaultChainId as berachainChainId } from "@berachain/config/internal";
|
|
3
|
+
import { type Address, parseUnits, zeroAddress } from "viem";
|
|
6
4
|
|
|
7
5
|
import { useBeraWallet, usePublicClient } from "@berachain/wagmi/hooks";
|
|
8
6
|
import { useSWR } from "@berachain/utils/pkg/swr";
|
|
@@ -19,9 +17,8 @@ import type { BalanceToken, MinimalERC20 } from "../../types/dex";
|
|
|
19
17
|
import type { DefaultHookOptions } from "../../types/global";
|
|
20
18
|
import { isToken } from "../../utils/tokens";
|
|
21
19
|
import { useGetConvertToAssets } from "../bend/useGetConvertToAssets";
|
|
20
|
+
import { useCrossChainNativeFee } from "../dex/useCrossChainNativeFee";
|
|
22
21
|
import { usePriceImpact } from "../dex/usePriceImpact";
|
|
23
|
-
import { usePollBalance } from "../tokens/usePollBalance";
|
|
24
|
-
import { useTokenPrices } from "../tokens/useTokenPrices";
|
|
25
22
|
|
|
26
23
|
type UseBendZapSupplyArgs = {
|
|
27
24
|
/*
|
|
@@ -69,10 +66,6 @@ export function useBendZapSupply(
|
|
|
69
66
|
}: UseBendZapSupplyArgs,
|
|
70
67
|
options?: DefaultHookOptions,
|
|
71
68
|
) {
|
|
72
|
-
const { getTokenPrice } = useTokenPrices({
|
|
73
|
-
tokens: tokenIn && loanToken ? [tokenIn, loanToken] : undefined,
|
|
74
|
-
});
|
|
75
|
-
|
|
76
69
|
const swrResponse = useBendZapSupplyHelper(
|
|
77
70
|
{
|
|
78
71
|
tokenIn,
|
|
@@ -106,39 +99,17 @@ export function useBendZapSupply(
|
|
|
106
99
|
},
|
|
107
100
|
);
|
|
108
101
|
|
|
109
|
-
const isCrossChain =
|
|
102
|
+
const isCrossChain = swrResponse.data?.isCrossChain;
|
|
110
103
|
|
|
111
|
-
//
|
|
112
|
-
|
|
113
|
-
usePollBalance(
|
|
114
|
-
{
|
|
115
|
-
address: zeroAddress,
|
|
116
|
-
chainId: isCrossChain ? tokenIn?.chainId : undefined,
|
|
117
|
-
},
|
|
118
|
-
{ isEnabled: !!isCrossChain },
|
|
119
|
-
);
|
|
120
|
-
|
|
121
|
-
// for cross-chain zaps, check if transaction value exceeds native token balance
|
|
122
|
-
// (tx.value includes bridge fees that must be paid in native token)
|
|
104
|
+
// for cross-chain zaps, tx.value includes the bridge fee (paid in native
|
|
105
|
+
// token on the source chain); check the source-chain native balance covers it.
|
|
123
106
|
const transactionValue =
|
|
124
107
|
swrResponse.data?.getCalldata?.({ account: zeroAddress })?.value ?? 0n;
|
|
125
108
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
};
|
|
131
|
-
const hasInsufficientNativeBalance =
|
|
132
|
-
isCrossChain &&
|
|
133
|
-
transactionValue > 0n &&
|
|
134
|
-
!isNativeBalanceLoading &&
|
|
135
|
-
transactionValue > BigInt(nativeBalance.raw);
|
|
136
|
-
|
|
137
|
-
// formatted native fee for gas reserve display
|
|
138
|
-
const nativeFee =
|
|
139
|
-
isCrossChain && transactionValue > 0n
|
|
140
|
-
? formatEther(transactionValue)
|
|
141
|
-
: undefined;
|
|
109
|
+
const { hasInsufficientNativeBalance, nativeFee } = useCrossChainNativeFee({
|
|
110
|
+
srcChainId: isCrossChain ? swrResponse.data?.srcChainId : undefined,
|
|
111
|
+
value: transactionValue,
|
|
112
|
+
});
|
|
142
113
|
|
|
143
114
|
return {
|
|
144
115
|
...swrResponse,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ChainId, defaultChainId } from "@berachain/config/internal";
|
|
2
|
+
|
|
1
3
|
import { useBeraWallet, useConfig } from "@berachain/wagmi/hooks";
|
|
2
4
|
import { useSWR } from "@berachain/utils/pkg/swr";
|
|
3
5
|
|
|
@@ -17,10 +19,9 @@ export function useEnsoUserTokensWithBalances(
|
|
|
17
19
|
const proxyAggregatorsThroughVercel = useBeraFlag(
|
|
18
20
|
"proxyAggregatorsThroughVercel",
|
|
19
21
|
);
|
|
20
|
-
const isEnabled = !!fromAddress;
|
|
21
22
|
|
|
22
23
|
const QUERY_KEY =
|
|
23
|
-
|
|
24
|
+
fromAddress && wagmiConfig
|
|
24
25
|
? ([
|
|
25
26
|
"useEnsoUserTokensWithBalances",
|
|
26
27
|
fromAddress,
|
|
@@ -43,6 +44,13 @@ export function useEnsoUserTokensWithBalances(
|
|
|
43
44
|
{
|
|
44
45
|
refreshInterval: POLLING.NORMAL,
|
|
45
46
|
...options,
|
|
47
|
+
// Enso only supports mainnet — on a Bepolia deployment `getBalances`
|
|
48
|
+
// returns a non-array, which the action reports as a warning (HUB-A1J).
|
|
49
|
+
// Don't query at all when the app isn't on an Enso-supported chain.
|
|
50
|
+
isEnabled:
|
|
51
|
+
chainId !== ChainId.BEPOLIA &&
|
|
52
|
+
defaultChainId !== ChainId.BEPOLIA &&
|
|
53
|
+
(options?.isEnabled ?? true),
|
|
46
54
|
},
|
|
47
55
|
);
|
|
48
56
|
}
|
package/src/hooks/exports.ts
CHANGED
|
@@ -13,6 +13,7 @@ export * from "./dex/useAllUserPools";
|
|
|
13
13
|
export * from "./dex/useApiPool";
|
|
14
14
|
export * from "./dex/useBexStatus";
|
|
15
15
|
export * from "./dex/useCreatePool";
|
|
16
|
+
export * from "./dex/useCrossChainNativeFee";
|
|
16
17
|
export { useGlobalLiquidityAndSwapVolume } from "./dex/useGlobalLiquidityAndSwapVolume";
|
|
17
18
|
export * from "./dex/useLiquidityMismatch";
|
|
18
19
|
export * from "./dex/useLpPosition";
|
|
@@ -32,7 +33,6 @@ export {
|
|
|
32
33
|
export * from "./enso/useBendDemultiply";
|
|
33
34
|
export * from "./enso/useBendMultiply";
|
|
34
35
|
export * from "./enso/useBendZapSupply";
|
|
35
|
-
export * from "./enso/useEnsoSwapBundle";
|
|
36
36
|
export * from "./enso/useEnsoUserTokensWithBalances";
|
|
37
37
|
export * from "./enso/useZapStakeBera";
|
|
38
38
|
export * from "./honey/useCappedGlobally";
|
|
@@ -51,7 +51,6 @@ export * from "./perps/usePythUpdateFee";
|
|
|
51
51
|
export { useAutoclaimedIncentives } from "./pol/useAutoclaimedIncentives";
|
|
52
52
|
export { useAutoclaimedIncentivesTxHash } from "./pol/useAutoclaimedIncentivesTxHash";
|
|
53
53
|
export * from "./pol/useBgtAprSimulation";
|
|
54
|
-
export { useBgtIncentiveDistributorPaused } from "./pol/useBgtIncentiveDistributorPaused";
|
|
55
54
|
export { useBgtUnstakedBalance } from "./pol/useBgtUnstakedBalance";
|
|
56
55
|
export { useClaimableFees } from "./pol/useClaimableFees";
|
|
57
56
|
export * from "./pol/useHighestVaultsAPR";
|
|
@@ -66,7 +65,7 @@ export * from "./pol/useRewardVaultIncentives";
|
|
|
66
65
|
export { useRewardVaultRewards } from "./pol/useRewardVaultRewards";
|
|
67
66
|
export * from "./pol/useRewardVaults";
|
|
68
67
|
export { useRewardVaults } from "./pol/useRewardVaults";
|
|
69
|
-
export * from "./pol/
|
|
68
|
+
export * from "./pol/useStakedAPY";
|
|
70
69
|
export * from "./pol/useStakedData";
|
|
71
70
|
export * from "./pol/useStakedSnapshots";
|
|
72
71
|
export * from "./pol/useStakingVaultsMetadata";
|
|
@@ -104,10 +103,8 @@ export {
|
|
|
104
103
|
export * from "./validators/useStakingPoolBatch";
|
|
105
104
|
export { useUserActiveValidators } from "./validators/useUserActiveValidators";
|
|
106
105
|
export { useUserBoostsOnValidator } from "./validators/useUserBoostsOnValidator";
|
|
107
|
-
export { useUserClaimableIncentives } from "./validators/useUserClaimableIncentives";
|
|
108
106
|
export * from "./validators/useUserStakingPositions";
|
|
109
107
|
export * from "./validators/useValidator";
|
|
110
|
-
export { useValidatorAnalytics } from "./validators/useValidatorAnalytics";
|
|
111
108
|
export { useValidatorCommission } from "./validators/useValidatorCommission";
|
|
112
109
|
export { useValidatorEstimatedBgtPerYear } from "./validators/useValidatorEstimatedBgtPerYear";
|
|
113
110
|
export { useValidatorIncentiveDistribution } from "./validators/useValidatorIncentiveDistribution";
|
|
@@ -4,11 +4,12 @@ import { useSWR } from "@berachain/utils/pkg/swr";
|
|
|
4
4
|
import { getAutoclaimedIncentives } from "../../actions/pol/getAutoclaimedIncentives";
|
|
5
5
|
import type { AutoclaimedIncentivesResponse } from "../../types/bribeBoost";
|
|
6
6
|
import type { DefaultHookReturnType } from "../../types/global";
|
|
7
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
7
8
|
|
|
8
9
|
interface UseAutoclaimedIncentivesArgs {
|
|
9
10
|
// Hard gate: when false the SWR key is null, so the API is never called.
|
|
10
|
-
// The banner consumer flips this to true only after
|
|
11
|
-
//
|
|
11
|
+
// The banner consumer flips this to true only after
|
|
12
|
+
// `bgtIncentiveDistributor.paused() === true` has been verified.
|
|
12
13
|
enabled: boolean;
|
|
13
14
|
}
|
|
14
15
|
|
|
@@ -16,9 +17,11 @@ export function useAutoclaimedIncentives({
|
|
|
16
17
|
enabled,
|
|
17
18
|
}: UseAutoclaimedIncentivesArgs): DefaultHookReturnType<AutoclaimedIncentivesResponse | null> {
|
|
18
19
|
const { address: account } = useBeraWallet();
|
|
20
|
+
const { config } = parseBaseArgs({});
|
|
19
21
|
|
|
20
22
|
const QUERY_KEY =
|
|
21
|
-
|
|
23
|
+
// `bribeBoostApi` is null on chains where the endpoint is shut down.
|
|
24
|
+
enabled && account && config.pol.bribeBoostApi
|
|
22
25
|
? (["useAutoclaimedIncentives", account] as const)
|
|
23
26
|
: null;
|
|
24
27
|
|
|
@@ -5,10 +5,11 @@ import { getAutoclaimedIncentivesTxHash } from "../../actions/pol/getAutoclaimed
|
|
|
5
5
|
import { POLLING } from "../../enum/polling";
|
|
6
6
|
import type { AutoclaimedIncentivesTxHashResponse } from "../../types/bribeBoost";
|
|
7
7
|
import type { DefaultHookReturnType } from "../../types/global";
|
|
8
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
8
9
|
|
|
9
10
|
interface UseAutoclaimedIncentivesTxHashArgs {
|
|
10
11
|
// Hard gate, identical to `useAutoclaimedIncentives` — only flip true once
|
|
11
|
-
//
|
|
12
|
+
// `bgtIncentiveDistributor.paused()` holds.
|
|
12
13
|
enabled: boolean;
|
|
13
14
|
}
|
|
14
15
|
|
|
@@ -16,9 +17,11 @@ export function useAutoclaimedIncentivesTxHash({
|
|
|
16
17
|
enabled,
|
|
17
18
|
}: UseAutoclaimedIncentivesTxHashArgs): DefaultHookReturnType<AutoclaimedIncentivesTxHashResponse | null> {
|
|
18
19
|
const { address: account } = useBeraWallet();
|
|
20
|
+
const { config } = parseBaseArgs({});
|
|
19
21
|
|
|
20
22
|
const QUERY_KEY =
|
|
21
|
-
|
|
23
|
+
// `bribeBoostApi` is null on chains where the endpoint is shut down.
|
|
24
|
+
enabled && account && config.pol.bribeBoostApi
|
|
22
25
|
? (["useAutoclaimedIncentivesTxHash", account] as const)
|
|
23
26
|
: null;
|
|
24
27
|
|
|
@@ -17,10 +17,11 @@ export function useRewardTokenToBeraRate(
|
|
|
17
17
|
},
|
|
18
18
|
opt?: DefaultHookOptions,
|
|
19
19
|
) {
|
|
20
|
-
const QUERY_KEY = address
|
|
21
|
-
? (["useRewardTokenToBeraRate", address] as const)
|
|
22
|
-
: null;
|
|
23
20
|
const publicClient = usePublicClient({ chainId: defaultChainId });
|
|
21
|
+
const QUERY_KEY =
|
|
22
|
+
address && publicClient
|
|
23
|
+
? (["useRewardTokenToBeraRate", address] as const)
|
|
24
|
+
: null;
|
|
24
25
|
|
|
25
26
|
return useSWR(
|
|
26
27
|
QUERY_KEY,
|
|
@@ -29,7 +30,7 @@ export function useRewardTokenToBeraRate(
|
|
|
29
30
|
assertPublicClient(publicClient);
|
|
30
31
|
|
|
31
32
|
return getRewardTokenToBeraRate({
|
|
32
|
-
address
|
|
33
|
+
address,
|
|
33
34
|
publicClient,
|
|
34
35
|
});
|
|
35
36
|
},
|
|
@@ -26,7 +26,6 @@ export function useRewardVaultBalanceFromStakingToken(
|
|
|
26
26
|
const isEnabled = options?.isEnabled ?? true;
|
|
27
27
|
const {
|
|
28
28
|
data: rewardVaultAddress = _rewardVaultAddress,
|
|
29
|
-
error,
|
|
30
29
|
refresh: mutateRewardVaultAddress,
|
|
31
30
|
isLoading: isLoadingRewardVaultAddress,
|
|
32
31
|
} = useRewardVaultFromToken(
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import type { GqlVaultSnapshotDataRange } from "@berachain/graphql/dex/api";
|
|
2
1
|
import { useSWR } from "@berachain/utils/pkg/swr";
|
|
3
2
|
|
|
4
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
getStakedBeraSnapshots,
|
|
5
|
+
type StakeSnapshotRange,
|
|
6
|
+
} from "../../actions/pol/getStakedBeraSnapshots";
|
|
5
7
|
import type { DefaultHookReturnType } from "../../types/global";
|
|
6
8
|
import { dailyResolution } from "../../utils/filter";
|
|
7
9
|
|
|
8
|
-
type
|
|
10
|
+
type UseStakedAPY = {
|
|
9
11
|
timestamp: number;
|
|
10
|
-
|
|
12
|
+
apy: number | null;
|
|
11
13
|
}[];
|
|
12
|
-
export function
|
|
14
|
+
export function useStakedAPY({
|
|
13
15
|
range,
|
|
14
16
|
}: {
|
|
15
|
-
range:
|
|
16
|
-
}): DefaultHookReturnType<
|
|
17
|
-
const QUERY_KEY = range ? (["
|
|
17
|
+
range: StakeSnapshotRange;
|
|
18
|
+
}): DefaultHookReturnType<UseStakedAPY> {
|
|
19
|
+
const QUERY_KEY = range ? (["useStakedAPY", range] as const) : null;
|
|
18
20
|
return useSWR(QUERY_KEY, async ([, range]) => {
|
|
19
21
|
const unsortedStakedBeraSnapshots = await getStakedBeraSnapshots({
|
|
20
22
|
range,
|
|
@@ -26,7 +28,7 @@ export function useStakedAPR({
|
|
|
26
28
|
|
|
27
29
|
return sortedStakedBeraSnapshots.map((item) => ({
|
|
28
30
|
timestamp: item.timestamp,
|
|
29
|
-
|
|
31
|
+
apy: item.apy,
|
|
30
32
|
}));
|
|
31
33
|
});
|
|
32
34
|
}
|
|
@@ -2,11 +2,11 @@ import { useMemo } from "react";
|
|
|
2
2
|
|
|
3
3
|
import { useBeraWallet, usePublicClient } from "@berachain/wagmi/hooks";
|
|
4
4
|
import BigNumber from "@berachain/utils/pkg/bignumber.js";
|
|
5
|
-
import { useSWR } from "@berachain/utils/pkg/swr";
|
|
5
|
+
import { useSWR, useSWRImmutable } from "@berachain/utils/pkg/swr";
|
|
6
6
|
|
|
7
7
|
import { getEarnedStakedBeraVault } from "../../actions/pol/getEarnedStakedBeraVault";
|
|
8
8
|
import { getRewardTokenToBeraRate } from "../../actions/pol/getRewardTokenToBeraRate";
|
|
9
|
-
import {
|
|
9
|
+
import { getStakedBeraAPY } from "../../actions/pol/getStakedBeraAPY";
|
|
10
10
|
import { useBeraFlag } from "../../contexts/BeraFlags/BeraFlags";
|
|
11
11
|
import { POLLING } from "../../enum/polling";
|
|
12
12
|
import { assertPublicClient } from "../../errors/assert";
|
|
@@ -18,7 +18,7 @@ import { useTokenPrices } from "../tokens/useTokenPrices";
|
|
|
18
18
|
/**
|
|
19
19
|
* Fetches staked asset data in two phases for progressive loading:
|
|
20
20
|
*
|
|
21
|
-
* 1.
|
|
21
|
+
* 1. APY — independent fetch, resolves quickly, shared by both phases.
|
|
22
22
|
* 2. Balances (fast path) — wallet balances (via usePollWalletBalances),
|
|
23
23
|
* token prices (via useTokenPrices), and exchange rates.
|
|
24
24
|
* Provides staked amounts and USD values immediately (earnings are 0).
|
|
@@ -42,12 +42,11 @@ export function useStakedData(stakingConfigs: StakingConfig[]) {
|
|
|
42
42
|
[stakingConfigs],
|
|
43
43
|
);
|
|
44
44
|
|
|
45
|
-
//
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
{ refreshInterval: POLLING.NORMAL },
|
|
45
|
+
// APY — only updates every ~12 hours on BE
|
|
46
|
+
const apyKey = window ? (["useStakedData:apy", window] as const) : null;
|
|
47
|
+
|
|
48
|
+
const { data: apy } = useSWRImmutable(apyKey, async ([, window]) =>
|
|
49
|
+
getStakedBeraAPY({ window }),
|
|
51
50
|
);
|
|
52
51
|
|
|
53
52
|
const {
|
|
@@ -152,7 +151,7 @@ export function useStakedData(stakingConfigs: StakingConfig[]) {
|
|
|
152
151
|
|
|
153
152
|
return {
|
|
154
153
|
token: inputToken,
|
|
155
|
-
|
|
154
|
+
apy,
|
|
156
155
|
stakedAmount: stakedAmount.toNumber(),
|
|
157
156
|
stakedAmountUsd,
|
|
158
157
|
earnedAmount: 0,
|
|
@@ -164,7 +163,7 @@ export function useStakedData(stakingConfigs: StakingConfig[]) {
|
|
|
164
163
|
walletBalances,
|
|
165
164
|
exchangeRates,
|
|
166
165
|
stakingConfigs,
|
|
167
|
-
|
|
166
|
+
apy,
|
|
168
167
|
getTokenPrice,
|
|
169
168
|
earningsSettled,
|
|
170
169
|
]);
|
|
@@ -205,14 +204,14 @@ export function useStakedData(stakingConfigs: StakingConfig[]) {
|
|
|
205
204
|
|
|
206
205
|
return {
|
|
207
206
|
token: inputToken,
|
|
208
|
-
|
|
207
|
+
apy,
|
|
209
208
|
stakedAmount: stakedAmount.toNumber(),
|
|
210
209
|
earnedAmount: earnedAmount.toNumber(),
|
|
211
210
|
stakedAmountUsd,
|
|
212
211
|
earnedAmountUsd,
|
|
213
212
|
};
|
|
214
213
|
});
|
|
215
|
-
}, [positionsRaw, walletBalances, stakingConfigs,
|
|
214
|
+
}, [positionsRaw, walletBalances, stakingConfigs, apy, getTokenPrice]);
|
|
216
215
|
|
|
217
216
|
return {
|
|
218
217
|
/** Fast path: staked amounts + USD values (no earnings) */
|
|
@@ -227,7 +226,7 @@ export function useStakedData(stakingConfigs: StakingConfig[]) {
|
|
|
227
226
|
/**
|
|
228
227
|
* Hard error: the RPC fast-path could not produce staked balances (wallet
|
|
229
228
|
* balances or exchange-rate reads failed). Price and earnings backend
|
|
230
|
-
* failures are intentionally excluded — those degrade gracefully (USD/
|
|
229
|
+
* failures are intentionally excluded — those degrade gracefully (USD/APY
|
|
231
230
|
* render as "—", earnings stop loading) so RPC-derived amounts still show.
|
|
232
231
|
*/
|
|
233
232
|
error: walletBalancesError ?? exchangeRatesError,
|
|
@@ -4,33 +4,28 @@ import { usePublicClient } from "@berachain/wagmi/hooks";
|
|
|
4
4
|
import { useSWR } from "@berachain/utils/pkg/swr";
|
|
5
5
|
|
|
6
6
|
import { getSWBeraVaultMetadata } from "../../actions/pol/getSWBeraVaultMetadata";
|
|
7
|
-
import { useBlockTime } from "../../contexts/BlockTimeProvider";
|
|
8
7
|
import { POLLING } from "../../enum/polling";
|
|
9
8
|
import { assertPublicClient } from "../../errors/assert";
|
|
10
9
|
|
|
11
10
|
export type StakingVaultEntry = {
|
|
12
11
|
address: Address;
|
|
13
|
-
underlyingAsset: Address;
|
|
14
12
|
};
|
|
15
13
|
|
|
16
14
|
export function useStakingVaultsMetadata(vaults: StakingVaultEntry[] = []) {
|
|
17
15
|
const publicClient = usePublicClient();
|
|
18
|
-
const blockTime = useBlockTime();
|
|
19
16
|
const QUERY_KEY =
|
|
20
|
-
vaults.length > 0 && publicClient
|
|
21
|
-
? (["useStakingVaultMetadata", vaults
|
|
17
|
+
vaults.length > 0 && publicClient
|
|
18
|
+
? (["useStakingVaultMetadata", vaults] as const)
|
|
22
19
|
: null;
|
|
23
20
|
return useSWR(
|
|
24
21
|
QUERY_KEY,
|
|
25
|
-
async ([, vaults
|
|
22
|
+
async ([, vaults]) => {
|
|
26
23
|
assertPublicClient(publicClient);
|
|
27
24
|
return Promise.all(
|
|
28
25
|
vaults.map((vault) =>
|
|
29
26
|
getSWBeraVaultMetadata({
|
|
30
27
|
address: vault.address,
|
|
31
|
-
underlyingAsset: vault.underlyingAsset,
|
|
32
28
|
publicClient,
|
|
33
|
-
blockTime,
|
|
34
29
|
}),
|
|
35
30
|
),
|
|
36
31
|
);
|