@berachain/berajs 0.2.2 → 0.2.4
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/.claude/skills/berajs/SKILL.md +222 -0
- package/.claude/skills/berajs/references/dex.md +235 -0
- package/.claude/skills/berajs/references/pol.md +194 -0
- package/.claude/skills/berajs/references/staking.md +198 -0
- package/.claude/skills/berajs/references/tokens.md +170 -0
- package/dist/{BexStatusProvider-nS3NcdxI.d.cts → BexStatusProvider-DRymVlQf.d.cts} +1 -1
- package/dist/{BexStatusProvider-nS3NcdxI.d.ts → BexStatusProvider-DRymVlQf.d.ts} +1 -1
- package/dist/{HoneyConfigProvider-CK6mOKFH.d.ts → HoneyConfigProvider-DVP_9KZn.d.ts} +1 -1
- package/dist/{HoneyConfigProvider-Ca3ouozs.d.cts → HoneyConfigProvider-DfkjmzEf.d.cts} +1 -1
- package/dist/abi/exports.cjs +1 -1
- package/dist/abi/exports.cjs.map +1 -1
- package/dist/abi/exports.d.cts +1893 -25347
- package/dist/abi/exports.d.ts +1893 -25347
- package/dist/abi/exports.mjs +1 -1
- package/dist/abi/exports.mjs.map +1 -1
- package/dist/actions/exports.cjs +1 -1
- package/dist/actions/exports.cjs.map +1 -1
- package/dist/actions/exports.d.cts +10 -9
- package/dist/actions/exports.d.ts +10 -9
- package/dist/actions/exports.mjs +1 -1
- package/dist/actions/exports.mjs.map +1 -1
- package/dist/chunk-4GU2O2OW.cjs +4 -0
- package/dist/chunk-4GU2O2OW.cjs.map +1 -0
- package/dist/chunk-5XWELBWR.mjs +2 -0
- package/dist/chunk-5XWELBWR.mjs.map +1 -0
- package/dist/chunk-BS6K7HGH.cjs +2 -0
- package/dist/chunk-BS6K7HGH.cjs.map +1 -0
- package/dist/chunk-NLVWRMGD.mjs +2 -0
- package/dist/chunk-NLVWRMGD.mjs.map +1 -0
- package/dist/chunk-OUD27MU7.cjs +2 -0
- package/dist/chunk-OUD27MU7.cjs.map +1 -0
- package/dist/chunk-RW3JFPED.mjs +4 -0
- package/dist/chunk-RW3JFPED.mjs.map +1 -0
- package/dist/chunk-S3EAKCVM.cjs +2 -0
- package/dist/{chunk-PKXAW6MO.cjs.map → chunk-S3EAKCVM.cjs.map} +1 -1
- package/dist/chunk-YNO7BCCM.mjs +2 -0
- package/dist/{chunk-3YXSUBA5.mjs.map → chunk-YNO7BCCM.mjs.map} +1 -1
- package/dist/contexts/exports.d.cts +3 -3
- package/dist/contexts/exports.d.ts +3 -3
- package/dist/enum/exports.d.cts +1 -1
- package/dist/enum/exports.d.ts +1 -1
- package/dist/errors/exports.d.cts +1 -1
- package/dist/errors/exports.d.ts +1 -1
- package/dist/{getValidatorQueuedOperatorAddress-RW4OMcD1.d.ts → getValidatorQueuedOperatorAddress-CqR6cyqC.d.ts} +3 -3
- package/dist/{getValidatorQueuedOperatorAddress-Dstyaomr.d.cts → getValidatorQueuedOperatorAddress-DZgrPmZ2.d.cts} +3 -3
- package/dist/{global.d-wYu8G8IQ.d.ts → global.d-BeYWDreg.d.ts} +5 -4
- package/dist/{global.d-CN6l2b9E.d.cts → global.d-DghRxpHd.d.cts} +5 -4
- package/dist/hooks/exports.cjs +3 -3
- package/dist/hooks/exports.cjs.map +1 -1
- package/dist/hooks/exports.d.cts +63 -39
- package/dist/hooks/exports.d.ts +63 -39
- package/dist/hooks/exports.mjs +3 -3
- package/dist/hooks/exports.mjs.map +1 -1
- package/dist/{txnEnum-BlBYhNRl.d.cts → txnEnum-DxPRHSJt.d.cts} +1 -1
- package/dist/{txnEnum-BlBYhNRl.d.ts → txnEnum-DxPRHSJt.d.ts} +1 -1
- package/dist/types/exports.d.cts +3 -3
- package/dist/types/exports.d.ts +3 -3
- package/dist/{useHoneySwapState-D1DKG_Of.d.ts → useHoneySwapState-B494PQDl.d.ts} +1 -1
- package/dist/{useHoneySwapState-B-vmIP1b.d.cts → useHoneySwapState-D6vpv19r.d.cts} +1 -1
- package/dist/utils/exports.cjs +1 -1
- package/dist/utils/exports.cjs.map +1 -1
- package/dist/utils/exports.d.cts +2 -2
- package/dist/utils/exports.d.ts +2 -2
- package/dist/utils/exports.mjs +1 -1
- package/dist/utils/exports.mjs.map +1 -1
- package/package.json +9 -10
- package/src/abi/exports.ts +0 -27
- package/src/actions/bend/getConvertToAssets.ts +1 -1
- package/src/actions/bend/getMaxDeposit.ts +1 -1
- package/src/actions/dex/aggregators/bex.ts +2 -1
- package/src/actions/dex/aggregators/enso/enso.ts +3 -2
- package/src/actions/dex/aggregators/enso/ensoErc4626.debug.test.ts +2 -3
- package/src/actions/dex/aggregators/erc4626.ts +2 -1
- package/src/actions/dex/aggregators/fly.ts +2 -1
- package/src/actions/dex/aggregators/haiku.ts +2 -1
- package/src/actions/dex/aggregators/kyberswap.ts +2 -2
- package/src/actions/dex/aggregators/oogabooga.ts +2 -1
- package/src/actions/dex/aggregators/openOcean.ts +2 -1
- package/src/actions/dex/aggregators/wbera.ts +2 -1
- package/src/actions/dex/getVaultPausedState.ts +2 -1
- package/src/actions/enso/getEnsoUserTokensWithBalances.debug.test.ts +1 -1
- package/src/actions/governance/__tests__/checkProposalField.unit.test.ts +2 -1
- package/src/actions/governance/__tests__/getDecodedFunctionData.integration.test.ts +66 -78
- package/src/actions/governance/__tests__/getQuorum.integration.test.ts +6 -7
- package/src/actions/governance/getDecodedFunctionData.ts +2 -2
- package/src/actions/governance/getProposalFromTx.ts +2 -1
- package/src/actions/governance/getProposalParams.ts +3 -2
- package/src/actions/governance/getQuorum.ts +2 -1
- package/src/actions/honey/getCollateralWeights.ts +2 -1
- package/src/actions/honey/getGlobalCapLimit.ts +2 -1
- package/src/actions/honey/getHoneyCollaterals.ts +2 -1
- package/src/actions/honey/getHoneyFees.ts +2 -1
- package/src/actions/honey/getHoneyPausedState.ts +2 -1
- package/src/actions/honey/getHoneyPreview.ts +2 -1
- package/src/actions/honey/getHoneyPythPriceOracle.ts +1 -1
- package/src/actions/honey/getHoneyRootPriceOracle.ts +2 -1
- package/src/actions/honey/getHoneyVaultsBalance.ts +3 -2
- package/src/actions/honey/getRelativeCapLimit.ts +2 -1
- package/src/actions/honey/getSharesWithoutFees.ts +3 -2
- package/src/actions/honey/getSwapPayload.ts +3 -2
- package/src/actions/honey/isBadCollateralAsset.ts +3 -2
- package/src/actions/honey/isBasketModeEnabled.ts +3 -2
- package/src/actions/pol/getBgtTokenTotalBoosts.ts +2 -1
- package/src/actions/pol/getLSTStakeConfig.ts +2 -1
- package/src/actions/pol/getRewardTokenToBeraRate.ts +2 -1
- package/src/actions/pol/getRewardVaultBeaconImplementation.ts +2 -1
- package/src/actions/pol/getRewardVaultDurationConstants.ts +2 -1
- package/src/actions/pol/getRewardVaultFromToken.ts +2 -1
- package/src/actions/pol/getRewardVaultIncentives.ts +2 -1
- package/src/actions/pol/getRewardVaultRewards.ts +2 -1
- package/src/actions/pol/getRewardVaultStakingToken.ts +1 -1
- package/src/actions/pol/getRewardVaults.ts +2 -1
- package/src/actions/pol/getSWBeraVaultMetadata.ts +2 -1
- package/src/actions/pol/getSWBeraWithdrawal.ts +2 -1
- package/src/actions/pol/getStakeWithdrawalCooldown.ts +1 -1
- package/src/actions/pol/getTotalStakedAmount.ts +2 -1
- package/src/actions/pol/getUserVaults.ts +2 -1
- package/src/actions/pol/getUserVaultsBalance.ts +2 -1
- package/src/actions/pol/getUserVaultsReward.ts +1 -1
- package/src/actions/pol/getVaultsSupply.ts +1 -1
- package/src/actions/pyth/getHoneyPythFeeds.ts +2 -1
- package/src/actions/transactions/beraWriteContract.integration.test.ts +48 -51
- package/src/actions/validators/getActiveBoostAndCommissionChangeDelay.ts +3 -2
- package/src/actions/validators/getBaselineRewardAllocation.ts +2 -1
- package/src/actions/validators/getDefaultRewardAllocation.ts +2 -1
- package/src/actions/validators/getUserBoostsOnValidator.ts +2 -1
- package/src/actions/validators/getValidatorCommission.ts +2 -1
- package/src/actions/validators/getValidatorOperatorAddress.ts +2 -1
- package/src/actions/validators/getValidatorQueuedCommission.ts +2 -1
- package/src/actions/validators/getValidatorQueuedOperatorAddress.ts +2 -1
- package/src/actions/validators/getValidatorQueuedRewardAllocation.ts +2 -1
- package/src/actions/validators/getValidatorRewardAllocation.ts +2 -1
- package/src/actions/validators/getValidatorRewardAllocatorAddress.ts +2 -1
- package/src/actions/validators/utils/__tests__/validatorUtils.integration.test.ts +10 -11
- package/src/errors/getRevertReason.integration.test.ts +115 -107
- package/src/hooks/dex/useAggregatorsRouterFeeBps.ts +2 -1
- package/src/hooks/dex/useCreatePool.ts +2 -1
- package/src/hooks/dex/usePollPoolCreationRelayerApproval.ts +2 -1
- package/src/hooks/governance/useGetPastVotes.ts +2 -1
- package/src/hooks/governance/useHasVoted.ts +2 -1
- package/src/hooks/governance/useIsCanceller.ts +2 -1
- package/src/hooks/governance/usePollProposalThreshold.ts +2 -1
- package/src/hooks/governance/usePollUserDelegates.ts +2 -1
- package/src/hooks/governance/useProposalSnapshot.ts +2 -1
- package/src/hooks/governance/useProposalState.ts +2 -1
- package/src/hooks/governance/useProposalTimelockState.ts +5 -4
- package/src/hooks/pol/useBgtUnstakedBalance.ts +2 -1
- package/src/hooks/pol/useOnChainRewardVault.ts +2 -1
- package/src/hooks/pol/useRewardVaultBalanceFromStakingToken.ts +2 -1
- package/src/hooks/pol/useRewardVaultFromToken.ts +2 -1
- package/src/hooks/pol/useStakedData.ts +169 -92
- package/src/hooks/validators/useOnChainValidator.ts +4 -3
- package/src/types/pol.d.ts +1 -0
- package/dist/chunk-3YXSUBA5.mjs +0 -2
- package/dist/chunk-A4UDYSB6.mjs +0 -4
- package/dist/chunk-A4UDYSB6.mjs.map +0 -1
- package/dist/chunk-CYKCYPFR.cjs +0 -2
- package/dist/chunk-CYKCYPFR.cjs.map +0 -1
- package/dist/chunk-ECRMUMTA.mjs +0 -2
- package/dist/chunk-ECRMUMTA.mjs.map +0 -1
- package/dist/chunk-F4BKSBEM.mjs +0 -2
- package/dist/chunk-F4BKSBEM.mjs.map +0 -1
- package/dist/chunk-FL2N3XHK.cjs +0 -2
- package/dist/chunk-FL2N3XHK.cjs.map +0 -1
- package/dist/chunk-MUCEYO3E.cjs +0 -4
- package/dist/chunk-MUCEYO3E.cjs.map +0 -1
- package/dist/chunk-P2Q7CMUD.cjs +0 -2
- package/dist/chunk-P2Q7CMUD.cjs.map +0 -1
- package/dist/chunk-PKXAW6MO.cjs +0 -2
- package/dist/chunk-Q3SCM6WL.mjs +0 -2
- package/dist/chunk-Q3SCM6WL.mjs.map +0 -1
- package/dist/chunk-TEBJWAVU.mjs +0 -2
- package/dist/chunk-TEBJWAVU.mjs.map +0 -1
- package/dist/chunk-VP7XUOSI.cjs +0 -2
- package/dist/chunk-VP7XUOSI.cjs.map +0 -1
- package/dist/pythWrapper-CBjsmmsK.d.cts +0 -1958
- package/dist/pythWrapper-CBjsmmsK.d.ts +0 -1958
- package/src/abi/bend/metaMorpho.ts +0 -2584
- package/src/abi/bend/morpho.ts +0 -444
- package/src/abi/bex/aggregatorsRouter.ts +0 -492
- package/src/abi/bex/balancerComposableStablePoolFactoryV6.ts +0 -283
- package/src/abi/bex/balancerPoolCreationHelper.ts +0 -267
- package/src/abi/bex/balancerVault.ts +0 -757
- package/src/abi/governance/governance.ts +0 -1016
- package/src/abi/governance/governanceTimelock.ts +0 -589
- package/src/abi/honey/collateralVault.ts +0 -1144
- package/src/abi/honey/honey.ts +0 -563
- package/src/abi/honey/honeyFactory.ts +0 -1270
- package/src/abi/honey/honeyFactoryReader.ts +0 -894
- package/src/abi/honey/honeyRootOracle.ts +0 -492
- package/src/abi/honey/pythPriceOracle.ts +0 -619
- package/src/abi/honey/pythWrapper.ts +0 -446
- package/src/abi/pol/LSTStakerVault.ts +0 -2032
- package/src/abi/pol/beaconDeposit.ts +0 -595
- package/src/abi/pol/beraChef.ts +0 -1019
- package/src/abi/pol/bgt.ts +0 -1008
- package/src/abi/pol/bgtIncentiveDistributor.ts +0 -640
- package/src/abi/pol/bgtStaker.ts +0 -1034
- package/src/abi/pol/rewardAllocationFactory.ts +0 -408
- package/src/abi/pol/rewardVault.ts +0 -1928
- package/src/abi/pol/rewardVaultFactory.ts +0 -586
- package/src/abi/pol/rewardVaultHelper.ts +0 -882
- package/src/abi/pol/stakeBeraVault.ts +0 -1116
- package/src/abi/pol/stakeBeraVaultWithdrawalRequest.ts +0 -618
- package/src/abi/pol/wbera.ts +0 -366
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/liammcaweeney/Work/bera/monobera/packages/berajs/dist/hooks/exports.cjs","../../src/hooks/bend/useGetConvertToAssets.ts","../../src/hooks/dex/useAggregatorsQuotes.ts","../../src/actions/dex/aggregators/bex.ts","../../src/actions/dex/aggregators/bgt.ts","../../src/actions/dex/aggregators/enso/enso.ts","../../src/hooks/dex/useLiquidityMismatch.ts","../../src/hooks/tokens/useTokenCurrentPrices.ts"],"names":["useGetConvertToAssets","sharesAmount","vaultAddress","vaultChainId","options","publicClient","usePublicClient","swrResponse","useSWR","_","assertPublicClient","getConvertToAssets","DEFAULT_DEADLINE","STALE_PRICE_THRESHOLD","swapKind","SwapKind","BexAggregator","BaseAggregator","ChainId","getUriFromLink","address","isToken","priceImpact","onChainAmount","sorPaths","sorAmount","queryData","deltaFromSorAmount","formatEther","error","BeraError","p","BeraMonitoring","args","balancerApi","BalancerApi","tokenIn","tokenOut","amount","slippage","account","zeroAddress","wberaIsBera","tokenInV3","Token","tokenOutV3","tokenAmount","TokenAmount","RequestError","swap","Swap","queryOutput","callData","Slippage","params","functionName","decodeFunctionData","balancerVaultAbi","bex","RedeemBgtAggregator","beraToken","InvalidArgumentError","bgtRedeem","EnsoAggregator","aggregatorsFeeBps","proxyAggregatorsThroughVercel","rewardVault","tokenInAddress","tokenOutAddress","isTokenInNative","isTokenOutNative","inputAmountAfterFees"],"mappings":"AAAA,wnDAAiE,yDAAspB,yDAAgG,yDAAwE,yDAAkD,iCAA8B,iCAA8B,iCAA8B,iCAA8B,yDAA2C,yDAAgF,yDAAmD,yDAAkF,iCAA8B,yDAAgE,yD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BAAA,CAA6B,CAC3B,qCAAA,CACA,qCAAA,CACA,yDAAA,CACA,qBACF,EAAA,MAEM,QAAA,CAAS,CACb,OAAA,CAAAkB,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,MAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CAAAA,CAAUC,iBAAAA,CACV,iBAAA,CAAAuB,CAAAA,CACA,6BAAA,CAAAC,CAAAA,CAAgC,CAAA,CAAA,CAChC,WAAA,CAAAC,CACF,CAAA,CAAkD,CAChD,IAAA,CAAK,kBAAA,CAAmB,CAAE,OAAA,CAAA9B,CAAAA,CAAS,QAAA,CAAAC,CAAS,CAAC,CAAA,CAE7C,GAAM,CACJ,cAAA,CAAA8B,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CACA,gBAAA,CAAAC,CACF,CAAA,CAAI,IAAA,CAAK,cAAA,CAAelC,CAAAA,CAAQ,OAAA,CAASC,CAAAA,CAAS,OAAO,CAAA,CAEnDkC,CAAAA,CAAuB,IAAA,CAAK,kBAAA,CAChCjC,CAAAA,CACA0B,CACF,CAAA,CAEA,IAAA,CAAK,GAAA,CAAMC,CAAAA,CACP,kCAAA,CACA,CAAA,EAAA;ACuHS,gEAAA;ACnKjB,mFAAA","file":"/Users/liammcaweeney/Work/bera/monobera/packages/berajs/dist/hooks/exports.cjs","sourcesContent":[null,"import useSWR from \"swr\";\n\nimport { usePublicClient } from \"@berachain/wagmi/hooks\";\n\nimport type { GetConvertToAssetsProps } from \"~/actions/bend/getConvertToAssets\";\nimport { getConvertToAssets } from \"~/actions/bend/getConvertToAssets\";\nimport { assertPublicClient } from \"~/errors/assert\";\nimport type { DefaultHookOptions } from \"~/types/global\";\n\nexport const useGetConvertToAssets = (\n {\n sharesAmount,\n vaultAddress,\n vaultChainId,\n }: Omit<GetConvertToAssetsProps, \"publicClient\"> & { vaultChainId?: number },\n options?: DefaultHookOptions,\n) => {\n const publicClient = usePublicClient({ chainId: vaultChainId });\n const swrResponse = useSWR(\n publicClient && sharesAmount && vaultAddress\n ? [\"useGetConvertToAssets\", sharesAmount, vaultAddress, vaultChainId]\n : null,\n async ([_, sharesAmount, vaultAddress]) => {\n assertPublicClient(publicClient);\n\n return getConvertToAssets({\n sharesAmount,\n vaultAddress,\n publicClient,\n });\n },\n {\n ...options?.opts,\n },\n );\n\n return {\n ...swrResponse,\n refresh: () => {\n swrResponse.mutate();\n },\n };\n};\n","import { useMemo } from \"react\";\nimport { type Address, zeroAddress } from \"viem\";\n\nimport { defaultChainId } from \"@berachain/config/internal\";\n\nimport { useBeraWallet, usePublicClient } from \"@berachain/wagmi/hooks\";\n\nimport { bex } from \"~/actions/dex/aggregators/bex\";\nimport { bgtRedeem } from \"~/actions/dex/aggregators/bgt\";\nimport { enso } from \"~/actions/dex/aggregators/enso/enso\";\nimport { erc4626Deposit } from \"~/actions/dex/aggregators/erc4626\";\nimport { fly } from \"~/actions/dex/aggregators/fly\";\nimport { haiku } from \"~/actions/dex/aggregators/haiku\";\nimport { honeyNative } from \"~/actions/dex/aggregators/honey\";\nimport { kyberswap } from \"~/actions/dex/aggregators/kyberswap\";\nimport { oogabooga } from \"~/actions/dex/aggregators/oogabooga\";\nimport { openOcean } from \"~/actions/dex/aggregators/openOcean\";\nimport { wberaSwap } from \"~/actions/dex/aggregators/wbera\";\nimport { useBeraFlag } from \"~/contexts/BeraFlags/BeraFlags\";\nimport type { HoneyConfigContextReturn } from \"~/contexts/HoneyConfigProvider\";\nimport type { SwapReferrer } from \"~/enum/dex\";\nimport { useAggregatorsRouterFeeBps } from \"~/hooks/dex/useAggregatorsRouterFeeBps\";\nimport type { IRawAggregatorQuote, MinimalERC20 } from \"~/types/dex\";\nimport type { DefaultHookOptions } from \"~/types/global\";\nimport { parseBaseArgs } from \"~/utils/parseBaseArgs\";\nimport { isToken } from \"~/utils/tokens\";\nimport { useUnderlyingAsset } from \"../tokens/useUnderlyingAsset\";\nimport { useBexStatus } from \"./useBexStatus\";\nimport {\n getAggregatorsSWROptions,\n raw_useSingleAggregatorQuote,\n} from \"./useSingleAggregatorQuote\";\n\nconst AGGREGATORS = [\n oogabooga,\n fly,\n kyberswap,\n openOcean,\n haiku,\n enso,\n bex,\n honeyNative,\n erc4626Deposit,\n];\n\ntype IUseAggregatorsQuotesArgs = BeraJS.BaseFunctionArgs & {\n tokenIn: MinimalERC20;\n tokenOut: MinimalERC20;\n amount: string;\n slippage: number;\n referrer?: SwapReferrer;\n rewardVault?: Address;\n /**\n * Useful cause the collaterals are provided byt he honeyContext and this way we can\n * use the Provider only in the swap page where is needed.\n *\n * The collaterals for the honey mint/redeem aggregator.\n */\n honeyNativeState?: Pick<\n HoneyConfigContextReturn,\n \"collateralList\" | \"protocol\"\n >;\n};\n\nexport function useAggregatorsQuotes(\n args: IUseAggregatorsQuotesArgs,\n options?: DefaultHookOptions,\n) {\n const { address: account } = useBeraWallet();\n const proxyAggregatorsThroughVercel = useBeraFlag(\n \"proxyAggregatorsThroughVercel\",\n );\n const activeAggregators = useBeraFlag(\"aggregators\");\n const publicClient = usePublicClient();\n const { data: feeBps } = useAggregatorsRouterFeeBps();\n\n const isWrapOrUnwrap =\n (isToken(args.tokenIn.address, \"BERA\") ||\n isToken(args.tokenIn.address, \"WBERA\")) &&\n (isToken(args.tokenOut.address, \"BERA\") ||\n isToken(args.tokenOut.address, \"WBERA\"));\n\n const isBgtRedeem = isToken(args.tokenIn.address, \"BGT\", {\n chainId: defaultChainId,\n });\n\n const { data: underlyingToken } = useUnderlyingAsset({\n token: args.tokenOut,\n });\n\n /**\n * Whether it's a native swap (wrap/unwrap) or BGT redeem\n */\n const isNativeSwap = isWrapOrUnwrap || isBgtRedeem;\n\n const { config } = parseBaseArgs(args);\n\n const isMAEnabled = config.bex.aggregatorsRouter !== zeroAddress;\n\n const swrOptions = getAggregatorsSWROptions(options);\n\n const sharedArgs = {\n activeAggregators,\n isMAEnabled,\n underlyingToken,\n isNativeSwap,\n account,\n publicClient,\n proxyAggregatorsThroughVercel,\n feeBps,\n } as const;\n\n // we're using independent useSWRs so we can show quotes as they come\n // instead of waiting for all of them to load\n const oogaBogaResult = raw_useSingleAggregatorQuote(\n {\n ...sharedArgs,\n ...args,\n aggregator: oogabooga,\n },\n { opts: swrOptions },\n );\n\n const flyResult = raw_useSingleAggregatorQuote(\n {\n ...sharedArgs,\n ...args,\n aggregator: fly,\n },\n { opts: swrOptions },\n );\n\n const erc4626Result = raw_useSingleAggregatorQuote(\n {\n ...sharedArgs,\n ...args,\n aggregator: erc4626Deposit,\n },\n { opts: swrOptions },\n );\n\n const kyberswapResult = raw_useSingleAggregatorQuote(\n {\n ...sharedArgs,\n ...args,\n aggregator: kyberswap,\n },\n { opts: swrOptions },\n );\n\n const openOceanResult = raw_useSingleAggregatorQuote(\n {\n ...sharedArgs,\n ...args,\n aggregator: openOcean,\n },\n { opts: swrOptions },\n );\n\n const haikuResult = raw_useSingleAggregatorQuote(\n {\n ...sharedArgs,\n ...args,\n aggregator: haiku,\n },\n { opts: swrOptions },\n );\n\n const ensoResult = raw_useSingleAggregatorQuote(\n {\n ...sharedArgs,\n ...args,\n aggregator: enso,\n },\n { opts: swrOptions },\n );\n\n const { protocol: bexProtocol } = useBexStatus();\n\n const bexResult = raw_useSingleAggregatorQuote(\n {\n ...sharedArgs,\n ...args,\n aggregator: bex,\n },\n { opts: { ...swrOptions, isEnabled: bexProtocol.isPaused === false } },\n );\n\n const wberaSwapResult = raw_useSingleAggregatorQuote({\n ...sharedArgs,\n ...args,\n aggregator: wberaSwap,\n });\n\n const bgtRedeemResult = raw_useSingleAggregatorQuote(\n {\n ...sharedArgs,\n ...args,\n aggregator: bgtRedeem,\n },\n { opts: swrOptions },\n );\n\n const honeyResult = raw_useSingleAggregatorQuote(\n {\n ...sharedArgs,\n ...args,\n aggregator: honeyNative,\n },\n { opts: swrOptions },\n );\n\n const results = isWrapOrUnwrap\n ? [wberaSwapResult]\n : isBgtRedeem\n ? [bgtRedeemResult]\n : [\n oogaBogaResult,\n erc4626Result,\n flyResult,\n kyberswapResult,\n openOceanResult,\n haikuResult,\n ensoResult,\n honeyResult,\n bexProtocol.isPaused === false ? bexResult : null,\n ].filter((i): i is NonNullable<typeof i> => i !== null);\n\n const data = useMemo(() => {\n const error = results.reduce<(typeof results)[number][\"error\"]>(\n (error, result) => error || result.error,\n undefined,\n );\n\n const loadingAggregatorsNames = results\n .map((r, i) =>\n r.isLoading\n ? isNativeSwap\n ? wberaSwap.name\n : AGGREGATORS[i].name\n : null,\n )\n .filter(Boolean);\n\n const quotes = results\n .filter(\n (result) =>\n result !== undefined &&\n !result.isLoading &&\n !result.error &&\n result.data?.amountOut,\n )\n .map(({ data }) => data) as IRawAggregatorQuote[];\n\n const isLoading = quotes.length === 0 && loadingAggregatorsNames.length > 0;\n return { quotes, loadingAggregatorsNames, isLoading, error };\n }, [results]);\n\n return {\n ...data,\n refresh: () => results.map((r) => r.mutate()),\n };\n}\n","import {\n type Address,\n Slippage,\n type SorSwapResult,\n Swap,\n SwapKind,\n Token,\n TokenAmount,\n} from \"@berachain-foundation/berancer-sdk\";\nimport { decodeFunctionData, formatEther, zeroAddress } from \"viem\";\n\nimport { getUriFromLink } from \"@berachain/config\";\nimport { ChainId } from \"@berachain/config/internal\";\n\nimport { balancerVaultAbi } from \"~/abi/bex/balancerVault\";\nimport { BalancerApi } from \"~/actions/dex/b-sdk\";\nimport { Aggregators } from \"~/enum/dex\";\nimport { assertPublicClient } from \"~/errors/assert\";\nimport { BeraError } from \"~/errors/BeraError\";\nimport { BeraMonitoring } from \"~/errors/BeraMonitoring\";\nimport { RequestError } from \"~/errors/RequestError\";\nimport type { IAggregatorArgs, IRawAggregatorQuote } from \"~/types/dex\";\nimport { isToken } from \"~/utils/tokens\";\nimport { BaseAggregator } from \"./base\";\n\n// Constants\nconst DEFAULT_DEADLINE = 60 * 5; // default transaction deadline in seconds\nconst STALE_PRICE_THRESHOLD = 0.05; // 5% threshold for stale prices\nconst swapKind = SwapKind.GivenIn;\n\nclass BexAggregator extends BaseAggregator {\n name = Aggregators.HubPools;\n supportedChains = [ChainId.MAINNET, ChainId.BEPOLIA];\n readonly url = getUriFromLink(this.config.api);\n readonly type = \"graphql\";\n\n /**\n * Helper function to convert zero address to wrapped token address\n */\n private convertZeroToWrapped(address: Address): Address {\n return isToken(address, \"BERA\") ? this.config.tokens.wbera : address;\n }\n\n /**\n * Helper to calculate price impact percentage\n */\n private calculatePriceImpact(priceImpact: {\n error: string | null;\n priceImpact?: string;\n }): number {\n if (priceImpact.error) {\n console.error(\"Swap price impact error\", priceImpact);\n return 0;\n }\n\n return Number(priceImpact.priceImpact);\n }\n\n /**\n * Helper to check for stale SOR prices\n */\n private checkStalePrices({\n onChainAmount,\n sorPaths,\n sorAmount,\n queryData,\n }: {\n onChainAmount: TokenAmount;\n sorPaths: { pools: string[] }[];\n sorAmount: string;\n queryData: IAggregatorArgs;\n }): void {\n // Check for stale prices\n const deltaFromSorAmount =\n Number.parseFloat(formatEther(onChainAmount.scale18)) /\n Number.parseFloat(sorAmount);\n\n if (Math.abs(1 - deltaFromSorAmount) > STALE_PRICE_THRESHOLD) {\n console.warn(\n \"SOR returned stale prices. Delta from return amount is more than 5%\",\n {\n deltaFromSorAmount,\n },\n );\n\n const error = new BeraError({\n reason: \"SOR_STALE_PRICES\",\n level: \"warning\",\n message:\n \"SOR returned stale prices. Delta from return amount is more than 5%\",\n extra: {\n deltaFromSorAmount,\n pools: sorPaths.map((p) => p.pools),\n onChainAmount: formatEther(onChainAmount.scale18),\n sorAmount,\n queryData,\n },\n fingerprint: [\"SOR_STALE_PRICES\"],\n });\n BeraMonitoring.captureException(error);\n }\n }\n\n async getQuote(args: IAggregatorArgs): Promise<IRawAggregatorQuote> {\n const balancerApi = new BalancerApi(\n this.url,\n // @ts-expect-error b-sdk has more chains than berajs\n this.chainId,\n );\n const {\n tokenIn,\n tokenOut,\n amount,\n slippage,\n account = zeroAddress,\n publicClient,\n } = args;\n this.assertChainSupport({ tokenIn, tokenOut });\n\n assertPublicClient(publicClient);\n\n const wberaIsBera = isToken(tokenIn, \"BERA\") || isToken(tokenOut, \"BERA\");\n\n // Initialize tokens\n const tokenInV3 = new Token(\n this.chainId,\n this.convertZeroToWrapped(tokenIn.address),\n tokenIn.decimals,\n );\n const tokenOutV3 = new Token(\n this.chainId,\n this.convertZeroToWrapped(tokenOut.address),\n tokenOut.decimals,\n );\n\n const tokenAmount = TokenAmount.fromRawAmount(\n tokenInV3,\n amount as `${number}`,\n );\n\n // swap paths\n const {\n paths: sorPaths,\n priceImpact,\n returnAmount: sorAmount,\n }: SorSwapResult = await balancerApi.sorSwapPaths.fetchSorSwapPaths({\n // @ts-expect-error b-sdk has more chains than berajs\n chainId: this.chainId,\n tokenIn: tokenInV3.address,\n tokenOut: tokenOutV3.address,\n swapKind,\n swapAmount: tokenAmount,\n });\n\n if (!sorPaths?.length) {\n throw new RequestError({\n response: undefined,\n endpoint: {\n url: this.url,\n name: this.name,\n type: this.type,\n },\n reason: BaseAggregator.PATH_NOT_FOUND_REASON,\n chainId: this.chainId,\n payload: {\n tokenIn: tokenInV3.address,\n tokenOut: tokenOutV3.address,\n swapKind,\n swapAmount: tokenAmount,\n },\n message: `No swap paths returned from Balancer API`,\n });\n }\n\n // execute swap query\n const swap = new Swap({\n chainId: this.chainId,\n paths: sorPaths,\n swapKind,\n userData: \"0x\" as `0x${string}`,\n });\n const queryOutput = await swap.query(publicClient.transport.url);\n\n if (!(\"expectedAmountOut\" in queryOutput)) {\n throw new Error(\"No Bex paths found\");\n }\n\n this.checkStalePrices({\n onChainAmount: queryOutput.expectedAmountOut,\n sorPaths,\n sorAmount,\n queryData: args,\n });\n\n // format quote response\n return {\n amountOut: queryOutput.expectedAmountOut.amount.toString(),\n amountIn: amount,\n allowanceRequirements: this.parseAllowanceRequirements({\n tokenIn,\n rawAmount: amount,\n spender: queryOutput.to,\n }),\n name: this.name,\n priceImpactPercentage: this.calculatePriceImpact(priceImpact),\n swapFeeBps: 0,\n getCalldata: ({ account }) => {\n // generate user transaction data\n const callData = swap.buildCall({\n slippage: Slippage.fromPercentage(slippage.toString() as `${number}`),\n deadline: BigInt(Math.round(Date.now() / 1000) + DEFAULT_DEADLINE),\n queryOutput,\n sender: account as Address,\n recipient: account as Address,\n wethIsEth: wberaIsBera,\n });\n\n const { args: params, functionName } = decodeFunctionData({\n abi: balancerVaultAbi,\n data: callData.callData,\n });\n\n return {\n params,\n functionName,\n abi: balancerVaultAbi,\n address: callData.to,\n value: callData.value || BigInt(0),\n };\n },\n };\n }\n}\n\nexport const bex = new BexAggregator();\n","import { ChainId } from \"@berachain/config/internal\";\n\nimport { Aggregators } from \"~/enum/dex\";\nimport { InvalidArgumentError } from \"~/errors/InvalidArgumentError\";\nimport type {\n IAggregatorArgs,\n IRawAggregatorQuote,\n MinimalERC20,\n} from \"~/types/dex\";\nimport { beraToken, isToken } from \"~/utils/tokens\";\nimport { BaseAggregator } from \"./base\";\n\nclass RedeemBgtAggregator extends BaseAggregator {\n name = Aggregators.RedeemBgt;\n supportedChains = [ChainId.MAINNET, ChainId.BEPOLIA];\n readonly type = \"rpc\";\n\n checkChainSupport({\n tokenIn,\n tokenOut,\n }: {\n tokenIn: MinimalERC20;\n tokenOut: MinimalERC20;\n }): boolean {\n if (!super.checkChainSupport({ tokenIn, tokenOut })) {\n return false;\n }\n\n return (\n // only supported on same chain\n tokenIn.chainId === tokenOut.chainId &&\n isToken(tokenIn, \"BGT\", { chainId: tokenIn.chainId }) &&\n isToken(tokenOut, \"BERA\")\n );\n }\n // handles native swaps: wrap and unwrap\n async getQuote({\n tokenIn,\n amount,\n }: Omit<\n IAggregatorArgs,\n \"slippage\" | \"feeBps\" | \"tokenOut\" | \"account\"\n >): Promise<IRawAggregatorQuote> {\n this.assertChainSupport({\n tokenIn,\n tokenOut: { ...beraToken, chainId: tokenIn.chainId },\n });\n\n if (!isToken(tokenIn, \"BGT\", { config: this.config })) {\n throw new InvalidArgumentError({\n property: \"tokenIn\",\n value: tokenIn,\n expected: \"BGT\",\n level: \"warning\",\n });\n }\n\n return {\n amountOut: amount,\n amountIn: amount,\n allowanceRequirements: [],\n name: Aggregators.RedeemBgt,\n isNativeSwap: true,\n swapFeeBps: 0,\n // not adding calldata here because it depends on the connected wallet\n // bgt redeem requires a receiver address\n // moreover this is a sensitive operation, better be sure of what data is being sent\n // by controlling it on the consumer side\n } as const;\n }\n}\n\nexport const bgtRedeem = new RedeemBgtAggregator();\n","import { zeroAddress } from \"viem\";\n\nimport { ChainId } from \"@berachain/config/internal\";\n\nimport { aggregatorsRouterAbi } from \"~/abi/bex/aggregatorsRouter\";\nimport { Aggregators } from \"~/enum/dex\";\nimport type { IAggregatorArgs, IRawAggregatorQuote } from \"~/types/dex\";\nimport { BaseAggregator } from \"../base\";\n\nexport class EnsoAggregator extends BaseAggregator {\n name = Aggregators.Enso;\n supportedChains = [ChainId.MAINNET];\n readonly type = \"rest\";\n needsAccountForQuote = true;\n\n notFoundMessages: string[] = [\n \"Could not build shortcuts for route\",\n \"Could not quote shortcuts for route\",\n \"Swap not found for a required underlying of defi route,\",\n \"No route found from\",\n ];\n\n async getQuote({\n tokenIn,\n tokenOut,\n amount,\n slippage,\n account = zeroAddress,\n aggregatorsFeeBps,\n proxyAggregatorsThroughVercel = false,\n rewardVault,\n }: IAggregatorArgs): Promise<IRawAggregatorQuote> {\n this.assertChainSupport({ tokenIn, tokenOut });\n\n const {\n tokenInAddress,\n tokenOutAddress,\n isTokenInNative,\n isTokenOutNative,\n } = this.parseAddresses(tokenIn.address, tokenOut.address);\n\n const inputAmountAfterFees = this.getAmountAfterFees(\n amount,\n aggregatorsFeeBps,\n );\n\n this.url = proxyAggregatorsThroughVercel\n ? `/api/aggregators?aggregator=enso`\n : `${this.config.bex.aggregatorsProxyUrl}/enso/api/v1/shortcuts/route?`;\n\n const url = new URL(this.url);\n url.searchParams.set(\n \"fromAddress\",\n this.config.bex.aggregatorsRouterExecutor,\n );\n url.searchParams.set(\"receiver\", this.config.bex.aggregatorsRouterExecutor);\n url.searchParams.set(\"spender\", this.config.bex.aggregatorsRouterExecutor);\n url.searchParams.set(\"amountIn\", inputAmountAfterFees);\n url.searchParams.set(\"tokenIn\", tokenInAddress);\n url.searchParams.set(\"tokenOut\", tokenOutAddress);\n url.searchParams.set(\"chainId\", ChainId.MAINNET.toString());\n url.searchParams.set(\"slippage\", (Number(slippage) * 100).toString());\n url.searchParams.set(\"refundReceiver\", account);\n\n const response = await this.fetch(url);\n\n const quote = await response.json();\n\n const inputData = this.getInputData({\n tokenIn: tokenInAddress,\n amountIn: amount,\n isNative: isTokenInNative,\n });\n\n const outputData = {\n tokenOut: tokenOutAddress,\n receiver: account,\n minAmountOut: this.getMinAmountOut(quote.amountOut.toString(), slippage),\n isNative: isTokenOutNative,\n };\n\n const aggregatorData = {\n aggregator: quote.tx?.to,\n data: quote.tx?.data,\n };\n\n return {\n amountOut: quote.amountOut.toString(),\n amountIn: amount,\n allowanceRequirements: this.parseAllowanceRequirements({\n tokenIn,\n rawAmount: amount,\n spender: this.config.bex.aggregatorsRouter,\n }),\n name: this.name,\n swapFeeBps: aggregatorsFeeBps!,\n getCalldata: () => ({\n params: [\n inputData,\n outputData,\n aggregatorData,\n {\n rewardVault: rewardVault ?? zeroAddress,\n isSwapAndStake: !!rewardVault,\n },\n ],\n functionName: \"swap\",\n abi: aggregatorsRouterAbi,\n // send full amount to router first, which will deduct the swap fee before executing trade\n value: isTokenInNative ? BigInt(amount) : BigInt(\"0\"),\n address: this.config.bex.aggregatorsRouter,\n }),\n };\n }\n}\n\nexport const enso = new EnsoAggregator();\n","import { useEffect, useState } from \"react\";\nimport { PoolType } from \"@berachain-foundation/berancer-sdk\";\n\nimport { PoolCreationStep } from \"~/enum/dex\";\nimport type { TokenCurrentPriceMap, TokenWithAmount } from \"~/types/dex\";\nimport { wrapNativeTokens } from \"~/utils/tokenWrapping\";\nimport { type Oracle, OracleMode } from \"./useCreatePool\";\n\nconst DEFAULT_LIQUIDITY_MISMATCH_TOLERANCE_PERCENT = 0.05; // 5%\n\nexport type LiquidityMismatchInfo = {\n title: string | null;\n message: string | null;\n suggestWeighted?: boolean;\n};\n\ninterface UseLiquidityMismatchParams {\n currentStep: PoolCreationStep;\n tokenPrices?: TokenCurrentPriceMap;\n isLoadingTokenPrices: boolean;\n tokens: TokenWithAmount[] | null;\n weights: bigint[] | null;\n weightsError: string | null;\n poolType: PoolType;\n liquidityMismatchTolerancePercent?: number;\n oracles: Oracle[];\n}\n\n/**\n * Hook for detecting liquidity mismatches.\n *\n * @param {PoolCreationStep} currentStep - The current step of the pool creation process.\n * @param {Record<string, number>} tokenPrices - The current token prices.\n * @param {boolean} isLoadingTokenPrices - Whether the token prices are still loading.\n * @param {Array<{ address: string, amount: number }>} tokens - The tokens in the pool, including their addresses and amounts.\n * @param {Record<string, number>} weights - The per-token weights in the pool we are creating.\n * @param {string | null} weightsError - An error message for the weights indicating that the weights are invalid.\n * @param {string} poolType - The type of pool being created.\n * @param {number} liquidityMismatchTolerancePercent - The tolerance for liquidity mismatches in percent.\n * @returns {Object} The liquidity mismatch info.\n */\nexport const useLiquidityMismatch = ({\n currentStep,\n tokenPrices,\n isLoadingTokenPrices,\n tokens,\n weights,\n weightsError,\n poolType,\n liquidityMismatchTolerancePercent = DEFAULT_LIQUIDITY_MISMATCH_TOLERANCE_PERCENT,\n oracles,\n}: UseLiquidityMismatchParams): LiquidityMismatchInfo => {\n // NOTE: would be nice to use Maps/Records more in here, as the zipping/unzipping is cumbersome.\n // NOTE: if we pull in string literal for currentStep things would also be a bit clearer in here.\n const [liquidityMismatchInfo, setLiquidityMismatchInfo] =\n useState<LiquidityMismatchInfo>({ title: null, message: null });\n\n useEffect(() => {\n // If we are either using custom rate-providing oracles or have incorrect/loading token prices, we cant do validation.\n if (\n !tokenPrices ||\n isLoadingTokenPrices ||\n !tokens ||\n !weights ||\n weightsError ||\n tokens.some((token) => !token.address) ||\n oracles.some((oracle) => oracle.mode === OracleMode.Custom) // Oracles give prices on their own, we dont support that here yet.\n ) {\n setLiquidityMismatchInfo({ title: null, message: null });\n return;\n }\n\n // Calculate some basic metrics we'll use to determine per-token contributions and model potential losses from arbitrage.\n let totalLiquidityUSD = 0;\n const tokenUSDAmounts: number[] = [];\n const numTokens = tokens.length;\n const wrappedTokens = wrapNativeTokens(tokens);\n const tokenUSDPrices = wrappedTokens.map((token) => {\n const tokenPriceUSD =\n tokenPrices[token.address.toLowerCase()]?.price ?? 0;\n if (!tokenPriceUSD || tokenPriceUSD === 0) {\n tokenUSDAmounts.push(0);\n return null;\n }\n const tokenAmountUSD = tokenPriceUSD * Number.parseFloat(token.amount);\n tokenUSDAmounts.push(tokenAmountUSD);\n totalLiquidityUSD += tokenAmountUSD;\n return tokenPriceUSD;\n });\n\n // Doesn't matter what step it is, if we have missing token prices for tokens we have selected, we cant issue a real warning.\n if (\n tokenUSDPrices.some((price) => price === null) ||\n tokenUSDPrices.length !== numTokens\n ) {\n setLiquidityMismatchInfo({\n title: \"Missing token price data\",\n message: `One or more token(s) do not have valid market price data. Please verify that token market prices align with the pool\n weightings and your initial liquidity amounts.`,\n });\n return;\n }\n\n // Step 1 - During token selection we check for a deviation in the quote prices of the tokens selected (for stable pools).\n if (\n currentStep === PoolCreationStep.SELECT_TOKENS &&\n poolType === PoolType.ComposableStable\n ) {\n const normalizedUSDPrices = tokenUSDPrices.map(\n (priceUSD) => priceUSD! / tokenUSDPrices[0]!, // always normalize on the first token's price\n );\n const maxDifference =\n Math.max(...normalizedUSDPrices) - Math.min(...normalizedUSDPrices);\n\n if (maxDifference > liquidityMismatchTolerancePercent) {\n setLiquidityMismatchInfo({\n title: \"Selected tokens have a significant price deviation\",\n message: \"Did you mean to create a Weighted pool instead?\",\n suggestWeighted: true,\n });\n } else {\n setLiquidityMismatchInfo({ title: null, message: null });\n }\n\n return;\n }\n\n // Validation During Liquidity Input and onwards.\n if (\n totalLiquidityUSD === 0 ||\n tokenUSDAmounts.some((value) => value === 0)\n ) {\n // User has not yet entered fully their liquidity values, so return early.\n setLiquidityMismatchInfo({ title: null, message: null });\n return;\n }\n\n // Simulate arbitrage for the pool to determine potential losses from arbitrageurs.\n // NOTE: we assume shortfalls and excesses are losses, but in reality the actual losses would be more complex to realise.\n // Balancer does this similarily https://github.com/balancer/frontend-v2/blob/8563b8d33b6bff266148bd48d7ebc89f921374f4/src/components/cards/CreatePool/InitialLiquidity.vue#L75\n let totalLossUSD = 0;\n if (poolType === PoolType.ComposableStable) {\n const expectedPerTokenLiquidityUSD = totalLiquidityUSD / numTokens;\n tokenUSDAmounts.forEach((value) => {\n totalLossUSD += Math.abs(expectedPerTokenLiquidityUSD - value);\n });\n } else if (poolType === PoolType.Weighted) {\n tokenUSDAmounts.forEach((value, index) => {\n const weightProportion = Number(weights[index]) / 1e18;\n const expectedValueUSD = totalLiquidityUSD * weightProportion;\n totalLossUSD += Math.abs(expectedValueUSD - value);\n });\n }\n\n // We'll show a total loss if it's 90% or more\n const isTotalLoss = totalLossUSD >= totalLiquidityUSD * 0.9;\n totalLossUSD = Math.min(totalLossUSD, totalLiquidityUSD);\n const totalLossPercentage = totalLossUSD / totalLiquidityUSD;\n\n if (totalLossPercentage > liquidityMismatchTolerancePercent) {\n setLiquidityMismatchInfo({\n // If it's a total loss we dont display a percentage\n title: isTotalLoss\n ? \"You could lose all of your initial liquidity\"\n : `You could lose $${totalLossUSD.toFixed(2)} (~${(\n totalLossPercentage * 100\n ).toFixed(2)}%)`,\n message: `Based on the market token prices, the value of tokens does not align with the specified pool weights. \n This discrepancy could expose you to potential losses from arbitrageurs. ${\n poolType === PoolType.ComposableStable\n ? \"Did you mean to create a Weighted pool instead?\"\n : \"\"\n }`,\n suggestWeighted: poolType === PoolType.ComposableStable,\n });\n } else {\n // All good bb bb\n setLiquidityMismatchInfo({ title: null, message: null });\n }\n }, [\n currentStep,\n tokenPrices,\n isLoadingTokenPrices,\n tokens,\n weights,\n weightsError,\n poolType,\n liquidityMismatchTolerancePercent,\n oracles,\n ]);\n return liquidityMismatchInfo;\n};\n","import { useMemo } from \"react\";\nimport useSWR from \"swr\";\nimport { type Address, isAddress, zeroAddress } from \"viem\";\n\nimport { defaultChainId } from \"@berachain/config/internal\";\n\nimport { getTokenCurrentPrices } from \"~/actions/prices/getTokenCurrentPrices\";\nimport { POLLING } from \"~/enum/polling\";\nimport { useTokens } from \"~/hooks/tokens/useTokens\";\nimport type { TokenCurrentPriceMap, TokenWithPrice } from \"~/types/dex\";\nimport type { DefaultHookOptions } from \"~/types/global\";\nimport { isToken } from \"~/utils/tokens\";\n\n/**\n * @deprecated use useTokenPrices instead that supports multichain tokens\n */\nexport function useTokenCurrentPrices(\n {\n addressIn,\n }: {\n addressIn?: string[] | readonly string[];\n } = {},\n options: DefaultHookOptions = {\n opts: {\n refreshInterval: POLLING.NORMAL,\n revalidateOnFocus: true,\n },\n },\n) {\n const { tokenList, ensoTokens } = useTokens();\n\n /**\n * Berachain or Bepolia Tokens. All tokens from other chains are excluded since API doesn't price them.\n */\n const beraAddresses = useMemo<Address[]>(() => {\n const addresses: Address[] = [];\n\n if (addressIn) {\n addresses.push(\n ...(addressIn.filter((a): a is Address => isAddress(a)) as Address[]),\n );\n }\n return addresses.map((a) => a.toLowerCase() as Address);\n }, [tokenList]);\n\n const hasAddressesNotInTokenList = useMemo(() => {\n const tokenSet = new Set(\n tokenList?.map((token) => token.address.toLowerCase() as Address),\n );\n // Native BERA (zero address) is priced via WBERA in getTokenCurrentPrices.\n // Treat zero address as \"known\" whenever WBERA exists in token list.\n if (tokenList.some((token) => isToken(token, \"WBERA\"))) {\n tokenSet.add(zeroAddress);\n }\n\n return beraAddresses?.some((a) => !tokenSet.has(a));\n }, [beraAddresses, tokenList]);\n\n /**\n * If no addressIn is provided, use default token list\n * If all addressIn are in the token list, use default token list\n * If some addressIn are not in the token list, use addressIn\n */\n const addresses = hasAddressesNotInTokenList\n ? beraAddresses\n : tokenList.map((token) => token.address);\n\n const QUERY_KEY =\n addresses && (options.opts?.isEnabled ?? true)\n ? ([\n \"useTokenCurrentPrices\",\n addresses.map((a) => a.toLowerCase() as Address),\n ] as const)\n : null;\n\n const apiResponse = useSWR(\n QUERY_KEY,\n async ([, addresses]) => {\n // this only works for Berachain tokens\n return getTokenCurrentPrices({ addressIn: addresses });\n },\n options.opts,\n );\n\n const ensoMatchingPrices = useMemo<TokenCurrentPriceMap>(() => {\n if (!ensoTokens) return {};\n\n const ensoPricesMap = new Map<number, Map<Address, TokenWithPrice>>([\n [defaultChainId, new Map()],\n ]);\n\n for (const token of ensoTokens) {\n if (token.price === undefined || token.chainId !== defaultChainId)\n continue;\n\n ensoPricesMap\n .get(defaultChainId)\n ?.set(token.address.toLowerCase() as Address, {\n ...token,\n price: token.price,\n chainId: defaultChainId,\n });\n }\n\n return Object.fromEntries(\n addresses.map((address) => {\n const price = ensoPricesMap.get(defaultChainId)?.get(address)?.price;\n\n if (!price) return [null, null];\n\n return [\n address.toLowerCase() as Address,\n {\n price,\n chainId: defaultChainId,\n updatedAt: Date.now(),\n },\n ];\n }),\n );\n }, [ensoTokens]);\n\n const data = useMemo(\n () => ({\n ...ensoMatchingPrices,\n // in this deprecated hook, we let api override enso prices, since there's no multichain support\n ...apiResponse.data,\n }),\n [ensoMatchingPrices, apiResponse.data],\n );\n\n return {\n ...apiResponse,\n data,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/Users/liammcaweeney/Work/bera/monobera/packages/berajs/dist/hooks/exports.cjs","../../src/hooks/bend/useGetConvertToAssets.ts","../../src/hooks/dex/useAggregatorsQuotes.ts","../../src/actions/dex/aggregators/bex.ts","../../src/actions/dex/aggregators/bgt.ts","../../src/actions/dex/aggregators/enso/enso.ts","../../src/hooks/dex/useLiquidityMismatch.ts","../../src/hooks/tokens/useMultipleTokenInformation.ts"],"names":["useGetConvertToAssets","sharesAmount","vaultAddress","vaultChainId","options","publicClient","usePublicClient","swrResponse","useSWR","_","assertPublicClient","getConvertToAssets","DEFAULT_DEADLINE","STALE_PRICE_THRESHOLD","swapKind","SwapKind","BexAggregator","BaseAggregator","ChainId","getUriFromLink","address","isToken","priceImpact","onChainAmount","sorPaths","sorAmount","queryData","deltaFromSorAmount","formatEther","error","BeraError","p","BeraMonitoring","args","balancerApi","BalancerApi","tokenIn","tokenOut","amount","slippage","account","zeroAddress","wberaIsBera","tokenInV3","Token","tokenOutV3","tokenAmount","TokenAmount","RequestError","swap","Swap","queryOutput","callData","Slippage","params","functionName","decodeFunctionData","balancerVaultAbi","bex","RedeemBgtAggregator","beraToken","InvalidArgumentError","bgtRedeem","EnsoAggregator","aggregatorsFeeBps","proxyAggregatorsThroughVercel","rewardVault","tokenInAddress","tokenOutAddress","isTokenInNative","isTokenOutNative","inputAmountAfterFees"],"mappings":"AAAA,wnDAAqpB,iCAA8B,yDAAwE,yDAAmD,iCAA8B,iCAA8B,iCAA8B,iCAA8B,yDAA2C,yDAAgF,yDAAmD,yDAA2E,iCAA8B,yDAAgE,yDAAwD,oECAlyC,+CAEa,IAOnBA,EAAAA,CAAwB,CACnC,CACE,YAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAA,CACAC,CAAAA,CAAAA,EACG,CACH,IAAMC,CAAAA,CAAeC,oCAAAA,CAAkB,OAAA,CAASH,CAAa,CAAC,CAAA,CACxDI,CAAAA,CAAcC,2BAAAA,CAClBH,EAAgBJ,CAAAA,EAAgBC,CAAAA,CAC5B,CAAC,uBAAA,CAAyBD,CAAAA,CAAcC,CAAAA,CAAcC,CAAY,CAAA,CAClE,IAAA,CACJ,KAAA,CAAO,CAACM,CAAAA,CAAGR,CAAAA,CAAcC,CAAY,CAAA,CAAA,EAAA,CACnCQ,iCAAAA,CAA+B,CAAA,CAExBC,iCAAAA,CACL,YAAA,CAAAV,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,YAAA,CAAAG,CACF,CAAC,CAAA,CAAA,CAEH,CACE,mBAAGD,CAAAA,6BAAS,MACd,CAC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,CAAAA,CAAS,OAAO,CAAA,CAEnDkC,CAAAA,CAAuB,IAAA,CAAK,kBAAA,CAChCjC,CAAAA,CACA0B,CACF,CAAA,CAEA,IAAA,CAAK,GAAA,CAAMC,CAAAA,CACP,kCAAA,CACA,CAAA,EAAA;ACsHS,gEAAA;ACtHI,mFAAA","file":"/Users/liammcaweeney/Work/bera/monobera/packages/berajs/dist/hooks/exports.cjs","sourcesContent":[null,"import useSWR from \"swr\";\n\nimport { usePublicClient } from \"@berachain/wagmi/hooks\";\n\nimport type { GetConvertToAssetsProps } from \"~/actions/bend/getConvertToAssets\";\nimport { getConvertToAssets } from \"~/actions/bend/getConvertToAssets\";\nimport { assertPublicClient } from \"~/errors/assert\";\nimport type { DefaultHookOptions } from \"~/types/global\";\n\nexport const useGetConvertToAssets = (\n {\n sharesAmount,\n vaultAddress,\n vaultChainId,\n }: Omit<GetConvertToAssetsProps, \"publicClient\"> & { vaultChainId?: number },\n options?: DefaultHookOptions,\n) => {\n const publicClient = usePublicClient({ chainId: vaultChainId });\n const swrResponse = useSWR(\n publicClient && sharesAmount && vaultAddress\n ? [\"useGetConvertToAssets\", sharesAmount, vaultAddress, vaultChainId]\n : null,\n async ([_, sharesAmount, vaultAddress]) => {\n assertPublicClient(publicClient);\n\n return getConvertToAssets({\n sharesAmount,\n vaultAddress,\n publicClient,\n });\n },\n {\n ...options?.opts,\n },\n );\n\n return {\n ...swrResponse,\n refresh: () => {\n swrResponse.mutate();\n },\n };\n};\n","import { useMemo } from \"react\";\nimport { type Address, zeroAddress } from \"viem\";\n\nimport { defaultChainId } from \"@berachain/config/internal\";\n\nimport { useBeraWallet, usePublicClient } from \"@berachain/wagmi/hooks\";\n\nimport { bex } from \"~/actions/dex/aggregators/bex\";\nimport { bgtRedeem } from \"~/actions/dex/aggregators/bgt\";\nimport { enso } from \"~/actions/dex/aggregators/enso/enso\";\nimport { erc4626Deposit } from \"~/actions/dex/aggregators/erc4626\";\nimport { fly } from \"~/actions/dex/aggregators/fly\";\nimport { haiku } from \"~/actions/dex/aggregators/haiku\";\nimport { honeyNative } from \"~/actions/dex/aggregators/honey\";\nimport { kyberswap } from \"~/actions/dex/aggregators/kyberswap\";\nimport { oogabooga } from \"~/actions/dex/aggregators/oogabooga\";\nimport { openOcean } from \"~/actions/dex/aggregators/openOcean\";\nimport { wberaSwap } from \"~/actions/dex/aggregators/wbera\";\nimport { useBeraFlag } from \"~/contexts/BeraFlags/BeraFlags\";\nimport type { HoneyConfigContextReturn } from \"~/contexts/HoneyConfigProvider\";\nimport type { SwapReferrer } from \"~/enum/dex\";\nimport { useAggregatorsRouterFeeBps } from \"~/hooks/dex/useAggregatorsRouterFeeBps\";\nimport type { IRawAggregatorQuote, MinimalERC20 } from \"~/types/dex\";\nimport type { DefaultHookOptions } from \"~/types/global\";\nimport { parseBaseArgs } from \"~/utils/parseBaseArgs\";\nimport { isToken } from \"~/utils/tokens\";\nimport { useUnderlyingAsset } from \"../tokens/useUnderlyingAsset\";\nimport { useBexStatus } from \"./useBexStatus\";\nimport {\n getAggregatorsSWROptions,\n raw_useSingleAggregatorQuote,\n} from \"./useSingleAggregatorQuote\";\n\nconst AGGREGATORS = [\n oogabooga,\n fly,\n kyberswap,\n openOcean,\n haiku,\n enso,\n bex,\n honeyNative,\n erc4626Deposit,\n];\n\ntype IUseAggregatorsQuotesArgs = BeraJS.BaseFunctionArgs & {\n tokenIn: MinimalERC20;\n tokenOut: MinimalERC20;\n amount: string;\n slippage: number;\n referrer?: SwapReferrer;\n rewardVault?: Address;\n /**\n * Useful cause the collaterals are provided byt he honeyContext and this way we can\n * use the Provider only in the swap page where is needed.\n *\n * The collaterals for the honey mint/redeem aggregator.\n */\n honeyNativeState?: Pick<\n HoneyConfigContextReturn,\n \"collateralList\" | \"protocol\"\n >;\n};\n\nexport function useAggregatorsQuotes(\n args: IUseAggregatorsQuotesArgs,\n options?: DefaultHookOptions,\n) {\n const { address: account } = useBeraWallet();\n const proxyAggregatorsThroughVercel = useBeraFlag(\n \"proxyAggregatorsThroughVercel\",\n );\n const activeAggregators = useBeraFlag(\"aggregators\");\n const publicClient = usePublicClient();\n const { data: feeBps } = useAggregatorsRouterFeeBps();\n\n const isWrapOrUnwrap =\n (isToken(args.tokenIn.address, \"BERA\") ||\n isToken(args.tokenIn.address, \"WBERA\")) &&\n (isToken(args.tokenOut.address, \"BERA\") ||\n isToken(args.tokenOut.address, \"WBERA\"));\n\n const isBgtRedeem = isToken(args.tokenIn.address, \"BGT\", {\n chainId: defaultChainId,\n });\n\n const { data: underlyingToken } = useUnderlyingAsset({\n token: args.tokenOut,\n });\n\n /**\n * Whether it's a native swap (wrap/unwrap) or BGT redeem\n */\n const isNativeSwap = isWrapOrUnwrap || isBgtRedeem;\n\n const { config } = parseBaseArgs(args);\n\n const isMAEnabled = config.bex.aggregatorsRouter !== zeroAddress;\n\n const swrOptions = getAggregatorsSWROptions(options);\n\n const sharedArgs = {\n activeAggregators,\n isMAEnabled,\n underlyingToken,\n isNativeSwap,\n account,\n publicClient,\n proxyAggregatorsThroughVercel,\n feeBps,\n } as const;\n\n // we're using independent useSWRs so we can show quotes as they come\n // instead of waiting for all of them to load\n const oogaBogaResult = raw_useSingleAggregatorQuote(\n {\n ...sharedArgs,\n ...args,\n aggregator: oogabooga,\n },\n { opts: swrOptions },\n );\n\n const flyResult = raw_useSingleAggregatorQuote(\n {\n ...sharedArgs,\n ...args,\n aggregator: fly,\n },\n { opts: swrOptions },\n );\n\n const erc4626Result = raw_useSingleAggregatorQuote(\n {\n ...sharedArgs,\n ...args,\n aggregator: erc4626Deposit,\n },\n { opts: swrOptions },\n );\n\n const kyberswapResult = raw_useSingleAggregatorQuote(\n {\n ...sharedArgs,\n ...args,\n aggregator: kyberswap,\n },\n { opts: swrOptions },\n );\n\n const openOceanResult = raw_useSingleAggregatorQuote(\n {\n ...sharedArgs,\n ...args,\n aggregator: openOcean,\n },\n { opts: swrOptions },\n );\n\n const haikuResult = raw_useSingleAggregatorQuote(\n {\n ...sharedArgs,\n ...args,\n aggregator: haiku,\n },\n { opts: swrOptions },\n );\n\n const ensoResult = raw_useSingleAggregatorQuote(\n {\n ...sharedArgs,\n ...args,\n aggregator: enso,\n },\n { opts: swrOptions },\n );\n\n const { protocol: bexProtocol } = useBexStatus();\n\n const bexResult = raw_useSingleAggregatorQuote(\n {\n ...sharedArgs,\n ...args,\n aggregator: bex,\n },\n { opts: { ...swrOptions, isEnabled: bexProtocol.isPaused === false } },\n );\n\n const wberaSwapResult = raw_useSingleAggregatorQuote({\n ...sharedArgs,\n ...args,\n aggregator: wberaSwap,\n });\n\n const bgtRedeemResult = raw_useSingleAggregatorQuote(\n {\n ...sharedArgs,\n ...args,\n aggregator: bgtRedeem,\n },\n { opts: swrOptions },\n );\n\n const honeyResult = raw_useSingleAggregatorQuote(\n {\n ...sharedArgs,\n ...args,\n aggregator: honeyNative,\n },\n { opts: swrOptions },\n );\n\n const results = isWrapOrUnwrap\n ? [wberaSwapResult]\n : isBgtRedeem\n ? [bgtRedeemResult]\n : [\n oogaBogaResult,\n erc4626Result,\n flyResult,\n kyberswapResult,\n openOceanResult,\n haikuResult,\n ensoResult,\n honeyResult,\n bexProtocol.isPaused === false ? bexResult : null,\n ].filter((i): i is NonNullable<typeof i> => i !== null);\n\n const data = useMemo(() => {\n const error = results.reduce<(typeof results)[number][\"error\"]>(\n (error, result) => error || result.error,\n undefined,\n );\n\n const loadingAggregatorsNames = results\n .map((r, i) =>\n r.isLoading\n ? isNativeSwap\n ? wberaSwap.name\n : AGGREGATORS[i].name\n : null,\n )\n .filter(Boolean);\n\n const quotes = results\n .filter(\n (result) =>\n result !== undefined &&\n !result.isLoading &&\n !result.error &&\n result.data?.amountOut,\n )\n .map(({ data }) => data) as IRawAggregatorQuote[];\n\n const isLoading = quotes.length === 0 && loadingAggregatorsNames.length > 0;\n return { quotes, loadingAggregatorsNames, isLoading, error };\n }, [results]);\n\n return {\n ...data,\n refresh: () => results.map((r) => r.mutate()),\n };\n}\n","import {\n type Address,\n Slippage,\n type SorSwapResult,\n Swap,\n SwapKind,\n Token,\n TokenAmount,\n} from \"@berachain-foundation/berancer-sdk\";\nimport { decodeFunctionData, formatEther, zeroAddress } from \"viem\";\n\nimport { getUriFromLink } from \"@berachain/config\";\nimport { ChainId } from \"@berachain/config/internal\";\n\nimport { vaultAbi as balancerVaultAbi } from \"@berachain/abis/bex/vault\";\n\nimport { BalancerApi } from \"~/actions/dex/b-sdk\";\nimport { Aggregators } from \"~/enum/dex\";\nimport { assertPublicClient } from \"~/errors/assert\";\nimport { BeraError } from \"~/errors/BeraError\";\nimport { BeraMonitoring } from \"~/errors/BeraMonitoring\";\nimport { RequestError } from \"~/errors/RequestError\";\nimport type { IAggregatorArgs, IRawAggregatorQuote } from \"~/types/dex\";\nimport { isToken } from \"~/utils/tokens\";\nimport { BaseAggregator } from \"./base\";\n\n// Constants\nconst DEFAULT_DEADLINE = 60 * 5; // default transaction deadline in seconds\nconst STALE_PRICE_THRESHOLD = 0.05; // 5% threshold for stale prices\nconst swapKind = SwapKind.GivenIn;\n\nclass BexAggregator extends BaseAggregator {\n name = Aggregators.HubPools;\n supportedChains = [ChainId.MAINNET, ChainId.BEPOLIA];\n readonly url = getUriFromLink(this.config.api);\n readonly type = \"graphql\";\n\n /**\n * Helper function to convert zero address to wrapped token address\n */\n private convertZeroToWrapped(address: Address): Address {\n return isToken(address, \"BERA\") ? this.config.tokens.wbera : address;\n }\n\n /**\n * Helper to calculate price impact percentage\n */\n private calculatePriceImpact(priceImpact: {\n error: string | null;\n priceImpact?: string;\n }): number {\n if (priceImpact.error) {\n console.error(\"Swap price impact error\", priceImpact);\n return 0;\n }\n\n return Number(priceImpact.priceImpact);\n }\n\n /**\n * Helper to check for stale SOR prices\n */\n private checkStalePrices({\n onChainAmount,\n sorPaths,\n sorAmount,\n queryData,\n }: {\n onChainAmount: TokenAmount;\n sorPaths: { pools: string[] }[];\n sorAmount: string;\n queryData: IAggregatorArgs;\n }): void {\n // Check for stale prices\n const deltaFromSorAmount =\n Number.parseFloat(formatEther(onChainAmount.scale18)) /\n Number.parseFloat(sorAmount);\n\n if (Math.abs(1 - deltaFromSorAmount) > STALE_PRICE_THRESHOLD) {\n console.warn(\n \"SOR returned stale prices. Delta from return amount is more than 5%\",\n {\n deltaFromSorAmount,\n },\n );\n\n const error = new BeraError({\n reason: \"SOR_STALE_PRICES\",\n level: \"warning\",\n message:\n \"SOR returned stale prices. Delta from return amount is more than 5%\",\n extra: {\n deltaFromSorAmount,\n pools: sorPaths.map((p) => p.pools),\n onChainAmount: formatEther(onChainAmount.scale18),\n sorAmount,\n queryData,\n },\n fingerprint: [\"SOR_STALE_PRICES\"],\n });\n BeraMonitoring.captureException(error);\n }\n }\n\n async getQuote(args: IAggregatorArgs): Promise<IRawAggregatorQuote> {\n const balancerApi = new BalancerApi(\n this.url,\n // @ts-expect-error b-sdk has more chains than berajs\n this.chainId,\n );\n const {\n tokenIn,\n tokenOut,\n amount,\n slippage,\n account = zeroAddress,\n publicClient,\n } = args;\n this.assertChainSupport({ tokenIn, tokenOut });\n\n assertPublicClient(publicClient);\n\n const wberaIsBera = isToken(tokenIn, \"BERA\") || isToken(tokenOut, \"BERA\");\n\n // Initialize tokens\n const tokenInV3 = new Token(\n this.chainId,\n this.convertZeroToWrapped(tokenIn.address),\n tokenIn.decimals,\n );\n const tokenOutV3 = new Token(\n this.chainId,\n this.convertZeroToWrapped(tokenOut.address),\n tokenOut.decimals,\n );\n\n const tokenAmount = TokenAmount.fromRawAmount(\n tokenInV3,\n amount as `${number}`,\n );\n\n // swap paths\n const {\n paths: sorPaths,\n priceImpact,\n returnAmount: sorAmount,\n }: SorSwapResult = await balancerApi.sorSwapPaths.fetchSorSwapPaths({\n // @ts-expect-error b-sdk has more chains than berajs\n chainId: this.chainId,\n tokenIn: tokenInV3.address,\n tokenOut: tokenOutV3.address,\n swapKind,\n swapAmount: tokenAmount,\n });\n\n if (!sorPaths?.length) {\n throw new RequestError({\n response: undefined,\n endpoint: {\n url: this.url,\n name: this.name,\n type: this.type,\n },\n reason: BaseAggregator.PATH_NOT_FOUND_REASON,\n chainId: this.chainId,\n payload: {\n tokenIn: tokenInV3.address,\n tokenOut: tokenOutV3.address,\n swapKind,\n swapAmount: tokenAmount,\n },\n message: `No swap paths returned from Balancer API`,\n });\n }\n\n // execute swap query\n const swap = new Swap({\n chainId: this.chainId,\n paths: sorPaths,\n swapKind,\n userData: \"0x\" as `0x${string}`,\n });\n const queryOutput = await swap.query(publicClient.transport.url);\n\n if (!(\"expectedAmountOut\" in queryOutput)) {\n throw new Error(\"No Bex paths found\");\n }\n\n this.checkStalePrices({\n onChainAmount: queryOutput.expectedAmountOut,\n sorPaths,\n sorAmount,\n queryData: args,\n });\n\n // format quote response\n return {\n amountOut: queryOutput.expectedAmountOut.amount.toString(),\n amountIn: amount,\n allowanceRequirements: this.parseAllowanceRequirements({\n tokenIn,\n rawAmount: amount,\n spender: queryOutput.to,\n }),\n name: this.name,\n priceImpactPercentage: this.calculatePriceImpact(priceImpact),\n swapFeeBps: 0,\n getCalldata: ({ account }) => {\n // generate user transaction data\n const callData = swap.buildCall({\n slippage: Slippage.fromPercentage(slippage.toString() as `${number}`),\n deadline: BigInt(Math.round(Date.now() / 1000) + DEFAULT_DEADLINE),\n queryOutput,\n sender: account as Address,\n recipient: account as Address,\n wethIsEth: wberaIsBera,\n });\n\n const { args: params, functionName } = decodeFunctionData({\n abi: balancerVaultAbi,\n data: callData.callData,\n });\n\n return {\n params,\n functionName,\n abi: balancerVaultAbi,\n address: callData.to,\n value: callData.value || BigInt(0),\n };\n },\n };\n }\n}\n\nexport const bex = new BexAggregator();\n","import { ChainId } from \"@berachain/config/internal\";\n\nimport { Aggregators } from \"~/enum/dex\";\nimport { InvalidArgumentError } from \"~/errors/InvalidArgumentError\";\nimport type {\n IAggregatorArgs,\n IRawAggregatorQuote,\n MinimalERC20,\n} from \"~/types/dex\";\nimport { beraToken, isToken } from \"~/utils/tokens\";\nimport { BaseAggregator } from \"./base\";\n\nclass RedeemBgtAggregator extends BaseAggregator {\n name = Aggregators.RedeemBgt;\n supportedChains = [ChainId.MAINNET, ChainId.BEPOLIA];\n readonly type = \"rpc\";\n\n checkChainSupport({\n tokenIn,\n tokenOut,\n }: {\n tokenIn: MinimalERC20;\n tokenOut: MinimalERC20;\n }): boolean {\n if (!super.checkChainSupport({ tokenIn, tokenOut })) {\n return false;\n }\n\n return (\n // only supported on same chain\n tokenIn.chainId === tokenOut.chainId &&\n isToken(tokenIn, \"BGT\", { chainId: tokenIn.chainId }) &&\n isToken(tokenOut, \"BERA\")\n );\n }\n // handles native swaps: wrap and unwrap\n async getQuote({\n tokenIn,\n amount,\n }: Omit<\n IAggregatorArgs,\n \"slippage\" | \"feeBps\" | \"tokenOut\" | \"account\"\n >): Promise<IRawAggregatorQuote> {\n this.assertChainSupport({\n tokenIn,\n tokenOut: { ...beraToken, chainId: tokenIn.chainId },\n });\n\n if (!isToken(tokenIn, \"BGT\", { config: this.config })) {\n throw new InvalidArgumentError({\n property: \"tokenIn\",\n value: tokenIn,\n expected: \"BGT\",\n level: \"warning\",\n });\n }\n\n return {\n amountOut: amount,\n amountIn: amount,\n allowanceRequirements: [],\n name: Aggregators.RedeemBgt,\n isNativeSwap: true,\n swapFeeBps: 0,\n // not adding calldata here because it depends on the connected wallet\n // bgt redeem requires a receiver address\n // moreover this is a sensitive operation, better be sure of what data is being sent\n // by controlling it on the consumer side\n } as const;\n }\n}\n\nexport const bgtRedeem = new RedeemBgtAggregator();\n","import { zeroAddress } from \"viem\";\n\nimport { ChainId } from \"@berachain/config/internal\";\n\nimport { metaAggregatorAbi as aggregatorsRouterAbi } from \"@berachain/abis/meta-aggregator/metaAggregator\";\n\nimport { Aggregators } from \"~/enum/dex\";\nimport type { IAggregatorArgs, IRawAggregatorQuote } from \"~/types/dex\";\nimport { BaseAggregator } from \"../base\";\n\nclass EnsoAggregator extends BaseAggregator {\n name = Aggregators.Enso;\n supportedChains = [ChainId.MAINNET];\n readonly type = \"rest\";\n needsAccountForQuote = true;\n\n notFoundMessages: string[] = [\n \"Could not build shortcuts for route\",\n \"Could not quote shortcuts for route\",\n \"Swap not found for a required underlying of defi route,\",\n \"No route found from\",\n ];\n\n async getQuote({\n tokenIn,\n tokenOut,\n amount,\n slippage,\n account = zeroAddress,\n aggregatorsFeeBps,\n proxyAggregatorsThroughVercel = false,\n rewardVault,\n }: IAggregatorArgs): Promise<IRawAggregatorQuote> {\n this.assertChainSupport({ tokenIn, tokenOut });\n\n const {\n tokenInAddress,\n tokenOutAddress,\n isTokenInNative,\n isTokenOutNative,\n } = this.parseAddresses(tokenIn.address, tokenOut.address);\n\n const inputAmountAfterFees = this.getAmountAfterFees(\n amount,\n aggregatorsFeeBps,\n );\n\n this.url = proxyAggregatorsThroughVercel\n ? `/api/aggregators?aggregator=enso`\n : `${this.config.bex.aggregatorsProxyUrl}/enso/api/v1/shortcuts/route?`;\n\n const url = new URL(this.url);\n url.searchParams.set(\n \"fromAddress\",\n this.config.bex.aggregatorsRouterExecutor,\n );\n url.searchParams.set(\"receiver\", this.config.bex.aggregatorsRouterExecutor);\n url.searchParams.set(\"spender\", this.config.bex.aggregatorsRouterExecutor);\n url.searchParams.set(\"amountIn\", inputAmountAfterFees);\n url.searchParams.set(\"tokenIn\", tokenInAddress);\n url.searchParams.set(\"tokenOut\", tokenOutAddress);\n url.searchParams.set(\"chainId\", ChainId.MAINNET.toString());\n url.searchParams.set(\"slippage\", (Number(slippage) * 100).toString());\n url.searchParams.set(\"refundReceiver\", account);\n\n const response = await this.fetch(url);\n\n const quote = await response.json();\n\n const inputData = this.getInputData({\n tokenIn: tokenInAddress,\n amountIn: amount,\n isNative: isTokenInNative,\n });\n\n const outputData = {\n tokenOut: tokenOutAddress,\n receiver: account,\n minAmountOut: this.getMinAmountOut(quote.amountOut.toString(), slippage),\n isNative: isTokenOutNative,\n };\n\n const aggregatorData = {\n aggregator: quote.tx?.to,\n data: quote.tx?.data,\n };\n\n return {\n amountOut: quote.amountOut.toString(),\n amountIn: amount,\n allowanceRequirements: this.parseAllowanceRequirements({\n tokenIn,\n rawAmount: amount,\n spender: this.config.bex.aggregatorsRouter,\n }),\n name: this.name,\n swapFeeBps: aggregatorsFeeBps!,\n getCalldata: () => ({\n params: [\n inputData,\n outputData,\n aggregatorData,\n {\n rewardVault: rewardVault ?? zeroAddress,\n isSwapAndStake: !!rewardVault,\n },\n ],\n functionName: \"swap\",\n abi: aggregatorsRouterAbi,\n // send full amount to router first, which will deduct the swap fee before executing trade\n value: isTokenInNative ? BigInt(amount) : BigInt(\"0\"),\n address: this.config.bex.aggregatorsRouter,\n }),\n };\n }\n}\n\nexport const enso = new EnsoAggregator();\n","import { useEffect, useState } from \"react\";\nimport { PoolType } from \"@berachain-foundation/berancer-sdk\";\n\nimport { PoolCreationStep } from \"~/enum/dex\";\nimport type { TokenCurrentPriceMap, TokenWithAmount } from \"~/types/dex\";\nimport { wrapNativeTokens } from \"~/utils/tokenWrapping\";\nimport { type Oracle, OracleMode } from \"./useCreatePool\";\n\nconst DEFAULT_LIQUIDITY_MISMATCH_TOLERANCE_PERCENT = 0.05; // 5%\n\nexport type LiquidityMismatchInfo = {\n title: string | null;\n message: string | null;\n suggestWeighted?: boolean;\n};\n\ninterface UseLiquidityMismatchParams {\n currentStep: PoolCreationStep;\n tokenPrices?: TokenCurrentPriceMap;\n isLoadingTokenPrices: boolean;\n tokens: TokenWithAmount[] | null;\n weights: bigint[] | null;\n weightsError: string | null;\n poolType: PoolType;\n liquidityMismatchTolerancePercent?: number;\n oracles: Oracle[];\n}\n\n/**\n * Hook for detecting liquidity mismatches.\n *\n * @param {PoolCreationStep} currentStep - The current step of the pool creation process.\n * @param {Record<string, number>} tokenPrices - The current token prices.\n * @param {boolean} isLoadingTokenPrices - Whether the token prices are still loading.\n * @param {Array<{ address: string, amount: number }>} tokens - The tokens in the pool, including their addresses and amounts.\n * @param {Record<string, number>} weights - The per-token weights in the pool we are creating.\n * @param {string | null} weightsError - An error message for the weights indicating that the weights are invalid.\n * @param {string} poolType - The type of pool being created.\n * @param {number} liquidityMismatchTolerancePercent - The tolerance for liquidity mismatches in percent.\n * @returns {Object} The liquidity mismatch info.\n */\nexport const useLiquidityMismatch = ({\n currentStep,\n tokenPrices,\n isLoadingTokenPrices,\n tokens,\n weights,\n weightsError,\n poolType,\n liquidityMismatchTolerancePercent = DEFAULT_LIQUIDITY_MISMATCH_TOLERANCE_PERCENT,\n oracles,\n}: UseLiquidityMismatchParams): LiquidityMismatchInfo => {\n // NOTE: would be nice to use Maps/Records more in here, as the zipping/unzipping is cumbersome.\n // NOTE: if we pull in string literal for currentStep things would also be a bit clearer in here.\n const [liquidityMismatchInfo, setLiquidityMismatchInfo] =\n useState<LiquidityMismatchInfo>({ title: null, message: null });\n\n useEffect(() => {\n // If we are either using custom rate-providing oracles or have incorrect/loading token prices, we cant do validation.\n if (\n !tokenPrices ||\n isLoadingTokenPrices ||\n !tokens ||\n !weights ||\n weightsError ||\n tokens.some((token) => !token.address) ||\n oracles.some((oracle) => oracle.mode === OracleMode.Custom) // Oracles give prices on their own, we dont support that here yet.\n ) {\n setLiquidityMismatchInfo({ title: null, message: null });\n return;\n }\n\n // Calculate some basic metrics we'll use to determine per-token contributions and model potential losses from arbitrage.\n let totalLiquidityUSD = 0;\n const tokenUSDAmounts: number[] = [];\n const numTokens = tokens.length;\n const wrappedTokens = wrapNativeTokens(tokens);\n const tokenUSDPrices = wrappedTokens.map((token) => {\n const tokenPriceUSD =\n tokenPrices[token.address.toLowerCase()]?.price ?? 0;\n if (!tokenPriceUSD || tokenPriceUSD === 0) {\n tokenUSDAmounts.push(0);\n return null;\n }\n const tokenAmountUSD = tokenPriceUSD * Number.parseFloat(token.amount);\n tokenUSDAmounts.push(tokenAmountUSD);\n totalLiquidityUSD += tokenAmountUSD;\n return tokenPriceUSD;\n });\n\n // Doesn't matter what step it is, if we have missing token prices for tokens we have selected, we cant issue a real warning.\n if (\n tokenUSDPrices.some((price) => price === null) ||\n tokenUSDPrices.length !== numTokens\n ) {\n setLiquidityMismatchInfo({\n title: \"Missing token price data\",\n message: `One or more token(s) do not have valid market price data. Please verify that token market prices align with the pool\n weightings and your initial liquidity amounts.`,\n });\n return;\n }\n\n // Step 1 - During token selection we check for a deviation in the quote prices of the tokens selected (for stable pools).\n if (\n currentStep === PoolCreationStep.SELECT_TOKENS &&\n poolType === PoolType.ComposableStable\n ) {\n const normalizedUSDPrices = tokenUSDPrices.map(\n (priceUSD) => priceUSD! / tokenUSDPrices[0]!, // always normalize on the first token's price\n );\n const maxDifference =\n Math.max(...normalizedUSDPrices) - Math.min(...normalizedUSDPrices);\n\n if (maxDifference > liquidityMismatchTolerancePercent) {\n setLiquidityMismatchInfo({\n title: \"Selected tokens have a significant price deviation\",\n message: \"Did you mean to create a Weighted pool instead?\",\n suggestWeighted: true,\n });\n } else {\n setLiquidityMismatchInfo({ title: null, message: null });\n }\n\n return;\n }\n\n // Validation During Liquidity Input and onwards.\n if (\n totalLiquidityUSD === 0 ||\n tokenUSDAmounts.some((value) => value === 0)\n ) {\n // User has not yet entered fully their liquidity values, so return early.\n setLiquidityMismatchInfo({ title: null, message: null });\n return;\n }\n\n // Simulate arbitrage for the pool to determine potential losses from arbitrageurs.\n // NOTE: we assume shortfalls and excesses are losses, but in reality the actual losses would be more complex to realise.\n // Balancer does this similarily https://github.com/balancer/frontend-v2/blob/8563b8d33b6bff266148bd48d7ebc89f921374f4/src/components/cards/CreatePool/InitialLiquidity.vue#L75\n let totalLossUSD = 0;\n if (poolType === PoolType.ComposableStable) {\n const expectedPerTokenLiquidityUSD = totalLiquidityUSD / numTokens;\n tokenUSDAmounts.forEach((value) => {\n totalLossUSD += Math.abs(expectedPerTokenLiquidityUSD - value);\n });\n } else if (poolType === PoolType.Weighted) {\n tokenUSDAmounts.forEach((value, index) => {\n const weightProportion = Number(weights[index]) / 1e18;\n const expectedValueUSD = totalLiquidityUSD * weightProportion;\n totalLossUSD += Math.abs(expectedValueUSD - value);\n });\n }\n\n // We'll show a total loss if it's 90% or more\n const isTotalLoss = totalLossUSD >= totalLiquidityUSD * 0.9;\n totalLossUSD = Math.min(totalLossUSD, totalLiquidityUSD);\n const totalLossPercentage = totalLossUSD / totalLiquidityUSD;\n\n if (totalLossPercentage > liquidityMismatchTolerancePercent) {\n setLiquidityMismatchInfo({\n // If it's a total loss we dont display a percentage\n title: isTotalLoss\n ? \"You could lose all of your initial liquidity\"\n : `You could lose $${totalLossUSD.toFixed(2)} (~${(\n totalLossPercentage * 100\n ).toFixed(2)}%)`,\n message: `Based on the market token prices, the value of tokens does not align with the specified pool weights. \n This discrepancy could expose you to potential losses from arbitrageurs. ${\n poolType === PoolType.ComposableStable\n ? \"Did you mean to create a Weighted pool instead?\"\n : \"\"\n }`,\n suggestWeighted: poolType === PoolType.ComposableStable,\n });\n } else {\n // All good bb bb\n setLiquidityMismatchInfo({ title: null, message: null });\n }\n }, [\n currentStep,\n tokenPrices,\n isLoadingTokenPrices,\n tokens,\n weights,\n weightsError,\n poolType,\n liquidityMismatchTolerancePercent,\n oracles,\n ]);\n return liquidityMismatchInfo;\n};\n","import useSWRImmutable from \"swr/immutable\";\nimport { isAddress } from \"viem\";\n\nimport { defaultChainId } from \"@berachain/config/internal\";\n\nimport { usePublicClient } from \"@berachain/wagmi/hooks\";\n\nimport { getTokenInformation } from \"~/actions/tokens/getTokenInformation\";\nimport { assertPublicClient } from \"~/errors/assert\";\nimport type { Token } from \"~/types/dex\";\nimport type { DefaultHookOptions, DefaultHookReturnType } from \"~/types/global\";\n\nexport type UseMultipleTokenInformationResponse = DefaultHookReturnType<\n Token[]\n>;\n\nexport type useMultipleTokenInformationArgs = {\n addresses: string[] | readonly string[] | undefined;\n chainId?: number;\n};\nexport function useMultipleTokenInformation(\n args: useMultipleTokenInformationArgs,\n options?: DefaultHookOptions,\n): UseMultipleTokenInformationResponse {\n const publicClient = usePublicClient();\n\n const QUERY_KEY =\n publicClient && args.addresses\n ? ([\n \"useMultipleTokenInformation\",\n args.addresses,\n args.chainId ?? defaultChainId,\n ] as const)\n : null;\n\n const swrResponse = useSWRImmutable<Token[], unknown, typeof QUERY_KEY>(\n QUERY_KEY,\n async ([, addresses, chainId]) => {\n // We already checked for publicClient in the QUERY_KEY\n // so we can safely assume that publicClient is defined\n // but we need this for correct type inference\n assertPublicClient(publicClient);\n\n return Promise.all(\n addresses.map(async (address) => {\n if (!address || !isAddress(address, { strict: false })) {\n throw new Error(\"Invalid address\");\n }\n\n const tk = await getTokenInformation({\n address: address,\n publicClient,\n chainId,\n });\n\n if (!tk) {\n throw new Error(`Token ${address} not found`);\n }\n\n return tk;\n }),\n );\n },\n { ...options?.opts },\n );\n\n return {\n ...swrResponse,\n refresh: () => swrResponse?.mutate?.(),\n };\n}\n"]}
|
package/dist/hooks/exports.d.cts
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
+
import * as swr__internal from 'swr/_internal';
|
|
1
2
|
import * as swr from 'swr';
|
|
2
3
|
import { SWRResponse } from 'swr';
|
|
3
|
-
import {
|
|
4
|
-
import { D as DefaultHookOptions, c as DefaultHookReturnType, G as GovernanceTopic, a as CustomProposalErrors, C as CustomProposal, S as StakingConfig, d as StakedBeraAsset, U as UserVaultInfo, e as IUseContractWriteArgs, f as UseContractWriteApi, B as BribeBoostRewardProof } from '../global.d-
|
|
5
|
-
export { T as TxnEventKeys } from '../global.d-
|
|
4
|
+
import { b as GetConvertToAssetsProps, O as OnChainPool, B as BaseAggregator, d as GetHoneyVaultsBalanceResponse, j as IsBadCollateralResponse, G as GetBgtAprSimulationArgs, a as GetBgtAprSimulationResult, i as GlobalData, e as GetMarkets, S as StakedBeraWithdrawal, k as RewardVaultIncentive, f as GetRewardVaultRewardsReturn, c as GetGaugeData, t as VaultMetadata, g as GetUserVaultsResponse, h as GetVaultHistoryArgs, V as ValidatorRewardAllocation, s as ValidatorWithUserBoost, U as UserBoostsOnValidator, l as UserStakingPoolPosition, n as ValidatorQueuedCommission, o as ValidatorQueuedOperatorAddress } from '../getValidatorQueuedOperatorAddress-DZgrPmZ2.cjs';
|
|
5
|
+
import { D as DefaultHookOptions, c as DefaultHookReturnType, G as GovernanceTopic, a as CustomProposalErrors, C as CustomProposal, S as StakingConfig, d as StakedBeraAsset, U as UserVaultInfo, e as IUseContractWriteArgs, f as UseContractWriteApi, B as BribeBoostRewardProof } from '../global.d-DghRxpHd.cjs';
|
|
6
|
+
export { T as TxnEventKeys } from '../global.d-DghRxpHd.cjs';
|
|
6
7
|
import { S as SwapReferrer, A as Aggregators, a as PoolCreationStep } from '../dex-C_BB0b0O.cjs';
|
|
7
8
|
import * as viem from 'viem';
|
|
8
9
|
import { Address, Hex } from 'viem';
|
|
9
|
-
import { M as MinimalERC20, d as HoneyConfigContextReturn, g as IRawAggregatorQuote, b as Token, t as TokenWithAmount, i as TokenCurrentPriceMap, v as IUserPosition, A as AllowanceQueryItem, j as AllowanceToken, B as BalanceToken, w as Calldata, h as PythPriceFeedMap, P as PythLatestUpdates, x as TokenPriceInfo, a as TokenWithMetadata } from '../HoneyConfigProvider-
|
|
10
|
+
import { M as MinimalERC20, d as HoneyConfigContextReturn, g as IRawAggregatorQuote, b as Token, t as TokenWithAmount, i as TokenCurrentPriceMap, v as IUserPosition, A as AllowanceQueryItem, j as AllowanceToken, B as BalanceToken, w as Calldata, h as PythPriceFeedMap, P as PythLatestUpdates, x as TokenPriceInfo, a as TokenWithMetadata } from '../HoneyConfigProvider-DfkjmzEf.cjs';
|
|
10
11
|
import * as _berachain_graphql_dex_api from '@berachain/graphql/dex/api';
|
|
11
12
|
import { GetPoolsQueryVariables, MinimalPoolFragment, GqlPoolEventType, PoolHistoricalDataFragment, GqlRewardVaultDynamicData, GqlVaultSnapshotDataRange, GqlValidatorDynamicData } from '@berachain/graphql/dex/api';
|
|
12
|
-
export { u as useBexStatus } from '../BexStatusProvider-
|
|
13
|
+
export { u as useBexStatus } from '../BexStatusProvider-DRymVlQf.cjs';
|
|
13
14
|
import { PoolType } from '@berachain-foundation/berancer-sdk';
|
|
14
15
|
import { SubgraphPoolFragment } from '@berachain/graphql/dex/subgraph';
|
|
15
16
|
import { P as POLLING } from '../polling-BKnyavLI.cjs';
|
|
16
|
-
import * as swr__internal from 'swr/_internal';
|
|
17
17
|
import { GetZapTransactionResponse } from '../types/exports.cjs';
|
|
18
18
|
import * as react from 'react';
|
|
19
19
|
import * as swr_infinite from 'swr/infinite';
|
|
20
20
|
import { SWRInfiniteResponse, SWRInfiniteKeyLoader } from 'swr/infinite';
|
|
21
21
|
import * as _berachain_graphql_governance from '@berachain/graphql/governance';
|
|
22
22
|
import { Proposal_Filter, Proposal_OrderBy, OrderDirection, ProposalStatus, ProposalSelectionFragment, ProposalWithVotesFragment, GetProposalVotesQueryVariables } from '@berachain/graphql/governance';
|
|
23
|
-
import { I as IHoneySwapState } from '../useHoneySwapState-
|
|
24
|
-
export { r as reducer, u as useHoneySwapState } from '../useHoneySwapState-
|
|
23
|
+
import { I as IHoneySwapState } from '../useHoneySwapState-D6vpv19r.cjs';
|
|
24
|
+
export { r as reducer, u as useHoneySwapState } from '../useHoneySwapState-D6vpv19r.cjs';
|
|
25
25
|
import * as _berachain_graphql_honey from '@berachain/graphql/honey';
|
|
26
26
|
import BigNumber from '@berachain/utils/pkg/bignumber.js';
|
|
27
27
|
import * as _berachain_graphql_pol_api from '@berachain/graphql/pol/api';
|
|
28
|
-
import { GqlRewardVaultFilter, ApiVaultFragment, GetVaultsQueryVariables, GetVaultHistoryQuery, ApiValidatorFragment, GetValidatorsQueryVariables,
|
|
28
|
+
import { GqlRewardVaultFilter, ApiVaultFragment, GetVaultsQueryVariables, GetVaultHistoryQuery, ApiValidatorFragment, GetValidatorsQueryVariables, GetValidatorsQuery, GqlChain, GetValidatorQuery, ApiValidatorMinimalFragment } from '@berachain/graphql/pol/api';
|
|
29
29
|
import { Address as Address$1 } from '@berachain/config';
|
|
30
30
|
import * as _berachain_graphql_pol_subgraph from '@berachain/graphql/pol/subgraph';
|
|
31
31
|
import { GetValidatorBlockStatsQuery, GetValidatorAnalyticsQuery } from '@berachain/graphql/pol/subgraph';
|
|
32
32
|
import '@berachain/config/internal';
|
|
33
|
-
import '../txnEnum-
|
|
33
|
+
import '../txnEnum-DxPRHSJt.cjs';
|
|
34
34
|
import '@wagmi/core';
|
|
35
35
|
import '../BeraError-_mQdkanr.cjs';
|
|
36
36
|
import 'react/jsx-runtime';
|
|
@@ -52,7 +52,7 @@ declare const useGetConvertToAssets: ({ sharesAmount, vaultAddress, vaultChainId
|
|
|
52
52
|
formatted: string;
|
|
53
53
|
}>;
|
|
54
54
|
isValidating: boolean;
|
|
55
|
-
isLoading:
|
|
55
|
+
isLoading: swr__internal.IsLoadingResponse<Data, Config>;
|
|
56
56
|
};
|
|
57
57
|
|
|
58
58
|
type IUseAggregatorsQuotesArgs$1 = BeraJS.BaseFunctionArgs & {
|
|
@@ -84,7 +84,7 @@ declare const useAggregatorsRouterFeeBps: () => {
|
|
|
84
84
|
error: any;
|
|
85
85
|
mutate: swr.KeyedMutator<number>;
|
|
86
86
|
isValidating: boolean;
|
|
87
|
-
isLoading:
|
|
87
|
+
isLoading: swr__internal.IsLoadingResponse<Data, Config>;
|
|
88
88
|
};
|
|
89
89
|
|
|
90
90
|
declare const useAllUserPoolsQueryKey: ({ query, }?: {
|
|
@@ -211,7 +211,7 @@ declare const useAllUserPools: (query: GetPoolsQueryVariables, options?: Default
|
|
|
211
211
|
count: number;
|
|
212
212
|
}>;
|
|
213
213
|
isValidating: boolean;
|
|
214
|
-
isLoading:
|
|
214
|
+
isLoading: swr__internal.IsLoadingResponse<Data, Config>;
|
|
215
215
|
};
|
|
216
216
|
|
|
217
217
|
declare const useApiPoolQueryKey: ({ poolId, account, }: {
|
|
@@ -227,7 +227,7 @@ declare function useApiPool({ poolId, account, }: {
|
|
|
227
227
|
error: any;
|
|
228
228
|
mutate: swr.KeyedMutator<MinimalPoolFragment>;
|
|
229
229
|
isValidating: boolean;
|
|
230
|
-
isLoading:
|
|
230
|
+
isLoading: swr__internal.IsLoadingResponse<Data, Config>;
|
|
231
231
|
};
|
|
232
232
|
|
|
233
233
|
interface UseCreatePoolProps extends BeraJS.BaseFunctionArgs {
|
|
@@ -279,7 +279,7 @@ declare const useExploitedTokens: ({ tokens, }: {
|
|
|
279
279
|
error: any;
|
|
280
280
|
mutate: swr.KeyedMutator<Record<`0x${string}`, boolean>>;
|
|
281
281
|
isValidating: boolean;
|
|
282
|
-
isLoading:
|
|
282
|
+
isLoading: swr__internal.IsLoadingResponse<Data, Config>;
|
|
283
283
|
};
|
|
284
284
|
|
|
285
285
|
declare const useGlobalLiquidityAndSwapVolume: () => {
|
|
@@ -291,7 +291,7 @@ declare const useGlobalLiquidityAndSwapVolume: () => {
|
|
|
291
291
|
error: any;
|
|
292
292
|
mutate: swr.KeyedMutator<_berachain_graphql_dex_api.GetGlobalLiquidityAndSwapVolumeQuery>;
|
|
293
293
|
isValidating: boolean;
|
|
294
|
-
isLoading:
|
|
294
|
+
isLoading: swr__internal.IsLoadingResponse<Data, Config>;
|
|
295
295
|
};
|
|
296
296
|
|
|
297
297
|
type LiquidityMismatchInfo = {
|
|
@@ -374,7 +374,7 @@ declare const usePollPoolCreationRelayerApproval: (options?: DefaultHookOptions)
|
|
|
374
374
|
error: any;
|
|
375
375
|
mutate: swr.KeyedMutator<boolean>;
|
|
376
376
|
isValidating: boolean;
|
|
377
|
-
isLoading:
|
|
377
|
+
isLoading: swr__internal.IsLoadingResponse<Data, Config>;
|
|
378
378
|
};
|
|
379
379
|
|
|
380
380
|
declare function useSubgraphPoolQueryKey({ poolId }: {
|
|
@@ -621,7 +621,7 @@ declare function useBendZapSupply({ tokenIn, loanToken, bendVault, rewardVault,
|
|
|
621
621
|
error: any;
|
|
622
622
|
mutate: swr.KeyedMutator<IRawAggregatorQuote>;
|
|
623
623
|
isValidating: boolean;
|
|
624
|
-
isLoading:
|
|
624
|
+
isLoading: swr__internal.IsLoadingResponse<Data, Config>;
|
|
625
625
|
};
|
|
626
626
|
declare function useBendZapSupplyHelper({ tokenIn, loanToken, bendVault, rewardVault, amount, slippage, }: UseBendZapSupplyArgs, options?: DefaultHookOptions): swr.SWRResponse<IRawAggregatorQuote, any, {
|
|
627
627
|
refreshInterval: POLLING;
|
|
@@ -640,6 +640,7 @@ declare function useBendZapSupplyHelper({ tokenIn, loanToken, bendVault, rewardV
|
|
|
640
640
|
keepPreviousData?: boolean;
|
|
641
641
|
suspense?: boolean;
|
|
642
642
|
fallbackData?: any;
|
|
643
|
+
strictServerPrefetchWarning?: boolean;
|
|
643
644
|
fetcher?: swr.BareFetcher<any> | undefined;
|
|
644
645
|
use?: swr.Middleware[];
|
|
645
646
|
fallback?: {
|
|
@@ -682,7 +683,7 @@ declare function useEnsoSwapBundle({ tokenIn, tokenOut, amount, slippage, }: {
|
|
|
682
683
|
error: any;
|
|
683
684
|
mutate: swr.KeyedMutator<GetZapTransactionResponse>;
|
|
684
685
|
isValidating: boolean;
|
|
685
|
-
isLoading:
|
|
686
|
+
isLoading: swr__internal.IsLoadingResponse<Data, Config>;
|
|
686
687
|
};
|
|
687
688
|
|
|
688
689
|
type UseZapStakeBeraArgs = {
|
|
@@ -715,7 +716,7 @@ declare function useZapStakeBera({ inputToken, amount, underlyingToken, slippage
|
|
|
715
716
|
error: any;
|
|
716
717
|
mutate: swr.KeyedMutator<IRawAggregatorQuote>;
|
|
717
718
|
isValidating: boolean;
|
|
718
|
-
isLoading:
|
|
719
|
+
isLoading: swr__internal.IsLoadingResponse<Data, Config>;
|
|
719
720
|
};
|
|
720
721
|
|
|
721
722
|
declare const useCreateProposal: ({ initialData, currentTopic, onError, }: {
|
|
@@ -858,10 +859,10 @@ declare const TimelockOperationState: {
|
|
|
858
859
|
* Fetches the state of a proposal timelock
|
|
859
860
|
* @returns state of the proposal timelock (unset, waiting, ready, done)
|
|
860
861
|
*/
|
|
861
|
-
declare
|
|
862
|
+
declare function useProposalTimelockState({ proposalTimelockId, timelockAddress, }: {
|
|
862
863
|
proposalTimelockId: Address | undefined;
|
|
863
864
|
timelockAddress: Address;
|
|
864
|
-
})
|
|
865
|
+
}): SWRResponse<(typeof TimelockOperationState)[keyof typeof TimelockOperationState]>;
|
|
865
866
|
|
|
866
867
|
/**
|
|
867
868
|
* Queries the quorum for a given timestamp.
|
|
@@ -877,7 +878,7 @@ declare function useQuorum({ at }: {
|
|
|
877
878
|
error: any;
|
|
878
879
|
mutate: swr.KeyedMutator<string>;
|
|
879
880
|
isValidating: boolean;
|
|
880
|
-
isLoading:
|
|
881
|
+
isLoading: swr__internal.IsLoadingResponse<Data, Config>;
|
|
881
882
|
};
|
|
882
883
|
|
|
883
884
|
interface UseCappedGloballyResponse extends DefaultHookReturnType<boolean | undefined> {
|
|
@@ -979,7 +980,7 @@ declare function useHoneyChartData({ days }: {
|
|
|
979
980
|
error: any;
|
|
980
981
|
mutate: swr.KeyedMutator<_berachain_graphql_honey.GetChartDataQuery>;
|
|
981
982
|
isValidating: boolean;
|
|
982
|
-
isLoading:
|
|
983
|
+
isLoading: swr__internal.IsLoadingResponse<Data, Config>;
|
|
983
984
|
};
|
|
984
985
|
|
|
985
986
|
declare function useHoneyGlobalData(): {
|
|
@@ -1001,7 +1002,7 @@ declare function useHoneyGlobalData(): {
|
|
|
1001
1002
|
error: any;
|
|
1002
1003
|
mutate: swr.KeyedMutator<_berachain_graphql_honey.GetGlobalDataQuery>;
|
|
1003
1004
|
isValidating: boolean;
|
|
1004
|
-
isLoading:
|
|
1005
|
+
isLoading: swr__internal.IsLoadingResponse<Data, Config>;
|
|
1005
1006
|
};
|
|
1006
1007
|
|
|
1007
1008
|
declare const useHoneyVaultsBalance: (options?: DefaultHookOptions) => DefaultHookReturnType<GetHoneyVaultsBalanceResponse[]>;
|
|
@@ -1055,7 +1056,7 @@ declare const useClaimableFees: () => {
|
|
|
1055
1056
|
error: any;
|
|
1056
1057
|
mutate: swr.KeyedMutator<string>;
|
|
1057
1058
|
isValidating: boolean;
|
|
1058
|
-
isLoading:
|
|
1059
|
+
isLoading: swr__internal.IsLoadingResponse<Data, Config>;
|
|
1059
1060
|
};
|
|
1060
1061
|
|
|
1061
1062
|
/**
|
|
@@ -1098,7 +1099,7 @@ declare function useQueuedBeraUnlock({ receiptTokenAddresses, account, version,
|
|
|
1098
1099
|
error: any;
|
|
1099
1100
|
mutate: swr.KeyedMutator<StakedBeraWithdrawal[]>;
|
|
1100
1101
|
isValidating: boolean;
|
|
1101
|
-
isLoading:
|
|
1102
|
+
isLoading: swr__internal.IsLoadingResponse<Data, Config>;
|
|
1102
1103
|
};
|
|
1103
1104
|
|
|
1104
1105
|
declare const useRewardTokenToBeraRate: ({ address, }: {
|
|
@@ -1120,6 +1121,7 @@ declare const useRewardTokenToBeraRate: ({ address, }: {
|
|
|
1120
1121
|
keepPreviousData?: boolean;
|
|
1121
1122
|
suspense?: boolean;
|
|
1122
1123
|
fallbackData?: any;
|
|
1124
|
+
strictServerPrefetchWarning?: boolean;
|
|
1123
1125
|
fetcher?: swr.BareFetcher<any> | undefined;
|
|
1124
1126
|
use?: swr.Middleware[];
|
|
1125
1127
|
fallback?: {
|
|
@@ -1173,7 +1175,7 @@ declare const useRewardVaultFromToken: ({ tokenAddress, }: {
|
|
|
1173
1175
|
error: any;
|
|
1174
1176
|
mutate: swr.KeyedMutator<`0x${string}` | undefined>;
|
|
1175
1177
|
isValidating: boolean;
|
|
1176
|
-
isLoading:
|
|
1178
|
+
isLoading: swr__internal.IsLoadingResponse<Data, Config>;
|
|
1177
1179
|
};
|
|
1178
1180
|
|
|
1179
1181
|
declare function useRewardVaultIncentives({ address, stakingToken, }: {
|
|
@@ -1185,7 +1187,7 @@ declare function useRewardVaultIncentives({ address, stakingToken, }: {
|
|
|
1185
1187
|
error: any;
|
|
1186
1188
|
mutate: swr.KeyedMutator<RewardVaultIncentive[]>;
|
|
1187
1189
|
isValidating: boolean;
|
|
1188
|
-
isLoading:
|
|
1190
|
+
isLoading: swr__internal.IsLoadingResponse<Data, Config>;
|
|
1189
1191
|
};
|
|
1190
1192
|
|
|
1191
1193
|
declare const useRewardVaultRewards: (address: Address, options?: DefaultHookOptions) => {
|
|
@@ -1194,7 +1196,7 @@ declare const useRewardVaultRewards: (address: Address, options?: DefaultHookOpt
|
|
|
1194
1196
|
error: any;
|
|
1195
1197
|
mutate: swr.KeyedMutator<GetRewardVaultRewardsReturn>;
|
|
1196
1198
|
isValidating: boolean;
|
|
1197
|
-
isLoading:
|
|
1199
|
+
isLoading: swr__internal.IsLoadingResponse<Data, Config>;
|
|
1198
1200
|
};
|
|
1199
1201
|
|
|
1200
1202
|
declare const useRewardVaultsQueryKey: (filter?: GetVaultsQueryVariables, onChainIncentives?: boolean) => readonly ["useRewardVaults", _berachain_graphql_pol_api.Exact<{
|
|
@@ -1214,7 +1216,7 @@ declare const useRewardVaults: (args: {
|
|
|
1214
1216
|
error: any;
|
|
1215
1217
|
mutate: swr.KeyedMutator<GetGaugeData>;
|
|
1216
1218
|
isValidating: boolean;
|
|
1217
|
-
isLoading:
|
|
1219
|
+
isLoading: swr__internal.IsLoadingResponse<Data, Config>;
|
|
1218
1220
|
};
|
|
1219
1221
|
|
|
1220
1222
|
type UseStakedAPR = {
|
|
@@ -1225,7 +1227,29 @@ declare function useStakedAPR({ range, }: {
|
|
|
1225
1227
|
range: GqlVaultSnapshotDataRange;
|
|
1226
1228
|
}): DefaultHookReturnType<UseStakedAPR>;
|
|
1227
1229
|
|
|
1228
|
-
|
|
1230
|
+
/**
|
|
1231
|
+
* Fetches staked asset data in two phases for progressive loading:
|
|
1232
|
+
*
|
|
1233
|
+
* 1. APR — independent fetch, resolves quickly, shared by both phases.
|
|
1234
|
+
* 2. Balances (fast path) — wallet balances (via usePollWalletBalances),
|
|
1235
|
+
* token prices (via useTokenPrices), and exchange rates.
|
|
1236
|
+
* Provides staked amounts and USD values immediately (earnings are 0).
|
|
1237
|
+
* 3. Positions (slow path) — adds earnings data from the vault.
|
|
1238
|
+
* Provides the full picture with earned amounts and USD values.
|
|
1239
|
+
*
|
|
1240
|
+
* Consumers can show `balances` right away and swap in `data` once positions resolve.
|
|
1241
|
+
*/
|
|
1242
|
+
declare const useStakedData: (stakingConfigs: StakingConfig[]) => {
|
|
1243
|
+
/** Fast path: staked amounts + USD values (no earnings) */
|
|
1244
|
+
balances: StakedBeraAsset[] | undefined;
|
|
1245
|
+
/** Slow path: full enriched positions with earnings */
|
|
1246
|
+
data: StakedBeraAsset[] | undefined;
|
|
1247
|
+
/** True only when both balances and positions are still loading */
|
|
1248
|
+
isLoading: boolean;
|
|
1249
|
+
isLoadingBalances: boolean;
|
|
1250
|
+
isLoadingPositions: boolean;
|
|
1251
|
+
isValidatingPositions: boolean;
|
|
1252
|
+
};
|
|
1229
1253
|
|
|
1230
1254
|
type UseStakedBeraSnapshot = Record<Address, {
|
|
1231
1255
|
_timestamp: number;
|
|
@@ -1274,7 +1298,7 @@ declare function useBeraCurrentPrice(opts?: DefaultHookOptions): {
|
|
|
1274
1298
|
error: any;
|
|
1275
1299
|
mutate: swr.KeyedMutator<TokenCurrentPriceMap>;
|
|
1276
1300
|
isValidating: boolean;
|
|
1277
|
-
isLoading:
|
|
1301
|
+
isLoading: swr__internal.IsLoadingResponse<Data, Config>;
|
|
1278
1302
|
};
|
|
1279
1303
|
|
|
1280
1304
|
type UseMultipleTokenInformationResponse = DefaultHookReturnType<Token[]>;
|
|
@@ -1335,7 +1359,7 @@ declare function useTokenCurrentPrice({ address }: {
|
|
|
1335
1359
|
error: any;
|
|
1336
1360
|
mutate: swr.KeyedMutator<TokenCurrentPriceMap>;
|
|
1337
1361
|
isValidating: boolean;
|
|
1338
|
-
isLoading:
|
|
1362
|
+
isLoading: swr__internal.IsLoadingResponse<Data, Config>;
|
|
1339
1363
|
};
|
|
1340
1364
|
|
|
1341
1365
|
/**
|
|
@@ -1350,7 +1374,7 @@ declare function useTokenCurrentPrices({ addressIn, }?: {
|
|
|
1350
1374
|
error: any;
|
|
1351
1375
|
mutate: swr.KeyedMutator<TokenCurrentPriceMap>;
|
|
1352
1376
|
isValidating: boolean;
|
|
1353
|
-
isLoading:
|
|
1377
|
+
isLoading: swr__internal.IsLoadingResponse<Data, Config>;
|
|
1354
1378
|
};
|
|
1355
1379
|
|
|
1356
1380
|
type UseTokenInformationResponse = DefaultHookReturnType<Token | undefined>;
|
|
@@ -1477,7 +1501,7 @@ declare function useDefaultRewardAllocation(options?: DefaultHookOptions): {
|
|
|
1477
1501
|
error: any;
|
|
1478
1502
|
mutate: swr.KeyedMutator<ValidatorRewardAllocation | undefined>;
|
|
1479
1503
|
isValidating: boolean;
|
|
1480
|
-
isLoading:
|
|
1504
|
+
isLoading: swr__internal.IsLoadingResponse<Data, Config>;
|
|
1481
1505
|
};
|
|
1482
1506
|
|
|
1483
1507
|
/**
|
|
@@ -1497,7 +1521,7 @@ declare const useManagedValidatorByAccount: ({ account }: {
|
|
|
1497
1521
|
error: any;
|
|
1498
1522
|
mutate: swr.KeyedMutator<_berachain_graphql_pol_subgraph.GetValidatorByAccountQuery | undefined>;
|
|
1499
1523
|
isValidating: boolean;
|
|
1500
|
-
isLoading:
|
|
1524
|
+
isLoading: swr__internal.IsLoadingResponse<Data, Config>;
|
|
1501
1525
|
};
|
|
1502
1526
|
|
|
1503
1527
|
type ManagedValidatorRole = {
|
|
@@ -1587,7 +1611,7 @@ declare const useUserStakingPositions: ({ account, validatorAddress, }: {
|
|
|
1587
1611
|
error: any;
|
|
1588
1612
|
mutate: swr.KeyedMutator<UserStakingPoolPosition[]>;
|
|
1589
1613
|
isValidating: boolean;
|
|
1590
|
-
isLoading:
|
|
1614
|
+
isLoading: swr__internal.IsLoadingResponse<Data, Config>;
|
|
1591
1615
|
};
|
|
1592
1616
|
|
|
1593
1617
|
declare function useValidator({ pubkey }: {
|
|
@@ -1739,7 +1763,7 @@ declare function useValidatorRewardAllocation(pubKey: Address, options?: Default
|
|
|
1739
1763
|
isNeverSet: boolean;
|
|
1740
1764
|
}>;
|
|
1741
1765
|
isValidating: boolean;
|
|
1742
|
-
isLoading:
|
|
1766
|
+
isLoading: swr__internal.IsLoadingResponse<Data, Config>;
|
|
1743
1767
|
};
|
|
1744
1768
|
|
|
1745
1769
|
export { IHoneySwapState, IUseContractWriteArgs, type LiquidityMismatchInfo, type ManagedValidatorRole, type OnChainPoolFragment, type Oracle, OracleMode, type RewardVault, type TokenPriceInput, type TokenPriceMap, type TokenPriceOutput, USE_AGGREGATORS_QUOTES_QUERY_KEY, type UseCappedGloballyResponse, type UseCappedRelativelyResponse, type UseCollateralWeightsResponse, UseContractWriteApi, type UseIsBadCollateralResponse, type UseMultipleTokenInformationResponse, type UsePollAllowancesArgs, type UsePollAllowancesResponse, type UsePollBalancesResponse, type UsePollMarketsResponse, type UsePollProposalResponse, type UsePollValidatorInfoResponse, type UsePollWalletBalancesArgs, type UseRewardVaultResponse, type UseStakingTokenInformationResponse, type UseTokenInformationArgs, type UseTokenInformationResponse, useAggregatorsQuotes, useAggregatorsRouterFeeBps, useAllUserPools, useAllUserPoolsQueryKey, useAllValidators, useAllValidatorsQueryKey, useApiEnrichedAllocation, useApiPool, useApiPoolQueryKey, useApiValidator, useApiValidatorQueryKey, useBaselineRewardAllocation, useBendZapSupply, useBendZapSupplyHelper, useBeraContractWrite, useBeraCurrentPrice, useBgtAprSimulation, useBgtUnstakedBalance, useBlockToTimestamp, useCappedGlobally, useCappedRelatively, useClaimableFees, useCollateralWeights, useCreatePool, useCreateProposal, useDailyValidatorBlockStats, useDefaultRewardAllocation, useEnsoSwapBundle, useExploitedTokens, useExploitedTokensQueryKey, useGetConvertToAssets, useGetPastVotes, useGetVerifiedAbi, useGlobalLiquidityAndSwapVolume, useHasVoted, useHighestVaultsAPR, useHistoryState, useHoneyAlerts, useHoneyBalances, useHoneyChartData, useHoneyGlobalData, useHoneyVaultsBalance, useIsBadCollateralAsset, useIsBasketModeEnabled, useIsCanceller, useLiquidityMismatch, useLpPosition, useManagedValidatorByAccount, useManagedValidatorRole, useMultipleTokenApprovalsWithSlippage, useMultipleTokenInformation, type useMultipleTokenInformationArgs, useOnChainPoolData, useOnChainPoolDataQueryKey, useOnChainValidator, usePollAllProposals, usePollAllProposalsQueryKey, usePollAllowances, usePollBalance, usePollGlobalData, usePollMarkets, usePollMarketsQueryKey, usePollPoolCreationRelayerApproval, usePollProposal, usePollProposalThreshold, usePollProposalVotes, usePollProposalVotesQueryKey, usePollUserDelegates, usePollWalletBalances, usePool, usePoolEvents, usePoolHistoricalData, usePools, usePoolsQueryKey, usePrevious, usePriceImpact, useProposalFromTx, useProposalSnapshot, useProposalState, useProposalTimelockState, usePythLatestPrices, usePythUpdateFee, useQueuedBeraUnlock, useQuorum, useRewardTokenToBeraRate, useRewardVault, useRewardVaultBalanceFromStakingToken, useRewardVaultFromToken, useRewardVaultIncentives, useRewardVaultQueryKey, useRewardVaultRewards, useRewardVaults, useRewardVaultsQueryKey, useSWBeraVaultMetadata, useSingleAggregatorQuote, useStakedAPR, useStakedData, useStakedSnapshots, useStakingPoolBatch, useStakingTokenInformation, type useStakingTokenInformationArgs, useSubgraphPoolQueryKey, useSubgraphUserValidators, useTokenCurrentPrice, useTokenCurrentPrices, useTokenInformation, useTokenPrice, useTokenPrices, useTokens, useTotalStakedAmount, useTotalSupply, useUserActiveValidators, useUserBoostsOnValidator, useUserClaimableIncentives, useUserStakingPositions, useUserVaultInfo, useUserVaults, useValidator, useValidatorAnalytics, useValidatorCommission, useValidatorEstimatedBgtPerYear, useValidatorQueuedCommission, useValidatorQueuedOperatorAddress, useValidatorQueuedRewardAllocation, useValidatorRewardAllocation, useVaultAddress, useVaultHistory, useVaultValidators, useZapStakeBera };
|