wagmi
124.3kstarscachedReact Hooks for Ethereum
Official links
About wagmi
wagmi is a collection of React Hooks containing everything you need to start working with Ethereum. It makes it easy to connect a wallet, display ENS and balance information, sign messages, interact with contracts, and much more — all with caching, request deduplication, and persistence handled for you. Built on top of viem, it gives you end-to-end type safety without sacrificing ergonomics.
Quickstarts
A fast path from zero to running code.
npm install wagmi viem@2.x @tanstack/react-queryimport { http, createConfig } from "wagmi";
import { mainnet, sepolia } from "wagmi/chains";
export const config = createConfig({
chains: [mainnet, sepolia],
transports: {
[mainnet.id]: http(),
[sepolia.id]: http(),
},
});import { useAccount, useBalance } from "wagmi";
export function Profile() {
const { address } = useAccount();
const { data } = useBalance({ address });
if (!address) return <p>Not connected</p>;
return <p>{data?.formatted} {data?.symbol}</p>;
}Documentation
The official docs cover configuration, connectors, hooks for reading and writing to contracts, ENS utilities, SSR, and testing. Start with the Getting Started guide, then move through Core Concepts before exploring the full hook reference.
Read full docsCommunity Notes
Tips, gotchas, and updated examples from the community.
No community notes yet.
Be the first to share a tip, gotcha, or updated example.