fedimint_walletv2_client/
events.rs1use bitcoin::Txid;
2use fedimint_core::core::{ModuleKind, OperationId};
3use fedimint_eventlog::{Event, EventKind, EventPersistence};
4use serde::{Deserialize, Serialize};
5
6#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
8pub struct SendPaymentEvent {
9 pub operation_id: OperationId,
10 pub amount: bitcoin::Amount,
11 pub fee: bitcoin::Amount,
12}
13
14impl Event for SendPaymentEvent {
15 const MODULE: Option<ModuleKind> = Some(fedimint_walletv2_common::KIND);
16 const KIND: EventKind = EventKind::from_static("payment-send");
17 const PERSISTENCE: EventPersistence = EventPersistence::Persistent;
18}
19
20#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
22pub enum SendPaymentStatus {
23 Success(Txid),
25 Aborted,
27}
28
29#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
31pub struct SendPaymentStatusEvent {
32 pub operation_id: OperationId,
33 pub status: SendPaymentStatus,
34}
35
36impl Event for SendPaymentStatusEvent {
37 const MODULE: Option<ModuleKind> = Some(fedimint_walletv2_common::KIND);
38 const KIND: EventKind = EventKind::from_static("payment-send-status");
39 const PERSISTENCE: EventPersistence = EventPersistence::Persistent;
40}
41
42#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
44pub struct ReceivePaymentEvent {
45 pub operation_id: OperationId,
46 pub amount: bitcoin::Amount,
47 pub fee: bitcoin::Amount,
48}
49
50impl Event for ReceivePaymentEvent {
51 const MODULE: Option<ModuleKind> = Some(fedimint_walletv2_common::KIND);
52 const KIND: EventKind = EventKind::from_static("payment-receive");
53 const PERSISTENCE: EventPersistence = EventPersistence::Persistent;
54}
55
56#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
58pub enum ReceivePaymentStatus {
59 Success,
61 Aborted,
63}
64
65#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
67pub struct ReceivePaymentStatusEvent {
68 pub operation_id: OperationId,
69 pub status: ReceivePaymentStatus,
70}
71
72impl Event for ReceivePaymentStatusEvent {
73 const MODULE: Option<ModuleKind> = Some(fedimint_walletv2_common::KIND);
74 const KIND: EventKind = EventKind::from_static("payment-receive-status");
75 const PERSISTENCE: EventPersistence = EventPersistence::Persistent;
76}