hyperlane_plugin_rpc/trait.rs
1use super::*;
2
3/// Pluggable interceptor invoked before each JSON-RPC 2.0 method dispatch.
4pub trait RpcInterceptor: Send + Sync + 'static {
5 /// Inspects or rejects an incoming JSON-RPC call before its method handler runs.
6 ///
7 /// # Arguments
8 ///
9 /// - `&str` - Target JSON-RPC method name.
10 /// - `&Option<Value>` - Optional method parameters.
11 ///
12 /// # Returns
13 ///
14 /// - `Result<(), RpcError>` - `Ok(())` to continue dispatch, or `Err(RpcError)` to short-circuit.
15 fn before_call(&self, method: &str, params: &Option<Value>) -> Result<(), RpcError>;
16}