1pub mod chain_handlers;
5pub mod static_handlers;
6
7use std::io;
8
9use bytes::Bytes;
10use jsonrpc_core::MethodCall;
11use serde::{Deserialize, Serialize};
12
13#[derive(Deserialize, Serialize, Debug, Clone)]
14pub struct PingResponse {
15 pub success: bool,
16}
17
18pub fn de_request(req: &Bytes) -> io::Result<String> {
22 let method_call: MethodCall = serde_json::from_slice(req).map_err(|e| {
23 io::Error::new(
24 io::ErrorKind::Other,
25 format!("failed to deserialize request: {e}"),
26 )
27 })?;
28 serde_json::to_string(&method_call).map_err(|e| {
29 io::Error::new(
30 io::ErrorKind::Other,
31 format!("failed to serialize request: {e}"),
32 )
33 })
34}