fedimint_wallet_client/
events.rs1use bitcoin::Txid;
2use fedimint_core::Amount;
3use fedimint_core::core::{ModuleKind, OperationId};
4use fedimint_eventlog::{Event, EventKind, EventPersistence};
5use serde::{Deserialize, Serialize};
6
7#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
9pub struct WithdrawRequest {
10 pub txid: Txid,
12}
13
14impl Event for WithdrawRequest {
15 const MODULE: Option<ModuleKind> = Some(fedimint_wallet_common::KIND);
16
17 const KIND: EventKind = EventKind::from_static("withdraw-request");
18 const PERSISTENCE: EventPersistence = EventPersistence::Persistent;
19}
20
21#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
23pub struct DepositConfirmed {
24 pub txid: Txid,
26
27 pub out_idx: u32,
29
30 pub amount: Amount,
32}
33
34impl Event for DepositConfirmed {
35 const MODULE: Option<ModuleKind> = Some(fedimint_wallet_common::KIND);
36 const KIND: EventKind = EventKind::from_static("deposit-confirmed");
37 const PERSISTENCE: EventPersistence = EventPersistence::Persistent;
38}
39
40#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
42pub struct SendPaymentEvent {
43 pub operation_id: OperationId,
44 pub amount: bitcoin::Amount,
45 pub fee: bitcoin::Amount,
46}
47
48impl Event for SendPaymentEvent {
49 const MODULE: Option<ModuleKind> = Some(fedimint_wallet_common::KIND);
50 const KIND: EventKind = EventKind::from_static("payment-send");
51 const PERSISTENCE: EventPersistence = EventPersistence::Persistent;
52}
53
54#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
56pub enum SendPaymentStatus {
57 Success(Txid),
59 Aborted,
61}
62
63#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
65pub struct SendPaymentStatusEvent {
66 pub operation_id: OperationId,
67 pub status: SendPaymentStatus,
68}
69
70impl Event for SendPaymentStatusEvent {
71 const MODULE: Option<ModuleKind> = Some(fedimint_wallet_common::KIND);
72 const KIND: EventKind = EventKind::from_static("payment-send-status");
73 const PERSISTENCE: EventPersistence = EventPersistence::Persistent;
74}
75
76#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
78pub struct ReceivePaymentEvent {
79 pub operation_id: OperationId,
80 pub amount: Amount,
81 pub txid: Txid,
82}
83
84impl Event for ReceivePaymentEvent {
85 const MODULE: Option<ModuleKind> = Some(fedimint_wallet_common::KIND);
86 const KIND: EventKind = EventKind::from_static("payment-receive");
87 const PERSISTENCE: EventPersistence = EventPersistence::Persistent;
88}