Menu

Post image 1
Post image 2
1 / 2
0

I Automated 85% of the wagmi v1-v2 Migration Using Codemods. Here's How.

DEV Community·Waleed·about 1 month ago
#8IUqfk8e
#wagmi#typescript#web3#todo#import#transform
Reading 0:00
15s threshold

wagmi v2 broke everything. If you've tried migrating a real DeFi frontend from wagmi v1 to v2, you know exactly what I mean. Every hook was renamed. The provider component changed. Connectors went from classes to factory functions. TanStack Query params moved into a nested query:{} object. configureChains was removed entirely. The official migration guide is 4,000+ words long. I built a codemod that automates 85% of this migration deterministically — with zero false positives — and leaves clear AI-ready TODO comments for the remaining 15%. Here's exactly how I did it, what worked, what didn't, and the real numbers from running it against the official wagmi v1 examples repo. The Problem wagmi v2 is a ground-up rewrite built around two new primitives: Viem instead of ethers.js TanStack Query instead of internal state management This meant every single hook had a breaking change. Not just renames — the entire API contract changed. useContractWrite in v1 accepted the contract config at the hook level.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More