Foundry
Plugin for resolving ABIs from Foundry projects. Supports generate
--watch
(-w
) mode.
import { foundry } from '@wagmi/cli/plugins'
Usage
import { defineConfig } from '@wagmi/cli'
import { foundry } from '@wagmi/cli/plugins'
export default defineConfig({
plugins: [
foundry({
project: '../hello_foundry',
}),
],
})
Configuration
project
Path to Foundry project.
import { defineConfig } from '@wagmi/cli'
import { foundry } from '@wagmi/cli/plugins'
export default defineConfig({
plugins: [
foundry({
project: '../hello_foundry',
}),
],
})
artifacts (optional)
Project's artifacts directory. Defaults to 'out/'
. Same as your foundry.toml
/forge
s --out
(-o
) option.
import { defineConfig } from '@wagmi/cli'
import { foundry } from '@wagmi/cli/plugins'
export default defineConfig({
plugins: [
foundry({
artifacts: 'out/',
project: '../hello_foundry',
}),
],
})
deployments (optional)
Mapping of addresses to attach to artifacts.
import { defineConfig } from '@wagmi/cli'
import { foundry } from '@wagmi/cli/plugins'
export default defineConfig({
plugins: [
foundry({
project: '../hello_foundry',
deployments: {
Counter: {
1: '0x314159265dd8dbb310642f98f50c066173c1259b',
5: '0x112234455c3a32fd11230c42e7bccd4a84e02010',
},
},
}),
],
})
exclude (optional)
Artifact files to exclude relative to artifacts
. Supports glob patterns.
import { defineConfig } from '@wagmi/cli'
import { foundry } from '@wagmi/cli/plugins'
export default defineConfig({
plugins: [
foundry({
exclude: [
// the following patterns are excluded by default
'Common.sol/**',
'Components.sol/**',
'Script.sol/**',
'StdAssertions.sol/**',
'StdError.sol/**',
'StdCheats.sol/**',
'StdMath.sol/**',
'StdJson.sol/**',
'StdStorage.sol/**',
'StdUtils.sol/**',
'Vm.sol/**',
'console.sol/**',
'console2.sol/**',
'test.sol/**',
'**.s.sol/*.json',
'**.t.sol/*.json',
],
project: '../hello_foundry',
}),
],
})
forge (optional)
Options for forge
.
import { defineConfig } from '@wagmi/cli'
import { foundry } from '@wagmi/cli/plugins'
export default defineConfig({
plugins: [
foundry({
forge: {
clean: true,
build: true,
path: 'path/to/forge',
rebuild: true,
},
project: '../hello_foundry',
}),
],
})
clean
Remove build artifacts and cache directories on start up. Defaults tofalse
.build
Build Foundry project before fetching artifacts. Defaults totrue
.path
Path toforge
executable command. Defaults toforge
.rebuild
Rebuild every time a watched file or directory is changed. Used for setting up--watch
mode. Defaults totrue
.
include (optional)
Artifact files to include relative to artifacts
. Supports glob patterns.
import { defineConfig } from '@wagmi/cli'
import { foundry } from '@wagmi/cli/plugins'
export default defineConfig({
plugins: [
foundry({
include: [
// the following patterns are included by default
'*.json',
],
project: '../hello_foundry',
}),
],
})
namePrefix (optional)
Prefix to prepend to artifact names. Useful for preventing name collisions between contracts from other sources.
import { defineConfig } from '@wagmi/cli'
import { foundry } from '@wagmi/cli/plugins'
export default defineConfig({
plugins: [
foundry({
namePrefix: 'HelloFoundry',
project: '../hello_foundry',
}),
],
})