Modify create-monero-wallet command to accept wallet name and password args
This commit is contained in:
parent
2eb7ec2f64
commit
703cae0a43
2 changed files with 12 additions and 7 deletions
11
src/cli.rs
11
src/cli.rs
|
@ -294,7 +294,10 @@ impl UpdateCurrentBlock {
|
|||
|
||||
/// Create Monero wallet
|
||||
#[derive(Parser)]
|
||||
pub struct CreateMoneroWallet;
|
||||
pub struct CreateMoneroWallet {
|
||||
name: String,
|
||||
password: Option<String>,
|
||||
}
|
||||
|
||||
impl CreateMoneroWallet {
|
||||
pub async fn execute(
|
||||
|
@ -304,7 +307,11 @@ impl CreateMoneroWallet {
|
|||
let monero_config = config.blockchain()
|
||||
.and_then(|conf| conf.monero_config())
|
||||
.ok_or(anyhow!("monero configuration not found"))?;
|
||||
create_monero_wallet(monero_config).await?;
|
||||
create_monero_wallet(
|
||||
monero_config,
|
||||
self.name.clone(),
|
||||
self.password.clone(),
|
||||
).await?;
|
||||
println!("wallet created");
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -11,13 +11,11 @@ pub enum MoneroError {
|
|||
/// http://monerotoruzizulg5ttgat2emf4d6fbmiea25detrmmy7erypseyteyd.onion/resources/developer-guides/wallet-rpc.html#create_wallet
|
||||
pub async fn create_monero_wallet(
|
||||
config: &MoneroConfig,
|
||||
name: String,
|
||||
password: Option<String>,
|
||||
) -> Result<(), MoneroError> {
|
||||
let wallet_client = RpcClient::new(config.wallet_url.clone()).wallet();
|
||||
let language = "English".to_string();
|
||||
wallet_client.create_wallet(
|
||||
config.wallet_name.clone(),
|
||||
config.wallet_password.clone(),
|
||||
language,
|
||||
).await?;
|
||||
wallet_client.create_wallet(name, password, language).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue