Add functionality to open monero wallet through rpc

This commit is contained in:
Daniel Karzel 2021-02-09 14:32:33 +11:00
parent 62605a318a
commit dac4443bbd
3 changed files with 47 additions and 2 deletions

View file

@ -207,6 +207,11 @@ pub trait CreateWalletForOutput {
) -> anyhow::Result<()>;
}
#[async_trait]
pub trait OpenWallet {
async fn open_wallet(&self, file_name: &str) -> anyhow::Result<()>;
}
#[async_trait]
pub trait CreateWallet {
async fn create_wallet(&self, file_name: &str) -> anyhow::Result<()>;

View file

@ -1,6 +1,6 @@
use crate::monero::{
Amount, CreateWallet, CreateWalletForOutput, InsufficientFunds, PrivateViewKey, PublicViewKey,
Transfer, TransferProof, TxHash, WatchForTransfer,
Amount, CreateWallet, CreateWalletForOutput, InsufficientFunds, OpenWallet, PrivateViewKey,
PublicViewKey, Transfer, TransferProof, TxHash, WatchForTransfer,
};
use ::monero::{Address, Network, PrivateKey, PublicKey};
use anyhow::Result;
@ -94,6 +94,14 @@ impl CreateWalletForOutput for Wallet {
}
}
#[async_trait]
impl OpenWallet for Wallet {
async fn open_wallet(&self, file_name: &str) -> Result<()> {
self.inner.open_wallet(file_name).await?;
Ok(())
}
}
#[async_trait]
impl CreateWallet for Wallet {
async fn create_wallet(&self, file_name: &str) -> Result<()> {