pub trait ChainApiServer<Number, Hash, Header, SignedBlock>: 'static + Sized + Send + Sync {
    fn header(&self, hash: Option<Hash>) -> Result<Option<Header>, Error>;
    fn block(&self, hash: Option<Hash>) -> Result<Option<SignedBlock>, Error>;
    fn block_hash(
        &self,
        hash: Option<ListOrValue<NumberOrHex>>
    ) -> Result<ListOrValue<Option<Hash>>, Error>; fn finalized_head(&self) -> Result<Hash, Error>; fn subscribe_all_heads(
        &self,
        subscription_sink: SubscriptionSink
    ) -> Result<(), SubscriptionEmptyError>; fn subscribe_new_heads(
        &self,
        subscription_sink: SubscriptionSink
    ) -> Result<(), SubscriptionEmptyError>; fn subscribe_finalized_heads(
        &self,
        subscription_sink: SubscriptionSink
    ) -> Result<(), SubscriptionEmptyError>; fn into_rpc(self) -> RpcModule<Self>
    where
        Number: 'static + Send + Sync,
        Hash: 'static + Send + Sync + DeserializeOwned + Serialize,
        Header: 'static + Send + Sync + Serialize,
        SignedBlock: 'static + Send + Sync + Serialize
, { ... } }
Expand description

Server trait implementation for the ChainApi RPC API.

Required Methods§

Get header.

Get header and body of a relay chain block.

Get hash of the n-th block in the canon chain.

By default returns latest block hash.

Get hash of the last finalized block in the canon chain.

All head subscription.

New head subscription.

Finalized head subscription.

Provided Methods§

Collects all the methods and subscriptions defined in the trait and adds them into a single RpcModule.

Implementors§