mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
feat(rpc): add txpool namespace (#2591)
This commit is contained in:
@ -17,6 +17,7 @@ mod eth_filter;
|
||||
mod eth_pubsub;
|
||||
mod net;
|
||||
mod trace;
|
||||
mod txpool;
|
||||
mod web3;
|
||||
|
||||
/// re-export of all server traits
|
||||
@ -33,6 +34,7 @@ pub mod servers {
|
||||
eth_pubsub::EthPubSubApiServer,
|
||||
net::NetApiServer,
|
||||
trace::TraceApiServer,
|
||||
txpool::TxPoolApiServer,
|
||||
web3::Web3ApiServer,
|
||||
};
|
||||
}
|
||||
@ -51,6 +53,7 @@ pub mod clients {
|
||||
eth::EthApiClient,
|
||||
net::NetApiClient,
|
||||
trace::TraceApiClient,
|
||||
txpool::TxPoolApiClient,
|
||||
web3::Web3ApiClient,
|
||||
};
|
||||
}
|
||||
|
||||
36
crates/rpc/rpc-api/src/txpool.rs
Normal file
36
crates/rpc/rpc-api/src/txpool.rs
Normal file
@ -0,0 +1,36 @@
|
||||
use jsonrpsee::{core::RpcResult as Result, proc_macros::rpc};
|
||||
use reth_primitives::Address;
|
||||
use reth_rpc_types::txpool::{TxpoolContent, TxpoolContentFrom, TxpoolInspect, TxpoolStatus};
|
||||
|
||||
/// Txpool rpc interface.
|
||||
#[cfg_attr(not(feature = "client"), rpc(server))]
|
||||
#[cfg_attr(feature = "client", rpc(server, client))]
|
||||
#[async_trait::async_trait]
|
||||
pub trait TxPoolApi {
|
||||
/// Returns the number of transactions currently pending for inclusion in the next block(s), as
|
||||
/// well as the ones that are being scheduled for future execution only.
|
||||
/// Ref: [Here](https://geth.ethereum.org/docs/rpc/ns-txpool#txpool_status)
|
||||
#[method(name = "txpool_status")]
|
||||
async fn txpool_status(&self) -> Result<TxpoolStatus>;
|
||||
|
||||
/// Returns a summary of all the transactions currently pending for inclusion in the next
|
||||
/// block(s), as well as the ones that are being scheduled for future execution only.
|
||||
///
|
||||
/// See [here](https://geth.ethereum.org/docs/rpc/ns-txpool#txpool_inspect) for more details
|
||||
#[method(name = "txpool_inspect")]
|
||||
async fn txpool_inspect(&self) -> Result<TxpoolInspect>;
|
||||
|
||||
/// Retrieves the transactions contained within the txpool, returning pending as well as queued
|
||||
/// transactions of this address, grouped by nonce.
|
||||
///
|
||||
/// See [here](https://geth.ethereum.org/docs/rpc/ns-txpool#txpool_contentFrom) for more details
|
||||
#[method(name = "txpool_contentFrom")]
|
||||
async fn txpool_content_from(&self, from: Address) -> Result<TxpoolContentFrom>;
|
||||
|
||||
/// Returns the details of all transactions currently pending for inclusion in the next
|
||||
/// block(s), as well as the ones that are being scheduled for future execution only.
|
||||
///
|
||||
/// See [here](https://geth.ethereum.org/docs/rpc/ns-txpool#txpool_content) for more details
|
||||
#[method(name = "txpool_content")]
|
||||
async fn txpool_content(&self) -> Result<TxpoolContent>;
|
||||
}
|
||||
Reference in New Issue
Block a user