|
@@ -1,4 +1,4 @@
|
|
|
-use std::collections::HashMap;
|
|
|
+use std::collections::{BTreeMap, HashMap};
|
|
|
|
|
|
use cdk_common::nut02::{KeySetInfos, KeySetInfosMethods};
|
|
|
use tracing::instrument;
|
|
@@ -6,6 +6,21 @@ use tracing::instrument;
|
|
|
use crate::nuts::{Id, KeySetInfo, Keys};
|
|
|
use crate::{Error, Wallet};
|
|
|
|
|
|
+pub struct ActiveKeys {
|
|
|
+ keysets: KeySetInfos,
|
|
|
+ keys: BTreeMap<Id, Keys>,
|
|
|
+}
|
|
|
+
|
|
|
+impl ActiveKeys {
|
|
|
+ /// Get supported amounts for the given keyset info
|
|
|
+ pub fn get_supported_amounts(&self, id: &Id) -> Result<Vec<u64>, Error> {
|
|
|
+ self.keys
|
|
|
+ .get(id)
|
|
|
+ .map(|x| x.iter().map(|(amount, _)| amount.to_u64()).collect())
|
|
|
+ .ok_or(Error::UnknownKeySet)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
impl Wallet {
|
|
|
/// Load keys for mint keyset
|
|
|
///
|