fedimint_mint_client/
event.rs

1use std::time::Duration;
2
3use fedimint_core::Amount;
4use fedimint_core::core::ModuleKind;
5use fedimint_eventlog::{Event, EventKind};
6use fedimint_mint_common::{KIND, Nonce};
7use serde::{Deserialize, Serialize};
8
9/// Event that is emitted when a note is created.
10#[derive(Clone, Copy, Serialize, Deserialize)]
11pub struct NoteCreated {
12    /// The nonce of the note
13    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}
21
22/// Event that is emitted when a note is spent.
23#[derive(Clone, Copy, Serialize, Deserialize)]
24pub struct NoteSpent {
25    /// The nonce of the note
26    pub nonce: Nonce,
27}
28
29impl Event for NoteSpent {
30    const MODULE: Option<ModuleKind> = Some(KIND);
31
32    const KIND: EventKind = EventKind::from_static("note-spent");
33}
34
35/// Event that is emitted when ecash is spent out of band
36#[derive(Serialize, Deserialize)]
37pub struct OOBNotesSpent {
38    /// The requested amount to spend out of band
39    pub requested_amount: Amount,
40
41    /// The actual amount of ecash spent
42    pub spent_amount: Amount,
43
44    /// The timeout before attempting to refund
45    pub timeout: Duration,
46
47    /// Boolean that indicates if the invite code was included in the note
48    /// serialization
49    pub include_invite: bool,
50}
51
52impl Event for OOBNotesSpent {
53    const MODULE: Option<ModuleKind> = Some(KIND);
54
55    const KIND: EventKind = EventKind::from_static("oob-notes-spent");
56}
57
58/// Event that is emitted when out of band ecash is reissued
59#[derive(Serialize, Deserialize)]
60pub struct OOBNotesReissued {
61    /// The amount of out of band ecash being reissued
62    pub amount: Amount,
63}
64
65impl Event for OOBNotesReissued {
66    const MODULE: Option<ModuleKind> = Some(KIND);
67
68    const KIND: EventKind = EventKind::from_static("oob-notes-reissued");
69}