Plugins
Plugins for managing ABIs, generating code, and more.
Import
Import via the '@wagmi/cli/plugins' entrypoint.
ts
import { etherscan } from '@wagmi/cli/plugins'Available Plugins
actionsGenerate type-safe VanillaJS actions from configurationcontracts.blockExplorerFetch ABIs from Block Explorers that support?module=contract&action=getabi.etherscanFetch ABIs from Etherscan and add into configuration.fetchFetch and parse ABIs from network resource withfetch.foundryGenerate ABIs and watch for Foundry project changes.hardhatGenerate ABIs and watch for Hardhat projects changes.reactGenerate type-safe React Hooks from configurationcontracts.sourcifyFetch ABIs from Sourcify from configurationcontracts.
Create Plugin
Creating plugins to hook into the CLI is quite simple. Plugins most commonly inject contracts into contracts config, e.g. etherscan, and/or generate code using the run option, e.g. react. All you need to do is write a function that returns the Plugin type.
ts
import { type Plugin, defineConfig } from '@wagmi/cli'
function myPlugin(): Plugin {
// `name` is the only required property.
name: 'MyPlugin',
// You likely want to at least include `contracts` or `run`.
// ...
}
export default defineConfig({
out: 'src/generated.ts',
plugins: [myPlugin()],
})