Skip to content

Commit

Permalink
Add timeout builder to HttpClient
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcaseria committed Oct 28, 2024
1 parent dc325a9 commit 850bb76
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/cdk/src/wallet/client.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! Wallet client
use std::time::Duration;

use reqwest::Client;
use serde_json::Value;
use tracing::instrument;
Expand Down Expand Up @@ -91,6 +93,12 @@ impl HttpClient {
Ok(Self { inner: client })
}

/// Create new [`HttpClient`] with a timeout.
pub fn with_timeout(timeout: Duration) -> Result<Self, Error> {
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<Vec<KeySet>, Error> {
Expand Down

0 comments on commit 850bb76

Please sign in to comment.