1use alloy_eips::BlockId;
2use alloy_primitives::{map::AddressMap, U256};
3use jsonrpsee::{core::RpcResult, proc_macros::rpc};
4
5use reth_chain_state as _;
7
8#[cfg_attr(not(feature = "client"), rpc(server, namespace = "reth"))]
10#[cfg_attr(feature = "client", rpc(server, client, namespace = "reth"))]
11pub trait RethApi {
12 #[method(name = "getBalanceChangesInBlock")]
14 async fn reth_get_balance_changes_in_block(
15 &self,
16 block_id: BlockId,
17 ) -> RpcResult<AddressMap<U256>>;
18
19 #[subscription(
21 name = "subscribeChainNotifications",
22 unsubscribe = "unsubscribeChainNotifications",
23 item = reth_chain_state::CanonStateNotification
24 )]
25 async fn reth_subscribe_chain_notifications(&self) -> jsonrpsee::core::SubscriptionResult;
26
27 #[subscription(
31 name = "subscribePersistedBlock",
32 unsubscribe = "unsubscribePersistedBlock",
33 item = alloy_eips::BlockNumHash
34 )]
35 async fn reth_subscribe_persisted_block(&self) -> jsonrpsee::core::SubscriptionResult;
36
37 #[subscription(
42 name = "subscribeFinalizedChainNotifications",
43 unsubscribe = "unsubscribeFinalizedChainNotifications",
44 item = Vec<reth_chain_state::CanonStateNotification>
45 )]
46 async fn reth_subscribe_finalized_chain_notifications(
47 &self,
48 ) -> jsonrpsee::core::SubscriptionResult;
49}