ln_gateway/gateway_module_v2/
events.rsuse std::time::SystemTime;
use fedimint_core::config::FederationId;
use fedimint_core::core::ModuleKind;
use fedimint_core::Amount;
use fedimint_eventlog::{Event, EventKind};
use fedimint_lnv2_common::contracts::{Commitment, OutgoingContract, PaymentImage};
use serde::{Deserialize, Serialize};
use serde_millis;
use super::send_sm::Cancelled;
#[derive(Serialize, Deserialize)]
pub struct OutgoingPaymentStarted {
#[serde(with = "serde_millis")]
pub operation_start: SystemTime,
pub outgoing_contract: OutgoingContract,
pub min_contract_amount: Amount,
pub invoice_amount: Amount,
pub max_delay: u64,
}
impl Event for OutgoingPaymentStarted {
const MODULE: Option<ModuleKind> = Some(fedimint_lnv2_common::KIND);
const KIND: EventKind = EventKind::from_static("outgoing-payment-started");
}
#[derive(Serialize, Deserialize)]
pub struct OutgoingPaymentSucceeded {
pub payment_image: PaymentImage,
pub target_federation: Option<FederationId>,
}
impl Event for OutgoingPaymentSucceeded {
const MODULE: Option<ModuleKind> = Some(fedimint_lnv2_common::KIND);
const KIND: EventKind = EventKind::from_static("outgoing-payment-succeeded");
}
#[derive(Serialize, Deserialize)]
pub struct OutgoingPaymentFailed {
pub payment_image: PaymentImage,
pub error: Cancelled,
}
impl Event for OutgoingPaymentFailed {
const MODULE: Option<ModuleKind> = Some(fedimint_lnv2_common::KIND);
const KIND: EventKind = EventKind::from_static("outgoing-payment-failed");
}
#[derive(Serialize, Deserialize)]
pub struct IncomingPaymentStarted {
#[serde(with = "serde_millis")]
pub operation_start: SystemTime,
pub incoming_contract_commitment: Commitment,
pub invoice_amount: Amount,
}
impl Event for IncomingPaymentStarted {
const MODULE: Option<ModuleKind> = Some(fedimint_lnv2_common::KIND);
const KIND: EventKind = EventKind::from_static("incoming-payment-started");
}
#[derive(Serialize, Deserialize)]
pub struct IncomingPaymentSucceeded {
pub payment_image: PaymentImage,
}
impl Event for IncomingPaymentSucceeded {
const MODULE: Option<ModuleKind> = Some(fedimint_lnv2_common::KIND);
const KIND: EventKind = EventKind::from_static("incoming-payment-succeeded");
}
#[derive(Serialize, Deserialize)]
pub struct IncomingPaymentFailed {
pub payment_image: PaymentImage,
pub error: String,
}
impl Event for IncomingPaymentFailed {
const MODULE: Option<ModuleKind> = Some(fedimint_lnv2_common::KIND);
const KIND: EventKind = EventKind::from_static("incoming-payment-failed");
}
#[derive(Serialize, Deserialize)]
pub struct CompleteLightningPaymentSucceeded {
pub payment_image: PaymentImage,
}
impl Event for CompleteLightningPaymentSucceeded {
const MODULE: Option<ModuleKind> = Some(fedimint_lnv2_common::KIND);
const KIND: EventKind = EventKind::from_static("complete-lightning-payment-succeeded");
}