cuprate_test_utils::rpc::data::json

Constant GET_BLOCK_TEMPLATE_RESPONSE

Source
pub const GET_BLOCK_TEMPLATE_RESPONSE: &str = r#"{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "blockhashing_blob": "1010f4bae0b4069d648e741d85ca0e7acb4501f051b27e9b107d3cd7a3f03aa7f776089117c81a00000000e0c20372be23d356347091025c5b5e8f2abf83ab618378565cce2b703491523401",
    "blocktemplate_blob": "1010f4bae0b4069d648e741d85ca0e7acb4501f051b27e9b107d3cd7a3f03aa7f776089117c81a0000000002c681c30101ff8a81c3010180e0a596bb11033b7eedf47baf878f3490cb20b696079c34bd017fe59b0d070e74d73ffabc4bb0e05f011decb630f3148d0163b3bd39690dde4078e4cfb69fecf020d6278a27bad10c58023c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "difficulty": 283305047039,
    "difficulty_top64": 0,
    "expected_reward": 600000000000,
    "height": 3195018,
    "next_seed_hash": "",
    "prev_hash": "9d648e741d85ca0e7acb4501f051b27e9b107d3cd7a3f03aa7f776089117c81a",
    "reserved_offset": 131,
    "seed_hash": "e2aa0b7b55042cd48b02e395d78fa66a29815ccc1584e38db2d1f0e8485cd44f",
    "seed_height": 3194880,
    "status": "OK",
    "untrusted": false,
    "wide_difficulty": "0x41f64bf3ff"
  }
}"#;
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_BLOCK_TEMPLATE_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();
}