@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,25 +1,28 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getApolloClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BZKA6DBM.mjs";
|
|
4
4
|
import {
|
|
5
5
|
fetchBeep
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-7OESHTBN.mjs";
|
|
7
7
|
import {
|
|
8
8
|
pythAbi
|
|
9
9
|
} from "./chunk-GWSTVITN.mjs";
|
|
10
|
+
import {
|
|
11
|
+
getEnsoClient
|
|
12
|
+
} from "./chunk-ZHV3MQ4F.mjs";
|
|
10
13
|
import {
|
|
11
14
|
NotFoundError,
|
|
12
15
|
TransactionFailedError
|
|
13
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-M3MIGSH3.mjs";
|
|
14
17
|
import {
|
|
15
18
|
BeraMonitoring,
|
|
16
19
|
initBeraError
|
|
17
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-FWRYUIJK.mjs";
|
|
18
21
|
import {
|
|
19
22
|
assertAddress,
|
|
20
23
|
assertDefined,
|
|
21
24
|
assertPublicClient
|
|
22
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-TXWDUJOY.mjs";
|
|
23
26
|
import {
|
|
24
27
|
CAP_LIMIT_BUFFER,
|
|
25
28
|
DEFAULT_METAMASK_GAS_LIMIT,
|
|
@@ -34,27 +37,26 @@ import {
|
|
|
34
37
|
} from "./chunk-35RACQD4.mjs";
|
|
35
38
|
import {
|
|
36
39
|
beraFetch,
|
|
37
|
-
beraFetchJson
|
|
38
|
-
|
|
39
|
-
} from "./chunk-ZWTGVIPJ.mjs";
|
|
40
|
+
beraFetchJson
|
|
41
|
+
} from "./chunk-4576RF2K.mjs";
|
|
40
42
|
import {
|
|
41
43
|
beraToken,
|
|
42
44
|
getHoneyToken,
|
|
43
45
|
isToken
|
|
44
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-HPRLNT6R.mjs";
|
|
45
47
|
import {
|
|
46
48
|
parseBaseArgs
|
|
47
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-SC3BSCTN.mjs";
|
|
48
50
|
import {
|
|
49
51
|
RequestError
|
|
50
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-LL7XR2H5.mjs";
|
|
51
53
|
import {
|
|
52
54
|
BeraError,
|
|
53
55
|
InvalidArgumentError,
|
|
54
56
|
commonAbiErrors,
|
|
55
57
|
parseDecodedError,
|
|
56
58
|
parseViemError
|
|
57
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-MVNQY2D4.mjs";
|
|
58
60
|
|
|
59
61
|
// src/actions/bend/getConvertToAssets.ts
|
|
60
62
|
import { formatEther } from "viem";
|
|
@@ -79,6 +81,26 @@ var BaseAggregator = class _BaseAggregator {
|
|
|
79
81
|
static PATH_NOT_FOUND_REASON = RequestError.REASON_MAP.NO_SWAP_PATHS;
|
|
80
82
|
needsAccountForQuote = false;
|
|
81
83
|
notFoundMessages = [];
|
|
84
|
+
/**
|
|
85
|
+
* Whether this aggregator can handle a BERA↔WBERA pair.
|
|
86
|
+
*
|
|
87
|
+
* Most aggregators normalize native BERA → WBERA before routing (see
|
|
88
|
+
* `parseAddresses`), so a BERA↔WBERA pair collapses to WBERA↔WBERA and the
|
|
89
|
+
* external router rejects it as "same token" (e.g. Enso 400, HUB-9FQ). For
|
|
90
|
+
* those, `getUnsupportedReason` rejects the pair up-front so no request fires.
|
|
91
|
+
* Only the dedicated wrap/unwrap aggregator sets this `true`.
|
|
92
|
+
*/
|
|
93
|
+
supportsBeraWrap = false;
|
|
94
|
+
/**
|
|
95
|
+
* Whether this aggregator can bridge — route a pair whose tokens live on
|
|
96
|
+
* different chains (`tokenIn.chainId !== tokenOut.chainId`).
|
|
97
|
+
*
|
|
98
|
+
* Most aggregators only route within a single chain; handed a cross-chain
|
|
99
|
+
* pair they would 400 or, worse, quote garbage against the wrong chain.
|
|
100
|
+
* `getUnsupportedReason` rejects such pairs up-front unless this is `true`.
|
|
101
|
+
* Only bridging aggregators (Enso via LayerZero) set it.
|
|
102
|
+
*/
|
|
103
|
+
supportsBridging = false;
|
|
82
104
|
config;
|
|
83
105
|
chainId;
|
|
84
106
|
constructor(args = {}) {
|
|
@@ -174,27 +196,50 @@ var BaseAggregator = class _BaseAggregator {
|
|
|
174
196
|
];
|
|
175
197
|
}
|
|
176
198
|
/**
|
|
177
|
-
*
|
|
199
|
+
* Returns a human-readable reason this aggregator can't route the pair, or
|
|
200
|
+
* `null` if it can. Callers gate on `=== null`; `assertChainSupport` throws
|
|
201
|
+
* the reason so users get an accurate message (not a misleading "does not
|
|
202
|
+
* support chain ID" for what is actually a same-token pair).
|
|
178
203
|
*/
|
|
179
|
-
|
|
204
|
+
getUnsupportedReason({
|
|
180
205
|
tokenIn,
|
|
181
206
|
tokenOut
|
|
182
207
|
}) {
|
|
183
|
-
if (
|
|
184
|
-
return
|
|
208
|
+
if (isToken(tokenIn, tokenOut)) {
|
|
209
|
+
return `${this.name} cannot route between the same token (${tokenIn.symbol}).`;
|
|
185
210
|
}
|
|
186
|
-
|
|
211
|
+
if (!this.supportsBeraWrap) {
|
|
212
|
+
let normalize2 = function(token) {
|
|
213
|
+
return (isToken(token, "BERA") ? wbera : token.address).toLowerCase();
|
|
214
|
+
};
|
|
215
|
+
var normalize = normalize2;
|
|
216
|
+
const wbera = this.config.tokens.wbera;
|
|
217
|
+
if (normalize2(tokenIn) === normalize2(tokenOut)) {
|
|
218
|
+
return `${this.name} cannot route between BERA and WBERA \u2014 use wrap/unwrap instead.`;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
if (tokenIn.chainId !== tokenOut.chainId && !this.supportsBridging) {
|
|
222
|
+
return `${this.name} cannot route across chains (${tokenIn.chainId} \u2192 ${tokenOut.chainId}).`;
|
|
223
|
+
}
|
|
224
|
+
if (this.supportedChains !== null && (!this.supportedChains.includes(tokenIn.chainId) || !this.supportedChains.includes(tokenOut.chainId))) {
|
|
225
|
+
return `${this.name} does not support tokens chain ID: ${tokenIn.chainId} and ${tokenOut.chainId}`;
|
|
226
|
+
}
|
|
227
|
+
return null;
|
|
187
228
|
}
|
|
188
229
|
assertChainSupport({
|
|
189
230
|
tokenIn,
|
|
190
231
|
tokenOut,
|
|
191
|
-
underlyingToken
|
|
232
|
+
underlyingToken,
|
|
233
|
+
honeyNativeState
|
|
192
234
|
}) {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
235
|
+
const reason = this.getUnsupportedReason({
|
|
236
|
+
tokenIn,
|
|
237
|
+
tokenOut,
|
|
238
|
+
underlyingToken,
|
|
239
|
+
honeyNativeState
|
|
240
|
+
});
|
|
241
|
+
if (reason !== null) {
|
|
242
|
+
throw new BeraError({ message: reason, level: "error" });
|
|
198
243
|
}
|
|
199
244
|
}
|
|
200
245
|
async fetch(url, options) {
|
|
@@ -220,6 +265,157 @@ var BaseAggregator = class _BaseAggregator {
|
|
|
220
265
|
}
|
|
221
266
|
};
|
|
222
267
|
|
|
268
|
+
// src/actions/dex/aggregators/enso/ensoErc4626.ts
|
|
269
|
+
import { ethAddress, zeroAddress as zeroAddress2 } from "viem";
|
|
270
|
+
var EnsoErc4626Aggregator = class extends BaseAggregator {
|
|
271
|
+
name = "Enso (Mint)" /* EnsoErc4626 */;
|
|
272
|
+
supportedChains = null;
|
|
273
|
+
supportsBridging = true;
|
|
274
|
+
type = "rest";
|
|
275
|
+
needsAccountForQuote = true;
|
|
276
|
+
notFoundMessages = [
|
|
277
|
+
"Could not build shortcuts for route",
|
|
278
|
+
"Could not quote shortcuts for route",
|
|
279
|
+
"Swap not found for a required underlying of defi route,",
|
|
280
|
+
"No route found from"
|
|
281
|
+
];
|
|
282
|
+
async getQuote({
|
|
283
|
+
tokenIn,
|
|
284
|
+
tokenOut,
|
|
285
|
+
amount,
|
|
286
|
+
slippage,
|
|
287
|
+
account = zeroAddress2,
|
|
288
|
+
aggregatorsFeeBps,
|
|
289
|
+
proxyAggregatorsThroughVercel = false,
|
|
290
|
+
rewardVault,
|
|
291
|
+
underlyingToken
|
|
292
|
+
}) {
|
|
293
|
+
this.assertChainSupport({ tokenIn, tokenOut });
|
|
294
|
+
assertAddress(account, "account");
|
|
295
|
+
const ensoClient = getEnsoClient({
|
|
296
|
+
baseURL: proxyAggregatorsThroughVercel ? "/api/enso" : void 0
|
|
297
|
+
});
|
|
298
|
+
if (tokenIn.address === zeroAddress2) tokenIn.address = ethAddress;
|
|
299
|
+
if (tokenOut.address === zeroAddress2) tokenOut.address = ethAddress;
|
|
300
|
+
const zapTokenOut = underlyingToken ?? tokenOut;
|
|
301
|
+
const isCrossChain = tokenIn.chainId !== zapTokenOut.chainId;
|
|
302
|
+
const bundleActions = [
|
|
303
|
+
// this is the base route action, which will swap the token in to the zap token out
|
|
304
|
+
// it handles cross-chain swaps and refunds the user if the swap fails
|
|
305
|
+
// this might even be the only action if no underlying token or reward vault is provided
|
|
306
|
+
{
|
|
307
|
+
protocol: "enso",
|
|
308
|
+
action: "route",
|
|
309
|
+
args: {
|
|
310
|
+
tokenIn: tokenIn.address,
|
|
311
|
+
tokenOut: zapTokenOut.address,
|
|
312
|
+
// must be undefined if the token is the same chain
|
|
313
|
+
destinationChainId: isCrossChain ? zapTokenOut.chainId : void 0,
|
|
314
|
+
refundReceiver: account,
|
|
315
|
+
receiver: account,
|
|
316
|
+
amountIn: amount,
|
|
317
|
+
slippage: slippage * 100,
|
|
318
|
+
// Enso expects slippage in basis points
|
|
319
|
+
// We can't track CCIP delivery status (no poller in crossChainBridge),
|
|
320
|
+
// so keep Enso from routing cross-chain zaps through it.
|
|
321
|
+
ignoreBridges: isCrossChain ? ["ccip"] : void 0
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
];
|
|
325
|
+
if (underlyingToken) {
|
|
326
|
+
bundleActions.push({
|
|
327
|
+
protocol: "erc4626",
|
|
328
|
+
action: "deposit",
|
|
329
|
+
args: {
|
|
330
|
+
amountIn: { useOutputOfCallAt: 0 },
|
|
331
|
+
tokenIn: underlyingToken.address,
|
|
332
|
+
primaryAddress: tokenOut.address,
|
|
333
|
+
tokenOut: tokenOut.address
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
if (rewardVault) {
|
|
338
|
+
const offset = bundleActions.length;
|
|
339
|
+
bundleActions.push(
|
|
340
|
+
{
|
|
341
|
+
protocol: "enso",
|
|
342
|
+
action: "balance",
|
|
343
|
+
args: {
|
|
344
|
+
token: tokenOut.address
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
protocol: "erc20",
|
|
349
|
+
action: "approve",
|
|
350
|
+
args: {
|
|
351
|
+
amount: { useOutputOfCallAt: offset },
|
|
352
|
+
spender: rewardVault,
|
|
353
|
+
token: tokenOut.address
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
protocol: "enso",
|
|
358
|
+
action: "call",
|
|
359
|
+
args: {
|
|
360
|
+
address: rewardVault,
|
|
361
|
+
args: [account, { useOutputOfCallAt: offset }],
|
|
362
|
+
method: "stakeOnBehalf",
|
|
363
|
+
abi: "function stakeOnBehalf(address account, uint256 amount) external"
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
protocol: "enso",
|
|
368
|
+
action: "balance",
|
|
369
|
+
args: {
|
|
370
|
+
token: rewardVault
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
);
|
|
374
|
+
}
|
|
375
|
+
const bundle = await ensoClient.getBundleData(
|
|
376
|
+
{
|
|
377
|
+
fromAddress: account,
|
|
378
|
+
receiver: account,
|
|
379
|
+
spender: account,
|
|
380
|
+
chainId: tokenIn.chainId,
|
|
381
|
+
routingStrategy: "router"
|
|
382
|
+
},
|
|
383
|
+
bundleActions
|
|
384
|
+
);
|
|
385
|
+
const bridgeProtocol = bundle.route?.find(
|
|
386
|
+
(hop) => hop.action === "bridge"
|
|
387
|
+
)?.protocol;
|
|
388
|
+
const tokenOutAddress = rewardVault?.toLowerCase() ?? tokenOut.address.toLowerCase();
|
|
389
|
+
const amountOut = String(
|
|
390
|
+
bundle.minAmountsOut?.[tokenOutAddress] ?? bundle.amountsOut?.[tokenOutAddress] ?? "0"
|
|
391
|
+
);
|
|
392
|
+
return {
|
|
393
|
+
amountOut,
|
|
394
|
+
amountIn: amount,
|
|
395
|
+
allowanceRequirements: this.parseAllowanceRequirements({
|
|
396
|
+
tokenIn,
|
|
397
|
+
rawAmount: amount,
|
|
398
|
+
spender: bundle.tx.to
|
|
399
|
+
}),
|
|
400
|
+
name: this.name,
|
|
401
|
+
swapFeeBps: 0,
|
|
402
|
+
isCrossChain,
|
|
403
|
+
srcChainId: tokenIn.chainId,
|
|
404
|
+
bridgeProtocol,
|
|
405
|
+
priceImpactPercentage: bundle.priceImpact ? bundle.priceImpact / 100 : null,
|
|
406
|
+
getCalldata: () => ({
|
|
407
|
+
address: bundle.tx.to,
|
|
408
|
+
data: bundle.tx.data,
|
|
409
|
+
value: BigInt(bundle.tx.value ?? 0),
|
|
410
|
+
extraTags: { aggregator: this.name }
|
|
411
|
+
// not returning gas limit because it's usually underestimated by enso.
|
|
412
|
+
// gasLimit: BigInt(bundle.gas),
|
|
413
|
+
})
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
};
|
|
417
|
+
var ensoErc4626 = new EnsoErc4626Aggregator();
|
|
418
|
+
|
|
223
419
|
// src/actions/dex/bSdk.ts
|
|
224
420
|
import {
|
|
225
421
|
API_CHAIN_NAMES,
|
|
@@ -233,7 +429,7 @@ import {
|
|
|
233
429
|
VAULT,
|
|
234
430
|
WEIGHTED_POOL_FACTORY_BALANCER_V2
|
|
235
431
|
} from "@berachain-foundation/berancer-sdk";
|
|
236
|
-
import { zeroAddress as
|
|
432
|
+
import { zeroAddress as zeroAddress3 } from "viem";
|
|
237
433
|
import { berachain, berachainBepolia } from "viem/chains";
|
|
238
434
|
import { chainConfigs } from "@berachain/config/internal";
|
|
239
435
|
for (const chain of Object.keys(chainConfigs)) {
|
|
@@ -245,11 +441,11 @@ for (const chain of Object.keys(chainConfigs)) {
|
|
|
245
441
|
BALANCER_RELAYER[chainId] = config.bex.relayer;
|
|
246
442
|
VAULT[chainId] = config.bex.vault;
|
|
247
443
|
BALANCER_QUERIES[chainId] = config.bex.queries;
|
|
248
|
-
WEIGHTED_POOL_FACTORY_BALANCER_V2[chainId] =
|
|
249
|
-
COMPOSABLE_STABLE_POOL_FACTORY[chainId] =
|
|
444
|
+
WEIGHTED_POOL_FACTORY_BALANCER_V2[chainId] = zeroAddress3;
|
|
445
|
+
COMPOSABLE_STABLE_POOL_FACTORY[chainId] = zeroAddress3;
|
|
250
446
|
const nativeToken = new Token(
|
|
251
447
|
chainId,
|
|
252
|
-
|
|
448
|
+
zeroAddress3,
|
|
253
449
|
beraToken.decimals,
|
|
254
450
|
beraToken.name,
|
|
255
451
|
beraToken.symbol,
|
|
@@ -919,12 +1115,6 @@ async function getWeights({
|
|
|
919
1115
|
|
|
920
1116
|
// src/actions/honey/getHoney24hVolume.ts
|
|
921
1117
|
async function getHoney24hVolume() {
|
|
922
|
-
if (typeof window === "undefined") {
|
|
923
|
-
throw new BeraError({
|
|
924
|
-
message: "getHoney24hVolume is browser-only; call from a Client Component / SWR hook",
|
|
925
|
-
level: "error"
|
|
926
|
-
});
|
|
927
|
-
}
|
|
928
1118
|
const snapshots = await fetchBeep("/v0/honey/snapshots/{interval}", {
|
|
929
1119
|
path: { interval: "hour" },
|
|
930
1120
|
query: { perPage: "24" }
|
|
@@ -1550,21 +1740,6 @@ function getBgtAprSimulation({
|
|
|
1550
1740
|
};
|
|
1551
1741
|
}
|
|
1552
1742
|
|
|
1553
|
-
// src/actions/pol/getBgtIncentiveDistributorPaused.ts
|
|
1554
|
-
import { bgtIncentiveDistributorAbi } from "@berachain/abis/pol/rewards/bgtIncentiveDistributor";
|
|
1555
|
-
async function getBgtIncentiveDistributorPaused({
|
|
1556
|
-
publicClient,
|
|
1557
|
-
...args
|
|
1558
|
-
}) {
|
|
1559
|
-
assertPublicClient(publicClient);
|
|
1560
|
-
const { config } = parseBaseArgs(args);
|
|
1561
|
-
return publicClient.readContract({
|
|
1562
|
-
address: config.pol.bgtIncentiveDistributor,
|
|
1563
|
-
abi: bgtIncentiveDistributorAbi,
|
|
1564
|
-
functionName: "paused"
|
|
1565
|
-
});
|
|
1566
|
-
}
|
|
1567
|
-
|
|
1568
1743
|
// src/actions/pol/getEarnedStakedBeraVault.ts
|
|
1569
1744
|
async function getEarnedStakedBeraVault({
|
|
1570
1745
|
address,
|
|
@@ -1702,38 +1877,6 @@ async function getMarkets(args = {}) {
|
|
|
1702
1877
|
}
|
|
1703
1878
|
}
|
|
1704
1879
|
|
|
1705
|
-
// src/actions/pol/getRewardProofsByValidator.ts
|
|
1706
|
-
async function getRewardProofsByValidator({
|
|
1707
|
-
account,
|
|
1708
|
-
validator,
|
|
1709
|
-
page = 1,
|
|
1710
|
-
perPage = 1e3,
|
|
1711
|
-
...args
|
|
1712
|
-
}) {
|
|
1713
|
-
const { config } = parseBaseArgs(args);
|
|
1714
|
-
const result = await fetch(
|
|
1715
|
-
`${config.pol.bribeBoostApi}/api/v1/wallets/${account.toLowerCase()}/proofs/validator/${validator.toLowerCase()}?page=${page}&per_page=${perPage}`,
|
|
1716
|
-
{
|
|
1717
|
-
cache: "no-store"
|
|
1718
|
-
}
|
|
1719
|
-
);
|
|
1720
|
-
if (!result.ok) {
|
|
1721
|
-
const error = await getErrorResponse(result);
|
|
1722
|
-
throw new BeraError({
|
|
1723
|
-
message: "Failed to fetch proofs on server",
|
|
1724
|
-
cause: {
|
|
1725
|
-
error,
|
|
1726
|
-
result,
|
|
1727
|
-
account,
|
|
1728
|
-
validator
|
|
1729
|
-
},
|
|
1730
|
-
reason: error?.reason
|
|
1731
|
-
});
|
|
1732
|
-
}
|
|
1733
|
-
const data = await result.json();
|
|
1734
|
-
return data;
|
|
1735
|
-
}
|
|
1736
|
-
|
|
1737
1880
|
// src/actions/pol/getRewardTokenToBeraRate.ts
|
|
1738
1881
|
import { formatUnits as formatUnits6, parseUnits as parseUnits5 } from "viem";
|
|
1739
1882
|
import { wberaStakerVaultAbi as stakeBeraVaultAbi } from "@berachain/abis/pol/wberaStakerVault";
|
|
@@ -1988,64 +2131,44 @@ async function getRewardVaults({
|
|
|
1988
2131
|
};
|
|
1989
2132
|
}
|
|
1990
2133
|
|
|
1991
|
-
// src/actions/pol/
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
2134
|
+
// src/actions/pol/getStakedBeraAPY.ts
|
|
2135
|
+
function getBeepResolutionEnum(window2) {
|
|
2136
|
+
switch (window2) {
|
|
2137
|
+
case "18HOURS":
|
|
2138
|
+
return "EIGHTEEN_HOURS";
|
|
2139
|
+
case "12HOURS":
|
|
2140
|
+
return "TWELVE_HOURS";
|
|
2141
|
+
case "6HOURS":
|
|
2142
|
+
return "SIX_HOURS";
|
|
2143
|
+
case "DAY":
|
|
2144
|
+
return "ONE_DAY";
|
|
2145
|
+
case "WEEK":
|
|
2146
|
+
return "SEVEN_DAYS";
|
|
1999
2147
|
}
|
|
2000
|
-
return GqlSWberaVaultMetadataResolution.SevenDays;
|
|
2001
2148
|
}
|
|
2002
|
-
async function
|
|
2003
|
-
window: window2
|
|
2004
|
-
...args
|
|
2149
|
+
async function getStakedBeraAPY({
|
|
2150
|
+
window: window2
|
|
2005
2151
|
}) {
|
|
2006
|
-
const {
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
chain: config.bex.chainName,
|
|
2013
|
-
resolution: getResolution(window2 ?? "DAY")
|
|
2014
|
-
}
|
|
2015
|
-
});
|
|
2016
|
-
const { apr } = data.data.polGetSWberaVaultMetadata;
|
|
2017
|
-
return Number(apr);
|
|
2018
|
-
} catch (error) {
|
|
2019
|
-
console.error("Failed to get SW Bera APR", error);
|
|
2020
|
-
throw error;
|
|
2021
|
-
}
|
|
2152
|
+
const { apy } = await fetchBeep("/v0/stake/apr", {
|
|
2153
|
+
query: {
|
|
2154
|
+
interval: getBeepResolutionEnum(window2)
|
|
2155
|
+
}
|
|
2156
|
+
});
|
|
2157
|
+
return apy === null ? 0 : Number(apy);
|
|
2022
2158
|
}
|
|
2023
2159
|
|
|
2024
2160
|
// src/actions/pol/getStakedBeraSnapshots.ts
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2161
|
+
var StakeSnapshotRange = /* @__PURE__ */ ((StakeSnapshotRange2) => {
|
|
2162
|
+
StakeSnapshotRange2["SevenDays"] = "7";
|
|
2163
|
+
StakeSnapshotRange2["ThirtyDays"] = "30";
|
|
2164
|
+
StakeSnapshotRange2["SixtyDays"] = "60";
|
|
2165
|
+
StakeSnapshotRange2["NinetyDays"] = "90";
|
|
2166
|
+
return StakeSnapshotRange2;
|
|
2167
|
+
})(StakeSnapshotRange || {});
|
|
2029
2168
|
async function getStakedBeraSnapshots({
|
|
2030
|
-
|
|
2031
|
-
range = GqlVaultSnapshotDataRange.ThirtyDays,
|
|
2032
|
-
...args
|
|
2169
|
+
range = "30" /* ThirtyDays */
|
|
2033
2170
|
} = {}) {
|
|
2034
|
-
|
|
2035
|
-
const bexApiGraphqlClient = getApolloClient("api", args);
|
|
2036
|
-
try {
|
|
2037
|
-
const data = await bexApiGraphqlClient.query({
|
|
2038
|
-
query: GetSWberaVaultSnapshots,
|
|
2039
|
-
variables: {
|
|
2040
|
-
chain: chain ?? config.bex.chainName,
|
|
2041
|
-
range
|
|
2042
|
-
}
|
|
2043
|
-
});
|
|
2044
|
-
return data.data.polGetSWberaVaultSnapshots;
|
|
2045
|
-
} catch (error) {
|
|
2046
|
-
console.error("Failed to get SW Bera Snapshots", error);
|
|
2047
|
-
throw error;
|
|
2048
|
-
}
|
|
2171
|
+
return await fetchBeep("/v0/stake/apr/history", { query: { days: range } });
|
|
2049
2172
|
}
|
|
2050
2173
|
|
|
2051
2174
|
// src/actions/pol/getStakeWithdrawalCooldown.ts
|
|
@@ -2063,109 +2186,29 @@ async function getStakeWithdrawalCooldown({
|
|
|
2063
2186
|
}
|
|
2064
2187
|
|
|
2065
2188
|
// src/actions/pol/getSWBeraVaultMetadata.ts
|
|
2066
|
-
import {
|
|
2189
|
+
import { erc4626Abi } from "viem";
|
|
2067
2190
|
async function getSWBeraVaultMetadata({
|
|
2068
2191
|
address,
|
|
2069
|
-
|
|
2070
|
-
publicClient,
|
|
2071
|
-
blockTime
|
|
2192
|
+
publicClient
|
|
2072
2193
|
}) {
|
|
2073
2194
|
assertPublicClient(publicClient);
|
|
2074
|
-
const hoursWindow = 26;
|
|
2075
2195
|
try {
|
|
2076
|
-
const
|
|
2077
|
-
const blocksPerWindow = Math.floor(hoursWindow * 60 * 60 / blockTime);
|
|
2078
|
-
const blockWindowAgo = currentBlock.number - BigInt(blocksPerWindow);
|
|
2079
|
-
const [
|
|
2080
|
-
curretTotalAssets,
|
|
2081
|
-
currentTotalSupply,
|
|
2082
|
-
currentOneShareWorth,
|
|
2083
|
-
currentTVL,
|
|
2084
|
-
totalAssets24HoursAgo,
|
|
2085
|
-
totalSupply24HoursAgo,
|
|
2086
|
-
oneShareWorthWindowAgo,
|
|
2087
|
-
tvl24HoursAgo,
|
|
2088
|
-
underlyingTotalSupply,
|
|
2089
|
-
lockPeriod
|
|
2090
|
-
] = await Promise.all([
|
|
2196
|
+
const [curretTotalAssets, lockPeriod] = await Promise.all([
|
|
2091
2197
|
publicClient.readContract({
|
|
2092
2198
|
address,
|
|
2093
2199
|
abi: erc4626Abi,
|
|
2094
2200
|
functionName: "totalAssets"
|
|
2095
2201
|
}),
|
|
2096
|
-
publicClient.readContract({
|
|
2097
|
-
address,
|
|
2098
|
-
abi: erc4626Abi,
|
|
2099
|
-
functionName: "totalSupply"
|
|
2100
|
-
}),
|
|
2101
|
-
publicClient.readContract({
|
|
2102
|
-
address,
|
|
2103
|
-
abi: erc4626Abi,
|
|
2104
|
-
functionName: "previewRedeem",
|
|
2105
|
-
args: [10n ** 18n],
|
|
2106
|
-
blockNumber: currentBlock.number
|
|
2107
|
-
}),
|
|
2108
|
-
publicClient.readContract({
|
|
2109
|
-
address: underlyingAsset,
|
|
2110
|
-
abi: erc20Abi5,
|
|
2111
|
-
functionName: "balanceOf",
|
|
2112
|
-
args: [address]
|
|
2113
|
-
}),
|
|
2114
|
-
publicClient.readContract({
|
|
2115
|
-
address,
|
|
2116
|
-
abi: erc4626Abi,
|
|
2117
|
-
functionName: "totalAssets",
|
|
2118
|
-
blockNumber: blockWindowAgo
|
|
2119
|
-
}),
|
|
2120
|
-
publicClient.readContract({
|
|
2121
|
-
address,
|
|
2122
|
-
abi: erc20Abi5,
|
|
2123
|
-
functionName: "totalSupply",
|
|
2124
|
-
blockNumber: blockWindowAgo
|
|
2125
|
-
}),
|
|
2126
|
-
publicClient.readContract({
|
|
2127
|
-
address,
|
|
2128
|
-
abi: erc4626Abi,
|
|
2129
|
-
functionName: "previewRedeem",
|
|
2130
|
-
args: [10n ** 18n],
|
|
2131
|
-
blockNumber: blockWindowAgo
|
|
2132
|
-
}),
|
|
2133
|
-
publicClient.readContract({
|
|
2134
|
-
address: underlyingAsset,
|
|
2135
|
-
abi: erc20Abi5,
|
|
2136
|
-
functionName: "balanceOf",
|
|
2137
|
-
args: [address],
|
|
2138
|
-
blockNumber: blockWindowAgo
|
|
2139
|
-
}),
|
|
2140
|
-
publicClient.readContract({
|
|
2141
|
-
address: underlyingAsset,
|
|
2142
|
-
abi: erc20Abi5,
|
|
2143
|
-
functionName: "totalSupply"
|
|
2144
|
-
}),
|
|
2145
2202
|
getStakeWithdrawalCooldown({
|
|
2146
2203
|
publicClient,
|
|
2147
2204
|
address
|
|
2148
2205
|
})
|
|
2149
2206
|
]);
|
|
2150
|
-
const exchangeRateWindowAgo = new bignumber_js_default(
|
|
2151
|
-
oneShareWorthWindowAgo.toString()
|
|
2152
|
-
);
|
|
2153
|
-
const currentExchangeRate = new bignumber_js_default(currentOneShareWorth.toString());
|
|
2154
2207
|
return {
|
|
2155
2208
|
address,
|
|
2156
2209
|
current: {
|
|
2157
|
-
|
|
2158
|
-
totalSupply: new bignumber_js_default(currentTotalSupply.toString()).dividedBy(1e18).toString(),
|
|
2159
|
-
totalAssets: new bignumber_js_default(curretTotalAssets.toString()).dividedBy(1e18).toString(),
|
|
2160
|
-
tvl: new bignumber_js_default(currentTVL.toString()).dividedBy(1e18).toString()
|
|
2210
|
+
totalAssets: new bignumber_js_default(curretTotalAssets.toString()).dividedBy(1e18).toString()
|
|
2161
2211
|
},
|
|
2162
|
-
previous: {
|
|
2163
|
-
exchangeRate: exchangeRateWindowAgo.toString(),
|
|
2164
|
-
totalSupply: new bignumber_js_default(totalSupply24HoursAgo.toString()).dividedBy(1e18).toString(),
|
|
2165
|
-
totalAssets: new bignumber_js_default(totalAssets24HoursAgo.toString()).dividedBy(1e18).toString(),
|
|
2166
|
-
tvl: new bignumber_js_default(tvl24HoursAgo.toString()).dividedBy(1e18).toString()
|
|
2167
|
-
},
|
|
2168
|
-
totalWBeraIssued: new bignumber_js_default(underlyingTotalSupply.toString()).dividedBy(1e18).toString(),
|
|
2169
2212
|
lockPeriod
|
|
2170
2213
|
};
|
|
2171
2214
|
} catch (error) {
|
|
@@ -2315,29 +2358,6 @@ async function getTotalStakedAmount({
|
|
|
2315
2358
|
}
|
|
2316
2359
|
}
|
|
2317
2360
|
|
|
2318
|
-
// src/actions/pol/getUserClaimableIncentives.ts
|
|
2319
|
-
async function getUserClaimableIncentives({
|
|
2320
|
-
account,
|
|
2321
|
-
...args
|
|
2322
|
-
}) {
|
|
2323
|
-
const { config } = parseBaseArgs(args);
|
|
2324
|
-
const result = await fetch(
|
|
2325
|
-
`${config.pol.bribeBoostApi}/api/v1/wallets/${account.toLowerCase()}/rewards/aggregation`,
|
|
2326
|
-
{
|
|
2327
|
-
cache: "no-store"
|
|
2328
|
-
}
|
|
2329
|
-
);
|
|
2330
|
-
if (!result.ok) {
|
|
2331
|
-
const error = await getErrorResponse(result);
|
|
2332
|
-
throw new BeraError({
|
|
2333
|
-
message: "Failed to fetch incentives on server",
|
|
2334
|
-
cause: { error, result, account },
|
|
2335
|
-
reason: error?.error
|
|
2336
|
-
});
|
|
2337
|
-
}
|
|
2338
|
-
return result.json();
|
|
2339
|
-
}
|
|
2340
|
-
|
|
2341
2361
|
// src/actions/pol/getUserVaultInfo.ts
|
|
2342
2362
|
import { formatEther as formatEther5 } from "viem";
|
|
2343
2363
|
|
|
@@ -2592,7 +2612,7 @@ async function getVaultValidators({
|
|
|
2592
2612
|
}
|
|
2593
2613
|
|
|
2594
2614
|
// src/actions/prices/getTokenCurrentPrices.ts
|
|
2595
|
-
import { getAddress, zeroAddress as
|
|
2615
|
+
import { getAddress, zeroAddress as zeroAddress4 } from "viem";
|
|
2596
2616
|
import {
|
|
2597
2617
|
GetTokenCurrentPrices
|
|
2598
2618
|
} from "@berachain/graphql/dex/api";
|
|
@@ -2627,7 +2647,7 @@ async function getTokenCurrentPrices({
|
|
|
2627
2647
|
chainId
|
|
2628
2648
|
};
|
|
2629
2649
|
if (isToken(formattedAddress, "WBERA")) {
|
|
2630
|
-
map[
|
|
2650
|
+
map[zeroAddress4] = {
|
|
2631
2651
|
price: getSafeNumber(tokenInformation.price.toString()),
|
|
2632
2652
|
updatedAt: tokenInformation.updatedAt,
|
|
2633
2653
|
chainId
|
|
@@ -2652,7 +2672,7 @@ async function getTokenCurrentPrices({
|
|
|
2652
2672
|
// src/actions/tokens/getAllowances.ts
|
|
2653
2673
|
import { getPublicClient } from "@wagmi/core";
|
|
2654
2674
|
import {
|
|
2655
|
-
erc20Abi as
|
|
2675
|
+
erc20Abi as erc20Abi5,
|
|
2656
2676
|
formatUnits as formatUnits10
|
|
2657
2677
|
} from "viem";
|
|
2658
2678
|
async function getAllowances({
|
|
@@ -2678,7 +2698,7 @@ async function getAllowances({
|
|
|
2678
2698
|
contracts: items.map(
|
|
2679
2699
|
(item) => ({
|
|
2680
2700
|
address: item.token.address,
|
|
2681
|
-
abi:
|
|
2701
|
+
abi: erc20Abi5,
|
|
2682
2702
|
functionName: "allowance",
|
|
2683
2703
|
args: [account, item.spender]
|
|
2684
2704
|
})
|
|
@@ -3407,7 +3427,31 @@ async function getApiValidator({
|
|
|
3407
3427
|
}
|
|
3408
3428
|
|
|
3409
3429
|
// src/actions/validators/getValidatorRewardAllocation.ts
|
|
3430
|
+
import { beraChefAbi as beraChefAbi2 } from "@berachain/abis/pol/rewards/beraChef";
|
|
3431
|
+
|
|
3432
|
+
// src/actions/validators/getDefaultRewardAllocation.ts
|
|
3410
3433
|
import { beraChefAbi } from "@berachain/abis/pol/rewards/beraChef";
|
|
3434
|
+
function isDefaultRewardAllocation(rewardAllocation) {
|
|
3435
|
+
return rewardAllocation.start.blockNumber === 0;
|
|
3436
|
+
}
|
|
3437
|
+
async function getDefaultRewardAllocation({
|
|
3438
|
+
client,
|
|
3439
|
+
...args
|
|
3440
|
+
}) {
|
|
3441
|
+
const { config } = parseBaseArgs(args);
|
|
3442
|
+
const rawDefaultRewardAllocation = await client.readContract({
|
|
3443
|
+
address: config.pol.beraChef,
|
|
3444
|
+
abi: beraChefAbi,
|
|
3445
|
+
functionName: "getDefaultRewardAllocation",
|
|
3446
|
+
args: []
|
|
3447
|
+
});
|
|
3448
|
+
return formatValidatorRewardAllocation(
|
|
3449
|
+
{ ...rawDefaultRewardAllocation, startBlock: 0n },
|
|
3450
|
+
0
|
|
3451
|
+
);
|
|
3452
|
+
}
|
|
3453
|
+
|
|
3454
|
+
// src/actions/validators/getValidatorRewardAllocation.ts
|
|
3411
3455
|
function formatValidatorRewardAllocation(raw, startTs) {
|
|
3412
3456
|
return {
|
|
3413
3457
|
start: {
|
|
@@ -3435,13 +3479,13 @@ async function getValidatorRewardAllocation({
|
|
|
3435
3479
|
const [rawActiveRewardAllocation, rawSetRewardAllocation] = await Promise.all([
|
|
3436
3480
|
client.readContract({
|
|
3437
3481
|
address: config.pol.beraChef,
|
|
3438
|
-
abi:
|
|
3482
|
+
abi: beraChefAbi2,
|
|
3439
3483
|
functionName: "getActiveRewardAllocation",
|
|
3440
3484
|
args: [pubKey]
|
|
3441
3485
|
}),
|
|
3442
3486
|
client.readContract({
|
|
3443
3487
|
address: config.pol.beraChef,
|
|
3444
|
-
abi:
|
|
3488
|
+
abi: beraChefAbi2,
|
|
3445
3489
|
functionName: "getSetActiveRewardAllocation",
|
|
3446
3490
|
args: [pubKey]
|
|
3447
3491
|
})
|
|
@@ -3462,8 +3506,11 @@ async function getValidatorRewardAllocation({
|
|
|
3462
3506
|
rawSetRewardAllocation,
|
|
3463
3507
|
Number(lastRaUpdateSet.timestamp)
|
|
3464
3508
|
);
|
|
3509
|
+
const isDefault = isDefaultRewardAllocation(activeRewardAllocation);
|
|
3465
3510
|
let isBaseline = false;
|
|
3466
|
-
if (
|
|
3511
|
+
if (isDefault) {
|
|
3512
|
+
isBaseline = false;
|
|
3513
|
+
} else if (setRewardAllocation.start.blockNumber === 0) {
|
|
3467
3514
|
isBaseline = true;
|
|
3468
3515
|
} else {
|
|
3469
3516
|
isBaseline = !isSameRewardAllocation(
|
|
@@ -3475,6 +3522,7 @@ async function getValidatorRewardAllocation({
|
|
|
3475
3522
|
activeRewardAllocation,
|
|
3476
3523
|
setRewardAllocation,
|
|
3477
3524
|
isBaseline,
|
|
3525
|
+
isDefault,
|
|
3478
3526
|
isNeverSet: setRewardAllocation?.start.blockNumber === 0
|
|
3479
3527
|
};
|
|
3480
3528
|
} catch (e) {
|
|
@@ -3491,6 +3539,25 @@ async function getStakingPoolBatch({
|
|
|
3491
3539
|
return 5614;
|
|
3492
3540
|
}
|
|
3493
3541
|
|
|
3542
|
+
// src/actions/validators/getUserBoosts.ts
|
|
3543
|
+
import {
|
|
3544
|
+
GetUserValidatorInformation
|
|
3545
|
+
} from "@berachain/graphql/pol/api";
|
|
3546
|
+
async function getUserBoosts({
|
|
3547
|
+
account,
|
|
3548
|
+
...args
|
|
3549
|
+
}) {
|
|
3550
|
+
const { config } = parseBaseArgs(args);
|
|
3551
|
+
const apiClient = getApolloClient("api", args);
|
|
3552
|
+
return apiClient.query({
|
|
3553
|
+
query: GetUserValidatorInformation,
|
|
3554
|
+
variables: {
|
|
3555
|
+
address: account.toLowerCase(),
|
|
3556
|
+
chain: config.bex.chainName
|
|
3557
|
+
}
|
|
3558
|
+
});
|
|
3559
|
+
}
|
|
3560
|
+
|
|
3494
3561
|
// src/actions/validators/getUserBoostsOnValidator.ts
|
|
3495
3562
|
import { formatEther as formatEther6 } from "viem";
|
|
3496
3563
|
import { bgtAbi as bgtAbi2 } from "@berachain/abis/pol/bgt";
|
|
@@ -3540,91 +3607,92 @@ async function getUserBoostsOnValidator({
|
|
|
3540
3607
|
|
|
3541
3608
|
// src/actions/validators/getUserActiveValidators.ts
|
|
3542
3609
|
import { formatEther as formatEther7, parseEther as parseEther4 } from "viem";
|
|
3543
|
-
|
|
3544
|
-
// src/actions/validators/getUserBoosts.ts
|
|
3545
|
-
import {
|
|
3546
|
-
GetUserValidatorInformation
|
|
3547
|
-
} from "@berachain/graphql/pol/api";
|
|
3548
|
-
async function getUserBoosts({
|
|
3610
|
+
async function getUserActiveValidatorsApi({
|
|
3549
3611
|
account,
|
|
3612
|
+
chain,
|
|
3550
3613
|
...args
|
|
3551
3614
|
}) {
|
|
3552
3615
|
const { config } = parseBaseArgs(args);
|
|
3553
|
-
const
|
|
3554
|
-
|
|
3555
|
-
|
|
3616
|
+
const resolvedChain = chain ?? config.bex.chainName;
|
|
3617
|
+
const userBoosts = await getUserBoosts({ account });
|
|
3618
|
+
const validatorInfoList = await getAllValidators({
|
|
3556
3619
|
variables: {
|
|
3557
|
-
|
|
3558
|
-
|
|
3620
|
+
chain: resolvedChain,
|
|
3621
|
+
where: {
|
|
3622
|
+
idIn: userBoosts.data.polGetValidatorBoosts.boosts.map(
|
|
3623
|
+
(t) => t.validatorId
|
|
3624
|
+
)
|
|
3625
|
+
}
|
|
3559
3626
|
}
|
|
3560
3627
|
});
|
|
3628
|
+
return validatorInfoList?.validators.validators ?? [];
|
|
3561
3629
|
}
|
|
3562
|
-
|
|
3563
|
-
// src/actions/validators/getUserActiveValidators.ts
|
|
3564
|
-
async function getUserActiveValidators({
|
|
3630
|
+
async function getUserActiveValidatorsOnChain({
|
|
3565
3631
|
account,
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
...args
|
|
3632
|
+
validators,
|
|
3633
|
+
publicClient
|
|
3569
3634
|
}) {
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
where: {
|
|
3578
|
-
idIn: userBoosts.data.polGetValidatorBoosts.boosts.map(
|
|
3579
|
-
(t) => t.validatorId
|
|
3580
|
-
)
|
|
3581
|
-
}
|
|
3582
|
-
}
|
|
3583
|
-
}),
|
|
3584
|
-
Promise.all(
|
|
3585
|
-
userBoosts.data.polGetValidatorBoosts.boosts.filter(
|
|
3586
|
-
(t) => (
|
|
3587
|
-
// there's an edge case here where api doesn't return the pubkey
|
|
3588
|
-
// because the user might have boosted a pubkey that doesn't exist
|
|
3589
|
-
// api doesn't return the pubkey in this case, but we're choosing to filter them out
|
|
3590
|
-
!!t.validator
|
|
3591
|
-
)
|
|
3592
|
-
).map(
|
|
3593
|
-
(t) => getUserBoostsOnValidator({
|
|
3594
|
-
account,
|
|
3595
|
-
pubkey: t.validator.pubkey,
|
|
3596
|
-
publicClient
|
|
3597
|
-
})
|
|
3598
|
-
)
|
|
3635
|
+
return await Promise.all(
|
|
3636
|
+
validators.map(
|
|
3637
|
+
(validator) => getUserBoostsOnValidator({
|
|
3638
|
+
account,
|
|
3639
|
+
pubkey: validator.pubkey,
|
|
3640
|
+
publicClient
|
|
3641
|
+
})
|
|
3599
3642
|
)
|
|
3600
|
-
|
|
3601
|
-
|
|
3643
|
+
);
|
|
3644
|
+
}
|
|
3645
|
+
function mergeUserActiveValidators({
|
|
3646
|
+
validators,
|
|
3647
|
+
onChainBoosts
|
|
3648
|
+
}) {
|
|
3649
|
+
return validators.flatMap((validator) => {
|
|
3602
3650
|
const userDeposited = onChainBoosts.find(
|
|
3603
3651
|
(data) => data.pubkey.toLowerCase() === validator.pubkey.toLowerCase()
|
|
3604
3652
|
);
|
|
3605
3653
|
if (!userDeposited) {
|
|
3606
|
-
|
|
3654
|
+
return [];
|
|
3607
3655
|
}
|
|
3608
|
-
const droppableBoostAmount = parseEther4(userDeposited
|
|
3609
|
-
return
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3656
|
+
const droppableBoostAmount = parseEther4(userDeposited.activeBoostAmount ?? "0") - parseEther4(userDeposited.queuedDropBoostAmount);
|
|
3657
|
+
return [
|
|
3658
|
+
{
|
|
3659
|
+
...validator,
|
|
3660
|
+
userBoosts: {
|
|
3661
|
+
pubkey: userDeposited.pubkey,
|
|
3662
|
+
activeBoostAmount: userDeposited.activeBoostAmount,
|
|
3663
|
+
queuedBoostAmount: userDeposited.queuedBoostAmount,
|
|
3664
|
+
queuedBoostStartBlock: Number(userDeposited.queuedBoostStartBlock),
|
|
3665
|
+
queuedDropBoostAmount: userDeposited.queuedDropBoostAmount,
|
|
3666
|
+
queuedDropBoostStartBlock: Number(
|
|
3667
|
+
userDeposited.queuedDropBoostStartBlock
|
|
3668
|
+
),
|
|
3669
|
+
droppableBoostAmount: formatEther7(droppableBoostAmount),
|
|
3670
|
+
hasPendingBoosts: Number(userDeposited.queuedBoostAmount) > 0 || Number(userDeposited.queuedDropBoostAmount) > 0,
|
|
3671
|
+
hasActiveBoosts: Number(userDeposited.activeBoostAmount) > 0,
|
|
3672
|
+
hasDroppableBoosts: droppableBoostAmount > 0n
|
|
3673
|
+
}
|
|
3624
3674
|
}
|
|
3625
|
-
|
|
3675
|
+
];
|
|
3626
3676
|
});
|
|
3627
3677
|
}
|
|
3678
|
+
async function getUserActiveValidators({
|
|
3679
|
+
account,
|
|
3680
|
+
publicClient,
|
|
3681
|
+
chain,
|
|
3682
|
+
...args
|
|
3683
|
+
}) {
|
|
3684
|
+
const validators = await getUserActiveValidatorsApi({
|
|
3685
|
+
account,
|
|
3686
|
+
chain,
|
|
3687
|
+
...args
|
|
3688
|
+
});
|
|
3689
|
+
const onChainBoosts = await getUserActiveValidatorsOnChain({
|
|
3690
|
+
account,
|
|
3691
|
+
validators,
|
|
3692
|
+
publicClient
|
|
3693
|
+
});
|
|
3694
|
+
return mergeUserActiveValidators({ validators, onChainBoosts });
|
|
3695
|
+
}
|
|
3628
3696
|
|
|
3629
3697
|
// src/actions/validators/getUserStakingPositions.ts
|
|
3630
3698
|
var snowTestWalletPositions = [
|
|
@@ -3822,30 +3890,8 @@ async function getUserStakingPositions(account) {
|
|
|
3822
3890
|
return [];
|
|
3823
3891
|
}
|
|
3824
3892
|
|
|
3825
|
-
// src/actions/validators/getValidatorAnalytics.ts
|
|
3826
|
-
async function getValidatorAnalytics({
|
|
3827
|
-
pubkey,
|
|
3828
|
-
dayRange
|
|
3829
|
-
}) {
|
|
3830
|
-
if (typeof window === "undefined") {
|
|
3831
|
-
throw new BeraError({
|
|
3832
|
-
message: "getValidatorAnalytics is browser-only; call from a Client Component / SWR hook",
|
|
3833
|
-
level: "error"
|
|
3834
|
-
});
|
|
3835
|
-
}
|
|
3836
|
-
const params = new URLSearchParams({
|
|
3837
|
-
pubkey,
|
|
3838
|
-
dayRange: String(dayRange)
|
|
3839
|
-
});
|
|
3840
|
-
return beraFetchJson({
|
|
3841
|
-
url: `/api/pol/validator-analytics?${params}`,
|
|
3842
|
-
name: "pol-validator-analytics",
|
|
3843
|
-
type: "rest"
|
|
3844
|
-
});
|
|
3845
|
-
}
|
|
3846
|
-
|
|
3847
3893
|
// src/actions/validators/getValidatorCommission.ts
|
|
3848
|
-
import { beraChefAbi as
|
|
3894
|
+
import { beraChefAbi as beraChefAbi3 } from "@berachain/abis/pol/rewards/beraChef";
|
|
3849
3895
|
async function getValidatorCommission({
|
|
3850
3896
|
client,
|
|
3851
3897
|
pubKey,
|
|
@@ -3854,7 +3900,7 @@ async function getValidatorCommission({
|
|
|
3854
3900
|
const { config } = parseBaseArgs(args);
|
|
3855
3901
|
const result = await client.readContract({
|
|
3856
3902
|
address: config.pol.beraChef,
|
|
3857
|
-
abi:
|
|
3903
|
+
abi: beraChefAbi3,
|
|
3858
3904
|
functionName: "getValCommissionOnIncentiveTokens",
|
|
3859
3905
|
args: [pubKey]
|
|
3860
3906
|
});
|
|
@@ -3892,7 +3938,7 @@ async function getValidatorOperatorAddress({
|
|
|
3892
3938
|
}
|
|
3893
3939
|
|
|
3894
3940
|
// src/actions/validators/getValidatorQueuedCommission.ts
|
|
3895
|
-
import { beraChefAbi as
|
|
3941
|
+
import { beraChefAbi as beraChefAbi4 } from "@berachain/abis/pol/rewards/beraChef";
|
|
3896
3942
|
async function getValidatorQueuedCommission({
|
|
3897
3943
|
client,
|
|
3898
3944
|
pubKey,
|
|
@@ -3901,7 +3947,7 @@ async function getValidatorQueuedCommission({
|
|
|
3901
3947
|
const { config } = parseBaseArgs(args);
|
|
3902
3948
|
const result = await client.readContract({
|
|
3903
3949
|
address: config.pol.beraChef,
|
|
3904
|
-
abi:
|
|
3950
|
+
abi: beraChefAbi4,
|
|
3905
3951
|
functionName: "getValQueuedCommissionOnIncentiveTokens",
|
|
3906
3952
|
args: [pubKey]
|
|
3907
3953
|
});
|
|
@@ -3934,7 +3980,7 @@ async function getValidatorQueuedOperatorAddress({
|
|
|
3934
3980
|
}
|
|
3935
3981
|
|
|
3936
3982
|
// src/actions/validators/getValidatorQueuedRewardAllocation.ts
|
|
3937
|
-
import { beraChefAbi as
|
|
3983
|
+
import { beraChefAbi as beraChefAbi5 } from "@berachain/abis/pol/rewards/beraChef";
|
|
3938
3984
|
async function getValidatorQueuedRewardAllocation({
|
|
3939
3985
|
client,
|
|
3940
3986
|
pubKey,
|
|
@@ -3944,7 +3990,7 @@ async function getValidatorQueuedRewardAllocation({
|
|
|
3944
3990
|
try {
|
|
3945
3991
|
const result = await client.readContract({
|
|
3946
3992
|
address: config.pol.beraChef,
|
|
3947
|
-
abi:
|
|
3993
|
+
abi: beraChefAbi5,
|
|
3948
3994
|
functionName: "getQueuedRewardAllocation",
|
|
3949
3995
|
args: [pubKey]
|
|
3950
3996
|
});
|
|
@@ -3958,6 +4004,7 @@ async function getValidatorQueuedRewardAllocation({
|
|
|
3958
4004
|
export {
|
|
3959
4005
|
getConvertToAssets,
|
|
3960
4006
|
BaseAggregator,
|
|
4007
|
+
ensoErc4626,
|
|
3961
4008
|
BalancerApi,
|
|
3962
4009
|
getAllPools,
|
|
3963
4010
|
getApiPool,
|
|
@@ -3987,24 +4034,22 @@ export {
|
|
|
3987
4034
|
RewardVaultDistributionMode,
|
|
3988
4035
|
getRewardVaultRewards,
|
|
3989
4036
|
getBgtAprSimulation,
|
|
3990
|
-
getBgtIncentiveDistributorPaused,
|
|
3991
4037
|
getEarnedStakedBeraVault,
|
|
3992
4038
|
getGlobalData,
|
|
3993
4039
|
getMarkets,
|
|
3994
|
-
getRewardProofsByValidator,
|
|
3995
4040
|
getRewardTokenToBeraRate,
|
|
3996
4041
|
getRewardVault,
|
|
3997
4042
|
getRewardVaultEarnedRewards,
|
|
3998
4043
|
getRewardVaultIncentives,
|
|
3999
4044
|
getRewardVaultStakingToken,
|
|
4000
4045
|
getRewardVaults,
|
|
4001
|
-
|
|
4046
|
+
getStakedBeraAPY,
|
|
4047
|
+
StakeSnapshotRange,
|
|
4002
4048
|
getStakedBeraSnapshots,
|
|
4003
4049
|
getStakeWithdrawalCooldown,
|
|
4004
4050
|
getSWBeraVaultMetadata,
|
|
4005
4051
|
getSWBeraWithdrawal,
|
|
4006
4052
|
getTotalStakedAmount,
|
|
4007
|
-
getUserClaimableIncentives,
|
|
4008
4053
|
getUserVaultInfo,
|
|
4009
4054
|
getUserVaults,
|
|
4010
4055
|
getVaultHistory,
|
|
@@ -4019,11 +4064,16 @@ export {
|
|
|
4019
4064
|
formatValidatorRewardAllocation,
|
|
4020
4065
|
isSameRewardAllocation,
|
|
4021
4066
|
getValidatorRewardAllocation,
|
|
4067
|
+
isDefaultRewardAllocation,
|
|
4068
|
+
getDefaultRewardAllocation,
|
|
4022
4069
|
getStakingPoolBatch,
|
|
4070
|
+
getUserBoosts,
|
|
4023
4071
|
getUserBoostsOnValidator,
|
|
4072
|
+
getUserActiveValidatorsApi,
|
|
4073
|
+
getUserActiveValidatorsOnChain,
|
|
4074
|
+
mergeUserActiveValidators,
|
|
4024
4075
|
getUserActiveValidators,
|
|
4025
4076
|
getUserStakingPositions,
|
|
4026
|
-
getValidatorAnalytics,
|
|
4027
4077
|
getValidatorCommission,
|
|
4028
4078
|
getValidatorEstimatedBgtPerYear,
|
|
4029
4079
|
getValidatorOperatorAddress,
|
|
@@ -4031,4 +4081,4 @@ export {
|
|
|
4031
4081
|
getValidatorQueuedOperatorAddress,
|
|
4032
4082
|
getValidatorQueuedRewardAllocation
|
|
4033
4083
|
};
|
|
4034
|
-
//# sourceMappingURL=chunk-
|
|
4084
|
+
//# sourceMappingURL=chunk-SMBAW7AG.mjs.map
|