Skip to content

Commit

Permalink
Merge pull request #1139 from MutinyWallet/cashu-fix
Browse files Browse the repository at this point in the history
Fixes for cashu
  • Loading branch information
benthecarman authored Apr 15, 2024
2 parents 3606842 + 6e73695 commit 142d0b5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
10 changes: 6 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions mutiny-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ payjoin = { version = "0.13.0", features = ["send", "base64"] }
bincode = "1.3.3"
hex-conservative = "0.1.1"
async-lock = "3.2.0"
bitcoin-waila = { git = "https://github.com/mutinywallet/bitcoin-waila", rev = "1d6c416fc0abaa2efa78e3dcf28450975d8f7bfe" }
bitcoin-waila = "0.5.0"

fedimint-client = "0.3.0"
fedimint-core = "0.3.0"
Expand All @@ -58,7 +58,7 @@ fedimint-ln-client = "0.3.0"
fedimint-bip39 = "0.3.0"
fedimint-ln-common = "0.3.0"
fedimint-tbs = "0.3.0"
moksha-core = { git = "https://github.com/ngutech21/moksha", rev = "18d99977965662d46ccec29fecdb0ce493745917" }
moksha-core = "0.2.1"

base64 = "0.13.0"
pbkdf2 = "0.11"
Expand Down
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
4 changes: 2 additions & 2 deletions mutiny-wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ once_cell = "1.18.0"
hex-conservative = "0.1.1"
payjoin = { version = "0.13.0", features = ["send", "base64"] }
fedimint-core = "0.3.0"
moksha-core = { git = "https://github.com/ngutech21/moksha", rev = "18d99977965662d46ccec29fecdb0ce493745917" }
moksha-core = "0.2.1"

bitcoin-waila = { git = "https://github.com/mutinywallet/bitcoin-waila", rev = "1d6c416fc0abaa2efa78e3dcf28450975d8f7bfe" }
bitcoin-waila = "0.5.0"

# The `console_error_panic_hook` crate provides better debugging of panics by
# logging them with `console.error`. This is great for development, but requires
Expand Down

0 comments on commit 142d0b5

Please sign in to comment.