@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
|
@@ -17,82 +17,144 @@ export type ValidatorWithUserBoost = ApiValidatorInListFragment & {
|
|
|
17
17
|
userBoosts: UserBoostsOnValidator;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
export
|
|
20
|
+
export type UserValidatorsApiData = ApiValidatorInListFragment[];
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Fetches the API-side data for a user's boosted validators: the list of
|
|
24
|
+
* validator IDs the user has boosted (from the boosts API) and the validator
|
|
25
|
+
* info for each. On-chain boost amounts are fetched separately by
|
|
26
|
+
* {@link getUserActiveValidatorsOnChain} so the two can refresh independently.
|
|
27
|
+
*/
|
|
28
|
+
export async function getUserActiveValidatorsApi({
|
|
21
29
|
account,
|
|
22
|
-
publicClient,
|
|
23
30
|
chain,
|
|
24
31
|
...args
|
|
25
32
|
}: {
|
|
26
33
|
account: string;
|
|
27
|
-
publicClient: PublicClient | undefined;
|
|
28
34
|
chain?: GqlChain;
|
|
29
|
-
} & BeraJS.BaseFunctionArgs): Promise<
|
|
35
|
+
} & BeraJS.BaseFunctionArgs): Promise<UserValidatorsApiData> {
|
|
30
36
|
const { config } = parseBaseArgs(args);
|
|
31
37
|
const resolvedChain = chain ?? (config.bex.chainName as GqlChain);
|
|
32
38
|
|
|
33
39
|
const userBoosts = await getUserBoosts({ account });
|
|
34
40
|
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
(t) => t.validatorId,
|
|
42
|
-
),
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
}),
|
|
46
|
-
Promise.all(
|
|
47
|
-
userBoosts.data.polGetValidatorBoosts.boosts
|
|
48
|
-
.filter(
|
|
49
|
-
(t) =>
|
|
50
|
-
// there's an edge case here where api doesn't return the pubkey
|
|
51
|
-
// because the user might have boosted a pubkey that doesn't exist
|
|
52
|
-
// api doesn't return the pubkey in this case, but we're choosing to filter them out
|
|
53
|
-
!!t.validator,
|
|
54
|
-
)
|
|
55
|
-
.map((t) =>
|
|
56
|
-
getUserBoostsOnValidator({
|
|
57
|
-
account: account as Address,
|
|
58
|
-
pubkey: t.validator!.pubkey,
|
|
59
|
-
publicClient: publicClient,
|
|
60
|
-
}),
|
|
41
|
+
const validatorInfoList = await getAllValidators({
|
|
42
|
+
variables: {
|
|
43
|
+
chain: resolvedChain,
|
|
44
|
+
where: {
|
|
45
|
+
idIn: userBoosts.data.polGetValidatorBoosts.boosts.map(
|
|
46
|
+
(t) => t.validatorId,
|
|
61
47
|
),
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
return validatorInfoList?.validators.validators ?? [];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Reads the on-chain boost amounts for each validator in the API data.
|
|
57
|
+
* Cheap to re-run on its own, which is what powers the hook's
|
|
58
|
+
* `refreshOnChain()`.
|
|
59
|
+
*/
|
|
60
|
+
export async function getUserActiveValidatorsOnChain({
|
|
61
|
+
account,
|
|
62
|
+
validators,
|
|
63
|
+
publicClient,
|
|
64
|
+
}: {
|
|
65
|
+
account: string;
|
|
66
|
+
validators: UserValidatorsApiData;
|
|
67
|
+
publicClient: PublicClient | undefined;
|
|
68
|
+
}): Promise<UserBoostsOnValidator[]> {
|
|
69
|
+
return await Promise.all(
|
|
70
|
+
validators.map((validator) =>
|
|
71
|
+
getUserBoostsOnValidator({
|
|
72
|
+
account: account as Address,
|
|
73
|
+
pubkey: validator.pubkey as Address,
|
|
74
|
+
publicClient,
|
|
75
|
+
}),
|
|
62
76
|
),
|
|
63
|
-
|
|
77
|
+
);
|
|
78
|
+
}
|
|
64
79
|
|
|
65
|
-
|
|
80
|
+
/**
|
|
81
|
+
* Merges API validator info with on-chain boost amounts into the shape widgets
|
|
82
|
+
* consume. Validators without a matching on-chain read are dropped (the API can
|
|
83
|
+
* return a pubkey that was never actually boosted on-chain).
|
|
84
|
+
*/
|
|
85
|
+
export function mergeUserActiveValidators({
|
|
86
|
+
validators,
|
|
87
|
+
onChainBoosts,
|
|
88
|
+
}: {
|
|
89
|
+
validators: UserValidatorsApiData;
|
|
90
|
+
onChainBoosts: UserBoostsOnValidator[];
|
|
91
|
+
}): ValidatorWithUserBoost[] {
|
|
92
|
+
return validators.flatMap((validator) => {
|
|
66
93
|
const userDeposited = onChainBoosts.find(
|
|
67
94
|
(data) => data.pubkey.toLowerCase() === validator.pubkey.toLowerCase(),
|
|
68
95
|
);
|
|
69
96
|
|
|
70
97
|
if (!userDeposited) {
|
|
71
|
-
|
|
98
|
+
// there's an edge case here where api doesn't return the pubkey
|
|
99
|
+
// because the user might have boosted a pubkey that doesn't exist
|
|
100
|
+
// api doesn't return the pubkey in this case, but we're choosing to
|
|
101
|
+
// filter them out
|
|
102
|
+
return [];
|
|
72
103
|
}
|
|
73
104
|
|
|
74
105
|
const droppableBoostAmount =
|
|
75
|
-
parseEther(userDeposited
|
|
76
|
-
parseEther(userDeposited
|
|
106
|
+
parseEther(userDeposited.activeBoostAmount ?? "0") -
|
|
107
|
+
parseEther(userDeposited.queuedDropBoostAmount);
|
|
77
108
|
|
|
78
|
-
return
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
109
|
+
return [
|
|
110
|
+
{
|
|
111
|
+
...validator,
|
|
112
|
+
userBoosts: {
|
|
113
|
+
pubkey: userDeposited.pubkey,
|
|
114
|
+
activeBoostAmount: userDeposited.activeBoostAmount,
|
|
115
|
+
queuedBoostAmount: userDeposited.queuedBoostAmount,
|
|
116
|
+
queuedBoostStartBlock: Number(userDeposited.queuedBoostStartBlock),
|
|
117
|
+
queuedDropBoostAmount: userDeposited.queuedDropBoostAmount,
|
|
118
|
+
queuedDropBoostStartBlock: Number(
|
|
119
|
+
userDeposited.queuedDropBoostStartBlock,
|
|
120
|
+
),
|
|
121
|
+
droppableBoostAmount: formatEther(droppableBoostAmount),
|
|
122
|
+
hasPendingBoosts:
|
|
123
|
+
Number(userDeposited.queuedBoostAmount) > 0 ||
|
|
124
|
+
Number(userDeposited.queuedDropBoostAmount) > 0,
|
|
125
|
+
hasActiveBoosts: Number(userDeposited.activeBoostAmount) > 0,
|
|
126
|
+
hasDroppableBoosts: droppableBoostAmount > 0n,
|
|
127
|
+
} satisfies UserBoostsOnValidator,
|
|
128
|
+
} satisfies ValidatorWithUserBoost,
|
|
129
|
+
];
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Fetches a user's boosted validators with their on-chain boost amounts.
|
|
135
|
+
* Combines the API query, on-chain query, and merge; the hook
|
|
136
|
+
* `useUserActiveValidators` splits these so it can refresh the on-chain part
|
|
137
|
+
* alone.
|
|
138
|
+
*/
|
|
139
|
+
export async function getUserActiveValidators({
|
|
140
|
+
account,
|
|
141
|
+
publicClient,
|
|
142
|
+
chain,
|
|
143
|
+
...args
|
|
144
|
+
}: {
|
|
145
|
+
account: string;
|
|
146
|
+
publicClient: PublicClient | undefined;
|
|
147
|
+
chain?: GqlChain;
|
|
148
|
+
} & BeraJS.BaseFunctionArgs): Promise<ValidatorWithUserBoost[]> {
|
|
149
|
+
const validators = await getUserActiveValidatorsApi({
|
|
150
|
+
account,
|
|
151
|
+
chain,
|
|
152
|
+
...args,
|
|
153
|
+
});
|
|
154
|
+
const onChainBoosts = await getUserActiveValidatorsOnChain({
|
|
155
|
+
account,
|
|
156
|
+
validators,
|
|
157
|
+
publicClient,
|
|
97
158
|
});
|
|
159
|
+
return mergeUserActiveValidators({ validators, onChainBoosts });
|
|
98
160
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
2
|
|
|
3
|
-
import type { ValidatorIncentivesResponse } from "@berachain/graphql/beep";
|
|
4
|
-
|
|
5
3
|
import { BeraError } from "../../errors/BeraError";
|
|
4
|
+
import type { ValidatorIncentivesResponse } from "../../generated/beep";
|
|
6
5
|
import { calculateTimestampFromDays } from "../../utils/formatTimestamps";
|
|
7
6
|
import { fetchBeep } from "../clients/fetchBeep";
|
|
8
7
|
|
|
@@ -3,6 +3,7 @@ import type { Address, PublicClient } from "viem";
|
|
|
3
3
|
import { beraChefAbi } from "@berachain/abis/pol/rewards/beraChef";
|
|
4
4
|
|
|
5
5
|
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
6
|
+
import { isDefaultRewardAllocation } from "./getDefaultRewardAllocation";
|
|
6
7
|
|
|
7
8
|
export interface ValidatorRewardAllocationRaw {
|
|
8
9
|
startBlock: bigint;
|
|
@@ -86,6 +87,11 @@ export async function getValidatorRewardAllocation({
|
|
|
86
87
|
*/
|
|
87
88
|
isBaseline: boolean;
|
|
88
89
|
|
|
90
|
+
/**
|
|
91
|
+
* Whether the reward allocation is the default reward allocation.
|
|
92
|
+
*/
|
|
93
|
+
isDefault: boolean;
|
|
94
|
+
|
|
89
95
|
isNeverSet: boolean;
|
|
90
96
|
}> {
|
|
91
97
|
const { config } = parseBaseArgs(args);
|
|
@@ -132,9 +138,13 @@ export async function getValidatorRewardAllocation({
|
|
|
132
138
|
Number(lastRaUpdateSet.timestamp),
|
|
133
139
|
);
|
|
134
140
|
|
|
141
|
+
const isDefault = isDefaultRewardAllocation(activeRewardAllocation);
|
|
142
|
+
|
|
135
143
|
let isBaseline = false;
|
|
136
144
|
|
|
137
|
-
if (
|
|
145
|
+
if (isDefault) {
|
|
146
|
+
isBaseline = false;
|
|
147
|
+
} else if (setRewardAllocation.start.blockNumber === 0) {
|
|
138
148
|
// the validator has never set the reward allocation
|
|
139
149
|
isBaseline = true;
|
|
140
150
|
} else {
|
|
@@ -150,6 +160,7 @@ export async function getValidatorRewardAllocation({
|
|
|
150
160
|
activeRewardAllocation: activeRewardAllocation,
|
|
151
161
|
setRewardAllocation,
|
|
152
162
|
isBaseline,
|
|
163
|
+
isDefault,
|
|
153
164
|
isNeverSet: setRewardAllocation?.start.blockNumber === 0,
|
|
154
165
|
};
|
|
155
166
|
} catch (e) {
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { createContext, useContext } from "react";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
type EdgeConfigSchema,
|
|
5
|
-
isFlagEnabled,
|
|
6
|
-
} from "@berachain/config/internal/edge-config";
|
|
3
|
+
import { type EdgeConfigSchema, isFlagEnabled } from "@berachain/edge-config";
|
|
7
4
|
|
|
8
5
|
import { type BeraFlags, defaultFlags } from "./defaultFlags";
|
|
9
6
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { flags } from "@berachain/config/
|
|
1
|
+
import type { flags } from "@berachain/edge-config/flags";
|
|
2
2
|
|
|
3
3
|
type ClientSideFlags = keyof typeof flags;
|
|
4
4
|
|
|
@@ -19,7 +19,6 @@ export type BeraFlags = Record<
|
|
|
19
19
|
| "isZapStakeBeraEnabled"
|
|
20
20
|
| "mockValidatorOperator"
|
|
21
21
|
| "mockValidatorRewardAllocator"
|
|
22
|
-
| "isBgtPolRewardToken"
|
|
23
22
|
| "mockRewardDurationManager"
|
|
24
23
|
| "mockIncentiveManager"
|
|
25
24
|
| "isHoneyPythWrapperEnabled"
|
|
@@ -43,7 +42,6 @@ export const defaultFlags: BeraFlags = {
|
|
|
43
42
|
isZapStakeBeraEnabled: false,
|
|
44
43
|
mockValidatorOperator: false,
|
|
45
44
|
mockValidatorRewardAllocator: false,
|
|
46
|
-
isBgtPolRewardToken: true,
|
|
47
45
|
mockRewardDurationManager: false,
|
|
48
46
|
mockIncentiveManager: false,
|
|
49
47
|
isHoneyPythWrapperEnabled: true,
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from "react";
|
|
9
9
|
import type { Hex } from "viem";
|
|
10
10
|
|
|
11
|
-
import type { EdgeConfigSchema } from "@berachain/
|
|
11
|
+
import type { EdgeConfigSchema } from "@berachain/edge-config";
|
|
12
12
|
|
|
13
13
|
import { BeraError } from "../errors/BeraError";
|
|
14
14
|
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { createContext, type PropsWithChildren, useMemo } from "react";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
type EdgeConfigSchema,
|
|
5
|
-
isFlagEnabled,
|
|
6
|
-
} from "@berachain/config/internal/edge-config";
|
|
3
|
+
import { type EdgeConfigSchema, isFlagEnabled } from "@berachain/edge-config";
|
|
7
4
|
|
|
8
5
|
import { useEnsoUserTokensWithBalances } from "../hooks/enso/useEnsoUserTokensWithBalances";
|
|
9
6
|
import type { BalanceToken, Token, TokenWithMetadata } from "../types/dex";
|
package/src/enum/contracts.ts
CHANGED
|
@@ -8,7 +8,10 @@ export enum ContractName {
|
|
|
8
8
|
BEX_POOL = "bex.pool",
|
|
9
9
|
ERC20 = "others.erc20",
|
|
10
10
|
ERC4626 = "others.erc4626",
|
|
11
|
+
POL_BGT = "pol.bgt",
|
|
11
12
|
POL_STAKE_VAULT = "pol.stakeVault",
|
|
13
|
+
INFRARED_IBGT_VAULT = "infrared.ibgtVault",
|
|
14
|
+
INFRARED_IBGT_REDEEMER = "infrared.ibgtRedeemer",
|
|
12
15
|
BEX_EXPLOITED_FUND_DISTRIBUTOR = "bex.exploitedFundDistributor",
|
|
13
16
|
TW_MINIMAL_ACCOUNT = "thirdweb.minimalAccount",
|
|
14
17
|
}
|
package/src/enum/txnEnum.ts
CHANGED
|
@@ -41,7 +41,7 @@ export enum TransactionActionType {
|
|
|
41
41
|
RESET_REWARD_MODE = "Reset Reward Mode",
|
|
42
42
|
CREATE_BRIBE = "Add Incentives",
|
|
43
43
|
CLAIMING_BRIBES = "Claiming Incentives", // claiming others
|
|
44
|
-
CLAIMING_REWARDS = "Claiming
|
|
44
|
+
CLAIMING_REWARDS = "Claiming BERA",
|
|
45
45
|
CLAIM_ALL_REWARDS = "Claim All Rewards",
|
|
46
46
|
|
|
47
47
|
RECOVER_FUNDS = "Recover Bex Funds",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { WaitForTransactionReceiptTimeoutError } from "viem";
|
|
1
2
|
import { describe, expect, it } from "vitest";
|
|
2
3
|
|
|
3
4
|
import { BeraError } from "./BeraError.js";
|
|
@@ -69,3 +70,25 @@ describe("BeraError JSON-RPC code classification", () => {
|
|
|
69
70
|
expect(err.level).toBe("fatal");
|
|
70
71
|
});
|
|
71
72
|
});
|
|
73
|
+
|
|
74
|
+
// The transaction store (transactionStore.ts) pins a stable Sentry fingerprint
|
|
75
|
+
// on receipt timeouts by keying off exactly this reason string (HUB-97H/HUB-981
|
|
76
|
+
// grouping). If the pipeline ever stops deriving it, that grouping silently
|
|
77
|
+
// breaks — so lock the contract here.
|
|
78
|
+
describe("BeraError reason — receipt timeout fingerprint contract", () => {
|
|
79
|
+
it("derives WaitForTransactionReceiptTimeoutError from viem's timeout error", () => {
|
|
80
|
+
const err = new BeraError({
|
|
81
|
+
cause: new WaitForTransactionReceiptTimeoutError({ hash: "0xdeadbeef" }),
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
expect(err.reason).toBe("WaitForTransactionReceiptTimeoutError");
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it("does not derive that reason for an unrelated transaction error", () => {
|
|
88
|
+
const err = new BeraError({
|
|
89
|
+
cause: { code: 4001, message: "User rejected the request." },
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
expect(err.reason).not.toBe("WaitForTransactionReceiptTimeoutError");
|
|
93
|
+
});
|
|
94
|
+
});
|
|
@@ -20,6 +20,27 @@ export class RequestError extends BeraError {
|
|
|
20
20
|
static isCorsError(error: Error) {
|
|
21
21
|
return error.cause instanceof Response && error.cause.type === "cors";
|
|
22
22
|
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Matches the standard error messages browsers produce when fetch fails due
|
|
26
|
+
* to a network or CORS error, as empirically collected from Sentry. The
|
|
27
|
+
* trailing "(host)" suffix is our own annotation and optional: bare fetch
|
|
28
|
+
* TypeErrors are just "Failed to fetch" / "Load failed".
|
|
29
|
+
*/
|
|
30
|
+
private static readonly NETWORK_ERROR_MESSAGE_REGEX =
|
|
31
|
+
/^(?:NetworkError when attempting to fetch resource\.|Failed to fetch|Load failed)(?: \(([a-z0-9-.]+)\))?$/;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Whether a message is a browser fetch network-failure message. Used to tell
|
|
35
|
+
* genuine network TypeErrors apart from ordinary TypeErrors (which must NOT
|
|
36
|
+
* be grouped as network errors — see sentryBeforeSend).
|
|
37
|
+
*/
|
|
38
|
+
static isNetworkErrorMessage(message: string): boolean {
|
|
39
|
+
return (
|
|
40
|
+
message.startsWith("Network Error") ||
|
|
41
|
+
RequestError.NETWORK_ERROR_MESSAGE_REGEX.test(message)
|
|
42
|
+
);
|
|
43
|
+
}
|
|
23
44
|
/**
|
|
24
45
|
* The endpoint that was requested.
|
|
25
46
|
*/
|
|
@@ -153,6 +174,19 @@ export class RequestError extends BeraError {
|
|
|
153
174
|
this.message = `${message}${endpointLabel}: ${this.message}`;
|
|
154
175
|
}
|
|
155
176
|
|
|
177
|
+
/**
|
|
178
|
+
* The hostname of the requested endpoint (e.g. "beep.berachain.com"), used to
|
|
179
|
+
* group network errors by domain in Sentry. Falls back to the full url for
|
|
180
|
+
* relative/malformed urls that have no parseable host.
|
|
181
|
+
*/
|
|
182
|
+
get host(): string {
|
|
183
|
+
try {
|
|
184
|
+
return new URL(this.endpoint.url).hostname;
|
|
185
|
+
} catch {
|
|
186
|
+
return this.endpoint.url;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
156
190
|
setEndpoint(
|
|
157
191
|
endpoint:
|
|
158
192
|
| string
|
|
@@ -175,6 +209,14 @@ export class RequestError extends BeraError {
|
|
|
175
209
|
};
|
|
176
210
|
}
|
|
177
211
|
|
|
212
|
+
// Redact 40-hex addresses in the path (e.g. /wallets/0x…/autoclaimed) so
|
|
213
|
+
// per-wallet urls collapse to one Sentry fingerprint. Mirrors the span-url
|
|
214
|
+
// redaction in beraFetch; the error message/title is built from this url.
|
|
215
|
+
this.endpoint.url = this.endpoint.url.replace(
|
|
216
|
+
/0x[a-fA-F0-9]{40}/g,
|
|
217
|
+
":address",
|
|
218
|
+
);
|
|
219
|
+
|
|
178
220
|
if (
|
|
179
221
|
this.queryRichfulDomains.some((domain) =>
|
|
180
222
|
this.endpoint.url.includes(getUriFromLink(domain)),
|
|
@@ -223,16 +265,11 @@ export class RequestError extends BeraError {
|
|
|
223
265
|
};
|
|
224
266
|
}
|
|
225
267
|
|
|
226
|
-
//
|
|
227
|
-
//
|
|
228
|
-
//
|
|
229
|
-
// the list is empirically collected from sentry error logs.
|
|
230
|
-
// The trailing "(host)" suffix is optional: some browsers/transports omit
|
|
231
|
-
// it (e.g. bare "Failed to fetch" / "Load failed"). We normalize all of
|
|
232
|
-
// them to a single NETWORK_ERROR reason so the variants group together,
|
|
233
|
-
// falling back to the endpoint url when no host is present in the message.
|
|
268
|
+
// We normalize all fetch network-failure variants to a single
|
|
269
|
+
// NETWORK_ERROR reason so they group together, falling back to the
|
|
270
|
+
// endpoint url when no host is present in the message.
|
|
234
271
|
const failedToFetchMatch = message.match(
|
|
235
|
-
|
|
272
|
+
RequestError.NETWORK_ERROR_MESSAGE_REGEX,
|
|
236
273
|
);
|
|
237
274
|
if (failedToFetchMatch) {
|
|
238
275
|
return {
|
|
@@ -24,6 +24,27 @@ describe("RequestError endpoint normalization (grouping)", () => {
|
|
|
24
24
|
expect(b.endpoint.url).toBe(base);
|
|
25
25
|
expect(a.endpoint.url).toBe(b.endpoint.url);
|
|
26
26
|
});
|
|
27
|
+
|
|
28
|
+
it("redacts wallet addresses in the path so per-wallet urls group together (HUB-A8T)", () => {
|
|
29
|
+
function mk(addr: string) {
|
|
30
|
+
return new RequestError({
|
|
31
|
+
response: undefined,
|
|
32
|
+
statusCode: 500,
|
|
33
|
+
endpoint: {
|
|
34
|
+
url: `https://api-claim.berachain.com/api/v1/wallets/${addr}/autoclaimed/txhash`,
|
|
35
|
+
type: "rest",
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
const a = mk("0x9675b119c6907a1d17b4ad9ec14f03d3c4435635");
|
|
40
|
+
const b = mk("0x1111111111111111111111111111111111111111");
|
|
41
|
+
|
|
42
|
+
const expected =
|
|
43
|
+
"https://api-claim.berachain.com/api/v1/wallets/:address/autoclaimed/txhash";
|
|
44
|
+
expect(a.endpoint.url).toBe(expected);
|
|
45
|
+
expect(a.message).toBe(b.message);
|
|
46
|
+
expect(a.host).toBe("api-claim.berachain.com");
|
|
47
|
+
});
|
|
27
48
|
});
|
|
28
49
|
|
|
29
50
|
describe("RequestError network-error normalization (grouping)", () => {
|
|
@@ -52,6 +73,39 @@ describe("RequestError network-error normalization (grouping)", () => {
|
|
|
52
73
|
|
|
53
74
|
expect(err.reason).not.toBe(RequestError.REASON_MAP.NETWORK_ERROR);
|
|
54
75
|
});
|
|
76
|
+
|
|
77
|
+
it("groups network errors by host regardless of path/query (HONEY-1AH)", () => {
|
|
78
|
+
const a = new RequestError({
|
|
79
|
+
response: undefined,
|
|
80
|
+
cause: new TypeError("Failed to fetch"),
|
|
81
|
+
endpoint: {
|
|
82
|
+
url: "https://beep.berachain.com/v1/honey/balances",
|
|
83
|
+
type: "rest",
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
const b = new RequestError({
|
|
87
|
+
response: undefined,
|
|
88
|
+
cause: new TypeError("Failed to fetch"),
|
|
89
|
+
endpoint: {
|
|
90
|
+
url: "https://beep.berachain.com/v1/bonders?start=2025-11-28",
|
|
91
|
+
type: "rest",
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
expect(a.host).toBe("beep.berachain.com");
|
|
96
|
+
expect(a.host).toBe(b.host);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it("falls back to the raw url for a relative/malformed endpoint", () => {
|
|
100
|
+
const err = new RequestError({
|
|
101
|
+
response: undefined,
|
|
102
|
+
endpoint: { url: "/api/internal/foo", type: "rest" },
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
// No parseable host on a relative url → fall back to the url itself so the
|
|
106
|
+
// fingerprint stays stable rather than throwing.
|
|
107
|
+
expect(err.host).toBe("/api/internal/foo");
|
|
108
|
+
});
|
|
55
109
|
});
|
|
56
110
|
|
|
57
111
|
describe("RequestError NO_SWAP_PATHS leveling", () => {
|
package/src/errors/errorMap.ts
CHANGED
|
@@ -108,10 +108,15 @@ export const errorMsgMap = {
|
|
|
108
108
|
errorMSG:
|
|
109
109
|
"It seems an RPC error has occurred. Please try your request one more later.",
|
|
110
110
|
},
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
// Tx was broadcast but we timed out waiting for the receipt (RPC lag / dropped
|
|
112
|
+
// tx). Match on viem's error name (exact reason) — NOT a bare "hash" keyword,
|
|
113
|
+
// which used to match any message mentioning a tx/block/typehash and dumped
|
|
114
|
+
// unrelated errors into one meaningless "HASH" group (HUB-A9T).
|
|
115
|
+
TRANSACTION_TIMEOUT: {
|
|
116
|
+
reasons: ["WaitForTransactionReceiptTimeoutError"],
|
|
117
|
+
keywords: ["Timed out while waiting for transaction with hash"],
|
|
113
118
|
errorMSG:
|
|
114
|
-
"
|
|
119
|
+
"Transaction sent, but we couldn't confirm it in time. Check your wallet — if it didn't go through, try again.",
|
|
115
120
|
},
|
|
116
121
|
USER_REJECTION: {
|
|
117
122
|
reasons: ["UserRejectedRequestError"],
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
|
|
3
|
+
import { findMatchingError } from "./getErrorMessage.js";
|
|
4
|
+
|
|
5
|
+
describe("findMatchingError — transaction timeout (HUB-A9T)", () => {
|
|
6
|
+
const timeoutMessage =
|
|
7
|
+
'Timed out while waiting for transaction with hash "0x18160719ceffa85166d389a3a075ca081e8925b69d6e73884af01082421d124b" to be confirmed.';
|
|
8
|
+
|
|
9
|
+
it("matches viem's timeout error name via exact reason", () => {
|
|
10
|
+
const matched = findMatchingError({
|
|
11
|
+
reason: "WaitForTransactionReceiptTimeoutError",
|
|
12
|
+
message: timeoutMessage,
|
|
13
|
+
});
|
|
14
|
+
expect(matched?.key).toBe("TRANSACTION_TIMEOUT");
|
|
15
|
+
expect(matched?.matchedByReason).toBe(true);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("still matches the timeout by message keyword when reason is absent", () => {
|
|
19
|
+
const matched = findMatchingError({ message: timeoutMessage });
|
|
20
|
+
expect(matched?.key).toBe("TRANSACTION_TIMEOUT");
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it("no longer misfiles unrelated hash-mentioning errors into a HASH bucket", () => {
|
|
24
|
+
// Regression: the old `keywords: ["hash"]` entry swallowed any message
|
|
25
|
+
// containing "hash" (tx hash, block hash, typehash, …).
|
|
26
|
+
const matched = findMatchingError({
|
|
27
|
+
message: "invalid domain separator typehash for permit signature",
|
|
28
|
+
});
|
|
29
|
+
expect(matched?.key).not.toBe("HASH");
|
|
30
|
+
expect(matched?.key).not.toBe("TRANSACTION_TIMEOUT");
|
|
31
|
+
});
|
|
32
|
+
});
|