|
@@ -1,7 +1,6 @@
|
|
|
use crate::wallet::WalletDB;
|
|
use crate::wallet::WalletDB;
|
|
|
use crate::Result;
|
|
use crate::Result;
|
|
|
use log::*;
|
|
use log::*;
|
|
|
-use std::path::PathBuf;
|
|
|
|
|
use std::sync::Arc;
|
|
use std::sync::Arc;
|
|
|
|
|
|
|
|
// Dummy adapter for now
|
|
// Dummy adapter for now
|
|
@@ -12,16 +11,6 @@ impl RpcAdapter {
|
|
|
Arc::new(Self {})
|
|
Arc::new(Self {})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- pub async fn key_gen() -> Result<()> {
|
|
|
|
|
- debug!(target: "adapter", "key_gen() [START]");
|
|
|
|
|
- let (public, private) = WalletDB::create_key().await;
|
|
|
|
|
- let path = WalletDB::path("wallet.db").expect("Failed to get path");
|
|
|
|
|
- WalletDB::save_key(path, public, private)
|
|
|
|
|
- .await
|
|
|
|
|
- .expect("Failed to save key");
|
|
|
|
|
- Ok(())
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
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 = WalletDB::path("wallet.db").expect("Failed to get path");
|
|
let path = WalletDB::path("wallet.db").expect("Failed to get path");
|
|
@@ -29,17 +18,30 @@ impl RpcAdapter {
|
|
|
Ok(())
|
|
Ok(())
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- pub async fn new_cashier_wallet() -> Result<()> {
|
|
|
|
|
|
|
+ pub async fn new_cash_wallet() -> Result<()> {
|
|
|
debug!(target: "adapter", "new_cashier_wallet() [START]");
|
|
debug!(target: "adapter", "new_cashier_wallet() [START]");
|
|
|
let path = WalletDB::path("cashier.db").expect("Failed to get path");
|
|
let path = WalletDB::path("cashier.db").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<()> {
|
|
|
|
|
- debug!(target: "adapter", "save_cash_key() [START]");
|
|
|
|
|
|
|
+ pub async fn key_gen() -> Result<()> {
|
|
|
|
|
+ debug!(target: "adapter", "key_gen() [START]");
|
|
|
|
|
+ let (public, private) = WalletDB::create_key().await;
|
|
|
|
|
+ let path = WalletDB::path("wallet.db").expect("Failed to get path");
|
|
|
|
|
+ WalletDB::save_key(path, public, private)
|
|
|
|
|
+ .await
|
|
|
|
|
+ .expect("Failed to save key");
|
|
|
|
|
+ Ok(())
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ pub async fn cash_key_gen() -> Result<()> {
|
|
|
|
|
+ debug!(target: "adapter", "key_gen() [START]");
|
|
|
|
|
+ let (public, private) = WalletDB::create_key().await;
|
|
|
let path = WalletDB::path("cashier.db").expect("Failed to get path");
|
|
let path = WalletDB::path("cashier.db").expect("Failed to get path");
|
|
|
- WalletDB::save(path, pubkey).await?;
|
|
|
|
|
|
|
+ WalletDB::save_key(path, public, private)
|
|
|
|
|
+ .await
|
|
|
|
|
+ .expect("Failed to save key");
|
|
|
Ok(())
|
|
Ok(())
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -53,7 +55,8 @@ impl RpcAdapter {
|
|
|
pub async fn get_cash_key() -> Result<()> {
|
|
pub async fn get_cash_key() -> Result<()> {
|
|
|
debug!(target: "adapter", "get_cash_key() [START]");
|
|
debug!(target: "adapter", "get_cash_key() [START]");
|
|
|
let path = WalletDB::path("cashier.db").expect("Failed to get path");
|
|
let path = WalletDB::path("cashier.db").expect("Failed to get path");
|
|
|
- WalletDB::get(path).await?;
|
|
|
|
|
|
|
+ let key = WalletDB::get(path).await?;
|
|
|
|
|
+ println!("{:?}", key);
|
|
|
Ok(())
|
|
Ok(())
|
|
|
}
|
|
}
|
|
|
pub async fn save_key(pubkey: Vec<u8>) -> Result<()> {
|
|
pub async fn save_key(pubkey: Vec<u8>) -> Result<()> {
|
|
@@ -63,6 +66,13 @@ impl RpcAdapter {
|
|
|
Ok(())
|
|
Ok(())
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ pub async fn save_cash_key(pubkey: Vec<u8>) -> Result<()> {
|
|
|
|
|
+ debug!(target: "adapter", "save_cash_key() [START]");
|
|
|
|
|
+ let path = WalletDB::path("cashier.db").expect("Failed to get path");
|
|
|
|
|
+ WalletDB::save(path, pubkey).await?;
|
|
|
|
|
+ Ok(())
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
pub async fn get_info() {}
|
|
pub async fn get_info() {}
|
|
|
|
|
|
|
|
pub async fn say_hello() {}
|
|
pub async fn say_hello() {}
|