wagmi

124.3kstarscached

React Hooks for Ethereum

Frontend

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.

Installbash
npm install wagmi viem@2.x @tanstack/react-query
Create a configts
import { http, createConfig } from "wagmi";
import { mainnet, sepolia } from "wagmi/chains";

export const config = createConfig({
  chains: [mainnet, sepolia],
  transports: {
    [mainnet.id]: http(),
    [sepolia.id]: http(),
  },
});
Read on-chain datatsx
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 docs

Community Notes

Tips, gotchas, and updated examples from the community.

No community notes yet.

Be the first to share a tip, gotcha, or updated example.

Share a note

Related Tools

Browse all →