frontend-ux

Implement dApp wallet connection, transaction lifecycle, and error handling UX with wagmi and RainbowKit.

6|20|Updated Mar 14, 2026
One-click install
npx skills add https://github.com/andresdefi/cryptoskills --skill frontend-ux-andresdefi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: frontend-ux
Source: https://github.com/andresdefi/cryptoskills/tree/main/skills/frontend-ux
Command: npx skills add https://github.com/andresdefi/cryptoskills --skill frontend-ux-andresdefi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? dApp frontends frequently ship broken user experiences because developers treat wallet connection as a single button and transactions as a loading spinner, missing critical states like user rejection, wrong network, pending confirmation, and on-chain reverts. ## Core Features & Use Cases - Wallet Connection State Machine: Implements the four-state connection flow (disconnected, connecting, connected, wrong-network) using RainbowKit, wagmi v2, and EIP-6963 multi-wallet discovery. - Four-State Transaction Lifecycle: Provides complete transaction components handling idle, awaiting-signature, pending, and confirmed/failed states with silent reset on user rejection (error 4001) and decoded revert reasons. - Gas, Approvals, and Mobile Support: Covers USD-denominated gas estimation, EIP-1559 fee tiers, exact vs infinite ERC-20 approvals with Permit2, WalletConnect v2 mobile flows, and a full production QA checklist. - Use Case: When building a token transfer page on Base, use this Skill to generate a complete React component that prompts network switching, shows "Confirm in wallet..." during signing, displays a block explorer link while pending, and silently resets when the user rejects. ## Quick Start Ask the agent to build a dApp page with RainbowKit wallet connection and a four-state transaction form using wagmi v2 and viem.

Frequently Asked Questions about frontend-ux

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle wallet connection states in a React dApp?

Model wallet connection as a four-state machine: disconnected, connecting, connected, and wrong-network. RainbowKit's ConnectButton.Custom render prop exposes account, chain, and modal handlers so you can render distinct UI for each state, including a wrong-network switch prompt.

How to handle transaction states with wagmi useWriteContract?

Combine useWriteContract with useWaitForTransactionReceipt to derive four states: awaiting-signature while isSigning, pending while confirming, confirmed when receipt status is success, and failed on revert or error. Show an explorer link during pending and a retry button on failure.

Should I show an error when a user rejects a transaction with code 4001?

No. Error 4001 means the user intentionally cancelled in their wallet, so the correct UX is a silent reset back to the idle state. Detect it with viem's UserRejectedRequestError or by matching 'user rejected' in the message, and reserve error toasts for actual failures.

What is the difference between infinite approval and Permit2 for ERC-20 tokens?

Infinite approval grants a spender unlimited token access in one transaction but risks total loss if the spender is compromised. Permit2 uses one approval to Uniswap's universal Permit2 contract, then off-chain EIP-712 signatures per interaction, limiting exposure to time-bound permits.

Why does my dApp wallet connection fail on mobile browsers?

Regular mobile browsers have no injected provider, so connection requires WalletConnect v2 with a valid projectId. In-app browsers like MetaMask Mobile inject a provider directly. Include both injected() and walletConnect() connectors, or use RainbowKit which handles detection automatically.

How do I fix hydration mismatch errors with wagmi in Next.js SSR?

Enable ssr: true in the wagmi config and use cookieStorage so the server renders the connected state. Then hydrate on the client with cookieToInitialState read from request headers, preventing the flash of disconnected state on page load.