@berachain/berajs 0.2.12 → 0.3.0
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/bend/bundler.d.ts +100 -0
- package/dist/abi/bend/bundler.d.ts.map +1 -0
- package/dist/abi/bend/generalAdapter.d.ts +651 -0
- package/dist/abi/bend/generalAdapter.d.ts.map +1 -0
- package/dist/abi/bend/morphoVault.d.ts +1991 -0
- package/dist/abi/bend/morphoVault.d.ts.map +1 -0
- package/dist/abi/bend/publicAllocator.d.ts +448 -0
- package/dist/abi/bend/publicAllocator.d.ts.map +1 -0
- package/dist/abi/enso/ensoRouterAbi.d.ts +215 -0
- package/dist/abi/enso/ensoRouterAbi.d.ts.map +1 -0
- package/dist/abi/enso/ensoWalletV2Factory.d.ts +16 -0
- package/dist/abi/enso/ensoWalletV2Factory.d.ts.map +1 -0
- package/dist/abi/exports.d.ts +13 -6574
- package/dist/abi/exports.d.ts.map +1 -0
- package/dist/abi/exports.mjs +4 -3
- package/dist/abi/exports.mjs.map +1 -0
- package/dist/abi/pyth/pyth.d.ts +434 -0
- package/dist/abi/pyth/pyth.d.ts.map +1 -0
- package/dist/abi/pyth/pythErrors.d.ts +58 -0
- package/dist/abi/pyth/pythErrors.d.ts.map +1 -0
- package/dist/abi/utils/EIP7702StatelessDelegator.d.ts +799 -0
- package/dist/abi/utils/EIP7702StatelessDelegator.d.ts.map +1 -0
- package/dist/abi/utils/bundler3errors.d.ts +18 -0
- package/dist/abi/utils/bundler3errors.d.ts.map +1 -0
- package/dist/abi/utils/commonAbiErrors.d.ts +302 -0
- package/dist/abi/utils/commonAbiErrors.d.ts.map +1 -0
- package/dist/abi/utils/erc20errors.d.ts +167 -0
- package/dist/abi/utils/erc20errors.d.ts.map +1 -0
- package/dist/abi/utils/merkleDistributor.d.ts +655 -0
- package/dist/abi/utils/merkleDistributor.d.ts.map +1 -0
- package/dist/abi/utils/multicall3.d.ts +337 -0
- package/dist/abi/utils/multicall3.d.ts.map +1 -0
- package/dist/abi/utils/openChainErrors.d.ts +126 -0
- package/dist/abi/utils/openChainErrors.d.ts.map +1 -0
- package/dist/abi/utils/thirdwebMinimalAccount.d.ts +869 -0
- package/dist/abi/utils/thirdwebMinimalAccount.d.ts.map +1 -0
- package/dist/abi/utils/upgradableBeacon.d.ts +97 -0
- package/dist/abi/utils/upgradableBeacon.d.ts.map +1 -0
- package/dist/actions/__test/transports.d.ts +18 -0
- package/dist/actions/__test/transports.d.ts.map +1 -0
- package/dist/actions/bend/getConvertToAssets.d.ts +11 -0
- package/dist/actions/bend/getConvertToAssets.d.ts.map +1 -0
- package/dist/actions/bend/getMaxDeposit.d.ts +26 -0
- package/dist/actions/bend/getMaxDeposit.d.ts.map +1 -0
- package/dist/{getApolloClient-MWm_iq4u.d.ts → actions/clients/BeraApolloClient.d.ts} +3 -14
- package/dist/actions/clients/BeraApolloClient.d.ts.map +1 -0
- package/dist/actions/clients/clientName.d.ts +10 -0
- package/dist/actions/clients/clientName.d.ts.map +1 -0
- package/dist/actions/clients/exports.d.ts +6 -62
- package/dist/actions/clients/exports.d.ts.map +1 -0
- package/dist/actions/clients/exports.mjs +30 -10
- package/dist/actions/clients/exports.mjs.map +1 -0
- package/dist/actions/clients/fetchBeep.d.ts +12 -0
- package/dist/actions/clients/fetchBeep.d.ts.map +1 -0
- package/dist/actions/clients/fetchEnso.d.ts +17 -0
- package/dist/actions/clients/fetchEnso.d.ts.map +1 -0
- package/dist/actions/clients/fetchLayerzero.d.ts +12 -0
- package/dist/actions/clients/fetchLayerzero.d.ts.map +1 -0
- package/dist/actions/clients/fetchOpenApi.d.ts +51 -0
- package/dist/actions/clients/fetchOpenApi.d.ts.map +1 -0
- package/dist/actions/clients/getApolloClient.d.ts +11 -0
- package/dist/actions/clients/getApolloClient.d.ts.map +1 -0
- package/dist/actions/clients/getEnsoClient.d.ts +11 -0
- package/dist/actions/clients/getEnsoClient.d.ts.map +1 -0
- package/dist/actions/dex/aggregators/base.d.ts +114 -0
- package/dist/actions/dex/aggregators/base.d.ts.map +1 -0
- package/dist/actions/dex/aggregators/bex.d.ts +36 -0
- package/dist/actions/dex/aggregators/bex.d.ts.map +1 -0
- package/dist/actions/dex/aggregators/bgt.d.ts +17 -0
- package/dist/actions/dex/aggregators/bgt.d.ts.map +1 -0
- package/dist/actions/dex/aggregators/enso/enso.d.ts +15 -0
- package/dist/actions/dex/aggregators/enso/enso.d.ts.map +1 -0
- package/dist/actions/dex/aggregators/enso/ensoErc4626.d.ts +15 -0
- package/dist/actions/dex/aggregators/enso/ensoErc4626.d.ts.map +1 -0
- package/dist/actions/dex/aggregators/erc4626.d.ts +32 -0
- package/dist/actions/dex/aggregators/erc4626.d.ts.map +1 -0
- package/dist/actions/dex/aggregators/fly.d.ts +14 -0
- package/dist/actions/dex/aggregators/fly.d.ts.map +1 -0
- package/dist/actions/dex/aggregators/haiku.d.ts +20 -0
- package/dist/actions/dex/aggregators/haiku.d.ts.map +1 -0
- package/dist/actions/dex/aggregators/honey.d.ts +32 -0
- package/dist/actions/dex/aggregators/honey.d.ts.map +1 -0
- package/dist/actions/dex/aggregators/kyberswap.d.ts +14 -0
- package/dist/actions/dex/aggregators/kyberswap.d.ts.map +1 -0
- package/dist/actions/dex/aggregators/oogabooga.d.ts +13 -0
- package/dist/actions/dex/aggregators/oogabooga.d.ts.map +1 -0
- package/dist/actions/dex/aggregators/openOcean.d.ts +15 -0
- package/dist/actions/dex/aggregators/openOcean.d.ts.map +1 -0
- package/dist/actions/dex/aggregators/wbera.d.ts +18 -0
- package/dist/actions/dex/aggregators/wbera.d.ts.map +1 -0
- package/dist/actions/dex/bSdk.d.ts +3 -0
- package/dist/actions/dex/bSdk.d.ts.map +1 -0
- package/dist/actions/dex/getAllPools.d.ts +58 -0
- package/dist/actions/dex/getAllPools.d.ts.map +1 -0
- package/dist/actions/dex/getApiPool.d.ts +390 -0
- package/dist/actions/dex/getApiPool.d.ts.map +1 -0
- package/dist/actions/dex/getGlobalLiquidityAndSwapVolume.d.ts +3 -0
- package/dist/actions/dex/getGlobalLiquidityAndSwapVolume.d.ts.map +1 -0
- package/dist/actions/dex/getOnChainPool.d.ts +42 -0
- package/dist/actions/dex/getOnChainPool.d.ts.map +1 -0
- package/dist/actions/dex/getPoolEvents.d.ts +7 -0
- package/dist/actions/dex/getPoolEvents.d.ts.map +1 -0
- package/dist/actions/dex/getPoolHistoricalData.d.ts +15 -0
- package/dist/actions/dex/getPoolHistoricalData.d.ts.map +1 -0
- package/dist/actions/dex/getPoolPausedState.d.ts +10 -0
- package/dist/actions/dex/getPoolPausedState.d.ts.map +1 -0
- package/dist/actions/dex/getPoolWithState.d.ts +4 -0
- package/dist/actions/dex/getPoolWithState.d.ts.map +1 -0
- package/dist/actions/dex/getVaultPausedState.d.ts +5 -0
- package/dist/actions/dex/getVaultPausedState.d.ts.map +1 -0
- package/dist/actions/enso/__tests__/helpers.d.ts +24 -0
- package/dist/actions/enso/__tests__/helpers.d.ts.map +1 -0
- package/dist/actions/enso/flashloan.d.ts +41 -0
- package/dist/actions/enso/flashloan.d.ts.map +1 -0
- package/dist/actions/enso/getBendDemultiplyBundle.d.ts +55 -0
- package/dist/actions/enso/getBendDemultiplyBundle.d.ts.map +1 -0
- package/dist/actions/enso/getBendMultiplyBundle.d.ts +70 -0
- package/dist/actions/enso/getBendMultiplyBundle.d.ts.map +1 -0
- package/dist/actions/enso/getEnsoUserTokensWithBalances.d.ts +16 -0
- package/dist/actions/enso/getEnsoUserTokensWithBalances.d.ts.map +1 -0
- package/dist/actions/enso/util.d.ts +35 -0
- package/dist/actions/enso/util.d.ts.map +1 -0
- package/dist/actions/exports.d.ts +98 -1682
- package/dist/actions/exports.d.ts.map +1 -0
- package/dist/actions/exports.mjs +40 -40
- package/dist/actions/exports.mjs.map +1 -0
- package/dist/actions/governance/checkProposalField.d.ts +27 -0
- package/dist/actions/governance/checkProposalField.d.ts.map +1 -0
- package/dist/actions/governance/computeActualStatus.d.ts +14 -0
- package/dist/actions/governance/computeActualStatus.d.ts.map +1 -0
- package/dist/actions/governance/constants.d.ts +7 -0
- package/dist/actions/governance/constants.d.ts.map +1 -0
- package/dist/actions/governance/exports.d.ts +10 -132
- package/dist/actions/governance/exports.d.ts.map +1 -0
- package/dist/actions/governance/exports.mjs +5 -4
- package/dist/actions/governance/exports.mjs.map +1 -0
- package/dist/actions/governance/getAllProposals.d.ts +16 -0
- package/dist/actions/governance/getAllProposals.d.ts.map +1 -0
- package/dist/actions/governance/getBodyErrors.d.ts +10 -0
- package/dist/actions/governance/getBodyErrors.d.ts.map +1 -0
- package/dist/actions/governance/getDecodedFunctionData.d.ts +30 -0
- package/dist/actions/governance/getDecodedFunctionData.d.ts.map +1 -0
- package/dist/actions/governance/getProposalDetails.d.ts +10 -0
- package/dist/actions/governance/getProposalDetails.d.ts.map +1 -0
- package/dist/actions/governance/getProposalFromTx.d.ts +18 -0
- package/dist/actions/governance/getProposalFromTx.d.ts.map +1 -0
- package/dist/actions/governance/getProposalParams.d.ts +15 -0
- package/dist/actions/governance/getProposalParams.d.ts.map +1 -0
- package/dist/actions/governance/getProposalVotes.d.ts +10 -0
- package/dist/actions/governance/getProposalVotes.d.ts.map +1 -0
- package/dist/actions/governance/getQuorum.d.ts +13 -0
- package/dist/actions/governance/getQuorum.d.ts.map +1 -0
- package/dist/actions/governance/parseProposalBody.d.ts +13 -0
- package/dist/actions/governance/parseProposalBody.d.ts.map +1 -0
- package/dist/actions/honey/getChartData.d.ts +13 -0
- package/dist/actions/honey/getChartData.d.ts.map +1 -0
- package/dist/actions/honey/getCollateralWeights.d.ts +19 -0
- package/dist/actions/honey/getCollateralWeights.d.ts.map +1 -0
- package/dist/actions/honey/getGlobalCapLimit.d.ts +24 -0
- package/dist/actions/honey/getGlobalCapLimit.d.ts.map +1 -0
- package/dist/actions/honey/getHoney24hVolume.d.ts +9 -0
- package/dist/actions/honey/getHoney24hVolume.d.ts.map +1 -0
- package/dist/actions/honey/getHoneyCollaterals.d.ts +33 -0
- package/dist/actions/honey/getHoneyCollaterals.d.ts.map +1 -0
- package/dist/actions/honey/getHoneyFees.d.ts +24 -0
- package/dist/actions/honey/getHoneyFees.d.ts.map +1 -0
- package/dist/actions/honey/getHoneyPausedState.d.ts +9 -0
- package/dist/actions/honey/getHoneyPausedState.d.ts.map +1 -0
- package/dist/actions/honey/getHoneyPreview.d.ts +52 -0
- package/dist/actions/honey/getHoneyPreview.d.ts.map +1 -0
- package/dist/actions/honey/getHoneyPythPriceOracle.d.ts +10 -0
- package/dist/actions/honey/getHoneyPythPriceOracle.d.ts.map +1 -0
- package/dist/actions/honey/getHoneyRootPriceOracle.d.ts +9 -0
- package/dist/actions/honey/getHoneyRootPriceOracle.d.ts.map +1 -0
- package/dist/actions/honey/getHoneyTxns.d.ts +21 -0
- package/dist/actions/honey/getHoneyTxns.d.ts.map +1 -0
- package/dist/actions/honey/getHoneyVaultsBalance.d.ts +13 -0
- package/dist/actions/honey/getHoneyVaultsBalance.d.ts.map +1 -0
- package/dist/actions/honey/getPythLatestPrices.d.ts +26 -0
- package/dist/actions/honey/getPythLatestPrices.d.ts.map +1 -0
- package/dist/actions/honey/getRelativeCapLimit.d.ts +23 -0
- package/dist/actions/honey/getRelativeCapLimit.d.ts.map +1 -0
- package/dist/actions/honey/getSharesWithoutFees.d.ts +25 -0
- package/dist/actions/honey/getSharesWithoutFees.d.ts.map +1 -0
- package/dist/actions/honey/getSwapPayload.d.ts +24 -0
- package/dist/actions/honey/getSwapPayload.d.ts.map +1 -0
- package/dist/actions/honey/isBadCollateralAsset.d.ts +24 -0
- package/dist/actions/honey/isBadCollateralAsset.d.ts.map +1 -0
- package/dist/actions/honey/isBasketModeEnabled.d.ts +11 -0
- package/dist/actions/honey/isBasketModeEnabled.d.ts.map +1 -0
- package/dist/actions/misc/getBlockTimestamp.d.ts +14 -0
- package/dist/actions/misc/getBlockTimestamp.d.ts.map +1 -0
- package/dist/actions/pol/getAutoclaimedIncentives.d.ts +14 -0
- package/dist/actions/pol/getAutoclaimedIncentives.d.ts.map +1 -0
- package/dist/actions/pol/getAutoclaimedIncentivesTxHash.d.ts +14 -0
- package/dist/actions/pol/getAutoclaimedIncentivesTxHash.d.ts.map +1 -0
- package/dist/actions/pol/getBGTGlobalInfo.d.ts +10 -0
- package/dist/actions/pol/getBGTGlobalInfo.d.ts.map +1 -0
- package/dist/actions/pol/getBeraTokenTotalSupply.d.ts +7 -0
- package/dist/actions/pol/getBeraTokenTotalSupply.d.ts.map +1 -0
- package/dist/actions/pol/getBgtAprSimulation.d.ts +88 -0
- package/dist/actions/pol/getBgtAprSimulation.d.ts.map +1 -0
- package/dist/actions/pol/getBgtTokenTotalBoosts.d.ts +6 -0
- package/dist/actions/pol/getBgtTokenTotalBoosts.d.ts.map +1 -0
- package/dist/actions/pol/getBgtTokenTotalSupply.d.ts +6 -0
- package/dist/actions/pol/getBgtTokenTotalSupply.d.ts.map +1 -0
- package/dist/actions/pol/getBlockTime.d.ts +7 -0
- package/dist/actions/pol/getBlockTime.d.ts.map +1 -0
- package/dist/actions/pol/getEarnedStakedBeraVault.d.ts +19 -0
- package/dist/actions/pol/getEarnedStakedBeraVault.d.ts.map +1 -0
- package/dist/actions/pol/getGlobalData.d.ts +8 -0
- package/dist/actions/pol/getGlobalData.d.ts.map +1 -0
- package/dist/actions/pol/getHeroEarnVaults.d.ts +35 -0
- package/dist/actions/pol/getHeroEarnVaults.d.ts.map +1 -0
- package/dist/actions/pol/getLSTStakeConfig.d.ts +13 -0
- package/dist/actions/pol/getLSTStakeConfig.d.ts.map +1 -0
- package/dist/actions/pol/getMarkets.d.ts +9 -0
- package/dist/actions/pol/getMarkets.d.ts.map +1 -0
- package/dist/actions/pol/getRewardTokenToBeraRate.d.ts +12 -0
- package/dist/actions/pol/getRewardTokenToBeraRate.d.ts.map +1 -0
- package/dist/actions/pol/getRewardVault.d.ts +13 -0
- package/dist/actions/pol/getRewardVault.d.ts.map +1 -0
- package/dist/actions/pol/getRewardVaultBeaconImplementation.d.ts +8 -0
- package/dist/actions/pol/getRewardVaultBeaconImplementation.d.ts.map +1 -0
- package/dist/actions/pol/getRewardVaultDurationConstants.d.ts +12 -0
- package/dist/actions/pol/getRewardVaultDurationConstants.d.ts.map +1 -0
- package/dist/actions/pol/getRewardVaultEarnedRewards.d.ts +14 -0
- package/dist/actions/pol/getRewardVaultEarnedRewards.d.ts.map +1 -0
- package/dist/actions/pol/getRewardVaultFromToken.d.ts +7 -0
- package/dist/actions/pol/getRewardVaultFromToken.d.ts.map +1 -0
- package/dist/actions/pol/getRewardVaultIncentives.d.ts +23 -0
- package/dist/actions/pol/getRewardVaultIncentives.d.ts.map +1 -0
- package/dist/actions/pol/getRewardVaultRewards.d.ts +38 -0
- package/dist/actions/pol/getRewardVaultRewards.d.ts.map +1 -0
- package/dist/actions/pol/getRewardVaultStakingToken.d.ts +6 -0
- package/dist/actions/pol/getRewardVaultStakingToken.d.ts.map +1 -0
- package/dist/actions/pol/getRewardVaults.d.ts +14 -0
- package/dist/actions/pol/getRewardVaults.d.ts.map +1 -0
- package/dist/actions/pol/getSWBeraVaultMetadata.d.ts +19 -0
- package/dist/actions/pol/getSWBeraVaultMetadata.d.ts.map +1 -0
- package/dist/actions/pol/getSWBeraWithdrawal.d.ts +30 -0
- package/dist/actions/pol/getSWBeraWithdrawal.d.ts.map +1 -0
- package/dist/actions/pol/getStakeWithdrawalCooldown.d.ts +6 -0
- package/dist/actions/pol/getStakeWithdrawalCooldown.d.ts.map +1 -0
- package/dist/actions/pol/getStakedBeraAPY.d.ts +14 -0
- package/dist/actions/pol/getStakedBeraAPY.d.ts.map +1 -0
- package/dist/actions/pol/getStakedBeraSnapshots.d.ts +22 -0
- package/dist/actions/pol/getStakedBeraSnapshots.d.ts.map +1 -0
- package/dist/actions/pol/getStakingDailyAssets.d.ts +10 -0
- package/dist/actions/pol/getStakingDailyAssets.d.ts.map +1 -0
- package/dist/actions/pol/getStakingTokenInformation.d.ts +9 -0
- package/dist/actions/pol/getStakingTokenInformation.d.ts.map +1 -0
- package/dist/actions/pol/getTotalStakedAmount.d.ts +13 -0
- package/dist/actions/pol/getTotalStakedAmount.d.ts.map +1 -0
- package/dist/actions/pol/getUserVaultInfo.d.ts +9 -0
- package/dist/actions/pol/getUserVaultInfo.d.ts.map +1 -0
- package/dist/actions/pol/getUserVaults.d.ts +18 -0
- package/dist/actions/pol/getUserVaults.d.ts.map +1 -0
- package/dist/actions/pol/getUserVaultsBalance.d.ts +11 -0
- package/dist/actions/pol/getUserVaultsBalance.d.ts.map +1 -0
- package/dist/actions/pol/getVaultHistory.d.ts +8 -0
- package/dist/actions/pol/getVaultHistory.d.ts.map +1 -0
- package/dist/actions/pol/getVaultValidators.d.ts +7 -0
- package/dist/actions/pol/getVaultValidators.d.ts.map +1 -0
- package/dist/actions/pol/getVaultsSupply.d.ts +7 -0
- package/dist/actions/pol/getVaultsSupply.d.ts.map +1 -0
- package/dist/actions/prices/getTokenCurrentPrices.d.ts +5 -0
- package/dist/actions/prices/getTokenCurrentPrices.d.ts.map +1 -0
- package/dist/actions/pyth/getHoneyPythFeeds.d.ts +12 -0
- package/dist/actions/pyth/getHoneyPythFeeds.d.ts.map +1 -0
- package/dist/actions/pyth/getUpdateFee.d.ts +6 -0
- package/dist/actions/pyth/getUpdateFee.d.ts.map +1 -0
- package/dist/actions/server/exports.d.ts +2 -13
- package/dist/actions/server/exports.d.ts.map +1 -0
- package/dist/actions/server/exports.mjs +28 -17
- package/dist/actions/server/exports.mjs.map +1 -0
- package/dist/actions/server/getDailyValidatorBlockStats.d.ts +14 -0
- package/dist/actions/server/getDailyValidatorBlockStats.d.ts.map +1 -0
- package/dist/actions/tokens/getAllowances.d.ts +10 -0
- package/dist/actions/tokens/getAllowances.d.ts.map +1 -0
- package/dist/actions/tokens/getTokenInformation.d.ts +11 -0
- package/dist/actions/tokens/getTokenInformation.d.ts.map +1 -0
- package/dist/actions/tokens/getTokens.d.ts +5 -0
- package/dist/actions/tokens/getTokens.d.ts.map +1 -0
- package/dist/actions/tokens/getUnderlyingToken.d.ts +12 -0
- package/dist/actions/tokens/getUnderlyingToken.d.ts.map +1 -0
- package/dist/actions/tokens/getWalletBalances.d.ts +499 -0
- package/dist/actions/tokens/getWalletBalances.d.ts.map +1 -0
- package/dist/actions/transactions/beraWriteContract.d.ts +19 -0
- package/dist/actions/transactions/beraWriteContract.d.ts.map +1 -0
- package/dist/actions/validators/getActiveBoostAndCommissionChangeDelay.d.ts +30 -0
- package/dist/actions/validators/getActiveBoostAndCommissionChangeDelay.d.ts.map +1 -0
- package/dist/actions/validators/getAllValidators.d.ts +5 -0
- package/dist/actions/validators/getAllValidators.d.ts.map +1 -0
- package/dist/actions/validators/getApiEnrichedAllocation.d.ts +6 -0
- package/dist/actions/validators/getApiEnrichedAllocation.d.ts.map +1 -0
- package/dist/actions/validators/getApiValidator.d.ts +9 -0
- package/dist/actions/validators/getApiValidator.d.ts.map +1 -0
- package/dist/actions/validators/getBaselineRewardAllocation.d.ts +5 -0
- package/dist/actions/validators/getBaselineRewardAllocation.d.ts.map +1 -0
- package/dist/actions/validators/getDefaultRewardAllocation.d.ts +7 -0
- package/dist/actions/validators/getDefaultRewardAllocation.d.ts.map +1 -0
- package/dist/actions/validators/getStakingPoolBatch.d.ts +13 -0
- package/dist/actions/validators/getStakingPoolBatch.d.ts.map +1 -0
- package/dist/actions/validators/getUserActiveValidators.d.ts +48 -0
- package/dist/actions/validators/getUserActiveValidators.d.ts.map +1 -0
- package/dist/actions/validators/getUserBoosts.d.ts +7 -0
- package/dist/actions/validators/getUserBoosts.d.ts.map +1 -0
- package/dist/actions/validators/getUserBoostsOnValidator.d.ts +25 -0
- package/dist/actions/validators/getUserBoostsOnValidator.d.ts.map +1 -0
- package/dist/actions/validators/getUserStakingPositions.d.ts +20 -0
- package/dist/actions/validators/getUserStakingPositions.d.ts.map +1 -0
- package/dist/actions/validators/getValidatorCommission.d.ts +6 -0
- package/dist/actions/validators/getValidatorCommission.d.ts.map +1 -0
- package/dist/actions/validators/getValidatorEstimatedBgtPerYear.d.ts +3 -0
- package/dist/actions/validators/getValidatorEstimatedBgtPerYear.d.ts.map +1 -0
- package/dist/actions/validators/getValidatorIncentiveDistribution.d.ts +8 -0
- package/dist/actions/validators/getValidatorIncentiveDistribution.d.ts.map +1 -0
- package/dist/actions/validators/getValidatorOperatorAddress.d.ts +6 -0
- package/dist/actions/validators/getValidatorOperatorAddress.d.ts.map +1 -0
- package/dist/actions/validators/getValidatorQueuedCommission.d.ts +10 -0
- package/dist/actions/validators/getValidatorQueuedCommission.d.ts.map +1 -0
- package/dist/actions/validators/getValidatorQueuedOperatorAddress.d.ts +7 -0
- package/dist/actions/validators/getValidatorQueuedOperatorAddress.d.ts.map +1 -0
- package/dist/actions/validators/getValidatorQueuedRewardAllocation.d.ts +7 -0
- package/dist/actions/validators/getValidatorQueuedRewardAllocation.d.ts.map +1 -0
- package/dist/actions/validators/getValidatorRewardAllocation.d.ts +56 -0
- package/dist/actions/validators/getValidatorRewardAllocation.d.ts.map +1 -0
- package/dist/actions/validators/getValidatorRewardAllocatorAddress.d.ts +12 -0
- package/dist/actions/validators/getValidatorRewardAllocatorAddress.d.ts.map +1 -0
- package/dist/actions/validators/utils/aggregateValidatorIncentives.d.ts +6 -0
- package/dist/actions/validators/utils/aggregateValidatorIncentives.d.ts.map +1 -0
- package/dist/actions/validators/utils/getValidatorBoostApy.d.ts +7 -0
- package/dist/actions/validators/utils/getValidatorBoostApy.d.ts.map +1 -0
- package/dist/{chunk-E7YFXBBQ.mjs → chunk-35RACQD4.mjs} +7 -6
- package/dist/chunk-35RACQD4.mjs.map +1 -0
- package/dist/{chunk-T43JPYQS.mjs → chunk-4576RF2K.mjs} +30 -4
- package/dist/chunk-4576RF2K.mjs.map +1 -0
- package/dist/{chunk-W2VODV76.mjs → chunk-5PBYMJRG.mjs} +97 -25
- package/dist/chunk-5PBYMJRG.mjs.map +1 -0
- package/dist/{chunk-QVHEM4BG.mjs → chunk-7KN7TDUC.mjs} +10 -4
- package/dist/chunk-7KN7TDUC.mjs.map +1 -0
- package/dist/chunk-7OESHTBN.mjs +29 -0
- package/dist/chunk-7OESHTBN.mjs.map +1 -0
- package/dist/{chunk-SZ5C44L5.mjs → chunk-BMNEN4OK.mjs} +1 -0
- package/dist/chunk-BMNEN4OK.mjs.map +1 -0
- package/dist/{chunk-O2NQFKJK.mjs → chunk-BSLXKPX4.mjs} +4 -47
- package/dist/chunk-BSLXKPX4.mjs.map +1 -0
- package/dist/{chunk-MKSFQIKC.mjs → chunk-BZKA6DBM.mjs} +15 -16
- package/dist/chunk-BZKA6DBM.mjs.map +1 -0
- package/dist/{chunk-FGION6F6.mjs → chunk-FWRYUIJK.mjs} +3 -2
- package/dist/chunk-FWRYUIJK.mjs.map +1 -0
- package/dist/{chunk-SGIJVHZO.mjs → chunk-GLWPRM33.mjs} +1 -0
- package/dist/chunk-GLWPRM33.mjs.map +1 -0
- package/dist/{chunk-CDK4YV3D.mjs → chunk-GWSTVITN.mjs} +1 -0
- package/dist/chunk-GWSTVITN.mjs.map +1 -0
- package/dist/{chunk-IXIBY5FP.mjs → chunk-HPRLNT6R.mjs} +3 -2
- package/dist/chunk-HPRLNT6R.mjs.map +1 -0
- package/dist/chunk-J6GM7HWX.mjs +19 -0
- package/dist/chunk-J6GM7HWX.mjs.map +1 -0
- package/dist/{chunk-NBYLMO2L.mjs → chunk-JA4DHMTG.mjs} +1 -0
- package/dist/chunk-JA4DHMTG.mjs.map +1 -0
- package/dist/{chunk-DKMAIU74.mjs → chunk-KL6YZ5VR.mjs} +1 -0
- package/dist/chunk-KL6YZ5VR.mjs.map +1 -0
- package/dist/{chunk-RFJGL4MF.mjs → chunk-LL7XR2H5.mjs} +41 -3
- package/dist/chunk-LL7XR2H5.mjs.map +1 -0
- package/dist/{chunk-AUOPN6NK.mjs → chunk-M3MIGSH3.mjs} +2 -1
- package/dist/chunk-M3MIGSH3.mjs.map +1 -0
- package/dist/{chunk-KHXJDYA4.mjs → chunk-MVNQY2D4.mjs} +34 -3
- package/dist/chunk-MVNQY2D4.mjs.map +1 -0
- package/dist/{chunk-4ML4Y6UN.mjs → chunk-RM227WHI.mjs} +1 -0
- package/dist/chunk-RM227WHI.mjs.map +1 -0
- package/dist/{chunk-DQRH5VE3.mjs → chunk-SC3BSCTN.mjs} +2 -1
- package/dist/chunk-SC3BSCTN.mjs.map +1 -0
- package/dist/{chunk-XDG26EG6.mjs → chunk-SMBAW7AG.mjs} +436 -434
- package/dist/chunk-SMBAW7AG.mjs.map +1 -0
- package/dist/{chunk-GY6B3PD5.mjs → chunk-TXWDUJOY.mjs} +12 -1
- package/dist/chunk-TXWDUJOY.mjs.map +1 -0
- package/dist/{chunk-GUURQAME.mjs → chunk-UWJQ6UKG.mjs} +2 -1
- package/dist/chunk-UWJQ6UKG.mjs.map +1 -0
- package/dist/chunk-XO2BFPTB.mjs +50 -0
- package/dist/chunk-XO2BFPTB.mjs.map +1 -0
- package/dist/{chunk-BGMRHTBQ.mjs → chunk-XXKPXNQD.mjs} +1 -1
- package/dist/chunk-XXKPXNQD.mjs.map +1 -0
- package/dist/{chunk-HQCOU6GY.mjs → chunk-ZCEFC2TK.mjs} +1 -0
- package/dist/chunk-ZCEFC2TK.mjs.map +1 -0
- package/dist/{chunk-HYDP32P6.mjs → chunk-ZHV3MQ4F.mjs} +6 -6
- package/dist/chunk-ZHV3MQ4F.mjs.map +1 -0
- package/dist/contexts/BeraFlags/BeraFlags.d.ts +19 -0
- package/dist/contexts/BeraFlags/BeraFlags.d.ts.map +1 -0
- package/dist/contexts/BeraFlags/defaultFlags.d.ts +9 -0
- package/dist/contexts/BeraFlags/defaultFlags.d.ts.map +1 -0
- package/dist/{BexStatusProvider-DRymVlQf.d.ts → contexts/BexStatusProvider.d.ts} +9 -12
- package/dist/contexts/BexStatusProvider.d.ts.map +1 -0
- package/dist/contexts/BlockTimeProvider.d.ts +10 -0
- package/dist/contexts/BlockTimeProvider.d.ts.map +1 -0
- package/dist/contexts/HoneyConfigProvider.d.ts +50 -0
- package/dist/contexts/HoneyConfigProvider.d.ts.map +1 -0
- package/dist/contexts/SwrFallback.d.ts +6 -0
- package/dist/contexts/SwrFallback.d.ts.map +1 -0
- package/dist/contexts/TokensProvider.d.ts +24 -0
- package/dist/contexts/TokensProvider.d.ts.map +1 -0
- package/dist/contexts/exports.d.ts +7 -66
- package/dist/contexts/exports.d.ts.map +1 -0
- package/dist/contexts/exports.mjs +13 -12
- package/dist/contexts/exports.mjs.map +1 -0
- package/dist/data/contracts.d.ts +345 -0
- package/dist/data/contracts.d.ts.map +1 -0
- package/dist/enum/contracts.d.ts +18 -0
- package/dist/enum/contracts.d.ts.map +1 -0
- package/dist/{dex-C_BB0b0O.d.ts → enum/dex.d.ts} +6 -7
- package/dist/enum/dex.d.ts.map +1 -0
- package/dist/enum/exports.d.ts +7 -29
- package/dist/enum/exports.d.ts.map +1 -0
- package/dist/enum/exports.mjs +8 -5
- package/dist/enum/exports.mjs.map +1 -0
- package/dist/enum/governance/exports.d.ts +2 -60
- package/dist/enum/governance/exports.d.ts.map +1 -0
- package/dist/enum/governance/exports.mjs +2 -1
- package/dist/enum/governance/exports.mjs.map +1 -0
- package/dist/enum/governance.d.ts +59 -0
- package/dist/enum/governance.d.ts.map +1 -0
- package/dist/{honey-CYm0RWf4.d.ts → enum/honey.d.ts} +2 -3
- package/dist/enum/honey.d.ts.map +1 -0
- package/dist/enum/polling.d.ts +8 -0
- package/dist/enum/polling.d.ts.map +1 -0
- package/dist/enum/slippage.d.ts +17 -0
- package/dist/enum/slippage.d.ts.map +1 -0
- package/dist/{txnEnum-ByI5dtDi.d.ts → enum/txnEnum.d.ts} +2 -18
- package/dist/enum/txnEnum.d.ts.map +1 -0
- package/dist/{BeraError-7-A5JYy_.d.ts → errors/BeraError.d.ts} +7 -31
- package/dist/errors/BeraError.d.ts.map +1 -0
- package/dist/errors/BeraMonitoring.d.ts +46 -0
- package/dist/errors/BeraMonitoring.d.ts.map +1 -0
- package/dist/errors/BeraTracing.d.ts +58 -0
- package/dist/errors/BeraTracing.d.ts.map +1 -0
- package/dist/errors/InvalidArgumentError.d.ts +59 -0
- package/dist/errors/InvalidArgumentError.d.ts.map +1 -0
- package/dist/errors/NotFoundError.d.ts +25 -0
- package/dist/errors/NotFoundError.d.ts.map +1 -0
- package/dist/errors/RequestError.d.ts +75 -0
- package/dist/errors/RequestError.d.ts.map +1 -0
- package/dist/errors/TransactionFailedError.d.ts +49 -0
- package/dist/errors/TransactionFailedError.d.ts.map +1 -0
- package/dist/errors/assert.d.ts +82 -0
- package/dist/errors/assert.d.ts.map +1 -0
- package/dist/errors/errorMap.d.ts +1084 -0
- package/dist/errors/errorMap.d.ts.map +1 -0
- package/dist/errors/exports.d.ts +13 -328
- package/dist/errors/exports.d.ts.map +1 -0
- package/dist/errors/exports.mjs +9 -6
- package/dist/errors/exports.mjs.map +1 -0
- package/dist/errors/getErrorMessage.d.ts +46 -0
- package/dist/errors/getErrorMessage.d.ts.map +1 -0
- package/dist/errors/getRevertReason.d.ts +53 -0
- package/dist/errors/getRevertReason.d.ts.map +1 -0
- package/dist/errors/initBeraError.d.ts +44 -0
- package/dist/errors/initBeraError.d.ts.map +1 -0
- package/dist/errors/parseViemError.d.ts +88 -0
- package/dist/errors/parseViemError.d.ts.map +1 -0
- package/dist/errors/severity.d.ts +7 -0
- package/dist/errors/severity.d.ts.map +1 -0
- package/dist/errors/spanStatus.d.ts +18 -0
- package/dist/errors/spanStatus.d.ts.map +1 -0
- package/dist/hooks/bend/useGetConvertToAssets.d.ts +9 -0
- package/dist/hooks/bend/useGetConvertToAssets.d.ts.map +1 -0
- package/dist/hooks/dex/useAggregatorsQuotes.d.ts +29 -0
- package/dist/hooks/dex/useAggregatorsQuotes.d.ts.map +1 -0
- package/dist/hooks/dex/useAggregatorsRouterFeeBps.d.ts +2 -0
- package/dist/hooks/dex/useAggregatorsRouterFeeBps.d.ts.map +1 -0
- package/dist/hooks/dex/useAllUserPools.d.ts +68 -0
- package/dist/hooks/dex/useAllUserPools.d.ts.map +1 -0
- package/dist/hooks/dex/useApiPool.d.ts +11 -0
- package/dist/hooks/dex/useApiPool.d.ts.map +1 -0
- package/dist/hooks/dex/useBexStatus.d.ts +2 -0
- package/dist/hooks/dex/useBexStatus.d.ts.map +1 -0
- package/dist/hooks/dex/useCreatePool.d.ts +32 -0
- package/dist/hooks/dex/useCreatePool.d.ts.map +1 -0
- package/dist/hooks/dex/useCrossChainNativeFee.d.ts +32 -0
- package/dist/hooks/dex/useCrossChainNativeFee.d.ts.map +1 -0
- package/dist/hooks/dex/useGlobalLiquidityAndSwapVolume.d.ts +11 -0
- package/dist/hooks/dex/useGlobalLiquidityAndSwapVolume.d.ts.map +1 -0
- package/dist/hooks/dex/useLiquidityMismatch.d.ts +36 -0
- package/dist/hooks/dex/useLiquidityMismatch.d.ts.map +1 -0
- package/dist/hooks/dex/useLpPosition.d.ts +14 -0
- package/dist/hooks/dex/useLpPosition.d.ts.map +1 -0
- package/dist/hooks/dex/useMultipleTokenApprovalsWithSlippage.d.ts +13 -0
- package/dist/hooks/dex/useMultipleTokenApprovalsWithSlippage.d.ts.map +1 -0
- package/dist/hooks/dex/useOnChainPoolData.d.ts +49 -0
- package/dist/hooks/dex/useOnChainPoolData.d.ts.map +1 -0
- package/dist/hooks/dex/usePollPoolCreationRelayerApproval.d.ts +8 -0
- package/dist/hooks/dex/usePollPoolCreationRelayerApproval.d.ts.map +1 -0
- package/dist/hooks/dex/usePool.d.ts +10 -0
- package/dist/hooks/dex/usePool.d.ts.map +1 -0
- package/dist/hooks/dex/usePoolEvents.d.ts +6 -0
- package/dist/hooks/dex/usePoolEvents.d.ts.map +1 -0
- package/dist/hooks/dex/usePoolHistoricalData.d.ts +8 -0
- package/dist/hooks/dex/usePoolHistoricalData.d.ts.map +1 -0
- package/dist/hooks/dex/usePools.d.ts +129 -0
- package/dist/hooks/dex/usePools.d.ts.map +1 -0
- package/dist/hooks/dex/usePriceImpact.d.ts +11 -0
- package/dist/hooks/dex/usePriceImpact.d.ts.map +1 -0
- package/dist/hooks/dex/useSingleAggregatorQuote.d.ts +53 -0
- package/dist/hooks/dex/useSingleAggregatorQuote.d.ts.map +1 -0
- package/dist/hooks/enso/useBendDemultiply.d.ts +18 -0
- package/dist/hooks/enso/useBendDemultiply.d.ts.map +1 -0
- package/dist/hooks/enso/useBendMultiply.d.ts +19 -0
- package/dist/hooks/enso/useBendMultiply.d.ts.map +1 -0
- package/dist/hooks/enso/useBendZapSupply.d.ts +40 -0
- package/dist/hooks/enso/useBendZapSupply.d.ts.map +1 -0
- package/dist/hooks/enso/useEnsoUserTokensWithBalances.d.ts +6 -0
- package/dist/hooks/enso/useEnsoUserTokensWithBalances.d.ts.map +1 -0
- package/dist/hooks/enso/useEnsoWalletV2Address.d.ts +4 -0
- package/dist/hooks/enso/useEnsoWalletV2Address.d.ts.map +1 -0
- package/dist/hooks/enso/useIsBendAuthorized.d.ts +7 -0
- package/dist/hooks/enso/useIsBendAuthorized.d.ts.map +1 -0
- package/dist/hooks/enso/useZapStakeBera.d.ts +23 -0
- package/dist/hooks/enso/useZapStakeBera.d.ts.map +1 -0
- package/dist/hooks/exports.d.ts +106 -1332
- package/dist/hooks/exports.d.ts.map +1 -0
- package/dist/hooks/exports.mjs +868 -1247
- package/dist/hooks/exports.mjs.map +1 -0
- package/dist/hooks/governance/exports.d.ts +15 -186
- package/dist/hooks/governance/exports.d.ts.map +1 -0
- package/dist/hooks/governance/exports.mjs +63 -61
- package/dist/hooks/governance/exports.mjs.map +1 -0
- package/dist/hooks/governance/useCreateProposal.d.ts +13 -0
- package/dist/hooks/governance/useCreateProposal.d.ts.map +1 -0
- package/dist/hooks/governance/useGetPastVotes.d.ts +15 -0
- package/dist/hooks/governance/useGetPastVotes.d.ts.map +1 -0
- package/dist/hooks/governance/useHasVoted.d.ts +6 -0
- package/dist/hooks/governance/useHasVoted.d.ts.map +1 -0
- package/dist/hooks/governance/useIsCanceller.d.ts +5 -0
- package/dist/hooks/governance/useIsCanceller.d.ts.map +1 -0
- package/dist/hooks/governance/usePollAllProposals.d.ts +37 -0
- package/dist/hooks/governance/usePollAllProposals.d.ts.map +1 -0
- package/dist/hooks/governance/usePollProposal.d.ts +23 -0
- package/dist/hooks/governance/usePollProposal.d.ts.map +1 -0
- package/dist/hooks/governance/usePollProposalThreshold.d.ts +6 -0
- package/dist/hooks/governance/usePollProposalThreshold.d.ts.map +1 -0
- package/dist/hooks/governance/usePollProposalVotes.d.ts +23 -0
- package/dist/hooks/governance/usePollProposalVotes.d.ts.map +1 -0
- package/dist/hooks/governance/usePollUserDelegates.d.ts +7 -0
- package/dist/hooks/governance/usePollUserDelegates.d.ts.map +1 -0
- package/dist/hooks/governance/useProposalFromTx.d.ts +5 -0
- package/dist/hooks/governance/useProposalFromTx.d.ts.map +1 -0
- package/dist/hooks/governance/useProposalSnapshot.d.ts +12 -0
- package/dist/hooks/governance/useProposalSnapshot.d.ts.map +1 -0
- package/dist/hooks/governance/useProposalState.d.ts +7 -0
- package/dist/hooks/governance/useProposalState.d.ts.map +1 -0
- package/dist/hooks/governance/useProposalTimelockState.d.ts +18 -0
- package/dist/hooks/governance/useProposalTimelockState.d.ts.map +1 -0
- package/dist/hooks/governance/useQuorum.d.ts +17 -0
- package/dist/hooks/governance/useQuorum.d.ts.map +1 -0
- package/dist/hooks/honey/useCappedGlobally.d.ts +11 -0
- package/dist/hooks/honey/useCappedGlobally.d.ts.map +1 -0
- package/dist/hooks/honey/useCappedRelatively.d.ts +11 -0
- package/dist/hooks/honey/useCappedRelatively.d.ts.map +1 -0
- package/dist/hooks/honey/useCollateralWeights.d.ts +9 -0
- package/dist/hooks/honey/useCollateralWeights.d.ts.map +1 -0
- package/dist/hooks/honey/useHoney24hVolume.d.ts +2 -0
- package/dist/hooks/honey/useHoney24hVolume.d.ts.map +1 -0
- package/dist/hooks/honey/useHoneyAlerts.d.ts +47 -0
- package/dist/hooks/honey/useHoneyAlerts.d.ts.map +1 -0
- package/dist/hooks/honey/useHoneyBalances.d.ts +26 -0
- package/dist/hooks/honey/useHoneyBalances.d.ts.map +1 -0
- package/dist/hooks/honey/useHoneyChartData.d.ts +10 -0
- package/dist/hooks/honey/useHoneyChartData.d.ts.map +1 -0
- package/dist/{useHoneySwapState-twi7NTaO.d.ts → hooks/honey/useHoneySwapState.d.ts} +7 -9
- package/dist/hooks/honey/useHoneySwapState.d.ts.map +1 -0
- package/dist/hooks/honey/useHoneyVaultsBalance.d.ts +4 -0
- package/dist/hooks/honey/useHoneyVaultsBalance.d.ts.map +1 -0
- package/dist/hooks/honey/useIsBadCollateralAsset.d.ts +9 -0
- package/dist/hooks/honey/useIsBadCollateralAsset.d.ts.map +1 -0
- package/dist/hooks/honey/useIsBasketModeEnabled.d.ts +6 -0
- package/dist/hooks/honey/useIsBasketModeEnabled.d.ts.map +1 -0
- package/dist/hooks/honey/usePythLatestPrices.d.ts +20 -0
- package/dist/hooks/honey/usePythLatestPrices.d.ts.map +1 -0
- package/dist/hooks/perps/usePythUpdateFee.d.ts +11 -0
- package/dist/hooks/perps/usePythUpdateFee.d.ts.map +1 -0
- package/dist/hooks/pol/useAutoclaimedIncentives.d.ts +8 -0
- package/dist/hooks/pol/useAutoclaimedIncentives.d.ts.map +1 -0
- package/dist/hooks/pol/useAutoclaimedIncentivesTxHash.d.ts +8 -0
- package/dist/hooks/pol/useAutoclaimedIncentivesTxHash.d.ts.map +1 -0
- package/dist/hooks/pol/useBgtAprSimulation.d.ts +7 -0
- package/dist/hooks/pol/useBgtAprSimulation.d.ts.map +1 -0
- package/dist/hooks/pol/useBgtUnstakedBalance.d.ts +3 -0
- package/dist/hooks/pol/useBgtUnstakedBalance.d.ts.map +1 -0
- package/dist/hooks/pol/useClaimableFees.d.ts +2 -0
- package/dist/hooks/pol/useClaimableFees.d.ts.map +1 -0
- package/dist/hooks/pol/useHighestVaultsAPR.d.ts +23 -0
- package/dist/hooks/pol/useHighestVaultsAPR.d.ts.map +1 -0
- package/dist/hooks/pol/useOnChainRewardVault.d.ts +7 -0
- package/dist/hooks/pol/useOnChainRewardVault.d.ts.map +1 -0
- package/dist/hooks/pol/usePollGlobalData.d.ts +4 -0
- package/dist/hooks/pol/usePollGlobalData.d.ts.map +1 -0
- package/dist/hooks/pol/usePollMarkets.d.ts +7 -0
- package/dist/hooks/pol/usePollMarkets.d.ts.map +1 -0
- package/dist/hooks/pol/useQueuedBeraUnlock.d.ts +9 -0
- package/dist/hooks/pol/useQueuedBeraUnlock.d.ts.map +1 -0
- package/dist/hooks/pol/useRewardTokenToBeraRate.d.ts +6 -0
- package/dist/hooks/pol/useRewardTokenToBeraRate.d.ts.map +1 -0
- package/dist/hooks/pol/useRewardVault.d.ts +8 -0
- package/dist/hooks/pol/useRewardVault.d.ts.map +1 -0
- package/dist/hooks/pol/useRewardVaultBalanceFromStakingToken.d.ts +16 -0
- package/dist/hooks/pol/useRewardVaultBalanceFromStakingToken.d.ts.map +1 -0
- package/dist/hooks/pol/useRewardVaultFromToken.d.ts +7 -0
- package/dist/hooks/pol/useRewardVaultFromToken.d.ts.map +1 -0
- package/dist/hooks/pol/useRewardVaultIncentives.d.ts +6 -0
- package/dist/hooks/pol/useRewardVaultIncentives.d.ts.map +1 -0
- package/dist/hooks/pol/useRewardVaultRewards.d.ts +4 -0
- package/dist/hooks/pol/useRewardVaultRewards.d.ts.map +1 -0
- package/dist/hooks/pol/useRewardVaults.d.ts +15 -0
- package/dist/hooks/pol/useRewardVaults.d.ts.map +1 -0
- package/dist/hooks/pol/useStakedAPY.d.ts +11 -0
- package/dist/hooks/pol/useStakedAPY.d.ts.map +1 -0
- package/dist/hooks/pol/useStakedData.d.ts +41 -0
- package/dist/hooks/pol/useStakedData.d.ts.map +1 -0
- package/dist/hooks/pol/useStakedSnapshots.d.ts +10 -0
- package/dist/hooks/pol/useStakedSnapshots.d.ts.map +1 -0
- package/dist/hooks/pol/useStakingVaultsMetadata.d.ts +6 -0
- package/dist/hooks/pol/useStakingVaultsMetadata.d.ts.map +1 -0
- package/dist/hooks/pol/useTotalStakedAmount.d.ts +6 -0
- package/dist/hooks/pol/useTotalStakedAmount.d.ts.map +1 -0
- package/dist/hooks/pol/useUserVaultInfo.d.ts +7 -0
- package/dist/hooks/pol/useUserVaultInfo.d.ts.map +1 -0
- package/dist/hooks/pol/useUserVaults.d.ts +4 -0
- package/dist/hooks/pol/useUserVaults.d.ts.map +1 -0
- package/dist/hooks/pol/useVaultAddress.d.ts +10 -0
- package/dist/hooks/pol/useVaultAddress.d.ts.map +1 -0
- package/dist/hooks/pol/useVaultHistory.d.ts +5 -0
- package/dist/hooks/pol/useVaultHistory.d.ts.map +1 -0
- package/dist/hooks/pol/useVaultValidators.d.ts +7 -0
- package/dist/hooks/pol/useVaultValidators.d.ts.map +1 -0
- package/dist/hooks/tokens/useBeraCurrentPrice.d.ts +11 -0
- package/dist/hooks/tokens/useBeraCurrentPrice.d.ts.map +1 -0
- package/dist/hooks/tokens/useMultipleTokenInformation.d.ts +39 -0
- package/dist/hooks/tokens/useMultipleTokenInformation.d.ts.map +1 -0
- package/dist/hooks/tokens/usePollAllowances.d.ts +17 -0
- package/dist/hooks/tokens/usePollAllowances.d.ts.map +1 -0
- package/dist/hooks/tokens/usePollBalance.d.ts +12 -0
- package/dist/hooks/tokens/usePollBalance.d.ts.map +1 -0
- package/dist/hooks/tokens/usePollWalletBalances.d.ts +14 -0
- package/dist/hooks/tokens/usePollWalletBalances.d.ts.map +1 -0
- package/dist/hooks/tokens/useStakingTokenInformation.d.ts +8 -0
- package/dist/hooks/tokens/useStakingTokenInformation.d.ts.map +1 -0
- package/dist/hooks/tokens/useTokenCurrentPrices.d.ts +16 -0
- package/dist/hooks/tokens/useTokenCurrentPrices.d.ts.map +1 -0
- package/dist/hooks/tokens/useTokenInformation.d.ts +9 -0
- package/dist/hooks/tokens/useTokenInformation.d.ts.map +1 -0
- package/dist/hooks/tokens/useTokenPrice.d.ts +10 -0
- package/dist/hooks/tokens/useTokenPrice.d.ts.map +1 -0
- package/dist/hooks/tokens/useTokenPrices.d.ts +18 -0
- package/dist/hooks/tokens/useTokenPrices.d.ts.map +1 -0
- package/dist/hooks/tokens/useTokens.d.ts +18 -0
- package/dist/hooks/tokens/useTokens.d.ts.map +1 -0
- package/dist/hooks/tokens/useTotalSupply.d.ts +5 -0
- package/dist/hooks/tokens/useTotalSupply.d.ts.map +1 -0
- package/dist/hooks/tokens/useUnderlyingAsset.d.ts +10 -0
- package/dist/hooks/tokens/useUnderlyingAsset.d.ts.map +1 -0
- package/dist/hooks/useBlockToTimestamp.d.ts +6 -0
- package/dist/hooks/useBlockToTimestamp.d.ts.map +1 -0
- package/dist/hooks/useContractWrite/index.d.ts +3 -0
- package/dist/hooks/useContractWrite/index.d.ts.map +1 -0
- package/dist/hooks/useContractWrite/stateReducer.d.ts +28 -0
- package/dist/hooks/useContractWrite/stateReducer.d.ts.map +1 -0
- package/dist/hooks/useContractWrite/types.d.ts +54 -0
- package/dist/hooks/useContractWrite/types.d.ts.map +1 -0
- package/dist/hooks/useContractWrite/useBeraContractWrite.d.ts +10 -0
- package/dist/hooks/useContractWrite/useBeraContractWrite.d.ts.map +1 -0
- package/dist/hooks/useGetVerifiedAbi.d.ts +2 -0
- package/dist/hooks/useGetVerifiedAbi.d.ts.map +1 -0
- package/dist/hooks/useHistoryState.d.ts +17 -0
- package/dist/hooks/useHistoryState.d.ts.map +1 -0
- package/dist/hooks/usePrevious.d.ts +6 -0
- package/dist/hooks/usePrevious.d.ts.map +1 -0
- package/dist/hooks/validators/useAllValidators.d.ts +7 -0
- package/dist/hooks/validators/useAllValidators.d.ts.map +1 -0
- package/dist/hooks/validators/useApiEnrichedAllocation.d.ts +5 -0
- package/dist/hooks/validators/useApiEnrichedAllocation.d.ts.map +1 -0
- package/dist/hooks/validators/useApiValidator.d.ts +8 -0
- package/dist/hooks/validators/useApiValidator.d.ts.map +1 -0
- package/dist/hooks/validators/useBaselineRewardAllocation.d.ts +2 -0
- package/dist/hooks/validators/useBaselineRewardAllocation.d.ts.map +1 -0
- package/dist/hooks/validators/useManagedValidatorRole.d.ts +13 -0
- package/dist/hooks/validators/useManagedValidatorRole.d.ts.map +1 -0
- package/dist/hooks/validators/useOnChainValidator.d.ts +7 -0
- package/dist/hooks/validators/useOnChainValidator.d.ts.map +1 -0
- package/dist/hooks/validators/useStakingPoolBatch.d.ts +7 -0
- package/dist/hooks/validators/useStakingPoolBatch.d.ts.map +1 -0
- package/dist/hooks/validators/useUserActiveValidators.d.ts +12 -0
- package/dist/hooks/validators/useUserActiveValidators.d.ts.map +1 -0
- package/dist/hooks/validators/useUserBoostsOnValidator.d.ts +8 -0
- package/dist/hooks/validators/useUserBoostsOnValidator.d.ts.map +1 -0
- package/dist/hooks/validators/useUserStakingPositions.d.ts +31 -0
- package/dist/hooks/validators/useUserStakingPositions.d.ts.map +1 -0
- package/dist/hooks/validators/useValidator.d.ts +112 -0
- package/dist/hooks/validators/useValidator.d.ts.map +1 -0
- package/dist/hooks/validators/useValidatorCommission.d.ts +4 -0
- package/dist/hooks/validators/useValidatorCommission.d.ts.map +1 -0
- package/dist/hooks/validators/useValidatorEstimatedBgtPerYear.d.ts +6 -0
- package/dist/hooks/validators/useValidatorEstimatedBgtPerYear.d.ts.map +1 -0
- package/dist/hooks/validators/useValidatorIncentiveDistribution.d.ts +13 -0
- package/dist/hooks/validators/useValidatorIncentiveDistribution.d.ts.map +1 -0
- package/dist/hooks/validators/useValidatorQueuedCommission.d.ts +5 -0
- package/dist/hooks/validators/useValidatorQueuedCommission.d.ts.map +1 -0
- package/dist/hooks/validators/useValidatorQueuedOperatorAddress.d.ts +5 -0
- package/dist/hooks/validators/useValidatorQueuedOperatorAddress.d.ts.map +1 -0
- package/dist/hooks/validators/useValidatorQueuedRewardAllocation.d.ts +5 -0
- package/dist/hooks/validators/useValidatorQueuedRewardAllocation.d.ts.map +1 -0
- package/dist/hooks/validators/useValidatorRewardAllocation.d.ts +10 -0
- package/dist/hooks/validators/useValidatorRewardAllocation.d.ts.map +1 -0
- package/dist/types/exports.d.ts +8 -90
- package/dist/types/exports.d.ts.map +1 -0
- package/dist/types/exports.mjs +1 -0
- package/dist/types/exports.mjs.map +1 -0
- package/dist/types/governance/exports.d.ts +2 -109
- package/dist/types/governance/exports.d.ts.map +1 -0
- package/dist/types/governance/exports.mjs +1 -0
- package/dist/types/governance/exports.mjs.map +1 -0
- package/dist/utils/beraFetch.d.ts +15 -0
- package/dist/utils/beraFetch.d.ts.map +1 -0
- package/dist/utils/constants.d.ts +27 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/createEmitter.d.ts +88 -0
- package/dist/utils/createEmitter.d.ts.map +1 -0
- package/dist/utils/crossChainBridge.d.ts +74 -0
- package/dist/utils/crossChainBridge.d.ts.map +1 -0
- package/dist/utils/exports.d.ts +25 -429
- package/dist/utils/exports.d.ts.map +1 -0
- package/dist/utils/exports.mjs +165 -84
- package/dist/utils/exports.mjs.map +1 -0
- package/dist/utils/filter.d.ts +10 -0
- package/dist/utils/filter.d.ts.map +1 -0
- package/dist/utils/formatInputTokenValue.d.ts +2 -0
- package/dist/utils/formatInputTokenValue.d.ts.map +1 -0
- package/dist/utils/formatNumber.d.ts +32 -0
- package/dist/utils/formatNumber.d.ts.map +1 -0
- package/dist/utils/formatTimestamps.d.ts +20 -0
- package/dist/utils/formatTimestamps.d.ts.map +1 -0
- package/dist/utils/formatTokenList.d.ts +21 -0
- package/dist/utils/formatTokenList.d.ts.map +1 -0
- package/dist/utils/formatUsd.d.ts +5 -0
- package/dist/utils/formatUsd.d.ts.map +1 -0
- package/dist/utils/getContractName.d.ts +10 -0
- package/dist/utils/getContractName.d.ts.map +1 -0
- package/dist/utils/getErrorResponse.d.ts +5 -0
- package/dist/utils/getErrorResponse.d.ts.map +1 -0
- package/dist/utils/getHoneySwapMessage.d.ts +7 -0
- package/dist/utils/getHoneySwapMessage.d.ts.map +1 -0
- package/dist/utils/getServerSideClient.d.ts +6 -0
- package/dist/utils/getServerSideClient.d.ts.map +1 -0
- package/dist/utils/getTestClient.d.ts +75 -0
- package/dist/utils/getTestClient.d.ts.map +1 -0
- package/dist/utils/hasAnyTruthyValues.d.ts +2 -0
- package/dist/utils/hasAnyTruthyValues.d.ts.map +1 -0
- package/dist/utils/isDifferenceExceedingThreshold.d.ts +6 -0
- package/dist/utils/isDifferenceExceedingThreshold.d.ts.map +1 -0
- package/dist/utils/isSubgraphStale.d.ts +5 -0
- package/dist/utils/isSubgraphStale.d.ts.map +1 -0
- package/dist/utils/math.d.ts +15 -0
- package/dist/utils/math.d.ts.map +1 -0
- package/dist/utils/parseBaseArgs.d.ts +6 -0
- package/dist/utils/parseBaseArgs.d.ts.map +1 -0
- package/dist/utils/parseWhiskToken.d.ts +21 -0
- package/dist/utils/parseWhiskToken.d.ts.map +1 -0
- package/dist/utils/polyfillAbortSignalAny.d.ts +14 -0
- package/dist/utils/polyfillAbortSignalAny.d.ts.map +1 -0
- package/dist/utils/poolNamings.d.ts +9 -0
- package/dist/utils/poolNamings.d.ts.map +1 -0
- package/dist/utils/pythHoneyUtils.d.ts +2 -0
- package/dist/utils/pythHoneyUtils.d.ts.map +1 -0
- package/dist/utils/sanitizeRpcUrl.d.ts +10 -0
- package/dist/utils/sanitizeRpcUrl.d.ts.map +1 -0
- package/dist/utils/test-utils.d.ts +2 -0
- package/dist/utils/test-utils.d.ts.map +1 -0
- package/dist/utils/time.d.ts +65 -0
- package/dist/utils/time.d.ts.map +1 -0
- package/dist/utils/tokenWrapping.d.ts +7 -0
- package/dist/utils/tokenWrapping.d.ts.map +1 -0
- package/dist/utils/tokens.d.ts +37 -0
- package/dist/utils/tokens.d.ts.map +1 -0
- package/dist/utils/tracedTransport.d.ts +10 -0
- package/dist/utils/tracedTransport.d.ts.map +1 -0
- package/dist/utils/truncateHash.d.ts +5 -0
- package/dist/utils/truncateHash.d.ts.map +1 -0
- package/dist/utils/validatorUptimeStatus.d.ts +19 -0
- package/dist/utils/validatorUptimeStatus.d.ts.map +1 -0
- package/package.json +11 -7
- package/src/actions/clients/BeraApolloClient.ts +8 -4
- package/src/actions/clients/clientName.ts +17 -0
- package/src/actions/clients/clientName.unit.test.ts +39 -0
- package/src/actions/clients/exports.ts +2 -0
- package/src/actions/clients/fetchBeep.ts +4 -1
- package/src/actions/clients/fetchEnso.ts +48 -0
- package/src/actions/clients/fetchLayerzero.ts +34 -0
- package/src/actions/clients/fetchOpenApi.ts +9 -2
- package/src/actions/clients/fetchOpenApi.unit.test.ts +35 -19
- package/src/actions/clients/getApolloClient.ts +3 -11
- package/src/actions/dex/__tests__/aggregators.unit.test.ts +231 -2
- package/src/actions/dex/aggregators/base.ts +78 -18
- package/src/actions/dex/aggregators/bex.ts +44 -11
- package/src/actions/dex/aggregators/bgt.ts +11 -6
- package/src/actions/dex/aggregators/enso/enso.ts +1 -0
- package/src/actions/dex/aggregators/enso/ensoErc4626.ts +27 -9
- package/src/actions/dex/aggregators/erc4626.ts +19 -5
- package/src/actions/dex/aggregators/fly.ts +1 -0
- package/src/actions/dex/aggregators/haiku.ts +33 -2
- package/src/actions/dex/aggregators/honey.ts +17 -6
- package/src/actions/dex/aggregators/kyberswap.ts +1 -0
- package/src/actions/dex/aggregators/oogabooga.ts +1 -0
- package/src/actions/dex/aggregators/openOcean.ts +1 -0
- package/src/actions/dex/aggregators/wbera.ts +17 -11
- package/src/actions/dex/getPoolWithState.ts +2 -2
- package/src/actions/enso/__tests__/helpers.ts +15 -10
- package/src/actions/enso/getBendMultiplyBundle.ts +1 -1
- package/src/actions/enso/getEnsoUserTokensWithBalances.ts +4 -8
- package/src/actions/enso/util.ts +0 -59
- package/src/actions/exports.ts +5 -8
- package/src/actions/governance/getDecodedFunctionData.ts +5 -1
- package/src/actions/honey/getHoney24hVolume.ts +3 -12
- package/src/actions/honey/getHoneyCollaterals.ts +1 -1
- package/src/actions/honey/getSwapPayload.ts +4 -4
- package/src/actions/pol/getAutoclaimedIncentives.ts +1 -1
- package/src/actions/pol/getAutoclaimedIncentivesTxHash.ts +1 -1
- package/src/actions/pol/getBeraTokenTotalSupply.ts +3 -33
- package/src/actions/pol/getLSTStakeConfig.ts +0 -6
- package/src/actions/pol/{getUserVaultsReward.ts → getRewardVaultEarnedRewards.ts} +6 -4
- package/src/actions/pol/getSWBeraVaultMetadata.ts +2 -106
- package/src/actions/pol/getStakedBeraAPY.ts +45 -0
- package/src/actions/pol/getStakedBeraSnapshots.ts +18 -34
- package/src/actions/pol/getUserVaultInfo.ts +2 -2
- package/src/actions/pol/getVaultsSupply.ts +5 -2
- package/src/actions/server/getDailyValidatorBlockStats.ts +28 -17
- package/src/actions/tokens/getWalletBalances.ts +1 -3
- package/src/actions/transactions/beraWriteContract.integration.test.ts +16 -3
- package/src/actions/transactions/beraWriteContract.ts +2 -2
- package/src/actions/validators/getActiveBoostAndCommissionChangeDelay.ts +1 -1
- package/src/actions/validators/getUserActiveValidators.ts +116 -54
- package/src/actions/validators/getUserBoostsOnValidator.ts +6 -9
- package/src/actions/validators/getValidatorEstimatedBgtPerYear.ts +3 -3
- package/src/actions/validators/getValidatorRewardAllocation.ts +12 -1
- package/src/contexts/BeraFlags/BeraFlags.tsx +1 -4
- package/src/contexts/BeraFlags/defaultFlags.ts +1 -3
- package/src/contexts/BexStatusProvider.tsx +1 -1
- package/src/contexts/TokensProvider.tsx +1 -4
- package/src/contexts/exports.ts +1 -1
- package/src/enum/contracts.ts +3 -0
- package/src/errors/BeraError.ts +51 -1
- package/src/errors/BeraError.unit.test.ts +94 -0
- package/src/errors/BeraTracing.unit.test.ts +17 -18
- package/src/errors/RequestError.ts +61 -10
- package/src/errors/RequestError.unit.test.ts +101 -0
- package/src/errors/assert.ts +29 -0
- package/src/errors/errorMap.ts +8 -3
- package/src/errors/getErrorMessage.unit.test.ts +32 -0
- package/src/hooks/bend/useGetConvertToAssets.ts +3 -3
- package/src/hooks/dex/useAggregatorsQuotes.ts +7 -1
- package/src/hooks/dex/useAggregatorsRouterFeeBps.ts +2 -2
- package/src/hooks/dex/useAllUserPools.ts +6 -6
- package/src/hooks/dex/useApiPool.ts +3 -3
- package/src/hooks/dex/useCreatePool.ts +13 -13
- package/src/hooks/dex/useCrossChainNativeFee.ts +83 -0
- package/src/hooks/dex/useCrossChainNativeFee.unit.test.ts +63 -0
- package/src/hooks/dex/useGlobalLiquidityAndSwapVolume.ts +2 -2
- package/src/hooks/dex/useLiquidityMismatch.ts +3 -3
- package/src/hooks/dex/useLpPosition.ts +3 -3
- package/src/hooks/dex/useOnChainPoolData.ts +30 -13
- package/src/hooks/dex/usePollPoolCreationRelayerApproval.ts +3 -3
- package/src/hooks/dex/usePoolEvents.ts +3 -3
- package/src/hooks/dex/usePoolHistoricalData.ts +3 -3
- package/src/hooks/dex/usePools.ts +6 -6
- package/src/hooks/dex/usePriceImpact.ts +6 -6
- package/src/hooks/dex/useSingleAggregatorQuote.ts +4 -2
- package/src/hooks/enso/useBendZapSupply.ts +9 -38
- package/src/hooks/enso/useEnsoUserTokensWithBalances.ts +10 -2
- package/src/hooks/enso/useZapStakeBera.ts +1 -1
- package/src/hooks/exports.ts +2 -9
- package/src/hooks/governance/useCreateProposal.ts +4 -4
- package/src/hooks/governance/useGetPastVotes.ts +11 -7
- package/src/hooks/governance/useHasVoted.ts +3 -3
- package/src/hooks/governance/useIsCanceller.ts +3 -3
- package/src/hooks/governance/usePollAllProposals.ts +3 -3
- package/src/hooks/governance/usePollProposal.ts +3 -3
- package/src/hooks/governance/usePollProposalThreshold.ts +3 -3
- package/src/hooks/governance/usePollProposalVotes.ts +12 -12
- package/src/hooks/governance/usePollUserDelegates.ts +18 -14
- package/src/hooks/governance/useProposalFromTx.ts +3 -3
- package/src/hooks/governance/useProposalSnapshot.ts +3 -3
- package/src/hooks/governance/useProposalState.ts +3 -3
- package/src/hooks/honey/useCappedGlobally.ts +3 -3
- package/src/hooks/honey/useCappedRelatively.ts +3 -3
- package/src/hooks/honey/useCollateralWeights.ts +3 -3
- package/src/hooks/honey/useHoneyAlerts.ts +9 -9
- package/src/hooks/honey/useHoneyBalances.ts +3 -3
- package/src/hooks/honey/useHoneySwapState.ts +2 -2
- package/src/hooks/honey/useHoneyVaultsBalance.ts +3 -3
- package/src/hooks/honey/useIsBadCollateralAsset.ts +3 -3
- package/src/hooks/perps/usePythUpdateFee.ts +3 -3
- package/src/hooks/pol/useAutoclaimedIncentives.ts +7 -4
- package/src/hooks/pol/useAutoclaimedIncentivesTxHash.ts +6 -3
- package/src/hooks/pol/useBgtUnstakedBalance.ts +3 -3
- package/src/hooks/pol/useClaimableFees.ts +4 -4
- package/src/hooks/pol/useHighestVaultsAPR.ts +3 -3
- package/src/hooks/pol/useOnChainRewardVault.ts +6 -5
- package/src/hooks/pol/usePollGlobalData.ts +3 -3
- package/src/hooks/pol/usePollMarkets.ts +5 -5
- package/src/hooks/pol/useRewardTokenToBeraRate.ts +11 -18
- package/src/hooks/pol/useRewardVault.ts +6 -5
- package/src/hooks/pol/useRewardVaultBalanceFromStakingToken.ts +3 -4
- package/src/hooks/pol/useRewardVaultFromToken.ts +3 -3
- package/src/hooks/pol/useRewardVaultRewards.ts +3 -3
- package/src/hooks/pol/useRewardVaults.ts +6 -6
- package/src/hooks/pol/{useStakedAPR.ts → useStakedAPY.ts} +11 -9
- package/src/hooks/pol/useStakedData.ts +15 -16
- package/src/hooks/pol/useStakingVaultsMetadata.ts +5 -10
- package/src/hooks/pol/useUserVaultInfo.ts +3 -3
- package/src/hooks/pol/useUserVaults.ts +3 -3
- package/src/hooks/pol/useVaultAddress.ts +2 -2
- package/src/hooks/pol/useVaultHistory.ts +3 -3
- package/src/hooks/pol/useVaultValidators.ts +3 -3
- package/src/hooks/tokens/useBeraCurrentPrice.ts +8 -4
- package/src/hooks/tokens/useMultipleTokenInformation.ts +64 -21
- package/src/hooks/tokens/useMultipleTokenInformation.unit.test.ts +91 -0
- package/src/hooks/tokens/usePollBalance.ts +4 -2
- package/src/hooks/tokens/useStakingTokenInformation.ts +3 -3
- package/src/hooks/useBlockToTimestamp.ts +1 -1
- package/src/hooks/useContractWrite/index.ts +1 -1
- package/src/hooks/useContractWrite/stateReducer.ts +2 -2
- package/src/hooks/useContractWrite/useBeraContractWrite.ts +1 -3
- package/src/hooks/useGetVerifiedAbi.ts +2 -2
- package/src/hooks/validators/useAllValidators.ts +6 -6
- package/src/hooks/validators/useApiValidator.ts +6 -5
- package/src/hooks/validators/useOnChainValidator.ts +3 -3
- package/src/hooks/validators/useStakingPoolBatch.ts +3 -3
- package/src/hooks/validators/useUserActiveValidators.ts +57 -12
- package/src/hooks/validators/useUserBoostsOnValidator.ts +3 -3
- package/src/hooks/validators/useUserStakingPositions.ts +3 -3
- package/src/hooks/validators/useValidatorCommission.ts +3 -3
- package/src/hooks/validators/useValidatorEstimatedBgtPerYear.ts +4 -4
- package/src/hooks/validators/useValidatorIncentiveDistribution.ts +3 -4
- package/src/hooks/validators/useValidatorQueuedOperatorAddress.ts +3 -3
- package/src/hooks/validators/useValidatorQueuedRewardAllocation.ts +3 -3
- package/src/types/bribeBoost.d.ts +20 -0
- package/src/types/dex.d.ts +17 -0
- package/src/types/enso.d.ts +1 -27
- package/src/types/exports.ts +1 -1
- package/src/types/global.d.ts +7 -0
- package/src/types/pol.d.ts +3 -48
- package/src/utils/crossChainBridge.ts +290 -0
- package/src/utils/crossChainBridge.unit.test.ts +177 -0
- package/src/utils/exports.ts +1 -1
- package/src/utils/filter.ts +3 -5
- package/src/utils/formatInputTokenValue.ts +2 -2
- package/src/utils/formatNumber.ts +5 -5
- package/src/utils/formatTimestamps.unit.test.ts +6 -3
- package/src/utils/formatUsd.ts +6 -4
- package/src/utils/getServerSideClient.ts +3 -3
- package/src/utils/isDifferenceExceedingThreshold.ts +10 -6
- package/src/utils/math.ts +12 -7
- package/src/utils/math.unit.test.ts +114 -15
- package/src/utils/polyfillAbortSignalAny.ts +4 -4
- package/src/utils/polyfillAbortSignalAny.unit.test.ts +3 -1
- package/src/utils/poolNamings.ts +14 -10
- package/src/utils/pythHoneyUtils.ts +2 -2
- package/src/utils/truncateHash.ts +3 -3
- package/dist/HoneyConfigProvider-COOuDNra.d.ts +0 -390
- package/dist/RequestError-DBOIV65x.d.ts +0 -144
- package/dist/chunk-YLTWPFCJ.mjs +0 -39
- package/dist/defaultFlags-D6KfkTZx.d.ts +0 -10
- package/dist/getProposalVotes-DAUrdX2n.d.ts +0 -12
- package/dist/getValidatorQueuedOperatorAddress-Cc05dlO3.d.ts +0 -511
- package/dist/global.d-CR3zicga.d.ts +0 -231
- package/dist/pol.d-CeRgXBL8.d.ts +0 -167
- package/src/actions/enso/getEnsoSwapBundle.ts +0 -77
- package/src/actions/pol/getBgtIncentiveDistributorPaused.ts +0 -28
- package/src/actions/pol/getRewardProofsByValidator.ts +0 -49
- package/src/actions/pol/getStakedBeraAPR.ts +0 -56
- package/src/actions/pol/getUserClaimableIncentives.ts +0 -40
- package/src/actions/validators/getDailyValidatorBlockStats.ts +0 -38
- package/src/actions/validators/getValidatorAnalytics.ts +0 -33
- package/src/hooks/enso/useEnsoSwapBundle.ts +0 -121
- package/src/hooks/pol/useBgtIncentiveDistributorPaused.ts +0 -34
- package/src/hooks/tokens/useTokenCurrentPrice.ts +0 -21
- package/src/hooks/validators/useDailyValidatorBlockStats.ts +0 -33
- package/src/hooks/validators/useDefaultRewardAllocation.ts +0 -26
- package/src/hooks/validators/useUserClaimableIncentives.ts +0 -149
- package/src/hooks/validators/useValidatorAnalytics.ts +0 -34
- package/src/types/bribe-boost.d.ts +0 -69
- package/src/utils/formatIncentivesTokenMap.ts +0 -19
- package/src/utils/layerZeroScan.ts +0 -122
- /package/src/actions/dex/{b-sdk.ts → bSdk.ts} +0 -0
- /package/src/contexts/{block-time-provider.tsx → BlockTimeProvider.tsx} +0 -0
package/dist/hooks/exports.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ensoWalletV2FactoryAbi
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-JA4DHMTG.mjs";
|
|
4
4
|
import {
|
|
5
5
|
BalancerApi,
|
|
6
6
|
BaseAggregator,
|
|
7
7
|
beraWriteContract,
|
|
8
|
+
ensoErc4626,
|
|
8
9
|
formatValidatorRewardAllocation,
|
|
9
10
|
getAllPools,
|
|
10
11
|
getAllValidators,
|
|
@@ -15,13 +16,10 @@ import {
|
|
|
15
16
|
getAutoclaimedIncentives,
|
|
16
17
|
getAutoclaimedIncentivesTxHash,
|
|
17
18
|
getBgtAprSimulation,
|
|
18
|
-
getBgtIncentiveDistributorPaused,
|
|
19
19
|
getBlockTimestamp,
|
|
20
20
|
getChartData,
|
|
21
21
|
getCollateralWeights,
|
|
22
22
|
getConvertToAssets,
|
|
23
|
-
getDailyValidatorBlockStats,
|
|
24
|
-
getDefaultRewardAllocation,
|
|
25
23
|
getEarnedStakedBeraVault,
|
|
26
24
|
getGlobalCapLimit,
|
|
27
25
|
getGlobalData,
|
|
@@ -36,30 +34,28 @@ import {
|
|
|
36
34
|
getPythLatestPrices,
|
|
37
35
|
getPythUpdateFee,
|
|
38
36
|
getRelativeCapLimit,
|
|
39
|
-
getRewardProofsByValidator,
|
|
40
37
|
getRewardTokenToBeraRate,
|
|
41
38
|
getRewardVault,
|
|
39
|
+
getRewardVaultEarnedRewards,
|
|
42
40
|
getRewardVaultIncentives,
|
|
43
41
|
getRewardVaultRewards,
|
|
44
42
|
getRewardVaultStakingToken,
|
|
45
43
|
getRewardVaults,
|
|
46
44
|
getSWBeraVaultMetadata,
|
|
47
45
|
getSWBeraWithdrawal,
|
|
48
|
-
|
|
46
|
+
getStakedBeraAPY,
|
|
49
47
|
getStakedBeraSnapshots,
|
|
50
48
|
getStakingPoolBatch,
|
|
51
49
|
getSwapPayload,
|
|
52
50
|
getTokenCurrentPrices,
|
|
53
51
|
getTokenInformation,
|
|
54
52
|
getTotalStakedAmount,
|
|
55
|
-
|
|
53
|
+
getUserActiveValidatorsApi,
|
|
54
|
+
getUserActiveValidatorsOnChain,
|
|
56
55
|
getUserBoostsOnValidator,
|
|
57
|
-
getUserClaimableIncentives,
|
|
58
56
|
getUserStakingPositions,
|
|
59
57
|
getUserVaultInfo,
|
|
60
58
|
getUserVaults,
|
|
61
|
-
getUserVaultsReward,
|
|
62
|
-
getValidatorAnalytics,
|
|
63
59
|
getValidatorCommission,
|
|
64
60
|
getValidatorEstimatedBgtPerYear,
|
|
65
61
|
getValidatorOperatorAddress,
|
|
@@ -70,13 +66,14 @@ import {
|
|
|
70
66
|
getVaultHistory,
|
|
71
67
|
getVaultValidators,
|
|
72
68
|
isBadCollateralAsset,
|
|
73
|
-
isBasketModeEnabled
|
|
74
|
-
|
|
69
|
+
isBasketModeEnabled,
|
|
70
|
+
mergeUserActiveValidators
|
|
71
|
+
} from "../chunk-SMBAW7AG.mjs";
|
|
72
|
+
import "../chunk-BZKA6DBM.mjs";
|
|
75
73
|
import {
|
|
76
74
|
fetchBeep
|
|
77
|
-
} from "../chunk-
|
|
78
|
-
import "../chunk-
|
|
79
|
-
import "../chunk-CDK4YV3D.mjs";
|
|
75
|
+
} from "../chunk-7OESHTBN.mjs";
|
|
76
|
+
import "../chunk-GWSTVITN.mjs";
|
|
80
77
|
import {
|
|
81
78
|
TokenContext,
|
|
82
79
|
useBeraFlag,
|
|
@@ -84,37 +81,37 @@ import {
|
|
|
84
81
|
useBlockTime,
|
|
85
82
|
useEnsoUserTokensWithBalances,
|
|
86
83
|
useHoneyConfig
|
|
87
|
-
} from "../chunk-
|
|
84
|
+
} from "../chunk-5PBYMJRG.mjs";
|
|
88
85
|
import {
|
|
89
86
|
swr_default,
|
|
90
87
|
useSWR,
|
|
91
88
|
useSWRImmutable
|
|
92
|
-
} from "../chunk-
|
|
89
|
+
} from "../chunk-RM227WHI.mjs";
|
|
93
90
|
import {
|
|
94
91
|
getEnsoClient,
|
|
95
92
|
getWalletBalances
|
|
96
|
-
} from "../chunk-
|
|
97
|
-
import "../chunk-
|
|
98
|
-
import "../chunk-
|
|
99
|
-
import "../chunk-
|
|
93
|
+
} from "../chunk-ZHV3MQ4F.mjs";
|
|
94
|
+
import "../chunk-ZCEFC2TK.mjs";
|
|
95
|
+
import "../chunk-BSLXKPX4.mjs";
|
|
96
|
+
import "../chunk-XO2BFPTB.mjs";
|
|
97
|
+
import "../chunk-GLWPRM33.mjs";
|
|
100
98
|
import {
|
|
101
99
|
TransactionFailedError
|
|
102
|
-
} from "../chunk-
|
|
100
|
+
} from "../chunk-M3MIGSH3.mjs";
|
|
103
101
|
import {
|
|
104
102
|
BeraMonitoring,
|
|
105
103
|
initBeraError
|
|
106
|
-
} from "../chunk-
|
|
104
|
+
} from "../chunk-FWRYUIJK.mjs";
|
|
107
105
|
import {
|
|
108
106
|
assertAddress,
|
|
109
|
-
assertAmount,
|
|
110
107
|
assertDefined,
|
|
111
108
|
assertPositive,
|
|
112
109
|
assertPublicClient
|
|
113
|
-
} from "../chunk-
|
|
110
|
+
} from "../chunk-TXWDUJOY.mjs";
|
|
114
111
|
import {
|
|
115
112
|
computePriceImpact,
|
|
116
113
|
wrapNativeTokens
|
|
117
|
-
} from "../chunk-
|
|
114
|
+
} from "../chunk-7KN7TDUC.mjs";
|
|
118
115
|
import {
|
|
119
116
|
DEFAULT_METAMASK_GAS_LIMIT,
|
|
120
117
|
bignumber_js_default,
|
|
@@ -122,35 +119,35 @@ import {
|
|
|
122
119
|
getPythDefaultUpdateFee,
|
|
123
120
|
msToSeconds,
|
|
124
121
|
seconds
|
|
125
|
-
} from "../chunk-
|
|
122
|
+
} from "../chunk-35RACQD4.mjs";
|
|
126
123
|
import {
|
|
127
124
|
beraFetchJson
|
|
128
|
-
} from "../chunk-
|
|
129
|
-
import "../chunk-
|
|
125
|
+
} from "../chunk-4576RF2K.mjs";
|
|
126
|
+
import "../chunk-XXKPXNQD.mjs";
|
|
130
127
|
import {
|
|
131
128
|
beraToken,
|
|
132
129
|
getHoneyToken,
|
|
133
130
|
isToken
|
|
134
|
-
} from "../chunk-
|
|
131
|
+
} from "../chunk-HPRLNT6R.mjs";
|
|
135
132
|
import {
|
|
136
133
|
parseBaseArgs
|
|
137
|
-
} from "../chunk-
|
|
138
|
-
import "../chunk-
|
|
134
|
+
} from "../chunk-SC3BSCTN.mjs";
|
|
135
|
+
import "../chunk-BMNEN4OK.mjs";
|
|
139
136
|
import {
|
|
140
137
|
RequestError
|
|
141
|
-
} from "../chunk-
|
|
138
|
+
} from "../chunk-LL7XR2H5.mjs";
|
|
142
139
|
import {
|
|
143
140
|
BeraError,
|
|
144
141
|
InvalidArgumentError
|
|
145
|
-
} from "../chunk-
|
|
142
|
+
} from "../chunk-MVNQY2D4.mjs";
|
|
146
143
|
|
|
147
144
|
// src/hooks/bend/useGetConvertToAssets.ts
|
|
148
145
|
import { usePublicClient } from "@berachain/wagmi/hooks";
|
|
149
|
-
|
|
146
|
+
function useGetConvertToAssets({
|
|
150
147
|
sharesAmount,
|
|
151
148
|
vaultAddress,
|
|
152
149
|
vaultChainId
|
|
153
|
-
}, options)
|
|
150
|
+
}, options) {
|
|
154
151
|
const publicClient = usePublicClient({ chainId: vaultChainId });
|
|
155
152
|
return useSWR(
|
|
156
153
|
publicClient && sharesAmount && vaultAddress ? ["useGetConvertToAssets", sharesAmount, vaultAddress, vaultChainId] : null,
|
|
@@ -166,23 +163,24 @@ var useGetConvertToAssets = ({
|
|
|
166
163
|
...options
|
|
167
164
|
}
|
|
168
165
|
);
|
|
169
|
-
}
|
|
166
|
+
}
|
|
170
167
|
|
|
171
168
|
// src/hooks/dex/useAggregatorsQuotes.ts
|
|
172
169
|
import { useMemo } from "react";
|
|
173
|
-
import { zeroAddress as
|
|
170
|
+
import { zeroAddress as zeroAddress9 } from "viem";
|
|
174
171
|
import { defaultChainId } from "@berachain/config/internal";
|
|
175
172
|
import { useBeraWallet as useBeraWallet2, usePublicClient as usePublicClient4 } from "@berachain/wagmi/hooks";
|
|
176
173
|
|
|
177
174
|
// src/actions/dex/aggregators/bex.ts
|
|
178
175
|
import {
|
|
176
|
+
DECIMAL_SCALES,
|
|
179
177
|
Slippage,
|
|
180
178
|
Swap,
|
|
181
179
|
SwapKind,
|
|
182
180
|
Token,
|
|
183
181
|
TokenAmount
|
|
184
182
|
} from "@berachain-foundation/berancer-sdk";
|
|
185
|
-
import { decodeFunctionData, formatEther
|
|
183
|
+
import { decodeFunctionData, formatEther } from "viem";
|
|
186
184
|
import { getUriFromLink } from "@berachain/config";
|
|
187
185
|
import { ChainId } from "@berachain/config/internal";
|
|
188
186
|
import { vaultAbi as balancerVaultAbi } from "@berachain/abis/bex/vault";
|
|
@@ -194,6 +192,30 @@ var BexAggregator = class extends BaseAggregator {
|
|
|
194
192
|
supportedChains = [ChainId.MAINNET, ChainId.BEPOLIA];
|
|
195
193
|
url = getUriFromLink(this.config.api);
|
|
196
194
|
type = "graphql";
|
|
195
|
+
/**
|
|
196
|
+
* Opt bex out of tokens it structurally can't route (BGT, or decimals
|
|
197
|
+
* outside b-sdk's supported range) so the quote is never requested and other
|
|
198
|
+
* aggregators still handle it — see `supportsToken` for the specifics.
|
|
199
|
+
*/
|
|
200
|
+
getUnsupportedReason(args) {
|
|
201
|
+
const base = super.getUnsupportedReason(args);
|
|
202
|
+
if (base !== null) {
|
|
203
|
+
return base;
|
|
204
|
+
}
|
|
205
|
+
for (const token of [args.tokenIn, args.tokenOut]) {
|
|
206
|
+
if (!this.supportsToken(token)) {
|
|
207
|
+
return `${this.name} can't route ${token.symbol} (BGT or unsupported decimals).`;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return null;
|
|
211
|
+
}
|
|
212
|
+
supportsToken(token) {
|
|
213
|
+
if (isToken(token.address, "BGT", { config: this.config })) {
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
216
|
+
const scaleKey = 18 - token.decimals;
|
|
217
|
+
return scaleKey in DECIMAL_SCALES;
|
|
218
|
+
}
|
|
197
219
|
/**
|
|
198
220
|
* Helper function to convert zero address to wrapped token address
|
|
199
221
|
*/
|
|
@@ -249,14 +271,7 @@ var BexAggregator = class extends BaseAggregator {
|
|
|
249
271
|
// @ts-expect-error b-sdk has more chains than berajs
|
|
250
272
|
this.chainId
|
|
251
273
|
);
|
|
252
|
-
const {
|
|
253
|
-
tokenIn,
|
|
254
|
-
tokenOut,
|
|
255
|
-
amount,
|
|
256
|
-
slippage,
|
|
257
|
-
account = zeroAddress,
|
|
258
|
-
publicClient
|
|
259
|
-
} = args;
|
|
274
|
+
const { tokenIn, tokenOut, amount, slippage, publicClient } = args;
|
|
260
275
|
this.assertChainSupport({ tokenIn, tokenOut });
|
|
261
276
|
assertPublicClient(publicClient);
|
|
262
277
|
const wberaIsBera = isToken(tokenIn, "BERA") || isToken(tokenOut, "BERA");
|
|
@@ -332,13 +347,13 @@ var BexAggregator = class extends BaseAggregator {
|
|
|
332
347
|
name: this.name,
|
|
333
348
|
priceImpactPercentage: this.calculatePriceImpact(priceImpact),
|
|
334
349
|
swapFeeBps: 0,
|
|
335
|
-
getCalldata: ({ account
|
|
350
|
+
getCalldata: ({ account }) => {
|
|
336
351
|
const callData = swap.buildCall({
|
|
337
352
|
slippage: Slippage.fromPercentage(slippage.toString()),
|
|
338
353
|
deadline: BigInt(Math.round(Date.now() / 1e3) + DEFAULT_DEADLINE),
|
|
339
354
|
queryOutput,
|
|
340
|
-
sender:
|
|
341
|
-
recipient:
|
|
355
|
+
sender: account,
|
|
356
|
+
recipient: account,
|
|
342
357
|
wethIsEth: wberaIsBera
|
|
343
358
|
});
|
|
344
359
|
const { args: params, functionName } = decodeFunctionData({
|
|
@@ -350,7 +365,8 @@ var BexAggregator = class extends BaseAggregator {
|
|
|
350
365
|
functionName,
|
|
351
366
|
abi: balancerVaultAbi,
|
|
352
367
|
address: callData.to,
|
|
353
|
-
value: callData.value || BigInt(0)
|
|
368
|
+
value: callData.value || BigInt(0),
|
|
369
|
+
extraTags: { aggregator: this.name }
|
|
354
370
|
};
|
|
355
371
|
}
|
|
356
372
|
};
|
|
@@ -364,17 +380,21 @@ var RedeemBgtAggregator = class extends BaseAggregator {
|
|
|
364
380
|
name = "RedeemBgt" /* RedeemBgt */;
|
|
365
381
|
supportedChains = [ChainId2.MAINNET, ChainId2.BEPOLIA];
|
|
366
382
|
type = "rpc";
|
|
367
|
-
|
|
383
|
+
getUnsupportedReason({
|
|
368
384
|
tokenIn,
|
|
369
385
|
tokenOut
|
|
370
386
|
}) {
|
|
371
|
-
|
|
372
|
-
|
|
387
|
+
const base = super.getUnsupportedReason({ tokenIn, tokenOut });
|
|
388
|
+
if (base !== null) {
|
|
389
|
+
return base;
|
|
373
390
|
}
|
|
374
|
-
|
|
391
|
+
if (
|
|
375
392
|
// only supported on same chain
|
|
376
393
|
tokenIn.chainId === tokenOut.chainId && isToken(tokenIn, "BGT", { chainId: tokenIn.chainId }) && isToken(tokenOut, "BERA")
|
|
377
|
-
)
|
|
394
|
+
) {
|
|
395
|
+
return null;
|
|
396
|
+
}
|
|
397
|
+
return `${this.name} only redeems BGT \u2192 BERA on the same chain.`;
|
|
378
398
|
}
|
|
379
399
|
// handles native swaps: wrap and unwrap
|
|
380
400
|
async getQuote({
|
|
@@ -410,7 +430,7 @@ var RedeemBgtAggregator = class extends BaseAggregator {
|
|
|
410
430
|
var bgtRedeem = new RedeemBgtAggregator();
|
|
411
431
|
|
|
412
432
|
// src/actions/dex/aggregators/enso/enso.ts
|
|
413
|
-
import { zeroAddress
|
|
433
|
+
import { zeroAddress } from "viem";
|
|
414
434
|
import { ChainId as ChainId3 } from "@berachain/config/internal";
|
|
415
435
|
import aggregatorsRouterAbi from "@berachain/abis/meta-aggregator/metaAggregatorV2";
|
|
416
436
|
var EnsoAggregator = class extends BaseAggregator {
|
|
@@ -429,7 +449,7 @@ var EnsoAggregator = class extends BaseAggregator {
|
|
|
429
449
|
tokenOut,
|
|
430
450
|
amount,
|
|
431
451
|
slippage,
|
|
432
|
-
account =
|
|
452
|
+
account = zeroAddress,
|
|
433
453
|
aggregatorsFeeBps,
|
|
434
454
|
proxyAggregatorsThroughVercel = false,
|
|
435
455
|
rewardVault
|
|
@@ -445,7 +465,7 @@ var EnsoAggregator = class extends BaseAggregator {
|
|
|
445
465
|
amount,
|
|
446
466
|
aggregatorsFeeBps
|
|
447
467
|
);
|
|
448
|
-
const refundReceiver = account ===
|
|
468
|
+
const refundReceiver = account === zeroAddress ? this.config.bex.aggregatorsRouterExecutor : account;
|
|
449
469
|
const params = new URLSearchParams({
|
|
450
470
|
fromAddress: this.config.bex.aggregatorsRouterExecutor,
|
|
451
471
|
receiver: this.config.bex.aggregatorsRouterExecutor,
|
|
@@ -491,11 +511,12 @@ var EnsoAggregator = class extends BaseAggregator {
|
|
|
491
511
|
outputData,
|
|
492
512
|
aggregatorData,
|
|
493
513
|
{
|
|
494
|
-
rewardVault: rewardVault ??
|
|
514
|
+
rewardVault: rewardVault ?? zeroAddress,
|
|
495
515
|
isSwapAndStake: !!rewardVault
|
|
496
516
|
}
|
|
497
517
|
],
|
|
498
518
|
functionName: "swap",
|
|
519
|
+
extraTags: { aggregator: this.name },
|
|
499
520
|
abi: aggregatorsRouterAbi,
|
|
500
521
|
// send full amount to router first, which will deduct the swap fee before executing trade
|
|
501
522
|
value: isTokenInNative ? BigInt(amount) : BigInt("0"),
|
|
@@ -517,14 +538,25 @@ var ERC4626Aggregator = class extends BaseAggregator {
|
|
|
517
538
|
* Returns true when tokenOut is an ERC4626 vault whose underlying asset matches tokenIn,
|
|
518
539
|
* or when depositing native BERA into swBERA.
|
|
519
540
|
*/
|
|
520
|
-
|
|
541
|
+
getUnsupportedReason({
|
|
521
542
|
tokenIn,
|
|
522
543
|
tokenOut,
|
|
523
544
|
underlyingToken
|
|
524
545
|
}) {
|
|
525
|
-
const
|
|
546
|
+
const base = super.getUnsupportedReason({
|
|
547
|
+
tokenIn,
|
|
548
|
+
tokenOut,
|
|
549
|
+
underlyingToken
|
|
550
|
+
});
|
|
551
|
+
if (base !== null) {
|
|
552
|
+
return base;
|
|
553
|
+
}
|
|
554
|
+
const isVaultDeposit = !!underlyingToken && underlyingToken?.chainId === tokenOut.chainId && (isToken(underlyingToken, tokenIn) || // this is a special case for the swbera vault
|
|
526
555
|
isToken(tokenIn, "BERA") && isToken(tokenOut, "SWBERA"));
|
|
527
|
-
|
|
556
|
+
if (isVaultDeposit) {
|
|
557
|
+
return null;
|
|
558
|
+
}
|
|
559
|
+
return `${this.name} only deposits a token into its matching ERC4626 vault.`;
|
|
528
560
|
}
|
|
529
561
|
/**
|
|
530
562
|
* Fetches a deposit quote by calling `convertToShares` on the vault.
|
|
@@ -568,14 +600,16 @@ var ERC4626Aggregator = class extends BaseAggregator {
|
|
|
568
600
|
address: tokenOut.address,
|
|
569
601
|
functionName: "depositNative",
|
|
570
602
|
params: [BigInt(amount), account],
|
|
571
|
-
value: BigInt(amount)
|
|
603
|
+
value: BigInt(amount),
|
|
604
|
+
extraTags: { aggregator: this.name }
|
|
572
605
|
} : {
|
|
573
606
|
abi: erc4626Abi,
|
|
574
607
|
address: tokenOut.address,
|
|
575
608
|
functionName: "deposit",
|
|
576
609
|
contractName: "others.erc4626" /* ERC4626 */,
|
|
577
610
|
params: [BigInt(amount), account],
|
|
578
|
-
value: 0n
|
|
611
|
+
value: 0n,
|
|
612
|
+
extraTags: { aggregator: this.name }
|
|
579
613
|
}
|
|
580
614
|
};
|
|
581
615
|
}
|
|
@@ -583,7 +617,7 @@ var ERC4626Aggregator = class extends BaseAggregator {
|
|
|
583
617
|
var erc4626Deposit = new ERC4626Aggregator();
|
|
584
618
|
|
|
585
619
|
// src/actions/dex/aggregators/fly.ts
|
|
586
|
-
import { zeroAddress as
|
|
620
|
+
import { zeroAddress as zeroAddress2 } from "viem";
|
|
587
621
|
import { ChainId as ChainId4 } from "@berachain/config/internal";
|
|
588
622
|
import aggregatorsRouterAbi2 from "@berachain/abis/meta-aggregator/metaAggregatorV2";
|
|
589
623
|
var BASE_URL = "https://api.fly.trade/aggregator";
|
|
@@ -676,11 +710,12 @@ var FlyAggregator = class extends BaseAggregator {
|
|
|
676
710
|
outputData,
|
|
677
711
|
aggregatorData,
|
|
678
712
|
{
|
|
679
|
-
rewardVault: rewardVault ??
|
|
713
|
+
rewardVault: rewardVault ?? zeroAddress2,
|
|
680
714
|
isSwapAndStake: !!rewardVault
|
|
681
715
|
}
|
|
682
716
|
],
|
|
683
717
|
functionName: "swap",
|
|
718
|
+
extraTags: { aggregator: this.name },
|
|
684
719
|
abi: aggregatorsRouterAbi2,
|
|
685
720
|
// send full amount to router first, which will deduct the swap fee before executing trade
|
|
686
721
|
value: isToken(tokenIn, "BERA") ? BigInt(amount) : BigInt("0"),
|
|
@@ -693,7 +728,7 @@ var FlyAggregator = class extends BaseAggregator {
|
|
|
693
728
|
var fly = new FlyAggregator();
|
|
694
729
|
|
|
695
730
|
// src/actions/dex/aggregators/haiku.ts
|
|
696
|
-
import { formatUnits as formatUnits2, parseUnits, zeroAddress as
|
|
731
|
+
import { formatUnits as formatUnits2, parseUnits, zeroAddress as zeroAddress3 } from "viem";
|
|
697
732
|
import { ChainId as ChainId5 } from "@berachain/config/internal";
|
|
698
733
|
import aggregatorsRouterAbi3 from "@berachain/abis/meta-aggregator/metaAggregatorV2";
|
|
699
734
|
var HaikuAggregator = class extends BaseAggregator {
|
|
@@ -706,6 +741,20 @@ var HaikuAggregator = class extends BaseAggregator {
|
|
|
706
741
|
"No route found for the given input or the liquidity is not enough",
|
|
707
742
|
"Invalid input amount. Please ensure the total amount of input is greater than 0.001 USD"
|
|
708
743
|
];
|
|
744
|
+
getUnsupportedReason({
|
|
745
|
+
tokenIn,
|
|
746
|
+
tokenOut,
|
|
747
|
+
rewardVault
|
|
748
|
+
}) {
|
|
749
|
+
const base = super.getUnsupportedReason({ tokenIn, tokenOut });
|
|
750
|
+
if (base !== null) {
|
|
751
|
+
return base;
|
|
752
|
+
}
|
|
753
|
+
if (rewardVault) {
|
|
754
|
+
return `${this.name} does not support reward-vault staking.`;
|
|
755
|
+
}
|
|
756
|
+
return null;
|
|
757
|
+
}
|
|
709
758
|
async getQuote({
|
|
710
759
|
tokenIn,
|
|
711
760
|
tokenOut,
|
|
@@ -819,11 +868,12 @@ var HaikuAggregator = class extends BaseAggregator {
|
|
|
819
868
|
outputData,
|
|
820
869
|
aggregatorData,
|
|
821
870
|
{
|
|
822
|
-
rewardVault: rewardVault ??
|
|
871
|
+
rewardVault: rewardVault ?? zeroAddress3,
|
|
823
872
|
isSwapAndStake: !!rewardVault
|
|
824
873
|
}
|
|
825
874
|
],
|
|
826
875
|
functionName: "swap",
|
|
876
|
+
extraTags: { aggregator: this.name },
|
|
827
877
|
abi: aggregatorsRouterAbi3,
|
|
828
878
|
// send full amount to router first, which will deduct the swap fee before executing trade
|
|
829
879
|
value: isTokenInNative ? BigInt(amount) : BigInt("0"),
|
|
@@ -864,16 +914,23 @@ var HoneyNativeAggregator = class extends BaseAggregator {
|
|
|
864
914
|
(coll) => isToken(coll.address, isMint ? tokenIn : tokenOut)
|
|
865
915
|
);
|
|
866
916
|
}
|
|
867
|
-
|
|
917
|
+
getUnsupportedReason({
|
|
868
918
|
tokenIn,
|
|
869
919
|
tokenOut,
|
|
870
920
|
honeyNativeState
|
|
871
921
|
}) {
|
|
872
|
-
|
|
922
|
+
const base = super.getUnsupportedReason({ tokenIn, tokenOut });
|
|
923
|
+
if (base !== null) {
|
|
924
|
+
return base;
|
|
925
|
+
}
|
|
926
|
+
if (tokenIn.chainId === tokenOut.chainId && this.isHoneyNativeSwap({
|
|
873
927
|
tokenIn: tokenIn.address,
|
|
874
928
|
tokenOut: tokenOut.address,
|
|
875
929
|
honeyNativeState
|
|
876
|
-
})
|
|
930
|
+
})) {
|
|
931
|
+
return null;
|
|
932
|
+
}
|
|
933
|
+
return `${this.name} only mints/redeems HONEY against a listed collateral.`;
|
|
877
934
|
}
|
|
878
935
|
async getQuote({
|
|
879
936
|
tokenIn,
|
|
@@ -893,7 +950,7 @@ var HoneyNativeAggregator = class extends BaseAggregator {
|
|
|
893
950
|
});
|
|
894
951
|
}
|
|
895
952
|
assertPublicClient(publicClient);
|
|
896
|
-
this.assertChainSupport({ tokenIn, tokenOut });
|
|
953
|
+
this.assertChainSupport({ tokenIn, tokenOut, honeyNativeState });
|
|
897
954
|
const isMint = isToken(tokenOut, this.honeyToken);
|
|
898
955
|
const hubOrderedCollaterals = collaterals;
|
|
899
956
|
const collateral = collaterals.find(
|
|
@@ -1001,7 +1058,7 @@ var HoneyNativeAggregator = class extends BaseAggregator {
|
|
|
1001
1058
|
var honeyNative = new HoneyNativeAggregator();
|
|
1002
1059
|
|
|
1003
1060
|
// src/actions/dex/aggregators/kyberswap.ts
|
|
1004
|
-
import { zeroAddress as
|
|
1061
|
+
import { zeroAddress as zeroAddress4 } from "viem";
|
|
1005
1062
|
import { ChainId as ChainId7 } from "@berachain/config/internal";
|
|
1006
1063
|
import aggregatorsRouterAbi4 from "@berachain/abis/meta-aggregator/metaAggregatorV2";
|
|
1007
1064
|
var KyberSwapAggregator = class extends BaseAggregator {
|
|
@@ -1098,11 +1155,12 @@ var KyberSwapAggregator = class extends BaseAggregator {
|
|
|
1098
1155
|
outputData,
|
|
1099
1156
|
aggregatorData,
|
|
1100
1157
|
{
|
|
1101
|
-
rewardVault: rewardVault ??
|
|
1158
|
+
rewardVault: rewardVault ?? zeroAddress4,
|
|
1102
1159
|
isSwapAndStake: !!rewardVault
|
|
1103
1160
|
}
|
|
1104
1161
|
],
|
|
1105
1162
|
functionName: "swap",
|
|
1163
|
+
extraTags: { aggregator: this.name },
|
|
1106
1164
|
abi: aggregatorsRouterAbi4,
|
|
1107
1165
|
// send full amount to router first, which will deduct the swap fee before executing trade
|
|
1108
1166
|
value: isTokenInNative ? BigInt(amount) : BigInt("0"),
|
|
@@ -1115,7 +1173,7 @@ var KyberSwapAggregator = class extends BaseAggregator {
|
|
|
1115
1173
|
var kyberswap = new KyberSwapAggregator();
|
|
1116
1174
|
|
|
1117
1175
|
// src/actions/dex/aggregators/oogabooga.ts
|
|
1118
|
-
import { zeroAddress as
|
|
1176
|
+
import { zeroAddress as zeroAddress5 } from "viem";
|
|
1119
1177
|
import { ChainId as ChainId8 } from "@berachain/config/internal";
|
|
1120
1178
|
import aggregatorsRouterAbi5 from "@berachain/abis/meta-aggregator/metaAggregatorV2";
|
|
1121
1179
|
var OogaboogaAggregator = class extends BaseAggregator {
|
|
@@ -1192,11 +1250,12 @@ var OogaboogaAggregator = class extends BaseAggregator {
|
|
|
1192
1250
|
outputData,
|
|
1193
1251
|
aggregatorData,
|
|
1194
1252
|
{
|
|
1195
|
-
rewardVault: rewardVault ??
|
|
1253
|
+
rewardVault: rewardVault ?? zeroAddress5,
|
|
1196
1254
|
isSwapAndStake: !!rewardVault
|
|
1197
1255
|
}
|
|
1198
1256
|
],
|
|
1199
1257
|
functionName: "swap",
|
|
1258
|
+
extraTags: { aggregator: this.name },
|
|
1200
1259
|
abi: aggregatorsRouterAbi5,
|
|
1201
1260
|
// send full amount to router first, which will deduct the swap fee before executing trade
|
|
1202
1261
|
value: isTokenInNative ? BigInt(amount) : BigInt("0"),
|
|
@@ -1209,7 +1268,7 @@ var OogaboogaAggregator = class extends BaseAggregator {
|
|
|
1209
1268
|
var oogabooga = new OogaboogaAggregator();
|
|
1210
1269
|
|
|
1211
1270
|
// src/actions/dex/aggregators/openOcean.ts
|
|
1212
|
-
import { zeroAddress as
|
|
1271
|
+
import { zeroAddress as zeroAddress6 } from "viem";
|
|
1213
1272
|
import { ChainId as ChainId9 } from "@berachain/config/internal";
|
|
1214
1273
|
import aggregatorsRouterAbi6 from "@berachain/abis/meta-aggregator/metaAggregatorV2";
|
|
1215
1274
|
var OpenOceanAggregator = class extends BaseAggregator {
|
|
@@ -1223,7 +1282,7 @@ var OpenOceanAggregator = class extends BaseAggregator {
|
|
|
1223
1282
|
tokenOut,
|
|
1224
1283
|
amount,
|
|
1225
1284
|
slippage,
|
|
1226
|
-
account =
|
|
1285
|
+
account = zeroAddress6,
|
|
1227
1286
|
aggregatorsFeeBps,
|
|
1228
1287
|
publicClient,
|
|
1229
1288
|
rewardVault
|
|
@@ -1313,11 +1372,12 @@ var OpenOceanAggregator = class extends BaseAggregator {
|
|
|
1313
1372
|
outputData,
|
|
1314
1373
|
aggregatorData,
|
|
1315
1374
|
{
|
|
1316
|
-
rewardVault: rewardVault ??
|
|
1375
|
+
rewardVault: rewardVault ?? zeroAddress6,
|
|
1317
1376
|
isSwapAndStake: !!rewardVault
|
|
1318
1377
|
}
|
|
1319
1378
|
],
|
|
1320
1379
|
functionName: "swap",
|
|
1380
|
+
extraTags: { aggregator: this.name },
|
|
1321
1381
|
abi: aggregatorsRouterAbi6,
|
|
1322
1382
|
// send full amount to router first, which will deduct the swap fee before executing trade
|
|
1323
1383
|
value: isTokenInNative ? BigInt(amount) : BigInt("0"),
|
|
@@ -1336,18 +1396,21 @@ var WBeraAggregator = class extends BaseAggregator {
|
|
|
1336
1396
|
name = "Wrap" /* Wrap */;
|
|
1337
1397
|
supportedChains = [ChainId10.MAINNET, ChainId10.BEPOLIA];
|
|
1338
1398
|
type = "rpc";
|
|
1339
|
-
|
|
1399
|
+
// This aggregator's entire job is BERA↔WBERA, so keep the base same-token
|
|
1400
|
+
// (native-normalized) guard from rejecting it.
|
|
1401
|
+
supportsBeraWrap = true;
|
|
1402
|
+
getUnsupportedReason({
|
|
1340
1403
|
tokenIn,
|
|
1341
1404
|
tokenOut
|
|
1342
1405
|
}) {
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
) {
|
|
1348
|
-
return
|
|
1406
|
+
const base = super.getUnsupportedReason({ tokenIn, tokenOut });
|
|
1407
|
+
if (base !== null) {
|
|
1408
|
+
return base;
|
|
1409
|
+
}
|
|
1410
|
+
if (tokenIn.chainId === tokenOut.chainId && (isToken(tokenIn, "BERA") && isToken(tokenOut, "WBERA") || isToken(tokenIn, "WBERA") && isToken(tokenOut, "BERA"))) {
|
|
1411
|
+
return null;
|
|
1349
1412
|
}
|
|
1350
|
-
return
|
|
1413
|
+
return `${this.name} only wraps/unwraps between BERA and WBERA on the same chain.`;
|
|
1351
1414
|
}
|
|
1352
1415
|
// handles native swaps: wrap and unwrap
|
|
1353
1416
|
async getQuote({
|
|
@@ -1370,13 +1433,15 @@ var WBeraAggregator = class extends BaseAggregator {
|
|
|
1370
1433
|
address: this.config.tokens.wbera,
|
|
1371
1434
|
functionName: "deposit",
|
|
1372
1435
|
params: [],
|
|
1373
|
-
value: BigInt(amount)
|
|
1436
|
+
value: BigInt(amount),
|
|
1437
|
+
extraTags: { aggregator: this.name }
|
|
1374
1438
|
} : {
|
|
1375
1439
|
abi: wberaAbi,
|
|
1376
1440
|
address: this.config.tokens.wbera,
|
|
1377
1441
|
functionName: "withdraw",
|
|
1378
1442
|
params: [BigInt(amount)],
|
|
1379
|
-
value: BigInt(0)
|
|
1443
|
+
value: BigInt(0),
|
|
1444
|
+
extraTags: { aggregator: this.name }
|
|
1380
1445
|
};
|
|
1381
1446
|
}
|
|
1382
1447
|
};
|
|
@@ -1431,16 +1496,16 @@ function useUnderlyingAsset({ token }) {
|
|
|
1431
1496
|
}
|
|
1432
1497
|
|
|
1433
1498
|
// src/hooks/dex/useAggregatorsRouterFeeBps.ts
|
|
1434
|
-
import { zeroAddress as
|
|
1499
|
+
import { zeroAddress as zeroAddress7 } from "viem";
|
|
1435
1500
|
import aggregatorsRouterAbi7 from "@berachain/abis/meta-aggregator/metaAggregatorV2";
|
|
1436
1501
|
import { usePublicClient as usePublicClient2 } from "@berachain/wagmi/hooks";
|
|
1437
|
-
|
|
1502
|
+
function useAggregatorsRouterFeeBps() {
|
|
1438
1503
|
const publicClient = usePublicClient2();
|
|
1439
1504
|
const { config } = parseBaseArgs({
|
|
1440
1505
|
chainId: publicClient.chain?.id
|
|
1441
1506
|
});
|
|
1442
1507
|
return useSWRImmutable(
|
|
1443
|
-
publicClient && config.bex.aggregatorsRouter && config.bex.aggregatorsRouter !==
|
|
1508
|
+
publicClient && config.bex.aggregatorsRouter && config.bex.aggregatorsRouter !== zeroAddress7 ? ["useAggregatorsRouterFeeBps", config.bex.aggregatorsRouter] : null,
|
|
1444
1509
|
async ([, aggregatorsRouter]) => {
|
|
1445
1510
|
const fee = await publicClient.readContract({
|
|
1446
1511
|
address: aggregatorsRouter,
|
|
@@ -1450,10 +1515,10 @@ var useAggregatorsRouterFeeBps = () => {
|
|
|
1450
1515
|
return Number(fee);
|
|
1451
1516
|
}
|
|
1452
1517
|
);
|
|
1453
|
-
}
|
|
1518
|
+
}
|
|
1454
1519
|
|
|
1455
1520
|
// src/hooks/dex/useSingleAggregatorQuote.ts
|
|
1456
|
-
import { parseUnits as parseUnits2, zeroAddress as
|
|
1521
|
+
import { parseUnits as parseUnits2, zeroAddress as zeroAddress8 } from "viem";
|
|
1457
1522
|
import { useBeraWallet, usePublicClient as usePublicClient3 } from "@berachain/wagmi/hooks";
|
|
1458
1523
|
var USE_AGGREGATORS_QUOTES_QUERY_KEY = "useAggregatorsQuotes";
|
|
1459
1524
|
function getQueryKey({
|
|
@@ -1467,12 +1532,13 @@ function getQueryKey({
|
|
|
1467
1532
|
if (!Number(args.amount)) {
|
|
1468
1533
|
return null;
|
|
1469
1534
|
}
|
|
1470
|
-
if (
|
|
1535
|
+
if (aggregator.getUnsupportedReason({
|
|
1471
1536
|
tokenIn: args.tokenIn,
|
|
1472
1537
|
tokenOut: args.tokenOut,
|
|
1473
1538
|
underlyingToken: args.underlyingToken,
|
|
1474
|
-
honeyNativeState: args.honeyNativeState
|
|
1475
|
-
|
|
1539
|
+
honeyNativeState: args.honeyNativeState,
|
|
1540
|
+
rewardVault: args.rewardVault
|
|
1541
|
+
}) !== null) {
|
|
1476
1542
|
return null;
|
|
1477
1543
|
}
|
|
1478
1544
|
const name = aggregator.name;
|
|
@@ -1620,7 +1686,7 @@ function useSingleAggregatorQuote(args, options) {
|
|
|
1620
1686
|
}
|
|
1621
1687
|
}
|
|
1622
1688
|
const { config } = parseBaseArgs(args);
|
|
1623
|
-
const isMAEnabled = config.bex.aggregatorsRouter !==
|
|
1689
|
+
const isMAEnabled = config.bex.aggregatorsRouter !== zeroAddress8;
|
|
1624
1690
|
return raw_useSingleAggregatorQuote(
|
|
1625
1691
|
{
|
|
1626
1692
|
...args,
|
|
@@ -1665,7 +1731,7 @@ function useAggregatorsQuotes(args, options) {
|
|
|
1665
1731
|
});
|
|
1666
1732
|
const isNativeSwap = isWrapOrUnwrap || isBgtRedeem;
|
|
1667
1733
|
const { config } = parseBaseArgs(args);
|
|
1668
|
-
const isMAEnabled = config.bex.aggregatorsRouter !==
|
|
1734
|
+
const isMAEnabled = config.bex.aggregatorsRouter !== zeroAddress9;
|
|
1669
1735
|
const swrOptions = getAggregatorsSWROptions(options);
|
|
1670
1736
|
const sharedArgs = {
|
|
1671
1737
|
activeAggregators,
|
|
@@ -1740,7 +1806,13 @@ function useAggregatorsQuotes(args, options) {
|
|
|
1740
1806
|
...args,
|
|
1741
1807
|
aggregator: bex
|
|
1742
1808
|
},
|
|
1743
|
-
{
|
|
1809
|
+
{
|
|
1810
|
+
...swrOptions,
|
|
1811
|
+
// Compose with the caller's gate (e.g. same-token suppression from
|
|
1812
|
+
// useSwap) instead of overwriting it — otherwise bex fetches whenever
|
|
1813
|
+
// it's unpaused, regardless of isEnabled (HUB-9FQ).
|
|
1814
|
+
isEnabled: (options?.isEnabled ?? true) && bexProtocol.isPaused === false
|
|
1815
|
+
}
|
|
1744
1816
|
);
|
|
1745
1817
|
const wberaSwapResult = raw_useSingleAggregatorQuote({
|
|
1746
1818
|
...sharedArgs,
|
|
@@ -1797,12 +1869,12 @@ function useAggregatorsQuotes(args, options) {
|
|
|
1797
1869
|
}
|
|
1798
1870
|
|
|
1799
1871
|
// src/hooks/dex/useAllUserPools.ts
|
|
1800
|
-
|
|
1872
|
+
function useAllUserPoolsQueryKey({
|
|
1801
1873
|
query
|
|
1802
|
-
} = {})
|
|
1874
|
+
} = {}) {
|
|
1803
1875
|
return ["useAllUserPools", query];
|
|
1804
|
-
}
|
|
1805
|
-
|
|
1876
|
+
}
|
|
1877
|
+
function useAllUserPools(query, options) {
|
|
1806
1878
|
return useSWR(
|
|
1807
1879
|
useAllUserPoolsQueryKey({ query }),
|
|
1808
1880
|
async ([_, params]) => {
|
|
@@ -1816,16 +1888,16 @@ var useAllUserPools = (query, options) => {
|
|
|
1816
1888
|
...options
|
|
1817
1889
|
}
|
|
1818
1890
|
);
|
|
1819
|
-
}
|
|
1891
|
+
}
|
|
1820
1892
|
|
|
1821
1893
|
// src/hooks/dex/useApiPool.ts
|
|
1822
1894
|
import { isAddress } from "viem";
|
|
1823
|
-
|
|
1895
|
+
function useApiPoolQueryKey({
|
|
1824
1896
|
poolId,
|
|
1825
1897
|
account
|
|
1826
|
-
})
|
|
1898
|
+
}) {
|
|
1827
1899
|
return poolId ? [`usePool-api`, poolId, account] : null;
|
|
1828
|
-
}
|
|
1900
|
+
}
|
|
1829
1901
|
function useApiPool({
|
|
1830
1902
|
poolId,
|
|
1831
1903
|
account
|
|
@@ -1854,24 +1926,28 @@ function useApiPool({
|
|
|
1854
1926
|
// src/hooks/dex/useCreatePool.ts
|
|
1855
1927
|
import { useMemo as useMemo2 } from "react";
|
|
1856
1928
|
import { PoolType as PoolType2 } from "@berachain-foundation/berancer-sdk";
|
|
1857
|
-
import { keccak256, parseUnits as parseUnits3, zeroAddress as
|
|
1929
|
+
import { keccak256, parseUnits as parseUnits3, zeroAddress as zeroAddress10 } from "viem";
|
|
1858
1930
|
import { poolCreationHelperAbi as balancerPoolCreationHelperAbi } from "@berachain/abis/bex/poolCreationHelper";
|
|
1859
1931
|
|
|
1860
1932
|
// src/utils/poolNamings.ts
|
|
1861
1933
|
import { PoolType } from "@berachain-foundation/berancer-sdk";
|
|
1862
1934
|
import { formatUnits as formatUnits4 } from "viem";
|
|
1863
|
-
|
|
1935
|
+
function sortTokensByAddress(tokens) {
|
|
1864
1936
|
return [...tokens].sort(
|
|
1865
1937
|
(a, b) => a.address.toLowerCase().localeCompare(b.address.toLowerCase())
|
|
1866
1938
|
);
|
|
1867
|
-
}
|
|
1868
|
-
|
|
1939
|
+
}
|
|
1940
|
+
function generatePoolName(tokens) {
|
|
1869
1941
|
if (tokens.length === 0) {
|
|
1870
1942
|
return "";
|
|
1871
1943
|
}
|
|
1872
1944
|
return sortTokensByAddress(tokens).map((token) => token.symbol).join(" | ");
|
|
1873
|
-
}
|
|
1874
|
-
|
|
1945
|
+
}
|
|
1946
|
+
function generatePoolSymbol({
|
|
1947
|
+
tokens,
|
|
1948
|
+
weights,
|
|
1949
|
+
poolType
|
|
1950
|
+
}) {
|
|
1875
1951
|
let poolTypeString;
|
|
1876
1952
|
switch (poolType) {
|
|
1877
1953
|
case PoolType.ComposableStable:
|
|
@@ -1892,7 +1968,7 @@ var generatePoolSymbol = (tokens, weights, poolType) => {
|
|
|
1892
1968
|
}).join("-")}-${poolTypeString}`;
|
|
1893
1969
|
}
|
|
1894
1970
|
return `${sortTokensByAddress(tokens).map((token) => token.symbol).join("-")}-${poolTypeString}`;
|
|
1895
|
-
}
|
|
1971
|
+
}
|
|
1896
1972
|
|
|
1897
1973
|
// src/hooks/dex/useCreatePool.ts
|
|
1898
1974
|
var OracleMode = /* @__PURE__ */ ((OracleMode2) => {
|
|
@@ -1900,7 +1976,7 @@ var OracleMode = /* @__PURE__ */ ((OracleMode2) => {
|
|
|
1900
1976
|
OracleMode2["Custom"] = "Custom";
|
|
1901
1977
|
return OracleMode2;
|
|
1902
1978
|
})(OracleMode || {});
|
|
1903
|
-
|
|
1979
|
+
function createStablePoolArgs({
|
|
1904
1980
|
poolCreationHelper,
|
|
1905
1981
|
poolCreateTokens,
|
|
1906
1982
|
initialLiquidityTokens,
|
|
@@ -1914,7 +1990,7 @@ var createStablePoolArgs = ({
|
|
|
1914
1990
|
message,
|
|
1915
1991
|
actionType,
|
|
1916
1992
|
gasLimit = DEFAULT_METAMASK_GAS_LIMIT
|
|
1917
|
-
})
|
|
1993
|
+
}) {
|
|
1918
1994
|
const sortedPoolCreateAddresses = poolCreateTokens.map((token) => token.address.toLowerCase()).sort((a, b) => a < b ? -1 : 1);
|
|
1919
1995
|
const combinedData = sortedPoolCreateAddresses.map((address) => {
|
|
1920
1996
|
const liquidityToken = initialLiquidityTokens.find(
|
|
@@ -1924,7 +2000,7 @@ var createStablePoolArgs = ({
|
|
|
1924
2000
|
const oracle = oracles.find(
|
|
1925
2001
|
(oracle2) => oracle2.tokenAddress.toLowerCase() === address.toLowerCase()
|
|
1926
2002
|
);
|
|
1927
|
-
const rateProvider = oracle ? oracle.address :
|
|
2003
|
+
const rateProvider = oracle ? oracle.address : zeroAddress10;
|
|
1928
2004
|
const cacheDuration = oracle ? BigInt(oracle.cacheDuration) : BigInt(100);
|
|
1929
2005
|
return { amountIn, rateProvider, cacheDuration };
|
|
1930
2006
|
});
|
|
@@ -1970,8 +2046,8 @@ var createStablePoolArgs = ({
|
|
|
1970
2046
|
}
|
|
1971
2047
|
}
|
|
1972
2048
|
};
|
|
1973
|
-
}
|
|
1974
|
-
|
|
2049
|
+
}
|
|
2050
|
+
function createWeightedPoolArgs({
|
|
1975
2051
|
poolCreationHelper,
|
|
1976
2052
|
poolCreateTokens,
|
|
1977
2053
|
initialLiquidityTokens,
|
|
@@ -1984,7 +2060,7 @@ var createWeightedPoolArgs = ({
|
|
|
1984
2060
|
message,
|
|
1985
2061
|
actionType,
|
|
1986
2062
|
gasLimit = DEFAULT_METAMASK_GAS_LIMIT
|
|
1987
|
-
})
|
|
2063
|
+
}) {
|
|
1988
2064
|
const createPoolTokens = [];
|
|
1989
2065
|
const joinPoolTokens = [];
|
|
1990
2066
|
const sortedWeights = [];
|
|
@@ -2008,7 +2084,7 @@ var createWeightedPoolArgs = ({
|
|
|
2008
2084
|
sortedWeights.push(item.weight);
|
|
2009
2085
|
sortedAmountsIn.push(item.amountIn);
|
|
2010
2086
|
});
|
|
2011
|
-
const nativeTokenIndex = joinPoolTokens.indexOf(
|
|
2087
|
+
const nativeTokenIndex = joinPoolTokens.indexOf(zeroAddress10);
|
|
2012
2088
|
const value = nativeTokenIndex !== -1 ? sortedAmountsIn[nativeTokenIndex] : 0n;
|
|
2013
2089
|
return {
|
|
2014
2090
|
address: poolCreationHelper,
|
|
@@ -2020,7 +2096,7 @@ var createWeightedPoolArgs = ({
|
|
|
2020
2096
|
createPoolTokens,
|
|
2021
2097
|
joinPoolTokens,
|
|
2022
2098
|
sortedWeights,
|
|
2023
|
-
Array(createPoolTokens.length).fill(
|
|
2099
|
+
Array(createPoolTokens.length).fill(zeroAddress10),
|
|
2024
2100
|
swapFeePercentage,
|
|
2025
2101
|
sortedAmountsIn,
|
|
2026
2102
|
owner,
|
|
@@ -2038,8 +2114,8 @@ var createWeightedPoolArgs = ({
|
|
|
2038
2114
|
}
|
|
2039
2115
|
}
|
|
2040
2116
|
};
|
|
2041
|
-
}
|
|
2042
|
-
|
|
2117
|
+
}
|
|
2118
|
+
function useCreatePool({
|
|
2043
2119
|
poolCreateTokens,
|
|
2044
2120
|
initialLiquidityTokens,
|
|
2045
2121
|
normalizedWeights,
|
|
@@ -2051,7 +2127,7 @@ var useCreatePool = ({
|
|
|
2051
2127
|
amplification,
|
|
2052
2128
|
oracles,
|
|
2053
2129
|
...baseArgs
|
|
2054
|
-
})
|
|
2130
|
+
}) {
|
|
2055
2131
|
const { generatedPoolName, generatedPoolSymbol } = useMemo2(() => {
|
|
2056
2132
|
if (!poolCreateTokens) {
|
|
2057
2133
|
return {
|
|
@@ -2060,11 +2136,11 @@ var useCreatePool = ({
|
|
|
2060
2136
|
};
|
|
2061
2137
|
}
|
|
2062
2138
|
const generatedPoolName2 = generatePoolName(poolCreateTokens);
|
|
2063
|
-
const generatedPoolSymbol2 = generatePoolSymbol(
|
|
2064
|
-
poolCreateTokens,
|
|
2065
|
-
normalizedWeights,
|
|
2139
|
+
const generatedPoolSymbol2 = generatePoolSymbol({
|
|
2140
|
+
tokens: poolCreateTokens,
|
|
2141
|
+
weights: normalizedWeights,
|
|
2066
2142
|
poolType
|
|
2067
|
-
);
|
|
2143
|
+
});
|
|
2068
2144
|
return {
|
|
2069
2145
|
generatedPoolName: generatedPoolName2,
|
|
2070
2146
|
generatedPoolSymbol: generatedPoolSymbol2
|
|
@@ -2126,10 +2202,155 @@ var useCreatePool = ({
|
|
|
2126
2202
|
generatedPoolSymbol,
|
|
2127
2203
|
createPoolArgs
|
|
2128
2204
|
};
|
|
2129
|
-
}
|
|
2205
|
+
}
|
|
2206
|
+
|
|
2207
|
+
// src/hooks/dex/useCrossChainNativeFee.ts
|
|
2208
|
+
import { formatEther as formatEther3, zeroAddress as zeroAddress13 } from "viem";
|
|
2209
|
+
|
|
2210
|
+
// src/hooks/tokens/usePollBalance.ts
|
|
2211
|
+
import {
|
|
2212
|
+
erc20Abi,
|
|
2213
|
+
formatEther as formatEther2,
|
|
2214
|
+
formatUnits as formatUnits5,
|
|
2215
|
+
isAddress as isAddress3,
|
|
2216
|
+
zeroAddress as zeroAddress12
|
|
2217
|
+
} from "viem";
|
|
2218
|
+
import { defaultChainId as defaultChainId3 } from "@berachain/config/internal";
|
|
2219
|
+
import { useBeraWallet as useBeraWallet3, usePublicClient as usePublicClient6 } from "@berachain/wagmi/hooks";
|
|
2220
|
+
|
|
2221
|
+
// src/hooks/tokens/useTokenInformation.ts
|
|
2222
|
+
import { isAddress as isAddress2, zeroAddress as zeroAddress11 } from "viem";
|
|
2223
|
+
import { defaultChainId as defaultChainId2 } from "@berachain/config/internal";
|
|
2224
|
+
import { usePublicClient as usePublicClient5 } from "@berachain/wagmi/hooks";
|
|
2225
|
+
function useTokenInformation(args, options) {
|
|
2226
|
+
const publicClient = usePublicClient5({
|
|
2227
|
+
chainId: args.chainId
|
|
2228
|
+
});
|
|
2229
|
+
const QUERY_KEY = args?.address && publicClient && isAddress2(args.address) ? ["useTokenInformation", args.address, args.chainId] : null;
|
|
2230
|
+
return useSWRImmutable(
|
|
2231
|
+
QUERY_KEY,
|
|
2232
|
+
async ([_, address, chainId2 = defaultChainId2]) => {
|
|
2233
|
+
if (isToken(address, "BERA")) {
|
|
2234
|
+
return {
|
|
2235
|
+
address: zeroAddress11,
|
|
2236
|
+
decimals: beraToken.decimals,
|
|
2237
|
+
name: beraToken.name,
|
|
2238
|
+
symbol: beraToken.symbol,
|
|
2239
|
+
chainId: chainId2
|
|
2240
|
+
};
|
|
2241
|
+
}
|
|
2242
|
+
assertPublicClient(publicClient);
|
|
2243
|
+
return await getTokenInformation({
|
|
2244
|
+
address,
|
|
2245
|
+
publicClient,
|
|
2246
|
+
chainId: chainId2
|
|
2247
|
+
});
|
|
2248
|
+
},
|
|
2249
|
+
{ ...options }
|
|
2250
|
+
);
|
|
2251
|
+
}
|
|
2252
|
+
|
|
2253
|
+
// src/hooks/tokens/usePollBalance.ts
|
|
2254
|
+
function usePollBalance({
|
|
2255
|
+
address: addressString,
|
|
2256
|
+
owner,
|
|
2257
|
+
chainId: chainId2 = defaultChainId3
|
|
2258
|
+
}, options) {
|
|
2259
|
+
let address = addressString;
|
|
2260
|
+
if (isToken(address, "ETH")) {
|
|
2261
|
+
address = zeroAddress12;
|
|
2262
|
+
}
|
|
2263
|
+
const publicClient = usePublicClient6({ chainId: chainId2 });
|
|
2264
|
+
const { address: account } = useBeraWallet3();
|
|
2265
|
+
const assetOwner = owner ?? account;
|
|
2266
|
+
const QUERY_KEY = publicClient && assetOwner && isAddress3(assetOwner) && address && isAddress3(address) ? ["usePollBalance", assetOwner, address, chainId2] : null;
|
|
2267
|
+
const { data: tokenInformation, isLoading: isLoadingTokenInformation } = useTokenInformation({ address, chainId: chainId2 });
|
|
2268
|
+
const isNativeToken = isToken(address, "BERA");
|
|
2269
|
+
const { isLoading, data, error, ...rest } = useSWR(
|
|
2270
|
+
QUERY_KEY,
|
|
2271
|
+
async ([, assetOwner2, address2]) => {
|
|
2272
|
+
assertPublicClient(publicClient);
|
|
2273
|
+
if (!isToken(address2, "BERA")) {
|
|
2274
|
+
return await publicClient.readContract({
|
|
2275
|
+
address: address2,
|
|
2276
|
+
abi: erc20Abi,
|
|
2277
|
+
functionName: "balanceOf",
|
|
2278
|
+
args: [assetOwner2]
|
|
2279
|
+
});
|
|
2280
|
+
}
|
|
2281
|
+
return await publicClient.getBalance({
|
|
2282
|
+
address: assetOwner2
|
|
2283
|
+
});
|
|
2284
|
+
},
|
|
2285
|
+
{
|
|
2286
|
+
refreshInterval: 1e4 /* FAST */,
|
|
2287
|
+
...options
|
|
2288
|
+
}
|
|
2289
|
+
);
|
|
2290
|
+
const formattedBalance = !error && data ? isToken(address, "BERA") ? formatEther2(data) : tokenInformation && !isLoadingTokenInformation ? formatUnits5(data, tokenInformation.decimals) : void 0 : void 0;
|
|
2291
|
+
const tokenBalance = {
|
|
2292
|
+
chainId: chainId2,
|
|
2293
|
+
balance: data ? {
|
|
2294
|
+
raw: data.toString(),
|
|
2295
|
+
formatted: formattedBalance ?? "0"
|
|
2296
|
+
} : { raw: "0", formatted: "0" },
|
|
2297
|
+
address,
|
|
2298
|
+
decimals: isNativeToken ? beraToken.decimals : tokenInformation?.decimals ?? 0,
|
|
2299
|
+
symbol: isNativeToken ? beraToken.symbol : tokenInformation?.symbol ?? "",
|
|
2300
|
+
name: isNativeToken ? beraToken.name : tokenInformation?.name ?? ""
|
|
2301
|
+
};
|
|
2302
|
+
return {
|
|
2303
|
+
...rest,
|
|
2304
|
+
isLoading: isNativeToken ? isLoading : isLoading || isLoadingTokenInformation,
|
|
2305
|
+
error,
|
|
2306
|
+
data: tokenBalance
|
|
2307
|
+
};
|
|
2308
|
+
}
|
|
2309
|
+
|
|
2310
|
+
// src/hooks/dex/useCrossChainNativeFee.ts
|
|
2311
|
+
function isNativeFeeInsufficient({
|
|
2312
|
+
isCrossChain,
|
|
2313
|
+
value,
|
|
2314
|
+
nativeBalance,
|
|
2315
|
+
isLoading
|
|
2316
|
+
}) {
|
|
2317
|
+
if (!isCrossChain) return false;
|
|
2318
|
+
return value > 0n && !isLoading && value > nativeBalance;
|
|
2319
|
+
}
|
|
2320
|
+
function useCrossChainNativeFee({
|
|
2321
|
+
srcChainId,
|
|
2322
|
+
value
|
|
2323
|
+
}) {
|
|
2324
|
+
const isCrossChain = srcChainId !== void 0;
|
|
2325
|
+
const { data: nativeBalanceData, isLoading: isNativeBalanceLoading } = usePollBalance(
|
|
2326
|
+
{
|
|
2327
|
+
address: zeroAddress13,
|
|
2328
|
+
chainId: isCrossChain ? srcChainId : void 0
|
|
2329
|
+
},
|
|
2330
|
+
{ isEnabled: isCrossChain }
|
|
2331
|
+
);
|
|
2332
|
+
if (!isCrossChain) {
|
|
2333
|
+
return {
|
|
2334
|
+
nativeFee: void 0,
|
|
2335
|
+
hasInsufficientNativeBalance: false,
|
|
2336
|
+
isNativeBalanceLoading: false
|
|
2337
|
+
};
|
|
2338
|
+
}
|
|
2339
|
+
const nativeBalance = BigInt(nativeBalanceData?.balance.raw ?? 0n);
|
|
2340
|
+
return {
|
|
2341
|
+
nativeFee: value > 0n ? formatEther3(value) : void 0,
|
|
2342
|
+
hasInsufficientNativeBalance: isNativeFeeInsufficient({
|
|
2343
|
+
isCrossChain,
|
|
2344
|
+
value,
|
|
2345
|
+
nativeBalance,
|
|
2346
|
+
isLoading: isNativeBalanceLoading
|
|
2347
|
+
}),
|
|
2348
|
+
isNativeBalanceLoading
|
|
2349
|
+
};
|
|
2350
|
+
}
|
|
2130
2351
|
|
|
2131
2352
|
// src/hooks/dex/useGlobalLiquidityAndSwapVolume.ts
|
|
2132
|
-
|
|
2353
|
+
function useGlobalLiquidityAndSwapVolume() {
|
|
2133
2354
|
const response = useSWR(
|
|
2134
2355
|
"useGlobalLiquidityAndSwapVolume",
|
|
2135
2356
|
async () => getGlobalLiquidityAndSwapVolume()
|
|
@@ -2145,13 +2366,13 @@ var useGlobalLiquidityAndSwapVolume = () => {
|
|
|
2145
2366
|
)
|
|
2146
2367
|
}
|
|
2147
2368
|
};
|
|
2148
|
-
}
|
|
2369
|
+
}
|
|
2149
2370
|
|
|
2150
2371
|
// src/hooks/dex/useLiquidityMismatch.ts
|
|
2151
2372
|
import { useEffect, useState } from "react";
|
|
2152
2373
|
import { PoolType as PoolType3 } from "@berachain-foundation/berancer-sdk";
|
|
2153
2374
|
var DEFAULT_LIQUIDITY_MISMATCH_TOLERANCE_PERCENT = 0.05;
|
|
2154
|
-
|
|
2375
|
+
function useLiquidityMismatch({
|
|
2155
2376
|
currentStep,
|
|
2156
2377
|
tokenPrices,
|
|
2157
2378
|
isLoadingTokenPrices,
|
|
@@ -2161,7 +2382,7 @@ var useLiquidityMismatch = ({
|
|
|
2161
2382
|
poolType,
|
|
2162
2383
|
liquidityMismatchTolerancePercent = DEFAULT_LIQUIDITY_MISMATCH_TOLERANCE_PERCENT,
|
|
2163
2384
|
oracles
|
|
2164
|
-
})
|
|
2385
|
+
}) {
|
|
2165
2386
|
const [liquidityMismatchInfo, setLiquidityMismatchInfo] = useState({ title: null, message: null });
|
|
2166
2387
|
useEffect(() => {
|
|
2167
2388
|
if (!tokenPrices || isLoadingTokenPrices || !tokens || !weights || weightsError || tokens.some((token) => !token.address) || oracles.some((oracle) => oracle.mode === "Custom" /* Custom */)) {
|
|
@@ -2251,27 +2472,27 @@ var useLiquidityMismatch = ({
|
|
|
2251
2472
|
oracles
|
|
2252
2473
|
]);
|
|
2253
2474
|
return liquidityMismatchInfo;
|
|
2254
|
-
}
|
|
2475
|
+
}
|
|
2255
2476
|
|
|
2256
2477
|
// src/hooks/dex/useLpPosition.ts
|
|
2257
|
-
import { formatEther as
|
|
2478
|
+
import { formatEther as formatEther4, isAddressEqual } from "viem";
|
|
2258
2479
|
|
|
2259
2480
|
// src/hooks/pol/useRewardVaultBalanceFromStakingToken.ts
|
|
2260
|
-
import { isAddress as
|
|
2481
|
+
import { isAddress as isAddress5, zeroAddress as zeroAddress15 } from "viem";
|
|
2261
2482
|
import { rewardVaultAbi } from "@berachain/abis/pol/rewards/rewardVault";
|
|
2262
|
-
import { useBeraWallet as
|
|
2483
|
+
import { useBeraWallet as useBeraWallet4, usePublicClient as usePublicClient8 } from "@berachain/wagmi/hooks";
|
|
2263
2484
|
|
|
2264
2485
|
// src/hooks/pol/useRewardVaultFromToken.ts
|
|
2265
|
-
import { isAddress as
|
|
2486
|
+
import { isAddress as isAddress4, zeroAddress as zeroAddress14 } from "viem";
|
|
2266
2487
|
import { rewardVaultFactoryAbi } from "@berachain/abis/pol/rewards/rewardVaultFactory";
|
|
2267
|
-
import { usePublicClient as
|
|
2268
|
-
|
|
2488
|
+
import { usePublicClient as usePublicClient7 } from "@berachain/wagmi/hooks";
|
|
2489
|
+
function useRewardVaultFromToken({
|
|
2269
2490
|
tokenAddress
|
|
2270
2491
|
}, {
|
|
2271
2492
|
isEnabled = true
|
|
2272
|
-
} = {})
|
|
2273
|
-
const publicClient =
|
|
2274
|
-
const QUERY_KEY = publicClient && tokenAddress &&
|
|
2493
|
+
} = {}) {
|
|
2494
|
+
const publicClient = usePublicClient7();
|
|
2495
|
+
const QUERY_KEY = publicClient && tokenAddress && isAddress4(tokenAddress) && isEnabled ? ["useRewardVaultFromToken", tokenAddress] : null;
|
|
2275
2496
|
return useSWRImmutable(
|
|
2276
2497
|
QUERY_KEY,
|
|
2277
2498
|
async ([, tokenAddress2]) => {
|
|
@@ -2288,22 +2509,21 @@ var useRewardVaultFromToken = ({
|
|
|
2288
2509
|
functionName: "getVault",
|
|
2289
2510
|
args: [tokenAddress2]
|
|
2290
2511
|
});
|
|
2291
|
-
return res ===
|
|
2512
|
+
return res === zeroAddress14 ? void 0 : res;
|
|
2292
2513
|
}
|
|
2293
2514
|
);
|
|
2294
|
-
}
|
|
2515
|
+
}
|
|
2295
2516
|
|
|
2296
2517
|
// src/hooks/pol/useRewardVaultBalanceFromStakingToken.ts
|
|
2297
|
-
|
|
2518
|
+
function useRewardVaultBalanceFromStakingToken({
|
|
2298
2519
|
stakingToken,
|
|
2299
2520
|
rewardVaultAddress: _rewardVaultAddress
|
|
2300
|
-
}, options)
|
|
2301
|
-
const { address: account } =
|
|
2302
|
-
const publicClient =
|
|
2521
|
+
}, options) {
|
|
2522
|
+
const { address: account } = useBeraWallet4();
|
|
2523
|
+
const publicClient = usePublicClient8();
|
|
2303
2524
|
const isEnabled = options?.isEnabled ?? true;
|
|
2304
2525
|
const {
|
|
2305
2526
|
data: rewardVaultAddress = _rewardVaultAddress,
|
|
2306
|
-
error,
|
|
2307
2527
|
refresh: mutateRewardVaultAddress,
|
|
2308
2528
|
isLoading: isLoadingRewardVaultAddress
|
|
2309
2529
|
} = useRewardVaultFromToken(
|
|
@@ -2315,10 +2535,10 @@ var useRewardVaultBalanceFromStakingToken = ({
|
|
|
2315
2535
|
}
|
|
2316
2536
|
);
|
|
2317
2537
|
const swrResponse = useSWR(
|
|
2318
|
-
rewardVaultAddress && account && publicClient &&
|
|
2538
|
+
rewardVaultAddress && account && publicClient && isAddress5(rewardVaultAddress) && isAddress5(account) ? ["useVaultBalanceFromStakingToken", rewardVaultAddress, account] : null,
|
|
2319
2539
|
async ([, rewardVaultAddress2, account2]) => {
|
|
2320
2540
|
assertPublicClient(publicClient);
|
|
2321
|
-
if (rewardVaultAddress2 ===
|
|
2541
|
+
if (rewardVaultAddress2 === zeroAddress15) {
|
|
2322
2542
|
return {
|
|
2323
2543
|
address: rewardVaultAddress2,
|
|
2324
2544
|
balance: 0n
|
|
@@ -2345,112 +2565,12 @@ var useRewardVaultBalanceFromStakingToken = ({
|
|
|
2345
2565
|
},
|
|
2346
2566
|
isLoading: swrResponse.isLoading || isLoadingRewardVaultAddress
|
|
2347
2567
|
};
|
|
2348
|
-
}
|
|
2349
|
-
|
|
2350
|
-
// src/hooks/tokens/usePollBalance.ts
|
|
2351
|
-
import {
|
|
2352
|
-
erc20Abi,
|
|
2353
|
-
formatEther as formatEther2,
|
|
2354
|
-
formatUnits as formatUnits5,
|
|
2355
|
-
isAddress as isAddress5,
|
|
2356
|
-
zeroAddress as zeroAddress15
|
|
2357
|
-
} from "viem";
|
|
2358
|
-
import { defaultChainId as defaultChainId3 } from "@berachain/config/internal";
|
|
2359
|
-
import { useBeraWallet as useBeraWallet4, usePublicClient as usePublicClient8 } from "@berachain/wagmi/hooks";
|
|
2568
|
+
}
|
|
2360
2569
|
|
|
2361
|
-
// src/hooks/
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
function useTokenInformation(args, options) {
|
|
2366
|
-
const publicClient = usePublicClient7({
|
|
2367
|
-
chainId: args.chainId
|
|
2368
|
-
});
|
|
2369
|
-
const QUERY_KEY = args?.address && publicClient && isAddress4(args.address) ? ["useTokenInformation", args.address, args.chainId] : null;
|
|
2370
|
-
return useSWRImmutable(
|
|
2371
|
-
QUERY_KEY,
|
|
2372
|
-
async ([_, address, chainId2 = defaultChainId2]) => {
|
|
2373
|
-
if (isToken(address, "BERA")) {
|
|
2374
|
-
return {
|
|
2375
|
-
address: zeroAddress14,
|
|
2376
|
-
decimals: beraToken.decimals,
|
|
2377
|
-
name: beraToken.name,
|
|
2378
|
-
symbol: beraToken.symbol,
|
|
2379
|
-
chainId: chainId2
|
|
2380
|
-
};
|
|
2381
|
-
}
|
|
2382
|
-
assertPublicClient(publicClient);
|
|
2383
|
-
return await getTokenInformation({
|
|
2384
|
-
address,
|
|
2385
|
-
publicClient,
|
|
2386
|
-
chainId: chainId2
|
|
2387
|
-
});
|
|
2388
|
-
},
|
|
2389
|
-
{ ...options }
|
|
2390
|
-
);
|
|
2391
|
-
}
|
|
2392
|
-
|
|
2393
|
-
// src/hooks/tokens/usePollBalance.ts
|
|
2394
|
-
function usePollBalance({
|
|
2395
|
-
address: addressString,
|
|
2396
|
-
owner,
|
|
2397
|
-
chainId: chainId2 = defaultChainId3
|
|
2398
|
-
}, options) {
|
|
2399
|
-
let address = addressString;
|
|
2400
|
-
if (isToken(address, "ETH")) {
|
|
2401
|
-
address = zeroAddress15;
|
|
2402
|
-
}
|
|
2403
|
-
const publicClient = usePublicClient8({ chainId: chainId2 });
|
|
2404
|
-
const { address: account } = useBeraWallet4();
|
|
2405
|
-
const assetOwner = owner ?? account;
|
|
2406
|
-
const QUERY_KEY = publicClient && assetOwner && isAddress5(assetOwner) && address && isAddress5(address) ? ["usePollBalance", assetOwner, address, chainId2] : null;
|
|
2407
|
-
const { data: tokenInformation, isLoading: isLoadingTokenInformation } = useTokenInformation({ address, chainId: chainId2 });
|
|
2408
|
-
const isNativeToken = isToken(address, "BERA");
|
|
2409
|
-
const { isLoading, data, error, ...rest } = useSWR(
|
|
2410
|
-
QUERY_KEY,
|
|
2411
|
-
async ([, assetOwner2, address2]) => {
|
|
2412
|
-
assertPublicClient(publicClient);
|
|
2413
|
-
if (!isToken(address2, "BERA")) {
|
|
2414
|
-
return await publicClient.readContract({
|
|
2415
|
-
address: address2,
|
|
2416
|
-
abi: erc20Abi,
|
|
2417
|
-
functionName: "balanceOf",
|
|
2418
|
-
args: [assetOwner2]
|
|
2419
|
-
});
|
|
2420
|
-
}
|
|
2421
|
-
return await publicClient.getBalance({
|
|
2422
|
-
address: assetOwner2
|
|
2423
|
-
});
|
|
2424
|
-
},
|
|
2425
|
-
{
|
|
2426
|
-
refreshInterval: 1e4 /* FAST */,
|
|
2427
|
-
...options
|
|
2428
|
-
}
|
|
2429
|
-
);
|
|
2430
|
-
const formattedBalance = !error && data ? isToken(address, "BERA") ? formatEther2(data) : tokenInformation && !isLoadingTokenInformation ? formatUnits5(data, tokenInformation.decimals) : void 0 : void 0;
|
|
2431
|
-
const tokenBalance = {
|
|
2432
|
-
chainId: chainId2,
|
|
2433
|
-
balance: data ? {
|
|
2434
|
-
raw: data.toString(),
|
|
2435
|
-
formatted: formattedBalance ?? "0"
|
|
2436
|
-
} : { raw: "0", formatted: "0" },
|
|
2437
|
-
address,
|
|
2438
|
-
decimals: isNativeToken ? beraToken.decimals : tokenInformation?.decimals ?? 0,
|
|
2439
|
-
symbol: isNativeToken ? beraToken.symbol : tokenInformation?.symbol ?? "",
|
|
2440
|
-
name: isNativeToken ? beraToken.name : tokenInformation?.name ?? ""
|
|
2441
|
-
};
|
|
2442
|
-
return {
|
|
2443
|
-
...rest,
|
|
2444
|
-
isLoading: isLoading || isNativeToken ? isLoadingTokenInformation : false,
|
|
2445
|
-
error: error || !isNativeToken ? error : void 0,
|
|
2446
|
-
data: tokenBalance
|
|
2447
|
-
};
|
|
2448
|
-
}
|
|
2449
|
-
|
|
2450
|
-
// src/hooks/dex/useLpPosition.ts
|
|
2451
|
-
var useLpPosition = ({ pool, vaultAddress }, options) => {
|
|
2452
|
-
const { data: userPosition, ...rest } = usePollBalance({
|
|
2453
|
-
address: pool?.address
|
|
2570
|
+
// src/hooks/dex/useLpPosition.ts
|
|
2571
|
+
function useLpPosition({ pool, vaultAddress }, options) {
|
|
2572
|
+
const { data: userPosition, ...rest } = usePollBalance({
|
|
2573
|
+
address: pool?.address
|
|
2454
2574
|
});
|
|
2455
2575
|
const { data: userVaultTokenBalance, refresh: refreshVaultDeposit } = useRewardVaultBalanceFromStakingToken(
|
|
2456
2576
|
{
|
|
@@ -2496,9 +2616,9 @@ var useLpPosition = ({ pool, vaultAddress }, options) => {
|
|
|
2496
2616
|
balance: {
|
|
2497
2617
|
raw: userVaultTokenBalance.balance.toString(),
|
|
2498
2618
|
// Pools always use the 18 decimals
|
|
2499
|
-
formatted:
|
|
2619
|
+
formatted: formatEther4(userVaultTokenBalance.balance)
|
|
2500
2620
|
},
|
|
2501
|
-
usdValue: Number(
|
|
2621
|
+
usdValue: Number(formatEther4(userVaultTokenBalance.balance)) * lpTokenPrice
|
|
2502
2622
|
} : void 0
|
|
2503
2623
|
},
|
|
2504
2624
|
...rest,
|
|
@@ -2507,7 +2627,7 @@ var useLpPosition = ({ pool, vaultAddress }, options) => {
|
|
|
2507
2627
|
refreshVaultDeposit();
|
|
2508
2628
|
}
|
|
2509
2629
|
};
|
|
2510
|
-
}
|
|
2630
|
+
}
|
|
2511
2631
|
|
|
2512
2632
|
// src/hooks/dex/useMultipleTokenApprovalsWithSlippage.ts
|
|
2513
2633
|
import { useMemo as useMemo3 } from "react";
|
|
@@ -2600,13 +2720,33 @@ function useMultipleTokenApprovalsWithSlippage(tokenInput, options) {
|
|
|
2600
2720
|
|
|
2601
2721
|
// src/hooks/dex/useOnChainPoolData.ts
|
|
2602
2722
|
import { useMemo as useMemo5 } from "react";
|
|
2603
|
-
import { formatUnits as formatUnits6, isAddress as
|
|
2723
|
+
import { formatUnits as formatUnits6, isAddress as isAddress7 } from "viem";
|
|
2604
2724
|
import { usePublicClient as usePublicClient10 } from "@berachain/wagmi/hooks";
|
|
2605
2725
|
|
|
2606
2726
|
// src/hooks/tokens/useMultipleTokenInformation.ts
|
|
2607
|
-
import { isAddress as isAddress6 } from "viem";
|
|
2608
2727
|
import { defaultChainId as defaultChainId4 } from "@berachain/config/internal";
|
|
2609
2728
|
import { usePublicClient as usePublicClient9 } from "@berachain/wagmi/hooks";
|
|
2729
|
+
async function fetchMultipleTokenInformation({
|
|
2730
|
+
addresses,
|
|
2731
|
+
publicClient,
|
|
2732
|
+
chainId: chainId2
|
|
2733
|
+
}) {
|
|
2734
|
+
const settled = await Promise.allSettled(
|
|
2735
|
+
addresses.map(async (address) => {
|
|
2736
|
+
assertAddress(address, "address");
|
|
2737
|
+
const tk = await getTokenInformation({
|
|
2738
|
+
address,
|
|
2739
|
+
publicClient,
|
|
2740
|
+
chainId: chainId2
|
|
2741
|
+
});
|
|
2742
|
+
if (!tk) {
|
|
2743
|
+
throw new Error(`Token ${address} not found`);
|
|
2744
|
+
}
|
|
2745
|
+
return tk;
|
|
2746
|
+
})
|
|
2747
|
+
);
|
|
2748
|
+
return settled.filter((r) => r.status === "fulfilled").map((r) => r.value);
|
|
2749
|
+
}
|
|
2610
2750
|
function useMultipleTokenInformation(args, options) {
|
|
2611
2751
|
const publicClient = usePublicClient9();
|
|
2612
2752
|
const QUERY_KEY = publicClient && args.addresses ? [
|
|
@@ -2618,22 +2758,11 @@ function useMultipleTokenInformation(args, options) {
|
|
|
2618
2758
|
QUERY_KEY,
|
|
2619
2759
|
async ([, addresses, chainId2]) => {
|
|
2620
2760
|
assertPublicClient(publicClient);
|
|
2621
|
-
return
|
|
2622
|
-
addresses
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
const tk = await getTokenInformation({
|
|
2627
|
-
address,
|
|
2628
|
-
publicClient,
|
|
2629
|
-
chainId: chainId2
|
|
2630
|
-
});
|
|
2631
|
-
if (!tk) {
|
|
2632
|
-
throw new Error(`Token ${address} not found`);
|
|
2633
|
-
}
|
|
2634
|
-
return tk;
|
|
2635
|
-
})
|
|
2636
|
-
);
|
|
2761
|
+
return fetchMultipleTokenInformation({
|
|
2762
|
+
addresses,
|
|
2763
|
+
publicClient,
|
|
2764
|
+
chainId: chainId2
|
|
2765
|
+
});
|
|
2637
2766
|
},
|
|
2638
2767
|
{ ...options }
|
|
2639
2768
|
);
|
|
@@ -2641,7 +2770,7 @@ function useMultipleTokenInformation(args, options) {
|
|
|
2641
2770
|
|
|
2642
2771
|
// src/hooks/tokens/useTokenCurrentPrices.ts
|
|
2643
2772
|
import { useMemo as useMemo4 } from "react";
|
|
2644
|
-
import { isAddress as
|
|
2773
|
+
import { isAddress as isAddress6, zeroAddress as zeroAddress17 } from "viem";
|
|
2645
2774
|
import { defaultChainId as defaultChainId5 } from "@berachain/config/internal";
|
|
2646
2775
|
|
|
2647
2776
|
// src/hooks/tokens/useTokens.ts
|
|
@@ -2679,7 +2808,7 @@ function useTokenCurrentPrices({
|
|
|
2679
2808
|
const addresses2 = [];
|
|
2680
2809
|
if (addressIn) {
|
|
2681
2810
|
addresses2.push(
|
|
2682
|
-
...addressIn.filter((a) =>
|
|
2811
|
+
...addressIn.filter((a) => isAddress6(a))
|
|
2683
2812
|
);
|
|
2684
2813
|
}
|
|
2685
2814
|
return addresses2.map((a) => a.toLowerCase());
|
|
@@ -2751,7 +2880,7 @@ function useTokenCurrentPrices({
|
|
|
2751
2880
|
// src/hooks/dex/useOnChainPoolData.ts
|
|
2752
2881
|
function useOnChainPoolDataQueryKey(args) {
|
|
2753
2882
|
const address = "poolId" in args ? args.poolId?.slice(0, 42) : args.address;
|
|
2754
|
-
const isAddressValid =
|
|
2883
|
+
const isAddressValid = isAddress7(address);
|
|
2755
2884
|
const isValid = isAddressValid;
|
|
2756
2885
|
return isValid && address ? ["useOnChainPoolData", address] : null;
|
|
2757
2886
|
}
|
|
@@ -2785,18 +2914,15 @@ function useOnChainPoolData(poolId) {
|
|
|
2785
2914
|
if (!poolData || !tokenInformation) {
|
|
2786
2915
|
return void 0;
|
|
2787
2916
|
}
|
|
2788
|
-
const
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
createTime: 0,
|
|
2798
|
-
name: poolData.name,
|
|
2799
|
-
tokens: tokenInformation.map((token, idx) => ({
|
|
2917
|
+
const infoByAddress = new Map(
|
|
2918
|
+
tokenInformation.map(
|
|
2919
|
+
(token) => [token.address.toLowerCase(), token]
|
|
2920
|
+
)
|
|
2921
|
+
);
|
|
2922
|
+
const tokens = poolData.poolTokens[0].map((rawAddress, idx) => {
|
|
2923
|
+
const token = infoByAddress.get(rawAddress.toLowerCase());
|
|
2924
|
+
if (!token) return null;
|
|
2925
|
+
return {
|
|
2800
2926
|
address: token.address.toLowerCase(),
|
|
2801
2927
|
name: token.name,
|
|
2802
2928
|
decimals: token.decimals,
|
|
@@ -2812,7 +2938,23 @@ function useOnChainPoolData(poolId) {
|
|
|
2812
2938
|
token,
|
|
2813
2939
|
latestUSDPrice: tokenPrices?.[token.address]
|
|
2814
2940
|
}
|
|
2815
|
-
}
|
|
2941
|
+
};
|
|
2942
|
+
});
|
|
2943
|
+
if (tokens.some((token) => token === null)) {
|
|
2944
|
+
return void 0;
|
|
2945
|
+
}
|
|
2946
|
+
const pool2 = {
|
|
2947
|
+
address: address.toLowerCase(),
|
|
2948
|
+
id: poolId.toLowerCase(),
|
|
2949
|
+
type: poolData.type,
|
|
2950
|
+
factory: poolData.factory,
|
|
2951
|
+
totalShares: poolData.totalSupply,
|
|
2952
|
+
totalLiquidity: "0",
|
|
2953
|
+
// overwritten below
|
|
2954
|
+
swapFee: poolData.swapFee,
|
|
2955
|
+
createTime: 0,
|
|
2956
|
+
name: poolData.name,
|
|
2957
|
+
tokens,
|
|
2816
2958
|
amplificationParameter: poolData?.amplificationParameter && {
|
|
2817
2959
|
// For example, if value is 300000n and precision is 1000n, the user-set amplification parameter would be 300000n / 1000n = 300n.
|
|
2818
2960
|
currentFormattedValue: Number(poolData.amplificationParameter[0]) / Number(poolData.amplificationParameter[2])
|
|
@@ -2839,7 +2981,7 @@ function useOnChainPoolData(poolId) {
|
|
|
2839
2981
|
// src/hooks/dex/usePollPoolCreationRelayerApproval.ts
|
|
2840
2982
|
import { vaultAbi as balancerVaultAbi2 } from "@berachain/abis/bex/vault";
|
|
2841
2983
|
import { useBeraWallet as useBeraWallet6, usePublicClient as usePublicClient11 } from "@berachain/wagmi/hooks";
|
|
2842
|
-
|
|
2984
|
+
function usePollPoolCreationRelayerApproval(options) {
|
|
2843
2985
|
const { address: account } = useBeraWallet6();
|
|
2844
2986
|
const publicClient = usePublicClient11();
|
|
2845
2987
|
const QUERY_KEY = account && publicClient ? [
|
|
@@ -2862,7 +3004,7 @@ var usePollPoolCreationRelayerApproval = (options) => {
|
|
|
2862
3004
|
},
|
|
2863
3005
|
{ ...options }
|
|
2864
3006
|
);
|
|
2865
|
-
}
|
|
3007
|
+
}
|
|
2866
3008
|
|
|
2867
3009
|
// src/hooks/dex/usePool.ts
|
|
2868
3010
|
function usePool({ poolId }) {
|
|
@@ -2885,10 +3027,10 @@ function usePool({ poolId }) {
|
|
|
2885
3027
|
}
|
|
2886
3028
|
|
|
2887
3029
|
// src/hooks/dex/usePoolEvents.ts
|
|
2888
|
-
|
|
3030
|
+
function usePoolEvents({
|
|
2889
3031
|
poolId,
|
|
2890
3032
|
typeInArray
|
|
2891
|
-
})
|
|
3033
|
+
}) {
|
|
2892
3034
|
return useSWRImmutable(
|
|
2893
3035
|
poolId ? ["usePoolEvents", poolId, typeInArray] : null,
|
|
2894
3036
|
async ([, poolId2, typeInArray2]) => getPoolEvents({ poolId: poolId2, typeInArray: typeInArray2 }),
|
|
@@ -2896,10 +3038,10 @@ var usePoolEvents = ({
|
|
|
2896
3038
|
refreshInterval: 18e4 /* SLOW */
|
|
2897
3039
|
}
|
|
2898
3040
|
);
|
|
2899
|
-
}
|
|
3041
|
+
}
|
|
2900
3042
|
|
|
2901
3043
|
// src/hooks/dex/usePoolHistoricalData.ts
|
|
2902
|
-
|
|
3044
|
+
function usePoolHistoricalData({ poolId, ...baseArgs }, options) {
|
|
2903
3045
|
const { config } = parseBaseArgs(baseArgs);
|
|
2904
3046
|
const QUERY_KEY = poolId ? ["usePoolHistoricalData", poolId] : null;
|
|
2905
3047
|
return useSWR(
|
|
@@ -2912,17 +3054,17 @@ var usePoolHistoricalData = ({ poolId, ...baseArgs }, options) => {
|
|
|
2912
3054
|
},
|
|
2913
3055
|
options
|
|
2914
3056
|
);
|
|
2915
|
-
}
|
|
3057
|
+
}
|
|
2916
3058
|
|
|
2917
3059
|
// src/hooks/dex/usePools.ts
|
|
2918
3060
|
import { useMemo as useMemo6 } from "react";
|
|
2919
3061
|
import { useBeraWallet as useBeraWallet7 } from "@berachain/wagmi/hooks";
|
|
2920
|
-
|
|
3062
|
+
function usePoolsQueryKey({
|
|
2921
3063
|
query
|
|
2922
|
-
} = {})
|
|
3064
|
+
} = {}) {
|
|
2923
3065
|
return ["useAllPools", query];
|
|
2924
|
-
}
|
|
2925
|
-
|
|
3066
|
+
}
|
|
3067
|
+
function usePools(query, options) {
|
|
2926
3068
|
const { address: account } = useBeraWallet7();
|
|
2927
3069
|
const {
|
|
2928
3070
|
data: userPools,
|
|
@@ -2975,7 +3117,7 @@ var usePools = (query, options) => {
|
|
|
2975
3117
|
},
|
|
2976
3118
|
pagination
|
|
2977
3119
|
};
|
|
2978
|
-
}
|
|
3120
|
+
}
|
|
2979
3121
|
|
|
2980
3122
|
// src/hooks/dex/usePriceImpact.ts
|
|
2981
3123
|
import { useMemo as useMemo8 } from "react";
|
|
@@ -3081,12 +3223,12 @@ function usePriceImpact({
|
|
|
3081
3223
|
if (!tokenIn || !tokenOut || !formattedAmountIn || !formattedAmountOut)
|
|
3082
3224
|
return void 0;
|
|
3083
3225
|
if (tokenInPrice == null || tokenOutPrice == null) return null;
|
|
3084
|
-
return computePriceImpact(
|
|
3085
|
-
tokenInPrice.toString(),
|
|
3086
|
-
tokenOutPrice.toString(),
|
|
3087
|
-
formattedAmountIn,
|
|
3088
|
-
formattedAmountOut
|
|
3089
|
-
);
|
|
3226
|
+
return computePriceImpact({
|
|
3227
|
+
tokenInPrice: tokenInPrice.toString(),
|
|
3228
|
+
tokenOutPrice: tokenOutPrice.toString(),
|
|
3229
|
+
inAmount: formattedAmountIn,
|
|
3230
|
+
outAmount: formattedAmountOut
|
|
3231
|
+
});
|
|
3090
3232
|
}, [
|
|
3091
3233
|
tokenIn,
|
|
3092
3234
|
tokenOut,
|
|
@@ -3138,52 +3280,6 @@ function toBigIntOrUndefined(value) {
|
|
|
3138
3280
|
}
|
|
3139
3281
|
return typeof value === "bigint" ? value : BigInt(value);
|
|
3140
3282
|
}
|
|
3141
|
-
async function getTransactionsFromBundle({
|
|
3142
|
-
fromAddress,
|
|
3143
|
-
amountIn,
|
|
3144
|
-
tokenIn,
|
|
3145
|
-
chainId: chainId2,
|
|
3146
|
-
ensoClient,
|
|
3147
|
-
bundle,
|
|
3148
|
-
publicClient
|
|
3149
|
-
}) {
|
|
3150
|
-
const transactions = [];
|
|
3151
|
-
if (tokenIn !== ethAddress) {
|
|
3152
|
-
const approvalRequest = await ensoClient.getApprovalData({
|
|
3153
|
-
fromAddress,
|
|
3154
|
-
tokenAddress: tokenIn,
|
|
3155
|
-
chainId: chainId2,
|
|
3156
|
-
amount: amountIn
|
|
3157
|
-
});
|
|
3158
|
-
let requiresApproval = true;
|
|
3159
|
-
if (publicClient) {
|
|
3160
|
-
const currentAllowance = await publicClient.readContract({
|
|
3161
|
-
address: tokenIn,
|
|
3162
|
-
abi: erc20Abi2,
|
|
3163
|
-
functionName: "allowance",
|
|
3164
|
-
args: [fromAddress, approvalRequest.spender]
|
|
3165
|
-
});
|
|
3166
|
-
requiresApproval = currentAllowance < BigInt(amountIn);
|
|
3167
|
-
}
|
|
3168
|
-
if (requiresApproval) {
|
|
3169
|
-
const approvalValue = toBigIntOrUndefined(approvalRequest.tx.value) ?? 0n;
|
|
3170
|
-
transactions.push({
|
|
3171
|
-
to: approvalRequest.tx.to,
|
|
3172
|
-
data: approvalRequest.tx.data,
|
|
3173
|
-
value: approvalValue,
|
|
3174
|
-
gasLimit: BigInt(approvalRequest.gas)
|
|
3175
|
-
});
|
|
3176
|
-
}
|
|
3177
|
-
}
|
|
3178
|
-
const bundleValue = toBigIntOrUndefined(bundle.tx.value) ?? 0n;
|
|
3179
|
-
transactions.push({
|
|
3180
|
-
to: bundle.tx.to,
|
|
3181
|
-
data: bundle.tx.data,
|
|
3182
|
-
value: bundleValue,
|
|
3183
|
-
gasLimit: BigInt(bundle.gas)
|
|
3184
|
-
});
|
|
3185
|
-
return transactions;
|
|
3186
|
-
}
|
|
3187
3283
|
async function getEnsoWalletTransactionsWithApproval({
|
|
3188
3284
|
fromAddress,
|
|
3189
3285
|
amountIn,
|
|
@@ -3818,7 +3914,6 @@ async function getBendMultiplyBundle({
|
|
|
3818
3914
|
leverageMultiplier,
|
|
3819
3915
|
slippage
|
|
3820
3916
|
});
|
|
3821
|
-
const CALLBACK_IDX_ROUTE_LOAN_TO_COLLATERAL = 0;
|
|
3822
3917
|
const CALLBACK_IDX_BALANCE_COLLATERAL = 1;
|
|
3823
3918
|
const depositOnlyActions = [
|
|
3824
3919
|
{
|
|
@@ -4044,152 +4139,8 @@ function useBendMultiply({
|
|
|
4044
4139
|
}
|
|
4045
4140
|
|
|
4046
4141
|
// src/hooks/enso/useBendZapSupply.ts
|
|
4047
|
-
import {
|
|
4048
|
-
import { defaultChainId as berachainChainId } from "@berachain/config/internal";
|
|
4142
|
+
import { parseUnits as parseUnits7, zeroAddress as zeroAddress19 } from "viem";
|
|
4049
4143
|
import { useBeraWallet as useBeraWallet12, usePublicClient as usePublicClient16 } from "@berachain/wagmi/hooks";
|
|
4050
|
-
|
|
4051
|
-
// src/actions/dex/aggregators/enso/ensoErc4626.ts
|
|
4052
|
-
import { ethAddress as ethAddress2, zeroAddress as zeroAddress19 } from "viem";
|
|
4053
|
-
var EnsoErc4626Aggregator = class extends BaseAggregator {
|
|
4054
|
-
name = "Enso (Mint)" /* EnsoErc4626 */;
|
|
4055
|
-
supportedChains = null;
|
|
4056
|
-
type = "rest";
|
|
4057
|
-
needsAccountForQuote = true;
|
|
4058
|
-
notFoundMessages = [
|
|
4059
|
-
"Could not build shortcuts for route",
|
|
4060
|
-
"Could not quote shortcuts for route",
|
|
4061
|
-
"Swap not found for a required underlying of defi route,",
|
|
4062
|
-
"No route found from"
|
|
4063
|
-
];
|
|
4064
|
-
async getQuote({
|
|
4065
|
-
tokenIn,
|
|
4066
|
-
tokenOut,
|
|
4067
|
-
amount,
|
|
4068
|
-
slippage,
|
|
4069
|
-
account = zeroAddress19,
|
|
4070
|
-
aggregatorsFeeBps,
|
|
4071
|
-
proxyAggregatorsThroughVercel = false,
|
|
4072
|
-
rewardVault,
|
|
4073
|
-
underlyingToken
|
|
4074
|
-
}) {
|
|
4075
|
-
this.assertChainSupport({ tokenIn, tokenOut });
|
|
4076
|
-
assertAddress(account, "account");
|
|
4077
|
-
const ensoClient = getEnsoClient({
|
|
4078
|
-
baseURL: proxyAggregatorsThroughVercel ? "/api/enso" : void 0
|
|
4079
|
-
});
|
|
4080
|
-
if (tokenIn.address === zeroAddress19) tokenIn.address = ethAddress2;
|
|
4081
|
-
if (tokenOut.address === zeroAddress19) tokenOut.address = ethAddress2;
|
|
4082
|
-
const zapTokenOut = underlyingToken ?? tokenOut;
|
|
4083
|
-
const bundleActions = [
|
|
4084
|
-
// this is the base route action, which will swap the token in to the zap token out
|
|
4085
|
-
// it handles cross-chain swaps and refunds the user if the swap fails
|
|
4086
|
-
// this might even be the only action if no underlying token or reward vault is provided
|
|
4087
|
-
{
|
|
4088
|
-
protocol: "enso",
|
|
4089
|
-
action: "route",
|
|
4090
|
-
args: {
|
|
4091
|
-
tokenIn: tokenIn.address,
|
|
4092
|
-
tokenOut: zapTokenOut.address,
|
|
4093
|
-
destinationChainId: (
|
|
4094
|
-
// must be undefined if the token is the same chain
|
|
4095
|
-
tokenIn.chainId === zapTokenOut.chainId ? void 0 : zapTokenOut.chainId
|
|
4096
|
-
),
|
|
4097
|
-
refundReceiver: account,
|
|
4098
|
-
amountIn: amount,
|
|
4099
|
-
slippage: slippage * 100
|
|
4100
|
-
// Enso expects slippage in basis points
|
|
4101
|
-
}
|
|
4102
|
-
}
|
|
4103
|
-
];
|
|
4104
|
-
if (underlyingToken) {
|
|
4105
|
-
bundleActions.push({
|
|
4106
|
-
protocol: "erc4626",
|
|
4107
|
-
action: "deposit",
|
|
4108
|
-
args: {
|
|
4109
|
-
amountIn: { useOutputOfCallAt: 0 },
|
|
4110
|
-
tokenIn: underlyingToken.address,
|
|
4111
|
-
primaryAddress: tokenOut.address,
|
|
4112
|
-
tokenOut: tokenOut.address
|
|
4113
|
-
}
|
|
4114
|
-
});
|
|
4115
|
-
}
|
|
4116
|
-
if (rewardVault) {
|
|
4117
|
-
const offset = bundleActions.length;
|
|
4118
|
-
bundleActions.push(
|
|
4119
|
-
{
|
|
4120
|
-
protocol: "enso",
|
|
4121
|
-
action: "balance",
|
|
4122
|
-
args: {
|
|
4123
|
-
token: tokenOut.address
|
|
4124
|
-
}
|
|
4125
|
-
},
|
|
4126
|
-
{
|
|
4127
|
-
protocol: "erc20",
|
|
4128
|
-
action: "approve",
|
|
4129
|
-
args: {
|
|
4130
|
-
amount: { useOutputOfCallAt: offset },
|
|
4131
|
-
spender: rewardVault,
|
|
4132
|
-
token: tokenOut.address
|
|
4133
|
-
}
|
|
4134
|
-
},
|
|
4135
|
-
{
|
|
4136
|
-
protocol: "enso",
|
|
4137
|
-
action: "call",
|
|
4138
|
-
args: {
|
|
4139
|
-
address: rewardVault,
|
|
4140
|
-
args: [account, { useOutputOfCallAt: offset }],
|
|
4141
|
-
method: "stakeOnBehalf",
|
|
4142
|
-
abi: "function stakeOnBehalf(address account, uint256 amount) external"
|
|
4143
|
-
}
|
|
4144
|
-
},
|
|
4145
|
-
{
|
|
4146
|
-
protocol: "enso",
|
|
4147
|
-
action: "balance",
|
|
4148
|
-
args: {
|
|
4149
|
-
token: rewardVault
|
|
4150
|
-
}
|
|
4151
|
-
}
|
|
4152
|
-
);
|
|
4153
|
-
}
|
|
4154
|
-
const bundle = await ensoClient.getBundleData(
|
|
4155
|
-
{
|
|
4156
|
-
fromAddress: account,
|
|
4157
|
-
receiver: account,
|
|
4158
|
-
spender: account,
|
|
4159
|
-
chainId: tokenIn.chainId,
|
|
4160
|
-
routingStrategy: "router"
|
|
4161
|
-
},
|
|
4162
|
-
bundleActions
|
|
4163
|
-
);
|
|
4164
|
-
const tokenOutAddress = rewardVault?.toLowerCase() ?? tokenOut.address.toLowerCase();
|
|
4165
|
-
const amountOut = (
|
|
4166
|
-
// @ts-expect-error enso has not typed this but is returned sometimes from API.
|
|
4167
|
-
bundle.minAmountsOut?.[tokenOutAddress] ?? bundle.amountsOut[tokenOutAddress] ?? "0"
|
|
4168
|
-
);
|
|
4169
|
-
return {
|
|
4170
|
-
amountOut,
|
|
4171
|
-
amountIn: amount,
|
|
4172
|
-
allowanceRequirements: this.parseAllowanceRequirements({
|
|
4173
|
-
tokenIn,
|
|
4174
|
-
rawAmount: amount,
|
|
4175
|
-
spender: bundle.tx.to
|
|
4176
|
-
}),
|
|
4177
|
-
name: this.name,
|
|
4178
|
-
swapFeeBps: 0,
|
|
4179
|
-
priceImpactPercentage: bundle.priceImpact ? bundle.priceImpact / 100 : null,
|
|
4180
|
-
getCalldata: () => ({
|
|
4181
|
-
address: bundle.tx.to,
|
|
4182
|
-
data: bundle.tx.data,
|
|
4183
|
-
value: BigInt(bundle.tx.value ?? 0)
|
|
4184
|
-
// not returning gas limit because it's usually underestimated by enso.
|
|
4185
|
-
// gasLimit: BigInt(bundle.gas),
|
|
4186
|
-
})
|
|
4187
|
-
};
|
|
4188
|
-
}
|
|
4189
|
-
};
|
|
4190
|
-
var ensoErc4626 = new EnsoErc4626Aggregator();
|
|
4191
|
-
|
|
4192
|
-
// src/hooks/enso/useBendZapSupply.ts
|
|
4193
4144
|
function useBendZapSupply({
|
|
4194
4145
|
tokenIn,
|
|
4195
4146
|
loanToken,
|
|
@@ -4198,9 +4149,6 @@ function useBendZapSupply({
|
|
|
4198
4149
|
amount,
|
|
4199
4150
|
slippage
|
|
4200
4151
|
}, options) {
|
|
4201
|
-
const { getTokenPrice } = useTokenPrices({
|
|
4202
|
-
tokens: tokenIn && loanToken ? [tokenIn, loanToken] : void 0
|
|
4203
|
-
});
|
|
4204
4152
|
const swrResponse = useBendZapSupplyHelper(
|
|
4205
4153
|
{
|
|
4206
4154
|
tokenIn,
|
|
@@ -4229,21 +4177,12 @@ function useBendZapSupply({
|
|
|
4229
4177
|
formattedAmountOut: zapSupplyAmount?.formatted ?? "0"
|
|
4230
4178
|
}
|
|
4231
4179
|
);
|
|
4232
|
-
const isCrossChain =
|
|
4233
|
-
const
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
{ isEnabled: !!isCrossChain }
|
|
4239
|
-
);
|
|
4240
|
-
const transactionValue = swrResponse.data?.getCalldata?.({ account: zeroAddress20 })?.value ?? 0n;
|
|
4241
|
-
const nativeBalance = nativeBalanceData?.balance ?? {
|
|
4242
|
-
raw: "0",
|
|
4243
|
-
formatted: "0"
|
|
4244
|
-
};
|
|
4245
|
-
const hasInsufficientNativeBalance = isCrossChain && transactionValue > 0n && !isNativeBalanceLoading && transactionValue > BigInt(nativeBalance.raw);
|
|
4246
|
-
const nativeFee = isCrossChain && transactionValue > 0n ? formatEther4(transactionValue) : void 0;
|
|
4180
|
+
const isCrossChain = swrResponse.data?.isCrossChain;
|
|
4181
|
+
const transactionValue = swrResponse.data?.getCalldata?.({ account: zeroAddress19 })?.value ?? 0n;
|
|
4182
|
+
const { hasInsufficientNativeBalance, nativeFee } = useCrossChainNativeFee({
|
|
4183
|
+
srcChainId: isCrossChain ? swrResponse.data?.srcChainId : void 0,
|
|
4184
|
+
value: transactionValue
|
|
4185
|
+
});
|
|
4247
4186
|
return {
|
|
4248
4187
|
...swrResponse,
|
|
4249
4188
|
zapSupplyAmount,
|
|
@@ -4318,201 +4257,18 @@ function useBendZapSupplyHelper({
|
|
|
4318
4257
|
);
|
|
4319
4258
|
}
|
|
4320
4259
|
|
|
4321
|
-
// src/hooks/enso/
|
|
4322
|
-
import {
|
|
4323
|
-
import {
|
|
4324
|
-
import {
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
async function getEnsoSwapBundle({
|
|
4330
|
-
fromAddress,
|
|
4331
|
-
amountIn,
|
|
4332
|
-
tokenIn,
|
|
4333
|
-
tokenOut,
|
|
4334
|
-
chainId: chainId2,
|
|
4335
|
-
ensoClient,
|
|
4336
|
-
destinationChainId,
|
|
4337
|
-
slippage,
|
|
4338
|
-
publicClient
|
|
4339
|
-
}) {
|
|
4340
|
-
if (!fromAddress) {
|
|
4341
|
-
throw new InvalidArgumentError({
|
|
4342
|
-
property: "fromAddress",
|
|
4343
|
-
value: fromAddress,
|
|
4344
|
-
expected: "address"
|
|
4345
|
-
});
|
|
4346
|
-
}
|
|
4347
|
-
if (tokenOut === zeroAddress21) tokenOut = ethAddress3;
|
|
4348
|
-
const bundleAction = {
|
|
4349
|
-
protocol: "enso",
|
|
4350
|
-
action: "route",
|
|
4351
|
-
args: {
|
|
4352
|
-
tokenIn,
|
|
4353
|
-
tokenOut,
|
|
4354
|
-
amountIn,
|
|
4355
|
-
slippage: slippage * 100
|
|
4356
|
-
// Enso expects slippage in basis points
|
|
4357
|
-
}
|
|
4358
|
-
};
|
|
4359
|
-
if (destinationChainId && destinationChainId !== chainId2) {
|
|
4360
|
-
bundleAction.args = {
|
|
4361
|
-
...bundleAction.args,
|
|
4362
|
-
destinationChainId,
|
|
4363
|
-
refundReceiver: fromAddress
|
|
4364
|
-
};
|
|
4365
|
-
}
|
|
4366
|
-
const bundle = await ensoClient.getBundleData(
|
|
4367
|
-
{
|
|
4368
|
-
fromAddress,
|
|
4369
|
-
receiver: fromAddress,
|
|
4370
|
-
spender: fromAddress,
|
|
4371
|
-
chainId: chainId2,
|
|
4372
|
-
routingStrategy: "router"
|
|
4373
|
-
},
|
|
4374
|
-
[bundleAction]
|
|
4375
|
-
);
|
|
4376
|
-
const transactions = await getTransactionsFromBundle({
|
|
4377
|
-
fromAddress,
|
|
4378
|
-
amountIn,
|
|
4379
|
-
tokenIn,
|
|
4380
|
-
chainId: chainId2,
|
|
4381
|
-
ensoClient,
|
|
4382
|
-
bundle,
|
|
4383
|
-
publicClient
|
|
4384
|
-
});
|
|
4385
|
-
return {
|
|
4386
|
-
bundle,
|
|
4387
|
-
transactions
|
|
4388
|
-
};
|
|
4389
|
-
}
|
|
4390
|
-
|
|
4391
|
-
// src/hooks/tokens/usePollWalletBalances.ts
|
|
4392
|
-
import { useMemo as useMemo9 } from "react";
|
|
4393
|
-
import {
|
|
4394
|
-
useBeraWallet as useBeraWallet13,
|
|
4395
|
-
useConfig as useConfig3,
|
|
4396
|
-
usePublicClient as usePublicClient17
|
|
4397
|
-
} from "@berachain/wagmi/hooks";
|
|
4398
|
-
function usePollWalletBalances(args, options) {
|
|
4399
|
-
const publicClient = usePublicClient17();
|
|
4400
|
-
const wagmiConfig = useConfig3();
|
|
4401
|
-
const { address: connectedAccount } = useBeraWallet13();
|
|
4402
|
-
const { tokenList, refresh } = useTokens();
|
|
4403
|
-
const wallet = args?.walletAddress ?? connectedAccount;
|
|
4404
|
-
const tokens = useMemo9(() => {
|
|
4405
|
-
return new Map(
|
|
4406
|
-
(args?.tokens ?? tokenList)?.map((t) => [t.address.toLowerCase(), t]) ?? []
|
|
4407
|
-
);
|
|
4408
|
-
}, [tokenList, args?.tokens]);
|
|
4409
|
-
const QUERY_KEY = publicClient && tokenList !== void 0 && wallet ? [
|
|
4410
|
-
"usePollWalletBalances",
|
|
4411
|
-
wallet,
|
|
4412
|
-
// TODO: adding the whole list to the query is very inefficient, we should only add the tokens addresses
|
|
4413
|
-
Array.from(tokens.values())
|
|
4414
|
-
] : null;
|
|
4415
|
-
const swrResponse = useSWR(
|
|
4416
|
-
QUERY_KEY,
|
|
4417
|
-
async ([, wallet2, tokenList2]) => {
|
|
4418
|
-
return getWalletBalances({
|
|
4419
|
-
account: wallet2,
|
|
4420
|
-
tokenList: tokenList2,
|
|
4421
|
-
wagmiConfig
|
|
4422
|
-
});
|
|
4423
|
-
},
|
|
4424
|
-
{
|
|
4425
|
-
refreshInterval: 1e5 /* NORMAL */,
|
|
4426
|
-
...options
|
|
4427
|
-
}
|
|
4428
|
-
);
|
|
4429
|
-
return {
|
|
4430
|
-
...swrResponse,
|
|
4431
|
-
refresh: () => {
|
|
4432
|
-
swrResponse?.refresh();
|
|
4433
|
-
refresh();
|
|
4434
|
-
}
|
|
4435
|
-
};
|
|
4436
|
-
}
|
|
4437
|
-
|
|
4438
|
-
// src/hooks/enso/useEnsoSwapBundle.ts
|
|
4439
|
-
function useEnsoSwapBundle({
|
|
4440
|
-
tokenIn,
|
|
4441
|
-
tokenOut,
|
|
4442
|
-
amount,
|
|
4443
|
-
slippage
|
|
4444
|
-
}) {
|
|
4445
|
-
const { address: fromAddress } = useBeraWallet14();
|
|
4446
|
-
const wagmiConfig = useConfig4();
|
|
4447
|
-
const proxyAggregatorsThroughVercel = useBeraFlag(
|
|
4448
|
-
"proxyAggregatorsThroughVercel"
|
|
4449
|
-
);
|
|
4450
|
-
const ensoClient = getEnsoClient({
|
|
4451
|
-
baseURL: proxyAggregatorsThroughVercel ? "/api/enso" : void 0
|
|
4452
|
-
});
|
|
4453
|
-
const { refresh: refreshBalances } = usePollWalletBalances();
|
|
4454
|
-
const isEnabled = !!tokenIn && !!tokenOut && !!amount && Number(amount) > 0 && !!slippage && !!fromAddress && !!tokenIn.chainId;
|
|
4455
|
-
const QUERY_KEY = isEnabled ? [
|
|
4456
|
-
"useEnsoSwapBundle",
|
|
4457
|
-
fromAddress,
|
|
4458
|
-
tokenIn,
|
|
4459
|
-
tokenOut,
|
|
4460
|
-
amount,
|
|
4461
|
-
slippage,
|
|
4462
|
-
proxyAggregatorsThroughVercel ?? false
|
|
4463
|
-
] : null;
|
|
4464
|
-
const swrResponse = useSWR(
|
|
4465
|
-
QUERY_KEY,
|
|
4466
|
-
async ([, fromAddress2, tokenIn2, tokenOut2, amount2, slippage2]) => {
|
|
4467
|
-
assertAddress(fromAddress2, "fromAddress");
|
|
4468
|
-
assertAddress(tokenIn2?.address, "tokenInAddress");
|
|
4469
|
-
assertDefined(tokenIn2?.chainId, "tokenInChainId");
|
|
4470
|
-
assertAddress(tokenOut2?.address, "tokenOutAddress");
|
|
4471
|
-
assertAmount(amount2, "amount");
|
|
4472
|
-
assertAmount(slippage2, "slippage");
|
|
4473
|
-
const publicClient = getPublicClient2(wagmiConfig, {
|
|
4474
|
-
chainId: tokenIn2.chainId
|
|
4475
|
-
});
|
|
4476
|
-
assertPublicClient(publicClient);
|
|
4477
|
-
const rawAmount = parseUnits8(amount2, tokenIn2.decimals).toString();
|
|
4478
|
-
return getEnsoSwapBundle({
|
|
4479
|
-
fromAddress: fromAddress2,
|
|
4480
|
-
amountIn: rawAmount,
|
|
4481
|
-
tokenIn: tokenIn2.address,
|
|
4482
|
-
tokenOut: tokenOut2.address,
|
|
4483
|
-
chainId: tokenIn2.chainId,
|
|
4484
|
-
ensoClient,
|
|
4485
|
-
destinationChainId: berachainChainId2,
|
|
4486
|
-
slippage: slippage2,
|
|
4487
|
-
publicClient
|
|
4488
|
-
});
|
|
4489
|
-
},
|
|
4490
|
-
{
|
|
4491
|
-
refreshInterval: 1e5 /* NORMAL */,
|
|
4492
|
-
isEnabled
|
|
4493
|
-
}
|
|
4494
|
-
);
|
|
4495
|
-
return {
|
|
4496
|
-
...swrResponse,
|
|
4497
|
-
refresh: () => {
|
|
4498
|
-
swrResponse.refresh();
|
|
4499
|
-
refreshBalances();
|
|
4500
|
-
}
|
|
4501
|
-
};
|
|
4502
|
-
}
|
|
4503
|
-
|
|
4504
|
-
// src/hooks/enso/useZapStakeBera.ts
|
|
4505
|
-
import { formatUnits as formatUnits9, parseUnits as parseUnits9 } from "viem";
|
|
4506
|
-
import { chainConfigs, defaultChainId as defaultChainId9 } from "@berachain/config/internal";
|
|
4507
|
-
import { useBeraWallet as useBeraWallet15 } from "@berachain/wagmi/hooks";
|
|
4508
|
-
function useZapStakeBera({
|
|
4509
|
-
inputToken,
|
|
4510
|
-
amount,
|
|
4511
|
-
underlyingToken,
|
|
4260
|
+
// src/hooks/enso/useZapStakeBera.ts
|
|
4261
|
+
import { formatUnits as formatUnits9, parseUnits as parseUnits8 } from "viem";
|
|
4262
|
+
import { chainConfigs, defaultChainId as defaultChainId9 } from "@berachain/config/internal";
|
|
4263
|
+
import { useBeraWallet as useBeraWallet13 } from "@berachain/wagmi/hooks";
|
|
4264
|
+
function useZapStakeBera({
|
|
4265
|
+
inputToken,
|
|
4266
|
+
amount,
|
|
4267
|
+
underlyingToken,
|
|
4512
4268
|
slippage,
|
|
4513
4269
|
tokenOut
|
|
4514
4270
|
}, options) {
|
|
4515
|
-
const { address: account } =
|
|
4271
|
+
const { address: account } = useBeraWallet13();
|
|
4516
4272
|
const quoteAccount = account ?? chainConfigs[defaultChainId9].bex.aggregatorsRouterExecutor;
|
|
4517
4273
|
const isEnabled = !!inputToken && !!amount && Number(amount) > 0 && !!inputToken.chainId && !!underlyingToken && !!slippage;
|
|
4518
4274
|
const QUERY_KEY = isEnabled ? [
|
|
@@ -4535,7 +4291,7 @@ function useZapStakeBera({
|
|
|
4535
4291
|
underlyingToken2,
|
|
4536
4292
|
tokenOut2
|
|
4537
4293
|
]) => {
|
|
4538
|
-
const rawAmount =
|
|
4294
|
+
const rawAmount = parseUnits8(amount2, inputToken2.decimals).toString();
|
|
4539
4295
|
return ensoErc4626.getQuote({
|
|
4540
4296
|
account: quoteAccount2,
|
|
4541
4297
|
amount: rawAmount,
|
|
@@ -4564,13 +4320,13 @@ function useZapStakeBera({
|
|
|
4564
4320
|
data: {
|
|
4565
4321
|
...swrResponse.data,
|
|
4566
4322
|
priceImpactPercentage,
|
|
4567
|
-
isCrossChain:
|
|
4323
|
+
isCrossChain: swrResponse.data?.isCrossChain
|
|
4568
4324
|
}
|
|
4569
4325
|
};
|
|
4570
4326
|
}
|
|
4571
4327
|
|
|
4572
4328
|
// src/hooks/honey/useCappedGlobally.ts
|
|
4573
|
-
import { usePublicClient as
|
|
4329
|
+
import { usePublicClient as usePublicClient17 } from "@berachain/wagmi/hooks";
|
|
4574
4330
|
|
|
4575
4331
|
// src/hooks/honey/usePythLatestPrices.ts
|
|
4576
4332
|
function usePythLatestPrices({
|
|
@@ -4589,13 +4345,13 @@ function usePythLatestPrices({
|
|
|
4589
4345
|
}
|
|
4590
4346
|
|
|
4591
4347
|
// src/hooks/honey/useCappedGlobally.ts
|
|
4592
|
-
|
|
4348
|
+
function useCappedGlobally({
|
|
4593
4349
|
asset,
|
|
4594
4350
|
amount,
|
|
4595
4351
|
isMint,
|
|
4596
4352
|
isBasketModeEnabled: isBasketModeEnabled2
|
|
4597
|
-
}, options)
|
|
4598
|
-
const publicClient =
|
|
4353
|
+
}, options) {
|
|
4354
|
+
const publicClient = usePublicClient17();
|
|
4599
4355
|
const { priceFeedMap, flags } = useHoneyConfig();
|
|
4600
4356
|
const { data: latestPrices } = usePythLatestPrices(
|
|
4601
4357
|
{
|
|
@@ -4641,17 +4397,17 @@ var useCappedGlobally = ({
|
|
|
4641
4397
|
refreshInterval: 0
|
|
4642
4398
|
}
|
|
4643
4399
|
);
|
|
4644
|
-
}
|
|
4400
|
+
}
|
|
4645
4401
|
|
|
4646
4402
|
// src/hooks/honey/useCappedRelatively.ts
|
|
4647
|
-
import { usePublicClient as
|
|
4648
|
-
|
|
4403
|
+
import { usePublicClient as usePublicClient18 } from "@berachain/wagmi/hooks";
|
|
4404
|
+
function useCappedRelatively({
|
|
4649
4405
|
asset,
|
|
4650
4406
|
amount,
|
|
4651
4407
|
isMint,
|
|
4652
4408
|
isBasketModeEnabled: isBasketModeEnabled2
|
|
4653
|
-
}, options)
|
|
4654
|
-
const publicClient =
|
|
4409
|
+
}, options) {
|
|
4410
|
+
const publicClient = usePublicClient18();
|
|
4655
4411
|
const { collateralList, referenceCollateral } = useHoneyConfig();
|
|
4656
4412
|
const QUERY_KEY = asset && amount ? [
|
|
4657
4413
|
"useCappedRelatively",
|
|
@@ -4698,14 +4454,14 @@ var useCappedRelatively = ({
|
|
|
4698
4454
|
...options
|
|
4699
4455
|
}
|
|
4700
4456
|
);
|
|
4701
|
-
}
|
|
4457
|
+
}
|
|
4702
4458
|
|
|
4703
4459
|
// src/hooks/honey/useCollateralWeights.ts
|
|
4704
|
-
import { usePublicClient as
|
|
4705
|
-
|
|
4460
|
+
import { usePublicClient as usePublicClient19 } from "@berachain/wagmi/hooks";
|
|
4461
|
+
function useCollateralWeights({
|
|
4706
4462
|
collateralList
|
|
4707
|
-
}, options)
|
|
4708
|
-
const publicClient =
|
|
4463
|
+
}, options) {
|
|
4464
|
+
const publicClient = usePublicClient19();
|
|
4709
4465
|
const QUERY_KEY = publicClient && collateralList ? ["useCollateralWeights", collateralList] : void 0;
|
|
4710
4466
|
return useSWR(
|
|
4711
4467
|
QUERY_KEY,
|
|
@@ -4721,7 +4477,7 @@ var useCollateralWeights = ({
|
|
|
4721
4477
|
refreshInterval: options?.refreshInterval ?? 1e5 /* NORMAL */
|
|
4722
4478
|
}
|
|
4723
4479
|
);
|
|
4724
|
-
}
|
|
4480
|
+
}
|
|
4725
4481
|
|
|
4726
4482
|
// src/hooks/honey/useHoney24hVolume.ts
|
|
4727
4483
|
function useHoney24hVolume() {
|
|
@@ -4732,19 +4488,19 @@ function useHoney24hVolume() {
|
|
|
4732
4488
|
}
|
|
4733
4489
|
|
|
4734
4490
|
// src/hooks/honey/useHoneyAlerts.ts
|
|
4735
|
-
import { useMemo as
|
|
4491
|
+
import { useMemo as useMemo9 } from "react";
|
|
4736
4492
|
|
|
4737
4493
|
// src/hooks/honey/useHoneyBalances.ts
|
|
4738
4494
|
import {
|
|
4739
|
-
useBeraWallet as
|
|
4740
|
-
useConfig as
|
|
4741
|
-
usePublicClient as
|
|
4495
|
+
useBeraWallet as useBeraWallet14,
|
|
4496
|
+
useConfig as useConfig3,
|
|
4497
|
+
usePublicClient as usePublicClient20
|
|
4742
4498
|
} from "@berachain/wagmi/hooks";
|
|
4743
|
-
|
|
4744
|
-
const publicClient =
|
|
4745
|
-
const { address: account } =
|
|
4499
|
+
function useHoneyBalances() {
|
|
4500
|
+
const publicClient = usePublicClient20();
|
|
4501
|
+
const { address: account } = useBeraWallet14();
|
|
4746
4502
|
const { collateralList } = useHoneyConfig();
|
|
4747
|
-
const wagmiConfig =
|
|
4503
|
+
const wagmiConfig = useConfig3();
|
|
4748
4504
|
const QUERY_KEY = account && collateralList && publicClient ? ["useHoneyBalances", account, collateralList] : null;
|
|
4749
4505
|
return useSWR(
|
|
4750
4506
|
QUERY_KEY,
|
|
@@ -4769,12 +4525,12 @@ var useHoneyBalances = () => {
|
|
|
4769
4525
|
refreshInterval: 1e4 /* FAST */
|
|
4770
4526
|
}
|
|
4771
4527
|
);
|
|
4772
|
-
}
|
|
4528
|
+
}
|
|
4773
4529
|
|
|
4774
4530
|
// src/hooks/honey/useHoneyVaultsBalance.ts
|
|
4775
|
-
import { usePublicClient as
|
|
4776
|
-
|
|
4777
|
-
const publicClient =
|
|
4531
|
+
import { usePublicClient as usePublicClient21 } from "@berachain/wagmi/hooks";
|
|
4532
|
+
function useHoneyVaultsBalance(options) {
|
|
4533
|
+
const publicClient = usePublicClient21();
|
|
4778
4534
|
const { collateralList } = useHoneyConfig();
|
|
4779
4535
|
const QUERY_KEY = collateralList && publicClient ? ["useHoneyVaultsBalance", collateralList] : null;
|
|
4780
4536
|
return useSWR(
|
|
@@ -4788,12 +4544,12 @@ var useHoneyVaultsBalance = (options) => {
|
|
|
4788
4544
|
},
|
|
4789
4545
|
{ ...options, refreshInterval: 1e5 /* NORMAL */ }
|
|
4790
4546
|
);
|
|
4791
|
-
}
|
|
4547
|
+
}
|
|
4792
4548
|
|
|
4793
4549
|
// src/hooks/honey/useIsBadCollateralAsset.ts
|
|
4794
|
-
import { usePublicClient as
|
|
4795
|
-
|
|
4796
|
-
const publicClient =
|
|
4550
|
+
import { usePublicClient as usePublicClient22 } from "@berachain/wagmi/hooks";
|
|
4551
|
+
function useIsBadCollateralAsset({ collateral }, options) {
|
|
4552
|
+
const publicClient = usePublicClient22();
|
|
4797
4553
|
const { priceFeedMap, flags } = useHoneyConfig();
|
|
4798
4554
|
const { data: latestPrices } = usePythLatestPrices(
|
|
4799
4555
|
{
|
|
@@ -4827,15 +4583,15 @@ var useIsBadCollateralAsset = ({ collateral }, options) => {
|
|
|
4827
4583
|
refreshInterval: options?.refreshInterval ?? 1e5 /* NORMAL */
|
|
4828
4584
|
}
|
|
4829
4585
|
);
|
|
4830
|
-
}
|
|
4586
|
+
}
|
|
4831
4587
|
|
|
4832
4588
|
// src/hooks/honey/useHoneyAlerts.ts
|
|
4833
|
-
|
|
4589
|
+
function getIsLiquidityLowerThan({
|
|
4834
4590
|
lowerThan,
|
|
4835
4591
|
vaultsBalances,
|
|
4836
4592
|
state,
|
|
4837
4593
|
collateralList
|
|
4838
|
-
})
|
|
4594
|
+
}) {
|
|
4839
4595
|
const isMint = state.actionType === "mint";
|
|
4840
4596
|
if (!isMint && !state.isBasketModeEnabled) {
|
|
4841
4597
|
const redeemedVaultBalance = vaultsBalances?.find(
|
|
@@ -4861,13 +4617,13 @@ var getIsLiquidityLowerThan = ({
|
|
|
4861
4617
|
isLow: false,
|
|
4862
4618
|
isLiquidityLowCollaterals: []
|
|
4863
4619
|
};
|
|
4864
|
-
}
|
|
4865
|
-
|
|
4620
|
+
}
|
|
4621
|
+
function getRedeemMoreThanLiquidity({
|
|
4866
4622
|
vaultsBalances,
|
|
4867
4623
|
redeemedVaultBalance,
|
|
4868
4624
|
state,
|
|
4869
4625
|
collateralList
|
|
4870
|
-
})
|
|
4626
|
+
}) {
|
|
4871
4627
|
const isMint = state.actionType === "mint";
|
|
4872
4628
|
if (!isMint && vaultsBalances && redeemedVaultBalance) {
|
|
4873
4629
|
const isRedeemMoreThanLiquidityCollaterals = collateralList.filter(
|
|
@@ -4889,7 +4645,7 @@ var getRedeemMoreThanLiquidity = ({
|
|
|
4889
4645
|
};
|
|
4890
4646
|
}
|
|
4891
4647
|
return { isMore: false, isRedeemMoreThanLiquidityCollaterals: void 0 };
|
|
4892
|
-
}
|
|
4648
|
+
}
|
|
4893
4649
|
function getExceedingBalance({
|
|
4894
4650
|
state,
|
|
4895
4651
|
honeyBalances,
|
|
@@ -4917,13 +4673,13 @@ function getExceedingBalance({
|
|
|
4917
4673
|
}
|
|
4918
4674
|
return false;
|
|
4919
4675
|
}
|
|
4920
|
-
|
|
4676
|
+
function useHoneyAlerts({
|
|
4921
4677
|
actionType,
|
|
4922
4678
|
collaterals,
|
|
4923
4679
|
fromAmount,
|
|
4924
4680
|
toAmount,
|
|
4925
4681
|
isBasketModeEnabled: isBasketModeEnabled2
|
|
4926
|
-
})
|
|
4682
|
+
}) {
|
|
4927
4683
|
const state = {
|
|
4928
4684
|
actionType,
|
|
4929
4685
|
collaterals,
|
|
@@ -4958,7 +4714,7 @@ var useHoneyAlerts = ({
|
|
|
4958
4714
|
const redeemedVaultBalance = vaultsBalances?.find(
|
|
4959
4715
|
(vault) => vault.address.toLowerCase() === redeemedCollateral.toLowerCase()
|
|
4960
4716
|
);
|
|
4961
|
-
const [isLiquidityDepleted, isLowLiquidity] =
|
|
4717
|
+
const [isLiquidityDepleted, isLowLiquidity] = useMemo9(() => {
|
|
4962
4718
|
const isDepleted = getIsLiquidityLowerThan({
|
|
4963
4719
|
lowerThan: 1,
|
|
4964
4720
|
vaultsBalances,
|
|
@@ -4976,7 +4732,7 @@ var useHoneyAlerts = ({
|
|
|
4976
4732
|
const {
|
|
4977
4733
|
isMore: isRedeemMoreThanLiquidity,
|
|
4978
4734
|
isRedeemMoreThanLiquidityCollaterals
|
|
4979
|
-
} =
|
|
4735
|
+
} = useMemo9(() => {
|
|
4980
4736
|
return getRedeemMoreThanLiquidity({
|
|
4981
4737
|
vaultsBalances,
|
|
4982
4738
|
redeemedVaultBalance,
|
|
@@ -4984,7 +4740,7 @@ var useHoneyAlerts = ({
|
|
|
4984
4740
|
collateralList
|
|
4985
4741
|
});
|
|
4986
4742
|
}, [vaultsBalances, redeemedVaultBalance, state, collateralList]);
|
|
4987
|
-
const isExceedingBalance =
|
|
4743
|
+
const isExceedingBalance = useMemo9(
|
|
4988
4744
|
() => getExceedingBalance({
|
|
4989
4745
|
state,
|
|
4990
4746
|
honeyBalances
|
|
@@ -5004,7 +4760,7 @@ var useHoneyAlerts = ({
|
|
|
5004
4760
|
isCappedRelatively,
|
|
5005
4761
|
isExceedingBalance
|
|
5006
4762
|
};
|
|
5007
|
-
}
|
|
4763
|
+
}
|
|
5008
4764
|
|
|
5009
4765
|
// src/hooks/honey/useHoneyChartData.ts
|
|
5010
4766
|
function useHoneyChartData({ days }) {
|
|
@@ -5019,9 +4775,9 @@ import { formatUnits as formatUnits10 } from "viem";
|
|
|
5019
4775
|
import { defaultChainId as defaultChainId10 } from "@berachain/config/internal";
|
|
5020
4776
|
|
|
5021
4777
|
// src/hooks/honey/useIsBasketModeEnabled.ts
|
|
5022
|
-
import { usePublicClient as
|
|
4778
|
+
import { usePublicClient as usePublicClient23 } from "@berachain/wagmi/hooks";
|
|
5023
4779
|
function useIsBasketModeEnabled({ state }, options) {
|
|
5024
|
-
const publicClient =
|
|
4780
|
+
const publicClient = usePublicClient23();
|
|
5025
4781
|
const { priceFeedMap, flags, collateralList } = useHoneyConfig();
|
|
5026
4782
|
const { data: latestPrices } = usePythLatestPrices(
|
|
5027
4783
|
{
|
|
@@ -5159,7 +4915,7 @@ function reducer(state, action) {
|
|
|
5159
4915
|
throw new Error(`Unknown action type: ${action}`);
|
|
5160
4916
|
}
|
|
5161
4917
|
}
|
|
5162
|
-
|
|
4918
|
+
function useHoneySwapState() {
|
|
5163
4919
|
const { collateralList } = useHoneyConfig();
|
|
5164
4920
|
const [state, dispatch] = useReducer(
|
|
5165
4921
|
reducer,
|
|
@@ -5192,15 +4948,15 @@ var useHoneySwapState = () => {
|
|
|
5192
4948
|
}
|
|
5193
4949
|
}, [isBasketModeEnabled2]);
|
|
5194
4950
|
return { state, dispatch };
|
|
5195
|
-
}
|
|
4951
|
+
}
|
|
5196
4952
|
|
|
5197
4953
|
// src/hooks/perps/usePythUpdateFee.ts
|
|
5198
|
-
import { usePublicClient as
|
|
5199
|
-
|
|
4954
|
+
import { usePublicClient as usePublicClient24 } from "@berachain/wagmi/hooks";
|
|
4955
|
+
function usePythUpdateFee({
|
|
5200
4956
|
pythPriceFeedCalldata,
|
|
5201
4957
|
tokenListLength
|
|
5202
|
-
}, options)
|
|
5203
|
-
const publicClient =
|
|
4958
|
+
}, options) {
|
|
4959
|
+
const publicClient = usePublicClient24();
|
|
5204
4960
|
const QUERY_KEY = pythPriceFeedCalldata && pythPriceFeedCalldata.length > 0 ? ["usePythUpdateFee", pythPriceFeedCalldata] : null;
|
|
5205
4961
|
const { data = getPythDefaultUpdateFee(tokenListLength), isLoading } = useSWRImmutable(
|
|
5206
4962
|
QUERY_KEY,
|
|
@@ -5218,14 +4974,14 @@ var usePythUpdateFee = ({
|
|
|
5218
4974
|
data,
|
|
5219
4975
|
isLoading
|
|
5220
4976
|
};
|
|
5221
|
-
}
|
|
4977
|
+
}
|
|
5222
4978
|
|
|
5223
4979
|
// src/hooks/pol/useAutoclaimedIncentives.ts
|
|
5224
|
-
import { useBeraWallet as
|
|
4980
|
+
import { useBeraWallet as useBeraWallet15 } from "@berachain/wagmi/hooks";
|
|
5225
4981
|
function useAutoclaimedIncentives({
|
|
5226
4982
|
enabled
|
|
5227
4983
|
}) {
|
|
5228
|
-
const { address: account } =
|
|
4984
|
+
const { address: account } = useBeraWallet15();
|
|
5229
4985
|
const QUERY_KEY = enabled && account ? ["useAutoclaimedIncentives", account] : null;
|
|
5230
4986
|
return useSWR(
|
|
5231
4987
|
QUERY_KEY,
|
|
@@ -5239,11 +4995,11 @@ function useAutoclaimedIncentives({
|
|
|
5239
4995
|
}
|
|
5240
4996
|
|
|
5241
4997
|
// src/hooks/pol/useAutoclaimedIncentivesTxHash.ts
|
|
5242
|
-
import { useBeraWallet as
|
|
4998
|
+
import { useBeraWallet as useBeraWallet16 } from "@berachain/wagmi/hooks";
|
|
5243
4999
|
function useAutoclaimedIncentivesTxHash({
|
|
5244
5000
|
enabled
|
|
5245
5001
|
}) {
|
|
5246
|
-
const { address: account } =
|
|
5002
|
+
const { address: account } = useBeraWallet16();
|
|
5247
5003
|
const QUERY_KEY = enabled && account ? ["useAutoclaimedIncentivesTxHash", account] : null;
|
|
5248
5004
|
return useSWR(
|
|
5249
5005
|
QUERY_KEY,
|
|
@@ -5262,9 +5018,9 @@ function useAutoclaimedIncentivesTxHash({
|
|
|
5262
5018
|
}
|
|
5263
5019
|
|
|
5264
5020
|
// src/hooks/pol/useBgtAprSimulation.ts
|
|
5265
|
-
import { useMemo as
|
|
5021
|
+
import { useMemo as useMemo10 } from "react";
|
|
5266
5022
|
function useBgtAprSimulation(args) {
|
|
5267
|
-
return
|
|
5023
|
+
return useMemo10(() => {
|
|
5268
5024
|
if (!args) {
|
|
5269
5025
|
return void 0;
|
|
5270
5026
|
}
|
|
@@ -5272,29 +5028,13 @@ function useBgtAprSimulation(args) {
|
|
|
5272
5028
|
}, [args]);
|
|
5273
5029
|
}
|
|
5274
5030
|
|
|
5275
|
-
// src/hooks/pol/useBgtIncentiveDistributorPaused.ts
|
|
5276
|
-
import { usePublicClient as usePublicClient26 } from "@berachain/wagmi/hooks";
|
|
5277
|
-
function useBgtIncentiveDistributorPaused(options) {
|
|
5278
|
-
const publicClient = usePublicClient26();
|
|
5279
|
-
const QUERY_KEY = publicClient ? ["useBgtIncentiveDistributorPaused", publicClient.chain?.id] : null;
|
|
5280
|
-
return swr_default(
|
|
5281
|
-
QUERY_KEY,
|
|
5282
|
-
async () => getBgtIncentiveDistributorPaused({ publicClient }).catch(() => false),
|
|
5283
|
-
{
|
|
5284
|
-
revalidateOnFocus: false,
|
|
5285
|
-
revalidateOnReconnect: false,
|
|
5286
|
-
...options
|
|
5287
|
-
}
|
|
5288
|
-
);
|
|
5289
|
-
}
|
|
5290
|
-
|
|
5291
5031
|
// src/hooks/pol/useBgtUnstakedBalance.ts
|
|
5292
5032
|
import { formatEther as formatEther5 } from "viem";
|
|
5293
5033
|
import { bgtAbi } from "@berachain/abis/pol/bgt";
|
|
5294
|
-
import { useBeraWallet as
|
|
5295
|
-
|
|
5296
|
-
const { address: account } =
|
|
5297
|
-
const publicClient =
|
|
5034
|
+
import { useBeraWallet as useBeraWallet17, usePublicClient as usePublicClient25 } from "@berachain/wagmi/hooks";
|
|
5035
|
+
function useBgtUnstakedBalance(options) {
|
|
5036
|
+
const { address: account } = useBeraWallet17();
|
|
5037
|
+
const publicClient = usePublicClient25();
|
|
5298
5038
|
const QUERY_KEY = account && publicClient ? ["useBgtUnstakedBalance", account] : null;
|
|
5299
5039
|
return useSWR(
|
|
5300
5040
|
QUERY_KEY,
|
|
@@ -5316,14 +5056,14 @@ var useBgtUnstakedBalance = (options) => {
|
|
|
5316
5056
|
refreshInterval: options?.refreshInterval ?? 1e5 /* NORMAL */
|
|
5317
5057
|
}
|
|
5318
5058
|
);
|
|
5319
|
-
}
|
|
5059
|
+
}
|
|
5320
5060
|
|
|
5321
5061
|
// src/hooks/pol/useClaimableFees.ts
|
|
5322
5062
|
import { formatUnits as formatUnits11 } from "viem";
|
|
5323
|
-
import { useBeraWallet as
|
|
5324
|
-
|
|
5325
|
-
const { address: account } =
|
|
5326
|
-
const publicClient =
|
|
5063
|
+
import { useBeraWallet as useBeraWallet18, usePublicClient as usePublicClient26 } from "@berachain/wagmi/hooks";
|
|
5064
|
+
function useClaimableFees() {
|
|
5065
|
+
const { address: account } = useBeraWallet18();
|
|
5066
|
+
const publicClient = usePublicClient26();
|
|
5327
5067
|
const QUERY_KEY = account && publicClient ? ["useClaimableFees", account] : null;
|
|
5328
5068
|
return useSWR(
|
|
5329
5069
|
QUERY_KEY,
|
|
@@ -5332,7 +5072,7 @@ var useClaimableFees = () => {
|
|
|
5332
5072
|
const { config } = parseBaseArgs({
|
|
5333
5073
|
chainId: publicClient.chain.id
|
|
5334
5074
|
});
|
|
5335
|
-
const vaultReward = await
|
|
5075
|
+
const vaultReward = await getRewardVaultEarnedRewards({
|
|
5336
5076
|
account: account2,
|
|
5337
5077
|
vaultAddress: config.pol.staker,
|
|
5338
5078
|
publicClient
|
|
@@ -5343,7 +5083,7 @@ var useClaimableFees = () => {
|
|
|
5343
5083
|
refreshInterval: 18e4 /* SLOW */ * 2
|
|
5344
5084
|
}
|
|
5345
5085
|
);
|
|
5346
|
-
}
|
|
5086
|
+
}
|
|
5347
5087
|
|
|
5348
5088
|
// src/hooks/pol/useHighestVaultsAPR.ts
|
|
5349
5089
|
import {
|
|
@@ -5352,16 +5092,16 @@ import {
|
|
|
5352
5092
|
} from "@berachain/graphql/pol/api";
|
|
5353
5093
|
|
|
5354
5094
|
// src/hooks/pol/useRewardVaults.ts
|
|
5355
|
-
import { usePublicClient as
|
|
5356
|
-
|
|
5095
|
+
import { usePublicClient as usePublicClient27 } from "@berachain/wagmi/hooks";
|
|
5096
|
+
function useRewardVaultsQueryKey(filter, onChainIncentives = false) {
|
|
5357
5097
|
return ["useRewardVaults", filter, onChainIncentives];
|
|
5358
|
-
}
|
|
5359
|
-
|
|
5098
|
+
}
|
|
5099
|
+
function useRewardVaults(args, options) {
|
|
5360
5100
|
const QUERY_KEY = useRewardVaultsQueryKey(
|
|
5361
5101
|
args.filter,
|
|
5362
5102
|
args.onChainIncentives
|
|
5363
5103
|
);
|
|
5364
|
-
const publicClient =
|
|
5104
|
+
const publicClient = usePublicClient27();
|
|
5365
5105
|
return useSWR(
|
|
5366
5106
|
QUERY_KEY,
|
|
5367
5107
|
async ([, filter, onChainIncentives]) => {
|
|
@@ -5372,10 +5112,10 @@ var useRewardVaults = (args, options) => {
|
|
|
5372
5112
|
},
|
|
5373
5113
|
options
|
|
5374
5114
|
);
|
|
5375
|
-
}
|
|
5115
|
+
}
|
|
5376
5116
|
|
|
5377
5117
|
// src/hooks/pol/useHighestVaultsAPR.ts
|
|
5378
|
-
|
|
5118
|
+
function useHighestVaultsAPR(where = {}, { isEnabled = true } = {}) {
|
|
5379
5119
|
const swrResponse = useRewardVaults(
|
|
5380
5120
|
{
|
|
5381
5121
|
filter: {
|
|
@@ -5396,12 +5136,12 @@ var useHighestVaultsAPR = (where = {}, { isEnabled = true } = {}) => {
|
|
|
5396
5136
|
isLoading: swrResponse.isLoading,
|
|
5397
5137
|
highestApr: swrResponse.data?.rewardVaultList[0].dynamicData?.apr
|
|
5398
5138
|
};
|
|
5399
|
-
}
|
|
5139
|
+
}
|
|
5400
5140
|
|
|
5401
5141
|
// src/hooks/pol/usePollGlobalData.ts
|
|
5402
|
-
import { usePublicClient as
|
|
5403
|
-
|
|
5404
|
-
const publicClient =
|
|
5142
|
+
import { usePublicClient as usePublicClient28 } from "@berachain/wagmi/hooks";
|
|
5143
|
+
function usePollGlobalData(options) {
|
|
5144
|
+
const publicClient = usePublicClient28();
|
|
5405
5145
|
return useSWR(
|
|
5406
5146
|
publicClient ? "usePollGlobalData" : null,
|
|
5407
5147
|
async () => {
|
|
@@ -5413,13 +5153,13 @@ var usePollGlobalData = (options) => {
|
|
|
5413
5153
|
...options
|
|
5414
5154
|
}
|
|
5415
5155
|
);
|
|
5416
|
-
}
|
|
5156
|
+
}
|
|
5417
5157
|
|
|
5418
5158
|
// src/hooks/pol/usePollMarkets.ts
|
|
5419
|
-
|
|
5159
|
+
function usePollMarketsQueryKey() {
|
|
5420
5160
|
return "usePollMarkets";
|
|
5421
|
-
}
|
|
5422
|
-
|
|
5161
|
+
}
|
|
5162
|
+
function usePollMarkets(options) {
|
|
5423
5163
|
const QUERY_KEY = usePollMarketsQueryKey();
|
|
5424
5164
|
return useSWRImmutable(
|
|
5425
5165
|
QUERY_KEY,
|
|
@@ -5431,18 +5171,18 @@ var usePollMarkets = (options) => {
|
|
|
5431
5171
|
...options
|
|
5432
5172
|
}
|
|
5433
5173
|
);
|
|
5434
|
-
}
|
|
5174
|
+
}
|
|
5435
5175
|
|
|
5436
5176
|
// src/hooks/pol/useQueuedBeraUnlock.ts
|
|
5437
|
-
import { isAddress as
|
|
5438
|
-
import { usePublicClient as
|
|
5177
|
+
import { isAddress as isAddress8 } from "viem";
|
|
5178
|
+
import { usePublicClient as usePublicClient29 } from "@berachain/wagmi/hooks";
|
|
5439
5179
|
function useQueuedBeraUnlock({
|
|
5440
5180
|
receiptTokenAddresses,
|
|
5441
5181
|
account,
|
|
5442
5182
|
version
|
|
5443
5183
|
}, options) {
|
|
5444
|
-
const publicClient =
|
|
5445
|
-
const QUERY_KEY = receiptTokenAddresses && account && publicClient &&
|
|
5184
|
+
const publicClient = usePublicClient29();
|
|
5185
|
+
const QUERY_KEY = receiptTokenAddresses && account && publicClient && isAddress8(account) && version ? [
|
|
5446
5186
|
"useQueuedBeraUnlock",
|
|
5447
5187
|
receiptTokenAddresses,
|
|
5448
5188
|
account,
|
|
@@ -5471,24 +5211,17 @@ function useQueuedBeraUnlock({
|
|
|
5471
5211
|
}
|
|
5472
5212
|
|
|
5473
5213
|
// src/hooks/pol/useRewardTokenToBeraRate.ts
|
|
5474
|
-
import { isAddress as isAddress10 } from "viem";
|
|
5475
5214
|
import { defaultChainId as defaultChainId11 } from "@berachain/config/internal";
|
|
5476
|
-
import { usePublicClient as
|
|
5477
|
-
|
|
5215
|
+
import { usePublicClient as usePublicClient30 } from "@berachain/wagmi/hooks";
|
|
5216
|
+
function useRewardTokenToBeraRate({
|
|
5478
5217
|
address
|
|
5479
|
-
}, opt)
|
|
5480
|
-
const
|
|
5481
|
-
const
|
|
5218
|
+
}, opt) {
|
|
5219
|
+
const publicClient = usePublicClient30({ chainId: defaultChainId11 });
|
|
5220
|
+
const QUERY_KEY = address && publicClient ? ["useRewardTokenToBeraRate", address] : null;
|
|
5482
5221
|
return useSWR(
|
|
5483
5222
|
QUERY_KEY,
|
|
5484
5223
|
async ([_, address2]) => {
|
|
5485
|
-
|
|
5486
|
-
throw new InvalidArgumentError({
|
|
5487
|
-
property: "address",
|
|
5488
|
-
value: address2,
|
|
5489
|
-
expected: "Address"
|
|
5490
|
-
});
|
|
5491
|
-
}
|
|
5224
|
+
assertAddress(address2, "address");
|
|
5492
5225
|
assertPublicClient(publicClient);
|
|
5493
5226
|
return getRewardTokenToBeraRate({
|
|
5494
5227
|
address: address2,
|
|
@@ -5499,12 +5232,12 @@ var useRewardTokenToBeraRate = ({
|
|
|
5499
5232
|
...opt
|
|
5500
5233
|
}
|
|
5501
5234
|
);
|
|
5502
|
-
}
|
|
5235
|
+
}
|
|
5503
5236
|
|
|
5504
5237
|
// src/hooks/pol/useOnChainRewardVault.ts
|
|
5505
|
-
import { erc20Abi as erc20Abi4, formatUnits as formatUnits13, isAddress as
|
|
5238
|
+
import { erc20Abi as erc20Abi4, formatUnits as formatUnits13, isAddress as isAddress9 } from "viem";
|
|
5506
5239
|
import { beraChefAbi } from "@berachain/abis/pol/rewards/beraChef";
|
|
5507
|
-
import { usePublicClient as
|
|
5240
|
+
import { usePublicClient as usePublicClient31 } from "@berachain/wagmi/hooks";
|
|
5508
5241
|
|
|
5509
5242
|
// src/actions/pol/getStakingTokenInformation.ts
|
|
5510
5243
|
import { erc20Abi as erc20Abi3, formatUnits as formatUnits12 } from "viem";
|
|
@@ -5549,11 +5282,13 @@ async function getStakingTokenInformation({
|
|
|
5549
5282
|
}
|
|
5550
5283
|
|
|
5551
5284
|
// src/hooks/pol/useOnChainRewardVault.ts
|
|
5552
|
-
|
|
5553
|
-
|
|
5285
|
+
function useOnChainRewardVaultQueryKey(address) {
|
|
5286
|
+
return address && isAddress9(address) ? ["onChainRewardVault", address.toLowerCase()] : null;
|
|
5287
|
+
}
|
|
5288
|
+
function useOnChainRewardVault({
|
|
5554
5289
|
address
|
|
5555
|
-
}, opt)
|
|
5556
|
-
const publicClient =
|
|
5290
|
+
}, opt) {
|
|
5291
|
+
const publicClient = usePublicClient31();
|
|
5557
5292
|
const QUERY_KEY = useOnChainRewardVaultQueryKey(address);
|
|
5558
5293
|
return useSWR(
|
|
5559
5294
|
publicClient ? QUERY_KEY : null,
|
|
@@ -5633,11 +5368,13 @@ var useOnChainRewardVault = ({
|
|
|
5633
5368
|
},
|
|
5634
5369
|
opt
|
|
5635
5370
|
);
|
|
5636
|
-
}
|
|
5371
|
+
}
|
|
5637
5372
|
|
|
5638
5373
|
// src/hooks/pol/useRewardVault.ts
|
|
5639
|
-
|
|
5640
|
-
|
|
5374
|
+
function useRewardVaultQueryKey(address) {
|
|
5375
|
+
return address ? ["useRewardVault", address.toLowerCase()] : null;
|
|
5376
|
+
}
|
|
5377
|
+
function useRewardVault(id, options) {
|
|
5641
5378
|
const QUERY_KEY = useRewardVaultQueryKey(id);
|
|
5642
5379
|
const { isEnabled: _isEnabled, ...swrOptions } = options ?? {};
|
|
5643
5380
|
const swrResponse = useSWR(
|
|
@@ -5660,15 +5397,15 @@ var useRewardVault = (id, options) => {
|
|
|
5660
5397
|
onChainRewardVault.refresh();
|
|
5661
5398
|
}
|
|
5662
5399
|
};
|
|
5663
|
-
}
|
|
5400
|
+
}
|
|
5664
5401
|
|
|
5665
5402
|
// src/hooks/pol/useRewardVaultIncentives.ts
|
|
5666
|
-
import { usePublicClient as
|
|
5403
|
+
import { usePublicClient as usePublicClient32 } from "@berachain/wagmi/hooks";
|
|
5667
5404
|
function useRewardVaultIncentives({
|
|
5668
5405
|
address,
|
|
5669
5406
|
stakingToken
|
|
5670
5407
|
}) {
|
|
5671
|
-
const publicClient =
|
|
5408
|
+
const publicClient = usePublicClient32();
|
|
5672
5409
|
const QUERY_KEY = publicClient && address && stakingToken ? ["useRewardVaultIncentives", address, stakingToken] : null;
|
|
5673
5410
|
return useSWR(QUERY_KEY, async ([, address2, stakingToken2]) => {
|
|
5674
5411
|
assertPublicClient(publicClient);
|
|
@@ -5681,9 +5418,9 @@ function useRewardVaultIncentives({
|
|
|
5681
5418
|
}
|
|
5682
5419
|
|
|
5683
5420
|
// src/hooks/pol/useRewardVaultRewards.ts
|
|
5684
|
-
import { usePublicClient as
|
|
5685
|
-
|
|
5686
|
-
const publicClient =
|
|
5421
|
+
import { usePublicClient as usePublicClient33 } from "@berachain/wagmi/hooks";
|
|
5422
|
+
function useRewardVaultRewards(address, options) {
|
|
5423
|
+
const publicClient = usePublicClient33();
|
|
5687
5424
|
const QUERY_KEY = publicClient && address ? ["useRewardVaultRewards", address] : null;
|
|
5688
5425
|
return useSWR(
|
|
5689
5426
|
QUERY_KEY,
|
|
@@ -5695,10 +5432,10 @@ var useRewardVaultRewards = (address, options) => {
|
|
|
5695
5432
|
...options
|
|
5696
5433
|
}
|
|
5697
5434
|
);
|
|
5698
|
-
}
|
|
5435
|
+
}
|
|
5699
5436
|
|
|
5700
5437
|
// src/utils/filter.ts
|
|
5701
|
-
|
|
5438
|
+
function dailyResolution(data) {
|
|
5702
5439
|
const dailyData = [];
|
|
5703
5440
|
let lastDay = "";
|
|
5704
5441
|
for (const item of data) {
|
|
@@ -5717,13 +5454,13 @@ var dailyResolution = (data) => {
|
|
|
5717
5454
|
}
|
|
5718
5455
|
}
|
|
5719
5456
|
return dailyData;
|
|
5720
|
-
}
|
|
5457
|
+
}
|
|
5721
5458
|
|
|
5722
|
-
// src/hooks/pol/
|
|
5723
|
-
function
|
|
5459
|
+
// src/hooks/pol/useStakedAPY.ts
|
|
5460
|
+
function useStakedAPY({
|
|
5724
5461
|
range
|
|
5725
5462
|
}) {
|
|
5726
|
-
const QUERY_KEY = range ? ["
|
|
5463
|
+
const QUERY_KEY = range ? ["useStakedAPY", range] : null;
|
|
5727
5464
|
return useSWR(QUERY_KEY, async ([, range2]) => {
|
|
5728
5465
|
const unsortedStakedBeraSnapshots = await getStakedBeraSnapshots({
|
|
5729
5466
|
range: range2
|
|
@@ -5733,19 +5470,68 @@ function useStakedAPR({
|
|
|
5733
5470
|
);
|
|
5734
5471
|
return sortedStakedBeraSnapshots.map((item) => ({
|
|
5735
5472
|
timestamp: item.timestamp,
|
|
5736
|
-
|
|
5473
|
+
apy: item.apy
|
|
5737
5474
|
}));
|
|
5738
5475
|
});
|
|
5739
5476
|
}
|
|
5740
5477
|
|
|
5741
5478
|
// src/hooks/pol/useStakedData.ts
|
|
5742
5479
|
import { useMemo as useMemo12 } from "react";
|
|
5743
|
-
import { useBeraWallet as
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
|
|
5480
|
+
import { useBeraWallet as useBeraWallet20, usePublicClient as usePublicClient35 } from "@berachain/wagmi/hooks";
|
|
5481
|
+
|
|
5482
|
+
// src/hooks/tokens/usePollWalletBalances.ts
|
|
5483
|
+
import { useMemo as useMemo11 } from "react";
|
|
5484
|
+
import {
|
|
5485
|
+
useBeraWallet as useBeraWallet19,
|
|
5486
|
+
useConfig as useConfig4,
|
|
5487
|
+
usePublicClient as usePublicClient34
|
|
5488
|
+
} from "@berachain/wagmi/hooks";
|
|
5489
|
+
function usePollWalletBalances(args, options) {
|
|
5490
|
+
const publicClient = usePublicClient34();
|
|
5491
|
+
const wagmiConfig = useConfig4();
|
|
5492
|
+
const { address: connectedAccount } = useBeraWallet19();
|
|
5493
|
+
const { tokenList, refresh } = useTokens();
|
|
5494
|
+
const wallet = args?.walletAddress ?? connectedAccount;
|
|
5495
|
+
const tokens = useMemo11(() => {
|
|
5496
|
+
return new Map(
|
|
5497
|
+
(args?.tokens ?? tokenList)?.map((t) => [t.address.toLowerCase(), t]) ?? []
|
|
5498
|
+
);
|
|
5499
|
+
}, [tokenList, args?.tokens]);
|
|
5500
|
+
const QUERY_KEY = publicClient && tokenList !== void 0 && wallet ? [
|
|
5501
|
+
"usePollWalletBalances",
|
|
5502
|
+
wallet,
|
|
5503
|
+
// TODO: adding the whole list to the query is very inefficient, we should only add the tokens addresses
|
|
5504
|
+
Array.from(tokens.values())
|
|
5505
|
+
] : null;
|
|
5506
|
+
const swrResponse = useSWR(
|
|
5507
|
+
QUERY_KEY,
|
|
5508
|
+
async ([, wallet2, tokenList2]) => {
|
|
5509
|
+
return getWalletBalances({
|
|
5510
|
+
account: wallet2,
|
|
5511
|
+
tokenList: tokenList2,
|
|
5512
|
+
wagmiConfig
|
|
5513
|
+
});
|
|
5514
|
+
},
|
|
5515
|
+
{
|
|
5516
|
+
refreshInterval: 1e5 /* NORMAL */,
|
|
5517
|
+
...options
|
|
5518
|
+
}
|
|
5519
|
+
);
|
|
5520
|
+
return {
|
|
5521
|
+
...swrResponse,
|
|
5522
|
+
refresh: () => {
|
|
5523
|
+
swrResponse?.refresh();
|
|
5524
|
+
refresh();
|
|
5525
|
+
}
|
|
5526
|
+
};
|
|
5527
|
+
}
|
|
5528
|
+
|
|
5529
|
+
// src/hooks/pol/useStakedData.ts
|
|
5530
|
+
function useStakedData(stakingConfigs) {
|
|
5531
|
+
const window2 = useBeraFlag("swberaAprWindow");
|
|
5532
|
+
const publicClient = usePublicClient35();
|
|
5533
|
+
const { address: account } = useBeraWallet20();
|
|
5534
|
+
const receiptTokens = useMemo12(
|
|
5749
5535
|
() => stakingConfigs.map((config) => config.receiptToken),
|
|
5750
5536
|
[stakingConfigs]
|
|
5751
5537
|
);
|
|
@@ -5753,11 +5539,10 @@ var useStakedData = (stakingConfigs) => {
|
|
|
5753
5539
|
() => stakingConfigs.map((config) => config.inputTokens[0]),
|
|
5754
5540
|
[stakingConfigs]
|
|
5755
5541
|
);
|
|
5756
|
-
const
|
|
5757
|
-
const { data:
|
|
5758
|
-
|
|
5759
|
-
async ([, window3]) =>
|
|
5760
|
-
{ refreshInterval: 1e5 /* NORMAL */ }
|
|
5542
|
+
const apyKey = window2 ? ["useStakedData:apy", window2] : null;
|
|
5543
|
+
const { data: apy } = useSWRImmutable(
|
|
5544
|
+
apyKey,
|
|
5545
|
+
async ([, window3]) => getStakedBeraAPY({ window: window3 })
|
|
5761
5546
|
);
|
|
5762
5547
|
const {
|
|
5763
5548
|
data: walletBalances,
|
|
@@ -5825,7 +5610,7 @@ var useStakedData = (stakingConfigs) => {
|
|
|
5825
5610
|
const stakedAmountUsd = inputTokenPrice === void 0 ? void 0 : stakedAmount.multipliedBy(inputTokenPrice).toNumber();
|
|
5826
5611
|
return {
|
|
5827
5612
|
token: inputToken,
|
|
5828
|
-
|
|
5613
|
+
apy,
|
|
5829
5614
|
stakedAmount: stakedAmount.toNumber(),
|
|
5830
5615
|
stakedAmountUsd,
|
|
5831
5616
|
earnedAmount: 0,
|
|
@@ -5837,7 +5622,7 @@ var useStakedData = (stakingConfigs) => {
|
|
|
5837
5622
|
walletBalances,
|
|
5838
5623
|
exchangeRates,
|
|
5839
5624
|
stakingConfigs,
|
|
5840
|
-
|
|
5625
|
+
apy,
|
|
5841
5626
|
getTokenPrice,
|
|
5842
5627
|
earningsSettled
|
|
5843
5628
|
]);
|
|
@@ -5861,14 +5646,14 @@ var useStakedData = (stakingConfigs) => {
|
|
|
5861
5646
|
const earnedAmountUsd = inputTokenPrice === void 0 ? void 0 : earnedAmount.multipliedBy(inputTokenPrice).toNumber();
|
|
5862
5647
|
return {
|
|
5863
5648
|
token: inputToken,
|
|
5864
|
-
|
|
5649
|
+
apy,
|
|
5865
5650
|
stakedAmount: stakedAmount.toNumber(),
|
|
5866
5651
|
earnedAmount: earnedAmount.toNumber(),
|
|
5867
5652
|
stakedAmountUsd,
|
|
5868
5653
|
earnedAmountUsd
|
|
5869
5654
|
};
|
|
5870
5655
|
});
|
|
5871
|
-
}, [positionsRaw, walletBalances, stakingConfigs,
|
|
5656
|
+
}, [positionsRaw, walletBalances, stakingConfigs, apy, getTokenPrice]);
|
|
5872
5657
|
return {
|
|
5873
5658
|
/** Fast path: staked amounts + USD values (no earnings) */
|
|
5874
5659
|
balances,
|
|
@@ -5882,7 +5667,7 @@ var useStakedData = (stakingConfigs) => {
|
|
|
5882
5667
|
/**
|
|
5883
5668
|
* Hard error: the RPC fast-path could not produce staked balances (wallet
|
|
5884
5669
|
* balances or exchange-rate reads failed). Price and earnings backend
|
|
5885
|
-
* failures are intentionally excluded — those degrade gracefully (USD/
|
|
5670
|
+
* failures are intentionally excluded — those degrade gracefully (USD/APY
|
|
5886
5671
|
* render as "—", earnings stop loading) so RPC-derived amounts still show.
|
|
5887
5672
|
*/
|
|
5888
5673
|
error: walletBalancesError ?? exchangeRatesError,
|
|
@@ -5895,7 +5680,7 @@ var useStakedData = (stakingConfigs) => {
|
|
|
5895
5680
|
*/
|
|
5896
5681
|
earningsSettled
|
|
5897
5682
|
};
|
|
5898
|
-
}
|
|
5683
|
+
}
|
|
5899
5684
|
|
|
5900
5685
|
// src/actions/pol/getStakingDailyAssets.ts
|
|
5901
5686
|
async function getStakingDailyAssets({
|
|
@@ -5937,36 +5722,33 @@ function useStakedSnapshots({
|
|
|
5937
5722
|
}
|
|
5938
5723
|
|
|
5939
5724
|
// src/hooks/pol/useStakingVaultsMetadata.ts
|
|
5940
|
-
import { usePublicClient as
|
|
5941
|
-
|
|
5942
|
-
const publicClient =
|
|
5943
|
-
const
|
|
5944
|
-
const QUERY_KEY = vaults.length > 0 && publicClient && blockTime ? ["useStakingVaultMetadata", vaults, publicClient, blockTime] : null;
|
|
5725
|
+
import { usePublicClient as usePublicClient36 } from "@berachain/wagmi/hooks";
|
|
5726
|
+
function useStakingVaultsMetadata(vaults = []) {
|
|
5727
|
+
const publicClient = usePublicClient36();
|
|
5728
|
+
const QUERY_KEY = vaults.length > 0 && publicClient ? ["useStakingVaultMetadata", vaults] : null;
|
|
5945
5729
|
return useSWR(
|
|
5946
5730
|
QUERY_KEY,
|
|
5947
|
-
async ([, vaults2
|
|
5948
|
-
assertPublicClient(
|
|
5731
|
+
async ([, vaults2]) => {
|
|
5732
|
+
assertPublicClient(publicClient);
|
|
5949
5733
|
return Promise.all(
|
|
5950
5734
|
vaults2.map(
|
|
5951
5735
|
(vault) => getSWBeraVaultMetadata({
|
|
5952
5736
|
address: vault.address,
|
|
5953
|
-
|
|
5954
|
-
publicClient: publicClient2,
|
|
5955
|
-
blockTime: blockTime2
|
|
5737
|
+
publicClient
|
|
5956
5738
|
})
|
|
5957
5739
|
)
|
|
5958
5740
|
);
|
|
5959
5741
|
},
|
|
5960
5742
|
{ refreshInterval: 1e4 /* FAST */ }
|
|
5961
5743
|
);
|
|
5962
|
-
}
|
|
5744
|
+
}
|
|
5963
5745
|
|
|
5964
5746
|
// src/hooks/pol/useTotalStakedAmount.ts
|
|
5965
|
-
import { usePublicClient as
|
|
5747
|
+
import { usePublicClient as usePublicClient37 } from "@berachain/wagmi/hooks";
|
|
5966
5748
|
function useTotalStakedAmount({
|
|
5967
5749
|
vaultAddresses
|
|
5968
5750
|
}) {
|
|
5969
|
-
const publicClient =
|
|
5751
|
+
const publicClient = usePublicClient37();
|
|
5970
5752
|
return useSWR(
|
|
5971
5753
|
vaultAddresses && publicClient ? ["useTotalStakedAmount", vaultAddresses] : null,
|
|
5972
5754
|
([, vaultAddresses2]) => {
|
|
@@ -5976,10 +5758,10 @@ function useTotalStakedAmount({
|
|
|
5976
5758
|
}
|
|
5977
5759
|
|
|
5978
5760
|
// src/hooks/pol/useUserVaultInfo.ts
|
|
5979
|
-
import { useBeraWallet as
|
|
5980
|
-
|
|
5981
|
-
const { address: account } =
|
|
5982
|
-
const publicClient =
|
|
5761
|
+
import { useBeraWallet as useBeraWallet21, usePublicClient as usePublicClient38 } from "@berachain/wagmi/hooks";
|
|
5762
|
+
function useUserVaultInfo(args, options) {
|
|
5763
|
+
const { address: account } = useBeraWallet21();
|
|
5764
|
+
const publicClient = usePublicClient38();
|
|
5983
5765
|
const QUERY_KEY = account && publicClient && args.vaultAddress ? ["useUserVaultInfo", account, args.vaultAddress] : null;
|
|
5984
5766
|
return useSWR(
|
|
5985
5767
|
QUERY_KEY,
|
|
@@ -5996,13 +5778,13 @@ var useUserVaultInfo = (args, options) => {
|
|
|
5996
5778
|
refreshInterval: options?.refreshInterval ?? 1e5 /* NORMAL */
|
|
5997
5779
|
}
|
|
5998
5780
|
);
|
|
5999
|
-
}
|
|
5781
|
+
}
|
|
6000
5782
|
|
|
6001
5783
|
// src/hooks/pol/useUserVaults.ts
|
|
6002
|
-
import { useBeraWallet as
|
|
6003
|
-
|
|
6004
|
-
const { address: account } =
|
|
6005
|
-
const publicClient =
|
|
5784
|
+
import { useBeraWallet as useBeraWallet22, usePublicClient as usePublicClient39 } from "@berachain/wagmi/hooks";
|
|
5785
|
+
function useUserVaults(options) {
|
|
5786
|
+
const { address: account } = useBeraWallet22();
|
|
5787
|
+
const publicClient = usePublicClient39();
|
|
6006
5788
|
const QUERY_KEY = account && publicClient ? ["useUserVaults", account] : null;
|
|
6007
5789
|
return useSWR(
|
|
6008
5790
|
QUERY_KEY,
|
|
@@ -6019,12 +5801,12 @@ var useUserVaults = (options) => {
|
|
|
6019
5801
|
keepPreviousData: true
|
|
6020
5802
|
}
|
|
6021
5803
|
);
|
|
6022
|
-
}
|
|
5804
|
+
}
|
|
6023
5805
|
|
|
6024
5806
|
// src/hooks/pol/useVaultAddress.ts
|
|
6025
|
-
import { usePublicClient as
|
|
6026
|
-
|
|
6027
|
-
const publicClient =
|
|
5807
|
+
import { usePublicClient as usePublicClient40 } from "@berachain/wagmi/hooks";
|
|
5808
|
+
function useVaultAddress(vaultAddress) {
|
|
5809
|
+
const publicClient = usePublicClient40();
|
|
6028
5810
|
const QUERY_KEY = vaultAddress && publicClient ? ["useVaultAddress", vaultAddress] : null;
|
|
6029
5811
|
return useSWR(QUERY_KEY, async ([, vaultAddress2]) => {
|
|
6030
5812
|
assertPublicClient(publicClient);
|
|
@@ -6036,23 +5818,23 @@ var useVaultAddress = (vaultAddress) => {
|
|
|
6036
5818
|
]);
|
|
6037
5819
|
return { stakeToken, address: vaultAddress2 };
|
|
6038
5820
|
});
|
|
6039
|
-
}
|
|
5821
|
+
}
|
|
6040
5822
|
|
|
6041
5823
|
// src/hooks/pol/useVaultHistory.ts
|
|
6042
|
-
|
|
5824
|
+
function useVaultHistory({
|
|
6043
5825
|
vault,
|
|
6044
5826
|
range,
|
|
6045
5827
|
resolution
|
|
6046
|
-
})
|
|
5828
|
+
}) {
|
|
6047
5829
|
const QUERY_KEY = vault ? ["useVaultHistory", vault, range, resolution] : null;
|
|
6048
5830
|
return useSWR(
|
|
6049
5831
|
QUERY_KEY,
|
|
6050
5832
|
([, vault2, range2, resolution2]) => getVaultHistory({ vault: vault2, range: range2, resolution: resolution2 })
|
|
6051
5833
|
);
|
|
6052
|
-
}
|
|
5834
|
+
}
|
|
6053
5835
|
|
|
6054
5836
|
// src/hooks/pol/useVaultValidators.ts
|
|
6055
|
-
|
|
5837
|
+
function useVaultValidators(id, options) {
|
|
6056
5838
|
const QUERY_KEY = id ? ["useVaultValidators", id] : null;
|
|
6057
5839
|
return useSWR(
|
|
6058
5840
|
QUERY_KEY,
|
|
@@ -6065,42 +5847,44 @@ var useVaultValidators = (id, options) => {
|
|
|
6065
5847
|
...options
|
|
6066
5848
|
}
|
|
6067
5849
|
);
|
|
6068
|
-
}
|
|
5850
|
+
}
|
|
6069
5851
|
|
|
6070
5852
|
// src/hooks/tokens/useBeraCurrentPrice.ts
|
|
6071
|
-
import {
|
|
5853
|
+
import { defaultChainId as defaultChainId12 } from "@berachain/config/internal";
|
|
6072
5854
|
|
|
6073
|
-
// src/hooks/tokens/
|
|
6074
|
-
function
|
|
6075
|
-
const
|
|
6076
|
-
{
|
|
6077
|
-
addressIn: address ? [address] : void 0
|
|
6078
|
-
},
|
|
5855
|
+
// src/hooks/tokens/useTokenPrice.ts
|
|
5856
|
+
function useTokenPrice({ token }, options) {
|
|
5857
|
+
const { isLoading, error, priceMap } = useTokenPrices(
|
|
5858
|
+
{ tokens: token ? [token] : void 0 },
|
|
6079
5859
|
options
|
|
6080
5860
|
);
|
|
6081
5861
|
return {
|
|
6082
|
-
|
|
6083
|
-
|
|
5862
|
+
data: token ? priceMap[token.chainId]?.[token.address.toLowerCase()] : void 0,
|
|
5863
|
+
isLoading,
|
|
5864
|
+
error
|
|
6084
5865
|
};
|
|
6085
5866
|
}
|
|
6086
5867
|
|
|
6087
5868
|
// src/hooks/tokens/useBeraCurrentPrice.ts
|
|
6088
5869
|
function useBeraCurrentPrice(opts) {
|
|
6089
|
-
return
|
|
5870
|
+
return useTokenPrice(
|
|
5871
|
+
{ token: { ...beraToken, chainId: defaultChainId12 } },
|
|
5872
|
+
opts
|
|
5873
|
+
);
|
|
6090
5874
|
}
|
|
6091
5875
|
|
|
6092
5876
|
// src/hooks/tokens/useStakingTokenInformation.ts
|
|
6093
|
-
import { isAddress as
|
|
6094
|
-
import { usePublicClient as
|
|
6095
|
-
|
|
6096
|
-
const publicClient =
|
|
6097
|
-
const QUERY_KEY = args?.address && publicClient &&
|
|
5877
|
+
import { isAddress as isAddress10, zeroAddress as zeroAddress20 } from "viem";
|
|
5878
|
+
import { usePublicClient as usePublicClient41 } from "@berachain/wagmi/hooks";
|
|
5879
|
+
function useStakingTokenInformation(args, options) {
|
|
5880
|
+
const publicClient = usePublicClient41();
|
|
5881
|
+
const QUERY_KEY = args?.address && publicClient && isAddress10(args.address) ? ["useStakingTokenInformation", args.address] : null;
|
|
6098
5882
|
return useSWRImmutable(
|
|
6099
5883
|
QUERY_KEY,
|
|
6100
5884
|
async ([_, address]) => {
|
|
6101
5885
|
if (isToken(address, "BERA")) {
|
|
6102
5886
|
return {
|
|
6103
|
-
address:
|
|
5887
|
+
address: zeroAddress20,
|
|
6104
5888
|
decimals: beraToken.decimals,
|
|
6105
5889
|
name: beraToken.name,
|
|
6106
5890
|
symbol: beraToken.symbol
|
|
@@ -6113,26 +5897,13 @@ var useStakingTokenInformation = (args, options) => {
|
|
|
6113
5897
|
},
|
|
6114
5898
|
{ ...options }
|
|
6115
5899
|
);
|
|
6116
|
-
};
|
|
6117
|
-
|
|
6118
|
-
// src/hooks/tokens/useTokenPrice.ts
|
|
6119
|
-
function useTokenPrice({ token }, options) {
|
|
6120
|
-
const { isLoading, error, priceMap } = useTokenPrices(
|
|
6121
|
-
{ tokens: token ? [token] : void 0 },
|
|
6122
|
-
options
|
|
6123
|
-
);
|
|
6124
|
-
return {
|
|
6125
|
-
data: token ? priceMap[token.chainId]?.[token.address.toLowerCase()] : void 0,
|
|
6126
|
-
isLoading,
|
|
6127
|
-
error
|
|
6128
|
-
};
|
|
6129
5900
|
}
|
|
6130
5901
|
|
|
6131
5902
|
// src/hooks/tokens/useTotalSupply.ts
|
|
6132
5903
|
import { erc20Abi as erc20Abi5 } from "viem";
|
|
6133
|
-
import { usePublicClient as
|
|
5904
|
+
import { usePublicClient as usePublicClient42 } from "@berachain/wagmi/hooks";
|
|
6134
5905
|
function useTotalSupply({ address }) {
|
|
6135
|
-
const publicClient =
|
|
5906
|
+
const publicClient = usePublicClient42();
|
|
6136
5907
|
return useSWR(
|
|
6137
5908
|
address && publicClient ? ["useTotalSupply", address] : null,
|
|
6138
5909
|
([, address2]) => {
|
|
@@ -6148,9 +5919,9 @@ function useTotalSupply({ address }) {
|
|
|
6148
5919
|
}
|
|
6149
5920
|
|
|
6150
5921
|
// src/hooks/useBlockToTimestamp.ts
|
|
6151
|
-
import { useBlockNumber, usePublicClient as
|
|
5922
|
+
import { useBlockNumber, usePublicClient as usePublicClient43 } from "@berachain/wagmi/hooks";
|
|
6152
5923
|
function useBlockToTimestamp(inputBlock) {
|
|
6153
|
-
const publicClient =
|
|
5924
|
+
const publicClient = usePublicClient43();
|
|
6154
5925
|
const { config } = parseBaseArgs({ chainId: publicClient?.chain.id });
|
|
6155
5926
|
const { data: currentBlock, isLoading } = useBlockNumber({
|
|
6156
5927
|
cacheTime: seconds(config.averageBlockTime)
|
|
@@ -6179,7 +5950,7 @@ function useBlockToTimestamp(inputBlock) {
|
|
|
6179
5950
|
|
|
6180
5951
|
// src/hooks/useContractWrite/useBeraContractWrite.ts
|
|
6181
5952
|
import { useCallback as useCallback2, useReducer as useReducer2 } from "react";
|
|
6182
|
-
import { useBeraWagmi as useBeraWagmi3, useConfig as
|
|
5953
|
+
import { useBeraWagmi as useBeraWagmi3, useConfig as useConfig5 } from "@berachain/wagmi/hooks";
|
|
6183
5954
|
|
|
6184
5955
|
// src/hooks/useContractWrite/stateReducer.ts
|
|
6185
5956
|
var initialState = {
|
|
@@ -6187,7 +5958,7 @@ var initialState = {
|
|
|
6187
5958
|
txnHash: "",
|
|
6188
5959
|
message: ""
|
|
6189
5960
|
};
|
|
6190
|
-
|
|
5961
|
+
function reducer2(state, actions) {
|
|
6191
5962
|
switch (actions.type) {
|
|
6192
5963
|
case "confirm_sending" /* LOADING */:
|
|
6193
5964
|
return {
|
|
@@ -6217,7 +5988,7 @@ var reducer2 = (state, actions) => {
|
|
|
6217
5988
|
default:
|
|
6218
5989
|
return state;
|
|
6219
5990
|
}
|
|
6220
|
-
}
|
|
5991
|
+
}
|
|
6221
5992
|
|
|
6222
5993
|
// src/hooks/useContractWrite/useBeraContractWrite.ts
|
|
6223
5994
|
function useBeraContractWrite({
|
|
@@ -6230,7 +6001,7 @@ function useBeraContractWrite({
|
|
|
6230
6001
|
} = {}) {
|
|
6231
6002
|
const [state, dispatch] = useReducer2(reducer2, initialState);
|
|
6232
6003
|
const { account, onSmartAccountRejection } = useBeraWagmi3();
|
|
6233
|
-
const wagmiConfig =
|
|
6004
|
+
const wagmiConfig = useConfig5();
|
|
6234
6005
|
const txConfirmationTimeout = account?.wallet?.isContract ? 6e4 * 10 : 12e4;
|
|
6235
6006
|
const reset = useCallback2(() => {
|
|
6236
6007
|
dispatch({ type: "confirm_reset" /* RESET */ });
|
|
@@ -6303,10 +6074,9 @@ function useBeraContractWrite({
|
|
|
6303
6074
|
reset
|
|
6304
6075
|
};
|
|
6305
6076
|
}
|
|
6306
|
-
var useBeraContractWrite_default = useBeraContractWrite;
|
|
6307
6077
|
|
|
6308
6078
|
// src/hooks/useGetVerifiedAbi.ts
|
|
6309
|
-
import { isAddress as
|
|
6079
|
+
import { isAddress as isAddress11, zeroAddress as zeroAddress21 } from "viem";
|
|
6310
6080
|
import { chainId } from "@berachain/config/internal";
|
|
6311
6081
|
async function fetchVerifiedAbi(address) {
|
|
6312
6082
|
const data = await beraFetchJson({
|
|
@@ -6319,14 +6089,14 @@ async function fetchVerifiedAbi(address) {
|
|
|
6319
6089
|
}
|
|
6320
6090
|
return data.result;
|
|
6321
6091
|
}
|
|
6322
|
-
|
|
6092
|
+
function useGetVerifiedAbi(address) {
|
|
6323
6093
|
return useSWRImmutable(
|
|
6324
|
-
address &&
|
|
6325
|
-
address !==
|
|
6094
|
+
address && isAddress11(address) && // Address zero can't be a contract for sure
|
|
6095
|
+
address !== zeroAddress21 ? ["useGetVerifiedAbi", address] : null,
|
|
6326
6096
|
() => address ? fetchVerifiedAbi(address) : Promise.resolve(""),
|
|
6327
6097
|
{}
|
|
6328
6098
|
);
|
|
6329
|
-
}
|
|
6099
|
+
}
|
|
6330
6100
|
|
|
6331
6101
|
// src/hooks/useHistoryState.ts
|
|
6332
6102
|
import { useCallback as useCallback3, useEffect as useEffect3, useState as useState2 } from "react";
|
|
@@ -6376,12 +6146,12 @@ function usePrevious(value) {
|
|
|
6376
6146
|
}
|
|
6377
6147
|
|
|
6378
6148
|
// src/hooks/validators/useAllValidators.ts
|
|
6379
|
-
|
|
6149
|
+
function useAllValidatorsQueryKey({
|
|
6380
6150
|
variables
|
|
6381
|
-
} = {})
|
|
6151
|
+
} = {}) {
|
|
6382
6152
|
return ["useAllValidators", variables];
|
|
6383
|
-
}
|
|
6384
|
-
|
|
6153
|
+
}
|
|
6154
|
+
function useAllValidators(variables, options) {
|
|
6385
6155
|
const { config } = parseBaseArgs(variables);
|
|
6386
6156
|
return useSWR(
|
|
6387
6157
|
useAllValidatorsQueryKey({ variables }),
|
|
@@ -6399,7 +6169,7 @@ var useAllValidators = (variables, options) => {
|
|
|
6399
6169
|
...options
|
|
6400
6170
|
}
|
|
6401
6171
|
);
|
|
6402
|
-
}
|
|
6172
|
+
}
|
|
6403
6173
|
|
|
6404
6174
|
// src/hooks/validators/useApiEnrichedAllocation.ts
|
|
6405
6175
|
function useApiEnrichedAllocation({
|
|
@@ -6415,8 +6185,10 @@ function useApiEnrichedAllocation({
|
|
|
6415
6185
|
|
|
6416
6186
|
// src/hooks/validators/useApiValidator.ts
|
|
6417
6187
|
import { isHex } from "viem";
|
|
6418
|
-
|
|
6419
|
-
|
|
6188
|
+
function useApiValidatorQueryKey(id) {
|
|
6189
|
+
return id ? ["useApiValidator", id] : null;
|
|
6190
|
+
}
|
|
6191
|
+
function useApiValidator(id, options) {
|
|
6420
6192
|
const QUERY_KEY = useApiValidatorQueryKey(id);
|
|
6421
6193
|
return useSWR(
|
|
6422
6194
|
id ? QUERY_KEY : null,
|
|
@@ -6426,10 +6198,10 @@ var useApiValidator = (id, options) => {
|
|
|
6426
6198
|
},
|
|
6427
6199
|
options
|
|
6428
6200
|
);
|
|
6429
|
-
}
|
|
6201
|
+
}
|
|
6430
6202
|
|
|
6431
6203
|
// src/hooks/validators/useBaselineRewardAllocation.ts
|
|
6432
|
-
import { usePublicClient as
|
|
6204
|
+
import { usePublicClient as usePublicClient44 } from "@berachain/wagmi/hooks";
|
|
6433
6205
|
|
|
6434
6206
|
// src/actions/validators/getBaselineRewardAllocation.ts
|
|
6435
6207
|
import { rewardAllocatorFactoryAbi as rewardAllocationFactoryAbi } from "@berachain/abis/pol/rewards/rewardAllocatorFactory";
|
|
@@ -6451,7 +6223,7 @@ async function getBaselineRewardAllocation({
|
|
|
6451
6223
|
|
|
6452
6224
|
// src/hooks/validators/useBaselineRewardAllocation.ts
|
|
6453
6225
|
function useBaselineRewardAllocation() {
|
|
6454
|
-
const publicClient =
|
|
6226
|
+
const publicClient = usePublicClient44();
|
|
6455
6227
|
return useSWR(publicClient ? ["baselineRewardAllocation"] : null, () => {
|
|
6456
6228
|
assertPublicClient(publicClient);
|
|
6457
6229
|
return getBaselineRewardAllocation({
|
|
@@ -6460,51 +6232,12 @@ function useBaselineRewardAllocation() {
|
|
|
6460
6232
|
});
|
|
6461
6233
|
}
|
|
6462
6234
|
|
|
6463
|
-
// src/hooks/validators/useDailyValidatorBlockStats.ts
|
|
6464
|
-
var useDailyValidatorBlockStats = ({
|
|
6465
|
-
pubKey,
|
|
6466
|
-
first = 1
|
|
6467
|
-
}) => {
|
|
6468
|
-
const QUERY_KEY = pubKey ? ["useDailyValidatorBlockStats", pubKey, first] : null;
|
|
6469
|
-
return useSWR(
|
|
6470
|
-
QUERY_KEY,
|
|
6471
|
-
async ([, pubKey2, first2]) => {
|
|
6472
|
-
return await getDailyValidatorBlockStats({
|
|
6473
|
-
pubKey: pubKey2,
|
|
6474
|
-
first: first2
|
|
6475
|
-
});
|
|
6476
|
-
},
|
|
6477
|
-
{
|
|
6478
|
-
refreshInterval: 18e4 /* SLOW */
|
|
6479
|
-
}
|
|
6480
|
-
);
|
|
6481
|
-
};
|
|
6482
|
-
|
|
6483
|
-
// src/hooks/validators/useDefaultRewardAllocation.ts
|
|
6484
|
-
import { usePublicClient as usePublicClient46 } from "@berachain/wagmi/hooks";
|
|
6485
|
-
function useDefaultRewardAllocation(options) {
|
|
6486
|
-
const publicClient = usePublicClient46();
|
|
6487
|
-
const QUERY_KEY = publicClient ? ["useDefaultRewardAllocation"] : null;
|
|
6488
|
-
return useSWR(
|
|
6489
|
-
QUERY_KEY,
|
|
6490
|
-
async () => {
|
|
6491
|
-
assertPublicClient(publicClient);
|
|
6492
|
-
return await getDefaultRewardAllocation({
|
|
6493
|
-
client: publicClient
|
|
6494
|
-
});
|
|
6495
|
-
},
|
|
6496
|
-
{
|
|
6497
|
-
...options
|
|
6498
|
-
}
|
|
6499
|
-
);
|
|
6500
|
-
}
|
|
6501
|
-
|
|
6502
6235
|
// src/hooks/validators/useManagedValidatorRole.ts
|
|
6503
6236
|
import { useMemo as useMemo13 } from "react";
|
|
6504
|
-
import { useBeraWallet as
|
|
6237
|
+
import { useBeraWallet as useBeraWallet23, usePublicClient as usePublicClient45 } from "@berachain/wagmi/hooks";
|
|
6505
6238
|
|
|
6506
6239
|
// src/actions/validators/getValidatorRewardAllocatorAddress.ts
|
|
6507
|
-
import { zeroAddress as
|
|
6240
|
+
import { zeroAddress as zeroAddress22 } from "viem";
|
|
6508
6241
|
import { beraChefAbi as beraChefAbi2 } from "@berachain/abis/pol/rewards/beraChef";
|
|
6509
6242
|
async function getValidatorRewardAllocatorAddress({
|
|
6510
6243
|
client,
|
|
@@ -6519,7 +6252,7 @@ async function getValidatorRewardAllocatorAddress({
|
|
|
6519
6252
|
functionName: "valRewardAllocator",
|
|
6520
6253
|
args: [pubKey]
|
|
6521
6254
|
});
|
|
6522
|
-
if (result ===
|
|
6255
|
+
if (result === zeroAddress22) {
|
|
6523
6256
|
return null;
|
|
6524
6257
|
}
|
|
6525
6258
|
return result;
|
|
@@ -6548,13 +6281,13 @@ function useManagedValidatorRole({
|
|
|
6548
6281
|
pubKey,
|
|
6549
6282
|
account: accountAddress
|
|
6550
6283
|
}, options) {
|
|
6551
|
-
const publicClient =
|
|
6284
|
+
const publicClient = usePublicClient45();
|
|
6552
6285
|
const mockValidatorOperator = useBeraFlag("mockValidatorOperator");
|
|
6553
6286
|
const mockValidatorRewardAllocator = useBeraFlag(
|
|
6554
6287
|
"mockValidatorRewardAllocator"
|
|
6555
6288
|
);
|
|
6556
6289
|
const QUERY_KEY = publicClient && pubKey ? ["useManagedValidatorRole", pubKey] : null;
|
|
6557
|
-
const { address: connectedAccount } =
|
|
6290
|
+
const { address: connectedAccount } = useBeraWallet23();
|
|
6558
6291
|
const account = accountAddress ?? connectedAccount;
|
|
6559
6292
|
const swrResponse = useSWR(
|
|
6560
6293
|
QUERY_KEY,
|
|
@@ -6595,60 +6328,13 @@ function useManagedValidatorRole({
|
|
|
6595
6328
|
};
|
|
6596
6329
|
}
|
|
6597
6330
|
|
|
6598
|
-
// src/hooks/validators/useOnChainValidator.ts
|
|
6599
|
-
import { keccak256 as keccak2562 } from "viem";
|
|
6600
|
-
import { beaconDepositAbi } from "@berachain/abis/pol/beaconDeposit";
|
|
6601
|
-
import { bgtAbi as bgtAbi2 } from "@berachain/abis/pol/bgt";
|
|
6602
|
-
import { beraChefAbi as beraChefAbi3 } from "@berachain/abis/pol/rewards/beraChef";
|
|
6603
|
-
import { usePublicClient as usePublicClient48 } from "@berachain/wagmi/hooks";
|
|
6604
|
-
var useOnChainValidator = ({ pubkey }, options) => {
|
|
6605
|
-
const publicClient = usePublicClient48();
|
|
6606
|
-
const QUERY_KEY = pubkey ? ["useOnChainValidator", pubkey] : null;
|
|
6607
|
-
return useSWR(
|
|
6608
|
-
publicClient ? QUERY_KEY : null,
|
|
6609
|
-
async ([, pubkey2]) => {
|
|
6610
|
-
assertPublicClient(publicClient);
|
|
6611
|
-
const { config } = parseBaseArgs({
|
|
6612
|
-
chainId: publicClient.chain.id
|
|
6613
|
-
});
|
|
6614
|
-
const [operator, boostees, _rewardAllocation] = await Promise.all([
|
|
6615
|
-
publicClient.readContract({
|
|
6616
|
-
address: config.depositContract,
|
|
6617
|
-
abi: beaconDepositAbi,
|
|
6618
|
-
functionName: "getOperator",
|
|
6619
|
-
args: [pubkey2]
|
|
6620
|
-
}),
|
|
6621
|
-
publicClient?.readContract({
|
|
6622
|
-
address: config.tokens.bgt,
|
|
6623
|
-
abi: bgtAbi2,
|
|
6624
|
-
functionName: "boostees",
|
|
6625
|
-
args: [pubkey2]
|
|
6626
|
-
}),
|
|
6627
|
-
publicClient.readContract({
|
|
6628
|
-
address: config.pol.beraChef,
|
|
6629
|
-
abi: beraChefAbi3,
|
|
6630
|
-
functionName: "getActiveRewardAllocation",
|
|
6631
|
-
args: [pubkey2]
|
|
6632
|
-
})
|
|
6633
|
-
]);
|
|
6634
|
-
return {
|
|
6635
|
-
id: keccak2562(pubkey2),
|
|
6636
|
-
pubkey: pubkey2,
|
|
6637
|
-
operator,
|
|
6638
|
-
votingPower: Number(boostees)
|
|
6639
|
-
};
|
|
6640
|
-
},
|
|
6641
|
-
options
|
|
6642
|
-
);
|
|
6643
|
-
};
|
|
6644
|
-
|
|
6645
6331
|
// src/hooks/validators/useStakingPoolBatch.ts
|
|
6646
|
-
import { usePublicClient as
|
|
6647
|
-
|
|
6332
|
+
import { usePublicClient as usePublicClient46 } from "@berachain/wagmi/hooks";
|
|
6333
|
+
function useStakingPoolBatch({
|
|
6648
6334
|
valPubKey,
|
|
6649
6335
|
options
|
|
6650
|
-
})
|
|
6651
|
-
const publicClient =
|
|
6336
|
+
}) {
|
|
6337
|
+
const publicClient = usePublicClient46();
|
|
6652
6338
|
const QUERY_KEY = publicClient && valPubKey ? ["useStakingPoolBatch", valPubKey] : null;
|
|
6653
6339
|
return useSWR(
|
|
6654
6340
|
QUERY_KEY,
|
|
@@ -6664,19 +6350,32 @@ var useStakingPoolBatch = ({
|
|
|
6664
6350
|
...options
|
|
6665
6351
|
}
|
|
6666
6352
|
);
|
|
6667
|
-
}
|
|
6353
|
+
}
|
|
6668
6354
|
|
|
6669
6355
|
// src/hooks/validators/useUserActiveValidators.ts
|
|
6670
|
-
import {
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
-
const
|
|
6674
|
-
const
|
|
6675
|
-
|
|
6676
|
-
|
|
6356
|
+
import { useMemo as useMemo14 } from "react";
|
|
6357
|
+
import { useBeraWallet as useBeraWallet24, usePublicClient as usePublicClient47 } from "@berachain/wagmi/hooks";
|
|
6358
|
+
function useUserActiveValidators(options) {
|
|
6359
|
+
const { address: account } = useBeraWallet24();
|
|
6360
|
+
const publicClient = usePublicClient47();
|
|
6361
|
+
const apiSwr = useSWR(
|
|
6362
|
+
account ? ["useUserActiveValidatorsApi", account] : null,
|
|
6677
6363
|
async ([, account2]) => {
|
|
6678
|
-
return await
|
|
6364
|
+
return await getUserActiveValidatorsApi({ account: account2 });
|
|
6365
|
+
},
|
|
6366
|
+
{
|
|
6367
|
+
...options,
|
|
6368
|
+
refreshInterval: options?.refreshInterval ?? 18e4 /* SLOW */,
|
|
6369
|
+
keepPreviousData: true
|
|
6370
|
+
}
|
|
6371
|
+
);
|
|
6372
|
+
const validators = apiSwr.data;
|
|
6373
|
+
const onChainSwr = useSWR(
|
|
6374
|
+
publicClient && account && validators ? ["useUserActiveValidatorsOnChain", account, validators] : null,
|
|
6375
|
+
async ([, account2, validators2]) => {
|
|
6376
|
+
return await getUserActiveValidatorsOnChain({
|
|
6679
6377
|
account: account2,
|
|
6378
|
+
validators: validators2,
|
|
6680
6379
|
publicClient
|
|
6681
6380
|
});
|
|
6682
6381
|
},
|
|
@@ -6686,16 +6385,35 @@ var useUserActiveValidators = (options) => {
|
|
|
6686
6385
|
keepPreviousData: true
|
|
6687
6386
|
}
|
|
6688
6387
|
);
|
|
6689
|
-
|
|
6388
|
+
const onChainBoosts = onChainSwr.data;
|
|
6389
|
+
const data = useMemo14(() => {
|
|
6390
|
+
if (!validators || !onChainBoosts) return void 0;
|
|
6391
|
+
return mergeUserActiveValidators({ validators, onChainBoosts });
|
|
6392
|
+
}, [validators, onChainBoosts]);
|
|
6393
|
+
return {
|
|
6394
|
+
...apiSwr,
|
|
6395
|
+
data,
|
|
6396
|
+
isLoading: apiSwr.isLoading || onChainSwr.isLoading,
|
|
6397
|
+
isValidating: apiSwr.isValidating || onChainSwr.isValidating,
|
|
6398
|
+
error: apiSwr.error ?? onChainSwr.error,
|
|
6399
|
+
refresh: () => {
|
|
6400
|
+
apiSwr.refresh();
|
|
6401
|
+
onChainSwr.refresh();
|
|
6402
|
+
},
|
|
6403
|
+
refreshOnChain: () => {
|
|
6404
|
+
onChainSwr.refresh();
|
|
6405
|
+
}
|
|
6406
|
+
};
|
|
6407
|
+
}
|
|
6690
6408
|
|
|
6691
6409
|
// src/hooks/validators/useUserBoostsOnValidator.ts
|
|
6692
|
-
import { useBeraWallet as
|
|
6693
|
-
|
|
6410
|
+
import { useBeraWallet as useBeraWallet25, usePublicClient as usePublicClient48 } from "@berachain/wagmi/hooks";
|
|
6411
|
+
function useUserBoostsOnValidator({
|
|
6694
6412
|
pubkey,
|
|
6695
6413
|
...args
|
|
6696
|
-
})
|
|
6697
|
-
const { address: connectedAccount } =
|
|
6698
|
-
const publicClient =
|
|
6414
|
+
}) {
|
|
6415
|
+
const { address: connectedAccount } = useBeraWallet25();
|
|
6416
|
+
const publicClient = usePublicClient48();
|
|
6699
6417
|
const account = args.account ?? connectedAccount;
|
|
6700
6418
|
const QUERY_KEY = account && pubkey ? ["useUserBoostsOnValidator", pubkey, account] : null;
|
|
6701
6419
|
return useSWR(
|
|
@@ -6711,135 +6429,13 @@ var useUserBoostsOnValidator = ({
|
|
|
6711
6429
|
refreshInterval: 1e5 /* NORMAL */
|
|
6712
6430
|
}
|
|
6713
6431
|
);
|
|
6714
|
-
}
|
|
6715
|
-
|
|
6716
|
-
// src/hooks/validators/useUserClaimableIncentives.ts
|
|
6717
|
-
import { useCallback as useCallback4, useMemo as useMemo14 } from "react";
|
|
6718
|
-
import { useBeraWallet as useBeraWallet27 } from "@berachain/wagmi/hooks";
|
|
6719
|
-
|
|
6720
|
-
// src/utils/formatIncentivesTokenMap.ts
|
|
6721
|
-
var formatIncentivesTokenMap = (allRewards) => {
|
|
6722
|
-
const tokenMap = /* @__PURE__ */ new Set();
|
|
6723
|
-
allRewards.forEach((item) => {
|
|
6724
|
-
if (Array.isArray(item.rewards)) {
|
|
6725
|
-
item.rewards.forEach((reward) => {
|
|
6726
|
-
if (reward.token) {
|
|
6727
|
-
tokenMap.add(reward.token);
|
|
6728
|
-
}
|
|
6729
|
-
});
|
|
6730
|
-
}
|
|
6731
|
-
});
|
|
6732
|
-
return tokenMap;
|
|
6733
|
-
};
|
|
6734
|
-
|
|
6735
|
-
// src/hooks/validators/useUserClaimableIncentives.ts
|
|
6736
|
-
var useUserClaimableIncentives = () => {
|
|
6737
|
-
const { address: account } = useBeraWallet27();
|
|
6738
|
-
const REWARDS_QUERY_KEY = account ? ["useUserClaimableIncentives", account] : null;
|
|
6739
|
-
const allRewardsResponse = useSWR(
|
|
6740
|
-
REWARDS_QUERY_KEY,
|
|
6741
|
-
async ([, account2]) => {
|
|
6742
|
-
if (!account2) {
|
|
6743
|
-
throw new BeraError({
|
|
6744
|
-
message: "useUserClaimableIncentives needs a logged in account",
|
|
6745
|
-
level: "error"
|
|
6746
|
-
});
|
|
6747
|
-
}
|
|
6748
|
-
return await getUserClaimableIncentives({
|
|
6749
|
-
account: account2
|
|
6750
|
-
});
|
|
6751
|
-
},
|
|
6752
|
-
{
|
|
6753
|
-
revalidateOnFocus: false,
|
|
6754
|
-
revalidateOnReconnect: false,
|
|
6755
|
-
revalidateIfStale: false,
|
|
6756
|
-
refreshInterval: 18e4 /* SLOW */
|
|
6757
|
-
}
|
|
6758
|
-
);
|
|
6759
|
-
const allRewards = allRewardsResponse?.data;
|
|
6760
|
-
const tokenMap = useMemo14(() => {
|
|
6761
|
-
if (!allRewards) {
|
|
6762
|
-
return void 0;
|
|
6763
|
-
}
|
|
6764
|
-
if (!Array.isArray(allRewards)) {
|
|
6765
|
-
BeraMonitoring.captureException(
|
|
6766
|
-
new BeraError({
|
|
6767
|
-
message: "Incorrect aggregated incentives data receieved.",
|
|
6768
|
-
level: "error",
|
|
6769
|
-
extra: {
|
|
6770
|
-
allRewards,
|
|
6771
|
-
account
|
|
6772
|
-
}
|
|
6773
|
-
})
|
|
6774
|
-
);
|
|
6775
|
-
return void 0;
|
|
6776
|
-
}
|
|
6777
|
-
return formatIncentivesTokenMap(allRewards);
|
|
6778
|
-
}, [allRewards, account]);
|
|
6779
|
-
const QUERY_KEY = account && allRewards ? ["useUserClaimableIncentives", account, allRewards] : null;
|
|
6780
|
-
const swrResponse = useSWR(
|
|
6781
|
-
QUERY_KEY,
|
|
6782
|
-
async ([, account2, allRewards2]) => {
|
|
6783
|
-
if (!account2) {
|
|
6784
|
-
throw new InvalidArgumentError({
|
|
6785
|
-
property: "account",
|
|
6786
|
-
value: account2,
|
|
6787
|
-
expected: "Address"
|
|
6788
|
-
});
|
|
6789
|
-
}
|
|
6790
|
-
if (!allRewards2) {
|
|
6791
|
-
return [];
|
|
6792
|
-
}
|
|
6793
|
-
if (!Array.isArray(allRewards2)) {
|
|
6794
|
-
throw new InvalidArgumentError({
|
|
6795
|
-
message: "Incorrect aggregated incentives data receieved to calculate proofs.",
|
|
6796
|
-
property: "allRewards",
|
|
6797
|
-
value: allRewards2,
|
|
6798
|
-
expected: "Array",
|
|
6799
|
-
level: "error"
|
|
6800
|
-
});
|
|
6801
|
-
}
|
|
6802
|
-
const validatorsSet = new Set(allRewards2.map((item) => item.validator));
|
|
6803
|
-
const validatorAddresses = Array.from(validatorsSet);
|
|
6804
|
-
return await Promise.all(
|
|
6805
|
-
validatorAddresses.map(async (validator) => {
|
|
6806
|
-
const proofsData = await getRewardProofsByValidator({
|
|
6807
|
-
account: account2,
|
|
6808
|
-
validator,
|
|
6809
|
-
page: 1,
|
|
6810
|
-
perPage: 1e4
|
|
6811
|
-
});
|
|
6812
|
-
return {
|
|
6813
|
-
...proofsData,
|
|
6814
|
-
validator
|
|
6815
|
-
};
|
|
6816
|
-
})
|
|
6817
|
-
);
|
|
6818
|
-
},
|
|
6819
|
-
{
|
|
6820
|
-
revalidateOnFocus: false,
|
|
6821
|
-
revalidateOnReconnect: false,
|
|
6822
|
-
revalidateIfStale: false,
|
|
6823
|
-
refreshInterval: 18e4 /* SLOW */
|
|
6824
|
-
}
|
|
6825
|
-
);
|
|
6826
|
-
const refresh = useCallback4(() => {
|
|
6827
|
-
allRewardsResponse?.refresh();
|
|
6828
|
-
swrResponse?.refresh();
|
|
6829
|
-
}, [allRewardsResponse, swrResponse]);
|
|
6830
|
-
return {
|
|
6831
|
-
...swrResponse,
|
|
6832
|
-
isLoading: allRewardsResponse?.isLoading || swrResponse?.isLoading,
|
|
6833
|
-
tokenMap,
|
|
6834
|
-
refresh
|
|
6835
|
-
};
|
|
6836
|
-
};
|
|
6432
|
+
}
|
|
6837
6433
|
|
|
6838
6434
|
// src/hooks/validators/useUserStakingPositions.ts
|
|
6839
|
-
|
|
6435
|
+
function useUserStakingPositions({
|
|
6840
6436
|
account,
|
|
6841
6437
|
validatorAddress
|
|
6842
|
-
})
|
|
6438
|
+
}) {
|
|
6843
6439
|
const queryClient = account ? ["useUserStakingPositions", account, validatorAddress] : null;
|
|
6844
6440
|
return useSWRImmutable(
|
|
6845
6441
|
queryClient,
|
|
@@ -6853,10 +6449,59 @@ var useUserStakingPositions = ({
|
|
|
6853
6449
|
return userStakingPolls;
|
|
6854
6450
|
}
|
|
6855
6451
|
);
|
|
6856
|
-
}
|
|
6452
|
+
}
|
|
6857
6453
|
|
|
6858
6454
|
// src/hooks/validators/useValidator.ts
|
|
6859
6455
|
import { keccak256 as keccak2563 } from "viem";
|
|
6456
|
+
|
|
6457
|
+
// src/hooks/validators/useOnChainValidator.ts
|
|
6458
|
+
import { keccak256 as keccak2562 } from "viem";
|
|
6459
|
+
import { beaconDepositAbi } from "@berachain/abis/pol/beaconDeposit";
|
|
6460
|
+
import { bgtAbi as bgtAbi2 } from "@berachain/abis/pol/bgt";
|
|
6461
|
+
import { beraChefAbi as beraChefAbi3 } from "@berachain/abis/pol/rewards/beraChef";
|
|
6462
|
+
import { usePublicClient as usePublicClient49 } from "@berachain/wagmi/hooks";
|
|
6463
|
+
function useOnChainValidator({ pubkey }, options) {
|
|
6464
|
+
const publicClient = usePublicClient49();
|
|
6465
|
+
const QUERY_KEY = pubkey ? ["useOnChainValidator", pubkey] : null;
|
|
6466
|
+
return useSWR(
|
|
6467
|
+
publicClient ? QUERY_KEY : null,
|
|
6468
|
+
async ([, pubkey2]) => {
|
|
6469
|
+
assertPublicClient(publicClient);
|
|
6470
|
+
const { config } = parseBaseArgs({
|
|
6471
|
+
chainId: publicClient.chain.id
|
|
6472
|
+
});
|
|
6473
|
+
const [operator, boostees, _rewardAllocation] = await Promise.all([
|
|
6474
|
+
publicClient.readContract({
|
|
6475
|
+
address: config.depositContract,
|
|
6476
|
+
abi: beaconDepositAbi,
|
|
6477
|
+
functionName: "getOperator",
|
|
6478
|
+
args: [pubkey2]
|
|
6479
|
+
}),
|
|
6480
|
+
publicClient?.readContract({
|
|
6481
|
+
address: config.tokens.bgt,
|
|
6482
|
+
abi: bgtAbi2,
|
|
6483
|
+
functionName: "boostees",
|
|
6484
|
+
args: [pubkey2]
|
|
6485
|
+
}),
|
|
6486
|
+
publicClient.readContract({
|
|
6487
|
+
address: config.pol.beraChef,
|
|
6488
|
+
abi: beraChefAbi3,
|
|
6489
|
+
functionName: "getActiveRewardAllocation",
|
|
6490
|
+
args: [pubkey2]
|
|
6491
|
+
})
|
|
6492
|
+
]);
|
|
6493
|
+
return {
|
|
6494
|
+
id: keccak2562(pubkey2),
|
|
6495
|
+
pubkey: pubkey2,
|
|
6496
|
+
operator,
|
|
6497
|
+
votingPower: Number(boostees)
|
|
6498
|
+
};
|
|
6499
|
+
},
|
|
6500
|
+
options
|
|
6501
|
+
);
|
|
6502
|
+
}
|
|
6503
|
+
|
|
6504
|
+
// src/hooks/validators/useValidator.ts
|
|
6860
6505
|
function useValidator({ pubkey }, options) {
|
|
6861
6506
|
const {
|
|
6862
6507
|
data: { validator: indexerValidator, uptime } = {},
|
|
@@ -6899,30 +6544,10 @@ function useValidator({ pubkey }, options) {
|
|
|
6899
6544
|
};
|
|
6900
6545
|
}
|
|
6901
6546
|
|
|
6902
|
-
// src/hooks/validators/useValidatorAnalytics.ts
|
|
6903
|
-
function useValidatorAnalytics({
|
|
6904
|
-
pubkey,
|
|
6905
|
-
dayRange
|
|
6906
|
-
}) {
|
|
6907
|
-
const QUERY_KEY = pubkey && dayRange ? ["useValidatorAnalytics", pubkey, dayRange] : null;
|
|
6908
|
-
return useSWR(
|
|
6909
|
-
QUERY_KEY,
|
|
6910
|
-
async ([, pubkey2, dayRange2]) => {
|
|
6911
|
-
return await getValidatorAnalytics({
|
|
6912
|
-
pubkey: pubkey2,
|
|
6913
|
-
dayRange: dayRange2
|
|
6914
|
-
});
|
|
6915
|
-
},
|
|
6916
|
-
{
|
|
6917
|
-
refreshInterval: 18e4 /* SLOW */
|
|
6918
|
-
}
|
|
6919
|
-
);
|
|
6920
|
-
}
|
|
6921
|
-
|
|
6922
6547
|
// src/hooks/validators/useValidatorCommission.ts
|
|
6923
|
-
import { usePublicClient as
|
|
6924
|
-
|
|
6925
|
-
const publicClient =
|
|
6548
|
+
import { usePublicClient as usePublicClient50 } from "@berachain/wagmi/hooks";
|
|
6549
|
+
function useValidatorCommission(pubKey, options) {
|
|
6550
|
+
const publicClient = usePublicClient50();
|
|
6926
6551
|
const QUERY_KEY = publicClient && pubKey ? ["useValidatorCommission", pubKey] : null;
|
|
6927
6552
|
return swr_default(
|
|
6928
6553
|
QUERY_KEY,
|
|
@@ -6936,10 +6561,10 @@ var useValidatorCommission = (pubKey, options) => {
|
|
|
6936
6561
|
...options
|
|
6937
6562
|
}
|
|
6938
6563
|
);
|
|
6939
|
-
}
|
|
6564
|
+
}
|
|
6940
6565
|
|
|
6941
6566
|
// src/hooks/validators/useValidatorEstimatedBgtPerYear.ts
|
|
6942
|
-
|
|
6567
|
+
function useValidatorEstimatedBgtPerYear(validator) {
|
|
6943
6568
|
const { data: globalData, isLoading } = usePollGlobalData();
|
|
6944
6569
|
const blockTime = useBlockTime();
|
|
6945
6570
|
return {
|
|
@@ -6950,7 +6575,7 @@ var useValidatorEstimatedBgtPerYear = (validator) => {
|
|
|
6950
6575
|
) : void 0,
|
|
6951
6576
|
isLoading
|
|
6952
6577
|
};
|
|
6953
|
-
}
|
|
6578
|
+
}
|
|
6954
6579
|
|
|
6955
6580
|
// src/actions/validators/getValidatorIncentiveDistribution.ts
|
|
6956
6581
|
async function getValidatorIncentiveDistribution({
|
|
@@ -7007,9 +6632,9 @@ function useValidatorIncentiveDistribution({
|
|
|
7007
6632
|
}
|
|
7008
6633
|
|
|
7009
6634
|
// src/hooks/validators/useValidatorQueuedCommission.ts
|
|
7010
|
-
import { usePublicClient as
|
|
6635
|
+
import { usePublicClient as usePublicClient51 } from "@berachain/wagmi/hooks";
|
|
7011
6636
|
function useValidatorQueuedCommission(pubKey, options) {
|
|
7012
|
-
const publicClient =
|
|
6637
|
+
const publicClient = usePublicClient51();
|
|
7013
6638
|
const QUERY_KEY = publicClient && pubKey ? ["useValidatorQueuedCommission", pubKey] : null;
|
|
7014
6639
|
return useSWR(
|
|
7015
6640
|
QUERY_KEY,
|
|
@@ -7027,9 +6652,9 @@ function useValidatorQueuedCommission(pubKey, options) {
|
|
|
7027
6652
|
}
|
|
7028
6653
|
|
|
7029
6654
|
// src/hooks/validators/useValidatorQueuedOperatorAddress.ts
|
|
7030
|
-
import { usePublicClient as
|
|
7031
|
-
|
|
7032
|
-
const publicClient =
|
|
6655
|
+
import { usePublicClient as usePublicClient52 } from "@berachain/wagmi/hooks";
|
|
6656
|
+
function useValidatorQueuedOperatorAddress(pubKey, options) {
|
|
6657
|
+
const publicClient = usePublicClient52();
|
|
7033
6658
|
const QUERY_KEY = publicClient && pubKey ? ["useValidatorQueuedOperatorAddress", pubKey] : null;
|
|
7034
6659
|
return useSWR(
|
|
7035
6660
|
QUERY_KEY,
|
|
@@ -7043,12 +6668,12 @@ var useValidatorQueuedOperatorAddress = (pubKey, options) => {
|
|
|
7043
6668
|
...options
|
|
7044
6669
|
}
|
|
7045
6670
|
);
|
|
7046
|
-
}
|
|
6671
|
+
}
|
|
7047
6672
|
|
|
7048
6673
|
// src/hooks/validators/useValidatorQueuedRewardAllocation.ts
|
|
7049
|
-
import { usePublicClient as
|
|
7050
|
-
|
|
7051
|
-
const publicClient =
|
|
6674
|
+
import { usePublicClient as usePublicClient53 } from "@berachain/wagmi/hooks";
|
|
6675
|
+
function useValidatorQueuedRewardAllocation(pubKey, options) {
|
|
6676
|
+
const publicClient = usePublicClient53();
|
|
7052
6677
|
const QUERY_KEY = publicClient && pubKey ? ["useValidatorQueuedRewardAllocation", pubKey] : null;
|
|
7053
6678
|
return useSWR(
|
|
7054
6679
|
QUERY_KEY,
|
|
@@ -7062,12 +6687,12 @@ var useValidatorQueuedRewardAllocation = (pubKey, options) => {
|
|
|
7062
6687
|
...options
|
|
7063
6688
|
}
|
|
7064
6689
|
);
|
|
7065
|
-
}
|
|
6690
|
+
}
|
|
7066
6691
|
|
|
7067
6692
|
// src/hooks/validators/useValidatorRewardAllocation.ts
|
|
7068
|
-
import { usePublicClient as
|
|
6693
|
+
import { usePublicClient as usePublicClient54 } from "@berachain/wagmi/hooks";
|
|
7069
6694
|
function useValidatorRewardAllocation(pubKey, options) {
|
|
7070
|
-
const publicClient =
|
|
6695
|
+
const publicClient = usePublicClient54();
|
|
7071
6696
|
const QUERY_KEY = publicClient && pubKey ? ["useValidatorRewardAllocation", pubKey] : null;
|
|
7072
6697
|
return useSWR(
|
|
7073
6698
|
QUERY_KEY,
|
|
@@ -7085,6 +6710,8 @@ function useValidatorRewardAllocation(pubKey, options) {
|
|
|
7085
6710
|
export {
|
|
7086
6711
|
OracleMode,
|
|
7087
6712
|
USE_AGGREGATORS_QUOTES_QUERY_KEY,
|
|
6713
|
+
fetchMultipleTokenInformation,
|
|
6714
|
+
isNativeFeeInsufficient,
|
|
7088
6715
|
reducer,
|
|
7089
6716
|
useAggregatorsQuotes,
|
|
7090
6717
|
useAggregatorsRouterFeeBps,
|
|
@@ -7104,11 +6731,10 @@ export {
|
|
|
7104
6731
|
useBendMultiply,
|
|
7105
6732
|
useBendZapSupply,
|
|
7106
6733
|
useBendZapSupplyHelper,
|
|
7107
|
-
|
|
6734
|
+
useBeraContractWrite,
|
|
7108
6735
|
useBeraCurrentPrice,
|
|
7109
6736
|
useBexStatus,
|
|
7110
6737
|
useBgtAprSimulation,
|
|
7111
|
-
useBgtIncentiveDistributorPaused,
|
|
7112
6738
|
useBgtUnstakedBalance,
|
|
7113
6739
|
useBlockToTimestamp,
|
|
7114
6740
|
useCappedGlobally,
|
|
@@ -7116,9 +6742,7 @@ export {
|
|
|
7116
6742
|
useClaimableFees,
|
|
7117
6743
|
useCollateralWeights,
|
|
7118
6744
|
useCreatePool,
|
|
7119
|
-
|
|
7120
|
-
useDefaultRewardAllocation,
|
|
7121
|
-
useEnsoSwapBundle,
|
|
6745
|
+
useCrossChainNativeFee,
|
|
7122
6746
|
useEnsoUserTokensWithBalances,
|
|
7123
6747
|
useGetConvertToAssets,
|
|
7124
6748
|
useGetVerifiedAbi,
|
|
@@ -7140,7 +6764,6 @@ export {
|
|
|
7140
6764
|
useMultipleTokenInformation,
|
|
7141
6765
|
useOnChainPoolData,
|
|
7142
6766
|
useOnChainPoolDataQueryKey,
|
|
7143
|
-
useOnChainValidator,
|
|
7144
6767
|
usePollAllowances,
|
|
7145
6768
|
usePollBalance,
|
|
7146
6769
|
usePollGlobalData,
|
|
@@ -7168,13 +6791,12 @@ export {
|
|
|
7168
6791
|
useRewardVaults,
|
|
7169
6792
|
useRewardVaultsQueryKey,
|
|
7170
6793
|
useSingleAggregatorQuote,
|
|
7171
|
-
|
|
6794
|
+
useStakedAPY,
|
|
7172
6795
|
useStakedData,
|
|
7173
6796
|
useStakedSnapshots,
|
|
7174
6797
|
useStakingPoolBatch,
|
|
7175
6798
|
useStakingTokenInformation,
|
|
7176
6799
|
useStakingVaultsMetadata,
|
|
7177
|
-
useTokenCurrentPrice,
|
|
7178
6800
|
useTokenCurrentPrices,
|
|
7179
6801
|
useTokenInformation,
|
|
7180
6802
|
useTokenPrice,
|
|
@@ -7184,12 +6806,10 @@ export {
|
|
|
7184
6806
|
useTotalSupply,
|
|
7185
6807
|
useUserActiveValidators,
|
|
7186
6808
|
useUserBoostsOnValidator,
|
|
7187
|
-
useUserClaimableIncentives,
|
|
7188
6809
|
useUserStakingPositions,
|
|
7189
6810
|
useUserVaultInfo,
|
|
7190
6811
|
useUserVaults,
|
|
7191
6812
|
useValidator,
|
|
7192
|
-
useValidatorAnalytics,
|
|
7193
6813
|
useValidatorCommission,
|
|
7194
6814
|
useValidatorEstimatedBgtPerYear,
|
|
7195
6815
|
useValidatorIncentiveDistribution,
|
|
@@ -7202,3 +6822,4 @@ export {
|
|
|
7202
6822
|
useVaultValidators,
|
|
7203
6823
|
useZapStakeBera
|
|
7204
6824
|
};
|
|
6825
|
+
//# sourceMappingURL=exports.mjs.map
|