Add keypair print (#5766)

automerge
This commit is contained in:
Tyera Eulberg 2019-09-02 12:53:13 -07:00 committed by Grimes
parent 85e5fbeb35
commit e8ab599bae
2 changed files with 5 additions and 1 deletions

View File

@ -99,6 +99,7 @@ pub fn parse_args(matches: &ArgMatches<'_>) -> Result<WalletConfig, Box<dyn erro
command, command,
json_rpc_url, json_rpc_url,
keypair, keypair,
keypair_path: id_path.to_string(),
rpc_client: None, rpc_client: None,
}) })
} }

View File

@ -125,6 +125,7 @@ pub struct WalletConfig {
pub command: WalletCommand, pub command: WalletCommand,
pub json_rpc_url: String, pub json_rpc_url: String,
pub keypair: Keypair, pub keypair: Keypair,
pub keypair_path: String,
pub rpc_client: Option<RpcClient>, pub rpc_client: Option<RpcClient>,
} }
@ -134,6 +135,7 @@ impl Default for WalletConfig {
command: WalletCommand::Balance(Pubkey::default()), command: WalletCommand::Balance(Pubkey::default()),
json_rpc_url: "http://127.0.0.1:8899".to_string(), json_rpc_url: "http://127.0.0.1:8899".to_string(),
keypair: Keypair::new(), keypair: Keypair::new(),
keypair_path: "".to_string(),
rpc_client: None, rpc_client: None,
} }
} }
@ -1348,11 +1350,12 @@ fn process_ping(
} }
pub fn process_command(config: &WalletConfig) -> ProcessResult { pub fn process_command(config: &WalletConfig) -> ProcessResult {
println_name_value("Keypair:", &config.keypair_path);
if let WalletCommand::Address = config.command { if let WalletCommand::Address = config.command {
// Get address of this client // Get address of this client
return Ok(format!("{}", config.keypair.pubkey())); return Ok(format!("{}", config.keypair.pubkey()));
} }
println_name_value("Using RPC Endpoint:", &config.json_rpc_url); println_name_value("RPC Endpoint:", &config.json_rpc_url);
let mut _rpc_client; let mut _rpc_client;
let rpc_client = if config.rpc_client.is_none() { let rpc_client = if config.rpc_client.is_none() {