@berachain/berajs 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BeraError-D1HS_rbb.d.cts → BeraError-_mQdkanr.d.cts} +35 -10
- package/dist/{BeraError-D1HS_rbb.d.ts → BeraError-_mQdkanr.d.ts} +35 -10
- package/dist/HoneyConfigProvider-CK6mOKFH.d.ts +390 -0
- package/dist/HoneyConfigProvider-Ca3ouozs.d.cts +390 -0
- package/dist/{RequestError-D8AE6xnI.d.cts → RequestError-A8XJ6QR9.d.cts} +1 -1
- package/dist/{RequestError-m4jxyM7D.d.ts → RequestError-Dk97z8rm.d.ts} +1 -1
- package/dist/abi/exports.cjs +2 -0
- package/dist/abi/exports.cjs.map +1 -0
- package/dist/abi/{index.d.cts → exports.d.cts} +12369 -9122
- package/dist/abi/{index.d.ts → exports.d.ts} +12369 -9122
- package/dist/abi/exports.mjs +2 -0
- package/dist/abi/exports.mjs.map +1 -0
- package/dist/actions/exports.cjs +2 -0
- package/dist/actions/exports.cjs.map +1 -0
- package/dist/actions/{index.d.cts → exports.d.cts} +80 -107
- package/dist/actions/{index.d.ts → exports.d.ts} +80 -107
- package/dist/actions/exports.mjs +2 -0
- package/dist/actions/exports.mjs.map +1 -0
- package/dist/chunk-575OK77P.mjs +2 -0
- package/dist/chunk-575OK77P.mjs.map +1 -0
- package/dist/chunk-7GWTHOLO.mjs +2 -0
- package/dist/chunk-7GWTHOLO.mjs.map +1 -0
- package/dist/chunk-7SC4VD3U.cjs +2 -0
- package/dist/chunk-7SC4VD3U.cjs.map +1 -0
- package/dist/chunk-BHNQX4XC.mjs +2 -0
- package/dist/chunk-BHNQX4XC.mjs.map +1 -0
- package/dist/chunk-BOYZVULX.cjs +2 -0
- package/dist/chunk-BOYZVULX.cjs.map +1 -0
- package/dist/chunk-C3FHGFLK.mjs +2 -0
- package/dist/chunk-C3FHGFLK.mjs.map +1 -0
- package/dist/chunk-C3G5KXCH.mjs +2 -0
- package/dist/chunk-C3G5KXCH.mjs.map +1 -0
- package/dist/chunk-CYKCYPFR.cjs +2 -0
- package/dist/chunk-CYKCYPFR.cjs.map +1 -0
- package/dist/chunk-F4BKSBEM.mjs +2 -0
- package/dist/chunk-F4BKSBEM.mjs.map +1 -0
- package/dist/chunk-FL2N3XHK.cjs +2 -0
- package/dist/chunk-FL2N3XHK.cjs.map +1 -0
- package/dist/chunk-G6NA6NSM.mjs +4 -0
- package/dist/chunk-G6NA6NSM.mjs.map +1 -0
- package/dist/chunk-H2QSRMVS.mjs +2 -0
- package/dist/chunk-H2QSRMVS.mjs.map +1 -0
- package/dist/chunk-IJM76AWK.cjs +4 -0
- package/dist/chunk-IJM76AWK.cjs.map +1 -0
- package/dist/chunk-MTS5SZLA.mjs +2 -0
- package/dist/chunk-MTS5SZLA.mjs.map +1 -0
- package/dist/chunk-MUNAP5TM.cjs +2 -0
- package/dist/chunk-MUNAP5TM.cjs.map +1 -0
- package/dist/chunk-NAXAZJJY.mjs +2 -0
- package/dist/chunk-NAXAZJJY.mjs.map +1 -0
- package/dist/chunk-OGJMSGB2.mjs +2 -0
- package/dist/chunk-OGJMSGB2.mjs.map +1 -0
- package/dist/chunk-OIYXOKTT.cjs +2 -0
- package/dist/chunk-OIYXOKTT.cjs.map +1 -0
- package/dist/chunk-OS5AJMYJ.cjs +2 -0
- package/dist/chunk-OS5AJMYJ.cjs.map +1 -0
- package/dist/chunk-Q3SCM6WL.mjs +2 -0
- package/dist/chunk-Q3SCM6WL.mjs.map +1 -0
- package/dist/chunk-SWMJQOH6.cjs +2 -0
- package/dist/chunk-SWMJQOH6.cjs.map +1 -0
- package/dist/chunk-TEBJWAVU.mjs +2 -0
- package/dist/chunk-TEBJWAVU.mjs.map +1 -0
- package/dist/chunk-TJWKS54T.mjs +2 -0
- package/dist/chunk-TJWKS54T.mjs.map +1 -0
- package/dist/chunk-UQUWMHVF.cjs +2 -0
- package/dist/chunk-UQUWMHVF.cjs.map +1 -0
- package/dist/chunk-UXUWSRVV.cjs +2 -0
- package/dist/chunk-UXUWSRVV.cjs.map +1 -0
- package/dist/chunk-VP7XUOSI.cjs +2 -0
- package/dist/chunk-VP7XUOSI.cjs.map +1 -0
- package/dist/chunk-VXL2ZZ4X.cjs +2 -0
- package/dist/chunk-VXL2ZZ4X.cjs.map +1 -0
- package/dist/chunk-WRFDB3QJ.cjs +2 -0
- package/dist/chunk-WRFDB3QJ.cjs.map +1 -0
- package/dist/chunk-WTCBORPB.cjs +2 -0
- package/dist/chunk-WTCBORPB.cjs.map +1 -0
- package/dist/chunk-XNJLSA6P.cjs +2 -0
- package/dist/chunk-XNJLSA6P.cjs.map +1 -0
- package/dist/chunk-YQGZMWDT.mjs +2 -0
- package/dist/chunk-YQGZMWDT.mjs.map +1 -0
- package/dist/chunk-YXLFOEZN.mjs +2 -0
- package/dist/chunk-YXLFOEZN.mjs.map +1 -0
- package/dist/chunk-ZAKA4TGK.cjs +2 -0
- package/dist/chunk-ZAKA4TGK.cjs.map +1 -0
- package/dist/chunk-ZQRACIGR.mjs +2 -0
- package/dist/chunk-ZQRACIGR.mjs.map +1 -0
- package/dist/contexts/exports.cjs +2 -0
- package/dist/contexts/exports.cjs.map +1 -0
- package/dist/contexts/{index.d.ts → exports.d.cts} +19 -28
- package/dist/contexts/{index.d.cts → exports.d.ts} +19 -28
- package/dist/contexts/exports.mjs +2 -0
- package/dist/contexts/exports.mjs.map +1 -0
- package/dist/contracts-CQIPk0Jc.d.cts +74 -0
- package/dist/contracts-CQIPk0Jc.d.ts +74 -0
- package/dist/{defaultFlags-V-tJs2K8.d.cts → defaultFlags-d0kPbT0i.d.cts} +1 -1
- package/dist/{defaultFlags-V-tJs2K8.d.ts → defaultFlags-d0kPbT0i.d.ts} +1 -1
- package/dist/dex-C_BB0b0O.d.cts +37 -0
- package/dist/dex-C_BB0b0O.d.ts +37 -0
- package/dist/enum/exports.cjs +2 -0
- package/dist/enum/exports.cjs.map +1 -0
- package/dist/enum/exports.d.cts +24 -0
- package/dist/enum/exports.d.ts +24 -0
- package/dist/enum/exports.mjs +2 -0
- package/dist/enum/exports.mjs.map +1 -0
- package/dist/errors/exports.cjs +2 -0
- package/dist/errors/exports.cjs.map +1 -0
- package/dist/errors/exports.d.cts +385 -0
- package/dist/errors/exports.d.ts +385 -0
- package/dist/errors/exports.mjs +2 -0
- package/dist/{getValidatorQueuedOperatorAddress-9xY2RUGe.d.cts → getValidatorQueuedOperatorAddress-BX35p2Lv.d.ts} +125 -15
- package/dist/{getValidatorQueuedOperatorAddress-Ne2zoiiV.d.ts → getValidatorQueuedOperatorAddress-It0GsdvQ.d.cts} +125 -15
- package/dist/global.d-Ba-NIojH.d.cts +474 -0
- package/dist/global.d-By70bEv2.d.ts +474 -0
- package/dist/honey-CYm0RWf4.d.cts +14 -0
- package/dist/honey-CYm0RWf4.d.ts +14 -0
- package/dist/hooks/exports.cjs +4 -0
- package/dist/hooks/exports.cjs.map +1 -0
- package/dist/hooks/{index.d.cts → exports.d.cts} +223 -173
- package/dist/hooks/{index.d.ts → exports.d.ts} +223 -173
- package/dist/hooks/exports.mjs +4 -0
- package/dist/hooks/exports.mjs.map +1 -0
- package/dist/{BexStatusProvider-nS3NcdxI.d.cts → transactionStore-BvStaXf3.d.ts} +41 -1
- package/dist/{BexStatusProvider-nS3NcdxI.d.ts → transactionStore-CQrGYSY2.d.cts} +41 -1
- package/dist/{txnEnum-BQKDfaeH.d.cts → txnEnum-BYNbCxla.d.cts} +1 -0
- package/dist/{txnEnum-BQKDfaeH.d.ts → txnEnum-BYNbCxla.d.ts} +1 -0
- package/dist/types/exports.cjs +1 -0
- package/dist/types/exports.cjs.map +1 -0
- package/dist/types/exports.d.cts +58 -0
- package/dist/types/exports.d.ts +58 -0
- package/dist/types/exports.mjs +1 -0
- package/dist/{useHoneySwapState-C-9BV4VB.d.cts → useHoneySwapState-B-vmIP1b.d.cts} +1 -1
- package/dist/{useHoneySwapState-CUY5Sm1b.d.ts → useHoneySwapState-D1DKG_Of.d.ts} +1 -1
- package/dist/utils/exports.cjs +2 -0
- package/dist/utils/exports.cjs.map +1 -0
- package/dist/utils/{index.d.cts → exports.d.cts} +83 -20
- package/dist/utils/{index.d.ts → exports.d.ts} +83 -20
- package/dist/utils/exports.mjs +2 -0
- package/dist/utils/exports.mjs.map +1 -0
- package/package.json +16 -17
- package/src/abi/{index.ts → exports.ts} +3 -0
- package/src/abi/pol/LSTStakerVault.ts +2032 -0
- package/src/abi/utils/openChainErrors.ts +71 -30
- package/src/abi/utils/thirdwebMinimalAccount.ts +616 -0
- package/src/actions/clients/BeraApolloClient.ts +8 -6
- package/src/actions/dex/__tests__/aggregators.unit.test.ts +2 -5
- package/src/actions/dex/aggregators/base.ts +74 -16
- package/src/actions/dex/aggregators/bex.ts +54 -74
- package/src/actions/dex/aggregators/bgt.ts +31 -8
- package/src/actions/dex/aggregators/{enso.ts → enso/enso.ts} +18 -14
- package/src/actions/dex/aggregators/enso/ensoErc4626.debug.test.ts +37 -0
- package/src/actions/dex/aggregators/enso/ensoErc4626.ts +176 -0
- package/src/actions/dex/aggregators/erc4626.ts +122 -0
- package/src/actions/dex/aggregators/fly.ts +59 -53
- package/src/actions/dex/aggregators/haiku.ts +52 -54
- package/src/actions/dex/aggregators/honey.ts +54 -45
- package/src/actions/dex/aggregators/kyberswap.ts +41 -39
- package/src/actions/dex/aggregators/oogabooga.ts +47 -46
- package/src/actions/dex/aggregators/openOcean.ts +51 -46
- package/src/actions/dex/aggregators/wbera.ts +54 -42
- package/src/actions/dex/b-sdk.ts +5 -2
- package/src/actions/dex/getIsTokenExploited.ts +2 -2
- package/src/actions/enso/{zap.ts → getEnsoSwapBundle.ts} +4 -5
- package/src/actions/enso/getEnsoUserTokensWithBalances.debug.test.ts +73 -0
- package/src/actions/enso/{getEnsoUserToken.ts → getEnsoUserTokensWithBalances.ts} +42 -30
- package/src/actions/enso/util.ts +1 -1
- package/src/actions/{index.ts → exports.ts} +5 -0
- package/src/actions/governance/__tests__/checkProposalField.unit.test.ts +1 -1
- package/src/actions/governance/__tests__/getQuorum.integration.test.ts +1 -1
- package/src/actions/governance/checkProposalField.ts +1 -1
- package/src/actions/governance/computeActualStatus.ts +1 -1
- package/src/actions/governance/getBodyErrors.ts +1 -1
- package/src/actions/governance/getDecodedFunctionData.ts +1 -4
- package/src/actions/governance/getProposalDetails.ts +2 -2
- package/src/actions/governance/getProposalFromTx.ts +1 -2
- package/src/actions/governance/getProposalParams.ts +7 -8
- package/src/actions/governance/getQuorum.ts +1 -2
- package/src/actions/honey/getCollateralWeights.ts +1 -1
- package/src/actions/honey/getHoneyCollaterals.ts +1 -0
- package/src/actions/honey/getHoneyVaultsBalance.ts +51 -55
- package/src/actions/honey/getSwapPayload.ts +37 -35
- package/src/actions/honey/tests/pyth.integration.test.ts +0 -1
- package/src/actions/pol/__tests__/getAllValidators.integration.test.ts +1 -1
- package/src/actions/pol/getEarnedStakedBeraVault.ts +31 -0
- package/src/actions/pol/getGlobalData.ts +14 -13
- package/src/actions/pol/getLSTStakeConfig.ts +67 -0
- package/src/actions/pol/getMarkets.ts +1 -1
- package/src/actions/pol/getRewardProofsByValidator.ts +1 -1
- package/src/actions/pol/getRewardVaultIncentives.ts +3 -5
- package/src/actions/pol/getRewardVaults.ts +2 -3
- package/src/actions/pol/getSWBeraVaultMetadata.ts +7 -5
- package/src/actions/pol/getSWBeraWithdrawal.ts +41 -27
- package/src/actions/pol/getStakeWithdrawalCooldown.ts +5 -7
- package/src/actions/pol/getStakingDailyAssets.ts +21 -0
- package/src/actions/pol/getStakingTokenInformation.ts +3 -4
- package/src/actions/pol/getTotalStakedAmount.ts +47 -0
- package/src/actions/pol/getUserClaimableIncentives.ts +1 -1
- package/src/actions/pol/getUserVaults.ts +8 -6
- package/src/actions/pol/getUserVaultsBalance.ts +4 -16
- package/src/actions/prices/getTokenCurrentPrices.ts +8 -3
- package/src/actions/tokens/getAllowances.ts +68 -41
- package/src/actions/tokens/getTokenInformation.ts +4 -1
- package/src/actions/tokens/getTokens.ts +1 -1
- package/src/actions/tokens/getUnderlyingToken.ts +53 -0
- package/src/actions/tokens/getWalletBalances.integration.test.ts +53 -14
- package/src/actions/tokens/getWalletBalances.ts +69 -43
- package/src/actions/transactions/beraWriteContract.integration.test.ts +18 -6
- package/src/actions/transactions/beraWriteContract.ts +3 -3
- package/src/actions/validators/getUserActiveValidators.ts +2 -3
- package/src/actions/validators/getUserBoostsOnValidator.ts +2 -3
- package/src/contexts/BeraFlags/defaultFlags.ts +4 -0
- package/src/contexts/SwrFallback.tsx +13 -3
- package/src/contexts/TokensProvider.tsx +35 -8
- package/src/{hooks/transactions → contexts}/TransactionStoreContext.tsx +32 -4
- package/src/contexts/block-time-provider.tsx +1 -1
- package/src/contexts/{index.ts → exports.ts} +1 -1
- package/src/data/contracts.ts +16 -1
- package/src/enum/contracts.ts +13 -0
- package/src/enum/dex.ts +29 -0
- package/src/enum/{index.ts → exports.ts} +3 -0
- package/src/enum/governance.ts +61 -0
- package/src/enum/honey.ts +12 -0
- package/src/enum/txnEnum.ts +1 -0
- package/src/errors/BeraError.ts +50 -11
- package/src/errors/BeraMonitoring.ts +66 -0
- package/src/errors/BeraTracing.ts +79 -0
- package/src/errors/BeraTracing.unit.test.ts +198 -0
- package/src/errors/RequestError.ts +2 -2
- package/src/errors/assert.ts +4 -2
- package/src/errors/assert.unit.test.ts +6 -2
- package/src/errors/errorMap.ts +16 -6
- package/src/errors/{index.ts → exports.ts} +7 -0
- package/src/errors/getErrorMessage.ts +22 -3
- package/src/errors/getRevertReason.integration.test.ts +17 -5
- package/src/errors/getRevertReason.ts +41 -2
- package/src/errors/initBeraError.ts +52 -7
- package/src/errors/parseViemError.ts +114 -27
- package/src/errors/severity.ts +12 -0
- package/src/hooks/bend/useGetConvertToAssets.ts +3 -2
- package/src/hooks/dex/useAggregatorsQuotes.ts +126 -365
- package/src/hooks/dex/useAllUserPools.ts +1 -1
- package/src/hooks/dex/useApiPool.ts +1 -1
- package/src/hooks/dex/useCreatePool.ts +6 -5
- package/src/hooks/dex/useExploitedTokens.ts +1 -1
- package/src/hooks/dex/useLiquidityMismatch.ts +2 -5
- package/src/hooks/dex/useLpPosition.ts +21 -20
- package/src/hooks/dex/useMultipleTokenApprovalsWithSlippage.ts +40 -29
- package/src/hooks/dex/usePollPoolCreationRelayerApproval.ts +1 -1
- package/src/hooks/dex/usePoolEvents.ts +1 -1
- package/src/hooks/dex/usePools.ts +1 -1
- package/src/hooks/dex/usePriceImpact.ts +40 -0
- package/src/hooks/dex/useSingleAggregatorQuote.ts +350 -0
- package/src/hooks/enso/useBendZapSupply.ts +216 -0
- package/src/hooks/enso/useEnsoSwapBundle.ts +107 -0
- package/src/hooks/enso/useEnsoUserTokensWithBalances.ts +43 -0
- package/src/hooks/enso/useZapStakeBera.ts +113 -0
- package/src/hooks/{index.ts → exports.ts} +18 -7
- package/src/hooks/governance/useCreateProposal.ts +8 -8
- package/src/hooks/governance/usePollAllProposals.ts +1 -1
- package/src/hooks/governance/usePollProposal.ts +1 -1
- package/src/hooks/governance/usePollProposalThreshold.ts +1 -1
- package/src/hooks/governance/usePollUserDelegates.ts +1 -1
- package/src/hooks/governance/useProposalState.ts +2 -2
- package/src/hooks/honey/useCappedGlobally.ts +2 -1
- package/src/hooks/honey/useCappedRelatively.ts +1 -1
- package/src/hooks/honey/useCollateralWeights.ts +2 -1
- package/src/hooks/honey/useHoneyAlerts.ts +11 -11
- package/src/hooks/honey/useHoneyBalances.ts +7 -3
- package/src/hooks/honey/useHoneyGlobalData.ts +2 -1
- package/src/hooks/honey/useHoneySwapState.ts +2 -1
- package/src/hooks/honey/useHoneyVaultsBalance.ts +1 -1
- package/src/hooks/honey/useIsBadCollateralAsset.ts +2 -1
- package/src/hooks/honey/useIsBasketModeEnabled.ts +1 -1
- package/src/hooks/honey/usePythLatestPrices.ts +1 -1
- package/src/hooks/pol/useOnChainRewardVault.ts +3 -2
- package/src/hooks/pol/usePollGlobalData.ts +1 -1
- package/src/hooks/pol/usePollMarkets.ts +1 -1
- package/src/hooks/pol/useQueuedBeraUnlock.ts +17 -15
- package/src/hooks/pol/useRewardTokenToBeraRate.ts +6 -3
- package/src/hooks/pol/useRewardVault.ts +1 -1
- package/src/hooks/pol/useRewardVaults.ts +1 -1
- package/src/hooks/pol/useSWBeraVaultMetadata.ts +35 -0
- package/src/hooks/pol/useStakedAPR.ts +38 -0
- package/src/hooks/pol/useStakedData.ts +117 -0
- package/src/hooks/pol/useStakedSnapshots.ts +52 -0
- package/src/hooks/pol/useTotalStakedAmount.ts +30 -0
- package/src/hooks/pol/useUserVaultInfo.ts +1 -1
- package/src/hooks/pol/useVaultValidators.ts +1 -1
- package/src/hooks/tokens/useMultipleTokenInformation.ts +15 -6
- package/src/hooks/tokens/usePollAllowances.ts +15 -19
- package/src/hooks/tokens/usePollBalance.ts +8 -4
- package/src/hooks/tokens/usePollWalletBalances.ts +14 -11
- package/src/hooks/tokens/useStakingTokenInformation.ts +2 -1
- package/src/hooks/tokens/useTokenCurrentPrice.ts +4 -2
- package/src/hooks/tokens/useTokenCurrentPrices.ts +92 -13
- package/src/hooks/tokens/useTokenInformation.ts +11 -6
- package/src/hooks/tokens/useTokenPrice.ts +21 -0
- package/src/hooks/tokens/useTokenPrices.ts +133 -0
- package/src/hooks/tokens/useTokens.ts +1 -0
- package/src/hooks/tokens/useUnderlyingAsset.ts +23 -0
- package/src/hooks/transactions/transactionStore.ts +86 -65
- package/src/hooks/transactions/transactionStore.unit.test.ts +54 -1
- package/src/hooks/transactions/useAddRecentTransaction.ts +1 -1
- package/src/hooks/transactions/useRecentTransactions.ts +1 -1
- package/src/hooks/transactions/useSetTransactionStatus.ts +31 -0
- package/src/hooks/useContractWrite/useBeraContractWrite.ts +2 -1
- package/src/hooks/validators/useAllValidators.ts +1 -1
- package/src/hooks/validators/useApiValidator.ts +1 -1
- package/src/hooks/validators/useDailyValidatorBlockStats.ts +1 -1
- package/src/hooks/validators/useManagedValidatorByAccount.ts +1 -1
- package/src/hooks/validators/useManagedValidatorRole.ts +1 -1
- package/src/hooks/validators/useOnChainValidator.ts +1 -1
- package/src/hooks/validators/useStakingPoolBatch.ts +1 -1
- package/src/hooks/validators/useUserActiveValidators.ts +1 -1
- package/src/hooks/validators/useUserBoostsOnValidator.ts +1 -1
- package/src/hooks/validators/useUserClaimableIncentives.ts +8 -8
- package/src/hooks/validators/useValidator.ts +1 -1
- package/src/hooks/validators/useValidatorAnalytics.ts +1 -1
- package/src/hooks/validators/useValidatorCommission.ts +1 -1
- package/src/hooks/validators/useValidatorQueuedCommission.ts +1 -1
- package/src/hooks/validators/useValidatorQueuedOperatorAddress.ts +1 -1
- package/src/hooks/validators/useValidatorQueuedRewardAllocation.ts +1 -1
- package/src/hooks/validators/useValidatorRewardAllocation.ts +1 -1
- package/src/types/{dex.ts → dex.d.ts} +96 -67
- package/src/types/{enso.ts → enso.d.ts} +1 -1
- package/src/types/exports.ts +8 -0
- package/src/types/{global.ts → global.d.ts} +1 -30
- package/src/types/{governance.ts → governance.d.ts} +2 -64
- package/src/types/{honeySwap.ts → honeySwap.d.ts} +1 -13
- package/src/types/{pol.ts → pol.d.ts} +12 -1
- package/src/types/staking.d.ts +22 -0
- package/src/utils/createEmitter.ts +122 -0
- package/src/utils/createEmitter.unit.test.ts +149 -0
- package/src/utils/{index.ts → exports.ts} +3 -2
- package/src/utils/filter.ts +34 -0
- package/src/utils/formatNumber.ts +1 -1
- package/src/utils/formatNumber.unit.test.ts +2 -1
- package/src/utils/formatTokenList.ts +4 -10
- package/src/utils/getHoneySwapMessage.test.ts +1 -2
- package/src/utils/getServerSideClient.ts +4 -5
- package/src/utils/isDifferenceExceedingThreshold.ts +1 -1
- package/src/utils/layerZeroScan.ts +122 -0
- package/src/utils/math.ts +1 -1
- package/src/utils/parseWhiskToken.ts +15 -0
- package/src/utils/poolNamings.ts +1 -1
- package/src/utils/tokens.ts +23 -7
- package/dist/HoneyConfigProvider-6PXZJMSU.d.cts +0 -562
- package/dist/HoneyConfigProvider-CwDFrt02.d.ts +0 -562
- package/dist/abi/index.cjs +0 -2
- package/dist/abi/index.cjs.map +0 -1
- package/dist/abi/index.mjs +0 -2
- package/dist/actions/index.cjs +0 -2
- package/dist/actions/index.cjs.map +0 -1
- package/dist/actions/index.mjs +0 -2
- package/dist/aggregatorsRouter-Cny4B_MB.d.cts +0 -593
- package/dist/aggregatorsRouter-Cny4B_MB.d.ts +0 -593
- package/dist/chunk-22MQVFHP.cjs +0 -2
- package/dist/chunk-22MQVFHP.cjs.map +0 -1
- package/dist/chunk-3TKSVFZ3.mjs +0 -2
- package/dist/chunk-3TKSVFZ3.mjs.map +0 -1
- package/dist/chunk-6VF3RF53.cjs +0 -3
- package/dist/chunk-6VF3RF53.cjs.map +0 -1
- package/dist/chunk-6W22TFYA.mjs +0 -2
- package/dist/chunk-6W22TFYA.mjs.map +0 -1
- package/dist/chunk-AMRJ4B36.mjs +0 -2
- package/dist/chunk-AMRJ4B36.mjs.map +0 -1
- package/dist/chunk-DS2ZDVKU.mjs +0 -2
- package/dist/chunk-DS2ZDVKU.mjs.map +0 -1
- package/dist/chunk-ED43NYSE.cjs +0 -2
- package/dist/chunk-ED43NYSE.cjs.map +0 -1
- package/dist/chunk-EU4WFADK.cjs +0 -2
- package/dist/chunk-EU4WFADK.cjs.map +0 -1
- package/dist/chunk-HCTFDGXL.mjs +0 -2
- package/dist/chunk-HCTFDGXL.mjs.map +0 -1
- package/dist/chunk-IOSYBHKU.mjs +0 -2
- package/dist/chunk-IOSYBHKU.mjs.map +0 -1
- package/dist/chunk-JMKLDDKY.cjs +0 -2
- package/dist/chunk-JMKLDDKY.cjs.map +0 -1
- package/dist/chunk-KMKUXP2S.mjs +0 -3
- package/dist/chunk-KMKUXP2S.mjs.map +0 -1
- package/dist/chunk-OJXJ6CZ4.mjs +0 -4
- package/dist/chunk-OJXJ6CZ4.mjs.map +0 -1
- package/dist/chunk-PHIOKO3A.mjs +0 -2
- package/dist/chunk-PHIOKO3A.mjs.map +0 -1
- package/dist/chunk-QCK474XD.cjs +0 -2
- package/dist/chunk-QCK474XD.cjs.map +0 -1
- package/dist/chunk-REDXXUK7.cjs +0 -2
- package/dist/chunk-REDXXUK7.cjs.map +0 -1
- package/dist/chunk-S74ZMG2G.cjs +0 -2
- package/dist/chunk-S74ZMG2G.cjs.map +0 -1
- package/dist/chunk-TOAXF4YW.cjs +0 -2
- package/dist/chunk-TOAXF4YW.cjs.map +0 -1
- package/dist/chunk-UZ5CB33M.cjs +0 -2
- package/dist/chunk-UZ5CB33M.cjs.map +0 -1
- package/dist/chunk-VYWYJR63.mjs +0 -2
- package/dist/chunk-VYWYJR63.mjs.map +0 -1
- package/dist/chunk-XFPTQMAK.cjs +0 -4
- package/dist/chunk-XFPTQMAK.cjs.map +0 -1
- package/dist/chunk-YK4NINF5.mjs +0 -2
- package/dist/chunk-YK4NINF5.mjs.map +0 -1
- package/dist/contexts/index.cjs +0 -2
- package/dist/contexts/index.cjs.map +0 -1
- package/dist/contexts/index.mjs +0 -2
- package/dist/contexts/index.mjs.map +0 -1
- package/dist/enum/index.cjs +0 -2
- package/dist/enum/index.cjs.map +0 -1
- package/dist/enum/index.d.cts +0 -31
- package/dist/enum/index.d.ts +0 -31
- package/dist/enum/index.mjs +0 -2
- package/dist/enum/index.mjs.map +0 -1
- package/dist/errors/index.cjs +0 -2
- package/dist/errors/index.cjs.map +0 -1
- package/dist/errors/index.d.cts +0 -204
- package/dist/errors/index.d.ts +0 -204
- package/dist/errors/index.mjs +0 -2
- package/dist/errors/index.mjs.map +0 -1
- package/dist/hooks/index.cjs +0 -4
- package/dist/hooks/index.cjs.map +0 -1
- package/dist/hooks/index.mjs +0 -4
- package/dist/hooks/index.mjs.map +0 -1
- package/dist/staking-F9Nx9TKD.d.ts +0 -246
- package/dist/staking-f4BpYH7l.d.cts +0 -246
- package/dist/types/index.cjs +0 -2
- package/dist/types/index.cjs.map +0 -1
- package/dist/types/index.d.cts +0 -56
- package/dist/types/index.d.ts +0 -56
- package/dist/types/index.mjs +0 -2
- package/dist/types/index.mjs.map +0 -1
- package/dist/utils/index.cjs +0 -2
- package/dist/utils/index.cjs.map +0 -1
- package/dist/utils/index.mjs +0 -2
- package/dist/utils/index.mjs.map +0 -1
- package/src/actions/dex/getTransactionCount.ts +0 -29
- package/src/actions/enso/bend.ts +0 -143
- package/src/actions/enso/getEnsoUserToken.debug.test.ts +0 -57
- package/src/contexts/berajsProvider/context.tsx +0 -49
- package/src/contexts/berajsProvider/index.ts +0 -2
- package/src/contexts/berajsProvider/useBeraJs.ts +0 -18
- package/src/hooks/dex/usePollVaultIsPaused.ts +0 -30
- package/src/hooks/enso/useBendTransactionRequests.ts +0 -247
- package/src/hooks/enso/useEnsoZap.ts +0 -166
- package/src/hooks/enso/useZapTransactionRequests.ts +0 -81
- package/src/hooks/pol/useEarnedStakedBeraVault.ts +0 -59
- package/src/hooks/pol/useStakedBeraSnapshots.ts +0 -27
- package/src/hooks/validators/validatorRoleManager.ts +0 -0
- package/src/types/index.ts +0 -8
- package/src/types/staking.ts +0 -7
- package/src/utils/formatAggregatorsQuotes.ts +0 -57
- package/src/utils/formatAggregatorsQuotes.unit.test.ts +0 -191
- package/src/utils/sentryBeforeSend.ts +0 -52
- /package/dist/{abi/index.mjs.map → errors/exports.mjs.map} +0 -0
- /package/dist/{actions/index.mjs.map → types/exports.mjs.map} +0 -0
- /package/src/actions/dex/{__tests__ → aggregators}/haiku.integration.test.ts +0 -0
- /package/src/types/{bribe-boost.ts → bribe-boost.d.ts} +0 -0
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { type Config, getPublicClient } from "@wagmi/core";
|
|
2
2
|
import type { Address } from "viem";
|
|
3
3
|
|
|
4
|
-
import type { TransactionActionType } from "~/enum";
|
|
4
|
+
import type { TransactionActionType } from "~/enum/txnEnum";
|
|
5
|
+
import { BeraMonitoring } from "~/errors/BeraMonitoring";
|
|
6
|
+
import { InvalidArgumentError } from "~/errors/InvalidArgumentError";
|
|
7
|
+
import { initBeraError } from "~/errors/initBeraError";
|
|
5
8
|
|
|
6
9
|
const storageKeyLegacy = "rk-transactions";
|
|
7
10
|
const storageKey = "transactions";
|
|
8
11
|
|
|
9
|
-
type TransactionStatus = "pending" | "confirmed" | "failed";
|
|
12
|
+
export type TransactionStatus = "pending" | "confirmed" | "failed";
|
|
10
13
|
|
|
11
14
|
export interface Transaction {
|
|
12
15
|
hash: string;
|
|
@@ -105,17 +108,21 @@ function loadData(): Data {
|
|
|
105
108
|
|
|
106
109
|
const transactionHashRegex = /^0x([A-Fa-f0-9]{64})$/;
|
|
107
110
|
|
|
108
|
-
function validateTransaction(
|
|
109
|
-
transaction: Transaction | NewTransaction,
|
|
110
|
-
): string[] {
|
|
111
|
-
const errors: string[] = [];
|
|
112
|
-
|
|
111
|
+
function validateTransaction(transaction: Transaction | NewTransaction): void {
|
|
113
112
|
if (!transactionHashRegex.test(transaction.hash)) {
|
|
114
|
-
|
|
113
|
+
throw new InvalidArgumentError({
|
|
114
|
+
property: "hash",
|
|
115
|
+
value: transaction.hash,
|
|
116
|
+
expected: "TransactionHash",
|
|
117
|
+
});
|
|
115
118
|
}
|
|
116
119
|
|
|
117
120
|
if (typeof transaction.description !== "string") {
|
|
118
|
-
|
|
121
|
+
throw new InvalidArgumentError({
|
|
122
|
+
property: "description",
|
|
123
|
+
value: transaction.description,
|
|
124
|
+
expected: "string",
|
|
125
|
+
});
|
|
119
126
|
}
|
|
120
127
|
|
|
121
128
|
if (
|
|
@@ -123,10 +130,12 @@ function validateTransaction(
|
|
|
123
130
|
(!Number.isInteger(transaction.confirmations) ||
|
|
124
131
|
transaction.confirmations < 1)
|
|
125
132
|
) {
|
|
126
|
-
|
|
133
|
+
throw new InvalidArgumentError({
|
|
134
|
+
property: "confirmations",
|
|
135
|
+
value: transaction.confirmations,
|
|
136
|
+
expected: "positive integer",
|
|
137
|
+
});
|
|
127
138
|
}
|
|
128
|
-
|
|
129
|
-
return errors;
|
|
130
139
|
}
|
|
131
140
|
|
|
132
141
|
export function createTransactionStore({ config }: { config: Config }) {
|
|
@@ -139,21 +148,23 @@ export function createTransactionStore({ config }: { config: Config }) {
|
|
|
139
148
|
}
|
|
140
149
|
|
|
141
150
|
function addTransaction(account: string, transaction: NewTransaction): void {
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
151
|
+
const normalized: Transaction = { ...transaction, status: "pending" };
|
|
152
|
+
|
|
153
|
+
try {
|
|
154
|
+
validateTransaction(normalized);
|
|
155
|
+
|
|
156
|
+
updateTransactions(account, (transactions) => {
|
|
157
|
+
return [
|
|
158
|
+
normalized,
|
|
159
|
+
...transactions.filter(({ hash }) => {
|
|
160
|
+
// Omit any duplicate transactions
|
|
161
|
+
return hash !== normalized.hash;
|
|
162
|
+
}),
|
|
163
|
+
];
|
|
164
|
+
});
|
|
165
|
+
} catch (error) {
|
|
166
|
+
BeraMonitoring.captureException(initBeraError({ cause: error }));
|
|
146
167
|
}
|
|
147
|
-
|
|
148
|
-
updateTransactions(account, (transactions) => {
|
|
149
|
-
return [
|
|
150
|
-
{ ...transaction, status: "pending" },
|
|
151
|
-
...transactions.filter(({ hash }) => {
|
|
152
|
-
// Omit any duplicate transactions
|
|
153
|
-
return hash !== transaction.hash;
|
|
154
|
-
}),
|
|
155
|
-
];
|
|
156
|
-
});
|
|
157
168
|
}
|
|
158
169
|
|
|
159
170
|
function clearTransactions(account: string): void {
|
|
@@ -174,43 +185,49 @@ export function createTransactionStore({ config }: { config: Config }) {
|
|
|
174
185
|
});
|
|
175
186
|
}
|
|
176
187
|
|
|
177
|
-
async function
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
.map(async (transaction) => {
|
|
182
|
-
const { confirmations, hash, chainId } = transaction;
|
|
183
|
-
|
|
184
|
-
const existingRequest = transactionRequestCache.get(hash);
|
|
185
|
-
|
|
186
|
-
if (existingRequest) {
|
|
187
|
-
return await existingRequest;
|
|
188
|
-
}
|
|
189
|
-
const provider = getPublicClient(config, { chainId });
|
|
190
|
-
if (!provider) {
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
const requestPromise = provider
|
|
195
|
-
.waitForTransactionReceipt({ confirmations, hash: hash as Address })
|
|
196
|
-
.then(({ status }) => {
|
|
197
|
-
transactionRequestCache.delete(hash);
|
|
198
|
-
|
|
199
|
-
if (status === undefined) {
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
setTransactionStatus(
|
|
204
|
-
account,
|
|
205
|
-
hash,
|
|
206
|
-
Number(status) === 0 ? "failed" : "confirmed",
|
|
207
|
-
);
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
transactionRequestCache.set(hash, requestPromise);
|
|
188
|
+
async function refreshPendingTransactions(account: string): Promise<void> {
|
|
189
|
+
const pendingTransactions = getTransactions(account).filter(
|
|
190
|
+
(transaction) => transaction.status === "pending",
|
|
191
|
+
);
|
|
211
192
|
|
|
212
|
-
|
|
213
|
-
|
|
193
|
+
await Promise.allSettled(
|
|
194
|
+
pendingTransactions.map(async (transaction) => {
|
|
195
|
+
const { confirmations, hash, chainId } = transaction;
|
|
196
|
+
const existingRequest = transactionRequestCache.get(hash);
|
|
197
|
+
|
|
198
|
+
if (existingRequest) {
|
|
199
|
+
return await existingRequest;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const provider = getPublicClient(config, { chainId });
|
|
203
|
+
if (!provider) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const requestPromise = provider
|
|
208
|
+
.waitForTransactionReceipt({ confirmations, hash: hash as Address })
|
|
209
|
+
.then(({ status }) => {
|
|
210
|
+
if (status === undefined) {
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
setTransactionStatus(
|
|
215
|
+
account,
|
|
216
|
+
hash,
|
|
217
|
+
Number(status) === 0 ? "failed" : "confirmed",
|
|
218
|
+
);
|
|
219
|
+
})
|
|
220
|
+
.catch((error) => {
|
|
221
|
+
BeraMonitoring.captureException(initBeraError({ cause: error }));
|
|
222
|
+
})
|
|
223
|
+
.finally(() => {
|
|
224
|
+
transactionRequestCache.delete(hash);
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
transactionRequestCache.set(hash, requestPromise);
|
|
228
|
+
|
|
229
|
+
return await requestPromise;
|
|
230
|
+
}),
|
|
214
231
|
);
|
|
215
232
|
}
|
|
216
233
|
|
|
@@ -240,12 +257,15 @@ export function createTransactionStore({ config }: { config: Config }) {
|
|
|
240
257
|
|
|
241
258
|
persistData();
|
|
242
259
|
notifyListeners();
|
|
243
|
-
waitForPendingTransactions(account);
|
|
244
260
|
}
|
|
245
261
|
|
|
246
262
|
function persistData(): void {
|
|
263
|
+
if (typeof localStorage === "undefined") {
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
|
|
247
267
|
localStorage.setItem(storageKey, JSON.stringify(data));
|
|
248
|
-
// remove legacy data
|
|
268
|
+
// remove legacy data now that it has been converted to the new data format and saved to the new key
|
|
249
269
|
localStorage.removeItem(storageKeyLegacy);
|
|
250
270
|
}
|
|
251
271
|
|
|
@@ -268,7 +288,8 @@ export function createTransactionStore({ config }: { config: Config }) {
|
|
|
268
288
|
clearTransactions,
|
|
269
289
|
getTransactions,
|
|
270
290
|
onChange,
|
|
271
|
-
|
|
291
|
+
refreshPendingTransactions,
|
|
292
|
+
setTransactionStatus,
|
|
272
293
|
};
|
|
273
294
|
}
|
|
274
295
|
|
|
@@ -1,12 +1,38 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Config } from "@wagmi/core";
|
|
2
|
+
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
3
|
|
|
3
4
|
import type { Data, DataLegacy, Transaction } from "./transactionStore";
|
|
4
5
|
import {
|
|
5
6
|
convertLegacyDataToNewData,
|
|
7
|
+
createTransactionStore,
|
|
6
8
|
filterDuplicatefn,
|
|
7
9
|
mergeData,
|
|
8
10
|
} from "./transactionStore";
|
|
9
11
|
|
|
12
|
+
const storage = new Map<string, string>();
|
|
13
|
+
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
storage.clear();
|
|
16
|
+
const localStorageMock: Storage = {
|
|
17
|
+
get length() {
|
|
18
|
+
return storage.size;
|
|
19
|
+
},
|
|
20
|
+
clear: vi.fn(() => {
|
|
21
|
+
storage.clear();
|
|
22
|
+
}),
|
|
23
|
+
getItem: vi.fn((key: string) => storage.get(key) ?? null),
|
|
24
|
+
key: vi.fn((index: number) => Array.from(storage.keys())[index] ?? null),
|
|
25
|
+
removeItem: vi.fn((key: string) => {
|
|
26
|
+
storage.delete(key);
|
|
27
|
+
}),
|
|
28
|
+
setItem: vi.fn((key: string, value: string) => {
|
|
29
|
+
storage.set(key, value);
|
|
30
|
+
}),
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
vi.stubGlobal("localStorage", localStorageMock);
|
|
34
|
+
});
|
|
35
|
+
|
|
10
36
|
describe("convertLegacyDataToNewData", () => {
|
|
11
37
|
it("should convert legacy nested data to flat array format", () => {
|
|
12
38
|
const legacyData: DataLegacy = {
|
|
@@ -506,3 +532,30 @@ describe("mergeData", () => {
|
|
|
506
532
|
expect(result["0xAccount1"]?.[0]?.description).toBe("First");
|
|
507
533
|
});
|
|
508
534
|
});
|
|
535
|
+
|
|
536
|
+
describe("createTransactionStore", () => {
|
|
537
|
+
it("adds transactions and updates status", () => {
|
|
538
|
+
const store = createTransactionStore({ config: {} as Config });
|
|
539
|
+
const account = "0xAccount1";
|
|
540
|
+
const hash =
|
|
541
|
+
"0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
|
|
542
|
+
|
|
543
|
+
store.addTransaction(account, {
|
|
544
|
+
hash,
|
|
545
|
+
description: "Submitted",
|
|
546
|
+
timestamp: 123,
|
|
547
|
+
chainId: 1,
|
|
548
|
+
});
|
|
549
|
+
|
|
550
|
+
expect(store.getTransactions(account)).toHaveLength(1);
|
|
551
|
+
expect(store.getTransactions(account)[0]?.status).toBe("pending");
|
|
552
|
+
|
|
553
|
+
store.setTransactionStatus(account, hash, "confirmed");
|
|
554
|
+
|
|
555
|
+
expect(store.getTransactions(account)[0]?.status).toBe("confirmed");
|
|
556
|
+
|
|
557
|
+
store.setTransactionStatus(account, hash, "failed");
|
|
558
|
+
|
|
559
|
+
expect(store.getTransactions(account)[0]?.status).toBe("failed");
|
|
560
|
+
});
|
|
561
|
+
});
|
|
@@ -3,7 +3,7 @@ import { useCallback } from "react";
|
|
|
3
3
|
import { useBeraWagmi } from "@berachain/wagmi/hooks";
|
|
4
4
|
|
|
5
5
|
import { InvalidArgumentError } from "~/errors/InvalidArgumentError";
|
|
6
|
-
import { useTransactionStore } from "
|
|
6
|
+
import { useTransactionStore } from "../../contexts/TransactionStoreContext";
|
|
7
7
|
import type { NewTransaction } from "./transactionStore";
|
|
8
8
|
|
|
9
9
|
export function useAddRecentTransaction(): (
|
|
@@ -2,7 +2,7 @@ import { useEffect, useState } from "react";
|
|
|
2
2
|
|
|
3
3
|
import { useBeraWallet } from "@berachain/wagmi/hooks";
|
|
4
4
|
|
|
5
|
-
import { useTransactionStore } from "
|
|
5
|
+
import { useTransactionStore } from "../../contexts/TransactionStoreContext";
|
|
6
6
|
import type { Transaction } from "./transactionStore";
|
|
7
7
|
|
|
8
8
|
export function useRecentTransactions(): Transaction[] {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
|
|
3
|
+
import { useBeraWagmi } from "@berachain/wagmi/hooks";
|
|
4
|
+
|
|
5
|
+
import { InvalidArgumentError } from "~/errors/InvalidArgumentError";
|
|
6
|
+
import { useTransactionStore } from "../../contexts/TransactionStoreContext";
|
|
7
|
+
import type { TransactionStatus } from "./transactionStore";
|
|
8
|
+
|
|
9
|
+
export function useSetTransactionStatus(): (
|
|
10
|
+
hash: string,
|
|
11
|
+
status: TransactionStatus,
|
|
12
|
+
) => void {
|
|
13
|
+
const store = useTransactionStore();
|
|
14
|
+
const { account } = useBeraWagmi();
|
|
15
|
+
const address = account?.wallet?.address;
|
|
16
|
+
|
|
17
|
+
return useCallback(
|
|
18
|
+
(hash: string, status: TransactionStatus) => {
|
|
19
|
+
if (!address) {
|
|
20
|
+
throw new InvalidArgumentError({
|
|
21
|
+
property: "address",
|
|
22
|
+
value: address,
|
|
23
|
+
expected: "Address",
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
store.setTransactionStatus(address, hash, status);
|
|
28
|
+
},
|
|
29
|
+
[store, address],
|
|
30
|
+
);
|
|
31
|
+
}
|
|
@@ -6,9 +6,10 @@ import { useBeraWagmi, useConfig } from "@berachain/wagmi/hooks";
|
|
|
6
6
|
import { beraWriteContract } from "~/actions/transactions/beraWriteContract";
|
|
7
7
|
import { useBeraFlag } from "~/contexts/BeraFlags/BeraFlags";
|
|
8
8
|
import { TransactionFailedError } from "~/errors/TransactionFailedError";
|
|
9
|
+
import type { IUseContractWriteArgs } from "~/hooks/useContractWrite/types";
|
|
9
10
|
import type { IContractWrite } from "~/types/global";
|
|
10
11
|
import { ActionEnum, initialState, reducer } from "./stateReducer";
|
|
11
|
-
import type {
|
|
12
|
+
import type { UseContractWriteApi } from "./types";
|
|
12
13
|
|
|
13
14
|
function useBeraContractWrite({
|
|
14
15
|
onlyPermissionless,
|
|
@@ -8,7 +8,7 @@ import type {
|
|
|
8
8
|
|
|
9
9
|
import { getAllValidators } from "~/actions/validators/getAllValidators";
|
|
10
10
|
import { POLLING } from "~/enum/polling";
|
|
11
|
-
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types";
|
|
11
|
+
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types/global";
|
|
12
12
|
import { parseBaseArgs } from "~/utils/parseBaseArgs";
|
|
13
13
|
|
|
14
14
|
export const useAllValidatorsQueryKey = ({
|
|
@@ -4,7 +4,7 @@ import { type Address, isHex } from "viem";
|
|
|
4
4
|
import type { GetValidatorQuery } from "@berachain/graphql/pol/api";
|
|
5
5
|
|
|
6
6
|
import { getApiValidator } from "~/actions/validators/getApiValidator";
|
|
7
|
-
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types";
|
|
7
|
+
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types/global";
|
|
8
8
|
|
|
9
9
|
export interface UsePollValidatorInfoResponse
|
|
10
10
|
extends DefaultHookReturnType<GetValidatorQuery> {}
|
|
@@ -5,7 +5,7 @@ import type { GetValidatorBlockStatsQuery } from "@berachain/graphql/pol/subgrap
|
|
|
5
5
|
|
|
6
6
|
import { getDailyValidatorBlockStats } from "~/actions/validators/getDailyValidatorBlockStats";
|
|
7
7
|
import { POLLING } from "~/enum/polling";
|
|
8
|
-
import type { DefaultHookReturnType } from "~/types";
|
|
8
|
+
import type { DefaultHookReturnType } from "~/types/global";
|
|
9
9
|
|
|
10
10
|
export const useDailyValidatorBlockStats = ({
|
|
11
11
|
pubKey,
|
|
@@ -2,7 +2,7 @@ import useSWRImmutable from "swr/immutable";
|
|
|
2
2
|
import type { Address } from "viem";
|
|
3
3
|
|
|
4
4
|
import { getManagedValidatorByAccount } from "~/actions/validators/getManagedValidatorByAccount";
|
|
5
|
-
import type { DefaultHookOptions } from "~/types";
|
|
5
|
+
import type { DefaultHookOptions } from "~/types/global";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Return the validators managed by the account
|
|
@@ -8,7 +8,7 @@ import { getValidatorOperatorAddress } from "~/actions/validators/getValidatorOp
|
|
|
8
8
|
import { getValidatorRewardAllocatorAddress } from "~/actions/validators/getValidatorRewardAllocatorAddress";
|
|
9
9
|
import { useBeraFlag } from "~/contexts/BeraFlags/BeraFlags";
|
|
10
10
|
import { assertPublicClient } from "~/errors/assert";
|
|
11
|
-
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types";
|
|
11
|
+
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types/global";
|
|
12
12
|
|
|
13
13
|
export type ManagedValidatorRole = {
|
|
14
14
|
operator: Address | null;
|
|
@@ -8,7 +8,7 @@ import { beaconDepositAbi } from "~/abi/pol/beaconDeposit";
|
|
|
8
8
|
import { beraChefAbi } from "~/abi/pol/beraChef";
|
|
9
9
|
import { bgtAbi } from "~/abi/pol/bgt";
|
|
10
10
|
import { assertPublicClient } from "~/errors/assert";
|
|
11
|
-
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types";
|
|
11
|
+
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types/global";
|
|
12
12
|
import { parseBaseArgs } from "~/utils/parseBaseArgs";
|
|
13
13
|
|
|
14
14
|
export const useOnChainValidator = (
|
|
@@ -6,7 +6,7 @@ import { usePublicClient } from "@berachain/wagmi/hooks";
|
|
|
6
6
|
import { getStakingPoolBatch } from "~/actions/validators/getStakingPoolBatch";
|
|
7
7
|
import { POLLING } from "~/enum/polling";
|
|
8
8
|
import { assertPublicClient } from "~/errors/assert";
|
|
9
|
-
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types";
|
|
9
|
+
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types/global";
|
|
10
10
|
|
|
11
11
|
export const useStakingPoolBatch = ({
|
|
12
12
|
valPubKey,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import { POLLING } from "~/enum/polling";
|
|
10
10
|
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types/global";
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
interface UseUserActiveValidatorsResponse
|
|
13
13
|
extends DefaultHookReturnType<ValidatorWithUserBoost[] | undefined> {}
|
|
14
14
|
|
|
15
15
|
export const useUserActiveValidators = (
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
type UserBoostsOnValidator,
|
|
9
9
|
} from "~/actions/validators/getUserBoostsOnValidator";
|
|
10
10
|
import { POLLING } from "~/enum/polling";
|
|
11
|
-
import type { DefaultHookReturnType } from "~/types";
|
|
11
|
+
import type { DefaultHookReturnType } from "~/types/global";
|
|
12
12
|
|
|
13
13
|
export const useUserBoostsOnValidator = ({
|
|
14
14
|
pubkey,
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { useCallback, useMemo } from "react";
|
|
2
|
-
import * as Sentry from "@sentry/nextjs";
|
|
3
2
|
import useSWR from "swr";
|
|
4
3
|
|
|
5
4
|
import { useBeraWallet } from "@berachain/wagmi/hooks";
|
|
6
5
|
|
|
7
6
|
import { getRewardProofsByValidator } from "~/actions/pol/getRewardProofsByValidator";
|
|
8
7
|
import { getUserClaimableIncentives } from "~/actions/pol/getUserClaimableIncentives";
|
|
9
|
-
import { POLLING } from "~/enum";
|
|
8
|
+
import { POLLING } from "~/enum/polling";
|
|
10
9
|
import { BeraError } from "~/errors/BeraError";
|
|
10
|
+
import { BeraMonitoring } from "~/errors/BeraMonitoring";
|
|
11
11
|
import { InvalidArgumentError } from "~/errors/InvalidArgumentError";
|
|
12
|
-
import type { BribeBoostRewardProof
|
|
12
|
+
import type { BribeBoostRewardProof } from "~/types/bribe-boost";
|
|
13
|
+
import type { DefaultHookReturnType } from "~/types/global";
|
|
13
14
|
import { formatIncentivesTokenMap } from "~/utils/formatIncentivesTokenMap";
|
|
14
|
-
|
|
15
|
+
|
|
16
|
+
interface UseUserClaimableIncentivesReturnType
|
|
15
17
|
extends DefaultHookReturnType<BribeBoostRewardProof[]> {
|
|
16
18
|
tokenMap?: Set<string> | undefined;
|
|
17
19
|
}
|
|
@@ -56,17 +58,15 @@ export const useUserClaimableIncentives =
|
|
|
56
58
|
|
|
57
59
|
// If the data is not an array, capture an error
|
|
58
60
|
if (!Array.isArray(allRewards)) {
|
|
59
|
-
|
|
61
|
+
BeraMonitoring.captureException(
|
|
60
62
|
new BeraError({
|
|
61
63
|
message: "Incorrect aggregated incentives data receieved.",
|
|
62
64
|
level: "error",
|
|
63
|
-
}),
|
|
64
|
-
{
|
|
65
65
|
extra: {
|
|
66
66
|
allRewards,
|
|
67
67
|
account: account,
|
|
68
68
|
},
|
|
69
|
-
},
|
|
69
|
+
}),
|
|
70
70
|
);
|
|
71
71
|
return undefined;
|
|
72
72
|
}
|
|
@@ -3,7 +3,7 @@ import { type Address, keccak256 } from "viem";
|
|
|
3
3
|
import type { GqlValidatorDynamicData } from "@berachain/graphql/dex/api";
|
|
4
4
|
import type { ApiValidatorFragment } from "@berachain/graphql/pol/api";
|
|
5
5
|
|
|
6
|
-
import type { DefaultHookOptions } from "~/types";
|
|
6
|
+
import type { DefaultHookOptions } from "~/types/global";
|
|
7
7
|
import { useApiValidator } from "./useApiValidator";
|
|
8
8
|
import { useOnChainValidator } from "./useOnChainValidator";
|
|
9
9
|
|
|
@@ -5,7 +5,7 @@ import type { GetValidatorAnalyticsQuery } from "@berachain/graphql/pol/subgraph
|
|
|
5
5
|
|
|
6
6
|
import { getValidatorAnalytics } from "~/actions/validators/getValidatorAnalytics";
|
|
7
7
|
import { POLLING } from "~/enum/polling";
|
|
8
|
-
import type { DefaultHookReturnType } from "~/types";
|
|
8
|
+
import type { DefaultHookReturnType } from "~/types/global";
|
|
9
9
|
|
|
10
10
|
export function useValidatorAnalytics({
|
|
11
11
|
pubkey,
|
|
@@ -4,7 +4,7 @@ import type { Address, PublicClient } from "viem";
|
|
|
4
4
|
import { usePublicClient } from "@berachain/wagmi/hooks";
|
|
5
5
|
|
|
6
6
|
import { getValidatorCommission } from "~/actions/validators/getValidatorCommission";
|
|
7
|
-
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types";
|
|
7
|
+
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types/global";
|
|
8
8
|
|
|
9
9
|
export const useValidatorCommission = (
|
|
10
10
|
pubKey: Address,
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
type ValidatorQueuedCommission,
|
|
9
9
|
} from "~/actions/validators/getValidatorQueuedCommission";
|
|
10
10
|
import { assertPublicClient } from "~/errors/assert";
|
|
11
|
-
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types";
|
|
11
|
+
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types/global";
|
|
12
12
|
|
|
13
13
|
export function useValidatorQueuedCommission(
|
|
14
14
|
pubKey: Address,
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
getValidatorQueuedOperatorAddress,
|
|
8
8
|
type ValidatorQueuedOperatorAddress,
|
|
9
9
|
} from "~/actions/validators/getValidatorQueuedOperatorAddress";
|
|
10
|
-
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types";
|
|
10
|
+
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types/global";
|
|
11
11
|
|
|
12
12
|
export const useValidatorQueuedOperatorAddress = (
|
|
13
13
|
pubKey: Address,
|
|
@@ -5,7 +5,7 @@ import { usePublicClient } from "@berachain/wagmi/hooks";
|
|
|
5
5
|
|
|
6
6
|
import { getValidatorQueuedRewardAllocation } from "~/actions/validators/getValidatorQueuedRewardAllocation";
|
|
7
7
|
import type { ValidatorRewardAllocation } from "~/actions/validators/getValidatorRewardAllocation";
|
|
8
|
-
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types";
|
|
8
|
+
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types/global";
|
|
9
9
|
|
|
10
10
|
export const useValidatorQueuedRewardAllocation = (
|
|
11
11
|
pubKey: Address,
|
|
@@ -4,7 +4,7 @@ import type { Address, PublicClient } from "viem";
|
|
|
4
4
|
import { usePublicClient } from "@berachain/wagmi/hooks";
|
|
5
5
|
|
|
6
6
|
import { getValidatorRewardAllocation } from "~/actions/validators/getValidatorRewardAllocation";
|
|
7
|
-
import type { DefaultHookOptions } from "~/types";
|
|
7
|
+
import type { DefaultHookOptions } from "~/types/global";
|
|
8
8
|
|
|
9
9
|
export function useValidatorRewardAllocation(
|
|
10
10
|
pubKey: Address,
|