@berachain/berajs 0.2.5 → 0.2.6-patch.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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-7SMWQ6SN.mjs → chunk-3ZTAIOHH.mjs} +2 -2
- package/dist/chunk-3ZTAIOHH.mjs.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-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-I4V54RRZ.cjs +4 -0
- package/dist/chunk-I4V54RRZ.cjs.map +1 -0
- package/dist/chunk-I7M43BB4.cjs +2 -0
- package/dist/chunk-I7M43BB4.cjs.map +1 -0
- package/dist/chunk-IDFMLLDY.mjs +2 -0
- package/dist/chunk-IDFMLLDY.mjs.map +1 -0
- package/dist/chunk-KRVNPZLF.mjs +2 -0
- package/dist/chunk-KRVNPZLF.mjs.map +1 -0
- package/dist/{chunk-3YXSUBA5.mjs → chunk-MJZHJFZO.mjs} +2 -2
- 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-PKXAW6MO.cjs → chunk-NVHV2LDK.cjs} +2 -2
- package/dist/chunk-NVHV2LDK.cjs.map +1 -0
- package/dist/{chunk-FCWDGE62.cjs → chunk-NVOJIQUM.cjs} +2 -2
- package/dist/chunk-NVOJIQUM.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-ECRMUMTA.mjs → chunk-PLIH6KQM.mjs} +2 -2
- 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-YZV5LKIP.cjs → chunk-QXNF3YT7.cjs} +2 -2
- package/dist/chunk-QXNF3YT7.cjs.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-WIN4PK2Z.mjs +4 -0
- package/dist/chunk-WIN4PK2Z.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 +6 -7
- package/src/abi/enso/ensoWalletV2Factory.ts +9 -0
- package/src/abi/exports.ts +1 -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/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/getVaultHistory.ts +2 -2
- package/src/actions/pol/getVaultValidators.ts +1 -1
- 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/data/contracts.ts +10 -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/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/types.ts +2 -2
- package/src/hooks/useContractWrite/useBeraContractWrite.ts +5 -6
- package/src/hooks/useGetVerifiedAbi.ts +1 -1
- 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/global.d.ts +3 -3
- package/src/types/governance.d.ts +1 -1
- package/src/types/honeySwap.d.ts +3 -3
- package/src/utils/beraFetch.ts +1 -1
- package/src/utils/createEmitter.ts +1 -1
- package/src/utils/formatIncentivesTokenMap.ts +1 -1
- 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/.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/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-55L7STYD.mjs +0 -2
- package/dist/chunk-55L7STYD.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-BKDBIBVO.mjs +0 -4
- package/dist/chunk-BKDBIBVO.mjs.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-ECRMUMTA.mjs.map +0 -1
- package/dist/chunk-FCWDGE62.cjs.map +0 -1
- package/dist/chunk-P2Q7CMUD.cjs +0 -2
- package/dist/chunk-P2Q7CMUD.cjs.map +0 -1
- package/dist/chunk-PKXAW6MO.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-UXGB54NE.cjs +0 -4
- package/dist/chunk-UXGB54NE.cjs.map +0 -1
- package/dist/chunk-VXL2ZZ4X.cjs +0 -2
- package/dist/chunk-VXL2ZZ4X.cjs.map +0 -1
- 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
- /package/dist/{chunk-3YXSUBA5.mjs.map → chunk-MJZHJFZO.mjs.map} +0 -0
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Address, formatEther, type PublicClient, parseEther } from "viem";
|
|
2
2
|
|
|
3
3
|
import type {
|
|
4
4
|
ApiValidatorFragment,
|
|
5
5
|
GqlChain,
|
|
6
6
|
} from "@berachain/graphql/pol/api";
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import { parseBaseArgs } from "~/utils/parseBaseArgs";
|
|
8
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
10
9
|
import { getAllValidators } from "./getAllValidators";
|
|
11
10
|
import { getUserBoosts } from "./getUserBoosts";
|
|
12
11
|
import {
|
|
@@ -25,7 +24,7 @@ export async function getUserActiveValidators({
|
|
|
25
24
|
...args
|
|
26
25
|
}: {
|
|
27
26
|
account: string;
|
|
28
|
-
publicClient
|
|
27
|
+
publicClient: PublicClient | undefined;
|
|
29
28
|
chain?: GqlChain;
|
|
30
29
|
} & BeraJS.BaseFunctionArgs): Promise<ValidatorWithUserBoost[] | undefined> {
|
|
31
30
|
const { config } = parseBaseArgs(args);
|
|
@@ -38,51 +37,48 @@ export async function getUserActiveValidators({
|
|
|
38
37
|
variables: {
|
|
39
38
|
chain: resolvedChain,
|
|
40
39
|
where: {
|
|
41
|
-
idIn: userBoosts.data.
|
|
42
|
-
(t) => t.
|
|
40
|
+
idIn: userBoosts.data.polGetValidatorBoosts.boosts.map(
|
|
41
|
+
(t) => t.validatorId,
|
|
43
42
|
),
|
|
44
43
|
},
|
|
45
44
|
},
|
|
46
45
|
}),
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
account: account as Address,
|
|
56
|
-
pubkey: t.validator.publicKey,
|
|
57
|
-
publicClient: publicClient,
|
|
58
|
-
}),
|
|
59
|
-
),
|
|
46
|
+
Promise.all(
|
|
47
|
+
userBoosts.data.polGetValidatorBoosts.boosts
|
|
48
|
+
.filter(
|
|
49
|
+
(t) =>
|
|
50
|
+
// there's an edge case here where api doesn't return the pubkey
|
|
51
|
+
// because the user might have boosted a pubkey that doesn't exist
|
|
52
|
+
// api doesn't return the pubkey in this case, but we're choosing to filter them out
|
|
53
|
+
!!t.validator,
|
|
60
54
|
)
|
|
61
|
-
|
|
55
|
+
.map((t) =>
|
|
56
|
+
getUserBoostsOnValidator({
|
|
57
|
+
account: account as Address,
|
|
58
|
+
pubkey: t.validator!.pubkey,
|
|
59
|
+
publicClient: publicClient,
|
|
60
|
+
}),
|
|
61
|
+
),
|
|
62
|
+
),
|
|
62
63
|
]);
|
|
63
64
|
|
|
64
65
|
return validatorInfoList?.validators.validators.map((validator) => {
|
|
65
|
-
const userDeposited = onChainBoosts
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
data.pubkey.toLowerCase() === validator.pubkey.toLowerCase(),
|
|
69
|
-
)
|
|
70
|
-
: userBoosts.data.userValidatorInformations.find(
|
|
71
|
-
(data) =>
|
|
72
|
-
data.validator.id.toLowerCase() === validator.id.toLowerCase(),
|
|
73
|
-
);
|
|
66
|
+
const userDeposited = onChainBoosts.find(
|
|
67
|
+
(data) => data.pubkey.toLowerCase() === validator.pubkey.toLowerCase(),
|
|
68
|
+
);
|
|
74
69
|
|
|
75
70
|
if (!userDeposited) {
|
|
76
71
|
throw new Error("User deposited not found");
|
|
77
72
|
}
|
|
78
73
|
|
|
74
|
+
const droppableBoostAmount =
|
|
75
|
+
parseEther(userDeposited?.activeBoostAmount ?? "0") -
|
|
76
|
+
parseEther(userDeposited?.queuedDropBoostAmount);
|
|
77
|
+
|
|
79
78
|
return {
|
|
80
79
|
...validator,
|
|
81
80
|
userBoosts: {
|
|
82
|
-
pubkey:
|
|
83
|
-
"pubkey" in userDeposited
|
|
84
|
-
? userDeposited.pubkey
|
|
85
|
-
: userDeposited.validator.publicKey,
|
|
81
|
+
pubkey: userDeposited.pubkey,
|
|
86
82
|
activeBoostAmount: userDeposited?.activeBoostAmount,
|
|
87
83
|
queuedBoostAmount: userDeposited?.queuedBoostAmount,
|
|
88
84
|
queuedBoostStartBlock: Number(userDeposited?.queuedBoostStartBlock),
|
|
@@ -90,10 +86,12 @@ export async function getUserActiveValidators({
|
|
|
90
86
|
queuedDropBoostStartBlock: Number(
|
|
91
87
|
userDeposited?.queuedDropBoostStartBlock,
|
|
92
88
|
),
|
|
89
|
+
droppableBoostAmount: formatEther(droppableBoostAmount),
|
|
93
90
|
hasPendingBoosts:
|
|
94
91
|
Number(userDeposited?.queuedBoostAmount) > 0 ||
|
|
95
92
|
Number(userDeposited?.queuedDropBoostAmount) > 0,
|
|
96
93
|
hasActiveBoosts: Number(userDeposited?.activeBoostAmount) > 0,
|
|
94
|
+
hasDroppableBoosts: droppableBoostAmount > 0n,
|
|
97
95
|
} satisfies UserBoostsOnValidator,
|
|
98
96
|
} satisfies ValidatorWithUserBoost;
|
|
99
97
|
});
|
|
@@ -4,25 +4,29 @@ import {
|
|
|
4
4
|
GetUserValidatorInformation,
|
|
5
5
|
type GetUserValidatorInformationQuery,
|
|
6
6
|
type GetUserValidatorInformationQueryVariables,
|
|
7
|
-
|
|
7
|
+
type GqlChain,
|
|
8
|
+
} from "@berachain/graphql/pol/api";
|
|
8
9
|
|
|
9
|
-
import {
|
|
10
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
11
|
+
import { getApolloClient } from "../clients/getApolloClient";
|
|
10
12
|
|
|
11
13
|
export async function getUserBoosts({
|
|
12
14
|
account,
|
|
13
|
-
block,
|
|
14
15
|
...args
|
|
15
16
|
}: BeraJS.BaseFunctionArgs & {
|
|
16
17
|
account: string;
|
|
17
|
-
block?: GetUserValidatorInformationQueryVariables["block"];
|
|
18
18
|
}) {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
const { config } = parseBaseArgs(args);
|
|
20
|
+
const apiClient = getApolloClient("api", args);
|
|
21
|
+
|
|
22
|
+
return await apiClient.query<
|
|
22
23
|
GetUserValidatorInformationQuery,
|
|
23
24
|
GetUserValidatorInformationQueryVariables
|
|
24
25
|
>({
|
|
25
26
|
query: GetUserValidatorInformation,
|
|
26
|
-
variables: {
|
|
27
|
+
variables: {
|
|
28
|
+
address: account.toLowerCase() as Address,
|
|
29
|
+
chain: config.bex.chainName as unknown as GqlChain,
|
|
30
|
+
},
|
|
27
31
|
});
|
|
28
32
|
}
|
|
@@ -2,10 +2,14 @@ import { type Address, formatEther, type PublicClient } from "viem";
|
|
|
2
2
|
|
|
3
3
|
import { bgtAbi } from "@berachain/abis/pol/bgt";
|
|
4
4
|
|
|
5
|
-
import { parseBaseArgs } from "
|
|
5
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
6
6
|
|
|
7
7
|
export type UserBoostsOnValidator = {
|
|
8
8
|
pubkey: Address;
|
|
9
|
+
/**
|
|
10
|
+
* The amount of boosts that can be dropped.
|
|
11
|
+
*/
|
|
12
|
+
droppableBoostAmount: string;
|
|
9
13
|
activeBoostAmount: string;
|
|
10
14
|
queuedBoostAmount: string;
|
|
11
15
|
queuedBoostStartBlock: number;
|
|
@@ -13,6 +17,10 @@ export type UserBoostsOnValidator = {
|
|
|
13
17
|
queuedDropBoostStartBlock: number;
|
|
14
18
|
hasPendingBoosts: boolean;
|
|
15
19
|
hasActiveBoosts: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Whether the user has active boosts that can be dropped.
|
|
22
|
+
*/
|
|
23
|
+
hasDroppableBoosts: boolean;
|
|
16
24
|
};
|
|
17
25
|
|
|
18
26
|
export async function getUserBoostsOnValidator({
|
|
@@ -56,15 +64,19 @@ export async function getUserBoostsOnValidator({
|
|
|
56
64
|
}),
|
|
57
65
|
]);
|
|
58
66
|
|
|
67
|
+
const droppableBoostAmount = activeBoostAmount - queuedDropBoostAmount[1];
|
|
68
|
+
|
|
59
69
|
return {
|
|
60
70
|
pubkey,
|
|
71
|
+
droppableBoostAmount: formatEther(droppableBoostAmount),
|
|
61
72
|
activeBoostAmount: formatEther(activeBoostAmount),
|
|
62
73
|
queuedBoostAmount: formatEther(queuedBoostAmount[1]),
|
|
63
74
|
queuedDropBoostAmount: formatEther(queuedDropBoostAmount[1]),
|
|
64
75
|
queuedBoostStartBlock: queuedBoostAmount[0],
|
|
65
76
|
queuedDropBoostStartBlock: queuedDropBoostAmount[0],
|
|
66
77
|
hasPendingBoosts:
|
|
67
|
-
|
|
68
|
-
hasActiveBoosts:
|
|
78
|
+
queuedBoostAmount[1] > 0n || queuedDropBoostAmount[1] > 0n,
|
|
79
|
+
hasActiveBoosts: activeBoostAmount > 0n,
|
|
80
|
+
hasDroppableBoosts: droppableBoostAmount > 0n,
|
|
69
81
|
};
|
|
70
82
|
}
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
type GetValidatorAnalyticsQueryVariables,
|
|
7
7
|
} from "@berachain/graphql/pol/subgraph";
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { calculateTimestampFromDays } from "../../utils/formatTimestamps";
|
|
10
|
+
import { getApolloClient } from "../clients/getApolloClient";
|
|
11
11
|
|
|
12
12
|
export async function getValidatorAnalytics({
|
|
13
13
|
pubkey,
|
|
@@ -2,7 +2,7 @@ import type { Address, PublicClient } from "viem";
|
|
|
2
2
|
|
|
3
3
|
import { beraChefAbi } from "@berachain/abis/pol/rewards/beraChef";
|
|
4
4
|
|
|
5
|
-
import { parseBaseArgs } from "
|
|
5
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
6
6
|
|
|
7
7
|
export async function getValidatorCommission({
|
|
8
8
|
client,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ApiValidatorMinimalFragment } from "@berachain/graphql/pol/api";
|
|
2
2
|
|
|
3
|
-
import { yearsInSeconds } from "
|
|
3
|
+
import { yearsInSeconds } from "../../utils/time";
|
|
4
4
|
|
|
5
5
|
export const getValidatorEstimatedBgtPerYear = (
|
|
6
6
|
validator: ApiValidatorMinimalFragment,
|
|
@@ -2,7 +2,7 @@ import type { Address, PublicClient } from "viem";
|
|
|
2
2
|
|
|
3
3
|
import { beaconDepositAbi } from "@berachain/abis/pol/beaconDeposit";
|
|
4
4
|
|
|
5
|
-
import { parseBaseArgs } from "
|
|
5
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
6
6
|
|
|
7
7
|
export async function getValidatorOperatorAddress({
|
|
8
8
|
client,
|
|
@@ -2,7 +2,7 @@ import type { Address, PublicClient } from "viem";
|
|
|
2
2
|
|
|
3
3
|
import { beraChefAbi } from "@berachain/abis/pol/rewards/beraChef";
|
|
4
4
|
|
|
5
|
-
import { parseBaseArgs } from "
|
|
5
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
6
6
|
|
|
7
7
|
export interface ValidatorQueuedCommission {
|
|
8
8
|
blockNumberLast: number;
|
|
@@ -2,7 +2,7 @@ import type { Address, PublicClient } from "viem";
|
|
|
2
2
|
|
|
3
3
|
import { beaconDepositAbi } from "@berachain/abis/pol/beaconDeposit";
|
|
4
4
|
|
|
5
|
-
import { parseBaseArgs } from "
|
|
5
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
6
6
|
|
|
7
7
|
export type ValidatorQueuedOperatorAddress = [bigint, string];
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@ import type { Address, PublicClient } from "viem";
|
|
|
2
2
|
|
|
3
3
|
import { beraChefAbi } from "@berachain/abis/pol/rewards/beraChef";
|
|
4
4
|
|
|
5
|
-
import { parseBaseArgs } from "
|
|
5
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
6
6
|
import {
|
|
7
7
|
formatValidatorRewardAllocation,
|
|
8
8
|
type ValidatorRewardAllocation,
|
|
@@ -2,7 +2,7 @@ import type { Address, PublicClient } from "viem";
|
|
|
2
2
|
|
|
3
3
|
import { beraChefAbi } from "@berachain/abis/pol/rewards/beraChef";
|
|
4
4
|
|
|
5
|
-
import { parseBaseArgs } from "
|
|
5
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
6
6
|
|
|
7
7
|
export interface ValidatorRewardAllocationRaw {
|
|
8
8
|
startBlock: bigint;
|
|
@@ -2,7 +2,7 @@ import { type Address, type PublicClient, zeroAddress } from "viem";
|
|
|
2
2
|
|
|
3
3
|
import { beraChefAbi } from "@berachain/abis/pol/rewards/beraChef";
|
|
4
4
|
|
|
5
|
-
import { parseBaseArgs } from "
|
|
5
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
6
6
|
|
|
7
7
|
export type ValidatorRewardAllocatorAddress = Address;
|
|
8
8
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { parseBaseArgs } from "../../../../utils/parseBaseArgs";
|
|
4
|
+
import { getTokenCurrentPrices } from "../../../prices/getTokenCurrentPrices";
|
|
5
|
+
import { getAllValidators } from "../../getAllValidators";
|
|
5
6
|
import {
|
|
6
7
|
getValidatorBoostApy,
|
|
7
8
|
getValidatorReturnPerBgt,
|
|
8
|
-
} from "
|
|
9
|
-
import { parseBaseArgs } from "~/utils/parseBaseArgs";
|
|
9
|
+
} from "../getValidatorBoostApy";
|
|
10
10
|
|
|
11
11
|
describe("getValidatorBoostApy", async () => {
|
|
12
12
|
const { config } = parseBaseArgs({});
|
|
@@ -14,10 +14,12 @@ export type BeraFlags = Record<
|
|
|
14
14
|
| "sponsorGas"
|
|
15
15
|
| "enableSimulateCalls"
|
|
16
16
|
| "isBendVaultDataHourly"
|
|
17
|
+
| "isBendLoopingEnabled"
|
|
17
18
|
| "isMultiChainZapBendEnabled"
|
|
18
19
|
| "isZapStakeBeraEnabled"
|
|
19
20
|
| "mockValidatorOperator"
|
|
20
21
|
| "mockValidatorRewardAllocator"
|
|
22
|
+
| "isBgtPolRewardToken"
|
|
21
23
|
| "mockRewardDurationManager"
|
|
22
24
|
| "mockIncentiveManager"
|
|
23
25
|
| "isHoneyPythWrapperEnabled"
|
|
@@ -36,10 +38,12 @@ export const defaultFlags: BeraFlags = {
|
|
|
36
38
|
sponsorGas: false,
|
|
37
39
|
enableSimulateCalls: false,
|
|
38
40
|
isBendVaultDataHourly: true,
|
|
41
|
+
isBendLoopingEnabled: false,
|
|
39
42
|
isMultiChainZapBendEnabled: false,
|
|
40
43
|
isZapStakeBeraEnabled: false,
|
|
41
44
|
mockValidatorOperator: false,
|
|
42
45
|
mockValidatorRewardAllocator: false,
|
|
46
|
+
isBgtPolRewardToken: true,
|
|
43
47
|
mockRewardDurationManager: false,
|
|
44
48
|
mockIncentiveManager: false,
|
|
45
49
|
isHoneyPythWrapperEnabled: true,
|
|
@@ -10,7 +10,7 @@ import type { Hex } from "viem";
|
|
|
10
10
|
|
|
11
11
|
import type { EdgeConfigSchema } from "@berachain/config/internal/edge-config";
|
|
12
12
|
|
|
13
|
-
import { BeraError } from "
|
|
13
|
+
import { BeraError } from "../errors/BeraError";
|
|
14
14
|
|
|
15
15
|
type FactoryStatus = {
|
|
16
16
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createContext, useContext } from "react";
|
|
2
2
|
|
|
3
|
-
import type { HoneyFeeMap } from "
|
|
4
|
-
import type { TokenWithMetadata } from "
|
|
5
|
-
import type { PythPriceFeedMap } from "
|
|
3
|
+
import type { HoneyFeeMap } from "../actions/honey/getHoneyFees";
|
|
4
|
+
import type { TokenWithMetadata } from "../types/dex";
|
|
5
|
+
import type { PythPriceFeedMap } from "../types/honeySwap";
|
|
6
6
|
|
|
7
7
|
export const HoneyConfigContext = createContext<
|
|
8
8
|
HoneyConfigContextReturn | undefined
|
|
@@ -2,8 +2,8 @@ import type React from "react";
|
|
|
2
2
|
import { useEffect } from "react";
|
|
3
3
|
import { SWRConfig } from "swr";
|
|
4
4
|
|
|
5
|
-
import { BeraError } from "
|
|
6
|
-
import { BeraMonitoring } from "
|
|
5
|
+
import { BeraError } from "../errors/BeraError";
|
|
6
|
+
import { BeraMonitoring } from "../errors/BeraMonitoring";
|
|
7
7
|
|
|
8
8
|
export function SWRFallback({
|
|
9
9
|
fallback,
|
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
isFlagEnabled,
|
|
6
6
|
} from "@berachain/config/internal/edge-config";
|
|
7
7
|
|
|
8
|
-
import { useEnsoUserTokensWithBalances } from "
|
|
9
|
-
import type { BalanceToken, Token, TokenWithMetadata } from "
|
|
10
|
-
import { formatTokenList } from "
|
|
8
|
+
import { useEnsoUserTokensWithBalances } from "../hooks/enso/useEnsoUserTokensWithBalances";
|
|
9
|
+
import type { BalanceToken, Token, TokenWithMetadata } from "../types/dex";
|
|
10
|
+
import { formatTokenList } from "../utils/formatTokenList";
|
|
11
11
|
|
|
12
12
|
export interface TokensProviderContext {
|
|
13
13
|
tokenList: TokenWithMetadata[];
|
|
@@ -2,7 +2,7 @@ import { createContext, type PropsWithChildren, useContext } from "react";
|
|
|
2
2
|
|
|
3
3
|
import { mainnet } from "@berachain/config/mainnet";
|
|
4
4
|
|
|
5
|
-
import { parseBaseArgs } from "
|
|
5
|
+
import { parseBaseArgs } from "../utils/parseBaseArgs";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Average berachain block time in seconds
|
package/src/data/contracts.ts
CHANGED
|
@@ -410,4 +410,14 @@ export const contracts = [
|
|
|
410
410
|
"80094": "0xC0808A144CE2ea85bF84EBD1dDF5D59429f59dDE",
|
|
411
411
|
name: "bend.staging.supportedVaults.1",
|
|
412
412
|
},
|
|
413
|
+
{
|
|
414
|
+
"80069": null,
|
|
415
|
+
"80094": "0xc914a663837eb21c5a650716e015659686597e55",
|
|
416
|
+
name: "enso.walletV2Factory",
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
"80069": null,
|
|
420
|
+
"80094": "0x5dE09823D9143886896507107590d9859F3E390b",
|
|
421
|
+
name: "enso.walletFlashloanAdapter",
|
|
422
|
+
},
|
|
413
423
|
] as const;
|
package/src/enum/txnEnum.ts
CHANGED
|
@@ -18,6 +18,15 @@ export enum TransactionActionType {
|
|
|
18
18
|
|
|
19
19
|
DELEGATE = "Delegate",
|
|
20
20
|
REDELEGATE = "Redelegate",
|
|
21
|
+
|
|
22
|
+
QUEUE_BOOST = "Queue Boost",
|
|
23
|
+
ACTIVATE_BOOST = "Activate Boost",
|
|
24
|
+
QUEUE_UNBOOSTING_ALL = "Queue Drop Boost All",
|
|
25
|
+
UNBOOST = "Drop Boost",
|
|
26
|
+
QUEUE_UNBOOST = "Queue Drop Boost",
|
|
27
|
+
CANCEL_UNBOOST = "Cancel Drop Boost",
|
|
28
|
+
CANCEL_BOOST = "Cancel Boost",
|
|
29
|
+
|
|
21
30
|
UNBONDING = "Unbonding",
|
|
22
31
|
CANCEL_UNBONDING = "Cancel Unbonding",
|
|
23
32
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createEmitter, type EmitterMixin } from "
|
|
1
|
+
import { createEmitter, type EmitterMixin } from "../utils/createEmitter";
|
|
2
2
|
import type { BeraError } from "./BeraError";
|
|
3
3
|
import type { SeverityLevel } from "./severity";
|
|
4
4
|
|
|
@@ -31,7 +31,7 @@ const _emitter = createEmitter<{ exception: (event: ErrorEvent) => void }>();
|
|
|
31
31
|
* @example
|
|
32
32
|
* ```ts
|
|
33
33
|
* // In berajs code:
|
|
34
|
-
* import { BeraMonitoring } from "
|
|
34
|
+
* import { BeraMonitoring } from "./BeraMonitoring";
|
|
35
35
|
* BeraMonitoring.captureExceptionException(error);
|
|
36
36
|
*
|
|
37
37
|
* // In app instrumentation:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Unsubscribe } from "
|
|
1
|
+
import type { Unsubscribe } from "../utils/createEmitter";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Span context passed to tracing handlers.
|
|
@@ -34,7 +34,7 @@ const _handlers: StartSpanFn[] = [];
|
|
|
34
34
|
* @example
|
|
35
35
|
* ```ts
|
|
36
36
|
* // In berajs code:
|
|
37
|
-
* import { BeraTracing } from "
|
|
37
|
+
* import { BeraTracing } from "./BeraTracing";
|
|
38
38
|
* const result = await BeraTracing.startSpan(
|
|
39
39
|
* { name: "GraphQL query", op: "graphql.query", attributes: {} },
|
|
40
40
|
* () => executeQuery(),
|
|
@@ -36,7 +36,7 @@ export class RequestError extends BeraError {
|
|
|
36
36
|
// vercel internal proxy
|
|
37
37
|
"/api/aggregators?aggregator",
|
|
38
38
|
// bonder endpoints have date-based query params (e.g. ?start=2025-11-28)
|
|
39
|
-
mainnet.
|
|
39
|
+
mainnet.staking,
|
|
40
40
|
];
|
|
41
41
|
|
|
42
42
|
statusCode: number | undefined;
|
package/src/errors/assert.ts
CHANGED
|
@@ -119,6 +119,24 @@ export function assertAddress(
|
|
|
119
119
|
});
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
+
/**
|
|
123
|
+
* Asserts that a value is positive (> 0).
|
|
124
|
+
* @throws An InvalidArgumentError if the value is not positive.
|
|
125
|
+
*/
|
|
126
|
+
export function assertPositive(
|
|
127
|
+
value: string | bigint | number,
|
|
128
|
+
property: string,
|
|
129
|
+
): void {
|
|
130
|
+
const isPositive = typeof value === "bigint" ? value > 0n : Number(value) > 0;
|
|
131
|
+
if (!isPositive) {
|
|
132
|
+
throw new InvalidArgumentError({
|
|
133
|
+
property,
|
|
134
|
+
value,
|
|
135
|
+
expected: "positive amount",
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
122
140
|
/**
|
|
123
141
|
* Asserts that a value is a number greater than 0.
|
|
124
142
|
* @throws An InvalidArgumentError if the value is undefined, null, not a string or number, or not a number greater than 0.
|
|
@@ -29,13 +29,13 @@ import { rewardVaultAbi } from "@berachain/abis/pol/rewards/rewardVault";
|
|
|
29
29
|
|
|
30
30
|
import { getConfig } from "@berachain/wagmi/config";
|
|
31
31
|
|
|
32
|
-
import { beraWriteContract } from "
|
|
33
|
-
import { ContractName } from "
|
|
34
|
-
import { TransactionActionType } from "
|
|
35
|
-
import type { IContractWrite } from "
|
|
36
|
-
import { getServerSidePublicClient } from "
|
|
37
|
-
import { parseBaseArgs } from "
|
|
38
|
-
import { anvilMnemonic } from "
|
|
32
|
+
import { beraWriteContract } from "../actions/transactions/beraWriteContract";
|
|
33
|
+
import { ContractName } from "../enum/contracts";
|
|
34
|
+
import { TransactionActionType } from "../enum/txnEnum";
|
|
35
|
+
import type { IContractWrite } from "../types/global";
|
|
36
|
+
import { getServerSidePublicClient } from "../utils/getServerSideClient";
|
|
37
|
+
import { parseBaseArgs } from "../utils/parseBaseArgs";
|
|
38
|
+
import { anvilMnemonic } from "../utils/test-utils";
|
|
39
39
|
import { BeraError } from "./BeraError";
|
|
40
40
|
import { errorMsgMap, GENERAL_ERROR } from "./errorMap";
|
|
41
41
|
import { getErrorMessage } from "./getErrorMessage";
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
type PublicClient,
|
|
8
8
|
} from "viem";
|
|
9
9
|
|
|
10
|
-
import { commonAbiErrors } from "
|
|
10
|
+
import { commonAbiErrors } from "../abi/utils/commonAbiErrors";
|
|
11
11
|
import { InvalidArgumentError } from "./InvalidArgumentError";
|
|
12
12
|
import { parseViemError } from "./parseViemError";
|
|
13
13
|
import { TransactionFailedError } from "./TransactionFailedError";
|
|
@@ -2,10 +2,10 @@ import useSWR from "swr";
|
|
|
2
2
|
|
|
3
3
|
import { usePublicClient } from "@berachain/wagmi/hooks";
|
|
4
4
|
|
|
5
|
-
import type { GetConvertToAssetsProps } from "
|
|
6
|
-
import { getConvertToAssets } from "
|
|
7
|
-
import { assertPublicClient } from "
|
|
8
|
-
import type { DefaultHookOptions } from "
|
|
5
|
+
import type { GetConvertToAssetsProps } from "../../actions/bend/getConvertToAssets";
|
|
6
|
+
import { getConvertToAssets } from "../../actions/bend/getConvertToAssets";
|
|
7
|
+
import { assertPublicClient } from "../../errors/assert";
|
|
8
|
+
import type { DefaultHookOptions } from "../../types/global";
|
|
9
9
|
|
|
10
10
|
export const useGetConvertToAssets = (
|
|
11
11
|
{
|
|
@@ -5,26 +5,26 @@ import { defaultChainId } from "@berachain/config/internal";
|
|
|
5
5
|
|
|
6
6
|
import { useBeraWallet, usePublicClient } from "@berachain/wagmi/hooks";
|
|
7
7
|
|
|
8
|
-
import { bex } from "
|
|
9
|
-
import { bgtRedeem } from "
|
|
10
|
-
import { enso } from "
|
|
11
|
-
import { erc4626Deposit } from "
|
|
12
|
-
import { fly } from "
|
|
13
|
-
import { haiku } from "
|
|
14
|
-
import { honeyNative } from "
|
|
15
|
-
import { kyberswap } from "
|
|
16
|
-
import { oogabooga } from "
|
|
17
|
-
import { openOcean } from "
|
|
18
|
-
import { wberaSwap } from "
|
|
19
|
-
import { useBeraFlag } from "
|
|
20
|
-
import type { HoneyConfigContextReturn } from "
|
|
21
|
-
import type { SwapReferrer } from "
|
|
22
|
-
import {
|
|
23
|
-
import type {
|
|
24
|
-
import
|
|
25
|
-
import {
|
|
26
|
-
import { isToken } from "~/utils/tokens";
|
|
8
|
+
import { bex } from "../../actions/dex/aggregators/bex";
|
|
9
|
+
import { bgtRedeem } from "../../actions/dex/aggregators/bgt";
|
|
10
|
+
import { enso } from "../../actions/dex/aggregators/enso/enso";
|
|
11
|
+
import { erc4626Deposit } from "../../actions/dex/aggregators/erc4626";
|
|
12
|
+
import { fly } from "../../actions/dex/aggregators/fly";
|
|
13
|
+
import { haiku } from "../../actions/dex/aggregators/haiku";
|
|
14
|
+
import { honeyNative } from "../../actions/dex/aggregators/honey";
|
|
15
|
+
import { kyberswap } from "../../actions/dex/aggregators/kyberswap";
|
|
16
|
+
import { oogabooga } from "../../actions/dex/aggregators/oogabooga";
|
|
17
|
+
import { openOcean } from "../../actions/dex/aggregators/openOcean";
|
|
18
|
+
import { wberaSwap } from "../../actions/dex/aggregators/wbera";
|
|
19
|
+
import { useBeraFlag } from "../../contexts/BeraFlags/BeraFlags";
|
|
20
|
+
import type { HoneyConfigContextReturn } from "../../contexts/HoneyConfigProvider";
|
|
21
|
+
import type { SwapReferrer } from "../../enum/dex";
|
|
22
|
+
import type { IRawAggregatorQuote, MinimalERC20 } from "../../types/dex";
|
|
23
|
+
import type { DefaultHookOptions } from "../../types/global";
|
|
24
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
25
|
+
import { isToken } from "../../utils/tokens";
|
|
27
26
|
import { useUnderlyingAsset } from "../tokens/useUnderlyingAsset";
|
|
27
|
+
import { useAggregatorsRouterFeeBps } from "./useAggregatorsRouterFeeBps";
|
|
28
28
|
import { useBexStatus } from "./useBexStatus";
|
|
29
29
|
import {
|
|
30
30
|
getAggregatorsSWROptions,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import useSWRImmutable from "swr/immutable";
|
|
2
2
|
import { type PublicClient, zeroAddress } from "viem";
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import aggregatorsRouterAbi from "@berachain/abis/meta-aggregator/metaAggregatorV2";
|
|
5
5
|
|
|
6
6
|
import { usePublicClient } from "@berachain/wagmi/hooks";
|
|
7
7
|
|
|
8
|
-
import { parseBaseArgs } from "
|
|
8
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
9
9
|
|
|
10
10
|
export const useAggregatorsRouterFeeBps = () => {
|
|
11
11
|
const publicClient = usePublicClient() as PublicClient;
|