Add automated codemod reference to v1 → v2 migration guide #5098
Unanswered
Waleedbhattiii
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hey wagmi team 👋
I built a codemod that automates ~85% of the v1 → v2 migration
deterministically, with zero false positives. I wanted to check
interest before opening a docs PR.
What it does
8 JSSG transforms (Codemod platform) handle all the mechanical changes:
useContractRead→useReadContract,useSwitchNetwork→useSwitchChain, and 9 more<WagmiConfig>→<WagmiProvider>usePrepareContractWrite→useSimulateContractquery: {}watch: trueremoval (preserved onuseBlockNumber/useBlock)createClient→createConfig,useNetwork→useChainId/useChainsAn AI step handles the remaining ~15% (configureChains → Viem transports,
prepare hook destructuring, return shape changes).
Real numbers — tested on your own examples repo
I ran it against the
1.xbranch of this repo:Try it
The ask
Would you be open to a small docs PR adding a "Codemod" section
near the top of the v1 → v2 migration guide? Something like:
Happy to adjust the copy to match your docs style. Let me know
if you have any questions about the implementation.
All reactions