@@ -1,6 +1,7 @@
|
||||
use crate::{
|
||||
cluster_query::*,
|
||||
display::{println_name_value, println_signers},
|
||||
nonce::*,
|
||||
stake::*,
|
||||
storage::*,
|
||||
validator_info::*,
|
||||
@@ -104,6 +105,22 @@ pub enum CliCommand {
|
||||
ShowValidators {
|
||||
use_lamports_unit: bool,
|
||||
},
|
||||
// Nonce commands
|
||||
CreateNonceAccount {
|
||||
nonce_account: KeypairEq,
|
||||
lamports: u64,
|
||||
},
|
||||
GetNonce(Pubkey),
|
||||
NewNonce(KeypairEq),
|
||||
ShowNonceAccount {
|
||||
nonce_account_pubkey: Pubkey,
|
||||
use_lamports_unit: bool,
|
||||
},
|
||||
WithdrawFromNonceAccount {
|
||||
nonce_account: KeypairEq,
|
||||
destination_account_pubkey: Pubkey,
|
||||
lamports: u64,
|
||||
},
|
||||
// Program Deployment
|
||||
Deploy(String),
|
||||
// Stake Commands
|
||||
@@ -304,6 +321,14 @@ pub fn parse_command(matches: &ArgMatches<'_>) -> Result<CliCommandInfo, Box<dyn
|
||||
require_keypair: false,
|
||||
}),
|
||||
("show-validators", Some(matches)) => parse_show_validators(matches),
|
||||
// Nonce Commands
|
||||
("create-nonce-account", Some(matches)) => parse_nonce_create_account(matches),
|
||||
("get-nonce", Some(matches)) => parse_get_nonce(matches),
|
||||
("new-nonce", Some(matches)) => parse_new_nonce(matches),
|
||||
("show-nonce-account", Some(matches)) => parse_show_nonce_account(matches),
|
||||
("withdraw-from-nonce-account", Some(matches)) => {
|
||||
parse_withdraw_from_nonce_account(matches)
|
||||
}
|
||||
// Program Deployment
|
||||
("deploy", Some(matches)) => Ok(CliCommandInfo {
|
||||
command: CliCommand::Deploy(matches.value_of("program_location").unwrap().to_string()),
|
||||
@@ -497,6 +522,7 @@ pub fn parse_command(matches: &ArgMatches<'_>) -> Result<CliCommandInfo, Box<dyn
|
||||
require_keypair: true,
|
||||
})
|
||||
}
|
||||
//
|
||||
("", None) => {
|
||||
eprintln!("{}", matches.usage());
|
||||
Err(CliError::CommandNotRecognized(
|
||||
@@ -1035,6 +1061,39 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
|
||||
process_show_validators(&rpc_client, *use_lamports_unit)
|
||||
}
|
||||
|
||||
// Nonce Commands
|
||||
|
||||
// Create nonce account
|
||||
CliCommand::CreateNonceAccount {
|
||||
nonce_account,
|
||||
lamports,
|
||||
} => process_create_nonce_account(&rpc_client, config, nonce_account, *lamports),
|
||||
// Get the current nonce
|
||||
CliCommand::GetNonce(nonce_account_pubkey) => {
|
||||
process_get_nonce(&rpc_client, &nonce_account_pubkey)
|
||||
}
|
||||
// Get a new nonce
|
||||
CliCommand::NewNonce(nonce_account) => {
|
||||
process_new_nonce(&rpc_client, config, nonce_account)
|
||||
}
|
||||
// Show the contents of a nonce account
|
||||
CliCommand::ShowNonceAccount {
|
||||
nonce_account_pubkey,
|
||||
use_lamports_unit,
|
||||
} => process_show_nonce_account(&rpc_client, &nonce_account_pubkey, *use_lamports_unit),
|
||||
// Withdraw lamports from a nonce account
|
||||
CliCommand::WithdrawFromNonceAccount {
|
||||
nonce_account,
|
||||
destination_account_pubkey,
|
||||
lamports,
|
||||
} => process_withdraw_from_nonce_account(
|
||||
&rpc_client,
|
||||
config,
|
||||
&nonce_account,
|
||||
&destination_account_pubkey,
|
||||
*lamports,
|
||||
),
|
||||
|
||||
// Program Deployment
|
||||
|
||||
// Deploy a custom program to the chain
|
||||
@@ -1419,6 +1478,7 @@ pub fn app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, '
|
||||
.setting(AppSettings::SubcommandRequiredElseHelp)
|
||||
.subcommand(SubCommand::with_name("address").about("Get your public key"))
|
||||
.cluster_query_subcommands()
|
||||
.nonce_subcommands()
|
||||
.subcommand(
|
||||
SubCommand::with_name("deploy")
|
||||
.about("Deploy a program")
|
||||
|
Reference in New Issue
Block a user