Skip to main content

dig_events_protocol/
kind.rs

1//! The event-kind discriminant used as the subscription filter (SPEC §5).
2
3use enumset::EnumSetType;
4use serde::{Deserialize, Serialize};
5
6/// The kind discriminant of a [`WalletEvent`](crate::WalletEvent), used as the subscription FILTER.
7///
8/// A subscriber passes an `EnumSet<EventKind>`; the engine delivers only matching events (e.g. funds
9/// notifications subscribe `FundsReceived | FundsSent`; chain-watch subscribes
10/// `CoinStateChanged | NewTip`). An `EnumSet<EventKind>` serializes as a snake_case LIST on the wire
11/// (`["funds_received","funds_sent"]`).
12#[derive(Debug, Serialize, Deserialize, EnumSetType)]
13#[enumset(serialize_repr = "list")]
14#[serde(rename_all = "snake_case")]
15pub enum EventKind {
16    /// Inbound value landed.
17    FundsReceived,
18    /// Outbound value confirmed.
19    FundsSent,
20    /// A tracked coin's spent/created state changed.
21    CoinStateChanged,
22    /// A submitted transaction confirmed.
23    Confirmation,
24    /// A submitted transaction failed.
25    TransactionFailed,
26    /// A new chain tip was observed.
27    NewTip,
28    /// Sync progress advanced.
29    SyncProgress,
30    /// CAT metadata became available.
31    CatInfo,
32    /// DID metadata became available.
33    DidInfo,
34    /// NFT data became available.
35    NftData,
36    /// A new HD receive address became active.
37    Derivation,
38}