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