fedimint_lnv2_client/
events.rs1use fedimint_core::Amount;
2use fedimint_core::core::{Account, 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: Amount,
12 #[serde(default = "Account::primary")]
16 pub account: Account,
17}
18
19impl Event for SendPaymentEvent {
20 const MODULE: Option<ModuleKind> = Some(fedimint_lnv2_common::KIND);
21 const KIND: EventKind = EventKind::from_static("payment-send");
22 const PERSISTENCE: EventPersistence = EventPersistence::Persistent;
23}
24
25#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
27pub enum SendPaymentStatus {
28 Success([u8; 32]),
30 Refunded,
32}
33
34#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
36pub struct SendPaymentUpdateEvent {
37 pub operation_id: OperationId,
38 pub status: SendPaymentStatus,
39 #[serde(default = "Account::primary")]
44 pub account: Account,
45}
46
47impl Event for SendPaymentUpdateEvent {
48 const MODULE: Option<ModuleKind> = Some(fedimint_lnv2_common::KIND);
49 const KIND: EventKind = EventKind::from_static("payment-send-update");
50 const PERSISTENCE: EventPersistence = EventPersistence::Persistent;
51}
52
53#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
56pub struct ReceivePaymentEvent {
57 pub operation_id: OperationId,
58 pub amount: Amount,
59 #[serde(default)]
62 pub fee: Amount,
63 #[serde(default = "Account::primary")]
66 pub account: Account,
67}
68
69impl Event for ReceivePaymentEvent {
70 const MODULE: Option<ModuleKind> = Some(fedimint_lnv2_common::KIND);
71 const KIND: EventKind = EventKind::from_static("payment-receive");
72 const PERSISTENCE: EventPersistence = EventPersistence::Persistent;
73}