Address PR feedback

This commit is contained in:
David Caseria
2024-05-14 20:27:07 -04:00
parent 3f974ea327
commit 2a09dff5c6
5 changed files with 7 additions and 31 deletions

View File

@@ -10,12 +10,9 @@ license.workspace = true
[features] [features]
default = ["mint", "wallet", "all-nuts"] default = ["mint", "wallet"]
mint = ["dep:bip39"] mint = ["dep:bip39"]
wallet = ["nut13", "dep:bip39", "dep:reqwest"] wallet = ["dep:bip39", "dep:reqwest"]
all-nuts = ["nut13"]
nut13 = ["dep:bip39"]
[dependencies] [dependencies]
async-trait = "0.1" async-trait = "0.1"

View File

@@ -37,7 +37,6 @@ pub enum Error {
#[error(transparent)] #[error(transparent)]
Secret(#[from] super::secret::Error), Secret(#[from] super::secret::Error),
/// Bip32 error /// Bip32 error
#[cfg(feature = "nut13")]
#[error(transparent)] #[error(transparent)]
Bip32(#[from] bitcoin::bip32::Error), Bip32(#[from] bitcoin::bip32::Error),
/// Parse int error /// Parse int error

View File

@@ -11,7 +11,6 @@ pub mod nut09;
pub mod nut10; pub mod nut10;
pub mod nut11; pub mod nut11;
pub mod nut12; pub mod nut12;
#[cfg(feature = "nut13")]
pub mod nut13; pub mod nut13;
pub mod nut14; pub mod nut14;

View File

@@ -426,11 +426,7 @@ impl Wallet {
.get_keyset_counter(&active_keyset_id) .get_keyset_counter(&active_keyset_id)
.await?; .await?;
let count = if let Some(count) = count { let count = count.map_or(0, |c| c + 1);
count + 1
} else {
0
};
let premint_secrets = PreMintSecrets::from_xpriv( let premint_secrets = PreMintSecrets::from_xpriv(
active_keyset_id, active_keyset_id,
@@ -616,11 +612,7 @@ impl Wallet {
.get_keyset_counter(&active_keyset_id) .get_keyset_counter(&active_keyset_id)
.await?; .await?;
let count = if let Some(count) = count { let count = count.map_or(0, |c| c + 1);
count + 1
} else {
0
};
let change_premint_secrets = PreMintSecrets::from_xpriv( let change_premint_secrets = PreMintSecrets::from_xpriv(
active_keyset_id, active_keyset_id,
@@ -641,11 +633,7 @@ impl Wallet {
.get_keyset_counter(&active_keyset_id) .get_keyset_counter(&active_keyset_id)
.await?; .await?;
let count = if let Some(count) = count { let mut count = count.map_or(0, |c| c + 1);
count + 1
} else {
0
};
let premint_secrets = PreMintSecrets::from_xpriv( let premint_secrets = PreMintSecrets::from_xpriv(
active_keyset_id, active_keyset_id,
@@ -655,7 +643,7 @@ impl Wallet {
false, false,
)?; )?;
let count = count + premint_secrets.len() as u32; count += premint_secrets.len() as u32;
let change_premint_secrets = PreMintSecrets::from_xpriv( let change_premint_secrets = PreMintSecrets::from_xpriv(
active_keyset_id, active_keyset_id,
@@ -867,11 +855,7 @@ impl Wallet {
.get_keyset_counter(&active_keyset_id) .get_keyset_counter(&active_keyset_id)
.await?; .await?;
let count = if let Some(count) = count { let count = count.map_or(0, |c| c + 1);
count + 1
} else {
0
};
let premint_secrets = let premint_secrets =
PreMintSecrets::from_xpriv(active_keyset_id, count, self.xpriv, proofs_amount, true)?; PreMintSecrets::from_xpriv(active_keyset_id, count, self.xpriv, proofs_amount, true)?;
@@ -1084,7 +1068,6 @@ impl Wallet {
Ok(Token::new(mint_url, proofs, memo, unit)?.to_string()) Ok(Token::new(mint_url, proofs, memo, unit)?.to_string())
} }
#[cfg(feature = "nut13")]
#[instrument(skip(self), fields(mint_url = %mint_url))] #[instrument(skip(self), fields(mint_url = %mint_url))]
pub async fn restore(&mut self, mint_url: UncheckedUrl) -> Result<Amount, Error> { pub async fn restore(&mut self, mint_url: UncheckedUrl) -> Result<Amount, Error> {
// Check that mint is in store of mints // Check that mint is in store of mints
@@ -1156,7 +1139,6 @@ impl Wallet {
tracing::debug!("Restored {} proofs", proofs.len()); tracing::debug!("Restored {} proofs", proofs.len());
#[cfg(feature = "nut13")]
self.localstore self.localstore
.increment_keyset_counter(&keyset.id, proofs.len() as u32) .increment_keyset_counter(&keyset.id, proofs.len() as u32)
.await?; .await?;

View File

@@ -27,7 +27,6 @@ buildargs=(
"-p cdk --no-default-features" "-p cdk --no-default-features"
"-p cdk --no-default-features --features wallet" "-p cdk --no-default-features --features wallet"
"-p cdk --no-default-features --features mint" "-p cdk --no-default-features --features mint"
"-p cdk --no-default-features --features nut13"
"-p cdk-redb" "-p cdk-redb"
"-p cdk-redb --no-default-features --features wallet" "-p cdk-redb --no-default-features --features wallet"
"-p cdk-redb --no-default-features --features mint" "-p cdk-redb --no-default-features --features mint"