reth_rpc_eth_api/
pubsub.rs

1//! `eth_` RPC API for pubsub subscription.
2
3use alloy_json_rpc::RpcObject;
4use alloy_rpc_types_eth::pubsub::{Params, SubscriptionKind};
5use jsonrpsee::proc_macros::rpc;
6
7/// Ethereum pub-sub rpc interface.
8#[rpc(server, namespace = "eth")]
9pub trait EthPubSubApi<T: RpcObject> {
10    /// Create an ethereum subscription for the given params
11    #[subscription(
12        name = "subscribe" => "subscription",
13        unsubscribe = "unsubscribe",
14        item = alloy_rpc_types::pubsub::SubscriptionResult
15    )]
16    async fn subscribe(
17        &self,
18        kind: SubscriptionKind,
19        params: Option<Params>,
20    ) -> jsonrpsee::core::SubscriptionResult;
21}