Browse Source

add `invoice status`

thesimplekid 1 year ago
parent
commit
831aa43e27
3 changed files with 14 additions and 5 deletions
  1. 2 2
      Cargo.toml
  2. 3 3
      src/nuts/nut06.rs
  3. 9 0
      src/types.rs

+ 2 - 2
Cargo.toml

@@ -15,12 +15,12 @@ description = "Cashu rust wallet library"
 
 [dependencies]
 base64 = "0.21.0"
-bitcoin = { version = "0.30.0", features=["serde",  "rand"] }
+bitcoin = { version = "0.30.0", features=["serde",  "rand", "no-std"] }
 bitcoin_hashes = "0.12.0"
 hex = "0.4.3"
 k256 = { version = "0.13.1", features=["arithmetic"] }
 lightning-invoice = { version = "0.23.0", features=["serde"] }
-minreq = { version = "2.7.0", features = ["json-using-serde", "https"] }
+minreq = { version = "2.7.0", features = ["json-using-serde", "https"] } 
 rand = "0.8.5"
 getrandom = { version = "0.2", features = ["js"] }
 serde = { version = "1.0.160", features = ["derive"]}

+ 3 - 3
src/nuts/nut06.rs

@@ -17,7 +17,7 @@ pub struct SplitPayload {
 /// Split Request [NUT-06]
 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
 pub struct SplitRequest {
-    #[deprecated(since = "0.1.1", note = "mint does not need amount")]
+    #[deprecated(since = "0.1.5", note = "mint does not need amount")]
     #[serde(skip_serializing_if = "Option::is_none")]
     pub amount: Option<Amount>,
     pub proofs: Proofs,
@@ -38,14 +38,14 @@ impl SplitRequest {
 pub struct SplitResponse {
     /// Promises to keep
     #[deprecated(
-        since = "0.1.1",
+        since = "0.1.5",
         note = "mint only response with one list of all promises"
     )]
     #[serde(skip_serializing_if = "Option::is_none")]
     pub fst: Option<Vec<BlindedSignature>>,
     /// Promises to send
     #[deprecated(
-        since = "0.1.1",
+        since = "0.1.5",
         note = "mint only response with one list of all promises"
     )]
     #[serde(skip_serializing_if = "Option::is_none")]

+ 9 - 0
src/types.rs

@@ -23,3 +23,12 @@ pub struct Melted {
     pub preimage: Option<String>,
     pub change: Option<Proofs>,
 }
+
+/// Possible states of an invoice
+#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq)]
+pub enum InvoiceStatus {
+    Unpaid,
+    Paid,
+    Expired,
+    InFlight,
+}