Transaction Status
After sending a transaction, you can use state
to check the state of your transaction.
State is of type TransactionStatus.
Example below clears inputs and enables all disabled components back:
const { sendTransaction, state } = useSendTransaction()
const handleClick = () => {
setDisabled(true)
sendTransaction({ to: address, value: utils.parseEther(amount) })
}
useEffect(() => {
if (state.status != 'Mining') {
setDisabled(false)
setAmount('0')
setAddress('')
}
}, [state])