Difficulty: Intermediate
Type: UI/UX, bug
Background
When a user initiates a transaction (e.g., staking tokens), their wallet prompts them to sign the payload. If the user clicks "Reject" in their wallet extension, an error is thrown.
Problem
Currently, when a user rejects a transaction, the UI surfaces a generic, red "Transaction Failed: internal JSON-RPC error" toast notification. This is jarring and inaccurately portrays a normal user action as a catastrophic system failure.
Expected outcome
The application correctly intercepts the standard EIP-1193 user rejection code (4001) and handles it silently or displays a benign "Transaction cancelled by user" information toast.
Suggested implementation
- Locate the generic
catch blocks wrapping transaction logic.
- Inspect the thrown error object for
code === 4001 or specific string identifiers (e.g., user rejected transaction).
- Route the UI state accordingly (e.g., reset the loading button) without triggering the global error boundary or scary error toasts.
Acceptance criteria
Likely affected files/directories
src/hooks/useTransaction.ts
src/components/TransactionModal.tsx
Requirements
- Must account for slight variations in error objects across different wallet providers.
Difficulty: Intermediate
Type: UI/UX, bug
Background
When a user initiates a transaction (e.g., staking tokens), their wallet prompts them to sign the payload. If the user clicks "Reject" in their wallet extension, an error is thrown.
Problem
Currently, when a user rejects a transaction, the UI surfaces a generic, red "Transaction Failed: internal JSON-RPC error" toast notification. This is jarring and inaccurately portrays a normal user action as a catastrophic system failure.
Expected outcome
The application correctly intercepts the standard EIP-1193 user rejection code (4001) and handles it silently or displays a benign "Transaction cancelled by user" information toast.
Suggested implementation
catchblocks wrapping transaction logic.code === 4001or specific string identifiers (e.g.,user rejected transaction).Acceptance criteria
Likely affected files/directories
src/hooks/useTransaction.tssrc/components/TransactionModal.tsxRequirements