titan_types/
subscription.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use {
    super::EventType,
    borsh::{BorshDeserialize, BorshSerialize},
    serde::{Deserialize, Serialize},
    uuid::Uuid,
};

#[derive(Debug, Clone, Serialize, Deserialize, BorshSerialize, BorshDeserialize)]
pub struct Subscription {
    pub id: Uuid,
    pub endpoint: String,
    pub event_types: Vec<EventType>,
    pub last_success_epoch_secs: u64,
}

/// The expected subscription request from the TCP client.
/// For example, the client should send:
///   {"subscribe": ["RuneEtched", "RuneMinted"]}
#[derive(Debug, Serialize, Deserialize)]
pub struct TcpSubscriptionRequest {
    pub subscribe: Vec<EventType>,
}