scaffold-eth-2 icon indicating copy to clipboard operation
scaffold-eth-2 copied to clipboard

Handle tx revert in `useTransactor`

Open MattPereira opened this issue 6 months ago • 0 comments

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, the onSuccess will trigger even when the tx reverts because useTransactor 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 that useMutation's onSuccess doesn't get triggered

Will update with example, video, images, and full explanation later

Your ENS/address: matthu.eth

MattPereira avatar Aug 13 '24 19:08 MattPereira