Chapter 5

Connecting Wallets

dApps cannot sign transactions themselves — users connect wallets that hold keys and approve each action. Connection UX is the first impression; friction here loses users before they ever interact with your contracts.

wagmi's useConnect lists available connectors; useAccount exposes address and chain ID. Prompt a network switch when the user is on the wrong chain — many transactions fail silently or revert when chain ID mismatches your deployed contracts.

Show the connected address truncated with a copy button, display a wrong-network banner with one-click switch, and offer a clear disconnect option that clears cached state on logout.