Explorar o código

refactor: wallet localstore mod

thesimplekid hai 1 ano
pai
achega
fd692985dc

+ 0 - 3
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<Runtime> = Lazy::new(|| Runtime::new().expect("Can't start Tokio runtime"));

+ 0 - 0
crates/cashu-sdk/src/localstore/memory.rs → crates/cashu-sdk/src/wallet/localstore/memory.rs


+ 2 - 0
crates/cashu-sdk/src/localstore/mod.rs → 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)]

+ 0 - 0
crates/cashu-sdk/src/localstore/redb_store.rs → crates/cashu-sdk/src/wallet/localstore/redb_store.rs


+ 4 - 2
crates/cashu-sdk/src/wallet.rs → 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),
 }