|
@@ -1,8 +1,8 @@
|
|
|
-use std::path::{Path, PathBuf};
|
|
|
|
|
-use log::*;
|
|
|
|
|
-use std::sync::Arc;
|
|
|
|
|
use crate::wallet::WalletDB;
|
|
use crate::wallet::WalletDB;
|
|
|
use crate::{Error, Result};
|
|
use crate::{Error, Result};
|
|
|
|
|
+use log::*;
|
|
|
|
|
+use std::path::{Path, PathBuf};
|
|
|
|
|
+use std::sync::Arc;
|
|
|
|
|
|
|
|
// Dummy adapter for now
|
|
// Dummy adapter for now
|
|
|
pub struct RpcAdapter {}
|
|
pub struct RpcAdapter {}
|
|
@@ -22,39 +22,47 @@ impl RpcAdapter {
|
|
|
|
|
|
|
|
pub async fn key_gen() -> Result<PathBuf> {
|
|
pub async fn key_gen() -> Result<PathBuf> {
|
|
|
debug!(target: "adapter", "key_gen() [START]");
|
|
debug!(target: "adapter", "key_gen() [START]");
|
|
|
- let path = Self::get_path("wallet.db").await.expect("Failed to get path");
|
|
|
|
|
|
|
+ let path = Self::get_path("wallet.db")
|
|
|
|
|
+ .await
|
|
|
|
|
+ .expect("Failed to get path");
|
|
|
//WalletDB::key_gen(path).await?;
|
|
//WalletDB::key_gen(path).await?;
|
|
|
Ok(path)
|
|
Ok(path)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
pub async fn new_wallet() -> Result<()> {
|
|
pub async fn new_wallet() -> Result<()> {
|
|
|
debug!(target: "adapter", "new_wallet() [START]");
|
|
debug!(target: "adapter", "new_wallet() [START]");
|
|
|
- let path = Self::get_path("wallet.db").await.expect("Failed to get path");
|
|
|
|
|
|
|
+ let path = Self::get_path("wallet.db")
|
|
|
|
|
+ .await
|
|
|
|
|
+ .expect("Failed to get path");
|
|
|
WalletDB::new(path).await?;
|
|
WalletDB::new(path).await?;
|
|
|
Ok(())
|
|
Ok(())
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
pub async fn new_cashier_wallet() -> Result<()> {
|
|
pub async fn new_cashier_wallet() -> Result<()> {
|
|
|
debug!(target: "adapter", "new_cashier_wallet() [START]");
|
|
debug!(target: "adapter", "new_cashier_wallet() [START]");
|
|
|
- let path = Self::get_path("cashier.db").await.expect("Failed to get path");
|
|
|
|
|
|
|
+ let path = Self::get_path("cashier.db")
|
|
|
|
|
+ .await
|
|
|
|
|
+ .expect("Failed to get path");
|
|
|
WalletDB::new(path).await?;
|
|
WalletDB::new(path).await?;
|
|
|
Ok(())
|
|
Ok(())
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
pub async fn save_cash_key(pubkey: Vec<u8>) -> Result<()> {
|
|
pub async fn save_cash_key(pubkey: Vec<u8>) -> Result<()> {
|
|
|
debug!(target: "adapter", "save_cash_key() [START]");
|
|
debug!(target: "adapter", "save_cash_key() [START]");
|
|
|
- let path = Self::get_path("cashier.db").await.expect("Failed to get path");
|
|
|
|
|
|
|
+ let path = Self::get_path("cashier.db")
|
|
|
|
|
+ .await
|
|
|
|
|
+ .expect("Failed to get path");
|
|
|
WalletDB::save(path, pubkey).await?;
|
|
WalletDB::save(path, pubkey).await?;
|
|
|
Ok(())
|
|
Ok(())
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
pub async fn save_key(pubkey: Vec<u8>) -> Result<()> {
|
|
pub async fn save_key(pubkey: Vec<u8>) -> Result<()> {
|
|
|
debug!(target: "adapter", "save_key() [START]");
|
|
debug!(target: "adapter", "save_key() [START]");
|
|
|
- let path = Self::get_path("wallet.db").await.expect("Failed to get path");
|
|
|
|
|
|
|
+ let path = Self::get_path("wallet.db")
|
|
|
|
|
+ .await
|
|
|
|
|
+ .expect("Failed to get path");
|
|
|
WalletDB::save(path, pubkey).await?;
|
|
WalletDB::save(path, pubkey).await?;
|
|
|
Ok(())
|
|
Ok(())
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
pub async fn get_info() {}
|
|
pub async fn get_info() {}
|
|
@@ -63,4 +71,3 @@ impl RpcAdapter {
|
|
|
|
|
|
|
|
pub async fn stop() {}
|
|
pub async fn stop() {}
|
|
|
}
|
|
}
|
|
|
-
|
|
|