diff --git a/src/components/TransferForm.tsx b/src/components/TransferForm.tsx index e49c961..b105e93 100644 --- a/src/components/TransferForm.tsx +++ b/src/components/TransferForm.tsx @@ -1,6 +1,6 @@ import { useForm } from '@mantine/form'; import { isValidWalletAddress } from '../utils'; -import { FC } from 'react'; +import {FC, useEffect} from 'react'; import { Button, Stack, TextInput } from '@mantine/core'; import { TNodeWithRelayChains } from '@paraspell/sdk'; import {useWallet} from "../providers/WalletProvider.tsx"; @@ -21,13 +21,18 @@ type Props = { const TransferForm: FC = ({ onSubmit, loading }) => { const { selectedAccount } = useWallet(); + + useEffect(() => { + if (selectedAccount) form.values.address = selectedAccount.address; + }, [selectedAccount]); + const form = useForm({ initialValues: { from: 'Encointer', to: 'Kusama', currency: 'KSM', amount: 0.2, - address: selectedAccount? selectedAccount.address : '', + address: '', useApi: false, }, @@ -39,7 +44,7 @@ const TransferForm: FC = ({ onSubmit, loading }) => { return (
- +