Explorar o código

`nut08` change amount

thesimplekid hai 1 ano
pai
achega
eb31150031
Modificáronse 1 ficheiros con 9 adicións e 0 borrados
  1. 9 0
      src/nuts/nut08.rs

+ 9 - 0
src/nuts/nut08.rs

@@ -40,3 +40,12 @@ pub struct MeltResponse {
     pub preimage: Option<String>,
     pub change: Option<Vec<BlindedSignature>>,
 }
+
+impl MeltResponse {
+    pub fn change_amount(&self) -> Amount {
+        match &self.change {
+            Some(change) => change.iter().map(|c| c.amount).sum(),
+            None => Amount::ZERO,
+        }
+    }
+}