import { Button, Card, CardBody, FormControl, FormErrorMessage, FormLabel, Input, Text, VStack, useToast, } from "@chakra-ui/react"; import { useCallback } from "react"; import { useForm } from "react-hook-form"; import { useSendFiorino } from "../../../../hooks/useSendFiorino"; interface SendForm { amount: string; receiver: string; } export const SendCard = () => { const form = useForm(); const { errors } = form.formState; const toast = useToast(); const sendMutation = useSendFiorino({ onSuccess: () => { form.reset(); sendMutation.resetStatus(); toast({ title: "Success", description: "Transaction sent", status: "success", duration: 9000, isClosable: true, }); }, }); const onSubmit = useCallback( (data: SendForm) => { sendMutation.sendTransaction(data); }, [sendMutation] ); const isMinter = true; if (!isMinter) { return null; } return ( Send Amount {errors.amount?.message} Receiver {errors.receiver?.message} ); };