diff --git a/flutter/native/src/wasm_client.rs b/flutter/native/src/wasm_client.rs index ae1aaecf..fc859649 100644 --- a/flutter/native/src/wasm_client.rs +++ b/flutter/native/src/wasm_client.rs @@ -6,8 +6,8 @@ use moksha_core::blind::BlindedMessage; use moksha_core::keyset::Keysets; use moksha_core::primitives::CashuErrorResponse; use moksha_core::primitives::{ - CheckFeesRequest, CheckFeesResponse, PaymentRequest, PostMeltRequest, PostMeltResponse, - PostMintRequest, PostMintResponse, PostSplitRequest, PostSplitResponse, + CheckFeesRequest, CheckFeesResponse, MintInfoResponse, PaymentRequest, PostMeltRequest, + PostMeltResponse, PostMintRequest, PostMintResponse, PostSplitRequest, PostSplitResponse, }; use moksha_core::proof::Proofs; use moksha_wallet::{client::Client, error::MokshaWalletError}; @@ -120,6 +120,13 @@ impl Client for WasmClient { .await?; extract_response_data::(resp).await } + + async fn get_info(&self, mint_url: &Url) -> Result { + let resp = Request::get(mint_url.join(&format!("info"))?.as_str()) + .send() + .await?; + extract_response_data::(resp).await + } } async fn extract_response_data( diff --git a/moksha-wallet/src/client/mod.rs b/moksha-wallet/src/client/mod.rs index be114e4b..289b08fc 100644 --- a/moksha-wallet/src/client/mod.rs +++ b/moksha-wallet/src/client/mod.rs @@ -5,7 +5,8 @@ use moksha_core::{ blind::BlindedMessage, keyset::Keysets, primitives::{ - CheckFeesResponse, PaymentRequest, PostMeltResponse, PostMintResponse, PostSplitResponse, + CheckFeesResponse, MintInfoResponse, PaymentRequest, PostMeltResponse, PostMintResponse, + PostSplitResponse, }, proof::Proofs, }; @@ -59,4 +60,6 @@ pub trait Client { mint_url: &Url, amount: u64, ) -> Result; + + async fn get_info(&self, mint_url: &Url) -> Result; } diff --git a/moksha-wallet/src/client/reqwest.rs b/moksha-wallet/src/client/reqwest.rs index e073f69a..45ae9674 100644 --- a/moksha-wallet/src/client/reqwest.rs +++ b/moksha-wallet/src/client/reqwest.rs @@ -5,8 +5,9 @@ use moksha_core::{ blind::BlindedMessage, keyset::Keysets, primitives::{ - CashuErrorResponse, CheckFeesRequest, CheckFeesResponse, PaymentRequest, PostMeltRequest, - PostMeltResponse, PostMintRequest, PostMintResponse, PostSplitRequest, PostSplitResponse, + CashuErrorResponse, CheckFeesRequest, CheckFeesResponse, MintInfoResponse, PaymentRequest, + PostMeltRequest, PostMeltResponse, PostMintRequest, PostMintResponse, PostSplitRequest, + PostSplitResponse, }, proof::Proofs, }; @@ -150,6 +151,15 @@ impl Client for HttpClient { .await?; extract_response_data::(resp).await } + + async fn get_info(&self, mint_url: &Url) -> Result { + let resp = self + .request_client + .get(mint_url.join("info")?) + .send() + .await?; + extract_response_data::(resp).await + } } async fn extract_response_data( diff --git a/moksha-wallet/src/wallet.rs b/moksha-wallet/src/wallet.rs index 1d5e1935..0349f973 100644 --- a/moksha-wallet/src/wallet.rs +++ b/moksha-wallet/src/wallet.rs @@ -451,7 +451,8 @@ mod tests { use moksha_core::fixture::{read_fixture, read_fixture_as}; use moksha_core::keyset::{Keysets, MintKeyset}; use moksha_core::primitives::{ - CheckFeesResponse, PaymentRequest, PostMeltResponse, PostMintResponse, PostSplitResponse, + CheckFeesResponse, MintInfoResponse, PaymentRequest, PostMeltResponse, PostMintResponse, + PostSplitResponse, }; use moksha_core::proof::Proofs; use moksha_core::token::{Token, TokenV3}; @@ -616,6 +617,10 @@ mod tests { ) -> Result { unimplemented!() } + + async fn get_info(&self, _mint_url: &Url) -> Result { + unimplemented!() + } } #[tokio::test] diff --git a/moksha-wallet/tests/tests.rs b/moksha-wallet/tests/tests.rs index ea00b4ad..19c7f0cc 100644 --- a/moksha-wallet/tests/tests.rs +++ b/moksha-wallet/tests/tests.rs @@ -5,7 +5,8 @@ use moksha_core::blind::BlindedMessage; use moksha_core::fixture::{read_fixture, read_fixture_as}; use moksha_core::keyset::{Keysets, MintKeyset}; use moksha_core::primitives::{ - CheckFeesResponse, PaymentRequest, PostMeltResponse, PostMintResponse, PostSplitResponse, + CheckFeesResponse, MintInfoResponse, PaymentRequest, PostMeltResponse, PostMintResponse, + PostSplitResponse, }; use moksha_core::proof::Proofs; use moksha_core::token::TokenV3; @@ -98,6 +99,10 @@ impl Client for MockClient { ) -> Result { unimplemented!() } + + async fn get_info(&self, _mint_url: &Url) -> Result { + unimplemented!() + } } /// tests if tokens get restored, if the lightning payment is not successful