mirror of
https://github.com/aljazceru/cdk.git
synced 2025-12-24 16:14:54 +01:00
use value to return error
This commit is contained in:
@@ -19,7 +19,7 @@ bitcoin = { version = "0.30.0", features=["serde"] }
|
||||
bitcoin_hashes = "0.12.0"
|
||||
hex = "0.4.3"
|
||||
k256 = { version = "0.13.1", features=["arithmetic"] }
|
||||
lightning-invoice = { version = "0.22.0", features=["serde"] }
|
||||
lightning-invoice = { version = "0.23.0", features=["serde"] }
|
||||
minreq = { version = "2.7.0", features = ["json-using-serde", "https"] }
|
||||
rand = "0.8.5"
|
||||
getrandom = { version = "0.2", features = ["js"] }
|
||||
|
||||
@@ -90,10 +90,18 @@ impl Client {
|
||||
outputs: blinded_messages.blinded_messages,
|
||||
};
|
||||
|
||||
Ok(minreq::post(url)
|
||||
let res = minreq::post(url)
|
||||
.with_json(&request)?
|
||||
.send()?
|
||||
.json::<PostMintResponse>()?)
|
||||
.json::<Value>()?;
|
||||
|
||||
let response: Result<PostMintResponse, serde_json::Error> =
|
||||
serde_json::from_value(res.clone());
|
||||
|
||||
match response {
|
||||
Ok(res) => Ok(res),
|
||||
Err(_) => Err(Error::CustomError(res.to_string())),
|
||||
}
|
||||
}
|
||||
|
||||
/// Check Max expected fee [NUT-05]
|
||||
@@ -129,9 +137,13 @@ impl Client {
|
||||
.send()?
|
||||
.json::<Value>()?;
|
||||
|
||||
println!("{:?}", value);
|
||||
let response: Result<MeltResponse, serde_json::Error> =
|
||||
serde_json::from_value(value.clone());
|
||||
|
||||
Ok(serde_json::from_value(value)?)
|
||||
match response {
|
||||
Ok(res) => Ok(res),
|
||||
Err(_) => Err(Error::CustomError(value.to_string())),
|
||||
}
|
||||
}
|
||||
|
||||
/// Split Token [NUT-06]
|
||||
|
||||
Reference in New Issue
Block a user