fedimint_mint_client/
event.rs1use std::time::Duration;
2
3use fedimint_core::Amount;
4use fedimint_core::core::{ModuleKind, OperationId};
5use fedimint_eventlog::{Event, EventKind, EventPersistence};
6use fedimint_mint_common::{KIND, Nonce};
7use serde::{Deserialize, Serialize};
8
9#[derive(Clone, Copy, Serialize, Deserialize)]
11pub struct NoteCreated {
12 pub nonce: Nonce,
14}
15
16impl Event for NoteCreated {
17 const MODULE: Option<ModuleKind> = Some(KIND);
18
19 const KIND: EventKind = EventKind::from_static("note-created");
20 const PERSISTENCE: EventPersistence = EventPersistence::Persistent;
21}
22
23#[derive(Clone, Copy, Serialize, Deserialize)]
25pub struct NoteSpent {
26 pub nonce: Nonce,
28}
29
30impl Event for NoteSpent {
31 const MODULE: Option<ModuleKind> = Some(KIND);
32
33 const KIND: EventKind = EventKind::from_static("note-spent");
34 const PERSISTENCE: EventPersistence = EventPersistence::Persistent;
35}
36
37#[derive(Serialize, Deserialize)]
39pub struct OOBNotesSpent {
40 pub requested_amount: Amount,
42
43 pub spent_amount: Amount,
45
46 pub timeout: Duration,
48
49 pub include_invite: bool,
52}
53
54impl Event for OOBNotesSpent {
55 const MODULE: Option<ModuleKind> = Some(KIND);
56
57 const KIND: EventKind = EventKind::from_static("oob-notes-spent");
58 const PERSISTENCE: EventPersistence = EventPersistence::Persistent;
59}
60
61#[derive(Serialize, Deserialize)]
63pub struct OOBNotesReissued {
64 pub amount: Amount,
66}
67
68impl Event for OOBNotesReissued {
69 const MODULE: Option<ModuleKind> = Some(KIND);
70 const KIND: EventKind = EventKind::from_static("oob-notes-reissued");
71 const PERSISTENCE: EventPersistence = EventPersistence::Persistent;
72}
73
74#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
77pub struct SendPaymentEvent {
78 pub operation_id: OperationId,
79 pub amount: Amount,
80 pub oob_notes: String,
81}
82
83impl Event for SendPaymentEvent {
84 const MODULE: Option<ModuleKind> = Some(KIND);
85 const KIND: EventKind = EventKind::from_static("payment-send");
86 const PERSISTENCE: EventPersistence = EventPersistence::Persistent;
87}
88
89#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
91pub struct ReceivePaymentEvent {
92 pub operation_id: OperationId,
93 pub amount: Amount,
94}
95
96impl Event for ReceivePaymentEvent {
97 const MODULE: Option<ModuleKind> = Some(KIND);
98 const KIND: EventKind = EventKind::from_static("payment-receive");
99 const PERSISTENCE: EventPersistence = EventPersistence::Persistent;
100}
101
102#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
104pub enum ReceivePaymentStatus {
105 Success,
107 Rejected,
109}
110
111#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
113pub struct ReceivePaymentUpdateEvent {
114 pub operation_id: OperationId,
115 pub status: ReceivePaymentStatus,
116}
117
118impl Event for ReceivePaymentUpdateEvent {
119 const MODULE: Option<ModuleKind> = Some(KIND);
120 const KIND: EventKind = EventKind::from_static("payment-receive-update");
121 const PERSISTENCE: EventPersistence = EventPersistence::Persistent;
122}