@berachain/berajs 0.2.4 → 0.2.6-patch.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -0
- package/dist/abi/exports.cjs +1 -1
- package/dist/abi/exports.cjs.map +1 -1
- package/dist/abi/exports.d.cts +17 -1
- package/dist/abi/exports.d.ts +17 -1
- package/dist/abi/exports.mjs +1 -1
- package/dist/abi/exports.mjs.map +1 -1
- package/dist/actions/exports.cjs +1 -1
- package/dist/actions/exports.cjs.map +1 -1
- package/dist/actions/exports.d.cts +9 -38
- package/dist/actions/exports.d.ts +9 -38
- package/dist/actions/exports.mjs +1 -1
- package/dist/actions/exports.mjs.map +1 -1
- package/dist/chunk-2YBHAMDV.cjs +2 -0
- package/dist/chunk-2YBHAMDV.cjs.map +1 -0
- package/dist/chunk-57RINXU6.cjs +2 -0
- package/dist/chunk-57RINXU6.cjs.map +1 -0
- package/dist/{chunk-AX2YQQFQ.mjs → chunk-74QD4JAH.mjs} +2 -2
- package/dist/chunk-74QD4JAH.mjs.map +1 -0
- package/dist/chunk-74WA35RI.cjs +2 -0
- package/dist/chunk-74WA35RI.cjs.map +1 -0
- package/dist/{chunk-7WRTK7RJ.mjs → chunk-BEKH5EYT.mjs} +2 -2
- package/dist/chunk-BEKH5EYT.mjs.map +1 -0
- package/dist/{chunk-FCWDGE62.cjs → chunk-CF3LFNXG.cjs} +2 -2
- package/dist/chunk-CF3LFNXG.cjs.map +1 -0
- package/dist/chunk-COMMLZ3O.mjs +2 -0
- package/dist/chunk-COMMLZ3O.mjs.map +1 -0
- package/dist/chunk-DDEQFR3M.cjs +2 -0
- package/dist/chunk-DDEQFR3M.cjs.map +1 -0
- package/dist/{chunk-6LDOG5RL.cjs → chunk-DK42F2ZM.cjs} +2 -2
- package/dist/chunk-DK42F2ZM.cjs.map +1 -0
- package/dist/{chunk-7SMWQ6SN.mjs → chunk-FM3WDBFH.mjs} +2 -2
- package/dist/chunk-FM3WDBFH.mjs.map +1 -0
- package/dist/chunk-HWOGQSNL.cjs +4 -0
- package/dist/chunk-HWOGQSNL.cjs.map +1 -0
- package/dist/chunk-I7M43BB4.cjs +2 -0
- package/dist/chunk-I7M43BB4.cjs.map +1 -0
- package/dist/chunk-IBJOI5SN.mjs +4 -0
- package/dist/chunk-IBJOI5SN.mjs.map +1 -0
- package/dist/chunk-IDFMLLDY.mjs +2 -0
- package/dist/chunk-IDFMLLDY.mjs.map +1 -0
- package/dist/{chunk-YZV5LKIP.cjs → chunk-LNVR4BW6.cjs} +2 -2
- package/dist/chunk-LNVR4BW6.cjs.map +1 -0
- package/dist/chunk-MJZHJFZO.mjs +2 -0
- package/dist/{chunk-YNO7BCCM.mjs.map → chunk-MJZHJFZO.mjs.map} +1 -1
- package/dist/chunk-MK5NS5B5.mjs +2 -0
- package/dist/chunk-MK5NS5B5.mjs.map +1 -0
- package/dist/{chunk-C6ZGUO4H.cjs → chunk-NMH7LHPW.cjs} +2 -2
- package/dist/chunk-NMH7LHPW.cjs.map +1 -0
- package/dist/chunk-NVHV2LDK.cjs +2 -0
- package/dist/chunk-NVHV2LDK.cjs.map +1 -0
- package/dist/chunk-OGBD5YOG.mjs +2 -0
- package/dist/chunk-OGBD5YOG.mjs.map +1 -0
- package/dist/chunk-OIYXOKTT.cjs.map +1 -1
- package/dist/chunk-OUD27MU7.cjs.map +1 -1
- package/dist/chunk-PLIH6KQM.mjs +2 -0
- package/dist/chunk-PLIH6KQM.mjs.map +1 -0
- package/dist/chunk-QRAIGQF2.mjs +2 -0
- package/dist/chunk-QRAIGQF2.mjs.map +1 -0
- package/dist/chunk-RWOICHRW.cjs +2 -0
- package/dist/chunk-RWOICHRW.cjs.map +1 -0
- package/dist/chunk-T5FSQ3YE.mjs +2 -0
- package/dist/chunk-T5FSQ3YE.mjs.map +1 -0
- package/dist/chunk-WRFDB3QJ.cjs.map +1 -1
- package/dist/chunk-XNJLSA6P.cjs.map +1 -1
- package/dist/contexts/exports.cjs +1 -1
- package/dist/contexts/exports.cjs.map +1 -1
- package/dist/contexts/exports.d.cts +1 -1
- package/dist/contexts/exports.d.ts +1 -1
- package/dist/contexts/exports.mjs +1 -1
- package/dist/contexts/exports.mjs.map +1 -1
- package/dist/{defaultFlags-d0kPbT0i.d.cts → defaultFlags-D6KfkTZx.d.cts} +1 -1
- package/dist/{defaultFlags-d0kPbT0i.d.ts → defaultFlags-D6KfkTZx.d.ts} +1 -1
- package/dist/enum/exports.cjs +1 -1
- package/dist/enum/exports.cjs.map +1 -1
- package/dist/enum/exports.d.cts +1 -1
- package/dist/enum/exports.d.ts +1 -1
- package/dist/enum/exports.mjs +1 -1
- package/dist/errors/exports.cjs +1 -1
- package/dist/errors/exports.cjs.map +1 -1
- package/dist/errors/exports.d.cts +8 -3
- package/dist/errors/exports.d.ts +8 -3
- package/dist/errors/exports.mjs +1 -1
- package/dist/{getValidatorQueuedOperatorAddress-DZgrPmZ2.d.cts → getValidatorQueuedOperatorAddress-BdDYHycN.d.cts} +15 -4
- package/dist/{getValidatorQueuedOperatorAddress-CqR6cyqC.d.ts → getValidatorQueuedOperatorAddress-CmiPJmsr.d.ts} +15 -4
- package/dist/{global.d-BeYWDreg.d.ts → global.d-3GQMgC9k.d.ts} +1 -1
- package/dist/{global.d-DghRxpHd.d.cts → global.d-CwT1Phzf.d.cts} +1 -1
- package/dist/hooks/exports.cjs +3 -3
- package/dist/hooks/exports.cjs.map +1 -1
- package/dist/hooks/exports.d.cts +54 -75
- package/dist/hooks/exports.d.ts +54 -75
- package/dist/hooks/exports.mjs +3 -3
- package/dist/hooks/exports.mjs.map +1 -1
- package/dist/{txnEnum-DxPRHSJt.d.cts → txnEnum-CCuQUFlh.d.cts} +7 -0
- package/dist/{txnEnum-DxPRHSJt.d.ts → txnEnum-CCuQUFlh.d.ts} +7 -0
- package/dist/types/exports.cjs.map +1 -1
- package/dist/types/exports.d.cts +37 -4
- package/dist/types/exports.d.ts +37 -4
- package/dist/utils/exports.cjs +1 -1
- package/dist/utils/exports.cjs.map +1 -1
- package/dist/utils/exports.d.cts +2 -2
- package/dist/utils/exports.d.ts +2 -2
- package/dist/utils/exports.mjs +1 -1
- package/dist/utils/exports.mjs.map +1 -1
- package/package.json +25 -25
- package/src/abi/enso/ensoWalletV2Factory.ts +9 -0
- package/src/abi/exports.ts +1 -0
- package/src/abi/pyth/pyth.ts +0 -0
- package/src/actions/clients/BeraApolloClient.ts +3 -3
- package/src/actions/clients/getApolloClient.ts +5 -5
- package/src/actions/clients/getEnsoClient.ts +1 -1
- package/src/actions/dex/__tests__/aggregators.unit.test.ts +3 -3
- package/src/actions/dex/__tests__/getOnChainPool.unit.test.ts +1 -1
- package/src/actions/dex/aggregators/base.ts +12 -8
- package/src/actions/dex/aggregators/bex.ts +8 -8
- package/src/actions/dex/aggregators/bgt.ts +4 -4
- package/src/actions/dex/aggregators/enso/enso.ts +28 -20
- package/src/actions/dex/aggregators/enso/ensoErc4626.debug.test.ts +1 -1
- package/src/actions/dex/aggregators/enso/ensoErc4626.ts +7 -4
- package/src/actions/dex/aggregators/erc4626.ts +10 -6
- package/src/actions/dex/aggregators/fly.ts +9 -5
- package/src/actions/dex/aggregators/haiku.integration.test.ts +3 -3
- package/src/actions/dex/aggregators/haiku.ts +9 -5
- package/src/actions/dex/aggregators/honey.ts +15 -15
- package/src/actions/dex/aggregators/kyberswap.ts +8 -4
- package/src/actions/dex/aggregators/oogabooga.ts +8 -4
- package/src/actions/dex/aggregators/openOcean.ts +12 -8
- package/src/actions/dex/aggregators/wbera.ts +8 -4
- package/src/actions/dex/b-sdk.ts +2 -2
- package/src/actions/dex/getAllPools.ts +2 -2
- package/src/actions/dex/getApiPool.ts +2 -2
- package/src/actions/dex/getGlobalLiquidityAndSwapVolume.ts +2 -2
- package/src/actions/dex/getIsTokenExploited.ts +1 -1
- package/src/actions/dex/getOnChainPool.ts +3 -3
- package/src/actions/dex/getPoolEvents.ts +2 -2
- package/src/actions/dex/getPoolHistoricalData.ts +2 -2
- package/src/actions/dex/getVaultPausedState.ts +1 -1
- package/src/actions/enso/__tests__/getBendDemultiplyBundle.action.unit.test.ts +175 -0
- package/src/actions/enso/__tests__/getBendDemultiplyBundle.unit.test.ts +150 -0
- package/src/actions/enso/__tests__/getBendMultiplyBundle.action.unit.test.ts +138 -0
- package/src/actions/enso/__tests__/getBendMultiplyBundle.unit.test.ts +194 -0
- package/src/actions/enso/{getEnsoUserTokensWithBalances.debug.test.ts → __tests__/getEnsoUserTokensWithBalances.debug.test.ts} +3 -3
- package/src/actions/enso/__tests__/helpers.ts +42 -0
- package/src/actions/enso/__tests__/util.unit.test.ts +95 -0
- package/src/actions/enso/flashloan.ts +127 -0
- package/src/actions/enso/getBendDemultiplyBundle.ts +325 -0
- package/src/actions/enso/getBendMultiplyBundle.ts +348 -0
- package/src/actions/enso/getEnsoSwapBundle.ts +2 -2
- package/src/actions/enso/getEnsoUserTokensWithBalances.ts +5 -5
- package/src/actions/enso/util.ts +150 -5
- package/src/actions/exports.ts +0 -2
- package/src/actions/governance/__tests__/checkProposalField.unit.test.ts +2 -2
- package/src/actions/governance/__tests__/getDecodedFunctionData.integration.test.ts +2 -2
- package/src/actions/governance/__tests__/getQuorum.integration.test.ts +2 -2
- package/src/actions/governance/checkProposalField.ts +1 -1
- package/src/actions/governance/computeActualStatus.ts +1 -1
- package/src/actions/governance/getAllProposals.ts +1 -1
- package/src/actions/governance/getBodyErrors.ts +1 -1
- package/src/actions/governance/getProposalDetails.ts +1 -1
- package/src/actions/governance/getProposalFromTx.ts +1 -1
- package/src/actions/governance/getProposalParams.ts +3 -3
- package/src/actions/governance/getProposalVotes.ts +1 -1
- package/src/actions/governance/getQuorum.ts +2 -2
- package/src/actions/honey/getCollateralWeights.ts +2 -2
- package/src/actions/honey/getGlobalCapLimit.ts +4 -4
- package/src/actions/honey/getHoneyCollaterals.ts +5 -5
- package/src/actions/honey/getHoneyFees.ts +1 -1
- package/src/actions/honey/getHoneyPausedState.ts +1 -1
- package/src/actions/honey/getHoneyPreview.ts +3 -3
- package/src/actions/honey/getHoneyRootPriceOracle.ts +1 -1
- package/src/actions/honey/getHoneyVaultsBalance.ts +2 -2
- package/src/actions/honey/getRelativeCapLimit.ts +3 -3
- package/src/actions/honey/getSharesWithoutFees.ts +1 -1
- package/src/actions/honey/getSwapPayload.ts +6 -6
- package/src/actions/honey/isBadCollateralAsset.ts +2 -2
- package/src/actions/honey/isBasketModeEnabled.ts +2 -2
- package/src/actions/honey/tests/pyth.integration.test.ts +3 -3
- package/src/actions/misc/getBlockTimestamp.ts +2 -2
- package/src/actions/pol/__tests__/getAllValidators.integration.test.ts +2 -2
- package/src/actions/pol/__tests__/rewardVaults.integration.test.ts +1 -1
- package/src/actions/pol/getBGTGlobalInfo.ts +2 -2
- package/src/actions/pol/getBgtAprSimulation.ts +1 -1
- package/src/actions/pol/getBgtAprSimultaion.unit.test.ts +1 -1
- package/src/actions/pol/getBgtTokenTotalBoosts.ts +2 -2
- package/src/actions/pol/getBgtTokenTotalSupply.ts +2 -2
- package/src/actions/pol/getBlockTime.debug.test.ts +13 -0
- package/src/actions/pol/getBlockTime.ts +14 -23
- package/src/actions/pol/getEarnedStakedBeraVault.ts +3 -3
- package/src/actions/pol/getGlobalCuttingBoard.ts +0 -0
- package/src/actions/pol/getGlobalData.ts +2 -2
- package/src/actions/pol/getIncentiveFeeClaimStats.ts +4 -4
- package/src/actions/pol/getLSTStakeConfig.ts +5 -5
- package/src/actions/pol/getMarkets.ts +2 -2
- package/src/actions/pol/getRewardProofsByValidator.ts +4 -4
- package/src/actions/pol/getRewardTokenToBeraRate.ts +1 -1
- package/src/actions/pol/getRewardVault.ts +3 -3
- package/src/actions/pol/getRewardVaultBeaconImplementation.integration.test.ts +1 -1
- package/src/actions/pol/getRewardVaultBeaconImplementation.ts +3 -3
- package/src/actions/pol/getRewardVaultDurationConstants.integration.test.ts +1 -1
- package/src/actions/pol/getRewardVaultDurationConstants.ts +1 -1
- package/src/actions/pol/getRewardVaultFromToken.ts +1 -1
- package/src/actions/pol/getRewardVaultIncentives.ts +2 -2
- package/src/actions/pol/getRewardVaultRewards.ts +1 -1
- package/src/actions/pol/getRewardVaults.ts +1 -1
- package/src/actions/pol/getSWBeraVaultMetadata.ts +20 -22
- package/src/actions/pol/getSWBeraWithdrawal.ts +4 -4
- package/src/actions/pol/getStakedBeraAPR.ts +2 -2
- package/src/actions/pol/getStakedBeraSnapshots.ts +2 -2
- package/src/actions/pol/getStakingDailyAssets.ts +3 -3
- package/src/actions/pol/getStakingTokenInformation.ts +2 -2
- package/src/actions/pol/getTotalStakedAmount.ts +1 -1
- package/src/actions/pol/getUserClaimableIncentives.ts +4 -4
- package/src/actions/pol/getUserVaultInfo.ts +1 -1
- package/src/actions/pol/getUserVaults.ts +4 -4
- package/src/actions/pol/getUserVaultsBalance.ts +1 -1
- package/src/actions/pol/getUserVaultsReward.ts +0 -0
- package/src/actions/pol/getVaultHistory.ts +2 -2
- package/src/actions/pol/getVaultValidators.ts +1 -1
- package/src/actions/pol/getVaultsSupply.ts +0 -0
- package/src/actions/prices/__tests__/prices.integration.test.ts +2 -2
- package/src/actions/prices/getTokenCurrentPrices.ts +5 -5
- package/src/actions/pyth/getHoneyPythFeeds.ts +2 -2
- package/src/actions/pyth/getUpdateFee.ts +2 -2
- package/src/actions/tokens/getAllowances.ts +2 -2
- package/src/actions/tokens/getTokenInformation.ts +2 -2
- package/src/actions/tokens/getTokens.ts +3 -3
- package/src/actions/tokens/getUnderlyingToken.ts +4 -4
- package/src/actions/tokens/getWalletBalances.integration.test.ts +1 -1
- package/src/actions/tokens/getWalletBalances.ts +4 -4
- package/src/actions/transactions/beraWriteContract.integration.test.ts +6 -6
- package/src/actions/transactions/beraWriteContract.ts +12 -12
- package/src/actions/validators/getActiveBoostAndCommissionChangeDelay.integration.test.ts +1 -1
- package/src/actions/validators/getActiveBoostAndCommissionChangeDelay.ts +1 -1
- package/src/actions/validators/getAllValidators.ts +2 -2
- package/src/actions/validators/getApiValidator.ts +2 -2
- package/src/actions/validators/getBaselineRewardAllocation.ts +1 -1
- package/src/actions/validators/getDailyValidatorBlockStats.ts +1 -1
- package/src/actions/validators/getDefaultRewardAllocation.ts +1 -1
- package/src/actions/validators/getUserActiveValidators.ts +31 -33
- package/src/actions/validators/getUserBoosts.ts +12 -8
- package/src/actions/validators/getUserBoostsOnValidator.ts +15 -3
- package/src/actions/validators/getUserStakingPositions.ts +1 -1
- package/src/actions/validators/getValidatorAnalytics.ts +2 -2
- package/src/actions/validators/getValidatorCommission.ts +1 -1
- package/src/actions/validators/getValidatorEstimatedBgtPerYear.ts +1 -1
- package/src/actions/validators/getValidatorOperatorAddress.ts +1 -1
- package/src/actions/validators/getValidatorQueuedCommission.ts +1 -1
- package/src/actions/validators/getValidatorQueuedOperatorAddress.ts +1 -1
- package/src/actions/validators/getValidatorQueuedRewardAllocation.ts +1 -1
- package/src/actions/validators/getValidatorRewardAllocation.ts +1 -1
- package/src/actions/validators/getValidatorRewardAllocatorAddress.ts +1 -1
- package/src/actions/validators/utils/__tests__/validatorUtils.integration.test.ts +4 -4
- package/src/contexts/BeraFlags/defaultFlags.ts +4 -0
- package/src/contexts/BexStatusProvider.tsx +1 -1
- package/src/contexts/HoneyConfigProvider.tsx +3 -3
- package/src/contexts/SwrFallback.tsx +2 -2
- package/src/contexts/TokensProvider.tsx +3 -3
- package/src/contexts/block-time-provider.tsx +1 -1
- package/src/contexts/exports.ts +0 -0
- package/src/data/contracts.ts +10 -0
- package/src/enum/exports.ts +0 -0
- package/src/enum/polling.ts +0 -0
- package/src/enum/txnEnum.ts +9 -0
- package/src/errors/BeraMonitoring.ts +2 -2
- package/src/errors/BeraTracing.ts +2 -2
- package/src/errors/RequestError.ts +1 -1
- package/src/errors/assert.ts +18 -0
- package/src/errors/getErrorMessage.ts +0 -0
- package/src/errors/getRevertReason.integration.test.ts +7 -7
- package/src/errors/getRevertReason.ts +1 -1
- package/src/errors/parseViemError.ts +1 -1
- package/src/hooks/bend/useGetConvertToAssets.ts +4 -4
- package/src/hooks/dex/useAggregatorsQuotes.ts +19 -19
- package/src/hooks/dex/useAggregatorsRouterFeeBps.ts +2 -2
- package/src/hooks/dex/useAllUserPools.ts +3 -3
- package/src/hooks/dex/useApiPool.ts +3 -3
- package/src/hooks/dex/useBexStatus.ts +1 -1
- package/src/hooks/dex/useCreatePool.ts +9 -9
- package/src/hooks/dex/useExploitedTokens.ts +3 -3
- package/src/hooks/dex/useGlobalLiquidityAndSwapVolume.ts +1 -1
- package/src/hooks/dex/useLiquidityMismatch.ts +3 -3
- package/src/hooks/dex/useLpPosition.ts +7 -4
- package/src/hooks/dex/useMultipleTokenApprovalsWithSlippage.ts +4 -4
- package/src/hooks/dex/useOnChainPoolData.ts +3 -3
- package/src/hooks/dex/usePollPoolCreationRelayerApproval.ts +3 -3
- package/src/hooks/dex/usePool.ts +7 -40
- package/src/hooks/dex/usePoolEvents.ts +2 -2
- package/src/hooks/dex/usePoolHistoricalData.ts +6 -3
- package/src/hooks/dex/usePools.ts +3 -3
- package/src/hooks/dex/usePriceImpact.ts +2 -2
- package/src/hooks/dex/useSingleAggregatorQuote.ts +13 -13
- package/src/hooks/enso/useBendDemultiply.ts +158 -0
- package/src/hooks/enso/useBendMultiply.ts +163 -0
- package/src/hooks/enso/useBendZapSupply.ts +7 -7
- package/src/hooks/enso/useEnsoSwapBundle.ts +6 -6
- package/src/hooks/enso/useEnsoUserTokensWithBalances.ts +5 -5
- package/src/hooks/enso/useEnsoWalletV2Address.ts +38 -0
- package/src/hooks/enso/useIsBendAuthorized.ts +47 -0
- package/src/hooks/enso/useZapStakeBera.ts +4 -4
- package/src/hooks/exports.ts +4 -3
- package/src/hooks/governance/useCreateProposal.ts +3 -3
- package/src/hooks/governance/useGetPastVotes.ts +2 -2
- package/src/hooks/governance/useHasVoted.ts +2 -2
- package/src/hooks/governance/useIsCanceller.ts +4 -4
- package/src/hooks/governance/usePollAllProposals.ts +3 -3
- package/src/hooks/governance/usePollProposal.ts +7 -4
- package/src/hooks/governance/usePollProposalThreshold.ts +3 -3
- package/src/hooks/governance/usePollProposalVotes.ts +1 -1
- package/src/hooks/governance/usePollUserDelegates.ts +7 -4
- package/src/hooks/governance/useProposalFromTx.ts +1 -1
- package/src/hooks/governance/useProposalSnapshot.ts +2 -2
- package/src/hooks/governance/useProposalState.ts +2 -2
- package/src/hooks/governance/useProposalTimelockState.ts +2 -2
- package/src/hooks/governance/useQuorum.ts +1 -1
- package/src/hooks/honey/useCappedGlobally.ts +8 -5
- package/src/hooks/honey/useCappedRelatively.ts +7 -4
- package/src/hooks/honey/useCollateralWeights.ts +8 -5
- package/src/hooks/honey/useHoneyAlerts.ts +5 -5
- package/src/hooks/honey/useHoneyBalances.ts +7 -7
- package/src/hooks/honey/useHoneyChartData.ts +1 -1
- package/src/hooks/honey/useHoneySwapState.ts +4 -4
- package/src/hooks/honey/useHoneyVaultsBalance.ts +8 -5
- package/src/hooks/honey/useIsBadCollateralAsset.ts +9 -6
- package/src/hooks/honey/useIsBasketModeEnabled.ts +8 -5
- package/src/hooks/honey/usePythLatestPrices.ts +4 -4
- package/src/hooks/perps/usePythUpdateFee.ts +4 -4
- package/src/hooks/pol/useBgtAprSimulation.ts +1 -1
- package/src/hooks/pol/useBgtUnstakedBalance.ts +7 -4
- package/src/hooks/pol/useClaimableFees.ts +4 -4
- package/src/hooks/pol/useOnChainRewardVault.ts +7 -7
- package/src/hooks/pol/usePollGlobalData.ts +9 -3
- package/src/hooks/pol/usePollMarkets.ts +5 -2
- package/src/hooks/pol/useQueuedBeraUnlock.ts +4 -4
- package/src/hooks/pol/useRewardTokenToBeraRate.ts +4 -4
- package/src/hooks/pol/useRewardVault.ts +5 -2
- package/src/hooks/pol/useRewardVaultBalanceFromStakingToken.ts +2 -2
- package/src/hooks/pol/useRewardVaultFromToken.ts +2 -2
- package/src/hooks/pol/useRewardVaultIncentives.ts +2 -2
- package/src/hooks/pol/useRewardVaultRewards.ts +3 -3
- package/src/hooks/pol/useRewardVaults.ts +2 -2
- package/src/hooks/pol/useStakedAPR.ts +3 -3
- package/src/hooks/pol/useStakedData.ts +10 -10
- package/src/hooks/pol/useStakedSnapshots.ts +3 -3
- package/src/hooks/pol/useStakingVaultsMetadata.ts +40 -0
- package/src/hooks/pol/useTotalStakedAmount.ts +2 -2
- package/src/hooks/pol/useUserVaultInfo.ts +8 -5
- package/src/hooks/pol/useUserVaults.ts +7 -4
- package/src/hooks/pol/useVaultAddress.ts +2 -2
- package/src/hooks/pol/useVaultHistory.ts +2 -2
- package/src/hooks/pol/useVaultValidators.ts +5 -2
- package/src/hooks/tokens/useBeraCurrentPrice.ts +1 -1
- package/src/hooks/tokens/useMultipleTokenInformation.ts +7 -4
- package/src/hooks/tokens/usePollAllowances.ts +7 -4
- package/src/hooks/tokens/usePollBalance.ts +8 -5
- package/src/hooks/tokens/usePollWalletBalances.ts +8 -5
- package/src/hooks/tokens/useStakingTokenInformation.ts +7 -4
- package/src/hooks/tokens/useTokenCurrentPrice.ts +1 -1
- package/src/hooks/tokens/useTokenCurrentPrices.ts +6 -6
- package/src/hooks/tokens/useTokenInformation.ts +8 -5
- package/src/hooks/tokens/useTokenPrice.ts +1 -1
- package/src/hooks/tokens/useTokenPrices.ts +4 -4
- package/src/hooks/tokens/useTokens.ts +3 -3
- package/src/hooks/tokens/useTotalSupply.ts +1 -1
- package/src/hooks/tokens/useUnderlyingAsset.ts +3 -3
- package/src/hooks/useBlockToTimestamp.ts +5 -5
- package/src/hooks/useContractWrite/index.ts +0 -0
- package/src/hooks/useContractWrite/stateReducer.ts +0 -0
- package/src/hooks/useContractWrite/types.ts +2 -2
- package/src/hooks/useContractWrite/useBeraContractWrite.ts +5 -6
- package/src/hooks/useGetVerifiedAbi.ts +1 -1
- package/src/hooks/usePrevious.ts +0 -0
- package/src/hooks/validators/useAllValidators.ts +7 -4
- package/src/hooks/validators/useApiEnrichedAllocation.ts +2 -2
- package/src/hooks/validators/useApiValidator.ts +5 -2
- package/src/hooks/validators/useBaselineRewardAllocation.ts +2 -2
- package/src/hooks/validators/useDailyValidatorBlockStats.ts +3 -3
- package/src/hooks/validators/useDefaultRewardAllocation.ts +4 -4
- package/src/hooks/validators/useManagedValidatorRole.ts +8 -5
- package/src/hooks/validators/useOnChainValidator.ts +6 -3
- package/src/hooks/validators/useStakingPoolBatch.ts +7 -4
- package/src/hooks/validators/useUserActiveValidators.ts +6 -3
- package/src/hooks/validators/useUserBoostsOnValidator.ts +3 -3
- package/src/hooks/validators/useUserClaimableIncentives.ts +9 -9
- package/src/hooks/validators/useUserStakingPositions.ts +1 -1
- package/src/hooks/validators/useValidator.ts +1 -1
- package/src/hooks/validators/useValidatorAnalytics.ts +3 -3
- package/src/hooks/validators/useValidatorCommission.ts +5 -2
- package/src/hooks/validators/useValidatorEstimatedBgtPerYear.ts +3 -3
- package/src/hooks/validators/useValidatorQueuedCommission.ts +6 -3
- package/src/hooks/validators/useValidatorQueuedOperatorAddress.ts +5 -2
- package/src/hooks/validators/useValidatorQueuedRewardAllocation.ts +6 -3
- package/src/hooks/validators/useValidatorRewardAllocation.ts +2 -2
- package/src/types/dex.d.ts +1 -1
- package/src/types/enso.d.ts +34 -0
- package/src/types/exports.ts +0 -0
- package/src/types/global.d.ts +3 -3
- package/src/types/governance.d.ts +1 -1
- package/src/types/honeySwap.d.ts +3 -3
- package/src/types/staking.d.ts +0 -0
- package/src/utils/beraFetch.ts +1 -1
- package/src/utils/createEmitter.ts +1 -1
- package/src/utils/exports.ts +0 -0
- package/src/utils/filter.ts +0 -0
- package/src/utils/formatIncentivesTokenMap.ts +1 -1
- package/src/utils/formatInputTokenValue.ts +0 -0
- package/src/utils/formatNumber.ts +0 -0
- package/src/utils/getContractName.ts +1 -1
- package/src/utils/getHoneySwapMessage.test.ts +1 -1
- package/src/utils/getHoneySwapMessage.ts +1 -1
- package/src/utils/parseBaseArgs.ts +1 -1
- package/src/utils/parseBaseArgs.unit.test.ts +1 -1
- package/src/utils/parseWhiskToken.ts +1 -1
- package/src/utils/poolNamings.ts +1 -1
- package/src/utils/tokens.ts +2 -2
- package/src/utils/tokens.unit.test.ts +1 -1
- package/src/utils/truncateHash.ts +0 -0
- package/.claude/skills/berajs/SKILL.md +0 -222
- package/.claude/skills/berajs/references/dex.md +0 -235
- package/.claude/skills/berajs/references/pol.md +0 -194
- package/.claude/skills/berajs/references/staking.md +0 -198
- package/.claude/skills/berajs/references/tokens.md +0 -170
- package/LICENSE +0 -21
- package/dist/chunk-22J3YJDN.cjs +0 -2
- package/dist/chunk-22J3YJDN.cjs.map +0 -1
- package/dist/chunk-2LL3P5PN.mjs +0 -2
- package/dist/chunk-2LL3P5PN.mjs.map +0 -1
- package/dist/chunk-4GU2O2OW.cjs +0 -4
- package/dist/chunk-4GU2O2OW.cjs.map +0 -1
- package/dist/chunk-55L7STYD.mjs +0 -2
- package/dist/chunk-55L7STYD.mjs.map +0 -1
- package/dist/chunk-5XWELBWR.mjs +0 -2
- package/dist/chunk-5XWELBWR.mjs.map +0 -1
- package/dist/chunk-6LDOG5RL.cjs.map +0 -1
- package/dist/chunk-7LNBSOVV.cjs +0 -2
- package/dist/chunk-7LNBSOVV.cjs.map +0 -1
- package/dist/chunk-7SMWQ6SN.mjs.map +0 -1
- package/dist/chunk-7WRTK7RJ.mjs.map +0 -1
- package/dist/chunk-AX2YQQFQ.mjs.map +0 -1
- package/dist/chunk-BS6K7HGH.cjs +0 -2
- package/dist/chunk-BS6K7HGH.cjs.map +0 -1
- package/dist/chunk-C3FHGFLK.mjs +0 -2
- package/dist/chunk-C3FHGFLK.mjs.map +0 -1
- package/dist/chunk-C6ZGUO4H.cjs.map +0 -1
- package/dist/chunk-FCWDGE62.cjs.map +0 -1
- package/dist/chunk-RW3JFPED.mjs +0 -4
- package/dist/chunk-RW3JFPED.mjs.map +0 -1
- package/dist/chunk-S3EAKCVM.cjs +0 -2
- package/dist/chunk-S3EAKCVM.cjs.map +0 -1
- package/dist/chunk-SWMJQOH6.cjs +0 -2
- package/dist/chunk-SWMJQOH6.cjs.map +0 -1
- package/dist/chunk-THATXCJK.mjs +0 -2
- package/dist/chunk-THATXCJK.mjs.map +0 -1
- package/dist/chunk-VXL2ZZ4X.cjs +0 -2
- package/dist/chunk-VXL2ZZ4X.cjs.map +0 -1
- package/dist/chunk-YNO7BCCM.mjs +0 -2
- package/dist/chunk-YXLFOEZN.mjs +0 -2
- package/dist/chunk-YXLFOEZN.mjs.map +0 -1
- package/dist/chunk-YZV5LKIP.cjs.map +0 -1
- package/src/actions/dex/getSubgraphPool.ts +0 -30
- package/src/actions/validators/getManagedValidatorByAccount.ts +0 -32
- package/src/hooks/pol/useSWBeraVaultMetadata.ts +0 -35
- package/src/hooks/validators/useManagedValidatorByAccount.ts +0 -40
- package/src/hooks/validators/useSubgraphUserValidators.ts +0 -36
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{h as t}from"./chunk-74QD4JAH.mjs";import{chainConfigs as A,defaultChainId as m}from"@berachain/config/internal";function i(o){let n=o.chainId??m,e=o.config??A[n];if(o.chainId&&o.chainId!==e.chainId)throw new t({property:"chainId",value:n,expected:`config.chainId: ${e.chainId}`});return{config:e,chainId:e.chainId}}import{ethAddress as p,isAddress as B,zeroAddress as f}from"viem";import{mainnet as d}from"@berachain/config/mainnet";var I={address:f,decimals:18,name:"Bera",symbol:"BERA",logoURI:"https://imagedelivery.net/qNj7Q3MCke89zoKzav7eDQ/tokens/0x0000000000000000000000000000000000000000.png/public"},R={address:d.tokens.wbera,decimals:18,name:"WBera",symbol:"WBERA"};function l(o){let{config:n,chainId:e}=i(o);return{address:n.honey.token,symbol:"HONEY",name:"Honey",decimals:18,chainId:e}}function b(...o){let[n,e,r]=o;if(n===void 0)return!1;let s=typeof n=="string"?n:n.address;if(typeof e=="string"&&!B(e)&&!e.startsWith("0x")){if(e==="BERA")return s.toLowerCase()===f;if(e==="WBERA")return s.toLowerCase()===d.tokens.wbera;if(e==="ETH")return s.toLowerCase()===p;if(e==="SWBERA")return s.toLowerCase()===d.tokens.swbera.toLowerCase();if(r===void 0)throw new t({property:"baseArgs",value:r,expected:"BeraJS.BaseFunctionArgs",message:"baseArgs is required when compared to a known token different than BERA or WBERA. Checking against token: "+e+" and token address: "+s});let{config:a}=i(r),c={BGT:a.tokens.bgt,HONEY:a.honey.token,SWBERA:a.tokens.swbera,ETH:p};if(e in c)return s.toLowerCase()===c[e].toLowerCase()}let k=typeof e=="object"?e.address:e;return s.toLowerCase()===k.toLowerCase()}export{i as a,I as b,R as c,l as d,b as e};
|
|
2
|
+
//# sourceMappingURL=chunk-IDFMLLDY.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/parseBaseArgs.ts","../src/utils/tokens.ts"],"sourcesContent":["import {\n type BeraConfig,\n chainConfigs,\n defaultChainId,\n} from \"@berachain/config/internal\";\n\nimport { InvalidArgumentError } from \"../errors/InvalidArgumentError\";\n\nexport function parseBaseArgs(args: BeraJS.BaseFunctionArgs) {\n const chainId = args.chainId ?? defaultChainId;\n const config: BeraConfig = args.config ?? chainConfigs[chainId];\n\n if (args.chainId && args.chainId !== config.chainId) {\n // this matches unless the config is explicitly provided\n throw new InvalidArgumentError({\n property: \"chainId\",\n value: chainId,\n expected: `config.chainId: ${config.chainId}`,\n });\n }\n\n return { config, chainId: config.chainId };\n}\n","import { type Address, ethAddress, isAddress, zeroAddress } from \"viem\";\n\nimport { mainnet } from \"@berachain/config/mainnet\";\n\nimport { InvalidArgumentError } from \"../errors/InvalidArgumentError\";\nimport type { TokenWithMetadata } from \"../types/dex\";\nimport { parseBaseArgs } from \"./parseBaseArgs\";\n\nexport const beraToken = {\n address: zeroAddress,\n decimals: 18,\n name: \"Bera\",\n symbol: \"BERA\",\n logoURI:\n \"https://imagedelivery.net/qNj7Q3MCke89zoKzav7eDQ/tokens/0x0000000000000000000000000000000000000000.png/public\",\n} as const satisfies Omit<TokenWithMetadata, \"chainId\">;\n\nexport const wBeraToken = {\n address: mainnet.tokens.wbera,\n decimals: 18,\n name: \"WBera\",\n symbol: \"WBERA\",\n} as const satisfies Omit<TokenWithMetadata, \"chainId\">;\n\nexport function getHoneyToken(baseArgs: BeraJS.BaseFunctionArgs) {\n const { config, chainId } = parseBaseArgs(baseArgs);\n\n return {\n address: config.honey.token,\n symbol: \"HONEY\",\n name: \"Honey\",\n decimals: 18,\n chainId,\n } as const satisfies TokenWithMetadata;\n}\n\ntype KnownTokens = \"BERA\" | \"WBERA\" | \"BGT\" | \"HONEY\" | \"SWBERA\" | \"ETH\";\n\ntype BaseToken =\n | {\n address: Address | string;\n }\n | Address;\n\ntype InputToken = BaseToken | string | undefined;\n\ntype IsTokenParams =\n | [\n token: InputToken,\n compareTo:\n | BaseToken\n | Extract<KnownTokens, \"BERA\" | \"WBERA\" | \"ETH\" | \"SWBERA\">,\n ]\n | [\n token: InputToken,\n compareTo: BaseToken | KnownTokens,\n baseArgs: BeraJS.BaseFunctionArgs,\n ];\n\nexport function isToken(...args: IsTokenParams): boolean {\n const [token, compareTo, baseArgs] = args;\n\n if (token === undefined) return false;\n\n const tokenAddress = typeof token === \"string\" ? token : token.address;\n\n if (\n typeof compareTo === \"string\" &&\n !isAddress(compareTo) &&\n // this is a safeguard against weird inputs from enso. `0x00`\n !compareTo.startsWith(\"0x\")\n ) {\n if (compareTo === \"BERA\") {\n return tokenAddress.toLowerCase() === zeroAddress;\n }\n if (compareTo === \"WBERA\") {\n // we are sure that wbera token is the same on all chains because it's checked on the config and forced as types\n return tokenAddress.toLowerCase() === mainnet.tokens.wbera;\n }\n\n if (compareTo === \"ETH\") {\n return tokenAddress.toLowerCase() === ethAddress;\n }\n\n if (compareTo === \"SWBERA\") {\n // we are sure that wbera token is the same on all chains because it's checked on the config and forced as types\n return tokenAddress.toLowerCase() === mainnet.tokens.swbera.toLowerCase();\n }\n\n if (baseArgs === undefined) {\n throw new InvalidArgumentError({\n property: \"baseArgs\",\n value: baseArgs,\n expected: \"BeraJS.BaseFunctionArgs\",\n message:\n \"baseArgs is required when compared to a known token different than BERA or WBERA. Checking against token: \" +\n compareTo +\n \" and token address: \" +\n tokenAddress,\n });\n }\n const { config } = parseBaseArgs(baseArgs);\n\n const tokenMap: Record<Exclude<KnownTokens, \"BERA\" | \"WBERA\">, Address> = {\n BGT: config.tokens.bgt,\n HONEY: config.honey.token,\n SWBERA: config.tokens.swbera,\n ETH: ethAddress as Address,\n } as const;\n if (compareTo in tokenMap) {\n return (\n tokenAddress.toLowerCase() ===\n tokenMap[compareTo as keyof typeof tokenMap].toLowerCase()\n );\n }\n }\n\n const compareToAddress =\n typeof compareTo === \"object\" ? compareTo.address : compareTo;\n\n return tokenAddress.toLowerCase() === compareToAddress.toLowerCase();\n}\n"],"mappings":"yCAAA,OAEE,gBAAAA,EACA,kBAAAC,MACK,6BAIA,SAASC,EAAcC,EAA+B,CAC3D,IAAMC,EAAUD,EAAK,SAAWE,EAC1BC,EAAqBH,EAAK,QAAUI,EAAaH,CAAO,EAE9D,GAAID,EAAK,SAAWA,EAAK,UAAYG,EAAO,QAE1C,MAAM,IAAIE,EAAqB,CAC7B,SAAU,UACV,MAAOJ,EACP,SAAU,mBAAmBE,EAAO,OAAO,EAC7C,CAAC,EAGH,MAAO,CAAE,OAAAA,EAAQ,QAASA,EAAO,OAAQ,CAC3C,CCtBA,OAAuB,cAAAG,EAAY,aAAAC,EAAW,eAAAC,MAAmB,OAEjE,OAAS,WAAAC,MAAe,4BAMjB,IAAMC,EAAY,CACvB,QAASC,EACT,SAAU,GACV,KAAM,OACN,OAAQ,OACR,QACE,+GACJ,EAEaC,EAAa,CACxB,QAASC,EAAQ,OAAO,MACxB,SAAU,GACV,KAAM,QACN,OAAQ,OACV,EAEO,SAASC,EAAcC,EAAmC,CAC/D,GAAM,CAAE,OAAAC,EAAQ,QAAAC,CAAQ,EAAIC,EAAcH,CAAQ,EAElD,MAAO,CACL,QAASC,EAAO,MAAM,MACtB,OAAQ,QACR,KAAM,QACN,SAAU,GACV,QAAAC,CACF,CACF,CAyBO,SAASE,KAAWC,EAA8B,CACvD,GAAM,CAACC,EAAOC,EAAWP,CAAQ,EAAIK,EAErC,GAAIC,IAAU,OAAW,MAAO,GAEhC,IAAME,EAAe,OAAOF,GAAU,SAAWA,EAAQA,EAAM,QAE/D,GACE,OAAOC,GAAc,UACrB,CAACE,EAAUF,CAAS,GAEpB,CAACA,EAAU,WAAW,IAAI,EAC1B,CACA,GAAIA,IAAc,OAChB,OAAOC,EAAa,YAAY,IAAMZ,EAExC,GAAIW,IAAc,QAEhB,OAAOC,EAAa,YAAY,IAAMV,EAAQ,OAAO,MAGvD,GAAIS,IAAc,MAChB,OAAOC,EAAa,YAAY,IAAME,EAGxC,GAAIH,IAAc,SAEhB,OAAOC,EAAa,YAAY,IAAMV,EAAQ,OAAO,OAAO,YAAY,EAG1E,GAAIE,IAAa,OACf,MAAM,IAAIW,EAAqB,CAC7B,SAAU,WACV,MAAOX,EACP,SAAU,0BACV,QACE,6GACAO,EACA,uBACAC,CACJ,CAAC,EAEH,GAAM,CAAE,OAAAP,CAAO,EAAIE,EAAcH,CAAQ,EAEnCY,EAAoE,CACxE,IAAKX,EAAO,OAAO,IACnB,MAAOA,EAAO,MAAM,MACpB,OAAQA,EAAO,OAAO,OACtB,IAAKS,CACP,EACA,GAAIH,KAAaK,EACf,OACEJ,EAAa,YAAY,IACzBI,EAASL,CAAkC,EAAE,YAAY,CAG/D,CAEA,IAAMM,EACJ,OAAON,GAAc,SAAWA,EAAU,QAAUA,EAEtD,OAAOC,EAAa,YAAY,IAAMK,EAAiB,YAAY,CACrE","names":["chainConfigs","defaultChainId","parseBaseArgs","args","chainId","defaultChainId","config","chainConfigs","InvalidArgumentError","ethAddress","isAddress","zeroAddress","mainnet","beraToken","zeroAddress","wBeraToken","mainnet","getHoneyToken","baseArgs","config","chainId","parseBaseArgs","isToken","args","token","compareTo","tokenAddress","isAddress","ethAddress","InvalidArgumentError","tokenMap","compareToAddress"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } 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
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } 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 _chunkCF3LFNXGcjs = require('./chunk-CF3LFNXG.cjs');var _chunk2YBHAMDVcjs = require('./chunk-2YBHAMDV.cjs');var _chunkDDEQFR3Mcjs = require('./chunk-DDEQFR3M.cjs');var _chunk74WA35RIcjs = require('./chunk-74WA35RI.cjs');var _chunkNMH7LHPWcjs = require('./chunk-NMH7LHPW.cjs');var _react = require('react');var _edgeconfig = require('@berachain/config/internal/edge-config');var _jsxruntime = require('react/jsx-runtime');var W=_react.createContext.call(void 0, void 0);function pe({children:e,flags:t,aggregators:a,swberaAprWindow:n="DAY"}){return _jsxruntime.jsx.call(void 0, W.Provider,{value:{..._chunkDDEQFR3Mcjs.a,...t,aggregators:a?Object.entries(a).filter(([,r])=>_edgeconfig.isFlagEnabled.call(void 0, r)).map(([r])=>r):void 0,swberaAprWindow:n},children:e})}function D(){let e=_react.useContext.call(void 0, W);if(!e)throw new Error("BeraFlagsProvider not found");return e}function fe(e){return D()[e]}var w=_react.createContext.call(void 0, {protocol:{isPaused:!1,factories:{composableStable:"enabled",weighted:"enabled",allPaused:!1}},onPoolChange:()=>{},pool:void 0});function Te(){let e=_react.useContext.call(void 0, w);if(!e)throw new (0, _chunkNMH7LHPWcjs.f)({level:"fatal",message:"BexStateContext is not defined"});return e}function he({children:e,isVaultPaused:t,labels:a,factories:n}){let[r,u]=_react.useState.call(void 0, ),s=_nullishCoalesce((_optionalChain([r, 'optionalAccess', _2 => _2.isPaused])&&!_optionalChain([r, 'optionalAccess', _3 => _3.isInRecoveryMode])), () => (!1)),l=t||_optionalChain([r, 'optionalAccess', _4 => _4.isPaused]);return _jsxruntime.jsx.call(void 0, w.Provider,{value:{protocol:{isPaused:t,factories:{...n,allPaused:n.composableStable==="paused"&&n.weighted==="paused"}},labels:a,onPoolChange:u,pool:r?{...r,disablePoolWithdrawals:!!s,disablePoolDeposits:!!l}:void 0},children:e})}var _mainnet = require('@berachain/config/mainnet');function ve(){return _react.useContext.call(void 0, F)}var F=_react.createContext.call(void 0, _mainnet.mainnet.averageBlockTime);function Ee({children:e,blockTime:t,...a}){let{config:n}=_chunk74WA35RIcjs.a.call(void 0, a);return _jsxruntime.jsx.call(void 0, F.Provider,{value:_nullishCoalesce(t, () => (n.averageBlockTime)),children:e})}var L=_react.createContext.call(void 0, void 0);function Fe({children:e,...t}){return _jsxruntime.jsx.call(void 0, L.Provider,{value:t,children:e})}function Le(){let e=_react.useContext.call(void 0, L);if(!e)throw new Error("useHoneyConfig must be used within a HoneyConfigProvider");return e}var _swr = require('swr'); var _swr2 = _interopRequireDefault(_swr);var _hooks = require('@berachain/wagmi/hooks');var _core = require('@wagmi/core');var _viem = require('viem');async function R({account:e,wagmiConfig:t,chainId:a,ensoClient:n}){let u=(await n.getBalances({useEoa:!0,chainId:_nullishCoalesce(a, () => ("all")),eoaAddress:e})).map(o=>({name:o.name,symbol:o.symbol,decimals:o.decimals,address:_chunk74WA35RIcjs.e.call(void 0, o.token,"ETH")?_chunk74WA35RIcjs.b.address:o.token,logoURI:o.logoUri,balance:{raw:o.amount.toString(),formatted:_viem.formatUnits.call(void 0, BigInt(o.amount),o.decimals)},chainId:Number(o.chainId),price:Number(o.price)})),s=Object.groupBy(u,o=>_nullishCoalesce(o.chainId, () => (0))),l=await Promise.allSettled(Object.entries(s).map(async([o,i])=>{if(!i)return;let p=_core.getChains.call(void 0, t).find(d=>d.id===Number(o));if(!p)return;let k=_optionalChain([p, 'access', _5 => _5.contracts, 'optionalAccess', _6 => _6.multicall3, 'optionalAccess', _7 => _7.address]);if(!k)return _chunk2YBHAMDVcjs.g.captureException(new (0, _chunkNMH7LHPWcjs.h)({property:"multicallAddress",value:k,expected:"Address",chainId:Number(o)})),i;let f=await _core.multicall.call(void 0, t,{chainId:Number(o),contracts:i.map(d=>_chunkCF3LFNXGcjs.b.call(void 0, {token:d,account:e,multicallAddress:k})),allowFailure:!0}),x=[];for(let d=0;d<i.length;d++){let T=i[d];if(f[d].status==="success"){let C=f[d].result;x.push({...T,balance:{raw:_nullishCoalesce(_optionalChain([C, 'optionalAccess', _8 => _8.toString, 'call', _9 => _9()]), () => ("0")),formatted:_viem.formatUnits.call(void 0, _nullishCoalesce(C, () => (0n)),T.decimals)}})}else console.error("error getting balance",f[d].error),_chunk2YBHAMDVcjs.g.captureException(_chunk2YBHAMDVcjs.a.call(void 0, {cause:f[d].error})),x.push(T)}return x})),c=[];for(let o of l)o.status==="fulfilled"?c.push(..._nullishCoalesce(o.value, () => ([]))):_chunk2YBHAMDVcjs.g.captureException(_chunk2YBHAMDVcjs.a.call(void 0, {cause:o.reason}));return c.sort((o,i)=>{let p=Number(o.balance.formatted)*(_nullishCoalesce(o.price, () => (0)));return Number(i.balance.formatted)*(_nullishCoalesce(i.price, () => (0)))-p})}function A({chainId:e}={},t){let{address:a}=_hooks.useBeraWallet.call(void 0, ),n=_hooks.useConfig.call(void 0, ),r=!!a&&(_nullishCoalesce(_optionalChain([t, 'optionalAccess', _10 => _10.opts, 'optionalAccess', _11 => _11.isEnabled]), () => (!0))),s=_swr2.default.call(void 0, r&&n?["useEnsoUserTokensWithBalances",a,e]:null,async([,l,c])=>R({account:l,wagmiConfig:n,chainId:_nullishCoalesce(c, () => ("all")),ensoClient:_chunkCF3LFNXGcjs.a.call(void 0, )}),{refreshInterval:1e5,isEnabled:r,..._optionalChain([t, 'optionalAccess', _12 => _12.opts])});return{...s,refresh:()=>s.mutate()}}function H({defaultTokenList:e=[],externalList:t=[]}){if(e.length===0)return{tokenList:t,customTokenList:t,featuredTokenList:[]};let a=e.map(s=>({...s,default:!0})),n=a.filter(s=>_optionalChain([s, 'access', _13 => _13.tags, 'optionalAccess', _14 => _14.some, 'call', _15 => _15(l=>l==="featured")])),r=[...a,...t];return{tokenList:r.filter((s,l)=>r.findIndex(c=>_chunk74WA35RIcjs.e.call(void 0, c,s))===l),customTokenList:t,featuredTokenList:n}}var ie=_react.createContext.call(void 0, void 0);function je({children:e,defaultTokens:t,edgeConfigTokenList:a,userTokens:n,onAddToken:r,onRemoveToken:u}){let{data:s,refresh:l}=A(),{tokenList:c=[],featuredTokenList:o=[]}=_react.useMemo.call(void 0, ()=>H({defaultTokenList:[...t,..._optionalChain([a, 'optionalAccess', _16 => _16.filter, 'call', _17 => _17(i=>_edgeconfig.isFlagEnabled.call(void 0, i.enabled))])],externalList:[...n,...(_nullishCoalesce(s, () => ([]))).map(i=>({...i,balance:void 0,price:void 0}))]}),[t,n,a,s]);return _jsxruntime.jsx.call(void 0, ie.Provider,{value:{tokenList:c,userTokens:n,featuredTokens:o,ensoTokens:s,onAddToken(i){r(i,{defaultTokens:t,userTokens:n,tokenList:c})},onRemoveToken:u,refresh:()=>{l()}},children:e})}exports.a = pe; exports.b = D; exports.c = fe; exports.d = w; exports.e = Te; exports.f = he; exports.g = ve; exports.h = F; exports.i = Ee; exports.j = L; exports.k = Fe; exports.l = Le; exports.m = A; exports.n = ie; exports.o = je;
|
|
2
|
+
//# sourceMappingURL=chunk-LNVR4BW6.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/snowbera/Documents/workspace/monobera/packages/berajs/dist/chunk-LNVR4BW6.cjs","../src/contexts/BeraFlags/BeraFlags.tsx","../src/contexts/BexStatusProvider.tsx","../src/contexts/block-time-provider.tsx","../src/contexts/HoneyConfigProvider.tsx","../src/hooks/enso/useEnsoUserTokensWithBalances.ts","../src/actions/enso/getEnsoUserTokensWithBalances.ts","../src/contexts/TokensProvider.tsx","../src/utils/formatTokenList.ts"],"names":["BeraFlagContext","createContext","BeraFlagsProvider","children","flags","aggregators","swberaAprWindow","jsx","defaultFlags","value","isFlagEnabled","key","useBeraFlags","context","useContext","useBeraFlag","BexStateContext","useBexStatus","BeraError","BexStatusProvider","isVaultPaused","labels","factories","poolState","setPoolState","useState","disablePoolWithdrawals","disablePoolDeposits","useBlockTime","BlockTimeContext","mainnet","BlockTimeProvider","blockTime","args","config","parseBaseArgs","HoneyConfigContext","HoneyConfigProvider","props","useHoneyConfig","getEnsoUserTokensWithBalances","account","wagmiConfig","chainId","ensoClient","tokens","balance","isToken","beraToken","formatUnits","tokenByChainId","a","balances","chainTokens","chainConfig","getChains","chain","multicallAddress","BeraMonitoring","InvalidArgumentError","multicall","token","getBalanceCall","tokensWithBalances","index","initBeraError","flattenedBalances","result","b","aValue","useEnsoUserTokensWithBalances","options","fromAddress","useBeraWallet","useConfig","isEnabled","swrResponse","useSWR","getEnsoClient","formatTokenList","defaultTokenList","externalList","defaultList","featuredTokenList","tag","mergedList","item","i","TokenContext","TokensProvider","defaultTokens","edgeConfigTokenList","userTokens","onAddToken","onRemoveToken","ensoTokens","refresh","tokenList","useMemo","t","tk"],"mappings":"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","file":"/Users/snowbera/Documents/workspace/monobera/packages/berajs/dist/chunk-LNVR4BW6.cjs","sourcesContent":[null,"import { createContext, useContext } from \"react\";\n\nimport {\n type EdgeConfigSchema,\n isFlagEnabled,\n} from \"@berachain/config/internal/edge-config\";\n\nimport { type BeraFlags, defaultFlags } from \"./defaultFlags\";\n\nexport type { BeraFlags };\n\nexport type BeraFlagsContextReturn = BeraFlags & {\n /**\n * A list of aggregators that are enabled. If not provided, all aggregators are enabled.\n */\n aggregators: string[] | undefined;\n swberaAprWindow: Exclude<\n EdgeConfigSchema[\"pol\"][\"swberaAprWindow\"],\n undefined\n >;\n};\n\nconst BeraFlagContext = createContext<BeraFlagsContextReturn | undefined>(\n undefined,\n);\n\nexport function BeraFlagsProvider({\n children,\n flags,\n aggregators,\n swberaAprWindow = \"DAY\",\n}: {\n children: React.ReactNode;\n flags: BeraFlags;\n aggregators?: NonNullable<EdgeConfigSchema[\"bex\"]>[\"aggregators\"];\n swberaAprWindow?: EdgeConfigSchema[\"pol\"][\"swberaAprWindow\"];\n}) {\n return (\n <BeraFlagContext.Provider\n value={{\n ...defaultFlags,\n ...flags,\n aggregators: aggregators\n ? Object.entries(aggregators)\n .filter(([, value]) => isFlagEnabled(value))\n .map(([key]) => key)\n : undefined,\n swberaAprWindow,\n }}\n >\n {children}\n </BeraFlagContext.Provider>\n );\n}\n\nexport function useBeraFlags() {\n const context = useContext(BeraFlagContext);\n if (!context) {\n throw new Error(\"BeraFlagsProvider not found\");\n }\n return context;\n}\n\nexport function useBeraFlag<T extends keyof BeraFlagsContextReturn>(\n key: T,\n): BeraFlagsContextReturn[T] {\n const flags = useBeraFlags();\n return flags[key];\n}\n","import {\n createContext,\n type Dispatch,\n type PropsWithChildren,\n type SetStateAction,\n useContext,\n useState,\n} from \"react\";\nimport type { Hex } from \"viem\";\n\nimport type { EdgeConfigSchema } from \"@berachain/config/internal/edge-config\";\n\nimport { BeraError } from \"../errors/BeraError\";\n\ntype FactoryStatus = {\n /**\n * If the composable stable factory is enabled\n */\n composableStable: \"paused\" | \"enabled\";\n /**\n * If the weighted factory is enabled\n */\n weighted: \"paused\" | \"enabled\";\n};\nexport interface BexStatusProviderProps {\n isVaultPaused: boolean;\n pool?: {\n id: Hex;\n isInRecoveryMode: boolean;\n isPaused: boolean;\n };\n factories: FactoryStatus;\n labels?: NonNullable<EdgeConfigSchema[\"bex\"]>[\"emergencyLabels\"];\n}\n\nexport const BexStateContext = createContext<{\n protocol: {\n isPaused: boolean;\n factories: FactoryStatus & { allPaused: boolean };\n };\n onPoolChange: Dispatch<SetStateAction<BexStatusProviderProps[\"pool\"]>>;\n pool?: {\n id: Hex;\n isInRecoveryMode: boolean;\n isPaused: boolean;\n disablePoolWithdrawals: boolean;\n disablePoolDeposits: boolean;\n };\n labels?: NonNullable<EdgeConfigSchema[\"bex\"]>[\"emergencyLabels\"];\n}>({\n protocol: {\n isPaused: false,\n factories: {\n composableStable: \"enabled\",\n weighted: \"enabled\",\n allPaused: false,\n },\n },\n onPoolChange: () => {},\n pool: undefined,\n});\n\n/**\n * @description Determines the status of a pool or vault and returns the appropriate messages and flags to disable functionality.\n * More information here https://www.notion.so/berachain/BEX-RecoveryMode-and-Pause-explained-17c6120abced80e0985dd589b57ff018\n *\n * @returns status flags to enable/disable/notify users across the BEX\n *\n **/\nexport function useBexStatus() {\n const context = useContext(BexStateContext);\n\n if (!context) {\n throw new BeraError({\n level: \"fatal\",\n message: \"BexStateContext is not defined\",\n });\n }\n\n return context;\n}\n\nexport function BexStatusProvider({\n children,\n isVaultPaused,\n labels,\n factories,\n}: PropsWithChildren<BexStatusProviderProps>) {\n const [poolState, setPoolState] = useState<BexStatusProviderProps[\"pool\"]>();\n // Determine whether to disable withdrawals for a pool (vault pause does not impact this)\n const disablePoolWithdrawals =\n (poolState?.isPaused && !poolState?.isInRecoveryMode) ?? false;\n\n // Determine whether to disable deposits for a pool (vault pause does not impact this)\n const disablePoolDeposits = isVaultPaused || poolState?.isPaused;\n\n // TODO: we dont yet support anything to disable staking/unstaking within reward vaults if they get paused\n\n return (\n <BexStateContext.Provider\n value={{\n protocol: {\n isPaused: isVaultPaused,\n factories: {\n ...factories,\n allPaused:\n factories.composableStable === \"paused\" &&\n factories.weighted === \"paused\",\n },\n },\n labels,\n onPoolChange: setPoolState,\n pool: poolState\n ? {\n ...poolState,\n disablePoolWithdrawals: !!disablePoolWithdrawals,\n disablePoolDeposits: !!disablePoolDeposits,\n }\n : undefined,\n }}\n >\n {children}\n </BexStateContext.Provider>\n );\n}\n","import { createContext, type PropsWithChildren, useContext } from \"react\";\n\nimport { mainnet } from \"@berachain/config/mainnet\";\n\nimport { parseBaseArgs } from \"../utils/parseBaseArgs\";\n\n/**\n * Average berachain block time in seconds\n */\nexport function useBlockTime(): number {\n return useContext(BlockTimeContext);\n}\n\nexport const BlockTimeContext = createContext<number>(\n // this is the default block time for berachain, but actually overridden by the block time provider\n mainnet.averageBlockTime,\n);\n\nexport function BlockTimeProvider({\n children,\n blockTime,\n ...args\n}: PropsWithChildren<{\n blockTime?: number;\n}> &\n BeraJS.BaseFunctionArgs) {\n const { config } = parseBaseArgs(args);\n\n return (\n <BlockTimeContext.Provider value={blockTime ?? config.averageBlockTime}>\n {children}\n </BlockTimeContext.Provider>\n );\n}\n","import { createContext, useContext } from \"react\";\n\nimport type { HoneyFeeMap } from \"../actions/honey/getHoneyFees\";\nimport type { TokenWithMetadata } from \"../types/dex\";\nimport type { PythPriceFeedMap } from \"../types/honeySwap\";\n\nexport const HoneyConfigContext = createContext<\n HoneyConfigContextReturn | undefined\n>(undefined);\n\nexport type TokenWithOrder = TokenWithMetadata & {\n order: number;\n};\nexport interface HoneyConfigContextReturn {\n /**\n * Map of the Pyth price feed ids for each collateral\n */\n priceFeedMap: PythPriceFeedMap;\n /**\n * This is the list of all the collaterals that are supported by the Honey protocol\n */\n collateralList: TokenWithOrder[];\n /**\n * This is the main collateral that is used to calculate the relative cap limit\n */\n referenceCollateral: TokenWithOrder;\n /**\n * An object that maps the redeem/mint rate for each collateral and the weighted rates for the basket mode\n */\n feeMap: HoneyFeeMap;\n flags: {\n /**\n * If true, mint/redeem will also update pyth prices\n */\n isPythWrapperEnabled: boolean;\n };\n /**\n * Honey protocol configs\n */\n protocol: {\n /**\n * Honey protocol paused state\n */\n isPaused: boolean;\n /**\n * The label for the Honey protocol paused message\n */\n pausedBannerLabel?: string;\n };\n}\n\nexport interface HoneyConfigProviderProps extends HoneyConfigContextReturn {\n children: React.ReactNode;\n}\n\nexport function HoneyConfigProvider({\n children,\n ...props\n}: HoneyConfigProviderProps) {\n return (\n <HoneyConfigContext.Provider value={props}>\n {children}\n </HoneyConfigContext.Provider>\n );\n}\n\nexport function useHoneyConfig() {\n const context = useContext(HoneyConfigContext);\n if (!context) {\n throw new Error(\"useHoneyConfig must be used within a HoneyConfigProvider\");\n }\n return context;\n}\n","import useSWR from \"swr\";\n\nimport { useBeraWallet, useConfig } from \"@berachain/wagmi/hooks\";\n\nimport { getEnsoClient } from \"../../actions/clients/getEnsoClient\";\nimport { getEnsoUserTokensWithBalances } from \"../../actions/enso/getEnsoUserTokensWithBalances\";\nimport { POLLING } from \"../../enum/polling\";\nimport type { BalanceToken } from \"../../types/dex\";\nimport type { DefaultHookOptions } from \"../../types/global\";\n\nexport function useEnsoUserTokensWithBalances(\n { chainId }: { chainId?: number } = {},\n options?: DefaultHookOptions,\n) {\n const { address: fromAddress } = useBeraWallet();\n const wagmiConfig = useConfig();\n const isEnabled = !!fromAddress && (options?.opts?.isEnabled ?? true);\n\n const QUERY_KEY =\n isEnabled && wagmiConfig\n ? ([\"useEnsoUserTokensWithBalances\", fromAddress, chainId] as const)\n : null;\n\n const swrResponse = useSWR(\n QUERY_KEY,\n async ([, fromAddress, chainId]): Promise<BalanceToken[]> =>\n getEnsoUserTokensWithBalances({\n account: fromAddress,\n wagmiConfig,\n chainId: chainId ?? \"all\",\n ensoClient: getEnsoClient(),\n }),\n {\n refreshInterval: POLLING.NORMAL,\n isEnabled,\n ...options?.opts,\n },\n );\n return {\n ...swrResponse,\n refresh: () => swrResponse.mutate(),\n };\n}\n","import type { EnsoClient } from \"@ensofinance/sdk\";\nimport { type Config, getChains, multicall } from \"@wagmi/core\";\nimport { type Address, formatUnits } from \"viem\";\n\nimport { BeraMonitoring } from \"../../errors/BeraMonitoring\";\nimport { InvalidArgumentError } from \"../../errors/InvalidArgumentError\";\nimport { initBeraError } from \"../../errors/initBeraError\";\nimport type { BalanceToken } from \"../../types/dex\";\nimport { beraToken, isToken } from \"../../utils/tokens\";\nimport { getBalanceCall } from \"../tokens/getWalletBalances\";\n\n/**\n * Get user balances for each supported chain.\n *\n * This uses enso's balance endpoint to get the balances and RPC to get fresh balances.\n */\nexport async function getEnsoUserTokensWithBalances({\n account,\n wagmiConfig,\n chainId,\n ensoClient,\n}: {\n account: Address;\n wagmiConfig: Config;\n chainId: number | \"all\";\n ensoClient: EnsoClient;\n}): Promise<BalanceToken[]> {\n const ensoBalances = await ensoClient.getBalances({\n useEoa: true,\n chainId: chainId ?? \"all\",\n eoaAddress: account,\n });\n\n const tokens: BalanceToken[] = ensoBalances.map(\n (balance) =>\n ({\n name: balance.name,\n symbol: balance.symbol,\n decimals: balance.decimals,\n address: isToken(balance.token, \"ETH\")\n ? beraToken.address\n : balance.token,\n logoURI: balance.logoUri,\n balance: {\n raw: balance.amount.toString(),\n formatted: formatUnits(BigInt(balance.amount), balance.decimals),\n },\n\n chainId: Number(\n // @ts-expect-error - balance.chainId is defined just not typed by enso\n balance.chainId,\n ),\n price: Number(balance.price),\n }) as const satisfies BalanceToken,\n );\n\n const tokenByChainId = Object.groupBy(tokens, (a) => a.chainId ?? 0);\n\n const balances = await Promise.allSettled(\n Object.entries(tokenByChainId).map(async ([chainId, chainTokens]) => {\n if (!chainTokens) return undefined;\n const chainConfig = getChains(wagmiConfig).find(\n (chain) => chain.id === Number(chainId),\n );\n\n if (!chainConfig) {\n // if we've queried a chain that is not supported, we need to return undefined\n return undefined;\n }\n\n const multicall3 = chainConfig.contracts?.multicall3;\n\n const multicallAddress = multicall3?.address;\n\n if (!multicallAddress) {\n // if multicall is not supported on this chain, we need to use the enso balance\n // first let's report the error, as this is likely unexpected\n BeraMonitoring.captureException(\n new InvalidArgumentError({\n property: \"multicallAddress\",\n value: multicallAddress,\n expected: \"Address\",\n chainId: Number(chainId),\n }),\n );\n\n // we can return the tokens as is, as the balance is already set from the enso client\n return chainTokens;\n }\n\n const balances = await multicall(wagmiConfig, {\n chainId: Number(chainId),\n contracts: chainTokens.map((token) =>\n getBalanceCall({\n token,\n account,\n multicallAddress,\n }),\n ),\n allowFailure: true,\n });\n\n const tokensWithBalances: BalanceToken[] = [];\n\n for (let index = 0; index < chainTokens.length; index++) {\n const token = chainTokens[index];\n if (balances[index].status === \"success\") {\n const balance = balances[index].result;\n\n tokensWithBalances.push({\n ...token,\n balance: {\n raw: balance?.toString() ?? \"0\",\n formatted: formatUnits(balance ?? 0n, token.decimals),\n },\n });\n } else {\n console.error(\"error getting balance\", balances[index].error);\n BeraMonitoring.captureException(\n initBeraError({ cause: balances[index].error }),\n );\n // uses enso balance as fallback\n tokensWithBalances.push(token);\n }\n }\n\n return tokensWithBalances;\n }),\n );\n\n const flattenedBalances: BalanceToken[] = [];\n for (const result of balances) {\n if (result.status === \"fulfilled\") {\n flattenedBalances.push(...(result.value ?? []));\n } else {\n BeraMonitoring.captureException(initBeraError({ cause: result.reason }));\n }\n }\n\n return flattenedBalances.sort((a, b) => {\n const aValue = Number(a.balance.formatted) * (a.price ?? 0);\n const bValue = Number(b.balance.formatted) * (b.price ?? 0);\n return bValue - aValue;\n });\n}\n","import { createContext, type PropsWithChildren, useMemo } from \"react\";\n\nimport {\n type EdgeConfigSchema,\n isFlagEnabled,\n} from \"@berachain/config/internal/edge-config\";\n\nimport { useEnsoUserTokensWithBalances } from \"../hooks/enso/useEnsoUserTokensWithBalances\";\nimport type { BalanceToken, Token, TokenWithMetadata } from \"../types/dex\";\nimport { formatTokenList } from \"../utils/formatTokenList\";\n\nexport interface TokensProviderContext {\n tokenList: TokenWithMetadata[];\n userTokens: Token[];\n featuredTokens: TokenWithMetadata[];\n onRemoveToken: (token: Token) => void;\n onAddToken: (token: Token) => void;\n refresh: () => void;\n ensoTokens: BalanceToken[] | undefined;\n}\n\nexport const TokenContext = createContext<TokensProviderContext | undefined>(\n undefined,\n);\n\nexport interface TokensProviderProps\n extends Omit<\n TokensProviderContext,\n \"tokenList\" | \"onAddToken\" | \"featuredTokens\" | \"ensoTokens\"\n > {\n onAddToken: (\n token: Token,\n context: {\n defaultTokens: TokenWithMetadata[];\n userTokens: Token[];\n tokenList: TokenWithMetadata[];\n },\n ) => void;\n defaultTokens: TokenWithMetadata[];\n edgeConfigTokenList: EdgeConfigSchema[\"tokens\"];\n}\n\nexport function TokensProvider({\n children,\n defaultTokens,\n edgeConfigTokenList,\n userTokens,\n onAddToken,\n onRemoveToken,\n}: PropsWithChildren<Omit<TokensProviderProps, \"refresh\">>) {\n const { data: ensoTokens, refresh } = useEnsoUserTokensWithBalances();\n\n const { tokenList = [], featuredTokenList = [] } = useMemo(\n () =>\n formatTokenList({\n defaultTokenList: [\n ...defaultTokens,\n ...(edgeConfigTokenList?.filter((token) =>\n isFlagEnabled(token.enabled),\n ) as TokenWithMetadata[]),\n ],\n externalList: [\n ...userTokens,\n ...(ensoTokens ?? []).map((t) => ({\n ...t,\n balance: undefined,\n price: undefined,\n })),\n ],\n }),\n [defaultTokens, userTokens, edgeConfigTokenList, ensoTokens],\n );\n\n return (\n <TokenContext.Provider\n value={{\n tokenList,\n userTokens,\n featuredTokens: featuredTokenList,\n ensoTokens,\n onAddToken(tk) {\n onAddToken(tk, { defaultTokens, userTokens, tokenList });\n },\n onRemoveToken,\n refresh: () => {\n refresh();\n },\n }}\n >\n {children}\n </TokenContext.Provider>\n );\n}\n","import type { Token, TokenWithMetadata } from \"../types/dex\";\nimport { isToken } from \"./tokens\";\n\nexport interface FormatTokenListReturnType {\n /**\n * Token list including custom tokens\n */\n tokenList: Token[];\n /**\n * Custom token list (added by the user)\n */\n customTokenList?: Token[];\n /**\n * Featured token list\n */\n featuredTokenList?: Token[];\n}\n\nfunction formatTokenList({\n defaultTokenList = [],\n externalList = [],\n}: {\n defaultTokenList: TokenWithMetadata[];\n externalList?: Token[];\n}): FormatTokenListReturnType {\n if (defaultTokenList.length === 0) {\n return {\n tokenList: externalList,\n customTokenList: externalList,\n featuredTokenList: [],\n };\n }\n\n const defaultList = defaultTokenList.map((token) => {\n return { ...token, default: true };\n });\n\n const featuredTokenList = defaultList.filter((token) => {\n return token.tags?.some((tag) => tag === \"featured\");\n });\n\n const mergedList = [...defaultList, ...externalList];\n\n const uniqueList = mergedList.filter(\n (item, index) => mergedList.findIndex((i) => isToken(i, item)) === index,\n );\n\n return {\n tokenList: uniqueList,\n customTokenList: externalList,\n featuredTokenList,\n };\n}\n\nexport { formatTokenList };\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as t}from"./chunk-PLIH6KQM.mjs";import{c as T,e as a}from"./chunk-IDFMLLDY.mjs";function m(e){return{...e,...a(e,"BERA")&&T}}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 t(e).times(i),s=new t(r).times(o);if(n.lt(.01)||s.lt(.01)||n.isZero()||s.isZero())return 0;let u=s.div(n);return Number(new t(1).minus(u).toFixed())};export{m as a,d as b,g as c};
|
|
2
|
+
//# sourceMappingURL=chunk-MJZHJFZO.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/tokenWrapping.ts","../src/utils/math.ts"],"sourcesContent":["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"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/utils/tokenWrapping.ts","../src/utils/math.ts"],"sourcesContent":["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"],"mappings":"yFAMO,SAASA,EAAqCC,EAAa,CAChE,MAAO,CACL,GAAGA,EACH,GAAIC,EAAQD,EAAO,MAAM,GAAKE,CAChC,CACF,CAEO,SAASC,EAAsCC,EAAkB,CACtE,OAAOA,EAAO,IAAKJ,GAAUD,EAAgBC,CAAK,CAAC,CACrD,CCLO,IAAMK,EAAqB,CAChCC,EACAC,EACAC,EACAC,IACW,CACX,GAAI,CAACH,GAAgB,CAACC,GAAiB,CAACC,GAAY,CAACC,EAAW,MAAO,GAEvE,IAAMC,EAAQ,IAAIC,EAAUL,CAAY,EAAE,MAAME,CAAQ,EAClDI,EAAS,IAAID,EAAUJ,CAAa,EAAE,MAAME,CAAS,EAI3D,GADIC,EAAM,GAAG,GAAI,GAAKE,EAAO,GAAG,GAAI,GAChCF,EAAM,OAAO,GAAKE,EAAO,OAAO,EAAG,MAAO,GAE9C,IAAMC,EAAQD,EAAO,IAAIF,CAAK,EAC9B,OAAO,OAAO,IAAIC,EAAU,CAAC,EAAE,MAAME,CAAK,EAAE,QAAQ,CAAC,CACvD","names":["wrapNativeToken","token","isToken","wBeraToken","wrapNativeTokens","tokens","computePriceImpact","tokenInPrice","tokenOutPrice","inAmount","outAmount","usdIn","bignumber_js_default","usdOut","ratio"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e={isGovernanceEnabled:!0,enableEip5792:!1,proxyAggregatorsThroughVercel:!1,isEmbeddedWalletsEnabled:!0,sponsorGas:!1,enableSimulateCalls:!1,isBendVaultDataHourly:!0,isBendLoopingEnabled:!1,isMultiChainZapBendEnabled:!1,isZapStakeBeraEnabled:!1,mockValidatorOperator:!1,mockValidatorRewardAllocator:!1,isBgtPolRewardToken:!0,mockRewardDurationManager:!1,mockIncentiveManager:!1,isHoneyPythWrapperEnabled:!0};export{e as a};
|
|
2
|
+
//# sourceMappingURL=chunk-MK5NS5B5.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/contexts/BeraFlags/defaultFlags.ts"],"sourcesContent":["import type { flags } from \"@berachain/config/internal/flags\";\n\ntype ClientSideFlags = keyof typeof flags;\n\nexport type BeraFlags = Record<\n Extract<\n ClientSideFlags,\n // We don't want to have all flags on the context. Just the ones that cannot be used server side only\n // this is because we generally should prefer server side flags, also according to flag-sdk docs\n | \"isGovernanceEnabled\"\n | \"enableEip5792\"\n | \"proxyAggregatorsThroughVercel\"\n | \"isEmbeddedWalletsEnabled\"\n | \"sponsorGas\"\n | \"enableSimulateCalls\"\n | \"isBendVaultDataHourly\"\n | \"isBendLoopingEnabled\"\n | \"isMultiChainZapBendEnabled\"\n | \"isZapStakeBeraEnabled\"\n | \"mockValidatorOperator\"\n | \"mockValidatorRewardAllocator\"\n | \"isBgtPolRewardToken\"\n | \"mockRewardDurationManager\"\n | \"mockIncentiveManager\"\n | \"isHoneyPythWrapperEnabled\"\n >,\n boolean | undefined\n>;\n\n/**\n * @private\n */\nexport const defaultFlags: BeraFlags = {\n isGovernanceEnabled: true,\n enableEip5792: false,\n proxyAggregatorsThroughVercel: false,\n isEmbeddedWalletsEnabled: true,\n sponsorGas: false,\n enableSimulateCalls: false,\n isBendVaultDataHourly: true,\n isBendLoopingEnabled: false,\n isMultiChainZapBendEnabled: false,\n isZapStakeBeraEnabled: false,\n mockValidatorOperator: false,\n mockValidatorRewardAllocator: false,\n isBgtPolRewardToken: true,\n mockRewardDurationManager: false,\n mockIncentiveManager: false,\n isHoneyPythWrapperEnabled: true,\n};\n"],"mappings":"AAgCO,IAAMA,EAA0B,CACrC,oBAAqB,GACrB,cAAe,GACf,8BAA+B,GAC/B,yBAA0B,GAC1B,WAAY,GACZ,oBAAqB,GACrB,sBAAuB,GACvB,qBAAsB,GACtB,2BAA4B,GAC5B,sBAAuB,GACvB,sBAAuB,GACvB,6BAA8B,GAC9B,oBAAqB,GACrB,0BAA2B,GAC3B,qBAAsB,GACtB,0BAA2B,EAC7B","names":["defaultFlags"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } 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 _class; var _class2;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&&_optionalChain([t, 'optionalAccess', _2 => _2.reasons, 'optionalAccess', _3 => _3.some, 'call', _4 => _4(u=>u===o)]))return{key:s,category:n,errorMSG:t.errorMSG,matchedByReason:!0};if(_optionalChain([t, 'optionalAccess', _5 => _5.keywords, 'optionalAccess', _6 => _6.some, 'call', _7 => _7(u=>_optionalChain([r, 'optionalAccess', _8 => _8.toLowerCase, 'call', _9 => _9(), 'access', _10 => _10.includes, 'call', _11 => _11(u.toLowerCase().trim())]))]))return{key:s,category:n,errorMSG:t.errorMSG,matchedByReason:!1}}}return null}function F({reason:o,message:r}){return _nullishCoalesce(_optionalChain([E, 'call', _12 => _12({reason:o,message:r}), 'optionalAccess', _13 => _13.errorMSG]), () => (p))}var _viem = require('viem');var _internal = require('@berachain/config/internal');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 _viem.BaseError||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)&&_optionalChain([o, 'access', _14 => _14.args, 'optionalAccess', _15 => _15.at, 'call', _16 => _16(0)])?_optionalChain([o, 'access', _17 => _17.args, 'optionalAccess', _18 => _18.at, 'call', _19 => _19(0)]):o.errorName}function f({error:o,abi:r,revertIfUnknown:n=!0}){if(!g(o)){if(n)throw o;return o instanceof _viem.BaseError?{reason:o.shortMessage,rootCause:o}:{reason:o.message,rootCause:o}}let e=o;for(;g(e);){if(l(e,"ContractFunctionExecutionError",_viem.ContractFunctionExecutionError)){e=e.cause;continue}if(l(e,"TransactionExecutionError",_viem.TransactionExecutionError)&&e.cause instanceof _viem.AtomicReadyWalletRejectedUpgradeError)return{reason:"AtomicReadyWalletRejectedUpgradeError",rootCause:e.cause};if(l(e,"RpcRequestError",_viem.RpcRequestError)){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=_viem.decodeErrorResult.call(void 0, {data:e.data,abi:[...S,..._nullishCoalesce(r, () => ([]))]});return{reason:_nullishCoalesce(P(a), () => (e.shortMessage)),rootCause:e}}if(l(e,"ContractFunctionRevertedError",_viem.ContractFunctionRevertedError))return{reason:_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(e.reason, () => (e.signature)), () => (_optionalChain([e, 'access', _20 => _20.data, 'optionalAccess', _21 => _21.errorName]))), () => (e.shortMessage)),rootCause:e};if(l(e,"UserRejectedRequestError",_viem.UserRejectedRequestError))return{reason:"UserRejectedRequestError",rootCause:e};if(l(e,"HttpRequestError",_viem.HttpRequestError))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 =class o extends Error{__init() {this.reason=null}__init2() {this._tags={}}set tags(r){this._tags=r}get tags(){return{...this._tags,"error.displayMessage":this.displayMessage,"error.reason":this.reason,"error.level":this.level}}__init3() {this.level="error"}__init4() {this.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 _viem.BaseError?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});_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);,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=_nullishCoalesce(_optionalChain([i, 'optionalAccess', _22 => _22.reason]), () => (null))}catch (e2){}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=_optionalChain([i, 'optionalAccess', _23 => _23.errorMSG]),i&&!i.matchedByReason&&this.reason&&(this.reason=i.key)}this.displayMessage=_nullishCoalesce(A, () => (p)),this.tags={...this.tags,...u},!_internal.appConfig.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())}}, _class);var _mainnet = require('@berachain/config/mainnet');var R= (_class2 =class o extends d{static isCorsError(r){return r.cause instanceof Response&&r.cause.type==="cors"}__init5() {this.queryRichfulDomains=[_mainnet.mainnet.bex.aggregatorsProxyUrl,"https://api.fly.trade/aggregator/quote","https://open-api.openocean.finance/v4/bera/swap","/api/aggregators?aggregator",_mainnet.mainnet.bonder]}static __initStatic() {this.REASON_MAP={429:"RATE_LIMITED_429",NETWORK_ERROR:"NETWORK_ERROR",CORS_ERROR:"CORS"}}constructor(r){if(super(r);_class2.prototype.__init5.call(this);,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=_nullishCoalesce(r.level, () => ("warning"));else{let a=this.tryMatchNetworkError();a&&(this.reason=_nullishCoalesce(this.reason, () => (a.reason)),this.level=_nullishCoalesce(r.level, () => ("warning")),this.endpoint.url=_nullishCoalesce(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 (e3){}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}}, _class2.__initStatic(), _class2);var w=class extends d{constructor(r){super(r),this.level=_nullishCoalesce(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}};exports.a = E; exports.b = F; exports.c = S; exports.d = P; exports.e = f; exports.f = d; exports.g = R; exports.h = w;
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } 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 _class; var _class2;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&&_optionalChain([t, 'optionalAccess', _2 => _2.reasons, 'optionalAccess', _3 => _3.some, 'call', _4 => _4(u=>u===o)]))return{key:s,category:n,errorMSG:t.errorMSG,matchedByReason:!0};if(_optionalChain([t, 'optionalAccess', _5 => _5.keywords, 'optionalAccess', _6 => _6.some, 'call', _7 => _7(u=>_optionalChain([r, 'optionalAccess', _8 => _8.toLowerCase, 'call', _9 => _9(), 'access', _10 => _10.includes, 'call', _11 => _11(u.toLowerCase().trim())]))]))return{key:s,category:n,errorMSG:t.errorMSG,matchedByReason:!1}}}return null}function F({reason:o,message:r}){return _nullishCoalesce(_optionalChain([E, 'call', _12 => _12({reason:o,message:r}), 'optionalAccess', _13 => _13.errorMSG]), () => (p))}var _viem = require('viem');var _internal = require('@berachain/config/internal');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 _viem.BaseError||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)&&_optionalChain([o, 'access', _14 => _14.args, 'optionalAccess', _15 => _15.at, 'call', _16 => _16(0)])?_optionalChain([o, 'access', _17 => _17.args, 'optionalAccess', _18 => _18.at, 'call', _19 => _19(0)]):o.errorName}function f({error:o,abi:r,revertIfUnknown:n=!0}){if(!g(o)){if(n)throw o;return o instanceof _viem.BaseError?{reason:o.shortMessage,rootCause:o}:{reason:o.message,rootCause:o}}let e=o;for(;g(e);){if(l(e,"ContractFunctionExecutionError",_viem.ContractFunctionExecutionError)){e=e.cause;continue}if(l(e,"TransactionExecutionError",_viem.TransactionExecutionError)&&e.cause instanceof _viem.AtomicReadyWalletRejectedUpgradeError)return{reason:"AtomicReadyWalletRejectedUpgradeError",rootCause:e.cause};if(l(e,"RpcRequestError",_viem.RpcRequestError)){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=_viem.decodeErrorResult.call(void 0, {data:e.data,abi:[...S,..._nullishCoalesce(r, () => ([]))]});return{reason:_nullishCoalesce(P(a), () => (e.shortMessage)),rootCause:e}}if(l(e,"ContractFunctionRevertedError",_viem.ContractFunctionRevertedError))return{reason:_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(e.reason, () => (e.signature)), () => (_optionalChain([e, 'access', _20 => _20.data, 'optionalAccess', _21 => _21.errorName]))), () => (e.shortMessage)),rootCause:e};if(l(e,"UserRejectedRequestError",_viem.UserRejectedRequestError))return{reason:"UserRejectedRequestError",rootCause:e};if(l(e,"HttpRequestError",_viem.HttpRequestError))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 =class o extends Error{__init() {this.reason=null}__init2() {this._tags={}}set tags(r){this._tags=r}get tags(){return{...this._tags,"error.displayMessage":this.displayMessage,"error.reason":this.reason,"error.level":this.level}}__init3() {this.level="error"}__init4() {this.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 _viem.BaseError?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});_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);,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=_nullishCoalesce(_optionalChain([i, 'optionalAccess', _22 => _22.reason]), () => (null))}catch (e2){}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=_optionalChain([i, 'optionalAccess', _23 => _23.errorMSG]),i&&!i.matchedByReason&&this.reason&&(this.reason=i.key)}this.displayMessage=_nullishCoalesce(A, () => (p)),this.tags={...this.tags,...u},!_internal.appConfig.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())}}, _class);var _mainnet = require('@berachain/config/mainnet');var R= (_class2 =class o extends d{static isCorsError(r){return r.cause instanceof Response&&r.cause.type==="cors"}__init5() {this.queryRichfulDomains=[_mainnet.mainnet.bex.aggregatorsProxyUrl,"https://api.fly.trade/aggregator/quote","https://open-api.openocean.finance/v4/bera/swap","/api/aggregators?aggregator",_mainnet.mainnet.staking]}static __initStatic() {this.REASON_MAP={429:"RATE_LIMITED_429",NETWORK_ERROR:"NETWORK_ERROR",CORS_ERROR:"CORS"}}constructor(r){if(super(r);_class2.prototype.__init5.call(this);,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=_nullishCoalesce(r.level, () => ("warning"));else{let a=this.tryMatchNetworkError();a&&(this.reason=_nullishCoalesce(this.reason, () => (a.reason)),this.level=_nullishCoalesce(r.level, () => ("warning")),this.endpoint.url=_nullishCoalesce(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 (e3){}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}}, _class2.__initStatic(), _class2);var w=class extends d{constructor(r){super(r),this.level=_nullishCoalesce(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}};exports.a = E; exports.b = F; exports.c = S; exports.d = P; exports.e = f; exports.f = d; exports.g = R; exports.h = w;
|
|
2
|
+
//# sourceMappingURL=chunk-NMH7LHPW.cjs.map
|