reth_rpc_api/txpool.rs
1use alloy_json_rpc::RpcObject;
2use alloy_primitives::Address;
3use alloy_rpc_types_txpool::{TxpoolContent, TxpoolContentFrom, TxpoolInspect, TxpoolStatus};
4use jsonrpsee::{core::RpcResult, proc_macros::rpc};
5
6/// Txpool rpc interface.
7#[rpc(server, namespace = "txpool")]
8pub trait TxPoolApi<T: RpcObject> {
9 /// Returns the number of transactions currently pending for inclusion in the next block(s), as
10 /// well as the ones that are being scheduled for future execution only.
11 ///
12 /// See [here](https://geth.ethereum.org/docs/rpc/ns-txpool#txpool_status) for more details
13 #[method(name = "status")]
14 async fn txpool_status(&self) -> RpcResult<TxpoolStatus>;
15
16 /// Returns a summary of all the transactions currently pending for inclusion in the next
17 /// block(s), as well as the ones that are being scheduled for future execution only.
18 ///
19 /// See [here](https://geth.ethereum.org/docs/rpc/ns-txpool#txpool_inspect) for more details
20 #[method(name = "inspect")]
21 async fn txpool_inspect(&self) -> RpcResult<TxpoolInspect>;
22
23 /// Retrieves the transactions contained within the txpool, returning pending as well as queued
24 /// transactions of this address, grouped by nonce.
25 ///
26 /// See [here](https://geth.ethereum.org/docs/rpc/ns-txpool#txpool_contentFrom) for more details
27 #[method(name = "contentFrom")]
28 async fn txpool_content_from(&self, from: Address) -> RpcResult<TxpoolContentFrom<T>>;
29
30 /// Returns the details of all transactions currently pending for inclusion in the next
31 /// block(s), as well as the ones that are being scheduled for future execution only.
32 ///
33 /// See [here](https://geth.ethereum.org/docs/rpc/ns-txpool#txpool_content) for more details
34 #[method(name = "content")]
35 async fn txpool_content(&self) -> RpcResult<TxpoolContent<T>>;
36}