React
Plugin for generating type-safe React Hooks from configuration contracts
. Requires wagmi@>=0.11
.
import { react } from '@wagmi/cli/plugins'
Usage
import { defineConfig } from '@wagmi/cli'
import { react } from '@wagmi/cli/plugins'
export default defineConfig({
plugins: [
react({
useContractRead: true,
useContractFunctionRead: true,
}),
],
})
Configuration
useContract (optional)
Generate useContract
hook. Defaults to true
.
import { defineConfig } from '@wagmi/cli'
import { react } from '@wagmi/cli/plugins'
export default defineConfig({
plugins: [
react({
useContract: true,
}),
],
})
useContractEvent (optional)
Generate useContractEvent
hook. Defaults to true
.
import { defineConfig } from '@wagmi/cli'
import { react } from '@wagmi/cli/plugins'
export default defineConfig({
plugins: [
react({
useContractEvent: true,
}),
],
})
useContractItemEvent (optional)
Generate useContractEvent
hook for each event in ABI. Defaults to true
.
import { defineConfig } from '@wagmi/cli'
import { react } from '@wagmi/cli/plugins'
export default defineConfig({
plugins: [
react({
useContractItemEvent: true,
}),
],
})
useContractRead (optional)
Generate useContractRead
hook. Defaults to true
.
import { defineConfig } from '@wagmi/cli'
import { react } from '@wagmi/cli/plugins'
export default defineConfig({
plugins: [
react({
useContractRead: true,
}),
],
})
useContractFunctionRead (optional)
Generate useContractRead
hook for each "read" function in ABI. Defaults to true
.
import { defineConfig } from '@wagmi/cli'
import { react } from '@wagmi/cli/plugins'
export default defineConfig({
plugins: [
react({
useContractFunctionRead: true,
}),
],
})
usePrepareContractWrite (optional)
Generate usePrepareContractWrite
hook. Defaults to true
.
import { defineConfig } from '@wagmi/cli'
import { react } from '@wagmi/cli/plugins'
export default defineConfig({
plugins: [
react({
usePrepareContractWrite: true,
}),
],
})
usePrepareContractFunctionWrite (optional)
Generate usePrepareContractWrite
hook for each "write" function in ABI. Defaults to true
.
import { defineConfig } from '@wagmi/cli'
import { react } from '@wagmi/cli/plugins'
export default defineConfig({
plugins: [
react({
usePrepareContractFunctionWrite: true,
}),
],
})