Migrate from v1 to v2
To get started, install the latest version of the Wagmi CLI.
bash
pnpm add @wagmi/cli
pnpm add @wagmi/cli
bash
npm install @wagmi/cli
npm install @wagmi/cli
bash
yarn add @wagmi/cli
yarn add @wagmi/cli
bash
bun add @wagmi/cli
bun add @wagmi/cli
Not ready to migrate yet?
The Wagmi CLI v1 docs are still available at 1.x.wagmi.sh/cli.
Changed generated action and hook names
Generated action and hook names now align with Wagmi v2 naming conventions. If you want hooks to still follow Wagmi v1 naming conventions, set getActionName
and getHookName
to 'legacy'
.
ts
import { defineConfig } from '@wagmi/cli'
import { actions, react } from '@wagmi/cli/plugins'
export default defineConfig({
plugins: [
actions({
getActionName: 'legacy',
}),
react({
getHookName: 'legacy',
}),
],
})
import { defineConfig } from '@wagmi/cli'
import { actions, react } from '@wagmi/cli/plugins'
export default defineConfig({
plugins: [
actions({
getActionName: 'legacy',
}),
react({
getHookName: 'legacy',
}),
],
})