scaffold-eth-2
scaffold-eth-2 copied to clipboard
Handle tx revert in `useTransactor`
Issue
- The
useTransactor
hook displays a success notification even if the transaction reverts, which is confusing for users. - If you're using tanstack's
useMutation
, theonSuccess
will trigger even when the tx reverts becauseuseTransactor
isn't throwing an error on tx revert
Proposal
- Only show success notification when tx status is success
- Throw an error if status is not
"success"
so thatuseMutation
'sonSuccess
doesn't get triggered
Will update with example, video, images, and full explanation later
Your ENS/address: matthu.eth