Skip to content

Commit

Permalink
chore: formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mubarak23 committed Nov 10, 2024
1 parent 51c52ff commit 018125d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions crates/cdk/src/wallet/keysets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ impl Wallet {

Ok(keysets.keysets)
}

/// Get active keyset for mint
///
/// Queries mint for current keysets then gets [`Keys`] for any unknown
/// keysets
#[instrument(skip(self))]
pub async fn get_active_mint_keysets(&self) -> Result<Vec<KeySetInfo>, Error> {
let keysets = self.client.get_mint_keysets(self.mint_url.clone()).await?;
let keysets = self.client.get_mint_keysets(self.mint_url.clone()).await?;
let keysets = keysets.keysets;

self.localstore
Expand Down Expand Up @@ -95,9 +95,12 @@ impl Wallet {
/// keysets
#[instrument(skip(self))]
pub async fn get_active_mint_keyset(&self) -> Result<KeySetInfo, Error> {
let active_keysets = self.get_active_mint_keysets().await?;
let active_keysets = self.get_active_mint_keysets().await?;

let keyset_with_lowest_fee = active_keysets.into_iter().min_by_key(|key| key.input_fee_ppk).ok_or(Error::NoActiveKeysetWithLowestFee)?;
let keyset_with_lowest_fee = active_keysets
.into_iter()
.min_by_key(|key| key.input_fee_ppk)
.ok_or(Error::NoActiveKeysetWithLowestFee)?;
Ok(keyset_with_lowest_fee)
}
}

0 comments on commit 018125d

Please sign in to comment.