@berachain/berajs 0.2.4 → 0.2.6-patch.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -0
- package/dist/abi/exports.cjs +1 -1
- package/dist/abi/exports.cjs.map +1 -1
- package/dist/abi/exports.d.cts +17 -1
- package/dist/abi/exports.d.ts +17 -1
- package/dist/abi/exports.mjs +1 -1
- package/dist/abi/exports.mjs.map +1 -1
- package/dist/actions/exports.cjs +1 -1
- package/dist/actions/exports.cjs.map +1 -1
- package/dist/actions/exports.d.cts +9 -38
- package/dist/actions/exports.d.ts +9 -38
- package/dist/actions/exports.mjs +1 -1
- package/dist/actions/exports.mjs.map +1 -1
- package/dist/chunk-2YBHAMDV.cjs +2 -0
- package/dist/chunk-2YBHAMDV.cjs.map +1 -0
- package/dist/chunk-57RINXU6.cjs +2 -0
- package/dist/chunk-57RINXU6.cjs.map +1 -0
- package/dist/{chunk-AX2YQQFQ.mjs → chunk-74QD4JAH.mjs} +2 -2
- package/dist/chunk-74QD4JAH.mjs.map +1 -0
- package/dist/chunk-74WA35RI.cjs +2 -0
- package/dist/chunk-74WA35RI.cjs.map +1 -0
- package/dist/{chunk-7WRTK7RJ.mjs → chunk-BEKH5EYT.mjs} +2 -2
- package/dist/chunk-BEKH5EYT.mjs.map +1 -0
- package/dist/{chunk-FCWDGE62.cjs → chunk-CF3LFNXG.cjs} +2 -2
- package/dist/chunk-CF3LFNXG.cjs.map +1 -0
- package/dist/chunk-COMMLZ3O.mjs +2 -0
- package/dist/chunk-COMMLZ3O.mjs.map +1 -0
- package/dist/chunk-DDEQFR3M.cjs +2 -0
- package/dist/chunk-DDEQFR3M.cjs.map +1 -0
- package/dist/{chunk-6LDOG5RL.cjs → chunk-DK42F2ZM.cjs} +2 -2
- package/dist/chunk-DK42F2ZM.cjs.map +1 -0
- package/dist/{chunk-7SMWQ6SN.mjs → chunk-FM3WDBFH.mjs} +2 -2
- package/dist/chunk-FM3WDBFH.mjs.map +1 -0
- package/dist/chunk-HWOGQSNL.cjs +4 -0
- package/dist/chunk-HWOGQSNL.cjs.map +1 -0
- package/dist/chunk-I7M43BB4.cjs +2 -0
- package/dist/chunk-I7M43BB4.cjs.map +1 -0
- package/dist/chunk-IBJOI5SN.mjs +4 -0
- package/dist/chunk-IBJOI5SN.mjs.map +1 -0
- package/dist/chunk-IDFMLLDY.mjs +2 -0
- package/dist/chunk-IDFMLLDY.mjs.map +1 -0
- package/dist/{chunk-YZV5LKIP.cjs → chunk-LNVR4BW6.cjs} +2 -2
- package/dist/chunk-LNVR4BW6.cjs.map +1 -0
- package/dist/chunk-MJZHJFZO.mjs +2 -0
- package/dist/{chunk-YNO7BCCM.mjs.map → chunk-MJZHJFZO.mjs.map} +1 -1
- package/dist/chunk-MK5NS5B5.mjs +2 -0
- package/dist/chunk-MK5NS5B5.mjs.map +1 -0
- package/dist/{chunk-C6ZGUO4H.cjs → chunk-NMH7LHPW.cjs} +2 -2
- package/dist/chunk-NMH7LHPW.cjs.map +1 -0
- package/dist/chunk-NVHV2LDK.cjs +2 -0
- package/dist/chunk-NVHV2LDK.cjs.map +1 -0
- package/dist/chunk-OGBD5YOG.mjs +2 -0
- package/dist/chunk-OGBD5YOG.mjs.map +1 -0
- package/dist/chunk-OIYXOKTT.cjs.map +1 -1
- package/dist/chunk-OUD27MU7.cjs.map +1 -1
- package/dist/chunk-PLIH6KQM.mjs +2 -0
- package/dist/chunk-PLIH6KQM.mjs.map +1 -0
- package/dist/chunk-QRAIGQF2.mjs +2 -0
- package/dist/chunk-QRAIGQF2.mjs.map +1 -0
- package/dist/chunk-RWOICHRW.cjs +2 -0
- package/dist/chunk-RWOICHRW.cjs.map +1 -0
- package/dist/chunk-T5FSQ3YE.mjs +2 -0
- package/dist/chunk-T5FSQ3YE.mjs.map +1 -0
- package/dist/chunk-WRFDB3QJ.cjs.map +1 -1
- package/dist/chunk-XNJLSA6P.cjs.map +1 -1
- package/dist/contexts/exports.cjs +1 -1
- package/dist/contexts/exports.cjs.map +1 -1
- package/dist/contexts/exports.d.cts +1 -1
- package/dist/contexts/exports.d.ts +1 -1
- package/dist/contexts/exports.mjs +1 -1
- package/dist/contexts/exports.mjs.map +1 -1
- package/dist/{defaultFlags-d0kPbT0i.d.cts → defaultFlags-D6KfkTZx.d.cts} +1 -1
- package/dist/{defaultFlags-d0kPbT0i.d.ts → defaultFlags-D6KfkTZx.d.ts} +1 -1
- package/dist/enum/exports.cjs +1 -1
- package/dist/enum/exports.cjs.map +1 -1
- package/dist/enum/exports.d.cts +1 -1
- package/dist/enum/exports.d.ts +1 -1
- package/dist/enum/exports.mjs +1 -1
- package/dist/errors/exports.cjs +1 -1
- package/dist/errors/exports.cjs.map +1 -1
- package/dist/errors/exports.d.cts +8 -3
- package/dist/errors/exports.d.ts +8 -3
- package/dist/errors/exports.mjs +1 -1
- package/dist/{getValidatorQueuedOperatorAddress-DZgrPmZ2.d.cts → getValidatorQueuedOperatorAddress-BdDYHycN.d.cts} +15 -4
- package/dist/{getValidatorQueuedOperatorAddress-CqR6cyqC.d.ts → getValidatorQueuedOperatorAddress-CmiPJmsr.d.ts} +15 -4
- package/dist/{global.d-BeYWDreg.d.ts → global.d-3GQMgC9k.d.ts} +1 -1
- package/dist/{global.d-DghRxpHd.d.cts → global.d-CwT1Phzf.d.cts} +1 -1
- package/dist/hooks/exports.cjs +3 -3
- package/dist/hooks/exports.cjs.map +1 -1
- package/dist/hooks/exports.d.cts +54 -75
- package/dist/hooks/exports.d.ts +54 -75
- package/dist/hooks/exports.mjs +3 -3
- package/dist/hooks/exports.mjs.map +1 -1
- package/dist/{txnEnum-DxPRHSJt.d.cts → txnEnum-CCuQUFlh.d.cts} +7 -0
- package/dist/{txnEnum-DxPRHSJt.d.ts → txnEnum-CCuQUFlh.d.ts} +7 -0
- package/dist/types/exports.cjs.map +1 -1
- package/dist/types/exports.d.cts +37 -4
- package/dist/types/exports.d.ts +37 -4
- package/dist/utils/exports.cjs +1 -1
- package/dist/utils/exports.cjs.map +1 -1
- package/dist/utils/exports.d.cts +2 -2
- package/dist/utils/exports.d.ts +2 -2
- package/dist/utils/exports.mjs +1 -1
- package/dist/utils/exports.mjs.map +1 -1
- package/package.json +25 -25
- package/src/abi/enso/ensoWalletV2Factory.ts +9 -0
- package/src/abi/exports.ts +1 -0
- package/src/abi/pyth/pyth.ts +0 -0
- package/src/actions/clients/BeraApolloClient.ts +3 -3
- package/src/actions/clients/getApolloClient.ts +5 -5
- package/src/actions/clients/getEnsoClient.ts +1 -1
- package/src/actions/dex/__tests__/aggregators.unit.test.ts +3 -3
- package/src/actions/dex/__tests__/getOnChainPool.unit.test.ts +1 -1
- package/src/actions/dex/aggregators/base.ts +12 -8
- package/src/actions/dex/aggregators/bex.ts +8 -8
- package/src/actions/dex/aggregators/bgt.ts +4 -4
- package/src/actions/dex/aggregators/enso/enso.ts +28 -20
- package/src/actions/dex/aggregators/enso/ensoErc4626.debug.test.ts +1 -1
- package/src/actions/dex/aggregators/enso/ensoErc4626.ts +7 -4
- package/src/actions/dex/aggregators/erc4626.ts +10 -6
- package/src/actions/dex/aggregators/fly.ts +9 -5
- package/src/actions/dex/aggregators/haiku.integration.test.ts +3 -3
- package/src/actions/dex/aggregators/haiku.ts +9 -5
- package/src/actions/dex/aggregators/honey.ts +15 -15
- package/src/actions/dex/aggregators/kyberswap.ts +8 -4
- package/src/actions/dex/aggregators/oogabooga.ts +8 -4
- package/src/actions/dex/aggregators/openOcean.ts +12 -8
- package/src/actions/dex/aggregators/wbera.ts +8 -4
- package/src/actions/dex/b-sdk.ts +2 -2
- package/src/actions/dex/getAllPools.ts +2 -2
- package/src/actions/dex/getApiPool.ts +2 -2
- package/src/actions/dex/getGlobalLiquidityAndSwapVolume.ts +2 -2
- package/src/actions/dex/getIsTokenExploited.ts +1 -1
- package/src/actions/dex/getOnChainPool.ts +3 -3
- package/src/actions/dex/getPoolEvents.ts +2 -2
- package/src/actions/dex/getPoolHistoricalData.ts +2 -2
- package/src/actions/dex/getVaultPausedState.ts +1 -1
- package/src/actions/enso/__tests__/getBendDemultiplyBundle.action.unit.test.ts +175 -0
- package/src/actions/enso/__tests__/getBendDemultiplyBundle.unit.test.ts +150 -0
- package/src/actions/enso/__tests__/getBendMultiplyBundle.action.unit.test.ts +138 -0
- package/src/actions/enso/__tests__/getBendMultiplyBundle.unit.test.ts +194 -0
- package/src/actions/enso/{getEnsoUserTokensWithBalances.debug.test.ts → __tests__/getEnsoUserTokensWithBalances.debug.test.ts} +3 -3
- package/src/actions/enso/__tests__/helpers.ts +42 -0
- package/src/actions/enso/__tests__/util.unit.test.ts +95 -0
- package/src/actions/enso/flashloan.ts +127 -0
- package/src/actions/enso/getBendDemultiplyBundle.ts +325 -0
- package/src/actions/enso/getBendMultiplyBundle.ts +348 -0
- package/src/actions/enso/getEnsoSwapBundle.ts +2 -2
- package/src/actions/enso/getEnsoUserTokensWithBalances.ts +5 -5
- package/src/actions/enso/util.ts +150 -5
- package/src/actions/exports.ts +0 -2
- package/src/actions/governance/__tests__/checkProposalField.unit.test.ts +2 -2
- package/src/actions/governance/__tests__/getDecodedFunctionData.integration.test.ts +2 -2
- package/src/actions/governance/__tests__/getQuorum.integration.test.ts +2 -2
- package/src/actions/governance/checkProposalField.ts +1 -1
- package/src/actions/governance/computeActualStatus.ts +1 -1
- package/src/actions/governance/getAllProposals.ts +1 -1
- package/src/actions/governance/getBodyErrors.ts +1 -1
- package/src/actions/governance/getProposalDetails.ts +1 -1
- package/src/actions/governance/getProposalFromTx.ts +1 -1
- package/src/actions/governance/getProposalParams.ts +3 -3
- package/src/actions/governance/getProposalVotes.ts +1 -1
- package/src/actions/governance/getQuorum.ts +2 -2
- package/src/actions/honey/getCollateralWeights.ts +2 -2
- package/src/actions/honey/getGlobalCapLimit.ts +4 -4
- package/src/actions/honey/getHoneyCollaterals.ts +5 -5
- package/src/actions/honey/getHoneyFees.ts +1 -1
- package/src/actions/honey/getHoneyPausedState.ts +1 -1
- package/src/actions/honey/getHoneyPreview.ts +3 -3
- package/src/actions/honey/getHoneyRootPriceOracle.ts +1 -1
- package/src/actions/honey/getHoneyVaultsBalance.ts +2 -2
- package/src/actions/honey/getRelativeCapLimit.ts +3 -3
- package/src/actions/honey/getSharesWithoutFees.ts +1 -1
- package/src/actions/honey/getSwapPayload.ts +6 -6
- package/src/actions/honey/isBadCollateralAsset.ts +2 -2
- package/src/actions/honey/isBasketModeEnabled.ts +2 -2
- package/src/actions/honey/tests/pyth.integration.test.ts +3 -3
- package/src/actions/misc/getBlockTimestamp.ts +2 -2
- package/src/actions/pol/__tests__/getAllValidators.integration.test.ts +2 -2
- package/src/actions/pol/__tests__/rewardVaults.integration.test.ts +1 -1
- package/src/actions/pol/getBGTGlobalInfo.ts +2 -2
- package/src/actions/pol/getBgtAprSimulation.ts +1 -1
- package/src/actions/pol/getBgtAprSimultaion.unit.test.ts +1 -1
- package/src/actions/pol/getBgtTokenTotalBoosts.ts +2 -2
- package/src/actions/pol/getBgtTokenTotalSupply.ts +2 -2
- package/src/actions/pol/getBlockTime.debug.test.ts +13 -0
- package/src/actions/pol/getBlockTime.ts +14 -23
- package/src/actions/pol/getEarnedStakedBeraVault.ts +3 -3
- package/src/actions/pol/getGlobalCuttingBoard.ts +0 -0
- package/src/actions/pol/getGlobalData.ts +2 -2
- package/src/actions/pol/getIncentiveFeeClaimStats.ts +4 -4
- package/src/actions/pol/getLSTStakeConfig.ts +5 -5
- package/src/actions/pol/getMarkets.ts +2 -2
- package/src/actions/pol/getRewardProofsByValidator.ts +4 -4
- package/src/actions/pol/getRewardTokenToBeraRate.ts +1 -1
- package/src/actions/pol/getRewardVault.ts +3 -3
- package/src/actions/pol/getRewardVaultBeaconImplementation.integration.test.ts +1 -1
- package/src/actions/pol/getRewardVaultBeaconImplementation.ts +3 -3
- package/src/actions/pol/getRewardVaultDurationConstants.integration.test.ts +1 -1
- package/src/actions/pol/getRewardVaultDurationConstants.ts +1 -1
- package/src/actions/pol/getRewardVaultFromToken.ts +1 -1
- package/src/actions/pol/getRewardVaultIncentives.ts +2 -2
- package/src/actions/pol/getRewardVaultRewards.ts +1 -1
- package/src/actions/pol/getRewardVaults.ts +1 -1
- package/src/actions/pol/getSWBeraVaultMetadata.ts +20 -22
- package/src/actions/pol/getSWBeraWithdrawal.ts +4 -4
- package/src/actions/pol/getStakedBeraAPR.ts +2 -2
- package/src/actions/pol/getStakedBeraSnapshots.ts +2 -2
- package/src/actions/pol/getStakingDailyAssets.ts +3 -3
- package/src/actions/pol/getStakingTokenInformation.ts +2 -2
- package/src/actions/pol/getTotalStakedAmount.ts +1 -1
- package/src/actions/pol/getUserClaimableIncentives.ts +4 -4
- package/src/actions/pol/getUserVaultInfo.ts +1 -1
- package/src/actions/pol/getUserVaults.ts +4 -4
- package/src/actions/pol/getUserVaultsBalance.ts +1 -1
- package/src/actions/pol/getUserVaultsReward.ts +0 -0
- package/src/actions/pol/getVaultHistory.ts +2 -2
- package/src/actions/pol/getVaultValidators.ts +1 -1
- package/src/actions/pol/getVaultsSupply.ts +0 -0
- package/src/actions/prices/__tests__/prices.integration.test.ts +2 -2
- package/src/actions/prices/getTokenCurrentPrices.ts +5 -5
- package/src/actions/pyth/getHoneyPythFeeds.ts +2 -2
- package/src/actions/pyth/getUpdateFee.ts +2 -2
- package/src/actions/tokens/getAllowances.ts +2 -2
- package/src/actions/tokens/getTokenInformation.ts +2 -2
- package/src/actions/tokens/getTokens.ts +3 -3
- package/src/actions/tokens/getUnderlyingToken.ts +4 -4
- package/src/actions/tokens/getWalletBalances.integration.test.ts +1 -1
- package/src/actions/tokens/getWalletBalances.ts +4 -4
- package/src/actions/transactions/beraWriteContract.integration.test.ts +6 -6
- package/src/actions/transactions/beraWriteContract.ts +12 -12
- package/src/actions/validators/getActiveBoostAndCommissionChangeDelay.integration.test.ts +1 -1
- package/src/actions/validators/getActiveBoostAndCommissionChangeDelay.ts +1 -1
- package/src/actions/validators/getAllValidators.ts +2 -2
- package/src/actions/validators/getApiValidator.ts +2 -2
- package/src/actions/validators/getBaselineRewardAllocation.ts +1 -1
- package/src/actions/validators/getDailyValidatorBlockStats.ts +1 -1
- package/src/actions/validators/getDefaultRewardAllocation.ts +1 -1
- package/src/actions/validators/getUserActiveValidators.ts +31 -33
- package/src/actions/validators/getUserBoosts.ts +12 -8
- package/src/actions/validators/getUserBoostsOnValidator.ts +15 -3
- package/src/actions/validators/getUserStakingPositions.ts +1 -1
- package/src/actions/validators/getValidatorAnalytics.ts +2 -2
- package/src/actions/validators/getValidatorCommission.ts +1 -1
- package/src/actions/validators/getValidatorEstimatedBgtPerYear.ts +1 -1
- package/src/actions/validators/getValidatorOperatorAddress.ts +1 -1
- package/src/actions/validators/getValidatorQueuedCommission.ts +1 -1
- package/src/actions/validators/getValidatorQueuedOperatorAddress.ts +1 -1
- package/src/actions/validators/getValidatorQueuedRewardAllocation.ts +1 -1
- package/src/actions/validators/getValidatorRewardAllocation.ts +1 -1
- package/src/actions/validators/getValidatorRewardAllocatorAddress.ts +1 -1
- package/src/actions/validators/utils/__tests__/validatorUtils.integration.test.ts +4 -4
- package/src/contexts/BeraFlags/defaultFlags.ts +4 -0
- package/src/contexts/BexStatusProvider.tsx +1 -1
- package/src/contexts/HoneyConfigProvider.tsx +3 -3
- package/src/contexts/SwrFallback.tsx +2 -2
- package/src/contexts/TokensProvider.tsx +3 -3
- package/src/contexts/block-time-provider.tsx +1 -1
- package/src/contexts/exports.ts +0 -0
- package/src/data/contracts.ts +10 -0
- package/src/enum/exports.ts +0 -0
- package/src/enum/polling.ts +0 -0
- package/src/enum/txnEnum.ts +9 -0
- package/src/errors/BeraMonitoring.ts +2 -2
- package/src/errors/BeraTracing.ts +2 -2
- package/src/errors/RequestError.ts +1 -1
- package/src/errors/assert.ts +18 -0
- package/src/errors/getErrorMessage.ts +0 -0
- package/src/errors/getRevertReason.integration.test.ts +7 -7
- package/src/errors/getRevertReason.ts +1 -1
- package/src/errors/parseViemError.ts +1 -1
- package/src/hooks/bend/useGetConvertToAssets.ts +4 -4
- package/src/hooks/dex/useAggregatorsQuotes.ts +19 -19
- package/src/hooks/dex/useAggregatorsRouterFeeBps.ts +2 -2
- package/src/hooks/dex/useAllUserPools.ts +3 -3
- package/src/hooks/dex/useApiPool.ts +3 -3
- package/src/hooks/dex/useBexStatus.ts +1 -1
- package/src/hooks/dex/useCreatePool.ts +9 -9
- package/src/hooks/dex/useExploitedTokens.ts +3 -3
- package/src/hooks/dex/useGlobalLiquidityAndSwapVolume.ts +1 -1
- package/src/hooks/dex/useLiquidityMismatch.ts +3 -3
- package/src/hooks/dex/useLpPosition.ts +7 -4
- package/src/hooks/dex/useMultipleTokenApprovalsWithSlippage.ts +4 -4
- package/src/hooks/dex/useOnChainPoolData.ts +3 -3
- package/src/hooks/dex/usePollPoolCreationRelayerApproval.ts +3 -3
- package/src/hooks/dex/usePool.ts +7 -40
- package/src/hooks/dex/usePoolEvents.ts +2 -2
- package/src/hooks/dex/usePoolHistoricalData.ts +6 -3
- package/src/hooks/dex/usePools.ts +3 -3
- package/src/hooks/dex/usePriceImpact.ts +2 -2
- package/src/hooks/dex/useSingleAggregatorQuote.ts +13 -13
- package/src/hooks/enso/useBendDemultiply.ts +158 -0
- package/src/hooks/enso/useBendMultiply.ts +163 -0
- package/src/hooks/enso/useBendZapSupply.ts +7 -7
- package/src/hooks/enso/useEnsoSwapBundle.ts +6 -6
- package/src/hooks/enso/useEnsoUserTokensWithBalances.ts +5 -5
- package/src/hooks/enso/useEnsoWalletV2Address.ts +38 -0
- package/src/hooks/enso/useIsBendAuthorized.ts +47 -0
- package/src/hooks/enso/useZapStakeBera.ts +4 -4
- package/src/hooks/exports.ts +4 -3
- package/src/hooks/governance/useCreateProposal.ts +3 -3
- package/src/hooks/governance/useGetPastVotes.ts +2 -2
- package/src/hooks/governance/useHasVoted.ts +2 -2
- package/src/hooks/governance/useIsCanceller.ts +4 -4
- package/src/hooks/governance/usePollAllProposals.ts +3 -3
- package/src/hooks/governance/usePollProposal.ts +7 -4
- package/src/hooks/governance/usePollProposalThreshold.ts +3 -3
- package/src/hooks/governance/usePollProposalVotes.ts +1 -1
- package/src/hooks/governance/usePollUserDelegates.ts +7 -4
- package/src/hooks/governance/useProposalFromTx.ts +1 -1
- package/src/hooks/governance/useProposalSnapshot.ts +2 -2
- package/src/hooks/governance/useProposalState.ts +2 -2
- package/src/hooks/governance/useProposalTimelockState.ts +2 -2
- package/src/hooks/governance/useQuorum.ts +1 -1
- package/src/hooks/honey/useCappedGlobally.ts +8 -5
- package/src/hooks/honey/useCappedRelatively.ts +7 -4
- package/src/hooks/honey/useCollateralWeights.ts +8 -5
- package/src/hooks/honey/useHoneyAlerts.ts +5 -5
- package/src/hooks/honey/useHoneyBalances.ts +7 -7
- package/src/hooks/honey/useHoneyChartData.ts +1 -1
- package/src/hooks/honey/useHoneySwapState.ts +4 -4
- package/src/hooks/honey/useHoneyVaultsBalance.ts +8 -5
- package/src/hooks/honey/useIsBadCollateralAsset.ts +9 -6
- package/src/hooks/honey/useIsBasketModeEnabled.ts +8 -5
- package/src/hooks/honey/usePythLatestPrices.ts +4 -4
- package/src/hooks/perps/usePythUpdateFee.ts +4 -4
- package/src/hooks/pol/useBgtAprSimulation.ts +1 -1
- package/src/hooks/pol/useBgtUnstakedBalance.ts +7 -4
- package/src/hooks/pol/useClaimableFees.ts +4 -4
- package/src/hooks/pol/useOnChainRewardVault.ts +7 -7
- package/src/hooks/pol/usePollGlobalData.ts +9 -3
- package/src/hooks/pol/usePollMarkets.ts +5 -2
- package/src/hooks/pol/useQueuedBeraUnlock.ts +4 -4
- package/src/hooks/pol/useRewardTokenToBeraRate.ts +4 -4
- package/src/hooks/pol/useRewardVault.ts +5 -2
- package/src/hooks/pol/useRewardVaultBalanceFromStakingToken.ts +2 -2
- package/src/hooks/pol/useRewardVaultFromToken.ts +2 -2
- package/src/hooks/pol/useRewardVaultIncentives.ts +2 -2
- package/src/hooks/pol/useRewardVaultRewards.ts +3 -3
- package/src/hooks/pol/useRewardVaults.ts +2 -2
- package/src/hooks/pol/useStakedAPR.ts +3 -3
- package/src/hooks/pol/useStakedData.ts +10 -10
- package/src/hooks/pol/useStakedSnapshots.ts +3 -3
- package/src/hooks/pol/useStakingVaultsMetadata.ts +40 -0
- package/src/hooks/pol/useTotalStakedAmount.ts +2 -2
- package/src/hooks/pol/useUserVaultInfo.ts +8 -5
- package/src/hooks/pol/useUserVaults.ts +7 -4
- package/src/hooks/pol/useVaultAddress.ts +2 -2
- package/src/hooks/pol/useVaultHistory.ts +2 -2
- package/src/hooks/pol/useVaultValidators.ts +5 -2
- package/src/hooks/tokens/useBeraCurrentPrice.ts +1 -1
- package/src/hooks/tokens/useMultipleTokenInformation.ts +7 -4
- package/src/hooks/tokens/usePollAllowances.ts +7 -4
- package/src/hooks/tokens/usePollBalance.ts +8 -5
- package/src/hooks/tokens/usePollWalletBalances.ts +8 -5
- package/src/hooks/tokens/useStakingTokenInformation.ts +7 -4
- package/src/hooks/tokens/useTokenCurrentPrice.ts +1 -1
- package/src/hooks/tokens/useTokenCurrentPrices.ts +6 -6
- package/src/hooks/tokens/useTokenInformation.ts +8 -5
- package/src/hooks/tokens/useTokenPrice.ts +1 -1
- package/src/hooks/tokens/useTokenPrices.ts +4 -4
- package/src/hooks/tokens/useTokens.ts +3 -3
- package/src/hooks/tokens/useTotalSupply.ts +1 -1
- package/src/hooks/tokens/useUnderlyingAsset.ts +3 -3
- package/src/hooks/useBlockToTimestamp.ts +5 -5
- package/src/hooks/useContractWrite/index.ts +0 -0
- package/src/hooks/useContractWrite/stateReducer.ts +0 -0
- package/src/hooks/useContractWrite/types.ts +2 -2
- package/src/hooks/useContractWrite/useBeraContractWrite.ts +5 -6
- package/src/hooks/useGetVerifiedAbi.ts +1 -1
- package/src/hooks/usePrevious.ts +0 -0
- package/src/hooks/validators/useAllValidators.ts +7 -4
- package/src/hooks/validators/useApiEnrichedAllocation.ts +2 -2
- package/src/hooks/validators/useApiValidator.ts +5 -2
- package/src/hooks/validators/useBaselineRewardAllocation.ts +2 -2
- package/src/hooks/validators/useDailyValidatorBlockStats.ts +3 -3
- package/src/hooks/validators/useDefaultRewardAllocation.ts +4 -4
- package/src/hooks/validators/useManagedValidatorRole.ts +8 -5
- package/src/hooks/validators/useOnChainValidator.ts +6 -3
- package/src/hooks/validators/useStakingPoolBatch.ts +7 -4
- package/src/hooks/validators/useUserActiveValidators.ts +6 -3
- package/src/hooks/validators/useUserBoostsOnValidator.ts +3 -3
- package/src/hooks/validators/useUserClaimableIncentives.ts +9 -9
- package/src/hooks/validators/useUserStakingPositions.ts +1 -1
- package/src/hooks/validators/useValidator.ts +1 -1
- package/src/hooks/validators/useValidatorAnalytics.ts +3 -3
- package/src/hooks/validators/useValidatorCommission.ts +5 -2
- package/src/hooks/validators/useValidatorEstimatedBgtPerYear.ts +3 -3
- package/src/hooks/validators/useValidatorQueuedCommission.ts +6 -3
- package/src/hooks/validators/useValidatorQueuedOperatorAddress.ts +5 -2
- package/src/hooks/validators/useValidatorQueuedRewardAllocation.ts +6 -3
- package/src/hooks/validators/useValidatorRewardAllocation.ts +2 -2
- package/src/types/dex.d.ts +1 -1
- package/src/types/enso.d.ts +34 -0
- package/src/types/exports.ts +0 -0
- package/src/types/global.d.ts +3 -3
- package/src/types/governance.d.ts +1 -1
- package/src/types/honeySwap.d.ts +3 -3
- package/src/types/staking.d.ts +0 -0
- package/src/utils/beraFetch.ts +1 -1
- package/src/utils/createEmitter.ts +1 -1
- package/src/utils/exports.ts +0 -0
- package/src/utils/filter.ts +0 -0
- package/src/utils/formatIncentivesTokenMap.ts +1 -1
- package/src/utils/formatInputTokenValue.ts +0 -0
- package/src/utils/formatNumber.ts +0 -0
- package/src/utils/getContractName.ts +1 -1
- package/src/utils/getHoneySwapMessage.test.ts +1 -1
- package/src/utils/getHoneySwapMessage.ts +1 -1
- package/src/utils/parseBaseArgs.ts +1 -1
- package/src/utils/parseBaseArgs.unit.test.ts +1 -1
- package/src/utils/parseWhiskToken.ts +1 -1
- package/src/utils/poolNamings.ts +1 -1
- package/src/utils/tokens.ts +2 -2
- package/src/utils/tokens.unit.test.ts +1 -1
- package/src/utils/truncateHash.ts +0 -0
- package/.claude/skills/berajs/SKILL.md +0 -222
- package/.claude/skills/berajs/references/dex.md +0 -235
- package/.claude/skills/berajs/references/pol.md +0 -194
- package/.claude/skills/berajs/references/staking.md +0 -198
- package/.claude/skills/berajs/references/tokens.md +0 -170
- package/LICENSE +0 -21
- package/dist/chunk-22J3YJDN.cjs +0 -2
- package/dist/chunk-22J3YJDN.cjs.map +0 -1
- package/dist/chunk-2LL3P5PN.mjs +0 -2
- package/dist/chunk-2LL3P5PN.mjs.map +0 -1
- package/dist/chunk-4GU2O2OW.cjs +0 -4
- package/dist/chunk-4GU2O2OW.cjs.map +0 -1
- package/dist/chunk-55L7STYD.mjs +0 -2
- package/dist/chunk-55L7STYD.mjs.map +0 -1
- package/dist/chunk-5XWELBWR.mjs +0 -2
- package/dist/chunk-5XWELBWR.mjs.map +0 -1
- package/dist/chunk-6LDOG5RL.cjs.map +0 -1
- package/dist/chunk-7LNBSOVV.cjs +0 -2
- package/dist/chunk-7LNBSOVV.cjs.map +0 -1
- package/dist/chunk-7SMWQ6SN.mjs.map +0 -1
- package/dist/chunk-7WRTK7RJ.mjs.map +0 -1
- package/dist/chunk-AX2YQQFQ.mjs.map +0 -1
- package/dist/chunk-BS6K7HGH.cjs +0 -2
- package/dist/chunk-BS6K7HGH.cjs.map +0 -1
- package/dist/chunk-C3FHGFLK.mjs +0 -2
- package/dist/chunk-C3FHGFLK.mjs.map +0 -1
- package/dist/chunk-C6ZGUO4H.cjs.map +0 -1
- package/dist/chunk-FCWDGE62.cjs.map +0 -1
- package/dist/chunk-RW3JFPED.mjs +0 -4
- package/dist/chunk-RW3JFPED.mjs.map +0 -1
- package/dist/chunk-S3EAKCVM.cjs +0 -2
- package/dist/chunk-S3EAKCVM.cjs.map +0 -1
- package/dist/chunk-SWMJQOH6.cjs +0 -2
- package/dist/chunk-SWMJQOH6.cjs.map +0 -1
- package/dist/chunk-THATXCJK.mjs +0 -2
- package/dist/chunk-THATXCJK.mjs.map +0 -1
- package/dist/chunk-VXL2ZZ4X.cjs +0 -2
- package/dist/chunk-VXL2ZZ4X.cjs.map +0 -1
- package/dist/chunk-YNO7BCCM.mjs +0 -2
- package/dist/chunk-YXLFOEZN.mjs +0 -2
- package/dist/chunk-YXLFOEZN.mjs.map +0 -1
- package/dist/chunk-YZV5LKIP.cjs.map +0 -1
- package/src/actions/dex/getSubgraphPool.ts +0 -30
- package/src/actions/validators/getManagedValidatorByAccount.ts +0 -32
- package/src/hooks/pol/useSWBeraVaultMetadata.ts +0 -35
- package/src/hooks/validators/useManagedValidatorByAccount.ts +0 -40
- package/src/hooks/validators/useSubgraphUserValidators.ts +0 -36
package/package.json
CHANGED
|
@@ -1,37 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@berachain/berajs",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6-patch.1",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
7
|
-
"src"
|
|
8
|
-
".claude/skills"
|
|
7
|
+
"src"
|
|
9
8
|
],
|
|
10
9
|
"author": "Berachain",
|
|
11
10
|
"license": "MIT",
|
|
12
11
|
"type": "module",
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsup",
|
|
14
|
+
"prebuild": "pnpm contracts:update",
|
|
15
|
+
"prepublishOnly": "pnpm build -- --prepublish --sourcemap",
|
|
16
|
+
"test": "vitest",
|
|
17
|
+
"clean": "git clean -xdf dist .turbo node_modules",
|
|
18
|
+
"check-types": "tsup --dtsOnly",
|
|
19
|
+
"precheck-types": "pnpm prebuild",
|
|
20
|
+
"dev": "tsup --watch",
|
|
21
|
+
"lint": "biome lint",
|
|
22
|
+
"lint:fix": "pnpm lint --fix",
|
|
23
|
+
"errors:update": "node .scripts/updateUnkownSignatures.js && biome format src/abi/utils --write",
|
|
24
|
+
"contracts:update": "node .scripts/getContractNames.js && biome format src/data/contracts.ts --write"
|
|
25
|
+
},
|
|
13
26
|
"dependencies": {
|
|
14
27
|
"@apollo/client": "4.1.6",
|
|
15
28
|
"@berachain-foundation/berancer-sdk": "1.1.3",
|
|
16
29
|
"@berachain/abis": "0.1.0",
|
|
17
|
-
"@berachain/
|
|
30
|
+
"@berachain/config": "0.1.0",
|
|
31
|
+
"@berachain/graphql": "0.4.8",
|
|
18
32
|
"@ensofinance/sdk": "2.0.12",
|
|
19
33
|
"@pythnetwork/hermes-client": "2.0.0",
|
|
20
34
|
"@wagmi/core": "2.22.1",
|
|
21
35
|
"gray-matter": "4.0.3",
|
|
22
|
-
"swr": "2.4.1"
|
|
23
|
-
"@berachain/config": "0.1.0"
|
|
36
|
+
"swr": "2.4.1"
|
|
24
37
|
},
|
|
25
38
|
"devDependencies": {
|
|
39
|
+
"@berachain/utils": "0.1.0",
|
|
40
|
+
"@berachain/wagmi": "0.4.0",
|
|
26
41
|
"@types/react-dom": "19.1.6",
|
|
27
42
|
"@types/react": "19.1.8",
|
|
28
43
|
"@typescript/analyze-trace": "0.10.1",
|
|
29
44
|
"tsup": "8.4.0",
|
|
30
45
|
"typescript": "5.5.4",
|
|
31
46
|
"viem": "2.45.0",
|
|
32
|
-
"vitest": "3.2.4"
|
|
33
|
-
"@berachain/utils": "0.1.0",
|
|
34
|
-
"@berachain/wagmi": "0.4.0"
|
|
47
|
+
"vitest": "3.2.4"
|
|
35
48
|
},
|
|
36
49
|
"exports": {
|
|
37
50
|
"./*": {
|
|
@@ -49,22 +62,9 @@
|
|
|
49
62
|
}
|
|
50
63
|
},
|
|
51
64
|
"peerDependencies": {
|
|
65
|
+
"@berachain/wagmi": "^0.4.0",
|
|
52
66
|
"react": "^19.1",
|
|
53
67
|
"react-dom": "^19.1",
|
|
54
|
-
"viem": "^2.41.2"
|
|
55
|
-
"@berachain/wagmi": "0.4.0"
|
|
56
|
-
},
|
|
57
|
-
"scripts": {
|
|
58
|
-
"build": "tsup",
|
|
59
|
-
"prebuild": "pnpm contracts:update",
|
|
60
|
-
"test": "vitest",
|
|
61
|
-
"clean": "git clean -xdf dist .turbo node_modules",
|
|
62
|
-
"check-types": "tsup --dtsOnly",
|
|
63
|
-
"precheck-types": "pnpm prebuild",
|
|
64
|
-
"dev": "tsup --watch",
|
|
65
|
-
"lint": "biome lint",
|
|
66
|
-
"lint:fix": "pnpm lint --fix",
|
|
67
|
-
"errors:update": "node .scripts/updateUnkownSignatures.js && biome format src/abi/utils --write",
|
|
68
|
-
"contracts:update": "node .scripts/getContractNames.js && biome format src/data/contracts.ts --write"
|
|
68
|
+
"viem": "^2.41.2"
|
|
69
69
|
}
|
|
70
|
-
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const ensoWalletV2FactoryAbi = [
|
|
2
|
+
{
|
|
3
|
+
inputs: [{ internalType: "address", name: "user", type: "address" }],
|
|
4
|
+
name: "getAddress",
|
|
5
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
6
|
+
stateMutability: "view",
|
|
7
|
+
type: "function",
|
|
8
|
+
},
|
|
9
|
+
] as const;
|
package/src/abi/exports.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from "./bend/generalAdapter";
|
|
|
3
3
|
export * from "./bend/morphoVault";
|
|
4
4
|
export * from "./bend/publicAllocator";
|
|
5
5
|
export * from "./enso/ensoRouterAbi";
|
|
6
|
+
export * from "./enso/ensoWalletV2Factory";
|
|
6
7
|
export * from "./pyth/pyth";
|
|
7
8
|
export * from "./pyth/pythErrors";
|
|
8
9
|
export * from "./utils/EIP7702StatelessDelegator";
|
package/src/abi/pyth/pyth.ts
CHANGED
|
File without changes
|
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
|
|
9
9
|
import { appConfig } from "@berachain/config/internal";
|
|
10
10
|
|
|
11
|
-
import { BeraError } from "
|
|
12
|
-
import { BeraTracing } from "
|
|
13
|
-
import { RequestError } from "
|
|
11
|
+
import { BeraError } from "../../errors/BeraError";
|
|
12
|
+
import { BeraTracing } from "../../errors/BeraTracing";
|
|
13
|
+
import { RequestError } from "../../errors/RequestError";
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* This is a wrapper around the ApolloClient that throws a BeraError if the query returns an error or no data.
|
|
@@ -7,8 +7,8 @@ import { currentDapp } from "@berachain/config/internal";
|
|
|
7
7
|
|
|
8
8
|
import apiResults from "@berachain/graphql/dex/api";
|
|
9
9
|
|
|
10
|
-
import { BeraError } from "
|
|
11
|
-
import { parseBaseArgs } from "
|
|
10
|
+
import { BeraError } from "../../errors/BeraError";
|
|
11
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
12
12
|
import { BeraApolloClient } from "./BeraApolloClient";
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -66,8 +66,8 @@ function getClient(
|
|
|
66
66
|
type GraphqlClient =
|
|
67
67
|
| "honey.subgraph"
|
|
68
68
|
| "pol.subgraph"
|
|
69
|
+
| "pol.fees"
|
|
69
70
|
| "governance.subgraph"
|
|
70
|
-
| "blocks.subgraph"
|
|
71
71
|
| "bex.subgraph"
|
|
72
72
|
| "api"
|
|
73
73
|
| "bend.whisk";
|
|
@@ -99,10 +99,10 @@ export function getApolloClient(
|
|
|
99
99
|
return getClient(config.honey.subgraph);
|
|
100
100
|
case "pol.subgraph":
|
|
101
101
|
return getClient(config.pol.subgraph);
|
|
102
|
+
case "pol.fees":
|
|
103
|
+
return getClient(config.pol.feesSubgraph);
|
|
102
104
|
case "governance.subgraph":
|
|
103
105
|
return getClient(config.governance.subgraph);
|
|
104
|
-
case "blocks.subgraph":
|
|
105
|
-
return getClient(config.blocksSubgraph);
|
|
106
106
|
case "bex.subgraph":
|
|
107
107
|
return getClient(config.bex.subgraph);
|
|
108
108
|
}
|
|
@@ -2,7 +2,7 @@ import { EnsoClient } from "@ensofinance/sdk";
|
|
|
2
2
|
|
|
3
3
|
import { appConfig } from "@berachain/config/internal";
|
|
4
4
|
|
|
5
|
-
import { parseBaseArgs } from "
|
|
5
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
6
6
|
|
|
7
7
|
const isProduction =
|
|
8
8
|
process.env.NODE_ENV !== "development" && process.env.NODE_ENV !== "test";
|
|
@@ -2,9 +2,9 @@ import { beforeEach, describe, expect, test } from "vitest";
|
|
|
2
2
|
|
|
3
3
|
import { ChainId } from "@berachain/config/internal";
|
|
4
4
|
|
|
5
|
-
import { Aggregators } from "
|
|
6
|
-
import { BeraError } from "
|
|
7
|
-
import type { IAggregatorArgs, IRawAggregatorQuote } from "
|
|
5
|
+
import { Aggregators } from "../../../enum/dex";
|
|
6
|
+
import { BeraError } from "../../../errors/BeraError";
|
|
7
|
+
import type { IAggregatorArgs, IRawAggregatorQuote } from "../../../types/dex";
|
|
8
8
|
import { BaseAggregator } from "../aggregators/base";
|
|
9
9
|
|
|
10
10
|
// Test implementation of BaseAggregator to access protected methods
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
2
|
|
|
3
|
-
import { getServerSidePublicClient } from "
|
|
3
|
+
import { getServerSidePublicClient } from "../../../utils/getServerSideClient";
|
|
4
4
|
import { getOnChainPool } from "../getOnChainPool";
|
|
5
5
|
|
|
6
6
|
describe("getOnChainPool", () => {
|
|
@@ -4,14 +4,18 @@ import type { BeraConfig, ChainId } from "@berachain/config/internal";
|
|
|
4
4
|
|
|
5
5
|
import BigNumber from "@berachain/utils/pkg/bignumber.js";
|
|
6
6
|
|
|
7
|
-
import type { HoneyConfigContextReturn } from "
|
|
8
|
-
import type { Aggregators } from "
|
|
9
|
-
import { BeraError } from "
|
|
10
|
-
import { initBeraError } from "
|
|
11
|
-
import type {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
import type { HoneyConfigContextReturn } from "../../../contexts/HoneyConfigProvider";
|
|
8
|
+
import type { Aggregators } from "../../../enum/dex";
|
|
9
|
+
import { BeraError } from "../../../errors/BeraError";
|
|
10
|
+
import { initBeraError } from "../../../errors/initBeraError";
|
|
11
|
+
import type {
|
|
12
|
+
IAggregatorArgs,
|
|
13
|
+
IRawAggregatorQuote,
|
|
14
|
+
Token,
|
|
15
|
+
} from "../../../types/dex";
|
|
16
|
+
import { beraFetch } from "../../../utils/beraFetch";
|
|
17
|
+
import { parseBaseArgs } from "../../../utils/parseBaseArgs";
|
|
18
|
+
import { isToken } from "../../../utils/tokens";
|
|
15
19
|
|
|
16
20
|
export abstract class BaseAggregator {
|
|
17
21
|
abstract name: Aggregators;
|
|
@@ -14,14 +14,14 @@ import { ChainId } from "@berachain/config/internal";
|
|
|
14
14
|
|
|
15
15
|
import { vaultAbi as balancerVaultAbi } from "@berachain/abis/bex/vault";
|
|
16
16
|
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import
|
|
24
|
-
import {
|
|
17
|
+
import { Aggregators } from "../../../enum/dex";
|
|
18
|
+
import { assertPublicClient } from "../../../errors/assert";
|
|
19
|
+
import { BeraError } from "../../../errors/BeraError";
|
|
20
|
+
import { BeraMonitoring } from "../../../errors/BeraMonitoring";
|
|
21
|
+
import { RequestError } from "../../../errors/RequestError";
|
|
22
|
+
import type { IAggregatorArgs, IRawAggregatorQuote } from "../../../types/dex";
|
|
23
|
+
import { isToken } from "../../../utils/tokens";
|
|
24
|
+
import { BalancerApi } from "../b-sdk";
|
|
25
25
|
import { BaseAggregator } from "./base";
|
|
26
26
|
|
|
27
27
|
// Constants
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ChainId } from "@berachain/config/internal";
|
|
2
2
|
|
|
3
|
-
import { Aggregators } from "
|
|
4
|
-
import { InvalidArgumentError } from "
|
|
3
|
+
import { Aggregators } from "../../../enum/dex";
|
|
4
|
+
import { InvalidArgumentError } from "../../../errors/InvalidArgumentError";
|
|
5
5
|
import type {
|
|
6
6
|
IAggregatorArgs,
|
|
7
7
|
IRawAggregatorQuote,
|
|
8
8
|
MinimalERC20,
|
|
9
|
-
} from "
|
|
10
|
-
import { beraToken, isToken } from "
|
|
9
|
+
} from "../../../types/dex";
|
|
10
|
+
import { beraToken, isToken } from "../../../utils/tokens";
|
|
11
11
|
import { BaseAggregator } from "./base";
|
|
12
12
|
|
|
13
13
|
class RedeemBgtAggregator extends BaseAggregator {
|
|
@@ -2,10 +2,14 @@ import { zeroAddress } from "viem";
|
|
|
2
2
|
|
|
3
3
|
import { ChainId } from "@berachain/config/internal";
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
import { Aggregators } from "
|
|
8
|
-
import type {
|
|
5
|
+
import aggregatorsRouterAbi from "@berachain/abis/meta-aggregator/metaAggregatorV2";
|
|
6
|
+
|
|
7
|
+
import { Aggregators } from "../../../../enum/dex";
|
|
8
|
+
import type {
|
|
9
|
+
IAggregatorArgs,
|
|
10
|
+
IRawAggregatorQuote,
|
|
11
|
+
} from "../../../../types/dex";
|
|
12
|
+
import type { IContractWrite } from "../../../../types/global";
|
|
9
13
|
import { BaseAggregator } from "../base";
|
|
10
14
|
|
|
11
15
|
class EnsoAggregator extends BaseAggregator {
|
|
@@ -95,22 +99,26 @@ class EnsoAggregator extends BaseAggregator {
|
|
|
95
99
|
}),
|
|
96
100
|
name: this.name,
|
|
97
101
|
swapFeeBps: aggregatorsFeeBps!,
|
|
98
|
-
getCalldata: () =>
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
102
|
+
getCalldata: () =>
|
|
103
|
+
({
|
|
104
|
+
params: [
|
|
105
|
+
inputData,
|
|
106
|
+
outputData,
|
|
107
|
+
aggregatorData,
|
|
108
|
+
{
|
|
109
|
+
rewardVault: rewardVault ?? zeroAddress,
|
|
110
|
+
isSwapAndStake: !!rewardVault,
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
functionName: "swap",
|
|
114
|
+
abi: aggregatorsRouterAbi,
|
|
115
|
+
// send full amount to router first, which will deduct the swap fee before executing trade
|
|
116
|
+
value: isTokenInNative ? BigInt(amount) : BigInt("0"),
|
|
117
|
+
address: this.config.bex.aggregatorsRouter,
|
|
118
|
+
}) satisfies Omit<
|
|
119
|
+
IContractWrite<typeof aggregatorsRouterAbi, "swap">,
|
|
120
|
+
"message" | "actionType"
|
|
121
|
+
>,
|
|
114
122
|
};
|
|
115
123
|
}
|
|
116
124
|
}
|
|
@@ -3,7 +3,7 @@ import { describe, expect, it } from "vitest";
|
|
|
3
3
|
|
|
4
4
|
import { mainnet } from "@berachain/config/mainnet";
|
|
5
5
|
|
|
6
|
-
import { beraToken, getHoneyToken } from "
|
|
6
|
+
import { beraToken, getHoneyToken } from "../../../../utils/tokens";
|
|
7
7
|
import { ensoErc4626 } from "./ensoErc4626";
|
|
8
8
|
|
|
9
9
|
describe("ensoErc4626", () => {
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import type { BundleAction } from "@ensofinance/sdk";
|
|
2
2
|
import { type Address, ethAddress, type Hex, zeroAddress } from "viem";
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
4
|
+
import { Aggregators } from "../../../../enum/dex";
|
|
5
|
+
import { assertAddress } from "../../../../errors/assert";
|
|
6
|
+
import type {
|
|
7
|
+
IAggregatorArgs,
|
|
8
|
+
IRawAggregatorQuote,
|
|
9
|
+
} from "../../../../types/dex";
|
|
10
|
+
import { getEnsoClient } from "../../../clients/getEnsoClient";
|
|
8
11
|
import { BaseAggregator } from "../base";
|
|
9
12
|
|
|
10
13
|
class EnsoErc4626Aggregator extends BaseAggregator {
|
|
@@ -2,12 +2,16 @@ import { erc4626Abi, formatUnits } from "viem";
|
|
|
2
2
|
|
|
3
3
|
import { wberaStakerVaultAbi as stakeBeraVaultAbi } from "@berachain/abis/pol/wberaStakerVault";
|
|
4
4
|
|
|
5
|
-
import { ContractName } from "
|
|
6
|
-
import { Aggregators } from "
|
|
7
|
-
import { assertDefined, assertPublicClient } from "
|
|
8
|
-
import type {
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
import { ContractName } from "../../../enum/contracts";
|
|
6
|
+
import { Aggregators } from "../../../enum/dex";
|
|
7
|
+
import { assertDefined, assertPublicClient } from "../../../errors/assert";
|
|
8
|
+
import type {
|
|
9
|
+
IAggregatorArgs,
|
|
10
|
+
IRawAggregatorQuote,
|
|
11
|
+
Token,
|
|
12
|
+
} from "../../../types/dex";
|
|
13
|
+
import type { IContractWrite } from "../../../types/global";
|
|
14
|
+
import { isToken } from "../../../utils/tokens";
|
|
11
15
|
import { BaseAggregator } from "./base";
|
|
12
16
|
|
|
13
17
|
/**
|
|
@@ -2,11 +2,12 @@ import { type Address, type Hex, zeroAddress } from "viem";
|
|
|
2
2
|
|
|
3
3
|
import { ChainId } from "@berachain/config/internal";
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import aggregatorsRouterAbi from "@berachain/abis/meta-aggregator/metaAggregatorV2";
|
|
6
6
|
|
|
7
|
-
import { Aggregators } from "
|
|
8
|
-
import type { IAggregatorArgs, IRawAggregatorQuote } from "
|
|
9
|
-
import {
|
|
7
|
+
import { Aggregators } from "../../../enum/dex";
|
|
8
|
+
import type { IAggregatorArgs, IRawAggregatorQuote } from "../../../types/dex";
|
|
9
|
+
import type { IContractWrite } from "../../../types/global";
|
|
10
|
+
import { isToken } from "../../../utils/tokens";
|
|
10
11
|
import { BaseAggregator } from "./base";
|
|
11
12
|
|
|
12
13
|
const BASE_URL = "https://api.fly.trade/aggregator";
|
|
@@ -134,7 +135,10 @@ class FlyAggregator extends BaseAggregator {
|
|
|
134
135
|
// send full amount to router first, which will deduct the swap fee before executing trade
|
|
135
136
|
value: isToken(tokenIn, "BERA") ? BigInt(amount) : BigInt("0"),
|
|
136
137
|
address: this.config.bex.aggregatorsRouter,
|
|
137
|
-
}
|
|
138
|
+
} satisfies Omit<
|
|
139
|
+
IContractWrite<typeof aggregatorsRouterAbi, "swap">,
|
|
140
|
+
"message" | "actionType"
|
|
141
|
+
>;
|
|
138
142
|
},
|
|
139
143
|
};
|
|
140
144
|
}
|
|
@@ -2,9 +2,9 @@ import { describe, expect, it } from "vitest";
|
|
|
2
2
|
|
|
3
3
|
import { ChainId, defaultChainId } from "@berachain/config/internal";
|
|
4
4
|
|
|
5
|
-
import { assertAddress } from "
|
|
6
|
-
import { getServerSidePublicClient } from "
|
|
7
|
-
import { parseBaseArgs } from "
|
|
5
|
+
import { assertAddress } from "../../../errors/assert";
|
|
6
|
+
import { getServerSidePublicClient } from "../../../utils/getServerSideClient";
|
|
7
|
+
import { parseBaseArgs } from "../../../utils/parseBaseArgs";
|
|
8
8
|
|
|
9
9
|
describe.runIf(defaultChainId === ChainId.MAINNET)("haiku", () => {
|
|
10
10
|
const { config } = parseBaseArgs({ chainId: defaultChainId });
|
|
@@ -2,11 +2,12 @@ import { formatUnits, parseUnits, zeroAddress } from "viem";
|
|
|
2
2
|
|
|
3
3
|
import { ChainId } from "@berachain/config/internal";
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import aggregatorsRouterAbi from "@berachain/abis/meta-aggregator/metaAggregatorV2";
|
|
6
6
|
|
|
7
|
-
import { Aggregators, SwapReferrer } from "
|
|
8
|
-
import { BeraError } from "
|
|
9
|
-
import type { IAggregatorArgs, IRawAggregatorQuote } from "
|
|
7
|
+
import { Aggregators, SwapReferrer } from "../../../enum/dex";
|
|
8
|
+
import { BeraError } from "../../../errors/BeraError";
|
|
9
|
+
import type { IAggregatorArgs, IRawAggregatorQuote } from "../../../types/dex";
|
|
10
|
+
import type { IContractWrite } from "../../../types/global";
|
|
10
11
|
import { BaseAggregator } from "./base";
|
|
11
12
|
|
|
12
13
|
class HaikuAggregator extends BaseAggregator {
|
|
@@ -161,7 +162,10 @@ class HaikuAggregator extends BaseAggregator {
|
|
|
161
162
|
// send full amount to router first, which will deduct the swap fee before executing trade
|
|
162
163
|
value: isTokenInNative ? BigInt(amount) : BigInt("0"),
|
|
163
164
|
address: this.config.bex.aggregatorsRouter,
|
|
164
|
-
}
|
|
165
|
+
} satisfies Omit<
|
|
166
|
+
IContractWrite<typeof aggregatorsRouterAbi, "swap">,
|
|
167
|
+
"message" | "actionType"
|
|
168
|
+
>;
|
|
165
169
|
},
|
|
166
170
|
};
|
|
167
171
|
}
|
|
@@ -4,26 +4,26 @@ import { ChainId } from "@berachain/config/internal";
|
|
|
4
4
|
|
|
5
5
|
import BigNumber from "@berachain/utils/pkg/bignumber.js";
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} from "
|
|
12
|
-
import { getHoneyVaultsBalance } from "~/actions/honey/getHoneyVaultsBalance";
|
|
13
|
-
import { getSwapPayload } from "~/actions/honey/getSwapPayload";
|
|
14
|
-
import { isBasketModeEnabled } from "~/actions/honey/isBasketModeEnabled";
|
|
15
|
-
import type { HoneyConfigContextReturn } from "~/contexts/HoneyConfigProvider";
|
|
16
|
-
import { Aggregators } from "~/enum/dex";
|
|
17
|
-
import { assertPublicClient } from "~/errors/assert";
|
|
18
|
-
import { BeraError } from "~/errors/BeraError";
|
|
19
|
-
import { InvalidArgumentError } from "~/errors/InvalidArgumentError";
|
|
7
|
+
import type { HoneyConfigContextReturn } from "../../../contexts/HoneyConfigProvider";
|
|
8
|
+
import { Aggregators } from "../../../enum/dex";
|
|
9
|
+
import { assertPublicClient } from "../../../errors/assert";
|
|
10
|
+
import { BeraError } from "../../../errors/BeraError";
|
|
11
|
+
import { InvalidArgumentError } from "../../../errors/InvalidArgumentError";
|
|
20
12
|
import type {
|
|
21
13
|
IAggregatorArgs,
|
|
22
14
|
IRawAggregatorQuote,
|
|
23
15
|
Token,
|
|
24
16
|
TokenWithMetadata,
|
|
25
|
-
} from "
|
|
26
|
-
import { getHoneyToken, isToken } from "
|
|
17
|
+
} from "../../../types/dex";
|
|
18
|
+
import { getHoneyToken, isToken } from "../../../utils/tokens";
|
|
19
|
+
import {
|
|
20
|
+
getHoneyPreview,
|
|
21
|
+
type HoneyPreviewArgs,
|
|
22
|
+
HoneyPreviewMethod,
|
|
23
|
+
} from "../../honey/getHoneyPreview";
|
|
24
|
+
import { getHoneyVaultsBalance } from "../../honey/getHoneyVaultsBalance";
|
|
25
|
+
import { getSwapPayload } from "../../honey/getSwapPayload";
|
|
26
|
+
import { isBasketModeEnabled } from "../../honey/isBasketModeEnabled";
|
|
27
27
|
import { BaseAggregator } from "./base";
|
|
28
28
|
|
|
29
29
|
interface IHoneyNativeArgs
|
|
@@ -2,10 +2,11 @@ import { zeroAddress } from "viem";
|
|
|
2
2
|
|
|
3
3
|
import { ChainId } from "@berachain/config/internal";
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import aggregatorsRouterAbi from "@berachain/abis/meta-aggregator/metaAggregatorV2";
|
|
6
6
|
|
|
7
|
-
import { Aggregators } from "
|
|
8
|
-
import type { IAggregatorArgs, IRawAggregatorQuote } from "
|
|
7
|
+
import { Aggregators } from "../../../enum/dex";
|
|
8
|
+
import type { IAggregatorArgs, IRawAggregatorQuote } from "../../../types/dex";
|
|
9
|
+
import type { IContractWrite } from "../../../types/global";
|
|
9
10
|
import { BaseAggregator } from "./base";
|
|
10
11
|
|
|
11
12
|
class KyberSwapAggregator extends BaseAggregator {
|
|
@@ -135,7 +136,10 @@ class KyberSwapAggregator extends BaseAggregator {
|
|
|
135
136
|
// send full amount to router first, which will deduct the swap fee before executing trade
|
|
136
137
|
value: isTokenInNative ? BigInt(amount) : BigInt("0"),
|
|
137
138
|
address: this.config.bex.aggregatorsRouter,
|
|
138
|
-
}
|
|
139
|
+
} satisfies Omit<
|
|
140
|
+
IContractWrite<typeof aggregatorsRouterAbi, "swap">,
|
|
141
|
+
"message" | "actionType"
|
|
142
|
+
>;
|
|
139
143
|
},
|
|
140
144
|
};
|
|
141
145
|
}
|
|
@@ -2,10 +2,11 @@ import { zeroAddress } from "viem";
|
|
|
2
2
|
|
|
3
3
|
import { ChainId } from "@berachain/config/internal";
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import aggregatorsRouterAbi from "@berachain/abis/meta-aggregator/metaAggregatorV2";
|
|
6
6
|
|
|
7
|
-
import { Aggregators } from "
|
|
8
|
-
import type { IAggregatorArgs, IRawAggregatorQuote } from "
|
|
7
|
+
import { Aggregators } from "../../../enum/dex";
|
|
8
|
+
import type { IAggregatorArgs, IRawAggregatorQuote } from "../../../types/dex";
|
|
9
|
+
import type { IContractWrite } from "../../../types/global";
|
|
9
10
|
import { BaseAggregator } from "./base";
|
|
10
11
|
|
|
11
12
|
class OogaboogaAggregator extends BaseAggregator {
|
|
@@ -103,7 +104,10 @@ class OogaboogaAggregator extends BaseAggregator {
|
|
|
103
104
|
// send full amount to router first, which will deduct the swap fee before executing trade
|
|
104
105
|
value: isTokenInNative ? BigInt(amount) : BigInt("0"),
|
|
105
106
|
address: this.config.bex.aggregatorsRouter,
|
|
106
|
-
}
|
|
107
|
+
} satisfies Omit<
|
|
108
|
+
IContractWrite<typeof aggregatorsRouterAbi, "swap">,
|
|
109
|
+
"message" | "actionType"
|
|
110
|
+
>;
|
|
107
111
|
},
|
|
108
112
|
};
|
|
109
113
|
}
|
|
@@ -2,13 +2,14 @@ import { zeroAddress } from "viem";
|
|
|
2
2
|
|
|
3
3
|
import { ChainId } from "@berachain/config/internal";
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
import { Aggregators } from "
|
|
8
|
-
import { assertPublicClient } from "
|
|
9
|
-
import { InvalidArgumentError } from "
|
|
10
|
-
import { RequestError } from "
|
|
11
|
-
import type { IAggregatorArgs, IRawAggregatorQuote } from "
|
|
5
|
+
import aggregatorsRouterAbi from "@berachain/abis/meta-aggregator/metaAggregatorV2";
|
|
6
|
+
|
|
7
|
+
import { Aggregators } from "../../../enum/dex";
|
|
8
|
+
import { assertPublicClient } from "../../../errors/assert";
|
|
9
|
+
import { InvalidArgumentError } from "../../../errors/InvalidArgumentError";
|
|
10
|
+
import { RequestError } from "../../../errors/RequestError";
|
|
11
|
+
import type { IAggregatorArgs, IRawAggregatorQuote } from "../../../types/dex";
|
|
12
|
+
import type { IContractWrite } from "../../../types/global";
|
|
12
13
|
import { BaseAggregator } from "./base";
|
|
13
14
|
|
|
14
15
|
class OpenOceanAggregator extends BaseAggregator {
|
|
@@ -139,7 +140,10 @@ class OpenOceanAggregator extends BaseAggregator {
|
|
|
139
140
|
// send full amount to router first, which will deduct the swap fee before executing trade
|
|
140
141
|
value: isTokenInNative ? BigInt(amount) : BigInt("0"),
|
|
141
142
|
address: this.config.bex.aggregatorsRouter,
|
|
142
|
-
}
|
|
143
|
+
} satisfies Omit<
|
|
144
|
+
IContractWrite<typeof aggregatorsRouterAbi, "swap">,
|
|
145
|
+
"message" | "actionType"
|
|
146
|
+
>;
|
|
143
147
|
},
|
|
144
148
|
};
|
|
145
149
|
}
|
|
@@ -2,10 +2,14 @@ import { ChainId } from "@berachain/config/internal";
|
|
|
2
2
|
|
|
3
3
|
import { wberaAbi } from "@berachain/abis/wbera";
|
|
4
4
|
|
|
5
|
-
import { Aggregators } from "
|
|
6
|
-
import type {
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import { Aggregators } from "../../../enum/dex";
|
|
6
|
+
import type {
|
|
7
|
+
IAggregatorArgs,
|
|
8
|
+
IRawAggregatorQuote,
|
|
9
|
+
Token,
|
|
10
|
+
} from "../../../types/dex";
|
|
11
|
+
import type { IContractWrite } from "../../../types/global";
|
|
12
|
+
import { isToken } from "../../../utils/tokens";
|
|
9
13
|
import { BaseAggregator } from "./base";
|
|
10
14
|
|
|
11
15
|
class WBeraAggregator extends BaseAggregator {
|
package/src/actions/dex/b-sdk.ts
CHANGED
|
@@ -15,8 +15,8 @@ import { berachain, berachainBepolia } from "viem/chains";
|
|
|
15
15
|
|
|
16
16
|
import { type ChainId, chainConfigs } from "@berachain/config/internal";
|
|
17
17
|
|
|
18
|
-
import { parseBaseArgs } from "
|
|
19
|
-
import { beraToken } from "
|
|
18
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
19
|
+
import { beraToken } from "../../utils/tokens";
|
|
20
20
|
|
|
21
21
|
for (const chain of Object.keys(chainConfigs)) {
|
|
22
22
|
const { config, chainId } = parseBaseArgs({
|
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
GqlPoolOrderDirection,
|
|
12
12
|
} from "@berachain/graphql/pol/api";
|
|
13
13
|
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
14
|
+
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
15
|
+
import { getApolloClient } from "../clients/getApolloClient";
|
|
16
16
|
|
|
17
17
|
export async function getAllPools({
|
|
18
18
|
textSearch,
|