Ccutlerjay109-create

wagmi-v1-to-v2-cutlerjay109

Automatically migrates your codebase from wagmi v1 to wagmi v2

wagmimigrationweb3ethereumreact
Public
0 executions

Run locally

npx codemod wagmi-v1-to-v2-cutlerjay109

wagmi v1 → v2 Codemod

Automatically migrates your codebase from wagmi v1 to wagmi v2 using jssg (JavaScript ast-grep).

What it does

TransformWhat it fixes
rename-hooksRenames all v1 hooks to v2 names
rename-connectorsConverts connector classes to functions
fix-importsFixes import paths for chains, ABIs, WagmiConfig
fix-use-networkReplaces useNetwork with useAccount/useConfig
fix-tanstack-queryMoves query params into query:{} object
fix-account-effectMoves callbacks into useAccountEffect
fix-create-configRemoves configureChains, fixes createConfig
fix-prepare-hooksReplaces prepare hooks with simulate/estimate

Usage

Run the full migration workflow

bash

Run from the Codemod Registry

bash

Run a single transform

bash

Run tests

bash

After running the codemod

Some changes require manual review:

  • useBalance with token parameter → replace with useReadContracts
  • useToken → replace with useReadContracts
  • Custom connectors → follow the wagmi v2 connector guide
  • Add QueryClientProvider from @tanstack/react-query to your app root
  • The AI step in the workflow handles most of these automatically

Coverage

Automates approximately 80-85% of the wagmi v1 → v2 migration deterministically.
The remaining 15% is handled by the built-in AI step in the workflow.

Tech Stack

  • jssg (JavaScript ast-grep) — AST-based code transformation engine
  • Codemod CLI — workflow orchestration
  • Jest — transform testing

Ready to contribute?

Build your own codemod and share it with the community.