Skip to main content

Command

Enum Command 

Source
pub enum Command {
Show 28 variants Init { name: String, javascript: bool, no_install: bool, package_manager: PackageManager, no_git: bool, template: ProgramTemplate, test_template: TestTemplate, force: bool, install_agent_skills: bool, }, Build {
Show 13 fields skip_lint: bool, ignore_keys: bool, no_idl: bool, idl: Option<String>, idl_ts: Option<String>, verifiable: bool, program_name: Option<String>, solana_version: Option<String>, docker_image: Option<String>, bootstrap: BootstrapMode, env: Vec<String>, cargo_args: Vec<String>, no_docs: bool,
}, Expand { program_name: Option<String>, cargo_args: Vec<String>, }, Verify { program_id: Pubkey, repo_url: Option<String>, commit_hash: Option<String>, current_dir: bool, program_name: Option<String>, args: Vec<String>, }, Test { program_name: Option<String>, skip_deploy: bool, skip_lint: bool, skip_local_validator: bool, skip_build: bool, no_idl: bool, detach: bool, run: Vec<String>, validator: ValidatorType, args: Vec<String>, env: Vec<String>, cargo_args: Vec<String>, }, New { name: String, template: ProgramTemplate, force: bool, }, Idl { subcmd: IdlCommand, }, Clean, Deploy { program_name: Option<String>, program_keypair: Option<String>, verifiable: bool, no_idl: bool, solana_args: Vec<String>, }, Migrate, Upgrade { program_id: Pubkey, program_filepath: String, max_retries: u32, solana_args: Vec<String>, }, Airdrop { amount: f64, pubkey: Option<Pubkey>, }, Cluster { subcmd: ClusterCommand, }, Config { subcmd: ConfigCommand, }, Shell, Run { script: String, script_args: Vec<String>, }, Keys { subcmd: KeysCommand, }, Localnet { skip_build: bool, skip_deploy: bool, skip_lint: bool, ignore_keys: bool, validator: ValidatorType, env: Vec<String>, cargo_args: Vec<String>, }, Account { account_type: String, address: Pubkey, idl: Option<String>, }, Completions { shell: Shell, }, Address, Balance { pubkey: Option<Pubkey>, lamports: bool, }, Epoch, EpochInfo, Logs { include_votes: bool, address: Option<Vec<Pubkey>>, }, ShowAccount { cmd: ShowAccountCommand, }, Keygen { subcmd: KeygenCommand, }, Program { subcmd: ProgramCommand, },
}

Variants§

§

Init

Initializes a workspace.

Fields

§name: String

Workspace name

§javascript: bool

Use JavaScript instead of TypeScript

§no_install: bool

Don’t install JavaScript dependencies

§package_manager: PackageManager

Package Manager to use

§no_git: bool

Don’t initialize git

§template: ProgramTemplate

Rust program template to use

§test_template: TestTemplate

Test template to use

§force: bool

Initialize even if there are files

§install_agent_skills: bool

Install Solana agent skills

§

Build

Builds the workspace.

Fields

§skip_lint: bool

True if the build should not fail even if there are no “CHECK” comments

§ignore_keys: bool

Skip checking for program ID mismatch between keypair and declare_id

§no_idl: bool

Do not build the IDL

§idl: Option<String>

Output directory for the IDL.

§idl_ts: Option<String>

Output directory for the TypeScript IDL.

§verifiable: bool

True if the build artifact needs to be deterministic and verifiable.

§program_name: Option<String>

Name of the program to build

§solana_version: Option<String>

Version of the Solana toolchain to use. For –verifiable builds only.

§docker_image: Option<String>

Docker image to use. For –verifiable builds only.

§bootstrap: BootstrapMode

Bootstrap docker image from scratch, installing all requirements for verifiable builds. Only works for debian-based images.

§env: Vec<String>

Environment variables to pass into the docker container

§cargo_args: Vec<String>

