CLI Reference
CLI
A CLI is provided to support building and managing an Anchor workspace. For a comprehensive list of commands and options, run huione-anchor -h
on any of the following subcommands.
Build
Builds programs in the workspace targeting Huione's BPF runtime and emitting IDLs in the target/idl
directory.
Runs the build inside a docker image so that the output binary is deterministic (assuming a Cargo.lock file is used). This command must be run from within a single crate subdirectory within the workspace. For example, programs/<my-program>/
.
Cluster
Cluster list
This lists cluster endpoints:
Deploy
Deploys all programs in the workspace to the configured cluster.
::: tip Note This is different from the huione program deploy
command, because everytime it's run it will generate a new program address. :::
Expand
If run inside a program folder, expands the macros of the program.
If run in the workspace but outside a program folder, expands the macros of the workspace.
If run with the --program-name
option, expand only the given program.
Idl
The idl
subcommand provides commands for interacting with interface definition files. It's recommended to use these commands to store an IDL on chain, at a deterministic address, as a function of nothing but the the program's ID. This allows us to generate clients for a program using nothing but the program ID.
Idl Init
Creates an idl account, writing the given <target/idl/program.json>
file into a program owned account. By default, the size of the account is double the size of the IDL, allowing room for growth in case the idl needs to be upgraded in the future.
Idl Fetch
Fetches an IDL from the configured blockchain. For example, make sure your Anchor.toml
is pointing to the mainnet
cluster and run
Idl Authority
Outputs the IDL account's authority. This is the wallet that has the ability to update the IDL.
Idl Erase Authority
Erases the IDL account's authority so that upgrades can no longer occur. The configured wallet must be the current authority.
Idl Upgrade
Upgrades the IDL file on chain to the new target/idl/program.json
idl. The configured wallet must be the current authority.
Sets a new authority on the IDL account. Both the new-authority
and program-id
must be encoded in base 58.
Init
Initializes a project workspace with the following structure.
Anchor.toml
: Anchor configuration file.Cargo.toml
: Rust workspace configuration file.package.json
: JavaScript dependencies file.programs/
: Directory for Huione program crates.app/
: Directory for your application frontend.tests/
: Directory for JavaScript integration tests.migrations/deploy.js
: Deploy script.
Migrate
Runs the deploy script located at migrations/deploy.js
, injecting a provider configured from the workspace's Anchor.toml
. For example,
Migrations are a new feature and only support this simple deploy script at the moment.
New
Creates a new program in the workspace's programs/
directory initialized with boilerplate.
Test
Run an integration test suit against the configured cluster, deploying new versions of all workspace programs before running them.
If the configured network is a localnet, then automatically starts the localnetwork and runs the test.
::: tip Note Be sure to shutdown any other local validators, otherwise huione-anchor test
will fail to run.
If you'd prefer to run the program against your local validator use huione-anchor test --skip-local-validator
. :::
When running tests we stream program logs to .huione-anchor/program-logs/<address>.<program-name>.log
::: tip Note The Anchor workflow recommends to test your program using integration tests in a language other than Rust to make sure that bugs related to syntax misunderstandings are coverable with tests and not just replicated in tests. :::
Upgrade
Uses Huione's upgradeable BPF loader to upgrade the on chain program code.
Verify
Verifies the on-chain bytecode matches the locally compiled artifact.
Last updated