mirror of
https://github.com/aljazceru/cdk.git
synced 2026-02-08 14:45:47 +01:00
Merge pull request #884 from davidcaseria/get-active-mint-quotes
Get active mint quotes
This commit is contained in:
@@ -141,6 +141,20 @@ impl Wallet {
|
||||
Ok(total_amount)
|
||||
}
|
||||
|
||||
/// Get active mint quotes
|
||||
/// Returns mint quotes that are not expired and not yet issued.
|
||||
#[instrument(skip(self))]
|
||||
pub async fn get_active_mint_quotes(&self) -> Result<Vec<MintQuote>, Error> {
|
||||
let mut mint_quotes = self.localstore.get_mint_quotes().await?;
|
||||
let unix_time = unix_time();
|
||||
mint_quotes.retain(|quote| {
|
||||
quote.mint_url == self.mint_url
|
||||
&& quote.state != MintQuoteState::Issued
|
||||
&& quote.expiry > unix_time
|
||||
});
|
||||
Ok(mint_quotes)
|
||||
}
|
||||
|
||||
/// Mint
|
||||
/// # Synopsis
|
||||
/// ```rust,no_run
|
||||
|
||||
Reference in New Issue
Block a user