@berachain/berajs 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{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} +80 -107
- package/dist/actions/{index.d.ts → exports.d.ts} +80 -107
- package/dist/actions/exports.mjs +2 -0
- package/dist/actions/exports.mjs.map +1 -0
- package/dist/chunk-575OK77P.mjs +2 -0
- package/dist/chunk-575OK77P.mjs.map +1 -0
- package/dist/chunk-7GWTHOLO.mjs +2 -0
- package/dist/chunk-7GWTHOLO.mjs.map +1 -0
- package/dist/chunk-7SC4VD3U.cjs +2 -0
- package/dist/chunk-7SC4VD3U.cjs.map +1 -0
- package/dist/chunk-BHNQX4XC.mjs +2 -0
- package/dist/chunk-BHNQX4XC.mjs.map +1 -0
- package/dist/chunk-BOYZVULX.cjs +2 -0
- package/dist/chunk-BOYZVULX.cjs.map +1 -0
- package/dist/chunk-C3FHGFLK.mjs +2 -0
- package/dist/chunk-C3FHGFLK.mjs.map +1 -0
- package/dist/chunk-C3G5KXCH.mjs +2 -0
- package/dist/chunk-C3G5KXCH.mjs.map +1 -0
- package/dist/chunk-CYKCYPFR.cjs +2 -0
- package/dist/chunk-CYKCYPFR.cjs.map +1 -0
- package/dist/chunk-F4BKSBEM.mjs +2 -0
- package/dist/chunk-F4BKSBEM.mjs.map +1 -0
- package/dist/chunk-FL2N3XHK.cjs +2 -0
- package/dist/chunk-FL2N3XHK.cjs.map +1 -0
- package/dist/chunk-G6NA6NSM.mjs +4 -0
- package/dist/chunk-G6NA6NSM.mjs.map +1 -0
- package/dist/chunk-H2QSRMVS.mjs +2 -0
- package/dist/chunk-H2QSRMVS.mjs.map +1 -0
- package/dist/chunk-IJM76AWK.cjs +4 -0
- package/dist/chunk-IJM76AWK.cjs.map +1 -0
- package/dist/chunk-MTS5SZLA.mjs +2 -0
- package/dist/chunk-MTS5SZLA.mjs.map +1 -0
- package/dist/chunk-MUNAP5TM.cjs +2 -0
- package/dist/chunk-MUNAP5TM.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-OS5AJMYJ.cjs +2 -0
- package/dist/chunk-OS5AJMYJ.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-TJWKS54T.mjs +2 -0
- package/dist/chunk-TJWKS54T.mjs.map +1 -0
- package/dist/chunk-UQUWMHVF.cjs +2 -0
- package/dist/chunk-UQUWMHVF.cjs.map +1 -0
- package/dist/chunk-UXUWSRVV.cjs +2 -0
- package/dist/chunk-UXUWSRVV.cjs.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-WTCBORPB.cjs +2 -0
- package/dist/chunk-WTCBORPB.cjs.map +1 -0
- package/dist/chunk-XNJLSA6P.cjs +2 -0
- package/dist/chunk-XNJLSA6P.cjs.map +1 -0
- package/dist/chunk-YQGZMWDT.mjs +2 -0
- package/dist/chunk-YQGZMWDT.mjs.map +1 -0
- package/dist/chunk-YXLFOEZN.mjs +2 -0
- package/dist/chunk-YXLFOEZN.mjs.map +1 -0
- package/dist/chunk-ZAKA4TGK.cjs +2 -0
- package/dist/chunk-ZAKA4TGK.cjs.map +1 -0
- package/dist/chunk-ZQRACIGR.mjs +2 -0
- package/dist/chunk-ZQRACIGR.mjs.map +1 -0
- package/dist/contexts/exports.cjs +2 -0
- package/dist/contexts/exports.cjs.map +1 -0
- package/dist/contexts/{index.d.ts → exports.d.cts} +19 -28
- package/dist/contexts/{index.d.cts → exports.d.ts} +19 -28
- package/dist/contexts/exports.mjs +2 -0
- package/dist/contexts/exports.mjs.map +1 -0
- package/dist/contracts-CQIPk0Jc.d.cts +74 -0
- package/dist/contracts-CQIPk0Jc.d.ts +74 -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 +24 -0
- package/dist/enum/exports.d.ts +24 -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 +385 -0
- package/dist/errors/exports.d.ts +385 -0
- package/dist/errors/exports.mjs +2 -0
- package/dist/{getValidatorQueuedOperatorAddress-9xY2RUGe.d.cts → getValidatorQueuedOperatorAddress-BX35p2Lv.d.ts} +125 -15
- package/dist/{getValidatorQueuedOperatorAddress-Ne2zoiiV.d.ts → getValidatorQueuedOperatorAddress-It0GsdvQ.d.cts} +125 -15
- package/dist/global.d-Ba-NIojH.d.cts +474 -0
- package/dist/global.d-By70bEv2.d.ts +474 -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} +223 -173
- package/dist/hooks/{index.d.ts → exports.d.ts} +223 -173
- package/dist/hooks/exports.mjs +4 -0
- package/dist/hooks/exports.mjs.map +1 -0
- package/dist/{BexStatusProvider-nS3NcdxI.d.cts → transactionStore-BvStaXf3.d.ts} +41 -1
- package/dist/{BexStatusProvider-nS3NcdxI.d.ts → transactionStore-CQrGYSY2.d.cts} +41 -1
- package/dist/{txnEnum-BQKDfaeH.d.cts → txnEnum-BYNbCxla.d.cts} +1 -0
- package/dist/{txnEnum-BQKDfaeH.d.ts → txnEnum-BYNbCxla.d.ts} +1 -0
- package/dist/types/exports.cjs +1 -0
- package/dist/types/exports.cjs.map +1 -0
- package/dist/types/exports.d.cts +58 -0
- package/dist/types/exports.d.ts +58 -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 +16 -17
- 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 +21 -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/{hooks/transactions → contexts}/TransactionStoreContext.tsx +32 -4
- package/src/contexts/block-time-provider.tsx +1 -1
- package/src/contexts/{index.ts → exports.ts} +1 -1
- package/src/data/contracts.ts +16 -1
- 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 +50 -11
- 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 +2 -2
- package/src/errors/assert.ts +4 -2
- package/src/errors/assert.unit.test.ts +6 -2
- package/src/errors/errorMap.ts +16 -6
- package/src/errors/{index.ts → exports.ts} +7 -0
- package/src/errors/getErrorMessage.ts +22 -3
- package/src/errors/getRevertReason.integration.test.ts +17 -5
- 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} +18 -7
- 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/transactions/transactionStore.ts +86 -65
- package/src/hooks/transactions/transactionStore.unit.test.ts +54 -1
- package/src/hooks/transactions/useAddRecentTransaction.ts +1 -1
- package/src/hooks/transactions/useRecentTransactions.ts +1 -1
- package/src/hooks/transactions/useSetTransactionStatus.ts +31 -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/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
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Address, PublicClient, Hex } from 'viem';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { BeraConfig, ChainId } from '@berachain/config/internal';
|
|
3
|
+
import { I as IAggregatorArgs, g as IRawAggregatorQuote, b as Token, d as HoneyConfigContextReturn, B as BalanceToken, P as PythLatestUpdates } from './HoneyConfigProvider-Ca3ouozs.cjs';
|
|
4
|
+
import { A as Aggregators } from './dex-C_BB0b0O.cjs';
|
|
5
|
+
import { GqlPoolType, GlobalDataQuery, ApiVaultFragment, GetVaultsQueryVariables, GqlChain, GetVaultHistoryQueryVariables, GetVaultHistoryQuery, ApiValidatorFragment } from '@berachain/graphql/pol/api';
|
|
6
|
+
import { P as ProtocolMetadata } from './global.d-Ba-NIojH.cjs';
|
|
6
7
|
|
|
7
8
|
interface GetConvertToAssetsProps {
|
|
8
9
|
sharesAmount: bigint;
|
|
@@ -14,6 +15,90 @@ declare function getConvertToAssets({ sharesAmount, vaultAddress, publicClient,
|
|
|
14
15
|
formatted: string;
|
|
15
16
|
}>;
|
|
16
17
|
|
|
18
|
+
declare abstract class BaseAggregator {
|
|
19
|
+
abstract name: Aggregators;
|
|
20
|
+
/**
|
|
21
|
+
* Supported chains for the aggregator.
|
|
22
|
+
* If null, the aggregator is supported on all chains.
|
|
23
|
+
*/
|
|
24
|
+
abstract supportedChains: number[] | null;
|
|
25
|
+
static PATH_NOT_FOUND_REASON: string;
|
|
26
|
+
needsAccountForQuote: boolean;
|
|
27
|
+
notFoundMessages: string[];
|
|
28
|
+
config: BeraConfig;
|
|
29
|
+
chainId: ChainId;
|
|
30
|
+
constructor(args?: BeraJS.BaseFunctionArgs);
|
|
31
|
+
/**
|
|
32
|
+
* Identifies the url of the last sent request. Might not have all query params.
|
|
33
|
+
* Mainly used for error reporting.
|
|
34
|
+
*/
|
|
35
|
+
url: string;
|
|
36
|
+
abstract readonly type: "rest" | "graphql" | "rpc";
|
|
37
|
+
abstract getQuote(args: IAggregatorArgs): Promise<IRawAggregatorQuote | undefined> | Promise<IRawAggregatorQuote | undefined>;
|
|
38
|
+
/**
|
|
39
|
+
* return wbera for native tokens to accomodate the aggregator's router logic
|
|
40
|
+
*/
|
|
41
|
+
protected parseAddresses(tokenIn: string, tokenOut: string): {
|
|
42
|
+
tokenInAddress: Address;
|
|
43
|
+
tokenOutAddress: Address;
|
|
44
|
+
isTokenInNative: boolean;
|
|
45
|
+
isTokenOutNative: boolean;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Calculate input amount after fees.
|
|
49
|
+
*
|
|
50
|
+
* @returns Amount in wad format
|
|
51
|
+
*/
|
|
52
|
+
protected getAmountAfterFees(amount: string, aggregatorsFeeBps?: number): string;
|
|
53
|
+
/**
|
|
54
|
+
* Formats input data for aggregator swaps
|
|
55
|
+
*/
|
|
56
|
+
protected getInputData({ tokenIn, amountIn, isNative, isPermit2Approval, permit2SpenderAddress, }: {
|
|
57
|
+
tokenIn: Address;
|
|
58
|
+
amountIn: string;
|
|
59
|
+
isNative: boolean;
|
|
60
|
+
isPermit2Approval?: boolean;
|
|
61
|
+
permit2SpenderAddress?: Address | null;
|
|
62
|
+
}): {
|
|
63
|
+
tokenIn: `0x${string}`;
|
|
64
|
+
amountIn: bigint;
|
|
65
|
+
isNative: boolean;
|
|
66
|
+
isPermit2Approval: boolean;
|
|
67
|
+
permit2SpenderAddress: `0x${string}`;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Calculate min amount out
|
|
71
|
+
*/
|
|
72
|
+
protected getMinAmountOut(amountOut: string, slippage: number): bigint;
|
|
73
|
+
protected parseAllowanceRequirements({ tokenIn, rawAmount, spender, }: {
|
|
74
|
+
tokenIn: Token;
|
|
75
|
+
rawAmount: string;
|
|
76
|
+
spender: Address;
|
|
77
|
+
}): {
|
|
78
|
+
token: Token;
|
|
79
|
+
amount: {
|
|
80
|
+
raw: string;
|
|
81
|
+
formatted: string;
|
|
82
|
+
};
|
|
83
|
+
spender: `0x${string}`;
|
|
84
|
+
}[];
|
|
85
|
+
/**
|
|
86
|
+
* Check if chain is supported
|
|
87
|
+
*/
|
|
88
|
+
checkChainSupport({ tokenIn, tokenOut, }: {
|
|
89
|
+
tokenIn: Token;
|
|
90
|
+
tokenOut: Token;
|
|
91
|
+
honeyNativeState?: Pick<HoneyConfigContextReturn, "collateralList">;
|
|
92
|
+
underlyingToken?: Token | null;
|
|
93
|
+
}): boolean;
|
|
94
|
+
assertChainSupport({ tokenIn, tokenOut, underlyingToken, }: {
|
|
95
|
+
tokenIn: Token;
|
|
96
|
+
tokenOut: Token;
|
|
97
|
+
underlyingToken?: Token | null;
|
|
98
|
+
}): void;
|
|
99
|
+
protected fetch(url: string | URL, options?: RequestInit): Promise<Response>;
|
|
100
|
+
}
|
|
101
|
+
|
|
17
102
|
interface PoolStatus {
|
|
18
103
|
isPoolInRecoveryMode: boolean;
|
|
19
104
|
isPoolPaused: boolean;
|
|
@@ -67,7 +152,7 @@ interface GetVaultsBalancesArgs extends BeraJS.BaseFunctionArgs {
|
|
|
67
152
|
collateralList: Token[];
|
|
68
153
|
honeyFactoryAddress?: Address;
|
|
69
154
|
}
|
|
70
|
-
interface GetHoneyVaultsBalanceResponse extends
|
|
155
|
+
interface GetHoneyVaultsBalanceResponse extends BalanceToken {
|
|
71
156
|
vault: Address;
|
|
72
157
|
}
|
|
73
158
|
declare function getHoneyVaultsBalance({ client, collateralList, honeyFactoryAddress, ...args }: GetVaultsBalancesArgs): Promise<GetHoneyVaultsBalanceResponse[]>;
|
|
@@ -269,24 +354,44 @@ interface GetGaugeData {
|
|
|
269
354
|
}
|
|
270
355
|
declare function getRewardVaults({ filter, publicClient, ...args }?: {
|
|
271
356
|
filter?: GetVaultsQueryVariables;
|
|
272
|
-
publicClient?:
|
|
357
|
+
publicClient?: PublicClient | undefined;
|
|
273
358
|
} & BeraJS.BaseFunctionArgs): Promise<GetGaugeData>;
|
|
274
359
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
360
|
+
interface VaultMetadata {
|
|
361
|
+
current: {
|
|
362
|
+
exchangeRate: string;
|
|
363
|
+
totalSupply: string;
|
|
364
|
+
totalAssets: string;
|
|
365
|
+
tvl: string;
|
|
366
|
+
};
|
|
367
|
+
previous: {
|
|
368
|
+
exchangeRate: string;
|
|
369
|
+
totalSupply: string;
|
|
370
|
+
totalAssets: string;
|
|
371
|
+
tvl: string;
|
|
372
|
+
};
|
|
373
|
+
totalWBeraIssued: string;
|
|
374
|
+
lockPeriod?: number;
|
|
375
|
+
totalBuyBacks: number;
|
|
376
|
+
totalBuyBacksInLast24Hours: number;
|
|
377
|
+
}
|
|
279
378
|
/**
|
|
280
379
|
*
|
|
380
|
+
* @param address - The address of the vault
|
|
281
381
|
* @throws {Error} If the vault is not found
|
|
282
382
|
* @returns
|
|
283
383
|
*/
|
|
284
|
-
declare function
|
|
384
|
+
declare function getSWBeraVaultMetadata({ address, publicClient, blockTime, ...args }: {
|
|
385
|
+
address: Address;
|
|
386
|
+
publicClient?: PublicClient;
|
|
387
|
+
blockTime: number;
|
|
388
|
+
} & BeraJS.BaseFunctionArgs): Promise<VaultMetadata>;
|
|
285
389
|
|
|
286
390
|
/**
|
|
287
391
|
* Interface representing a staked BERA withdrawal request
|
|
288
392
|
*/
|
|
289
393
|
interface StakedBeraWithdrawal {
|
|
394
|
+
receiptTokenAddress: Address;
|
|
290
395
|
withdrawalAmount?: bigint;
|
|
291
396
|
timeRemaining?: string;
|
|
292
397
|
withdrawalRequestId?: bigint;
|
|
@@ -304,7 +409,12 @@ interface StakedBeraWithdrawal {
|
|
|
304
409
|
* @param version - The version of the stake vault contract ("V1" or "V2")
|
|
305
410
|
* @returns Promise resolving to an array of withdrawal request information
|
|
306
411
|
*/
|
|
307
|
-
declare function getSWBeraWithdrawal(contractAddress
|
|
412
|
+
declare function getSWBeraWithdrawal({ contractAddress, accountAddress, publicClient, version, }: {
|
|
413
|
+
contractAddress: Address;
|
|
414
|
+
accountAddress: Address;
|
|
415
|
+
publicClient: PublicClient;
|
|
416
|
+
version: "V1" | "V2";
|
|
417
|
+
}): Promise<StakedBeraWithdrawal[]>;
|
|
308
418
|
|
|
309
419
|
interface UserVault {
|
|
310
420
|
unclaimedBgt: string;
|
|
@@ -392,7 +502,7 @@ type UserBoostsOnValidator = {
|
|
|
392
502
|
declare function getUserBoostsOnValidator({ account, pubkey, publicClient, ...args }: {
|
|
393
503
|
account: Address;
|
|
394
504
|
pubkey: Address;
|
|
395
|
-
publicClient:
|
|
505
|
+
publicClient: PublicClient | undefined;
|
|
396
506
|
} & BeraJS.BaseFunctionArgs): Promise<UserBoostsOnValidator>;
|
|
397
507
|
|
|
398
508
|
type ValidatorWithUserBoost = ApiValidatorFragment & {
|
|
@@ -400,7 +510,7 @@ type ValidatorWithUserBoost = ApiValidatorFragment & {
|
|
|
400
510
|
};
|
|
401
511
|
declare function getUserActiveValidators({ account, publicClient, chain, ...args }: {
|
|
402
512
|
account: string;
|
|
403
|
-
publicClient?:
|
|
513
|
+
publicClient?: PublicClient | undefined;
|
|
404
514
|
chain?: GqlChain;
|
|
405
515
|
} & BeraJS.BaseFunctionArgs): Promise<ValidatorWithUserBoost[] | undefined>;
|
|
406
516
|
|
|
@@ -437,4 +547,4 @@ declare function getValidatorQueuedOperatorAddress({ client, pubKey, ...args }:
|
|
|
437
547
|
pubKey: Address;
|
|
438
548
|
} & BeraJS.BaseFunctionArgs): Promise<ValidatorQueuedOperatorAddress | undefined>;
|
|
439
549
|
|
|
440
|
-
export { getVaultHistory as A,
|
|
550
|
+
export { getVaultHistory as A, BaseAggregator as B, type ValidatorWithUserBoost as C, getUserActiveValidators as D, type UserBoostsOnValidator as E, getUserBoostsOnValidator as F, type GetConvertToAssetsProps as G, type UserStakingPoolPosition as H, type IsBadCollateralArgs as I, getUserStakingPositions as J, type ValidatorQueuedCommission as K, getValidatorQueuedCommission as L, type ValidatorQueuedOperatorAddress as M, getValidatorQueuedOperatorAddress as N, type OnChainPool as O, type PoolStatus as P, type ValidatorRewardAllocationRaw as Q, type RewardVaultIncentive as R, type StakedBeraWithdrawal as S, type ValidatorRewardAllocationUpdate as T, type UserVault as U, type ValidatorRewardAllocation as V, type ValidatorRewardAllocationUpdateWithExpiration as W, formatValidatorRewardAllocation as X, isSameRewardAllocation as Y, getValidatorRewardAllocation as Z, getOnChainPool as a, getPoolPausedState as b, type GetHoneyVaultsBalanceResponse as c, getHoneyVaultsBalance as d, type IsBadCollateralResponse as e, type GetBgtAprSimulationArgs as f, getConvertToAssets as g, type GetBgtAprSimulationResult as h, isBadCollateralAsset as i, getBgtAprSimulation as j, type GlobalData as k, getGlobalData as l, type GetMarkets as m, getMarkets as n, getRewardVaultIncentives as o, RewardVaultDistributionMode as p, type GetRewardVaultRewardsReturn as q, getRewardVaultRewards as r, type GetGaugeData as s, getRewardVaults as t, type VaultMetadata as u, getSWBeraVaultMetadata as v, getSWBeraWithdrawal as w, type GetUserVaultsResponse as x, getUserVaults as y, type GetVaultHistoryArgs as z };
|
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
import { Address, Hex, AbiFunction, Abi, ContractFunctionName, ContractFunctionArgs, TransactionReceipt, WalletCallReceipt, Account } from 'viem';
|
|
2
|
+
import { ProposalWithVotesFragment, ProposalVoteFragment } from '@berachain/graphql/governance';
|
|
3
|
+
import { b as ProposalTypeEnum, a as ProposalErrorCodes, C as ContractName } from './contracts-CQIPk0Jc.cjs';
|
|
4
|
+
import { a as TokenWithMetadata, b as Token } from './HoneyConfigProvider-Ca3ouozs.cjs';
|
|
5
|
+
import { ApiValidatorFragment } from '@berachain/graphql/pol/api';
|
|
6
|
+
import { Config, GetWalletClientReturnType } from '@wagmi/core';
|
|
7
|
+
import { SWRConfiguration, SWRResponse } from 'swr';
|
|
8
|
+
import { ChainId, BeraConfig } from '@berachain/config';
|
|
9
|
+
import { T as TransactionActionType } from './txnEnum-BYNbCxla.cjs';
|
|
10
|
+
import { B as BeraError } from './BeraError-_mQdkanr.cjs';
|
|
11
|
+
|
|
12
|
+
type Proposal = ProposalWithVotesFragment;
|
|
13
|
+
|
|
14
|
+
type Vote = ProposalVoteFragment;
|
|
15
|
+
|
|
16
|
+
type Voter = Address;
|
|
17
|
+
|
|
18
|
+
type ProposalVotes = {
|
|
19
|
+
yes: number;
|
|
20
|
+
no: number;
|
|
21
|
+
abstain: number;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
type PROPOSAL_GENRE = "berahub" | "honey" | "bend" | "berps" | "general";
|
|
25
|
+
|
|
26
|
+
type CustomProposalActionErrors = {
|
|
27
|
+
type?: null | ProposalErrorCodes;
|
|
28
|
+
target?: null | ProposalErrorCodes;
|
|
29
|
+
value?: null | ProposalErrorCodes;
|
|
30
|
+
ABI?: null | ProposalErrorCodes;
|
|
31
|
+
functionSignature?: null | ProposalErrorCodes;
|
|
32
|
+
args?: (null | ProposalErrorCodes)[];
|
|
33
|
+
vault?: null | ProposalErrorCodes;
|
|
34
|
+
isFriend?: null | ProposalErrorCodes;
|
|
35
|
+
to?: null | ProposalErrorCodes;
|
|
36
|
+
amount?: null | ProposalErrorCodes;
|
|
37
|
+
minIncentiveRate?: null | ProposalErrorCodes;
|
|
38
|
+
managerAddress?: null | ProposalErrorCodes;
|
|
39
|
+
input?: null | ProposalErrorCodes;
|
|
40
|
+
token?: null | ProposalErrorCodes;
|
|
41
|
+
rawCalldata?: null | ProposalErrorCodes;
|
|
42
|
+
message?: null | ProposalErrorCodes;
|
|
43
|
+
} | null;
|
|
44
|
+
|
|
45
|
+
type CustomProposalErrors = {
|
|
46
|
+
title?: null | ProposalErrorCodes;
|
|
47
|
+
description?: null | ProposalErrorCodes;
|
|
48
|
+
forumLink?: null | ProposalErrorCodes;
|
|
49
|
+
actions?: CustomProposalActionErrors[];
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
type GovernanceTopic = {
|
|
53
|
+
id: PROPOSAL_GENRE;
|
|
54
|
+
color: string;
|
|
55
|
+
icon: React.ReactNode;
|
|
56
|
+
iconBackground?: string;
|
|
57
|
+
name: string;
|
|
58
|
+
slug: string;
|
|
59
|
+
forumLink: string;
|
|
60
|
+
description?: string;
|
|
61
|
+
comingSoon?: boolean;
|
|
62
|
+
};
|
|
63
|
+
type CustomProposal = {
|
|
64
|
+
title: string;
|
|
65
|
+
description: any;
|
|
66
|
+
actions: ProposalAction[];
|
|
67
|
+
forumLink: string;
|
|
68
|
+
topic: Set<PROPOSAL_GENRE>;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
type SafeProposalAction = {
|
|
72
|
+
value: bigint;
|
|
73
|
+
target: "" | Address;
|
|
74
|
+
} & (
|
|
75
|
+
| {
|
|
76
|
+
type: ProposalTypeEnum.CUSTOM_PROPOSAL;
|
|
77
|
+
input: "ABI" | "rawCalldata" | "message";
|
|
78
|
+
ABI: string;
|
|
79
|
+
_isVerifiedAbi?: boolean;
|
|
80
|
+
functionSignature: string;
|
|
81
|
+
args: string[];
|
|
82
|
+
rawCalldata: Hex;
|
|
83
|
+
message: string;
|
|
84
|
+
}
|
|
85
|
+
| {
|
|
86
|
+
type:
|
|
87
|
+
| ProposalTypeEnum.WHITELIST_REWARD_VAULT
|
|
88
|
+
| ProposalTypeEnum.BLACKLIST_REWARD_VAULT;
|
|
89
|
+
vault: Address;
|
|
90
|
+
}
|
|
91
|
+
| {
|
|
92
|
+
type: ProposalTypeEnum.ERC20_TRANSFER;
|
|
93
|
+
to: Address;
|
|
94
|
+
amount: string;
|
|
95
|
+
}
|
|
96
|
+
| {
|
|
97
|
+
type: ProposalTypeEnum.WHITELIST_REWARD_VAULT_INCENTIVE;
|
|
98
|
+
vault: Address;
|
|
99
|
+
token: Address;
|
|
100
|
+
minIncentiveRate: string;
|
|
101
|
+
managerAddress: Address;
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
type ProposalAction = Partial<SafeProposalAction> & {
|
|
106
|
+
type: SafeProposalAction["type"];
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
type VerifiedAbi = {
|
|
110
|
+
abiItem?: AbiFunction;
|
|
111
|
+
functionName?: string;
|
|
112
|
+
args: readonly unknown[];
|
|
113
|
+
functionSignature?: string;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
interface ProtocolMetadata {
|
|
117
|
+
name: string;
|
|
118
|
+
logoURI: string;
|
|
119
|
+
url: string;
|
|
120
|
+
description: string;
|
|
121
|
+
tags?: string[];
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Configuration for a single staking option.
|
|
126
|
+
* Maps receipt tokens to their accepted input tokens.
|
|
127
|
+
*/
|
|
128
|
+
type StakingConfig = {
|
|
129
|
+
/** Unique identifier for this staking config */
|
|
130
|
+
id: string;
|
|
131
|
+
/** The token received when staking (e.g., sWBERA, siBERA) */
|
|
132
|
+
receiptToken: TokenWithMetadata;
|
|
133
|
+
/** Tokens that can be staked to receive the receipt token */
|
|
134
|
+
inputTokens: TokenWithMetadata[];
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
interface BribeBoostReward {
|
|
138
|
+
token: string;
|
|
139
|
+
total_unclaimed: string;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
interface BribeBoostRewardItem {
|
|
143
|
+
rewards: BribeBoostReward[];
|
|
144
|
+
validator: string;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
interface BribeBoostRewardProof {
|
|
148
|
+
validator?: string;
|
|
149
|
+
pagination: {
|
|
150
|
+
next: number;
|
|
151
|
+
previous: number;
|
|
152
|
+
record_per_page: number;
|
|
153
|
+
current_page: number;
|
|
154
|
+
total_page: number;
|
|
155
|
+
};
|
|
156
|
+
rewards:
|
|
157
|
+
| {
|
|
158
|
+
id: string;
|
|
159
|
+
dist_id: string;
|
|
160
|
+
token: Address;
|
|
161
|
+
recipient: string;
|
|
162
|
+
amount: string;
|
|
163
|
+
merkle_proof: string[];
|
|
164
|
+
available_at: number;
|
|
165
|
+
}[]
|
|
166
|
+
| null;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
interface BribeBoostValidatorApr {
|
|
170
|
+
id: string;
|
|
171
|
+
boost_total_bgt: string;
|
|
172
|
+
rewards_total_usd: string;
|
|
173
|
+
daily_rate: string;
|
|
174
|
+
apr: string;
|
|
175
|
+
apy: string;
|
|
176
|
+
tokens: Address[]; // Confirm this type with backend real data
|
|
177
|
+
validator: string;
|
|
178
|
+
start_block: number;
|
|
179
|
+
end_block: number;
|
|
180
|
+
start_timestamp: number;
|
|
181
|
+
end_timestamp: number;
|
|
182
|
+
created_at: string;
|
|
183
|
+
updated_at: string;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
type IncentiveReward = {
|
|
187
|
+
tokenMetadata: Token | undefined;
|
|
188
|
+
tokenPrice: number;
|
|
189
|
+
tokenValue: number;
|
|
190
|
+
id: string;
|
|
191
|
+
dist_id: string;
|
|
192
|
+
token: string;
|
|
193
|
+
recipient: string;
|
|
194
|
+
formattedAmount: string;
|
|
195
|
+
amount: string;
|
|
196
|
+
merkle_proof: string[];
|
|
197
|
+
available_at: number;
|
|
198
|
+
};
|
|
199
|
+
interface IncentiveRewardChunksWithValidatorData {
|
|
200
|
+
validator: ApiValidatorFragment | undefined;
|
|
201
|
+
maxTimestamp: number | undefined;
|
|
202
|
+
minTimestamp: number | undefined;
|
|
203
|
+
totalValue: number;
|
|
204
|
+
tokenTotals: {
|
|
205
|
+
chainId: number;
|
|
206
|
+
address: Address;
|
|
207
|
+
amount: number;
|
|
208
|
+
value: number;
|
|
209
|
+
metadata: Token | undefined;
|
|
210
|
+
}[];
|
|
211
|
+
rewards: IncentiveReward[];
|
|
212
|
+
isCurrent: boolean;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
interface AggregatedTokenTotals {
|
|
216
|
+
address: Address;
|
|
217
|
+
amount: number;
|
|
218
|
+
value: number;
|
|
219
|
+
metadata: Token | undefined;
|
|
220
|
+
chainId: number;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
type ClaimedIncentives = Record<string, string>;
|
|
224
|
+
|
|
225
|
+
type ClaimedIncentivesLocalState = Record<string, ClaimedIncentives>;
|
|
226
|
+
|
|
227
|
+
interface UserVaultInfo {
|
|
228
|
+
balance: bigint;
|
|
229
|
+
delegatedBalance: bigint;
|
|
230
|
+
withdrawableBalance: bigint;
|
|
231
|
+
rewards: string;
|
|
232
|
+
percentage: string;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
type StakedBeraAsset = {
|
|
236
|
+
token: TokenWithMetadata;
|
|
237
|
+
apr: number;
|
|
238
|
+
stakedAmount: number;
|
|
239
|
+
stakedAmountUsd: number;
|
|
240
|
+
earnedAmount: number;
|
|
241
|
+
earnedAmountUsd: number;
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
interface UseContractWriteApi {
|
|
245
|
+
isLoading: boolean;
|
|
246
|
+
isSubmitting: boolean;
|
|
247
|
+
isSuccess: boolean;
|
|
248
|
+
isError: boolean;
|
|
249
|
+
write: IContractWriteFn;
|
|
250
|
+
reset: () => void;
|
|
251
|
+
}
|
|
252
|
+
type PropagatedArgs<args> = Omit<args, TxnEventKeys | "contractName"> & {
|
|
253
|
+
contractName?: string;
|
|
254
|
+
};
|
|
255
|
+
type TxnEventKeys = "onSuccess" | "onError" | "onLoading" | "onSubmission" | "onWarning";
|
|
256
|
+
interface IUseContractWriteArgs<abi extends Abi | undefined = undefined, functionName extends abi extends Abi ? ContractFunctionName<abi> : never = abi extends Abi ? ContractFunctionName<abi> : never, params extends abi extends Abi ? ContractFunctionArgs<abi, "payable" | "nonpayable", functionName> : never = abi extends Abi ? ContractFunctionArgs<abi, "payable" | "nonpayable", functionName> : never> {
|
|
257
|
+
onSuccess?: (receipts: TransactionReceipt | WalletCallReceipt<bigint, "success" | "reverted">,
|
|
258
|
+
/**
|
|
259
|
+
* Arguments that were used to call the write function.
|
|
260
|
+
*/
|
|
261
|
+
writeArgs: PropagatedArgs<IContractWrite<abi, functionName, params>>) => void;
|
|
262
|
+
onError?: (e: BeraError,
|
|
263
|
+
/**
|
|
264
|
+
* Arguments that were used to call the write function.
|
|
265
|
+
*/
|
|
266
|
+
writeArgs: PropagatedArgs<IContractWrite<abi, functionName, params>>) => void;
|
|
267
|
+
onLoading?: (
|
|
268
|
+
/**
|
|
269
|
+
* Arguments that were used to call the write function.
|
|
270
|
+
*/
|
|
271
|
+
writeArgs: PropagatedArgs<IContractWrite<abi, functionName, params>>) => void;
|
|
272
|
+
onSubmission?: (
|
|
273
|
+
/**
|
|
274
|
+
* @param args.id If request is a batch call, this will be the id of the request to the wallet provider
|
|
275
|
+
* @param args.txHash If request is a single transaction, this will be the hash of the transaction to wait for
|
|
276
|
+
*/
|
|
277
|
+
args: {
|
|
278
|
+
txHash: Hex;
|
|
279
|
+
id?: never;
|
|
280
|
+
} | {
|
|
281
|
+
id: string;
|
|
282
|
+
txHash?: never;
|
|
283
|
+
},
|
|
284
|
+
/**
|
|
285
|
+
* Arguments that were used to call the write function.
|
|
286
|
+
*/
|
|
287
|
+
writeArgs: PropagatedArgs<IContractWrite<abi, functionName, params>>) => void;
|
|
288
|
+
/**
|
|
289
|
+
* Callback function executed when a transaction encounters a warning. Transaction will still be submitted.
|
|
290
|
+
*/
|
|
291
|
+
onWarning?: (e: BeraError, writeArgs: Omit<IContractWrite<abi, functionName, params>, TxnEventKeys>) => void;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
type DefaultHookOptions = {
|
|
295
|
+
opts?: SWRConfiguration & { isEnabled?: boolean };
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
type DefaultHookReturnType<T = any> = Omit<
|
|
299
|
+
SWRResponse<T, any, any>,
|
|
300
|
+
"mutate"
|
|
301
|
+
> & {
|
|
302
|
+
refresh: () => void;
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
type IContractWriteFn = <
|
|
306
|
+
abi extends Abi | undefined = undefined,
|
|
307
|
+
functionName extends abi extends Abi
|
|
308
|
+
? ContractFunctionName<abi>
|
|
309
|
+
: never = abi extends Abi ? ContractFunctionName<abi> : never,
|
|
310
|
+
params extends abi extends Abi
|
|
311
|
+
? ContractFunctionArgs<abi, "payable" | "nonpayable", functionName>
|
|
312
|
+
: never = abi extends Abi
|
|
313
|
+
? ContractFunctionArgs<abi, "payable" | "nonpayable", functionName>
|
|
314
|
+
: never,
|
|
315
|
+
>(
|
|
316
|
+
props: IContractWrite<abi, functionName, params>,
|
|
317
|
+
) => Promise<
|
|
318
|
+
| TransactionReceipt
|
|
319
|
+
| WalletCallReceipt<bigint, "success" | "reverted">
|
|
320
|
+
| undefined
|
|
321
|
+
>;
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Posthog must be able to serialize this. BigInts are not supported.
|
|
325
|
+
*/
|
|
326
|
+
type AllowedEventData = number | string | boolean | null | undefined;
|
|
327
|
+
|
|
328
|
+
type EventData = Record<
|
|
329
|
+
string,
|
|
330
|
+
| AllowedEventData
|
|
331
|
+
| AllowedEventData[]
|
|
332
|
+
| Record<
|
|
333
|
+
string,
|
|
334
|
+
| AllowedEventData
|
|
335
|
+
| AllowedEventData[]
|
|
336
|
+
| Record<string, AllowedEventData | AllowedEventData[]>
|
|
337
|
+
>
|
|
338
|
+
>;
|
|
339
|
+
|
|
340
|
+
type IContractWrite<
|
|
341
|
+
abi extends Abi | undefined = undefined,
|
|
342
|
+
functionName extends abi extends Abi
|
|
343
|
+
? ContractFunctionName<abi>
|
|
344
|
+
: never = abi extends Abi ? ContractFunctionName<abi> : never,
|
|
345
|
+
params extends abi extends Abi
|
|
346
|
+
? ContractFunctionArgs<abi, "payable" | "nonpayable", functionName>
|
|
347
|
+
: never = abi extends Abi
|
|
348
|
+
? ContractFunctionArgs<abi, "payable" | "nonpayable", functionName>
|
|
349
|
+
: never,
|
|
350
|
+
> = {
|
|
351
|
+
/**
|
|
352
|
+
* A message that will be shown to user while the transaction is pending.
|
|
353
|
+
*
|
|
354
|
+
* @example "Sending approvals"
|
|
355
|
+
*/
|
|
356
|
+
message: string;
|
|
357
|
+
/**
|
|
358
|
+
* The chain ID of the transaction.
|
|
359
|
+
*
|
|
360
|
+
* @default berachainChainId
|
|
361
|
+
*/
|
|
362
|
+
chainId?: ChainId;
|
|
363
|
+
/**
|
|
364
|
+
* The type of transaction to be performed. It will be stored in the transaction history.
|
|
365
|
+
*
|
|
366
|
+
* Generally uses infinite tense.
|
|
367
|
+
* @example TransactionActionType.APPROVAL => "Approve tokens"
|
|
368
|
+
*/
|
|
369
|
+
actionType: TransactionActionType;
|
|
370
|
+
txnName?: string;
|
|
371
|
+
gasLimit?: bigint;
|
|
372
|
+
account?: Account | Address;
|
|
373
|
+
/**
|
|
374
|
+
* Wheter the transaction can be sent by any account. Before setting this to true, make sure smart contract doesn't rely on `msg.sender`.
|
|
375
|
+
*
|
|
376
|
+
* Only transaction with permissionless flag set to true can be sent with overriden account.
|
|
377
|
+
* Everything else will throw an error.
|
|
378
|
+
*/
|
|
379
|
+
permissionless?: boolean;
|
|
380
|
+
/**
|
|
381
|
+
* The event to be tracked more specifically.
|
|
382
|
+
* If not provided, the event will be tracked with the message and actionType.
|
|
383
|
+
*/
|
|
384
|
+
track?: {
|
|
385
|
+
eventName: string;
|
|
386
|
+
eventData?: EventData;
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* A wagmi config used to get wallet clients, switch chains, etc.
|
|
391
|
+
*
|
|
392
|
+
* This is preferred over providing clients as state updates are kept synched in this config object w/o re-rendering.
|
|
393
|
+
*/
|
|
394
|
+
wagmiConfig?: Config;
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* walletClient should only be provided for tests or scripts.
|
|
398
|
+
*
|
|
399
|
+
* Wagmi Config is preferred.
|
|
400
|
+
*/
|
|
401
|
+
walletClient?: GetWalletClientReturnType | undefined;
|
|
402
|
+
/**
|
|
403
|
+
* The name of the contract to be used for the transaction. By default, it will be devrel's contract mapping.
|
|
404
|
+
* Custom values will be ignored if the address is already mapped in the devrel's contract mapping.
|
|
405
|
+
*
|
|
406
|
+
* @example "pol.rewardVault"
|
|
407
|
+
*/
|
|
408
|
+
contractName?: ContractName;
|
|
409
|
+
/**
|
|
410
|
+
* This is a canonical list of ABIs that will be used to parse the error.
|
|
411
|
+
*
|
|
412
|
+
* This is an useful way to parse errors when providing raw data with no ABI.
|
|
413
|
+
*/
|
|
414
|
+
errorsAbi?: Abi;
|
|
415
|
+
} & IUseContractWriteArgs<abi, functionName, params> &
|
|
416
|
+
(abi extends Abi
|
|
417
|
+
? {
|
|
418
|
+
abi: abi;
|
|
419
|
+
functionName: functionName;
|
|
420
|
+
params: params;
|
|
421
|
+
address: Address;
|
|
422
|
+
calls?: never;
|
|
423
|
+
value?: bigint;
|
|
424
|
+
}
|
|
425
|
+
:
|
|
426
|
+
| {
|
|
427
|
+
data: Hex;
|
|
428
|
+
address: Address;
|
|
429
|
+
value?: bigint;
|
|
430
|
+
calls?: never;
|
|
431
|
+
}
|
|
432
|
+
| {
|
|
433
|
+
value: bigint;
|
|
434
|
+
address: Address;
|
|
435
|
+
data?: Hex;
|
|
436
|
+
calls?: never;
|
|
437
|
+
}
|
|
438
|
+
| {
|
|
439
|
+
value?: never;
|
|
440
|
+
address?: never;
|
|
441
|
+
calls: (Omit<
|
|
442
|
+
IContractWrite,
|
|
443
|
+
| "calls"
|
|
444
|
+
| "gasLimit"
|
|
445
|
+
| "account"
|
|
446
|
+
| "address"
|
|
447
|
+
| "message"
|
|
448
|
+
| "actionType"
|
|
449
|
+
| TxnEventKeys
|
|
450
|
+
> & {
|
|
451
|
+
address: Address;
|
|
452
|
+
})[];
|
|
453
|
+
});
|
|
454
|
+
|
|
455
|
+
declare global {
|
|
456
|
+
export namespace BeraJS {
|
|
457
|
+
export type BaseFunctionArgs = {
|
|
458
|
+
/**
|
|
459
|
+
* If only chainId is provided, config will be inferred from it
|
|
460
|
+
*
|
|
461
|
+
* @default `import { defaultChainId } from "@berachain/config/internal";`
|
|
462
|
+
*/
|
|
463
|
+
chainId?: ChainId;
|
|
464
|
+
/**
|
|
465
|
+
* A config to infer the default values of the other arguments
|
|
466
|
+
*
|
|
467
|
+
* @default chainConfigs[chainId]
|
|
468
|
+
*/
|
|
469
|
+
config?: BeraConfig;
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
export type { AggregatedTokenTotals as A, BribeBoostRewardProof as B, CustomProposal as C, DefaultHookOptions as D, GovernanceTopic as G, IContractWrite as I, ProtocolMetadata as P, StakingConfig as S, TxnEventKeys as T, UserVaultInfo as U, Vote as V, CustomProposalErrors as a, BribeBoostRewardItem as b, DefaultHookReturnType as c, StakedBeraAsset as d, IUseContractWriteArgs as e, UseContractWriteApi as f, BribeBoostReward as g, BribeBoostValidatorApr as h, IContractWriteFn as i, Proposal as j, Voter as k, ProposalVotes as l, PROPOSAL_GENRE as m, CustomProposalActionErrors as n, SafeProposalAction as o, ProposalAction as p, VerifiedAbi as q, IncentiveReward as r, IncentiveRewardChunksWithValidatorData as s, ClaimedIncentives as t, ClaimedIncentivesLocalState as u };
|