fedimint_mintv2_client/
events.rs1use fedimint_core::Amount;
2use fedimint_core::core::{Account, ModuleKind, OperationId};
3use fedimint_eventlog::{Event, EventKind, EventPersistence};
4use fedimint_mintv2_common::KIND;
5use serde::{Deserialize, Serialize};
6
7#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
10pub struct SendPaymentEvent {
11 pub operation_id: OperationId,
12 pub amount: Amount,
13 #[serde(default = "Account::primary")]
17 pub account: Account,
18 pub ecash: String,
19}
20
21impl Event for SendPaymentEvent {
22 const MODULE: Option<ModuleKind> = Some(KIND);
23 const KIND: EventKind = EventKind::from_static("payment-send");
24 const PERSISTENCE: EventPersistence = EventPersistence::Persistent;
25}
26
27#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
29pub struct ReceivePaymentEvent {
30 pub operation_id: OperationId,
31 pub amount: Amount,
32 #[serde(default = "Account::primary")]
35 pub account: Account,
36}
37
38impl Event for ReceivePaymentEvent {
39 const MODULE: Option<ModuleKind> = Some(KIND);
40 const KIND: EventKind = EventKind::from_static("payment-receive");
41 const PERSISTENCE: EventPersistence = EventPersistence::Persistent;
42}
43
44#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
46pub enum ReceivePaymentStatus {
47 Success,
49 Rejected,
51}
52
53#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
55pub struct ReceivePaymentUpdateEvent {
56 pub operation_id: OperationId,
57 pub status: ReceivePaymentStatus,
58 #[serde(default = "Account::primary")]
63 pub account: Account,
64}
65
66impl Event for ReceivePaymentUpdateEvent {
67 const MODULE: Option<ModuleKind> = Some(KIND);
68 const KIND: EventKind = EventKind::from_static("payment-receive-update");
69 const PERSISTENCE: EventPersistence = EventPersistence::Persistent;
70}