Browse Source

Remote default implementation of methods

Cesar Rodas 2 months ago
parent
commit
eec82e0e3d

+ 1 - 2
crates/cdk-integration-tests/Cargo.toml

@@ -20,7 +20,7 @@ rand.workspace = true
 bip39 = { workspace = true, features = ["rand"] }
 anyhow.workspace = true
 cashu = { workspace = true, features = ["mint", "wallet"] }
-cdk = { workspace = true, features = ["mint", "wallet", "auth"] }
+cdk = { workspace = true, features = ["mint", "wallet", "auth", "bip353"] }
 cdk-cln = { workspace = true }
 cdk-lnd = { workspace = true }
 cdk-ldk-node = { workspace = true }
@@ -63,7 +63,6 @@ uuid = { workspace = true, features = ["js"] }
 [dev-dependencies]
 bip39 = { workspace = true, features = ["rand"] }
 anyhow.workspace = true
-cdk = { workspace = true, features = ["mint", "wallet"] }
 cdk-axum = { workspace = true }
 cdk-fake-wallet = { workspace = true }
 tower-http = { workspace = true, features = ["cors"] }

+ 4 - 0
crates/cdk-integration-tests/src/init_pure_tests.rs

@@ -55,6 +55,10 @@ impl Debug for DirectMintConnection {
 /// Convert the requests and responses between the [String] and [Uuid] variants as necessary.
 #[async_trait]
 impl MintConnector for DirectMintConnection {
+    async fn resolve_dns_txt(&self, _domain: &str) -> Result<Vec<String>, Error> {
+        panic!("Not implemented");
+    }
+
     async fn get_mint_keys(&self) -> Result<Vec<KeySet>, Error> {
         Ok(self.mint.pubkeys().keysets)
     }

+ 1 - 1
crates/cdk/Cargo.toml

@@ -11,7 +11,7 @@ license.workspace = true
 
 
 [features]
-default = ["mint", "wallet", "auth", "nostr"]
+default = ["mint", "wallet", "auth", "nostr", "bip353"]
 wallet = ["dep:futures", "dep:reqwest", "cdk-common/wallet", "dep:rustls"]
 nostr = ["wallet", "dep:nostr-sdk"]
 mint = ["dep:futures", "dep:reqwest", "cdk-common/mint", "cdk-signatory"]

+ 5 - 0
crates/cdk/examples/mint-token-bolt12-with-custom-http.rs

@@ -40,6 +40,11 @@ impl Default for CustomHttp {
 #[cfg_attr(target_arch = "wasm32", async_trait::async_trait(?Send))]
 #[cfg_attr(not(target_arch = "wasm32"), async_trait::async_trait)]
 impl HttpTransport for CustomHttp {
+    #[cfg(feature = "bip353")]
+    async fn resolve_dns_txt(&self, _domain: &str) -> Result<Vec<String>, Error> {
+        panic!("Not supported");
+    }
+
     fn with_proxy(
         &mut self,
         _proxy: Url,

+ 1 - 3
crates/cdk/src/wallet/mint_connector/mod.rs

@@ -30,9 +30,7 @@ pub type HttpClient = http_client::HttpClient<transport::Async>;
 pub trait MintConnector: Debug {
     #[cfg(feature = "bip353")]
     /// Resolve the DNS record getting the TXT value
-    async fn resolve_dns_txt(&self, _domain: &str) -> Result<Vec<String>, Error> {
-        todo!()
-    }
+    async fn resolve_dns_txt(&self, _domain: &str) -> Result<Vec<String>, Error>;
 
     /// Get Active Mint Keys [NUT-01]
     async fn get_mint_keys(&self) -> Result<Vec<KeySet>, Error>;

+ 1 - 3
crates/cdk/src/wallet/mint_connector/transport.rs

@@ -22,9 +22,7 @@ use crate::error::ErrorResponse;
 pub trait Transport: Default + Send + Sync + Debug + Clone {
     #[cfg(feature = "bip353")]
     /// DNS resolver to get a TXT record from a domain name
-    async fn resolve_dns_txt(&self, _domain: &str) -> Result<Vec<String>, Error> {
-        todo!()
-    }
+    async fn resolve_dns_txt(&self, _domain: &str) -> Result<Vec<String>, Error>;
 
     /// Make the transport to use a given proxy
     fn with_proxy(