diff --git a/crates/cdk/src/mint/mod.rs b/crates/cdk/src/mint/mod.rs index 857823a3..1df2e040 100644 --- a/crates/cdk/src/mint/mod.rs +++ b/crates/cdk/src/mint/mod.rs @@ -103,26 +103,31 @@ impl Mint { } /// Set Mint Url + #[instrument(skip_all)] pub fn set_mint_url(&mut self, mint_url: UncheckedUrl) { self.mint_url = mint_url; } /// Get Mint Url + #[instrument(skip_all)] pub fn get_mint_url(&self) -> &UncheckedUrl { &self.mint_url } /// Set Mint Info + #[instrument(skip_all)] pub fn set_mint_info(&mut self, mint_info: MintInfo) { self.mint_info = mint_info; } /// Get Mint Info + #[instrument(skip_all)] pub fn mint_info(&self) -> &MintInfo { &self.mint_info } /// New mint quote + #[instrument(skip_all)] pub async fn new_mint_quote( &self, mint_url: UncheckedUrl, @@ -147,6 +152,7 @@ impl Mint { } /// Check mint quote + #[instrument(skip(self))] pub async fn check_mint_quote(&self, quote_id: &str) -> Result { let quote = self .localstore @@ -173,18 +179,21 @@ impl Mint { } /// Update mint quote + #[instrument(skip_all)] pub async fn update_mint_quote(&self, quote: MintQuote) -> Result<(), Error> { self.localstore.add_mint_quote(quote).await?; Ok(()) } /// Get mint quotes + #[instrument(skip_all)] pub async fn mint_quotes(&self) -> Result, Error> { let quotes = self.localstore.get_mint_quotes().await?; Ok(quotes) } /// Get pending mint quotes + #[instrument(skip_all)] pub async fn get_pending_mint_quotes(&self) -> Result, Error> { let mint_quotes = self.localstore.get_mint_quotes().await?; @@ -195,6 +204,7 @@ impl Mint { } /// Remove mint quote + #[instrument(skip_all)] pub async fn remove_mint_quote(&self, quote_id: &str) -> Result<(), Error> { self.localstore.remove_mint_quote(quote_id).await?; @@ -202,6 +212,7 @@ impl Mint { } /// New melt quote + #[instrument(skip_all)] pub async fn new_melt_quote( &self, request: String, @@ -226,6 +237,7 @@ impl Mint { } /// Fee required for proof set + #[instrument(skip_all)] pub async fn get_proofs_fee(&self, proofs: &Proofs) -> Result { let mut sum_fee = 0; @@ -243,6 +255,7 @@ impl Mint { } /// Check melt quote status + #[instrument(skip(self))] pub async fn check_melt_quote(&self, quote_id: &str) -> Result { let quote = self .localstore @@ -263,26 +276,29 @@ impl Mint { } /// Update melt quote + #[instrument(skip_all)] pub async fn update_melt_quote(&self, quote: MeltQuote) -> Result<(), Error> { self.localstore.add_melt_quote(quote).await?; Ok(()) } /// Get melt quotes + #[instrument(skip_all)] pub async fn melt_quotes(&self) -> Result, Error> { let quotes = self.localstore.get_melt_quotes().await?; Ok(quotes) } /// Remove melt quote + #[instrument(skip(self))] pub async fn remove_melt_quote(&self, quote_id: &str) -> Result<(), Error> { self.localstore.remove_melt_quote(quote_id).await?; Ok(()) } - /// Retrieve the public keys of the active keyset for distribution to - /// wallet clients + /// Retrieve the public keys of the active keyset for distribution to wallet clients + #[instrument(skip(self))] pub async fn keyset_pubkeys(&self, keyset_id: &Id) -> Result { self.ensure_keyset_loaded(keyset_id).await?; let keysets = self.keysets.read().await; @@ -292,8 +308,8 @@ impl Mint { }) } - /// Retrieve the public keys of the active keyset for distribution to - /// wallet clients + /// Retrieve the public keys of the active keyset for distribution to wallet clients + #[instrument(skip_all)] pub async fn pubkeys(&self) -> Result { let keyset_infos = self.localstore.get_keyset_infos().await?; for keyset_info in keyset_infos { @@ -306,6 +322,7 @@ impl Mint { } /// Return a list of all supported keysets + #[instrument(skip_all)] pub async fn keysets(&self) -> Result { let keysets = self.localstore.get_keyset_infos().await?; let active_keysets: HashSet = self @@ -330,6 +347,7 @@ impl Mint { } /// Get keysets + #[instrument(skip(self))] pub async fn keyset(&self, id: &Id) -> Result, Error> { self.ensure_keyset_loaded(id).await?; let keysets = self.keysets.read().await; @@ -339,6 +357,7 @@ impl Mint { /// Add current keyset to inactive keysets /// Generate new keyset + #[instrument(skip(self))] pub async fn rotate_keyset( &self, unit: CurrencyUnit, @@ -365,6 +384,7 @@ impl Mint { } /// Process mint request + #[instrument(skip_all)] pub async fn process_mint_request( &self, mint_request: nut04::MintBolt11Request, @@ -430,6 +450,7 @@ impl Mint { } /// Blind Sign + #[instrument(skip_all)] pub async fn blind_sign( &self, blinded_message: &BlindedMessage, @@ -480,7 +501,7 @@ impl Mint { } /// Process Swap - #[instrument(skip(self, swap_request))] + #[instrument(skip_all)] pub async fn process_swap_request( &self, swap_request: SwapRequest, @@ -600,6 +621,7 @@ impl Mint { } /// Verify [`Proof`] meets conditions and is signed + #[instrument(skip_all)] pub async fn verify_proof(&self, proof: &Proof) -> Result<(), Error> { // Check if secret is a nut10 secret with conditions if let Ok(secret) = @@ -643,6 +665,7 @@ impl Mint { } /// Check state + #[instrument(skip_all)] pub async fn check_state( &self, check_state: &CheckStateRequest, @@ -668,6 +691,7 @@ impl Mint { } /// Verify melt request is valid + #[instrument(skip_all)] pub async fn verify_melt_request( &self, melt_request: &MeltBolt11Request, @@ -794,6 +818,7 @@ impl Mint { /// Process unpaid melt request /// In the event that a melt request fails and the lighthing payment is not made /// The [`Proofs`] should be returned to an unspent state and the quote should be unpaid + #[instrument(skip_all)] pub async fn process_unpaid_melt(&self, melt_request: &MeltBolt11Request) -> Result<(), Error> { self.localstore .remove_pending_proofs(melt_request.inputs.iter().map(|p| &p.secret).collect()) @@ -808,6 +833,7 @@ impl Mint { /// Process melt request marking [`Proofs`] as spent /// The melt request must be verifyed using [`Self::verify_melt_request`] before calling [`Self::process_melt_request`] + #[instrument(skip_all)] pub async fn process_melt_request( &self, melt_request: &MeltBolt11Request, @@ -905,6 +931,7 @@ impl Mint { } /// Restore + #[instrument(skip_all)] pub async fn restore(&self, request: RestoreRequest) -> Result { let output_len = request.outputs.len(); @@ -937,6 +964,7 @@ impl Mint { } /// Ensure Keyset is loaded in mint + #[instrument(skip(self))] pub async fn ensure_keyset_loaded(&self, id: &Id) -> Result<(), Error> { let keysets = self.keysets.read().await; if keysets.contains_key(id) { @@ -956,6 +984,7 @@ impl Mint { } /// Generate [`MintKeySet`] from [`MintKeySetInfo`] + #[instrument(skip_all)] pub fn generate_keyset(&self, keyset_info: MintKeySetInfo) -> MintKeySet { MintKeySet::generate_from_xpriv(&self.secp_ctx, self.xpriv, keyset_info) } @@ -1005,6 +1034,7 @@ impl From for KeySetInfo { } /// Generate new [`MintKeySetInfo`] from path +#[instrument(skip_all)] fn create_new_keyset( secp: &secp256k1::Secp256k1, xpriv: ExtendedPrivKey,