import React, { useState, Dispatch, SetStateAction } from "react"; import { ContractMethod, TezosToolkit, WalletContract } from "@taquito/taquito"; interface RecordsProps { contract: WalletContract | any; setUserBalance: Dispatch>; Tezos: TezosToolkit; userAddress: string; setStorage: Dispatch>; } const Records = ({ contract, setUserBalance, Tezos, userAddress, setStorage }: RecordsProps) => { const [loadingIncrement, setLoadingIncrement] = useState(false); const [loadingDecrement, setLoadingDecrement] = useState(false); const [formKaName, setName] = useState(''); const [formKaDate, setDate] = useState(''); const [formKaHeight, setHeight] = useState(''); const [formKaWeight, setWeight] = useState(''); const [formKaAge, setAge] = useState(''); const [formKaHospital, setHospital] = useState(''); const [formKaPrescription, setPrescription] = useState(''); const addRecord = async (): Promise => { setLoadingIncrement(true); try { const apnaForm = { name: formKaName, date: formKaDate, age: formKaAge, height: formKaHeight, weight: formKaWeight, hospital: formKaHospital, prescription: formKaPrescription, }; console.log(JSON.stringify(apnaForm)); const op = await contract.methods.default(JSON.stringify(apnaForm)).send(); await op.confirmation(); const newStorage: any = await contract.storage(); if (newStorage) setStorage(newStorage); setUserBalance(await Tezos.tz.getBalance(userAddress)); alert("Record Saved."); } catch (error) { console.log(error); } finally { setLoadingIncrement(false); } }; if (!contract && !userAddress) return
 
; return (
setName(event.target.value)} required/>
setDate(event.target.value)} required/>
setAge(event.target.value)} required/>
setHeight(event.target.value)} required/>
setWeight(event.target.value)} required/>
    setHospital(event.target.value)} required/>