diff --git a/src/components/create-pool/CreatePoolForm/index.tsx b/src/components/create-pool/CreatePoolForm/index.tsx index 3de4de1..f740dac 100644 --- a/src/components/create-pool/CreatePoolForm/index.tsx +++ b/src/components/create-pool/CreatePoolForm/index.tsx @@ -11,7 +11,7 @@ import { import { usePrepareAlgebraPositionManagerMulticall } from '@/generated'; import { useTransitionAwait } from '@/hooks/common/useTransactionAwait'; import { Address, useContractWrite } from 'wagmi'; -import { useDerivedMintInfo } from '@/state/mintStore'; +import { useDerivedMintInfo, useMintState } from '@/state/mintStore'; import Loader from '@/components/common/Loader'; import { PoolState, usePool } from '@/hooks/pools/usePool'; import Summary from '../Summary'; @@ -21,7 +21,9 @@ import { STABLECOINS } from '@/constants/tokens'; const CreatePoolForm = () => { const { currencies } = useDerivedSwapInfo(); - const { typedValue, actions: { selectCurrency, typeInput } } = useSwapState(); + const { actions: { selectCurrency } } = useSwapState(); + + const { startPriceTypedValue, actions: { typeStartPriceInput } } = useMintState() const currencyA = currencies[SwapField.INPUT]; const currencyB = currencies[SwapField.OUTPUT]; @@ -83,14 +85,12 @@ const CreatePoolForm = () => { useEffect(() => { selectCurrency(SwapField.INPUT, undefined) selectCurrency(SwapField.OUTPUT, undefined) - typeInput(SwapField.INPUT, '') - typeInput(SwapField.OUTPUT, '') + typeStartPriceInput('') return () => { selectCurrency(SwapField.INPUT, ADDRESS_ZERO) selectCurrency(SwapField.OUTPUT, STABLECOINS.USDT.address as Account) - typeInput(SwapField.INPUT, '') - typeInput(SwapField.OUTPUT, '') + typeStartPriceInput('') } }, []) @@ -114,7 +114,7 @@ const CreatePoolForm = () => { disabled={ isLoading || isPoolExists || - !typedValue || + !startPriceTypedValue || !areCurrenciesSelected || isSameToken } @@ -128,7 +128,7 @@ const CreatePoolForm = () => { 'Select currencies' ) : isPoolExists ? ( 'Pool already exists' - ) : !typedValue ? ( + ) : !startPriceTypedValue ? ( 'Enter initial price' ) : ( 'Create Pool' diff --git a/src/components/create-pool/SelectPair/index.tsx b/src/components/create-pool/SelectPair/index.tsx index 0928558..b5849b8 100644 --- a/src/components/create-pool/SelectPair/index.tsx +++ b/src/components/create-pool/SelectPair/index.tsx @@ -1,6 +1,6 @@ import TokenCard from '@/components/swap/TokenCard'; -import { IDerivedMintInfo, useMintActionHandlers } from '@/state/mintStore'; -import { useSwapActionHandlers, useSwapState } from '@/state/swapStore'; +import { IDerivedMintInfo, useMintActionHandlers, useMintState } from '@/state/mintStore'; +import { useSwapActionHandlers } from '@/state/swapStore'; import { SwapField } from '@/types/swap-field'; import { Currency } from '@cryptoalgebra/integral-sdk'; import { ChevronsUpDownIcon } from 'lucide-react'; @@ -13,12 +13,12 @@ interface ISelectPair { } const SelectPair = ({ mintInfo, currencyA, currencyB }: ISelectPair) => { - const { onCurrencySelection, onUserInput, onSwitchTokens } = + const { onCurrencySelection, onSwitchTokens } = useSwapActionHandlers(); const { onStartPriceInput } = useMintActionHandlers(mintInfo.noLiquidity); - const { typedValue } = useSwapState(); + const { startPriceTypedValue } = useMintState(); const handleInputSelect = useCallback( (inputCurrency: Currency) => { @@ -36,17 +36,16 @@ const SelectPair = ({ mintInfo, currencyA, currencyB }: ISelectPair) => { const handleTypeInput = useCallback( (value: string) => { - onUserInput(SwapField.INPUT, value); onStartPriceInput(value); }, - [onUserInput, onStartPriceInput] + [onStartPriceInput] ); return (