diff --git a/crates/cdk/src/wallet/client.rs b/crates/cdk/src/wallet/client.rs index 47a93c912..5c3e3ea16 100644 --- a/crates/cdk/src/wallet/client.rs +++ b/crates/cdk/src/wallet/client.rs @@ -1,5 +1,7 @@ //! Wallet client +use std::time::Duration; + use reqwest::Client; use serde_json::Value; use tracing::instrument; @@ -91,6 +93,12 @@ impl HttpClient { Ok(Self { inner: client }) } + /// Create new [`HttpClient`] with a timeout. + pub fn with_timeout(timeout: Duration) -> Result { + let client = reqwest::Client::builder().timeout(timeout).build()?; + Ok(Self { inner: client }) + } + /// Get Active Mint Keys [NUT-01] #[instrument(skip(self), fields(mint_url = %mint_url))] pub async fn get_mint_keys(&self, mint_url: Url) -> Result, Error> {