Conversation
| async fn get_keyset_info(&self, mint_url: &str, keyset_id: &str) -> Result<cdk02::KeySet> { | ||
| let base = reqwest::Url::parse(mint_url).map_err(|_| Error::InvalidMintUrl)?; | ||
| let url = base | ||
| .join(&format!("/v1/keys/{}", keyset_id)) |
Check warning
Code scanning / clippy
variables can be used directly in the format! string Warning library
Comment on lines
+300
to
+375
| if let Ok(Some(offer)) = self | ||
| .mint_store | ||
| .get_offer(&mint_request.mint_request_id) | ||
| .await | ||
| { | ||
| if offer.proofs.is_none() { | ||
| debug!( | ||
| "Checking for keyset info for {}", | ||
| &mint_request.mint_request_id | ||
| ); | ||
| // not finished - check keyset and try to mint and create tokens and persist | ||
| match self | ||
| .mint_client | ||
| .get_keyset_info(&mint_cfg.default_mint_url, &offer.keyset_id) | ||
| .await | ||
| { | ||
| // keyset info is available | ||
| Ok(keyset_info) => { | ||
| // fetch private key for requester | ||
| let private_key = match self.identity_store.get_full().await { | ||
| Ok(identity) => { | ||
| // check if requester is identity | ||
| if identity.identity.node_id | ||
| == mint_request.requester_node_id | ||
| { | ||
| identity.key_pair.get_private_key_string() | ||
| } else { | ||
| // check if requester is a company | ||
| let local_companies: HashMap< | ||
| String, | ||
| (Company, CompanyKeys), | ||
| > = self.company_store.get_all().await?; | ||
| if let Some(requester_company) = | ||
| local_companies.get(&mint_request.requester_node_id) | ||
| { | ||
| requester_company.1.private_key.clone() | ||
| } else { | ||
| // requester is neither identity, nor company | ||
| log::warn!( | ||
| "Requester for {} is not a local identity, or company", | ||
| &mint_request.mint_request_id | ||
| ); | ||
| return Ok(()); | ||
| } | ||
| } | ||
| } | ||
| Err(e) => { | ||
| return Err(e.into()); | ||
| } | ||
| }; | ||
| debug!( | ||
| "Keyset found and minting for {}", | ||
| &mint_request.mint_request_id | ||
| ); | ||
| // mint and generate proofs | ||
| let proofs = self | ||
| .mint_client | ||
| .mint( | ||
| &mint_cfg.default_mint_url, | ||
| keyset_info, | ||
| offer.discounted_sum, | ||
| &mint_request.mint_request_id, | ||
| &private_key, | ||
| ) | ||
| .await?; | ||
| // store proofs on the offer | ||
| self.mint_store | ||
| .add_proofs_to_offer(&mint_request.mint_request_id, &proofs) | ||
| .await?; | ||
| } | ||
| Err(_) => { | ||
| info!("No keyset available for {}", mint_request.mint_request_id); | ||
| } | ||
| }; | ||
| } | ||
| } |
Check warning
Code scanning / clippy
this if statement can be collapsed Warning
Codecov ReportAttention: Patch coverage is 📢 Thoughts on this report? Let us know! |
mtbitcr
approved these changes
May 29, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Description
Relates to #517
✅ Checklist
Please ensure the following tasks are completed before requesting a review:
cargo fmt.cargo clippy.🚀 Changes Made
See above.
💡 How to Test
Please provide clear instructions on how reviewers can test your changes:
🤝 Related Issues
List any related issues, pull requests, or discussions:
📋 Review Guidelines
Please focus on the following while reviewing: