diff --git a/crates/cashu-sdk/src/mint/mod.rs b/crates/cashu-sdk/src/mint/mod.rs index 0d7e25d9..8aeb4339 100644 --- a/crates/cashu-sdk/src/mint/mod.rs +++ b/crates/cashu-sdk/src/mint/mod.rs @@ -1,4 +1,5 @@ use std::collections::HashSet; +use std::sync::Arc; use cashu::dhke::{sign_message, verify_message}; #[cfg(feature = "nut07")] @@ -53,16 +54,16 @@ pub enum Error { MultipleUnits, } -pub struct Mint { +pub struct Mint { // pub pubkey: PublicKey mnemonic: Mnemonic, pub fee_reserve: FeeReserve, - pub localstore: L, + pub localstore: Arc, } -impl Mint { +impl Mint { pub async fn new( - localstore: L, + localstore: Arc, mnemonic: Mnemonic, keysets_info: HashSet, min_fee_reserve: Amount, @@ -111,6 +112,23 @@ impl Mint { Ok(quote) } + pub async fn update_mint_quote(&self, quote: MintQuote) -> Result<(), Error> { + self.localstore.add_mint_quote(quote).await?; + + Ok(()) + } + + pub async fn mint_quotes(&self) -> Result, Error> { + let quotes = self.localstore.get_mint_quotes().await?; + Ok(quotes) + } + + pub async fn remove_mint_quote(&self, quote_id: &str) -> Result<(), Error> { + self.localstore.remove_mint_quote(quote_id).await?; + + Ok(()) + } + pub async fn new_melt_quote( &self, request: String,