1use alloy_eips::BlockId;
2use alloy_primitives::{map::AddressMap, U256, U64};
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 #[method(name = "getBlockExecutionOutcome")]
25 async fn reth_get_block_execution_outcome(
26 &self,
27 block_id: BlockId,
28 count: Option<U64>,
29 ) -> RpcResult<Option<serde_json::Value>>;
30
31 #[subscription(
33 name = "subscribeChainNotifications",
34 unsubscribe = "unsubscribeChainNotifications",
35 item = reth_chain_state::CanonStateNotification
36 )]
37 async fn reth_subscribe_chain_notifications(&self) -> jsonrpsee::core::SubscriptionResult;
38
39 #[subscription(
43 name = "subscribePersistedBlock",
44 unsubscribe = "unsubscribePersistedBlock",
45 item = alloy_eips::BlockNumHash
46 )]
47 async fn reth_subscribe_persisted_block(&self) -> jsonrpsee::core::SubscriptionResult;
48
49 #[subscription(
54 name = "subscribeFinalizedChainNotifications",
55 unsubscribe = "unsubscribeFinalizedChainNotifications",
56 item = Vec<reth_chain_state::CanonStateNotification>
57 )]
58 async fn reth_subscribe_finalized_chain_notifications(
59 &self,
60 ) -> jsonrpsee::core::SubscriptionResult;
61}