Skip to content

fix: handle EIP-1193 user rejection (code 4001) gracefully during wallet signing [0x954dB727f224dAabeA2A506C8aE92029b25339cE] - #133

Open
waterWang wants to merge 1 commit into
Adamantine-guild:mainfrom
waterWang:fix/handle-wallet-rejection-4001
Open

fix: handle EIP-1193 user rejection (code 4001) gracefully during wallet signing [0x954dB727f224dAabeA2A506C8aE92029b25339cE]#133
waterWang wants to merge 1 commit into
Adamantine-guild:mainfrom
waterWang:fix/handle-wallet-rejection-4001

Conversation

@waterWang

Copy link
Copy Markdown
Contributor

Summary

When a user rejects a transaction signing request in their wallet (MetaMask/Rabby etc.), the app currently shows a scary red error toast with a generic message. This PR handles EIP-1193 error code 4001 (user rejection) gracefully by showing a neutral info toast instead.

Changes

  • TxToasts.tsx: Added notifyTxCancelled() helper that dismisses the pending toast and shows a neutral info toast
  • SendModal.tsx: Updated the catch block to detect code === 4001 and route to the new handler

Acceptance criteria

  • Rejecting a transaction in MetaMask/Rabby does not trigger a red error toast
  • The pending toast is dismissed immediately
  • Real transaction failures still correctly show error toasts

Closes #107

…let signing

When a user rejects a transaction signing request in their wallet
(MetaMask/Rabby etc.), the app now shows a neutral info toast
('Transaction cancelled by user') instead of a scary red error toast.

- Add notifyTxCancelled() helper to TxToasts.tsx
- Detect code === 4001 in SendModal's catch block
- Dismiss pending toast for both user rejection and real errors

Closes Adamantine-guild#107

[0x954dB727f224dAabeA2A506C8aE92029b25339cE]
@Lakes41

Lakes41 commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

This PR cannot be merged automatically because it has merge conflicts.

Please update the branch with the latest base branch and resolve the conflicts.

After the conflicts are resolved and checks pass, the automation can review it again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle User Rejection (Error 4001) gracefully during wallet signing

2 participants