@berachain/berajs 0.2.4 → 0.2.6
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 +40 -40
- 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 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/actions/bend/getMaxDeposit.ts","../../src/actions/dex/getPoolWithState.ts","../../src/actions/dex/getVaultPausedState.ts","../../src/actions/governance/getDecodedFunctionData.ts","../../src/actions/honey/getHoneyFees.ts","../../src/actions/honey/getHoneyPausedState.ts","../../src/actions/honey/getHoneyPythPriceOracle.ts","../../src/actions/honey/getHoneyRootPriceOracle.ts","../../src/actions/pol/getBlockTime.ts","../../src/actions/pol/getLSTStakeConfig.ts","../../src/actions/pol/getRewardVaultDurationConstants.ts","../../src/actions/pol/getRewardVaultBeaconImplementation.ts","../../src/abi/utils/upgradableBeacon.ts","../../src/actions/pol/getRewardVaultFromToken.ts","../../src/actions/pyth/getHoneyPythFeeds.ts","../../src/actions/tokens/getTokens.ts","../../src/actions/validators/getActiveBoostAndCommissionChangeDelay.ts","../../src/actions/validators/utils/getValidatorBoostApy.ts"],"sourcesContent":["import { type Address, formatEther, type PublicClient } from \"viem\";\n\nimport { metaMorphoV11Abi as metaMorphoAbi } from \"@berachain/abis/bend-metamorpho/metaMorphoV11\";\n\ninterface GetMaxDepositProps {\n vaultAddress: Address;\n publicClient: PublicClient;\n}\n\nexport async function getMaxDeposit({\n vaultAddress,\n publicClient,\n}: GetMaxDepositProps): Promise<string> {\n const maxDeposit = await publicClient.readContract({\n address: vaultAddress,\n abi: metaMorphoAbi,\n functionName: \"maxDeposit\",\n args: [vaultAddress],\n });\n return formatEther(maxDeposit);\n}\n","import {\n type MinimalToken,\n mapPoolType,\n type PoolState,\n} from \"@berachain-foundation/berancer-sdk\";\nimport type { Address } from \"viem\";\n\nimport type { MinimalPoolFragment } from \"@berachain/graphql/dex/api\";\n\nexport const getPoolState = (apiPool: MinimalPoolFragment): PoolState => {\n return {\n type: mapPoolType(apiPool.type),\n protocolVersion: apiPool.protocolVersion as 1 | 2 | 3,\n tokens: apiPool.tokens.map<MinimalToken>(\n (pt) =>\n ({\n ...pt,\n address: pt.address as Address,\n }) satisfies MinimalToken,\n ),\n id: apiPool.id as Address,\n address: apiPool.address as Address,\n } satisfies PoolState;\n};\n","import type { PublicClient } from \"viem\";\n\nimport { vaultAbi as balancerVaultAbi } from \"@berachain/abis/bex/vault\";\n\nimport { parseBaseArgs } from \"~/utils/parseBaseArgs\";\n\nexport async function getVaultPausedState({\n publicClient,\n ...args\n}: BeraJS.BaseFunctionArgs & {\n publicClient: PublicClient;\n}) {\n const { config } = parseBaseArgs(args);\n\n const vaultPausedState = await publicClient.readContract({\n address: config.bex.vault,\n abi: balancerVaultAbi,\n functionName: \"getPausedState\",\n });\n\n return vaultPausedState[0];\n}\n","import {\n type Abi,\n type AbiFunction,\n type AbiItem,\n type Address,\n decodeFunctionData,\n erc20Abi,\n type PublicClient,\n pad,\n toFunctionSignature,\n trim,\n} from \"viem\";\n\nimport { appConfig, defaultChainId } from \"@berachain/config/internal\";\n\nimport { beraChefAbi } from \"@berachain/abis/pol/rewards/beraChef\";\nimport { rewardVaultAbi } from \"@berachain/abis/pol/rewards/rewardVault\";\n\n// Function to check if ABI contains proxy-related functions\nfunction isProxyABI(abi: Abi[]): boolean {\n return abi.some(\n (item: any) =>\n item.name === \"implementation\" ||\n item.name === \"proxyType\" ||\n (item.type === \"constructor\" &&\n item.inputs?.[0]?.name === \"implementation\"),\n );\n}\n\n/**\n * {@link https://docs.berascan.com/api-endpoints/contracts}\n */\nasync function _getAbi({\n contractAddress,\n chainId,\n publicClient,\n}: {\n contractAddress: Address;\n chainId: number;\n publicClient: PublicClient;\n}) {\n const url = `https://api.etherscan.io/v2/api?module=contract&action=getabi&address=${contractAddress}&apikey=${appConfig.apiKeys.private.etherscan}&chainId=${chainId}`;\n\n const response = await fetch(url);\n\n if (!response.ok) {\n throw new Error(`Failed to fetch ABI: ${response.statusText}`);\n }\n\n const data = await response.json();\n if (data.status === \"0\") throw new Error(data.result);\n\n const abi = JSON.parse(data.result);\n if (!isProxyABI(abi)) return abi;\n\n const implementationResult = await publicClient.getStorageAt({\n address: contractAddress,\n // bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)).\n slot: \"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc\",\n });\n\n // if implementation is not set, it might be a beacon proxy\n if (!implementationResult || trim(implementationResult) === \"0x00\")\n return abi;\n // storage slot has 32 byes (64 characters) but an address only has 20 bytes (40 characters)\n const implementationAddress = pad(trim(implementationResult), { size: 20 });\n return _getAbi({\n contractAddress: implementationAddress as `0x${string}`,\n chainId,\n publicClient,\n });\n}\n\nasync function _getAbiForCallData({\n address,\n callData,\n knownAbi,\n chainId,\n publicClient,\n}: {\n address: Address;\n callData: `0x${string}`;\n knownAbi: AbiItem[];\n chainId: number;\n publicClient: PublicClient;\n}) {\n try {\n if (decodeFunctionData({ data: callData, abi: knownAbi })) {\n return knownAbi;\n }\n } catch {}\n try {\n return await _getAbi({ contractAddress: address, chainId, publicClient });\n } catch {}\n}\n\nfunction _decodeCallData(callData: `0x${string}`, abi: AbiItem[]) {\n try {\n return decodeFunctionData({ data: callData, abi });\n } catch {\n return undefined;\n }\n}\n\nfunction _findAbiItem(abi: AbiItem[], functionName: string) {\n return abi.find(\n (a: AbiItem) => a.type === \"function\" && a.name === functionName,\n ) as AbiFunction | undefined;\n}\n\nfunction _getFunctionSignature(abiItem: AbiFunction | undefined) {\n if (!abiItem) return;\n try {\n return toFunctionSignature(abiItem);\n } catch (error) {\n console.error(error);\n }\n}\n\n/**\n * Decodes the function data from a given contract address and calldata.\n *\n * This function attempts to decode the provided calldata using a known set of ABIs.\n * If the call data cannot be decoded with the known ABIs, it fetches the ABI from the blockexplorer API.\n *\n * @param address - The contract address.\n * @param callData - The calldata to decode, in hexadecimal format.\n * @returns An object containing the decoded ABI item, function signature, function name, and arguments.\n */\nexport async function getDecodedFunctionData({\n address,\n callData,\n chainId = defaultChainId,\n publicClient,\n}: {\n address: Address;\n callData: `0x${string}`;\n chainId?: number;\n publicClient: PublicClient;\n}) {\n const knownAbi = [...beraChefAbi, ...rewardVaultAbi, ...erc20Abi];\n\n const abi = await _getAbiForCallData({\n address,\n callData,\n knownAbi,\n chainId,\n publicClient,\n });\n\n const decodedData = _decodeCallData(callData, abi);\n\n if (!abi || !decodedData) {\n return { args: [] };\n }\n\n const abiItem = _findAbiItem(abi, decodedData.functionName);\n\n const functionSignature = _getFunctionSignature(abiItem);\n\n return {\n abiItem,\n functionSignature,\n functionName: decodedData.functionName,\n args: decodedData.args as unknown[],\n };\n}\n","import { type Address, formatUnits, type PublicClient } from \"viem\";\n\nimport { honeyFactoryAbi } from \"@berachain/abis/honey/honeyFactory\";\n\nimport type { Token } from \"@berachain/graphql/pol/api\";\n\nimport { parseBaseArgs } from \"~/utils/parseBaseArgs\";\n\nexport interface CollateralRates {\n mintFee: number;\n redeemFee: number;\n}\n\nexport interface HoneyFeeMap {\n single: Record<Address, CollateralRates>;\n basket: CollateralRates;\n}\n\nexport interface CollateralRatesArgs extends BeraJS.BaseFunctionArgs {\n client: PublicClient;\n collateralList: Token[];\n}\n\n/**\n * Fetches the mint and redeem rates for all collateral tokens and calculates the weighted basket rates\n * @param {Object} params - The parameters object\n * @param {PublicClient} params.client - The Viem public client instance\n * @param {Address[]} params.collateralList - Array of collateral token addresses\n * @returns {Promise<HoneyFeeMap | undefined>} Object containing individual collateral rates and weighted basket rates,\n * or undefined if the operation fails\n */\nexport async function getHoneyFees({\n client,\n collateralList,\n ...args\n}: CollateralRatesArgs): Promise<HoneyFeeMap> {\n const { config } = parseBaseArgs(args);\n\n try {\n // create a list for all the promises needed, fetch the mint and redeem rates for each collateral token\n const promiseList: Record<\"mint\" | \"redeem\", Promise<bigint>[]> = {\n mint: [],\n redeem: [],\n };\n for (const coll of collateralList) {\n promiseList.mint.push(\n client.readContract({\n address: config.honey.factory,\n abi: honeyFactoryAbi,\n functionName: \"mintRates\",\n args: [coll.address as Address],\n }),\n );\n promiseList.redeem.push(\n client.readContract({\n address: config.honey.factory,\n abi: honeyFactoryAbi,\n functionName: \"redeemRates\",\n args: [coll.address as Address],\n }),\n );\n }\n const [mintRates, redeemRates, collateralWeights] = await Promise.all([\n Promise.all(promiseList.mint),\n Promise.all(promiseList.redeem),\n // fetch the collateral weights, needed to calculate the weighted basket rates\n client.readContract({\n address: config.honey.factory,\n abi: honeyFactoryAbi,\n functionName: \"getWeights\",\n }),\n ]);\n\n // calculate the weighted basket rates and the single collateral rates\n\n return collateralList.reduce<HoneyFeeMap>(\n (acc, coll) => {\n const collIdx = collateralList.indexOf(coll);\n acc.single[coll.address as Address] = {\n mintFee: 1 - +formatUnits(mintRates[collIdx], 18),\n redeemFee: 1 - +formatUnits(redeemRates[collIdx], 18),\n };\n acc.basket.mintFee +=\n acc.single[coll.address as Address].mintFee *\n +formatUnits(collateralWeights[collIdx], 18);\n\n acc.basket.redeemFee +=\n acc.single[coll.address as Address].redeemFee *\n +formatUnits(collateralWeights[collIdx], 18);\n return acc;\n },\n {\n single: {},\n basket: { mintFee: 0, redeemFee: 0 },\n },\n );\n } catch (e) {\n console.log(e);\n throw e;\n }\n}\n","import type { PublicClient } from \"viem\";\n\nimport { honeyAbi } from \"@berachain/abis/honey/honey\";\n\nimport { parseBaseArgs } from \"~/utils/parseBaseArgs\";\n\n/**\n * Gets the pause state of the Honey protocol\n * @returns boolean\n */\nexport async function getHoneyPausedState({\n client,\n ...args\n}: BeraJS.BaseFunctionArgs & {\n client: PublicClient;\n}) {\n const { config } = parseBaseArgs(args);\n const honeyAddress = config.honey.token;\n const honeyPausedState = await client.readContract({\n address: honeyAddress,\n abi: honeyAbi,\n functionName: \"paused\",\n });\n\n return honeyPausedState;\n}\n","import type { Address, PublicClient } from \"viem\";\n\nimport { rootPriceOracleAbi as honeyRootOracleAbi } from \"@berachain/abis/extras/rootPriceOracle\";\n\n/**\n * Gets the address of the Honey Pyth Oracle, which is called by the Honey Root Price Oracle to get the price of the collaterals\n * @returns\n */\nexport async function getHoneyPythOracle({\n pythOracle,\n publicClient,\n}: {\n publicClient: PublicClient;\n pythOracle: Address;\n}) {\n return await publicClient.readContract({\n address: pythOracle,\n abi: honeyRootOracleAbi,\n functionName: \"pythOracle\",\n });\n}\n","import type { Address, PublicClient } from \"viem\";\n\nimport { honeyFactoryAbi } from \"@berachain/abis/honey/honeyFactory\";\n\nimport { parseBaseArgs } from \"~/utils/parseBaseArgs\";\n\n/**\n * Gets the address of the Honey Root Price Oracle, which keeps the logic to price the collaterals\n */\nexport async function getHoneyRootPriceOracle({\n publicClient,\n factory,\n ...args\n}: BeraJS.BaseFunctionArgs & {\n publicClient: PublicClient;\n factory?: Address;\n}): Promise<Address> {\n const { config } = parseBaseArgs(args);\n return await publicClient.readContract({\n address: factory ?? config.honey.factory,\n abi: honeyFactoryAbi,\n functionName: \"priceOracle\",\n });\n}\n","import {\n GetBlocksTimeStamp,\n type GetBlocksTimeStampQuery,\n type GetBlocksTimeStampQueryVariables,\n} from \"@berachain/graphql/chain\";\n\nimport { parseBaseArgs } from \"~/utils/parseBaseArgs\";\nimport { hoursInSeconds, msToSeconds } from \"~/utils/time\";\nimport { getApolloClient } from \"../clients/getApolloClient\";\n\nexport async function getBlockTime({\n defaultBlockTime,\n blocksSpan,\n ...args\n}: {\n defaultBlockTime?: number;\n blocksSpan?: number;\n} & BeraJS.BaseFunctionArgs = {}): Promise<number> {\n const { config } = parseBaseArgs(args);\n\n const blocksClient = getApolloClient(\"blocks.subgraph\", args);\n\n const blockTime = defaultBlockTime ?? config.averageBlockTime;\n const span = blocksSpan ?? Math.floor(hoursInSeconds(1) / blockTime);\n\n const res = await blocksClient.query<\n GetBlocksTimeStampQuery,\n GetBlocksTimeStampQueryVariables\n >({\n query: GetBlocksTimeStamp,\n variables: {\n skip: span,\n },\n });\n\n const data = res.data;\n\n return (\n // we need to use current timestamp as the latest block might not have been minted (chain halted)\n (msToSeconds(Date.now()) - Number(data?.oldest[0]?.timestamp)) /\n (Number(data?.newest[0]?.number) - Number(data?.oldest[0]?.number))\n );\n}\n","import type { Address, PublicClient } from \"viem\";\n\nimport { lstStakerVaultAbi } from \"@berachain/abis/pol/lst/lstStakerVault\";\n\nimport { assertPublicClient } from \"~/errors/assert\";\nimport type { TokenWithMetadata } from \"~/types/dex\";\nimport type { StakingConfig } from \"~/types/staking\";\nimport { parseBaseArgs } from \"~/utils/parseBaseArgs\";\nimport { isToken } from \"~/utils/tokens\";\n\nexport type GetLSTStakeConfigArgs = {\n tokenList: TokenWithMetadata[];\n publicClient?: PublicClient;\n lstStakingVaults: Address[];\n} & BeraJS.BaseFunctionArgs;\n\n/**\n * Builds staking configs from on-chain LST vaults and optional native configs.\n */\nexport async function getLSTStakeConfig({\n tokenList,\n publicClient,\n lstStakingVaults,\n ...args\n}: GetLSTStakeConfigArgs): Promise<StakingConfig[]> {\n assertPublicClient(publicClient);\n\n const { config } = parseBaseArgs({\n ...args,\n chainId: publicClient.chain?.id ?? args.chainId,\n });\n\n const lstStakingTokens = tokenList.filter((token) =>\n lstStakingVaults.includes(token.address),\n );\n\n if (lstStakingTokens.length === 0) {\n return [];\n }\n\n const assets = await Promise.all(\n lstStakingTokens.map(async (stakingToken) => {\n // read the asset token address from the lst staking vault\n const assetTokenAddress = await publicClient.readContract({\n address: stakingToken.address,\n abi: lstStakerVaultAbi,\n functionName: \"asset\",\n });\n return { assetTokenAddress, stakingToken };\n }),\n );\n\n return assets.reduce<StakingConfig[]>(\n (acc, { assetTokenAddress, stakingToken }) => {\n const assetToken = tokenList.find((token) =>\n isToken(token, assetTokenAddress),\n );\n if (!assetToken) return acc;\n acc.push({\n id: stakingToken.address,\n receiptToken: stakingToken,\n inputTokens: [assetToken],\n });\n return acc;\n },\n [],\n );\n}\n","import type { PublicClient } from \"viem\";\n\nimport { rewardVaultAbi } from \"@berachain/abis/pol/rewards/rewardVault\";\n\nimport { assertPublicClient } from \"~/errors/assert\";\nimport { getRewardVaultBeaconImplementation } from \"./getRewardVaultBeaconImplementation\";\n\nexport interface RewardVaultDurationConstants {\n minRewardDuration: number;\n maxRewardDuration: number;\n}\n\n/**\n * Returns the minimum and maximum reward duration constants for all reward vaults.\n */\nexport async function getRewardVaultDurationConstants({\n publicClient,\n ...baseArgs\n}: BeraJS.BaseFunctionArgs & {\n publicClient: PublicClient;\n}): Promise<RewardVaultDurationConstants> {\n assertPublicClient(publicClient);\n\n const beaconImplementation = await getRewardVaultBeaconImplementation({\n publicClient,\n ...baseArgs,\n });\n\n const [minRewardDuration, maxRewardDuration] = await Promise.all([\n publicClient.readContract({\n address: beaconImplementation,\n abi: rewardVaultAbi,\n functionName: \"MIN_REWARD_DURATION\",\n }),\n publicClient.readContract({\n address: beaconImplementation,\n abi: rewardVaultAbi,\n functionName: \"MAX_REWARD_DURATION\",\n }),\n ]);\n\n return {\n minRewardDuration: Number(minRewardDuration),\n maxRewardDuration: Number(maxRewardDuration),\n };\n}\n","import type { Address, PublicClient } from \"viem\";\n\nimport { rewardVaultFactoryAbi } from \"@berachain/abis/pol/rewards/rewardVaultFactory\";\n\nimport { upgradableBeaconAbi } from \"~/abi/utils/upgradableBeacon\";\nimport { assertAddress, assertDefined } from \"~/errors/assert\";\nimport { parseBaseArgs } from \"~/utils/parseBaseArgs\";\n\n/**\n * Returns the beacon implementation address for all reward vaults.\n */\nexport async function getRewardVaultBeaconImplementation({\n publicClient,\n ...args\n}: BeraJS.BaseFunctionArgs & {\n publicClient: PublicClient;\n}): Promise<Address> {\n const { config } = parseBaseArgs(args);\n const factoryAddress = config.pol.factory;\n assertDefined(publicClient, \"publicClient\");\n assertAddress(config.pol.factory, \"factoryAddress\");\n\n // from the factory contract, we get the beacon address\n const beacon = await publicClient.readContract({\n address: factoryAddress,\n abi: rewardVaultFactoryAbi,\n functionName: \"beacon\",\n });\n\n // from the beacon contract, we get the current implementation address\n return await publicClient.readContract({\n address: beacon,\n abi: upgradableBeaconAbi,\n functionName: \"implementation\",\n });\n}\n","export const upgradableBeaconAbi = [\n {\n inputs: [\n { internalType: \"address\", name: \"initialOwner\", type: \"address\" },\n {\n internalType: \"address\",\n name: \"initialImplementation\",\n type: \"address\",\n },\n ],\n stateMutability: \"payable\",\n type: \"constructor\",\n },\n { inputs: [], name: \"NewImplementationHasNoCode\", type: \"error\" },\n { inputs: [], name: \"NewOwnerIsZeroAddress\", type: \"error\" },\n { inputs: [], name: \"Unauthorized\", type: \"error\" },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"address\",\n name: \"oldOwner\",\n type: \"address\",\n },\n {\n indexed: true,\n internalType: \"address\",\n name: \"newOwner\",\n type: \"address\",\n },\n ],\n name: \"OwnershipTransferred\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"address\",\n name: \"implementation\",\n type: \"address\",\n },\n ],\n name: \"Upgraded\",\n type: \"event\",\n },\n {\n inputs: [],\n name: \"implementation\",\n outputs: [{ internalType: \"address\", name: \"result\", type: \"address\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"owner\",\n outputs: [{ internalType: \"address\", name: \"result\", type: \"address\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"renounceOwnership\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"newOwner\", type: \"address\" }],\n name: \"transferOwnership\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"newImplementation\", type: \"address\" },\n ],\n name: \"upgradeTo\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n] as const;\n","import { type Address, type PublicClient, zeroAddress } from \"viem\";\n\nimport { rewardVaultFactoryAbi } from \"@berachain/abis/pol/rewards/rewardVaultFactory\";\n\nimport { parseBaseArgs } from \"~/utils/parseBaseArgs\";\n\nexport async function getRewardVaultFromToken({\n tokenAddress,\n publicClient,\n factoryAddress,\n ...args\n}: {\n tokenAddress: Address;\n publicClient: PublicClient;\n factoryAddress?: Address;\n} & BeraJS.BaseFunctionArgs) {\n const { config } = parseBaseArgs(args);\n\n const vaultAddress = await publicClient.readContract({\n address: factoryAddress ?? config.pol.factory,\n abi: rewardVaultFactoryAbi,\n functionName: \"getVault\",\n args: [tokenAddress],\n });\n\n if (vaultAddress === zeroAddress) {\n return null;\n }\n\n return vaultAddress;\n}\n","import type { PublicClient } from \"viem\";\n\nimport type { Address } from \"@berachain/config\";\n\nimport { pythPriceOracleAbi } from \"@berachain/abis/extras/pythPriceOracle\";\n\nimport type { PythPriceFeedMap } from \"~/types/honeySwap\";\nimport { parseBaseArgs } from \"~/utils/parseBaseArgs\";\n\n/**\n * Given a list of tokens, it will return the price feed ids for each token according to honey priceOracle\n * @returns\n */\nexport async function getHoneyPythFeeds({\n tokenList,\n publicClient,\n ...args\n}: {\n tokenList: readonly Address[];\n publicClient: PublicClient;\n} & BeraJS.BaseFunctionArgs): Promise<PythPriceFeedMap> {\n const { config } = parseBaseArgs(args);\n\n try {\n const priceFeedIds = await Promise.all(\n tokenList.map((token) =>\n publicClient.readContract({\n address: config.honey.pythOracle,\n abi: pythPriceOracleAbi,\n functionName: \"feeds\",\n args: [token],\n }),\n ),\n );\n\n return tokenList.reduce<PythPriceFeedMap>(\n (acc, token, index) => ({\n ...acc,\n [token]: priceFeedIds[index],\n }),\n {},\n );\n } catch (e) {\n console.error(\"getPythPriceFeedId\", e);\n throw e;\n }\n}\n","import type { TokenWithMetadata } from \"~/types/dex\";\nimport { beraFetchJson } from \"~/utils/beraFetch\";\nimport { parseBaseArgs } from \"~/utils/parseBaseArgs\";\n\nexport async function getTokens({\n url,\n ...args\n}: BeraJS.BaseFunctionArgs & { url?: string } = {}): Promise<\n TokenWithMetadata[]\n> {\n const { config } = parseBaseArgs(args);\n const tokenList = await beraFetchJson<{ tokens: TokenWithMetadata[] }>({\n url: url ?? config.lists.tokenList,\n type: \"rest\",\n name: \"GitHub\",\n });\n\n return tokenList.tokens ?? [];\n}\n","import type { PublicClient } from \"viem\";\n\nimport type { EdgeConfigSchema } from \"@berachain/config/internal/edge-config\";\n\nimport { bgtAbi } from \"@berachain/abis/pol/bgt\";\nimport { beraChefAbi } from \"@berachain/abis/pol/rewards/beraChef\";\n\nimport { parseBaseArgs } from \"~/utils/parseBaseArgs\";\n\nexport interface ActiveBoostAndCommissionChangeDelay {\n boostDelay: number;\n unboostDelay: number;\n commissionChangeDelay: number;\n rewardAllocationBlockDelay: number;\n maxWeightPerVault: number;\n maxNumWeightsPerRewardAllocation: number;\n /**\n * Percentage of the validator's commission rate that can be changed at once.\n *\n * @example 1 => 100%\n */\n maxCommissionRate: number;\n /**\n * The number of blocks after which a reward allocation is considered stale and will fallback\n * to baseline reward allocation.\n *\n */\n rewardAllocationInactivityBlockSpan: number;\n /**\n * The number of hours in advance to warn the operator that the reward allocation is expiring.\n */\n ui: EdgeConfigSchema[\"pol\"][\"automatedRewardAllocation\"];\n}\n\nexport async function getActiveBoostAndCommissionChangeDelay({\n publicClient,\n ui,\n ...args\n}: BeraJS.BaseFunctionArgs &\n Pick<ActiveBoostAndCommissionChangeDelay, \"ui\"> & {\n publicClient: PublicClient;\n }): Promise<ActiveBoostAndCommissionChangeDelay> {\n const { config } = parseBaseArgs(args);\n\n const [\n maxCommissionRate,\n commissionChangeDelay,\n rewardAllocationBlockDelay,\n maxWeightPerVault,\n maxNumWeightsPerRewardAllocation,\n dropBoostDelay,\n activateBoostDelay,\n rewardAllocationInactivityBlockSpan,\n ] = await Promise.all([\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"MAX_COMMISSION_RATE\",\n }),\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"commissionChangeDelay\",\n }),\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"rewardAllocationBlockDelay\",\n }),\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"maxWeightPerVault\",\n }),\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"maxNumWeightsPerRewardAllocation\",\n }),\n publicClient.readContract({\n address: config.tokens.bgt,\n abi: bgtAbi,\n functionName: \"dropBoostDelay\",\n }),\n publicClient.readContract({\n address: config.tokens.bgt,\n abi: bgtAbi,\n functionName: \"activateBoostDelay\",\n }),\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"rewardAllocationInactivityBlockSpan\",\n }),\n ]);\n\n return {\n maxCommissionRate: Number(maxCommissionRate) / 1e4,\n boostDelay: Number(activateBoostDelay),\n unboostDelay: Number(dropBoostDelay),\n commissionChangeDelay: Number(commissionChangeDelay),\n rewardAllocationBlockDelay: Number(rewardAllocationBlockDelay),\n maxWeightPerVault: Number(maxWeightPerVault) / 1e4,\n maxNumWeightsPerRewardAllocation: Number(maxNumWeightsPerRewardAllocation),\n rewardAllocationInactivityBlockSpan: Number(\n rewardAllocationInactivityBlockSpan,\n ),\n ui,\n };\n}\n","import type { ApiValidatorFragment } from \"@berachain/graphql/pol/api\";\n\nexport function getValidatorReturnPerBgt(\n validator: Pick<\n ApiValidatorFragment,\n \"dynamicData\" | \"rewardAllocationWeights\"\n >,\n): number {\n return validator?.rewardAllocationWeights?.reduce((acc, ab) => {\n if (!ab) return acc;\n\n const totalIncentiveValue =\n ab.receivingVault?.activeIncentives\n .filter((inc) => Number(inc.remainingAmount) > 0)\n .reduce((totalIncentiveValue, currIncentive) => {\n const tokenPrice =\n Number(currIncentive.remainingAmountUsd) /\n Number(currIncentive.remainingAmount);\n\n return (\n totalIncentiveValue +\n Number(currIncentive.incentiveRate) * tokenPrice\n );\n }, 0) ?? 0;\n\n return acc + totalIncentiveValue * ab.percentage;\n }, 0);\n}\n\nexport function getValidatorBoostApy({\n validator,\n bgtPrice,\n}: {\n validator: Pick<\n ApiValidatorFragment,\n \"dynamicData\" | \"rewardAllocationWeights\"\n >;\n bgtPrice: number;\n}): number {\n const validatorActiveBoostAmount = Number(\n validator.dynamicData?.activeBoostAmount ?? 0,\n );\n\n const returnPerBgt = getValidatorReturnPerBgt(validator);\n\n if (!returnPerBgt || !validatorActiveBoostAmount) {\n // As of now, a validator cannot send rewards to the vaults if it has no active boost amount\n // If baseRate changes on chain, we should update this function\n return 0;\n }\n\n const boostApy =\n (returnPerBgt *\n Number(validator.dynamicData?.lastDayDistributedBGTAmount ?? 0) *\n 365) /\n (validatorActiveBoostAmount * bgtPrice);\n\n return boostApy;\n}\n"],"mappings":"6nCAAA,OAAuB,eAAAA,MAAsC,OAE7D,OAAS,oBAAoBC,MAAqB,gDAOlD,eAAsBC,GAAc,CAClC,aAAAC,EACA,aAAAC,CACF,EAAwC,CACtC,IAAMC,EAAa,MAAMD,EAAa,aAAa,CACjD,QAASD,EACT,IAAKF,EACL,aAAc,aACd,KAAM,CAACE,CAAY,CACrB,CAAC,EACD,OAAOH,EAAYK,CAAU,CAC/B,CCpBA,OAEE,eAAAC,MAEK,qCAKA,IAAMC,GAAgBC,IACpB,CACL,KAAMF,EAAYE,EAAQ,IAAI,EAC9B,gBAAiBA,EAAQ,gBACzB,OAAQA,EAAQ,OAAO,IACpBC,IACE,CACC,GAAGA,EACH,QAASA,EAAG,OACd,EACJ,EACA,GAAID,EAAQ,G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","metaMorphoAbi","getMaxDeposit","vaultAddress","publicClient","maxDeposit","mapPoolType","getPoolState","apiPool","pt","balancerVaultAbi","getVaultPausedState","publicClient","args","config","parseBaseArgs","balancerVaultAbi","decodeFunctionData","erc20Abi","pad","toFunctionSignature","trim","appConfig","defaultChainId","beraChefAbi","rewardVaultAbi","isProxyABI","abi","item","_getAbi","contractAddress","chainId","publicClient","url","response","data","implementationResult","implementationAddress","_getAbiForCallData","address","callData","knownAbi","_decodeCallData","_findAbiItem","functionName","a","_getFunctionSignature","abiItem","error","getDecodedFunctionData","decodedData","functionSignature","formatUnits","honeyFactoryAbi","getHoneyFees","client","collateralList","args","config","parseBaseArgs","promiseList","coll","honeyFactoryAbi","mintRates","redeemRates","collateralWeights","acc","collIdx","formatUnits","e","honeyAbi","getHoneyPausedState","client","args","config","parseBaseArgs","honeyAddress","honeyAbi","honeyRootOracleAbi","getHoneyPythOracle","pythOracle","publicClient","honeyFactoryAbi","getHoneyRootPriceOracle","publicClient","factory","args","config","parseBaseArgs","honeyFactoryAbi","GetBlocksTimeStamp","getBlockTime","defaultBlockTime","blocksSpan","args","config","parseBaseArgs","blocksClient","getApolloClient","blockTime","span","hoursInSeconds","data","GetBlocksTimeStamp","msToSeconds","lstStakerVaultAbi","getLSTStakeConfig","tokenList","publicClient","lstStakingVaults","args","assertPublicClient","config","parseBaseArgs","lstStakingTokens","token","stakingToken","lstStakerVaultAbi","acc","assetTokenAddress","assetToken","isToken","rewardVaultAbi","rewardVaultFactoryAbi","upgradableBeaconAbi","getRewardVaultBeaconImplementation","publicClient","args","config","parseBaseArgs","factoryAddress","assertDefined","assertAddress","beacon","rewardVaultFactoryAbi","upgradableBeaconAbi","getRewardVaultDurationConstants","publicClient","baseArgs","assertPublicClient","beaconImplementation","getRewardVaultBeaconImplementation","minRewardDuration","maxRewardDuration","rewardVaultAbi","zeroAddress","rewardVaultFactoryAbi","getRewardVaultFromToken","tokenAddress","publicClient","factoryAddress","args","config","parseBaseArgs","vaultAddress","rewardVaultFactoryAbi","zeroAddress","pythPriceOracleAbi","getHoneyPythFeeds","tokenList","publicClient","args","config","parseBaseArgs","priceFeedIds","token","pythPriceOracleAbi","acc","index","e","getTokens","url","args","config","parseBaseArgs","beraFetchJson","bgtAbi","beraChefAbi","getActiveBoostAndCommissionChangeDelay","publicClient","ui","args","config","parseBaseArgs","maxCommissionRate","commissionChangeDelay","rewardAllocationBlockDelay","maxWeightPerVault","maxNumWeightsPerRewardAllocation","dropBoostDelay","activateBoostDelay","rewardAllocationInactivityBlockSpan","beraChefAbi","bgtAbi","getValidatorReturnPerBgt","validator","acc","ab","totalIncentiveValue","inc","currIncentive","tokenPrice","getValidatorBoostApy","bgtPrice","validatorActiveBoostAmount","returnPerBgt"]}
|
|
1
|
+
{"version":3,"sources":["../../src/actions/bend/getMaxDeposit.ts","../../src/actions/dex/getPoolWithState.ts","../../src/actions/dex/getVaultPausedState.ts","../../src/actions/governance/getDecodedFunctionData.ts","../../src/actions/honey/getHoneyFees.ts","../../src/actions/honey/getHoneyPausedState.ts","../../src/actions/honey/getHoneyPythPriceOracle.ts","../../src/actions/honey/getHoneyRootPriceOracle.ts","../../src/actions/pol/getBlockTime.ts","../../src/actions/pol/getLSTStakeConfig.ts","../../src/actions/pol/getRewardVaultDurationConstants.ts","../../src/actions/pol/getRewardVaultBeaconImplementation.ts","../../src/abi/utils/upgradableBeacon.ts","../../src/actions/pol/getRewardVaultFromToken.ts","../../src/actions/pyth/getHoneyPythFeeds.ts","../../src/actions/tokens/getTokens.ts","../../src/actions/validators/getActiveBoostAndCommissionChangeDelay.ts","../../src/actions/validators/utils/getValidatorBoostApy.ts"],"sourcesContent":["import { type Address, formatEther, type PublicClient } from \"viem\";\n\nimport { metaMorphoV11Abi as metaMorphoAbi } from \"@berachain/abis/bend-metamorpho/metaMorphoV11\";\n\ninterface GetMaxDepositProps {\n vaultAddress: Address;\n publicClient: PublicClient;\n}\n\nexport async function getMaxDeposit({\n vaultAddress,\n publicClient,\n}: GetMaxDepositProps): Promise<string> {\n const maxDeposit = await publicClient.readContract({\n address: vaultAddress,\n abi: metaMorphoAbi,\n functionName: \"maxDeposit\",\n args: [vaultAddress],\n });\n return formatEther(maxDeposit);\n}\n","import {\n type MinimalToken,\n mapPoolType,\n type PoolState,\n} from \"@berachain-foundation/berancer-sdk\";\nimport type { Address } from \"viem\";\n\nimport type { MinimalPoolFragment } from \"@berachain/graphql/dex/api\";\n\nexport const getPoolState = (apiPool: MinimalPoolFragment): PoolState => {\n return {\n type: mapPoolType(apiPool.type),\n protocolVersion: apiPool.protocolVersion as 1 | 2 | 3,\n tokens: apiPool.tokens.map<MinimalToken>(\n (pt) =>\n ({\n ...pt,\n address: pt.address as Address,\n }) satisfies MinimalToken,\n ),\n id: apiPool.id as Address,\n address: apiPool.address as Address,\n } satisfies PoolState;\n};\n","import type { PublicClient } from \"viem\";\n\nimport { vaultAbi as balancerVaultAbi } from \"@berachain/abis/bex/vault\";\n\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\nexport async function getVaultPausedState({\n publicClient,\n ...args\n}: BeraJS.BaseFunctionArgs & {\n publicClient: PublicClient;\n}) {\n const { config } = parseBaseArgs(args);\n\n const vaultPausedState = await publicClient.readContract({\n address: config.bex.vault,\n abi: balancerVaultAbi,\n functionName: \"getPausedState\",\n });\n\n return vaultPausedState[0];\n}\n","import {\n type Abi,\n type AbiFunction,\n type AbiItem,\n type Address,\n decodeFunctionData,\n erc20Abi,\n type PublicClient,\n pad,\n toFunctionSignature,\n trim,\n} from \"viem\";\n\nimport { appConfig, defaultChainId } from \"@berachain/config/internal\";\n\nimport { beraChefAbi } from \"@berachain/abis/pol/rewards/beraChef\";\nimport { rewardVaultAbi } from \"@berachain/abis/pol/rewards/rewardVault\";\n\n// Function to check if ABI contains proxy-related functions\nfunction isProxyABI(abi: Abi[]): boolean {\n return abi.some(\n (item: any) =>\n item.name === \"implementation\" ||\n item.name === \"proxyType\" ||\n (item.type === \"constructor\" &&\n item.inputs?.[0]?.name === \"implementation\"),\n );\n}\n\n/**\n * {@link https://docs.berascan.com/api-endpoints/contracts}\n */\nasync function _getAbi({\n contractAddress,\n chainId,\n publicClient,\n}: {\n contractAddress: Address;\n chainId: number;\n publicClient: PublicClient;\n}) {\n const url = `https://api.etherscan.io/v2/api?module=contract&action=getabi&address=${contractAddress}&apikey=${appConfig.apiKeys.private.etherscan}&chainId=${chainId}`;\n\n const response = await fetch(url);\n\n if (!response.ok) {\n throw new Error(`Failed to fetch ABI: ${response.statusText}`);\n }\n\n const data = await response.json();\n if (data.status === \"0\") throw new Error(data.result);\n\n const abi = JSON.parse(data.result);\n if (!isProxyABI(abi)) return abi;\n\n const implementationResult = await publicClient.getStorageAt({\n address: contractAddress,\n // bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)).\n slot: \"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc\",\n });\n\n // if implementation is not set, it might be a beacon proxy\n if (!implementationResult || trim(implementationResult) === \"0x00\")\n return abi;\n // storage slot has 32 byes (64 characters) but an address only has 20 bytes (40 characters)\n const implementationAddress = pad(trim(implementationResult), { size: 20 });\n return _getAbi({\n contractAddress: implementationAddress as `0x${string}`,\n chainId,\n publicClient,\n });\n}\n\nasync function _getAbiForCallData({\n address,\n callData,\n knownAbi,\n chainId,\n publicClient,\n}: {\n address: Address;\n callData: `0x${string}`;\n knownAbi: AbiItem[];\n chainId: number;\n publicClient: PublicClient;\n}) {\n try {\n if (decodeFunctionData({ data: callData, abi: knownAbi })) {\n return knownAbi;\n }\n } catch {}\n try {\n return await _getAbi({ contractAddress: address, chainId, publicClient });\n } catch {}\n}\n\nfunction _decodeCallData(callData: `0x${string}`, abi: AbiItem[]) {\n try {\n return decodeFunctionData({ data: callData, abi });\n } catch {\n return undefined;\n }\n}\n\nfunction _findAbiItem(abi: AbiItem[], functionName: string) {\n return abi.find(\n (a: AbiItem) => a.type === \"function\" && a.name === functionName,\n ) as AbiFunction | undefined;\n}\n\nfunction _getFunctionSignature(abiItem: AbiFunction | undefined) {\n if (!abiItem) return;\n try {\n return toFunctionSignature(abiItem);\n } catch (error) {\n console.error(error);\n }\n}\n\n/**\n * Decodes the function data from a given contract address and calldata.\n *\n * This function attempts to decode the provided calldata using a known set of ABIs.\n * If the call data cannot be decoded with the known ABIs, it fetches the ABI from the blockexplorer API.\n *\n * @param address - The contract address.\n * @param callData - The calldata to decode, in hexadecimal format.\n * @returns An object containing the decoded ABI item, function signature, function name, and arguments.\n */\nexport async function getDecodedFunctionData({\n address,\n callData,\n chainId = defaultChainId,\n publicClient,\n}: {\n address: Address;\n callData: `0x${string}`;\n chainId?: number;\n publicClient: PublicClient;\n}) {\n const knownAbi = [...beraChefAbi, ...rewardVaultAbi, ...erc20Abi];\n\n const abi = await _getAbiForCallData({\n address,\n callData,\n knownAbi,\n chainId,\n publicClient,\n });\n\n const decodedData = _decodeCallData(callData, abi);\n\n if (!abi || !decodedData) {\n return { args: [] };\n }\n\n const abiItem = _findAbiItem(abi, decodedData.functionName);\n\n const functionSignature = _getFunctionSignature(abiItem);\n\n return {\n abiItem,\n functionSignature,\n functionName: decodedData.functionName,\n args: decodedData.args as unknown[],\n };\n}\n","import { type Address, formatUnits, type PublicClient } from \"viem\";\n\nimport { honeyFactoryAbi } from \"@berachain/abis/honey/honeyFactory\";\n\nimport type { Token } from \"@berachain/graphql/pol/api\";\n\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\nexport interface CollateralRates {\n mintFee: number;\n redeemFee: number;\n}\n\nexport interface HoneyFeeMap {\n single: Record<Address, CollateralRates>;\n basket: CollateralRates;\n}\n\nexport interface CollateralRatesArgs extends BeraJS.BaseFunctionArgs {\n client: PublicClient;\n collateralList: Token[];\n}\n\n/**\n * Fetches the mint and redeem rates for all collateral tokens and calculates the weighted basket rates\n * @param {Object} params - The parameters object\n * @param {PublicClient} params.client - The Viem public client instance\n * @param {Address[]} params.collateralList - Array of collateral token addresses\n * @returns {Promise<HoneyFeeMap | undefined>} Object containing individual collateral rates and weighted basket rates,\n * or undefined if the operation fails\n */\nexport async function getHoneyFees({\n client,\n collateralList,\n ...args\n}: CollateralRatesArgs): Promise<HoneyFeeMap> {\n const { config } = parseBaseArgs(args);\n\n try {\n // create a list for all the promises needed, fetch the mint and redeem rates for each collateral token\n const promiseList: Record<\"mint\" | \"redeem\", Promise<bigint>[]> = {\n mint: [],\n redeem: [],\n };\n for (const coll of collateralList) {\n promiseList.mint.push(\n client.readContract({\n address: config.honey.factory,\n abi: honeyFactoryAbi,\n functionName: \"mintRates\",\n args: [coll.address as Address],\n }),\n );\n promiseList.redeem.push(\n client.readContract({\n address: config.honey.factory,\n abi: honeyFactoryAbi,\n functionName: \"redeemRates\",\n args: [coll.address as Address],\n }),\n );\n }\n const [mintRates, redeemRates, collateralWeights] = await Promise.all([\n Promise.all(promiseList.mint),\n Promise.all(promiseList.redeem),\n // fetch the collateral weights, needed to calculate the weighted basket rates\n client.readContract({\n address: config.honey.factory,\n abi: honeyFactoryAbi,\n functionName: \"getWeights\",\n }),\n ]);\n\n // calculate the weighted basket rates and the single collateral rates\n\n return collateralList.reduce<HoneyFeeMap>(\n (acc, coll) => {\n const collIdx = collateralList.indexOf(coll);\n acc.single[coll.address as Address] = {\n mintFee: 1 - +formatUnits(mintRates[collIdx], 18),\n redeemFee: 1 - +formatUnits(redeemRates[collIdx], 18),\n };\n acc.basket.mintFee +=\n acc.single[coll.address as Address].mintFee *\n +formatUnits(collateralWeights[collIdx], 18);\n\n acc.basket.redeemFee +=\n acc.single[coll.address as Address].redeemFee *\n +formatUnits(collateralWeights[collIdx], 18);\n return acc;\n },\n {\n single: {},\n basket: { mintFee: 0, redeemFee: 0 },\n },\n );\n } catch (e) {\n console.log(e);\n throw e;\n }\n}\n","import type { PublicClient } from \"viem\";\n\nimport { honeyAbi } from \"@berachain/abis/honey/honey\";\n\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\n/**\n * Gets the pause state of the Honey protocol\n * @returns boolean\n */\nexport async function getHoneyPausedState({\n client,\n ...args\n}: BeraJS.BaseFunctionArgs & {\n client: PublicClient;\n}) {\n const { config } = parseBaseArgs(args);\n const honeyAddress = config.honey.token;\n const honeyPausedState = await client.readContract({\n address: honeyAddress,\n abi: honeyAbi,\n functionName: \"paused\",\n });\n\n return honeyPausedState;\n}\n","import type { Address, PublicClient } from \"viem\";\n\nimport { rootPriceOracleAbi as honeyRootOracleAbi } from \"@berachain/abis/extras/rootPriceOracle\";\n\n/**\n * Gets the address of the Honey Pyth Oracle, which is called by the Honey Root Price Oracle to get the price of the collaterals\n * @returns\n */\nexport async function getHoneyPythOracle({\n pythOracle,\n publicClient,\n}: {\n publicClient: PublicClient;\n pythOracle: Address;\n}) {\n return await publicClient.readContract({\n address: pythOracle,\n abi: honeyRootOracleAbi,\n functionName: \"pythOracle\",\n });\n}\n","import type { Address, PublicClient } from \"viem\";\n\nimport { honeyFactoryAbi } from \"@berachain/abis/honey/honeyFactory\";\n\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\n/**\n * Gets the address of the Honey Root Price Oracle, which keeps the logic to price the collaterals\n */\nexport async function getHoneyRootPriceOracle({\n publicClient,\n factory,\n ...args\n}: BeraJS.BaseFunctionArgs & {\n publicClient: PublicClient;\n factory?: Address;\n}): Promise<Address> {\n const { config } = parseBaseArgs(args);\n return await publicClient.readContract({\n address: factory ?? config.honey.factory,\n abi: honeyFactoryAbi,\n functionName: \"priceOracle\",\n });\n}\n","import type { PublicClient } from \"viem\";\n\nimport { assertPublicClient } from \"../../errors/assert\";\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\nimport { hoursInSeconds, msToSeconds } from \"../../utils/time\";\n\nexport async function getBlockTime({\n defaultBlockTime,\n publicClient,\n blocksSpan,\n ...args\n}: {\n defaultBlockTime?: number;\n blocksSpan?: number;\n publicClient: PublicClient | undefined;\n} & BeraJS.BaseFunctionArgs): Promise<number> {\n assertPublicClient(publicClient);\n\n const { config } = parseBaseArgs(args);\n\n const blockTime = defaultBlockTime ?? config.averageBlockTime;\n const span = blocksSpan ?? Math.floor(hoursInSeconds(1) / blockTime);\n\n const currentBlock = await publicClient?.getBlock({ blockTag: \"latest\" });\n const oldestBlock = await publicClient?.getBlock({\n blockNumber: currentBlock.number - BigInt(span),\n });\n\n return (\n // we need to use current timestamp as the latest block might not have been minted (chain halted)\n (msToSeconds(Date.now()) - Number(oldestBlock?.timestamp)) /\n (Number(currentBlock?.number) - Number(oldestBlock?.number))\n );\n}\n","import type { Address, PublicClient } from \"viem\";\n\nimport { lstStakerVaultAbi } from \"@berachain/abis/pol/lst/lstStakerVault\";\n\nimport { assertPublicClient } from \"../../errors/assert\";\nimport type { TokenWithMetadata } from \"../../types/dex\";\nimport type { StakingConfig } from \"../../types/staking\";\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\nimport { isToken } from \"../../utils/tokens\";\n\nexport type GetLSTStakeConfigArgs = {\n tokenList: TokenWithMetadata[];\n publicClient?: PublicClient;\n lstStakingVaults: Address[];\n} & BeraJS.BaseFunctionArgs;\n\n/**\n * Builds staking configs from on-chain LST vaults and optional native configs.\n */\nexport async function getLSTStakeConfig({\n tokenList,\n publicClient,\n lstStakingVaults,\n ...args\n}: GetLSTStakeConfigArgs): Promise<StakingConfig[]> {\n assertPublicClient(publicClient);\n\n const { config } = parseBaseArgs({\n ...args,\n chainId: publicClient.chain?.id ?? args.chainId,\n });\n\n const lstStakingTokens = tokenList.filter((token) =>\n lstStakingVaults.includes(token.address),\n );\n\n if (lstStakingTokens.length === 0) {\n return [];\n }\n\n const assets = await Promise.all(\n lstStakingTokens.map(async (stakingToken) => {\n // read the asset token address from the lst staking vault\n const assetTokenAddress = await publicClient.readContract({\n address: stakingToken.address,\n abi: lstStakerVaultAbi,\n functionName: \"asset\",\n });\n return { assetTokenAddress, stakingToken };\n }),\n );\n\n return assets.reduce<StakingConfig[]>(\n (acc, { assetTokenAddress, stakingToken }) => {\n const assetToken = tokenList.find((token) =>\n isToken(token, assetTokenAddress),\n );\n if (!assetToken) return acc;\n acc.push({\n id: stakingToken.address,\n receiptToken: stakingToken,\n inputTokens: [assetToken],\n });\n return acc;\n },\n [],\n );\n}\n","import type { PublicClient } from \"viem\";\n\nimport { rewardVaultAbi } from \"@berachain/abis/pol/rewards/rewardVault\";\n\nimport { assertPublicClient } from \"../../errors/assert\";\nimport { getRewardVaultBeaconImplementation } from \"./getRewardVaultBeaconImplementation\";\n\nexport interface RewardVaultDurationConstants {\n minRewardDuration: number;\n maxRewardDuration: number;\n}\n\n/**\n * Returns the minimum and maximum reward duration constants for all reward vaults.\n */\nexport async function getRewardVaultDurationConstants({\n publicClient,\n ...baseArgs\n}: BeraJS.BaseFunctionArgs & {\n publicClient: PublicClient;\n}): Promise<RewardVaultDurationConstants> {\n assertPublicClient(publicClient);\n\n const beaconImplementation = await getRewardVaultBeaconImplementation({\n publicClient,\n ...baseArgs,\n });\n\n const [minRewardDuration, maxRewardDuration] = await Promise.all([\n publicClient.readContract({\n address: beaconImplementation,\n abi: rewardVaultAbi,\n functionName: \"MIN_REWARD_DURATION\",\n }),\n publicClient.readContract({\n address: beaconImplementation,\n abi: rewardVaultAbi,\n functionName: \"MAX_REWARD_DURATION\",\n }),\n ]);\n\n return {\n minRewardDuration: Number(minRewardDuration),\n maxRewardDuration: Number(maxRewardDuration),\n };\n}\n","import type { Address, PublicClient } from \"viem\";\n\nimport { rewardVaultFactoryAbi } from \"@berachain/abis/pol/rewards/rewardVaultFactory\";\n\nimport { upgradableBeaconAbi } from \"../../abi/utils/upgradableBeacon\";\nimport { assertAddress, assertDefined } from \"../../errors/assert\";\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\n/**\n * Returns the beacon implementation address for all reward vaults.\n */\nexport async function getRewardVaultBeaconImplementation({\n publicClient,\n ...args\n}: BeraJS.BaseFunctionArgs & {\n publicClient: PublicClient;\n}): Promise<Address> {\n const { config } = parseBaseArgs(args);\n const factoryAddress = config.pol.factory;\n assertDefined(publicClient, \"publicClient\");\n assertAddress(config.pol.factory, \"factoryAddress\");\n\n // from the factory contract, we get the beacon address\n const beacon = await publicClient.readContract({\n address: factoryAddress,\n abi: rewardVaultFactoryAbi,\n functionName: \"beacon\",\n });\n\n // from the beacon contract, we get the current implementation address\n return await publicClient.readContract({\n address: beacon,\n abi: upgradableBeaconAbi,\n functionName: \"implementation\",\n });\n}\n","export const upgradableBeaconAbi = [\n {\n inputs: [\n { internalType: \"address\", name: \"initialOwner\", type: \"address\" },\n {\n internalType: \"address\",\n name: \"initialImplementation\",\n type: \"address\",\n },\n ],\n stateMutability: \"payable\",\n type: \"constructor\",\n },\n { inputs: [], name: \"NewImplementationHasNoCode\", type: \"error\" },\n { inputs: [], name: \"NewOwnerIsZeroAddress\", type: \"error\" },\n { inputs: [], name: \"Unauthorized\", type: \"error\" },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"address\",\n name: \"oldOwner\",\n type: \"address\",\n },\n {\n indexed: true,\n internalType: \"address\",\n name: \"newOwner\",\n type: \"address\",\n },\n ],\n name: \"OwnershipTransferred\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"address\",\n name: \"implementation\",\n type: \"address\",\n },\n ],\n name: \"Upgraded\",\n type: \"event\",\n },\n {\n inputs: [],\n name: \"implementation\",\n outputs: [{ internalType: \"address\", name: \"result\", type: \"address\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"owner\",\n outputs: [{ internalType: \"address\", name: \"result\", type: \"address\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"renounceOwnership\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"newOwner\", type: \"address\" }],\n name: \"transferOwnership\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"newImplementation\", type: \"address\" },\n ],\n name: \"upgradeTo\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n] as const;\n","import { type Address, type PublicClient, zeroAddress } from \"viem\";\n\nimport { rewardVaultFactoryAbi } from \"@berachain/abis/pol/rewards/rewardVaultFactory\";\n\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\nexport async function getRewardVaultFromToken({\n tokenAddress,\n publicClient,\n factoryAddress,\n ...args\n}: {\n tokenAddress: Address;\n publicClient: PublicClient;\n factoryAddress?: Address;\n} & BeraJS.BaseFunctionArgs) {\n const { config } = parseBaseArgs(args);\n\n const vaultAddress = await publicClient.readContract({\n address: factoryAddress ?? config.pol.factory,\n abi: rewardVaultFactoryAbi,\n functionName: \"getVault\",\n args: [tokenAddress],\n });\n\n if (vaultAddress === zeroAddress) {\n return null;\n }\n\n return vaultAddress;\n}\n","import type { PublicClient } from \"viem\";\n\nimport type { Address } from \"@berachain/config\";\n\nimport { pythPriceOracleAbi } from \"@berachain/abis/extras/pythPriceOracle\";\n\nimport type { PythPriceFeedMap } from \"../../types/honeySwap\";\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\n/**\n * Given a list of tokens, it will return the price feed ids for each token according to honey priceOracle\n * @returns\n */\nexport async function getHoneyPythFeeds({\n tokenList,\n publicClient,\n ...args\n}: {\n tokenList: readonly Address[];\n publicClient: PublicClient;\n} & BeraJS.BaseFunctionArgs): Promise<PythPriceFeedMap> {\n const { config } = parseBaseArgs(args);\n\n try {\n const priceFeedIds = await Promise.all(\n tokenList.map((token) =>\n publicClient.readContract({\n address: config.honey.pythOracle,\n abi: pythPriceOracleAbi,\n functionName: \"feeds\",\n args: [token],\n }),\n ),\n );\n\n return tokenList.reduce<PythPriceFeedMap>(\n (acc, token, index) => ({\n ...acc,\n [token]: priceFeedIds[index],\n }),\n {},\n );\n } catch (e) {\n console.error(\"getPythPriceFeedId\", e);\n throw e;\n }\n}\n","import type { TokenWithMetadata } from \"../../types/dex\";\nimport { beraFetchJson } from \"../../utils/beraFetch\";\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\nexport async function getTokens({\n url,\n ...args\n}: BeraJS.BaseFunctionArgs & { url?: string } = {}): Promise<\n TokenWithMetadata[]\n> {\n const { config } = parseBaseArgs(args);\n const tokenList = await beraFetchJson<{ tokens: TokenWithMetadata[] }>({\n url: url ?? config.lists.tokenList,\n type: \"rest\",\n name: \"GitHub\",\n });\n\n return tokenList.tokens ?? [];\n}\n","import type { PublicClient } from \"viem\";\n\nimport type { EdgeConfigSchema } from \"@berachain/config/internal/edge-config\";\n\nimport { bgtAbi } from \"@berachain/abis/pol/bgt\";\nimport { beraChefAbi } from \"@berachain/abis/pol/rewards/beraChef\";\n\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\nexport interface ActiveBoostAndCommissionChangeDelay {\n boostDelay: number;\n unboostDelay: number;\n commissionChangeDelay: number;\n rewardAllocationBlockDelay: number;\n maxWeightPerVault: number;\n maxNumWeightsPerRewardAllocation: number;\n /**\n * Percentage of the validator's commission rate that can be changed at once.\n *\n * @example 1 => 100%\n */\n maxCommissionRate: number;\n /**\n * The number of blocks after which a reward allocation is considered stale and will fallback\n * to baseline reward allocation.\n *\n */\n rewardAllocationInactivityBlockSpan: number;\n /**\n * The number of hours in advance to warn the operator that the reward allocation is expiring.\n */\n ui: EdgeConfigSchema[\"pol\"][\"automatedRewardAllocation\"];\n}\n\nexport async function getActiveBoostAndCommissionChangeDelay({\n publicClient,\n ui,\n ...args\n}: BeraJS.BaseFunctionArgs &\n Pick<ActiveBoostAndCommissionChangeDelay, \"ui\"> & {\n publicClient: PublicClient;\n }): Promise<ActiveBoostAndCommissionChangeDelay> {\n const { config } = parseBaseArgs(args);\n\n const [\n maxCommissionRate,\n commissionChangeDelay,\n rewardAllocationBlockDelay,\n maxWeightPerVault,\n maxNumWeightsPerRewardAllocation,\n dropBoostDelay,\n activateBoostDelay,\n rewardAllocationInactivityBlockSpan,\n ] = await Promise.all([\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"MAX_COMMISSION_RATE\",\n }),\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"commissionChangeDelay\",\n }),\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"rewardAllocationBlockDelay\",\n }),\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"maxWeightPerVault\",\n }),\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"maxNumWeightsPerRewardAllocation\",\n }),\n publicClient.readContract({\n address: config.tokens.bgt,\n abi: bgtAbi,\n functionName: \"dropBoostDelay\",\n }),\n publicClient.readContract({\n address: config.tokens.bgt,\n abi: bgtAbi,\n functionName: \"activateBoostDelay\",\n }),\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"rewardAllocationInactivityBlockSpan\",\n }),\n ]);\n\n return {\n maxCommissionRate: Number(maxCommissionRate) / 1e4,\n boostDelay: Number(activateBoostDelay),\n unboostDelay: Number(dropBoostDelay),\n commissionChangeDelay: Number(commissionChangeDelay),\n rewardAllocationBlockDelay: Number(rewardAllocationBlockDelay),\n maxWeightPerVault: Number(maxWeightPerVault) / 1e4,\n maxNumWeightsPerRewardAllocation: Number(maxNumWeightsPerRewardAllocation),\n rewardAllocationInactivityBlockSpan: Number(\n rewardAllocationInactivityBlockSpan,\n ),\n ui,\n };\n}\n","import type { ApiValidatorFragment } from \"@berachain/graphql/pol/api\";\n\nexport function getValidatorReturnPerBgt(\n validator: Pick<\n ApiValidatorFragment,\n \"dynamicData\" | \"rewardAllocationWeights\"\n >,\n): number {\n return validator?.rewardAllocationWeights?.reduce((acc, ab) => {\n if (!ab) return acc;\n\n const totalIncentiveValue =\n ab.receivingVault?.activeIncentives\n .filter((inc) => Number(inc.remainingAmount) > 0)\n .reduce((totalIncentiveValue, currIncentive) => {\n const tokenPrice =\n Number(currIncentive.remainingAmountUsd) /\n Number(currIncentive.remainingAmount);\n\n return (\n totalIncentiveValue +\n Number(currIncentive.incentiveRate) * tokenPrice\n );\n }, 0) ?? 0;\n\n return acc + totalIncentiveValue * ab.percentage;\n }, 0);\n}\n\nexport function getValidatorBoostApy({\n validator,\n bgtPrice,\n}: {\n validator: Pick<\n ApiValidatorFragment,\n \"dynamicData\" | \"rewardAllocationWeights\"\n >;\n bgtPrice: number;\n}): number {\n const validatorActiveBoostAmount = Number(\n validator.dynamicData?.activeBoostAmount ?? 0,\n );\n\n const returnPerBgt = getValidatorReturnPerBgt(validator);\n\n if (!returnPerBgt || !validatorActiveBoostAmount) {\n // As of now, a validator cannot send rewards to the vaults if it has no active boost amount\n // If baseRate changes on chain, we should update this function\n return 0;\n }\n\n const boostApy =\n (returnPerBgt *\n Number(validator.dynamicData?.lastDayDistributedBGTAmount ?? 0) *\n 365) /\n (validatorActiveBoostAmount * bgtPrice);\n\n return boostApy;\n}\n"],"mappings":"2mCAAA,OAAuB,eAAAA,MAAsC,OAE7D,OAAS,oBAAoBC,MAAqB,gDAOlD,eAAsBC,GAAc,CAClC,aAAAC,EACA,aAAAC,CACF,EAAwC,CACtC,IAAMC,EAAa,MAAMD,EAAa,aAAa,CACjD,QAASD,EACT,IAAKF,EACL,aAAc,aACd,KAAM,CAACE,CAAY,CACrB,CAAC,EACD,OAAOH,EAAYK,CAAU,CAC/B,CCpBA,OAEE,eAAAC,MAEK,qCAKA,IAAMC,GAAgBC,IACpB,CACL,KAAMF,EAAYE,EAAQ,IAAI,EAC9B,gBAAiBA,EAAQ,gBACzB,OAAQA,EAAQ,OAAO,IACpBC,IACE,CACC,GAAGA,EACH,QAASA,EAAG,OACd,EACJ,EACA,GAAID,EAAQ,GACZ,QAASA,EAAQ,OACnB,GCpBF,OAAS,YAAYE,MAAwB,4BAI7C,eAAsBC,GAAoB,CACxC,aAAAC,EACA,GAAGC,CACL,EAEG,CACD,GAAM,CAAE,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AAC,EACDd,EAAa,aAAa,CACxB,QAASG,EAAO,IAAI,SACpB,IAAKU,EACL,aAAc,qCAChB,CAAC,CACH,CAAC,EAED,MAAO,CACL,kBAAmB,OAAOR,CAAiB,EAAI,IAC/C,WAAY,OAAOM,CAAkB,EACrC,aAAc,OAAOD,CAAc,EACnC,sBAAuB,OAAOJ,CAAqB,EACnD,2BAA4B,OAAOC,CAA0B,EAC7D,kBAAmB,OAAOC,CAAiB,EAAI,IAC/C,iCAAkC,OAAOC,CAAgC,EACzE,oCAAqC,OACnCG,CACF,EACA,GAAAX,CACF,CACF,CC3GO,SAASc,GACdC,EAIQ,CACR,OAAOA,GAAW,yBAAyB,OAAO,CAACC,EAAKC,IAAO,CAC7D,GAAI,CAACA,EAAI,OAAOD,EAEhB,IAAME,EACJD,EAAG,gBAAgB,iBAChB,OAAQE,GAAQ,OAAOA,EAAI,eAAe,EAAI,CAAC,EAC/C,OAAO,CAACD,EAAqBE,IAAkB,CAC9C,IAAMC,EACJ,OAAOD,EAAc,kBAAkB,EACvC,OAAOA,EAAc,eAAe,EAEtC,OACEF,EACA,OAAOE,EAAc,aAAa,EAAIC,CAE1C,EAAG,CAAC,GAAK,EAEb,OAAOL,EAAME,EAAsBD,EAAG,UACxC,EAAG,CAAC,CACN,CAEO,SAASK,GAAqB,CACnC,UAAAP,EACA,SAAAQ,CACF,EAMW,CACT,IAAMC,EAA6B,OACjCT,EAAU,aAAa,mBAAqB,CAC9C,EAEMU,EAAeX,GAAyBC,CAAS,EAEvD,MAAI,CAACU,GAAgB,CAACD,EAGb,EAINC,EACC,OAAOV,EAAU,aAAa,6BAA+B,CAAC,EAC9D,KACDS,EAA6BD,EAGlC","names":["formatEther","metaMorphoAbi","getMaxDeposit","vaultAddress","publicClient","maxDeposit","mapPoolType","getPoolState","apiPool","pt","balancerVaultAbi","getVaultPausedState","publicClient","args","config","parseBaseArgs","balancerVaultAbi","decodeFunctionData","erc20Abi","pad","toFunctionSignature","trim","appConfig","defaultChainId","beraChefAbi","rewardVaultAbi","isProxyABI","abi","item","_getAbi","contractAddress","chainId","publicClient","url","response","data","implementationResult","implementationAddress","_getAbiForCallData","address","callData","knownAbi","_decodeCallData","_findAbiItem","functionName","a","_getFunctionSignature","abiItem","error","getDecodedFunctionData","decodedData","functionSignature","formatUnits","honeyFactoryAbi","getHoneyFees","client","collateralList","args","config","parseBaseArgs","promiseList","coll","honeyFactoryAbi","mintRates","redeemRates","collateralWeights","acc","collIdx","formatUnits","e","honeyAbi","getHoneyPausedState","client","args","config","parseBaseArgs","honeyAddress","honeyAbi","honeyRootOracleAbi","getHoneyPythOracle","pythOracle","publicClient","honeyFactoryAbi","getHoneyRootPriceOracle","publicClient","factory","args","config","parseBaseArgs","honeyFactoryAbi","getBlockTime","defaultBlockTime","publicClient","blocksSpan","args","assertPublicClient","config","parseBaseArgs","blockTime","span","hoursInSeconds","currentBlock","oldestBlock","msToSeconds","lstStakerVaultAbi","getLSTStakeConfig","tokenList","publicClient","lstStakingVaults","args","assertPublicClient","config","parseBaseArgs","lstStakingTokens","token","stakingToken","lstStakerVaultAbi","acc","assetTokenAddress","assetToken","isToken","rewardVaultAbi","rewardVaultFactoryAbi","upgradableBeaconAbi","getRewardVaultBeaconImplementation","publicClient","args","config","parseBaseArgs","factoryAddress","assertDefined","assertAddress","beacon","rewardVaultFactoryAbi","upgradableBeaconAbi","getRewardVaultDurationConstants","publicClient","baseArgs","assertPublicClient","beaconImplementation","getRewardVaultBeaconImplementation","minRewardDuration","maxRewardDuration","rewardVaultAbi","zeroAddress","rewardVaultFactoryAbi","getRewardVaultFromToken","tokenAddress","publicClient","factoryAddress","args","config","parseBaseArgs","vaultAddress","rewardVaultFactoryAbi","zeroAddress","pythPriceOracleAbi","getHoneyPythFeeds","tokenList","publicClient","args","config","parseBaseArgs","priceFeedIds","token","pythPriceOracleAbi","acc","index","e","getTokens","url","args","config","parseBaseArgs","beraFetchJson","bgtAbi","beraChefAbi","getActiveBoostAndCommissionChangeDelay","publicClient","ui","args","config","parseBaseArgs","maxCommissionRate","commissionChangeDelay","rewardAllocationBlockDelay","maxWeightPerVault","maxNumWeightsPerRewardAllocation","dropBoostDelay","activateBoostDelay","rewardAllocationInactivityBlockSpan","beraChefAbi","bgtAbi","getValidatorReturnPerBgt","validator","acc","ab","totalIncentiveValue","inc","currIncentive","tokenPrice","getValidatorBoostApy","bgtPrice","validatorActiveBoostAmount","returnPerBgt"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkNMH7LHPWcjs = require('./chunk-NMH7LHPW.cjs');var _viem = require('viem');function w({cause:e,level:t}){if(e instanceof _viem.BaseError){let n=_chunkNMH7LHPWcjs.e.call(void 0, {error:e,revertIfUnknown:!1});if(n.isRequestError&&n.rootCause instanceof _viem.BaseError&&"url"in n.rootCause&&typeof n.rootCause.url=="string")return new (0, _chunkNMH7LHPWcjs.g)({cause:n.rootCause,response:void 0,endpoint:{url:n.rootCause.url,type:"rpc"},level:t})}return e instanceof _chunkNMH7LHPWcjs.f?e:new (0, _chunkNMH7LHPWcjs.f)({cause:e,level:t})}function c(e){return e!=null}function x({value:e,property:t,fn:r}){let n=r(e);if(!n.isValid)throw new (0, _chunkNMH7LHPWcjs.h)({property:t,value:e,expected:n.expectedType})}function o({value:e,property:t,fn:r}){x({value:e,property:t,fn:n=>{let l=c(n),{isValid:v,expectedType:E}=r(n);return{expectedType:E,isValid:l&&v}}})}function y(e,t){o({value:e,property:t,fn:r=>({expectedType:"defined",isValid:c(r)})})}function A(e,t="publicClient"){y(e,t)}function D(e,t){o({value:e,property:t,fn:r=>({expectedType:"Address",isValid:typeof r=="string"&&_viem.isAddress.call(void 0, r)})})}function K(e,t){if(!(typeof e=="bigint"?e>0n:Number(e)>0))throw new (0, _chunkNMH7LHPWcjs.h)({property:t,value:e,expected:"positive amount"})}function M(e,t){o({value:e,property:t,fn:r=>({expectedType:"number",isValid:(typeof r=="string"||typeof r=="number")&&Number(r)>0})})}function f(){let e={};return{emit(t,...r){for(let n of e[t]||[])n(...r)},events:e,on(t,r){return e[t]||(e[t]=[]),e[t].push(r),()=>{e[t]=_optionalChain([e, 'access', _2 => _2[t], 'optionalAccess', _3 => _3.filter, 'call', _4 => _4(n=>r!==n)])}}}}var d=f(),_= exports.g ={captureException(e){let t={exception:e,timestamp:Date.now()};d.emit("exception",t)},on(...e){return d.on(...e)}};exports.a = w; exports.b = y; exports.c = A; exports.d = D; exports.e = K; exports.f = M; exports.g = _;
|
|
2
|
+
//# sourceMappingURL=chunk-2YBHAMDV.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/snowbera/Documents/workspace/monobera/packages/berajs/dist/chunk-2YBHAMDV.cjs","../src/errors/initBeraError.ts","../src/errors/assert.ts","../src/utils/createEmitter.ts","../src/errors/BeraMonitoring.ts"],"names":["initBeraError","error","level","BaseError","parsed","parseViemError","RequestError","BeraError","_isDefined","value","_assert","property","fn","result","InvalidArgumentError","_assertDefined","isDefined","isValid","expectedType","assertDefined","assertPublicClient","assertAddress","isAddress","assertPositive","assertAmount","createEmitter","events","event","args","callback","cb","i","_emitter","BeraMonitoring","exception"],"mappings":"AAAA,qoBAA6D,4BCAnC,SAyCVA,CAAAA,CAAc,CAC5B,KAAA,CAAOC,CAAAA,CACP,KAAA,CAAAC,CACF,CAAA,CAMc,CAIZ,EAAA,CAAID,EAAAA,WAAiBE,eAAAA,CAAW,CAC9B,IAAMC,CAAAA,CAASC,iCAAAA,CACb,KAAA,CAAAJ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CAAS,IAAA,CAAK,WAAA,CAAaL,CAAK,CAClC,CAAA,CAKA,EAAA,CAAA,GAAMC,CAAAA,CAAM,CACV,OAAOI,CAAAA,CAAS,EAAA,CAAG,GAAGJ,CAAI,CAC5B,CACF,CAAA,CAAA,wGAAA","file":"/Users/snowbera/Documents/workspace/monobera/packages/berajs/dist/chunk-2YBHAMDV.cjs","sourcesContent":[null,"import { BaseError } from \"viem\";\n\nimport { BeraError } from \"./BeraError\";\nimport { parseViemError } from \"./parseViemError\";\nimport { RequestError } from \"./RequestError\";\nimport type { SeverityLevel } from \"./severity\";\n\n/**\n * The preferred way to normalize any unknown error into a BeraError.\n *\n * This function acts as a smart factory that picks the correct BeraError subclass:\n *\n * 1. If `cause` is already a `BeraError`, returns it as-is (no double-wrapping).\n * 2. If `cause` is a viem `BaseError`, runs `parseViemError` to classify it:\n * - If the root cause is an `HttpRequestError` (RPC transport failure), wraps it\n * in a `RequestError` with the endpoint URL extracted from the error.\n * 3. Otherwise, wraps in a new `BeraError` — which triggers the automatic reason\n * detection pipeline in the BeraError constructor (parseViemError → errorMap → displayMessage).\n *\n * **Use this instead of `new BeraError({ cause })` when you don't know the error type.**\n * It ensures RequestErrors are correctly classified (important for Sentry filtering\n * and fingerprinting — RequestErrors are skipped from transaction error grouping).\n *\n * @example\n * ```ts\n * try {\n * await someOperation();\n * } catch (error) {\n * // Normalizes to the right subclass, reason auto-detected\n * throw initBeraError({ cause: error });\n * }\n * ```\n *\n * @example\n * ```ts\n * // Reporting to Sentry without rethrowing\n * catch (error) {\n * captureException(initBeraError({ cause: error }));\n * }\n * ```\n */\nexport function initBeraError({\n cause: error,\n level,\n}: {\n cause: unknown;\n /**\n * The severity level of the error, only used if the error is not a BeraError.\n */\n level?: SeverityLevel;\n}): BeraError {\n // ── Step 1: Check if it's a viem BaseError that wraps an RPC transport failure ──\n // parseViemError with revertIfUnknown=false won't throw — it returns { reason: undefined }\n // if the error chain doesn't match any known type.\n if (error instanceof BaseError) {\n const parsed = parseViemError({\n error,\n revertIfUnknown: false,\n });\n if (\n parsed.isRequestError &&\n parsed.rootCause instanceof BaseError &&\n \"url\" in parsed.rootCause &&\n typeof parsed.rootCause.url === \"string\"\n ) {\n // RPC transport failure (e.g. HTTP 502 from the RPC endpoint).\n // Wrapping in RequestError gives it proper endpoint tagging and level=\"warning\".\n return new RequestError({\n cause: parsed.rootCause,\n response: undefined,\n endpoint: {\n url: parsed.rootCause.url as string,\n type: \"rpc\",\n },\n level,\n });\n }\n }\n\n // ── Step 2: Return as-is if already a BeraError, otherwise wrap ──────────\n // The BeraError constructor will run automatic reason detection on the cause.\n const err =\n error instanceof BeraError\n ? error\n : new BeraError({\n cause: error,\n level,\n });\n\n return err;\n}\n","import type { GetPublicClientReturnType } from \"@wagmi/core\";\nimport { type Address, isAddress, type PublicClient } from \"viem\";\n\nimport { InvalidArgumentError } from \"./InvalidArgumentError\";\n\nfunction _isDefined<T>(value: T): value is NonNullable<T> {\n return value !== undefined && value !== null;\n}\n\ntype _AssertFn<T> = (value: T) => { expectedType: string; isValid: boolean };\n\n/**\n * Internal assertion function.\n * @throws An InvalidArgumentError if the value is not valid.\n */\nfunction _assert<T>({\n value,\n property,\n fn,\n}: {\n value: T;\n property: string;\n fn: _AssertFn<T>;\n}) {\n const result = fn(value);\n if (!result.isValid) {\n throw new InvalidArgumentError({\n property,\n value,\n expected: result.expectedType,\n });\n }\n}\n\nfunction _assertDefined<T>({\n value,\n property,\n fn,\n}: {\n value: T;\n property: string;\n fn: (value: T) => { expectedType: string; isValid: boolean };\n}) {\n _assert({\n value,\n property,\n fn: (value) => {\n const isDefined = _isDefined(value);\n const { isValid, expectedType } = fn(value);\n return {\n expectedType,\n isValid: isDefined && isValid,\n };\n },\n });\n}\n\n/**\n * Asserts that a value is defined.\n * @throws An InvalidArgumentError if the value is undefined or null.\n */\nexport function assertDefined<T>(\n /**\n * The value to assert.\n */\n value: T,\n /**\n * The property name.\n */\n property: string,\n): asserts value is NonNullable<T> {\n _assertDefined({\n value,\n property,\n fn: (value) => ({ expectedType: \"defined\", isValid: _isDefined(value) }),\n });\n}\n\n/**\n * Asserts that a value is a PublicClient.\n * @throws An InvalidArgumentError if the value is undefined or not a PublicClient.\n */\nexport function assertPublicClient(\n /**\n * The value to assert.\n */\n value: // it's important to have both types here because it helps with typescript build performance\n PublicClient | GetPublicClientReturnType | undefined,\n /**\n * The property name.\n */\n property: string = \"publicClient\",\n): asserts value is PublicClient {\n // there's no current way to check if a value is a PublicClient, so we just assert it's defined and `value: PublicClient` will do the rest\n assertDefined(value, property);\n}\n\n/**\n * Asserts that a value is an address (20 bytes).\n * @throws An InvalidArgumentError if the value is undefined, null, not a string, or not an address.\n */\nexport function assertAddress(\n /**\n * The value to assert.\n */\n value: string | undefined | null,\n /**\n * The property name.\n */\n property: string,\n): asserts value is Address {\n _assertDefined({\n value,\n property,\n fn: (value) => ({\n expectedType: \"Address\",\n isValid: typeof value === \"string\" && isAddress(value),\n }),\n });\n}\n\n/**\n * Asserts that a value is positive (> 0).\n * @throws An InvalidArgumentError if the value is not positive.\n */\nexport function assertPositive(\n value: string | bigint | number,\n property: string,\n): void {\n const isPositive = typeof value === \"bigint\" ? value > 0n : Number(value) > 0;\n if (!isPositive) {\n throw new InvalidArgumentError({\n property,\n value,\n expected: \"positive amount\",\n });\n }\n}\n\n/**\n * Asserts that a value is a number greater than 0.\n * @throws An InvalidArgumentError if the value is undefined, null, not a string or number, or not a number greater than 0.\n */\nexport function assertAmount(\n /**\n * The value to assert.\n */\n value: unknown,\n /**\n * The property name.\n */\n property: string,\n): asserts value is string | number {\n _assertDefined({\n value,\n property,\n fn: (value) => ({\n expectedType: \"number\",\n isValid:\n (typeof value === \"string\" || typeof value === \"number\") &&\n Number(value) > 0,\n }),\n });\n}\n","interface EventsMap {\n [event: string]: any;\n}\n\ninterface DefaultEvents extends EventsMap {\n [event: string]: (...args: any) => void;\n}\n\nexport type Unsubscribe = () => void;\n\nexport interface Emitter<Events extends EventsMap = DefaultEvents> {\n /**\n * Calls each of the listeners registered for a given event.\n *\n * ```js\n * ee.emit('tick', tickType, tickDuration)\n * ```\n *\n * @param event The event name.\n * @param args The arguments for listeners.\n */\n emit<K extends keyof Events>(event: K, ...args: Parameters<Events[K]>): void;\n\n /**\n * Add a listener for a given event.\n *\n * ```js\n * const unbind = ee.on('tick', (tickType, tickDuration) => {\n * count += 1\n * })\n *\n * disable () {\n * unbind()\n * }\n * ```\n *\n * @param event The event name.\n * @param cb The listener function.\n * @returns Unbind listener from event.\n */\n on<K extends keyof Events>(event: K, cb: Events[K]): Unsubscribe;\n events: Partial<{ [E in keyof Events]: Events[E][] }>;\n}\n\n/**\n * An interface for mixins that expose the `on` function (without the emitter\n * bound to `this`)\n *\n * ```js\n * import { createEmitter } from '~utils/createEmitter'\n *\n * class Ticker implements EmitterMixin<Events> {\n * constructor() {\n * this.emitter = createEmitter()\n * }\n * on(...args) {\n * return this.emitter.on(...args)\n * }\n * tick() {\n * this.emitter.emit('tick')\n * }\n * }\n * ```\n */\nexport interface EmitterMixin<Events extends EventsMap = DefaultEvents> {\n on<K extends keyof Events>(event: K, cb: Events[K]): Unsubscribe;\n}\n\n/**\n * Create event emitter.\n *\n * ```js\n * import { createEmitter } from './createEmitter'\n *\n * class Ticker {\n * constructor() {\n * this.emitter = createEmitter()\n * }\n * on(...args) {\n * return this.emitter.on(...args)\n * }\n * tick() {\n * this.emitter.emit('tick')\n * }\n * }\n * ```\n *\n * Inspired by {@link https://github.com/ai/nanoevents}\n */\nexport function createEmitter<\n Events extends EventsMap = DefaultEvents,\n>(): Emitter<Events> {\n /**\n * Event names in keys and arrays with listeners in values.\n *\n * ```js\n * emitter1.events = emitter2.events\n * emitter2.events = { }\n * ```\n */\n const events: Partial<{ [E in keyof Events]: Events[E][] }> = {};\n\n return {\n emit(event, ...args) {\n for (const callback of events[event] || []) {\n callback(...args);\n }\n },\n events,\n on(event, cb) {\n if (!events[event]) {\n events[event] = [];\n }\n\n events[event].push(cb);\n\n return () => {\n events[event] = events[event]?.filter((i) => cb !== i);\n };\n },\n };\n}\n","import { createEmitter, type EmitterMixin } from \"../utils/createEmitter\";\nimport type { BeraError } from \"./BeraError\";\nimport type { SeverityLevel } from \"./severity\";\n\n/**\n * Context passed alongside captured exceptions.\n * Mirrors the subset of Sentry's CaptureContext that berajs actually uses.\n */\nexport interface CaptureContext {\n level: SeverityLevel;\n extra?: Record<string, unknown>;\n tags?: Record<string, string | number | boolean | null | undefined>;\n fingerprint?: string[];\n data?: Record<string, unknown>;\n}\n\nexport interface ErrorEvent {\n exception: BeraError;\n timestamp: number;\n}\n\nconst _emitter = createEmitter<{ exception: (event: ErrorEvent) => void }>();\n\n/**\n * A generic error reporter for berajs.\n *\n * Instead of calling Sentry.captureException directly, berajs calls\n * `BeraMonitoring.captureException()`. Consumer apps subscribe via `.on()` and\n * forward events to their monitoring provider (Sentry, Datadog, etc.).\n *\n * @example\n * ```ts\n * // In berajs code:\n * import { BeraMonitoring } from \"./BeraMonitoring\";\n * BeraMonitoring.captureExceptionException(error);\n *\n * // In app instrumentation:\n * import { BeraMonitoring } from \"@berachain/berajs/errors\";\n * BeraMonitoring.on((event) => {\n * if (event.type === \"exception\") {\n * Sentry.captureException(event.exception);\n * }\n * });\n * ```\n */\nexport const BeraMonitoring: {\n captureException: (exception: BeraError) => void;\n} & EmitterMixin<{ exception: (event: ErrorEvent) => void }> = {\n /**\n * Capture an exception. Notifies all subscribers.\n */\n captureException(exception: BeraError): void {\n const event: ErrorEvent = {\n exception,\n timestamp: Date.now(),\n };\n _emitter.emit(\"exception\", event);\n },\n /**\n * Subscribe to error events.\n * @returns An unsubscribe function.\n */\n on(...args) {\n return _emitter.on(...args);\n },\n};\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkNVHV2LDKcjs = require('./chunk-NVHV2LDK.cjs');var _chunk74WA35RIcjs = require('./chunk-74WA35RI.cjs');function m(e){return{...e,..._chunk74WA35RIcjs.e.call(void 0, e,"BERA")&&_chunk74WA35RIcjs.c}}function d(e){return e.map(r=>m(r))}var g=(e,r,i,o)=>{if(!e||!r||!i||!o)return 0;let n=new (0, _chunkNVHV2LDKcjs.a)(e).times(i),s=new (0, _chunkNVHV2LDKcjs.a)(r).times(o);if(n.lt(.01)||s.lt(.01)||n.isZero()||s.isZero())return 0;let u=s.div(n);return Number(new (0, _chunkNVHV2LDKcjs.a)(1).minus(u).toFixed())};exports.a = m; exports.b = d; exports.c = g;
|
|
2
|
+
//# sourceMappingURL=chunk-57RINXU6.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/snowbera/Documents/workspace/monobera/packages/berajs/dist/chunk-57RINXU6.cjs","../src/utils/tokenWrapping.ts","../src/utils/math.ts"],"names":["wrapNativeToken","token","isToken","wBeraToken","wrapNativeTokens","tokens","computePriceImpact","tokenInPrice","tokenOutPrice","inAmount","outAmount","usdIn","bignumber_js_default","usdOut","ratio"],"mappings":"AAAA,iIAAwC,wDAAgD,SCMxEA,CAAAA,CAAqCC,CAAAA,CAAa,CAChE,MAAO,CACL,GAAGA,CAAAA,CACH,GAAIC,iCAAAA,CAAQD,CAAO,MAAM,CAAA,EAAKE,mBAChC,CACF,CAEO,SAASC,CAAAA,CAAsCC,CAAAA,CAAkB,CACtE,OAAOA,CAAAA,CAAO,GAAA,CAAKJ,CAAAA,EAAUD,CAAAA,CAAgBC,CAAK,CAAC,CACrD,CCLO,IAAMK,CAAAA,CAAqB,CAChCC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CAAAA,EACW,CACX,EAAA,CAAI,CAACH,CAAAA,EAAgB,CAACC,CAAAA,EAAiB,CAACC,CAAAA,EAAY,CAACC,CAAAA,CAAW,OAAO,CAAA,CAEvE,IAAMC,CAAAA,CAAQ,IAAIC,wBAAAA,CAAUL,CAAY,CAAA,CAAE,KAAA,CAAME,CAAQ,CAAA,CAClDI,CAAAA,CAAS,IAAID,wBAAAA,CAAUJ,CAAa,CAAA,CAAE,KAAA,CAAME,CAAS,CAAA,CAI3D,EAAA,CADIC,CAAAA,CAAM,EAAA,CAAG,GAAI,CAAA,EAAKE,CAAAA,CAAO,EAAA,CAAG,GAAI,CAAA,EAChCF,CAAAA,CAAM,MAAA,CAAO,CAAA,EAAKE,CAAAA,CAAO,MAAA,CAAO,CAAA,CAAG,OAAO,CAAA,CAE9C,IAAMC,CAAAA,CAAQD,CAAAA,CAAO,GAAA,CAAIF,CAAK,CAAA,CAC9B,OAAO,MAAA,CAAO,IAAIC,wBAAAA,CAAU,CAAC,CAAA,CAAE,KAAA,CAAME,CAAK,CAAA,CAAE,OAAA,CAAQ,CAAC,CACvD,CAAA,CAAA,4CAAA","file":"/Users/snowbera/Documents/workspace/monobera/packages/berajs/dist/chunk-57RINXU6.cjs","sourcesContent":[null,"import { isToken, wBeraToken } from \"./tokens\";\n\ntype BaseToken = {\n address: string;\n};\n\nexport function wrapNativeToken<T extends BaseToken>(token: T): T {\n return {\n ...token,\n ...(isToken(token, \"BERA\") && wBeraToken),\n };\n}\n\nexport function wrapNativeTokens<T extends BaseToken>(tokens: T[]): T[] {\n return tokens.map((token) => wrapNativeToken(token));\n}\n","import BigNumber from \"@berachain/utils/pkg/bignumber.js\";\n\n/**\n * Compute the price impact of a swap\n * @param {string} tokenInPrice - The price of the input token\n * @param {string} tokenOutPrice - The price of the output token\n * @param {string} inAmount - The amount of the input token\n * @param {string} outAmount - The amount of the output token\n * @returns {number} The price impact of the swap\n */\nexport const computePriceImpact = (\n tokenInPrice: string,\n tokenOutPrice: string,\n inAmount: string,\n outAmount: string,\n): number => {\n if (!tokenInPrice || !tokenOutPrice || !inAmount || !outAmount) return 0;\n\n const usdIn = new BigNumber(tokenInPrice).times(inAmount);\n const usdOut = new BigNumber(tokenOutPrice).times(outAmount);\n\n // is the amount is close to 0, return 0\n if (usdIn.lt(0.01) || usdOut.lt(0.01)) return 0;\n if (usdIn.isZero() || usdOut.isZero()) return 0;\n\n const ratio = usdOut.div(usdIn);\n return Number(new BigNumber(1).minus(ratio).toFixed());\n};\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var p="Something went wrong. Please try again later.",B={ERC20:{NOT_ENOUGH_BALANCE:{reasons:["NotEnoughBalance"],errorMSG:"You do not have enough balance to perform this action."},InsufficientBalance:{reasons:["InsufficientBalance"],errorMSG:"Insufficient token balance"},INSUFFICIENT_ALLOWANCE:{reasons:["0x13be252b","InsufficientAllowance","ERC20InsufficientAllowance"],errorMSG:"You do not have enough allowance to perform this action."},SIGNATURE_EXPIRED:{reasons:["SignatureExpired"],errorMSG:"Transaction took too long to complete. Please try again."}},HTTP:{RATE_LIMITED_429:{reasons:["429"],errorMSG:"Too many requests. Please try again later."}},ENSO:{COULD_NOT_BUILD_SHORTCUT:{keywords:["Could not build shortcuts for route","Could not quote shortcuts for route"],errorMSG:"There was an error building the zap route. Try with lower amounts."},NOT_ENOUGH_LIQUIDITY:{keywords:["Swap not found for a required underlying of defi route, please make sure your amountIn is within an acceptable range"],errorMSG:"The amount you\u2019re trying to swap might be too high. Please make sure that your amount is within an acceptable range."},NO_ROUTE_FOUND:{keywords:["No route found from"],errorMSG:"No swap route found for the given tokens."}},RPC:{NOT_ENOUGH_GAS_TOKEN:{reasons:["InsufficientFundsError"],keywords:["insufficient funds for gas * price + value:","The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."],errorMSG:"Insufficient BERA balance to perform this action."},NONCE_TOO_LOW:{keywords:["nonce too low: next nonce"],errorMSG:"Nonce is too low. Your wallet might have unconfirmed transactions."},GAS_PRICE:{keywords:["gasLimit"],errorMSG:"It seems an RPC error has occurred while estimating gas. Please try your request later."},JSON_RPC:{keywords:["JSON-RPC"],errorMSG:"It seems an RPC error has occurred. Please try your request one more later."},HASH:{keywords:["hash"],errorMSG:"It seems an RPC error has occurred. Please check if your transaction was finalized. If not, please try again."},USER_REJECTION:{reasons:["UserRejectedRequestError"],keywords:["User denied transaction signature"],errorMSG:"You rejected the transaction."},SMART_UPGRADE_REJECTION:{reasons:["AtomicReadyWalletRejectedUpgradeError"],errorMSG:"You've declined to upgrade to batch transactions for now, try again for the traditional method."},CHAIN_MISMATCH:{reasons:["ChainMismatchError"],errorMSG:"Wallet seems to be on the wrong chain, please refresh the page and try again."}},EIP7702:{SESSION_KEY_EXPIRED:{reasons:["SessionKeyExpired"],errorMSG:"Session key has expired. Please create a new one."},CALL_POLICY_VIOLATED:{reasons:["CallPolicyViolated"],errorMSG:"Call policy violated. Please check your call policies."}},HONEY:{BLACKLISTED_WALLET:{reasons:["BlacklistedWallet","0x265693b4"],errorMSG:"Your wallet is blacklisted from minting or redeeming HONEY."},LIQUIDITY_ERROR:{reasons:["0x4656425a"],errorMSG:"You are trying to redeem more than the liquidity available in the vault."}},BEX:{SLIPPAGE_EXCEEDED:{reasons:["SlippageExceeded","TooMuchSlippage"],errorMSG:"Price changed while executing the transaction and exceeded the allowed slippage."},BAL000:{reasons:["BAL#000"],errorMSG:"Addition overflow occurred during calculation. (BEX#000)"},BAL001:{reasons:["BAL#001"],errorMSG:"Subtraction overflow occurred during calculation. (BEX#001)"},BAL002:{reasons:["BAL#002"],errorMSG:"Subtraction underflow occurred during calculation. (BEX#002)"},BAL003:{reasons:["BAL#003"],errorMSG:"Multiplication overflow occurred during calculation. (BEX#003)"},BAL004:{reasons:["BAL#004"],errorMSG:"Attempted division by zero. (BEX#004)"},BAL005:{reasons:["BAL#005"],errorMSG:"Multiplication overflow during FixedPoint Division. (BEX#005)"},BAL006:{reasons:["BAL#006"],errorMSG:"Invalid x in ExpMath.pow(x, y). (BEX#006)"},BAL007:{reasons:["BAL#007"],errorMSG:"Invalid y in ExpMath.pow(x, y). (BEX#007)"},BAL008:{reasons:["BAL#008"],errorMSG:"In LogExpMath.pow(x, y), error computing x^y as exp(y * ln(x)). (BEX#008)"},BAL009:{reasons:["BAL#009"],errorMSG:"In LogExpMath.exp(x) = e^x; x out of bounds. (BEX#009)"},BAL100:{reasons:["BAL#100"],errorMSG:"Value is out of acceptable bounds. (BEX#100)"},BAL101:{reasons:["BAL#101"],errorMSG:"Tokens must be sorted in address order on pool registration. (BEX#101)"},BAL102:{reasons:["BAL#102"],errorMSG:"Tokens must be sorted in address order on pool registration. (BEX#102)"},BAL103:{reasons:["BAL#103"],errorMSG:"Parallel array inputs must have the same length. (BEX#103)"},BAL104:{reasons:["BAL#104"],errorMSG:"Address to be interpreted as a token cannot be 0. (BEX#104)"},BAL105:{reasons:["BAL#105"],errorMSG:"Insufficient byte length. (BEX#105)"},BAL200:{reasons:["BAL#200"],errorMSG:"All pools must contain at least two tokens. (BEX#200)"},BAL201:{reasons:["BAL#201"],errorMSG:"Token count exceeds the maximum for a given pool type. (BEX#201)"},BAL202:{reasons:["BAL#202"],errorMSG:"Swap fee percentage exceeds the maximum allowed. (BEX#202)"},BAL203:{reasons:["BAL#203"],errorMSG:"Swap fee percentage is below the minimum allowed. (BEX#203)"},BAL204:{reasons:["BAL#204"],errorMSG:"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)"},BAL205:{reasons:["BAL#205"],errorMSG:"User attempted to execute a callback intended for the vault contract. (BEX#205)"},BAL206:{reasons:["BAL#206"],errorMSG:"Pools must be initialized with a special 'Init' join, before they can be joined by LPs. (BEX#206)"},BAL207:{reasons:["BAL#207"],errorMSG:"Slippage/front-running protection check failed on a pool exit. (BEX#207)"},BAL208:{reasons:["BAL#208"],errorMSG:"Minimum BPT output amount not met. (BEX#208)"},BAL209:{reasons:["BAL#209"],errorMSG:"Slippage/front-running protection check failed on a pool join. (BEX#209)"},BAL210:{reasons:["BAL#210"],errorMSG:"Pools with oracles are limited to two tokens. A pool with the TWO_TOKEN specialization must have exactly two tokens. (BEX#210)"},BAL211:{reasons:["BAL#211"],errorMSG:"The pool factory is disabled and new pools cannot be created at this time. (BEX#211)"},BAL300:{reasons:["BAL#300"],errorMSG:"The amplification parameter is below the minimum allowed. (BEX#300)"},BAL301:{reasons:["BAL#301"],errorMSG:"The amplification parameter exceeds the maximum allowed. (BEX#301)"},BAL302:{reasons:["BAL#302"],errorMSG:"The weight parameter is below the minimum allowed. (BEX#302)"},BAL303:{reasons:["BAL#303"],errorMSG:"The number of stable tokens exceeds the maximum allowed. (BEX#303)"},BAL304:{reasons:["BAL#304"],errorMSG:"The amount of tokens in would unbalance the pool. (BEX#304)"},BAL305:{reasons:["BAL#305"],errorMSG:"The amount of tokens out would unbalance the pool. (BEX#305)"},BAL306:{reasons:["BAL#306"],errorMSG:"Disproportionate pool exit would unbalance the pool. (BEX#306)"},BAL307:{reasons:["BAL#307"],errorMSG:"Disproportionate pool join would unbalance the pool. (BEX#307)"},BAL308:{reasons:["BAL#308"],errorMSG:"Normalized weights do not add to 1.0 exactly. (BEX#308)"},BAL309:{reasons:["BAL#309"],errorMSG:"Invalid token provided for operation. (BEX#309)"},BAL310:{reasons:["BAL#310"],errorMSG:"Unhandled pool join operation for this pool type. (BEX#310)"},BAL311:{reasons:["BAL#311"],errorMSG:"Pool balances must be > 0. (BEX#311)"},BAL312:{reasons:["BAL#312"],errorMSG:"Invalid query for oracle data ('ago' timestamp was not in the past). (BEX#312)"},BAL313:{reasons:["BAL#313"],errorMSG:"Oracle has no data to query. (BEX#313)"},BAL314:{reasons:["BAL#314"],errorMSG:"Oracle query data is before its earliest data sample. (BEX#314)"},BAL315:{reasons:["BAL#315"],errorMSG:"Cannot query an oracle sample outside the buffer of 1024. (BEX#315)"},BAL316:{reasons:["BAL#316"],errorMSG:"Oracle query window must have non-zero duration. (BEX#316)"},BAL317:{reasons:["BAL#317"],errorMSG:"Amplification parameter change has less than the minimum duration. (BEX#317)"},BAL318:{reasons:["BAL#318"],errorMSG:"Cannot start an amplification parameter update if one is already ongoing. (BEX#318)"},BAL319:{reasons:["BAL#319"],errorMSG:"The requested amplification parameter change is too fast (cannot halve or double over less than a day). (BEX#319)"},BAL320:{reasons:["BAL#320"],errorMSG:"Cannot cancel an update if there isn't one already ongoing. (BEX#320)"},BAL321:{reasons:["BAL#321"],errorMSG:"Stable pool invariant calculation did not converge. (BEX#321)"},BAL322:{reasons:["BAL#322"],errorMSG:"Stable pool balance calculation did not converge. (BEX#322)"},BAL323:{reasons:["BAL#323"],errorMSG:"Relayer must be a valid contract. (BEX#323)"},BAL324:{reasons:["BAL#324"],errorMSG:"Base pool relayer was not called correctly. (BEX#324)"},BAL325:{reasons:["BAL#325"],errorMSG:"Rebalancing relayer operation re-entered unexpectedly. (BEX#325)"},BAL326:{reasons:["BAL#326"],errorMSG:"Detected time travel in gradual updates (start > end time in a gradual weights update). (BEX#326)"},BAL327:{reasons:["BAL#327"],errorMSG:"Swaps are disabled for this pool. (BEX#327)"},BAL328:{reasons:["BAL#328"],errorMSG:"Caller is not the owner of the LBP. (BEX#328)"},BAL329:{reasons:["BAL#329"],errorMSG:"Rate returned from a rateProvider must fit within 128 bits. (BEX#329)"},BAL330:{reasons:["BAL#330"],errorMSG:"Investment pools only allow proportional joins and exits when swaps are disabled (to prevent unbalancing the pool). (BEX#330)"},BAL331:{reasons:["BAL#331"],errorMSG:"Gradual weight update duration too short (minimum 1 day). (BEX#331)"},BAL332:{reasons:["BAL#332"],errorMSG:"Invalid Linear Pool operating range. (BEX#332)"},BAL333:{reasons:["BAL#333"],errorMSG:"Linear Pool max balance must fit in 112 bits. (BEX#333)"},BAL334:{reasons:["BAL#334"],errorMSG:"Unhandled pool join/exit operation for linear pool type. (BEX#334)"},BAL335:{reasons:["BAL#335"],errorMSG:"Cannot reset Linear Pool targets if pool is unbalanced. (BEX#335)"},BAL336:{reasons:["BAL#336"],errorMSG:"Unhandled pool exit operation for this pool type. (BEX#336)"},BAL337:{reasons:["BAL#337"],errorMSG:"Management fees can only be collected by the pool owner. (BEX#337)"},BAL338:{reasons:["BAL#338"],errorMSG:"Management swap fee percentage exceeded the maximum. (BEX#338)"},BAL339:{reasons:["BAL#339"],errorMSG:"Unhandled pool join/exit operation for managed pool type. (BEX#339)"},BAL340:{reasons:["BAL#340"],errorMSG:"Unhandled pool join/exit operation for phantom pool type. (BEX#340)"},BAL341:{reasons:["BAL#341"],errorMSG:"Token does not have a valid rate provider. (BEX#341)"},BAL342:{reasons:["BAL#342"],errorMSG:"Invalid pool initialization parameters provided. (BEX#342)"},BAL343:{reasons:["BAL#343"],errorMSG:"Value is out of the new target range for the operation. (BEX#343)"},BAL344:{reasons:["BAL#344"],errorMSG:"This feature is currently disabled. (BEX#344)"},BAL345:{reasons:["BAL#345"],errorMSG:"The pool controller is uninitialized. (BEX#345)"},BAL346:{reasons:["BAL#346"],errorMSG:"Cannot set swap fee during an ongoing fee change. (BEX#346)"},BAL347:{reasons:["BAL#347"],errorMSG:"Cannot set swap fee during pending fee changes. (BEX#347)"},BAL348:{reasons:["BAL#348"],errorMSG:"Cannot change tokens during a weight change. (BEX#348)"},BAL349:{reasons:["BAL#349"],errorMSG:"Cannot change tokens during pending weight changes. (BEX#349)"},BAL350:{reasons:["BAL#350"],errorMSG:"Weight parameter exceeds the maximum allowed. (BEX#350)"},BAL351:{reasons:["BAL#351"],errorMSG:"Unauthorized join operation. (BEX#351)"},BAL352:{reasons:["BAL#352"],errorMSG:"Management AUM fee percentage exceeded the maximum allowed. (BEX#352)"},BAL353:{reasons:["BAL#353"],errorMSG:"Fractional target values are not supported. (BEX#353)"},BAL354:{reasons:["BAL#354"],errorMSG:"Adding or removing BPT is not allowed in this context. (BEX#354)"},BAL355:{reasons:["BAL#355"],errorMSG:"Invalid circuit breaker bounds configuration. (BEX#355)"},BAL356:{reasons:["BAL#356"],errorMSG:"The circuit breaker has been triggered. (BEX#356)"},BAL357:{reasons:["BAL#357"],errorMSG:"Malicious query detected and reverted. (BEX#357)"},BAL358:{reasons:["BAL#358"],errorMSG:"Joins and exits are currently disabled for this pool. (BEX#358)"},BAL400:{reasons:["BAL#400"],errorMSG:"Reentrancy detected. (BEX#400)"},BAL401:{reasons:["BAL#401"],errorMSG:"The sender is not allowed to perform this action. (BEX#401)"},BAL402:{reasons:["BAL#402"],errorMSG:"The contract is currently paused. (BEX#402)"},BAL403:{reasons:["BAL#403"],errorMSG:"The pause window has expired. (BEX#403)"},BAL404:{reasons:["BAL#404"],errorMSG:"The maximum pause window duration has been exceeded. (BEX#404)"},BAL405:{reasons:["BAL#405"],errorMSG:"The maximum buffer period duration has been exceeded. (BEX#405)"},BAL406:{reasons:["BAL#406"],errorMSG:"The account has insufficient balance. (BEX#406)"},BAL407:{reasons:["BAL#407"],errorMSG:"The account has insufficient allowance. (BEX#407)"},BAL408:{reasons:["BAL#408"],errorMSG:"ERC20: Transfer from zero address. (BEX#408)"},BAL409:{reasons:["BAL#409"],errorMSG:"ERC20: Transfer to zero address. (BEX#409)"},BAL410:{reasons:["BAL#410"],errorMSG:"ERC20: Mint to zero address. (BEX#410)"},BAL411:{reasons:["BAL#411"],errorMSG:"ERC20: Burn from zero address. (BEX#411)"},BAL412:{reasons:["BAL#412"],errorMSG:"ERC20: Approve from zero address. (BEX#412)"},BAL413:{reasons:["BAL#413"],errorMSG:"ERC20: Approve to zero address. (BEX#413)"},BAL414:{reasons:["BAL#414"],errorMSG:"ERC20: Transfer exceeds allowance. (BEX#414)"},BAL415:{reasons:["BAL#415"],errorMSG:"ERC20: Decreased allowance below zero. (BEX#415)"},BAL416:{reasons:["BAL#416"],errorMSG:"ERC20: Transfer exceeds balance. (BEX#416)"},BAL417:{reasons:["BAL#417"],errorMSG:"ERC20: Burn exceeds allowance. (BEX#417)"},BAL418:{reasons:["BAL#418"],errorMSG:"SafeERC20: Call failed. (BEX#418)"},BAL419:{reasons:["BAL#419"],errorMSG:"Address has insufficient balance. (BEX#419)"},BAL420:{reasons:["BAL#420"],errorMSG:"Address cannot send value. (BEX#420)"},BAL421:{reasons:["BAL#421"],errorMSG:"SafeCast: Value cannot fit into int256. (BEX#421)"},BAL422:{reasons:["BAL#422"],errorMSG:"AccessControl: Grant sender is not an admin. (BEX#422)"},BAL423:{reasons:["BAL#423"],errorMSG:"AccessControl: Revoke sender is not an admin. (BEX#423)"},BAL424:{reasons:["BAL#424"],errorMSG:"AccessControl: Renounce sender not allowed for accounts other than self. (BEX#424)"},BAL425:{reasons:["BAL#425"],errorMSG:"Buffer period has expired. (BEX#425)"},BAL426:{reasons:["BAL#426"],errorMSG:"Caller is not the owner. (BEX#426)"},BAL427:{reasons:["BAL#427"],errorMSG:"New owner cannot be zero address. (BEX#427)"},BAL428:{reasons:["BAL#428"],errorMSG:"Code deployment failed. (BEX#428)"},BAL429:{reasons:["BAL#429"],errorMSG:"Call to non-contract address. (BEX#429)"},BAL430:{reasons:["BAL#430"],errorMSG:"Low-level call failed. (BEX#430)"},BAL431:{reasons:["BAL#431"],errorMSG:"The contract is not paused. (BEX#431)"},BAL432:{reasons:["BAL#432"],errorMSG:"Address is already allowlisted. (BEX#432)"},BAL433:{reasons:["BAL#433"],errorMSG:"Address is not allowlisted. (BEX#433)"},BAL434:{reasons:["BAL#434"],errorMSG:"ERC20: Burn exceeds balance. (BEX#434)"},BAL435:{reasons:["BAL#435"],errorMSG:"Invalid operation. (BEX#435)"},BAL436:{reasons:["BAL#436"],errorMSG:"Codec overflow detected. (BEX#436)"},BAL437:{reasons:["BAL#437"],errorMSG:"The system is in recovery mode. (BEX#437)"},BAL438:{reasons:["BAL#438"],errorMSG:"The system is not in recovery mode. (BEX#438)"},BAL439:{reasons:["BAL#439"],errorMSG:"Induced failure. (BEX#439)"},BAL440:{reasons:["BAL#440"],errorMSG:"Expired signature. (BEX#440)"},BAL441:{reasons:["BAL#441"],errorMSG:"Malformed signature. (BEX#441)"},BAL442:{reasons:["BAL#442"],errorMSG:"SafeCast: Value cannot fit into uint64. (BEX#442)"},BAL443:{reasons:["BAL#443"],errorMSG:"Unhandled fee type. (BEX#443)"},BAL444:{reasons:["BAL#444"],errorMSG:"ERC20: Burn from zero address. (BEX#444)"},BAL500:{reasons:["BAL#500"],errorMSG:"Invalid pool ID. (BEX#500)"},BAL501:{reasons:["BAL#501"],errorMSG:"Caller is not the pool. (BEX#501)"},BAL502:{reasons:["BAL#502"],errorMSG:"Sender is not the asset manager. (BEX#502)"},BAL503:{reasons:["BAL#503"],errorMSG:"User does not allow the relayer. (BEX#503)"},BAL504:{reasons:["BAL#504"],errorMSG:"Invalid signature. (BEX#504)"},BAL505:{reasons:["BAL#505"],errorMSG:"Exit would yield fewer than the minimum tokens out. (BEX#505)"},BAL506:{reasons:["BAL#506"],errorMSG:"Join would cost more than the maximum tokens in. (BEX#506)"},BAL507:{reasons:["BAL#507"],errorMSG:"Swap violates user-supplied limits. (BEX#507)"},BAL508:{reasons:["BAL#508"],errorMSG:"Swap transaction not mined within the deadline. (BEX#508)"},BAL509:{reasons:["BAL#509"],errorMSG:"Cannot swap the same token. (BEX#509)"},BAL510:{reasons:["BAL#510"],errorMSG:"Unknown amount in the first swap of a batch. (BEX#510)"},BAL511:{reasons:["BAL#511"],errorMSG:"Malconstructed multihop swap. (BEX#511)"},BAL512:{reasons:["BAL#512"],errorMSG:"Internal balance overflow. (BEX#512)"},BAL513:{reasons:["BAL#513"],errorMSG:"Insufficient internal balance. (BEX#513)"},BAL514:{reasons:["BAL#514"],errorMSG:"Invalid BERA internal balance. (BEX#514)"},BAL515:{reasons:["BAL#515"],errorMSG:"Flashloan must repay the loan in the same transaction. (BEX#515)"},BAL516:{reasons:["BAL#516"],errorMSG:"Insufficient BERA balance. (BEX#516)"},BAL517:{reasons:["BAL#517"],errorMSG:"Unallocated BERA. (BEX#517)"},BAL518:{reasons:["BAL#518"],errorMSG:"Relayers cannot receive BERA directly (only through the Vault). (BEX#518)"},BAL519:{reasons:["BAL#519"],errorMSG:"Cannot use BERA sentinel for internal balance. (BEX#519)"},BAL520:{reasons:["BAL#520"],errorMSG:"Tokens mismatch. (BEX#520)"},BAL521:{reasons:["BAL#521"],errorMSG:"Token is not registered. (BEX#521)"},BAL522:{reasons:["BAL#522"],errorMSG:"Token is already registered. (BEX#522)"},BAL523:{reasons:["BAL#523"],errorMSG:"Tokens are already set. (BEX#523)"},BAL524:{reasons:["BAL#524"],errorMSG:"Tokens length must be 2. (BEX#524)"},BAL525:{reasons:["BAL#525"],errorMSG:"Nonzero token balance detected. (BEX#525)"},BAL526:{reasons:["BAL#526"],errorMSG:"Balance total overflow detected. (BEX#526)"},BAL527:{reasons:["BAL#527"],errorMSG:"Pool has no tokens. (BEX#527)"},BAL528:{reasons:["BAL#528"],errorMSG:"Insufficient flash loan balance. (BEX#528)"},BAL600:{reasons:["BAL#600"],errorMSG:"Swap fee percentage is too high. (BEX#600)"},BAL601:{reasons:["BAL#601"],errorMSG:"Flash loan fee percentage is too high. (BEX#601)"},BAL602:{reasons:["BAL#602"],errorMSG:"Insufficient flash loan fee amount. (BEX#602)"},BAL700:{reasons:["BAL#700"],errorMSG:"Splitter fee percentage is too high. (BEX#700)"},BAL998:{reasons:["BAL#998"],errorMSG:"Unimplemented functionality. (BEX#998)"},BAL999:{reasons:["BAL#999"],errorMSG:"An unexpected error occurred. (BEX#999)"},NO_SWAP_PATHS:{keywords:["No swap paths returned"],errorMSG:"No swap paths were found."}},AGGREGATOR:{NOT_ENOUGH_LIQUIDITY:{keywords:["Not enough liquidity"],errorMSG:"Not enough liquidity. Try a lower amount."}},POL:{REWARD_VAULT_FACTORY:{reasons:["VaultAlreadyExists"],errorMSG:"Failed to create action. An action already exists with this staking token."},NOT_REWARD_VAULT_MANAGER:{reasons:["NotRewardVaultManager"],errorMSG:"You are not the manager of this action."},NOT_INCENTIVE_MANAGER:{reasons:["NotIncentiveManager"],errorMSG:"You are not the incentive manager of this token."},DURATION_CHANGE_NOT_ALLOWED:{reasons:["DurationChangeNotAllowed"],errorMSG:"You cannot change the duration of this action."},INVALID_PROOF:{reasons:["InvalidProof"],errorMSG:"Tokens already claimed or invalid proof."},CONTRACT_PAUSED:{reasons:["EnforcedPause"],errorMSG:"The contract you're interacting with is temporarily paused."},DISTRIBUTION_PAUSED:{reasons:["DistributionEnforcedPause"],errorMSG:"Distribution is temporarily paused."},INVALID_VALIDATOR_COMMISSION:{reasons:["InvalidCommissionValue"],errorMSG:"Invalid commission percentage."},NOT_REWARD_ALLOCATOR:{reasons:["NotRewardAllocator"],errorMSG:"You are not the reward allocator of this validator."},NOT_OPERATOR:{reasons:["NotOperator"],errorMSG:"You are not the operator of this validator."},INVALID_REWARD_ALLOCATION:{reasons:["InvalidRewardAllocationWeights"],errorMSG:"Invalid reward allocation weights."},NOT_REWARD_DURATION_MANAGER:{reasons:["NotRewardDurationManager"],errorMSG:"You are not the reward duration manager of this validator."}},BEND:{INSUFFICIENT_POSITION:{keywords:["insufficient position"],errorMSG:"Insufficient position"},INSUFFICIENT_LIQUIDITY:{keywords:["insufficient liquidity on market"],errorMSG:"Insufficient liquidity on market."},ALL_CAPS_REACHED:{reasons:["AllCapsReached"],errorMSG:"All caps reached on vault."},AboveMaxTimelock:{reasons:["AboveMaxTimelock"],errorMSG:"Above max timelock"},AddressEmptyCode:{reasons:["AddressEmptyCode"],errorMSG:"Address empty code"},AddressInsufficientBalance:{reasons:["AddressInsufficientBalance"],errorMSG:"Address insufficient balance"},AllCapsReached:{reasons:["AllCapsReached"],errorMSG:"All caps reached"},AlreadyPending:{reasons:["AlreadyPending"],errorMSG:"Already pending"},AlreadySet:{reasons:["AlreadySet"],errorMSG:"Already set"},BelowMinTimelock:{reasons:["BelowMinTimelock"],errorMSG:"Below min timelock"},DuplicateMarket:{reasons:["DuplicateMarket"],errorMSG:"Duplicate market"},ECDSAInvalidSignature:{reasons:["ECDSAInvalidSignature"],errorMSG:"Invalid ECDSA signature"},ECDSAInvalidSignatureLength:{reasons:["ECDSAInvalidSignatureLength"],errorMSG:"Invalid ECDSA signature length"},ECDSAInvalidSignatureS:{reasons:["ECDSAInvalidSignatureS"],errorMSG:"Invalid ECDSA signature S value"},ERC20InsufficientBalance:{reasons:["ERC20InsufficientBalance"],errorMSG:"ERC20 insufficient balance"},ERC20InvalidApprover:{reasons:["ERC20InvalidApprover"],errorMSG:"ERC20 invalid approver"},ERC20InvalidReceiver:{reasons:["ERC20InvalidReceiver"],errorMSG:"ERC20 invalid receiver"},ERC20InvalidSender:{reasons:["ERC20InvalidSender"],errorMSG:"ERC20 invalid sender"},ERC20InvalidSpender:{reasons:["ERC20InvalidSpender"],errorMSG:"ERC20 invalid spender"},ERC2612ExpiredSignature:{reasons:["ERC2612ExpiredSignature"],errorMSG:"ERC2612 expired signature"},ERC2612InvalidSigner:{reasons:["ERC2612InvalidSigner"],errorMSG:"ERC2612 invalid signer"},ERC4626ExceededMaxDeposit:{reasons:["ERC4626ExceededMaxDeposit"],errorMSG:"ERC4626 exceeded max deposit"},ERC4626ExceededMaxMint:{reasons:["ERC4626ExceededMaxMint"],errorMSG:"ERC4626 exceeded max mint"},ERC4626ExceededMaxRedeem:{reasons:["ERC4626ExceededMaxRedeem"],errorMSG:"ERC4626 exceeded max redeem"},ERC4626ExceededMaxWithdraw:{reasons:["ERC4626ExceededMaxWithdraw"],errorMSG:"ERC4626 exceeded max withdraw"},FailedInnerCall:{reasons:["FailedInnerCall"],errorMSG:"Failed inner call"},InconsistentAsset:{reasons:["InconsistentAsset"],errorMSG:"Inconsistent asset"},InconsistentReallocation:{reasons:["InconsistentReallocation"],errorMSG:"Inconsistent reallocation"},InvalidAccountNonce:{reasons:["InvalidAccountNonce"],errorMSG:"Invalid account nonce"},InvalidMarketRemovalNonZeroCap:{reasons:["InvalidMarketRemovalNonZeroCap"],errorMSG:"Invalid market removal (non-zero cap)"},InvalidMarketRemovalNonZeroSupply:{reasons:["InvalidMarketRemovalNonZeroSupply"],errorMSG:"Invalid market removal (non-zero supply)"},InvalidMarketRemovalTimelockNotElapsed:{reasons:["InvalidMarketRemovalTimelockNotElapsed"],errorMSG:"Invalid market removal (timelock not elapsed)"},InvalidShortString:{reasons:["InvalidShortString"],errorMSG:"Invalid short string"},MarketNotCreated:{reasons:["MarketNotCreated"],errorMSG:"Market not created"},MarketNotEnabled:{reasons:["MarketNotEnabled"],errorMSG:"Market not enabled"},MathOverflowedMulDiv:{reasons:["MathOverflowedMulDiv"],errorMSG:"Math overflow"},MaxFeeExceeded:{reasons:["MaxFeeExceeded"],errorMSG:"Max fee exceeded"},MaxQueueLengthExceeded:{reasons:["MaxQueueLengthExceeded"],errorMSG:"Max queue length exceeded"},NoPendingValue:{reasons:["NoPendingValue"],errorMSG:"No pending value"},NonZeroCap:{reasons:["NonZeroCap"],errorMSG:"Non-zero cap"},NotAllocatorRole:{reasons:["NotAllocatorRole"],errorMSG:"Not allocator role"},NotCuratorNorGuardianRole:{reasons:["NotCuratorNorGuardianRole"],errorMSG:"Not curator or guardian role"},NotCuratorRole:{reasons:["NotCuratorRole"],errorMSG:"Not curator role"},NotEnoughLiquidity:{reasons:["NotEnoughLiquidity"],errorMSG:"Not enough liquidity"},NotGuardianRole:{reasons:["NotGuardianRole"],errorMSG:"Not guardian role"},OwnableInvalidOwner:{reasons:["OwnableInvalidOwner"],errorMSG:"Invalid owner"},OwnableUnauthorizedAccount:{reasons:["OwnableUnauthorizedAccount"],errorMSG:"Unauthorized account"},PendingCap:{reasons:["PendingCap"],errorMSG:"Pending cap"},PendingRemoval:{reasons:["PendingRemoval"],errorMSG:"Pending removal"},SafeCastOverflowedUintDowncast:{reasons:["SafeCastOverflowedUintDowncast"],errorMSG:"SafeCast overflow"},SafeERC20FailedOperation:{reasons:["SafeERC20FailedOperation"],errorMSG:"SafeERC20 failed operation"},StringTooLong:{reasons:["StringTooLong"],errorMSG:"String too long"},SupplyCapExceeded:{reasons:["SupplyCapExceeded"],errorMSG:"Supply cap exceeded"},TimelockNotElapsed:{reasons:["TimelockNotElapsed"],errorMSG:"Timelock not elapsed"},UnauthorizedMarket:{reasons:["UnauthorizedMarket"],errorMSG:"Unauthorized market"},ZeroAddress:{reasons:["ZeroAddress"],errorMSG:"Zero address"},ZeroFeeRecipient:{reasons:["ZeroFeeRecipient"],errorMSG:"Zero fee recipient"}}};function E({reason:o,message:r}){for(let n in B){let a=B[n];for(let s in a){let t=a[s];if(o&&t?.reasons?.some(u=>u===o))return{key:s,category:n,errorMSG:t.errorMSG,matchedByReason:!0};if(t?.keywords?.some(u=>r?.toLowerCase().includes(u.toLowerCase().trim())))return{key:s,category:n,errorMSG:t.errorMSG,matchedByReason:!1}}}return null}function F({reason:o,message:r}){return E({reason:o,message:r})?.errorMSG??p}import{BaseError as _}from"viem";import{appConfig as D}from"@berachain/config/internal";import{AtomicReadyWalletRejectedUpgradeError as I,BaseError as M,ContractFunctionExecutionError as x,ContractFunctionRevertedError as X,decodeErrorResult as T,HttpRequestError as b,RpcRequestError as N,TransactionExecutionError as k,UserRejectedRequestError as O}from"viem";var h=[{inputs:[],name:"AlreadyInitiated",type:"error"},{inputs:[],name:"EmptyBundle",type:"error"},{inputs:[],name:"IncorrectReenterHash",type:"error"},{inputs:[],name:"MissingExpectedReenter",type:"error"}];var m=[{inputs:[],name:"AllowanceOverflow",type:"error"},{inputs:[],name:"AllowanceUnderflow",type:"error"},{inputs:[],name:"ETHTransferFailed",type:"error"},{inputs:[],name:"InsufficientAllowance",type:"error"},{inputs:[],name:"InsufficientBalance",type:"error"},{inputs:[],name:"InvalidPermit",type:"error"},{inputs:[],name:"Permit2AllowanceIsFixedAtInfinity",type:"error"},{inputs:[],name:"PermitExpired",type:"error"},{inputs:[],name:"TotalSupplyOverflow",type:"error"},{name:"AllowanceOverflow",type:"error",inputs:[]},{name:"AllowanceUnderflow",type:"error",inputs:[]},{name:"InsufficientAllowance",type:"error",inputs:[]},{name:"InsufficientBalance",type:"error",inputs:[]},{name:"InvalidPermit",type:"error",inputs:[]},{name:"Permit2AllowanceIsFixedAtInfinity",type:"error",inputs:[]},{name:"PermitExpired",type:"error",inputs:[]},{name:"TotalSupplyOverflow",type:"error",inputs:[]},{name:"ECDSAInvalidSignature",type:"error",inputs:[]},{name:"ECDSAInvalidSignatureLength",type:"error",inputs:[{type:"uint256"}]},{name:"ECDSAInvalidSignatureS",type:"error",inputs:[{type:"bytes32"}]},{name:"ERC20InsufficientAllowance",type:"error",inputs:[{type:"address"},{type:"uint256"},{type:"uint256"}]},{name:"ERC20InsufficientBalance",type:"error",inputs:[{type:"address"},{type:"uint256"},{type:"uint256"}]},{name:"ERC20InvalidApprover",type:"error",inputs:[{type:"address"}]},{name:"ERC20InvalidReceiver",type:"error",inputs:[{type:"address"}]},{name:"ERC20InvalidSender",type:"error",inputs:[{type:"address"}]},{name:"ERC20InvalidSpender",type:"error",inputs:[{type:"address"}]},{name:"ERC2612ExpiredSignature",type:"error",inputs:[{type:"uint256"}]},{name:"ERC2612InvalidSigner",type:"error",inputs:[{type:"address"},{type:"address"}]},{name:"InvalidAccountNonce",type:"error",inputs:[{type:"address"},{type:"uint256"}]},{name:"InvalidShortString",type:"error",inputs:[]},{name:"StringTooLong",type:"error",inputs:[{type:"string"}]}];var L=[{name:"AllowanceExpired",type:"error",inputs:[{type:"uint256"}]},{name:"AssetNotRegistered",type:"error",inputs:[{type:"address"}]},{name:"ERC20InsufficientAllowance",type:"error",inputs:[{type:"address"},{type:"uint256"},{type:"uint256"}]},{name:"ERC4626ExceededMaxWithdraw",type:"error",inputs:[{type:"address"},{type:"uint256"},{type:"uint256"}]},{name:"ERC721NonexistentToken",type:"error",inputs:[{type:"uint256"}]},{name:"ExecutionFailed",type:"error",inputs:[{type:"uint256"},{type:"address"},{type:"string"}]},{name:"ExpiredTransaction",type:"error",inputs:[]},{name:"FailedToCallFunction",type:"error",inputs:[{type:"bytes"}]},{name:"InsufficientAmountOut",type:"error",inputs:[]},{name:"MinimalOutputBalanceViolation",type:"error",inputs:[{type:"address"},{type:"uint256"}]},{name:"NotPegged",type:"error",inputs:[{type:"address"}]},{name:"RedeemMoreThanMax",type:"error",inputs:[]},{name:"SignatureExpired",type:"error",inputs:[{type:"uint256"}]},{name:"SlippageExceeded",type:"error",inputs:[{type:"uint256"},{type:"uint256"}]},{name:"SlippageExceeded",type:"error",inputs:[]},{name:"StalePrice",type:"error",inputs:[]},{name:"TooMuchSlippage",type:"error",inputs:[{type:"address"},{type:"uint256"},{type:"uint256"}]},{name:"TransferFromFailed",type:"error",inputs:[]},{name:"UnexpectedBasketModeStatus",type:"error",inputs:[]},{name:"zeroAmountRequired",type:"error",inputs:[]}];var S=[...m,...h,...L];function g(o){return o instanceof M||o instanceof Error&&"shortMessage"in o&&"message"in o&&"details"in o}function l(o,r,n){return o instanceof n||o.name===r}function P(o){return o.errorName==="Error"&&Array.isArray(o.args)&&o.args?.at(0)?o.args?.at(0):o.errorName}function f({error:o,abi:r,revertIfUnknown:n=!0}){if(!g(o)){if(n)throw o;return o instanceof M?{reason:o.shortMessage,rootCause:o}:{reason:o.message,rootCause:o}}let e=o;for(;g(e);){if(l(e,"ContractFunctionExecutionError",x)){e=e.cause;continue}if(l(e,"TransactionExecutionError",k)&&e.cause instanceof I)return{reason:"AtomicReadyWalletRejectedUpgradeError",rootCause:e.cause};if(l(e,"RpcRequestError",N)){if(!e.data){if(typeof e.cause=="object"&&e.cause&&"message"in e.cause&&typeof e.cause.message=="string")return{reason:e.cause.message,rootCause:e.cause};throw new Error("No data",{cause:e})}let a=T({data:e.data,abi:[...S,...r??[]]});return{reason:P(a)??e.shortMessage,rootCause:e}}if(l(e,"ContractFunctionRevertedError",X))return{reason:e.reason??e.signature??e.data?.errorName??e.shortMessage,rootCause:e};if(l(e,"UserRejectedRequestError",O))return{reason:"UserRejectedRequestError",rootCause:e};if(l(e,"HttpRequestError",b))return{reason:`HttpRequestError(status:${e.status})`,rootCause:e,isRequestError:!0};if(!e.cause)return{reason:e.name,rootCause:e};e=e.cause}if(!n)return{reason:void 0,rootCause:e};throw new Error("UnknownErrorInGetRevertReason",{cause:e})}function y(o){switch(o){case"UserRejectedRequestError":case 4001:return"UserRejectedRequestError";default:return`RPC_ERROR_${o}`}}var d=class o extends Error{displayMessage;cause;chainId;reason=null;fingerprint;_tags={};set tags(r){this._tags=r}get tags(){return{...this._tags,"error.displayMessage":this.displayMessage,"error.reason":this.reason,"error.level":this.level}}level="error";extra={};constructor({message:r,displayMessage:n,cause:e,reason:a,level:s,abi:t,tags:u,chainId:v,fingerprint:C}){let c=r;if(c||(e instanceof _?c=e.shortMessage:(e instanceof Error||typeof e=="object"&&e!==null&&"message"in e&&typeof e.message=="string")&&(c=e.message)),super(c,{cause:e}),this.name="BeraError",this.fingerprint=C,this.cause=e,this.chainId=v,a)this.reason=a;else if(e instanceof Error)try{let i=f({error:e,revertIfUnknown:!0,abi:t});this.reason=i?.reason??null}catch{}s?this.level=s:this.reason===y("UserRejectedRequestError")?this.level="info":this.level="error";let A=n;if(this.cause instanceof o&&this.cause.displayMessage!==p&&(A=this.cause.displayMessage),!A){let i=E(this);A=i?.errorMSG,i&&!i.matchedByReason&&this.reason&&(this.reason=i.key)}this.displayMessage=A??p,this.tags={...this.tags,...u},!D.env.isProduction&&process.env.NODE_ENV!=="test"&&(console.group("BeraError thrown"),console.debug("Level",this.level),console.debug("Reason",this.reason),console.debug("Message",this.message),console.debug("Display Message",this.displayMessage),console.debug("Cause",this.cause),console.groupEnd())}};import{mainnet as G}from"@berachain/config/mainnet";var R=class o extends d{response;static isCorsError(r){return r.cause instanceof Response&&r.cause.type==="cors"}endpoint;queryRichfulDomains=[G.bex.aggregatorsProxyUrl,"https://api.fly.trade/aggregator/quote","https://open-api.openocean.finance/v4/bera/swap","/api/aggregators?aggregator",G.bonder];statusCode;payload;static REASON_MAP={429:"RATE_LIMITED_429",NETWORK_ERROR:"NETWORK_ERROR",CORS_ERROR:"CORS"};constructor(r){if(super(r),this.name="RequestError",this.response=r.response,this.payload=r.payload,this.endpoint=this.setEndpoint(r.endpoint),!this.message&&typeof this.cause=="object"&&this.cause!==null&&"error"in this.cause&&typeof this.cause.error=="string"&&(this.message=this.cause.error),r.statusCode?this.statusCode=r.statusCode:this.response instanceof Response&&(this.statusCode=this.response.status),this.statusCode===429)this.reason=o.REASON_MAP[429],this.displayMessage=B.HTTP.RATE_LIMITED_429.errorMSG,this.level=r.level??"warning";else{let a=this.tryMatchNetworkError();a&&(this.reason=this.reason??a.reason,this.level=r.level??"warning",this.endpoint.url=this.endpoint.url??a.url)}this.tags={...this.tags,"error.statusCode":this.statusCode,"operation.type":"query",...r.tags};let n="";this.reason?n+=`${this.reason} \u2013 `:this.statusCode&&this.statusCode>=400&&(n+=`HTTP ${this.statusCode} \u2013 `);let e=this.endpoint.type?`${this.endpoint.type}(${this.endpoint.url})`:this.endpoint.url;this.message=`${n}${e}: ${this.message}`}setEndpoint(r){if(typeof r=="string"||r instanceof URL?this.endpoint={url:typeof r=="string"?r:r.toString()}:this.endpoint={...this.endpoint,...r,url:r.url.toString()},this.queryRichfulDomains.some(n=>this.endpoint.url.includes(n)))try{let n=new URL(this.endpoint.url);n.search="",this.endpoint.url=n.toString()}catch{}return this.tags={...this.tags,"operation.source.url":this.endpoint.url,"operation.source.name":this.endpoint.name,"operation.source.type":this.endpoint.type},this.endpoint}tryMatchNetworkError(){if(this.cause instanceof Error&&"message"in this.cause&&typeof this.cause.message=="string"||this.cause instanceof TypeError){let r=this.cause.message;if(r.startsWith("Network Error"))return{reason:o.REASON_MAP.NETWORK_ERROR,message:r,url:this.endpoint.url};let n=r.match(/^(?:NetworkError when attempting to fetch resource\.|Failed to fetch|Load failed) \(([a-z0-9-.]+)\)$/);if(n)return{reason:o.REASON_MAP.NETWORK_ERROR,message:r,url:n[1]}}if(typeof this.cause=="object"&&this.cause!==null&&"message"in this.cause&&typeof this.cause.message=="string"){let r=this.cause.message;if(r.startsWith("error: canceling statement due to lock timeout occurred in"))return{reason:o.REASON_MAP.NETWORK_ERROR,message:r,url:this.endpoint.url}}return!1}};var w=class extends d{property;value;expected;constructor(r){super(r),this.level=r.level??"warning",this.name="InvalidArgumentError",this.property=r.property,this.value=r.value,this.expected=r.expected,this.message=`Invalid argument: ${this.property} ${this.isMissing?"is missing":`is invalid, expected ${this.expected}`}`,r.reason||(this.reason=`${this.name}.${this.property}.${this.isInvalid?"invalid":"missing"}`)}get isMissing(){return this.value===void 0}get isInvalid(){return this.value!==void 0}};export{E as a,F as b,S as c,P as d,f as e,d as f,R as g,w as h};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
var p="Something went wrong. Please try again later.",B={ERC20:{NOT_ENOUGH_BALANCE:{reasons:["NotEnoughBalance"],errorMSG:"You do not have enough balance to perform this action."},InsufficientBalance:{reasons:["InsufficientBalance"],errorMSG:"Insufficient token balance"},INSUFFICIENT_ALLOWANCE:{reasons:["0x13be252b","InsufficientAllowance","ERC20InsufficientAllowance"],errorMSG:"You do not have enough allowance to perform this action."},SIGNATURE_EXPIRED:{reasons:["SignatureExpired"],errorMSG:"Transaction took too long to complete. Please try again."}},HTTP:{RATE_LIMITED_429:{reasons:["429"],errorMSG:"Too many requests. Please try again later."}},ENSO:{COULD_NOT_BUILD_SHORTCUT:{keywords:["Could not build shortcuts for route","Could not quote shortcuts for route"],errorMSG:"There was an error building the zap route. Try with lower amounts."},NOT_ENOUGH_LIQUIDITY:{keywords:["Swap not found for a required underlying of defi route, please make sure your amountIn is within an acceptable range"],errorMSG:"The amount you\u2019re trying to swap might be too high. Please make sure that your amount is within an acceptable range."},NO_ROUTE_FOUND:{keywords:["No route found from"],errorMSG:"No swap route found for the given tokens."}},RPC:{NOT_ENOUGH_GAS_TOKEN:{reasons:["InsufficientFundsError"],keywords:["insufficient funds for gas * price + value:","The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."],errorMSG:"Insufficient BERA balance to perform this action."},NONCE_TOO_LOW:{keywords:["nonce too low: next nonce"],errorMSG:"Nonce is too low. Your wallet might have unconfirmed transactions."},GAS_PRICE:{keywords:["gasLimit"],errorMSG:"It seems an RPC error has occurred while estimating gas. Please try your request later."},JSON_RPC:{keywords:["JSON-RPC"],errorMSG:"It seems an RPC error has occurred. Please try your request one more later."},HASH:{keywords:["hash"],errorMSG:"It seems an RPC error has occurred. Please check if your transaction was finalized. If not, please try again."},USER_REJECTION:{reasons:["UserRejectedRequestError"],keywords:["User denied transaction signature"],errorMSG:"You rejected the transaction."},SMART_UPGRADE_REJECTION:{reasons:["AtomicReadyWalletRejectedUpgradeError"],errorMSG:"You've declined to upgrade to batch transactions for now, try again for the traditional method."},CHAIN_MISMATCH:{reasons:["ChainMismatchError"],errorMSG:"Wallet seems to be on the wrong chain, please refresh the page and try again."}},EIP7702:{SESSION_KEY_EXPIRED:{reasons:["SessionKeyExpired"],errorMSG:"Session key has expired. Please create a new one."},CALL_POLICY_VIOLATED:{reasons:["CallPolicyViolated"],errorMSG:"Call policy violated. Please check your call policies."}},HONEY:{BLACKLISTED_WALLET:{reasons:["BlacklistedWallet","0x265693b4"],errorMSG:"Your wallet is blacklisted from minting or redeeming HONEY."},LIQUIDITY_ERROR:{reasons:["0x4656425a"],errorMSG:"You are trying to redeem more than the liquidity available in the vault."}},BEX:{SLIPPAGE_EXCEEDED:{reasons:["SlippageExceeded","TooMuchSlippage"],errorMSG:"Price changed while executing the transaction and exceeded the allowed slippage."},BAL000:{reasons:["BAL#000"],errorMSG:"Addition overflow occurred during calculation. (BEX#000)"},BAL001:{reasons:["BAL#001"],errorMSG:"Subtraction overflow occurred during calculation. (BEX#001)"},BAL002:{reasons:["BAL#002"],errorMSG:"Subtraction underflow occurred during calculation. (BEX#002)"},BAL003:{reasons:["BAL#003"],errorMSG:"Multiplication overflow occurred during calculation. (BEX#003)"},BAL004:{reasons:["BAL#004"],errorMSG:"Attempted division by zero. (BEX#004)"},BAL005:{reasons:["BAL#005"],errorMSG:"Multiplication overflow during FixedPoint Division. (BEX#005)"},BAL006:{reasons:["BAL#006"],errorMSG:"Invalid x in ExpMath.pow(x, y). (BEX#006)"},BAL007:{reasons:["BAL#007"],errorMSG:"Invalid y in ExpMath.pow(x, y). (BEX#007)"},BAL008:{reasons:["BAL#008"],errorMSG:"In LogExpMath.pow(x, y), error computing x^y as exp(y * ln(x)). (BEX#008)"},BAL009:{reasons:["BAL#009"],errorMSG:"In LogExpMath.exp(x) = e^x; x out of bounds. (BEX#009)"},BAL100:{reasons:["BAL#100"],errorMSG:"Value is out of acceptable bounds. (BEX#100)"},BAL101:{reasons:["BAL#101"],errorMSG:"Tokens must be sorted in address order on pool registration. (BEX#101)"},BAL102:{reasons:["BAL#102"],errorMSG:"Tokens must be sorted in address order on pool registration. (BEX#102)"},BAL103:{reasons:["BAL#103"],errorMSG:"Parallel array inputs must have the same length. (BEX#103)"},BAL104:{reasons:["BAL#104"],errorMSG:"Address to be interpreted as a token cannot be 0. (BEX#104)"},BAL105:{reasons:["BAL#105"],errorMSG:"Insufficient byte length. (BEX#105)"},BAL200:{reasons:["BAL#200"],errorMSG:"All pools must contain at least two tokens. (BEX#200)"},BAL201:{reasons:["BAL#201"],errorMSG:"Token count exceeds the maximum for a given pool type. (BEX#201)"},BAL202:{reasons:["BAL#202"],errorMSG:"Swap fee percentage exceeds the maximum allowed. (BEX#202)"},BAL203:{reasons:["BAL#203"],errorMSG:"Swap fee percentage is below the minimum allowed. (BEX#203)"},BAL204:{reasons:["BAL#204"],errorMSG:"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)"},BAL205:{reasons:["BAL#205"],errorMSG:"User attempted to execute a callback intended for the vault contract. (BEX#205)"},BAL206:{reasons:["BAL#206"],errorMSG:"Pools must be initialized with a special 'Init' join, before they can be joined by LPs. (BEX#206)"},BAL207:{reasons:["BAL#207"],errorMSG:"Slippage/front-running protection check failed on a pool exit. (BEX#207)"},BAL208:{reasons:["BAL#208"],errorMSG:"Minimum BPT output amount not met. (BEX#208)"},BAL209:{reasons:["BAL#209"],errorMSG:"Slippage/front-running protection check failed on a pool join. (BEX#209)"},BAL210:{reasons:["BAL#210"],errorMSG:"Pools with oracles are limited to two tokens. A pool with the TWO_TOKEN specialization must have exactly two tokens. (BEX#210)"},BAL211:{reasons:["BAL#211"],errorMSG:"The pool factory is disabled and new pools cannot be created at this time. (BEX#211)"},BAL300:{reasons:["BAL#300"],errorMSG:"The amplification parameter is below the minimum allowed. (BEX#300)"},BAL301:{reasons:["BAL#301"],errorMSG:"The amplification parameter exceeds the maximum allowed. (BEX#301)"},BAL302:{reasons:["BAL#302"],errorMSG:"The weight parameter is below the minimum allowed. (BEX#302)"},BAL303:{reasons:["BAL#303"],errorMSG:"The number of stable tokens exceeds the maximum allowed. (BEX#303)"},BAL304:{reasons:["BAL#304"],errorMSG:"The amount of tokens in would unbalance the pool. (BEX#304)"},BAL305:{reasons:["BAL#305"],errorMSG:"The amount of tokens out would unbalance the pool. (BEX#305)"},BAL306:{reasons:["BAL#306"],errorMSG:"Disproportionate pool exit would unbalance the pool. (BEX#306)"},BAL307:{reasons:["BAL#307"],errorMSG:"Disproportionate pool join would unbalance the pool. (BEX#307)"},BAL308:{reasons:["BAL#308"],errorMSG:"Normalized weights do not add to 1.0 exactly. (BEX#308)"},BAL309:{reasons:["BAL#309"],errorMSG:"Invalid token provided for operation. (BEX#309)"},BAL310:{reasons:["BAL#310"],errorMSG:"Unhandled pool join operation for this pool type. (BEX#310)"},BAL311:{reasons:["BAL#311"],errorMSG:"Pool balances must be > 0. (BEX#311)"},BAL312:{reasons:["BAL#312"],errorMSG:"Invalid query for oracle data ('ago' timestamp was not in the past). (BEX#312)"},BAL313:{reasons:["BAL#313"],errorMSG:"Oracle has no data to query. (BEX#313)"},BAL314:{reasons:["BAL#314"],errorMSG:"Oracle query data is before its earliest data sample. (BEX#314)"},BAL315:{reasons:["BAL#315"],errorMSG:"Cannot query an oracle sample outside the buffer of 1024. (BEX#315)"},BAL316:{reasons:["BAL#316"],errorMSG:"Oracle query window must have non-zero duration. (BEX#316)"},BAL317:{reasons:["BAL#317"],errorMSG:"Amplification parameter change has less than the minimum duration. (BEX#317)"},BAL318:{reasons:["BAL#318"],errorMSG:"Cannot start an amplification parameter update if one is already ongoing. (BEX#318)"},BAL319:{reasons:["BAL#319"],errorMSG:"The requested amplification parameter change is too fast (cannot halve or double over less than a day). (BEX#319)"},BAL320:{reasons:["BAL#320"],errorMSG:"Cannot cancel an update if there isn't one already ongoing. (BEX#320)"},BAL321:{reasons:["BAL#321"],errorMSG:"Stable pool invariant calculation did not converge. (BEX#321)"},BAL322:{reasons:["BAL#322"],errorMSG:"Stable pool balance calculation did not converge. (BEX#322)"},BAL323:{reasons:["BAL#323"],errorMSG:"Relayer must be a valid contract. (BEX#323)"},BAL324:{reasons:["BAL#324"],errorMSG:"Base pool relayer was not called correctly. (BEX#324)"},BAL325:{reasons:["BAL#325"],errorMSG:"Rebalancing relayer operation re-entered unexpectedly. (BEX#325)"},BAL326:{reasons:["BAL#326"],errorMSG:"Detected time travel in gradual updates (start > end time in a gradual weights update). (BEX#326)"},BAL327:{reasons:["BAL#327"],errorMSG:"Swaps are disabled for this pool. (BEX#327)"},BAL328:{reasons:["BAL#328"],errorMSG:"Caller is not the owner of the LBP. (BEX#328)"},BAL329:{reasons:["BAL#329"],errorMSG:"Rate returned from a rateProvider must fit within 128 bits. (BEX#329)"},BAL330:{reasons:["BAL#330"],errorMSG:"Investment pools only allow proportional joins and exits when swaps are disabled (to prevent unbalancing the pool). (BEX#330)"},BAL331:{reasons:["BAL#331"],errorMSG:"Gradual weight update duration too short (minimum 1 day). (BEX#331)"},BAL332:{reasons:["BAL#332"],errorMSG:"Invalid Linear Pool operating range. (BEX#332)"},BAL333:{reasons:["BAL#333"],errorMSG:"Linear Pool max balance must fit in 112 bits. (BEX#333)"},BAL334:{reasons:["BAL#334"],errorMSG:"Unhandled pool join/exit operation for linear pool type. (BEX#334)"},BAL335:{reasons:["BAL#335"],errorMSG:"Cannot reset Linear Pool targets if pool is unbalanced. (BEX#335)"},BAL336:{reasons:["BAL#336"],errorMSG:"Unhandled pool exit operation for this pool type. (BEX#336)"},BAL337:{reasons:["BAL#337"],errorMSG:"Management fees can only be collected by the pool owner. (BEX#337)"},BAL338:{reasons:["BAL#338"],errorMSG:"Management swap fee percentage exceeded the maximum. (BEX#338)"},BAL339:{reasons:["BAL#339"],errorMSG:"Unhandled pool join/exit operation for managed pool type. (BEX#339)"},BAL340:{reasons:["BAL#340"],errorMSG:"Unhandled pool join/exit operation for phantom pool type. (BEX#340)"},BAL341:{reasons:["BAL#341"],errorMSG:"Token does not have a valid rate provider. (BEX#341)"},BAL342:{reasons:["BAL#342"],errorMSG:"Invalid pool initialization parameters provided. (BEX#342)"},BAL343:{reasons:["BAL#343"],errorMSG:"Value is out of the new target range for the operation. (BEX#343)"},BAL344:{reasons:["BAL#344"],errorMSG:"This feature is currently disabled. (BEX#344)"},BAL345:{reasons:["BAL#345"],errorMSG:"The pool controller is uninitialized. (BEX#345)"},BAL346:{reasons:["BAL#346"],errorMSG:"Cannot set swap fee during an ongoing fee change. (BEX#346)"},BAL347:{reasons:["BAL#347"],errorMSG:"Cannot set swap fee during pending fee changes. (BEX#347)"},BAL348:{reasons:["BAL#348"],errorMSG:"Cannot change tokens during a weight change. (BEX#348)"},BAL349:{reasons:["BAL#349"],errorMSG:"Cannot change tokens during pending weight changes. (BEX#349)"},BAL350:{reasons:["BAL#350"],errorMSG:"Weight parameter exceeds the maximum allowed. (BEX#350)"},BAL351:{reasons:["BAL#351"],errorMSG:"Unauthorized join operation. (BEX#351)"},BAL352:{reasons:["BAL#352"],errorMSG:"Management AUM fee percentage exceeded the maximum allowed. (BEX#352)"},BAL353:{reasons:["BAL#353"],errorMSG:"Fractional target values are not supported. (BEX#353)"},BAL354:{reasons:["BAL#354"],errorMSG:"Adding or removing BPT is not allowed in this context. (BEX#354)"},BAL355:{reasons:["BAL#355"],errorMSG:"Invalid circuit breaker bounds configuration. (BEX#355)"},BAL356:{reasons:["BAL#356"],errorMSG:"The circuit breaker has been triggered. (BEX#356)"},BAL357:{reasons:["BAL#357"],errorMSG:"Malicious query detected and reverted. (BEX#357)"},BAL358:{reasons:["BAL#358"],errorMSG:"Joins and exits are currently disabled for this pool. (BEX#358)"},BAL400:{reasons:["BAL#400"],errorMSG:"Reentrancy detected. (BEX#400)"},BAL401:{reasons:["BAL#401"],errorMSG:"The sender is not allowed to perform this action. (BEX#401)"},BAL402:{reasons:["BAL#402"],errorMSG:"The contract is currently paused. (BEX#402)"},BAL403:{reasons:["BAL#403"],errorMSG:"The pause window has expired. (BEX#403)"},BAL404:{reasons:["BAL#404"],errorMSG:"The maximum pause window duration has been exceeded. (BEX#404)"},BAL405:{reasons:["BAL#405"],errorMSG:"The maximum buffer period duration has been exceeded. (BEX#405)"},BAL406:{reasons:["BAL#406"],errorMSG:"The account has insufficient balance. (BEX#406)"},BAL407:{reasons:["BAL#407"],errorMSG:"The account has insufficient allowance. (BEX#407)"},BAL408:{reasons:["BAL#408"],errorMSG:"ERC20: Transfer from zero address. (BEX#408)"},BAL409:{reasons:["BAL#409"],errorMSG:"ERC20: Transfer to zero address. (BEX#409)"},BAL410:{reasons:["BAL#410"],errorMSG:"ERC20: Mint to zero address. (BEX#410)"},BAL411:{reasons:["BAL#411"],errorMSG:"ERC20: Burn from zero address. (BEX#411)"},BAL412:{reasons:["BAL#412"],errorMSG:"ERC20: Approve from zero address. (BEX#412)"},BAL413:{reasons:["BAL#413"],errorMSG:"ERC20: Approve to zero address. (BEX#413)"},BAL414:{reasons:["BAL#414"],errorMSG:"ERC20: Transfer exceeds allowance. (BEX#414)"},BAL415:{reasons:["BAL#415"],errorMSG:"ERC20: Decreased allowance below zero. (BEX#415)"},BAL416:{reasons:["BAL#416"],errorMSG:"ERC20: Transfer exceeds balance. (BEX#416)"},BAL417:{reasons:["BAL#417"],errorMSG:"ERC20: Burn exceeds allowance. (BEX#417)"},BAL418:{reasons:["BAL#418"],errorMSG:"SafeERC20: Call failed. (BEX#418)"},BAL419:{reasons:["BAL#419"],errorMSG:"Address has insufficient balance. (BEX#419)"},BAL420:{reasons:["BAL#420"],errorMSG:"Address cannot send value. (BEX#420)"},BAL421:{reasons:["BAL#421"],errorMSG:"SafeCast: Value cannot fit into int256. (BEX#421)"},BAL422:{reasons:["BAL#422"],errorMSG:"AccessControl: Grant sender is not an admin. (BEX#422)"},BAL423:{reasons:["BAL#423"],errorMSG:"AccessControl: Revoke sender is not an admin. (BEX#423)"},BAL424:{reasons:["BAL#424"],errorMSG:"AccessControl: Renounce sender not allowed for accounts other than self. (BEX#424)"},BAL425:{reasons:["BAL#425"],errorMSG:"Buffer period has expired. (BEX#425)"},BAL426:{reasons:["BAL#426"],errorMSG:"Caller is not the owner. (BEX#426)"},BAL427:{reasons:["BAL#427"],errorMSG:"New owner cannot be zero address. (BEX#427)"},BAL428:{reasons:["BAL#428"],errorMSG:"Code deployment failed. (BEX#428)"},BAL429:{reasons:["BAL#429"],errorMSG:"Call to non-contract address. (BEX#429)"},BAL430:{reasons:["BAL#430"],errorMSG:"Low-level call failed. (BEX#430)"},BAL431:{reasons:["BAL#431"],errorMSG:"The contract is not paused. (BEX#431)"},BAL432:{reasons:["BAL#432"],errorMSG:"Address is already allowlisted. (BEX#432)"},BAL433:{reasons:["BAL#433"],errorMSG:"Address is not allowlisted. (BEX#433)"},BAL434:{reasons:["BAL#434"],errorMSG:"ERC20: Burn exceeds balance. (BEX#434)"},BAL435:{reasons:["BAL#435"],errorMSG:"Invalid operation. (BEX#435)"},BAL436:{reasons:["BAL#436"],errorMSG:"Codec overflow detected. (BEX#436)"},BAL437:{reasons:["BAL#437"],errorMSG:"The system is in recovery mode. (BEX#437)"},BAL438:{reasons:["BAL#438"],errorMSG:"The system is not in recovery mode. (BEX#438)"},BAL439:{reasons:["BAL#439"],errorMSG:"Induced failure. (BEX#439)"},BAL440:{reasons:["BAL#440"],errorMSG:"Expired signature. (BEX#440)"},BAL441:{reasons:["BAL#441"],errorMSG:"Malformed signature. (BEX#441)"},BAL442:{reasons:["BAL#442"],errorMSG:"SafeCast: Value cannot fit into uint64. (BEX#442)"},BAL443:{reasons:["BAL#443"],errorMSG:"Unhandled fee type. (BEX#443)"},BAL444:{reasons:["BAL#444"],errorMSG:"ERC20: Burn from zero address. (BEX#444)"},BAL500:{reasons:["BAL#500"],errorMSG:"Invalid pool ID. (BEX#500)"},BAL501:{reasons:["BAL#501"],errorMSG:"Caller is not the pool. (BEX#501)"},BAL502:{reasons:["BAL#502"],errorMSG:"Sender is not the asset manager. (BEX#502)"},BAL503:{reasons:["BAL#503"],errorMSG:"User does not allow the relayer. (BEX#503)"},BAL504:{reasons:["BAL#504"],errorMSG:"Invalid signature. (BEX#504)"},BAL505:{reasons:["BAL#505"],errorMSG:"Exit would yield fewer than the minimum tokens out. (BEX#505)"},BAL506:{reasons:["BAL#506"],errorMSG:"Join would cost more than the maximum tokens in. (BEX#506)"},BAL507:{reasons:["BAL#507"],errorMSG:"Swap violates user-supplied limits. (BEX#507)"},BAL508:{reasons:["BAL#508"],errorMSG:"Swap transaction not mined within the deadline. (BEX#508)"},BAL509:{reasons:["BAL#509"],errorMSG:"Cannot swap the same token. (BEX#509)"},BAL510:{reasons:["BAL#510"],errorMSG:"Unknown amount in the first swap of a batch. (BEX#510)"},BAL511:{reasons:["BAL#511"],errorMSG:"Malconstructed multihop swap. (BEX#511)"},BAL512:{reasons:["BAL#512"],errorMSG:"Internal balance overflow. (BEX#512)"},BAL513:{reasons:["BAL#513"],errorMSG:"Insufficient internal balance. (BEX#513)"},BAL514:{reasons:["BAL#514"],errorMSG:"Invalid BERA internal balance. (BEX#514)"},BAL515:{reasons:["BAL#515"],errorMSG:"Flashloan must repay the loan in the same transaction. (BEX#515)"},BAL516:{reasons:["BAL#516"],errorMSG:"Insufficient BERA balance. (BEX#516)"},BAL517:{reasons:["BAL#517"],errorMSG:"Unallocated BERA. (BEX#517)"},BAL518:{reasons:["BAL#518"],errorMSG:"Relayers cannot receive BERA directly (only through the Vault). (BEX#518)"},BAL519:{reasons:["BAL#519"],errorMSG:"Cannot use BERA sentinel for internal balance. (BEX#519)"},BAL520:{reasons:["BAL#520"],errorMSG:"Tokens mismatch. (BEX#520)"},BAL521:{reasons:["BAL#521"],errorMSG:"Token is not registered. (BEX#521)"},BAL522:{reasons:["BAL#522"],errorMSG:"Token is already registered. (BEX#522)"},BAL523:{reasons:["BAL#523"],errorMSG:"Tokens are already set. (BEX#523)"},BAL524:{reasons:["BAL#524"],errorMSG:"Tokens length must be 2. (BEX#524)"},BAL525:{reasons:["BAL#525"],errorMSG:"Nonzero token balance detected. (BEX#525)"},BAL526:{reasons:["BAL#526"],errorMSG:"Balance total overflow detected. (BEX#526)"},BAL527:{reasons:["BAL#527"],errorMSG:"Pool has no tokens. (BEX#527)"},BAL528:{reasons:["BAL#528"],errorMSG:"Insufficient flash loan balance. (BEX#528)"},BAL600:{reasons:["BAL#600"],errorMSG:"Swap fee percentage is too high. (BEX#600)"},BAL601:{reasons:["BAL#601"],errorMSG:"Flash loan fee percentage is too high. (BEX#601)"},BAL602:{reasons:["BAL#602"],errorMSG:"Insufficient flash loan fee amount. (BEX#602)"},BAL700:{reasons:["BAL#700"],errorMSG:"Splitter fee percentage is too high. (BEX#700)"},BAL998:{reasons:["BAL#998"],errorMSG:"Unimplemented functionality. (BEX#998)"},BAL999:{reasons:["BAL#999"],errorMSG:"An unexpected error occurred. (BEX#999)"},NO_SWAP_PATHS:{keywords:["No swap paths returned"],errorMSG:"No swap paths were found."}},AGGREGATOR:{NOT_ENOUGH_LIQUIDITY:{keywords:["Not enough liquidity"],errorMSG:"Not enough liquidity. Try a lower amount."}},POL:{REWARD_VAULT_FACTORY:{reasons:["VaultAlreadyExists"],errorMSG:"Failed to create action. An action already exists with this staking token."},NOT_REWARD_VAULT_MANAGER:{reasons:["NotRewardVaultManager"],errorMSG:"You are not the manager of this action."},NOT_INCENTIVE_MANAGER:{reasons:["NotIncentiveManager"],errorMSG:"You are not the incentive manager of this token."},DURATION_CHANGE_NOT_ALLOWED:{reasons:["DurationChangeNotAllowed"],errorMSG:"You cannot change the duration of this action."},INVALID_PROOF:{reasons:["InvalidProof"],errorMSG:"Tokens already claimed or invalid proof."},CONTRACT_PAUSED:{reasons:["EnforcedPause"],errorMSG:"The contract you're interacting with is temporarily paused."},DISTRIBUTION_PAUSED:{reasons:["DistributionEnforcedPause"],errorMSG:"Distribution is temporarily paused."},INVALID_VALIDATOR_COMMISSION:{reasons:["InvalidCommissionValue"],errorMSG:"Invalid commission percentage."},NOT_REWARD_ALLOCATOR:{reasons:["NotRewardAllocator"],errorMSG:"You are not the reward allocator of this validator."},NOT_OPERATOR:{reasons:["NotOperator"],errorMSG:"You are not the operator of this validator."},INVALID_REWARD_ALLOCATION:{reasons:["InvalidRewardAllocationWeights"],errorMSG:"Invalid reward allocation weights."},NOT_REWARD_DURATION_MANAGER:{reasons:["NotRewardDurationManager"],errorMSG:"You are not the reward duration manager of this validator."}},BEND:{INSUFFICIENT_POSITION:{keywords:["insufficient position"],errorMSG:"Insufficient position"},INSUFFICIENT_LIQUIDITY:{keywords:["insufficient liquidity on market"],errorMSG:"Insufficient liquidity on market."},ALL_CAPS_REACHED:{reasons:["AllCapsReached"],errorMSG:"All caps reached on vault."},AboveMaxTimelock:{reasons:["AboveMaxTimelock"],errorMSG:"Above max timelock"},AddressEmptyCode:{reasons:["AddressEmptyCode"],errorMSG:"Address empty code"},AddressInsufficientBalance:{reasons:["AddressInsufficientBalance"],errorMSG:"Address insufficient balance"},AllCapsReached:{reasons:["AllCapsReached"],errorMSG:"All caps reached"},AlreadyPending:{reasons:["AlreadyPending"],errorMSG:"Already pending"},AlreadySet:{reasons:["AlreadySet"],errorMSG:"Already set"},BelowMinTimelock:{reasons:["BelowMinTimelock"],errorMSG:"Below min timelock"},DuplicateMarket:{reasons:["DuplicateMarket"],errorMSG:"Duplicate market"},ECDSAInvalidSignature:{reasons:["ECDSAInvalidSignature"],errorMSG:"Invalid ECDSA signature"},ECDSAInvalidSignatureLength:{reasons:["ECDSAInvalidSignatureLength"],errorMSG:"Invalid ECDSA signature length"},ECDSAInvalidSignatureS:{reasons:["ECDSAInvalidSignatureS"],errorMSG:"Invalid ECDSA signature S value"},ERC20InsufficientBalance:{reasons:["ERC20InsufficientBalance"],errorMSG:"ERC20 insufficient balance"},ERC20InvalidApprover:{reasons:["ERC20InvalidApprover"],errorMSG:"ERC20 invalid approver"},ERC20InvalidReceiver:{reasons:["ERC20InvalidReceiver"],errorMSG:"ERC20 invalid receiver"},ERC20InvalidSender:{reasons:["ERC20InvalidSender"],errorMSG:"ERC20 invalid sender"},ERC20InvalidSpender:{reasons:["ERC20InvalidSpender"],errorMSG:"ERC20 invalid spender"},ERC2612ExpiredSignature:{reasons:["ERC2612ExpiredSignature"],errorMSG:"ERC2612 expired signature"},ERC2612InvalidSigner:{reasons:["ERC2612InvalidSigner"],errorMSG:"ERC2612 invalid signer"},ERC4626ExceededMaxDeposit:{reasons:["ERC4626ExceededMaxDeposit"],errorMSG:"ERC4626 exceeded max deposit"},ERC4626ExceededMaxMint:{reasons:["ERC4626ExceededMaxMint"],errorMSG:"ERC4626 exceeded max mint"},ERC4626ExceededMaxRedeem:{reasons:["ERC4626ExceededMaxRedeem"],errorMSG:"ERC4626 exceeded max redeem"},ERC4626ExceededMaxWithdraw:{reasons:["ERC4626ExceededMaxWithdraw"],errorMSG:"ERC4626 exceeded max withdraw"},FailedInnerCall:{reasons:["FailedInnerCall"],errorMSG:"Failed inner call"},InconsistentAsset:{reasons:["InconsistentAsset"],errorMSG:"Inconsistent asset"},InconsistentReallocation:{reasons:["InconsistentReallocation"],errorMSG:"Inconsistent reallocation"},InvalidAccountNonce:{reasons:["InvalidAccountNonce"],errorMSG:"Invalid account nonce"},InvalidMarketRemovalNonZeroCap:{reasons:["InvalidMarketRemovalNonZeroCap"],errorMSG:"Invalid market removal (non-zero cap)"},InvalidMarketRemovalNonZeroSupply:{reasons:["InvalidMarketRemovalNonZeroSupply"],errorMSG:"Invalid market removal (non-zero supply)"},InvalidMarketRemovalTimelockNotElapsed:{reasons:["InvalidMarketRemovalTimelockNotElapsed"],errorMSG:"Invalid market removal (timelock not elapsed)"},InvalidShortString:{reasons:["InvalidShortString"],errorMSG:"Invalid short string"},MarketNotCreated:{reasons:["MarketNotCreated"],errorMSG:"Market not created"},MarketNotEnabled:{reasons:["MarketNotEnabled"],errorMSG:"Market not enabled"},MathOverflowedMulDiv:{reasons:["MathOverflowedMulDiv"],errorMSG:"Math overflow"},MaxFeeExceeded:{reasons:["MaxFeeExceeded"],errorMSG:"Max fee exceeded"},MaxQueueLengthExceeded:{reasons:["MaxQueueLengthExceeded"],errorMSG:"Max queue length exceeded"},NoPendingValue:{reasons:["NoPendingValue"],errorMSG:"No pending value"},NonZeroCap:{reasons:["NonZeroCap"],errorMSG:"Non-zero cap"},NotAllocatorRole:{reasons:["NotAllocatorRole"],errorMSG:"Not allocator role"},NotCuratorNorGuardianRole:{reasons:["NotCuratorNorGuardianRole"],errorMSG:"Not curator or guardian role"},NotCuratorRole:{reasons:["NotCuratorRole"],errorMSG:"Not curator role"},NotEnoughLiquidity:{reasons:["NotEnoughLiquidity"],errorMSG:"Not enough liquidity"},NotGuardianRole:{reasons:["NotGuardianRole"],errorMSG:"Not guardian role"},OwnableInvalidOwner:{reasons:["OwnableInvalidOwner"],errorMSG:"Invalid owner"},OwnableUnauthorizedAccount:{reasons:["OwnableUnauthorizedAccount"],errorMSG:"Unauthorized account"},PendingCap:{reasons:["PendingCap"],errorMSG:"Pending cap"},PendingRemoval:{reasons:["PendingRemoval"],errorMSG:"Pending removal"},SafeCastOverflowedUintDowncast:{reasons:["SafeCastOverflowedUintDowncast"],errorMSG:"SafeCast overflow"},SafeERC20FailedOperation:{reasons:["SafeERC20FailedOperation"],errorMSG:"SafeERC20 failed operation"},StringTooLong:{reasons:["StringTooLong"],errorMSG:"String too long"},SupplyCapExceeded:{reasons:["SupplyCapExceeded"],errorMSG:"Supply cap exceeded"},TimelockNotElapsed:{reasons:["TimelockNotElapsed"],errorMSG:"Timelock not elapsed"},UnauthorizedMarket:{reasons:["UnauthorizedMarket"],errorMSG:"Unauthorized market"},ZeroAddress:{reasons:["ZeroAddress"],errorMSG:"Zero address"},ZeroFeeRecipient:{reasons:["ZeroFeeRecipient"],errorMSG:"Zero fee recipient"}}};function E({reason:o,message:r}){for(let n in B){let a=B[n];for(let s in a){let t=a[s];if(o&&t?.reasons?.some(u=>u===o))return{key:s,category:n,errorMSG:t.errorMSG,matchedByReason:!0};if(t?.keywords?.some(u=>r?.toLowerCase().includes(u.toLowerCase().trim())))return{key:s,category:n,errorMSG:t.errorMSG,matchedByReason:!1}}}return null}function F({reason:o,message:r}){return E({reason:o,message:r})?.errorMSG??p}import{BaseError as _}from"viem";import{appConfig as D}from"@berachain/config/internal";import{AtomicReadyWalletRejectedUpgradeError as I,BaseError as M,ContractFunctionExecutionError as x,ContractFunctionRevertedError as X,decodeErrorResult as T,HttpRequestError as b,RpcRequestError as N,TransactionExecutionError as k,UserRejectedRequestError as O}from"viem";var h=[{inputs:[],name:"AlreadyInitiated",type:"error"},{inputs:[],name:"EmptyBundle",type:"error"},{inputs:[],name:"IncorrectReenterHash",type:"error"},{inputs:[],name:"MissingExpectedReenter",type:"error"}];var m=[{inputs:[],name:"AllowanceOverflow",type:"error"},{inputs:[],name:"AllowanceUnderflow",type:"error"},{inputs:[],name:"ETHTransferFailed",type:"error"},{inputs:[],name:"InsufficientAllowance",type:"error"},{inputs:[],name:"InsufficientBalance",type:"error"},{inputs:[],name:"InvalidPermit",type:"error"},{inputs:[],name:"Permit2AllowanceIsFixedAtInfinity",type:"error"},{inputs:[],name:"PermitExpired",type:"error"},{inputs:[],name:"TotalSupplyOverflow",type:"error"},{name:"AllowanceOverflow",type:"error",inputs:[]},{name:"AllowanceUnderflow",type:"error",inputs:[]},{name:"InsufficientAllowance",type:"error",inputs:[]},{name:"InsufficientBalance",type:"error",inputs:[]},{name:"InvalidPermit",type:"error",inputs:[]},{name:"Permit2AllowanceIsFixedAtInfinity",type:"error",inputs:[]},{name:"PermitExpired",type:"error",inputs:[]},{name:"TotalSupplyOverflow",type:"error",inputs:[]},{name:"ECDSAInvalidSignature",type:"error",inputs:[]},{name:"ECDSAInvalidSignatureLength",type:"error",inputs:[{type:"uint256"}]},{name:"ECDSAInvalidSignatureS",type:"error",inputs:[{type:"bytes32"}]},{name:"ERC20InsufficientAllowance",type:"error",inputs:[{type:"address"},{type:"uint256"},{type:"uint256"}]},{name:"ERC20InsufficientBalance",type:"error",inputs:[{type:"address"},{type:"uint256"},{type:"uint256"}]},{name:"ERC20InvalidApprover",type:"error",inputs:[{type:"address"}]},{name:"ERC20InvalidReceiver",type:"error",inputs:[{type:"address"}]},{name:"ERC20InvalidSender",type:"error",inputs:[{type:"address"}]},{name:"ERC20InvalidSpender",type:"error",inputs:[{type:"address"}]},{name:"ERC2612ExpiredSignature",type:"error",inputs:[{type:"uint256"}]},{name:"ERC2612InvalidSigner",type:"error",inputs:[{type:"address"},{type:"address"}]},{name:"InvalidAccountNonce",type:"error",inputs:[{type:"address"},{type:"uint256"}]},{name:"InvalidShortString",type:"error",inputs:[]},{name:"StringTooLong",type:"error",inputs:[{type:"string"}]}];var L=[{name:"AllowanceExpired",type:"error",inputs:[{type:"uint256"}]},{name:"AssetNotRegistered",type:"error",inputs:[{type:"address"}]},{name:"ERC20InsufficientAllowance",type:"error",inputs:[{type:"address"},{type:"uint256"},{type:"uint256"}]},{name:"ERC4626ExceededMaxWithdraw",type:"error",inputs:[{type:"address"},{type:"uint256"},{type:"uint256"}]},{name:"ERC721NonexistentToken",type:"error",inputs:[{type:"uint256"}]},{name:"ExecutionFailed",type:"error",inputs:[{type:"uint256"},{type:"address"},{type:"string"}]},{name:"ExpiredTransaction",type:"error",inputs:[]},{name:"FailedToCallFunction",type:"error",inputs:[{type:"bytes"}]},{name:"InsufficientAmountOut",type:"error",inputs:[]},{name:"MinimalOutputBalanceViolation",type:"error",inputs:[{type:"address"},{type:"uint256"}]},{name:"NotPegged",type:"error",inputs:[{type:"address"}]},{name:"RedeemMoreThanMax",type:"error",inputs:[]},{name:"SignatureExpired",type:"error",inputs:[{type:"uint256"}]},{name:"SlippageExceeded",type:"error",inputs:[{type:"uint256"},{type:"uint256"}]},{name:"SlippageExceeded",type:"error",inputs:[]},{name:"StalePrice",type:"error",inputs:[]},{name:"TooMuchSlippage",type:"error",inputs:[{type:"address"},{type:"uint256"},{type:"uint256"}]},{name:"TransferFromFailed",type:"error",inputs:[]},{name:"UnexpectedBasketModeStatus",type:"error",inputs:[]},{name:"zeroAmountRequired",type:"error",inputs:[]}];var S=[...m,...h,...L];function g(o){return o instanceof M||o instanceof Error&&"shortMessage"in o&&"message"in o&&"details"in o}function l(o,r,n){return o instanceof n||o.name===r}function P(o){return o.errorName==="Error"&&Array.isArray(o.args)&&o.args?.at(0)?o.args?.at(0):o.errorName}function f({error:o,abi:r,revertIfUnknown:n=!0}){if(!g(o)){if(n)throw o;return o instanceof M?{reason:o.shortMessage,rootCause:o}:{reason:o.message,rootCause:o}}let e=o;for(;g(e);){if(l(e,"ContractFunctionExecutionError",x)){e=e.cause;continue}if(l(e,"TransactionExecutionError",k)&&e.cause instanceof I)return{reason:"AtomicReadyWalletRejectedUpgradeError",rootCause:e.cause};if(l(e,"RpcRequestError",N)){if(!e.data){if(typeof e.cause=="object"&&e.cause&&"message"in e.cause&&typeof e.cause.message=="string")return{reason:e.cause.message,rootCause:e.cause};throw new Error("No data",{cause:e})}let a=T({data:e.data,abi:[...S,...r??[]]});return{reason:P(a)??e.shortMessage,rootCause:e}}if(l(e,"ContractFunctionRevertedError",X))return{reason:e.reason??e.signature??e.data?.errorName??e.shortMessage,rootCause:e};if(l(e,"UserRejectedRequestError",O))return{reason:"UserRejectedRequestError",rootCause:e};if(l(e,"HttpRequestError",b))return{reason:`HttpRequestError(status:${e.status})`,rootCause:e,isRequestError:!0};if(!e.cause)return{reason:e.name,rootCause:e};e=e.cause}if(!n)return{reason:void 0,rootCause:e};throw new Error("UnknownErrorInGetRevertReason",{cause:e})}function y(o){switch(o){case"UserRejectedRequestError":case 4001:return"UserRejectedRequestError";default:return`RPC_ERROR_${o}`}}var d=class o extends Error{displayMessage;cause;chainId;reason=null;fingerprint;_tags={};set tags(r){this._tags=r}get tags(){return{...this._tags,"error.displayMessage":this.displayMessage,"error.reason":this.reason,"error.level":this.level}}level="error";extra={};constructor({message:r,displayMessage:n,cause:e,reason:a,level:s,abi:t,tags:u,chainId:v,fingerprint:C}){let c=r;if(c||(e instanceof _?c=e.shortMessage:(e instanceof Error||typeof e=="object"&&e!==null&&"message"in e&&typeof e.message=="string")&&(c=e.message)),super(c,{cause:e}),this.name="BeraError",this.fingerprint=C,this.cause=e,this.chainId=v,a)this.reason=a;else if(e instanceof Error)try{let i=f({error:e,revertIfUnknown:!0,abi:t});this.reason=i?.reason??null}catch{}s?this.level=s:this.reason===y("UserRejectedRequestError")?this.level="info":this.level="error";let A=n;if(this.cause instanceof o&&this.cause.displayMessage!==p&&(A=this.cause.displayMessage),!A){let i=E(this);A=i?.errorMSG,i&&!i.matchedByReason&&this.reason&&(this.reason=i.key)}this.displayMessage=A??p,this.tags={...this.tags,...u},!D.env.isProduction&&process.env.NODE_ENV!=="test"&&(console.group("BeraError thrown"),console.debug("Level",this.level),console.debug("Reason",this.reason),console.debug("Message",this.message),console.debug("Display Message",this.displayMessage),console.debug("Cause",this.cause),console.groupEnd())}};import{mainnet as G}from"@berachain/config/mainnet";var R=class o extends d{response;static isCorsError(r){return r.cause instanceof Response&&r.cause.type==="cors"}endpoint;queryRichfulDomains=[G.bex.aggregatorsProxyUrl,"https://api.fly.trade/aggregator/quote","https://open-api.openocean.finance/v4/bera/swap","/api/aggregators?aggregator",G.staking];statusCode;payload;static REASON_MAP={429:"RATE_LIMITED_429",NETWORK_ERROR:"NETWORK_ERROR",CORS_ERROR:"CORS"};constructor(r){if(super(r),this.name="RequestError",this.response=r.response,this.payload=r.payload,this.endpoint=this.setEndpoint(r.endpoint),!this.message&&typeof this.cause=="object"&&this.cause!==null&&"error"in this.cause&&typeof this.cause.error=="string"&&(this.message=this.cause.error),r.statusCode?this.statusCode=r.statusCode:this.response instanceof Response&&(this.statusCode=this.response.status),this.statusCode===429)this.reason=o.REASON_MAP[429],this.displayMessage=B.HTTP.RATE_LIMITED_429.errorMSG,this.level=r.level??"warning";else{let a=this.tryMatchNetworkError();a&&(this.reason=this.reason??a.reason,this.level=r.level??"warning",this.endpoint.url=this.endpoint.url??a.url)}this.tags={...this.tags,"error.statusCode":this.statusCode,"operation.type":"query",...r.tags};let n="";this.reason?n+=`${this.reason} \u2013 `:this.statusCode&&this.statusCode>=400&&(n+=`HTTP ${this.statusCode} \u2013 `);let e=this.endpoint.type?`${this.endpoint.type}(${this.endpoint.url})`:this.endpoint.url;this.message=`${n}${e}: ${this.message}`}setEndpoint(r){if(typeof r=="string"||r instanceof URL?this.endpoint={url:typeof r=="string"?r:r.toString()}:this.endpoint={...this.endpoint,...r,url:r.url.toString()},this.queryRichfulDomains.some(n=>this.endpoint.url.includes(n)))try{let n=new URL(this.endpoint.url);n.search="",this.endpoint.url=n.toString()}catch{}return this.tags={...this.tags,"operation.source.url":this.endpoint.url,"operation.source.name":this.endpoint.name,"operation.source.type":this.endpoint.type},this.endpoint}tryMatchNetworkError(){if(this.cause instanceof Error&&"message"in this.cause&&typeof this.cause.message=="string"||this.cause instanceof TypeError){let r=this.cause.message;if(r.startsWith("Network Error"))return{reason:o.REASON_MAP.NETWORK_ERROR,message:r,url:this.endpoint.url};let n=r.match(/^(?:NetworkError when attempting to fetch resource\.|Failed to fetch|Load failed) \(([a-z0-9-.]+)\)$/);if(n)return{reason:o.REASON_MAP.NETWORK_ERROR,message:r,url:n[1]}}if(typeof this.cause=="object"&&this.cause!==null&&"message"in this.cause&&typeof this.cause.message=="string"){let r=this.cause.message;if(r.startsWith("error: canceling statement due to lock timeout occurred in"))return{reason:o.REASON_MAP.NETWORK_ERROR,message:r,url:this.endpoint.url}}return!1}};var w=class extends d{property;value;expected;constructor(r){super(r),this.level=r.level??"warning",this.name="InvalidArgumentError",this.property=r.property,this.value=r.value,this.expected=r.expected,this.message=`Invalid argument: ${this.property} ${this.isMissing?"is missing":`is invalid, expected ${this.expected}`}`,r.reason||(this.reason=`${this.name}.${this.property}.${this.isInvalid?"invalid":"missing"}`)}get isMissing(){return this.value===void 0}get isInvalid(){return this.value!==void 0}};export{E as a,F as b,S as c,P as d,f as e,d as f,R as g,w as h};
|
|
2
|
+
//# sourceMappingURL=chunk-74QD4JAH.mjs.map
|