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