fedimint_wallet_client/
events.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use bitcoin::Txid;
use fedimint_core::core::ModuleKind;
use fedimint_core::Amount;
use fedimint_eventlog::{Event, EventKind};
use serde::{Deserialize, Serialize};

/// Event that is emitted when the client pegs-out ecash onchain
#[derive(Serialize, Deserialize)]
pub struct WithdrawRequest {
    /// The bitcoin transaction ID
    pub txid: Txid,
}

impl Event for WithdrawRequest {
    const MODULE: Option<ModuleKind> = Some(fedimint_wallet_common::KIND);

    const KIND: EventKind = EventKind::from_static("withdraw-request");
}

/// Event that is emitted when the client confirms an onchain deposit.
#[derive(Serialize, Deserialize)]
pub struct DepositConfirmed {
    /// The bitcoin transaction ID
    pub txid: Txid,

    /// The out index of the deposit transaction
    pub out_idx: u32,

    /// The amount being deposited
    pub amount: Amount,
}

impl Event for DepositConfirmed {
    const MODULE: Option<ModuleKind> = Some(fedimint_wallet_common::KIND);

    const KIND: EventKind = EventKind::from_static("deposit-confirmed");
}