Anchor.toml Configuration
Anchor workspace config reference documentation
provider (required)
A wallet and cluster that are used for all commands.
Example:
scripts (required for testing)
Scripts that can be run with anchor run <script>. The test script is
executed by anchor test.
Example:
features
resolution
This tells the IDL to support account resolution. The default is true.
Example:
workspace
types
Adds a directory where you want the <idl>.ts file to be copied when running
anchor build. This is helpful when you want to keep this file in version
control, like when using it on the frontend, which will probably not have access
to the target directory generated by anchor.
Example:
members
Sets the paths --relative to the Anchor.toml-- to all programs in the local
workspace, i.e., the path to the Cargo.toml manifest associated with each
program that can be compiled by the anchor CLI. For programs using the
standard Anchor workflow, this can be omitted. For programs not written in
Anchor but still want to publish, this should be added.
Example:
exclude
Opposite of workspace.members.
Example:
programs
Example:
The addresses of the programs in the workspace.
programs.localnet is used during testing on localnet where it's possible to
load a program at genesis with the --bpf-program option on
solana-test-validator.
test
startup_wait
Increases the time anchor waits for the solana-test-validator to start up.
This is, for example, useful if you're cloning (see test.validator.clone) many
accounts which increases the validator's startup time.
Example:
genesis
Makes commands like anchor test start solana-test-validator with a given
program already loaded.
Example
upgradeable
Deploys the program-to-test using --upgradeable-program. This makes it
possible to test that certain instructions can only be executed by the program's
upgrade authority. The initial upgrade authority will be set to
provider.wallet.
If unspecified or explicitly set to false, then the test program will be
deployed with --bpf-program, disabling upgrades to it.
Example:
test.validator
These options are passed into the options with the same name in the
solana-test-validator cli (see solana-test-validator --help) in commands
like anchor test.
test.validator.clone
Use this to clone an account from the test.validator.clone.url cluster to the
cluster of your test. If address points to a program owned by the "BPF
upgradeable loader", anchor (>= 0.23.0) will clone the program data account of
the program for you automatically.
Example:
test.validator.account
Use this to upload an account from a .json file.
Example:
toolchain
Override toolchain data in the workspace similar to
rust-toolchain.toml.
package_manager
The package_manager field indicates which package manager Anchor should use for all of its client and
workspace commands. Valid values
include npm, yarn, pnpm, and bun.
Anchor will default to yarn, if a value is not specified. Note values should be in lowercase, since
values are deserialized with serde(rename_all = "lowercase").
Example: