Browse Source

refactor(cdk-redb): feature gate mint and wallet

thesimplekid 11 months ago
parent
commit
15a25a4f3d

+ 1 - 1
.helix/languages.toml

@@ -1,2 +1,2 @@
 [language-server.rust-analyzer.config]
-cargo = { features = [ "wallet", "mint", "redb" ] }
+cargo = { features = [ "wallet", "mint", "redb", "all-nuts" ] }

+ 5 - 1
crates/cdk-redb/Cargo.toml

@@ -8,10 +8,14 @@ repository.workspace = true
 rust-version.workspace = true
 
 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+[features]
+default = ["mint", "wallet"]
+mint = ["cdk/mint"]
+wallet = ["cdk/wallet"]
 
 [dependencies]
 async-trait.workspace = true
-cdk.workspace = true
+cdk = { workspace = true, default-features = false }
 redb = "2.0.0"
 tokio.workspace = true
 thiserror.workspace = true

+ 8 - 4
crates/cdk-redb/src/lib.rs

@@ -1,5 +1,9 @@
-pub mod mint_redb;
-pub mod wallet_redb;
+#[cfg(feature = "mint")]
+pub mod mint;
+#[cfg(feature = "wallet")]
+pub mod wallet;
 
-pub use mint_redb::MintRedbDatabase;
-pub use wallet_redb::RedbWalletDatabase;
+#[cfg(feature = "mint")]
+pub use mint::MintRedbDatabase;
+#[cfg(feature = "wallet")]
+pub use wallet::RedbWalletDatabase;

+ 0 - 0
crates/cdk-redb/src/mint_redb.rs → crates/cdk-redb/src/mint.rs


+ 0 - 0
crates/cdk-redb/src/wallet_redb.rs → crates/cdk-redb/src/wallet.rs


+ 2 - 0
crates/cdk/src/cdk_database/mod.rs

@@ -13,7 +13,9 @@ use crate::secret::Secret;
 use crate::types::{MeltQuote, MintQuote};
 use crate::url::UncheckedUrl;
 
+#[cfg(feature = "mint")]
 pub mod mint_memory;
+#[cfg(feature = "wallet")]
 pub mod wallet_memory;
 
 #[derive(Debug, Error)]