Arguments to pass to the underlying cargo build-sbf command

§no_docs: bool

Suppress doc strings in IDL output

§

Expand

Expands macros (wrapper around cargo expand)

Use it in a program folder to expand program

Use it in a workspace but outside a program folder to expand the entire workspace

Fields

§program_name: Option<String>

Expand only this program

§cargo_args: Vec<String>

Arguments to pass to the underlying cargo expand command

§

Verify

Verifies the on-chain bytecode matches the locally compiled artifact. Run this command inside a program subdirectory, i.e., in the dir containing the program’s Cargo.toml.

Fields

§program_id: Pubkey

The program ID to verify.

§repo_url: Option<String>

The URL of the repository to verify against. Conflicts with --current-dir.

§commit_hash: Option<String>

The commit hash to verify against. Requires --repo-url.

§current_dir: bool

Verify against the source code in the current directory. Conflicts with --repo-url.

§program_name: Option<String>

Name of the program to run the command on. Defaults to the package name.

§args: Vec<String>

Any additional arguments to pass to solana-verify.

§

Test

Runs integration tests.

Fields

§program_name: Option<String>

Build and test only this program

§skip_deploy: bool

Use this flag if you want to run tests against previously deployed programs.

§skip_lint: bool

True if the build should not fail even if there are no “CHECK” comments where normally required

§skip_local_validator: bool

Flag to skip starting a local validator, if the configured cluster url is a localnet.

§skip_build: bool

Flag to skip building the program in the workspace, use this to save time when running test and the program code is not altered.

§no_idl: bool

Do not build the IDL

§detach: bool

Flag to keep the local validator running after tests to be able to check the transactions.

§run: Vec<String>

Run the test suites under the specified path

§validator: ValidatorType

Validator type to use for local testing

§args: Vec<String>
§env: Vec<String>

Environment variables to pass into the docker container

§cargo_args: Vec<String>

Arguments to pass to the underlying cargo build-sbf command.

§

New

Creates a new program.

Fields

§name: String

Program name

§template: ProgramTemplate

Rust program template to use

§force: bool

Create new program even if there is already one

§

Idl

Commands for interacting with interface definitions.

Fields

§subcmd: IdlCommand
§

Clean

Remove all artifacts from the generated directories except program keypairs.

§

Deploy

👎Deprecated since 0.32.0:

use anchor program deploy instead

Deploys each program in the workspace.

Fields

§program_name: Option<String>
👎Deprecated since 0.32.0:

use anchor program deploy instead

Only deploy this program

§program_keypair: Option<String>
👎Deprecated since 0.32.0:

use anchor program deploy instead

Keypair of the program (filepath) (requires program-name)

§verifiable: bool
👎Deprecated since 0.32.0:

use anchor program deploy instead

If true, deploy from path target/verifiable

§no_idl: bool
👎Deprecated since 0.32.0:

use anchor program deploy instead

Don’t upload IDL during deployment (IDL is uploaded by default)

§solana_args: Vec<String>
👎Deprecated since 0.32.0:

use anchor program deploy instead

Arguments to pass to the underlying solana program deploy command.

§

Migrate

Runs the deploy migration script.

§

Upgrade

👎Deprecated since 0.32.0:

use anchor program upgrade instead

Deploys, initializes an IDL, and migrates all in one command. Upgrades a single program. The configured wallet must be the upgrade authority.

Fields

§program_id: Pubkey
👎Deprecated since 0.32.0:

use anchor program upgrade instead

The program to upgrade.

§program_filepath: String
👎Deprecated since 0.32.0:

use anchor program upgrade instead

Filepath to the new program binary.

§max_retries: u32
👎Deprecated since 0.32.0:

use anchor program upgrade instead

Max times to retry on failure.

§solana_args: Vec<String>
👎Deprecated since 0.32.0:

use anchor program upgrade instead

Arguments to pass to the underlying solana program deploy command.

§

Airdrop

Request an airdrop of SOL

