@berachain/berajs 0.2.4 → 0.2.6-patch.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/README.md +0 -0
- package/dist/abi/exports.cjs +1 -1
- package/dist/abi/exports.cjs.map +1 -1
- package/dist/abi/exports.d.cts +17 -1
- package/dist/abi/exports.d.ts +17 -1
- package/dist/abi/exports.mjs +1 -1
- package/dist/abi/exports.mjs.map +1 -1
- package/dist/actions/exports.cjs +1 -1
- package/dist/actions/exports.cjs.map +1 -1
- package/dist/actions/exports.d.cts +9 -38
- package/dist/actions/exports.d.ts +9 -38
- package/dist/actions/exports.mjs +1 -1
- package/dist/actions/exports.mjs.map +1 -1
- package/dist/chunk-2YBHAMDV.cjs +2 -0
- package/dist/chunk-2YBHAMDV.cjs.map +1 -0
- package/dist/chunk-57RINXU6.cjs +2 -0
- package/dist/chunk-57RINXU6.cjs.map +1 -0
- package/dist/{chunk-AX2YQQFQ.mjs → chunk-74QD4JAH.mjs} +2 -2
- package/dist/chunk-74QD4JAH.mjs.map +1 -0
- package/dist/chunk-74WA35RI.cjs +2 -0
- package/dist/chunk-74WA35RI.cjs.map +1 -0
- package/dist/{chunk-7WRTK7RJ.mjs → chunk-BEKH5EYT.mjs} +2 -2
- package/dist/chunk-BEKH5EYT.mjs.map +1 -0
- package/dist/{chunk-FCWDGE62.cjs → chunk-CF3LFNXG.cjs} +2 -2
- package/dist/chunk-CF3LFNXG.cjs.map +1 -0
- package/dist/chunk-COMMLZ3O.mjs +2 -0
- package/dist/chunk-COMMLZ3O.mjs.map +1 -0
- package/dist/chunk-DDEQFR3M.cjs +2 -0
- package/dist/chunk-DDEQFR3M.cjs.map +1 -0
- package/dist/{chunk-6LDOG5RL.cjs → chunk-DK42F2ZM.cjs} +2 -2
- package/dist/chunk-DK42F2ZM.cjs.map +1 -0
- package/dist/{chunk-7SMWQ6SN.mjs → chunk-FM3WDBFH.mjs} +2 -2
- package/dist/chunk-FM3WDBFH.mjs.map +1 -0
- package/dist/chunk-HWOGQSNL.cjs +4 -0
- package/dist/chunk-HWOGQSNL.cjs.map +1 -0
- package/dist/chunk-I7M43BB4.cjs +2 -0
- package/dist/chunk-I7M43BB4.cjs.map +1 -0
- package/dist/chunk-IBJOI5SN.mjs +4 -0
- package/dist/chunk-IBJOI5SN.mjs.map +1 -0
- package/dist/chunk-IDFMLLDY.mjs +2 -0
- package/dist/chunk-IDFMLLDY.mjs.map +1 -0
- package/dist/{chunk-YZV5LKIP.cjs → chunk-LNVR4BW6.cjs} +2 -2
- package/dist/chunk-LNVR4BW6.cjs.map +1 -0
- package/dist/chunk-MJZHJFZO.mjs +2 -0
- package/dist/{chunk-YNO7BCCM.mjs.map → chunk-MJZHJFZO.mjs.map} +1 -1
- package/dist/chunk-MK5NS5B5.mjs +2 -0
- package/dist/chunk-MK5NS5B5.mjs.map +1 -0
- package/dist/{chunk-C6ZGUO4H.cjs → chunk-NMH7LHPW.cjs} +2 -2
- package/dist/chunk-NMH7LHPW.cjs.map +1 -0
- package/dist/chunk-NVHV2LDK.cjs +2 -0
- package/dist/chunk-NVHV2LDK.cjs.map +1 -0
- package/dist/chunk-OGBD5YOG.mjs +2 -0
- package/dist/chunk-OGBD5YOG.mjs.map +1 -0
- package/dist/chunk-OIYXOKTT.cjs.map +1 -1
- package/dist/chunk-OUD27MU7.cjs.map +1 -1
- package/dist/chunk-PLIH6KQM.mjs +2 -0
- package/dist/chunk-PLIH6KQM.mjs.map +1 -0
- package/dist/chunk-QRAIGQF2.mjs +2 -0
- package/dist/chunk-QRAIGQF2.mjs.map +1 -0
- package/dist/chunk-RWOICHRW.cjs +2 -0
- package/dist/chunk-RWOICHRW.cjs.map +1 -0
- package/dist/chunk-T5FSQ3YE.mjs +2 -0
- package/dist/chunk-T5FSQ3YE.mjs.map +1 -0
- package/dist/chunk-WRFDB3QJ.cjs.map +1 -1
- package/dist/chunk-XNJLSA6P.cjs.map +1 -1
- package/dist/contexts/exports.cjs +1 -1
- package/dist/contexts/exports.cjs.map +1 -1
- package/dist/contexts/exports.d.cts +1 -1
- package/dist/contexts/exports.d.ts +1 -1
- package/dist/contexts/exports.mjs +1 -1
- package/dist/contexts/exports.mjs.map +1 -1
- package/dist/{defaultFlags-d0kPbT0i.d.cts → defaultFlags-D6KfkTZx.d.cts} +1 -1
- package/dist/{defaultFlags-d0kPbT0i.d.ts → defaultFlags-D6KfkTZx.d.ts} +1 -1
- package/dist/enum/exports.cjs +1 -1
- package/dist/enum/exports.cjs.map +1 -1
- package/dist/enum/exports.d.cts +1 -1
- package/dist/enum/exports.d.ts +1 -1
- package/dist/enum/exports.mjs +1 -1
- package/dist/errors/exports.cjs +1 -1
- package/dist/errors/exports.cjs.map +1 -1
- package/dist/errors/exports.d.cts +8 -3
- package/dist/errors/exports.d.ts +8 -3
- package/dist/errors/exports.mjs +1 -1
- package/dist/{getValidatorQueuedOperatorAddress-DZgrPmZ2.d.cts → getValidatorQueuedOperatorAddress-BdDYHycN.d.cts} +15 -4
- package/dist/{getValidatorQueuedOperatorAddress-CqR6cyqC.d.ts → getValidatorQueuedOperatorAddress-CmiPJmsr.d.ts} +15 -4
- package/dist/{global.d-BeYWDreg.d.ts → global.d-3GQMgC9k.d.ts} +1 -1
- package/dist/{global.d-DghRxpHd.d.cts → global.d-CwT1Phzf.d.cts} +1 -1
- package/dist/hooks/exports.cjs +3 -3
- package/dist/hooks/exports.cjs.map +1 -1
- package/dist/hooks/exports.d.cts +54 -75
- package/dist/hooks/exports.d.ts +54 -75
- package/dist/hooks/exports.mjs +3 -3
- package/dist/hooks/exports.mjs.map +1 -1
- package/dist/{txnEnum-DxPRHSJt.d.cts → txnEnum-CCuQUFlh.d.cts} +7 -0
- package/dist/{txnEnum-DxPRHSJt.d.ts → txnEnum-CCuQUFlh.d.ts} +7 -0
- package/dist/types/exports.cjs.map +1 -1
- package/dist/types/exports.d.cts +37 -4
- package/dist/types/exports.d.ts +37 -4
- package/dist/utils/exports.cjs +1 -1
- package/dist/utils/exports.cjs.map +1 -1
- package/dist/utils/exports.d.cts +2 -2
- package/dist/utils/exports.d.ts +2 -2
- package/dist/utils/exports.mjs +1 -1
- package/dist/utils/exports.mjs.map +1 -1
- package/package.json +25 -25
- package/src/abi/enso/ensoWalletV2Factory.ts +9 -0
- package/src/abi/exports.ts +1 -0
- package/src/abi/pyth/pyth.ts +0 -0
- package/src/actions/clients/BeraApolloClient.ts +3 -3
- package/src/actions/clients/getApolloClient.ts +5 -5
- package/src/actions/clients/getEnsoClient.ts +1 -1
- package/src/actions/dex/__tests__/aggregators.unit.test.ts +3 -3
- package/src/actions/dex/__tests__/getOnChainPool.unit.test.ts +1 -1
- package/src/actions/dex/aggregators/base.ts +12 -8
- package/src/actions/dex/aggregators/bex.ts +8 -8
- package/src/actions/dex/aggregators/bgt.ts +4 -4
- package/src/actions/dex/aggregators/enso/enso.ts +28 -20
- package/src/actions/dex/aggregators/enso/ensoErc4626.debug.test.ts +1 -1
- package/src/actions/dex/aggregators/enso/ensoErc4626.ts +7 -4
- package/src/actions/dex/aggregators/erc4626.ts +10 -6
- package/src/actions/dex/aggregators/fly.ts +9 -5
- package/src/actions/dex/aggregators/haiku.integration.test.ts +3 -3
- package/src/actions/dex/aggregators/haiku.ts +9 -5
- package/src/actions/dex/aggregators/honey.ts +15 -15
- package/src/actions/dex/aggregators/kyberswap.ts +8 -4
- package/src/actions/dex/aggregators/oogabooga.ts +8 -4
- package/src/actions/dex/aggregators/openOcean.ts +12 -8
- package/src/actions/dex/aggregators/wbera.ts +8 -4
- package/src/actions/dex/b-sdk.ts +2 -2
- package/src/actions/dex/getAllPools.ts +2 -2
- package/src/actions/dex/getApiPool.ts +2 -2
- package/src/actions/dex/getGlobalLiquidityAndSwapVolume.ts +2 -2
- package/src/actions/dex/getIsTokenExploited.ts +1 -1
- package/src/actions/dex/getOnChainPool.ts +3 -3
- package/src/actions/dex/getPoolEvents.ts +2 -2
- package/src/actions/dex/getPoolHistoricalData.ts +2 -2
- package/src/actions/dex/getVaultPausedState.ts +1 -1
- package/src/actions/enso/__tests__/getBendDemultiplyBundle.action.unit.test.ts +175 -0
- package/src/actions/enso/__tests__/getBendDemultiplyBundle.unit.test.ts +150 -0
- package/src/actions/enso/__tests__/getBendMultiplyBundle.action.unit.test.ts +138 -0
- package/src/actions/enso/__tests__/getBendMultiplyBundle.unit.test.ts +194 -0
- package/src/actions/enso/{getEnsoUserTokensWithBalances.debug.test.ts → __tests__/getEnsoUserTokensWithBalances.debug.test.ts} +3 -3
- package/src/actions/enso/__tests__/helpers.ts +42 -0
- package/src/actions/enso/__tests__/util.unit.test.ts +95 -0
- package/src/actions/enso/flashloan.ts +127 -0
- package/src/actions/enso/getBendDemultiplyBundle.ts +325 -0
- package/src/actions/enso/getBendMultiplyBundle.ts +348 -0
- package/src/actions/enso/getEnsoSwapBundle.ts +2 -2
- package/src/actions/enso/getEnsoUserTokensWithBalances.ts +5 -5
- package/src/actions/enso/util.ts +150 -5
- package/src/actions/exports.ts +0 -2
- package/src/actions/governance/__tests__/checkProposalField.unit.test.ts +2 -2
- package/src/actions/governance/__tests__/getDecodedFunctionData.integration.test.ts +2 -2
- package/src/actions/governance/__tests__/getQuorum.integration.test.ts +2 -2
- package/src/actions/governance/checkProposalField.ts +1 -1
- package/src/actions/governance/computeActualStatus.ts +1 -1
- package/src/actions/governance/getAllProposals.ts +1 -1
- package/src/actions/governance/getBodyErrors.ts +1 -1
- package/src/actions/governance/getProposalDetails.ts +1 -1
- package/src/actions/governance/getProposalFromTx.ts +1 -1
- package/src/actions/governance/getProposalParams.ts +3 -3
- package/src/actions/governance/getProposalVotes.ts +1 -1
- package/src/actions/governance/getQuorum.ts +2 -2
- package/src/actions/honey/getCollateralWeights.ts +2 -2
- package/src/actions/honey/getGlobalCapLimit.ts +4 -4
- package/src/actions/honey/getHoneyCollaterals.ts +5 -5
- package/src/actions/honey/getHoneyFees.ts +1 -1
- package/src/actions/honey/getHoneyPausedState.ts +1 -1
- package/src/actions/honey/getHoneyPreview.ts +3 -3
- package/src/actions/honey/getHoneyRootPriceOracle.ts +1 -1
- package/src/actions/honey/getHoneyVaultsBalance.ts +2 -2
- package/src/actions/honey/getRelativeCapLimit.ts +3 -3
- package/src/actions/honey/getSharesWithoutFees.ts +1 -1
- package/src/actions/honey/getSwapPayload.ts +6 -6
- package/src/actions/honey/isBadCollateralAsset.ts +2 -2
- package/src/actions/honey/isBasketModeEnabled.ts +2 -2
- package/src/actions/honey/tests/pyth.integration.test.ts +3 -3
- package/src/actions/misc/getBlockTimestamp.ts +2 -2
- package/src/actions/pol/__tests__/getAllValidators.integration.test.ts +2 -2
- package/src/actions/pol/__tests__/rewardVaults.integration.test.ts +1 -1
- package/src/actions/pol/getBGTGlobalInfo.ts +2 -2
- package/src/actions/pol/getBgtAprSimulation.ts +1 -1
- package/src/actions/pol/getBgtAprSimultaion.unit.test.ts +1 -1
- package/src/actions/pol/getBgtTokenTotalBoosts.ts +2 -2
- package/src/actions/pol/getBgtTokenTotalSupply.ts +2 -2
- package/src/actions/pol/getBlockTime.debug.test.ts +13 -0
- package/src/actions/pol/getBlockTime.ts +14 -23
- package/src/actions/pol/getEarnedStakedBeraVault.ts +3 -3
- package/src/actions/pol/getGlobalCuttingBoard.ts +0 -0
- package/src/actions/pol/getGlobalData.ts +2 -2
- package/src/actions/pol/getIncentiveFeeClaimStats.ts +4 -4
- package/src/actions/pol/getLSTStakeConfig.ts +5 -5
- package/src/actions/pol/getMarkets.ts +2 -2
- package/src/actions/pol/getRewardProofsByValidator.ts +4 -4
- package/src/actions/pol/getRewardTokenToBeraRate.ts +1 -1
- package/src/actions/pol/getRewardVault.ts +3 -3
- package/src/actions/pol/getRewardVaultBeaconImplementation.integration.test.ts +1 -1
- package/src/actions/pol/getRewardVaultBeaconImplementation.ts +3 -3
- package/src/actions/pol/getRewardVaultDurationConstants.integration.test.ts +1 -1
- package/src/actions/pol/getRewardVaultDurationConstants.ts +1 -1
- package/src/actions/pol/getRewardVaultFromToken.ts +1 -1
- package/src/actions/pol/getRewardVaultIncentives.ts +2 -2
- package/src/actions/pol/getRewardVaultRewards.ts +1 -1
- package/src/actions/pol/getRewardVaults.ts +1 -1
- package/src/actions/pol/getSWBeraVaultMetadata.ts +20 -22
- package/src/actions/pol/getSWBeraWithdrawal.ts +4 -4
- package/src/actions/pol/getStakedBeraAPR.ts +2 -2
- package/src/actions/pol/getStakedBeraSnapshots.ts +2 -2
- package/src/actions/pol/getStakingDailyAssets.ts +3 -3
- package/src/actions/pol/getStakingTokenInformation.ts +2 -2
- package/src/actions/pol/getTotalStakedAmount.ts +1 -1
- package/src/actions/pol/getUserClaimableIncentives.ts +4 -4
- package/src/actions/pol/getUserVaultInfo.ts +1 -1
- package/src/actions/pol/getUserVaults.ts +4 -4
- package/src/actions/pol/getUserVaultsBalance.ts +1 -1
- package/src/actions/pol/getUserVaultsReward.ts +0 -0
- package/src/actions/pol/getVaultHistory.ts +2 -2
- package/src/actions/pol/getVaultValidators.ts +1 -1
- package/src/actions/pol/getVaultsSupply.ts +0 -0
- package/src/actions/prices/__tests__/prices.integration.test.ts +2 -2
- package/src/actions/prices/getTokenCurrentPrices.ts +5 -5
- package/src/actions/pyth/getHoneyPythFeeds.ts +2 -2
- package/src/actions/pyth/getUpdateFee.ts +2 -2
- package/src/actions/tokens/getAllowances.ts +2 -2
- package/src/actions/tokens/getTokenInformation.ts +2 -2
- package/src/actions/tokens/getTokens.ts +3 -3
- package/src/actions/tokens/getUnderlyingToken.ts +4 -4
- package/src/actions/tokens/getWalletBalances.integration.test.ts +1 -1
- package/src/actions/tokens/getWalletBalances.ts +4 -4
- package/src/actions/transactions/beraWriteContract.integration.test.ts +6 -6
- package/src/actions/transactions/beraWriteContract.ts +12 -12
- package/src/actions/validators/getActiveBoostAndCommissionChangeDelay.integration.test.ts +1 -1
- package/src/actions/validators/getActiveBoostAndCommissionChangeDelay.ts +1 -1
- package/src/actions/validators/getAllValidators.ts +2 -2
- package/src/actions/validators/getApiValidator.ts +2 -2
- package/src/actions/validators/getBaselineRewardAllocation.ts +1 -1
- package/src/actions/validators/getDailyValidatorBlockStats.ts +1 -1
- package/src/actions/validators/getDefaultRewardAllocation.ts +1 -1
- package/src/actions/validators/getUserActiveValidators.ts +31 -33
- package/src/actions/validators/getUserBoosts.ts +12 -8
- package/src/actions/validators/getUserBoostsOnValidator.ts +15 -3
- package/src/actions/validators/getUserStakingPositions.ts +1 -1
- package/src/actions/validators/getValidatorAnalytics.ts +2 -2
- package/src/actions/validators/getValidatorCommission.ts +1 -1
- package/src/actions/validators/getValidatorEstimatedBgtPerYear.ts +1 -1
- package/src/actions/validators/getValidatorOperatorAddress.ts +1 -1
- package/src/actions/validators/getValidatorQueuedCommission.ts +1 -1
- package/src/actions/validators/getValidatorQueuedOperatorAddress.ts +1 -1
- package/src/actions/validators/getValidatorQueuedRewardAllocation.ts +1 -1
- package/src/actions/validators/getValidatorRewardAllocation.ts +1 -1
- package/src/actions/validators/getValidatorRewardAllocatorAddress.ts +1 -1
- package/src/actions/validators/utils/__tests__/validatorUtils.integration.test.ts +4 -4
- package/src/contexts/BeraFlags/defaultFlags.ts +4 -0
- package/src/contexts/BexStatusProvider.tsx +1 -1
- package/src/contexts/HoneyConfigProvider.tsx +3 -3
- package/src/contexts/SwrFallback.tsx +2 -2
- package/src/contexts/TokensProvider.tsx +3 -3
- package/src/contexts/block-time-provider.tsx +1 -1
- package/src/contexts/exports.ts +0 -0
- package/src/data/contracts.ts +10 -0
- package/src/enum/exports.ts +0 -0
- package/src/enum/polling.ts +0 -0
- package/src/enum/txnEnum.ts +9 -0
- package/src/errors/BeraMonitoring.ts +2 -2
- package/src/errors/BeraTracing.ts +2 -2
- package/src/errors/RequestError.ts +1 -1
- package/src/errors/assert.ts +18 -0
- package/src/errors/getErrorMessage.ts +0 -0
- package/src/errors/getRevertReason.integration.test.ts +7 -7
- package/src/errors/getRevertReason.ts +1 -1
- package/src/errors/parseViemError.ts +1 -1
- package/src/hooks/bend/useGetConvertToAssets.ts +4 -4
- package/src/hooks/dex/useAggregatorsQuotes.ts +19 -19
- package/src/hooks/dex/useAggregatorsRouterFeeBps.ts +2 -2
- package/src/hooks/dex/useAllUserPools.ts +3 -3
- package/src/hooks/dex/useApiPool.ts +3 -3
- package/src/hooks/dex/useBexStatus.ts +1 -1
- package/src/hooks/dex/useCreatePool.ts +9 -9
- package/src/hooks/dex/useExploitedTokens.ts +3 -3
- package/src/hooks/dex/useGlobalLiquidityAndSwapVolume.ts +1 -1
- package/src/hooks/dex/useLiquidityMismatch.ts +3 -3
- package/src/hooks/dex/useLpPosition.ts +7 -4
- package/src/hooks/dex/useMultipleTokenApprovalsWithSlippage.ts +4 -4
- package/src/hooks/dex/useOnChainPoolData.ts +3 -3
- package/src/hooks/dex/usePollPoolCreationRelayerApproval.ts +3 -3
- package/src/hooks/dex/usePool.ts +7 -40
- package/src/hooks/dex/usePoolEvents.ts +2 -2
- package/src/hooks/dex/usePoolHistoricalData.ts +6 -3
- package/src/hooks/dex/usePools.ts +3 -3
- package/src/hooks/dex/usePriceImpact.ts +2 -2
- package/src/hooks/dex/useSingleAggregatorQuote.ts +13 -13
- package/src/hooks/enso/useBendDemultiply.ts +158 -0
- package/src/hooks/enso/useBendMultiply.ts +163 -0
- package/src/hooks/enso/useBendZapSupply.ts +7 -7
- package/src/hooks/enso/useEnsoSwapBundle.ts +6 -6
- package/src/hooks/enso/useEnsoUserTokensWithBalances.ts +5 -5
- package/src/hooks/enso/useEnsoWalletV2Address.ts +38 -0
- package/src/hooks/enso/useIsBendAuthorized.ts +47 -0
- package/src/hooks/enso/useZapStakeBera.ts +4 -4
- package/src/hooks/exports.ts +4 -3
- package/src/hooks/governance/useCreateProposal.ts +3 -3
- package/src/hooks/governance/useGetPastVotes.ts +2 -2
- package/src/hooks/governance/useHasVoted.ts +2 -2
- package/src/hooks/governance/useIsCanceller.ts +4 -4
- package/src/hooks/governance/usePollAllProposals.ts +3 -3
- package/src/hooks/governance/usePollProposal.ts +7 -4
- package/src/hooks/governance/usePollProposalThreshold.ts +3 -3
- package/src/hooks/governance/usePollProposalVotes.ts +1 -1
- package/src/hooks/governance/usePollUserDelegates.ts +7 -4
- package/src/hooks/governance/useProposalFromTx.ts +1 -1
- package/src/hooks/governance/useProposalSnapshot.ts +2 -2
- package/src/hooks/governance/useProposalState.ts +2 -2
- package/src/hooks/governance/useProposalTimelockState.ts +2 -2
- package/src/hooks/governance/useQuorum.ts +1 -1
- package/src/hooks/honey/useCappedGlobally.ts +8 -5
- package/src/hooks/honey/useCappedRelatively.ts +7 -4
- package/src/hooks/honey/useCollateralWeights.ts +8 -5
- package/src/hooks/honey/useHoneyAlerts.ts +5 -5
- package/src/hooks/honey/useHoneyBalances.ts +7 -7
- package/src/hooks/honey/useHoneyChartData.ts +1 -1
- package/src/hooks/honey/useHoneySwapState.ts +4 -4
- package/src/hooks/honey/useHoneyVaultsBalance.ts +8 -5
- package/src/hooks/honey/useIsBadCollateralAsset.ts +9 -6
- package/src/hooks/honey/useIsBasketModeEnabled.ts +8 -5
- package/src/hooks/honey/usePythLatestPrices.ts +4 -4
- package/src/hooks/perps/usePythUpdateFee.ts +4 -4
- package/src/hooks/pol/useBgtAprSimulation.ts +1 -1
- package/src/hooks/pol/useBgtUnstakedBalance.ts +7 -4
- package/src/hooks/pol/useClaimableFees.ts +4 -4
- package/src/hooks/pol/useOnChainRewardVault.ts +7 -7
- package/src/hooks/pol/usePollGlobalData.ts +9 -3
- package/src/hooks/pol/usePollMarkets.ts +5 -2
- package/src/hooks/pol/useQueuedBeraUnlock.ts +4 -4
- package/src/hooks/pol/useRewardTokenToBeraRate.ts +4 -4
- package/src/hooks/pol/useRewardVault.ts +5 -2
- package/src/hooks/pol/useRewardVaultBalanceFromStakingToken.ts +2 -2
- package/src/hooks/pol/useRewardVaultFromToken.ts +2 -2
- package/src/hooks/pol/useRewardVaultIncentives.ts +2 -2
- package/src/hooks/pol/useRewardVaultRewards.ts +3 -3
- package/src/hooks/pol/useRewardVaults.ts +2 -2
- package/src/hooks/pol/useStakedAPR.ts +3 -3
- package/src/hooks/pol/useStakedData.ts +10 -10
- package/src/hooks/pol/useStakedSnapshots.ts +3 -3
- package/src/hooks/pol/useStakingVaultsMetadata.ts +40 -0
- package/src/hooks/pol/useTotalStakedAmount.ts +2 -2
- package/src/hooks/pol/useUserVaultInfo.ts +8 -5
- package/src/hooks/pol/useUserVaults.ts +7 -4
- package/src/hooks/pol/useVaultAddress.ts +2 -2
- package/src/hooks/pol/useVaultHistory.ts +2 -2
- package/src/hooks/pol/useVaultValidators.ts +5 -2
- package/src/hooks/tokens/useBeraCurrentPrice.ts +1 -1
- package/src/hooks/tokens/useMultipleTokenInformation.ts +7 -4
- package/src/hooks/tokens/usePollAllowances.ts +7 -4
- package/src/hooks/tokens/usePollBalance.ts +8 -5
- package/src/hooks/tokens/usePollWalletBalances.ts +8 -5
- package/src/hooks/tokens/useStakingTokenInformation.ts +7 -4
- package/src/hooks/tokens/useTokenCurrentPrice.ts +1 -1
- package/src/hooks/tokens/useTokenCurrentPrices.ts +6 -6
- package/src/hooks/tokens/useTokenInformation.ts +8 -5
- package/src/hooks/tokens/useTokenPrice.ts +1 -1
- package/src/hooks/tokens/useTokenPrices.ts +4 -4
- package/src/hooks/tokens/useTokens.ts +3 -3
- package/src/hooks/tokens/useTotalSupply.ts +1 -1
- package/src/hooks/tokens/useUnderlyingAsset.ts +3 -3
- package/src/hooks/useBlockToTimestamp.ts +5 -5
- package/src/hooks/useContractWrite/index.ts +0 -0
- package/src/hooks/useContractWrite/stateReducer.ts +0 -0
- package/src/hooks/useContractWrite/types.ts +2 -2
- package/src/hooks/useContractWrite/useBeraContractWrite.ts +5 -6
- package/src/hooks/useGetVerifiedAbi.ts +1 -1
- package/src/hooks/usePrevious.ts +0 -0
- package/src/hooks/validators/useAllValidators.ts +7 -4
- package/src/hooks/validators/useApiEnrichedAllocation.ts +2 -2
- package/src/hooks/validators/useApiValidator.ts +5 -2
- package/src/hooks/validators/useBaselineRewardAllocation.ts +2 -2
- package/src/hooks/validators/useDailyValidatorBlockStats.ts +3 -3
- package/src/hooks/validators/useDefaultRewardAllocation.ts +4 -4
- package/src/hooks/validators/useManagedValidatorRole.ts +8 -5
- package/src/hooks/validators/useOnChainValidator.ts +6 -3
- package/src/hooks/validators/useStakingPoolBatch.ts +7 -4
- package/src/hooks/validators/useUserActiveValidators.ts +6 -3
- package/src/hooks/validators/useUserBoostsOnValidator.ts +3 -3
- package/src/hooks/validators/useUserClaimableIncentives.ts +9 -9
- package/src/hooks/validators/useUserStakingPositions.ts +1 -1
- package/src/hooks/validators/useValidator.ts +1 -1
- package/src/hooks/validators/useValidatorAnalytics.ts +3 -3
- package/src/hooks/validators/useValidatorCommission.ts +5 -2
- package/src/hooks/validators/useValidatorEstimatedBgtPerYear.ts +3 -3
- package/src/hooks/validators/useValidatorQueuedCommission.ts +6 -3
- package/src/hooks/validators/useValidatorQueuedOperatorAddress.ts +5 -2
- package/src/hooks/validators/useValidatorQueuedRewardAllocation.ts +6 -3
- package/src/hooks/validators/useValidatorRewardAllocation.ts +2 -2
- package/src/types/dex.d.ts +1 -1
- package/src/types/enso.d.ts +34 -0
- package/src/types/exports.ts +0 -0
- package/src/types/global.d.ts +3 -3
- package/src/types/governance.d.ts +1 -1
- package/src/types/honeySwap.d.ts +3 -3
- package/src/types/staking.d.ts +0 -0
- package/src/utils/beraFetch.ts +1 -1
- package/src/utils/createEmitter.ts +1 -1
- package/src/utils/exports.ts +0 -0
- package/src/utils/filter.ts +0 -0
- package/src/utils/formatIncentivesTokenMap.ts +1 -1
- package/src/utils/formatInputTokenValue.ts +0 -0
- package/src/utils/formatNumber.ts +0 -0
- package/src/utils/getContractName.ts +1 -1
- package/src/utils/getHoneySwapMessage.test.ts +1 -1
- package/src/utils/getHoneySwapMessage.ts +1 -1
- package/src/utils/parseBaseArgs.ts +1 -1
- package/src/utils/parseBaseArgs.unit.test.ts +1 -1
- package/src/utils/parseWhiskToken.ts +1 -1
- package/src/utils/poolNamings.ts +1 -1
- package/src/utils/tokens.ts +2 -2
- package/src/utils/tokens.unit.test.ts +1 -1
- package/src/utils/truncateHash.ts +0 -0
- package/.claude/skills/berajs/SKILL.md +0 -222
- package/.claude/skills/berajs/references/dex.md +0 -235
- package/.claude/skills/berajs/references/pol.md +0 -194
- package/.claude/skills/berajs/references/staking.md +0 -198
- package/.claude/skills/berajs/references/tokens.md +0 -170
- package/LICENSE +0 -21
- package/dist/chunk-22J3YJDN.cjs +0 -2
- package/dist/chunk-22J3YJDN.cjs.map +0 -1
- package/dist/chunk-2LL3P5PN.mjs +0 -2
- package/dist/chunk-2LL3P5PN.mjs.map +0 -1
- package/dist/chunk-4GU2O2OW.cjs +0 -4
- package/dist/chunk-4GU2O2OW.cjs.map +0 -1
- package/dist/chunk-55L7STYD.mjs +0 -2
- package/dist/chunk-55L7STYD.mjs.map +0 -1
- package/dist/chunk-5XWELBWR.mjs +0 -2
- package/dist/chunk-5XWELBWR.mjs.map +0 -1
- package/dist/chunk-6LDOG5RL.cjs.map +0 -1
- package/dist/chunk-7LNBSOVV.cjs +0 -2
- package/dist/chunk-7LNBSOVV.cjs.map +0 -1
- package/dist/chunk-7SMWQ6SN.mjs.map +0 -1
- package/dist/chunk-7WRTK7RJ.mjs.map +0 -1
- package/dist/chunk-AX2YQQFQ.mjs.map +0 -1
- package/dist/chunk-BS6K7HGH.cjs +0 -2
- package/dist/chunk-BS6K7HGH.cjs.map +0 -1
- package/dist/chunk-C3FHGFLK.mjs +0 -2
- package/dist/chunk-C3FHGFLK.mjs.map +0 -1
- package/dist/chunk-C6ZGUO4H.cjs.map +0 -1
- package/dist/chunk-FCWDGE62.cjs.map +0 -1
- package/dist/chunk-RW3JFPED.mjs +0 -4
- package/dist/chunk-RW3JFPED.mjs.map +0 -1
- package/dist/chunk-S3EAKCVM.cjs +0 -2
- package/dist/chunk-S3EAKCVM.cjs.map +0 -1
- package/dist/chunk-SWMJQOH6.cjs +0 -2
- package/dist/chunk-SWMJQOH6.cjs.map +0 -1
- package/dist/chunk-THATXCJK.mjs +0 -2
- package/dist/chunk-THATXCJK.mjs.map +0 -1
- package/dist/chunk-VXL2ZZ4X.cjs +0 -2
- package/dist/chunk-VXL2ZZ4X.cjs.map +0 -1
- package/dist/chunk-YNO7BCCM.mjs +0 -2
- package/dist/chunk-YXLFOEZN.mjs +0 -2
- package/dist/chunk-YXLFOEZN.mjs.map +0 -1
- package/dist/chunk-YZV5LKIP.cjs.map +0 -1
- package/src/actions/dex/getSubgraphPool.ts +0 -30
- package/src/actions/validators/getManagedValidatorByAccount.ts +0 -32
- package/src/hooks/pol/useSWBeraVaultMetadata.ts +0 -35
- package/src/hooks/validators/useManagedValidatorByAccount.ts +0 -40
- package/src/hooks/validators/useSubgraphUserValidators.ts +0 -36
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/errors/errorMap.ts","../src/errors/getErrorMessage.ts","../src/errors/BeraError.ts","../src/abi/utils/bundler3errors.ts","../src/abi/utils/erc20errors.ts","../src/abi/utils/openChainErrors.ts","../src/abi/utils/commonAbiErrors.ts","../src/errors/parseViemError.ts"],"names":["GENERAL_ERROR","errorMsgMap","findMatchingError","reason","message","category","errors","type","errorType","r","keyword","getErrorMessage","bundler3errorsAbi","erc20errorsAbi","openChainErrorsAbi","commonAbiErrors","isBaseError","error","BaseError","isViemError","name","shouldBeInstanceOf","parseDecodedError","parseViemError","abi","revertIfUnknown","cause","ContractFunctionExecutionError","TransactionExecutionError","AtomicReadyWalletRejectedUpgradeError","RpcRequestError","decodedError","decodeErrorResult","ContractFunctionRevertedError","UserRejectedRequestError","HttpRequestError","rpcErrorToReason","errCode"],"mappings":"AAuBO,8sBAAMA,CAAAA,CAAgB,+CAAA,CAEhBC,CAAAA,CAAc,CACzB,KAAA,CAAO,CACL,kBAAA,CAAoB,CAClB,OAAA,CAAS,CAAC,kBAAkB,CAAA,CAC5B,QAAA,CAAU,wDACZ,CAAA,CACA,mBAAA,CAAqB,CACnB,OAAA,CA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AA,CACE,MAAO,CAAA,UAAA,EAAaA,CAAO,CAAA,CAAA","file":"/Users/liammcaweeney/Work/bera/monobera/packages/berajs/dist/chunk-C6ZGUO4H.cjs","sourcesContent":["export interface ErrorType {\n /**\n * Keywords to match in the error message. Use carefully. Do not use this for contract revert reasons\n * as they might match to other error messages.\n *\n * For instance InsufficientBalance might match to InsufficientBalanceToPayPythFee if used as keyword.\n */\n keywords?: string[];\n /**\n * The exact error code or contract revert reason.\n */\n reasons?: string[];\n errorMSG: string;\n}\n\nexport interface ErrorCategory {\n [key: string]: ErrorType;\n}\n\ninterface ErrorMessages {\n [key: string]: ErrorCategory | string;\n}\n\nexport const GENERAL_ERROR = \"Something went wrong. Please try again later.\";\n\nexport const errorMsgMap = {\n ERC20: {\n NOT_ENOUGH_BALANCE: {\n reasons: [\"NotEnoughBalance\"],\n errorMSG: \"You do not have enough balance to perform this action.\",\n },\n InsufficientBalance: {\n reasons: [\"InsufficientBalance\"],\n errorMSG: \"Insufficient token balance\",\n },\n INSUFFICIENT_ALLOWANCE: {\n reasons: [\n \"0x13be252b\",\n \"InsufficientAllowance\",\n \"ERC20InsufficientAllowance\",\n ],\n errorMSG: \"You do not have enough allowance to perform this action.\",\n },\n SIGNATURE_EXPIRED: {\n reasons: [\"SignatureExpired\"],\n errorMSG: \"Transaction took too long to complete. Please try again.\",\n },\n },\n HTTP: {\n RATE_LIMITED_429: {\n reasons: [\"429\"],\n errorMSG: \"Too many requests. Please try again later.\",\n },\n },\n ENSO: {\n COULD_NOT_BUILD_SHORTCUT: {\n keywords: [\n \"Could not build shortcuts for route\",\n \"Could not quote shortcuts for route\",\n ],\n\n errorMSG:\n \"There was an error building the zap route. Try with lower amounts.\",\n },\n NOT_ENOUGH_LIQUIDITY: {\n keywords: [\n \"Swap not found for a required underlying of defi route, please make sure your amountIn is within an acceptable range\",\n ],\n\n errorMSG:\n \"The amount you’re trying to swap might be too high. Please make sure that your amount is within an acceptable range.\",\n },\n NO_ROUTE_FOUND: {\n keywords: [\"No route found from\"],\n errorMSG: \"No swap route found for the given tokens.\",\n },\n },\n RPC: {\n NOT_ENOUGH_GAS_TOKEN: {\n reasons: [\"InsufficientFundsError\"],\n keywords: [\n \"insufficient funds for gas * price + value:\",\n \"The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account.\",\n ],\n errorMSG: \"Insufficient BERA balance to perform this action.\",\n },\n NONCE_TOO_LOW: {\n keywords: [\"nonce too low: next nonce\"],\n errorMSG:\n \"Nonce is too low. Your wallet might have unconfirmed transactions.\",\n },\n GAS_PRICE: {\n keywords: [\"gasLimit\"],\n errorMSG:\n \"It seems an RPC error has occurred while estimating gas. Please try your request later.\",\n },\n JSON_RPC: {\n keywords: [\"JSON-RPC\"],\n\n errorMSG:\n \"It seems an RPC error has occurred. Please try your request one more later.\",\n },\n HASH: {\n keywords: [\"hash\"],\n errorMSG:\n \"It seems an RPC error has occurred. Please check if your transaction was finalized. If not, please try again.\",\n },\n USER_REJECTION: {\n reasons: [\"UserRejectedRequestError\"],\n keywords: [\"User denied transaction signature\"],\n errorMSG: \"You rejected the transaction.\",\n },\n SMART_UPGRADE_REJECTION: {\n reasons: [\"AtomicReadyWalletRejectedUpgradeError\"],\n errorMSG:\n \"You've declined to upgrade to batch transactions for now, try again for the traditional method.\",\n },\n CHAIN_MISMATCH: {\n reasons: [\"ChainMismatchError\"],\n errorMSG:\n \"Wallet seems to be on the wrong chain, please refresh the page and try again.\",\n },\n },\n EIP7702: {\n SESSION_KEY_EXPIRED: {\n reasons: [\"SessionKeyExpired\"],\n errorMSG: \"Session key has expired. Please create a new one.\",\n },\n CALL_POLICY_VIOLATED: {\n reasons: [\"CallPolicyViolated\"],\n errorMSG: \"Call policy violated. Please check your call policies.\",\n },\n },\n HONEY: {\n BLACKLISTED_WALLET: {\n reasons: [\"BlacklistedWallet\", \"0x265693b4\"],\n errorMSG: \"Your wallet is blacklisted from minting or redeeming HONEY.\",\n },\n LIQUIDITY_ERROR: {\n reasons: [\"0x4656425a\"],\n errorMSG:\n \"You are trying to redeem more than the liquidity available in the vault.\",\n },\n },\n // NOTE: these codes are from https://github.com/balancer/balancer-v2-monorepo/blob/master/pkg/balancer-js/src/utils/errors.ts\n // ... and additionally from https://docs.balancer.fi/reference/contracts/error-codes.html\n // NOTE: descriptions are generated by GPT where not available.\n BEX: {\n SLIPPAGE_EXCEEDED: {\n reasons: [\"SlippageExceeded\", \"TooMuchSlippage\"],\n errorMSG:\n \"Price changed while executing the transaction and exceeded the allowed slippage.\",\n },\n // math\n BAL000: {\n reasons: [\"BAL#000\"],\n errorMSG: \"Addition overflow occurred during calculation. (BEX#000)\",\n },\n BAL001: {\n reasons: [\"BAL#001\"],\n errorMSG: \"Subtraction overflow occurred during calculation. (BEX#001)\",\n },\n BAL002: {\n reasons: [\"BAL#002\"],\n errorMSG: \"Subtraction underflow occurred during calculation. (BEX#002)\",\n },\n BAL003: {\n reasons: [\"BAL#003\"],\n errorMSG:\n \"Multiplication overflow occurred during calculation. (BEX#003)\",\n },\n BAL004: {\n reasons: [\"BAL#004\"],\n errorMSG: \"Attempted division by zero. (BEX#004)\",\n },\n BAL005: {\n reasons: [\"BAL#005\"],\n errorMSG: \"Multiplication overflow during FixedPoint Division. (BEX#005)\",\n },\n BAL006: {\n reasons: [\"BAL#006\"],\n errorMSG: \"Invalid x in ExpMath.pow(x, y). (BEX#006)\",\n },\n BAL007: {\n reasons: [\"BAL#007\"],\n errorMSG: \"Invalid y in ExpMath.pow(x, y). (BEX#007)\",\n },\n BAL008: {\n reasons: [\"BAL#008\"],\n errorMSG:\n \"In LogExpMath.pow(x, y), error computing x^y as exp(y * ln(x)). (BEX#008)\",\n },\n BAL009: {\n reasons: [\"BAL#009\"],\n errorMSG: \"In LogExpMath.exp(x) = e^x; x out of bounds. (BEX#009)\",\n },\n // Input\n BAL100: {\n reasons: [\"BAL#100\"],\n errorMSG: \"Value is out of acceptable bounds. (BEX#100)\",\n },\n BAL101: {\n reasons: [\"BAL#101\"],\n errorMSG:\n \"Tokens must be sorted in address order on pool registration. (BEX#101)\",\n },\n BAL102: {\n reasons: [\"BAL#102\"],\n errorMSG:\n \"Tokens must be sorted in address order on pool registration. (BEX#102)\",\n },\n BAL103: {\n reasons: [\"BAL#103\"],\n errorMSG: \"Parallel array inputs must have the same length. (BEX#103)\",\n },\n BAL104: {\n reasons: [\"BAL#104\"],\n errorMSG: \"Address to be interpreted as a token cannot be 0. (BEX#104)\",\n },\n BAL105: {\n reasons: [\"BAL#105\"],\n errorMSG: \"Insufficient byte length. (BEX#105)\",\n },\n // Shared Pools\n BAL200: {\n reasons: [\"BAL#200\"],\n errorMSG: \"All pools must contain at least two tokens. (BEX#200)\",\n },\n BAL201: {\n reasons: [\"BAL#201\"],\n errorMSG:\n \"Token count exceeds the maximum for a given pool type. (BEX#201)\",\n },\n BAL202: {\n reasons: [\"BAL#202\"],\n errorMSG: \"Swap fee percentage exceeds the maximum allowed. (BEX#202)\",\n },\n BAL203: {\n reasons: [\"BAL#203\"],\n errorMSG: \"Swap fee percentage is below the minimum allowed. (BEX#203)\",\n },\n BAL204: {\n reasons: [\"BAL#204\"],\n errorMSG:\n \"Pool initialization failed: a small amount of BPT is minted to the zero address to maintain mathematical consistency. If initial balances are too low, the initialization process may fail. (BEX#204)\",\n },\n BAL205: {\n reasons: [\"BAL#205\"],\n errorMSG:\n \"User attempted to execute a callback intended for the vault contract. (BEX#205)\",\n },\n BAL206: {\n reasons: [\"BAL#206\"],\n errorMSG:\n \"Pools must be initialized with a special 'Init' join, before they can be joined by LPs. (BEX#206)\",\n },\n BAL207: {\n reasons: [\"BAL#207\"],\n errorMSG:\n \"Slippage/front-running protection check failed on a pool exit. (BEX#207)\",\n },\n BAL208: {\n reasons: [\"BAL#208\"],\n errorMSG: \"Minimum BPT output amount not met. (BEX#208)\",\n },\n BAL209: {\n reasons: [\"BAL#209\"],\n errorMSG:\n \"Slippage/front-running protection check failed on a pool join. (BEX#209)\",\n },\n BAL210: {\n reasons: [\"BAL#210\"],\n errorMSG:\n \"Pools with oracles are limited to two tokens. A pool with the TWO_TOKEN specialization must have exactly two tokens. (BEX#210)\",\n },\n BAL211: {\n reasons: [\"BAL#211\"],\n errorMSG:\n \"The pool factory is disabled and new pools cannot be created at this time. (BEX#211)\",\n },\n // Pools\n BAL300: {\n reasons: [\"BAL#300\"],\n errorMSG:\n \"The amplification parameter is below the minimum allowed. (BEX#300)\",\n },\n BAL301: {\n reasons: [\"BAL#301\"],\n errorMSG:\n \"The amplification parameter exceeds the maximum allowed. (BEX#301)\",\n },\n BAL302: {\n reasons: [\"BAL#302\"],\n errorMSG: \"The weight parameter is below the minimum allowed. (BEX#302)\",\n },\n BAL303: {\n reasons: [\"BAL#303\"],\n errorMSG:\n \"The number of stable tokens exceeds the maximum allowed. (BEX#303)\",\n },\n BAL304: {\n reasons: [\"BAL#304\"],\n errorMSG: \"The amount of tokens in would unbalance the pool. (BEX#304)\",\n },\n BAL305: {\n reasons: [\"BAL#305\"],\n errorMSG: \"The amount of tokens out would unbalance the pool. (BEX#305)\",\n },\n BAL306: {\n reasons: [\"BAL#306\"],\n errorMSG:\n \"Disproportionate pool exit would unbalance the pool. (BEX#306)\",\n },\n BAL307: {\n reasons: [\"BAL#307\"],\n errorMSG:\n \"Disproportionate pool join would unbalance the pool. (BEX#307)\",\n },\n BAL308: {\n reasons: [\"BAL#308\"],\n errorMSG: \"Normalized weights do not add to 1.0 exactly. (BEX#308)\",\n },\n BAL309: {\n reasons: [\"BAL#309\"],\n errorMSG: \"Invalid token provided for operation. (BEX#309)\",\n },\n BAL310: {\n reasons: [\"BAL#310\"],\n errorMSG: \"Unhandled pool join operation for this pool type. (BEX#310)\",\n },\n BAL311: {\n reasons: [\"BAL#311\"],\n errorMSG: \"Pool balances must be > 0. (BEX#311)\",\n },\n BAL312: {\n reasons: [\"BAL#312\"],\n errorMSG:\n \"Invalid query for oracle data ('ago' timestamp was not in the past). (BEX#312)\",\n },\n BAL313: {\n reasons: [\"BAL#313\"],\n errorMSG: \"Oracle has no data to query. (BEX#313)\",\n },\n BAL314: {\n reasons: [\"BAL#314\"],\n errorMSG:\n \"Oracle query data is before its earliest data sample. (BEX#314)\",\n },\n BAL315: {\n reasons: [\"BAL#315\"],\n errorMSG:\n \"Cannot query an oracle sample outside the buffer of 1024. (BEX#315)\",\n },\n BAL316: {\n reasons: [\"BAL#316\"],\n errorMSG: \"Oracle query window must have non-zero duration. (BEX#316)\",\n },\n BAL317: {\n reasons: [\"BAL#317\"],\n errorMSG:\n \"Amplification parameter change has less than the minimum duration. (BEX#317)\",\n },\n BAL318: {\n reasons: [\"BAL#318\"],\n errorMSG:\n \"Cannot start an amplification parameter update if one is already ongoing. (BEX#318)\",\n },\n BAL319: {\n reasons: [\"BAL#319\"],\n errorMSG:\n \"The requested amplification parameter change is too fast (cannot halve or double over less than a day). (BEX#319)\",\n },\n BAL320: {\n reasons: [\"BAL#320\"],\n errorMSG:\n \"Cannot cancel an update if there isn't one already ongoing. (BEX#320)\",\n },\n BAL321: {\n reasons: [\"BAL#321\"],\n errorMSG: \"Stable pool invariant calculation did not converge. (BEX#321)\",\n },\n BAL322: {\n reasons: [\"BAL#322\"],\n errorMSG: \"Stable pool balance calculation did not converge. (BEX#322)\",\n },\n BAL323: {\n reasons: [\"BAL#323\"],\n errorMSG: \"Relayer must be a valid contract. (BEX#323)\",\n },\n BAL324: {\n reasons: [\"BAL#324\"],\n errorMSG: \"Base pool relayer was not called correctly. (BEX#324)\",\n },\n BAL325: {\n reasons: [\"BAL#325\"],\n errorMSG:\n \"Rebalancing relayer operation re-entered unexpectedly. (BEX#325)\",\n },\n BAL326: {\n reasons: [\"BAL#326\"],\n errorMSG:\n \"Detected time travel in gradual updates (start > end time in a gradual weights update). (BEX#326)\",\n },\n BAL327: {\n reasons: [\"BAL#327\"],\n errorMSG: \"Swaps are disabled for this pool. (BEX#327)\",\n },\n BAL328: {\n reasons: [\"BAL#328\"],\n errorMSG: \"Caller is not the owner of the LBP. (BEX#328)\",\n },\n BAL329: {\n reasons: [\"BAL#329\"],\n errorMSG:\n \"Rate returned from a rateProvider must fit within 128 bits. (BEX#329)\",\n },\n BAL330: {\n reasons: [\"BAL#330\"],\n errorMSG:\n \"Investment pools only allow proportional joins and exits when swaps are disabled (to prevent unbalancing the pool). (BEX#330)\",\n },\n BAL331: {\n reasons: [\"BAL#331\"],\n errorMSG:\n \"Gradual weight update duration too short (minimum 1 day). (BEX#331)\",\n },\n BAL332: {\n reasons: [\"BAL#332\"],\n errorMSG: \"Invalid Linear Pool operating range. (BEX#332)\",\n },\n BAL333: {\n reasons: [\"BAL#333\"],\n errorMSG: \"Linear Pool max balance must fit in 112 bits. (BEX#333)\",\n },\n BAL334: {\n reasons: [\"BAL#334\"],\n errorMSG:\n \"Unhandled pool join/exit operation for linear pool type. (BEX#334)\",\n },\n BAL335: {\n reasons: [\"BAL#335\"],\n errorMSG:\n \"Cannot reset Linear Pool targets if pool is unbalanced. (BEX#335)\",\n },\n BAL336: {\n reasons: [\"BAL#336\"],\n errorMSG: \"Unhandled pool exit operation for this pool type. (BEX#336)\",\n },\n BAL337: {\n reasons: [\"BAL#337\"],\n errorMSG:\n \"Management fees can only be collected by the pool owner. (BEX#337)\",\n },\n BAL338: {\n reasons: [\"BAL#338\"],\n errorMSG:\n \"Management swap fee percentage exceeded the maximum. (BEX#338)\",\n },\n BAL339: {\n reasons: [\"BAL#339\"],\n errorMSG:\n \"Unhandled pool join/exit operation for managed pool type. (BEX#339)\",\n },\n BAL340: {\n reasons: [\"BAL#340\"],\n errorMSG:\n \"Unhandled pool join/exit operation for phantom pool type. (BEX#340)\",\n },\n BAL341: {\n reasons: [\"BAL#341\"],\n errorMSG: \"Token does not have a valid rate provider. (BEX#341)\",\n },\n BAL342: {\n reasons: [\"BAL#342\"],\n errorMSG: \"Invalid pool initialization parameters provided. (BEX#342)\",\n },\n BAL343: {\n reasons: [\"BAL#343\"],\n errorMSG:\n \"Value is out of the new target range for the operation. (BEX#343)\",\n },\n BAL344: {\n reasons: [\"BAL#344\"],\n errorMSG: \"This feature is currently disabled. (BEX#344)\",\n },\n BAL345: {\n reasons: [\"BAL#345\"],\n errorMSG: \"The pool controller is uninitialized. (BEX#345)\",\n },\n BAL346: {\n reasons: [\"BAL#346\"],\n errorMSG: \"Cannot set swap fee during an ongoing fee change. (BEX#346)\",\n },\n BAL347: {\n reasons: [\"BAL#347\"],\n errorMSG: \"Cannot set swap fee during pending fee changes. (BEX#347)\",\n },\n BAL348: {\n reasons: [\"BAL#348\"],\n errorMSG: \"Cannot change tokens during a weight change. (BEX#348)\",\n },\n BAL349: {\n reasons: [\"BAL#349\"],\n errorMSG: \"Cannot change tokens during pending weight changes. (BEX#349)\",\n },\n BAL350: {\n reasons: [\"BAL#350\"],\n errorMSG: \"Weight parameter exceeds the maximum allowed. (BEX#350)\",\n },\n BAL351: {\n reasons: [\"BAL#351\"],\n errorMSG: \"Unauthorized join operation. (BEX#351)\",\n },\n BAL352: {\n reasons: [\"BAL#352\"],\n errorMSG:\n \"Management AUM fee percentage exceeded the maximum allowed. (BEX#352)\",\n },\n BAL353: {\n reasons: [\"BAL#353\"],\n errorMSG: \"Fractional target values are not supported. (BEX#353)\",\n },\n BAL354: {\n reasons: [\"BAL#354\"],\n errorMSG:\n \"Adding or removing BPT is not allowed in this context. (BEX#354)\",\n },\n BAL355: {\n reasons: [\"BAL#355\"],\n errorMSG: \"Invalid circuit breaker bounds configuration. (BEX#355)\",\n },\n BAL356: {\n reasons: [\"BAL#356\"],\n errorMSG: \"The circuit breaker has been triggered. (BEX#356)\",\n },\n BAL357: {\n reasons: [\"BAL#357\"],\n errorMSG: \"Malicious query detected and reverted. (BEX#357)\",\n },\n BAL358: {\n reasons: [\"BAL#358\"],\n errorMSG:\n \"Joins and exits are currently disabled for this pool. (BEX#358)\",\n },\n // Lib\n BAL400: {\n reasons: [\"BAL#400\"],\n errorMSG: \"Reentrancy detected. (BEX#400)\",\n },\n BAL401: {\n reasons: [\"BAL#401\"],\n errorMSG: \"The sender is not allowed to perform this action. (BEX#401)\",\n },\n BAL402: {\n reasons: [\"BAL#402\"],\n errorMSG: \"The contract is currently paused. (BEX#402)\",\n },\n BAL403: {\n reasons: [\"BAL#403\"],\n errorMSG: \"The pause window has expired. (BEX#403)\",\n },\n BAL404: {\n reasons: [\"BAL#404\"],\n errorMSG:\n \"The maximum pause window duration has been exceeded. (BEX#404)\",\n },\n BAL405: {\n reasons: [\"BAL#405\"],\n errorMSG:\n \"The maximum buffer period duration has been exceeded. (BEX#405)\",\n },\n BAL406: {\n reasons: [\"BAL#406\"],\n errorMSG: \"The account has insufficient balance. (BEX#406)\",\n },\n BAL407: {\n reasons: [\"BAL#407\"],\n errorMSG: \"The account has insufficient allowance. (BEX#407)\",\n },\n BAL408: {\n reasons: [\"BAL#408\"],\n errorMSG: \"ERC20: Transfer from zero address. (BEX#408)\",\n },\n BAL409: {\n reasons: [\"BAL#409\"],\n errorMSG: \"ERC20: Transfer to zero address. (BEX#409)\",\n },\n BAL410: {\n reasons: [\"BAL#410\"],\n errorMSG: \"ERC20: Mint to zero address. (BEX#410)\",\n },\n BAL411: {\n reasons: [\"BAL#411\"],\n errorMSG: \"ERC20: Burn from zero address. (BEX#411)\",\n },\n BAL412: {\n reasons: [\"BAL#412\"],\n errorMSG: \"ERC20: Approve from zero address. (BEX#412)\",\n },\n BAL413: {\n reasons: [\"BAL#413\"],\n errorMSG: \"ERC20: Approve to zero address. (BEX#413)\",\n },\n BAL414: {\n reasons: [\"BAL#414\"],\n errorMSG: \"ERC20: Transfer exceeds allowance. (BEX#414)\",\n },\n BAL415: {\n reasons: [\"BAL#415\"],\n errorMSG: \"ERC20: Decreased allowance below zero. (BEX#415)\",\n },\n BAL416: {\n reasons: [\"BAL#416\"],\n errorMSG: \"ERC20: Transfer exceeds balance. (BEX#416)\",\n },\n BAL417: {\n reasons: [\"BAL#417\"],\n errorMSG: \"ERC20: Burn exceeds allowance. (BEX#417)\",\n },\n BAL418: {\n reasons: [\"BAL#418\"],\n errorMSG: \"SafeERC20: Call failed. (BEX#418)\",\n },\n BAL419: {\n reasons: [\"BAL#419\"],\n errorMSG: \"Address has insufficient balance. (BEX#419)\",\n },\n BAL420: {\n reasons: [\"BAL#420\"],\n errorMSG: \"Address cannot send value. (BEX#420)\",\n },\n BAL421: {\n reasons: [\"BAL#421\"],\n errorMSG: \"SafeCast: Value cannot fit into int256. (BEX#421)\",\n },\n BAL422: {\n reasons: [\"BAL#422\"],\n errorMSG: \"AccessControl: Grant sender is not an admin. (BEX#422)\",\n },\n BAL423: {\n reasons: [\"BAL#423\"],\n errorMSG: \"AccessControl: Revoke sender is not an admin. (BEX#423)\",\n },\n BAL424: {\n reasons: [\"BAL#424\"],\n errorMSG:\n \"AccessControl: Renounce sender not allowed for accounts other than self. (BEX#424)\",\n },\n BAL425: {\n reasons: [\"BAL#425\"],\n errorMSG: \"Buffer period has expired. (BEX#425)\",\n },\n BAL426: {\n reasons: [\"BAL#426\"],\n errorMSG: \"Caller is not the owner. (BEX#426)\",\n },\n BAL427: {\n reasons: [\"BAL#427\"],\n errorMSG: \"New owner cannot be zero address. (BEX#427)\",\n },\n BAL428: {\n reasons: [\"BAL#428\"],\n errorMSG: \"Code deployment failed. (BEX#428)\",\n },\n BAL429: {\n reasons: [\"BAL#429\"],\n errorMSG: \"Call to non-contract address. (BEX#429)\",\n },\n BAL430: {\n reasons: [\"BAL#430\"],\n errorMSG: \"Low-level call failed. (BEX#430)\",\n },\n BAL431: {\n reasons: [\"BAL#431\"],\n errorMSG: \"The contract is not paused. (BEX#431)\",\n },\n BAL432: {\n reasons: [\"BAL#432\"],\n errorMSG: \"Address is already allowlisted. (BEX#432)\",\n },\n BAL433: {\n reasons: [\"BAL#433\"],\n errorMSG: \"Address is not allowlisted. (BEX#433)\",\n },\n BAL434: {\n reasons: [\"BAL#434\"],\n errorMSG: \"ERC20: Burn exceeds balance. (BEX#434)\",\n },\n BAL435: {\n reasons: [\"BAL#435\"],\n errorMSG: \"Invalid operation. (BEX#435)\",\n },\n BAL436: {\n reasons: [\"BAL#436\"],\n errorMSG: \"Codec overflow detected. (BEX#436)\",\n },\n BAL437: {\n reasons: [\"BAL#437\"],\n errorMSG: \"The system is in recovery mode. (BEX#437)\",\n },\n BAL438: {\n reasons: [\"BAL#438\"],\n errorMSG: \"The system is not in recovery mode. (BEX#438)\",\n },\n BAL439: {\n reasons: [\"BAL#439\"],\n errorMSG: \"Induced failure. (BEX#439)\",\n },\n BAL440: {\n reasons: [\"BAL#440\"],\n errorMSG: \"Expired signature. (BEX#440)\",\n },\n BAL441: {\n reasons: [\"BAL#441\"],\n errorMSG: \"Malformed signature. (BEX#441)\",\n },\n BAL442: {\n reasons: [\"BAL#442\"],\n errorMSG: \"SafeCast: Value cannot fit into uint64. (BEX#442)\",\n },\n BAL443: {\n reasons: [\"BAL#443\"],\n errorMSG: \"Unhandled fee type. (BEX#443)\",\n },\n BAL444: {\n reasons: [\"BAL#444\"],\n errorMSG: \"ERC20: Burn from zero address. (BEX#444)\",\n },\n // Vault\n BAL500: {\n reasons: [\"BAL#500\"],\n errorMSG: \"Invalid pool ID. (BEX#500)\",\n },\n BAL501: {\n reasons: [\"BAL#501\"],\n errorMSG: \"Caller is not the pool. (BEX#501)\",\n },\n BAL502: {\n reasons: [\"BAL#502\"],\n errorMSG: \"Sender is not the asset manager. (BEX#502)\",\n },\n BAL503: {\n reasons: [\"BAL#503\"],\n errorMSG: \"User does not allow the relayer. (BEX#503)\",\n },\n BAL504: {\n reasons: [\"BAL#504\"],\n errorMSG: \"Invalid signature. (BEX#504)\",\n },\n BAL505: {\n reasons: [\"BAL#505\"],\n errorMSG: \"Exit would yield fewer than the minimum tokens out. (BEX#505)\",\n },\n BAL506: {\n reasons: [\"BAL#506\"],\n errorMSG: \"Join would cost more than the maximum tokens in. (BEX#506)\",\n },\n BAL507: {\n reasons: [\"BAL#507\"],\n errorMSG: \"Swap violates user-supplied limits. (BEX#507)\",\n },\n BAL508: {\n reasons: [\"BAL#508\"],\n errorMSG: \"Swap transaction not mined within the deadline. (BEX#508)\",\n },\n BAL509: {\n reasons: [\"BAL#509\"],\n errorMSG: \"Cannot swap the same token. (BEX#509)\",\n },\n BAL510: {\n reasons: [\"BAL#510\"],\n errorMSG: \"Unknown amount in the first swap of a batch. (BEX#510)\",\n },\n BAL511: {\n reasons: [\"BAL#511\"],\n errorMSG: \"Malconstructed multihop swap. (BEX#511)\",\n },\n BAL512: {\n reasons: [\"BAL#512\"],\n errorMSG: \"Internal balance overflow. (BEX#512)\",\n },\n BAL513: {\n reasons: [\"BAL#513\"],\n errorMSG: \"Insufficient internal balance. (BEX#513)\",\n },\n BAL514: {\n reasons: [\"BAL#514\"],\n errorMSG: \"Invalid BERA internal balance. (BEX#514)\",\n },\n BAL515: {\n reasons: [\"BAL#515\"],\n errorMSG:\n \"Flashloan must repay the loan in the same transaction. (BEX#515)\",\n },\n BAL516: {\n reasons: [\"BAL#516\"],\n errorMSG: \"Insufficient BERA balance. (BEX#516)\",\n },\n BAL517: {\n reasons: [\"BAL#517\"],\n errorMSG: \"Unallocated BERA. (BEX#517)\",\n },\n BAL518: {\n reasons: [\"BAL#518\"],\n errorMSG:\n \"Relayers cannot receive BERA directly (only through the Vault). (BEX#518)\",\n },\n BAL519: {\n reasons: [\"BAL#519\"],\n errorMSG: \"Cannot use BERA sentinel for internal balance. (BEX#519)\",\n },\n BAL520: {\n reasons: [\"BAL#520\"],\n errorMSG: \"Tokens mismatch. (BEX#520)\",\n },\n BAL521: {\n reasons: [\"BAL#521\"],\n errorMSG: \"Token is not registered. (BEX#521)\",\n },\n BAL522: {\n reasons: [\"BAL#522\"],\n errorMSG: \"Token is already registered. (BEX#522)\",\n },\n BAL523: {\n reasons: [\"BAL#523\"],\n errorMSG: \"Tokens are already set. (BEX#523)\",\n },\n BAL524: {\n reasons: [\"BAL#524\"],\n errorMSG: \"Tokens length must be 2. (BEX#524)\",\n },\n BAL525: {\n reasons: [\"BAL#525\"],\n errorMSG: \"Nonzero token balance detected. (BEX#525)\",\n },\n BAL526: {\n reasons: [\"BAL#526\"],\n errorMSG: \"Balance total overflow detected. (BEX#526)\",\n },\n BAL527: {\n reasons: [\"BAL#527\"],\n errorMSG: \"Pool has no tokens. (BEX#527)\",\n },\n BAL528: {\n reasons: [\"BAL#528\"],\n errorMSG: \"Insufficient flash loan balance. (BEX#528)\",\n },\n // Fees\n BAL600: {\n reasons: [\"BAL#600\"],\n errorMSG: \"Swap fee percentage is too high. (BEX#600)\",\n },\n BAL601: {\n reasons: [\"BAL#601\"],\n errorMSG: \"Flash loan fee percentage is too high. (BEX#601)\",\n },\n BAL602: {\n reasons: [\"BAL#602\"],\n errorMSG: \"Insufficient flash loan fee amount. (BEX#602)\",\n },\n // FeeSplitter\n BAL700: {\n reasons: [\"BAL#700\"],\n errorMSG: \"Splitter fee percentage is too high. (BEX#700)\",\n },\n // Misc\n BAL998: {\n reasons: [\"BAL#998\"],\n errorMSG: \"Unimplemented functionality. (BEX#998)\",\n },\n BAL999: {\n reasons: [\"BAL#999\"],\n errorMSG: \"An unexpected error occurred. (BEX#999)\",\n },\n // SoR swap paths\n NO_SWAP_PATHS: {\n keywords: [\"No swap paths returned\"],\n errorMSG: \"No swap paths were found.\",\n },\n },\n AGGREGATOR: {\n NOT_ENOUGH_LIQUIDITY: {\n keywords: [\"Not enough liquidity\"],\n errorMSG: \"Not enough liquidity. Try a lower amount.\",\n },\n },\n POL: {\n REWARD_VAULT_FACTORY: {\n reasons: [\"VaultAlreadyExists\"],\n errorMSG:\n \"Failed to create action. An action already exists with this staking token.\",\n },\n NOT_REWARD_VAULT_MANAGER: {\n reasons: [\"NotRewardVaultManager\"],\n errorMSG: \"You are not the manager of this action.\",\n },\n NOT_INCENTIVE_MANAGER: {\n reasons: [\"NotIncentiveManager\"],\n errorMSG: \"You are not the incentive manager of this token.\",\n },\n DURATION_CHANGE_NOT_ALLOWED: {\n reasons: [\"DurationChangeNotAllowed\"],\n errorMSG: \"You cannot change the duration of this action.\",\n },\n INVALID_PROOF: {\n reasons: [\"InvalidProof\"],\n errorMSG: \"Tokens already claimed or invalid proof.\",\n },\n CONTRACT_PAUSED: {\n reasons: [\"EnforcedPause\"],\n errorMSG: \"The contract you're interacting with is temporarily paused.\",\n },\n DISTRIBUTION_PAUSED: {\n reasons: [\"DistributionEnforcedPause\"],\n errorMSG: \"Distribution is temporarily paused.\",\n },\n INVALID_VALIDATOR_COMMISSION: {\n reasons: [\"InvalidCommissionValue\"],\n errorMSG: \"Invalid commission percentage.\",\n },\n NOT_REWARD_ALLOCATOR: {\n reasons: [\"NotRewardAllocator\"],\n errorMSG: \"You are not the reward allocator of this validator.\",\n },\n NOT_OPERATOR: {\n reasons: [\"NotOperator\"],\n errorMSG: \"You are not the operator of this validator.\",\n },\n INVALID_REWARD_ALLOCATION: {\n reasons: [\"InvalidRewardAllocationWeights\"],\n errorMSG: \"Invalid reward allocation weights.\",\n },\n NOT_REWARD_DURATION_MANAGER: {\n reasons: [\"NotRewardDurationManager\"],\n errorMSG: \"You are not the reward duration manager of this validator.\",\n },\n },\n BEND: {\n INSUFFICIENT_POSITION: {\n keywords: [\"insufficient position\"],\n errorMSG: \"Insufficient position\",\n },\n INSUFFICIENT_LIQUIDITY: {\n keywords: [\"insufficient liquidity on market\"],\n errorMSG: \"Insufficient liquidity on market.\",\n },\n ALL_CAPS_REACHED: {\n reasons: [\"AllCapsReached\"],\n errorMSG: \"All caps reached on vault.\",\n },\n AboveMaxTimelock: {\n reasons: [\"AboveMaxTimelock\"],\n errorMSG: \"Above max timelock\",\n },\n AddressEmptyCode: {\n reasons: [\"AddressEmptyCode\"],\n errorMSG: \"Address empty code\",\n },\n AddressInsufficientBalance: {\n reasons: [\"AddressInsufficientBalance\"],\n errorMSG: \"Address insufficient balance\",\n },\n AllCapsReached: {\n reasons: [\"AllCapsReached\"],\n errorMSG: \"All caps reached\",\n },\n AlreadyPending: {\n reasons: [\"AlreadyPending\"],\n errorMSG: \"Already pending\",\n },\n AlreadySet: {\n reasons: [\"AlreadySet\"],\n errorMSG: \"Already set\",\n },\n BelowMinTimelock: {\n reasons: [\"BelowMinTimelock\"],\n errorMSG: \"Below min timelock\",\n },\n DuplicateMarket: {\n reasons: [\"DuplicateMarket\"],\n errorMSG: \"Duplicate market\",\n },\n ECDSAInvalidSignature: {\n reasons: [\"ECDSAInvalidSignature\"],\n errorMSG: \"Invalid ECDSA signature\",\n },\n ECDSAInvalidSignatureLength: {\n reasons: [\"ECDSAInvalidSignatureLength\"],\n errorMSG: \"Invalid ECDSA signature length\",\n },\n ECDSAInvalidSignatureS: {\n reasons: [\"ECDSAInvalidSignatureS\"],\n errorMSG: \"Invalid ECDSA signature S value\",\n },\n ERC20InsufficientBalance: {\n reasons: [\"ERC20InsufficientBalance\"],\n errorMSG: \"ERC20 insufficient balance\",\n },\n ERC20InvalidApprover: {\n reasons: [\"ERC20InvalidApprover\"],\n errorMSG: \"ERC20 invalid approver\",\n },\n ERC20InvalidReceiver: {\n reasons: [\"ERC20InvalidReceiver\"],\n errorMSG: \"ERC20 invalid receiver\",\n },\n ERC20InvalidSender: {\n reasons: [\"ERC20InvalidSender\"],\n errorMSG: \"ERC20 invalid sender\",\n },\n ERC20InvalidSpender: {\n reasons: [\"ERC20InvalidSpender\"],\n errorMSG: \"ERC20 invalid spender\",\n },\n ERC2612ExpiredSignature: {\n reasons: [\"ERC2612ExpiredSignature\"],\n errorMSG: \"ERC2612 expired signature\",\n },\n ERC2612InvalidSigner: {\n reasons: [\"ERC2612InvalidSigner\"],\n errorMSG: \"ERC2612 invalid signer\",\n },\n ERC4626ExceededMaxDeposit: {\n reasons: [\"ERC4626ExceededMaxDeposit\"],\n errorMSG: \"ERC4626 exceeded max deposit\",\n },\n ERC4626ExceededMaxMint: {\n reasons: [\"ERC4626ExceededMaxMint\"],\n errorMSG: \"ERC4626 exceeded max mint\",\n },\n ERC4626ExceededMaxRedeem: {\n reasons: [\"ERC4626ExceededMaxRedeem\"],\n errorMSG: \"ERC4626 exceeded max redeem\",\n },\n ERC4626ExceededMaxWithdraw: {\n reasons: [\"ERC4626ExceededMaxWithdraw\"],\n errorMSG: \"ERC4626 exceeded max withdraw\",\n },\n FailedInnerCall: {\n reasons: [\"FailedInnerCall\"],\n errorMSG: \"Failed inner call\",\n },\n InconsistentAsset: {\n reasons: [\"InconsistentAsset\"],\n errorMSG: \"Inconsistent asset\",\n },\n InconsistentReallocation: {\n reasons: [\"InconsistentReallocation\"],\n errorMSG: \"Inconsistent reallocation\",\n },\n InvalidAccountNonce: {\n reasons: [\"InvalidAccountNonce\"],\n errorMSG: \"Invalid account nonce\",\n },\n InvalidMarketRemovalNonZeroCap: {\n reasons: [\"InvalidMarketRemovalNonZeroCap\"],\n errorMSG: \"Invalid market removal (non-zero cap)\",\n },\n InvalidMarketRemovalNonZeroSupply: {\n reasons: [\"InvalidMarketRemovalNonZeroSupply\"],\n errorMSG: \"Invalid market removal (non-zero supply)\",\n },\n InvalidMarketRemovalTimelockNotElapsed: {\n reasons: [\"InvalidMarketRemovalTimelockNotElapsed\"],\n errorMSG: \"Invalid market removal (timelock not elapsed)\",\n },\n InvalidShortString: {\n reasons: [\"InvalidShortString\"],\n errorMSG: \"Invalid short string\",\n },\n MarketNotCreated: {\n reasons: [\"MarketNotCreated\"],\n errorMSG: \"Market not created\",\n },\n MarketNotEnabled: {\n reasons: [\"MarketNotEnabled\"],\n errorMSG: \"Market not enabled\",\n },\n MathOverflowedMulDiv: {\n reasons: [\"MathOverflowedMulDiv\"],\n errorMSG: \"Math overflow\",\n },\n MaxFeeExceeded: {\n reasons: [\"MaxFeeExceeded\"],\n errorMSG: \"Max fee exceeded\",\n },\n MaxQueueLengthExceeded: {\n reasons: [\"MaxQueueLengthExceeded\"],\n errorMSG: \"Max queue length exceeded\",\n },\n NoPendingValue: {\n reasons: [\"NoPendingValue\"],\n errorMSG: \"No pending value\",\n },\n NonZeroCap: {\n reasons: [\"NonZeroCap\"],\n errorMSG: \"Non-zero cap\",\n },\n NotAllocatorRole: {\n reasons: [\"NotAllocatorRole\"],\n errorMSG: \"Not allocator role\",\n },\n NotCuratorNorGuardianRole: {\n reasons: [\"NotCuratorNorGuardianRole\"],\n errorMSG: \"Not curator or guardian role\",\n },\n NotCuratorRole: {\n reasons: [\"NotCuratorRole\"],\n errorMSG: \"Not curator role\",\n },\n NotEnoughLiquidity: {\n reasons: [\"NotEnoughLiquidity\"],\n errorMSG: \"Not enough liquidity\",\n },\n NotGuardianRole: {\n reasons: [\"NotGuardianRole\"],\n errorMSG: \"Not guardian role\",\n },\n OwnableInvalidOwner: {\n reasons: [\"OwnableInvalidOwner\"],\n errorMSG: \"Invalid owner\",\n },\n OwnableUnauthorizedAccount: {\n reasons: [\"OwnableUnauthorizedAccount\"],\n errorMSG: \"Unauthorized account\",\n },\n PendingCap: {\n reasons: [\"PendingCap\"],\n errorMSG: \"Pending cap\",\n },\n PendingRemoval: {\n reasons: [\"PendingRemoval\"],\n errorMSG: \"Pending removal\",\n },\n SafeCastOverflowedUintDowncast: {\n reasons: [\"SafeCastOverflowedUintDowncast\"],\n errorMSG: \"SafeCast overflow\",\n },\n SafeERC20FailedOperation: {\n reasons: [\"SafeERC20FailedOperation\"],\n errorMSG: \"SafeERC20 failed operation\",\n },\n StringTooLong: {\n reasons: [\"StringTooLong\"],\n errorMSG: \"String too long\",\n },\n SupplyCapExceeded: {\n reasons: [\"SupplyCapExceeded\"],\n errorMSG: \"Supply cap exceeded\",\n },\n TimelockNotElapsed: {\n reasons: [\"TimelockNotElapsed\"],\n errorMSG: \"Timelock not elapsed\",\n },\n UnauthorizedMarket: {\n reasons: [\"UnauthorizedMarket\"],\n errorMSG: \"Unauthorized market\",\n },\n ZeroAddress: {\n reasons: [\"ZeroAddress\"],\n errorMSG: \"Zero address\",\n },\n ZeroFeeRecipient: {\n reasons: [\"ZeroFeeRecipient\"],\n errorMSG: \"Zero fee recipient\",\n },\n },\n} as const satisfies ErrorMessages;\n","import { type ErrorCategory, errorMsgMap, GENERAL_ERROR } from \"./errorMap\";\n\nexport interface MatchedError {\n /** The error key in the errorMap (e.g. \"NOT_ENOUGH_GAS_TOKEN\") */\n key: string;\n /** The category in the errorMap (e.g. \"RPC\", \"BEX\") */\n category: string;\n /** The user-friendly display message */\n errorMSG: string;\n /** Whether the match was by exact reason (true) or keyword (false) */\n matchedByReason: boolean;\n}\n\n/**\n * Finds the matching error entry in errorMap by reason or message.\n *\n * ## Matching priority:\n * 1. **Exact reason match** (preferred): checks `errorType.reasons` for an exact string match.\n * 2. **Keyword fallback**: checks `errorType.keywords` for case-insensitive substring matches in `message`.\n *\n * @returns The matched error entry with key and category, or null if no match found.\n */\nexport function findMatchingError({\n reason,\n message,\n}: {\n reason?: string | null;\n message?: string;\n}): MatchedError | null {\n for (const category in errorMsgMap) {\n const categoryKey = category as keyof typeof errorMsgMap;\n const errors = errorMsgMap[categoryKey] as ErrorCategory;\n\n for (const type in errors) {\n const errorType = errors[type];\n\n // Priority 1: Exact reason match (deterministic, preferred for contract revert reasons)\n if (reason) {\n if (\n errorType?.reasons?.some((r) => {\n return r === reason;\n })\n ) {\n return {\n key: type,\n category,\n errorMSG: errorType.errorMSG,\n matchedByReason: true,\n };\n }\n }\n\n // Priority 2: Keyword substring match on message (case-insensitive fallback, use carefully)\n if (\n errorType?.keywords?.some((keyword) => {\n return message?.toLowerCase().includes(keyword.toLowerCase().trim());\n })\n ) {\n return {\n key: type,\n category,\n errorMSG: errorType.errorMSG,\n matchedByReason: false,\n };\n }\n }\n }\n\n return null;\n}\n\n/**\n * Resolves a user-friendly displayMessage by matching `reason` and `message` against `errorMap.ts`.\n *\n * This is the bridge between the automatic reason detection pipeline (parseViemError) and\n * the user-facing error messages. Called by the BeraError constructor.\n *\n * ## Matching priority:\n * 1. **Exact reason match** (preferred): checks `errorType.reasons` for an exact string match.\n * This is the most reliable path — contract revert reasons like \"NotEnoughBalance\" or \"BAL#508\"\n * are matched deterministically.\n * 2. **Keyword fallback**: checks `errorType.keywords` for case-insensitive substring matches in `message`.\n * Use sparingly — keyword matching can cause false positives (e.g. \"InsufficientBalance\"\n * keyword would also match \"InsufficientBalanceToPayPythFee\").\n * 3. **GENERAL_ERROR fallback**: \"Something went wrong. Please try again later.\"\n *\n * To ensure new contract errors get good displayMessages, add their reason to `errorMap.ts`.\n * The reason is auto-detected by parseViemError — you only need to map it to a message here.\n */\nexport function getErrorMessage({\n reason,\n message,\n}: {\n reason?: string | null;\n message?: string;\n}): string {\n return findMatchingError({ reason, message })?.errorMSG ?? GENERAL_ERROR;\n}\n","import { type Abi, BaseError } from \"viem\";\n\nimport { appConfig } from \"@berachain/config/internal\";\n\nimport { GENERAL_ERROR } from \"./errorMap\";\nimport { findMatchingError } from \"./getErrorMessage\";\nimport { parseViemError, rpcErrorToReason } from \"./parseViemError\";\nimport type { SeverityLevel } from \"./severity\";\n\nexport interface IBeraErrorArgs {\n message?: string;\n displayMessage?: string;\n cause?: unknown;\n reason?: string;\n chainId?: number;\n fingerprint?: string[];\n /**\n * The level of the error to be used for error reporting.\n */\n level?: SeverityLevel;\n tags?: {\n [key in TagsKey]?: Primitive;\n };\n extra?: Record<string, unknown>;\n /**\n * Optional ABI to be used to parse the error.\n */\n abi?: Abi;\n}\n\ntype Primitive = number | string | boolean | bigint | symbol | null | undefined;\n\n/**\n * An helper type to make sure we only use the allowed tags. Sync this with docs/errors.md\n */\ntype TagsKey =\n | \"wallet.chain\"\n | \"wallet.connector\"\n | \"wallet.address\"\n | \"error.reason\"\n | \"operation.type\"\n | \"operation.key\"\n | \"operation.txn.functionName\"\n | \"operation.txn.to\"\n | \"operation.txn.status\"\n | \"operation.source.url\"\n | \"operation.source.name\"\n | \"operation.source.queryName\"\n | \"operation.source.type\";\n\n/**\n * Base error class for the entire berajs SDK.\n *\n * All errors should be a BeraError or one of its subclasses. Unknown errors should be\n * normalized via `initBeraError({ cause })`.\n *\n * Key design: the constructor runs an **automatic reason detection pipeline** when `reason`\n * is not explicitly provided. It calls `parseViemError` on the `cause` to extract a\n * machine-readable reason code (e.g. \"NotEnoughBalance\", \"BAL#508\", \"UserRejectedRequestError\").\n * That reason is then matched against `errorMap.ts` to resolve a user-friendly `displayMessage`.\n *\n * This means: for most viem errors, you only need to pass `cause` and everything else\n * (reason, displayMessage, level) is derived automatically.\n *\n * @see parseViemError — the reason extraction engine\n * @see errorMap.ts — reason → displayMessage mapping\n * @see initBeraError — normalizes any error into a BeraError (preferred entry point)\n */\nexport class BeraError extends Error {\n /**\n * A human-readable message that can be displayed to end user.\n *\n * In berachain dapps, this is shown in the error pop-up.\n */\n displayMessage: string;\n\n /**\n * The cause of the error.\n *\n * This is typically the error that was thrown.\n */\n cause: unknown;\n\n /**\n * The chain id of the error.\n */\n chainId?: number;\n\n /**\n * The code for the reason for the error.\n *\n * This is typically the error code can be found in the errorMap.ts file. I.e. NotEnoughBalance or BAL#508\n */\n reason: string | null = null;\n\n /**\n * The fingerprint for the error.\n *\n * This is typically used to group errors in Sentry.\n */\n fingerprint: string[] | undefined;\n\n private _tags: {\n [key: string | TagsKey]: Primitive;\n } = {};\n\n set tags(tags: {\n [key: string | TagsKey]: Primitive;\n }) {\n this._tags = tags;\n }\n\n get tags(): {\n [key: string | TagsKey]: Primitive;\n } {\n return {\n ...this._tags,\n \"error.displayMessage\": this.displayMessage,\n \"error.reason\": this.reason,\n \"error.level\": this.level,\n };\n }\n\n level: SeverityLevel = \"error\";\n\n extra: Record<string, unknown> = {};\n\n constructor({\n message: m,\n displayMessage: dm,\n cause,\n reason,\n level,\n abi,\n tags,\n chainId,\n fingerprint,\n }: IBeraErrorArgs) {\n let message = m;\n\n if (!message) {\n if (cause instanceof BaseError) {\n // Using shortMesage as it doesn't include the payload.\n message = cause.shortMessage;\n } else if (cause instanceof Error) {\n message = cause.message;\n } else if (\n typeof cause === \"object\" &&\n cause !== null &&\n \"message\" in cause &&\n typeof cause.message === \"string\"\n ) {\n // this covers responses from HTTP requests\n message = cause.message;\n }\n }\n super(message, {\n cause,\n });\n\n this.name = \"BeraError\";\n\n this.fingerprint = fingerprint;\n\n this.cause = cause;\n\n this.chainId = chainId;\n\n // ── Automatic reason detection ──────────────────────────────────────\n // If `reason` was provided explicitly, use it directly.\n // Otherwise, attempt to extract it from the `cause` by unwrapping the viem error chain.\n // parseViemError walks nested errors (ContractFunctionExecutionError →\n // ContractFunctionRevertedError → RpcRequestError) and decodes revert data using ABI.\n // The extracted reason (e.g. \"NotEnoughBalance\", \"BAL#508\") is the key that drives\n // displayMessage resolution and Sentry fingerprinting.\n if (reason) {\n this.reason = reason;\n } else if (cause instanceof Error) {\n try {\n const parsed = parseViemError({\n error: cause,\n revertIfUnknown: true,\n abi,\n });\n\n this.reason = parsed?.reason ?? null;\n } catch {\n // parseViemError throws when it can't identify the error type and revertIfUnknown=true.\n // In that case, reason stays null and displayMessage falls back to GENERAL_ERROR.\n }\n }\n\n // ── Level inference ─────────────────────────────────────────────────\n // User rejections are \"info\" (not actionable by devs), everything else defaults to \"error\".\n if (level) {\n this.level = level;\n } else if (this.reason === rpcErrorToReason(\"UserRejectedRequestError\")) {\n this.level = \"info\";\n } else {\n this.level = \"error\";\n }\n\n // ── displayMessage resolution ─────────────────────────────────────────\n // Priority:\n // 1. Explicit `displayMessage` passed by caller\n // 2. Cascaded from a BeraError cause (if it has a non-generic message)\n // 3. Looked up from errorMap.ts using the detected `reason` and `message`\n // 4. GENERAL_ERROR fallback: \"Something went wrong. Please try again later.\"\n let displayMessage = dm;\n\n if (\n this.cause instanceof BeraError &&\n this.cause.displayMessage !== GENERAL_ERROR\n ) {\n // Cascade: inner BeraError already resolved a good displayMessage, reuse it\n displayMessage = this.cause.displayMessage;\n }\n\n if (!displayMessage) {\n // Match reason (exact) or message (keyword) against errorMap.ts\n const matched = findMatchingError(this);\n displayMessage = matched?.errorMSG;\n\n // ── Reason normalization ──────────────────────────────────────────\n // If the reason was resolved from a raw error message (e.g. \"insufficient funds for\n // gas * price + value: have X want Y\") rather than a stable key (e.g. \"InsufficientFundsError\"),\n // normalize it to the matched errorMap key (e.g. \"NOT_ENOUGH_GAS\") for stable Sentry fingerprinting.\n if (matched && !matched.matchedByReason && this.reason) {\n this.reason = matched.key;\n }\n }\n\n this.displayMessage = displayMessage ?? GENERAL_ERROR;\n\n this.tags = {\n ...this.tags,\n ...tags,\n };\n // Useful for debugging in development or on vercel preview links\n if (!appConfig.env.isProduction && process.env.NODE_ENV !== \"test\") {\n console.group(\"BeraError thrown\");\n console.debug(\"Level\", this.level);\n console.debug(\"Reason\", this.reason);\n console.debug(\"Message\", this.message);\n console.debug(\"Display Message\", this.displayMessage);\n console.debug(\"Cause\", this.cause);\n console.groupEnd();\n }\n }\n}\n","export const bundler3errorsAbi = [\n { inputs: [], name: \"AlreadyInitiated\", type: \"error\" },\n { inputs: [], name: \"EmptyBundle\", type: \"error\" },\n { inputs: [], name: \"IncorrectReenterHash\", type: \"error\" },\n { inputs: [], name: \"MissingExpectedReenter\", type: \"error\" },\n] as const;\n","/**\n * A list of ERC20 error codes according to eip-6093 and solady.\n *\n * This is needed since viem erc20Abi does not include error codes.\n */\nexport const erc20errorsAbi = [\n { inputs: [], name: \"AllowanceOverflow\", type: \"error\" },\n { inputs: [], name: \"AllowanceUnderflow\", type: \"error\" },\n { inputs: [], name: \"ETHTransferFailed\", type: \"error\" },\n { inputs: [], name: \"InsufficientAllowance\", type: \"error\" },\n { inputs: [], name: \"InsufficientBalance\", type: \"error\" },\n { inputs: [], name: \"InvalidPermit\", type: \"error\" },\n { inputs: [], name: \"Permit2AllowanceIsFixedAtInfinity\", type: \"error\" },\n { inputs: [], name: \"PermitExpired\", type: \"error\" },\n { inputs: [], name: \"TotalSupplyOverflow\", type: \"error\" },\n { name: \"AllowanceOverflow\", type: \"error\", inputs: [] },\n { name: \"AllowanceUnderflow\", type: \"error\", inputs: [] },\n { name: \"InsufficientAllowance\", type: \"error\", inputs: [] },\n { name: \"InsufficientBalance\", type: \"error\", inputs: [] },\n { name: \"InvalidPermit\", type: \"error\", inputs: [] },\n { name: \"Permit2AllowanceIsFixedAtInfinity\", type: \"error\", inputs: [] },\n { name: \"PermitExpired\", type: \"error\", inputs: [] },\n { name: \"TotalSupplyOverflow\", type: \"error\", inputs: [] },\n { name: \"ECDSAInvalidSignature\", type: \"error\", inputs: [] },\n {\n name: \"ECDSAInvalidSignatureLength\",\n type: \"error\",\n inputs: [{ type: \"uint256\" }],\n },\n {\n name: \"ECDSAInvalidSignatureS\",\n type: \"error\",\n inputs: [{ type: \"bytes32\" }],\n },\n {\n name: \"ERC20InsufficientAllowance\",\n type: \"error\",\n inputs: [{ type: \"address\" }, { type: \"uint256\" }, { type: \"uint256\" }],\n },\n {\n name: \"ERC20InsufficientBalance\",\n type: \"error\",\n inputs: [{ type: \"address\" }, { type: \"uint256\" }, { type: \"uint256\" }],\n },\n {\n name: \"ERC20InvalidApprover\",\n type: \"error\",\n inputs: [{ type: \"address\" }],\n },\n {\n name: \"ERC20InvalidReceiver\",\n type: \"error\",\n inputs: [{ type: \"address\" }],\n },\n { name: \"ERC20InvalidSender\", type: \"error\", inputs: [{ type: \"address\" }] },\n { name: \"ERC20InvalidSpender\", type: \"error\", inputs: [{ type: \"address\" }] },\n {\n name: \"ERC2612ExpiredSignature\",\n type: \"error\",\n inputs: [{ type: \"uint256\" }],\n },\n {\n name: \"ERC2612InvalidSigner\",\n type: \"error\",\n inputs: [{ type: \"address\" }, { type: \"address\" }],\n },\n {\n name: \"InvalidAccountNonce\",\n type: \"error\",\n inputs: [{ type: \"address\" }, { type: \"uint256\" }],\n },\n { name: \"InvalidShortString\", type: \"error\", inputs: [] },\n { name: \"StringTooLong\", type: \"error\", inputs: [{ type: \"string\" }] },\n] as const;\n","export const openChainErrorsAbi = [\n {\n name: \"AllowanceExpired\",\n type: \"error\",\n inputs: [\n {\n type: \"uint256\",\n },\n ],\n },\n {\n name: \"AssetNotRegistered\",\n type: \"error\",\n inputs: [\n {\n type: \"address\",\n },\n ],\n },\n {\n name: \"ERC20InsufficientAllowance\",\n type: \"error\",\n inputs: [\n {\n type: \"address\",\n },\n {\n type: \"uint256\",\n },\n {\n type: \"uint256\",\n },\n ],\n },\n {\n name: \"ERC4626ExceededMaxWithdraw\",\n type: \"error\",\n inputs: [\n {\n type: \"address\",\n },\n {\n type: \"uint256\",\n },\n {\n type: \"uint256\",\n },\n ],\n },\n {\n name: \"ERC721NonexistentToken\",\n type: \"error\",\n inputs: [\n {\n type: \"uint256\",\n },\n ],\n },\n {\n name: \"ExecutionFailed\",\n type: \"error\",\n inputs: [\n {\n type: \"uint256\",\n },\n {\n type: \"address\",\n },\n {\n type: \"string\",\n },\n ],\n },\n {\n name: \"ExpiredTransaction\",\n type: \"error\",\n inputs: [],\n },\n {\n name: \"FailedToCallFunction\",\n type: \"error\",\n inputs: [\n {\n type: \"bytes\",\n },\n ],\n },\n {\n name: \"InsufficientAmountOut\",\n type: \"error\",\n inputs: [],\n },\n {\n name: \"MinimalOutputBalanceViolation\",\n type: \"error\",\n inputs: [\n {\n type: \"address\",\n },\n {\n type: \"uint256\",\n },\n ],\n },\n {\n name: \"NotPegged\",\n type: \"error\",\n inputs: [\n {\n type: \"address\",\n },\n ],\n },\n {\n name: \"RedeemMoreThanMax\",\n type: \"error\",\n inputs: [],\n },\n {\n name: \"SignatureExpired\",\n type: \"error\",\n inputs: [\n {\n type: \"uint256\",\n },\n ],\n },\n {\n name: \"SlippageExceeded\",\n type: \"error\",\n inputs: [\n {\n type: \"uint256\",\n },\n {\n type: \"uint256\",\n },\n ],\n },\n {\n name: \"SlippageExceeded\",\n type: \"error\",\n inputs: [],\n },\n {\n name: \"StalePrice\",\n type: \"error\",\n inputs: [],\n },\n {\n name: \"TooMuchSlippage\",\n type: \"error\",\n inputs: [\n {\n type: \"address\",\n },\n {\n type: \"uint256\",\n },\n {\n type: \"uint256\",\n },\n ],\n },\n {\n name: \"TransferFromFailed\",\n type: \"error\",\n inputs: [],\n },\n {\n name: \"UnexpectedBasketModeStatus\",\n type: \"error\",\n inputs: [],\n },\n {\n name: \"zeroAmountRequired\",\n type: \"error\",\n inputs: [],\n },\n] as const;\n","import { bundler3errorsAbi } from \"./bundler3errors\";\nimport { erc20errorsAbi } from \"./erc20errors\";\nimport { openChainErrorsAbi } from \"./openChainErrors\";\n\nexport const commonAbiErrors = [\n ...erc20errorsAbi,\n ...bundler3errorsAbi,\n ...openChainErrorsAbi,\n] as const;\n","import {\n type Abi,\n AtomicReadyWalletRejectedUpgradeError,\n BaseError,\n ContractFunctionExecutionError,\n ContractFunctionRevertedError,\n type DecodeErrorResultReturnType,\n decodeErrorResult,\n HttpRequestError,\n type ProviderRpcErrorCode,\n RpcRequestError,\n TransactionExecutionError,\n UserRejectedRequestError,\n} from \"viem\";\n\nimport { commonAbiErrors } from \"~/abi/utils/commonAbiErrors\";\n\n/**\n * Duck-type check for viem's BaseError.\n *\n * We can't always rely on `instanceof BaseError` because viem errors may originate\n * from a different version of the `viem` package (e.g. in dependency tree mismatches).\n * The duck-type fallback checks for the structural shape that all viem errors share:\n * `shortMessage`, `message`, and `details`.\n */\nfunction isBaseError(error: unknown): error is BaseError {\n if (error instanceof BaseError) {\n return true;\n }\n\n if (\n error instanceof Error &&\n \"shortMessage\" in error &&\n \"message\" in error &&\n \"details\" in error\n ) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Type-guard for specific viem error types.\n *\n * Uses both `instanceof` and `error.name` to handle cases where the error\n * was created by a different viem version (name-based fallback).\n */\nfunction isViemError<T extends Error>(\n error: Error,\n name: T[\"name\"],\n shouldBeInstanceOf: new (...args: any[]) => T,\n): error is T {\n if (error instanceof shouldBeInstanceOf) {\n return true;\n }\n\n if (error.name === name) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Extracts a human-readable reason string from a decoded Solidity error.\n *\n * Solidity has two kinds of revert errors:\n * - `revert(\"some message\")` → decoded as `Error(string)` where the message is in `args[0]`.\n * In this case we return the string argument (e.g. `\"BAL#508\"`).\n * - `revert CustomError(...)` → decoded as `CustomError(...)` where `errorName` is the\n * custom error name. In this case we return `errorName` (e.g. `\"NotEnoughBalance\"`).\n *\n * The returned string is used as the `reason` field in BeraError and is matched against\n * `errorMap.ts` to resolve a user-friendly `displayMessage`.\n */\nexport function parseDecodedError<const abi extends Abi | readonly unknown[]>(\n error: DecodeErrorResultReturnType<abi>,\n): string | undefined {\n if (\n error.errorName === \"Error\" &&\n Array.isArray(error.args) &&\n error.args?.at(0)\n ) {\n // Solidity `revert(\"message\")` — the message string is the reason\n return error.args?.at(0) as string;\n }\n\n // Custom error `revert CustomError(...)` — the error name is the reason\n return error.errorName;\n}\n\n/**\n * The reason extraction engine — recursively unwraps viem error chains to extract\n * a machine-readable `reason` string.\n *\n * This function is the core of the automatic reason detection system. It is called by:\n * - `BeraError` constructor (when `reason` is not manually provided)\n * - `initBeraError` (to detect if the error is a RequestError)\n * - `getRevertReason` (after replaying a failed on-chain transaction)\n *\n * ## Viem error chain structure\n *\n * Viem errors are deeply nested. The typical chains look like:\n *\n * **From `simulateContract`:**\n * ```\n * ContractFunctionExecutionError ← wrapper, skipped\n * └── ContractFunctionRevertedError ← reason extracted here (cause.reason / cause.signature)\n * ```\n *\n * **From `publicClient.call` (raw call):**\n * ```\n * CallExecutionError ← wrapper, skipped\n * └── ExecutionRevertedError ← wrapper, skipped\n * └── RpcRequestError ← reason decoded from cause.data using ABI\n * ```\n *\n * **From `writeContract` / `sendTransaction`:**\n * ```\n * TransactionExecutionError ← checked for special wallet errors\n * └── UserRejectedRequestError ← \"UserRejectedRequestError\"\n * └── AtomicReadyWalletRejectedUpgradeError ← \"AtomicReadyWalletRejectedUpgradeError\"\n * ```\n *\n * **From RPC transport failures:**\n * ```\n * ContractFunctionExecutionError ← wrapper, skipped\n * └── HttpRequestError ← \"HttpRequestError(status:<code>)\", isRequestError=true\n * ```\n *\n * The function walks `cause.cause` in a while loop until it finds an error type it can\n * extract a reason from, or runs out of nested causes.\n *\n * ## Parameters\n *\n * @param error - Any Error instance (typically a viem BaseError).\n * @param abi - Optional contract ABI. Merged with `commonAbiErrors` to decode revert data.\n * Passing the correct ABI enables decoding custom error names (e.g. \"SlippageExceeded\")\n * instead of falling back to hex selectors (e.g. \"0xa3b1e29f\").\n * @param revertIfUnknown - If true, throws when the error doesn't match any known pattern.\n * The BeraError constructor calls with `true`; `initBeraError` calls with `false`.\n *\n * @returns `{ reason, rootCause, isRequestError? }` where:\n * - `reason` is the extracted error code/name (matched against errorMap.ts for displayMessage)\n * - `rootCause` is the deepest error in the chain that was identified\n * - `isRequestError` is true if the error is an HTTP/RPC transport failure\n */\nexport function parseViemError({\n error,\n abi,\n revertIfUnknown = true,\n}: {\n error: Error;\n abi?: Abi;\n revertIfUnknown: boolean;\n}): {\n reason: string | undefined;\n rootCause: unknown;\n isRequestError?: boolean;\n} {\n // If it's not a viem-shaped error, either rethrow or return the message as-is\n if (!isBaseError(error)) {\n if (revertIfUnknown) {\n throw error;\n }\n\n if (error instanceof BaseError) {\n return { reason: error.shortMessage, rootCause: error };\n }\n\n return { reason: error.message, rootCause: error };\n }\n\n // Begin unwrapping the nested error chain\n let cause: unknown = error;\n\n // Walk the nested viem error chain from outermost to innermost.\n // Each iteration checks for known error types and either extracts the reason or\n // skips the wrapper to go deeper into `cause.cause`.\n while (isBaseError(cause)) {\n // ── Step 1: Skip wrapper errors that don't carry reason data ────────────\n // ContractFunctionExecutionError is a top-level wrapper from simulateContract/writeContract.\n // The actual revert info is in its nested cause.\n if (\n isViemError(\n cause,\n \"ContractFunctionExecutionError\",\n ContractFunctionExecutionError,\n )\n ) {\n cause = cause.cause;\n continue;\n }\n\n // ── Step 2: Check for wallet-level errors ──────────────────────────────\n // TransactionExecutionError wraps errors from wallet interactions (sendTransaction).\n // Check for EIP-7702 smart wallet upgrade rejection specifically.\n if (\n isViemError(cause, \"TransactionExecutionError\", TransactionExecutionError)\n ) {\n if (cause.cause instanceof AtomicReadyWalletRejectedUpgradeError) {\n return {\n reason: \"AtomicReadyWalletRejectedUpgradeError\",\n rootCause: cause.cause,\n };\n }\n }\n\n // ── Step 3: RpcRequestError — from raw `publicClient.call` ─────────────\n // Error chain: CallExecutionError → ExecutionRevertedError → RpcRequestError\n // The revert data is in `cause.data` as raw hex bytes.\n // We decode it using the provided ABI + commonAbiErrors to get the error name.\n if (isViemError(cause, \"RpcRequestError\", RpcRequestError)) {\n if (!cause.data) {\n // No revert data available — check if there's a nested message (special RPC cases)\n if (\n typeof cause.cause === \"object\" &&\n cause.cause &&\n \"message\" in cause.cause &&\n typeof cause.cause.message === \"string\"\n ) {\n return { reason: cause.cause.message, rootCause: cause.cause };\n }\n\n throw new Error(\"No data\", { cause });\n }\n\n // Decode the raw revert bytes into a structured error using ABI.\n // commonAbiErrors includes Error(string) and Panic(uint256) so standard reverts\n // are always decodable even without a user-provided ABI.\n const decodedError = decodeErrorResult({\n data: cause.data as `0x${string}`,\n abi: [...commonAbiErrors, ...(abi ?? [])],\n });\n\n return {\n reason: parseDecodedError(decodedError) ?? cause.shortMessage,\n rootCause: cause,\n };\n }\n\n // ── Step 4: ContractFunctionRevertedError — from `simulateContract` ────\n // Error chain: ContractFunctionExecutionError → ContractFunctionRevertedError\n // Viem already decoded the revert using the ABI passed to simulateContract.\n // `cause.reason` is the decoded error name (e.g. \"NotEnoughBalance\").\n // `cause.signature` is the 4-byte selector fallback (e.g. \"0x13be252b\").\n // `cause.data?.errorName` is another fallback from the decoded data.\n if (\n isViemError(\n cause,\n \"ContractFunctionRevertedError\",\n ContractFunctionRevertedError,\n )\n ) {\n return {\n reason:\n cause.reason ??\n cause.signature ??\n cause.data?.errorName ??\n cause.shortMessage,\n rootCause: cause,\n };\n }\n\n // ── Step 5: UserRejectedRequestError — wallet popup dismissed ──────────\n // The user clicked \"Reject\" in their wallet. Level is set to \"info\" by BeraError constructor.\n if (\n isViemError(cause, \"UserRejectedRequestError\", UserRejectedRequestError)\n ) {\n return { reason: \"UserRejectedRequestError\", rootCause: cause };\n }\n\n // ── Step 6: HttpRequestError — RPC transport failure ───────────────────\n // The RPC endpoint returned an HTTP error (e.g. 502, 503).\n // Flagged as isRequestError so initBeraError can wrap it in a RequestError.\n if (isViemError(cause, \"HttpRequestError\", HttpRequestError)) {\n return {\n reason: `HttpRequestError(status:${cause.status})`,\n rootCause: cause,\n isRequestError: true,\n };\n }\n\n // ── Step 7: End of chain — no deeper cause to unwrap ───────────────────\n if (!cause.cause) {\n return { reason: cause.name, rootCause: cause };\n }\n\n // Keep unwrapping\n cause = cause.cause;\n }\n\n if (!revertIfUnknown) {\n return { reason: undefined, rootCause: cause };\n }\n\n // Cannot use BeraError here because of circular dependency\n throw new Error(\"UnknownErrorInGetRevertReason\", {\n cause: cause,\n });\n}\n\n/**\n * Returns the error code thrown by RpcError.\n *\n * @see {@link RpcError}\n * @param errCode - The error code to get the name for.\n * @returns The name of the error code.\n */\nexport function rpcErrorToReason(\n errCode:\n | number\n | ProviderRpcErrorCode\n // Here we add errors for which we know the code\n | \"UserRejectedRequestError\",\n): string {\n switch (errCode) {\n // Actually this should not get here if UserRejectedRequestError is thrown\n case \"UserRejectedRequestError\":\n case 4001:\n return \"UserRejectedRequestError\";\n default:\n return `RPC_ERROR_${errCode}`;\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/liammcaweeney/Work/bera/monobera/packages/berajs/dist/chunk-FCWDGE62.cjs","../src/actions/clients/getEnsoClient.ts"],"names":["isProduction","getEnsoClient","useProxy","args","config","parseBaseArgs","EnsoClient"],"mappings":"AAAA,yuBAAwC,wDAAuD,wDAAgD,uCCApH,sDAED,IAIpBA,CAAAA,CACJ,OAAA,CAAQ,GAAA,CAAI,QAAA,GAAa,aAAA,EAAiB,OAAA,CAAQ,GAAA,CAAI,QAAA,GAAa,MAAA,CAE9D,SAASC,CAAAA,CAAc,CAC5B,QAAA,CAAAC,CAAAA,CAAWF,CAAAA,CACX,GAAGG,CACL,CAAA,CAAsD,CAAC,CAAA,CAAG,CACxD,GAAM,CAAE,MAAA,CAAAC,CAAO,CAAA,CAAIC,iCAAAA,CAAkB,CAAA,CACrC,OAAO,IAAIC,oBAAAA,CAAW,CACpB,OAAA,CAASJ,CAAAA,CACL,CAAA,EAAA","file":"/Users/liammcaweeney/Work/bera/monobera/packages/berajs/dist/chunk-FCWDGE62.cjs","sourcesContent":[null,"import { EnsoClient } from \"@ensofinance/sdk\";\n\nimport { appConfig } from \"@berachain/config/internal\";\n\nimport { parseBaseArgs } from \"~/utils/parseBaseArgs\";\n\nconst isProduction =\n process.env.NODE_ENV !== \"development\" && process.env.NODE_ENV !== \"test\";\n\nexport function getEnsoClient({\n useProxy = isProduction,\n ...args\n}: BeraJS.BaseFunctionArgs & { useProxy?: boolean } = {}) {\n const { config } = parseBaseArgs(args);\n return new EnsoClient({\n baseURL: useProxy\n ? `${config.bex.aggregatorsProxyUrl}/enso/api/v1/`\n : undefined,\n apiKey: useProxy\n ? // no API key since proxy has CORS for .berachain.com domains\n \"\"\n : appConfig.apiKeys.public.enso,\n });\n}\n"]}
|
package/dist/chunk-RW3JFPED.mjs
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{a as qe}from"./chunk-NLVWRMGD.mjs";import{a as Qe,b as _e,c as H}from"./chunk-7WRTK7RJ.mjs";import{a as q,b as j,c as v,d as we,f as O}from"./chunk-2LL3P5PN.mjs";import{A as $e,C as K,E as Pe,F as je,a as ue,b as Ue,c as We,d as de,i as Ce,j as Oe,k as S,l as Me,q as He,x as te,y as Je}from"./chunk-5XWELBWR.mjs";import{a as c,b as ce,d as Le,e as R}from"./chunk-THATXCJK.mjs";import{c as le,d as De,e as ee,f as P,g as $,h as x}from"./chunk-AX2YQQFQ.mjs";import{formatEther as Wt}from"viem";import{metaMorphoV11Abi as Lt}from"@berachain/abis/bend-metamorpho/metaMorphoV11";async function yo({sharesAmount:e,vaultAddress:t,publicClient:r}){let a=await r.readContract({address:t,abi:Lt,functionName:"convertToAssets",args:[e]});return{raw:a,formatted:Wt(a)}}import{ApolloClient as Ot,ServerError as Mt}from"@apollo/client";import{appConfig as Ht}from"@berachain/config/internal";var me=class extends Ot{url;constructor(t){super(t),this.url=t.url}async query(t){let r=_t(t.query),a={url:this.url,type:"graphql"},o={"operation.type":"query","operation.source.url":a.url,"operation.source.type":a.type,"operation.source.queryName":r};try{let i=()=>super.query(t),l=await Qe.startSpan({name:`GraphQL ${r}`,op:"BeraApolloClient.query",attributes:o},i);if(l.error||l.data===void 0)throw new P({level:"fatal",tags:o,message:"Bera Apollo Client: No data returned from query, but error should be thrown since errorPolicy is none"});return{data:l.data}}catch(i){throw!Ht.env.isProduction&&console.error("BeraApolloClient error",i),Mt.is(i)?new $({response:i.response,cause:i,statusCode:i.statusCode,endpoint:a,tags:o}):i instanceof TypeError?new $({level:"fatal",reason:"TypeError",response:i,cause:i,endpoint:a,tags:o}):new $({response:i,tags:o,cause:i,endpoint:a})}}};function _t(e){return e.definitions.find(r=>r.kind==="OperationDefinition")?.name?.value}import{InMemoryCache as Jt}from"@apollo/client";import{HttpLink as $t}from"@apollo/client/link/http";import{getUriFromLink as Ye}from"@berachain/config";import{currentDapp as Ke}from"@berachain/config/internal";import jt from"@berachain/graphql/dex/api";import{gql as Io}from"@apollo/client";function Kt(e){if(!Ke)return e;let t=typeof e=="string"?void 0:e.headers;return{uri:Ye(e),headers:{...t,"x-graphql-client-name":`berachain.${Ke}.${process.env.NEXT_RUNTIME||"browser"}`,"x-graphql-client-version":`${process.env.VERCEL_TARGET_ENV}.${process.env.VERCEL_GIT_COMMIT_SHA}`}}}function _(e,{ssrMode:t,inMemoryCacheOptions:r}={}){let a=Ye(e),o=typeof e=="string"?void 0:e.headers;return new me({url:a,link:new $t({uri:a,headers:o}),defaultOptions:{query:{errorPolicy:"none",fetchPolicy:"no-cache"}},cache:new Jt(r),ssrMode:t})}function g(e,{...t}){let{config:r}=c(t);switch(e){case"api":return _(Kt(r.api),{inMemoryCacheOptions:{possibleTypes:jt.possibleTypes}});case"bend.whisk":if(!r.bend.whiskApi)throw new P({message:"Bend whisk API is not configured on this chain",level:"error"});return _(r.bend.whiskApi);case"honey.subgraph":return _(r.honey.subgraph);case"pol.subgraph":return _(r.pol.subgraph);case"governance.subgraph":return _(r.governance.subgraph);case"blocks.subgraph":return _(r.blocksSubgraph);case"bex.subgraph":return _(r.bex.subgraph)}}import{formatUnits as Yt,isAddress as ze,zeroAddress as zt}from"viem";import re from"@berachain/utils/pkg/bignumber.js";var Xe=class e{static PATH_NOT_FOUND_REASON="NO_SWAP_PATHS";needsAccountForQuote=!1;notFoundMessages=[];config;chainId;constructor(t={}){let{config:r,chainId:a}=c(t);this.config=r,this.chainId=a}url="";parseAddresses(t,r){if(!ze(t)||!ze(r))throw new P({message:`Invalid address: ${t} or ${r}`,level:"error"});return{tokenInAddress:R(t,"BERA")?this.config.tokens.wbera:t,tokenOutAddress:R(r,"BERA")?this.config.tokens.wbera:r,isTokenInNative:R(t,"BERA"),isTokenOutNative:R(r,"BERA")}}getAmountAfterFees(t,r){if(r===void 0)throw new P({message:"aggregatorsFeeBps is required",level:"error"});let a=new re(t).times(r).dividedBy(1e4).toFixed(0,re.ROUND_DOWN);return new re(t).minus(a).toFixed(0,re.ROUND_DOWN)}getInputData({tokenIn:t,amountIn:r,isNative:a,isPermit2Approval:o=!1,permit2SpenderAddress:i}){return{tokenIn:t,amountIn:BigInt(r),isNative:a,isPermit2Approval:o,permit2SpenderAddress:i??zt}}getMinAmountOut(t,r){if(r===void 0)throw new P({message:"slippage is required",level:"error"});let a=new re(t).times(1-r/100);return a.isNaN()||a.isZero()?0n:BigInt(a.toFixed(0))}parseAllowanceRequirements({tokenIn:t,rawAmount:r,spender:a}){return R(t,"BERA")?[]:[{token:t,amount:{raw:r,formatted:Yt(BigInt(r),t.decimals)},spender:a}]}checkChainSupport({tokenIn:t,tokenOut:r}){return this.supportedChains===null?!0:this.supportedChains.includes(t.chainId)&&this.supportedChains.includes(r.chainId)}assertChainSupport({tokenIn:t,tokenOut:r,underlyingToken:a}){if(!this.checkChainSupport({tokenIn:t,tokenOut:r,underlyingToken:a}))throw new P({message:`${this.name} does not support tokens chain ID: ${t.chainId} and ${r.chainId}`,level:"error"})}async fetch(t,r){try{return await Ue({url:t,name:this.name,type:this.type},{method:"GET",headers:{"Content-Type":"application/json"},...r})}catch(a){let o=q({cause:a});throw this.notFoundMessages.some(i=>o.message.includes(i))&&(o.reason=e.PATH_NOT_FOUND_REASON),o}}};import{API_CHAIN_NAMES as Xt,BALANCER_QUERIES as Zt,BALANCER_RELAYER as er,BalancerApi as _o,CHAINS as tr,COMPOSABLE_STABLE_POOL_FACTORY as rr,NATIVE_ASSETS as ar,Token as or,VAULT as nr,WEIGHTED_POOL_FACTORY_BALANCER_V2 as ir}from"@berachain-foundation/berancer-sdk";import{zeroAddress as Be}from"viem";import{berachain as Ze,berachainBepolia as sr}from"viem/chains";import{chainConfigs as lr}from"@berachain/config/internal";for(let e of Object.keys(lr)){let{config:t,chainId:r}=c({chainId:Number(e)});Xt[r]=t.bex.chainName,tr[r]=r===Ze.id?Ze:sr,er[r]=t.bex.relayer,nr[r]=t.bex.vault,Zt[r]=t.bex.queries,ir[r]=Be,rr[r]=Be;let a=new or(r,Be,ce.decimals,ce.name,ce.symbol,t.tokens.wbera);ar[r]=a}import{GetPools as ur}from"@berachain/graphql/dex/api";import{GqlPoolOrderBy as cr,GqlPoolOrderDirection as dr}from"@berachain/graphql/pol/api";async function rn({textSearch:e,chain:t,first:r,orderBy:a,orderDirection:o,skip:i,fetchPolicy:l,userAddress:n,blacklistedPoolIds:s,...d}={}){let{config:u}=c(d),f=await g("api",d).query({query:ur,variables:{textSearch:e,chain:t??u.bex.chainName,first:r,orderBy:a??cr.TotalLiquidity,orderDirection:o??dr.Desc,skip:i,userAddress:n,blacklistedPoolIds:s},fetchPolicy:l});return{pools:f.data.poolGetPools??[],count:f.data.count??0}}import{GetPool as mr}from"@berachain/graphql/dex/api";async function ln({poolId:e,account:t,...r}){let{config:a}=c(r),l=(await g("api",r).query({query:mr,variables:{id:e,userAddress:t,chain:a.bex.chainName},fetchPolicy:"no-cache"})).data.poolGetPool;if(!l)throw new Error(`Pool not found for id: ${e} and user ${t}`);return l}import{GetGlobalLiquidityAndSwapVolume as pr}from"@berachain/graphql/dex/api";async function pn(e={}){let{config:t}=c(e);return(await g("api",e).query({query:pr,variables:{chain:t.bex.chainName}})).data}import{weightedPoolV4Abi_V2 as fr}from"@berachain-foundation/berancer-sdk";async function et({publicClient:e,poolAddress:t}){let r=fr,a=await e.multicall({contracts:[{address:t,abi:r,functionName:"inRecoveryMode"},{address:t,abi:r,functionName:"getPausedState"}],allowFailure:!1});return{isPoolInRecoveryMode:a[0],isPoolPaused:a[1][0]}}import{stablePoolAbi_V3 as gr,vaultV2Abi as br,weightedPoolFactoryAbi_V3 as tt,weightedPoolV4Abi_V2 as pe}from"@berachain-foundation/berancer-sdk";import{erc20Abi as rt,formatEther as at,formatUnits as yr,isAddress as Ar,isHex as hr}from"viem";import{GqlPoolType as ot}from"@berachain/graphql/pol/api";async function vn({poolId:e,publicClient:t,...r}){let{config:a}=c(r),o=e.slice(0,42);if(!Ar(o)||!hr(e))throw new x({property:"poolId",value:e,expected:"Hex"});try{let[i,l,n,s,d,u,m,f,b]=await Promise.all([t.readContract({address:o,abi:rt,functionName:"name"}),t.readContract({address:a.bex.vault,abi:br,functionName:"getPoolTokens",args:[e]}),t.readContract({address:o,abi:rt,functionName:"totalSupply"}),t.readContract({address:o,abi:pe,functionName:"getSwapFeePercentage"}),t.readContract({address:o,abi:pe,functionName:"version"}),t.readContract({address:o,abi:pe,functionName:"decimals"}),t.readContract({address:a.bex.factories.composableStable,abi:tt,functionName:"isPoolFromFactory",args:[o]}),t.readContract({address:a.bex.factories.weighted,abi:tt,functionName:"isPoolFromFactory",args:[o]}),et({publicClient:t,poolAddress:o})]),p=Number(u),A=JSON.parse(d),C,B,y;if(m?[C,y]=await Promise.all([t.readContract({address:o,abi:[{type:"function",name:"getActualSupply",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]}],functionName:"getActualSupply"}),t.readContract({address:o,abi:gr,functionName:"getAmplificationParameter"})]):A.name==="WeightedPool"&&(B=await t.readContract({address:o,abi:pe,functionName:"getNormalizedWeights"})),!m&&!f)throw new Error(`Pool ${o} is not a valid BEX pool`);return{name:i,address:o,id:e,poolTokens:[l[0],l[1].map(String),Number(l[2])],totalSupply:yr(C??n,p),swapFee:at(s),decimals:p,weights:B?.map(T=>at(T)),version:A,factory:m?a.bex.factories.composableStable:a.bex.factories.weighted,type:m?ot.Stable:ot.Weighted,amplificationParameter:y?[Number(y[0]),y[1],Number(y[2])]:void 0,pausedState:b}}catch(i){throw q({cause:i})}}import{GetPoolEvents as wr}from"@berachain/graphql/dex/api";async function Nn({poolId:e,typeInArray:t,...r}){let{config:a}=c(r);return(await g("api",r).query({query:wr,variables:{poolId:e,typeIn:t,chain:a.bex.chainName}})).data}import{isHex as Cr}from"viem";import{GetPoolHistoricalData as Pr}from"@berachain/graphql/dex/api";async function In({poolId:e,chain:t,...r}){if(!e||!Cr(e))throw new x({property:"poolId",value:e,expected:"hex string"});let a=g("api",r),{data:o}=await a.query({query:Pr,variables:{poolId:e,chain:t}});return o.poolGetSnapshots}import{isHex as Br}from"viem";import{GetSubgraphPool as vr}from"@berachain/graphql/dex/subgraph";async function Wn({poolId:e,...t}){if(!Br(e))throw new Error("poolId is not a valid hex string");return(await g("bex.subgraph",t).query({query:vr,variables:{id:e}})).data.pool}import{isAddress as nt,isHex as Vr}from"viem";var Y=({fieldOrType:e,value:t,required:r=!0,baseUrl:a,components:o})=>{if(!["bool","string"].includes(e)&&r&&(t==null||t===""))return"Required";if(e.startsWith("uint")||e.startsWith("int")){if(typeof t!="string")return"Invalid amount";try{let l=BigInt(t);if(e.startsWith("uint")&&l<0n)return"Negative amount"}catch{return"Invalid amount"}return null}switch(e){case"string":return t!==void 0&&typeof t!="string"?"Invalid amount":null;case"bool":return typeof t!="boolean"?"Invalid amount":null;case"title":return t.length===0?"Required":null;case"description":return t.length===0?"Required":null;case"forumLink":if(t.length===0)return"Required";if(!URL.canParse(t))return"Invalid address";let l=new URL(a);return t.startsWith(l.toString())?null:"Must be a berachain forum link";case"address":return nt(t,{strict:!0})?null:"Invalid address";case"hex":return Vr(t,{strict:!0})?null:"Invalid address";case"abi":try{JSON.parse(t)}catch{return"Invalid ABI"}return null;case"action":return nt(t,{strict:!0})?null:"Invalid address";case"tuple":if(typeof t=="object"&&Array.isArray(o)){let n={};for(let s of o)n[s.name]=Y({fieldOrType:s.type,value:t[s.name],components:s.components});return Object.values(n).every(s=>s===null)?null:n}return null;case"tuple[]":if(Array.isArray(t)){let n=t.map(s=>Y({fieldOrType:"tuple",value:s,components:o}));return n.every(s=>s===null)?null:n}return null;case"logoURI":return t===void 0||t===""||URL.canParse(t)&&new URL(t).protocol==="https:"?null:"Must be HTTPS or IPFS";case"url":return t===void 0||t===""||URL.canParse(t)&&new URL(t).protocol==="https:"?null:"Must be HTTPS";default:return console.error(`Invalid field or type: ${e}`),null}};import{ProposalStatus as w}from"@berachain/graphql/governance";var Rr=!1,_n=[w.Active,w.PendingQueue,w.PendingExecution,w.Defeated,w.QuorumNotReached];function fe(e,t){let r=Date.now()/1e3;if(t!==void 0){if(e.status===w.CanceledByGuardian)return w.CanceledByGuardian;if(t===2)return Number(e.voteStartAt)<r?w.CanceledByUser:w.CanceledByGuardian;if(t===3)return e.pollResult?!e.quorum||BigInt(e.quorum)>BigInt(e.pollResult.totalTowardsQuorum)?w.QuorumNotReached:w.Defeated:w.QuorumNotReached;if(t===4)return w.PendingQueue;if(t===5)return Number(e.queueEnd)<Date.now()/1e3?w.PendingExecution:w.InQueue;if(t===6)return console.warn("Unexpected expired state on proposal id: ",e.id),w.Defeated}return e.status===w.InQueue&&Number(e.queueEnd)<Date.now()/1e3?w.PendingExecution:Rr&&t===1&&e.quorum&&BigInt(e.quorum)<BigInt(e.pollResult.totalTowardsQuorum)&&Number(e.pollResult.forPercentage)>Number(e.pollResult.againstPercentage)?w.PendingQueue:e.status===w.Pending?Number(e.voteStartAt)<r&&Number(e.voteEndAt)>r?w.Active:Number(e.voteEndAt)<r?e.pollResult?!e.quorum||BigInt(e.quorum)>BigInt(e.pollResult.totalTowardsQuorum)?w.QuorumNotReached:e.pollResult?.against>e.pollResult?.for?w.Defeated:w.PendingQueue:w.QuorumNotReached:w.Pending:e.status===w.Active&&Number(e.voteEndAt)<r?!e.quorum||BigInt(e.quorum)>BigInt(e.pollResult.totalTowardsQuorum)?w.QuorumNotReached:BigInt(e.pollResult?.against??0n)>BigInt(e.pollResult?.for??0n)?w.Defeated:w.PendingQueue:e.status===w.InQueue&&Number(e.queueEnd)<Date.now()/1e3?w.PendingExecution:e.status}import{GetProposals as Sr,SearchProposals as kr}from"@berachain/graphql/governance";async function Yn({where:e,orderBy:t,orderDirection:r,offset:a=0,perPage:o=20,text:i,...l}){try{if(o>1e3)throw new Error("perPage must be less than 1000");let n=g("governance.subgraph",l),[s]=await Promise.all([i?n.query({query:kr,variables:{offset:a,limit:o,where:e,text:i}}):n.query({query:Sr,variables:{offset:a,limit:o,where:e,orderBy:t,orderDirection:r}})]);return s.data.proposals.map(d=>({...d,status:fe(d)}))}catch(n){throw console.error("getAllProposals:",n),n}}var Zn=(e,t)=>{let r={};return r.title=Y({fieldOrType:"title",value:e.title}),r.description=Y({fieldOrType:"description",value:e.description}),r.forumLink=Y({fieldOrType:"forumLink",value:e.forumLink,baseUrl:t.forumLink}),r};import{GetProposal as Nr}from"@berachain/graphql/governance";async function oi({proposalId:e,...t}){let a=await g("governance.subgraph",t).query({query:Nr,variables:{id:e}});if(a.data.proposal)return{...a.data.proposal,status:fe(a.data.proposal)}}import it from"gray-matter";var Gr=e=>{let t=/#(?:([\w-]+)# )?(.+)\n([\s\S]*)/,r=e.match(t);if(r){let a=r[1]||null,o=r[2],i=r[3].replace(`
|
|
2
|
-
`,"<br />");return{type:a,title:o,content:i}}throw new Error("Invalid proposal body")},st=e=>{if(!e)return{isFrontMatter:!1,data:{title:"Loading..."},content:"",matter:"",language:"",orig:"",stringify:()=>""};let t=e?.description??"";if(it.test(t))return{...it(t),isFrontMatter:!0};try{let r=Gr(t);return{isFrontMatter:!1,data:{title:r.title},content:r.content,matter:"",language:"",orig:t,stringify:()=>t}}catch{return{isFrontMatter:!1,data:{title:e?.description?.split(`
|
|
3
|
-
`)[0].slice(0,100)},content:t,matter:"",language:"",orig:t,stringify:()=>t}}};import{parseEventLogs as xr}from"viem";import{berachainGovernanceAbi as Tr}from"@berachain/abis/gov/berachainGovernance";import{ProposalStatus as Er}from"@berachain/graphql/governance";async function pi(e){v(e.publicClient);let t;"tx"in e?t=e.tx:t=await e.publicClient.getTransactionReceipt({hash:e.txHash});let r=t?.logs?xr({abi:Tr,logs:t.logs,eventName:"ProposalCreated"})?.at(0):void 0;if(!t||!r)return null;let a=await e.publicClient.getBlock({blockNumber:t.blockNumber}),o=st({description:r?.args.description});return{id:String(r.args.proposalId),proposalId:String(r?.args.proposalId),createdAt:a.timestamp.toString(),title:o.data.title,createdAtBlock:a.timestamp.toString(),voteStartAt:String(r?.args.voteStart),voteEndAt:String(r?.args.voteEnd),proposer:r?.args.proposer,description:o.content,unverifiedForumLink:o.data.forumLink,pollResult:{for:"0",forVotersCount:0,forPercentage:"0",against:"0",againstVotersCount:0,againstPercentage:"0",abstain:"0",abstainVotersCount:0,abstainPercentage:"0",total:"0",totalVotersCount:0,totalTowardsQuorum:"0"},status:Er.Pending,quorum:null,topics:o.data.topics,votes:[],executableCalls:r?.args.targets.map((i,l)=>({__typename:"ExecutableCall",id:`${t.transactionHash}-${l}`,target:i,value:String(r?.args.values[l]),calldata:r?.args.calldatas[l]})),timelock:void 0}}import{GetProposalVotes as Fr}from"@berachain/graphql/governance";async function yi({variables:e,...t}){return g("governance.subgraph",t).query({query:Fr,variables:e})}import{Aggregation_Interval as Ir,GetChartData as qr}from"@berachain/graphql/honey";async function Ci({days:e,...t}){return(await g("honey.subgraph",t).query({query:qr,variables:{interval:Ir.Day,first:e}})).data}import{honeyFactoryAbi as Dr}from"@berachain/abis/honey/honeyFactory";async function Vi({client:e,collateralList:t,...r}){let{config:a}=c(r);try{let o=await e.readContract({address:a.honey.factory,abi:Dr,functionName:"getWeights"});return t.reduce((l,n,s)=>Object.assign(l,{[n.address]:o[s]}),{})}catch(o){throw console.log(o),o}}import{erc20Abi as ve}from"viem";async function lt({address:e,publicClient:t,chainId:r}){try{if(!t)throw new Error("Public client not found");let[a,o,i]=await Promise.all([t.readContract({address:e,abi:ve,functionName:"decimals"}),t.readContract({address:e,abi:ve,functionName:"name"}),t.readContract({address:e,abi:ve,functionName:"symbol"})]),l={address:e,decimals:a,name:o,symbol:i,chainId:r};if(typeof l.decimals!="number"||typeof l.name!="string"||typeof l.symbol!="string")throw new Error(`Invalid ERC20 token. Address: ${e}`);return l}catch(a){throw console.error(a),q({cause:a})}}import{honeyFactoryAbi as Ve}from"@berachain/abis/honey/honeyFactory";async function Re({client:e,tokenData:t,preferredCollateralOrder:r,...a}){let{config:o}=c(a),[i,l]=await Promise.all([e.readContract({address:o.honey.factory,abi:Ve,functionName:"numRegisteredAssets"}),e.readContract({address:o.honey.factory,abi:Ve,functionName:"referenceCollateral"})]),n=[];for(let f=0;f<i;f++)n.push(e.readContract({address:o.honey.factory,abi:Ve,functionName:"registeredAssets",args:[BigInt(f)]}));let s=await Promise.all(n),u=(await Promise.all(s.map(f=>{let b=t?.find(p=>R(p,f));return b||lt({address:f,chainId:o.chainId,publicClient:e})}))).filter(f=>!!f).sort((f,b)=>s.indexOf(f.address)-s.indexOf(b.address)).map((f,b)=>({...f,order:b}));if(r?.length){let f=[];for(let b of r){let p=u.find(A=>R(A.address,b.address));p&&(f.push(p),u.splice(u.indexOf(p),1))}u.unshift(...f)}let m=u.find(f=>R(f,l));if(!u)throw new Error("Collateral tokens not found");if(!m)throw new Error("Reference collateral address not found");return{collaterals:u,referenceCollateral:m}}import{parseUnits as Qr}from"viem";import{honeyFactoryAbi as ut}from"@berachain/abis/honey/honeyFactory";import{honeyFactoryReaderAbi as Ur}from"@berachain/abis/honey/honeyFactoryReader";async function ct({client:e,collateral:t,latestPrices:r,isPythWrapperEnabled:a,...o}){let{config:i}=c(o);try{let l=e.readContract({address:i.honey.factory,abi:ut,functionName:"isBadCollateralAsset",args:[t.address]}),n=e.readContract({address:i.honey.factory,abi:ut,functionName:"isPegged",args:[t.address]});if(a&&r){let u=r.prices.map(m=>Qr(m,18));n=e.readContract({address:i.honey.reader,abi:Ur,functionName:"isPeggedWithPrice",args:[t.address,u[0]]})}let[s,d]=await Promise.all([l,n]);return{isBlacklisted:s,isDepegged:!d}}catch(l){throw console.log(l),l}}import{parseEther as mt}from"viem";import{honeyFactoryAbi as Or}from"@berachain/abis/honey/honeyFactory";import{parseEther as Wr}from"viem";import{collateralVaultAbi as Lr}from"@berachain/abis/honey/collateralVault";import{honeyFactoryAbi as dt}from"@berachain/abis/honey/honeyFactory";async function ae({client:e,asset:t,amount:r,...a}){let{config:o}=c(a);try{let[i,l]=await Promise.all([e.readContract({address:o.honey.factory,abi:dt,functionName:"vaults",args:[t]}),e.readContract({address:o.honey.factory,abi:dt,functionName:"collectedFees",args:[o.honey.factory,t]})]);return await e.readContract({address:i,abi:Lr,functionName:"balanceOf",args:[o.honey.factory]})+Wr(r??"0")-l}catch(i){throw console.log(i),i}}var Mr=mt("1");async function Zi({client:e,asset:t,amount:r,isMint:a,isPythWrapperEnabled:o,latestPrices:i,...l}){let{config:n}=c(l);try{let s=await e.readContract({address:n.honey.factory,abi:Or,functionName:"globalCap"});if(s>=Mr)return!1;let[{collaterals:d},u]=await Promise.all([Re({client:e}),Hr({client:e,asset:t,amount:r,latestPrices:i,isPythWrapperEnabled:o})]);if(!u)return;for(let m in u)if((a&&R(d[m],t)||!a&&R(d[m],t))&&u[m]>s-de)return!0;return!1}catch(s){throw console.log(s),s}}async function Hr({client:e,asset:t,amount:r,latestPrices:a,isPythWrapperEnabled:o}){let{collaterals:i}=await Re({client:e}),l=0n,n=[];for(let s of i){let d=await ct({client:e,collateral:t,latestPrices:a,isPythWrapperEnabled:o});if(d?.isBlacklisted||d?.isDepegged)continue;let u=await ae({client:e,asset:s.address,amount:R(s,t)?r:"0"});u&&(l+=u,n.push(u))}if(l===0n)return n;for(let s in i)n[s]=mt(n[s].toString())/l;return n}import{GetGlobalData as _r}from"@berachain/graphql/honey";async function as({...e}={}){return(await g("honey.subgraph",e).query({query:_r})).data}import{parseUnits as pt}from"viem";import{honeyFactoryReaderAbi as ft}from"@berachain/abis/honey/honeyFactoryReader";var Jr=(s=>(s.Mint="previewMintHoney",s.MintWithPrice="previewMintHoneyWithPrices",s.RequiredCollateral="previewMintCollaterals",s.RequiredCollateralWithPrice="previewMintCollateralsWithPrices",s.Redeem="previewRedeemCollaterals",s.RedeemWithPrice="previewRedeemCollateralsWithPrices",s.HoneyToRedeem="previewRedeemHoney",s.HoneyToRedeemWithPrice="previewRedeemHoneyWithPrices",s))(Jr||{});async function ls({client:e,collateral:t,collateralList:r,amount:a,method:o,latestPrices:i,isPythWrapperEnabled:l,...n}){let{config:s}=c(n);try{let d=o==="previewMintHoney"||o==="previewRedeemHoney"||o==="previewMintHoneyWithPrices"||o==="previewRedeemHoneyWithPrices",u=pt(a,d?t.decimals:18),m,f=[t.address,u];if(l&&i){let p=i.prices.map(A=>pt(A,18));f=[t.address,u,p]}if(d){let p=await e.readContract({address:s.honey.reader,abi:ft,functionName:o,args:f});m={collaterals:p[0],honey:p[1]}}else m={collaterals:await e.readContract({address:s.honey.reader,abi:ft,functionName:o,args:f}),honey:u};let b=r.reduce((p,A)=>{let C=A.order;return A.address===t.address&&m.collaterals[C]===BigInt(0)?Object.assign(p,{[A.address]:m.collaterals[0]}):Object.assign(p,{[A.address]:m.collaterals[C]})},{});return b[t.address]===BigInt(0)&&(b[t.address]=m.collaterals[0]),{collaterals:b,honey:m.honey}}catch(d){throw console.log("error",d),d}}import{formatUnits as $r}from"viem";import{collateralVaultAbi as Se}from"@berachain/abis/honey/collateralVault";import{honeyFactoryAbi as gt}from"@berachain/abis/honey/honeyFactory";async function fs({client:e,collateralList:t,honeyFactoryAddress:r,...a}){let{config:o}=c(a),i=r??o.honey.factory;return await Promise.all(t.map(async n=>{let s=await e.readContract({address:o.honey.factory,abi:gt,functionName:"vaults",args:[n.address]}),[d,u,[m,f]]=await Promise.all([e.readContract({address:s,abi:Se,functionName:"balanceOf",args:[i]}),e.readContract({address:i,abi:gt,functionName:"collectedAssetFees",args:[n.address]}),e.readContract({address:s,abi:Se,functionName:"custodyInfo"})]),b=await e.readContract({address:s,abi:Se,functionName:"convertToAssets",args:[d-u]});return{...n,balance:{raw:b.toString(),formatted:$r(b,n.decimals)},vault:m?f:s}}))}import{HermesClient as jr}from"@pythnetwork/hermes-client";import{formatUnits as Kr}from"viem";var Yr="https://hermes.pyth.network";async function bt({priceFeedId:e}){let r=await new jr(Yr,{}).getLatestPriceUpdates(e,{encoding:"hex",parsed:!0});return{calldata:r.binary.data.map(a=>`0x${a}`),prices:r.parsed?.flatMap(a=>Kr(BigInt(a.price.price),a.price.expo*-1))??[]}}import{parseEther as zr}from"viem";import{honeyFactoryAbi as Xr}from"@berachain/abis/honey/honeyFactory";async function vs({client:e,asset:t,amount:r,isMint:a,referenceCollateral:o,...i}){let{config:l}=c(i);if(t===o.address)return!1;try{let[n]=await Promise.all([e.readContract({address:l.honey.factory,abi:Xr,functionName:"relativeCap",args:[t]})]),[s,d]=await Promise.all([ae({client:e,asset:t,amount:a?r:void 0}),ae({client:e,asset:o.address,amount:a?void 0:r})]);return d===0n?s!==0n:zr((s??0n).toString())/(d??0n)>=n-de}catch(n){throw console.log(n),n}}async function yt({client:e,priceFeedId:t,...r}){let{config:a}=c(r);try{return await e.readContract({address:a.external.pyth,abi:qe,functionName:"getUpdateFee",args:[t]})}catch(o){throw console.error("getPythUpdateFee",o),o}}import{parseUnits as At}from"viem";import{honeyFactoryAbi as Zr}from"@berachain/abis/honey/honeyFactory";import{honeyFactoryPythWrapperAbi as ea}from"@berachain/abis/honey/honeyFactoryPythWrapper";var Ds=async({state:e,publicClient:t,priceFeedMap:r,collateralList:a,isPythWrapperEnabled:o,...i})=>{let{config:l}=c(i),n=Le(i),{actionType:s,fromAmount:d,collaterals:u,isBasketModeEnabled:m}=e,f=o?l.honey.pythWrapper:l.honey.factory,b=a.map(p=>p.address);if(d[0]&&b.length){let p=s==="mint";if(o&&t&&r){let C=(await bt({priceFeedId:Object.values(r)})).calldata,B=0n;try{B=await yt({client:t,priceFeedId:C})}catch{B=Oe(u.length)}return({account:y})=>{let T=[C,u[0]?.address,At(d[0],(p?u[0]?.decimals:n?.decimals)??18),y,!!m];return{address:f,abi:ea,functionName:p?"mint":"redeem",params:T,value:B}}}return({account:A})=>{let C=[u[0]?.address,At(d[0],(p?u[0]?.decimals:n?.decimals)??18),A,!!m];return{value:0n,address:f,abi:Zr,functionName:p?"mint":"redeem",params:C}}}throw new Error("Something went wrong while creating the Honey swap payload")};import{parseUnits as ta}from"viem";import{honeyFactoryAbi as ra}from"@berachain/abis/honey/honeyFactory";import{honeyFactoryReaderAbi as aa}from"@berachain/abis/honey/honeyFactoryReader";async function Ms({client:e,isMint:t,collateralList:r,latestPrices:a,isPythWrapperEnabled:o,...i}){let{config:l}=c(i);if(o&&a){if(r.length===0)return;let s=a.prices.map(u=>ta(u,18));return await e.readContract({address:l.honey.reader,abi:aa,functionName:"isBasketModeEnabledWithPrices",args:[t,s]})}return await e.readContract({address:l.honey.factory,abi:ra,functionName:"isBasketModeEnabled",args:[t]})}async function $s({block:e,currentBlock:t,blockTime:r,publicClient:a}){if(j(e,"block"),v(a),t>e){let i=await a.getBlock({blockNumber:BigInt(e),includeTransactions:!1});return{timestamp:Number(i.timestamp)}}return{timestamp:S(Date.now())+r*(Number(e)-Number(t))}}import{formatUnits as ke}from"viem";import{rewardVaultAbi as z}from"@berachain/abis/pol/rewards/rewardVault";var oa=(a=>(a.Duration="duration",a.TargetRate="targetRate",a.TargetApr="targetApr",a))(oa||{});async function Xs(e,t){let[r,a,o,i,l,n]=await Promise.all([t.readContract({address:e,abi:z,functionName:"rewardsDuration"}),t.readContract({address:e,abi:z,functionName:"rewardVaultManager"}),t.readContract({address:e,abi:z,functionName:"rewardRate"}),t.readContract({address:e,abi:z,functionName:"periodFinish"}),t.readContract({address:e,abi:z,functionName:"targetRewardsPerSecond"}),t.readContract({address:e,abi:z,functionName:"minRewardDurationForTargetRate"})]),s=o*(i-BigInt(S(Date.now())))/10n**18n;return{rewardsDuration:Number(r),mode:l===0n?"duration":"targetRate",manager:a,rewardRate:ke(o,36),periodFinish:Number(i),availableRewards:ke(s,18),minRewardDurationForTargetRate:Number(n),targetRewardsPerSecond:ke(l,36)}}function ge(e,t,r){return e?r*t*te(1)/e:null}function na(e,t,r){return r?e*r/(t*te(1)):0}function tl({availableRewards:e,periodFinish:t,tvl:r,bgtPrice:a,MIN_REWARD_DURATION:o,MAX_REWARD_DURATION:i,...l}){let n=S(Date.now());if(n>t)return{apr:0,duration:0,rewardRate:0,targetRate:null,periodFinish:0,mode:null};if(l.mode==="targetRate"||l.mode==="targetApr"){let m,{minRewardDurationForTargetRate:f,currentDuration:b}=l;if(l.mode==="targetRate"?m=l.rewardRate:m=na(l.apr,a,r),m===0){let C=Math.min(b,i),B=e?e/C:0;return{apr:ge(r,a,B),duration:C,rewardRate:B,targetRate:null,periodFinish:C+n,mode:"duration"}}let p=f||o,A=e?e/m:0;if(A<p){let C=e?e/p:0;return{apr:ge(r,a,C),duration:p,rewardRate:C,targetRate:C.toString(),periodFinish:p+n,mode:null}}return{apr:ge(r,a,m),duration:A,rewardRate:m,targetRate:m.toString(),periodFinish:A+n,mode:null}}let{duration:s}=l,d=e/s;return{apr:ge(r,a,d),mode:null,targetRate:null,duration:s,rewardRate:d,periodFinish:s+n}}async function nl({address:e,account:t,...r}){let{config:a}=c(r),o=`${a.bonder}/vaults/${e}/earnings/${t}`;return We({url:o,type:"rest"})}import{formatUnits as ia}from"viem";import{rewardVaultAbi as sa}from"@berachain/abis/pol/rewards/rewardVault";import{GetVaults as la}from"@berachain/graphql/pol/api";async function be({filter:e,publicClient:t,...r}={}){let o=await g("api",r).query({query:la,variables:e}),i=await Promise.allSettled(o.data.polGetRewardVaults.vaults.map(async n=>{if(t)return Promise.allSettled(n.activeIncentives.map(s=>t.readContract({abi:sa,address:n.address,functionName:"incentives",args:[s.tokenAddress]})))})),l=o.data.polGetRewardVaults.vaults.map((n,s)=>{let d=0,u=n.activeIncentives.map((m,f)=>{let b=Number(m.remainingAmountUsd)&&Number(m.remainingAmount)?Number(m.remainingAmountUsd)/Number(m.remainingAmount):0,p=i[s]?.status==="fulfilled"&&i[s]?.value?.[f]?.status==="fulfilled"?ia(BigInt(i[s].value[f].value[2]),m.token.decimals):m.remainingAmount;return d+=Number(p)*Number(b),{...m,remainingAmount:p}});return{...n,dynamicData:{...n.dynamicData,allTimeReceivedBGTAmount:n.dynamicData?.allTimeReceivedBGTAmount??"0",bgtCapturePercentage:n.dynamicData?.bgtCapturePercentage??"0",activeIncentivesValueUsd:d.toString(),activeIncentivesRateUsd:n.dynamicData?.activeIncentivesRateUsd??"0",bgtCapturePerBlock:n.dynamicData?.bgtCapturePerBlock??"0"},activeIncentives:u}});return{pagination:o.data.polGetRewardVaults.pagination,gaugeList:l}}import{GlobalData as ua}from"@berachain/graphql/pol/api";async function ht(e={}){let{config:t}=c(e),a=await g("api",e).query({query:ua,variables:{chain:t.bex.chainName}});return{...a.data.polGetGlobalInfo,top3EmittingValidators:a.data.top3EmittingValidators.validators,allValidatorsCount:a.data.allValidatorsCount.pagination.totalCount}}import{formatEther as ca}from"viem";import{bgtAbi as da}from"@berachain/abis/pol/bgt";async function wt({publicClient:e,...t}){let{config:r}=c(t);v(e);try{let a=await e.readContract({address:r.tokens.bgt,abi:da,functionName:"totalBoosts",args:[]});return ca(a)}catch(a){throw console.log(a),a}}import{erc20Abi as ma,formatEther as pa}from"viem";async function Ct({publicClient:e,...t}){let{config:r}=c(t);v(e);try{let a=await e.readContract({address:r.tokens.bgt,abi:ma,functionName:"totalSupply",args:[]});return pa(a??0n)}catch(a){throw console.log(a),a}}import{GqlRewardVaultOrderBy as fa,GqlRewardVaultOrderDirection as ga}from"@berachain/graphql/pol/api";async function Pt(e){let{gaugeList:t}=await be({filter:{orderBy:fa.Apr,orderDirection:ga.Desc,pageSize:e,where:{includeNonWhitelisted:!1}}});return t}async function Fl(e){let[t,r,a,o]=await Promise.allSettled([ht(),Pt(300),Ct({publicClient:e}),wt({publicClient:e})]);return t.status==="rejected"&&O.captureException(q({cause:t.reason,level:"warning"})),r.status==="rejected"&&O.captureException(q({cause:r.reason,level:"warning"})),a.status==="rejected"&&O.captureException(q({cause:a.reason,level:"warning"})),o.status==="rejected"&&O.captureException(q({cause:o.reason,level:"warning"})),{bgtTotalSupply:a.status==="fulfilled"?a.value:void 0,globalCuttingBoard:r.status==="fulfilled"?r.value:[],bgtTotalBoosts:o.status==="fulfilled"?o.value:void 0,...t.status==="fulfilled"?t.value:{}}}import{GetIncentiveFeeClaimStats as ba}from"@berachain/graphql/pol/subgraph";async function Bt({...e}){let t=g("pol.subgraph",e),{data:r}=await t.query({query:ba});if(r.incentiveFeeClaims.length>0){let a=r?.incentiveFeeClaims.reduce((l,n)=>l+Number(n.payoutAmount),3e4),i=(r?.incentiveFeeClaims.filter(l=>Number(l.timestamp)/1e3>Date.now()-He(1))).reduce((l,n)=>l+Number(n.payoutAmount),0);return{sumAllClaims:a,sumClaimsInLast24Hours:i}}return{sumAllClaims:0,sumClaimsInLast24Hours:0}}async function Ll(e={}){let{config:t}=c(e);try{let a=await(await fetch(t.lists.rewardVaultList)).json();if(!a.protocols)throw new Error("Missing protocols in market list");return{marketList:a.protocols,marketDictionary:a.protocols.reduce((o,i)=>(o[i.name]=i,o),{})}}catch(r){throw console.error("Error fetching validator information",r),r}}async function Jl({account:e,validator:t,page:r=1,perPage:a=1e3,...o}){let{config:i}=c(o),l=await fetch(`${i.pol.bribeBoostApi}/api/v1/wallets/${e.toLowerCase()}/proofs/validator/${t.toLowerCase()}?page=${r}&per_page=${a}`,{cache:"no-store"});if(!l.ok){let s=await ue(l);throw new P({message:"Failed to fetch proofs on server",cause:{error:s,result:l,account:e,validator:t},reason:s?.reason})}return await l.json()}import{formatUnits as ya,parseUnits as Aa}from"viem";import{wberaStakerVaultAbi as ha}from"@berachain/abis/pol/wberaStakerVault";async function zl({address:e,publicClient:t}){return v(t),t.readContract({address:e,abi:ha,functionName:"previewRedeem",args:[Aa("1",18)]}).then(r=>Number(ya(r,18))).catch(()=>0)}import{GetRewardVault as wa}from"@berachain/graphql/pol/api";async function au({address:e,chainName:t,...r}){let{config:a}=c(r),o=t??a.bex.chainName,i=g("api",r),{data:l}=await i.query({query:wa,variables:{vaultId:e,chain:o}});if(!l?.rewardVault)throw new _e({resource:"Reward vault",id:e,chainId:a.chainId});return l.rewardVault}import{isSameAddress as vt}from"@berachain-foundation/berancer-sdk";import{erc20Abi as Ne,formatUnits as oe}from"viem";import{rewardVaultAbi as Ge}from"@berachain/abis/pol/rewards/rewardVault";async function cu({address:e,stakingToken:t,publicClient:r}){let a=await r.readContract({address:e,abi:Ge,functionName:"getWhitelistedTokens"}),i=a.findIndex(n=>vt(t,n))!==-1?await r.readContract({address:e,abi:Ge,functionName:"totalSupply"}):0n,l=await Promise.allSettled(a.map(async n=>{let[s,d,u,m]=await Promise.all([r.readContract({address:e,abi:Ge,functionName:"incentives",args:[n]}),r.readContract({address:n,abi:Ne,functionName:"decimals"}),r.readContract({address:n,abi:Ne,functionName:"symbol"}),r.readContract({address:n,abi:Ne,functionName:"balanceOf",args:[e]})]),[f,b,p,A]=s;return{token:n,manager:A,minIncentiveRate:oe(f,d),incentiveRate:oe(b,d),remainingAmount:oe(p,d),symbol:u,decimals:d,pendingAmount:vt(t,n)?oe(m-i-p,d):oe(m-p,d)}}));return l.forEach((n,s)=>{n.status==="rejected"&&O.captureException(new P({reason:n.reason,message:"Incorrect incentives token received.",level:"error",extra:{token:a[s],address:e,error:n.reason}}))}),l.map(n=>n.status==="fulfilled"?n.value:null).filter(n=>n!==null)}import{rewardVaultAbi as Ca}from"@berachain/abis/pol/rewards/rewardVault";async function pu({address:e,publicClient:t}){return await t.readContract({address:e,abi:Ca,functionName:"stakeToken"})}import{GetSWberaVaultMetadata as Pa,GqlSWberaVaultMetadataResolution as Vt}from"@berachain/graphql/pol/api";function Ba(e){return e==="DAY"?Vt.OneDay:Vt.SevenDays}async function Au({window:e,...t}){let{config:r}=c(t),a=g("api",t);try{let o=await a.query({query:Pa,variables:{chain:r.bex.chainName,resolution:Ba(e??"DAY")}}),{apr:i}=o.data.polGetSWberaVaultMetadata;return Number(i)}catch(o){throw console.error("Failed to get SW Bera APR",o),o}}import{GetSWberaVaultSnapshots as va,GqlVaultSnapshotDataRange as Va}from"@berachain/graphql/pol/api";async function Bu({chain:e,range:t=Va.ThirtyDays,...r}={}){let{config:a}=c(r),o=g("api",r);try{return(await o.query({query:va,variables:{chain:e??a.bex.chainName,range:t}})).data.polGetSWberaVaultSnapshots}catch(i){throw console.error("Failed to get SW Bera Snapshots",i),i}}import{wberaStakerVaultAbi as Ra}from"@berachain/abis/pol/wberaStakerVault";async function ne({publicClient:e,address:t}){let r=await e.readContract({address:t,abi:Ra,functionName:"WITHDRAWAL_COOLDOWN"});return Number(r)}import{erc20Abi as ye}from"viem";import{wberaStakerVaultAbi as ie}from"@berachain/abis/pol/wberaStakerVault";import M from"@berachain/utils/pkg/bignumber.js";async function Fu({address:e,publicClient:t,blockTime:r,...a}){let{config:o}=c(a);v(t);let i=26;try{let[l]=await Promise.all([t.getBlock({blockTag:"latest"})]),n=Math.floor(i*60*60/r),s=l.number-BigInt(n),[d,u,m,f,b,p,A,C,B,y,T]=await Promise.all([t.readContract({address:e,abi:ie,functionName:"totalAssets"}),t.readContract({address:e,abi:ie,functionName:"totalSupply"}),t.readContract({address:e,abi:ie,functionName:"previewRedeem",args:[10n**18n],blockNumber:l.number}),t.readContract({address:o.tokens.wbera,abi:ye,functionName:"balanceOf",args:[e]}),t.readContract({address:e,abi:ie,functionName:"totalAssets",blockNumber:s}),t.readContract({address:e,abi:ye,functionName:"totalSupply",blockNumber:s}),t.readContract({address:e,abi:ie,functionName:"previewRedeem",args:[10n**18n],blockNumber:s}),t.readContract({address:o.tokens.wbera,abi:ye,functionName:"balanceOf",args:[e],blockNumber:s}),t.readContract({address:o.tokens.wbera,abi:ye,functionName:"totalSupply"}),ne({publicClient:t,address:e}),Bt({})]),k=new M(A.toString());return{current:{exchangeRate:new M(m.toString()).toString(),totalSupply:new M(u.toString()).dividedBy(1e18).toString(),totalAssets:new M(d.toString()).dividedBy(1e18).toString(),tvl:new M(f.toString()).dividedBy(1e18).toString()},previous:{exchangeRate:k.toString(),totalSupply:new M(p.toString()).dividedBy(1e18).toString(),totalAssets:new M(b.toString()).dividedBy(1e18).toString(),tvl:new M(C.toString()).dividedBy(1e18).toString()},totalWBeraIssued:new M(B.toString()).dividedBy(1e18).toString(),lockPeriod:y,totalBuyBacks:T.sumAllClaims,totalBuyBacksInLast24Hours:T.sumClaimsInLast24Hours}}catch(l){throw console.error("Failed to get SW Bera Vault Metadata",l),l}}import{wberaStakerVaultAbi as Ae}from"@berachain/abis/pol/wberaStakerVault";function Rt(e){let t=Date.now(),r=e*1e3-t;if(r<=0)return;let a=S(r);return $e(a,!0,!0)}async function Lu({contractAddress:e,accountAddress:t,publicClient:r,version:a}){let o=[];function i(l,n){let[s,d,u]=l,m=s,f=Number(u)+Number(n),b=S(Date.now()),p=f-b;if(m>0){let A=Rt(p<=0?0:f);o.push({receiptTokenAddress:e,withdrawalAmount:m,timeRemaining:A})}}switch(a){case"V1":{let[l,n]=await Promise.all([r.readContract({address:e,abi:Ae,functionName:"withdrawalRequests",args:[t]}),ne({publicClient:r,address:e})]);return i(l,n),o}case"V2":{let[l,n]=await Promise.all([r.readContract({address:e,abi:Ae,functionName:"getERC721WithdrawalRequestIds",args:[t]}),ne({publicClient:r,address:e})]);if(R(e,"SWBERA")){let u=await r.readContract({address:e,abi:Ae,functionName:"withdrawalRequests",args:[t]});i(u,n)}let d=(await Promise.all(l.map(async u=>{let m=await r.readContract({address:e,abi:Ae,functionName:"getERC721WithdrawalRequest",args:[u]}),{assets:f,requestTime:b}=m;if(!f||!b)throw new Error("Invalid withdrawal request");let p=f,A=Number(b)+Number(n),C=S(Date.now()),B=A-C;if(p>0){let y=Rt(B<=0?0:A);return{withdrawalAmount:p,timeRemaining:y,withdrawalRequestId:u,receiptTokenAddress:e}}return null}))).filter(u=>u!==null);return o.push(...d),o}}}import{wberaStakerVaultAbi as Sa}from"@berachain/abis/pol/wberaStakerVault";async function _u({vaultAddresses:e,publicClient:t}){v(t);try{let r=await Promise.all(e.map(async o=>await t.readContract({address:o,abi:Sa,functionName:"totalAssets"})));return e.reduce((o,i,l)=>(o[i]=r[l],o),{})}catch(r){throw console.error("Failed to get total staked amount",r),r}}async function Yu({account:e,...t}){let{config:r}=c(t),a=await fetch(`${r.pol.bribeBoostApi}/api/v1/wallets/${e.toLowerCase()}/rewards/aggregation`,{cache:"no-store"});if(!a.ok){let o=await ue(a);throw new P({message:"Failed to fetch incentives on server",cause:{error:o,result:a,account:e},reason:o?.error})}return await a.json()}import{rewardVaultAbi as ka}from"@berachain/abis/pol/rewards/rewardVault";async function St({account:e,vaultAddress:t,publicClient:r}){if(!r)throw new Error("Missing public client");if(!e)throw new Error("Missing user account");if(!t)throw new Error("Missing vault address");return await r.readContract({address:t,abi:ka,functionName:"earned",args:[e]})}import{formatEther as xe}from"viem";import{rewardVaultAbi as kt}from"@berachain/abis/pol/rewards/rewardVault";async function Nt({account:e,vaultAddress:t,publicClient:r}){v(r),we(e,"account"),we(t,"vaultAddress");try{let[a,o]=await Promise.all([r.readContract({address:t,abi:kt,functionName:"balanceOf",args:[e]}),r.readContract({address:t,abi:kt,functionName:"getTotalDelegateStaked",args:[e]})]);return{balance:a,delegated:o}}catch(a){throw console.log(a),a}}import{rewardVaultAbi as Na}from"@berachain/abis/pol/rewards/rewardVault";async function Gt({vaultAddress:e,publicClient:t}){if(!t)throw new Error("Missing public client");if(!e)throw new Error("Missing vault address");try{return await t.readContract({address:e,abi:Na,functionName:"totalSupply",args:[]})}catch(r){throw console.log(r),r}}async function uc({account:e,vaultAddress:t,publicClient:r}){let[a,o,i]=await Promise.all([Nt({account:e,vaultAddress:t,publicClient:r}),St({account:e,vaultAddress:t,publicClient:r}),Gt({vaultAddress:t,publicClient:r})]),l=a.balance-a.delegated,n=i>0n?Number(Number.parseFloat(xe(a.balance))/Number.parseFloat(xe(i))).toString():"0";return{balance:a.balance,delegatedBalance:a.delegated,withdrawableBalance:l,rewards:xe(o),percentage:n}}import{formatUnits as Te}from"viem";import{rewardVaultAbi as xt}from"@berachain/abis/pol/rewards/rewardVault";import{GetUserVaults as Ga}from"@berachain/graphql/pol/api";async function Ac({account:e,publicClient:t,...r}){let{config:a}=c(r),l=(await g("api",r).query({query:Ga,variables:{userId:e,chain:a.bex.chainName}})).data?.userVaultDeposits?.deposits;if(!l)return{totalBgtRewards:"0",vaults:[],totalStakedValue:0};let[n,s]=await Promise.all([t.multicall({allowFailure:!1,contracts:l.map(b=>({address:b.vaultAddress,abi:xt,functionName:"earned",args:[e]}))}),t.multicall({allowFailure:!1,contracts:l.map(b=>({address:b.vaultAddress,abi:xt,functionName:"balanceOf",args:[e]}))})]),{userVaults:d,total:u}=l.reduce((b,p,A)=>{let C=n[A],B=s[A];if(b.total+=C,!p.vault)return O.captureException(new P({message:"Deposit data from API is missing vault",level:"error",extra:{deposit:p}})),console.error("Deposit data from API is missing vault",p),b;if(C>0n||B>0n){let y=p.vault.dynamicData?.tvl&&Number(p.vault.stakingTokenAmount)!==0?Number(p.vault.dynamicData?.tvl??0)/Number(p.vault.stakingTokenAmount):null;b.userVaults.push({...p,vault:p.vault,unclaimedBgt:Te(C,18),formattedBalance:Te(B,p.vault.stakingToken.decimals),stakingTokenPrice:y})}return b},{userVaults:[],total:0n}),m=[...d].sort((b,p)=>{if(b.vault.isVaultWhitelisted&&!p.vault.isVaultWhitelisted)return-1;if(!b.vault.isVaultWhitelisted&&p.vault.isVaultWhitelisted)return 1;let A=Number.parseFloat(b.unclaimedBgt);return Number.parseFloat(p.unclaimedBgt)-A});return{totalStakedValue:m.reduce((b,p)=>{let A=Number(p.vault.dynamicData?.tvl??0);if(A===0)return b;let C=Number.parseFloat(p.vault.stakingTokenAmount),B=A/C;return b+B*Number(p.formattedBalance)},0),totalBgtRewards:Te(u,18),vaults:m}}import{GetVaultHistory as xa}from"@berachain/graphql/pol/api";async function Bc({vault:e,chain:t,...r}){let{config:a}=c(r);return(await g("api",r).query({query:xa,variables:{...r,vaultId:e,chain:t??a.bex.chainName}})).data.polGetRewardVaultSnapshots}import{GetVaultValidators as Ta}from"@berachain/graphql/pol/api";async function Sc({address:e,onlyActiveValidators:t,...r}){return(await g("api",r).query({query:Ta,variables:{vaultId:e,isActive:t}})).data.validators.validators??[]}import{getAddress as Ea,zeroAddress as Fa}from"viem";import{GetTokenCurrentPrices as Ia}from"@berachain/graphql/dex/api";async function Ic({addressIn:e,...t}){let{config:r,chainId:a}=c(t),o=e.map(n=>n.toLowerCase()).filter((n,s,d)=>n&&d.indexOf(n)===s),i=g("api",t),{data:l}=await i.query({query:Ia,variables:{chains:[r.bex.chainName],addressIn:o}});return l.tokenGetCurrentPrices.reduce((n,s)=>{if(!s.price||!s.address)return n;let d=s.address;return n[Ea(d)]={price:K(s.price.toString()),updatedAt:s.updatedAt,chainId:a},n[d.toLowerCase()]={price:K(s.price.toString()),updatedAt:s.updatedAt,chainId:a},R(d,"WBERA")&&(n[Fa]={price:K(s.price.toString()),updatedAt:s.updatedAt,chainId:a},n[r.tokens.bgt.toLowerCase()]={price:K(s.price.toString()),updatedAt:s.updatedAt,chainId:a},n[r.tokens.bgt]={price:K(s.price.toString()),updatedAt:s.updatedAt,chainId:a}),n},{})}import{getPublicClient as qa}from"@wagmi/core";import{erc20Abi as Da,formatUnits as Qa}from"viem";async function Wc({items:e,account:t,config:r}){j(e,"items"),j(r,"config"),j(t,"account");let a=Object.groupBy(e,i=>i.token.chainId);return(await Promise.allSettled(Object.entries(a).map(async([i,l])=>{if(!l)return[];let n=qa(r,{chainId:Number(i)});return v(n,`publicClient ${i}`),(await n.multicall({contracts:l.map(u=>({address:u.token.address,abi:Da,functionName:"allowance",args:[t,u.spender]}))})).map((u,m)=>{let f=l[m];return u.error?void 0:{token:f.token,spender:f.spender,amount:f.amount,allowance:{raw:u.result.toString(),formatted:Qa(u.result,f.token.decimals)},needsApproval:u.result<BigInt(f.amount.raw)}}).filter(u=>!!u)}))).flatMap(i=>i.status==="fulfilled"?i.value:void 0).filter(i=>!!i)}import{getPublicClient as La,getWalletClient as Oa,switchChain as Ma}from"@wagmi/core";import{BaseError as Ha,createWalletClient as _a,decodeErrorResult as Ja,HttpRequestError as $a,http as ja}from"viem";import{ChainId as Ka,defaultChainId as Ft}from"@berachain/config/internal";import{AbiFunctionSignatureNotFoundError as Ua,decodeFunctionData as Wa}from"viem";async function Tt({publicClient:e,abi:t,...r}){let a=[...le,...t??[]],o,i,l,n,s,d,u;if("txHash"in r){let m=await e.getTransaction({hash:r.txHash});if(!m.to)throw new x({property:"tx",value:m,expected:"Transaction",message:"Trying to get revert reason for a contract creation"});s=m.input,i=m.to,l=m.from,n=m.value,o=m.blockNumber}else if(o=r.blockNumber,i=r.to,l=r.account,n=r.value,"data"in r)s=r.data;else if("functionName"in r&&"args"in r)d=r.functionName,u=r.args;else if(!n)throw new x({property:"dataOrFunctionNameAndArgs",value:r,expected:"Hex or FunctionName and Args"});try{if(!a)if(s)await e.call({data:s,to:i,account:l,blockNumber:o,value:n});else throw new Error("Data is required if abi is not provided");if("functionName"in r&&"args"in r&&r.functionName)d=r.functionName,u=r.args;else if(s){if(!a){let m=await e.call({data:s,to:i,account:l,blockNumber:o,value:n});throw new Error(`Getting revert reason for successful simulation. Data: ${s}`,{cause:m})}try{let m=Wa({abi:a,data:s});d=m.functionName,u=m.args}catch(m){throw m instanceof Ua&&await e.call({data:s,to:i,account:l,blockNumber:o,value:n}),new Error("Data is required if abi is not provided")}}else throw new Error("No data or function name and args provided");throw a&&d?(await e.simulateContract({functionName:d,args:u,abi:a,address:i,account:l,blockNumber:o}),new H({message:"Getting revert reason for successful simulation",functionName:d,to:i,txHash:"txHash"in r?r.txHash:void 0,input:r})):new Error("No data or function name and args provided")}catch(m){if(m instanceof Error)return ee({error:m,abi:a,revertIfUnknown:!0});throw m}}var Ya=Me(1),Et=(e,t)=>e*(100n+BigInt(t))/100n;function Ee({nonceResult:e,onWarning:t}){if(e.status==="fulfilled"){if(e.value&&e.value>Number.MAX_SAFE_INTEGER){t?.(new P({message:"Nonce is too large. No nonce will be provided to avoid IntegerOutOfRangeError.",cause:e.value,level:"debug"}));return}return e.value}}function za(e=Ft){return e===Ka.BEPOLIA?process.env.NEXT_PUBLIC_80069_ANVIL_IMPERSONATE_ACCOUNT==="true":process.env.NEXT_PUBLIC_80094_ANVIL_IMPERSONATE_ACCOUNT==="true"}async function ld(e){if(process.env.NODE_ENV==="development"&&!e.contractName&&e.address&&!("calls"in e||e.calls))throw console.warn("beraWriteContract: Contract name is required. Either update the contract mapping in devrel or provide a contract name in ContractName enum","This is a development error and will be thrown in development mode only."),new x({property:"contractName",value:e.contractName,expected:"ContractName",displayMessage:`[DEV] Contract name is required as it's not mapped in the devrel's contract mapping ${e.address}`,level:"error"});let{address:t,calls:r,value:a,gasLimit:o,onLoading:i,onSuccess:l,onWarning:n,onError:s,onSubmission:d,wagmiConfig:u,walletClient:m,account:f,txConfirmationTimeout:b=12e4,chainId:p=Ft,impersonateAccount:A=za(p),errorsAbi:C=[],pollingInterval:B=Ya,...y}=e;i?.(e);let T="data"in y?y.data:void 0,k=[...le,...C,..."abi"in y&&y.abi&&Array.isArray(y.abi)?y.abi:[]],N=m;if(!u){s?.(new x({property:"wagmiConfig",value:u,expected:"Config"}),e);return}if(!(N?.account?.type==="local"))try{await Ma(u,{chainId:p})}catch(V){let G=V;s?.(new P({cause:G,displayMessage:"There was an error switching to the chain."}),e);return}if(!N)try{N=await Oa(u,{chainId:p})}catch(V){s?.(new P({cause:V,displayMessage:"There was an error connecting to the wallet."}),e);return}if(!N){s?.(new x({displayMessage:"There was an error connecting to the wallet.",property:"walletClient",value:N,expected:"WalletClient"}),e);return}let I=f||N.account;if(!I){s?.(new x({property:"account",value:I,expected:"Account"}),e);return}let se=typeof I=="string"?I:I.address,U=La(u,{chainId:p});try{v(U)}catch(V){s?.(V,e);return}if(A){let V=Pe(p);await V.impersonateAccount({address:se}),N=_a({transport:ja(V.transport.url),account:I,chain:N.chain})}let E,Z={calls:"calls"in y?y.calls:void 0,params:"params"in y?y.params:void 0,value:a,data:"data"in y?y.data:void 0};try{let V=U.getTransactionCount({address:se,blockTag:"latest"}).catch(()=>{}),G={account:se,to:t,address:t,chainId:p,value:a};if(r){let F=r.map(h=>{if("abi"in h&&Array.isArray(k)&&k.push(...h.abi),"data"in h)return{to:h.address,data:h.data,value:h.value??0n};if("abi"in h&&"functionName"in h){let W="params"in h?h.params:void 0;return{to:h.address,abi:h.abi,functionName:h.functionName,args:W,value:h.value??0n}}return{to:h.address,value:h.value??0n}});if(e.enableSimulateCalls){let h=await U.simulateCalls({calls:F,account:I}),W=h.results.findIndex(L=>L.status==="failure");if(W!==-1){if(h.block.number===null)throw new x({property:"blockNumber",value:h.block.number,expected:"bigint",message:"Block number is null"});let L=h.results[W],{reason:he}=L.data&&L.data!=="0x"?{reason:De(Ja({data:L.data,abi:k}))}:ee({error:L.error,revertIfUnknown:!1,abi:k});s?.(new H({cause:L.error,txHash:E,chainId:p,reason:he,abi:k,input:Z,blockNumber:h.block.number}),e);return}}if(process.env.NODE_ENV==="test")throw new x({displayMessage:"Batch calls are not supported in test environment",expected:"not test",property:"NODE_ENV",value:process.env.NODE_ENV,level:"fatal"});let D=await N.sendCalls({calls:F,account:I,forceAtomic:!0});d?.({id:D.id},e);let Q=await N.waitForCallsStatus({id:D.id,pollingInterval:B,timeout:b});if(Q.status==="success"){let h=Q.receipts?.[0];if(!h)throw new P({message:"Call status is success but no receipt was found",cause:Q,level:"error",reason:"CALL_STATUS_SUCCESS_BUT_NO_RECEIPT"});return l?.(h,e),h}throw console.error("wallet_sendCalls: Call failed",Q),new H({cause:Q,level:"error",input:Z,txHash:E,abi:k,chainId:p})}if(T){let[F,D,Q]=await Promise.allSettled([U.call({...G,data:T}),o??U.estimateGas({...G,data:T}),V]);if(F.status==="rejected")throw F.reason;let h=D.status==="fulfilled"?Et(D.value,10):Ce;E=await N.sendTransaction({data:T,to:t,account:I,gas:h,chainId:p,nonce:Ee({nonceResult:Q,onWarning(W){n?.(W,e)}}),value:a}),d?.({txHash:E},e)}else if("abi"in y&&"functionName"in y){let{abi:F,functionName:D}=y,Q="params"in y?y.params:void 0,[h,W,L]=await Promise.allSettled([U.simulateContract({...G,abi:k,functionName:D,args:Q,account:I}),o??U.estimateContractGas({...G,abi:k,functionName:D,args:Q}),V]);if(h.status==="rejected")throw h.reason;let he=o??(W.status==="fulfilled"?Et(W.value,10):Ce);E=await N.writeContract({...h.value.request,chainId:p,gas:he,nonce:Ee({nonceResult:L,onWarning(Ut){n?.(Ut,e)}})}),d?.({txHash:E},e)}else{let[F]=await Promise.allSettled([V]);E=await N.sendTransaction({chainId:p,to:t,value:a,account:I,nonce:Ee({nonceResult:F,onWarning(D){n?.(D,e)}})}),d?.({txHash:E},e)}process.env.NODE_ENV==="test"&&await Pe(p).mine({blocks:1});let J=await U.waitForTransactionReceipt({hash:E,pollingInterval:B,timeout:b,confirmations:1});if(J.status==="success")l?.(J,e);else{let F=await Tt({publicClient:U,blockNumber:J.blockNumber,to:t,account:se,abi:k,args:"params"in y?y.params:void 0,functionName:"functionName"in y?y.functionName:void 0,value:a,data:T});process.env.NODE_ENV==="test"&&console.error("beraWriteContract: Revert reason",F),s?.(new H({reason:F.reason,txHash:E,receipt:J,to:t,functionName:"functionName"in y?y.functionName:void 0,input:Z,chainId:p,abi:k,blockNumber:J.blockNumber}),e)}return J}catch(V){if(V instanceof P)s?.(V,e);else if(V instanceof Error){let G=ee({error:V,revertIfUnknown:!1,abi:k});if(G&&G.rootCause instanceof Ha&&"url"in G.rootCause){s?.(new $({cause:G.rootCause,response:void 0,endpoint:{url:G.rootCause.url,type:"rpc"},statusCode:G.rootCause instanceof $a?G.rootCause.status:void 0}),e);return}s?.(new H({cause:V,to:t,txHash:E,chainId:p,abi:k,functionName:"functionName"in y?y.functionName:void 0,input:Z}),e)}else s?.(new H({cause:V,txHash:E,to:t,chainId:p,functionName:"functionName"in y?y.functionName:void 0,input:Z,abi:k}),e)}}import{GetValidators as Xa}from"@berachain/graphql/pol/api";async function It({variables:e={},...t}={}){let{config:r}=c(t);return(await g("api",t).query({query:Xa,variables:{chain:r.bex.chainName,...e}})).data}import{isAddressEqual as Za}from"viem";async function bd({allocation:e}){let t=await be({filter:{where:{vaultAddressIn:e.weights.map(a=>a.receiver)}}}),r=e?.start.blockNumber??0;return e?.weights.map(a=>({percentage:a.percentage,receiver:a.receiver,startBlock:r,receivingVault:t?.gaugeList.find(o=>Za(o.address,a.receiver))}))}import{GetValidator as eo}from"@berachain/graphql/pol/api";async function Cd({id:e,...t}){let{config:r}=c(t);return(await g("api",t).query({query:eo,variables:{id:e,chain:r.bex.chainName}})).data}import{GetValidatorBlockStats as to}from"@berachain/graphql/pol/subgraph";async function Vd({pubKey:e,first:t=1,...r}){let a=g("pol.subgraph",r);try{return(await a.query({query:to,variables:{pubKey:e,first:t}})).data}catch(o){throw console.error("GetValidatorBlockStats:",o),o}}import{beraChefAbi as qt}from"@berachain/abis/pol/rewards/beraChef";function X(e,t){return{start:{blockNumber:Number(e.startBlock),timestamp:e.startBlock!==0n?t:0},weights:e.weights.map(r=>({receiver:r.receiver,percentage:Number(r.percentageNumerator)/1e4}))}}function ro(e,t){return e.start.blockNumber===t.start.blockNumber&&e.weights.every((r,a)=>r.percentage===t.weights[a].percentage)}async function Nd({client:e,pubKey:t,...r}){let{config:a}=c(r);try{let[o,i]=await Promise.all([e.readContract({address:a.pol.beraChef,abi:qt,functionName:"getActiveRewardAllocation",args:[t]}),e.readContract({address:a.pol.beraChef,abi:qt,functionName:"getSetActiveRewardAllocation",args:[t]})]),[l,n]=await Promise.all([o.startBlock!==0n?e.getBlock({blockNumber:BigInt(o.startBlock)}):{timestamp:0},i.startBlock!==0n?e.getBlock({blockNumber:BigInt(i.startBlock)}):{timestamp:0}]),s=X(o,Number(l.timestamp)),d=X(i,Number(n.timestamp)),u=!1;return d.start.blockNumber===0?u=!0:u=!ro(d,s),{activeRewardAllocation:s,setRewardAllocation:d,isBaseline:u,isNeverSet:d?.start.blockNumber===0}}catch(o){throw console.log("getValidatorRewardAllocation:",o),o}}import{beraChefAbi as ao}from"@berachain/abis/pol/rewards/beraChef";function Fd(e){return e.start.blockNumber===0}async function Id({client:e,...t}){let{config:r}=c(t),a=await e.readContract({address:r.pol.beraChef,abi:ao,functionName:"getDefaultRewardAllocation",args:[]});return X({...a,startBlock:0n},0)}import{GetValidatorByAccount as oo}from"@berachain/graphql/pol/subgraph";async function Ud({account:e,...t}){try{return(await g("pol.subgraph",t).query({query:oo,variables:{account:e}})).data}catch(r){throw console.error("getManagedValidatorByAccount:",r),r}}async function Ld({client:e,valPubKey:t}){return 5614}import{formatEther as Fe}from"viem";import{bgtAbi as Ie}from"@berachain/abis/pol/bgt";async function Dt({account:e,pubkey:t,publicClient:r,...a}){let{config:o}=c(a);if(!e)throw new Error("account is required");if(!r)throw new Error("publicClient is required");let[i,l,n]=await Promise.all([r.readContract({address:o.tokens.bgt,abi:Ie,functionName:"boosted",args:[e,t]}),r.readContract({address:o.tokens.bgt,abi:Ie,functionName:"boostedQueue",args:[e,t]}),r.readContract({address:o.tokens.bgt,abi:Ie,functionName:"dropBoostQueue",args:[e,t]})]);return{pubkey:t,activeBoostAmount:Fe(i),queuedBoostAmount:Fe(l[1]),queuedDropBoostAmount:Fe(n[1]),queuedBoostStartBlock:l[0],queuedDropBoostStartBlock:n[0],hasPendingBoosts:Number(l[1])>0||Number(n[1])>0,hasActiveBoosts:Number(i)>0}}import{GetUserValidatorInformation as no}from"@berachain/graphql/pol/subgraph";async function Qt({account:e,block:t,...r}){return await g("pol.subgraph",r).query({query:no,variables:{address:e.toLowerCase(),block:t}})}async function tm({account:e,publicClient:t,chain:r,...a}){let{config:o}=c(a),i=r??o.bex.chainName,l=await Qt({account:e}),[n,s]=await Promise.all([It({variables:{chain:i,where:{idIn:l.data.userValidatorInformations.map(d=>d.validator.id)}}}),t&&je({lastBlockTimestamp:l.data._meta?.block.timestamp,blockTime:o.averageBlockTime})?Promise.all(l.data.userValidatorInformations.map(d=>Dt({account:e,pubkey:d.validator.publicKey,publicClient:t}))):void 0]);return n?.validators.validators.map(d=>{let u=s?s.find(m=>m.pubkey.toLowerCase()===d.pubkey.toLowerCase()):l.data.userValidatorInformations.find(m=>m.validator.id.toLowerCase()===d.id.toLowerCase());if(!u)throw new Error("User deposited not found");return{...d,userBoosts:{pubkey:"pubkey"in u?u.pubkey:u.validator.publicKey,activeBoostAmount:u?.activeBoostAmount,queuedBoostAmount:u?.queuedBoostAmount,queuedBoostStartBlock:Number(u?.queuedBoostStartBlock),queuedDropBoostAmount:u?.queuedDropBoostAmount,queuedDropBoostStartBlock:Number(u?.queuedDropBoostStartBlock),hasPendingBoosts:Number(u?.queuedBoostAmount)>0||Number(u?.queuedDropBoostAmount)>0,hasActiveBoosts:Number(u?.activeBoostAmount)>0}}})}var io=[{validatorAddress:"0x8f51e63d9921a461be29e73dca1c2385e1adc5943fbb36ded4ba96025ee8a783184d1118da08171f6ea831153c878a6d",earning:.045,staked:{amount:16114000000000000000n,formattedAmount:"161.14"},rewards:{amount:15214000000000000000n,formattedAmount:"152.14"}},{staked:{amount:141514000000000000000n,formattedAmount:"1415.14"},validatorAddress:"0x97b21253b17f4e814fe7505c15c18e68c85ab2477274ad370a762df50e3eb4cb1a48451e089bc22e158d7448549a8ab9",earning:.045,rewards:{amount:15414000000000000000n,formattedAmount:"154.14"},queueData:{stake:[{amount:16159000000000000000n,formattedAmount:"161.59"}],unstake:[{amount:16159000000000000000n,formattedAmount:"161.59",timestamp:S(Date.now()-72e6)}]}},{staked:{amount:141514000000000000000n,formattedAmount:"1415.14"},validatorAddress:"0xa2705d6b27891f3f5651f26547d1bb79e256f95f249d1ad717cef087d77d38b037e5d6dbaa2538930fd0731ec9b02f3a",earning:.145,rewards:{amount:15414000000000000000n,formattedAmount:"154.14"},queueData:{unstake:[{amount:16159000000000000000n,formattedAmount:"161.59",timestamp:S(Date.now()-72e6)}]}},{staked:{amount:141514000000000000000n,formattedAmount:"1415.14"},validatorAddress:"0xa2705d6b27891f3f5651f26547d1bb79e256f95f249d1ad717cef087d77d38b037e5d6dbaa2538930fd0731ec9b02f3a",earning:.145,rewards:{amount:15414000000000000000n,formattedAmount:"154.14"},queueData:{unstake:[{amount:16159000000000000000n,formattedAmount:"161.59",timestamp:S(Date.now()-72e6)}]}},{staked:{amount:141514000000000000000n,formattedAmount:"1415.14"},validatorAddress:"0xa2705d6b27891f3f5651f26547d1bb79e256f95f249d1ad717cef087d77d38b037e5d6dbaa2538930fd0731ec9b02f3a",earning:.145,rewards:{amount:15414000000000000000n,formattedAmount:"154.14"},queueData:{unstake:[{amount:16159000000000000000n,formattedAmount:"161.59",timestamp:S(Date.now()-72e6)}]}},{staked:{amount:141514000000000000000n,formattedAmount:"1415.14"},validatorAddress:"0xa2705d6b27891f3f5651f26547d1bb79e256f95f249d1ad717cef087d77d38b037e5d6dbaa2538930fd0731ec9b02f3a",earning:.145,rewards:{amount:15414000000000000000n,formattedAmount:"154.14"},queueData:{unstake:[{amount:16159000000000000000n,formattedAmount:"161.59",timestamp:S(Date.now()-72e6)}]}},{staked:{amount:141514000000000000000n,formattedAmount:"1415.14"},validatorAddress:"0xa2705d6b27891f3f5651f26547d1bb79e256f95f249d1ad717cef087d77d38b037e5d6dbaa2538930fd0731ec9b02f3a",earning:.145,rewards:{amount:15414000000000000000n,formattedAmount:"154.14"},queueData:{unstake:[{amount:16159000000000000000n,formattedAmount:"161.59",timestamp:S(Date.now()-72e6)}]}},{staked:{amount:241514000000000000000n,formattedAmount:"2415.14"},validatorAddress:"0xa4e4b63514f54d61da5197359f11ff1fc2930788ba2ffdd30c2fc059cbe0221020197bf9446b16ac347f36c7517a8686",earning:.145,rewards:{amount:15414000000000000000n,formattedAmount:"154.14"},queueData:{unstake:[{amount:1159000000000000000n,formattedAmount:"11.59",timestamp:S(Date.now()-36e6)}]}},{validatorAddress:"0xb0511ec039591e98bd4e183ba70b85572214a7ad8ca1a43e96ad3495d3821054927bc542e5482ec9733e35b7ef0b1f03",earning:.045,staked:{amount:141514000000000000000n,formattedAmount:"1415.14"},rewards:{amount:15414000000000000000n,formattedAmount:"154.14"},queueData:{stake:[{amount:1159000000000000000n,formattedAmount:"11.59"}]}}];async function om(e){return await new Promise(t=>setTimeout(t,2e3)),e==="0x4C368fFE3650379d6318C8d4630bc51f8Ad12bB6"?io:[]}import{GetValidatorAnalytics as so}from"@berachain/graphql/pol/subgraph";async function um({pubkey:e,dayRange:t,...r}){return(await g("pol.subgraph",r).query({query:so,variables:{pubKey:e,timestamp:Je(t).toString()}})).data}import{beraChefAbi as lo}from"@berachain/abis/pol/rewards/beraChef";async function pm({client:e,pubKey:t,...r}){let{config:a}=c(r),o=await e.readContract({address:a.pol.beraChef,abi:lo,functionName:"getValCommissionOnIncentiveTokens",args:[t]});return Number(o??0n)/1e4}var bm=(e,t,r)=>{if(!t||!e)return 0;let a=te(1)/r;return(t?a*(Number(e.dynamicData?.stakedBeraAmount)/t):0)*Number.parseFloat(e.dynamicData?.rewardRate??"0")};import{beaconDepositAbi as uo}from"@berachain/abis/pol/beaconDeposit";async function wm({client:e,pubKey:t,...r}){let{config:a}=c(r);try{return await e.readContract({address:a.depositContract,abi:uo,functionName:"getOperator",args:[t]})}catch(o){throw console.log("getValidatorOperatorAddress:",o),o}}import{beraChefAbi as co}from"@berachain/abis/pol/rewards/beraChef";async function vm({client:e,pubKey:t,...r}){let{config:a}=c(r),o=await e.readContract({address:a.pol.beraChef,abi:co,functionName:"getValQueuedCommissionOnIncentiveTokens",args:[t]});return{blockNumberLast:o.blockNumberLast,commissionRate:Number(o.commissionRate)/1e4}}import{beaconDepositAbi as mo}from"@berachain/abis/pol/beaconDeposit";async function km({client:e,pubKey:t,...r}){let{config:a}=c(r);try{return await e.readContract({address:a.depositContract,abi:mo,functionName:"queuedOperator",args:[t]})}catch(o){throw console.log("getValidatorQueuedOperatorAddress:",o),o}}import{beraChefAbi as po}from"@berachain/abis/pol/rewards/beraChef";async function Em({client:e,pubKey:t,...r}){let{config:a}=c(r);try{let o=await e.readContract({address:a.pol.beraChef,abi:po,functionName:"getQueuedRewardAllocation",args:[t]});return X(o,0)}catch(o){throw console.log("getValidatorQueuedRewardAllocation:",o),o}}export{yo as a,me as b,g as c,Io as d,Xe as e,_o as f,rn as g,ln as h,pn as i,et as j,vn as k,Nn as l,In as m,Wn as n,Y as o,_n as p,fe as q,Yn as r,Zn as s,oi as t,st as u,pi as v,yi as w,Ci as x,Vi as y,lt as z,Re as A,ct as B,Zi as C,as as D,Jr as E,ls as F,fs as G,bt as H,vs as I,yt as J,Ds as K,Ms as L,$s as M,oa as N,Xs as O,tl as P,nl as Q,be as R,Fl as S,Bt as T,Ll as U,Jl as V,zl as W,au as X,cu as Y,pu as Z,Au as _,Bu as $,ne as aa,Fu as ba,Lu as ca,_u as da,Yu as ea,St as fa,uc as ga,Ac as ha,Bc as ia,Sc as ja,Ic as ka,Wc as la,za as ma,ld as na,It as oa,bd as pa,Cd as qa,Vd as ra,X as sa,ro as ta,Nd as ua,Fd as va,Id as wa,Ud as xa,Ld as ya,Dt as za,tm as Aa,om as Ba,um as Ca,pm as Da,bm as Ea,wm as Fa,vm as Ga,km as Ha,Em as Ia};
|
|
4
|
-
//# sourceMappingURL=chunk-RW3JFPED.mjs.map
|