111 lines
2.7 KiB
Rust
111 lines
2.7 KiB
Rust
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Serialize, Deserialize, Debug)]
|
|
pub struct NodeInfoOuter {
|
|
pub id: String,
|
|
pub jsonrpc: String,
|
|
pub result: NodeInfo,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug)]
|
|
pub struct NodeInfo {
|
|
pub adjusted_time: u64,
|
|
alt_blocks_count: u64,
|
|
block_size_limit: u64,
|
|
block_size_median: u64,
|
|
block_weight_limit: u64,
|
|
block_weight_median: u64,
|
|
bootstrap_daemon_address: String,
|
|
busy_syncing: bool,
|
|
credits: u64,
|
|
cumulative_difficulty: u64,
|
|
cumulative_difficulty_top64: u64,
|
|
pub database_size: u64,
|
|
difficulty: u64,
|
|
difficulty_top64: u64,
|
|
pub free_space: u64,
|
|
grey_peerlist_size: u64,
|
|
pub height: u64,
|
|
height_without_bootstrap: u64,
|
|
incoming_connections_count: u64,
|
|
mainnet: bool,
|
|
nettype: String,
|
|
offline: bool,
|
|
outgoing_connections_count: u64,
|
|
restricted: bool,
|
|
rpc_connections_count: u64,
|
|
stagenet: bool,
|
|
pub start_time: u64,
|
|
status: String,
|
|
synchronized: bool,
|
|
target: u64,
|
|
target_height: u64,
|
|
testnet: bool,
|
|
top_block_hash: String,
|
|
top_hash: String,
|
|
tx_count: u64,
|
|
tx_pool_size: u64,
|
|
untrusted: bool,
|
|
update_available: bool,
|
|
version: String,
|
|
was_bootstrap_ever_used: bool,
|
|
white_peerlist_size: u64,
|
|
wide_cumulative_difficulty: String,
|
|
wide_difficulty: String,
|
|
#[serde(skip_deserializing, default = "none")]
|
|
pub time_up_pretty: String,
|
|
#[serde(skip_deserializing, default = "none")]
|
|
pub free_space_pretty: String,
|
|
#[serde(skip_deserializing, default = "none")]
|
|
pub db_size_pretty: String,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug)]
|
|
pub struct BlockHeaderInfosOuter {
|
|
pub id: String,
|
|
pub jsonrpc: String,
|
|
pub result: BlockHeaderInfos,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug)]
|
|
pub struct BlockHeaderInfos {
|
|
credits: u64,
|
|
pub headers: Vec<BlockHeaderInfo>,
|
|
status: String,
|
|
top_hash: String,
|
|
untrusted: bool,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug)]
|
|
pub struct BlockHeaderInfo {
|
|
block_size: u64,
|
|
block_weight: u64,
|
|
cumulative_difficulty: u64,
|
|
cumulative_difficulty_top64: u64,
|
|
depth: u64,
|
|
difficulty: u64,
|
|
difficulty_top64: u64,
|
|
hash: String,
|
|
height: u64,
|
|
long_term_weight: u64,
|
|
major_version: u64,
|
|
miner_tx_hash: String,
|
|
minor_version: u64,
|
|
nonce: u64,
|
|
num_txes: u64,
|
|
orphan_status: bool,
|
|
pow_hash: String,
|
|
prev_hash: String,
|
|
reward: u64,
|
|
pub timestamp: u64,
|
|
wide_cumulative_difficulty: String,
|
|
wide_difficulty: String,
|
|
#[serde(skip_deserializing, default = "none")]
|
|
pub timestamp_pretty: String
|
|
}
|
|
|
|
|
|
fn none() -> String {
|
|
"".to_string()
|
|
}
|