fedimovies/src/monero/wallet.rs
2022-08-22 20:17:27 +00:00

23 lines
685 B
Rust

use monero_rpc::RpcClient;
use crate::config::MoneroConfig;
#[derive(thiserror::Error, Debug)]
pub enum MoneroError {
#[error(transparent)]
WalletError(#[from] anyhow::Error),
}
/// http://monerotoruzizulg5ttgat2emf4d6fbmiea25detrmmy7erypseyteyd.onion/resources/developer-guides/wallet-rpc.html#create_wallet
pub async fn create_monero_wallet(
config: &MoneroConfig,
) -> 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?;
Ok(())
}