fedimint_wallet_client/
events.rs

1use bitcoin::Txid;
2use fedimint_core::Amount;
3use fedimint_core::core::ModuleKind;
4use fedimint_eventlog::{Event, EventKind, EventPersistence};
5use serde::{Deserialize, Serialize};
6
7/// Event that is emitted when the client pegs-out ecash onchain
8#[derive(Serialize, Deserialize)]
9pub struct WithdrawRequest {
10    /// The bitcoin transaction ID
11    pub txid: Txid,
12}
13
14impl Event for WithdrawRequest {
15    const MODULE: Option<ModuleKind> = Some(fedimint_wallet_common::KIND);
16
17    const KIND: EventKind = EventKind::from_static("withdraw-request");
18    const PERSISTENCE: EventPersistence = EventPersistence::Persistent;
19}
20
21/// Event that is emitted when the client confirms an onchain deposit.
22#[derive(Serialize, Deserialize)]
23pub struct DepositConfirmed {
24    /// The bitcoin transaction ID
25    pub txid: Txid,
26
27    /// The out index of the deposit transaction
28    pub out_idx: u32,
29
30    /// The amount being deposited
31    pub amount: Amount,
32}
33
34impl Event for DepositConfirmed {
35    const MODULE: Option<ModuleKind> = Some(fedimint_wallet_common::KIND);
36    const KIND: EventKind = EventKind::from_static("deposit-confirmed");
37    const PERSISTENCE: EventPersistence = EventPersistence::Persistent;
38}