mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
feat: make SubscriptionIdcompatible with client proc macro (#1378)
This commit is contained in:
@ -1,34 +1,34 @@
|
||||
use jsonrpsee::{core::RpcResult as Result, proc_macros::rpc, types::SubscriptionId};
|
||||
use jsonrpsee::{core::RpcResult as Result, proc_macros::rpc};
|
||||
use reth_primitives::rpc::Filter;
|
||||
use reth_rpc_types::{FilterChanges, Log};
|
||||
use reth_rpc_types::{FilterChanges, FilterId, Log};
|
||||
|
||||
/// Rpc Interface for poll-based ethereum filter API.
|
||||
#[cfg_attr(not(feature = "client"), rpc(server))]
|
||||
#[cfg_attr(feature = "client", rpc(server))] // TODO(mattsse) make it work with SubscriptionId lifetime
|
||||
#[cfg_attr(feature = "client", rpc(server, client))]
|
||||
pub trait EthFilterApi {
|
||||
/// Creates anew filter and returns its id.
|
||||
#[method(name = "eth_newFilter")]
|
||||
async fn new_filter(&self, filter: Filter) -> Result<SubscriptionId<'static>>;
|
||||
async fn new_filter(&self, filter: Filter) -> Result<FilterId>;
|
||||
|
||||
/// Creates a new block filter and returns its id.
|
||||
#[method(name = "eth_newBlockFilter")]
|
||||
async fn new_block_filter(&self) -> Result<SubscriptionId<'static>>;
|
||||
async fn new_block_filter(&self) -> Result<FilterId>;
|
||||
|
||||
/// Creates a pending transaction filter and returns its id.
|
||||
#[method(name = "eth_newPendingTransactionFilter")]
|
||||
async fn new_pending_transaction_filter(&self) -> Result<SubscriptionId<'static>>;
|
||||
async fn new_pending_transaction_filter(&self) -> Result<FilterId>;
|
||||
|
||||
/// Returns all filter changes since last poll.
|
||||
#[method(name = "eth_getFilterChanges")]
|
||||
async fn filter_changes(&self, id: SubscriptionId<'_>) -> Result<FilterChanges>;
|
||||
async fn filter_changes(&self, id: FilterId) -> Result<FilterChanges>;
|
||||
|
||||
/// Returns all logs matching given filter (in a range 'from' - 'to').
|
||||
#[method(name = "eth_getFilterLogs")]
|
||||
async fn filter_logs(&self, id: SubscriptionId<'_>) -> Result<Vec<Log>>;
|
||||
async fn filter_logs(&self, id: FilterId) -> Result<Vec<Log>>;
|
||||
|
||||
/// Uninstalls filter.
|
||||
#[method(name = "eth_uninstallFilter")]
|
||||
async fn uninstall_filter(&self, id: SubscriptionId<'_>) -> Result<bool>;
|
||||
async fn uninstall_filter(&self, id: FilterId) -> Result<bool>;
|
||||
|
||||
/// Returns logs matching given filter object.
|
||||
#[method(name = "eth_getLogs")]
|
||||
|
||||
Reference in New Issue
Block a user