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wapInfo.tsx","webpack://_N_E/./hooks/useFetchLPDistribution.ts","webpack://_N_E/./views/NewPosition/Context.tsx","webpack://_N_E/./views/NewPosition/Pool/ZapInSwapPath.tsx","webpack://_N_E/./views/NewPosition/Pool/SwapDetail.tsx","webpack://_N_E/./views/NewPosition/styles.ts","webpack://_N_E/./views/NewPosition/util.tsx","webpack://_N_E/<anon>"],"sourcesContent":["import {\n IAddSnackbarProps,\n useSnackbarV2,\n} from \"@/components/SnackbarContext/SnackbarContextV2\";\nimport { useMutatePositionMap } from \"../useCurrentChainPositions\";\nimport { useFetchUserTokensBalance } from \"../useFetchUserTokensBalance\";\n\nexport const usePositionSnackBar = () => {\n const { addSnackbar } = useSnackbarV2();\n const { mutatePositionMap } = useMutatePositionMap();\n const { mutate: tokenBalanceMutate } = useFetchUserTokensBalance();\n\n const addPositionSnackbar = (props: IAddSnackbarProps) => {\n const onTxSuccess = () => {\n mutatePositionMap();\n tokenBalanceMutate();\n props.onTxSuccess?.();\n };\n\n addSnackbar({\n ...props,\n onTxSuccess,\n });\n };\n\n return { addPositionSnackbar };\n};\n","import {\n useAllChainStateStore,\n useSolverRoutingStore,\n} from \"@/components/GlobalStore\";\nimport { useNetwork } from \"@/components/NetworkContext/NetworkContext\";\nimport {\n CreatePositionOptions,\n IncreaseLiquidityOptions,\n RebalanceOptions,\n SwapCall,\n} from \"@/config/position/positionConfig\";\nimport {\n getIncreaseLiquidityOptimalSwapInfo,\n getRebalanceSwapData,\n} from \"@/helper/positionHelper\";\nimport { getSwapInfo } from \"@/views/NewPosition/util\";\nimport { SwapPathProps } from \"@aperture/uikit\";\nimport { getLogger } from \"@aperture_finance/uniswap-v3-automation-sdk\";\nimport { E_Solver } from \"@aperture_finance/uniswap-v3-automation-sdk/dist/viem\";\nimport { useRequest } from \"ahooks\";\nimport { useState, useTransition } from \"react\";\nimport { useAccount } from \"wagmi\";\nimport { useEventCallback } from \"../useEventCallback\";\n\nconst DEFAULT_SOLVERS = [E_Solver.SamePool, E_Solver.OneInch];\n\nexport const useSwapInfo = () => {\n const { ammEnum, networkId, publicClient } = useNetwork();\n const { address } = useAccount();\n const { updateTokenPriceMap } = useAllChainStateStore();\n const { setSwapInfo } = useSolverRoutingStore();\n const [isSyncing, setIsSyncing] = useState(false);\n const [isSyncingTx, setIsSyncingTx] = useState(false);\n const [fetchInfo, setFetchInfo] = useState<Record<string, SwapPathProps[]>>(\n {}\n );\n const [, startTransition] = useTransition();\n\n const {\n run,\n loading,\n error: swapInfoError,\n cancel: _cancelSwapInfo,\n } = useRequest(\n async (swapCall: SwapCall) => {\n const { type, positionId, slippage, tokenMap, fetchKey, options } =\n swapCall;\n\n let result: SwapPathProps[];\n if (type === \"Rebalance\") {\n const { tickLower, tickUpper, tokenPrices } =\n options as RebalanceOptions;\n result = await getRebalanceSwapData(\n ammEnum,\n networkId,\n address,\n BigInt(positionId),\n tickLower,\n tickUpper,\n slippage,\n tokenPrices,\n tokenMap,\n publicClient,\n DEFAULT_SOLVERS\n );\n } else if (type === \"IncreaseLiquidity\") {\n const { pool, deadline, amounts } = options as IncreaseLiquidityOptions;\n setIsSyncingTx(true);\n result = await getIncreaseLiquidityOptimalSwapInfo(\n ammEnum,\n networkId,\n address,\n positionId,\n pool,\n slippage,\n deadline,\n amounts,\n tokenMap,\n publicClient,\n DEFAULT_SOLVERS\n );\n } else if (type === \"CreatePosition\") {\n const { poolKey, tickLower, tickUpper, tokenA, tokenB, amounts } =\n options as CreatePositionOptions;\n result = await getSwapInfo(\n ammEnum,\n networkId,\n tokenMap,\n tokenA,\n tokenB,\n amounts[0],\n amounts[1],\n poolKey,\n tickLower,\n tickUpper,\n address,\n slippage,\n publicClient,\n DEFAULT_SOLVERS\n );\n }\n setSwapInfo(result);\n setFetchInfo((prev) => ({\n ...prev,\n [fetchKey]: result,\n }));\n },\n {\n manual: true,\n pollingInterval: 30_000,\n onFinally: () => setIsSyncing(false),\n onError: (e, [{ type, fetchKey, options }]) => {\n setIsSyncingTx(false);\n setSwapInfo(fetchInfo?.[fetchKey]);\n setFetchInfo({});\n if (type === \"Rebalance\") {\n const { tokenPrices } = options as RebalanceOptions;\n if (tokenPrices[0] === \"0\" || tokenPrices[1] === \"0\") {\n getLogger().info(\"Refetching token prices due to invalid data\", {\n ...options,\n });\n // lazy refetch token prices if it's not available\n setTimeout(() => {\n updateTokenPriceMap({ chainId: networkId });\n }, 5_000);\n }\n }\n },\n }\n );\n\n const cancelSwapInfo = useEventCallback(() => {\n _cancelSwapInfo();\n startTransition(() => {\n setFetchInfo({});\n setSwapInfo(undefined);\n setIsSyncing(false);\n setIsSyncingTx(false);\n });\n });\n\n return {\n isSyncing: isSyncing || loading,\n setIsSyncing,\n setFetchInfo,\n runSwapInfo: useEventCallback(run),\n swapInfoError,\n cancelSwapInfo,\n isSyncingTx,\n setIsSyncingTx,\n };\n};\n","import { useNetwork } from \"@/components/NetworkContext/NetworkContext\";\nimport { isManta } from \"@/utils/networkHelper\";\nimport { AmmEnum, ChartEntry } from \"@aperture/uikit\";\nimport {\n ApertureSupportedChainId,\n viem,\n} from \"@aperture_finance/uniswap-v3-automation-sdk\";\nimport { TickMath } from \"@aperture_finance/uniswap-v3-sdk\";\nimport bigDecimal from \"js-big-decimal\";\nimport useSWR from \"swr/immutable\";\nimport { PublicClient } from \"viem\";\n\nexport function useFetchLPDistribution(\n tokenAAddress: string | null,\n tokenBAddress: string | null,\n poolKey: number | undefined\n) {\n const { ammEnum, networkId, publicClient } = useNetwork();\n const shouldFetch = ammEnum && tokenAAddress && tokenBAddress && poolKey;\n return useSWR(\n shouldFetch\n ? `token-distribution-${ammEnum}-${networkId}-${tokenAAddress}-${tokenBAddress}-${poolKey}`\n : null,\n () =>\n getLPDistribution(\n ammEnum,\n networkId,\n publicClient,\n tokenAAddress,\n tokenBAddress,\n poolKey\n )\n );\n}\n\nasync function getLPDistribution(\n amm: AmmEnum,\n chainId: ApertureSupportedChainId,\n publicClient: PublicClient,\n tokenAAddress: string,\n tokenBAddress: string,\n poolKey: number\n) {\n const pool = await viem.getPool(\n tokenAAddress,\n tokenBAddress,\n poolKey,\n chainId,\n amm,\n publicClient\n );\n // TODO: add fallback method using subgraph\n let liquidityArray: viem.Liquidity[];\n try {\n // Fetch for full range (TickMath.MIN_TICK, TickMath.MAX_TICK)\n liquidityArray = await viem.getLiquidityArrayForPool(\n chainId,\n amm,\n pool,\n TickMath.MIN_TICK,\n TickMath.MAX_TICK,\n publicClient\n );\n } catch (error) {\n // Failed to fetch for full range, fetch in batches of 3k ensuring that current tick is within the specified tick range\n liquidityArray = [];\n const ticksPerBatch = isManta(chainId) ? 300 : 3000;\n const batches = [\n {\n minTick: pool.tickCurrent - ticksPerBatch * pool.tickSpacing,\n maxTick: pool.tickCurrent,\n },\n {\n minTick: pool.tickCurrent,\n maxTick: pool.tickCurrent + ticksPerBatch * pool.tickSpacing,\n },\n ];\n for (const batch of batches) {\n try {\n const batchData = await viem.getLiquidityArrayForPool(\n chainId,\n amm,\n pool,\n batch.minTick,\n batch.maxTick,\n publicClient\n );\n liquidityArray = [...liquidityArray, ...batchData];\n } catch (batchError) {\n console.error(\n `Failed to fetch batch ${batch.minTick} to ${batch.maxTick}.`,\n batchError\n );\n }\n }\n // Remove duplicates\n liquidityArray = Array.from(\n new Map(liquidityArray.map((item) => [item.tick, item])).values()\n );\n }\n\n const currentLiquidity = liquidityArray.reduce(function (previous, current) {\n return Math.abs(current.tick - pool.tickCurrent) <\n Math.abs(previous.tick - pool.tickCurrent)\n ? current\n : previous;\n }).liquidityActive;\n\n const formatDataToken0: ChartEntry[] = [];\n const formatDataToken1: ChartEntry[] = [];\n liquidityArray.forEach((liquidity) => {\n const liquidityActive = Number(liquidity.liquidityActive);\n if (\n bigDecimal.compareTo(\n liquidityActive,\n bigDecimal.multiply(currentLiquidity, 10)\n ) < 0\n ) {\n formatDataToken0.push({\n activeLiquidity: liquidityActive,\n price0: Number(liquidity.price0),\n });\n formatDataToken1.push({\n activeLiquidity: liquidityActive,\n price0: Number(liquidity.price1),\n });\n }\n });\n return { tokenA: formatDataToken0, tokenB: formatDataToken1 };\n}\n","import { useGlobalSlippage } from \"@/components/GlobalStore\";\nimport { useNetwork } from \"@/components/NetworkContext/NetworkContext\";\nimport { SwapCall } from \"@/config/position/positionConfig\";\nimport { getTokensFromInfo } from \"@/helper/tokenHelper\";\nimport { useCurrentChainToken } from \"@/hooks/globalState/useCurrentChainToken\";\nimport { useSwapInfo } from \"@/hooks/swapInfo/useSwapInfo\";\nimport { TokenPriceMap } from \"@/hooks/useFetchAllChainsTokensPrice\";\nimport { useFetchCurrentChainMarketPrice } from \"@/hooks/useFetchMarketPrice\";\nimport { useFetchUserTokensBalance } from \"@/hooks/useFetchUserTokensBalance\";\nimport { OpenPositionQueryKey as QueryKey } from \"@/utils/browserHistory\";\nimport { DEFAULT_SLIPPAGE } from \"@/utils/helper\";\nimport { IToken } from \"@aperture/types\";\nimport { ITransactionSettingsForm } from \"@aperture/uikit\";\nimport { SlipStreamPool } from \"@aperture_finance/uniswap-v3-automation-sdk/dist/viem\";\nimport { Pool, TICK_SPACINGS } from \"@aperture_finance/uniswap-v3-sdk\";\nimport { Token } from \"@uniswap/sdk-core\";\nimport {\n PropsWithChildren,\n createContext,\n useContext,\n useMemo,\n useState,\n} from \"react\";\nimport {\n useAvailableASPools,\n useCachedFetchTokenMap,\n useCurrentPool,\n useUrlQuery,\n} from \"./hooks\";\n\ninterface OpenPositionContextType {\n tokenMap: Record<string, IToken>;\n commonTokens: IToken[];\n tokensPrice: TokenPriceMap;\n availableASPools: SlipStreamPool[];\n\n selectedTokenA: IToken;\n selectedTokenB: IToken;\n selectedTokenList: { token0: Token; token1: Token };\n\n setSelectedToken: (\n key: QueryKey.TOKEN_A | QueryKey.TOKEN_B,\n token: IToken | null\n ) => void;\n\n baseTokenIdx: 0 | 1;\n setBaseTokenIdx: (idx: 0 | 1) => void;\n\n startPrice: string;\n setStartPrice: (price: string) => void;\n\n marketPrice: Record<\n number,\n {\n tokenA: string;\n tokenB: string;\n }\n >;\n marketPriceLoading: boolean;\n\n tickLower: number;\n tickUpper: number;\n\n setTickUrl: (\n key: QueryKey.TICK_LOWER | QueryKey.TICK_UPPER,\n tick: number\n ) => void;\n\n isSettingChanged: boolean;\n\n zapIn: boolean;\n setZapInUrl: (zapIn: boolean) => void;\n\n feeTier: number;\n tickSpacing: number;\n poolKey: number;\n setPoolKeyUrl: (poolKey: number) => void;\n\n selectedZapInToken: IToken | [IToken, IToken];\n setSelectedZapInToken: (token: IToken | [IToken, IToken] | undefined) => void;\n\n tokenAAmount: string;\n setTokenAAmount: (amount: string) => void;\n\n tokenBAmount: string;\n setTokenBAmount: (amount: string) => void;\n\n zapTokenAAmount: string;\n setZapTokenAAmount: (amount: string) => void;\n\n zapTokenBAmount: string;\n setZapTokenBAmount: (amount: string) => void;\n\n txnSetting: ITransactionSettingsForm;\n setTxnSetting: (setting: ITransactionSettingsForm) => void;\n\n lowPrice: string;\n setLowPrice: (price: string) => void;\n\n highPrice: string;\n setHighPrice: (price: string) => void;\n\n totalPrice: string;\n setTotalPrice: (price: string) => void;\n\n pool: Pool | null;\n isPoolInitialization: boolean;\n\n isSyncing: boolean;\n setIsSyncing: (isSyncing: boolean) => void;\n runSwapInfo: (swapCall: SwapCall) => void;\n cancelSwapInfo: () => void;\n swapInfoError: Error | null;\n\n tokenBalanceMutate: () => void;\n}\n\nconst OpenPositionContext = createContext<OpenPositionContextType | undefined>(\n undefined\n);\n\nexport const OpenPositionProvider: React.FC<PropsWithChildren> = ({\n children,\n}) => {\n const { networkId, ammEnum } = useNetwork();\n\n const { commonTokens, data: tokenMap } = useCachedFetchTokenMap();\n const { currentTokenPrice: tokensPrice } = useCurrentChainToken(networkId);\n const { mutate: tokenBalanceMutate } = useFetchUserTokensBalance();\n\n const [selectedZapInToken, setSelectedZapInToken] = useState<\n IToken | [IToken, IToken]\n >();\n\n const [tokenAAmount, setTokenAAmount] = useState<string>(\"\");\n const [tokenBAmount, setTokenBAmount] = useState<string>(\"\");\n\n const [zapTokenAAmount, setZapTokenAAmount] = useState<string>(\"\");\n const [zapTokenBAmount, setZapTokenBAmount] = useState<string>(\"\");\n\n const [baseTokenIdx, setBaseTokenIdx] = useState<0 | 1>(0);\n const [startPrice, setStartPrice] = useState<string>(\"\");\n\n const { globalSlippage } = useGlobalSlippage();\n const [txnSetting, setTxnSetting] = useState<ITransactionSettingsForm>({\n slippage: globalSlippage ?? DEFAULT_SLIPPAGE,\n deadline: \"30\",\n });\n\n const [lowPrice, setLowPrice] = useState<string>(\"\");\n const [highPrice, setHighPrice] = useState<string>(\"\");\n const [totalPrice, setTotalPrice] = useState<string>(\"0\");\n\n const {\n isSyncing,\n setIsSyncing,\n runSwapInfo,\n cancelSwapInfo,\n swapInfoError,\n } = useSwapInfo();\n\n const {\n feeTier: poolKey,\n selectedTokenA,\n selectedTokenB,\n tickLower,\n tickUpper,\n zapIn,\n isUrlUpdated,\n setFeeTierUrl: setPoolKeyUrl,\n setTickUrl,\n setSelectedToken,\n setZapInUrl,\n } = useUrlQuery(tokenMap);\n\n const selectedTokenList = useMemo(() => {\n // selectedTokenList should change only when token address and decimals changed\n if (selectedTokenA && selectedTokenB && networkId) {\n return getTokensFromInfo(selectedTokenA, selectedTokenB, networkId);\n } else {\n return null;\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n selectedTokenA?.address,\n selectedTokenA?.decimals,\n selectedTokenB?.address,\n selectedTokenB?.decimals,\n networkId,\n ]);\n\n const availableASPools = useAvailableASPools(\n selectedTokenList?.token0?.address ?? null,\n selectedTokenList?.token1?.address ?? null\n );\n\n const { data: marketPrice, isLoading: marketPriceLoading } =\n useFetchCurrentChainMarketPrice(\n selectedTokenA?.address ?? null,\n selectedTokenB?.address ?? null,\n availableASPools.map((pool) => pool.tickSpacing)\n );\n\n const resetQueryParams = () => {\n setSelectedToken(QueryKey.TOKEN_A, null);\n setSelectedToken(QueryKey.TOKEN_B, null);\n setPoolKeyUrl(undefined);\n setZapInUrl(undefined);\n setTickUrl(QueryKey.TICK_LOWER, undefined);\n setTickUrl(QueryKey.TICK_UPPER, undefined);\n setPreviousNetworkId(networkId);\n };\n\n const [previousNetworkId, setPreviousNetworkId] = useState(networkId);\n if (networkId !== previousNetworkId) {\n resetQueryParams();\n setPreviousNetworkId(networkId);\n }\n\n const [previousPoolKey, setPreviousPoolKey] = useState(poolKey);\n if (poolKey !== previousPoolKey) {\n if (isUrlUpdated) {\n setStartPrice(\"\");\n if (!marketPrice?.[poolKey]) {\n // if the pool is not available, reset the tick\n setTickUrl(QueryKey.TICK_LOWER, undefined);\n setTickUrl(QueryKey.TICK_UPPER, undefined);\n }\n }\n setPreviousPoolKey(poolKey);\n }\n\n const { fee, tickSpacing } = useMemo(() => {\n if (ammEnum !== \"SLIPSTREAM\") {\n return {\n fee: poolKey,\n tickSpacing: TICK_SPACINGS[poolKey],\n };\n }\n\n return (\n availableASPools?.find((pool) => pool.tickSpacing === poolKey) ?? {\n fee: 0,\n tickSpacing: 0,\n }\n );\n }, [ammEnum, availableASPools, poolKey]);\n\n const currentPoolStatus = !!marketPrice?.[poolKey];\n\n const pool = useCurrentPool({\n token0: selectedTokenList?.token0,\n token1: selectedTokenList?.token1,\n poolKey,\n startPrice,\n baseToken: baseTokenIdx ? selectedTokenB : selectedTokenA,\n currentPoolStatus,\n });\n\n const isPoolInitialization =\n !marketPriceLoading &&\n !currentPoolStatus &&\n poolKey &&\n !!selectedTokenA &&\n !!selectedTokenB;\n\n return (\n <OpenPositionContext.Provider\n value={{\n tokenMap,\n commonTokens,\n tokensPrice,\n\n availableASPools,\n\n tokenBalanceMutate,\n\n feeTier: fee,\n tickSpacing,\n poolKey,\n setPoolKeyUrl,\n\n selectedTokenA,\n selectedTokenB,\n setSelectedToken,\n\n baseTokenIdx,\n setBaseTokenIdx,\n\n startPrice,\n setStartPrice,\n\n marketPrice,\n marketPriceLoading,\n\n selectedTokenList,\n tickLower,\n tickUpper,\n\n zapIn,\n setZapInUrl,\n\n isSettingChanged: isUrlUpdated,\n\n selectedZapInToken,\n setSelectedZapInToken,\n\n tokenAAmount,\n setTokenAAmount,\n\n tokenBAmount,\n setTokenBAmount,\n\n zapTokenAAmount,\n setZapTokenAAmount,\n\n zapTokenBAmount,\n setZapTokenBAmount,\n\n setTickUrl,\n\n txnSetting,\n setTxnSetting,\n\n lowPrice,\n setLowPrice,\n\n highPrice,\n setHighPrice,\n\n totalPrice,\n setTotalPrice,\n\n pool,\n isPoolInitialization,\n\n isSyncing,\n setIsSyncing,\n runSwapInfo,\n cancelSwapInfo,\n swapInfoError,\n }}\n >\n {children}\n </OpenPositionContext.Provider>\n );\n};\n\nexport const useOpenPositionContext = () => {\n const context = useContext(OpenPositionContext);\n if (!context) {\n throw new Error(\n \"useOpenPositionContext must be used within a OpenPositionProvider\"\n );\n }\n return context;\n};\n","import { useSolverRoutingStore } from \"@/components/GlobalStore\";\nimport { OrderRoutingModal } from \"@/components/layout/hooks\";\nimport { useNetwork } from \"@/components/NetworkContext/NetworkContext\";\nimport { getSwapFailureMessage } from \"@/helper/positionHelper\";\nimport { DEFAULT_APERTURE_ZAPIN_FEE } from \"@/utils/helper\";\nimport { ApertureLogos } from \"@aperture/assetkit\";\nimport { IToken } from \"@aperture/types\";\nimport { SwapPath } from \"@aperture/uikit\";\nimport { E_ModalKey, FlexColumn, T2, useModal } from \"@aperture/uikitv2\";\nimport bigDecimal from \"js-big-decimal\";\nimport { useEffect } from \"react\";\nimport styled, { useTheme } from \"styled-components\";\nimport { useAccount } from \"wagmi\";\nimport { useOpenPositionContext } from \"../Context\";\n\nconst NoSwapInfoWrapper = styled(FlexColumn)`\n margin: 32px 0;\n align-items: center;\n gap: ${({ theme }) => theme.spacing[\"3xl\"]};\n`;\nconst NoSwapInfoText = styled(T2)`\n color: ${({ theme }) => theme.colors.global.text.T3};\n`;\n\nexport const ZapInSwapPath = (props: {\n hide?: boolean;\n zapTokenA: IToken;\n zapTokenB: IToken;\n\n zapTokenAAmount: string;\n zapTokenBAmount: string;\n\n tickLower: number;\n tickUpper: number;\n\n keepDropdown?: boolean;\n}) => {\n const {\n hide,\n zapTokenA,\n zapTokenB,\n zapTokenAAmount,\n zapTokenBAmount,\n tickLower,\n tickUpper,\n keepDropdown,\n } = props;\n\n const theme = useTheme();\n const {\n poolKey,\n tokenMap,\n totalPrice,\n isPoolInitialization,\n\n isSyncing,\n setIsSyncing,\n runSwapInfo,\n cancelSwapInfo,\n swapInfoError,\n txnSetting,\n } = useOpenPositionContext();\n\n const { address: walletAddress } = useAccount();\n const { ammEnum, networkId } = useNetwork();\n const { swapInfo, selectedSolver, suggestedSolver, noNeedSwap } =\n useSolverRoutingStore();\n const { setModalState } = useModal();\n\n useEffect(() => {\n if (isPoolInitialization) {\n cancelSwapInfo();\n return;\n }\n setIsSyncing(true);\n\n const option_amounts = [\n zapTokenAAmount !== \"\" ? zapTokenAAmount : \"0\",\n zapTokenBAmount !== \"\" ? zapTokenBAmount : \"0\",\n ];\n if (\n bigDecimal.compareTo(option_amounts[0], 0) === 0 &&\n bigDecimal.compareTo(option_amounts[1], 0) === 0\n ) {\n cancelSwapInfo();\n } else {\n const fetchKey =\n `${ammEnum}-${networkId}-${walletAddress}` +\n `:${zapTokenA.address}-${zapTokenB.address}-${poolKey}` +\n `:[${tickLower},${tickUpper}]_${txnSetting.slippage}` +\n `:[${option_amounts[0]},${option_amounts[1]}]`;\n runSwapInfo({\n type: \"CreatePosition\",\n positionId: \"\",\n slippage: txnSetting.slippage,\n tokenMap,\n fetchKey,\n options: {\n tokenA: zapTokenA,\n tokenB: zapTokenB,\n amounts: option_amounts as [string, string],\n poolKey,\n tickLower,\n tickUpper,\n },\n });\n }\n }, [\n poolKey,\n txnSetting.slippage,\n cancelSwapInfo,\n setIsSyncing,\n runSwapInfo,\n zapTokenAAmount,\n zapTokenBAmount,\n ammEnum,\n networkId,\n walletAddress,\n zapTokenA,\n zapTokenB,\n tickLower,\n tickUpper,\n tokenMap,\n isPoolInitialization,\n ]);\n\n const selectedSwapInfo = swapInfo?.[selectedSolver];\n if ((!isSyncing && !selectedSwapInfo && !swapInfoError) || hide) {\n return null;\n } else if (!isSyncing && noNeedSwap) {\n return (\n <NoSwapInfoWrapper>\n <ApertureLogos.OutlineLogo fill={theme.colors.global.text.T1} />\n <NoSwapInfoText>No need to swap</NoSwapInfoText>\n </NoSwapInfoWrapper>\n );\n }\n\n return (\n <>\n <SwapPath\n loading={isSyncing}\n priceImpact={selectedSwapInfo?.priceImpact}\n api={selectedSwapInfo?.api}\n fromToken={selectedSwapInfo?.fromToken}\n swapData={selectedSwapInfo?.swapData}\n swapRoutes={selectedSwapInfo?.swapRoutes}\n showSwapRoutes={selectedSwapInfo?.swapRoutes?.length > 0}\n errorMsg={getSwapFailureMessage(\n swapInfo,\n swapInfoError,\n totalPrice === \"-\" ? \"0\" : totalPrice\n )}\n onBtnClick={() => setModalState(E_ModalKey.ORDER_ROUTING_MODAL, true)}\n suggested={selectedSolver === suggestedSolver}\n gasFeeUSD={selectedSwapInfo?.gasFeeUSD}\n keepDropdown={keepDropdown}\n feeUSD={selectedSwapInfo?.feeUSD}\n feePercentage={DEFAULT_APERTURE_ZAPIN_FEE * 100}\n />\n <OrderRoutingModal />\n </>\n );\n};\n","import { useSolverRoutingStore } from \"@/components/GlobalStore\";\nimport {\n ErrorMsg,\n getOtherTokenAmount,\n getSwapFailureMessage,\n} from \"@/helper/positionHelper\";\nimport { ChevronDown } from \"@aperture/uikit\";\nimport { Button, Flex, RaindropSpinner, T3Regular } from \"@aperture/uikitv2\";\nimport { useDebounce } from \"ahooks\";\nimport bigDecimal from \"js-big-decimal\";\nimport { useEffect, useMemo, useState } from \"react\";\nimport styled from \"styled-components\";\nimport { useOpenPositionContext } from \"../Context\";\nimport { H5 } from \"../styles\";\nimport { ZapInSwapPath } from \"./ZapInSwapPath\";\n\nconst Title = styled(Flex)<{ disabled: boolean }>`\n cursor: ${({ disabled }) => (disabled ? \"auto\" : \"pointer\")};\n`;\nconst Wrapper = styled.div`\n margin-top: 24px;\n`;\nconst ErrorMessage = styled(T3Regular)`\n padding: 2px 12px;\n border-radius: ${({ theme }) => theme.radii.md};\n color: ${({ theme }) => theme.colors.global.warning};\n background: ${({ theme }) =>\n theme.isDark ? \"rgba(237,156,0,0.1)\" : \"rgba(202,109,0,0.2)\"};\n`;\nconst StyledButton = styled(Button)<{ inDrawer?: boolean }>`\n background: ${({ theme, inDrawer }) =>\n inDrawer\n ? theme.colors.global.background.BG3\n : theme.colors.global.background.BG2};\n :hover {\n background: ${({ theme, inDrawer }) =>\n inDrawer\n ? theme.colors.global.background.BG4\n : theme.colors.global.background.BG3};\n color: ${({ theme }) => theme.colors.global.text.T2};\n }\n :disabled {\n cursor: not-allowed;\n }\n`;\n\nexport const SwapDetail = () => {\n const [hide, setHide] = useState(true);\n const [failureMessage, setFailureMessage] = useState(undefined);\n const { swapInfo } = useSolverRoutingStore();\n const {\n swapInfoError,\n totalPrice,\n selectedTokenA,\n selectedTokenB,\n isSyncing,\n pool,\n setTokenAAmount,\n setTokenBAmount,\n } = useOpenPositionContext();\n const { tickLower, tickUpper, zapTokenAAmount, zapTokenBAmount } =\n useDebounceForm();\n\n const tokenAmountOnChange = (value: string, isTokenA: boolean) => {\n const setter = isTokenA ? setTokenAAmount : setTokenBAmount;\n const otherSetter = isTokenA ? setTokenBAmount : setTokenAAmount;\n setter(value);\n if (pool && bigDecimal.compareTo(value, 0) > 0) {\n try {\n const otherTokenAmount = getOtherTokenAmount(\n isTokenA ? selectedTokenA.address : selectedTokenB.address,\n value,\n tickLower,\n tickUpper,\n pool\n ).toExact();\n otherSetter(otherTokenAmount);\n } catch (e) {\n console.log(\"Failed on getOtherTokenAmount\", e);\n otherSetter(\"\");\n }\n } else otherSetter(\"\");\n };\n\n useEffect(() => {\n if (isSyncing) return setFailureMessage(undefined);\n const timeId = setTimeout(() => {\n return setFailureMessage(\n getSwapFailureMessage(\n swapInfo,\n swapInfoError,\n totalPrice === \"-\" ? \"0\" : totalPrice\n )\n );\n }, 2020);\n return () => {\n clearTimeout(timeId);\n };\n }, [isSyncing, swapInfo, swapInfoError, totalPrice]);\n\n const showAlignTokens = failureMessage === ErrorMsg.InsufficientPoolToken;\n\n return (\n <Wrapper>\n <Title\n width=\"100%\"\n justifyContent=\"space-between\"\n disabled={!!failureMessage}\n onClick={() => !failureMessage && setHide(!hide)}\n >\n <H5>Swap Details</H5>\n <Flex alignItems=\"center\" gap={8}>\n {hide && isSyncing && <RaindropSpinner width={16} height={16} />}\n {failureMessage && <ErrorMessage>{failureMessage}</ErrorMessage>}\n {!failureMessage && <ChevronDown isShow={!hide} />}\n </Flex>\n </Title>\n <ZapInSwapPath\n hide={hide || !!failureMessage}\n zapTokenA={selectedTokenA}\n zapTokenB={selectedTokenB}\n zapTokenAAmount={zapTokenAAmount}\n zapTokenBAmount={zapTokenBAmount}\n tickLower={tickLower}\n tickUpper={tickUpper}\n keepDropdown={true}\n />\n {showAlignTokens && (\n <AlignTokenAmounts\n tokenA={selectedTokenA.ticker}\n tokenB={selectedTokenB.ticker}\n disableA={bigDecimal.compareTo(zapTokenBAmount, 0) <= 0}\n disableB={bigDecimal.compareTo(zapTokenAAmount, 0) <= 0}\n onAlignTokenA={() => tokenAmountOnChange(zapTokenBAmount, false)}\n onAlignTokenB={() => tokenAmountOnChange(zapTokenAAmount, true)}\n />\n )}\n </Wrapper>\n );\n};\n\ninterface IProps {\n tokenA: string;\n tokenB: string;\n onAlignTokenA: () => void;\n onAlignTokenB: () => void;\n disableA?: boolean;\n disableB?: boolean;\n isAddLP?: boolean;\n}\nexport const AlignTokenAmounts = ({\n tokenA,\n tokenB,\n onAlignTokenA,\n onAlignTokenB,\n disableA = false,\n disableB = false,\n isAddLP,\n}: IProps) => {\n return (\n <Flex gap=\"lg\" style={{ marginTop: 20 }}>\n <StyledButton\n variant=\"default\"\n size=\"xl\"\n width=\"256px\"\n onClick={onAlignTokenA}\n disabled={disableA}\n inDrawer={isAddLP}\n >{`Align ${tokenA} with ${tokenB}`}</StyledButton>\n <StyledButton\n variant=\"default\"\n size=\"xl\"\n width=\"256px\"\n onClick={onAlignTokenB}\n disabled={disableB}\n inDrawer={isAddLP}\n >{`Align ${tokenB} with ${tokenA}`}</StyledButton>\n </Flex>\n );\n};\n\nexport function useDebounceForm() {\n const { tokenAAmount, tokenBAmount, tickLower, tickUpper } =\n useOpenPositionContext();\n\n const form = useMemo(() => {\n return {\n zapTokenAAmount: tokenAAmount || \"0\",\n zapTokenBAmount: tokenBAmount || \"0\",\n tickLower,\n tickUpper,\n };\n }, [tokenAAmount, tokenBAmount, tickLower, tickUpper]);\n\n return useDebounce(form, { wait: 2000 });\n}\n","import { AccessoryIcons } from \"@aperture/assetkit\";\nimport {\n Button,\n Flex,\n FlexColumn,\n Headline5,\n SwitchMenuTab,\n} from \"@aperture/uikit\";\nimport styled from \"styled-components\";\nimport {\n FlexboxProps,\n GridProps,\n LayoutProps,\n SpaceProps,\n} from \"styled-system\";\n\nexport const Wrapper = styled.div<\n FlexboxProps & GridProps & LayoutProps & SpaceProps & { mt?: number }\n>`\n display: flex;\n flex-direction: row;\n padding-bottom: ${({ theme }) => theme.spacing[\"10xl\"]};\n padding: 0;\n margin-top: ${({ mt }) => `${mt ?? 24}px`};\n gap: 40px;\n`;\n\nexport const Container = styled(Wrapper)`\n margin-top: 0;\n gap: 0;\n width: 520px;\n flex-direction: column;\n color: ${({ theme }) => theme.colors.global.text.T1};\n padding-bottom: 0;\n`;\n\nexport const ContentBox = styled(Wrapper)`\n margin-top: 0;\n gap: 0;\n gap: ${({ theme }) => theme.spacing.lg};\n flex-direction: row;\n padding-bottom: 0;\n`;\n\nexport const Content = styled(Wrapper)`\n margin-top: 0;\n gap: 0;\n gap: ${({ theme }) => theme.spacing.lg};\n flex-direction: column;\n padding-bottom: 0;\n`;\n\nexport const ContentFeeTier = styled(Wrapper)`\n margin-top: 24px;\n gap: 0;\n gap: ${({ theme }) => theme.spacing.lg};\n flex-direction: column;\n padding-bottom: 0;\n`;\n\nexport const ButtonBox = styled(Button)`\n font-family: \"Roboto Flex\";\n font-size: 16px;\n font-weight: 500;\n line-height: 20px;\n color: ${({ theme }) => theme.colors.global.textAlt.T1};\n background-color: ${({ theme }) => theme.colors.global.primary};\n\n :hover {\n background-color: ${({ theme }) => theme.colors.global.primary};\n ${({ disabled }) => !disabled && \"opacity: 0.8;\"}\n }\n :disabled {\n background-color: ${({ theme }) => theme.colors.global.primaryDisable};\n }\n`;\n\nexport const SelectedToken = styled.div<{ disabled?: boolean }>`\n width: 254px;\n height: 40px;\n padding: 0 14.5px 0 12px;\n display: flex;\n align-items: center;\n box-sizing: border-box;\n color: ${({ theme, disabled }) =>\n disabled ? theme.colors.global.text.T4 : theme.colors.global.text.T1};\n background-color: ${({ theme, disabled }) =>\n disabled\n ? theme.colors.global.background.BG4\n : theme.colors.global.background.BG2};\n border-radius: ${({ theme }) => theme.radii.round};\n &:hover {\n opacity: 0.8;\n }\n cursor: ${({ disabled }) => (disabled ? \"auto\" : \"pointer\")};\n`;\n\nexport const SelectedTokenIconWrapper = styled.div`\n margin-right: 8px;\n height: 28px;\n width: 28px;\n`;\n\nexport const ArrowDownWrapper = styled.div`\n margin-left: auto;\n > svg,\n path {\n fill: ${({ theme }) => theme.colors.global.text.T1};\n }\n`;\n\nexport const ArrowDown = styled(AccessoryIcons.CaretIcon)`\n width: 20px;\n height: 20px;\n`;\n\nexport const IGMaxWrapper = styled.div<{ disabled?: boolean }>`\n width: 254px;\n height: 126px;\n opacity: ${({ disabled }) => (disabled ? 0.5 : 1)};\n cursor: ${({ disabled }) => (disabled ? \"no-drop\" : \"auto\")};\n`;\n\nexport const SpaceBetweenLine = styled(Wrapper)<{ height: number }>`\n margin-top: 24px;\n align-items: center;\n flex-direction: column;\n justify-content: flex-start;\n align-items: flex-start;\n gap: 20px;\n height: ${({ height }) => `${height}px`};\n`;\n\nexport const StyledTokenTab = styled(SwitchMenuTab)`\n margin-right: 4px;\n`;\n\nexport const ButtonWrapper = styled(Wrapper)`\n flex-direction: column;\n gap: ${({ theme }) => theme.spacing.xl};\n`;\n\nexport const ButtonGroup = styled.div`\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n gap: ${({ theme }) => theme.spacing.md};\n\n &:has(> div:only-child) {\n display: grid;\n grid-template-columns: 1fr;\n }\n`;\n\nexport const FlexColumnBox = styled(FlexColumn)`\n margin-top: 24px;\n`;\n\nexport const Subtitle2Box = styled(FlexColumn)`\n margin: 0 0 6px 0;\n`;\n\nexport const FlexContentBox = styled(Flex)`\n gap: 16px;\n`;\n\nexport const LiquidityBox = styled.div`\n margin-top: 64px;\n`;\n\nexport const H5 = styled(Headline5)<{ disabled?: boolean }>`\n opacity: ${({ disabled }) => (disabled ? 0.5 : 1)};\n`;\n","import { getFormattedSwapInfo } from \"@/helper/positionHelper\";\nimport { ITokenMap } from \"@/hooks/useFetchTokenMap\";\nimport { IToken } from \"@aperture/types\";\nimport {\n ApertureSupportedChainId,\n getLogger,\n viem,\n} from \"@aperture_finance/uniswap-v3-automation-sdk\";\nimport { E_Solver } from \"@aperture_finance/uniswap-v3-automation-sdk/dist/viem\";\nimport { AmmEnum } from \"@ui/utils\";\nimport { CurrencyAmount } from \"@uniswap/sdk-core\";\nimport Big from \"big.js\";\nimport bigDecimal from \"js-big-decimal\";\nimport { Address, PublicClient } from \"viem\";\n\nconst eoa = \"0x4bD047CA72fa05F0B89ad08FE5Ba5ccdC07DFFBF\";\n\nexport const checkInsufficientToken = (\n disableToken: boolean,\n tokenAmount: string,\n tokenBalance?: string\n) => {\n return !!(\n !disableToken &&\n tokenBalance &&\n bigDecimal.compareTo(tokenAmount, tokenBalance ?? \"0\") > 0\n );\n};\n\nexport const getSwapInfo = async (\n amm: AmmEnum,\n networkId: ApertureSupportedChainId,\n tokenMap: ITokenMap,\n tokenA: IToken,\n tokenB: IToken,\n tokenAAmount: string,\n tokenBAmount: string,\n poolKey: number,\n tickLower: number,\n tickUpper: number,\n walletAddress: Address,\n slippage: number,\n client: PublicClient,\n solvers: E_Solver[]\n) => {\n const pool = await viem.getPool(\n tokenA.address,\n tokenB.address,\n poolKey,\n networkId,\n amm,\n client\n );\n const isTokenAToken0 = tokenA.address === pool.token0.address;\n const amount0 = bigDecimal.multiply(\n isTokenAToken0 ? tokenAAmount : tokenBAmount,\n new Big(10).pow(pool.token0.decimals)\n );\n const amount1 = bigDecimal.multiply(\n isTokenAToken0 ? tokenBAmount : tokenAAmount,\n new Big(10).pow(pool.token1.decimals)\n );\n const price0 = (isTokenAToken0 ? tokenA : tokenB).price;\n const price1 = (isTokenAToken0 ? tokenB : tokenA).price;\n\n try {\n const swapInfo = await viem.getMintOptimalSwapInfoV3(\n networkId,\n amm,\n CurrencyAmount.fromRawAmount(pool.token0, amount0),\n CurrencyAmount.fromRawAmount(pool.token1, amount1),\n poolKey,\n tickLower,\n tickUpper,\n walletAddress ?? eoa,\n slippage,\n [price0, price1],\n client,\n solvers\n );\n return getFormattedSwapInfo(amm, networkId, tokenMap, swapInfo);\n } catch (error) {\n getLogger().error(\"NewPosition.getSwapInfo.Error\", {\n amm,\n networkId,\n walletAddress,\n tokenA,\n tokenB,\n tokenAAmount,\n tokenBAmount,\n poolKey,\n tickLower,\n tickUpper,\n slippage,\n error: (error as Error).message,\n });\n throw error;\n }\n};\n"],"names":["usePositionSnackBar","addSnackbar","useSnackbarV2","mutatePositionMap","useMutatePositionMap","mutate","tokenBalanceMutate","useFetchUserTokensBalance","addPositionSnackbar","onTxSuccess","props","DEFAULT_SOLVERS","E_Solver","useSwapInfo","ammEnum","networkId","publicClient","useNetwork","address","useAccount","updateTokenPriceMap","useAllChainStateStore","setSwapInfo","useSolverRoutingStore","isSyncing","setIsSyncing","useState","isSyncingTx","setIsSyncingTx","fetchInfo","setFetchInfo","startTransition","useTransition","run","loading","error","swapInfoError","cancel","_cancelSwapInfo","useRequest","swapCall","result","type","positionId","slippage","tokenMap","fetchKey","options","tickLower","tickUpper","tokenPrices","getRebalanceSwapData","BigInt","pool","deadline","amounts","getIncreaseLiquidityOptimalSwapInfo","poolKey","tokenA","tokenB","getSwapInfo","prev","manual","pollingInterval","onFinally","onError","e","param","getLogger","info","setTimeout","chainId","cancelSwapInfo","useEventCallback","undefined","runSwapInfo","useFetchLPDistribution","tokenAAddress","tokenBAddress","useSWR","shouldFetch","concat","getLPDistribution","amm","liquidityArray","viem","TickMath","ticksPerBatch","isManta","batches","minTick","tickCurrent","tickSpacing","maxTick","batch","batchData","batchError","console","Array","from","Map","map","item","tick","values","currentLiquidity","reduce","previous","current","Math","abs","liquidityActive","formatDataToken0","formatDataToken1","forEach","Number","liquidity","bigDecimal","push","activeLiquidity","price0","price1","OpenPositionContext","createContext","OpenPositionProvider","selectedTokenList","selectedTokenA","selectedTokenB","children","commonTokens","data","useCachedFetchTokenMap","currentTokenPrice","tokensPrice","useCurrentChainToken","selectedZapInToken","setSelectedZapInToken","tokenAAmount","setTokenAAmount","tokenBAmount","setTokenBAmount","zapTokenAAmount","setZapTokenAAmount","zapTokenBAmount","setZapTokenBAmount","baseTokenIdx","setBaseTokenIdx","startPrice","setStartPrice","globalSlippage","useGlobalSlippage","txnSetting","setTxnSetting","DEFAULT_SLIPPAGE","lowPrice","setLowPrice","highPrice","setHighPrice","totalPrice","setTotalPrice","feeTier","zapIn","isUrlUpdated","setFeeTierUrl","setPoolKeyUrl","setTickUrl","setSelectedToken","setZapInUrl","useUrlQuery","useMemo","getTokensFromInfo","decimals","availableASPools","useAvailableASPools","token0","token1","marketPrice","isLoading","marketPriceLoading","useFetchCurrentChainMarketPrice","previousNetworkId","setPreviousNetworkId","QueryKey","previousPoolKey","setPreviousPoolKey","fee","TICK_SPACINGS","find","currentPoolStatus","useCurrentPool","baseToken","react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__","jsx","Provider","value","isSettingChanged","isPoolInitialization","useOpenPositionContext","context","useContext","NoSwapInfoWrapper","styled","FlexColumn","theme","spacing","NoSwapInfoText","T2","colors","global","text","T3","ZapInSwapPath","selectedSwapInfo","hide","zapTokenA","zapTokenB","keepDropdown","useTheme","walletAddress","swapInfo","selectedSolver","suggestedSolver","noNeedSwap","setModalState","useModal","useEffect","option_amounts","jsx_runtime","jsxs","ApertureLogos","fill","T1","Fragment","SwapPath","priceImpact","api","fromToken","swapData","swapRoutes","showSwapRoutes","length","errorMsg","getSwapFailureMessage","onBtnClick","E_ModalKey","suggested","gasFeeUSD","feeUSD","feePercentage","DEFAULT_APERTURE_ZAPIN_FEE","OrderRoutingModal","Title","Flex","disabled","Wrapper","ErrorMessage","T3Regular","radii","md","warning","isDark","StyledButton","Button","inDrawer","background","BG3","BG2","BG4","SwapDetail","setHide","failureMessage","setFailureMessage","useDebounceForm","tokenAmountOnChange","isTokenA","otherSetter","setter","otherTokenAmount","getOtherTokenAmount","toExact","log","timeId","clearTimeout","showAlignTokens","ErrorMsg","width","justifyContent","onClick","H5","alignItems","gap","RaindropSpinner","height","ChevronDown","isShow","AlignTokenAmounts","ticker","disableA","disableB","onAlignTokenA","onAlignTokenB","isAddLP","style","marginTop","variant","size","form","useDebounce","wait","mt","Container","ContentBox","lg","Content","ContentFeeTier","ButtonBox","textAlt","primary","primaryDisable","SelectedToken","T4","round","SelectedTokenIconWrapper","ArrowDownWrapper","ArrowDown","AccessoryIcons","withConfig","IGMaxWrapper","SpaceBetweenLine","StyledTokenTab","SwitchMenuTab","ButtonWrapper","xl","ButtonGroup","FlexColumnBox","LiquidityBox","Headline5","checkInsufficientToken","disableToken","tokenAmount","tokenBalance","client","solvers","isTokenAToken0","amount0","Big","pow","amount1","price","CurrencyAmount","getFormattedSwapInfo","message"],"sourceRoot":""}