Actions

Plugin for generating type-safe VanillaJS actions from configuration contracts. Requires wagmi@>=0.11 or @wagmi/core@>=0.9.

import { actions } from '@wagmi/cli/plugins'

Usage

import { defineConfig } from '@wagmi/cli'
import { actions } from '@wagmi/cli/plugins'
 
export default defineConfig({
  plugins: [
    actions({
      readContract: true,
    }),
  ],
})

Configuration

getContract (optional)

Generate getContract action. Defaults to true.

import { defineConfig } from '@wagmi/cli'
import { actions } from '@wagmi/cli/plugins'
 
export default defineConfig({
  plugins: [
    actions({
      getContract: true,
    }),
  ],
})

overridePackageName (optional)

Override detected import source for actions. Defaults to either wagmi/actions or @wagmi/core depending on what is installed.

import { defineConfig } from '@wagmi/cli'
import { actions } from '@wagmi/cli/plugins'
 
export default defineConfig({
  plugins: [
    actions({
      overridePackageName: true,
    }),
  ],
})

prepareWriteContract (optional)

Generate prepareWriteContract action. Defaults to true.

import { defineConfig } from '@wagmi/cli'
import { actions } from '@wagmi/cli/plugins'
 
export default defineConfig({
  plugins: [
    actions({
      prepareWriteContract: true,
    }),
  ],
})

readContract (optional)

Generate readContract action. Defaults to true.

import { defineConfig } from '@wagmi/cli'
import { actions } from '@wagmi/cli/plugins'
 
export default defineConfig({
  plugins: [
    actions({
      readContract: true,
    }),
  ],
})

watchContractEvent (optional)

Generate watchContractEvent action. Defaults to true.

import { defineConfig } from '@wagmi/cli'
import { actions } from '@wagmi/cli/plugins'
 
export default defineConfig({
  plugins: [
    actions({
      watchContractEvent: true,
    }),
  ],
})