hypercall_api/handlers/
rsm_rpc.rs1use axum::extract::State;
2use hypercall_rsm_rpc::{RsmRpcContext, RsmRpcRequest, RsmRpcResponse};
3
4use crate::handlers::AppState;
5use crate::sonic_json::SonicJson;
6
7#[utoipa::path(
9 post,
10 path = "/rsm/rpc",
11 operation_id = "rsm_rpc",
12 request_body(content = RsmRpcRequest, content_type = "application/json"),
13 responses(
14 (status = 200, description = "Validator RSM JSON-RPC response", body = RsmRpcResponse)
15 ),
16 tag = "RSM"
17)]
18pub async fn rsm_rpc(
19 State(state): State<AppState>,
20 SonicJson(request): SonicJson<RsmRpcRequest>,
21) -> SonicJson<RsmRpcResponse> {
22 let context = RsmRpcContext {
23 db: state.db.clone(),
24 environment: state.runtime_config.rsm_environment,
25 };
26 SonicJson(hypercall_rsm_rpc::handle_rsm_rpc(context, request).await)
27}