@berachain/berajs 0.2.5 → 0.2.6-patch.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -0
- package/dist/abi/exports.cjs +1 -1
- package/dist/abi/exports.cjs.map +1 -1
- package/dist/abi/exports.d.cts +17 -1
- package/dist/abi/exports.d.ts +17 -1
- package/dist/abi/exports.mjs +1 -1
- package/dist/abi/exports.mjs.map +1 -1
- package/dist/actions/exports.cjs +1 -1
- package/dist/actions/exports.cjs.map +1 -1
- package/dist/actions/exports.d.cts +9 -38
- package/dist/actions/exports.d.ts +9 -38
- package/dist/actions/exports.mjs +1 -1
- package/dist/actions/exports.mjs.map +1 -1
- package/dist/chunk-2YBHAMDV.cjs +2 -0
- package/dist/chunk-2YBHAMDV.cjs.map +1 -0
- package/dist/chunk-57RINXU6.cjs +2 -0
- package/dist/chunk-57RINXU6.cjs.map +1 -0
- package/dist/{chunk-AX2YQQFQ.mjs → chunk-74QD4JAH.mjs} +2 -2
- package/dist/chunk-74QD4JAH.mjs.map +1 -0
- package/dist/chunk-74WA35RI.cjs +2 -0
- package/dist/chunk-74WA35RI.cjs.map +1 -0
- package/dist/{chunk-7WRTK7RJ.mjs → chunk-BEKH5EYT.mjs} +2 -2
- package/dist/chunk-BEKH5EYT.mjs.map +1 -0
- package/dist/{chunk-FCWDGE62.cjs → chunk-CF3LFNXG.cjs} +2 -2
- package/dist/chunk-CF3LFNXG.cjs.map +1 -0
- package/dist/chunk-COMMLZ3O.mjs +2 -0
- package/dist/chunk-COMMLZ3O.mjs.map +1 -0
- package/dist/chunk-DDEQFR3M.cjs +2 -0
- package/dist/chunk-DDEQFR3M.cjs.map +1 -0
- package/dist/{chunk-6LDOG5RL.cjs → chunk-DK42F2ZM.cjs} +2 -2
- package/dist/chunk-DK42F2ZM.cjs.map +1 -0
- package/dist/{chunk-7SMWQ6SN.mjs → chunk-FM3WDBFH.mjs} +2 -2
- package/dist/chunk-FM3WDBFH.mjs.map +1 -0
- package/dist/chunk-HWOGQSNL.cjs +4 -0
- package/dist/chunk-HWOGQSNL.cjs.map +1 -0
- package/dist/chunk-I7M43BB4.cjs +2 -0
- package/dist/chunk-I7M43BB4.cjs.map +1 -0
- package/dist/chunk-IBJOI5SN.mjs +4 -0
- package/dist/chunk-IBJOI5SN.mjs.map +1 -0
- package/dist/chunk-IDFMLLDY.mjs +2 -0
- package/dist/chunk-IDFMLLDY.mjs.map +1 -0
- package/dist/{chunk-YZV5LKIP.cjs → chunk-LNVR4BW6.cjs} +2 -2
- package/dist/chunk-LNVR4BW6.cjs.map +1 -0
- package/dist/{chunk-3YXSUBA5.mjs → chunk-MJZHJFZO.mjs} +2 -2
- package/dist/chunk-MK5NS5B5.mjs +2 -0
- package/dist/chunk-MK5NS5B5.mjs.map +1 -0
- package/dist/{chunk-C6ZGUO4H.cjs → chunk-NMH7LHPW.cjs} +2 -2
- package/dist/chunk-NMH7LHPW.cjs.map +1 -0
- package/dist/{chunk-PKXAW6MO.cjs → chunk-NVHV2LDK.cjs} +2 -2
- package/dist/chunk-NVHV2LDK.cjs.map +1 -0
- package/dist/chunk-OGBD5YOG.mjs +2 -0
- package/dist/chunk-OGBD5YOG.mjs.map +1 -0
- package/dist/chunk-OIYXOKTT.cjs.map +1 -1
- package/dist/chunk-OUD27MU7.cjs.map +1 -1
- package/dist/{chunk-ECRMUMTA.mjs → chunk-PLIH6KQM.mjs} +2 -2
- package/dist/chunk-PLIH6KQM.mjs.map +1 -0
- package/dist/chunk-QRAIGQF2.mjs +2 -0
- package/dist/chunk-QRAIGQF2.mjs.map +1 -0
- package/dist/chunk-RWOICHRW.cjs +2 -0
- package/dist/chunk-RWOICHRW.cjs.map +1 -0
- package/dist/chunk-T5FSQ3YE.mjs +2 -0
- package/dist/chunk-T5FSQ3YE.mjs.map +1 -0
- package/dist/chunk-WRFDB3QJ.cjs.map +1 -1
- package/dist/chunk-XNJLSA6P.cjs.map +1 -1
- package/dist/contexts/exports.cjs +1 -1
- package/dist/contexts/exports.cjs.map +1 -1
- package/dist/contexts/exports.d.cts +1 -1
- package/dist/contexts/exports.d.ts +1 -1
- package/dist/contexts/exports.mjs +1 -1
- package/dist/contexts/exports.mjs.map +1 -1
- package/dist/{defaultFlags-d0kPbT0i.d.cts → defaultFlags-D6KfkTZx.d.cts} +1 -1
- package/dist/{defaultFlags-d0kPbT0i.d.ts → defaultFlags-D6KfkTZx.d.ts} +1 -1
- package/dist/enum/exports.cjs +1 -1
- package/dist/enum/exports.cjs.map +1 -1
- package/dist/enum/exports.d.cts +1 -1
- package/dist/enum/exports.d.ts +1 -1
- package/dist/enum/exports.mjs +1 -1
- package/dist/errors/exports.cjs +1 -1
- package/dist/errors/exports.cjs.map +1 -1
- package/dist/errors/exports.d.cts +8 -3
- package/dist/errors/exports.d.ts +8 -3
- package/dist/errors/exports.mjs +1 -1
- package/dist/{getValidatorQueuedOperatorAddress-DZgrPmZ2.d.cts → getValidatorQueuedOperatorAddress-BdDYHycN.d.cts} +15 -4
- package/dist/{getValidatorQueuedOperatorAddress-CqR6cyqC.d.ts → getValidatorQueuedOperatorAddress-CmiPJmsr.d.ts} +15 -4
- package/dist/{global.d-BeYWDreg.d.ts → global.d-3GQMgC9k.d.ts} +1 -1
- package/dist/{global.d-DghRxpHd.d.cts → global.d-CwT1Phzf.d.cts} +1 -1
- package/dist/hooks/exports.cjs +3 -3
- package/dist/hooks/exports.cjs.map +1 -1
- package/dist/hooks/exports.d.cts +54 -75
- package/dist/hooks/exports.d.ts +54 -75
- package/dist/hooks/exports.mjs +3 -3
- package/dist/hooks/exports.mjs.map +1 -1
- package/dist/{txnEnum-DxPRHSJt.d.cts → txnEnum-CCuQUFlh.d.cts} +7 -0
- package/dist/{txnEnum-DxPRHSJt.d.ts → txnEnum-CCuQUFlh.d.ts} +7 -0
- package/dist/types/exports.cjs.map +1 -1
- package/dist/types/exports.d.cts +37 -4
- package/dist/types/exports.d.ts +37 -4
- package/dist/utils/exports.cjs +1 -1
- package/dist/utils/exports.cjs.map +1 -1
- package/dist/utils/exports.d.cts +2 -2
- package/dist/utils/exports.d.ts +2 -2
- package/dist/utils/exports.mjs +1 -1
- package/dist/utils/exports.mjs.map +1 -1
- package/package.json +25 -25
- package/src/abi/enso/ensoWalletV2Factory.ts +9 -0
- package/src/abi/exports.ts +1 -0
- package/src/abi/pyth/pyth.ts +0 -0
- package/src/actions/clients/BeraApolloClient.ts +3 -3
- package/src/actions/clients/getApolloClient.ts +5 -5
- package/src/actions/clients/getEnsoClient.ts +1 -1
- package/src/actions/dex/__tests__/aggregators.unit.test.ts +3 -3
- package/src/actions/dex/__tests__/getOnChainPool.unit.test.ts +1 -1
- package/src/actions/dex/aggregators/base.ts +12 -8
- package/src/actions/dex/aggregators/bex.ts +8 -8
- package/src/actions/dex/aggregators/bgt.ts +4 -4
- package/src/actions/dex/aggregators/enso/enso.ts +28 -20
- package/src/actions/dex/aggregators/enso/ensoErc4626.debug.test.ts +1 -1
- package/src/actions/dex/aggregators/enso/ensoErc4626.ts +7 -4
- package/src/actions/dex/aggregators/erc4626.ts +10 -6
- package/src/actions/dex/aggregators/fly.ts +9 -5
- package/src/actions/dex/aggregators/haiku.integration.test.ts +3 -3
- package/src/actions/dex/aggregators/haiku.ts +9 -5
- package/src/actions/dex/aggregators/honey.ts +15 -15
- package/src/actions/dex/aggregators/kyberswap.ts +8 -4
- package/src/actions/dex/aggregators/oogabooga.ts +8 -4
- package/src/actions/dex/aggregators/openOcean.ts +12 -8
- package/src/actions/dex/aggregators/wbera.ts +8 -4
- package/src/actions/dex/b-sdk.ts +2 -2
- package/src/actions/dex/getAllPools.ts +2 -2
- package/src/actions/dex/getApiPool.ts +2 -2
- package/src/actions/dex/getGlobalLiquidityAndSwapVolume.ts +2 -2
- package/src/actions/dex/getIsTokenExploited.ts +1 -1
- package/src/actions/dex/getOnChainPool.ts +3 -3
- package/src/actions/dex/getPoolEvents.ts +2 -2
- package/src/actions/dex/getPoolHistoricalData.ts +2 -2
- package/src/actions/dex/getVaultPausedState.ts +1 -1
- package/src/actions/enso/__tests__/getBendDemultiplyBundle.action.unit.test.ts +175 -0
- package/src/actions/enso/__tests__/getBendDemultiplyBundle.unit.test.ts +150 -0
- package/src/actions/enso/__tests__/getBendMultiplyBundle.action.unit.test.ts +138 -0
- package/src/actions/enso/__tests__/getBendMultiplyBundle.unit.test.ts +194 -0
- package/src/actions/enso/{getEnsoUserTokensWithBalances.debug.test.ts → __tests__/getEnsoUserTokensWithBalances.debug.test.ts} +3 -3
- package/src/actions/enso/__tests__/helpers.ts +42 -0
- package/src/actions/enso/__tests__/util.unit.test.ts +95 -0
- package/src/actions/enso/flashloan.ts +127 -0
- package/src/actions/enso/getBendDemultiplyBundle.ts +325 -0
- package/src/actions/enso/getBendMultiplyBundle.ts +348 -0
- package/src/actions/enso/getEnsoSwapBundle.ts +2 -2
- package/src/actions/enso/getEnsoUserTokensWithBalances.ts +5 -5
- package/src/actions/enso/util.ts +150 -5
- package/src/actions/exports.ts +0 -2
- package/src/actions/governance/__tests__/checkProposalField.unit.test.ts +2 -2
- package/src/actions/governance/__tests__/getDecodedFunctionData.integration.test.ts +2 -2
- package/src/actions/governance/__tests__/getQuorum.integration.test.ts +2 -2
- package/src/actions/governance/checkProposalField.ts +1 -1
- package/src/actions/governance/computeActualStatus.ts +1 -1
- package/src/actions/governance/getAllProposals.ts +1 -1
- package/src/actions/governance/getBodyErrors.ts +1 -1
- package/src/actions/governance/getProposalDetails.ts +1 -1
- package/src/actions/governance/getProposalFromTx.ts +1 -1
- package/src/actions/governance/getProposalParams.ts +3 -3
- package/src/actions/governance/getProposalVotes.ts +1 -1
- package/src/actions/governance/getQuorum.ts +2 -2
- package/src/actions/honey/getCollateralWeights.ts +2 -2
- package/src/actions/honey/getGlobalCapLimit.ts +4 -4
- package/src/actions/honey/getHoneyCollaterals.ts +5 -5
- package/src/actions/honey/getHoneyFees.ts +1 -1
- package/src/actions/honey/getHoneyPausedState.ts +1 -1
- package/src/actions/honey/getHoneyPreview.ts +3 -3
- package/src/actions/honey/getHoneyRootPriceOracle.ts +1 -1
- package/src/actions/honey/getHoneyVaultsBalance.ts +2 -2
- package/src/actions/honey/getRelativeCapLimit.ts +3 -3
- package/src/actions/honey/getSharesWithoutFees.ts +1 -1
- package/src/actions/honey/getSwapPayload.ts +6 -6
- package/src/actions/honey/isBadCollateralAsset.ts +2 -2
- package/src/actions/honey/isBasketModeEnabled.ts +2 -2
- package/src/actions/honey/tests/pyth.integration.test.ts +3 -3
- package/src/actions/misc/getBlockTimestamp.ts +2 -2
- package/src/actions/pol/__tests__/getAllValidators.integration.test.ts +2 -2
- package/src/actions/pol/__tests__/rewardVaults.integration.test.ts +1 -1
- package/src/actions/pol/getBGTGlobalInfo.ts +2 -2
- package/src/actions/pol/getBgtAprSimulation.ts +1 -1
- package/src/actions/pol/getBgtAprSimultaion.unit.test.ts +1 -1
- package/src/actions/pol/getBgtTokenTotalBoosts.ts +2 -2
- package/src/actions/pol/getBgtTokenTotalSupply.ts +2 -2
- package/src/actions/pol/getBlockTime.debug.test.ts +13 -0
- package/src/actions/pol/getBlockTime.ts +14 -23
- package/src/actions/pol/getEarnedStakedBeraVault.ts +3 -3
- package/src/actions/pol/getGlobalCuttingBoard.ts +0 -0
- package/src/actions/pol/getGlobalData.ts +2 -2
- package/src/actions/pol/getIncentiveFeeClaimStats.ts +4 -4
- package/src/actions/pol/getLSTStakeConfig.ts +5 -5
- package/src/actions/pol/getMarkets.ts +2 -2
- package/src/actions/pol/getRewardProofsByValidator.ts +4 -4
- package/src/actions/pol/getRewardTokenToBeraRate.ts +1 -1
- package/src/actions/pol/getRewardVault.ts +3 -3
- package/src/actions/pol/getRewardVaultBeaconImplementation.integration.test.ts +1 -1
- package/src/actions/pol/getRewardVaultBeaconImplementation.ts +3 -3
- package/src/actions/pol/getRewardVaultDurationConstants.integration.test.ts +1 -1
- package/src/actions/pol/getRewardVaultDurationConstants.ts +1 -1
- package/src/actions/pol/getRewardVaultFromToken.ts +1 -1
- package/src/actions/pol/getRewardVaultIncentives.ts +2 -2
- package/src/actions/pol/getRewardVaultRewards.ts +1 -1
- package/src/actions/pol/getRewardVaults.ts +1 -1
- package/src/actions/pol/getSWBeraVaultMetadata.ts +20 -22
- package/src/actions/pol/getSWBeraWithdrawal.ts +4 -4
- package/src/actions/pol/getStakedBeraAPR.ts +2 -2
- package/src/actions/pol/getStakedBeraSnapshots.ts +2 -2
- package/src/actions/pol/getStakingDailyAssets.ts +3 -3
- package/src/actions/pol/getStakingTokenInformation.ts +2 -2
- package/src/actions/pol/getTotalStakedAmount.ts +1 -1
- package/src/actions/pol/getUserClaimableIncentives.ts +4 -4
- package/src/actions/pol/getUserVaultInfo.ts +1 -1
- package/src/actions/pol/getUserVaults.ts +4 -4
- package/src/actions/pol/getUserVaultsBalance.ts +1 -1
- package/src/actions/pol/getUserVaultsReward.ts +0 -0
- package/src/actions/pol/getVaultHistory.ts +2 -2
- package/src/actions/pol/getVaultValidators.ts +1 -1
- package/src/actions/pol/getVaultsSupply.ts +0 -0
- package/src/actions/prices/__tests__/prices.integration.test.ts +2 -2
- package/src/actions/prices/getTokenCurrentPrices.ts +5 -5
- package/src/actions/pyth/getHoneyPythFeeds.ts +2 -2
- package/src/actions/pyth/getUpdateFee.ts +2 -2
- package/src/actions/tokens/getAllowances.ts +2 -2
- package/src/actions/tokens/getTokenInformation.ts +2 -2
- package/src/actions/tokens/getTokens.ts +3 -3
- package/src/actions/tokens/getUnderlyingToken.ts +4 -4
- package/src/actions/tokens/getWalletBalances.integration.test.ts +1 -1
- package/src/actions/tokens/getWalletBalances.ts +4 -4
- package/src/actions/transactions/beraWriteContract.integration.test.ts +6 -6
- package/src/actions/transactions/beraWriteContract.ts +12 -12
- package/src/actions/validators/getActiveBoostAndCommissionChangeDelay.integration.test.ts +1 -1
- package/src/actions/validators/getActiveBoostAndCommissionChangeDelay.ts +1 -1
- package/src/actions/validators/getAllValidators.ts +2 -2
- package/src/actions/validators/getApiValidator.ts +2 -2
- package/src/actions/validators/getBaselineRewardAllocation.ts +1 -1
- package/src/actions/validators/getDailyValidatorBlockStats.ts +1 -1
- package/src/actions/validators/getDefaultRewardAllocation.ts +1 -1
- package/src/actions/validators/getUserActiveValidators.ts +31 -33
- package/src/actions/validators/getUserBoosts.ts +12 -8
- package/src/actions/validators/getUserBoostsOnValidator.ts +15 -3
- package/src/actions/validators/getUserStakingPositions.ts +1 -1
- package/src/actions/validators/getValidatorAnalytics.ts +2 -2
- package/src/actions/validators/getValidatorCommission.ts +1 -1
- package/src/actions/validators/getValidatorEstimatedBgtPerYear.ts +1 -1
- package/src/actions/validators/getValidatorOperatorAddress.ts +1 -1
- package/src/actions/validators/getValidatorQueuedCommission.ts +1 -1
- package/src/actions/validators/getValidatorQueuedOperatorAddress.ts +1 -1
- package/src/actions/validators/getValidatorQueuedRewardAllocation.ts +1 -1
- package/src/actions/validators/getValidatorRewardAllocation.ts +1 -1
- package/src/actions/validators/getValidatorRewardAllocatorAddress.ts +1 -1
- package/src/actions/validators/utils/__tests__/validatorUtils.integration.test.ts +4 -4
- package/src/contexts/BeraFlags/defaultFlags.ts +4 -0
- package/src/contexts/BexStatusProvider.tsx +1 -1
- package/src/contexts/HoneyConfigProvider.tsx +3 -3
- package/src/contexts/SwrFallback.tsx +2 -2
- package/src/contexts/TokensProvider.tsx +3 -3
- package/src/contexts/block-time-provider.tsx +1 -1
- package/src/contexts/exports.ts +0 -0
- package/src/data/contracts.ts +10 -0
- package/src/enum/exports.ts +0 -0
- package/src/enum/polling.ts +0 -0
- package/src/enum/txnEnum.ts +9 -0
- package/src/errors/BeraMonitoring.ts +2 -2
- package/src/errors/BeraTracing.ts +2 -2
- package/src/errors/RequestError.ts +1 -1
- package/src/errors/assert.ts +18 -0
- package/src/errors/getErrorMessage.ts +0 -0
- package/src/errors/getRevertReason.integration.test.ts +7 -7
- package/src/errors/getRevertReason.ts +1 -1
- package/src/errors/parseViemError.ts +1 -1
- package/src/hooks/bend/useGetConvertToAssets.ts +4 -4
- package/src/hooks/dex/useAggregatorsQuotes.ts +19 -19
- package/src/hooks/dex/useAggregatorsRouterFeeBps.ts +2 -2
- package/src/hooks/dex/useAllUserPools.ts +3 -3
- package/src/hooks/dex/useApiPool.ts +3 -3
- package/src/hooks/dex/useBexStatus.ts +1 -1
- package/src/hooks/dex/useCreatePool.ts +9 -9
- package/src/hooks/dex/useExploitedTokens.ts +3 -3
- package/src/hooks/dex/useGlobalLiquidityAndSwapVolume.ts +1 -1
- package/src/hooks/dex/useLiquidityMismatch.ts +3 -3
- package/src/hooks/dex/useLpPosition.ts +7 -4
- package/src/hooks/dex/useMultipleTokenApprovalsWithSlippage.ts +4 -4
- package/src/hooks/dex/useOnChainPoolData.ts +3 -3
- package/src/hooks/dex/usePollPoolCreationRelayerApproval.ts +3 -3
- package/src/hooks/dex/usePool.ts +7 -40
- package/src/hooks/dex/usePoolEvents.ts +2 -2
- package/src/hooks/dex/usePoolHistoricalData.ts +6 -3
- package/src/hooks/dex/usePools.ts +3 -3
- package/src/hooks/dex/usePriceImpact.ts +2 -2
- package/src/hooks/dex/useSingleAggregatorQuote.ts +13 -13
- package/src/hooks/enso/useBendDemultiply.ts +158 -0
- package/src/hooks/enso/useBendMultiply.ts +163 -0
- package/src/hooks/enso/useBendZapSupply.ts +7 -7
- package/src/hooks/enso/useEnsoSwapBundle.ts +6 -6
- package/src/hooks/enso/useEnsoUserTokensWithBalances.ts +5 -5
- package/src/hooks/enso/useEnsoWalletV2Address.ts +38 -0
- package/src/hooks/enso/useIsBendAuthorized.ts +47 -0
- package/src/hooks/enso/useZapStakeBera.ts +4 -4
- package/src/hooks/exports.ts +4 -3
- package/src/hooks/governance/useCreateProposal.ts +3 -3
- package/src/hooks/governance/useGetPastVotes.ts +2 -2
- package/src/hooks/governance/useHasVoted.ts +2 -2
- package/src/hooks/governance/useIsCanceller.ts +4 -4
- package/src/hooks/governance/usePollAllProposals.ts +3 -3
- package/src/hooks/governance/usePollProposal.ts +7 -4
- package/src/hooks/governance/usePollProposalThreshold.ts +3 -3
- package/src/hooks/governance/usePollProposalVotes.ts +1 -1
- package/src/hooks/governance/usePollUserDelegates.ts +7 -4
- package/src/hooks/governance/useProposalFromTx.ts +1 -1
- package/src/hooks/governance/useProposalSnapshot.ts +2 -2
- package/src/hooks/governance/useProposalState.ts +2 -2
- package/src/hooks/governance/useProposalTimelockState.ts +2 -2
- package/src/hooks/governance/useQuorum.ts +1 -1
- package/src/hooks/honey/useCappedGlobally.ts +8 -5
- package/src/hooks/honey/useCappedRelatively.ts +7 -4
- package/src/hooks/honey/useCollateralWeights.ts +8 -5
- package/src/hooks/honey/useHoneyAlerts.ts +5 -5
- package/src/hooks/honey/useHoneyBalances.ts +7 -7
- package/src/hooks/honey/useHoneyChartData.ts +1 -1
- package/src/hooks/honey/useHoneySwapState.ts +4 -4
- package/src/hooks/honey/useHoneyVaultsBalance.ts +8 -5
- package/src/hooks/honey/useIsBadCollateralAsset.ts +9 -6
- package/src/hooks/honey/useIsBasketModeEnabled.ts +8 -5
- package/src/hooks/honey/usePythLatestPrices.ts +4 -4
- package/src/hooks/perps/usePythUpdateFee.ts +4 -4
- package/src/hooks/pol/useBgtAprSimulation.ts +1 -1
- package/src/hooks/pol/useBgtUnstakedBalance.ts +7 -4
- package/src/hooks/pol/useClaimableFees.ts +4 -4
- package/src/hooks/pol/useOnChainRewardVault.ts +7 -7
- package/src/hooks/pol/usePollGlobalData.ts +9 -3
- package/src/hooks/pol/usePollMarkets.ts +5 -2
- package/src/hooks/pol/useQueuedBeraUnlock.ts +4 -4
- package/src/hooks/pol/useRewardTokenToBeraRate.ts +4 -4
- package/src/hooks/pol/useRewardVault.ts +5 -2
- package/src/hooks/pol/useRewardVaultBalanceFromStakingToken.ts +2 -2
- package/src/hooks/pol/useRewardVaultFromToken.ts +2 -2
- package/src/hooks/pol/useRewardVaultIncentives.ts +2 -2
- package/src/hooks/pol/useRewardVaultRewards.ts +3 -3
- package/src/hooks/pol/useRewardVaults.ts +2 -2
- package/src/hooks/pol/useStakedAPR.ts +3 -3
- package/src/hooks/pol/useStakedData.ts +10 -10
- package/src/hooks/pol/useStakedSnapshots.ts +3 -3
- package/src/hooks/pol/useStakingVaultsMetadata.ts +40 -0
- package/src/hooks/pol/useTotalStakedAmount.ts +2 -2
- package/src/hooks/pol/useUserVaultInfo.ts +8 -5
- package/src/hooks/pol/useUserVaults.ts +7 -4
- package/src/hooks/pol/useVaultAddress.ts +2 -2
- package/src/hooks/pol/useVaultHistory.ts +2 -2
- package/src/hooks/pol/useVaultValidators.ts +5 -2
- package/src/hooks/tokens/useBeraCurrentPrice.ts +1 -1
- package/src/hooks/tokens/useMultipleTokenInformation.ts +7 -4
- package/src/hooks/tokens/usePollAllowances.ts +7 -4
- package/src/hooks/tokens/usePollBalance.ts +8 -5
- package/src/hooks/tokens/usePollWalletBalances.ts +8 -5
- package/src/hooks/tokens/useStakingTokenInformation.ts +7 -4
- package/src/hooks/tokens/useTokenCurrentPrice.ts +1 -1
- package/src/hooks/tokens/useTokenCurrentPrices.ts +6 -6
- package/src/hooks/tokens/useTokenInformation.ts +8 -5
- package/src/hooks/tokens/useTokenPrice.ts +1 -1
- package/src/hooks/tokens/useTokenPrices.ts +4 -4
- package/src/hooks/tokens/useTokens.ts +3 -3
- package/src/hooks/tokens/useTotalSupply.ts +1 -1
- package/src/hooks/tokens/useUnderlyingAsset.ts +3 -3
- package/src/hooks/useBlockToTimestamp.ts +5 -5
- package/src/hooks/useContractWrite/index.ts +0 -0
- package/src/hooks/useContractWrite/stateReducer.ts +0 -0
- package/src/hooks/useContractWrite/types.ts +2 -2
- package/src/hooks/useContractWrite/useBeraContractWrite.ts +5 -6
- package/src/hooks/useGetVerifiedAbi.ts +1 -1
- package/src/hooks/usePrevious.ts +0 -0
- package/src/hooks/validators/useAllValidators.ts +7 -4
- package/src/hooks/validators/useApiEnrichedAllocation.ts +2 -2
- package/src/hooks/validators/useApiValidator.ts +5 -2
- package/src/hooks/validators/useBaselineRewardAllocation.ts +2 -2
- package/src/hooks/validators/useDailyValidatorBlockStats.ts +3 -3
- package/src/hooks/validators/useDefaultRewardAllocation.ts +4 -4
- package/src/hooks/validators/useManagedValidatorRole.ts +8 -5
- package/src/hooks/validators/useOnChainValidator.ts +6 -3
- package/src/hooks/validators/useStakingPoolBatch.ts +7 -4
- package/src/hooks/validators/useUserActiveValidators.ts +6 -3
- package/src/hooks/validators/useUserBoostsOnValidator.ts +3 -3
- package/src/hooks/validators/useUserClaimableIncentives.ts +9 -9
- package/src/hooks/validators/useUserStakingPositions.ts +1 -1
- package/src/hooks/validators/useValidator.ts +1 -1
- package/src/hooks/validators/useValidatorAnalytics.ts +3 -3
- package/src/hooks/validators/useValidatorCommission.ts +5 -2
- package/src/hooks/validators/useValidatorEstimatedBgtPerYear.ts +3 -3
- package/src/hooks/validators/useValidatorQueuedCommission.ts +6 -3
- package/src/hooks/validators/useValidatorQueuedOperatorAddress.ts +5 -2
- package/src/hooks/validators/useValidatorQueuedRewardAllocation.ts +6 -3
- package/src/hooks/validators/useValidatorRewardAllocation.ts +2 -2
- package/src/types/dex.d.ts +1 -1
- package/src/types/enso.d.ts +34 -0
- package/src/types/exports.ts +0 -0
- package/src/types/global.d.ts +3 -3
- package/src/types/governance.d.ts +1 -1
- package/src/types/honeySwap.d.ts +3 -3
- package/src/types/staking.d.ts +0 -0
- package/src/utils/beraFetch.ts +1 -1
- package/src/utils/createEmitter.ts +1 -1
- package/src/utils/exports.ts +0 -0
- package/src/utils/filter.ts +0 -0
- package/src/utils/formatIncentivesTokenMap.ts +1 -1
- package/src/utils/formatInputTokenValue.ts +0 -0
- package/src/utils/formatNumber.ts +0 -0
- package/src/utils/getContractName.ts +1 -1
- package/src/utils/getHoneySwapMessage.test.ts +1 -1
- package/src/utils/getHoneySwapMessage.ts +1 -1
- package/src/utils/parseBaseArgs.ts +1 -1
- package/src/utils/parseBaseArgs.unit.test.ts +1 -1
- package/src/utils/parseWhiskToken.ts +1 -1
- package/src/utils/poolNamings.ts +1 -1
- package/src/utils/tokens.ts +2 -2
- package/src/utils/tokens.unit.test.ts +1 -1
- package/src/utils/truncateHash.ts +0 -0
- package/.claude/skills/berajs/SKILL.md +0 -222
- package/.claude/skills/berajs/references/dex.md +0 -235
- package/.claude/skills/berajs/references/pol.md +0 -194
- package/.claude/skills/berajs/references/staking.md +0 -198
- package/.claude/skills/berajs/references/tokens.md +0 -170
- package/LICENSE +0 -21
- package/dist/chunk-22J3YJDN.cjs +0 -2
- package/dist/chunk-22J3YJDN.cjs.map +0 -1
- package/dist/chunk-2LL3P5PN.mjs +0 -2
- package/dist/chunk-2LL3P5PN.mjs.map +0 -1
- package/dist/chunk-55L7STYD.mjs +0 -2
- package/dist/chunk-55L7STYD.mjs.map +0 -1
- package/dist/chunk-6LDOG5RL.cjs.map +0 -1
- package/dist/chunk-7LNBSOVV.cjs +0 -2
- package/dist/chunk-7LNBSOVV.cjs.map +0 -1
- package/dist/chunk-7SMWQ6SN.mjs.map +0 -1
- package/dist/chunk-7WRTK7RJ.mjs.map +0 -1
- package/dist/chunk-AX2YQQFQ.mjs.map +0 -1
- package/dist/chunk-BKDBIBVO.mjs +0 -4
- package/dist/chunk-BKDBIBVO.mjs.map +0 -1
- package/dist/chunk-C3FHGFLK.mjs +0 -2
- package/dist/chunk-C3FHGFLK.mjs.map +0 -1
- package/dist/chunk-C6ZGUO4H.cjs.map +0 -1
- package/dist/chunk-ECRMUMTA.mjs.map +0 -1
- package/dist/chunk-FCWDGE62.cjs.map +0 -1
- package/dist/chunk-P2Q7CMUD.cjs +0 -2
- package/dist/chunk-P2Q7CMUD.cjs.map +0 -1
- package/dist/chunk-PKXAW6MO.cjs.map +0 -1
- package/dist/chunk-SWMJQOH6.cjs +0 -2
- package/dist/chunk-SWMJQOH6.cjs.map +0 -1
- package/dist/chunk-THATXCJK.mjs +0 -2
- package/dist/chunk-THATXCJK.mjs.map +0 -1
- package/dist/chunk-UXGB54NE.cjs +0 -4
- package/dist/chunk-UXGB54NE.cjs.map +0 -1
- package/dist/chunk-VXL2ZZ4X.cjs +0 -2
- package/dist/chunk-VXL2ZZ4X.cjs.map +0 -1
- package/dist/chunk-YXLFOEZN.mjs +0 -2
- package/dist/chunk-YXLFOEZN.mjs.map +0 -1
- package/dist/chunk-YZV5LKIP.cjs.map +0 -1
- package/src/actions/dex/getSubgraphPool.ts +0 -30
- package/src/actions/validators/getManagedValidatorByAccount.ts +0 -32
- package/src/hooks/pol/useSWBeraVaultMetadata.ts +0 -35
- package/src/hooks/validators/useManagedValidatorByAccount.ts +0 -40
- package/src/hooks/validators/useSubgraphUserValidators.ts +0 -36
- /package/dist/{chunk-3YXSUBA5.mjs.map → chunk-MJZHJFZO.mjs.map} +0 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import useSWR from "swr";
|
|
4
|
+
import type { Address, Hex } from "viem";
|
|
5
|
+
import { parseUnits } from "viem";
|
|
6
|
+
|
|
7
|
+
import { defaultChainId } from "@berachain/config/internal";
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
useBeraWagmi,
|
|
11
|
+
useBeraWallet,
|
|
12
|
+
usePublicClient,
|
|
13
|
+
} from "@berachain/wagmi/hooks";
|
|
14
|
+
|
|
15
|
+
import { getEnsoClient } from "../../actions/clients/getEnsoClient";
|
|
16
|
+
import { getBendDemultiplyBundle } from "../../actions/enso/getBendDemultiplyBundle";
|
|
17
|
+
import { POLLING } from "../../enum/polling";
|
|
18
|
+
import { assertPublicClient } from "../../errors/assert";
|
|
19
|
+
import type { Token } from "../../types/dex";
|
|
20
|
+
import type { BendDemultiplyBundleResponse } from "../../types/enso";
|
|
21
|
+
import type { DefaultHookOptions } from "../../types/global";
|
|
22
|
+
import { useEnsoWalletV2Address } from "./useEnsoWalletV2Address";
|
|
23
|
+
import { useIsBendAuthorized } from "./useIsBendAuthorized";
|
|
24
|
+
|
|
25
|
+
export type UseBendDemultiply = {
|
|
26
|
+
collateralToken?: Token;
|
|
27
|
+
loanToken?: Token;
|
|
28
|
+
marketId?: Hex;
|
|
29
|
+
primaryAddress?: Address;
|
|
30
|
+
repayAmount?: string;
|
|
31
|
+
slippage?: number;
|
|
32
|
+
chainId?: number;
|
|
33
|
+
collateralPriceInLoanAsset?: string;
|
|
34
|
+
currentCollateral?: string;
|
|
35
|
+
currentDebt?: string;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export function useBendDemultiply(
|
|
39
|
+
{
|
|
40
|
+
collateralToken,
|
|
41
|
+
loanToken,
|
|
42
|
+
marketId,
|
|
43
|
+
primaryAddress,
|
|
44
|
+
repayAmount,
|
|
45
|
+
slippage,
|
|
46
|
+
chainId,
|
|
47
|
+
collateralPriceInLoanAsset,
|
|
48
|
+
currentCollateral,
|
|
49
|
+
currentDebt,
|
|
50
|
+
}: UseBendDemultiply,
|
|
51
|
+
options?: DefaultHookOptions,
|
|
52
|
+
) {
|
|
53
|
+
const { address: fromAddress } = useBeraWallet();
|
|
54
|
+
const { account: { chainId: accountChainId } = {} } = useBeraWagmi();
|
|
55
|
+
|
|
56
|
+
const chainIdToUse = chainId ?? accountChainId ?? defaultChainId;
|
|
57
|
+
const publicClient = usePublicClient({ chainId: chainIdToUse });
|
|
58
|
+
const { data: ensoWalletV2Address } = useEnsoWalletV2Address({
|
|
59
|
+
chainId: chainIdToUse,
|
|
60
|
+
});
|
|
61
|
+
const { data: isAuthorized } = useIsBendAuthorized({
|
|
62
|
+
chainId: chainIdToUse,
|
|
63
|
+
primaryAddress,
|
|
64
|
+
ensoWalletV2Address,
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const QUERY_KEY =
|
|
68
|
+
collateralToken &&
|
|
69
|
+
loanToken &&
|
|
70
|
+
marketId &&
|
|
71
|
+
primaryAddress &&
|
|
72
|
+
repayAmount &&
|
|
73
|
+
ensoWalletV2Address &&
|
|
74
|
+
isAuthorized !== undefined &&
|
|
75
|
+
collateralToken.address !== loanToken.address &&
|
|
76
|
+
Number(repayAmount) > 0 &&
|
|
77
|
+
slippage !== undefined &&
|
|
78
|
+
collateralPriceInLoanAsset !== undefined &&
|
|
79
|
+
currentCollateral &&
|
|
80
|
+
currentDebt &&
|
|
81
|
+
Number(currentDebt) > 0 &&
|
|
82
|
+
fromAddress &&
|
|
83
|
+
(options?.opts?.isEnabled ?? true)
|
|
84
|
+
? ([
|
|
85
|
+
"useBendDemultiply",
|
|
86
|
+
fromAddress,
|
|
87
|
+
collateralToken,
|
|
88
|
+
loanToken,
|
|
89
|
+
marketId,
|
|
90
|
+
primaryAddress,
|
|
91
|
+
chainIdToUse,
|
|
92
|
+
repayAmount,
|
|
93
|
+
slippage,
|
|
94
|
+
collateralPriceInLoanAsset,
|
|
95
|
+
currentCollateral,
|
|
96
|
+
currentDebt,
|
|
97
|
+
ensoWalletV2Address,
|
|
98
|
+
isAuthorized,
|
|
99
|
+
] as const)
|
|
100
|
+
: null;
|
|
101
|
+
|
|
102
|
+
return useSWR<BendDemultiplyBundleResponse, unknown, typeof QUERY_KEY>(
|
|
103
|
+
QUERY_KEY,
|
|
104
|
+
async ([
|
|
105
|
+
_,
|
|
106
|
+
fromAddress,
|
|
107
|
+
collateralToken,
|
|
108
|
+
loanToken,
|
|
109
|
+
marketId,
|
|
110
|
+
primaryAddress,
|
|
111
|
+
chainId,
|
|
112
|
+
repayAmount,
|
|
113
|
+
slippage,
|
|
114
|
+
collateralPriceInLoanAsset,
|
|
115
|
+
currentCollateral,
|
|
116
|
+
currentDebt,
|
|
117
|
+
ensoWalletV2Address,
|
|
118
|
+
isAuthorized,
|
|
119
|
+
]) => {
|
|
120
|
+
assertPublicClient(publicClient);
|
|
121
|
+
|
|
122
|
+
const rawRepayAmount = parseUnits(
|
|
123
|
+
repayAmount,
|
|
124
|
+
loanToken.decimals,
|
|
125
|
+
).toString();
|
|
126
|
+
const rawCurrentCollateral = parseUnits(
|
|
127
|
+
currentCollateral,
|
|
128
|
+
collateralToken.decimals,
|
|
129
|
+
).toString();
|
|
130
|
+
const rawCurrentDebt = parseUnits(
|
|
131
|
+
currentDebt,
|
|
132
|
+
loanToken.decimals,
|
|
133
|
+
).toString();
|
|
134
|
+
|
|
135
|
+
return getBendDemultiplyBundle({
|
|
136
|
+
fromAddress,
|
|
137
|
+
repayAmount: rawRepayAmount,
|
|
138
|
+
collateralToken,
|
|
139
|
+
loanToken,
|
|
140
|
+
marketId,
|
|
141
|
+
primaryAddress,
|
|
142
|
+
chainId,
|
|
143
|
+
ensoClient: getEnsoClient(),
|
|
144
|
+
slippage,
|
|
145
|
+
publicClient,
|
|
146
|
+
collateralPriceInLoanAsset,
|
|
147
|
+
currentCollateral: rawCurrentCollateral,
|
|
148
|
+
currentDebt: rawCurrentDebt,
|
|
149
|
+
ensoWalletV2Address,
|
|
150
|
+
isAuthorized,
|
|
151
|
+
});
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
...options?.opts,
|
|
155
|
+
refreshInterval: POLLING.NORMAL,
|
|
156
|
+
},
|
|
157
|
+
);
|
|
158
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import useSWR from "swr";
|
|
4
|
+
import type { Address, Hex } from "viem";
|
|
5
|
+
import { parseUnits } from "viem";
|
|
6
|
+
|
|
7
|
+
import { defaultChainId } from "@berachain/config/internal";
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
useBeraWagmi,
|
|
11
|
+
useBeraWallet,
|
|
12
|
+
usePublicClient,
|
|
13
|
+
} from "@berachain/wagmi/hooks";
|
|
14
|
+
|
|
15
|
+
import { getEnsoClient } from "../../actions/clients/getEnsoClient";
|
|
16
|
+
import { getBendMultiplyBundle } from "../../actions/enso/getBendMultiplyBundle";
|
|
17
|
+
import { POLLING } from "../../enum/polling";
|
|
18
|
+
import { assertPublicClient } from "../../errors/assert";
|
|
19
|
+
import type { Token } from "../../types/dex";
|
|
20
|
+
import type { BendMultiplyBundleResponse } from "../../types/enso";
|
|
21
|
+
import type { DefaultHookOptions } from "../../types/global";
|
|
22
|
+
import { useEnsoWalletV2Address } from "./useEnsoWalletV2Address";
|
|
23
|
+
import { useIsBendAuthorized } from "./useIsBendAuthorized";
|
|
24
|
+
|
|
25
|
+
export type UseBendMultiply = {
|
|
26
|
+
collateralToken?: Token;
|
|
27
|
+
loanToken?: Token;
|
|
28
|
+
marketId?: Hex;
|
|
29
|
+
primaryAddress?: Address;
|
|
30
|
+
formattedSupplyCollateralAmount?: string;
|
|
31
|
+
formattedCurrentCollateralAmount?: string;
|
|
32
|
+
formattedCurrentBorrowAmount?: string;
|
|
33
|
+
leverageMultiplier?: number;
|
|
34
|
+
slippage?: number;
|
|
35
|
+
chainId?: number;
|
|
36
|
+
formattedCollateralPriceInLoanAsset?: string;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export function useBendMultiply(
|
|
40
|
+
{
|
|
41
|
+
collateralToken,
|
|
42
|
+
loanToken,
|
|
43
|
+
marketId,
|
|
44
|
+
primaryAddress,
|
|
45
|
+
formattedSupplyCollateralAmount,
|
|
46
|
+
formattedCurrentCollateralAmount,
|
|
47
|
+
formattedCurrentBorrowAmount,
|
|
48
|
+
leverageMultiplier,
|
|
49
|
+
slippage,
|
|
50
|
+
chainId,
|
|
51
|
+
formattedCollateralPriceInLoanAsset,
|
|
52
|
+
}: UseBendMultiply,
|
|
53
|
+
options?: DefaultHookOptions,
|
|
54
|
+
) {
|
|
55
|
+
const { address: fromAddress } = useBeraWallet();
|
|
56
|
+
const { account: { chainId: accountChainId } = {} } = useBeraWagmi();
|
|
57
|
+
|
|
58
|
+
const chainIdToUse = chainId ?? accountChainId ?? defaultChainId;
|
|
59
|
+
const publicClient = usePublicClient({ chainId: chainIdToUse });
|
|
60
|
+
const { data: ensoWalletV2Address } = useEnsoWalletV2Address({
|
|
61
|
+
chainId: chainIdToUse,
|
|
62
|
+
});
|
|
63
|
+
const { data: isAuthorized } = useIsBendAuthorized({
|
|
64
|
+
chainId: chainIdToUse,
|
|
65
|
+
primaryAddress,
|
|
66
|
+
ensoWalletV2Address,
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const QUERY_KEY =
|
|
70
|
+
collateralToken &&
|
|
71
|
+
loanToken &&
|
|
72
|
+
marketId &&
|
|
73
|
+
primaryAddress &&
|
|
74
|
+
ensoWalletV2Address &&
|
|
75
|
+
isAuthorized !== undefined &&
|
|
76
|
+
collateralToken.address !== loanToken.address &&
|
|
77
|
+
slippage !== undefined &&
|
|
78
|
+
leverageMultiplier !== undefined &&
|
|
79
|
+
formattedCollateralPriceInLoanAsset !== undefined &&
|
|
80
|
+
(Number(formattedSupplyCollateralAmount ?? 0) > 0 ||
|
|
81
|
+
(leverageMultiplier > 1 &&
|
|
82
|
+
(Number(formattedCurrentCollateralAmount ?? 0) > 0 ||
|
|
83
|
+
Number(formattedSupplyCollateralAmount ?? 0) > 0))) &&
|
|
84
|
+
fromAddress &&
|
|
85
|
+
(options?.opts?.isEnabled ?? true)
|
|
86
|
+
? ([
|
|
87
|
+
"useBendMultiply",
|
|
88
|
+
fromAddress,
|
|
89
|
+
collateralToken,
|
|
90
|
+
loanToken,
|
|
91
|
+
marketId,
|
|
92
|
+
primaryAddress,
|
|
93
|
+
chainIdToUse,
|
|
94
|
+
formattedSupplyCollateralAmount ?? "",
|
|
95
|
+
formattedCurrentCollateralAmount ?? "",
|
|
96
|
+
formattedCurrentBorrowAmount ?? "",
|
|
97
|
+
leverageMultiplier,
|
|
98
|
+
slippage,
|
|
99
|
+
formattedCollateralPriceInLoanAsset,
|
|
100
|
+
ensoWalletV2Address,
|
|
101
|
+
isAuthorized,
|
|
102
|
+
] as const)
|
|
103
|
+
: null;
|
|
104
|
+
|
|
105
|
+
return useSWR<BendMultiplyBundleResponse, unknown, typeof QUERY_KEY>(
|
|
106
|
+
QUERY_KEY,
|
|
107
|
+
async ([
|
|
108
|
+
_,
|
|
109
|
+
fromAddress,
|
|
110
|
+
collateralToken,
|
|
111
|
+
loanToken,
|
|
112
|
+
marketId,
|
|
113
|
+
primaryAddress,
|
|
114
|
+
chainId,
|
|
115
|
+
formattedSupplyCollateralAmount,
|
|
116
|
+
formattedCurrentCollateralAmount,
|
|
117
|
+
formattedCurrentBorrowAmount,
|
|
118
|
+
leverageMultiplier,
|
|
119
|
+
slippage,
|
|
120
|
+
formattedCollateralPriceInLoanAsset,
|
|
121
|
+
ensoWalletV2Address,
|
|
122
|
+
isAuthorized,
|
|
123
|
+
]) => {
|
|
124
|
+
assertPublicClient(publicClient);
|
|
125
|
+
|
|
126
|
+
const rawSupplyCollateralAmount = parseUnits(
|
|
127
|
+
formattedSupplyCollateralAmount || "0",
|
|
128
|
+
collateralToken.decimals,
|
|
129
|
+
).toString();
|
|
130
|
+
const rawCurrentCollateralAmount = parseUnits(
|
|
131
|
+
formattedCurrentCollateralAmount || "0",
|
|
132
|
+
collateralToken.decimals,
|
|
133
|
+
).toString();
|
|
134
|
+
const rawCurrentBorrowAmount = parseUnits(
|
|
135
|
+
formattedCurrentBorrowAmount || "0",
|
|
136
|
+
loanToken.decimals,
|
|
137
|
+
).toString();
|
|
138
|
+
|
|
139
|
+
return getBendMultiplyBundle({
|
|
140
|
+
fromAddress,
|
|
141
|
+
rawSupplyCollateralAmount,
|
|
142
|
+
rawCurrentCollateralAmount,
|
|
143
|
+
rawCurrentBorrowAmount,
|
|
144
|
+
collateralToken,
|
|
145
|
+
loanToken,
|
|
146
|
+
marketId,
|
|
147
|
+
primaryAddress,
|
|
148
|
+
chainId,
|
|
149
|
+
ensoClient: getEnsoClient(),
|
|
150
|
+
slippage,
|
|
151
|
+
leverageMultiplier,
|
|
152
|
+
publicClient,
|
|
153
|
+
formattedCollateralPriceInLoanAsset,
|
|
154
|
+
ensoWalletV2Address,
|
|
155
|
+
isAuthorized,
|
|
156
|
+
});
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
...options?.opts,
|
|
160
|
+
refreshInterval: POLLING.NORMAL,
|
|
161
|
+
},
|
|
162
|
+
);
|
|
163
|
+
}
|
|
@@ -7,19 +7,19 @@ import { defaultChainId as berachainChainId } from "@berachain/config/internal";
|
|
|
7
7
|
|
|
8
8
|
import { useBeraWallet, usePublicClient } from "@berachain/wagmi/hooks";
|
|
9
9
|
|
|
10
|
-
import { ensoErc4626 } from "
|
|
11
|
-
import { POLLING } from "
|
|
10
|
+
import { ensoErc4626 } from "../../actions/dex/aggregators/enso/ensoErc4626";
|
|
11
|
+
import { POLLING } from "../../enum/polling";
|
|
12
12
|
import {
|
|
13
13
|
assertAddress,
|
|
14
14
|
assertDefined,
|
|
15
15
|
assertPublicClient,
|
|
16
|
-
} from "
|
|
17
|
-
import {
|
|
18
|
-
import type {
|
|
19
|
-
import
|
|
20
|
-
import { isToken } from "~/utils/tokens";
|
|
16
|
+
} from "../../errors/assert";
|
|
17
|
+
import type { BalanceToken, MinimalERC20 } from "../../types/dex";
|
|
18
|
+
import type { DefaultHookOptions } from "../../types/global";
|
|
19
|
+
import { isToken } from "../../utils/tokens";
|
|
21
20
|
import { useGetConvertToAssets } from "../bend/useGetConvertToAssets";
|
|
22
21
|
import { usePriceImpact } from "../dex/usePriceImpact";
|
|
22
|
+
import { usePollBalance } from "../tokens/usePollBalance";
|
|
23
23
|
import { useTokenPrices } from "../tokens/useTokenPrices";
|
|
24
24
|
|
|
25
25
|
type UseBendZapSupplyArgs = {
|
|
@@ -8,17 +8,17 @@ import { defaultChainId as berachainChainId } from "@berachain/config/internal";
|
|
|
8
8
|
|
|
9
9
|
import { useBeraWallet, useConfig } from "@berachain/wagmi/hooks";
|
|
10
10
|
|
|
11
|
-
import { getEnsoClient } from "
|
|
12
|
-
import { getEnsoSwapBundle } from "
|
|
13
|
-
import { POLLING } from "
|
|
11
|
+
import { getEnsoClient } from "../../actions/clients/getEnsoClient";
|
|
12
|
+
import { getEnsoSwapBundle } from "../../actions/enso/getEnsoSwapBundle";
|
|
13
|
+
import { POLLING } from "../../enum/polling";
|
|
14
14
|
import {
|
|
15
15
|
assertAddress,
|
|
16
16
|
assertAmount,
|
|
17
17
|
assertDefined,
|
|
18
18
|
assertPublicClient,
|
|
19
|
-
} from "
|
|
20
|
-
import type { BalanceToken, MinimalERC20 } from "
|
|
21
|
-
import type { GetZapTransactionResponse } from "
|
|
19
|
+
} from "../../errors/assert";
|
|
20
|
+
import type { BalanceToken, MinimalERC20 } from "../../types/dex";
|
|
21
|
+
import type { GetZapTransactionResponse } from "../../types/enso";
|
|
22
22
|
import { usePollWalletBalances } from "../tokens/usePollWalletBalances";
|
|
23
23
|
|
|
24
24
|
/**
|
|
@@ -2,11 +2,11 @@ import useSWR from "swr";
|
|
|
2
2
|
|
|
3
3
|
import { useBeraWallet, useConfig } from "@berachain/wagmi/hooks";
|
|
4
4
|
|
|
5
|
-
import { getEnsoClient } from "
|
|
6
|
-
import { getEnsoUserTokensWithBalances } from "
|
|
7
|
-
import { POLLING } from "
|
|
8
|
-
import type { BalanceToken } from "
|
|
9
|
-
import type { DefaultHookOptions } from "
|
|
5
|
+
import { getEnsoClient } from "../../actions/clients/getEnsoClient";
|
|
6
|
+
import { getEnsoUserTokensWithBalances } from "../../actions/enso/getEnsoUserTokensWithBalances";
|
|
7
|
+
import { POLLING } from "../../enum/polling";
|
|
8
|
+
import type { BalanceToken } from "../../types/dex";
|
|
9
|
+
import type { DefaultHookOptions } from "../../types/global";
|
|
10
10
|
|
|
11
11
|
export function useEnsoUserTokensWithBalances(
|
|
12
12
|
{ chainId }: { chainId?: number } = {},
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import useSWR from "swr";
|
|
4
|
+
import type { Address } from "viem";
|
|
5
|
+
import { getAddress } from "viem";
|
|
6
|
+
|
|
7
|
+
import { useBeraWallet, usePublicClient } from "@berachain/wagmi/hooks";
|
|
8
|
+
|
|
9
|
+
import { getEnsoWalletV2Address } from "../../actions/enso/flashloan";
|
|
10
|
+
import { POLLING } from "../../enum/polling";
|
|
11
|
+
import { assertPublicClient } from "../../errors/assert";
|
|
12
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
13
|
+
|
|
14
|
+
export function useEnsoWalletV2Address({ chainId }: { chainId: number }) {
|
|
15
|
+
const { address: fromAddress } = useBeraWallet();
|
|
16
|
+
const publicClient = usePublicClient({ chainId });
|
|
17
|
+
|
|
18
|
+
const { config } = parseBaseArgs({});
|
|
19
|
+
const ensoWalletV2Factory = config.enso.walletV2Factory;
|
|
20
|
+
|
|
21
|
+
const QUERY_KEY =
|
|
22
|
+
fromAddress && ensoWalletV2Factory
|
|
23
|
+
? (["useEnsoWalletV2Address", fromAddress, ensoWalletV2Factory] as const)
|
|
24
|
+
: null;
|
|
25
|
+
|
|
26
|
+
return useSWR<Address, unknown, typeof QUERY_KEY>(
|
|
27
|
+
QUERY_KEY,
|
|
28
|
+
async ([_, accountAddress, factory]) => {
|
|
29
|
+
assertPublicClient(publicClient);
|
|
30
|
+
return getEnsoWalletV2Address({
|
|
31
|
+
publicClient,
|
|
32
|
+
ensoWalletV2Factory: getAddress(factory),
|
|
33
|
+
accountAddress,
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
{ refreshInterval: POLLING.SLOW },
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import useSWR from "swr";
|
|
4
|
+
import type { Address } from "viem";
|
|
5
|
+
|
|
6
|
+
import { useBeraWallet, usePublicClient } from "@berachain/wagmi/hooks";
|
|
7
|
+
|
|
8
|
+
import { getIsBendAuthorized } from "../../actions/enso/flashloan";
|
|
9
|
+
import { POLLING } from "../../enum/polling";
|
|
10
|
+
import { assertPublicClient } from "../../errors/assert";
|
|
11
|
+
|
|
12
|
+
export function useIsBendAuthorized({
|
|
13
|
+
chainId,
|
|
14
|
+
primaryAddress,
|
|
15
|
+
ensoWalletV2Address,
|
|
16
|
+
}: {
|
|
17
|
+
chainId: number;
|
|
18
|
+
primaryAddress?: Address;
|
|
19
|
+
ensoWalletV2Address?: Address;
|
|
20
|
+
}) {
|
|
21
|
+
const { address: fromAddress } = useBeraWallet();
|
|
22
|
+
const publicClient = usePublicClient({ chainId });
|
|
23
|
+
|
|
24
|
+
const QUERY_KEY =
|
|
25
|
+
fromAddress && primaryAddress && ensoWalletV2Address
|
|
26
|
+
? ([
|
|
27
|
+
"useIsBendAuthorized",
|
|
28
|
+
fromAddress,
|
|
29
|
+
primaryAddress,
|
|
30
|
+
ensoWalletV2Address,
|
|
31
|
+
] as const)
|
|
32
|
+
: null;
|
|
33
|
+
|
|
34
|
+
return useSWR<boolean, unknown, typeof QUERY_KEY>(
|
|
35
|
+
QUERY_KEY,
|
|
36
|
+
async ([_, accountAddress, primaryAddress, ensoWalletV2Address]) => {
|
|
37
|
+
assertPublicClient(publicClient);
|
|
38
|
+
return getIsBendAuthorized({
|
|
39
|
+
publicClient,
|
|
40
|
+
primaryAddress,
|
|
41
|
+
accountAddress,
|
|
42
|
+
ensoWalletV2Address,
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
{ refreshInterval: POLLING.SLOW },
|
|
46
|
+
);
|
|
47
|
+
}
|
|
@@ -7,10 +7,10 @@ import { chainConfigs, defaultChainId } from "@berachain/config/internal";
|
|
|
7
7
|
|
|
8
8
|
import { useBeraWallet } from "@berachain/wagmi/hooks";
|
|
9
9
|
|
|
10
|
-
import { ensoErc4626 } from "
|
|
11
|
-
import { POLLING } from "
|
|
12
|
-
import type { MinimalERC20 } from "
|
|
13
|
-
import type { DefaultHookOptions } from "
|
|
10
|
+
import { ensoErc4626 } from "../../actions/dex/aggregators/enso/ensoErc4626";
|
|
11
|
+
import { POLLING } from "../../enum/polling";
|
|
12
|
+
import type { MinimalERC20 } from "../../types/dex";
|
|
13
|
+
import type { DefaultHookOptions } from "../../types/global";
|
|
14
14
|
import { usePriceImpact } from "../dex/usePriceImpact";
|
|
15
15
|
|
|
16
16
|
type UseZapStakeBeraArgs = {
|
package/src/hooks/exports.ts
CHANGED
|
@@ -30,8 +30,11 @@ export {
|
|
|
30
30
|
USE_AGGREGATORS_QUOTES_QUERY_KEY,
|
|
31
31
|
useSingleAggregatorQuote,
|
|
32
32
|
} from "./dex/useSingleAggregatorQuote";
|
|
33
|
+
export * from "./enso/useBendDemultiply";
|
|
34
|
+
export * from "./enso/useBendMultiply";
|
|
33
35
|
export * from "./enso/useBendZapSupply";
|
|
34
36
|
export * from "./enso/useEnsoSwapBundle";
|
|
37
|
+
export * from "./enso/useEnsoUserTokensWithBalances";
|
|
35
38
|
export * from "./enso/useZapStakeBera";
|
|
36
39
|
export { useCreateProposal } from "./governance/useCreateProposal";
|
|
37
40
|
export * from "./governance/useGetPastVotes";
|
|
@@ -78,7 +81,7 @@ export { useRewardVaults } from "./pol/useRewardVaults";
|
|
|
78
81
|
export * from "./pol/useStakedAPR";
|
|
79
82
|
export * from "./pol/useStakedData";
|
|
80
83
|
export * from "./pol/useStakedSnapshots";
|
|
81
|
-
export * from "./pol/
|
|
84
|
+
export * from "./pol/useStakingVaultsMetadata";
|
|
82
85
|
export * from "./pol/useTotalStakedAmount";
|
|
83
86
|
export { useUserVaultInfo } from "./pol/useUserVaultInfo";
|
|
84
87
|
export { useUserVaults } from "./pol/useUserVaults";
|
|
@@ -109,14 +112,12 @@ export * from "./validators/useApiValidator";
|
|
|
109
112
|
export * from "./validators/useBaselineRewardAllocation";
|
|
110
113
|
export { useDailyValidatorBlockStats } from "./validators/useDailyValidatorBlockStats";
|
|
111
114
|
export { useDefaultRewardAllocation } from "./validators/useDefaultRewardAllocation";
|
|
112
|
-
export { useManagedValidatorByAccount } from "./validators/useManagedValidatorByAccount";
|
|
113
115
|
export {
|
|
114
116
|
type ManagedValidatorRole,
|
|
115
117
|
useManagedValidatorRole,
|
|
116
118
|
} from "./validators/useManagedValidatorRole";
|
|
117
119
|
export * from "./validators/useOnChainValidator";
|
|
118
120
|
export * from "./validators/useStakingPoolBatch";
|
|
119
|
-
export { useSubgraphUserValidators } from "./validators/useSubgraphUserValidators";
|
|
120
121
|
export { useUserActiveValidators } from "./validators/useUserActiveValidators";
|
|
121
122
|
export { useUserBoostsOnValidator } from "./validators/useUserBoostsOnValidator";
|
|
122
123
|
export { useUserClaimableIncentives } from "./validators/useUserClaimableIncentives";
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
import { useCallback, useEffect, useState } from "react";
|
|
4
4
|
|
|
5
|
-
import { getProposalParams } from "
|
|
6
|
-
import { ProposalTypeEnum } from "
|
|
5
|
+
import { getProposalParams } from "../../actions/governance/getProposalParams";
|
|
6
|
+
import { ProposalTypeEnum } from "../../enum/governance";
|
|
7
7
|
import type {
|
|
8
8
|
CustomProposal,
|
|
9
9
|
CustomProposalErrors,
|
|
10
10
|
GovernanceTopic,
|
|
11
11
|
PROPOSAL_GENRE,
|
|
12
12
|
SafeProposalAction,
|
|
13
|
-
} from "
|
|
13
|
+
} from "../../types/governance";
|
|
14
14
|
|
|
15
15
|
const defaultAction = {
|
|
16
16
|
type: ProposalTypeEnum.CUSTOM_PROPOSAL,
|
|
@@ -5,8 +5,8 @@ import { bgtAbi } from "@berachain/abis/pol/bgt";
|
|
|
5
5
|
|
|
6
6
|
import { useBeraWallet, usePublicClient } from "@berachain/wagmi/hooks";
|
|
7
7
|
|
|
8
|
-
import { assertPublicClient } from "
|
|
9
|
-
import { parseBaseArgs } from "
|
|
8
|
+
import { assertPublicClient } from "../../errors/assert";
|
|
9
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
10
10
|
import { useProposalSnapshot } from "./useProposalSnapshot";
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -5,8 +5,8 @@ import { berachainGovernanceAbi as governanceAbi } from "@berachain/abis/gov/ber
|
|
|
5
5
|
|
|
6
6
|
import { useBeraWallet, usePublicClient } from "@berachain/wagmi/hooks";
|
|
7
7
|
|
|
8
|
-
import { assertPublicClient } from "
|
|
9
|
-
import { parseBaseArgs } from "
|
|
8
|
+
import { assertPublicClient } from "../../errors/assert";
|
|
9
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
10
10
|
|
|
11
11
|
export const useHasVoted = ({
|
|
12
12
|
proposalId,
|
|
@@ -5,10 +5,10 @@ import { timeLockAbi as governanceTimelockAbi } from "@berachain/abis/gov/timeLo
|
|
|
5
5
|
|
|
6
6
|
import { usePublicClient } from "@berachain/wagmi/hooks";
|
|
7
7
|
|
|
8
|
-
import { CANCELLER_ROLE } from "
|
|
9
|
-
import { POLLING } from "
|
|
10
|
-
import { assertPublicClient } from "
|
|
11
|
-
import { parseBaseArgs } from "
|
|
8
|
+
import { CANCELLER_ROLE } from "../../actions/governance/constants";
|
|
9
|
+
import { POLLING } from "../../enum/polling";
|
|
10
|
+
import { assertPublicClient } from "../../errors/assert";
|
|
11
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
12
12
|
|
|
13
13
|
export const useIsCanceller = ({
|
|
14
14
|
account,
|
|
@@ -9,9 +9,9 @@ import {
|
|
|
9
9
|
ProposalStatus,
|
|
10
10
|
} from "@berachain/graphql/governance";
|
|
11
11
|
|
|
12
|
-
import { getAllProposals } from "
|
|
13
|
-
import { POLLING } from "
|
|
14
|
-
import type { DefaultHookOptions } from "
|
|
12
|
+
import { getAllProposals } from "../../actions/governance/getAllProposals";
|
|
13
|
+
import { POLLING } from "../../enum/polling";
|
|
14
|
+
import type { DefaultHookOptions } from "../../types/global";
|
|
15
15
|
|
|
16
16
|
const DEFAULT_PER_PAGE = 10;
|
|
17
17
|
|
|
@@ -7,10 +7,13 @@ import {
|
|
|
7
7
|
} from "@berachain/graphql/governance";
|
|
8
8
|
import { usePublicClient } from "@berachain/wagmi/hooks";
|
|
9
9
|
|
|
10
|
-
import { getProposalDetails } from "
|
|
11
|
-
import { POLLING } from "
|
|
12
|
-
import { assertPublicClient } from "
|
|
13
|
-
import type {
|
|
10
|
+
import { getProposalDetails } from "../../actions/governance/getProposalDetails";
|
|
11
|
+
import { POLLING } from "../../enum/polling";
|
|
12
|
+
import { assertPublicClient } from "../../errors/assert";
|
|
13
|
+
import type {
|
|
14
|
+
DefaultHookOptions,
|
|
15
|
+
DefaultHookReturnType,
|
|
16
|
+
} from "../../types/global";
|
|
14
17
|
|
|
15
18
|
export interface UsePollProposalResponse
|
|
16
19
|
extends DefaultHookReturnType<ProposalWithVotesFragment> {}
|
|
@@ -5,9 +5,9 @@ import { berachainGovernanceAbi as governanceAbi } from "@berachain/abis/gov/ber
|
|
|
5
5
|
|
|
6
6
|
import { usePublicClient } from "@berachain/wagmi/hooks";
|
|
7
7
|
|
|
8
|
-
import { POLLING } from "
|
|
9
|
-
import { assertPublicClient } from "
|
|
10
|
-
import type { DefaultHookReturnType } from "
|
|
8
|
+
import { POLLING } from "../../enum/polling";
|
|
9
|
+
import { assertPublicClient } from "../../errors/assert";
|
|
10
|
+
import type { DefaultHookReturnType } from "../../types/global";
|
|
11
11
|
|
|
12
12
|
export const usePollProposalThreshold = (
|
|
13
13
|
governorAddress: Address,
|
|
@@ -2,7 +2,7 @@ import useSWRInfinite, { type SWRInfiniteKeyLoader } from "swr/infinite";
|
|
|
2
2
|
|
|
3
3
|
import type { GetProposalVotesQueryVariables } from "@berachain/graphql/governance";
|
|
4
4
|
|
|
5
|
-
import { getProposalVotes } from "
|
|
5
|
+
import { getProposalVotes } from "../../actions/governance/getProposalVotes";
|
|
6
6
|
|
|
7
7
|
type UsePollProposalVotesArgs = Omit<
|
|
8
8
|
GetProposalVotesQueryVariables,
|
|
@@ -5,10 +5,13 @@ import { bgtAbi } from "@berachain/abis/pol/bgt";
|
|
|
5
5
|
|
|
6
6
|
import { useBeraWallet, usePublicClient } from "@berachain/wagmi/hooks";
|
|
7
7
|
|
|
8
|
-
import { POLLING } from "
|
|
9
|
-
import { assertPublicClient } from "
|
|
10
|
-
import type {
|
|
11
|
-
|
|
8
|
+
import { POLLING } from "../../enum/polling";
|
|
9
|
+
import { assertPublicClient } from "../../errors/assert";
|
|
10
|
+
import type {
|
|
11
|
+
DefaultHookOptions,
|
|
12
|
+
DefaultHookReturnType,
|
|
13
|
+
} from "../../types/global";
|
|
14
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
12
15
|
|
|
13
16
|
export const usePollUserDelegates = (
|
|
14
17
|
options?: DefaultHookOptions,
|