@berachain/berajs 0.2.13 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/clientName.unit.test.d.ts +2 -0
- package/dist/actions/clients/clientName.unit.test.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 +2 -2
- 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 +33 -64
- package/dist/actions/exports.mjs.map +1 -1
- package/dist/actions/governance/exports.mjs +3 -3
- package/dist/actions/honey/getChartData.d.ts +1 -1
- package/dist/actions/honey/getChartData.d.ts.map +1 -1
- 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/honey/getHoneyTxns.d.ts +1 -1
- package/dist/actions/honey/getHoneyTxns.d.ts.map +1 -1
- package/dist/actions/pol/getBGTGlobalInfo.d.ts +0 -1
- package/dist/actions/pol/getBGTGlobalInfo.d.ts.map +1 -1
- package/dist/actions/pol/getBeraTokenTotalSupply.d.ts.map +1 -1
- package/dist/actions/pol/getEarnedStakedBeraVault.d.ts +4 -27
- package/dist/actions/pol/getEarnedStakedBeraVault.d.ts.map +1 -1
- package/dist/actions/pol/getLSTStakeConfig.d.ts.map +1 -1
- package/dist/actions/pol/getRewardVaults.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/server/exports.mjs.map +1 -1
- package/dist/actions/server/getDailyValidatorBlockStats.d.ts +1 -1
- package/dist/actions/server/getDailyValidatorBlockStats.d.ts.map +1 -1
- 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/getValidatorIncentiveDistribution.d.ts +1 -1
- package/dist/actions/validators/getValidatorIncentiveDistribution.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-3TRTSTDH.mjs +19 -0
- package/dist/chunk-3TRTSTDH.mjs.map +1 -0
- package/dist/{chunk-ZWTGVIPJ.mjs → chunk-4576RF2K.mjs} +29 -4
- package/dist/chunk-4576RF2K.mjs.map +1 -0
- package/dist/{chunk-PHYZRH4I.mjs → chunk-5MUCX35C.mjs} +9 -13
- package/dist/chunk-5MUCX35C.mjs.map +1 -0
- package/dist/{chunk-UA3Z47LT.mjs → chunk-6D4S3EAC.mjs} +97 -26
- package/dist/chunk-6D4S3EAC.mjs.map +1 -0
- package/dist/{chunk-AEN6IJFU.mjs → chunk-7KN7TDUC.mjs} +2 -2
- package/dist/{chunk-LE4CYW7S.mjs → chunk-FWRYUIJK.mjs} +3 -3
- package/dist/chunk-GDUKRUHE.mjs +29 -0
- package/dist/chunk-GDUKRUHE.mjs.map +1 -0
- package/dist/{chunk-PJRLHTGC.mjs → chunk-HPRLNT6R.mjs} +3 -3
- package/dist/{chunk-DOZJB6IJ.mjs → chunk-KY7JMIIS.mjs} +394 -346
- package/dist/chunk-KY7JMIIS.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-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-IFNIPVTZ.mjs → chunk-Z337NBBW.mjs} +5 -49
- package/dist/chunk-Z337NBBW.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/enum/txnEnum.d.ts +1 -1
- package/dist/enum/txnEnum.d.ts.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/errors/getErrorMessage.unit.test.d.ts +2 -0
- package/dist/errors/getErrorMessage.unit.test.d.ts.map +1 -0
- package/dist/generated/beep.d.ts +1597 -0
- package/dist/generated/beep.d.ts.map +1 -0
- package/dist/generated/enso.d.ts +4957 -0
- package/dist/generated/enso.d.ts.map +1 -0
- package/dist/generated/layerzero.d.ts +2057 -0
- package/dist/generated/layerzero.d.ts.map +1 -0
- 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/useCrossChainNativeFee.unit.test.d.ts +2 -0
- package/dist/hooks/dex/useCrossChainNativeFee.unit.test.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/dex/useSingleAggregatorQuote.unit.test.d.ts +2 -0
- package/dist/hooks/dex/useSingleAggregatorQuote.unit.test.d.ts.map +1 -0
- package/dist/hooks/enso/useBendZapSupply.d.ts +2 -2
- package/dist/hooks/enso/useBendZapSupply.d.ts.map +1 -1
- package/dist/hooks/enso/useBendZapSupply.unit.test.d.ts +2 -0
- package/dist/hooks/enso/useBendZapSupply.unit.test.d.ts.map +1 -0
- package/dist/hooks/enso/useEnsoUserTokensWithBalances.d.ts.map +1 -1
- package/dist/hooks/enso/useEnsoUserTokensWithBalances.unit.test.d.ts +2 -0
- package/dist/hooks/enso/useEnsoUserTokensWithBalances.unit.test.d.ts.map +1 -0
- package/dist/hooks/enso/useZapStakeBera.d.ts.map +1 -1
- package/dist/hooks/enso/useZapStakeBera.unit.test.d.ts +2 -0
- package/dist/hooks/enso/useZapStakeBera.unit.test.d.ts.map +1 -0
- package/dist/hooks/exports.d.ts +2 -5
- package/dist/hooks/exports.d.ts.map +1 -1
- package/dist/hooks/exports.mjs +615 -911
- package/dist/hooks/exports.mjs.map +1 -1
- package/dist/hooks/governance/exports.mjs +4 -4
- package/dist/hooks/honey/useHoneyChartData.d.ts +4 -4
- package/dist/hooks/honey/useHoneyChartData.d.ts.map +1 -1
- package/dist/hooks/pol/useAutoclaimedIncentives.d.ts.map +1 -1
- package/dist/hooks/pol/useAutoclaimedIncentivesTxHash.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 +4 -2
- package/dist/hooks/pol/useStakedData.d.ts.map +1 -1
- package/dist/hooks/pol/useStakedSnapshots.d.ts +1 -1
- package/dist/hooks/pol/useStakedSnapshots.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/useMultipleTokenInformation.unit.test.d.ts +2 -0
- package/dist/hooks/tokens/useMultipleTokenInformation.unit.test.d.ts.map +1 -0
- 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 +0 -1
- package/dist/hooks/validators/useValidator.d.ts.map +1 -1
- package/dist/hooks/validators/useValidatorIncentiveDistribution.d.ts +4 -5
- 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/types/beep/exports.d.ts +2 -0
- package/dist/types/beep/exports.d.ts.map +1 -0
- package/dist/types/beep/exports.mjs +1 -0
- package/dist/types/beep/exports.mjs.map +1 -0
- package/dist/types/bribeBoost.d.ts +0 -49
- package/dist/types/dex.d.ts +17 -0
- package/dist/types/enso.d.ts +1 -27
- package/dist/types/global.d.ts +7 -0
- package/dist/types/pol.d.ts +3 -48
- package/dist/utils/crossChainBridge.d.ts +74 -0
- package/dist/utils/crossChainBridge.d.ts.map +1 -0
- package/dist/utils/crossChainBridge.unit.test.d.ts +2 -0
- package/dist/utils/crossChainBridge.unit.test.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 +14 -10
- 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 +6 -4
- package/src/actions/clients/fetchEnso.ts +47 -0
- package/src/actions/clients/fetchLayerzero.ts +33 -0
- package/src/actions/clients/fetchOpenApi.ts +9 -2
- package/src/actions/clients/fetchOpenApi.unit.test.ts +27 -12
- 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/getChartData.ts +2 -3
- package/src/actions/honey/getHoney24hVolume.ts +4 -13
- package/src/actions/honey/getHoneyCollaterals.ts +1 -1
- package/src/actions/honey/getHoneyTxns.ts +2 -3
- package/src/actions/pol/getBGTGlobalInfo.ts +0 -2
- package/src/actions/pol/getBeraTokenTotalSupply.ts +3 -33
- package/src/actions/pol/getEarnedStakedBeraVault.ts +1 -1
- package/src/actions/pol/getLSTStakeConfig.ts +0 -6
- package/src/actions/pol/getRewardVaults.ts +0 -1
- package/src/actions/pol/getSWBeraVaultMetadata.ts +2 -106
- package/src/actions/pol/getStakedBeraAPY.ts +44 -0
- package/src/actions/pol/getStakedBeraSnapshots.ts +17 -34
- package/src/actions/pol/getStakingDailyAssets.ts +1 -1
- package/src/actions/server/getDailyValidatorBlockStats.ts +1 -2
- package/src/actions/validators/getActiveBoostAndCommissionChangeDelay.ts +1 -1
- package/src/actions/validators/getUserActiveValidators.ts +116 -54
- package/src/actions/validators/getValidatorIncentiveDistribution.ts +1 -2
- 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/enum/txnEnum.ts +1 -1
- 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/generated/beep.ts +1605 -0
- package/src/generated/enso.ts +4965 -0
- package/src/generated/layerzero.ts +2065 -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 +10 -5
- package/src/hooks/dex/useSingleAggregatorQuote.unit.test.ts +86 -0
- package/src/hooks/enso/useBendZapSupply.ts +10 -38
- package/src/hooks/enso/useBendZapSupply.unit.test.ts +98 -0
- package/src/hooks/enso/useEnsoUserTokensWithBalances.ts +13 -3
- package/src/hooks/enso/useEnsoUserTokensWithBalances.unit.test.ts +69 -0
- package/src/hooks/enso/useZapStakeBera.ts +8 -1
- package/src/hooks/enso/useZapStakeBera.unit.test.ts +97 -0
- 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 +15 -14
- package/src/hooks/pol/useStakedSnapshots.ts +1 -1
- 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 +4 -5
- package/src/types/beep/exports.ts +4 -0
- 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/dex/b-sdk.d.ts +0 -3
- package/dist/actions/enso/getEnsoSwapBundle.d.ts +0 -3
- package/dist/actions/enso/getEnsoSwapBundle.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/getRewardProofsByValidator.d.ts +0 -9
- package/dist/actions/pol/getRewardProofsByValidator.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/validators/getValidatorAnalytics.d.ts +0 -12
- package/dist/actions/validators/getValidatorAnalytics.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/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/useHoneySwapState-CXVWAThr.d.ts +0 -32
- package/dist/useHoneySwapState-twi7NTaO.d.ts +0 -32
- package/dist/utils/formatIncentivesTokenMap.d.ts +0 -3
- package/dist/utils/formatIncentivesTokenMap.d.ts.map +0 -1
- package/dist/utils/layerZeroScan.d.ts +0 -39
- package/dist/utils/layerZeroScan.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-5MUCX35C.mjs";
|
|
4
4
|
import {
|
|
5
5
|
fetchBeep
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-GDUKRUHE.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,
|
|
@@ -1594,7 +1769,6 @@ async function getBGTGlobalInfo(args = {}) {
|
|
|
1594
1769
|
const data = apiRes.data;
|
|
1595
1770
|
return {
|
|
1596
1771
|
...data.polGetGlobalInfo,
|
|
1597
|
-
top3EmittingValidators: apiRes.data.top3EmittingValidators.validators,
|
|
1598
1772
|
allValidatorsCount: apiRes.data.allValidatorsCount.pagination.totalCount
|
|
1599
1773
|
};
|
|
1600
1774
|
}
|
|
@@ -1702,38 +1876,6 @@ async function getMarkets(args = {}) {
|
|
|
1702
1876
|
}
|
|
1703
1877
|
}
|
|
1704
1878
|
|
|
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
1879
|
// src/actions/pol/getRewardTokenToBeraRate.ts
|
|
1738
1880
|
import { formatUnits as formatUnits6, parseUnits as parseUnits5 } from "viem";
|
|
1739
1881
|
import { wberaStakerVaultAbi as stakeBeraVaultAbi } from "@berachain/abis/pol/wberaStakerVault";
|
|
@@ -1973,7 +2115,6 @@ async function getRewardVaults({
|
|
|
1973
2115
|
...vault,
|
|
1974
2116
|
dynamicData: {
|
|
1975
2117
|
...vault.dynamicData,
|
|
1976
|
-
allTimeRewards: vault.dynamicData?.allTimeRewards ?? "0",
|
|
1977
2118
|
rewardCapturePercentage: vault.dynamicData?.rewardCapturePercentage ?? 0,
|
|
1978
2119
|
activeIncentivesValueUsd: totalIncentiveInUsdc.toString(),
|
|
1979
2120
|
activeIncentivesRateUsd: vault.dynamicData?.activeIncentivesRateUsd ?? "0",
|
|
@@ -1988,64 +2129,44 @@ async function getRewardVaults({
|
|
|
1988
2129
|
};
|
|
1989
2130
|
}
|
|
1990
2131
|
|
|
1991
|
-
// src/actions/pol/
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
2132
|
+
// src/actions/pol/getStakedBeraAPY.ts
|
|
2133
|
+
function getBeepResolutionEnum(window2) {
|
|
2134
|
+
switch (window2) {
|
|
2135
|
+
case "18HOURS":
|
|
2136
|
+
return "EIGHTEEN_HOURS";
|
|
2137
|
+
case "12HOURS":
|
|
2138
|
+
return "TWELVE_HOURS";
|
|
2139
|
+
case "6HOURS":
|
|
2140
|
+
return "SIX_HOURS";
|
|
2141
|
+
case "DAY":
|
|
2142
|
+
return "ONE_DAY";
|
|
2143
|
+
case "WEEK":
|
|
2144
|
+
return "SEVEN_DAYS";
|
|
1999
2145
|
}
|
|
2000
|
-
return GqlSWberaVaultMetadataResolution.SevenDays;
|
|
2001
2146
|
}
|
|
2002
|
-
async function
|
|
2003
|
-
window: window2
|
|
2004
|
-
...args
|
|
2147
|
+
async function getStakedBeraAPY({
|
|
2148
|
+
window: window2
|
|
2005
2149
|
}) {
|
|
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
|
-
}
|
|
2150
|
+
const { apy } = await fetchBeep("/v0/stake/apr", {
|
|
2151
|
+
query: {
|
|
2152
|
+
interval: getBeepResolutionEnum(window2)
|
|
2153
|
+
}
|
|
2154
|
+
});
|
|
2155
|
+
return apy === null ? 0 : Number(apy);
|
|
2022
2156
|
}
|
|
2023
2157
|
|
|
2024
2158
|
// src/actions/pol/getStakedBeraSnapshots.ts
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2159
|
+
var StakeSnapshotRange = /* @__PURE__ */ ((StakeSnapshotRange2) => {
|
|
2160
|
+
StakeSnapshotRange2["SevenDays"] = "7";
|
|
2161
|
+
StakeSnapshotRange2["ThirtyDays"] = "30";
|
|
2162
|
+
StakeSnapshotRange2["SixtyDays"] = "60";
|
|
2163
|
+
StakeSnapshotRange2["NinetyDays"] = "90";
|
|
2164
|
+
return StakeSnapshotRange2;
|
|
2165
|
+
})(StakeSnapshotRange || {});
|
|
2029
2166
|
async function getStakedBeraSnapshots({
|
|
2030
|
-
|
|
2031
|
-
range = GqlVaultSnapshotDataRange.ThirtyDays,
|
|
2032
|
-
...args
|
|
2167
|
+
range = "30" /* ThirtyDays */
|
|
2033
2168
|
} = {}) {
|
|
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
|
-
}
|
|
2169
|
+
return await fetchBeep("/v0/stake/apr/history", { query: { days: range } });
|
|
2049
2170
|
}
|
|
2050
2171
|
|
|
2051
2172
|
// src/actions/pol/getStakeWithdrawalCooldown.ts
|
|
@@ -2063,109 +2184,29 @@ async function getStakeWithdrawalCooldown({
|
|
|
2063
2184
|
}
|
|
2064
2185
|
|
|
2065
2186
|
// src/actions/pol/getSWBeraVaultMetadata.ts
|
|
2066
|
-
import {
|
|
2187
|
+
import { erc4626Abi } from "viem";
|
|
2067
2188
|
async function getSWBeraVaultMetadata({
|
|
2068
2189
|
address,
|
|
2069
|
-
|
|
2070
|
-
publicClient,
|
|
2071
|
-
blockTime
|
|
2190
|
+
publicClient
|
|
2072
2191
|
}) {
|
|
2073
2192
|
assertPublicClient(publicClient);
|
|
2074
|
-
const hoursWindow = 26;
|
|
2075
2193
|
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([
|
|
2194
|
+
const [curretTotalAssets, lockPeriod] = await Promise.all([
|
|
2091
2195
|
publicClient.readContract({
|
|
2092
2196
|
address,
|
|
2093
2197
|
abi: erc4626Abi,
|
|
2094
2198
|
functionName: "totalAssets"
|
|
2095
2199
|
}),
|
|
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
2200
|
getStakeWithdrawalCooldown({
|
|
2146
2201
|
publicClient,
|
|
2147
2202
|
address
|
|
2148
2203
|
})
|
|
2149
2204
|
]);
|
|
2150
|
-
const exchangeRateWindowAgo = new bignumber_js_default(
|
|
2151
|
-
oneShareWorthWindowAgo.toString()
|
|
2152
|
-
);
|
|
2153
|
-
const currentExchangeRate = new bignumber_js_default(currentOneShareWorth.toString());
|
|
2154
2205
|
return {
|
|
2155
2206
|
address,
|
|
2156
2207
|
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()
|
|
2208
|
+
totalAssets: new bignumber_js_default(curretTotalAssets.toString()).dividedBy(1e18).toString()
|
|
2161
2209
|
},
|
|
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
2210
|
lockPeriod
|
|
2170
2211
|
};
|
|
2171
2212
|
} catch (error) {
|
|
@@ -2315,29 +2356,6 @@ async function getTotalStakedAmount({
|
|
|
2315
2356
|
}
|
|
2316
2357
|
}
|
|
2317
2358
|
|
|
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
2359
|
// src/actions/pol/getUserVaultInfo.ts
|
|
2342
2360
|
import { formatEther as formatEther5 } from "viem";
|
|
2343
2361
|
|
|
@@ -2592,7 +2610,7 @@ async function getVaultValidators({
|
|
|
2592
2610
|
}
|
|
2593
2611
|
|
|
2594
2612
|
// src/actions/prices/getTokenCurrentPrices.ts
|
|
2595
|
-
import { getAddress, zeroAddress as
|
|
2613
|
+
import { getAddress, zeroAddress as zeroAddress4 } from "viem";
|
|
2596
2614
|
import {
|
|
2597
2615
|
GetTokenCurrentPrices
|
|
2598
2616
|
} from "@berachain/graphql/dex/api";
|
|
@@ -2627,7 +2645,7 @@ async function getTokenCurrentPrices({
|
|
|
2627
2645
|
chainId
|
|
2628
2646
|
};
|
|
2629
2647
|
if (isToken(formattedAddress, "WBERA")) {
|
|
2630
|
-
map[
|
|
2648
|
+
map[zeroAddress4] = {
|
|
2631
2649
|
price: getSafeNumber(tokenInformation.price.toString()),
|
|
2632
2650
|
updatedAt: tokenInformation.updatedAt,
|
|
2633
2651
|
chainId
|
|
@@ -2652,7 +2670,7 @@ async function getTokenCurrentPrices({
|
|
|
2652
2670
|
// src/actions/tokens/getAllowances.ts
|
|
2653
2671
|
import { getPublicClient } from "@wagmi/core";
|
|
2654
2672
|
import {
|
|
2655
|
-
erc20Abi as
|
|
2673
|
+
erc20Abi as erc20Abi5,
|
|
2656
2674
|
formatUnits as formatUnits10
|
|
2657
2675
|
} from "viem";
|
|
2658
2676
|
async function getAllowances({
|
|
@@ -2678,7 +2696,7 @@ async function getAllowances({
|
|
|
2678
2696
|
contracts: items.map(
|
|
2679
2697
|
(item) => ({
|
|
2680
2698
|
address: item.token.address,
|
|
2681
|
-
abi:
|
|
2699
|
+
abi: erc20Abi5,
|
|
2682
2700
|
functionName: "allowance",
|
|
2683
2701
|
args: [account, item.spender]
|
|
2684
2702
|
})
|
|
@@ -3407,7 +3425,31 @@ async function getApiValidator({
|
|
|
3407
3425
|
}
|
|
3408
3426
|
|
|
3409
3427
|
// src/actions/validators/getValidatorRewardAllocation.ts
|
|
3428
|
+
import { beraChefAbi as beraChefAbi2 } from "@berachain/abis/pol/rewards/beraChef";
|
|
3429
|
+
|
|
3430
|
+
// src/actions/validators/getDefaultRewardAllocation.ts
|
|
3410
3431
|
import { beraChefAbi } from "@berachain/abis/pol/rewards/beraChef";
|
|
3432
|
+
function isDefaultRewardAllocation(rewardAllocation) {
|
|
3433
|
+
return rewardAllocation.start.blockNumber === 0;
|
|
3434
|
+
}
|
|
3435
|
+
async function getDefaultRewardAllocation({
|
|
3436
|
+
client,
|
|
3437
|
+
...args
|
|
3438
|
+
}) {
|
|
3439
|
+
const { config } = parseBaseArgs(args);
|
|
3440
|
+
const rawDefaultRewardAllocation = await client.readContract({
|
|
3441
|
+
address: config.pol.beraChef,
|
|
3442
|
+
abi: beraChefAbi,
|
|
3443
|
+
functionName: "getDefaultRewardAllocation",
|
|
3444
|
+
args: []
|
|
3445
|
+
});
|
|
3446
|
+
return formatValidatorRewardAllocation(
|
|
3447
|
+
{ ...rawDefaultRewardAllocation, startBlock: 0n },
|
|
3448
|
+
0
|
|
3449
|
+
);
|
|
3450
|
+
}
|
|
3451
|
+
|
|
3452
|
+
// src/actions/validators/getValidatorRewardAllocation.ts
|
|
3411
3453
|
function formatValidatorRewardAllocation(raw, startTs) {
|
|
3412
3454
|
return {
|
|
3413
3455
|
start: {
|
|
@@ -3435,13 +3477,13 @@ async function getValidatorRewardAllocation({
|
|
|
3435
3477
|
const [rawActiveRewardAllocation, rawSetRewardAllocation] = await Promise.all([
|
|
3436
3478
|
client.readContract({
|
|
3437
3479
|
address: config.pol.beraChef,
|
|
3438
|
-
abi:
|
|
3480
|
+
abi: beraChefAbi2,
|
|
3439
3481
|
functionName: "getActiveRewardAllocation",
|
|
3440
3482
|
args: [pubKey]
|
|
3441
3483
|
}),
|
|
3442
3484
|
client.readContract({
|
|
3443
3485
|
address: config.pol.beraChef,
|
|
3444
|
-
abi:
|
|
3486
|
+
abi: beraChefAbi2,
|
|
3445
3487
|
functionName: "getSetActiveRewardAllocation",
|
|
3446
3488
|
args: [pubKey]
|
|
3447
3489
|
})
|
|
@@ -3462,8 +3504,11 @@ async function getValidatorRewardAllocation({
|
|
|
3462
3504
|
rawSetRewardAllocation,
|
|
3463
3505
|
Number(lastRaUpdateSet.timestamp)
|
|
3464
3506
|
);
|
|
3507
|
+
const isDefault = isDefaultRewardAllocation(activeRewardAllocation);
|
|
3465
3508
|
let isBaseline = false;
|
|
3466
|
-
if (
|
|
3509
|
+
if (isDefault) {
|
|
3510
|
+
isBaseline = false;
|
|
3511
|
+
} else if (setRewardAllocation.start.blockNumber === 0) {
|
|
3467
3512
|
isBaseline = true;
|
|
3468
3513
|
} else {
|
|
3469
3514
|
isBaseline = !isSameRewardAllocation(
|
|
@@ -3475,6 +3520,7 @@ async function getValidatorRewardAllocation({
|
|
|
3475
3520
|
activeRewardAllocation,
|
|
3476
3521
|
setRewardAllocation,
|
|
3477
3522
|
isBaseline,
|
|
3523
|
+
isDefault,
|
|
3478
3524
|
isNeverSet: setRewardAllocation?.start.blockNumber === 0
|
|
3479
3525
|
};
|
|
3480
3526
|
} catch (e) {
|
|
@@ -3491,6 +3537,25 @@ async function getStakingPoolBatch({
|
|
|
3491
3537
|
return 5614;
|
|
3492
3538
|
}
|
|
3493
3539
|
|
|
3540
|
+
// src/actions/validators/getUserBoosts.ts
|
|
3541
|
+
import {
|
|
3542
|
+
GetUserValidatorInformation
|
|
3543
|
+
} from "@berachain/graphql/pol/api";
|
|
3544
|
+
async function getUserBoosts({
|
|
3545
|
+
account,
|
|
3546
|
+
...args
|
|
3547
|
+
}) {
|
|
3548
|
+
const { config } = parseBaseArgs(args);
|
|
3549
|
+
const apiClient = getApolloClient("api", args);
|
|
3550
|
+
return apiClient.query({
|
|
3551
|
+
query: GetUserValidatorInformation,
|
|
3552
|
+
variables: {
|
|
3553
|
+
address: account.toLowerCase(),
|
|
3554
|
+
chain: config.bex.chainName
|
|
3555
|
+
}
|
|
3556
|
+
});
|
|
3557
|
+
}
|
|
3558
|
+
|
|
3494
3559
|
// src/actions/validators/getUserBoostsOnValidator.ts
|
|
3495
3560
|
import { formatEther as formatEther6 } from "viem";
|
|
3496
3561
|
import { bgtAbi as bgtAbi2 } from "@berachain/abis/pol/bgt";
|
|
@@ -3540,91 +3605,92 @@ async function getUserBoostsOnValidator({
|
|
|
3540
3605
|
|
|
3541
3606
|
// src/actions/validators/getUserActiveValidators.ts
|
|
3542
3607
|
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({
|
|
3608
|
+
async function getUserActiveValidatorsApi({
|
|
3549
3609
|
account,
|
|
3610
|
+
chain,
|
|
3550
3611
|
...args
|
|
3551
3612
|
}) {
|
|
3552
3613
|
const { config } = parseBaseArgs(args);
|
|
3553
|
-
const
|
|
3554
|
-
|
|
3555
|
-
|
|
3614
|
+
const resolvedChain = chain ?? config.bex.chainName;
|
|
3615
|
+
const userBoosts = await getUserBoosts({ account });
|
|
3616
|
+
const validatorInfoList = await getAllValidators({
|
|
3556
3617
|
variables: {
|
|
3557
|
-
|
|
3558
|
-
|
|
3618
|
+
chain: resolvedChain,
|
|
3619
|
+
where: {
|
|
3620
|
+
idIn: userBoosts.data.polGetValidatorBoosts.boosts.map(
|
|
3621
|
+
(t) => t.validatorId
|
|
3622
|
+
)
|
|
3623
|
+
}
|
|
3559
3624
|
}
|
|
3560
3625
|
});
|
|
3626
|
+
return validatorInfoList?.validators.validators ?? [];
|
|
3561
3627
|
}
|
|
3562
|
-
|
|
3563
|
-
// src/actions/validators/getUserActiveValidators.ts
|
|
3564
|
-
async function getUserActiveValidators({
|
|
3628
|
+
async function getUserActiveValidatorsOnChain({
|
|
3565
3629
|
account,
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
...args
|
|
3630
|
+
validators,
|
|
3631
|
+
publicClient
|
|
3569
3632
|
}) {
|
|
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
|
-
)
|
|
3633
|
+
return await Promise.all(
|
|
3634
|
+
validators.map(
|
|
3635
|
+
(validator) => getUserBoostsOnValidator({
|
|
3636
|
+
account,
|
|
3637
|
+
pubkey: validator.pubkey,
|
|
3638
|
+
publicClient
|
|
3639
|
+
})
|
|
3599
3640
|
)
|
|
3600
|
-
|
|
3601
|
-
|
|
3641
|
+
);
|
|
3642
|
+
}
|
|
3643
|
+
function mergeUserActiveValidators({
|
|
3644
|
+
validators,
|
|
3645
|
+
onChainBoosts
|
|
3646
|
+
}) {
|
|
3647
|
+
return validators.flatMap((validator) => {
|
|
3602
3648
|
const userDeposited = onChainBoosts.find(
|
|
3603
3649
|
(data) => data.pubkey.toLowerCase() === validator.pubkey.toLowerCase()
|
|
3604
3650
|
);
|
|
3605
3651
|
if (!userDeposited) {
|
|
3606
|
-
|
|
3652
|
+
return [];
|
|
3607
3653
|
}
|
|
3608
|
-
const droppableBoostAmount = parseEther4(userDeposited
|
|
3609
|
-
return
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3654
|
+
const droppableBoostAmount = parseEther4(userDeposited.activeBoostAmount ?? "0") - parseEther4(userDeposited.queuedDropBoostAmount);
|
|
3655
|
+
return [
|
|
3656
|
+
{
|
|
3657
|
+
...validator,
|
|
3658
|
+
userBoosts: {
|
|
3659
|
+
pubkey: userDeposited.pubkey,
|
|
3660
|
+
activeBoostAmount: userDeposited.activeBoostAmount,
|
|
3661
|
+
queuedBoostAmount: userDeposited.queuedBoostAmount,
|
|
3662
|
+
queuedBoostStartBlock: Number(userDeposited.queuedBoostStartBlock),
|
|
3663
|
+
queuedDropBoostAmount: userDeposited.queuedDropBoostAmount,
|
|
3664
|
+
queuedDropBoostStartBlock: Number(
|
|
3665
|
+
userDeposited.queuedDropBoostStartBlock
|
|
3666
|
+
),
|
|
3667
|
+
droppableBoostAmount: formatEther7(droppableBoostAmount),
|
|
3668
|
+
hasPendingBoosts: Number(userDeposited.queuedBoostAmount) > 0 || Number(userDeposited.queuedDropBoostAmount) > 0,
|
|
3669
|
+
hasActiveBoosts: Number(userDeposited.activeBoostAmount) > 0,
|
|
3670
|
+
hasDroppableBoosts: droppableBoostAmount > 0n
|
|
3671
|
+
}
|
|
3624
3672
|
}
|
|
3625
|
-
|
|
3673
|
+
];
|
|
3626
3674
|
});
|
|
3627
3675
|
}
|
|
3676
|
+
async function getUserActiveValidators({
|
|
3677
|
+
account,
|
|
3678
|
+
publicClient,
|
|
3679
|
+
chain,
|
|
3680
|
+
...args
|
|
3681
|
+
}) {
|
|
3682
|
+
const validators = await getUserActiveValidatorsApi({
|
|
3683
|
+
account,
|
|
3684
|
+
chain,
|
|
3685
|
+
...args
|
|
3686
|
+
});
|
|
3687
|
+
const onChainBoosts = await getUserActiveValidatorsOnChain({
|
|
3688
|
+
account,
|
|
3689
|
+
validators,
|
|
3690
|
+
publicClient
|
|
3691
|
+
});
|
|
3692
|
+
return mergeUserActiveValidators({ validators, onChainBoosts });
|
|
3693
|
+
}
|
|
3628
3694
|
|
|
3629
3695
|
// src/actions/validators/getUserStakingPositions.ts
|
|
3630
3696
|
var snowTestWalletPositions = [
|
|
@@ -3822,30 +3888,8 @@ async function getUserStakingPositions(account) {
|
|
|
3822
3888
|
return [];
|
|
3823
3889
|
}
|
|
3824
3890
|
|
|
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
3891
|
// src/actions/validators/getValidatorCommission.ts
|
|
3848
|
-
import { beraChefAbi as
|
|
3892
|
+
import { beraChefAbi as beraChefAbi3 } from "@berachain/abis/pol/rewards/beraChef";
|
|
3849
3893
|
async function getValidatorCommission({
|
|
3850
3894
|
client,
|
|
3851
3895
|
pubKey,
|
|
@@ -3854,7 +3898,7 @@ async function getValidatorCommission({
|
|
|
3854
3898
|
const { config } = parseBaseArgs(args);
|
|
3855
3899
|
const result = await client.readContract({
|
|
3856
3900
|
address: config.pol.beraChef,
|
|
3857
|
-
abi:
|
|
3901
|
+
abi: beraChefAbi3,
|
|
3858
3902
|
functionName: "getValCommissionOnIncentiveTokens",
|
|
3859
3903
|
args: [pubKey]
|
|
3860
3904
|
});
|
|
@@ -3892,7 +3936,7 @@ async function getValidatorOperatorAddress({
|
|
|
3892
3936
|
}
|
|
3893
3937
|
|
|
3894
3938
|
// src/actions/validators/getValidatorQueuedCommission.ts
|
|
3895
|
-
import { beraChefAbi as
|
|
3939
|
+
import { beraChefAbi as beraChefAbi4 } from "@berachain/abis/pol/rewards/beraChef";
|
|
3896
3940
|
async function getValidatorQueuedCommission({
|
|
3897
3941
|
client,
|
|
3898
3942
|
pubKey,
|
|
@@ -3901,7 +3945,7 @@ async function getValidatorQueuedCommission({
|
|
|
3901
3945
|
const { config } = parseBaseArgs(args);
|
|
3902
3946
|
const result = await client.readContract({
|
|
3903
3947
|
address: config.pol.beraChef,
|
|
3904
|
-
abi:
|
|
3948
|
+
abi: beraChefAbi4,
|
|
3905
3949
|
functionName: "getValQueuedCommissionOnIncentiveTokens",
|
|
3906
3950
|
args: [pubKey]
|
|
3907
3951
|
});
|
|
@@ -3934,7 +3978,7 @@ async function getValidatorQueuedOperatorAddress({
|
|
|
3934
3978
|
}
|
|
3935
3979
|
|
|
3936
3980
|
// src/actions/validators/getValidatorQueuedRewardAllocation.ts
|
|
3937
|
-
import { beraChefAbi as
|
|
3981
|
+
import { beraChefAbi as beraChefAbi5 } from "@berachain/abis/pol/rewards/beraChef";
|
|
3938
3982
|
async function getValidatorQueuedRewardAllocation({
|
|
3939
3983
|
client,
|
|
3940
3984
|
pubKey,
|
|
@@ -3944,7 +3988,7 @@ async function getValidatorQueuedRewardAllocation({
|
|
|
3944
3988
|
try {
|
|
3945
3989
|
const result = await client.readContract({
|
|
3946
3990
|
address: config.pol.beraChef,
|
|
3947
|
-
abi:
|
|
3991
|
+
abi: beraChefAbi5,
|
|
3948
3992
|
functionName: "getQueuedRewardAllocation",
|
|
3949
3993
|
args: [pubKey]
|
|
3950
3994
|
});
|
|
@@ -3958,6 +4002,7 @@ async function getValidatorQueuedRewardAllocation({
|
|
|
3958
4002
|
export {
|
|
3959
4003
|
getConvertToAssets,
|
|
3960
4004
|
BaseAggregator,
|
|
4005
|
+
ensoErc4626,
|
|
3961
4006
|
BalancerApi,
|
|
3962
4007
|
getAllPools,
|
|
3963
4008
|
getApiPool,
|
|
@@ -3987,24 +4032,22 @@ export {
|
|
|
3987
4032
|
RewardVaultDistributionMode,
|
|
3988
4033
|
getRewardVaultRewards,
|
|
3989
4034
|
getBgtAprSimulation,
|
|
3990
|
-
getBgtIncentiveDistributorPaused,
|
|
3991
4035
|
getEarnedStakedBeraVault,
|
|
3992
4036
|
getGlobalData,
|
|
3993
4037
|
getMarkets,
|
|
3994
|
-
getRewardProofsByValidator,
|
|
3995
4038
|
getRewardTokenToBeraRate,
|
|
3996
4039
|
getRewardVault,
|
|
3997
4040
|
getRewardVaultEarnedRewards,
|
|
3998
4041
|
getRewardVaultIncentives,
|
|
3999
4042
|
getRewardVaultStakingToken,
|
|
4000
4043
|
getRewardVaults,
|
|
4001
|
-
|
|
4044
|
+
getStakedBeraAPY,
|
|
4045
|
+
StakeSnapshotRange,
|
|
4002
4046
|
getStakedBeraSnapshots,
|
|
4003
4047
|
getStakeWithdrawalCooldown,
|
|
4004
4048
|
getSWBeraVaultMetadata,
|
|
4005
4049
|
getSWBeraWithdrawal,
|
|
4006
4050
|
getTotalStakedAmount,
|
|
4007
|
-
getUserClaimableIncentives,
|
|
4008
4051
|
getUserVaultInfo,
|
|
4009
4052
|
getUserVaults,
|
|
4010
4053
|
getVaultHistory,
|
|
@@ -4019,11 +4062,16 @@ export {
|
|
|
4019
4062
|
formatValidatorRewardAllocation,
|
|
4020
4063
|
isSameRewardAllocation,
|
|
4021
4064
|
getValidatorRewardAllocation,
|
|
4065
|
+
isDefaultRewardAllocation,
|
|
4066
|
+
getDefaultRewardAllocation,
|
|
4022
4067
|
getStakingPoolBatch,
|
|
4068
|
+
getUserBoosts,
|
|
4023
4069
|
getUserBoostsOnValidator,
|
|
4070
|
+
getUserActiveValidatorsApi,
|
|
4071
|
+
getUserActiveValidatorsOnChain,
|
|
4072
|
+
mergeUserActiveValidators,
|
|
4024
4073
|
getUserActiveValidators,
|
|
4025
4074
|
getUserStakingPositions,
|
|
4026
|
-
getValidatorAnalytics,
|
|
4027
4075
|
getValidatorCommission,
|
|
4028
4076
|
getValidatorEstimatedBgtPerYear,
|
|
4029
4077
|
getValidatorOperatorAddress,
|
|
@@ -4031,4 +4079,4 @@ export {
|
|
|
4031
4079
|
getValidatorQueuedOperatorAddress,
|
|
4032
4080
|
getValidatorQueuedRewardAllocation
|
|
4033
4081
|
};
|
|
4034
|
-
//# sourceMappingURL=chunk-
|
|
4082
|
+
//# sourceMappingURL=chunk-KY7JMIIS.mjs.map
|