• CLI
  • Plugins

Plugins

@wagmi/cli has multiple built-in plugins for managing ABIs, integrating smart contract development tools, and generating code. You can also create your own plugins to hook into the CLI commands.

Built-in

NameDescription
ActionsGenerate type-safe VanillaJS actions from configuration contracts.
Block ExplorerFetch ABIs from Block Explorers that support ?module=contract&action=getabi.
ERCAdd ERC ABIs into configuration contracts.
EtherscanFetch ABIs from Etherscan and add into configuration.
FetchFetch and parse ABIs from network resource with fetch.
FoundryGenerate ABIs and watch for Foundry project changes.
HardhatGenerate ABIs and watch for Hardhat projects changes.
ReactGenerate type-safe React Hooks from configuration contracts.

Creating plugins

Creating plugins to hook into the CLI is quite simple. Plugins most commonly inject contracts into contracts config, e.g. Etherscan and ERC plugins, and/or generate code using the run option, e.g. the React plugin. All you need to do is write a function that returns the Plugin type (name is the only required property, but you likely want to at least include contracts or run).

wagmi.config.ts
import type { Plugin } from '@wagmi/cli'
 
function myPlugin(): Plugin {
  name: 'MyPlugin',
  // ...
}
 
export default {
  out: 'src/generated.ts',
  plugins: [myPlugin()],
}