1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use crate::common::types::{CliError, Command};
use async_trait::async_trait;
use clap::Parser;
use crate::common::utils::{generate_key_pair, save_keypair};
#[derive(Debug, Parser)]
pub struct CreateAccount {}
#[async_trait]
impl Command<String> for CreateAccount {
fn command_name(&self) -> &'static str {
"CreateAccount"
}
async fn execute(self) -> Result<String, CliError> {
let keypair = generate_key_pair(None);
match save_keypair(keypair) {
Ok(res) => return Ok(res),
Err(err) => panic!("Error saving keypair {}", err),
};
}
}