adapter.rs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. use crate::Result;
  2. use log::*;
  3. use std::sync::Arc;
  4. use crate::wallet::walletdb::DBInterface;
  5. // Dummy adapter for now
  6. pub struct RpcAdapter {}
  7. impl RpcAdapter {
  8. pub fn new() -> Arc<Self> {
  9. Arc::new(Self {})
  10. }
  11. pub async fn key_gen() -> Result<()> {
  12. debug!(target: "adapter", "key_gen() [START]");
  13. DBInterface::own_key_gen().await?;
  14. Ok(())
  15. }
  16. pub async fn new_wallet() -> Result<()> {
  17. debug!(target: "adapter", "new_wallet() [START]");
  18. DBInterface::new_wallet().await?;
  19. Ok(())
  20. }
  21. pub async fn new_cashier_wallet() -> Result<()> {
  22. debug!(target: "adapter", "new_wallet() [START]");
  23. DBInterface::new_cashier_wallet().await?;
  24. Ok(())
  25. }
  26. pub async fn save_key(pubkey: Vec<u8>) -> Result<()> {
  27. debug!(target: "adapter", "save_key() [START]");
  28. DBInterface::save_key(pubkey).await?;
  29. Ok(())
  30. }
  31. pub async fn get_info() {}
  32. pub async fn say_hello() {}
  33. pub async fn stop() {}
  34. }