use bitcoin::Txid;
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 WithdrawRequest {
pub txid: Txid,
}
impl Event for WithdrawRequest {
const MODULE: Option<ModuleKind> = Some(fedimint_wallet_common::KIND);
const KIND: EventKind = EventKind::from_static("withdraw-request");
const PERSISTENCE: EventPersistence = EventPersistence::Persistent;
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
pub struct DepositConfirmed {
pub txid: Txid,
pub out_idx: u32,
pub amount: Amount,
}
impl Event for DepositConfirmed {
const MODULE: Option<ModuleKind> = Some(fedimint_wallet_common::KIND);
const KIND: EventKind = EventKind::from_static("deposit-confirmed");
const PERSISTENCE: EventPersistence = EventPersistence::Persistent;
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
pub struct SendPaymentEvent {
pub operation_id: OperationId,
pub amount: bitcoin::Amount,
pub fee: bitcoin::Amount,
}
impl Event for SendPaymentEvent {
const MODULE: Option<ModuleKind> = Some(fedimint_wallet_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(Txid),
Aborted,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
pub struct SendPaymentStatusEvent {
pub operation_id: OperationId,
pub status: SendPaymentStatus,
}
impl Event for SendPaymentStatusEvent {
const MODULE: Option<ModuleKind> = Some(fedimint_wallet_common::KIND);
const KIND: EventKind = EventKind::from_static("payment-send-status");
const PERSISTENCE: EventPersistence = EventPersistence::Persistent;
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
pub struct ReceivePaymentEvent {
pub operation_id: OperationId,
pub amount: Amount,
pub txid: Txid,
}
impl Event for ReceivePaymentEvent {
const MODULE: Option<ModuleKind> = Some(fedimint_wallet_common::KIND);
const KIND: EventKind = EventKind::from_static("payment-receive");
const PERSISTENCE: EventPersistence = EventPersistence::Persistent;
}