alloy_provider::ext

Trait AdminApi

source
pub trait AdminApi<N, T>: Send + Sync {
    // Required methods
    fn add_peer<'life0, 'life1, 'async_trait>(
        &'life0 self,
        record: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = TransportResult<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn add_trusted_peer<'life0, 'life1, 'async_trait>(
        &'life0 self,
        record: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = TransportResult<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn remove_peer<'life0, 'life1, 'async_trait>(
        &'life0 self,
        record: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = TransportResult<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn remove_trusted_peer<'life0, 'life1, 'async_trait>(
        &'life0 self,
        record: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = TransportResult<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn peers<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = TransportResult<Vec<PeerInfo>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn node_info<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = TransportResult<NodeInfo>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn subscribe_peer_events<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = TransportResult<Subscription<PeerEvent>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Available on crate feature admin-api only.
Expand description

Admin namespace rpc interface that gives access to several non-standard RPC methods.

Required Methods§

source

fn add_peer<'life0, 'life1, 'async_trait>( &'life0 self, record: &'life1 str, ) -> Pin<Box<dyn Future<Output = TransportResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Requests adding the given peer, returning a boolean representing whether or not the peer was accepted for tracking.

source

fn add_trusted_peer<'life0, 'life1, 'async_trait>( &'life0 self, record: &'life1 str, ) -> Pin<Box<dyn Future<Output = TransportResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Requests adding the given peer as a trusted peer, which the node will always connect to even when its peer slots are full.

source

fn remove_peer<'life0, 'life1, 'async_trait>( &'life0 self, record: &'life1 str, ) -> Pin<Box<dyn Future<Output = TransportResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Requests to remove the given peer, returning true if the enode was successfully parsed and the peer was removed.

source

fn remove_trusted_peer<'life0, 'life1, 'async_trait>( &'life0 self, record: &'life1 str, ) -> Pin<Box<dyn Future<Output = TransportResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Requests to remove the given peer, returning a boolean representing whether or not the enode url passed was validated. A return value of true does not necessarily mean that the peer was disconnected.

source

fn peers<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = TransportResult<Vec<PeerInfo>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the list of peers currently connected to the node.

source

fn node_info<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = TransportResult<NodeInfo>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns general information about the node as well as information about the running p2p protocols (e.g. eth, snap).

source

fn subscribe_peer_events<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = TransportResult<Subscription<PeerEvent>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Available on crate feature pubsub only.

Subscribe to events received by peers over the network.

Implementors§

source§

impl<N, T, P> AdminApi<N, T> for P
where N: Network, T: Transport + Clone, P: Provider<T, N>,