Fields

§amount: f64

Amount of SOL to airdrop

§pubkey: Option<Pubkey>

Recipient address (defaults to configured wallet)

§

Cluster

Cluster commands.

Fields

§

Config

Configuration management commands.

Fields

§

Shell

Starts a node shell with an Anchor client setup according to the local config.

§

Run

Runs the script defined by the current workspace’s Anchor.toml.

Fields

§script: String

The name of the script to run.

§script_args: Vec<String>

Argument to pass to the underlying script.

§

Keys

Program keypair commands.

Fields

§

Localnet

Localnet commands.

Fields

§skip_build: bool

Flag to skip building the program in the workspace, use this to save time when running test and the program code is not altered.

§skip_deploy: bool

Use this flag if you want to run tests against previously deployed programs.

§skip_lint: bool

True if the build should not fail even if there are no “CHECK” comments where normally required

§ignore_keys: bool

Skip checking for program ID mismatch between keypair and declare_id

§validator: ValidatorType

Validator type to use for local testing

§env: Vec<String>

Environment variables to pass into the docker container

§cargo_args: Vec<String>

Arguments to pass to the underlying cargo build-sbf command.

§

Account

Fetch and deserialize an account using the IDL provided.

Fields

§account_type: String

Account struct to deserialize (format: <program_name>.)

§address: Pubkey

Address of the account to deserialize

§idl: Option<String>

IDL to use (defaults to workspace IDL)

§

Completions

Generates shell completions.

Fields

§shell: Shell
§

Address

Get your public key

§

Balance

Get your balance

Fields

§pubkey: Option<Pubkey>

Account to check balance for (defaults to configured wallet)

§lamports: bool

Display balance in lamports instead of SOL

§

Epoch

Get current epoch

§

EpochInfo

Get information about the current epoch

§

Logs

Stream transaction logs

Fields

§include_votes: bool

Include vote transactions when monitoring all transactions

§address: Option<Vec<Pubkey>>

Addresses to filter logs by

§

ShowAccount

Show the contents of an account

Fields

§cmd: ShowAccountCommand
§

Keygen

Keypair generation and management

Fields

§

Program

Program deployment and management commands

Fields

Trait Implementations§

Source§

impl CommandFactory for Command

Source§

fn command<'b>() -> Command

Build a Command that can instantiate Self. Read more
Source§

fn command_for_update<'b>() -> Command

Build a Command that can update self. Read more
Source§

impl Debug for Command

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FromArgMatches for Command

Source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

fn update_from_arg_matches_mut<'b>( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

impl Parser for Command

Source§

fn parse() -> Self

Parse from std::env::args_os(), exit on error.
Source§

fn try_parse() -> Result<Self, Error>

Parse from std::env::args_os(), return Err on error.
Source§

fn parse_from<I, T>(itr: I) -> Self
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, exit on error.
Source§

fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, return Err on error.
Source§

fn update_from<I, T>(&mut self, itr: I)
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, exit on error. Read more
Source§

fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, return Err on error.
Source§

impl Subcommand for Command

Source§

fn augment_subcommands<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate Self via FromArgMatches::from_arg_matches_mut Read more
Source§

fn augment_subcommands_for_update<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate self via FromArgMatches::update_from_arg_matches_mut Read more
Source§

fn has_subcommand(__clap_name: &str) -> bool

Test whether Self can parse a specific subcommand

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Conv for T

Source§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
Source§

impl<T> FmtForward for T

Source§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
Source§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
Source§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
Source§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
Source§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
Source§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
Source§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
Source§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
Source§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pipe for T
where T: ?Sized,

Source§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
Source§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
Source§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Source§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
Source§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
Source§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
Source§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Tap for T

Source§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
Source§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
Source§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
Source§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
Source§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
Source§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
Source§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
Source§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
Source§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
Source§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
Source§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
Source§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
Source§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
Source§

impl<T> TryConv for T

Source§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more