use fedimint_core::Amount;
use fedimint_core::core::{ModuleKind, OperationId};
use fedimint_eventlog::{Event, EventKind, EventPersistence};
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
pub struct SendPaymentEvent {
pub operation_id: OperationId,
pub amount: Amount,
pub fee: Amount,
}
impl Event for SendPaymentEvent {
const MODULE: Option<ModuleKind> = Some(fedimint_ln_common::KIND);
const KIND: EventKind = EventKind::from_static("payment-send");
const PERSISTENCE: EventPersistence = EventPersistence::Persistent;
}
#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
pub enum SendPaymentStatus {
Success([u8; 32]),
Refunded,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
pub struct SendPaymentUpdateEvent {
pub operation_id: OperationId,
pub status: SendPaymentStatus,
}
impl Event for SendPaymentUpdateEvent {
const MODULE: Option<ModuleKind> = Some(fedimint_ln_common::KIND);
const KIND: EventKind = EventKind::from_static("payment-send-update");
const PERSISTENCE: EventPersistence = EventPersistence::Persistent;
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
pub struct ReceivePaymentEvent {
pub operation_id: OperationId,
pub amount: Amount,
}
impl Event for ReceivePaymentEvent {
const MODULE: Option<ModuleKind> = Some(fedimint_ln_common::KIND);
const KIND: EventKind = EventKind::from_static("payment-receive");
const PERSISTENCE: EventPersistence = EventPersistence::Persistent;
}