nut07.rs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //! Spendable Check
  2. // https://github.com/cashubtc/nuts/blob/main/07.md
  3. use serde::{Deserialize, Serialize};
  4. use crate::secret::Secret;
  5. #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
  6. #[serde(rename_all = "UPPERCASE")]
  7. pub enum State {
  8. Spent,
  9. Unspent,
  10. Pending,
  11. }
  12. /// Check spendabale request [NUT-07]
  13. #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
  14. pub struct CheckStateRequest {
  15. pub secrets: Vec<Secret>,
  16. }
  17. /// Proof state [NUT-07]
  18. #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
  19. pub struct ProofState {
  20. /// Secret of proof
  21. pub secret: Secret,
  22. /// State of proof
  23. pub state: State,
  24. /// Witness data if it is supplied
  25. pub witness: Option<String>,
  26. }
  27. /// Check Spendable Response [NUT-07]
  28. #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
  29. pub struct CheckStateResponse {
  30. pub states: Vec<ProofState>,
  31. }
  32. /// Spendable Settings
  33. #[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
  34. pub struct Settings {
  35. supported: bool,
  36. }