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
38
39
40
41
42
43
44
45
46
47
48
use serde::{Deserialize, Serialize};
/// Specifies the topic which to be added as active subscription.
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Hash)]
#[serde(rename_all = "snake_case")]
pub enum Topic {
/// Subscribe new tip headers.
NewTipHeader,
/// Subscribe new tip blocks.
NewTipBlock,
/// Subscribe new transactions which are submitted to the pool.
NewTransaction,
/// Subscribe in-pool transactions which proposed on chain.
ProposedTransaction,
/// Subscribe transactions which are abandoned by tx-pool.
RejectedTransaction,
/// Subscribe to logs.
Log,
}
/// Log entry received from the subscription.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)]
pub struct LogEntry {
/// The log message.
pub message: String,
/// The log level.
pub level: LogLevel,
/// The log target
pub target: String,
/// The date
pub date: String,
}
/// Log level for log subscription.
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Hash)]
#[serde(rename_all = "snake_case")]
pub enum LogLevel {
/// Error level.
Error,
/// Warn level.
Warn,
/// Info level.
Info,
/// Debug level.
Debug,
/// Trace level.
Trace,
}