Wagmi + React
Wagmi is the standard React library for EVM wallet connections and contract interactions. This page covers the essential patterns for a Sei frontend: configuration, wallet connect/disconnect, reading balances, and writing to contracts. For Node.js scripts and backend services, see the viem Quickstart instead.Try it live
The hooks below —useBlockNumber, useBalance — are thin wrappers over JSON-RPC reads. Here are those same reads issued directly against Sei mainnet, no wallet connection required, so you can see the data your components will render.
Install
Configuration
Configure Wagmi with the Sei chain and your preferred wallet connectors:Provider Setup
Wrap your app withWagmiProvider and QueryClientProvider:
Connecting a Wallet
Reading the Native SEI Balance
Reading a Contract
Writing to a Contract
UseuseWriteContract for transactions that mutate state, and useWaitForTransactionReceipt to track confirmation:
useWaitForTransactionReceipt resolves as soon as the transaction is included in a block. A single confirmation is final. See Finality.