1use serde::{Deserialize, Serialize};
2
3use crate::Currency;
4
5#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
7#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
8pub enum SyncStatus {
9 Connecting,
10 Listening,
11 Offline,
12 Bootstrap,
13 Synced,
14 Catchup,
15}
16
17impl std::fmt::Display for SyncStatus {
18 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19 match self {
20 Self::Connecting => write!(f, "CONNECTING"),
21 Self::Listening => write!(f, "LISTENING"),
22 Self::Offline => write!(f, "OFFLINE"),
23 Self::Bootstrap => write!(f, "BOOTSTRAP"),
24 Self::Synced => write!(f, "SYNCED"),
25 Self::Catchup => write!(f, "CATCHUP"),
26 }
27 }
28}
29
30#[derive(Debug, Clone, PartialEq, Eq)]
32pub struct PeerInfo {
33 pub peer_id: String,
34 pub host: String,
35 pub port: i64,
36}
37
38#[derive(Debug, Clone)]
40pub struct DaemonStatus {
41 pub sync_status: SyncStatus,
42 pub blockchain_length: Option<i64>,
43 pub highest_block_length_received: Option<i64>,
44 pub uptime_secs: Option<i64>,
45 pub state_hash: Option<String>,
46 pub commit_id: Option<String>,
47 pub peers: Option<Vec<PeerInfo>>,
48}
49
50#[derive(Debug, Clone, PartialEq, Eq)]
52pub struct AccountBalance {
53 pub total: Currency,
54 pub liquid: Option<Currency>,
55 pub locked: Option<Currency>,
56}
57
58#[derive(Debug, Clone)]
60pub struct AccountData {
61 pub public_key: String,
62 pub nonce: u64,
63 pub balance: AccountBalance,
64 pub delegate: Option<String>,
65 pub token_id: Option<String>,
66}
67
68#[derive(Debug, Clone)]
70pub struct BlockInfo {
71 pub state_hash: String,
72 pub height: u64,
73 pub global_slot_since_hard_fork: u64,
74 pub global_slot_since_genesis: u64,
75 pub creator_pk: String,
76 pub command_transaction_count: i64,
77}
78
79#[derive(Debug, Clone, PartialEq, Eq)]
81pub struct SendPaymentResult {
82 pub id: String,
83 pub hash: String,
84 pub nonce: u64,
85}
86
87#[derive(Debug, Clone, PartialEq, Eq)]
89pub struct SendDelegationResult {
90 pub id: String,
91 pub hash: String,
92 pub nonce: u64,
93}
94
95#[derive(Debug, Clone, Serialize, Deserialize)]
97pub struct PooledUserCommand {
98 pub id: String,
99 pub hash: String,
100 pub kind: String,
101 pub nonce: String,
102 pub amount: String,
103 pub fee: String,
104 pub from: String,
105 pub to: String,
106}