From 8b9959073ff64a87eef125e03e2cc4eb0d5ef00d Mon Sep 17 00:00:00 2001 From: thesimplekid Date: Sat, 6 May 2023 12:13:07 -0400 Subject: [PATCH] fix: mint info --- integration_test/src/main.rs | 8 ++++---- src/client.rs | 4 +++- src/types.rs | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/integration_test/src/main.rs b/integration_test/src/main.rs index 9edc010c..03a98901 100644 --- a/integration_test/src/main.rs +++ b/integration_test/src/main.rs @@ -12,11 +12,11 @@ use lightning_invoice::Invoice; #[tokio::main] async fn main() { - let url = "https://legend.lnbits.com/cashu/api/v1/MWMnRmbewX92AHjcL55mRo/"; + let url = "https:dev-cashu.thesimplekid.com"; let client = Client::new(url).unwrap(); // NUT-09 - // test_get_mint_info(&mint).await; + test_get_mint_info(&client).await; let keys = test_get_mint_keys(&client).await; let wallet = CashuWallet::new(client.to_owned(), keys); @@ -139,8 +139,8 @@ async fn test_melt(wallet: &CashuWallet, invoice: Invoice, proofs: Proofs) { println!("{:?}", res); } -async fn _test_get_mint_info(mint: &Client) { - let _mint_info = mint.get_info().await.unwrap(); +async fn test_get_mint_info(mint: &Client) { + let mint_info = mint.get_info().await.unwrap(); // println!("{:?}", mint_info); } diff --git a/src/client.rs b/src/client.rs index f965bbaa..40b6d037 100644 --- a/src/client.rs +++ b/src/client.rs @@ -167,6 +167,8 @@ impl Client { /// Get Mint Info [NUT-09] pub async fn get_info(&self) -> Result { let url = self.mint_url.join("info")?; - Ok(minreq::get(url).send()?.json::()?) + let res = minreq::get(url).send()?.json::()?; + + Ok(serde_json::from_value(res)?) } } diff --git a/src/types.rs b/src/types.rs index 3d6a90c1..faee744c 100644 --- a/src/types.rs +++ b/src/types.rs @@ -301,7 +301,7 @@ pub struct MintInfo { /// long description pub description_long: String, /// contact methods to reach the mint operator - pub contact: HashMap, + pub contact: Vec>, /// shows which NUTs the mint supports pub nuts: Vec, /// message of the day that the wallet must display to the user