Forráskód Böngészése

chore: remove unwraps cdk

thesimplekid 1 hónapja
szülő
commit
72082df6f8

+ 1 - 1
crates/cdk/src/wallet/melt/melt_bolt12.rs

@@ -37,7 +37,7 @@ impl Wallet {
                 .map(|opt| opt.amount_msat())
                 .or_else(|| amount_for_offer(&offer, &CurrencyUnit::Msat).ok())
                 .ok_or(Error::AmountUndefined)?;
-            let amount_quote_unit = to_unit(amount_msat, &CurrencyUnit::Msat, &self.unit).unwrap();
+            let amount_quote_unit = to_unit(amount_msat, &CurrencyUnit::Msat, &self.unit)?;
 
             if quote_res.amount != amount_quote_unit {
                 tracing::warn!(

+ 5 - 1
crates/cdk/src/wallet/mint_connector/http_client.rs

@@ -257,7 +257,11 @@ where
         let transport = self.transport.clone();
         let keys_response = transport.http_get::<KeysResponse>(url, None).await?;
 
-        Ok(keys_response.keysets.first().unwrap().clone())
+        Ok(keys_response
+            .keysets
+            .first()
+            .ok_or(Error::UnknownKeySet)?
+            .clone())
     }
 
     /// Get Keysets [NUT-02]