cuprate_test_utils::rpc::data::json

Constant GET_ALTERNATE_CHAINS_RESPONSE

Source
pub const GET_ALTERNATE_CHAINS_RESPONSE: &str = r#"{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "chains": [{
      "block_hash": "4826c7d45d7cf4f02985b5c405b0e5d7f92c8d25e015492ce19aa3b209295dce",
      "block_hashes": ["4826c7d45d7cf4f02985b5c405b0e5d7f92c8d25e015492ce19aa3b209295dce"],
      "difficulty": 357404825113208373,
      "difficulty_top64": 0,
      "height": 3167471,
      "length": 1,
      "main_chain_parent_block": "69b5075ea627d6ba06b1c30b7e023884eeaef5282cf58ec847dab838ddbcdd86",
      "wide_difficulty": "0x4f5c1cb79e22635"
    },{
      "block_hash": "33ee476f5a1c5b9d889274cbbe171f5e0112df7ed69021918042525485deb401",
      "block_hashes": ["33ee476f5a1c5b9d889274cbbe171f5e0112df7ed69021918042525485deb401"],
      "difficulty": 354736121711617293,
      "difficulty_top64": 0,
      "height": 3157465,
      "length": 1,
      "main_chain_parent_block": "fd522fcc4cefe5c8c0e5c5600981b3151772c285df3a4e38e5c4011cf466d2cb",
      "wide_difficulty": "0x4ec469f8b9ee50d"
    }],
    "status": "OK",
    "untrusted": false
  }
}"#;
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_ALTERNATE_CHAINS_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();
}