mb-solana 0.0.10

my solana lib helpers and cli tools
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::account::keypair_from_str;
use crate::cli::util::{print_fatal, print_keypair};
use solana_sdk::signature::read_keypair_file;

pub fn run(private_key: Option<String>) {
    let private_key = match private_key {
        Some(private_key) => private_key,
        None => rpassword::prompt_password("private_key:").unwrap(),
    };

    if let Some(keypair) = keypair_from_str(&private_key) {
        return print_keypair(keypair);
    }
    if let Ok(keypair) = read_keypair_file(private_key) {
        return print_keypair(keypair);
    }
    print_fatal("invalid private key");
}