Wagmi react overview

From cyotee/indexedex · View interactive version

Wagmi react overview is an AI agent skill from the GitHub repository cyotee/indexedex. React hooks library for Ethereum built on viem and TanStack Query. Use when building React apps with wallet connections and contract interactions.

How to use this skill

Skill file

Wagmi-React Overview

React hooks for Ethereum.

Install

pnpm add wagmi viem@2.x @tanstack/react-query

Quick Start

// config.ts
import { createConfig, http } from 'wagmi'
import { mainnet, sepolia } from 'wagmi/chains'

export const config = createConfig({
  chains: [mainnet, sepolia],
  transports: {
    [mainnet.id]: http(),
    [sepolia.id]: http(),
  },
})
// App.tsx
import { WagmiProvider } from 'wagmi'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { config } from './config'

const queryClient = new QueryClient()

function App() {
  return (
    <WagmiProvider config={config}>
      <QueryClientProvider client={queryClient}>
        <YourComponents />
      </QueryClientProvider>
    </WagmiProvider>
  )
}

Skills

TypeScript Registration

import { useBlockNumber } from 'wagmi'

declare module 'wagmi' {
  interface Register {
    config: typeof config
  }
}

// Now chainId is typed
useBlockNumber({ chainId: mainnet.id }) // ✅
useBlockNumber({ chainId: 123 })        // ❌ type error
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.