1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
//! Queries the genesis config of the network.
//!
//! ## Example
//!
//! Returns the genesis config of the network.
//!
//! ```
//! use unc_jsonrpc_client::{methods, JsonRpcClient};
//!
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let client = JsonRpcClient::connect("https://rpc.mainnet.unc.org");
//!
//! let request = methods::EXPERIMENTAL_genesis_config::RpcGenesisConfigRequest;
//!
//! let response = client.call(request).await?;
//!
//! assert!(matches!(
//! response,
//! methods::EXPERIMENTAL_genesis_config::RpcGenesisConfigResponse { .. }
//! ));
//! # Ok(())
//! # }
//! ```
use super::*;
pub type RpcGenesisConfigResponse = unc_chain_configs::GenesisConfig;
#[derive(Debug)]
pub struct RpcGenesisConfigRequest;
#[derive(Debug, Deserialize, Error)]
#[error("{}", unreachable!("fatal: this error should never be constructed"))]
pub enum RpcGenesisConfigError {}
impl RpcHandlerResponse for RpcGenesisConfigResponse {}
impl RpcHandlerError for RpcGenesisConfigError {}
impl RpcMethod for RpcGenesisConfigRequest {
type Response = RpcGenesisConfigResponse;
type Error = RpcGenesisConfigError;
fn method_name(&self) -> &str {
"EXPERIMENTAL_genesis_config"
}
fn params(&self) -> Result<serde_json::Value, io::Error> {
Ok(json!(null))
}
}
impl private::Sealed for RpcGenesisConfigRequest {}