1use alloy_eips::BlockId;
2use alloy_primitives::{Address, U256};
3use jsonrpsee::{core::RpcResult, proc_macros::rpc};
4use std::collections::HashMap;
5
6use reth_chain_state as _;
8
9#[cfg_attr(not(feature = "client"), rpc(server, namespace = "reth"))]
11#[cfg_attr(feature = "client", rpc(server, client, namespace = "reth"))]
12pub trait RethApi {
13 #[method(name = "getBalanceChangesInBlock")]
15 async fn reth_get_balance_changes_in_block(
16 &self,
17 block_id: BlockId,
18 ) -> RpcResult<HashMap<Address, U256>>;
19
20 #[subscription(
22 name = "subscribeChainNotifications",
23 unsubscribe = "unsubscribeChainNotifications",
24 item = reth_chain_state::CanonStateNotification
25 )]
26 async fn reth_subscribe_chain_notifications(&self) -> jsonrpsee::core::SubscriptionResult;
27}