@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,44 +1,35 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
|
-
import
|
|
3
|
-
import { type Address, type PublicClient, parseUnits, zeroAddress } from "viem";
|
|
2
|
+
import { type Address, zeroAddress } from "viem";
|
|
4
3
|
|
|
5
4
|
import { defaultChainId } from "@berachain/config/internal";
|
|
6
5
|
|
|
7
6
|
import { useBeraWallet, usePublicClient } from "@berachain/wagmi/hooks";
|
|
8
7
|
|
|
9
|
-
import { BaseAggregator } from "~/actions/dex/aggregators/base";
|
|
10
8
|
import { bex } from "~/actions/dex/aggregators/bex";
|
|
11
9
|
import { bgtRedeem } from "~/actions/dex/aggregators/bgt";
|
|
12
|
-
import { enso } from "~/actions/dex/aggregators/enso";
|
|
10
|
+
import { enso } from "~/actions/dex/aggregators/enso/enso";
|
|
11
|
+
import { erc4626Deposit } from "~/actions/dex/aggregators/erc4626";
|
|
13
12
|
import { fly } from "~/actions/dex/aggregators/fly";
|
|
14
13
|
import { haiku } from "~/actions/dex/aggregators/haiku";
|
|
15
|
-
import {
|
|
16
|
-
HoneyNativeAggregator,
|
|
17
|
-
honeyNative,
|
|
18
|
-
} from "~/actions/dex/aggregators/honey";
|
|
14
|
+
import { honeyNative } from "~/actions/dex/aggregators/honey";
|
|
19
15
|
import { kyberswap } from "~/actions/dex/aggregators/kyberswap";
|
|
20
16
|
import { oogabooga } from "~/actions/dex/aggregators/oogabooga";
|
|
21
17
|
import { openOcean } from "~/actions/dex/aggregators/openOcean";
|
|
22
18
|
import { wberaSwap } from "~/actions/dex/aggregators/wbera";
|
|
23
19
|
import { useBeraFlag } from "~/contexts/BeraFlags/BeraFlags";
|
|
24
|
-
import type {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} from "~/
|
|
28
|
-
import {
|
|
29
|
-
import { BeraError } from "~/errors/BeraError";
|
|
30
|
-
import { RequestError } from "~/errors/RequestError";
|
|
31
|
-
import { useAggregatorsRouterFeeBps } from "~/hooks";
|
|
32
|
-
import type {
|
|
33
|
-
DefaultHookOptions,
|
|
34
|
-
IRawAggregatorQuote,
|
|
35
|
-
SwapReferrer,
|
|
36
|
-
} from "~/types";
|
|
37
|
-
import type { Aggregators } from "~/types/dex";
|
|
20
|
+
import type { HoneyConfigContextReturn } from "~/contexts/HoneyConfigProvider";
|
|
21
|
+
import type { SwapReferrer } from "~/enum/dex";
|
|
22
|
+
import { useAggregatorsRouterFeeBps } from "~/hooks/dex/useAggregatorsRouterFeeBps";
|
|
23
|
+
import type { IRawAggregatorQuote, MinimalERC20 } from "~/types/dex";
|
|
24
|
+
import type { DefaultHookOptions } from "~/types/global";
|
|
38
25
|
import { parseBaseArgs } from "~/utils/parseBaseArgs";
|
|
39
|
-
import { seconds } from "~/utils/time";
|
|
40
26
|
import { isToken } from "~/utils/tokens";
|
|
27
|
+
import { useUnderlyingAsset } from "../tokens/useUnderlyingAsset";
|
|
41
28
|
import { useBexStatus } from "./useBexStatus";
|
|
29
|
+
import {
|
|
30
|
+
getAggregatorsSWROptions,
|
|
31
|
+
raw_useSingleAggregatorQuote,
|
|
32
|
+
} from "./useSingleAggregatorQuote";
|
|
42
33
|
|
|
43
34
|
const AGGREGATORS = [
|
|
44
35
|
oogabooga,
|
|
@@ -49,13 +40,12 @@ const AGGREGATORS = [
|
|
|
49
40
|
enso,
|
|
50
41
|
bex,
|
|
51
42
|
honeyNative,
|
|
43
|
+
erc4626Deposit,
|
|
52
44
|
];
|
|
53
45
|
|
|
54
46
|
type IUseAggregatorsQuotesArgs = BeraJS.BaseFunctionArgs & {
|
|
55
|
-
tokenIn:
|
|
56
|
-
tokenOut:
|
|
57
|
-
tokenInDecimals: number;
|
|
58
|
-
tokenOutDecimals: number;
|
|
47
|
+
tokenIn: MinimalERC20;
|
|
48
|
+
tokenOut: MinimalERC20;
|
|
59
49
|
amount: string;
|
|
60
50
|
slippage: number;
|
|
61
51
|
referrer?: SwapReferrer;
|
|
@@ -72,141 +62,10 @@ type IUseAggregatorsQuotesArgs = BeraJS.BaseFunctionArgs & {
|
|
|
72
62
|
>;
|
|
73
63
|
};
|
|
74
64
|
|
|
75
|
-
|
|
76
|
-
string, // "useAggregatorsQuotes
|
|
77
|
-
string, // name
|
|
78
|
-
Address, // tokenIn
|
|
79
|
-
Address, // tokenOut
|
|
80
|
-
string, // parsedAmount
|
|
81
|
-
number, // slippage
|
|
82
|
-
Address | undefined, // account
|
|
83
|
-
number | undefined, // feeBps
|
|
84
|
-
number, // tokenInDecimals
|
|
85
|
-
number, // tokenOutDecimals
|
|
86
|
-
SwapReferrer | undefined, // referrer
|
|
87
|
-
Address | undefined, // rewardVault
|
|
88
|
-
TokenWithOrder[] | undefined, // collateralList
|
|
89
|
-
];
|
|
90
|
-
|
|
91
|
-
export const USE_AGGREGATORS_QUOTES_QUERY_KEY = "useAggregatorsQuotes";
|
|
92
|
-
|
|
93
|
-
function getQueryKey({
|
|
94
|
-
name,
|
|
95
|
-
account,
|
|
96
|
-
args,
|
|
97
|
-
feeBps,
|
|
98
|
-
options,
|
|
99
|
-
activeAggregators,
|
|
100
|
-
honeyNativeState,
|
|
101
|
-
}: {
|
|
102
|
-
name: Aggregators;
|
|
103
|
-
account: Address | undefined;
|
|
104
|
-
args: IUseAggregatorsQuotesArgs;
|
|
105
|
-
feeBps: number | undefined;
|
|
106
|
-
options?: DefaultHookOptions;
|
|
107
|
-
/**
|
|
108
|
-
* List of active aggregators fetched from edge config flags.
|
|
109
|
-
*
|
|
110
|
-
* If undefined, all aggregators are enabled.
|
|
111
|
-
*/
|
|
112
|
-
activeAggregators: string[] | undefined;
|
|
113
|
-
honeyNativeState?: Pick<HoneyConfigContextReturn, "collateralList">;
|
|
114
|
-
}): IQueryKey | null {
|
|
115
|
-
if (name !== bgtRedeem.name) {
|
|
116
|
-
if (
|
|
117
|
-
isToken(args.tokenIn, "BGT", { chainId: defaultChainId }) ||
|
|
118
|
-
isToken(args.tokenOut, "BGT", { chainId: defaultChainId })
|
|
119
|
-
) {
|
|
120
|
-
// can't happen, but just in case
|
|
121
|
-
return null;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
const {
|
|
126
|
-
tokenIn,
|
|
127
|
-
tokenOut,
|
|
128
|
-
tokenInDecimals,
|
|
129
|
-
tokenOutDecimals,
|
|
130
|
-
amount,
|
|
131
|
-
slippage,
|
|
132
|
-
referrer,
|
|
133
|
-
rewardVault,
|
|
134
|
-
} = args;
|
|
135
|
-
const parsedAmount = parseUnits(amount, tokenInDecimals).toString();
|
|
136
|
-
|
|
137
|
-
const isEnabledOnConfig =
|
|
138
|
-
!activeAggregators ||
|
|
139
|
-
activeAggregators.includes(name.toLowerCase().replaceAll(" ", ""));
|
|
140
|
-
|
|
141
|
-
return options?.opts?.isEnabled &&
|
|
142
|
-
Number(amount) &&
|
|
143
|
-
feeBps !== undefined &&
|
|
144
|
-
isEnabledOnConfig
|
|
145
|
-
? [
|
|
146
|
-
USE_AGGREGATORS_QUOTES_QUERY_KEY,
|
|
147
|
-
name,
|
|
148
|
-
tokenIn,
|
|
149
|
-
tokenOut,
|
|
150
|
-
parsedAmount,
|
|
151
|
-
slippage,
|
|
152
|
-
account,
|
|
153
|
-
feeBps,
|
|
154
|
-
tokenInDecimals,
|
|
155
|
-
tokenOutDecimals,
|
|
156
|
-
referrer,
|
|
157
|
-
rewardVault,
|
|
158
|
-
honeyNativeState?.collateralList,
|
|
159
|
-
]
|
|
160
|
-
: null;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
function getQueryFn({
|
|
164
|
-
aggregator,
|
|
165
|
-
publicClient,
|
|
166
|
-
proxyAggregatorsThroughVercel,
|
|
167
|
-
}: {
|
|
168
|
-
aggregator: BaseAggregator;
|
|
169
|
-
publicClient?: PublicClient;
|
|
170
|
-
proxyAggregatorsThroughVercel?: boolean;
|
|
171
|
-
}) {
|
|
172
|
-
return async ([
|
|
173
|
-
,
|
|
174
|
-
,
|
|
175
|
-
tokenIn,
|
|
176
|
-
tokenOut,
|
|
177
|
-
amount,
|
|
178
|
-
slippage,
|
|
179
|
-
account,
|
|
180
|
-
aggregatorsFeeBps,
|
|
181
|
-
tokenInDecimals,
|
|
182
|
-
tokenOutDecimals,
|
|
183
|
-
referrer,
|
|
184
|
-
rewardVault,
|
|
185
|
-
honeyCollaterals,
|
|
186
|
-
]: IQueryKey) =>
|
|
187
|
-
aggregator.getQuote({
|
|
188
|
-
tokenIn,
|
|
189
|
-
tokenOut,
|
|
190
|
-
amount,
|
|
191
|
-
slippage,
|
|
192
|
-
account,
|
|
193
|
-
aggregatorsFeeBps,
|
|
194
|
-
tokenInDecimals,
|
|
195
|
-
tokenOutDecimals,
|
|
196
|
-
publicClient,
|
|
197
|
-
proxyAggregatorsThroughVercel,
|
|
198
|
-
referrer,
|
|
199
|
-
rewardVault,
|
|
200
|
-
honeyNativeState: {
|
|
201
|
-
collateralList: honeyCollaterals ?? [],
|
|
202
|
-
},
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
export const useAggregatorsQuotes = (
|
|
65
|
+
export function useAggregatorsQuotes(
|
|
207
66
|
args: IUseAggregatorsQuotesArgs,
|
|
208
67
|
options?: DefaultHookOptions,
|
|
209
|
-
)
|
|
68
|
+
) {
|
|
210
69
|
const { address: account } = useBeraWallet();
|
|
211
70
|
const proxyAggregatorsThroughVercel = useBeraFlag(
|
|
212
71
|
"proxyAggregatorsThroughVercel",
|
|
@@ -215,20 +74,20 @@ export const useAggregatorsQuotes = (
|
|
|
215
74
|
const publicClient = usePublicClient();
|
|
216
75
|
const { data: feeBps } = useAggregatorsRouterFeeBps();
|
|
217
76
|
|
|
218
|
-
const { collateralList: collaterals, protocol: honeyProtocol } =
|
|
219
|
-
args.honeyNativeState ?? {};
|
|
220
|
-
|
|
221
77
|
const isWrapOrUnwrap =
|
|
222
|
-
(isToken(args.tokenIn, "BERA") ||
|
|
223
|
-
|
|
78
|
+
(isToken(args.tokenIn.address, "BERA") ||
|
|
79
|
+
isToken(args.tokenIn.address, "WBERA")) &&
|
|
80
|
+
(isToken(args.tokenOut.address, "BERA") ||
|
|
81
|
+
isToken(args.tokenOut.address, "WBERA"));
|
|
224
82
|
|
|
225
|
-
const isBgtRedeem = isToken(args.tokenIn, "BGT", {
|
|
83
|
+
const isBgtRedeem = isToken(args.tokenIn.address, "BGT", {
|
|
84
|
+
chainId: defaultChainId,
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
const { data: underlyingToken } = useUnderlyingAsset({
|
|
88
|
+
token: args.tokenOut,
|
|
89
|
+
});
|
|
226
90
|
|
|
227
|
-
// retrieve the honey collaterals in order to check if the swap is a honey mint or redeem
|
|
228
|
-
const isHoneyNative = useMemo(
|
|
229
|
-
() => HoneyNativeAggregator.isHoneyNativeSwap(args),
|
|
230
|
-
[args.tokenOut, args.tokenIn, collaterals],
|
|
231
|
-
);
|
|
232
91
|
/**
|
|
233
92
|
* Whether it's a native swap (wrap/unwrap) or BGT redeem
|
|
234
93
|
*/
|
|
@@ -238,224 +97,126 @@ export const useAggregatorsQuotes = (
|
|
|
238
97
|
|
|
239
98
|
const isMAEnabled = config.bex.aggregatorsRouter !== zeroAddress;
|
|
240
99
|
|
|
241
|
-
const swrOptions
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
console.warn(key[1], "returned error 403, stopping retries");
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
if (revalidateOpts.retryCount > (config.errorRetryCount ?? 3)) {
|
|
258
|
-
return;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
setTimeout(() => {
|
|
262
|
-
revalidate();
|
|
263
|
-
}, config.errorRetryInterval ?? seconds(10));
|
|
264
|
-
},
|
|
265
|
-
};
|
|
100
|
+
const swrOptions = getAggregatorsSWROptions(options);
|
|
101
|
+
|
|
102
|
+
const sharedArgs = {
|
|
103
|
+
activeAggregators,
|
|
104
|
+
isMAEnabled,
|
|
105
|
+
underlyingToken,
|
|
106
|
+
isNativeSwap,
|
|
107
|
+
account,
|
|
108
|
+
publicClient,
|
|
109
|
+
proxyAggregatorsThroughVercel,
|
|
110
|
+
feeBps,
|
|
111
|
+
} as const;
|
|
266
112
|
|
|
267
113
|
// we're using independent useSWRs so we can show quotes as they come
|
|
268
114
|
// instead of waiting for all of them to load
|
|
269
|
-
const oogaBogaResult =
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
115
|
+
const oogaBogaResult = raw_useSingleAggregatorQuote(
|
|
116
|
+
{
|
|
117
|
+
...sharedArgs,
|
|
118
|
+
...args,
|
|
119
|
+
aggregator: oogabooga,
|
|
120
|
+
},
|
|
121
|
+
{ opts: swrOptions },
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
const flyResult = raw_useSingleAggregatorQuote(
|
|
125
|
+
{
|
|
126
|
+
...sharedArgs,
|
|
127
|
+
...args,
|
|
128
|
+
aggregator: fly,
|
|
129
|
+
},
|
|
130
|
+
{ opts: swrOptions },
|
|
282
131
|
);
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
options,
|
|
292
|
-
activeAggregators,
|
|
293
|
-
}),
|
|
294
|
-
getQueryFn({ aggregator: fly, proxyAggregatorsThroughVercel }),
|
|
295
|
-
swrOptions,
|
|
132
|
+
|
|
133
|
+
const erc4626Result = raw_useSingleAggregatorQuote(
|
|
134
|
+
{
|
|
135
|
+
...sharedArgs,
|
|
136
|
+
...args,
|
|
137
|
+
aggregator: erc4626Deposit,
|
|
138
|
+
},
|
|
139
|
+
{ opts: swrOptions },
|
|
296
140
|
);
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
options,
|
|
306
|
-
activeAggregators,
|
|
307
|
-
}),
|
|
308
|
-
getQueryFn({ aggregator: kyberswap, proxyAggregatorsThroughVercel }),
|
|
309
|
-
swrOptions,
|
|
141
|
+
|
|
142
|
+
const kyberswapResult = raw_useSingleAggregatorQuote(
|
|
143
|
+
{
|
|
144
|
+
...sharedArgs,
|
|
145
|
+
...args,
|
|
146
|
+
aggregator: kyberswap,
|
|
147
|
+
},
|
|
148
|
+
{ opts: swrOptions },
|
|
310
149
|
);
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
account,
|
|
317
|
-
args,
|
|
318
|
-
feeBps,
|
|
319
|
-
options,
|
|
320
|
-
activeAggregators,
|
|
321
|
-
}),
|
|
322
|
-
getQueryFn({
|
|
150
|
+
|
|
151
|
+
const openOceanResult = raw_useSingleAggregatorQuote(
|
|
152
|
+
{
|
|
153
|
+
...sharedArgs,
|
|
154
|
+
...args,
|
|
323
155
|
aggregator: openOcean,
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
}),
|
|
327
|
-
swrOptions,
|
|
156
|
+
},
|
|
157
|
+
{ opts: swrOptions },
|
|
328
158
|
);
|
|
329
|
-
const haikuResult = useSWR(
|
|
330
|
-
isNativeSwap || !isMAEnabled
|
|
331
|
-
? null
|
|
332
|
-
: getQueryKey({
|
|
333
|
-
name: haiku.name,
|
|
334
|
-
account,
|
|
335
|
-
args,
|
|
336
|
-
feeBps,
|
|
337
|
-
options,
|
|
338
|
-
activeAggregators,
|
|
339
|
-
}),
|
|
340
|
-
getQueryFn({
|
|
341
|
-
aggregator: haiku,
|
|
342
|
-
publicClient,
|
|
343
|
-
proxyAggregatorsThroughVercel,
|
|
344
|
-
}),
|
|
345
159
|
|
|
346
|
-
|
|
160
|
+
const haikuResult = raw_useSingleAggregatorQuote(
|
|
161
|
+
{
|
|
162
|
+
...sharedArgs,
|
|
163
|
+
...args,
|
|
164
|
+
aggregator: haiku,
|
|
165
|
+
},
|
|
166
|
+
{ opts: swrOptions },
|
|
347
167
|
);
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
options,
|
|
357
|
-
activeAggregators,
|
|
358
|
-
}),
|
|
359
|
-
getQueryFn({ aggregator: enso, proxyAggregatorsThroughVercel }),
|
|
360
|
-
swrOptions,
|
|
168
|
+
|
|
169
|
+
const ensoResult = raw_useSingleAggregatorQuote(
|
|
170
|
+
{
|
|
171
|
+
...sharedArgs,
|
|
172
|
+
...args,
|
|
173
|
+
aggregator: enso,
|
|
174
|
+
},
|
|
175
|
+
{ opts: swrOptions },
|
|
361
176
|
);
|
|
177
|
+
|
|
362
178
|
const { protocol: bexProtocol } = useBexStatus();
|
|
363
179
|
|
|
364
|
-
const bexResult =
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
args.rewardVault
|
|
370
|
-
? null
|
|
371
|
-
: getQueryKey({
|
|
372
|
-
name: bex.name,
|
|
373
|
-
account,
|
|
374
|
-
args,
|
|
375
|
-
// Always zero on bex swaps
|
|
376
|
-
feeBps: 0,
|
|
377
|
-
options,
|
|
378
|
-
activeAggregators,
|
|
379
|
-
}),
|
|
380
|
-
getQueryFn({ aggregator: bex, publicClient }),
|
|
381
|
-
swrOptions,
|
|
382
|
-
);
|
|
383
|
-
const wberaSwapResult = useSWR(
|
|
384
|
-
isWrapOrUnwrap
|
|
385
|
-
? getQueryKey({
|
|
386
|
-
name: wberaSwap.name,
|
|
387
|
-
account,
|
|
388
|
-
args,
|
|
389
|
-
// Always 0 for wrap/unwrap
|
|
390
|
-
feeBps: 0,
|
|
391
|
-
options,
|
|
392
|
-
// wbera is always enabled
|
|
393
|
-
activeAggregators: undefined,
|
|
394
|
-
})
|
|
395
|
-
: null,
|
|
396
|
-
async ([, , tokenIn, tokenOut, amount, , account]: IQueryKey) => {
|
|
397
|
-
return wberaSwap.getQuote({
|
|
398
|
-
tokenIn,
|
|
399
|
-
tokenOut,
|
|
400
|
-
amount,
|
|
401
|
-
account,
|
|
402
|
-
});
|
|
180
|
+
const bexResult = raw_useSingleAggregatorQuote(
|
|
181
|
+
{
|
|
182
|
+
...sharedArgs,
|
|
183
|
+
...args,
|
|
184
|
+
aggregator: bex,
|
|
403
185
|
},
|
|
404
|
-
swrOptions,
|
|
186
|
+
{ opts: { ...swrOptions, isEnabled: bexProtocol.isPaused === false } },
|
|
405
187
|
);
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
: null,
|
|
419
|
-
async ([, , tokenIn, , amount]: IQueryKey) => {
|
|
420
|
-
return bgtRedeem.getQuote({
|
|
421
|
-
tokenIn,
|
|
422
|
-
amount,
|
|
423
|
-
});
|
|
188
|
+
|
|
189
|
+
const wberaSwapResult = raw_useSingleAggregatorQuote({
|
|
190
|
+
...sharedArgs,
|
|
191
|
+
...args,
|
|
192
|
+
aggregator: wberaSwap,
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
const bgtRedeemResult = raw_useSingleAggregatorQuote(
|
|
196
|
+
{
|
|
197
|
+
...sharedArgs,
|
|
198
|
+
...args,
|
|
199
|
+
aggregator: bgtRedeem,
|
|
424
200
|
},
|
|
425
|
-
swrOptions,
|
|
201
|
+
{ opts: swrOptions },
|
|
426
202
|
);
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
? null
|
|
433
|
-
: getQueryKey({
|
|
434
|
-
name: honeyNative.name,
|
|
435
|
-
account,
|
|
436
|
-
args,
|
|
437
|
-
// Always 0 for honey mint/redeem
|
|
438
|
-
feeBps: 0,
|
|
439
|
-
options,
|
|
440
|
-
// honey mint/redeem is always enabled
|
|
441
|
-
activeAggregators: undefined,
|
|
442
|
-
honeyNativeState: {
|
|
443
|
-
collateralList: collaterals,
|
|
444
|
-
},
|
|
445
|
-
}),
|
|
446
|
-
getQueryFn({
|
|
203
|
+
|
|
204
|
+
const honeyResult = raw_useSingleAggregatorQuote(
|
|
205
|
+
{
|
|
206
|
+
...sharedArgs,
|
|
207
|
+
...args,
|
|
447
208
|
aggregator: honeyNative,
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
}),
|
|
451
|
-
swrOptions,
|
|
209
|
+
},
|
|
210
|
+
{ opts: swrOptions },
|
|
452
211
|
);
|
|
212
|
+
|
|
453
213
|
const results = isWrapOrUnwrap
|
|
454
214
|
? [wberaSwapResult]
|
|
455
215
|
: isBgtRedeem
|
|
456
216
|
? [bgtRedeemResult]
|
|
457
217
|
: [
|
|
458
218
|
oogaBogaResult,
|
|
219
|
+
erc4626Result,
|
|
459
220
|
flyResult,
|
|
460
221
|
kyberswapResult,
|
|
461
222
|
openOceanResult,
|
|
@@ -499,4 +260,4 @@ export const useAggregatorsQuotes = (
|
|
|
499
260
|
...data,
|
|
500
261
|
refresh: () => results.map((r) => r.mutate()),
|
|
501
262
|
};
|
|
502
|
-
}
|
|
263
|
+
}
|
|
@@ -4,7 +4,7 @@ import type { GetPoolsQueryVariables } from "@berachain/graphql/dex/api";
|
|
|
4
4
|
|
|
5
5
|
import { getAllPools } from "~/actions/dex/getAllPools";
|
|
6
6
|
import { POLLING } from "~/enum/polling";
|
|
7
|
-
import type { DefaultHookOptions } from "~/types";
|
|
7
|
+
import type { DefaultHookOptions } from "~/types/global";
|
|
8
8
|
|
|
9
9
|
export const useAllUserPoolsQueryKey = ({
|
|
10
10
|
query,
|
|
@@ -5,7 +5,7 @@ import type { MinimalPoolFragment } from "@berachain/graphql/dex/api";
|
|
|
5
5
|
|
|
6
6
|
import { getApiPool } from "~/actions/dex/getApiPool";
|
|
7
7
|
import { POLLING } from "~/enum/polling";
|
|
8
|
-
import { InvalidArgumentError } from "~/errors";
|
|
8
|
+
import { InvalidArgumentError } from "~/errors/InvalidArgumentError";
|
|
9
9
|
|
|
10
10
|
export const useApiPoolQueryKey = ({
|
|
11
11
|
poolId,
|
|
@@ -18,8 +18,9 @@ import {
|
|
|
18
18
|
import { balancerPoolCreationHelperAbi } from "~/abi/bex/balancerPoolCreationHelper";
|
|
19
19
|
import { getApolloClient } from "~/actions/clients/getApolloClient";
|
|
20
20
|
import { TransactionActionType } from "~/enum/txnEnum";
|
|
21
|
-
import type {
|
|
22
|
-
import {
|
|
21
|
+
import type { Token, TokenWithAmount } from "~/types/dex";
|
|
22
|
+
import type { IContractWrite } from "~/types/global";
|
|
23
|
+
import { DEFAULT_METAMASK_GAS_LIMIT } from "~/utils/constants";
|
|
23
24
|
import { parseBaseArgs } from "~/utils/parseBaseArgs";
|
|
24
25
|
import { generatePoolName, generatePoolSymbol } from "~/utils/poolNamings";
|
|
25
26
|
import { isToken } from "~/utils/tokens";
|
|
@@ -28,7 +29,7 @@ import { wrapNativeTokens } from "~/utils/tokenWrapping";
|
|
|
28
29
|
const DEFAULT_WEIGHTS_DUPLICATION_THRESHOLD = 0.005;
|
|
29
30
|
interface UseCreatePoolProps extends BeraJS.BaseFunctionArgs {
|
|
30
31
|
poolCreateTokens: Token[];
|
|
31
|
-
initialLiquidityTokens:
|
|
32
|
+
initialLiquidityTokens: TokenWithAmount[];
|
|
32
33
|
normalizedWeights: bigint[]; // NOTE: if you pass weights that have off-by-1 errors pool create will fail (ex: 0.3 repeating)
|
|
33
34
|
poolType: PoolType;
|
|
34
35
|
swapFee: number;
|
|
@@ -78,7 +79,7 @@ const createStablePoolArgs = ({
|
|
|
78
79
|
}: {
|
|
79
80
|
poolCreationHelper: Address;
|
|
80
81
|
poolCreateTokens: Token[];
|
|
81
|
-
initialLiquidityTokens:
|
|
82
|
+
initialLiquidityTokens: TokenWithAmount[];
|
|
82
83
|
swapFeePercentage: bigint;
|
|
83
84
|
salt: string;
|
|
84
85
|
poolName: string;
|
|
@@ -186,7 +187,7 @@ const createWeightedPoolArgs = ({
|
|
|
186
187
|
}: {
|
|
187
188
|
poolCreationHelper: Address;
|
|
188
189
|
poolCreateTokens: Token[];
|
|
189
|
-
initialLiquidityTokens:
|
|
190
|
+
initialLiquidityTokens: TokenWithAmount[];
|
|
190
191
|
normalizedWeights: bigint[];
|
|
191
192
|
swapFeePercentage: bigint;
|
|
192
193
|
salt: string;
|
|
@@ -5,7 +5,7 @@ import { usePublicClient } from "@berachain/wagmi/hooks";
|
|
|
5
5
|
|
|
6
6
|
import { getIsTokenExploited } from "~/actions/dex/getIsTokenExploited";
|
|
7
7
|
import { assertPublicClient } from "~/errors/assert";
|
|
8
|
-
import type { Token } from "~/types";
|
|
8
|
+
import type { Token } from "~/types/dex";
|
|
9
9
|
|
|
10
10
|
export const useExploitedTokensQueryKey = (tokens: Token[] | undefined) => {
|
|
11
11
|
const filteredTokens = tokens?.filter((token) => token.address);
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { useEffect, useState } from "react";
|
|
2
2
|
import { PoolType } from "@berachain-foundation/berancer-sdk";
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
type TokenCurrentPriceMap,
|
|
7
|
-
type TokenWithAmount,
|
|
8
|
-
} from "~/types";
|
|
4
|
+
import { PoolCreationStep } from "~/enum/dex";
|
|
5
|
+
import type { TokenCurrentPriceMap, TokenWithAmount } from "~/types/dex";
|
|
9
6
|
import { wrapNativeTokens } from "~/utils/tokenWrapping";
|
|
10
7
|
import { type Oracle, OracleMode } from "./useCreatePool";
|
|
11
8
|
|