cuprate_test_utils::rpc::data::json

Constant RELAY_TX_REQUEST

Source
pub const RELAY_TX_REQUEST: &str = r#"{
  "jsonrpc": "2.0",
  "id": "0",
  "method": "relay_tx",
  "params": {
    "txids": ["9fd75c429cbe52da9a52f2ffc5fbd107fe7fd2099c0d8de274dc8a67e0c98613"]
  }
}"#;
Expand description

Documentation, response.

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

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