cuprate_test_utils::rpc::data::json

Constant GET_INFO_RESPONSE

Source
pub const GET_INFO_RESPONSE: &str = r#"{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "adjusted_time": 1721245289,
    "alt_blocks_count": 16,
    "block_size_limit": 600000,
    "block_size_median": 300000,
    "block_weight_limit": 600000,
    "block_weight_median": 300000,
    "bootstrap_daemon_address": "",
    "busy_syncing": false,
    "credits": 0,
    "cumulative_difficulty": 366127702242611947,
    "cumulative_difficulty_top64": 0,
    "database_size": 235169075200,
    "difficulty": 280716748706,
    "difficulty_top64": 0,
    "free_space": 30521749504,
    "grey_peerlist_size": 4996,
    "height": 3195028,
    "height_without_bootstrap": 3195028,
    "incoming_connections_count": 62,
    "mainnet": true,
    "nettype": "mainnet",
    "offline": false,
    "outgoing_connections_count": 1143,
    "restricted": false,
    "rpc_connections_count": 1,
    "stagenet": false,
    "start_time": 1720462427,
    "status": "OK",
    "synchronized": true,
    "target": 120,
    "target_height": 0,
    "testnet": false,
    "top_block_hash": "bdf06d18ed1931a8ee62654e9b6478cc459bc7072628b8e36f4524d339552946",
    "top_hash": "",
    "tx_count": 43205750,
    "tx_pool_size": 12,
    "untrusted": false,
    "update_available": false,
    "version": "0.18.3.3-release",
    "was_bootstrap_ever_used": false,
    "white_peerlist_size": 1000,
    "wide_cumulative_difficulty": "0x514bf349299d2eb",
    "wide_difficulty": "0x415c05a7a2"
  }
}"#;
Expand description

Documentation, request.

use cuprate_test_utils::rpc::data::json::*;
use serde_json::{to_value, Value};

let value = serde_json::from_str::<Value>(&GET_INFO_RESPONSE).unwrap();
let Value::Object(map) = value else {
    panic!();
};

assert_eq!(map.get("jsonrpc").unwrap(), "2.0");
map.get("id").unwrap();

if map.get("method").is_some() {
    return;
}

if map.get("result").is_none() {
    map.get("error").unwrap();
}