@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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"polyfillAbortSignalAny.unit.test.d.ts","sourceRoot":"","sources":["../../src/utils/polyfillAbortSignalAny.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"time.unit.test.d.ts","sourceRoot":"","sources":["../../src/utils/time.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.unit.test.d.ts","sourceRoot":"","sources":["../../src/utils/tokens.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"truncateHash.unit.test.d.ts","sourceRoot":"","sources":["../../src/utils/truncateHash.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import type { BundleAction } from "@ensofinance/sdk";
|
|
2
|
-
import { ethAddress, zeroAddress } from "viem";
|
|
3
|
-
|
|
4
|
-
import { assertAddress } from "../../errors/assert";
|
|
5
|
-
import type {
|
|
6
|
-
GetEnsoSwapBundleArgs,
|
|
7
|
-
GetZapTransactionResponse,
|
|
8
|
-
} from "../../types/enso";
|
|
9
|
-
import { getTransactionsFromBundle } from "./util";
|
|
10
|
-
|
|
11
|
-
export async function getEnsoSwapBundle({
|
|
12
|
-
fromAddress,
|
|
13
|
-
amountIn,
|
|
14
|
-
tokenIn,
|
|
15
|
-
tokenOut,
|
|
16
|
-
chainId,
|
|
17
|
-
ensoClient,
|
|
18
|
-
destinationChainId,
|
|
19
|
-
slippage,
|
|
20
|
-
publicClient,
|
|
21
|
-
}: GetEnsoSwapBundleArgs): Promise<GetZapTransactionResponse> {
|
|
22
|
-
assertAddress(fromAddress, "fromAddress");
|
|
23
|
-
|
|
24
|
-
if (tokenOut === zeroAddress) tokenOut = ethAddress;
|
|
25
|
-
|
|
26
|
-
const bundleAction: BundleAction = {
|
|
27
|
-
protocol: "enso",
|
|
28
|
-
action: "route",
|
|
29
|
-
args: {
|
|
30
|
-
tokenIn,
|
|
31
|
-
tokenOut,
|
|
32
|
-
amountIn,
|
|
33
|
-
slippage: slippage * 100, // Enso expects slippage in basis points
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* If the zap is cross chain, we need to add the destination chain id and the refund receiver.
|
|
38
|
-
*
|
|
39
|
-
* Enso still need to update the sdk types to support this.
|
|
40
|
-
*/
|
|
41
|
-
if (destinationChainId && destinationChainId !== chainId) {
|
|
42
|
-
bundleAction.args = {
|
|
43
|
-
...bundleAction.args,
|
|
44
|
-
destinationChainId: destinationChainId,
|
|
45
|
-
refundReceiver: fromAddress,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const bundle = await ensoClient.getBundleData(
|
|
50
|
-
{
|
|
51
|
-
fromAddress: fromAddress,
|
|
52
|
-
receiver: fromAddress,
|
|
53
|
-
spender: fromAddress,
|
|
54
|
-
chainId: chainId,
|
|
55
|
-
routingStrategy: "router",
|
|
56
|
-
},
|
|
57
|
-
[bundleAction],
|
|
58
|
-
);
|
|
59
|
-
const transactions = await getTransactionsFromBundle({
|
|
60
|
-
fromAddress,
|
|
61
|
-
amountIn,
|
|
62
|
-
tokenIn,
|
|
63
|
-
chainId,
|
|
64
|
-
ensoClient,
|
|
65
|
-
bundle,
|
|
66
|
-
publicClient,
|
|
67
|
-
});
|
|
68
|
-
return {
|
|
69
|
-
bundle,
|
|
70
|
-
transactions,
|
|
71
|
-
};
|
|
72
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { PublicClient } from "viem";
|
|
2
|
-
|
|
3
|
-
import { bgtIncentiveDistributorAbi } from "@berachain/abis/pol/rewards/bgtIncentiveDistributor";
|
|
4
|
-
|
|
5
|
-
import { assertPublicClient } from "../../errors/assert";
|
|
6
|
-
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Reads `paused()` on the BGT incentive distributor. Used to gate the
|
|
10
|
-
* autoclaim banner — when `true`, users can no longer self-claim and the
|
|
11
|
-
* bot is responsible for distributing incentives on their behalf.
|
|
12
|
-
*/
|
|
13
|
-
export async function getBgtIncentiveDistributorPaused({
|
|
14
|
-
publicClient,
|
|
15
|
-
...args
|
|
16
|
-
}: {
|
|
17
|
-
publicClient: PublicClient | undefined;
|
|
18
|
-
} & BeraJS.BaseFunctionArgs): Promise<boolean> {
|
|
19
|
-
assertPublicClient(publicClient);
|
|
20
|
-
|
|
21
|
-
const { config } = parseBaseArgs(args);
|
|
22
|
-
|
|
23
|
-
return publicClient.readContract({
|
|
24
|
-
address: config.pol.bgtIncentiveDistributor,
|
|
25
|
-
abi: bgtIncentiveDistributorAbi,
|
|
26
|
-
functionName: "paused",
|
|
27
|
-
});
|
|
28
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { Address } from "viem";
|
|
2
|
-
|
|
3
|
-
import { BeraError } from "../../errors/BeraError";
|
|
4
|
-
import type { BribeBoostRewardProof } from "../../types/bribeBoost";
|
|
5
|
-
import { getErrorResponse } from "../../utils/getErrorResponse";
|
|
6
|
-
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
7
|
-
|
|
8
|
-
export async function getRewardProofsByValidator({
|
|
9
|
-
account,
|
|
10
|
-
validator,
|
|
11
|
-
page = 1,
|
|
12
|
-
perPage = 1000,
|
|
13
|
-
...args
|
|
14
|
-
}: {
|
|
15
|
-
account: Address;
|
|
16
|
-
validator: Address;
|
|
17
|
-
page?: number;
|
|
18
|
-
perPage?: number;
|
|
19
|
-
} & BeraJS.BaseFunctionArgs): Promise<BribeBoostRewardProof> {
|
|
20
|
-
const { config } = parseBaseArgs(args);
|
|
21
|
-
|
|
22
|
-
// We'll try to revalidate on the client side by using the cache: "no-store" and swrImmutable
|
|
23
|
-
// In the future, we can look at using cache and tags to invalidate the cache on the server side to prevent stale data
|
|
24
|
-
const result = await fetch(
|
|
25
|
-
`${
|
|
26
|
-
config.pol.bribeBoostApi
|
|
27
|
-
}/api/v1/wallets/${account.toLowerCase()}/proofs/validator/${validator.toLowerCase()}?page=${page}&per_page=${perPage}`,
|
|
28
|
-
{
|
|
29
|
-
cache: "no-store",
|
|
30
|
-
},
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
if (!result.ok) {
|
|
34
|
-
const error = await getErrorResponse(result);
|
|
35
|
-
throw new BeraError({
|
|
36
|
-
message: "Failed to fetch proofs on server",
|
|
37
|
-
cause: {
|
|
38
|
-
error,
|
|
39
|
-
result: result,
|
|
40
|
-
account,
|
|
41
|
-
validator,
|
|
42
|
-
},
|
|
43
|
-
reason: error?.reason,
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const data = await result.json();
|
|
48
|
-
return data;
|
|
49
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
GetSWberaVaultMetadata,
|
|
3
|
-
type GetSWberaVaultMetadataQuery,
|
|
4
|
-
type GetSWberaVaultMetadataQueryVariables,
|
|
5
|
-
type GqlChain,
|
|
6
|
-
GqlSWberaVaultMetadataResolution,
|
|
7
|
-
} from "@berachain/graphql/pol/api";
|
|
8
|
-
|
|
9
|
-
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
10
|
-
import { getApolloClient } from "../clients/getApolloClient";
|
|
11
|
-
|
|
12
|
-
function getResolution(window: "DAY" | "WEEK") {
|
|
13
|
-
if (window === "DAY") {
|
|
14
|
-
return GqlSWberaVaultMetadataResolution.OneDay;
|
|
15
|
-
}
|
|
16
|
-
return GqlSWberaVaultMetadataResolution.SevenDays;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
*
|
|
21
|
-
* @throws {Error} If the vault is not found
|
|
22
|
-
* @returns
|
|
23
|
-
*/
|
|
24
|
-
export async function getStakedBeraAPR({
|
|
25
|
-
window,
|
|
26
|
-
...args
|
|
27
|
-
}: {
|
|
28
|
-
/**
|
|
29
|
-
* APR might vary depending on the annualized time window (day or week)
|
|
30
|
-
*/
|
|
31
|
-
window: "DAY" | "WEEK";
|
|
32
|
-
} & BeraJS.BaseFunctionArgs): Promise<number> {
|
|
33
|
-
const { config } = parseBaseArgs(args);
|
|
34
|
-
|
|
35
|
-
const bexApiGraphqlClient = getApolloClient("api", args);
|
|
36
|
-
|
|
37
|
-
try {
|
|
38
|
-
const data = await bexApiGraphqlClient.query<
|
|
39
|
-
GetSWberaVaultMetadataQuery,
|
|
40
|
-
GetSWberaVaultMetadataQueryVariables
|
|
41
|
-
>({
|
|
42
|
-
query: GetSWberaVaultMetadata,
|
|
43
|
-
variables: {
|
|
44
|
-
chain: config.bex.chainName as GqlChain,
|
|
45
|
-
resolution: getResolution(window ?? "DAY"),
|
|
46
|
-
},
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
const { apr } = data.data.polGetSWberaVaultMetadata;
|
|
50
|
-
|
|
51
|
-
return Number(apr);
|
|
52
|
-
} catch (error) {
|
|
53
|
-
console.error("Failed to get SW Bera APR", error);
|
|
54
|
-
throw error;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { Address } from "viem";
|
|
2
|
-
|
|
3
|
-
import { BeraError } from "../../errors/BeraError";
|
|
4
|
-
import type { BribeBoostRewardItem } from "../../types/bribeBoost";
|
|
5
|
-
import { getErrorResponse } from "../../utils/getErrorResponse";
|
|
6
|
-
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Server-side function to get user claimable incentives grouped by validator
|
|
10
|
-
*/
|
|
11
|
-
export async function getUserClaimableIncentives({
|
|
12
|
-
account,
|
|
13
|
-
...args
|
|
14
|
-
}: {
|
|
15
|
-
account: Address;
|
|
16
|
-
} & BeraJS.BaseFunctionArgs): Promise<BribeBoostRewardItem[] | null> {
|
|
17
|
-
const { config } = parseBaseArgs(args);
|
|
18
|
-
|
|
19
|
-
// We'll try to revalidate on the client side by using the cache: "no-store" and swrImmutable
|
|
20
|
-
// In the future, we can look at using cache and tags to invalidate the cache on the server side to prevent stale data
|
|
21
|
-
const result = await fetch(
|
|
22
|
-
`${
|
|
23
|
-
config.pol.bribeBoostApi
|
|
24
|
-
}/api/v1/wallets/${account.toLowerCase()}/rewards/aggregation`,
|
|
25
|
-
{
|
|
26
|
-
cache: "no-store",
|
|
27
|
-
},
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
if (!result.ok) {
|
|
31
|
-
const error = await getErrorResponse(result);
|
|
32
|
-
throw new BeraError({
|
|
33
|
-
message: "Failed to fetch incentives on server",
|
|
34
|
-
cause: { error, result, account },
|
|
35
|
-
reason: error?.error,
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return result.json();
|
|
40
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { Address } from "viem";
|
|
2
|
-
|
|
3
|
-
import type { GetValidatorAnalyticsQuery } from "@berachain/graphql/pol/subgraph";
|
|
4
|
-
|
|
5
|
-
import { BeraError } from "../../errors/BeraError";
|
|
6
|
-
import { beraFetchJson } from "../../utils/beraFetch";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Browser-only. Hits `/api/pol/validator-analytics`.
|
|
10
|
-
*
|
|
11
|
-
* @deprecated will be removed in pol vNext
|
|
12
|
-
*/
|
|
13
|
-
export async function getValidatorAnalytics({
|
|
14
|
-
pubkey,
|
|
15
|
-
dayRange,
|
|
16
|
-
}: {
|
|
17
|
-
pubkey: Address;
|
|
18
|
-
dayRange: number;
|
|
19
|
-
}): Promise<GetValidatorAnalyticsQuery | undefined> {
|
|
20
|
-
if (typeof window === "undefined") {
|
|
21
|
-
throw new BeraError({
|
|
22
|
-
message:
|
|
23
|
-
"getValidatorAnalytics is browser-only; call from a Client Component / SWR hook",
|
|
24
|
-
level: "error",
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const params = new URLSearchParams({
|
|
29
|
-
pubkey,
|
|
30
|
-
dayRange: String(dayRange),
|
|
31
|
-
});
|
|
32
|
-
return beraFetchJson<GetValidatorAnalyticsQuery>({
|
|
33
|
-
url: `/api/pol/validator-analytics?${params}`,
|
|
34
|
-
name: "pol-validator-analytics",
|
|
35
|
-
type: "rest",
|
|
36
|
-
});
|
|
37
|
-
}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { getPublicClient } from "@wagmi/core";
|
|
4
|
-
import { parseUnits } from "viem";
|
|
5
|
-
|
|
6
|
-
import { defaultChainId as berachainChainId } from "@berachain/config/internal";
|
|
7
|
-
|
|
8
|
-
import { useBeraWallet, useConfig } from "@berachain/wagmi/hooks";
|
|
9
|
-
import { useSWR } from "@berachain/utils/pkg/swr";
|
|
10
|
-
|
|
11
|
-
import { getEnsoClient } from "../../actions/clients/getEnsoClient";
|
|
12
|
-
import { getEnsoSwapBundle } from "../../actions/enso/getEnsoSwapBundle";
|
|
13
|
-
import { useBeraFlag } from "../../contexts/BeraFlags/BeraFlags";
|
|
14
|
-
import { POLLING } from "../../enum/polling";
|
|
15
|
-
import {
|
|
16
|
-
assertAddress,
|
|
17
|
-
assertAmount,
|
|
18
|
-
assertDefined,
|
|
19
|
-
assertPublicClient,
|
|
20
|
-
} from "../../errors/assert";
|
|
21
|
-
import type { BalanceToken, MinimalERC20 } from "../../types/dex";
|
|
22
|
-
import type { GetZapTransactionResponse } from "../../types/enso";
|
|
23
|
-
import { usePollWalletBalances } from "../tokens/usePollWalletBalances";
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Get the swap bundle for swapping tokens using Enso.
|
|
27
|
-
* @param {Pick<BalanceToken, "address" | "decimals">} tokenIn - The input token to swap from
|
|
28
|
-
* @param {Pick<BalanceToken, "address" | "decimals">} tokenOut - The output token to swap to
|
|
29
|
-
* @param {string} amount - The amount of input token to swap
|
|
30
|
-
* @param {number} slippage - The slippage tolerance to use for the route in percentage
|
|
31
|
-
* @returns {DefaultHookReturnType<GetZapTransactionResponse> & {tokens: BalanceToken[], refresh: () => void}}
|
|
32
|
-
*
|
|
33
|
-
* The zap transaction response data with polling enabled, see {@link GetZapTransactionResponse} and {@link BalanceToken}
|
|
34
|
-
* @remarks The hook is only enabled when all parameters are provided and amount is greater than 0
|
|
35
|
-
*/
|
|
36
|
-
export function useEnsoSwapBundle({
|
|
37
|
-
tokenIn,
|
|
38
|
-
tokenOut,
|
|
39
|
-
amount,
|
|
40
|
-
slippage,
|
|
41
|
-
}: {
|
|
42
|
-
tokenIn?: Pick<MinimalERC20, "address" | "decimals" | "chainId">;
|
|
43
|
-
tokenOut?: Pick<MinimalERC20, "address" | "decimals">;
|
|
44
|
-
amount?: string;
|
|
45
|
-
slippage?: number;
|
|
46
|
-
}) {
|
|
47
|
-
const { address: fromAddress } = useBeraWallet();
|
|
48
|
-
const wagmiConfig = useConfig();
|
|
49
|
-
const proxyAggregatorsThroughVercel = useBeraFlag(
|
|
50
|
-
"proxyAggregatorsThroughVercel",
|
|
51
|
-
);
|
|
52
|
-
const ensoClient = getEnsoClient({
|
|
53
|
-
baseURL: proxyAggregatorsThroughVercel ? "/api/enso" : undefined,
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
const { refresh: refreshBalances } = usePollWalletBalances();
|
|
57
|
-
|
|
58
|
-
const isEnabled =
|
|
59
|
-
!!tokenIn &&
|
|
60
|
-
!!tokenOut &&
|
|
61
|
-
!!amount &&
|
|
62
|
-
Number(amount) > 0 &&
|
|
63
|
-
!!slippage &&
|
|
64
|
-
!!fromAddress &&
|
|
65
|
-
!!tokenIn.chainId;
|
|
66
|
-
|
|
67
|
-
const QUERY_KEY = isEnabled
|
|
68
|
-
? ([
|
|
69
|
-
"useEnsoSwapBundle",
|
|
70
|
-
fromAddress,
|
|
71
|
-
tokenIn,
|
|
72
|
-
tokenOut,
|
|
73
|
-
amount,
|
|
74
|
-
slippage,
|
|
75
|
-
proxyAggregatorsThroughVercel ?? false,
|
|
76
|
-
] as const)
|
|
77
|
-
: null;
|
|
78
|
-
|
|
79
|
-
const swrResponse = useSWR(
|
|
80
|
-
QUERY_KEY,
|
|
81
|
-
async ([, fromAddress, tokenIn, tokenOut, amount, slippage]) => {
|
|
82
|
-
assertAddress(fromAddress, "fromAddress");
|
|
83
|
-
assertAddress(tokenIn?.address, "tokenInAddress");
|
|
84
|
-
assertDefined(tokenIn?.chainId, "tokenInChainId");
|
|
85
|
-
assertAddress(tokenOut?.address, "tokenOutAddress");
|
|
86
|
-
assertAmount(amount, "amount");
|
|
87
|
-
assertAmount(slippage, "slippage");
|
|
88
|
-
|
|
89
|
-
const publicClient = getPublicClient(wagmiConfig, {
|
|
90
|
-
chainId: tokenIn.chainId,
|
|
91
|
-
});
|
|
92
|
-
assertPublicClient(publicClient);
|
|
93
|
-
|
|
94
|
-
const rawAmount = parseUnits(amount, tokenIn.decimals).toString();
|
|
95
|
-
|
|
96
|
-
return getEnsoSwapBundle({
|
|
97
|
-
fromAddress,
|
|
98
|
-
amountIn: rawAmount,
|
|
99
|
-
tokenIn: tokenIn.address,
|
|
100
|
-
tokenOut: tokenOut.address,
|
|
101
|
-
chainId: tokenIn.chainId,
|
|
102
|
-
ensoClient,
|
|
103
|
-
destinationChainId: berachainChainId,
|
|
104
|
-
slippage,
|
|
105
|
-
publicClient,
|
|
106
|
-
});
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
refreshInterval: POLLING.NORMAL,
|
|
110
|
-
isEnabled: isEnabled,
|
|
111
|
-
},
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
return {
|
|
115
|
-
...swrResponse,
|
|
116
|
-
refresh: () => {
|
|
117
|
-
swrResponse.refresh();
|
|
118
|
-
refreshBalances();
|
|
119
|
-
},
|
|
120
|
-
};
|
|
121
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { usePublicClient } from "@berachain/wagmi/hooks";
|
|
2
|
-
import useSWR from "@berachain/utils/pkg/swr";
|
|
3
|
-
|
|
4
|
-
import { getBgtIncentiveDistributorPaused } from "../../actions/pol/getBgtIncentiveDistributorPaused";
|
|
5
|
-
import type {
|
|
6
|
-
DefaultHookOptions,
|
|
7
|
-
DefaultHookReturnType,
|
|
8
|
-
} from "../../types/global";
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Client hook around `getBgtIncentiveDistributorPaused`. When `paused()` is
|
|
12
|
-
* true, users can no longer self-claim incentives and the bot distributes them
|
|
13
|
-
* on their behalf. Fails closed (`false`) so a read error never blocks the UI.
|
|
14
|
-
*/
|
|
15
|
-
export function useBgtIncentiveDistributorPaused(
|
|
16
|
-
options?: DefaultHookOptions,
|
|
17
|
-
): DefaultHookReturnType<boolean> {
|
|
18
|
-
const publicClient = usePublicClient();
|
|
19
|
-
|
|
20
|
-
const QUERY_KEY = publicClient
|
|
21
|
-
? (["useBgtIncentiveDistributorPaused", publicClient.chain?.id] as const)
|
|
22
|
-
: null;
|
|
23
|
-
|
|
24
|
-
return useSWR(
|
|
25
|
-
QUERY_KEY,
|
|
26
|
-
async () =>
|
|
27
|
-
getBgtIncentiveDistributorPaused({ publicClient }).catch(() => false),
|
|
28
|
-
{
|
|
29
|
-
revalidateOnFocus: false,
|
|
30
|
-
revalidateOnReconnect: false,
|
|
31
|
-
...options,
|
|
32
|
-
},
|
|
33
|
-
);
|
|
34
|
-
}
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import { useCallback, useMemo } from "react";
|
|
2
|
-
|
|
3
|
-
import { useBeraWallet } from "@berachain/wagmi/hooks";
|
|
4
|
-
import { useSWR } from "@berachain/utils/pkg/swr";
|
|
5
|
-
|
|
6
|
-
import { getRewardProofsByValidator } from "../../actions/pol/getRewardProofsByValidator";
|
|
7
|
-
import { getUserClaimableIncentives } from "../../actions/pol/getUserClaimableIncentives";
|
|
8
|
-
import { POLLING } from "../../enum/polling";
|
|
9
|
-
import { BeraError } from "../../errors/BeraError";
|
|
10
|
-
import { BeraMonitoring } from "../../errors/BeraMonitoring";
|
|
11
|
-
import { InvalidArgumentError } from "../../errors/InvalidArgumentError";
|
|
12
|
-
import type { BribeBoostRewardProof } from "../../types/bribeBoost";
|
|
13
|
-
import type { DefaultHookReturnType } from "../../types/global";
|
|
14
|
-
import { formatIncentivesTokenMap } from "../../utils/formatIncentivesTokenMap";
|
|
15
|
-
|
|
16
|
-
interface UseUserClaimableIncentivesReturnType
|
|
17
|
-
extends DefaultHookReturnType<BribeBoostRewardProof[]> {
|
|
18
|
-
tokenMap?: Set<string> | undefined;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function useUserClaimableIncentives(): UseUserClaimableIncentivesReturnType {
|
|
22
|
-
const { address: account } = useBeraWallet();
|
|
23
|
-
|
|
24
|
-
const REWARDS_QUERY_KEY = account
|
|
25
|
-
? (["useUserClaimableIncentives", account] as const)
|
|
26
|
-
: null;
|
|
27
|
-
|
|
28
|
-
const allRewardsResponse = useSWR(
|
|
29
|
-
REWARDS_QUERY_KEY,
|
|
30
|
-
async ([, account]) => {
|
|
31
|
-
if (!account) {
|
|
32
|
-
throw new BeraError({
|
|
33
|
-
message: "useUserClaimableIncentives needs a logged in account",
|
|
34
|
-
level: "error",
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Get all reward tokens and all claimable validator associated with the account
|
|
39
|
-
return await getUserClaimableIncentives({
|
|
40
|
-
account,
|
|
41
|
-
});
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
revalidateOnFocus: false,
|
|
45
|
-
revalidateOnReconnect: false,
|
|
46
|
-
revalidateIfStale: false,
|
|
47
|
-
refreshInterval: POLLING.SLOW,
|
|
48
|
-
},
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
const allRewards = allRewardsResponse?.data;
|
|
52
|
-
const tokenMap = useMemo(() => {
|
|
53
|
-
// Return empty set if no incentives data or still loading
|
|
54
|
-
if (!allRewards) {
|
|
55
|
-
return undefined;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// If the data is not an array, capture an error
|
|
59
|
-
if (!Array.isArray(allRewards)) {
|
|
60
|
-
BeraMonitoring.captureException(
|
|
61
|
-
new BeraError({
|
|
62
|
-
message: "Incorrect aggregated incentives data receieved.",
|
|
63
|
-
level: "error",
|
|
64
|
-
extra: {
|
|
65
|
-
allRewards,
|
|
66
|
-
account: account,
|
|
67
|
-
},
|
|
68
|
-
}),
|
|
69
|
-
);
|
|
70
|
-
return undefined;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return formatIncentivesTokenMap(allRewards);
|
|
74
|
-
}, [allRewards, account]);
|
|
75
|
-
|
|
76
|
-
const QUERY_KEY =
|
|
77
|
-
account && allRewards
|
|
78
|
-
? (["useUserClaimableIncentives", account, allRewards] as const)
|
|
79
|
-
: null;
|
|
80
|
-
|
|
81
|
-
const swrResponse = useSWR(
|
|
82
|
-
QUERY_KEY,
|
|
83
|
-
async ([, account, allRewards]) => {
|
|
84
|
-
if (!account) {
|
|
85
|
-
throw new InvalidArgumentError({
|
|
86
|
-
property: "account",
|
|
87
|
-
value: account,
|
|
88
|
-
expected: "Address",
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Return empty set if no incentives data or still loading
|
|
93
|
-
if (!allRewards) {
|
|
94
|
-
return [];
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (!Array.isArray(allRewards)) {
|
|
98
|
-
// If the data is unexpected, throw an error
|
|
99
|
-
throw new InvalidArgumentError({
|
|
100
|
-
message:
|
|
101
|
-
"Incorrect aggregated incentives data receieved to calculate proofs.",
|
|
102
|
-
property: "allRewards",
|
|
103
|
-
value: allRewards,
|
|
104
|
-
expected: "Array",
|
|
105
|
-
level: "error",
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
const validatorsSet = new Set(allRewards.map((item) => item.validator));
|
|
110
|
-
const validatorAddresses = Array.from(validatorsSet);
|
|
111
|
-
|
|
112
|
-
// Get total count of rewards for each validator in increments of MAX_PROOFS_SIZE_PER_INCENTIVE_CLAIM
|
|
113
|
-
return await Promise.all(
|
|
114
|
-
validatorAddresses.map(async (validator) => {
|
|
115
|
-
const proofsData = await getRewardProofsByValidator({
|
|
116
|
-
account: account,
|
|
117
|
-
validator: validator as `0x${string}`,
|
|
118
|
-
page: 1,
|
|
119
|
-
perPage: 10_000,
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
return {
|
|
123
|
-
...proofsData,
|
|
124
|
-
validator: validator,
|
|
125
|
-
};
|
|
126
|
-
}),
|
|
127
|
-
);
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
revalidateOnFocus: false,
|
|
131
|
-
revalidateOnReconnect: false,
|
|
132
|
-
revalidateIfStale: false,
|
|
133
|
-
refreshInterval: POLLING.SLOW,
|
|
134
|
-
},
|
|
135
|
-
);
|
|
136
|
-
|
|
137
|
-
const refresh = useCallback(() => {
|
|
138
|
-
allRewardsResponse?.refresh();
|
|
139
|
-
swrResponse?.refresh();
|
|
140
|
-
}, [allRewardsResponse, swrResponse]);
|
|
141
|
-
|
|
142
|
-
return {
|
|
143
|
-
...swrResponse,
|
|
144
|
-
isLoading: allRewardsResponse?.isLoading || swrResponse?.isLoading,
|
|
145
|
-
tokenMap,
|
|
146
|
-
refresh,
|
|
147
|
-
};
|
|
148
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { Address } from "viem";
|
|
2
|
-
|
|
3
|
-
import type { GetValidatorAnalyticsQuery } from "@berachain/graphql/pol/subgraph";
|
|
4
|
-
import { useSWR } from "@berachain/utils/pkg/swr";
|
|
5
|
-
|
|
6
|
-
import { getValidatorAnalytics } from "../../actions/validators/getValidatorAnalytics";
|
|
7
|
-
import { POLLING } from "../../enum/polling";
|
|
8
|
-
import type { DefaultHookReturnType } from "../../types/global";
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @deprecated will be removed in pol vNext
|
|
12
|
-
*/
|
|
13
|
-
export function useValidatorAnalytics({
|
|
14
|
-
pubkey,
|
|
15
|
-
dayRange,
|
|
16
|
-
}: {
|
|
17
|
-
pubkey: Address | undefined;
|
|
18
|
-
dayRange: number;
|
|
19
|
-
}): DefaultHookReturnType<GetValidatorAnalyticsQuery> {
|
|
20
|
-
const QUERY_KEY =
|
|
21
|
-
pubkey && dayRange
|
|
22
|
-
? (["useValidatorAnalytics", pubkey, dayRange] as const)
|
|
23
|
-
: null;
|
|
24
|
-
|
|
25
|
-
return useSWR(
|
|
26
|
-
QUERY_KEY,
|
|
27
|
-
async ([, pubkey, dayRange]) => {
|
|
28
|
-
return await getValidatorAnalytics({
|
|
29
|
-
pubkey: pubkey,
|
|
30
|
-
dayRange,
|
|
31
|
-
});
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
refreshInterval: POLLING.SLOW,
|
|
35
|
-
},
|
|
36
|
-
);
|
|
37
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { BribeBoostRewardItem } from "../types/bribeBoost";
|
|
2
|
-
|
|
3
|
-
export function formatIncentivesTokenMap(
|
|
4
|
-
allRewards: BribeBoostRewardItem[],
|
|
5
|
-
): Set<string> {
|
|
6
|
-
const tokenMap = new Set<string>();
|
|
7
|
-
|
|
8
|
-
for (const item of allRewards) {
|
|
9
|
-
if (Array.isArray(item.rewards)) {
|
|
10
|
-
for (const reward of item.rewards) {
|
|
11
|
-
if (reward.token) {
|
|
12
|
-
tokenMap.add(reward.token);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return tokenMap;
|
|
19
|
-
}
|