CLI: Fix create-nonce-account with seed (#8929) (#8961)

automerge
This commit is contained in:
mergify[bot]
2020-03-19 10:32:35 -07:00
committed by GitHub
parent 2a617f2d07
commit ad6078da2d
3 changed files with 142 additions and 11 deletions

View File

@@ -41,6 +41,7 @@ use solana_sdk::{
pubkey::Pubkey,
signature::{Keypair, Signature, Signer, SignerError},
system_instruction::{self, create_address_with_seed, SystemError, MAX_ADDRESS_SEED_LEN},
system_program,
transaction::{Transaction, TransactionError},
};
use solana_stake_program::{
@@ -1062,9 +1063,10 @@ pub fn parse_create_address_with_seed(
};
let program_id = match matches.value_of("program_id").unwrap() {
"NONCE" => system_program::id(),
"STAKE" => solana_stake_program::id(),
"VOTE" => solana_vote_program::id(),
"STORAGE" => solana_storage_program::id(),
"VOTE" => solana_vote_program::id(),
_ => pubkey_of(matches, "program_id").unwrap(),
};
@@ -2338,7 +2340,7 @@ pub fn app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, '
.required(true)
.help(
"The program_id that the address will ultimately be used for, \n\
or one of STAKE, VOTE, and STORAGE keywords",
or one of NONCE, STAKE, STORAGE, and VOTE keywords",
),
)
.arg(
@@ -2760,6 +2762,7 @@ mod tests {
("STAKE", solana_stake_program::id()),
("VOTE", solana_vote_program::id()),
("STORAGE", solana_storage_program::id()),
("NONCE", system_program::id()),
] {
let test_create_address_with_seed = test_commands.clone().get_matches_from(vec![
"test",

View File

@@ -110,13 +110,6 @@ impl NonceSubCommands for App<'_, '_> {
.validator(is_valid_pubkey)
.help("Account to be granted authority of the nonce account"),
)
.arg(
Arg::with_name("seed")
.long("seed")
.value_name("STRING")
.takes_value(true)
.help("Seed for address generation; if specified, the resulting account will be at a derived address of the NONCE_ACCOUNT pubkey")
)
.arg(nonce_authority_arg()),
)
.subcommand(
@@ -147,6 +140,13 @@ impl NonceSubCommands for App<'_, '_> {
.value_name("PUBKEY")
.validator(is_valid_pubkey)
.help("Assign noncing authority to another entity"),
)
.arg(
Arg::with_name("seed")
.long("seed")
.value_name("STRING")
.takes_value(true)
.help("Seed for address generation; if specified, the resulting account will be at a derived address of the NONCE_ACCOUNT pubkey")
),
)
.subcommand(