Skip to content

Commit

Permalink
Handle tx revert in useTransactor (#907)
Browse files Browse the repository at this point in the history
  • Loading branch information
MattPereira committed Aug 15, 2024
1 parent 0e18439 commit b6d73d2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/nextjs/hooks/scaffold-eth/useTransactor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ export const useTransactor = (_walletClient?: WalletClient): TransactionFunc =>
});
notification.remove(notificationId);

if (transactionReceipt.status === "reverted") throw new Error("Transaction reverted");

notification.success(
<TxnNotification message="Transaction completed successfully!" blockExplorerLink={blockExplorerTxURL} />,
{
Expand Down

0 comments on commit b6d73d2

Please sign in to comment.