cuprate_test_utils::rpc::data::json

Constant GENERATE_BLOCKS_REQUEST

Source
pub const GENERATE_BLOCKS_REQUEST: &str = r#"{
  "jsonrpc": "2.0",
  "id": "0",
  "method": "generateblocks",
  "params": {
    "amount_of_blocks": 1,
    "wallet_address": "44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A",
    "starting_nonce": 0
  }
}"#;
Expand description

Documentation, response.

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

let value = serde_json::from_str::<Value>(&GENERATE_BLOCKS_REQUEST).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();
}