@berachain/berajs 0.1.2 → 0.2.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/dist/{BeraError-D1HS_rbb.d.cts → BeraError-_mQdkanr.d.cts} +35 -10
- package/dist/{BeraError-D1HS_rbb.d.ts → BeraError-_mQdkanr.d.ts} +35 -10
- package/dist/HoneyConfigProvider-CK6mOKFH.d.ts +390 -0
- package/dist/HoneyConfigProvider-Ca3ouozs.d.cts +390 -0
- package/dist/{RequestError-D8AE6xnI.d.cts → RequestError-A8XJ6QR9.d.cts} +1 -1
- package/dist/{RequestError-m4jxyM7D.d.ts → RequestError-Dk97z8rm.d.ts} +1 -1
- package/dist/abi/exports.cjs +2 -0
- package/dist/abi/exports.cjs.map +1 -0
- package/dist/abi/{index.d.cts → exports.d.cts} +12369 -9122
- package/dist/abi/{index.d.ts → exports.d.ts} +12369 -9122
- package/dist/abi/exports.mjs +2 -0
- package/dist/abi/exports.mjs.map +1 -0
- package/dist/actions/exports.cjs +2 -0
- package/dist/actions/exports.cjs.map +1 -0
- package/dist/actions/{index.d.cts → exports.d.cts} +79 -107
- package/dist/actions/{index.d.ts → exports.d.ts} +79 -107
- package/dist/actions/exports.mjs +2 -0
- package/dist/actions/exports.mjs.map +1 -0
- package/dist/chunk-22J3YJDN.cjs +2 -0
- package/dist/chunk-22J3YJDN.cjs.map +1 -0
- package/dist/chunk-2LL3P5PN.mjs +2 -0
- package/dist/chunk-2LL3P5PN.mjs.map +1 -0
- package/dist/chunk-3YXSUBA5.mjs +2 -0
- package/dist/chunk-3YXSUBA5.mjs.map +1 -0
- package/dist/chunk-55L7STYD.mjs +2 -0
- package/dist/chunk-55L7STYD.mjs.map +1 -0
- package/dist/chunk-575OK77P.mjs +2 -0
- package/dist/chunk-575OK77P.mjs.map +1 -0
- package/dist/chunk-6LDOG5RL.cjs +2 -0
- package/dist/chunk-6LDOG5RL.cjs.map +1 -0
- package/dist/chunk-7LNBSOVV.cjs +2 -0
- package/dist/chunk-7LNBSOVV.cjs.map +1 -0
- package/dist/chunk-7SMWQ6SN.mjs +2 -0
- package/dist/chunk-7SMWQ6SN.mjs.map +1 -0
- package/dist/chunk-7WRTK7RJ.mjs +2 -0
- package/dist/chunk-7WRTK7RJ.mjs.map +1 -0
- package/dist/chunk-A4UDYSB6.mjs +4 -0
- package/dist/chunk-A4UDYSB6.mjs.map +1 -0
- package/dist/chunk-AX2YQQFQ.mjs +2 -0
- package/dist/chunk-AX2YQQFQ.mjs.map +1 -0
- package/dist/chunk-C3FHGFLK.mjs +2 -0
- package/dist/chunk-C3FHGFLK.mjs.map +1 -0
- package/dist/chunk-C6ZGUO4H.cjs +2 -0
- package/dist/chunk-C6ZGUO4H.cjs.map +1 -0
- package/dist/chunk-CYKCYPFR.cjs +2 -0
- package/dist/chunk-CYKCYPFR.cjs.map +1 -0
- package/dist/chunk-ECRMUMTA.mjs +2 -0
- package/dist/chunk-ECRMUMTA.mjs.map +1 -0
- package/dist/chunk-F4BKSBEM.mjs +2 -0
- package/dist/chunk-F4BKSBEM.mjs.map +1 -0
- package/dist/chunk-FCWDGE62.cjs +2 -0
- package/dist/chunk-FCWDGE62.cjs.map +1 -0
- package/dist/chunk-FL2N3XHK.cjs +2 -0
- package/dist/chunk-FL2N3XHK.cjs.map +1 -0
- package/dist/chunk-MUCEYO3E.cjs +4 -0
- package/dist/chunk-MUCEYO3E.cjs.map +1 -0
- package/dist/chunk-NAXAZJJY.mjs +2 -0
- package/dist/chunk-NAXAZJJY.mjs.map +1 -0
- package/dist/chunk-OGJMSGB2.mjs +2 -0
- package/dist/chunk-OGJMSGB2.mjs.map +1 -0
- package/dist/chunk-OIYXOKTT.cjs +2 -0
- package/dist/chunk-OIYXOKTT.cjs.map +1 -0
- package/dist/chunk-P2Q7CMUD.cjs +2 -0
- package/dist/chunk-P2Q7CMUD.cjs.map +1 -0
- package/dist/chunk-PKXAW6MO.cjs +2 -0
- package/dist/chunk-PKXAW6MO.cjs.map +1 -0
- package/dist/chunk-Q3SCM6WL.mjs +2 -0
- package/dist/chunk-Q3SCM6WL.mjs.map +1 -0
- package/dist/chunk-SWMJQOH6.cjs +2 -0
- package/dist/chunk-SWMJQOH6.cjs.map +1 -0
- package/dist/chunk-TEBJWAVU.mjs +2 -0
- package/dist/chunk-TEBJWAVU.mjs.map +1 -0
- package/dist/chunk-THATXCJK.mjs +2 -0
- package/dist/chunk-THATXCJK.mjs.map +1 -0
- package/dist/chunk-VP7XUOSI.cjs +2 -0
- package/dist/chunk-VP7XUOSI.cjs.map +1 -0
- package/dist/chunk-VXL2ZZ4X.cjs +2 -0
- package/dist/chunk-VXL2ZZ4X.cjs.map +1 -0
- package/dist/chunk-WRFDB3QJ.cjs +2 -0
- package/dist/chunk-WRFDB3QJ.cjs.map +1 -0
- package/dist/chunk-XNJLSA6P.cjs +2 -0
- package/dist/chunk-XNJLSA6P.cjs.map +1 -0
- package/dist/chunk-YXLFOEZN.mjs +2 -0
- package/dist/chunk-YXLFOEZN.mjs.map +1 -0
- package/dist/chunk-YZV5LKIP.cjs +2 -0
- package/dist/chunk-YZV5LKIP.cjs.map +1 -0
- package/dist/contexts/exports.cjs +2 -0
- package/dist/contexts/exports.cjs.map +1 -0
- package/dist/contexts/{index.d.cts → exports.d.cts} +10 -27
- package/dist/contexts/{index.d.ts → exports.d.ts} +10 -27
- package/dist/contexts/exports.mjs +2 -0
- package/dist/contexts/exports.mjs.map +1 -0
- package/dist/{defaultFlags-V-tJs2K8.d.cts → defaultFlags-d0kPbT0i.d.cts} +1 -1
- package/dist/{defaultFlags-V-tJs2K8.d.ts → defaultFlags-d0kPbT0i.d.ts} +1 -1
- package/dist/dex-C_BB0b0O.d.cts +37 -0
- package/dist/dex-C_BB0b0O.d.ts +37 -0
- package/dist/enum/exports.cjs +2 -0
- package/dist/enum/exports.cjs.map +1 -0
- package/dist/enum/exports.d.cts +23 -0
- package/dist/enum/exports.d.ts +23 -0
- package/dist/enum/exports.mjs +2 -0
- package/dist/enum/exports.mjs.map +1 -0
- package/dist/errors/exports.cjs +2 -0
- package/dist/errors/exports.cjs.map +1 -0
- package/dist/errors/exports.d.cts +408 -0
- package/dist/errors/exports.d.ts +408 -0
- package/dist/errors/exports.mjs +2 -0
- package/dist/{getValidatorQueuedOperatorAddress-Ne2zoiiV.d.ts → getValidatorQueuedOperatorAddress-Dstyaomr.d.cts} +125 -15
- package/dist/{getValidatorQueuedOperatorAddress-9xY2RUGe.d.cts → getValidatorQueuedOperatorAddress-RW4OMcD1.d.ts} +125 -15
- package/dist/global.d-CN6l2b9E.d.cts +473 -0
- package/dist/global.d-wYu8G8IQ.d.ts +473 -0
- package/dist/honey-CYm0RWf4.d.cts +14 -0
- package/dist/honey-CYm0RWf4.d.ts +14 -0
- package/dist/hooks/exports.cjs +4 -0
- package/dist/hooks/exports.cjs.map +1 -0
- package/dist/hooks/{index.d.cts → exports.d.cts} +218 -176
- package/dist/hooks/{index.d.ts → exports.d.ts} +218 -176
- package/dist/hooks/exports.mjs +4 -0
- package/dist/hooks/exports.mjs.map +1 -0
- package/dist/{txnEnum-BQKDfaeH.d.cts → txnEnum-BlBYhNRl.d.cts} +75 -1
- package/dist/{txnEnum-BQKDfaeH.d.ts → txnEnum-BlBYhNRl.d.ts} +75 -1
- package/dist/types/exports.cjs +1 -0
- package/dist/types/exports.cjs.map +1 -0
- package/dist/types/exports.d.cts +57 -0
- package/dist/types/exports.d.ts +57 -0
- package/dist/types/exports.mjs +1 -0
- package/dist/{useHoneySwapState-C-9BV4VB.d.cts → useHoneySwapState-B-vmIP1b.d.cts} +1 -1
- package/dist/{useHoneySwapState-CUY5Sm1b.d.ts → useHoneySwapState-D1DKG_Of.d.ts} +1 -1
- package/dist/utils/exports.cjs +2 -0
- package/dist/utils/exports.cjs.map +1 -0
- package/dist/utils/{index.d.cts → exports.d.cts} +83 -20
- package/dist/utils/{index.d.ts → exports.d.ts} +83 -20
- package/dist/utils/exports.mjs +2 -0
- package/dist/utils/exports.mjs.map +1 -0
- package/package.json +19 -20
- package/src/abi/{index.ts → exports.ts} +3 -0
- package/src/abi/pol/LSTStakerVault.ts +2032 -0
- package/src/abi/utils/openChainErrors.ts +71 -30
- package/src/abi/utils/thirdwebMinimalAccount.ts +616 -0
- package/src/actions/clients/BeraApolloClient.ts +8 -6
- package/src/actions/dex/__tests__/aggregators.unit.test.ts +2 -5
- package/src/actions/dex/aggregators/base.ts +74 -16
- package/src/actions/dex/aggregators/bex.ts +54 -74
- package/src/actions/dex/aggregators/bgt.ts +31 -8
- package/src/actions/dex/aggregators/{enso.ts → enso/enso.ts} +18 -14
- package/src/actions/dex/aggregators/enso/ensoErc4626.debug.test.ts +37 -0
- package/src/actions/dex/aggregators/enso/ensoErc4626.ts +176 -0
- package/src/actions/dex/aggregators/erc4626.ts +122 -0
- package/src/actions/dex/aggregators/fly.ts +59 -53
- package/src/actions/dex/aggregators/haiku.ts +52 -54
- package/src/actions/dex/aggregators/honey.ts +54 -45
- package/src/actions/dex/aggregators/kyberswap.ts +41 -39
- package/src/actions/dex/aggregators/oogabooga.ts +47 -46
- package/src/actions/dex/aggregators/openOcean.ts +51 -46
- package/src/actions/dex/aggregators/wbera.ts +54 -42
- package/src/actions/dex/b-sdk.ts +5 -2
- package/src/actions/dex/getIsTokenExploited.ts +2 -2
- package/src/actions/enso/{zap.ts → getEnsoSwapBundle.ts} +4 -5
- package/src/actions/enso/getEnsoUserTokensWithBalances.debug.test.ts +73 -0
- package/src/actions/enso/{getEnsoUserToken.ts → getEnsoUserTokensWithBalances.ts} +42 -30
- package/src/actions/enso/util.ts +1 -1
- package/src/actions/{index.ts → exports.ts} +5 -0
- package/src/actions/governance/__tests__/checkProposalField.unit.test.ts +1 -1
- package/src/actions/governance/__tests__/getQuorum.integration.test.ts +1 -1
- package/src/actions/governance/checkProposalField.ts +1 -1
- package/src/actions/governance/computeActualStatus.ts +1 -1
- package/src/actions/governance/getBodyErrors.ts +1 -1
- package/src/actions/governance/getDecodedFunctionData.ts +1 -4
- package/src/actions/governance/getProposalDetails.ts +2 -2
- package/src/actions/governance/getProposalFromTx.ts +1 -2
- package/src/actions/governance/getProposalParams.ts +7 -8
- package/src/actions/governance/getQuorum.ts +1 -2
- package/src/actions/honey/getCollateralWeights.ts +1 -1
- package/src/actions/honey/getHoneyCollaterals.ts +1 -0
- package/src/actions/honey/getHoneyVaultsBalance.ts +51 -55
- package/src/actions/honey/getSwapPayload.ts +37 -35
- package/src/actions/honey/tests/pyth.integration.test.ts +0 -1
- package/src/actions/pol/__tests__/getAllValidators.integration.test.ts +1 -1
- package/src/actions/pol/getEarnedStakedBeraVault.ts +31 -0
- package/src/actions/pol/getGlobalData.ts +14 -13
- package/src/actions/pol/getLSTStakeConfig.ts +67 -0
- package/src/actions/pol/getMarkets.ts +1 -1
- package/src/actions/pol/getRewardProofsByValidator.ts +1 -1
- package/src/actions/pol/getRewardVaultIncentives.ts +3 -5
- package/src/actions/pol/getRewardVaults.ts +2 -3
- package/src/actions/pol/getSWBeraVaultMetadata.ts +7 -5
- package/src/actions/pol/getSWBeraWithdrawal.ts +41 -27
- package/src/actions/pol/getStakeWithdrawalCooldown.ts +5 -7
- package/src/actions/pol/getStakingDailyAssets.ts +24 -0
- package/src/actions/pol/getStakingTokenInformation.ts +3 -4
- package/src/actions/pol/getTotalStakedAmount.ts +47 -0
- package/src/actions/pol/getUserClaimableIncentives.ts +1 -1
- package/src/actions/pol/getUserVaults.ts +8 -6
- package/src/actions/pol/getUserVaultsBalance.ts +4 -16
- package/src/actions/prices/getTokenCurrentPrices.ts +8 -3
- package/src/actions/tokens/getAllowances.ts +68 -41
- package/src/actions/tokens/getTokenInformation.ts +4 -1
- package/src/actions/tokens/getTokens.ts +1 -1
- package/src/actions/tokens/getUnderlyingToken.ts +53 -0
- package/src/actions/tokens/getWalletBalances.integration.test.ts +53 -14
- package/src/actions/tokens/getWalletBalances.ts +69 -43
- package/src/actions/transactions/beraWriteContract.integration.test.ts +18 -6
- package/src/actions/transactions/beraWriteContract.ts +3 -3
- package/src/actions/validators/getUserActiveValidators.ts +2 -3
- package/src/actions/validators/getUserBoostsOnValidator.ts +2 -3
- package/src/contexts/BeraFlags/defaultFlags.ts +4 -0
- package/src/contexts/SwrFallback.tsx +13 -3
- package/src/contexts/TokensProvider.tsx +35 -8
- package/src/contexts/block-time-provider.tsx +1 -1
- package/src/contexts/{index.ts → exports.ts} +0 -1
- package/src/data/contracts.ts +17 -2
- package/src/enum/contracts.ts +13 -0
- package/src/enum/dex.ts +29 -0
- package/src/enum/{index.ts → exports.ts} +3 -0
- package/src/enum/governance.ts +61 -0
- package/src/enum/honey.ts +12 -0
- package/src/enum/txnEnum.ts +1 -0
- package/src/errors/BeraError.ts +61 -13
- package/src/errors/BeraMonitoring.ts +66 -0
- package/src/errors/BeraTracing.ts +79 -0
- package/src/errors/BeraTracing.unit.test.ts +198 -0
- package/src/errors/RequestError.ts +29 -3
- package/src/errors/assert.ts +4 -2
- package/src/errors/assert.unit.test.ts +6 -2
- package/src/errors/errorMap.ts +19 -8
- package/src/errors/{index.ts → exports.ts} +7 -0
- package/src/errors/getErrorMessage.ts +67 -9
- package/src/errors/getRevertReason.integration.test.ts +18 -6
- package/src/errors/getRevertReason.ts +41 -2
- package/src/errors/initBeraError.ts +52 -7
- package/src/errors/parseViemError.ts +114 -27
- package/src/errors/severity.ts +12 -0
- package/src/hooks/bend/useGetConvertToAssets.ts +3 -2
- package/src/hooks/dex/useAggregatorsQuotes.ts +126 -365
- package/src/hooks/dex/useAllUserPools.ts +1 -1
- package/src/hooks/dex/useApiPool.ts +1 -1
- package/src/hooks/dex/useCreatePool.ts +6 -5
- package/src/hooks/dex/useExploitedTokens.ts +1 -1
- package/src/hooks/dex/useLiquidityMismatch.ts +2 -5
- package/src/hooks/dex/useLpPosition.ts +21 -20
- package/src/hooks/dex/useMultipleTokenApprovalsWithSlippage.ts +40 -29
- package/src/hooks/dex/usePollPoolCreationRelayerApproval.ts +1 -1
- package/src/hooks/dex/usePoolEvents.ts +1 -1
- package/src/hooks/dex/usePools.ts +1 -1
- package/src/hooks/dex/usePriceImpact.ts +40 -0
- package/src/hooks/dex/useSingleAggregatorQuote.ts +350 -0
- package/src/hooks/enso/useBendZapSupply.ts +216 -0
- package/src/hooks/enso/useEnsoSwapBundle.ts +107 -0
- package/src/hooks/enso/useEnsoUserTokensWithBalances.ts +43 -0
- package/src/hooks/enso/useZapStakeBera.ts +113 -0
- package/src/hooks/{index.ts → exports.ts} +17 -10
- package/src/hooks/governance/useCreateProposal.ts +8 -8
- package/src/hooks/governance/usePollAllProposals.ts +1 -1
- package/src/hooks/governance/usePollProposal.ts +1 -1
- package/src/hooks/governance/usePollProposalThreshold.ts +1 -1
- package/src/hooks/governance/usePollUserDelegates.ts +1 -1
- package/src/hooks/governance/useProposalState.ts +2 -2
- package/src/hooks/honey/useCappedGlobally.ts +2 -1
- package/src/hooks/honey/useCappedRelatively.ts +1 -1
- package/src/hooks/honey/useCollateralWeights.ts +2 -1
- package/src/hooks/honey/useHoneyAlerts.ts +11 -11
- package/src/hooks/honey/useHoneyBalances.ts +7 -3
- package/src/hooks/honey/useHoneyGlobalData.ts +2 -1
- package/src/hooks/honey/useHoneySwapState.ts +2 -1
- package/src/hooks/honey/useHoneyVaultsBalance.ts +1 -1
- package/src/hooks/honey/useIsBadCollateralAsset.ts +2 -1
- package/src/hooks/honey/useIsBasketModeEnabled.ts +1 -1
- package/src/hooks/honey/usePythLatestPrices.ts +1 -1
- package/src/hooks/pol/useOnChainRewardVault.ts +3 -2
- package/src/hooks/pol/usePollGlobalData.ts +1 -1
- package/src/hooks/pol/usePollMarkets.ts +1 -1
- package/src/hooks/pol/useQueuedBeraUnlock.ts +17 -15
- package/src/hooks/pol/useRewardTokenToBeraRate.ts +6 -3
- package/src/hooks/pol/useRewardVault.ts +1 -1
- package/src/hooks/pol/useRewardVaults.ts +1 -1
- package/src/hooks/pol/useSWBeraVaultMetadata.ts +35 -0
- package/src/hooks/pol/useStakedAPR.ts +38 -0
- package/src/hooks/pol/useStakedData.ts +117 -0
- package/src/hooks/pol/useStakedSnapshots.ts +52 -0
- package/src/hooks/pol/useTotalStakedAmount.ts +30 -0
- package/src/hooks/pol/useUserVaultInfo.ts +1 -1
- package/src/hooks/pol/useVaultValidators.ts +1 -1
- package/src/hooks/tokens/useMultipleTokenInformation.ts +15 -6
- package/src/hooks/tokens/usePollAllowances.ts +15 -19
- package/src/hooks/tokens/usePollBalance.ts +8 -4
- package/src/hooks/tokens/usePollWalletBalances.ts +14 -11
- package/src/hooks/tokens/useStakingTokenInformation.ts +2 -1
- package/src/hooks/tokens/useTokenCurrentPrice.ts +4 -2
- package/src/hooks/tokens/useTokenCurrentPrices.ts +92 -13
- package/src/hooks/tokens/useTokenInformation.ts +11 -6
- package/src/hooks/tokens/useTokenPrice.ts +21 -0
- package/src/hooks/tokens/useTokenPrices.ts +133 -0
- package/src/hooks/tokens/useTokens.ts +1 -0
- package/src/hooks/tokens/useUnderlyingAsset.ts +23 -0
- package/src/hooks/useContractWrite/useBeraContractWrite.ts +2 -1
- package/src/hooks/validators/useAllValidators.ts +1 -1
- package/src/hooks/validators/useApiValidator.ts +1 -1
- package/src/hooks/validators/useDailyValidatorBlockStats.ts +1 -1
- package/src/hooks/validators/useManagedValidatorByAccount.ts +1 -1
- package/src/hooks/validators/useManagedValidatorRole.ts +1 -1
- package/src/hooks/validators/useOnChainValidator.ts +1 -1
- package/src/hooks/validators/useStakingPoolBatch.ts +1 -1
- package/src/hooks/validators/useUserActiveValidators.ts +1 -1
- package/src/hooks/validators/useUserBoostsOnValidator.ts +1 -1
- package/src/hooks/validators/useUserClaimableIncentives.ts +8 -8
- package/src/hooks/validators/useValidator.ts +1 -1
- package/src/hooks/validators/useValidatorAnalytics.ts +1 -1
- package/src/hooks/validators/useValidatorCommission.ts +1 -1
- package/src/hooks/validators/useValidatorQueuedCommission.ts +1 -1
- package/src/hooks/validators/useValidatorQueuedOperatorAddress.ts +1 -1
- package/src/hooks/validators/useValidatorQueuedRewardAllocation.ts +1 -1
- package/src/hooks/validators/useValidatorRewardAllocation.ts +1 -1
- package/src/types/{dex.ts → dex.d.ts} +96 -67
- package/src/types/{enso.ts → enso.d.ts} +1 -1
- package/src/types/exports.ts +8 -0
- package/src/types/{global.ts → global.d.ts} +1 -30
- package/src/types/{governance.ts → governance.d.ts} +2 -64
- package/src/types/{honeySwap.ts → honeySwap.d.ts} +1 -13
- package/src/types/{pol.ts → pol.d.ts} +12 -1
- package/src/types/staking.d.ts +22 -0
- package/src/utils/createEmitter.ts +122 -0
- package/src/utils/createEmitter.unit.test.ts +149 -0
- package/src/utils/{index.ts → exports.ts} +3 -2
- package/src/utils/filter.ts +34 -0
- package/src/utils/formatNumber.ts +1 -1
- package/src/utils/formatNumber.unit.test.ts +2 -1
- package/src/utils/formatTokenList.ts +4 -10
- package/src/utils/getHoneySwapMessage.test.ts +1 -2
- package/src/utils/getServerSideClient.ts +4 -5
- package/src/utils/isDifferenceExceedingThreshold.ts +1 -1
- package/src/utils/layerZeroScan.ts +122 -0
- package/src/utils/math.ts +1 -1
- package/src/utils/parseWhiskToken.ts +15 -0
- package/src/utils/poolNamings.ts +1 -1
- package/src/utils/tokens.ts +23 -7
- package/dist/HoneyConfigProvider-6PXZJMSU.d.cts +0 -562
- package/dist/HoneyConfigProvider-CwDFrt02.d.ts +0 -562
- package/dist/abi/index.cjs +0 -2
- package/dist/abi/index.cjs.map +0 -1
- package/dist/abi/index.mjs +0 -2
- package/dist/actions/index.cjs +0 -2
- package/dist/actions/index.cjs.map +0 -1
- package/dist/actions/index.mjs +0 -2
- package/dist/aggregatorsRouter-Cny4B_MB.d.cts +0 -593
- package/dist/aggregatorsRouter-Cny4B_MB.d.ts +0 -593
- package/dist/chunk-22MQVFHP.cjs +0 -2
- package/dist/chunk-22MQVFHP.cjs.map +0 -1
- package/dist/chunk-3TKSVFZ3.mjs +0 -2
- package/dist/chunk-3TKSVFZ3.mjs.map +0 -1
- package/dist/chunk-6VF3RF53.cjs +0 -3
- package/dist/chunk-6VF3RF53.cjs.map +0 -1
- package/dist/chunk-6W22TFYA.mjs +0 -2
- package/dist/chunk-6W22TFYA.mjs.map +0 -1
- package/dist/chunk-AMRJ4B36.mjs +0 -2
- package/dist/chunk-AMRJ4B36.mjs.map +0 -1
- package/dist/chunk-DS2ZDVKU.mjs +0 -2
- package/dist/chunk-DS2ZDVKU.mjs.map +0 -1
- package/dist/chunk-ED43NYSE.cjs +0 -2
- package/dist/chunk-ED43NYSE.cjs.map +0 -1
- package/dist/chunk-EU4WFADK.cjs +0 -2
- package/dist/chunk-EU4WFADK.cjs.map +0 -1
- package/dist/chunk-HCTFDGXL.mjs +0 -2
- package/dist/chunk-HCTFDGXL.mjs.map +0 -1
- package/dist/chunk-IOSYBHKU.mjs +0 -2
- package/dist/chunk-IOSYBHKU.mjs.map +0 -1
- package/dist/chunk-JMKLDDKY.cjs +0 -2
- package/dist/chunk-JMKLDDKY.cjs.map +0 -1
- package/dist/chunk-KMKUXP2S.mjs +0 -3
- package/dist/chunk-KMKUXP2S.mjs.map +0 -1
- package/dist/chunk-OJXJ6CZ4.mjs +0 -4
- package/dist/chunk-OJXJ6CZ4.mjs.map +0 -1
- package/dist/chunk-PHIOKO3A.mjs +0 -2
- package/dist/chunk-PHIOKO3A.mjs.map +0 -1
- package/dist/chunk-QCK474XD.cjs +0 -2
- package/dist/chunk-QCK474XD.cjs.map +0 -1
- package/dist/chunk-REDXXUK7.cjs +0 -2
- package/dist/chunk-REDXXUK7.cjs.map +0 -1
- package/dist/chunk-S74ZMG2G.cjs +0 -2
- package/dist/chunk-S74ZMG2G.cjs.map +0 -1
- package/dist/chunk-TOAXF4YW.cjs +0 -2
- package/dist/chunk-TOAXF4YW.cjs.map +0 -1
- package/dist/chunk-UZ5CB33M.cjs +0 -2
- package/dist/chunk-UZ5CB33M.cjs.map +0 -1
- package/dist/chunk-VYWYJR63.mjs +0 -2
- package/dist/chunk-VYWYJR63.mjs.map +0 -1
- package/dist/chunk-XFPTQMAK.cjs +0 -4
- package/dist/chunk-XFPTQMAK.cjs.map +0 -1
- package/dist/chunk-YK4NINF5.mjs +0 -2
- package/dist/chunk-YK4NINF5.mjs.map +0 -1
- package/dist/contexts/index.cjs +0 -2
- package/dist/contexts/index.cjs.map +0 -1
- package/dist/contexts/index.mjs +0 -2
- package/dist/contexts/index.mjs.map +0 -1
- package/dist/enum/index.cjs +0 -2
- package/dist/enum/index.cjs.map +0 -1
- package/dist/enum/index.d.cts +0 -31
- package/dist/enum/index.d.ts +0 -31
- package/dist/enum/index.mjs +0 -2
- package/dist/enum/index.mjs.map +0 -1
- package/dist/errors/index.cjs +0 -2
- package/dist/errors/index.cjs.map +0 -1
- package/dist/errors/index.d.cts +0 -204
- package/dist/errors/index.d.ts +0 -204
- package/dist/errors/index.mjs +0 -2
- package/dist/errors/index.mjs.map +0 -1
- package/dist/hooks/index.cjs +0 -4
- package/dist/hooks/index.cjs.map +0 -1
- package/dist/hooks/index.mjs +0 -4
- package/dist/hooks/index.mjs.map +0 -1
- package/dist/staking-F9Nx9TKD.d.ts +0 -246
- package/dist/staking-f4BpYH7l.d.cts +0 -246
- package/dist/types/index.cjs +0 -2
- package/dist/types/index.cjs.map +0 -1
- package/dist/types/index.d.cts +0 -56
- package/dist/types/index.d.ts +0 -56
- package/dist/types/index.mjs +0 -2
- package/dist/types/index.mjs.map +0 -1
- package/dist/utils/index.cjs +0 -2
- package/dist/utils/index.cjs.map +0 -1
- package/dist/utils/index.mjs +0 -2
- package/dist/utils/index.mjs.map +0 -1
- package/src/actions/dex/getTransactionCount.ts +0 -29
- package/src/actions/enso/bend.ts +0 -143
- package/src/actions/enso/getEnsoUserToken.debug.test.ts +0 -57
- package/src/contexts/berajsProvider/context.tsx +0 -49
- package/src/contexts/berajsProvider/index.ts +0 -2
- package/src/contexts/berajsProvider/useBeraJs.ts +0 -18
- package/src/hooks/dex/usePollVaultIsPaused.ts +0 -30
- package/src/hooks/enso/useBendTransactionRequests.ts +0 -247
- package/src/hooks/enso/useEnsoZap.ts +0 -166
- package/src/hooks/enso/useZapTransactionRequests.ts +0 -81
- package/src/hooks/pol/useEarnedStakedBeraVault.ts +0 -59
- package/src/hooks/pol/useStakedBeraSnapshots.ts +0 -27
- package/src/hooks/transactions/TransactionStoreContext.tsx +0 -59
- package/src/hooks/transactions/transactionStore.ts +0 -275
- package/src/hooks/transactions/transactionStore.unit.test.ts +0 -508
- package/src/hooks/transactions/useAddRecentTransaction.ts +0 -29
- package/src/hooks/transactions/useRecentTransactions.ts +0 -27
- package/src/hooks/validators/validatorRoleManager.ts +0 -0
- package/src/types/index.ts +0 -8
- package/src/types/staking.ts +0 -7
- package/src/utils/formatAggregatorsQuotes.ts +0 -57
- package/src/utils/formatAggregatorsQuotes.unit.test.ts +0 -191
- package/src/utils/sentryBeforeSend.ts +0 -52
- /package/dist/{abi/index.mjs.map → errors/exports.mjs.map} +0 -0
- /package/dist/{actions/index.mjs.map → types/exports.mjs.map} +0 -0
- /package/src/actions/dex/{__tests__ → aggregators}/haiku.integration.test.ts +0 -0
- /package/src/types/{bribe-boost.ts → bribe-boost.d.ts} +0 -0
|
@@ -2,7 +2,7 @@ import useSWRImmutable from "swr/immutable";
|
|
|
2
2
|
import type { Address } from "viem";
|
|
3
3
|
|
|
4
4
|
import { getManagedValidatorByAccount } from "~/actions/validators/getManagedValidatorByAccount";
|
|
5
|
-
import type { DefaultHookOptions } from "~/types";
|
|
5
|
+
import type { DefaultHookOptions } from "~/types/global";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Return the validators managed by the account
|
|
@@ -8,7 +8,7 @@ import { getValidatorOperatorAddress } from "~/actions/validators/getValidatorOp
|
|
|
8
8
|
import { getValidatorRewardAllocatorAddress } from "~/actions/validators/getValidatorRewardAllocatorAddress";
|
|
9
9
|
import { useBeraFlag } from "~/contexts/BeraFlags/BeraFlags";
|
|
10
10
|
import { assertPublicClient } from "~/errors/assert";
|
|
11
|
-
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types";
|
|
11
|
+
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types/global";
|
|
12
12
|
|
|
13
13
|
export type ManagedValidatorRole = {
|
|
14
14
|
operator: Address | null;
|
|
@@ -8,7 +8,7 @@ import { beaconDepositAbi } from "~/abi/pol/beaconDeposit";
|
|
|
8
8
|
import { beraChefAbi } from "~/abi/pol/beraChef";
|
|
9
9
|
import { bgtAbi } from "~/abi/pol/bgt";
|
|
10
10
|
import { assertPublicClient } from "~/errors/assert";
|
|
11
|
-
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types";
|
|
11
|
+
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types/global";
|
|
12
12
|
import { parseBaseArgs } from "~/utils/parseBaseArgs";
|
|
13
13
|
|
|
14
14
|
export const useOnChainValidator = (
|
|
@@ -6,7 +6,7 @@ import { usePublicClient } from "@berachain/wagmi/hooks";
|
|
|
6
6
|
import { getStakingPoolBatch } from "~/actions/validators/getStakingPoolBatch";
|
|
7
7
|
import { POLLING } from "~/enum/polling";
|
|
8
8
|
import { assertPublicClient } from "~/errors/assert";
|
|
9
|
-
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types";
|
|
9
|
+
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types/global";
|
|
10
10
|
|
|
11
11
|
export const useStakingPoolBatch = ({
|
|
12
12
|
valPubKey,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import { POLLING } from "~/enum/polling";
|
|
10
10
|
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types/global";
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
interface UseUserActiveValidatorsResponse
|
|
13
13
|
extends DefaultHookReturnType<ValidatorWithUserBoost[] | undefined> {}
|
|
14
14
|
|
|
15
15
|
export const useUserActiveValidators = (
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
type UserBoostsOnValidator,
|
|
9
9
|
} from "~/actions/validators/getUserBoostsOnValidator";
|
|
10
10
|
import { POLLING } from "~/enum/polling";
|
|
11
|
-
import type { DefaultHookReturnType } from "~/types";
|
|
11
|
+
import type { DefaultHookReturnType } from "~/types/global";
|
|
12
12
|
|
|
13
13
|
export const useUserBoostsOnValidator = ({
|
|
14
14
|
pubkey,
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { useCallback, useMemo } from "react";
|
|
2
|
-
import * as Sentry from "@sentry/nextjs";
|
|
3
2
|
import useSWR from "swr";
|
|
4
3
|
|
|
5
4
|
import { useBeraWallet } from "@berachain/wagmi/hooks";
|
|
6
5
|
|
|
7
6
|
import { getRewardProofsByValidator } from "~/actions/pol/getRewardProofsByValidator";
|
|
8
7
|
import { getUserClaimableIncentives } from "~/actions/pol/getUserClaimableIncentives";
|
|
9
|
-
import { POLLING } from "~/enum";
|
|
8
|
+
import { POLLING } from "~/enum/polling";
|
|
10
9
|
import { BeraError } from "~/errors/BeraError";
|
|
10
|
+
import { BeraMonitoring } from "~/errors/BeraMonitoring";
|
|
11
11
|
import { InvalidArgumentError } from "~/errors/InvalidArgumentError";
|
|
12
|
-
import type { BribeBoostRewardProof
|
|
12
|
+
import type { BribeBoostRewardProof } from "~/types/bribe-boost";
|
|
13
|
+
import type { DefaultHookReturnType } from "~/types/global";
|
|
13
14
|
import { formatIncentivesTokenMap } from "~/utils/formatIncentivesTokenMap";
|
|
14
|
-
|
|
15
|
+
|
|
16
|
+
interface UseUserClaimableIncentivesReturnType
|
|
15
17
|
extends DefaultHookReturnType<BribeBoostRewardProof[]> {
|
|
16
18
|
tokenMap?: Set<string> | undefined;
|
|
17
19
|
}
|
|
@@ -56,17 +58,15 @@ export const useUserClaimableIncentives =
|
|
|
56
58
|
|
|
57
59
|
// If the data is not an array, capture an error
|
|
58
60
|
if (!Array.isArray(allRewards)) {
|
|
59
|
-
|
|
61
|
+
BeraMonitoring.captureException(
|
|
60
62
|
new BeraError({
|
|
61
63
|
message: "Incorrect aggregated incentives data receieved.",
|
|
62
64
|
level: "error",
|
|
63
|
-
}),
|
|
64
|
-
{
|
|
65
65
|
extra: {
|
|
66
66
|
allRewards,
|
|
67
67
|
account: account,
|
|
68
68
|
},
|
|
69
|
-
},
|
|
69
|
+
}),
|
|
70
70
|
);
|
|
71
71
|
return undefined;
|
|
72
72
|
}
|
|
@@ -3,7 +3,7 @@ import { type Address, keccak256 } from "viem";
|
|
|
3
3
|
import type { GqlValidatorDynamicData } from "@berachain/graphql/dex/api";
|
|
4
4
|
import type { ApiValidatorFragment } from "@berachain/graphql/pol/api";
|
|
5
5
|
|
|
6
|
-
import type { DefaultHookOptions } from "~/types";
|
|
6
|
+
import type { DefaultHookOptions } from "~/types/global";
|
|
7
7
|
import { useApiValidator } from "./useApiValidator";
|
|
8
8
|
import { useOnChainValidator } from "./useOnChainValidator";
|
|
9
9
|
|
|
@@ -5,7 +5,7 @@ import type { GetValidatorAnalyticsQuery } from "@berachain/graphql/pol/subgraph
|
|
|
5
5
|
|
|
6
6
|
import { getValidatorAnalytics } from "~/actions/validators/getValidatorAnalytics";
|
|
7
7
|
import { POLLING } from "~/enum/polling";
|
|
8
|
-
import type { DefaultHookReturnType } from "~/types";
|
|
8
|
+
import type { DefaultHookReturnType } from "~/types/global";
|
|
9
9
|
|
|
10
10
|
export function useValidatorAnalytics({
|
|
11
11
|
pubkey,
|
|
@@ -4,7 +4,7 @@ import type { Address, PublicClient } from "viem";
|
|
|
4
4
|
import { usePublicClient } from "@berachain/wagmi/hooks";
|
|
5
5
|
|
|
6
6
|
import { getValidatorCommission } from "~/actions/validators/getValidatorCommission";
|
|
7
|
-
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types";
|
|
7
|
+
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types/global";
|
|
8
8
|
|
|
9
9
|
export const useValidatorCommission = (
|
|
10
10
|
pubKey: Address,
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
type ValidatorQueuedCommission,
|
|
9
9
|
} from "~/actions/validators/getValidatorQueuedCommission";
|
|
10
10
|
import { assertPublicClient } from "~/errors/assert";
|
|
11
|
-
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types";
|
|
11
|
+
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types/global";
|
|
12
12
|
|
|
13
13
|
export function useValidatorQueuedCommission(
|
|
14
14
|
pubKey: Address,
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
getValidatorQueuedOperatorAddress,
|
|
8
8
|
type ValidatorQueuedOperatorAddress,
|
|
9
9
|
} from "~/actions/validators/getValidatorQueuedOperatorAddress";
|
|
10
|
-
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types";
|
|
10
|
+
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types/global";
|
|
11
11
|
|
|
12
12
|
export const useValidatorQueuedOperatorAddress = (
|
|
13
13
|
pubKey: Address,
|
|
@@ -5,7 +5,7 @@ import { usePublicClient } from "@berachain/wagmi/hooks";
|
|
|
5
5
|
|
|
6
6
|
import { getValidatorQueuedRewardAllocation } from "~/actions/validators/getValidatorQueuedRewardAllocation";
|
|
7
7
|
import type { ValidatorRewardAllocation } from "~/actions/validators/getValidatorRewardAllocation";
|
|
8
|
-
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types";
|
|
8
|
+
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types/global";
|
|
9
9
|
|
|
10
10
|
export const useValidatorQueuedRewardAllocation = (
|
|
11
11
|
pubKey: Address,
|
|
@@ -4,7 +4,7 @@ import type { Address, PublicClient } from "viem";
|
|
|
4
4
|
import { usePublicClient } from "@berachain/wagmi/hooks";
|
|
5
5
|
|
|
6
6
|
import { getValidatorRewardAllocation } from "~/actions/validators/getValidatorRewardAllocation";
|
|
7
|
-
import type { DefaultHookOptions } from "~/types";
|
|
7
|
+
import type { DefaultHookOptions } from "~/types/global";
|
|
8
8
|
|
|
9
9
|
export function useValidatorRewardAllocation(
|
|
10
10
|
pubKey: Address,
|
|
@@ -1,29 +1,23 @@
|
|
|
1
1
|
import type { SwapKind } from "@berachain-foundation/berancer-sdk";
|
|
2
|
-
import type { Abi, Address, PublicClient } from "viem";
|
|
2
|
+
import type { Abi, Address, Hex, PublicClient } from "viem";
|
|
3
3
|
|
|
4
|
-
import type { aggregatorsRouterAbi } from "~/abi/bex/aggregatorsRouter";
|
|
5
4
|
import type { HoneyConfigContextReturn } from "~/contexts/HoneyConfigProvider";
|
|
6
|
-
import type { IContractWrite, TokenBalance } from "./global";
|
|
7
5
|
|
|
8
6
|
export type MinimalERC20 = {
|
|
9
7
|
address: Address;
|
|
10
8
|
decimals: number;
|
|
11
9
|
symbol: string;
|
|
12
10
|
name: string;
|
|
11
|
+
chainId: number;
|
|
13
12
|
};
|
|
14
13
|
|
|
15
14
|
export type TokenWithMetadata = MinimalERC20 & {
|
|
16
15
|
tags?: string[];
|
|
17
16
|
base64?: string;
|
|
18
17
|
logoURI?: string;
|
|
19
|
-
chainId?: number;
|
|
20
18
|
};
|
|
21
19
|
|
|
22
20
|
export type Token = TokenWithMetadata & {
|
|
23
|
-
/**
|
|
24
|
-
* @deprecated
|
|
25
|
-
*/
|
|
26
|
-
default?: boolean;
|
|
27
21
|
totalSupply?: string;
|
|
28
22
|
weight?: number | string | null;
|
|
29
23
|
};
|
|
@@ -31,6 +25,7 @@ export type Token = TokenWithMetadata & {
|
|
|
31
25
|
export interface TokenPriceInfo {
|
|
32
26
|
price: number;
|
|
33
27
|
updatedAt: number;
|
|
28
|
+
chainId: number;
|
|
34
29
|
}
|
|
35
30
|
|
|
36
31
|
export type TokenCurrentPriceMap = Record<
|
|
@@ -40,19 +35,39 @@ export type TokenCurrentPriceMap = Record<
|
|
|
40
35
|
|
|
41
36
|
export interface TokenWithAmount extends Token {
|
|
42
37
|
amount: string;
|
|
38
|
+
exceeding?: boolean;
|
|
43
39
|
}
|
|
44
40
|
|
|
45
|
-
export interface
|
|
46
|
-
|
|
47
|
-
formattedBalance: string;
|
|
48
|
-
price?: number;
|
|
41
|
+
export interface TokenWithPrice extends Token {
|
|
42
|
+
price: number;
|
|
49
43
|
}
|
|
50
44
|
|
|
51
|
-
export
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
45
|
+
export interface BalanceToken extends Token {
|
|
46
|
+
balance: {
|
|
47
|
+
/**
|
|
48
|
+
* This is the string representation of the balance in wei.
|
|
49
|
+
*
|
|
50
|
+
* It can be safely parsed to a bigint, but we're returning it as a string to avoid serialization issues.
|
|
51
|
+
*
|
|
52
|
+
* @example "1200000000000000000"
|
|
53
|
+
*/
|
|
54
|
+
raw: string;
|
|
55
|
+
/**
|
|
56
|
+
* This is the formatted representation of the balance in the token's decimals.
|
|
57
|
+
*
|
|
58
|
+
* @example "1.2"
|
|
59
|
+
*/
|
|
60
|
+
formatted: string;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Price of the token in USD.
|
|
64
|
+
*/
|
|
65
|
+
price?: number;
|
|
66
|
+
/**
|
|
67
|
+
* Balance value in USD.
|
|
68
|
+
* Calculated as balance * price.
|
|
69
|
+
*/
|
|
70
|
+
usdValue?: number;
|
|
56
71
|
}
|
|
57
72
|
|
|
58
73
|
export interface SwapRequest {
|
|
@@ -65,25 +80,48 @@ export interface SwapRequest {
|
|
|
65
80
|
swapKind: SwapKind;
|
|
66
81
|
}
|
|
67
82
|
|
|
83
|
+
/**
|
|
84
|
+
* Object with properties to check the allowance of a token.
|
|
85
|
+
*/
|
|
86
|
+
export interface AllowanceQueryItem {
|
|
87
|
+
token: MinimalERC20;
|
|
88
|
+
/**
|
|
89
|
+
* The amount of the token to approve.
|
|
90
|
+
*/
|
|
91
|
+
amount: {
|
|
92
|
+
raw: string;
|
|
93
|
+
formatted: string;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* The address to approve the tokens to.
|
|
97
|
+
*/
|
|
98
|
+
spender: Address;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface AllowanceToken extends AllowanceQueryItem {
|
|
102
|
+
/**
|
|
103
|
+
* The current allowance of the token.
|
|
104
|
+
*/
|
|
105
|
+
allowance: {
|
|
106
|
+
raw: string;
|
|
107
|
+
formatted: string;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Whether the allowance is needed to perform the transaction.
|
|
111
|
+
*/
|
|
112
|
+
needsApproval: boolean;
|
|
113
|
+
}
|
|
114
|
+
|
|
68
115
|
export interface IUserPosition {
|
|
69
|
-
lpBalance?:
|
|
70
|
-
tokenBalances?:
|
|
116
|
+
lpBalance?: BalanceToken;
|
|
117
|
+
tokenBalances?: Omit<BalanceToken, "chainId">[];
|
|
71
118
|
userSharePercentage?: number;
|
|
72
|
-
stakedBalance?:
|
|
119
|
+
stakedBalance?: Pick<BalanceToken, "address" | "balance" | "usdValue">;
|
|
73
120
|
/**
|
|
74
121
|
* Just a utility to detect if there is a price for the LP token.
|
|
75
122
|
*/
|
|
76
123
|
lpTokenPrice?: number;
|
|
77
124
|
}
|
|
78
|
-
|
|
79
|
-
export enum PoolCreationStep {
|
|
80
|
-
POOL_TYPE = "Pool Type",
|
|
81
|
-
SELECT_TOKENS = "Select Tokens",
|
|
82
|
-
DEPOSIT_LIQUIDITY = "Deposit Liquidity",
|
|
83
|
-
SET_PARAMETERS = "Set Parameters",
|
|
84
|
-
SET_INFO = "Set Info",
|
|
85
|
-
}
|
|
86
|
-
|
|
87
125
|
export type BexStatus = {
|
|
88
126
|
protocol: {
|
|
89
127
|
/**
|
|
@@ -120,10 +158,11 @@ export type BexStatus = {
|
|
|
120
158
|
};
|
|
121
159
|
|
|
122
160
|
export type IAggregatorArgs = {
|
|
123
|
-
tokenIn:
|
|
124
|
-
tokenOut:
|
|
125
|
-
|
|
126
|
-
|
|
161
|
+
tokenIn: MinimalERC20;
|
|
162
|
+
tokenOut: MinimalERC20;
|
|
163
|
+
/**
|
|
164
|
+
* Amount of tokenIn to swap in wei.
|
|
165
|
+
*/
|
|
127
166
|
amount: string;
|
|
128
167
|
slippage: number;
|
|
129
168
|
account?: Address;
|
|
@@ -131,55 +170,50 @@ export type IAggregatorArgs = {
|
|
|
131
170
|
aggregatorsFeeBps?: number;
|
|
132
171
|
proxyAggregatorsThroughVercel?: boolean;
|
|
133
172
|
referrer?: SwapReferrer;
|
|
173
|
+
/**
|
|
174
|
+
* If provided, the aggregator will swap to the underlying token and deposit it into the vault (tokenOut).
|
|
175
|
+
*
|
|
176
|
+
* The aggregator won't check if the tokenOut is an ERC4626 vault, so this needs to be asserted by the caller.
|
|
177
|
+
* This is used for Staked BERA/iBera and Bend Vaults.
|
|
178
|
+
*/
|
|
179
|
+
underlyingToken?: MinimalERC20 | null;
|
|
134
180
|
/**
|
|
135
181
|
* If provided, the aggregator will stake into the reward vault after the swap.
|
|
136
182
|
*/
|
|
137
183
|
rewardVault?: Address;
|
|
184
|
+
/**
|
|
185
|
+
* Only needed by the honey mint/redeem aggregator.
|
|
186
|
+
*/
|
|
138
187
|
honeyNativeState?: Pick<HoneyConfigContextReturn, "collateralList">;
|
|
139
188
|
};
|
|
140
189
|
|
|
141
|
-
export
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
Enso = "Enso",
|
|
151
|
-
RedeemBgt = "RedeemBgt",
|
|
152
|
-
Honey = "Honey",
|
|
153
|
-
}
|
|
190
|
+
export type Calldata = {
|
|
191
|
+
params?: readonly unknown[] | undefined;
|
|
192
|
+
functionName?: string;
|
|
193
|
+
abi?: Abi;
|
|
194
|
+
address: Address;
|
|
195
|
+
data?: Hex;
|
|
196
|
+
value: bigint;
|
|
197
|
+
gasLimit?: bigint;
|
|
198
|
+
};
|
|
154
199
|
|
|
155
|
-
export type IRawAggregatorQuote
|
|
200
|
+
export type IRawAggregatorQuote = {
|
|
156
201
|
amountOut: string;
|
|
157
202
|
amountIn: string;
|
|
158
203
|
name: Aggregators;
|
|
159
|
-
|
|
204
|
+
allowanceRequirements: AllowanceQueryItem[];
|
|
160
205
|
/**
|
|
161
206
|
* True if it's bera wrap/unwrap or bgt redeem.
|
|
162
207
|
*/
|
|
163
208
|
isNativeSwap?: boolean;
|
|
164
|
-
priceImpactPercentage?: number;
|
|
209
|
+
priceImpactPercentage?: number | null;
|
|
165
210
|
swapFeeBps: number;
|
|
166
|
-
|
|
167
|
-
? Omit<
|
|
168
|
-
IContractWrite<typeof aggregatorsRouterAbi, "swap">,
|
|
169
|
-
"message" | "actionType"
|
|
170
|
-
>
|
|
171
|
-
: {
|
|
172
|
-
params: readonly unknown[] | undefined;
|
|
173
|
-
functionName: string;
|
|
174
|
-
abi: Abi;
|
|
175
|
-
address: Address;
|
|
176
|
-
value?: bigint;
|
|
177
|
-
};
|
|
211
|
+
getCalldata?: ({ account }: { account: Address }) => Calldata;
|
|
178
212
|
};
|
|
179
213
|
|
|
180
214
|
export type IAggregatorQuote =
|
|
181
215
|
// no need to force to swapAndStake as type check is done on each getQuote
|
|
182
|
-
IRawAggregatorQuote
|
|
216
|
+
IRawAggregatorQuote & {
|
|
183
217
|
amountOut: string;
|
|
184
218
|
amountOutUsd: string;
|
|
185
219
|
amountIn: string;
|
|
@@ -189,8 +223,3 @@ export type IAggregatorQuote =
|
|
|
189
223
|
relativeLossPercentage: number;
|
|
190
224
|
isBest?: boolean;
|
|
191
225
|
};
|
|
192
|
-
|
|
193
|
-
export enum SwapReferrer {
|
|
194
|
-
SWAP = "SWAP",
|
|
195
|
-
ZAP = "ZAP",
|
|
196
|
-
}
|
|
@@ -13,12 +13,12 @@ import type {
|
|
|
13
13
|
|
|
14
14
|
import type { BeraConfig, ChainId } from "@berachain/config";
|
|
15
15
|
|
|
16
|
+
import type { ContractName } from "~/enum/contracts";
|
|
16
17
|
import type { TransactionActionType } from "~/enum/txnEnum";
|
|
17
18
|
import type {
|
|
18
19
|
IUseContractWriteArgs,
|
|
19
20
|
TxnEventKeys,
|
|
20
21
|
} from "~/hooks/useContractWrite/types";
|
|
21
|
-
import type { Token } from "./dex";
|
|
22
22
|
|
|
23
23
|
export type DefaultHookOptions = {
|
|
24
24
|
opts?: SWRConfiguration & { isEnabled?: boolean };
|
|
@@ -31,24 +31,6 @@ export type DefaultHookReturnType<T = any> = Omit<
|
|
|
31
31
|
refresh: () => void;
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
export interface TokenBalance {
|
|
35
|
-
address: Address;
|
|
36
|
-
/**
|
|
37
|
-
* Balance in wei, should be string to be serializable in JSON
|
|
38
|
-
*/
|
|
39
|
-
balance: bigint | string;
|
|
40
|
-
formattedBalance: string;
|
|
41
|
-
/**
|
|
42
|
-
* Balance in USD
|
|
43
|
-
*/
|
|
44
|
-
usdValue?: number;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface AllowanceToken extends Token {
|
|
48
|
-
allowance: bigint;
|
|
49
|
-
formattedAllowance: string;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
34
|
export type IContractWriteFn = <
|
|
53
35
|
abi extends Abi | undefined = undefined,
|
|
54
36
|
functionName extends abi extends Abi
|
|
@@ -84,17 +66,6 @@ type EventData = Record<
|
|
|
84
66
|
>
|
|
85
67
|
>;
|
|
86
68
|
|
|
87
|
-
/**
|
|
88
|
-
* A list of contract names that are not mapped in the devrel's contract mapping or that are generated by factories (e.g. RewardVault).
|
|
89
|
-
*/
|
|
90
|
-
export enum ContractName {
|
|
91
|
-
ENSO_ROUTER = "enso.router",
|
|
92
|
-
POL_REWARD_VAULT = "pol.rewardVault",
|
|
93
|
-
BEX_POOL = "bex.pool",
|
|
94
|
-
ERC20 = "others.erc20",
|
|
95
|
-
BEX_EXPLOITED_FUND_DISTRIBUTOR = "bex.exploitedFundDistributor",
|
|
96
|
-
}
|
|
97
|
-
|
|
98
69
|
export type IContractWrite<
|
|
99
70
|
abi extends Abi | undefined = undefined,
|
|
100
71
|
functionName extends abi extends Abi
|
|
@@ -5,57 +5,20 @@ import type {
|
|
|
5
5
|
ProposalWithVotesFragment,
|
|
6
6
|
} from "@berachain/graphql/governance";
|
|
7
7
|
|
|
8
|
+
import type { ProposalErrorCodes, ProposalTypeEnum } from "~/enum/governance";
|
|
9
|
+
|
|
8
10
|
export type Proposal = ProposalWithVotesFragment;
|
|
9
11
|
|
|
10
12
|
export type Vote = ProposalVoteFragment;
|
|
11
13
|
|
|
12
14
|
export type Voter = Address;
|
|
13
15
|
|
|
14
|
-
/**
|
|
15
|
-
* Maps the proposal state from the governor contract to a more human-readable format.
|
|
16
|
-
* Don't edit this enum manually, it's synced with the governor contract.
|
|
17
|
-
*
|
|
18
|
-
* @see https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/governance/IGovernor.sol
|
|
19
|
-
*/
|
|
20
|
-
export enum ProposalState {
|
|
21
|
-
Pending = 0,
|
|
22
|
-
Active = 1,
|
|
23
|
-
Canceled = 2,
|
|
24
|
-
Defeated = 3,
|
|
25
|
-
Succeeded = 4,
|
|
26
|
-
Queued = 5,
|
|
27
|
-
Expired = 6,
|
|
28
|
-
Executed = 7,
|
|
29
|
-
}
|
|
30
|
-
|
|
31
16
|
export type ProposalVotes = {
|
|
32
17
|
yes: number;
|
|
33
18
|
no: number;
|
|
34
19
|
abstain: number;
|
|
35
20
|
};
|
|
36
21
|
|
|
37
|
-
export const VoteColorMap = {
|
|
38
|
-
yes: "#059669",
|
|
39
|
-
1: "#059669",
|
|
40
|
-
no: "#DC2629",
|
|
41
|
-
2: "#DC2629",
|
|
42
|
-
veto: "#0284C7",
|
|
43
|
-
4: "#0284C7",
|
|
44
|
-
abstain: "#78716c",
|
|
45
|
-
3: "#78716c",
|
|
46
|
-
yes_secondary: "#ECFDF5",
|
|
47
|
-
no_secondary: "#FEF2F2",
|
|
48
|
-
veto_secondary: "#F0F9FF",
|
|
49
|
-
abstain_secondary: "#E7E5E4",
|
|
50
|
-
default: "#57534e",
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export enum VoteEnum {
|
|
54
|
-
AGAINST = "no",
|
|
55
|
-
FOR = "yes",
|
|
56
|
-
ABSTAIN = "abstain",
|
|
57
|
-
}
|
|
58
|
-
|
|
59
22
|
export type PROPOSAL_GENRE = "berahub" | "honey" | "bend" | "berps" | "general";
|
|
60
23
|
|
|
61
24
|
export type CustomProposalActionErrors = {
|
|
@@ -84,22 +47,6 @@ export type CustomProposalErrors = {
|
|
|
84
47
|
actions?: CustomProposalActionErrors[];
|
|
85
48
|
};
|
|
86
49
|
|
|
87
|
-
export enum ProposalErrorCodes {
|
|
88
|
-
REQUIRED = "Required",
|
|
89
|
-
INVALID_AMOUNT = "Invalid amount",
|
|
90
|
-
NEGATIVE_AMOUNT = "Negative amount",
|
|
91
|
-
INVALID_ADDRESS = "Invalid address",
|
|
92
|
-
INVALID_ACTION = "Invalid action",
|
|
93
|
-
INVALID_ABI = "Invalid ABI",
|
|
94
|
-
MUST_BE_HTTPS = "Must be HTTPS",
|
|
95
|
-
MUST_BE_HTTPS_OR_IPFS = "Must be HTTPS or IPFS",
|
|
96
|
-
INVALID_BASEPATH = "Must be a berachain forum link",
|
|
97
|
-
/**
|
|
98
|
-
* Mainly used when it's not a reward vault
|
|
99
|
-
*/
|
|
100
|
-
INVALID_CONTRACT = "This is not a valid contract",
|
|
101
|
-
}
|
|
102
|
-
|
|
103
50
|
export type GovernanceTopic = {
|
|
104
51
|
id: PROPOSAL_GENRE;
|
|
105
52
|
color: string;
|
|
@@ -111,15 +58,6 @@ export type GovernanceTopic = {
|
|
|
111
58
|
description?: string;
|
|
112
59
|
comingSoon?: boolean;
|
|
113
60
|
};
|
|
114
|
-
|
|
115
|
-
export enum ProposalTypeEnum {
|
|
116
|
-
CUSTOM_PROPOSAL = "custom-action",
|
|
117
|
-
WHITELIST_REWARD_VAULT = "whitelist-reward-vault",
|
|
118
|
-
BLACKLIST_REWARD_VAULT = "blacklist-reward-vault",
|
|
119
|
-
ERC20_TRANSFER = "erc20-transfer",
|
|
120
|
-
WHITELIST_REWARD_VAULT_INCENTIVE = "whitelist-reward-vault-incentive",
|
|
121
|
-
}
|
|
122
|
-
|
|
123
61
|
export type CustomProposal = {
|
|
124
62
|
title: string;
|
|
125
63
|
description: any;
|
|
@@ -2,19 +2,7 @@ import type { Address, Hex } from "viem";
|
|
|
2
2
|
|
|
3
3
|
import type { HoneyPreviewResult } from "~/actions/honey/getHoneyPreview";
|
|
4
4
|
import type { TokenWithOrder } from "~/contexts/HoneyConfigProvider";
|
|
5
|
-
|
|
6
|
-
export enum HoneySwapAction {
|
|
7
|
-
RESET_AMOUNTS = "RESET_AMOUNTS",
|
|
8
|
-
ACTION_TYPE_CHANGE = "ACTION_TYPE_CHANGE",
|
|
9
|
-
COLLATERALS_CHANGE = "COLLATERALS_CHANGE",
|
|
10
|
-
FROM_AMOUNT_CHANGE = "FROM_AMOUNT_CHANGE",
|
|
11
|
-
TO_AMOUNT_CHANGE = "TO_AMOUNT_CHANGE",
|
|
12
|
-
PREVIEW_CHANGE = "PREVIEW_CHANGE",
|
|
13
|
-
IS_BASKET_MODE_ENABLED_CHANGE = "IS_BASKET_MODE_ENABLED_CHANGE",
|
|
14
|
-
IS_TYPING_CHANGE = "IS_TYPING_CHANGE",
|
|
15
|
-
IS_SUBMITTING_CHANGE = "IS_SUBMITTING_CHANGE",
|
|
16
|
-
IS_LOADING_CHANGE = "IS_LOADING_CHANGE",
|
|
17
|
-
}
|
|
5
|
+
import type { HoneySwapAction } from "~/enum/honey";
|
|
18
6
|
|
|
19
7
|
export type PythPriceFeedMap = Record<Address, Hex>;
|
|
20
8
|
|
|
@@ -2,7 +2,7 @@ import type { Address } from "viem";
|
|
|
2
2
|
|
|
3
3
|
import type { ApiValidatorFragment } from "@berachain/graphql/pol/api";
|
|
4
4
|
|
|
5
|
-
import type { Token } from "./dex";
|
|
5
|
+
import type { Token, TokenWithMetadata } from "./dex";
|
|
6
6
|
|
|
7
7
|
export type IncentiveReward = {
|
|
8
8
|
tokenMetadata: Token | undefined;
|
|
@@ -23,6 +23,7 @@ export interface IncentiveRewardChunksWithValidatorData {
|
|
|
23
23
|
minTimestamp: number | undefined;
|
|
24
24
|
totalValue: number;
|
|
25
25
|
tokenTotals: {
|
|
26
|
+
chainId: number;
|
|
26
27
|
address: Address;
|
|
27
28
|
amount: number;
|
|
28
29
|
value: number;
|
|
@@ -37,6 +38,7 @@ export interface AggregatedTokenTotals {
|
|
|
37
38
|
amount: number;
|
|
38
39
|
value: number;
|
|
39
40
|
metadata: Token | undefined;
|
|
41
|
+
chainId: number;
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
export type ClaimedIncentives = Record<string, string>;
|
|
@@ -50,3 +52,12 @@ export interface UserVaultInfo {
|
|
|
50
52
|
rewards: string;
|
|
51
53
|
percentage: string;
|
|
52
54
|
}
|
|
55
|
+
|
|
56
|
+
export type StakedBeraAsset = {
|
|
57
|
+
token: TokenWithMetadata;
|
|
58
|
+
apr: number;
|
|
59
|
+
stakedAmount: number;
|
|
60
|
+
stakedAmountUsd: number;
|
|
61
|
+
earnedAmount: number;
|
|
62
|
+
earnedAmountUsd: number;
|
|
63
|
+
};
|