hyperlane-plugin-rpc 22.9.0

A JSON-RPC 2.0 server plugin for the Hyperlane framework with async method routing, batch dispatch, notification handling, and configurable payload and batch DoS bounds.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use super::*;

/// Encodes one [`RpcResponse`] into JSON bytes, falling back to an empty object on serialization error.
///
/// # Arguments
///
/// - `&RpcResponse` - Response envelope to serialize.
///
/// # Returns
///
/// - `Vec<u8>` - Serialized JSON payload bytes.
pub(crate) fn encode_rpc_response(response: &RpcResponse) -> Vec<u8> {
    to_vec(response).unwrap_or_default()
}