@berachain/berajs 0.2.4 → 0.2.6-patch.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -0
- package/dist/abi/exports.cjs +1 -1
- package/dist/abi/exports.cjs.map +1 -1
- package/dist/abi/exports.d.cts +17 -1
- package/dist/abi/exports.d.ts +17 -1
- package/dist/abi/exports.mjs +1 -1
- package/dist/abi/exports.mjs.map +1 -1
- package/dist/actions/exports.cjs +1 -1
- package/dist/actions/exports.cjs.map +1 -1
- package/dist/actions/exports.d.cts +9 -38
- package/dist/actions/exports.d.ts +9 -38
- package/dist/actions/exports.mjs +1 -1
- package/dist/actions/exports.mjs.map +1 -1
- package/dist/chunk-2YBHAMDV.cjs +2 -0
- package/dist/chunk-2YBHAMDV.cjs.map +1 -0
- package/dist/chunk-57RINXU6.cjs +2 -0
- package/dist/chunk-57RINXU6.cjs.map +1 -0
- package/dist/{chunk-AX2YQQFQ.mjs → chunk-74QD4JAH.mjs} +2 -2
- package/dist/chunk-74QD4JAH.mjs.map +1 -0
- package/dist/chunk-74WA35RI.cjs +2 -0
- package/dist/chunk-74WA35RI.cjs.map +1 -0
- package/dist/{chunk-7WRTK7RJ.mjs → chunk-BEKH5EYT.mjs} +2 -2
- package/dist/chunk-BEKH5EYT.mjs.map +1 -0
- package/dist/{chunk-FCWDGE62.cjs → chunk-CF3LFNXG.cjs} +2 -2
- package/dist/chunk-CF3LFNXG.cjs.map +1 -0
- package/dist/chunk-COMMLZ3O.mjs +2 -0
- package/dist/chunk-COMMLZ3O.mjs.map +1 -0
- package/dist/chunk-DDEQFR3M.cjs +2 -0
- package/dist/chunk-DDEQFR3M.cjs.map +1 -0
- package/dist/{chunk-6LDOG5RL.cjs → chunk-DK42F2ZM.cjs} +2 -2
- package/dist/chunk-DK42F2ZM.cjs.map +1 -0
- package/dist/{chunk-7SMWQ6SN.mjs → chunk-FM3WDBFH.mjs} +2 -2
- package/dist/chunk-FM3WDBFH.mjs.map +1 -0
- package/dist/chunk-HWOGQSNL.cjs +4 -0
- package/dist/chunk-HWOGQSNL.cjs.map +1 -0
- package/dist/chunk-I7M43BB4.cjs +2 -0
- package/dist/chunk-I7M43BB4.cjs.map +1 -0
- package/dist/chunk-IBJOI5SN.mjs +4 -0
- package/dist/chunk-IBJOI5SN.mjs.map +1 -0
- package/dist/chunk-IDFMLLDY.mjs +2 -0
- package/dist/chunk-IDFMLLDY.mjs.map +1 -0
- package/dist/{chunk-YZV5LKIP.cjs → chunk-LNVR4BW6.cjs} +2 -2
- package/dist/chunk-LNVR4BW6.cjs.map +1 -0
- package/dist/chunk-MJZHJFZO.mjs +2 -0
- package/dist/{chunk-YNO7BCCM.mjs.map → chunk-MJZHJFZO.mjs.map} +1 -1
- package/dist/chunk-MK5NS5B5.mjs +2 -0
- package/dist/chunk-MK5NS5B5.mjs.map +1 -0
- package/dist/{chunk-C6ZGUO4H.cjs → chunk-NMH7LHPW.cjs} +2 -2
- package/dist/chunk-NMH7LHPW.cjs.map +1 -0
- package/dist/chunk-NVHV2LDK.cjs +2 -0
- package/dist/chunk-NVHV2LDK.cjs.map +1 -0
- package/dist/chunk-OGBD5YOG.mjs +2 -0
- package/dist/chunk-OGBD5YOG.mjs.map +1 -0
- package/dist/chunk-OIYXOKTT.cjs.map +1 -1
- package/dist/chunk-OUD27MU7.cjs.map +1 -1
- package/dist/chunk-PLIH6KQM.mjs +2 -0
- package/dist/chunk-PLIH6KQM.mjs.map +1 -0
- package/dist/chunk-QRAIGQF2.mjs +2 -0
- package/dist/chunk-QRAIGQF2.mjs.map +1 -0
- package/dist/chunk-RWOICHRW.cjs +2 -0
- package/dist/chunk-RWOICHRW.cjs.map +1 -0
- package/dist/chunk-T5FSQ3YE.mjs +2 -0
- package/dist/chunk-T5FSQ3YE.mjs.map +1 -0
- package/dist/chunk-WRFDB3QJ.cjs.map +1 -1
- package/dist/chunk-XNJLSA6P.cjs.map +1 -1
- package/dist/contexts/exports.cjs +1 -1
- package/dist/contexts/exports.cjs.map +1 -1
- package/dist/contexts/exports.d.cts +1 -1
- package/dist/contexts/exports.d.ts +1 -1
- package/dist/contexts/exports.mjs +1 -1
- package/dist/contexts/exports.mjs.map +1 -1
- package/dist/{defaultFlags-d0kPbT0i.d.cts → defaultFlags-D6KfkTZx.d.cts} +1 -1
- package/dist/{defaultFlags-d0kPbT0i.d.ts → defaultFlags-D6KfkTZx.d.ts} +1 -1
- package/dist/enum/exports.cjs +1 -1
- package/dist/enum/exports.cjs.map +1 -1
- package/dist/enum/exports.d.cts +1 -1
- package/dist/enum/exports.d.ts +1 -1
- package/dist/enum/exports.mjs +1 -1
- package/dist/errors/exports.cjs +1 -1
- package/dist/errors/exports.cjs.map +1 -1
- package/dist/errors/exports.d.cts +8 -3
- package/dist/errors/exports.d.ts +8 -3
- package/dist/errors/exports.mjs +1 -1
- package/dist/{getValidatorQueuedOperatorAddress-DZgrPmZ2.d.cts → getValidatorQueuedOperatorAddress-BdDYHycN.d.cts} +15 -4
- package/dist/{getValidatorQueuedOperatorAddress-CqR6cyqC.d.ts → getValidatorQueuedOperatorAddress-CmiPJmsr.d.ts} +15 -4
- package/dist/{global.d-BeYWDreg.d.ts → global.d-3GQMgC9k.d.ts} +1 -1
- package/dist/{global.d-DghRxpHd.d.cts → global.d-CwT1Phzf.d.cts} +1 -1
- package/dist/hooks/exports.cjs +3 -3
- package/dist/hooks/exports.cjs.map +1 -1
- package/dist/hooks/exports.d.cts +54 -75
- package/dist/hooks/exports.d.ts +54 -75
- package/dist/hooks/exports.mjs +3 -3
- package/dist/hooks/exports.mjs.map +1 -1
- package/dist/{txnEnum-DxPRHSJt.d.cts → txnEnum-CCuQUFlh.d.cts} +7 -0
- package/dist/{txnEnum-DxPRHSJt.d.ts → txnEnum-CCuQUFlh.d.ts} +7 -0
- package/dist/types/exports.cjs.map +1 -1
- package/dist/types/exports.d.cts +37 -4
- package/dist/types/exports.d.ts +37 -4
- package/dist/utils/exports.cjs +1 -1
- package/dist/utils/exports.cjs.map +1 -1
- package/dist/utils/exports.d.cts +2 -2
- package/dist/utils/exports.d.ts +2 -2
- package/dist/utils/exports.mjs +1 -1
- package/dist/utils/exports.mjs.map +1 -1
- package/package.json +25 -25
- package/src/abi/enso/ensoWalletV2Factory.ts +9 -0
- package/src/abi/exports.ts +1 -0
- package/src/abi/pyth/pyth.ts +0 -0
- package/src/actions/clients/BeraApolloClient.ts +3 -3
- package/src/actions/clients/getApolloClient.ts +5 -5
- package/src/actions/clients/getEnsoClient.ts +1 -1
- package/src/actions/dex/__tests__/aggregators.unit.test.ts +3 -3
- package/src/actions/dex/__tests__/getOnChainPool.unit.test.ts +1 -1
- package/src/actions/dex/aggregators/base.ts +12 -8
- package/src/actions/dex/aggregators/bex.ts +8 -8
- package/src/actions/dex/aggregators/bgt.ts +4 -4
- package/src/actions/dex/aggregators/enso/enso.ts +28 -20
- package/src/actions/dex/aggregators/enso/ensoErc4626.debug.test.ts +1 -1
- package/src/actions/dex/aggregators/enso/ensoErc4626.ts +7 -4
- package/src/actions/dex/aggregators/erc4626.ts +10 -6
- package/src/actions/dex/aggregators/fly.ts +9 -5
- package/src/actions/dex/aggregators/haiku.integration.test.ts +3 -3
- package/src/actions/dex/aggregators/haiku.ts +9 -5
- package/src/actions/dex/aggregators/honey.ts +15 -15
- package/src/actions/dex/aggregators/kyberswap.ts +8 -4
- package/src/actions/dex/aggregators/oogabooga.ts +8 -4
- package/src/actions/dex/aggregators/openOcean.ts +12 -8
- package/src/actions/dex/aggregators/wbera.ts +8 -4
- package/src/actions/dex/b-sdk.ts +2 -2
- package/src/actions/dex/getAllPools.ts +2 -2
- package/src/actions/dex/getApiPool.ts +2 -2
- package/src/actions/dex/getGlobalLiquidityAndSwapVolume.ts +2 -2
- package/src/actions/dex/getIsTokenExploited.ts +1 -1
- package/src/actions/dex/getOnChainPool.ts +3 -3
- package/src/actions/dex/getPoolEvents.ts +2 -2
- package/src/actions/dex/getPoolHistoricalData.ts +2 -2
- package/src/actions/dex/getVaultPausedState.ts +1 -1
- package/src/actions/enso/__tests__/getBendDemultiplyBundle.action.unit.test.ts +175 -0
- package/src/actions/enso/__tests__/getBendDemultiplyBundle.unit.test.ts +150 -0
- package/src/actions/enso/__tests__/getBendMultiplyBundle.action.unit.test.ts +138 -0
- package/src/actions/enso/__tests__/getBendMultiplyBundle.unit.test.ts +194 -0
- package/src/actions/enso/{getEnsoUserTokensWithBalances.debug.test.ts → __tests__/getEnsoUserTokensWithBalances.debug.test.ts} +3 -3
- package/src/actions/enso/__tests__/helpers.ts +42 -0
- package/src/actions/enso/__tests__/util.unit.test.ts +95 -0
- package/src/actions/enso/flashloan.ts +127 -0
- package/src/actions/enso/getBendDemultiplyBundle.ts +325 -0
- package/src/actions/enso/getBendMultiplyBundle.ts +348 -0
- package/src/actions/enso/getEnsoSwapBundle.ts +2 -2
- package/src/actions/enso/getEnsoUserTokensWithBalances.ts +5 -5
- package/src/actions/enso/util.ts +150 -5
- package/src/actions/exports.ts +0 -2
- package/src/actions/governance/__tests__/checkProposalField.unit.test.ts +2 -2
- package/src/actions/governance/__tests__/getDecodedFunctionData.integration.test.ts +2 -2
- package/src/actions/governance/__tests__/getQuorum.integration.test.ts +2 -2
- package/src/actions/governance/checkProposalField.ts +1 -1
- package/src/actions/governance/computeActualStatus.ts +1 -1
- package/src/actions/governance/getAllProposals.ts +1 -1
- package/src/actions/governance/getBodyErrors.ts +1 -1
- package/src/actions/governance/getProposalDetails.ts +1 -1
- package/src/actions/governance/getProposalFromTx.ts +1 -1
- package/src/actions/governance/getProposalParams.ts +3 -3
- package/src/actions/governance/getProposalVotes.ts +1 -1
- package/src/actions/governance/getQuorum.ts +2 -2
- package/src/actions/honey/getCollateralWeights.ts +2 -2
- package/src/actions/honey/getGlobalCapLimit.ts +4 -4
- package/src/actions/honey/getHoneyCollaterals.ts +5 -5
- package/src/actions/honey/getHoneyFees.ts +1 -1
- package/src/actions/honey/getHoneyPausedState.ts +1 -1
- package/src/actions/honey/getHoneyPreview.ts +3 -3
- package/src/actions/honey/getHoneyRootPriceOracle.ts +1 -1
- package/src/actions/honey/getHoneyVaultsBalance.ts +2 -2
- package/src/actions/honey/getRelativeCapLimit.ts +3 -3
- package/src/actions/honey/getSharesWithoutFees.ts +1 -1
- package/src/actions/honey/getSwapPayload.ts +6 -6
- package/src/actions/honey/isBadCollateralAsset.ts +2 -2
- package/src/actions/honey/isBasketModeEnabled.ts +2 -2
- package/src/actions/honey/tests/pyth.integration.test.ts +3 -3
- package/src/actions/misc/getBlockTimestamp.ts +2 -2
- package/src/actions/pol/__tests__/getAllValidators.integration.test.ts +2 -2
- package/src/actions/pol/__tests__/rewardVaults.integration.test.ts +1 -1
- package/src/actions/pol/getBGTGlobalInfo.ts +2 -2
- package/src/actions/pol/getBgtAprSimulation.ts +1 -1
- package/src/actions/pol/getBgtAprSimultaion.unit.test.ts +1 -1
- package/src/actions/pol/getBgtTokenTotalBoosts.ts +2 -2
- package/src/actions/pol/getBgtTokenTotalSupply.ts +2 -2
- package/src/actions/pol/getBlockTime.debug.test.ts +13 -0
- package/src/actions/pol/getBlockTime.ts +14 -23
- package/src/actions/pol/getEarnedStakedBeraVault.ts +3 -3
- package/src/actions/pol/getGlobalCuttingBoard.ts +0 -0
- package/src/actions/pol/getGlobalData.ts +2 -2
- package/src/actions/pol/getIncentiveFeeClaimStats.ts +4 -4
- package/src/actions/pol/getLSTStakeConfig.ts +5 -5
- package/src/actions/pol/getMarkets.ts +2 -2
- package/src/actions/pol/getRewardProofsByValidator.ts +4 -4
- package/src/actions/pol/getRewardTokenToBeraRate.ts +1 -1
- package/src/actions/pol/getRewardVault.ts +3 -3
- package/src/actions/pol/getRewardVaultBeaconImplementation.integration.test.ts +1 -1
- package/src/actions/pol/getRewardVaultBeaconImplementation.ts +3 -3
- package/src/actions/pol/getRewardVaultDurationConstants.integration.test.ts +1 -1
- package/src/actions/pol/getRewardVaultDurationConstants.ts +1 -1
- package/src/actions/pol/getRewardVaultFromToken.ts +1 -1
- package/src/actions/pol/getRewardVaultIncentives.ts +2 -2
- package/src/actions/pol/getRewardVaultRewards.ts +1 -1
- package/src/actions/pol/getRewardVaults.ts +1 -1
- package/src/actions/pol/getSWBeraVaultMetadata.ts +20 -22
- package/src/actions/pol/getSWBeraWithdrawal.ts +4 -4
- package/src/actions/pol/getStakedBeraAPR.ts +2 -2
- package/src/actions/pol/getStakedBeraSnapshots.ts +2 -2
- package/src/actions/pol/getStakingDailyAssets.ts +3 -3
- package/src/actions/pol/getStakingTokenInformation.ts +2 -2
- package/src/actions/pol/getTotalStakedAmount.ts +1 -1
- package/src/actions/pol/getUserClaimableIncentives.ts +4 -4
- package/src/actions/pol/getUserVaultInfo.ts +1 -1
- package/src/actions/pol/getUserVaults.ts +4 -4
- package/src/actions/pol/getUserVaultsBalance.ts +1 -1
- package/src/actions/pol/getUserVaultsReward.ts +0 -0
- package/src/actions/pol/getVaultHistory.ts +2 -2
- package/src/actions/pol/getVaultValidators.ts +1 -1
- package/src/actions/pol/getVaultsSupply.ts +0 -0
- package/src/actions/prices/__tests__/prices.integration.test.ts +2 -2
- package/src/actions/prices/getTokenCurrentPrices.ts +5 -5
- package/src/actions/pyth/getHoneyPythFeeds.ts +2 -2
- package/src/actions/pyth/getUpdateFee.ts +2 -2
- package/src/actions/tokens/getAllowances.ts +2 -2
- package/src/actions/tokens/getTokenInformation.ts +2 -2
- package/src/actions/tokens/getTokens.ts +3 -3
- package/src/actions/tokens/getUnderlyingToken.ts +4 -4
- package/src/actions/tokens/getWalletBalances.integration.test.ts +1 -1
- package/src/actions/tokens/getWalletBalances.ts +4 -4
- package/src/actions/transactions/beraWriteContract.integration.test.ts +6 -6
- package/src/actions/transactions/beraWriteContract.ts +12 -12
- package/src/actions/validators/getActiveBoostAndCommissionChangeDelay.integration.test.ts +1 -1
- package/src/actions/validators/getActiveBoostAndCommissionChangeDelay.ts +1 -1
- package/src/actions/validators/getAllValidators.ts +2 -2
- package/src/actions/validators/getApiValidator.ts +2 -2
- package/src/actions/validators/getBaselineRewardAllocation.ts +1 -1
- package/src/actions/validators/getDailyValidatorBlockStats.ts +1 -1
- package/src/actions/validators/getDefaultRewardAllocation.ts +1 -1
- package/src/actions/validators/getUserActiveValidators.ts +31 -33
- package/src/actions/validators/getUserBoosts.ts +12 -8
- package/src/actions/validators/getUserBoostsOnValidator.ts +15 -3
- package/src/actions/validators/getUserStakingPositions.ts +1 -1
- package/src/actions/validators/getValidatorAnalytics.ts +2 -2
- package/src/actions/validators/getValidatorCommission.ts +1 -1
- package/src/actions/validators/getValidatorEstimatedBgtPerYear.ts +1 -1
- package/src/actions/validators/getValidatorOperatorAddress.ts +1 -1
- package/src/actions/validators/getValidatorQueuedCommission.ts +1 -1
- package/src/actions/validators/getValidatorQueuedOperatorAddress.ts +1 -1
- package/src/actions/validators/getValidatorQueuedRewardAllocation.ts +1 -1
- package/src/actions/validators/getValidatorRewardAllocation.ts +1 -1
- package/src/actions/validators/getValidatorRewardAllocatorAddress.ts +1 -1
- package/src/actions/validators/utils/__tests__/validatorUtils.integration.test.ts +4 -4
- package/src/contexts/BeraFlags/defaultFlags.ts +4 -0
- package/src/contexts/BexStatusProvider.tsx +1 -1
- package/src/contexts/HoneyConfigProvider.tsx +3 -3
- package/src/contexts/SwrFallback.tsx +2 -2
- package/src/contexts/TokensProvider.tsx +3 -3
- package/src/contexts/block-time-provider.tsx +1 -1
- package/src/contexts/exports.ts +0 -0
- package/src/data/contracts.ts +10 -0
- package/src/enum/exports.ts +0 -0
- package/src/enum/polling.ts +0 -0
- package/src/enum/txnEnum.ts +9 -0
- package/src/errors/BeraMonitoring.ts +2 -2
- package/src/errors/BeraTracing.ts +2 -2
- package/src/errors/RequestError.ts +1 -1
- package/src/errors/assert.ts +18 -0
- package/src/errors/getErrorMessage.ts +0 -0
- package/src/errors/getRevertReason.integration.test.ts +7 -7
- package/src/errors/getRevertReason.ts +1 -1
- package/src/errors/parseViemError.ts +1 -1
- package/src/hooks/bend/useGetConvertToAssets.ts +4 -4
- package/src/hooks/dex/useAggregatorsQuotes.ts +19 -19
- package/src/hooks/dex/useAggregatorsRouterFeeBps.ts +2 -2
- package/src/hooks/dex/useAllUserPools.ts +3 -3
- package/src/hooks/dex/useApiPool.ts +3 -3
- package/src/hooks/dex/useBexStatus.ts +1 -1
- package/src/hooks/dex/useCreatePool.ts +9 -9
- package/src/hooks/dex/useExploitedTokens.ts +3 -3
- package/src/hooks/dex/useGlobalLiquidityAndSwapVolume.ts +1 -1
- package/src/hooks/dex/useLiquidityMismatch.ts +3 -3
- package/src/hooks/dex/useLpPosition.ts +7 -4
- package/src/hooks/dex/useMultipleTokenApprovalsWithSlippage.ts +4 -4
- package/src/hooks/dex/useOnChainPoolData.ts +3 -3
- package/src/hooks/dex/usePollPoolCreationRelayerApproval.ts +3 -3
- package/src/hooks/dex/usePool.ts +7 -40
- package/src/hooks/dex/usePoolEvents.ts +2 -2
- package/src/hooks/dex/usePoolHistoricalData.ts +6 -3
- package/src/hooks/dex/usePools.ts +3 -3
- package/src/hooks/dex/usePriceImpact.ts +2 -2
- package/src/hooks/dex/useSingleAggregatorQuote.ts +13 -13
- package/src/hooks/enso/useBendDemultiply.ts +158 -0
- package/src/hooks/enso/useBendMultiply.ts +163 -0
- package/src/hooks/enso/useBendZapSupply.ts +7 -7
- package/src/hooks/enso/useEnsoSwapBundle.ts +6 -6
- package/src/hooks/enso/useEnsoUserTokensWithBalances.ts +5 -5
- package/src/hooks/enso/useEnsoWalletV2Address.ts +38 -0
- package/src/hooks/enso/useIsBendAuthorized.ts +47 -0
- package/src/hooks/enso/useZapStakeBera.ts +4 -4
- package/src/hooks/exports.ts +4 -3
- package/src/hooks/governance/useCreateProposal.ts +3 -3
- package/src/hooks/governance/useGetPastVotes.ts +2 -2
- package/src/hooks/governance/useHasVoted.ts +2 -2
- package/src/hooks/governance/useIsCanceller.ts +4 -4
- package/src/hooks/governance/usePollAllProposals.ts +3 -3
- package/src/hooks/governance/usePollProposal.ts +7 -4
- package/src/hooks/governance/usePollProposalThreshold.ts +3 -3
- package/src/hooks/governance/usePollProposalVotes.ts +1 -1
- package/src/hooks/governance/usePollUserDelegates.ts +7 -4
- package/src/hooks/governance/useProposalFromTx.ts +1 -1
- package/src/hooks/governance/useProposalSnapshot.ts +2 -2
- package/src/hooks/governance/useProposalState.ts +2 -2
- package/src/hooks/governance/useProposalTimelockState.ts +2 -2
- package/src/hooks/governance/useQuorum.ts +1 -1
- package/src/hooks/honey/useCappedGlobally.ts +8 -5
- package/src/hooks/honey/useCappedRelatively.ts +7 -4
- package/src/hooks/honey/useCollateralWeights.ts +8 -5
- package/src/hooks/honey/useHoneyAlerts.ts +5 -5
- package/src/hooks/honey/useHoneyBalances.ts +7 -7
- package/src/hooks/honey/useHoneyChartData.ts +1 -1
- package/src/hooks/honey/useHoneySwapState.ts +4 -4
- package/src/hooks/honey/useHoneyVaultsBalance.ts +8 -5
- package/src/hooks/honey/useIsBadCollateralAsset.ts +9 -6
- package/src/hooks/honey/useIsBasketModeEnabled.ts +8 -5
- package/src/hooks/honey/usePythLatestPrices.ts +4 -4
- package/src/hooks/perps/usePythUpdateFee.ts +4 -4
- package/src/hooks/pol/useBgtAprSimulation.ts +1 -1
- package/src/hooks/pol/useBgtUnstakedBalance.ts +7 -4
- package/src/hooks/pol/useClaimableFees.ts +4 -4
- package/src/hooks/pol/useOnChainRewardVault.ts +7 -7
- package/src/hooks/pol/usePollGlobalData.ts +9 -3
- package/src/hooks/pol/usePollMarkets.ts +5 -2
- package/src/hooks/pol/useQueuedBeraUnlock.ts +4 -4
- package/src/hooks/pol/useRewardTokenToBeraRate.ts +4 -4
- package/src/hooks/pol/useRewardVault.ts +5 -2
- package/src/hooks/pol/useRewardVaultBalanceFromStakingToken.ts +2 -2
- package/src/hooks/pol/useRewardVaultFromToken.ts +2 -2
- package/src/hooks/pol/useRewardVaultIncentives.ts +2 -2
- package/src/hooks/pol/useRewardVaultRewards.ts +3 -3
- package/src/hooks/pol/useRewardVaults.ts +2 -2
- package/src/hooks/pol/useStakedAPR.ts +3 -3
- package/src/hooks/pol/useStakedData.ts +10 -10
- package/src/hooks/pol/useStakedSnapshots.ts +3 -3
- package/src/hooks/pol/useStakingVaultsMetadata.ts +40 -0
- package/src/hooks/pol/useTotalStakedAmount.ts +2 -2
- package/src/hooks/pol/useUserVaultInfo.ts +8 -5
- package/src/hooks/pol/useUserVaults.ts +7 -4
- package/src/hooks/pol/useVaultAddress.ts +2 -2
- package/src/hooks/pol/useVaultHistory.ts +2 -2
- package/src/hooks/pol/useVaultValidators.ts +5 -2
- package/src/hooks/tokens/useBeraCurrentPrice.ts +1 -1
- package/src/hooks/tokens/useMultipleTokenInformation.ts +7 -4
- package/src/hooks/tokens/usePollAllowances.ts +7 -4
- package/src/hooks/tokens/usePollBalance.ts +8 -5
- package/src/hooks/tokens/usePollWalletBalances.ts +8 -5
- package/src/hooks/tokens/useStakingTokenInformation.ts +7 -4
- package/src/hooks/tokens/useTokenCurrentPrice.ts +1 -1
- package/src/hooks/tokens/useTokenCurrentPrices.ts +6 -6
- package/src/hooks/tokens/useTokenInformation.ts +8 -5
- package/src/hooks/tokens/useTokenPrice.ts +1 -1
- package/src/hooks/tokens/useTokenPrices.ts +4 -4
- package/src/hooks/tokens/useTokens.ts +3 -3
- package/src/hooks/tokens/useTotalSupply.ts +1 -1
- package/src/hooks/tokens/useUnderlyingAsset.ts +3 -3
- package/src/hooks/useBlockToTimestamp.ts +5 -5
- package/src/hooks/useContractWrite/index.ts +0 -0
- package/src/hooks/useContractWrite/stateReducer.ts +0 -0
- package/src/hooks/useContractWrite/types.ts +2 -2
- package/src/hooks/useContractWrite/useBeraContractWrite.ts +5 -6
- package/src/hooks/useGetVerifiedAbi.ts +1 -1
- package/src/hooks/usePrevious.ts +0 -0
- package/src/hooks/validators/useAllValidators.ts +7 -4
- package/src/hooks/validators/useApiEnrichedAllocation.ts +2 -2
- package/src/hooks/validators/useApiValidator.ts +5 -2
- package/src/hooks/validators/useBaselineRewardAllocation.ts +2 -2
- package/src/hooks/validators/useDailyValidatorBlockStats.ts +3 -3
- package/src/hooks/validators/useDefaultRewardAllocation.ts +4 -4
- package/src/hooks/validators/useManagedValidatorRole.ts +8 -5
- package/src/hooks/validators/useOnChainValidator.ts +6 -3
- package/src/hooks/validators/useStakingPoolBatch.ts +7 -4
- package/src/hooks/validators/useUserActiveValidators.ts +6 -3
- package/src/hooks/validators/useUserBoostsOnValidator.ts +3 -3
- package/src/hooks/validators/useUserClaimableIncentives.ts +9 -9
- package/src/hooks/validators/useUserStakingPositions.ts +1 -1
- package/src/hooks/validators/useValidator.ts +1 -1
- package/src/hooks/validators/useValidatorAnalytics.ts +3 -3
- package/src/hooks/validators/useValidatorCommission.ts +5 -2
- package/src/hooks/validators/useValidatorEstimatedBgtPerYear.ts +3 -3
- package/src/hooks/validators/useValidatorQueuedCommission.ts +6 -3
- package/src/hooks/validators/useValidatorQueuedOperatorAddress.ts +5 -2
- package/src/hooks/validators/useValidatorQueuedRewardAllocation.ts +6 -3
- package/src/hooks/validators/useValidatorRewardAllocation.ts +2 -2
- package/src/types/dex.d.ts +1 -1
- package/src/types/enso.d.ts +34 -0
- package/src/types/exports.ts +0 -0
- package/src/types/global.d.ts +3 -3
- package/src/types/governance.d.ts +1 -1
- package/src/types/honeySwap.d.ts +3 -3
- package/src/types/staking.d.ts +0 -0
- package/src/utils/beraFetch.ts +1 -1
- package/src/utils/createEmitter.ts +1 -1
- package/src/utils/exports.ts +0 -0
- package/src/utils/filter.ts +0 -0
- package/src/utils/formatIncentivesTokenMap.ts +1 -1
- package/src/utils/formatInputTokenValue.ts +0 -0
- package/src/utils/formatNumber.ts +0 -0
- package/src/utils/getContractName.ts +1 -1
- package/src/utils/getHoneySwapMessage.test.ts +1 -1
- package/src/utils/getHoneySwapMessage.ts +1 -1
- package/src/utils/parseBaseArgs.ts +1 -1
- package/src/utils/parseBaseArgs.unit.test.ts +1 -1
- package/src/utils/parseWhiskToken.ts +1 -1
- package/src/utils/poolNamings.ts +1 -1
- package/src/utils/tokens.ts +2 -2
- package/src/utils/tokens.unit.test.ts +1 -1
- package/src/utils/truncateHash.ts +0 -0
- package/.claude/skills/berajs/SKILL.md +0 -222
- package/.claude/skills/berajs/references/dex.md +0 -235
- package/.claude/skills/berajs/references/pol.md +0 -194
- package/.claude/skills/berajs/references/staking.md +0 -198
- package/.claude/skills/berajs/references/tokens.md +0 -170
- package/LICENSE +0 -21
- package/dist/chunk-22J3YJDN.cjs +0 -2
- package/dist/chunk-22J3YJDN.cjs.map +0 -1
- package/dist/chunk-2LL3P5PN.mjs +0 -2
- package/dist/chunk-2LL3P5PN.mjs.map +0 -1
- package/dist/chunk-4GU2O2OW.cjs +0 -4
- package/dist/chunk-4GU2O2OW.cjs.map +0 -1
- package/dist/chunk-55L7STYD.mjs +0 -2
- package/dist/chunk-55L7STYD.mjs.map +0 -1
- package/dist/chunk-5XWELBWR.mjs +0 -2
- package/dist/chunk-5XWELBWR.mjs.map +0 -1
- package/dist/chunk-6LDOG5RL.cjs.map +0 -1
- package/dist/chunk-7LNBSOVV.cjs +0 -2
- package/dist/chunk-7LNBSOVV.cjs.map +0 -1
- package/dist/chunk-7SMWQ6SN.mjs.map +0 -1
- package/dist/chunk-7WRTK7RJ.mjs.map +0 -1
- package/dist/chunk-AX2YQQFQ.mjs.map +0 -1
- package/dist/chunk-BS6K7HGH.cjs +0 -2
- package/dist/chunk-BS6K7HGH.cjs.map +0 -1
- package/dist/chunk-C3FHGFLK.mjs +0 -2
- package/dist/chunk-C3FHGFLK.mjs.map +0 -1
- package/dist/chunk-C6ZGUO4H.cjs.map +0 -1
- package/dist/chunk-FCWDGE62.cjs.map +0 -1
- package/dist/chunk-RW3JFPED.mjs +0 -4
- package/dist/chunk-RW3JFPED.mjs.map +0 -1
- package/dist/chunk-S3EAKCVM.cjs +0 -2
- package/dist/chunk-S3EAKCVM.cjs.map +0 -1
- package/dist/chunk-SWMJQOH6.cjs +0 -2
- package/dist/chunk-SWMJQOH6.cjs.map +0 -1
- package/dist/chunk-THATXCJK.mjs +0 -2
- package/dist/chunk-THATXCJK.mjs.map +0 -1
- package/dist/chunk-VXL2ZZ4X.cjs +0 -2
- package/dist/chunk-VXL2ZZ4X.cjs.map +0 -1
- package/dist/chunk-YNO7BCCM.mjs +0 -2
- package/dist/chunk-YXLFOEZN.mjs +0 -2
- package/dist/chunk-YXLFOEZN.mjs.map +0 -1
- package/dist/chunk-YZV5LKIP.cjs.map +0 -1
- package/src/actions/dex/getSubgraphPool.ts +0 -30
- package/src/actions/validators/getManagedValidatorByAccount.ts +0 -32
- package/src/hooks/pol/useSWBeraVaultMetadata.ts +0 -35
- package/src/hooks/validators/useManagedValidatorByAccount.ts +0 -40
- package/src/hooks/validators/useSubgraphUserValidators.ts +0 -36
|
@@ -1,43 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
GetBlocksTimeStamp,
|
|
3
|
-
type GetBlocksTimeStampQuery,
|
|
4
|
-
type GetBlocksTimeStampQueryVariables,
|
|
5
|
-
} from "@berachain/graphql/chain";
|
|
1
|
+
import type { PublicClient } from "viem";
|
|
6
2
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
3
|
+
import { assertPublicClient } from "../../errors/assert";
|
|
4
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
5
|
+
import { hoursInSeconds, msToSeconds } from "../../utils/time";
|
|
10
6
|
|
|
11
7
|
export async function getBlockTime({
|
|
12
8
|
defaultBlockTime,
|
|
9
|
+
publicClient,
|
|
13
10
|
blocksSpan,
|
|
14
11
|
...args
|
|
15
12
|
}: {
|
|
16
13
|
defaultBlockTime?: number;
|
|
17
14
|
blocksSpan?: number;
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
publicClient: PublicClient | undefined;
|
|
16
|
+
} & BeraJS.BaseFunctionArgs): Promise<number> {
|
|
17
|
+
assertPublicClient(publicClient);
|
|
20
18
|
|
|
21
|
-
const
|
|
19
|
+
const { config } = parseBaseArgs(args);
|
|
22
20
|
|
|
23
21
|
const blockTime = defaultBlockTime ?? config.averageBlockTime;
|
|
24
22
|
const span = blocksSpan ?? Math.floor(hoursInSeconds(1) / blockTime);
|
|
25
23
|
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
>({
|
|
30
|
-
query: GetBlocksTimeStamp,
|
|
31
|
-
variables: {
|
|
32
|
-
skip: span,
|
|
33
|
-
},
|
|
24
|
+
const currentBlock = await publicClient?.getBlock({ blockTag: "latest" });
|
|
25
|
+
const oldestBlock = await publicClient?.getBlock({
|
|
26
|
+
blockNumber: currentBlock.number - BigInt(span),
|
|
34
27
|
});
|
|
35
28
|
|
|
36
|
-
const data = res.data;
|
|
37
|
-
|
|
38
29
|
return (
|
|
39
30
|
// we need to use current timestamp as the latest block might not have been minted (chain halted)
|
|
40
|
-
(msToSeconds(Date.now()) - Number(
|
|
41
|
-
(Number(
|
|
31
|
+
(msToSeconds(Date.now()) - Number(oldestBlock?.timestamp)) /
|
|
32
|
+
(Number(currentBlock?.number) - Number(oldestBlock?.number))
|
|
42
33
|
);
|
|
43
34
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
2
|
|
|
3
|
-
import { beraFetchJson } from "
|
|
4
|
-
import { parseBaseArgs } from "
|
|
3
|
+
import { beraFetchJson } from "../../utils/beraFetch";
|
|
4
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
5
5
|
|
|
6
6
|
type StakingHistoryData = {
|
|
7
7
|
currentDepositRate: string;
|
|
@@ -26,6 +26,6 @@ export async function getEarnedStakedBeraVault({
|
|
|
26
26
|
}: BeraJS.BaseFunctionArgs &
|
|
27
27
|
GetEarnedStakedBeraVaultArgs): Promise<StakingHistoryData> {
|
|
28
28
|
const { config } = parseBaseArgs(args);
|
|
29
|
-
const url = `${config.
|
|
29
|
+
const url = `${config.staking}/vaults/${address}/earnings/${account}`;
|
|
30
30
|
return beraFetchJson<StakingHistoryData>({ url, type: "rest" });
|
|
31
31
|
}
|
|
File without changes
|
|
@@ -2,8 +2,8 @@ import type { PublicClient } from "viem";
|
|
|
2
2
|
|
|
3
3
|
import type { ApiVaultFragment } from "@berachain/graphql/pol/api";
|
|
4
4
|
|
|
5
|
-
import { BeraMonitoring } from "
|
|
6
|
-
import { initBeraError } from "
|
|
5
|
+
import { BeraMonitoring } from "../../errors/BeraMonitoring";
|
|
6
|
+
import { initBeraError } from "../../errors/initBeraError";
|
|
7
7
|
import { type GlobalInfo, getBGTGlobalInfo } from "./getBGTGlobalInfo";
|
|
8
8
|
import { getBgtTokenTotalBoosts } from "./getBgtTokenTotalBoosts";
|
|
9
9
|
import { getBgtTokenTotalSupply } from "./getBgtTokenTotalSupply";
|
|
@@ -2,15 +2,15 @@ import {
|
|
|
2
2
|
GetIncentiveFeeClaimStats,
|
|
3
3
|
type GetIncentiveFeeClaimStatsQuery,
|
|
4
4
|
type GetIncentiveFeeClaimStatsQueryVariables,
|
|
5
|
-
} from "@berachain/graphql/pol/
|
|
5
|
+
} from "@berachain/graphql/pol/fees";
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { days } from "../../utils/time";
|
|
8
|
+
import { getApolloClient } from "../clients/getApolloClient";
|
|
9
9
|
|
|
10
10
|
export async function getIncentiveFeeClaimStats({
|
|
11
11
|
...args
|
|
12
12
|
}: BeraJS.BaseFunctionArgs) {
|
|
13
|
-
const bgtClient = getApolloClient("pol.
|
|
13
|
+
const bgtClient = getApolloClient("pol.fees", args);
|
|
14
14
|
const { data } = await bgtClient.query<
|
|
15
15
|
GetIncentiveFeeClaimStatsQuery,
|
|
16
16
|
GetIncentiveFeeClaimStatsQueryVariables
|
|
@@ -2,11 +2,11 @@ import type { Address, PublicClient } from "viem";
|
|
|
2
2
|
|
|
3
3
|
import { lstStakerVaultAbi } from "@berachain/abis/pol/lst/lstStakerVault";
|
|
4
4
|
|
|
5
|
-
import { assertPublicClient } from "
|
|
6
|
-
import type { TokenWithMetadata } from "
|
|
7
|
-
import type { StakingConfig } from "
|
|
8
|
-
import { parseBaseArgs } from "
|
|
9
|
-
import { isToken } from "
|
|
5
|
+
import { assertPublicClient } from "../../errors/assert";
|
|
6
|
+
import type { TokenWithMetadata } from "../../types/dex";
|
|
7
|
+
import type { StakingConfig } from "../../types/staking";
|
|
8
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
9
|
+
import { isToken } from "../../utils/tokens";
|
|
10
10
|
|
|
11
11
|
export type GetLSTStakeConfigArgs = {
|
|
12
12
|
tokenList: TokenWithMetadata[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ProtocolMetadata } from "
|
|
2
|
-
import { parseBaseArgs } from "
|
|
1
|
+
import type { ProtocolMetadata } from "../../types/staking";
|
|
2
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
3
3
|
|
|
4
4
|
export interface GetMarkets {
|
|
5
5
|
marketList: ProtocolMetadata[];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
2
|
|
|
3
|
-
import { BeraError } from "
|
|
4
|
-
import type { BribeBoostRewardProof } from "
|
|
5
|
-
import { getErrorResponse } from "
|
|
6
|
-
import { parseBaseArgs } from "
|
|
3
|
+
import { BeraError } from "../../errors/BeraError";
|
|
4
|
+
import type { BribeBoostRewardProof } from "../../types/bribe-boost";
|
|
5
|
+
import { getErrorResponse } from "../../utils/getErrorResponse";
|
|
6
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
7
7
|
|
|
8
8
|
export async function getRewardProofsByValidator({
|
|
9
9
|
account,
|
|
@@ -2,7 +2,7 @@ import { type Address, formatUnits, type PublicClient, parseUnits } from "viem";
|
|
|
2
2
|
|
|
3
3
|
import { wberaStakerVaultAbi as stakeBeraVaultAbi } from "@berachain/abis/pol/wberaStakerVault";
|
|
4
4
|
|
|
5
|
-
import { assertPublicClient } from "
|
|
5
|
+
import { assertPublicClient } from "../../errors/assert";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
*
|
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
type GqlChain,
|
|
9
9
|
} from "@berachain/graphql/pol/api";
|
|
10
10
|
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
11
|
+
import { NotFoundError } from "../../errors/NotFoundError";
|
|
12
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
13
|
+
import { getApolloClient } from "../clients/getApolloClient";
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isAddress, zeroAddress } from "viem";
|
|
2
2
|
import { describe, expect, it } from "vitest";
|
|
3
3
|
|
|
4
|
-
import { getServerSidePublicClient } from "
|
|
4
|
+
import { getServerSidePublicClient } from "../../utils/getServerSideClient";
|
|
5
5
|
import { getRewardVaultBeaconImplementation } from "./getRewardVaultBeaconImplementation";
|
|
6
6
|
|
|
7
7
|
describe("getRewardVaultBeaconImplementation", () => {
|
|
@@ -2,9 +2,9 @@ import type { Address, PublicClient } from "viem";
|
|
|
2
2
|
|
|
3
3
|
import { rewardVaultFactoryAbi } from "@berachain/abis/pol/rewards/rewardVaultFactory";
|
|
4
4
|
|
|
5
|
-
import { upgradableBeaconAbi } from "
|
|
6
|
-
import { assertAddress, assertDefined } from "
|
|
7
|
-
import { parseBaseArgs } from "
|
|
5
|
+
import { upgradableBeaconAbi } from "../../abi/utils/upgradableBeacon";
|
|
6
|
+
import { assertAddress, assertDefined } from "../../errors/assert";
|
|
7
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Returns the beacon implementation address for all reward vaults.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
2
|
|
|
3
|
-
import { getServerSidePublicClient } from "
|
|
3
|
+
import { getServerSidePublicClient } from "../../utils/getServerSideClient";
|
|
4
4
|
import { getRewardVaultDurationConstants } from "./getRewardVaultDurationConstants";
|
|
5
5
|
|
|
6
6
|
describe("getRewardVaultDurationConstants", () => {
|
|
@@ -2,7 +2,7 @@ import type { PublicClient } from "viem";
|
|
|
2
2
|
|
|
3
3
|
import { rewardVaultAbi } from "@berachain/abis/pol/rewards/rewardVault";
|
|
4
4
|
|
|
5
|
-
import { assertPublicClient } from "
|
|
5
|
+
import { assertPublicClient } from "../../errors/assert";
|
|
6
6
|
import { getRewardVaultBeaconImplementation } from "./getRewardVaultBeaconImplementation";
|
|
7
7
|
|
|
8
8
|
export interface RewardVaultDurationConstants {
|
|
@@ -2,7 +2,7 @@ import { type Address, type PublicClient, zeroAddress } from "viem";
|
|
|
2
2
|
|
|
3
3
|
import { rewardVaultFactoryAbi } from "@berachain/abis/pol/rewards/rewardVaultFactory";
|
|
4
4
|
|
|
5
|
-
import { parseBaseArgs } from "
|
|
5
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
6
6
|
|
|
7
7
|
export async function getRewardVaultFromToken({
|
|
8
8
|
tokenAddress,
|
|
@@ -3,8 +3,8 @@ import { type Address, erc20Abi, formatUnits, type PublicClient } from "viem";
|
|
|
3
3
|
|
|
4
4
|
import { rewardVaultAbi } from "@berachain/abis/pol/rewards/rewardVault";
|
|
5
5
|
|
|
6
|
-
import { BeraError } from "
|
|
7
|
-
import { BeraMonitoring } from "
|
|
6
|
+
import { BeraError } from "../../errors/BeraError";
|
|
7
|
+
import { BeraMonitoring } from "../../errors/BeraMonitoring";
|
|
8
8
|
|
|
9
9
|
export interface RewardVaultIncentive {
|
|
10
10
|
token: Address;
|
|
@@ -2,7 +2,7 @@ import { type Address, formatUnits, type PublicClient } from "viem";
|
|
|
2
2
|
|
|
3
3
|
import { rewardVaultAbi } from "@berachain/abis/pol/rewards/rewardVault";
|
|
4
4
|
|
|
5
|
-
import { msToSeconds } from "
|
|
5
|
+
import { msToSeconds } from "../../utils/time";
|
|
6
6
|
|
|
7
7
|
export enum RewardVaultDistributionMode {
|
|
8
8
|
Duration = "duration",
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
type GetVaultsQueryVariables,
|
|
10
10
|
} from "@berachain/graphql/pol/api";
|
|
11
11
|
|
|
12
|
-
import { getApolloClient } from "
|
|
12
|
+
import { getApolloClient } from "../clients/getApolloClient";
|
|
13
13
|
|
|
14
14
|
export interface GetGaugeData {
|
|
15
15
|
gaugeList: ApiVaultFragment[];
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { type Address, erc20Abi, type PublicClient } from "viem";
|
|
2
|
-
|
|
3
|
-
import { wberaStakerVaultAbi as stakeBeraVaultAbi } from "@berachain/abis/pol/wberaStakerVault";
|
|
1
|
+
import { type Address, erc20Abi, erc4626Abi, type PublicClient } from "viem";
|
|
4
2
|
|
|
5
3
|
import BigNumber from "@berachain/utils/pkg/bignumber.js";
|
|
6
4
|
|
|
7
|
-
import { assertPublicClient } from "
|
|
8
|
-
import { parseBaseArgs } from "~/utils/parseBaseArgs";
|
|
5
|
+
import { assertPublicClient } from "../../errors/assert";
|
|
9
6
|
import { getIncentiveFeeClaimStats } from "./getIncentiveFeeClaimStats";
|
|
10
7
|
import { getStakeWithdrawalCooldown } from "./getStakeWithdrawalCooldown";
|
|
11
8
|
|
|
@@ -26,32 +23,32 @@ export interface VaultMetadata {
|
|
|
26
23
|
lockPeriod?: number;
|
|
27
24
|
totalBuyBacks: number;
|
|
28
25
|
totalBuyBacksInLast24Hours: number;
|
|
26
|
+
address: Address;
|
|
29
27
|
}
|
|
30
28
|
/**
|
|
31
29
|
*
|
|
32
30
|
* @param address - The address of the vault
|
|
31
|
+
* @param underlyingAsset - The address of the vault's underlying asset token
|
|
33
32
|
* @throws {Error} If the vault is not found
|
|
34
33
|
* @returns
|
|
35
34
|
*/
|
|
36
35
|
export async function getSWBeraVaultMetadata({
|
|
37
36
|
address,
|
|
37
|
+
underlyingAsset,
|
|
38
38
|
publicClient,
|
|
39
39
|
blockTime,
|
|
40
|
-
...args
|
|
41
40
|
}: {
|
|
42
41
|
address: Address;
|
|
42
|
+
underlyingAsset: Address;
|
|
43
43
|
publicClient?: PublicClient;
|
|
44
44
|
blockTime: number;
|
|
45
|
-
}
|
|
46
|
-
const { config } = parseBaseArgs(args);
|
|
45
|
+
}): Promise<VaultMetadata> {
|
|
47
46
|
assertPublicClient(publicClient);
|
|
48
47
|
|
|
49
48
|
const hoursWindow = 26; // 26 hours is the window for the vault to ensure at least 1 claim per APR window.
|
|
50
49
|
try {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
publicClient.getBlock({ blockTag: "latest" }),
|
|
54
|
-
]);
|
|
50
|
+
const currentBlock = await publicClient.getBlock({ blockTag: "latest" });
|
|
51
|
+
|
|
55
52
|
const blocksPerWindow = Math.floor((hoursWindow * 60 * 60) / blockTime); // hoursWindow * 60 minutes * 60 seconds / actual block time
|
|
56
53
|
const blockWindowAgo = currentBlock.number - BigInt(blocksPerWindow);
|
|
57
54
|
|
|
@@ -64,36 +61,36 @@ export async function getSWBeraVaultMetadata({
|
|
|
64
61
|
totalSupply24HoursAgo,
|
|
65
62
|
oneShareWorthWindowAgo,
|
|
66
63
|
tvl24HoursAgo,
|
|
67
|
-
|
|
64
|
+
underlyingTotalSupply,
|
|
68
65
|
lockPeriod,
|
|
69
66
|
incentiveFeeClaimStats,
|
|
70
67
|
] = await Promise.all([
|
|
71
68
|
publicClient.readContract({
|
|
72
69
|
address,
|
|
73
|
-
abi:
|
|
70
|
+
abi: erc4626Abi,
|
|
74
71
|
functionName: "totalAssets",
|
|
75
72
|
}),
|
|
76
73
|
publicClient.readContract({
|
|
77
74
|
address,
|
|
78
|
-
abi:
|
|
75
|
+
abi: erc4626Abi,
|
|
79
76
|
functionName: "totalSupply",
|
|
80
77
|
}),
|
|
81
78
|
publicClient.readContract({
|
|
82
79
|
address,
|
|
83
|
-
abi:
|
|
80
|
+
abi: erc4626Abi,
|
|
84
81
|
functionName: "previewRedeem",
|
|
85
82
|
args: [10n ** 18n],
|
|
86
83
|
blockNumber: currentBlock.number,
|
|
87
84
|
}),
|
|
88
85
|
publicClient.readContract({
|
|
89
|
-
address:
|
|
86
|
+
address: underlyingAsset,
|
|
90
87
|
abi: erc20Abi,
|
|
91
88
|
functionName: "balanceOf",
|
|
92
89
|
args: [address],
|
|
93
90
|
}),
|
|
94
91
|
publicClient.readContract({
|
|
95
92
|
address,
|
|
96
|
-
abi:
|
|
93
|
+
abi: erc4626Abi,
|
|
97
94
|
functionName: "totalAssets",
|
|
98
95
|
blockNumber: blockWindowAgo,
|
|
99
96
|
}),
|
|
@@ -105,20 +102,20 @@ export async function getSWBeraVaultMetadata({
|
|
|
105
102
|
}),
|
|
106
103
|
publicClient.readContract({
|
|
107
104
|
address,
|
|
108
|
-
abi:
|
|
105
|
+
abi: erc4626Abi,
|
|
109
106
|
functionName: "previewRedeem",
|
|
110
107
|
args: [10n ** 18n],
|
|
111
108
|
blockNumber: blockWindowAgo,
|
|
112
109
|
}),
|
|
113
110
|
publicClient.readContract({
|
|
114
|
-
address:
|
|
111
|
+
address: underlyingAsset,
|
|
115
112
|
abi: erc20Abi,
|
|
116
113
|
functionName: "balanceOf",
|
|
117
114
|
args: [address],
|
|
118
115
|
blockNumber: blockWindowAgo,
|
|
119
116
|
}),
|
|
120
117
|
publicClient.readContract({
|
|
121
|
-
address:
|
|
118
|
+
address: underlyingAsset,
|
|
122
119
|
abi: erc20Abi,
|
|
123
120
|
functionName: "totalSupply",
|
|
124
121
|
}),
|
|
@@ -135,6 +132,7 @@ export async function getSWBeraVaultMetadata({
|
|
|
135
132
|
const currentExchangeRate = new BigNumber(currentOneShareWorth.toString());
|
|
136
133
|
|
|
137
134
|
return {
|
|
135
|
+
address,
|
|
138
136
|
current: {
|
|
139
137
|
exchangeRate: currentExchangeRate.toString(),
|
|
140
138
|
totalSupply: new BigNumber(currentTotalSupply.toString())
|
|
@@ -155,7 +153,7 @@ export async function getSWBeraVaultMetadata({
|
|
|
155
153
|
.toString(),
|
|
156
154
|
tvl: new BigNumber(tvl24HoursAgo.toString()).dividedBy(1e18).toString(),
|
|
157
155
|
},
|
|
158
|
-
totalWBeraIssued: new BigNumber(
|
|
156
|
+
totalWBeraIssued: new BigNumber(underlyingTotalSupply.toString())
|
|
159
157
|
.dividedBy(1e18)
|
|
160
158
|
.toString(),
|
|
161
159
|
lockPeriod,
|
|
@@ -2,10 +2,10 @@ import type { Address, PublicClient } from "viem";
|
|
|
2
2
|
|
|
3
3
|
import { wberaStakerVaultAbi as stakeBeraVaultAbi } from "@berachain/abis/pol/wberaStakerVault";
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
5
|
+
import { formatTimeLeft } from "../../utils/formatTimestamps";
|
|
6
|
+
import { msToSeconds } from "../../utils/time";
|
|
7
|
+
import { isToken } from "../../utils/tokens";
|
|
8
|
+
import { getStakeWithdrawalCooldown } from "./getStakeWithdrawalCooldown";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Calculates and returns formatted time remaining until a target date
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
GqlSWberaVaultMetadataResolution,
|
|
7
7
|
} from "@berachain/graphql/pol/api";
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
10
|
+
import { getApolloClient } from "../clients/getApolloClient";
|
|
11
11
|
|
|
12
12
|
function getResolution(window: "DAY" | "WEEK") {
|
|
13
13
|
if (window === "DAY") {
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
GqlVaultSnapshotDataRange,
|
|
7
7
|
} from "@berachain/graphql/pol/api";
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
10
|
+
import { getApolloClient } from "../clients/getApolloClient";
|
|
11
11
|
|
|
12
12
|
export type GetStakedBeraSnapshotsArgs = {
|
|
13
13
|
chain?: GqlChain;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
2
|
|
|
3
|
-
import { beraFetchJson } from "
|
|
4
|
-
import { parseBaseArgs } from "
|
|
3
|
+
import { beraFetchJson } from "../../utils/beraFetch";
|
|
4
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
5
5
|
|
|
6
6
|
export async function getStakingDailyAssets({
|
|
7
7
|
address,
|
|
@@ -16,7 +16,7 @@ export async function getStakingDailyAssets({
|
|
|
16
16
|
);
|
|
17
17
|
|
|
18
18
|
const { config } = parseBaseArgs({});
|
|
19
|
-
const url = `${config.
|
|
19
|
+
const url = `${config.staking}/vaults/${address}/total-assets-by-day?start=${startDayDate.toISOString().split("T")[0]}`;
|
|
20
20
|
return beraFetchJson<{ _timestamp: number; total_assets: string }[]>({
|
|
21
21
|
url,
|
|
22
22
|
type: "rest",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Address, erc20Abi, formatUnits, type PublicClient } from "viem";
|
|
2
2
|
|
|
3
|
-
import { assertPublicClient } from "
|
|
4
|
-
import type { Token } from "
|
|
3
|
+
import { assertPublicClient } from "../../errors/assert";
|
|
4
|
+
import type { Token } from "../../types/dex";
|
|
5
5
|
|
|
6
6
|
export interface GetStakingTokenInformation {
|
|
7
7
|
address: Address;
|
|
@@ -4,7 +4,7 @@ import type { Address } from "@berachain/config";
|
|
|
4
4
|
|
|
5
5
|
import { wberaStakerVaultAbi as stakeBeraVaultAbi } from "@berachain/abis/pol/wberaStakerVault";
|
|
6
6
|
|
|
7
|
-
import { assertPublicClient } from "
|
|
7
|
+
import { assertPublicClient } from "../../errors/assert";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Get the total staked amount for a given vault address
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
2
|
|
|
3
|
-
import { BeraError } from "
|
|
4
|
-
import type { BribeBoostRewardItem } from "
|
|
5
|
-
import { getErrorResponse } from "
|
|
6
|
-
import { parseBaseArgs } from "
|
|
3
|
+
import { BeraError } from "../../errors/BeraError";
|
|
4
|
+
import type { BribeBoostRewardItem } from "../../types/bribe-boost";
|
|
5
|
+
import { getErrorResponse } from "../../utils/getErrorResponse";
|
|
6
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Server-side function to get user claimable incentives grouped by validator
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Address, formatEther, type PublicClient } from "viem";
|
|
2
2
|
|
|
3
|
-
import type { UserVaultInfo } from "
|
|
3
|
+
import type { UserVaultInfo } from "../../types/pol";
|
|
4
4
|
import { getUserVaultsBalance } from "./getUserVaultsBalance";
|
|
5
5
|
import { getUserVaultsReward } from "./getUserVaultsReward";
|
|
6
6
|
import { getVaultsSupply } from "./getVaultsSupply";
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
type GqlChain,
|
|
11
11
|
} from "@berachain/graphql/pol/api";
|
|
12
12
|
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
13
|
+
import { BeraError } from "../../errors/BeraError";
|
|
14
|
+
import { BeraMonitoring } from "../../errors/BeraMonitoring";
|
|
15
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
16
|
+
import { getApolloClient } from "../clients/getApolloClient";
|
|
17
17
|
|
|
18
18
|
export interface UserVault {
|
|
19
19
|
unclaimedBgt: string;
|
|
@@ -2,7 +2,7 @@ import type { Address, PublicClient } from "viem";
|
|
|
2
2
|
|
|
3
3
|
import { rewardVaultAbi } from "@berachain/abis/pol/rewards/rewardVault";
|
|
4
4
|
|
|
5
|
-
import { assertAddress, assertPublicClient } from "
|
|
5
|
+
import { assertAddress, assertPublicClient } from "../../errors/assert";
|
|
6
6
|
|
|
7
7
|
export interface GetUserVaultsInfo {
|
|
8
8
|
account: string | undefined;
|
|
File without changes
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
type GqlChain,
|
|
8
8
|
} from "@berachain/graphql/pol/api";
|
|
9
9
|
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
11
|
+
import { getApolloClient } from "../clients/getApolloClient";
|
|
12
12
|
|
|
13
13
|
export type GetVaultHistoryArgs = {
|
|
14
14
|
vault: Address;
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
type GetVaultValidatorsQueryVariables,
|
|
8
8
|
} from "@berachain/graphql/pol/api";
|
|
9
9
|
|
|
10
|
-
import { getApolloClient } from "
|
|
10
|
+
import { getApolloClient } from "../clients/getApolloClient";
|
|
11
11
|
|
|
12
12
|
export async function getVaultValidators({
|
|
13
13
|
address,
|
|
File without changes
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getAddress } from "viem";
|
|
2
2
|
import { describe, expect, it } from "vitest";
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { parseBaseArgs } from "../../../utils/parseBaseArgs";
|
|
5
|
+
import { getTokens } from "../../tokens/getTokens";
|
|
6
6
|
import { getTokenCurrentPrices } from "../getTokenCurrentPrices";
|
|
7
7
|
|
|
8
8
|
describe("prices", async () => {
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
type GqlChain,
|
|
8
8
|
} from "@berachain/graphql/dex/api";
|
|
9
9
|
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
10
|
+
import type { TokenCurrentPriceMap } from "../../types/dex";
|
|
11
|
+
import { getSafeNumber } from "../../utils/formatNumber";
|
|
12
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
13
|
+
import { isToken } from "../../utils/tokens";
|
|
14
|
+
import { getApolloClient } from "../clients/getApolloClient";
|
|
15
15
|
|
|
16
16
|
export async function getTokenCurrentPrices({
|
|
17
17
|
addressIn: _addressIn,
|
|
@@ -4,8 +4,8 @@ import type { Address } from "@berachain/config";
|
|
|
4
4
|
|
|
5
5
|
import { pythPriceOracleAbi } from "@berachain/abis/extras/pythPriceOracle";
|
|
6
6
|
|
|
7
|
-
import type { PythPriceFeedMap } from "
|
|
8
|
-
import { parseBaseArgs } from "
|
|
7
|
+
import type { PythPriceFeedMap } from "../../types/honeySwap";
|
|
8
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Given a list of tokens, it will return the price feed ids for each token according to honey priceOracle
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Address, PublicClient } from "viem";
|
|
2
2
|
|
|
3
|
-
import { pythAbi } from "
|
|
4
|
-
import { parseBaseArgs } from "
|
|
3
|
+
import { pythAbi } from "../../abi/pyth/pyth";
|
|
4
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
5
5
|
|
|
6
6
|
export async function getPythUpdateFee({
|
|
7
7
|
client,
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
formatUnits,
|
|
7
7
|
} from "viem";
|
|
8
8
|
|
|
9
|
-
import { assertDefined, assertPublicClient } from "
|
|
10
|
-
import type { AllowanceQueryItem, AllowanceToken } from "
|
|
9
|
+
import { assertDefined, assertPublicClient } from "../../errors/assert";
|
|
10
|
+
import type { AllowanceQueryItem, AllowanceToken } from "../../types/dex";
|
|
11
11
|
|
|
12
12
|
export interface GetAllowances {
|
|
13
13
|
items: AllowanceQueryItem[] | undefined;
|