fedimint_lnv2_client/
events.rs1use fedimint_core::Amount;
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: Amount,
11 pub fee: Option<Amount>,
12}
13
14impl Event for SendPaymentEvent {
15 const MODULE: Option<ModuleKind> = Some(fedimint_lnv2_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([u8; 32]),
25 Refunded,
27}
28
29#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
31pub struct SendPaymentUpdateEvent {
32 pub operation_id: OperationId,
33 pub status: SendPaymentStatus,
34}
35
36impl Event for SendPaymentUpdateEvent {
37 const MODULE: Option<ModuleKind> = Some(fedimint_lnv2_common::KIND);
38 const KIND: EventKind = EventKind::from_static("payment-send-update");
39 const PERSISTENCE: EventPersistence = EventPersistence::Persistent;
40}
41
42#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
45pub struct ReceivePaymentEvent {
46 pub operation_id: OperationId,
47 pub amount: Amount,
48}
49
50impl Event for ReceivePaymentEvent {
51 const MODULE: Option<ModuleKind> = Some(fedimint_lnv2_common::KIND);
52 const KIND: EventKind = EventKind::from_static("payment-receive");
53 const PERSISTENCE: EventPersistence = EventPersistence::Persistent;
54}