From c3437beb6f06dd4ffa8d6eeec89f031885bc4a32 Mon Sep 17 00:00:00 2001 From: thesimplekid Date: Mon, 11 Sep 2023 20:45:39 +0100 Subject: [PATCH] ci: remove deprecated attribute versioning is not constant at the moment so the attribute just causes ci errors Will add back once more stable --- bindings/cashu-ffi/src/nuts/nut06/mod.rs | 12 ++----- crates/cashu-sdk/src/wallet.rs | 6 +--- crates/cashu/src/nuts/nut06.rs | 41 +++++++++++------------- 3 files changed, 22 insertions(+), 37 deletions(-) diff --git a/bindings/cashu-ffi/src/nuts/nut06/mod.rs b/bindings/cashu-ffi/src/nuts/nut06/mod.rs index e5009c43..4a5e17c9 100644 --- a/bindings/cashu-ffi/src/nuts/nut06/mod.rs +++ b/bindings/cashu-ffi/src/nuts/nut06/mod.rs @@ -21,11 +21,7 @@ impl SplitRequest { let outputs = outputs.into_iter().map(|o| o.as_ref().into()).collect(); Self { - inner: SplitRequestSdk { - amount: None, - proofs, - outputs, - }, + inner: SplitRequestSdk::new(proofs, outputs), } } @@ -64,11 +60,7 @@ impl SplitResponse { pub fn new(promises: Vec>) -> Self { let promises = promises.into_iter().map(|p| p.as_ref().into()).collect(); Self { - inner: SplitResponseSdk { - fst: None, - snd: None, - promises: Some(promises), - }, + inner: SplitResponseSdk::new(promises), } } diff --git a/crates/cashu-sdk/src/wallet.rs b/crates/cashu-sdk/src/wallet.rs index d70640fe..7e2c7445 100644 --- a/crates/cashu-sdk/src/wallet.rs +++ b/crates/cashu-sdk/src/wallet.rs @@ -278,11 +278,7 @@ impl Wallet { let blinded_messages = BlindedMessages::random(value)?; - let split_payload = SplitRequest { - amount: None, - proofs, - outputs: blinded_messages.blinded_messages.clone(), - }; + let split_payload = SplitRequest::new(proofs, blinded_messages.blinded_messages.clone()); Ok(SplitPayload { blinded_messages, diff --git a/crates/cashu/src/nuts/nut06.rs b/crates/cashu/src/nuts/nut06.rs index 49c9de56..6e055099 100644 --- a/crates/cashu/src/nuts/nut06.rs +++ b/crates/cashu/src/nuts/nut06.rs @@ -20,17 +20,29 @@ pub struct SplitPayload { /// Split Request [NUT-06] #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct SplitRequest { - #[deprecated(since = "0.3.0", note = "mint does not need amount")] - #[serde(skip_serializing_if = "Option::is_none")] + // TODO: This should be deprecated pub amount: Option, + /// Proofs that are to be spent in `Split` pub proofs: Proofs, + /// Blinded Messages for Mint to sign pub outputs: Vec, } impl SplitRequest { + pub fn new(proofs: Proofs, outputs: Vec) -> Self { + Self { + amount: None, + proofs, + outputs, + } + } + + /// Total value of proofs in `SplitRequest` pub fn proofs_amount(&self) -> Amount { self.proofs.iter().map(|proof| proof.amount).sum() } + + /// Total value of outputs in `SplitRequest` pub fn output_amount(&self) -> Amount { self.outputs.iter().map(|proof| proof.amount).sum() } @@ -40,17 +52,11 @@ impl SplitRequest { #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct SplitResponse { /// Promises to keep - #[deprecated( - since = "0.3.0", - note = "mint only response with one list of all promises" - )] + // TODO: This should be deprecated #[serde(skip_serializing_if = "Option::is_none")] pub fst: Option>, /// Promises to send - #[deprecated( - since = "0.3.0", - note = "mint only response with one list of all promises" - )] + // TODO: This should be deprecated #[serde(skip_serializing_if = "Option::is_none")] pub snd: Option>, /// Promises @@ -66,10 +72,7 @@ impl SplitResponse { } } - #[deprecated( - since = "0.3.0", - note = "mint only response with one list of all promises" - )] + // TODO: This should be deprecated pub fn new_from_amount( fst: Vec, snd: Vec, @@ -81,10 +84,7 @@ impl SplitResponse { } } - #[deprecated( - since = "0.3.0", - note = "mint only response with one list of all promises" - )] + // TODO: This should be deprecated pub fn change_amount(&self) -> Option { self.fst.as_ref().map(|fst| { fst.iter() @@ -93,10 +93,7 @@ impl SplitResponse { }) } - #[deprecated( - since = "0.3.0", - note = "mint only response with one list of all promises" - )] + // TODO: This should be deprecated pub fn target_amount(&self) -> Option { self.snd.as_ref().map(|snd| { snd.iter()