From fd692985dcb8b5ffc2c6fbfddddf82e14c3c32bf Mon Sep 17 00:00:00 2001 From: thesimplekid Date: Tue, 2 Jan 2024 19:22:40 +0000 Subject: [PATCH] refactor: wallet localstore mod --- crates/cashu-sdk/src/lib.rs | 3 --- crates/cashu-sdk/src/{ => wallet}/localstore/memory.rs | 0 crates/cashu-sdk/src/{ => wallet}/localstore/mod.rs | 2 ++ crates/cashu-sdk/src/{ => wallet}/localstore/redb_store.rs | 0 crates/cashu-sdk/src/{wallet.rs => wallet/mod.rs} | 6 ++++-- 5 files changed, 6 insertions(+), 5 deletions(-) rename crates/cashu-sdk/src/{ => wallet}/localstore/memory.rs (100%) rename crates/cashu-sdk/src/{ => wallet}/localstore/mod.rs (96%) rename crates/cashu-sdk/src/{ => wallet}/localstore/redb_store.rs (100%) rename crates/cashu-sdk/src/{wallet.rs => wallet/mod.rs} (99%) diff --git a/crates/cashu-sdk/src/lib.rs b/crates/cashu-sdk/src/lib.rs index 77678f67..79083942 100644 --- a/crates/cashu-sdk/src/lib.rs +++ b/crates/cashu-sdk/src/lib.rs @@ -11,7 +11,6 @@ use tokio::runtime::Runtime; #[cfg(feature = "wallet")] pub mod client; -mod localstore; #[cfg(feature = "mint")] pub mod mint; pub mod utils; @@ -20,8 +19,6 @@ pub mod wallet; pub use bip39::Mnemonic; pub use cashu::{self, *}; -#[cfg(all(not(target_arch = "wasm32"), feature = "redb"))] -pub use localstore::redb_store::RedbLocalStore; #[cfg(feature = "blocking")] static RUNTIME: Lazy = Lazy::new(|| Runtime::new().expect("Can't start Tokio runtime")); diff --git a/crates/cashu-sdk/src/localstore/memory.rs b/crates/cashu-sdk/src/wallet/localstore/memory.rs similarity index 100% rename from crates/cashu-sdk/src/localstore/memory.rs rename to crates/cashu-sdk/src/wallet/localstore/memory.rs diff --git a/crates/cashu-sdk/src/localstore/mod.rs b/crates/cashu-sdk/src/wallet/localstore/mod.rs similarity index 96% rename from crates/cashu-sdk/src/localstore/mod.rs rename to crates/cashu-sdk/src/wallet/localstore/mod.rs index 8458fc70..009c2aba 100644 --- a/crates/cashu-sdk/src/localstore/mod.rs +++ b/crates/cashu-sdk/src/wallet/localstore/mod.rs @@ -9,6 +9,8 @@ use async_trait::async_trait; use cashu::nuts::{Id, KeySetInfo, Keys, MintInfo, Proofs}; use cashu::types::{MeltQuote, MintQuote}; use cashu::url::UncheckedUrl; +#[cfg(all(not(target_arch = "wasm32"), feature = "redb"))] +pub use redb_store::RedbLocalStore; use thiserror::Error; #[derive(Debug, Error)] diff --git a/crates/cashu-sdk/src/localstore/redb_store.rs b/crates/cashu-sdk/src/wallet/localstore/redb_store.rs similarity index 100% rename from crates/cashu-sdk/src/localstore/redb_store.rs rename to crates/cashu-sdk/src/wallet/localstore/redb_store.rs diff --git a/crates/cashu-sdk/src/wallet.rs b/crates/cashu-sdk/src/wallet/mod.rs similarity index 99% rename from crates/cashu-sdk/src/wallet.rs rename to crates/cashu-sdk/src/wallet/mod.rs index 9bfdc7a2..57508ebc 100644 --- a/crates/cashu-sdk/src/wallet.rs +++ b/crates/cashu-sdk/src/wallet/mod.rs @@ -15,13 +15,15 @@ use cashu::types::ProofsStatus; use cashu::types::{MeltQuote, Melted, MintQuote}; use cashu::url::UncheckedUrl; use cashu::{Amount, Bolt11Invoice}; +use localstore::LocalStore; use thiserror::Error; use tracing::warn; use crate::client::Client; -use crate::localstore::LocalStore; use crate::utils::unix_time; +pub mod localstore; + #[derive(Debug, Error)] pub enum Error { /// Insufficient Funds @@ -39,7 +41,7 @@ pub enum Error { #[error("Quote Unknown")] QuoteUnknown, #[error("`{0}`")] - LocalStore(#[from] super::localstore::Error), + LocalStore(#[from] localstore::Error), #[error("`{0}`")] Custom(String), }