소스 검색

Wallet: Get active mint quotes

David Caseria 1 개월 전
부모
커밋
abb43c39b1
1개의 변경된 파일10개의 추가작업 그리고 0개의 파일을 삭제
  1. 10 0
      crates/cdk/src/wallet/mint.rs

+ 10 - 0
crates/cdk/src/wallet/mint.rs

@@ -141,6 +141,16 @@ impl Wallet {
         Ok(total_amount)
     }
 
+    /// Get active mint quotes
+    /// Mint quotes that are not expired and not paid will be returned (including those that are paid but 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.state != MintQuoteState::Paid && quote.expiry > unix_time);
+        Ok(mint_quotes)
+    }
+
     /// Mint
     /// # Synopsis
     /// ```rust,no_run