Skip to content

Commit

Permalink
Don't truncate cashu mint urls
Browse files Browse the repository at this point in the history
  • Loading branch information
benthecarman committed Apr 12, 2024
1 parent 8929f85 commit 4cc219e
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions mutiny-core/src/cashu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,27 @@ impl CashuHttpClient {
url: &Url,
melt_quote_request: PostMeltQuoteBolt11Request,
) -> Result<PostMeltQuoteBolt11Response, MutinyError> {
self.mint_post(
&url.join("/v1/melt/quote/bolt11")?,
json!(melt_quote_request),
)
.await
let url = format!("{url}/v1/melt/quote/bolt11");
self.mint_post(url, json!(melt_quote_request)).await
}

pub async fn post_melt_bolt11(
&self,
url: &Url,
melt_request: PostMeltBolt11Request,
) -> Result<PostMeltBolt11Response, MutinyError> {
self.mint_post(&url.join("/v1/melt/bolt11")?, json!(melt_request))
.await
let url = format!("{url}/v1/melt/bolt11");
self.mint_post(url, json!(melt_request)).await
}

async fn mint_post<T: serde::de::DeserializeOwned>(
&self,
url: &Url,
url: String,
body: Value,
) -> Result<T, MutinyError> {
let res = self
.client
.post(url.clone())
.post(url)
.header("Content-Type", "application/json")
.body(body.to_string())
.send()
Expand Down

0 comments on commit 4cc219e

Please sign in to comment.