|
@@ -12,55 +12,37 @@ impl RpcAdapter {
|
|
|
Arc::new(Self {})
|
|
Arc::new(Self {})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- pub async fn get_path(wallet: &str) -> Result<PathBuf> {
|
|
|
|
|
- debug!(target: "adapter", "TEST PATH [START]");
|
|
|
|
|
- let mut path = WalletDB::path().await.expect("Failed to get path");
|
|
|
|
|
- debug!(target: "adapter", "TEST PATH {:?}", path);
|
|
|
|
|
- path.push(wallet);
|
|
|
|
|
- Ok(path)
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
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 = WalletDB::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 = WalletDB::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 = WalletDB::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 = WalletDB::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 = WalletDB::path("wallet.db").await.expect("Failed to get path");
|
|
|
WalletDB::save(path, pubkey).await?;
|
|
WalletDB::save(path, pubkey).await?;
|
|
|
Ok(())
|
|
Ok(())
|
|
|
}
|
|
}
|