Trait sc_rpc_api::chain::ChainApi[][src]

pub trait ChainApi<Number, Hash, Header, SignedBlock>: Sized + Send + Sync + 'static {
    type Metadata: PubSubMetadata;
    fn header(&self, hash: Option<Hash>) -> FutureResult<Option<Header>>;
fn block(&self, hash: Option<Hash>) -> FutureResult<Option<SignedBlock>>;
fn block_hash(
        &self,
        hash: Option<ListOrValue<NumberOrHex>>
    ) -> Result<ListOrValue<Option<Hash>>>;
fn finalized_head(&self) -> Result<Hash>;
fn subscribe_all_heads(
        &self,
        metadata: Self::Metadata,
        subscriber: Subscriber<Header>
    );
fn unsubscribe_all_heads(
        &self,
        metadata: Option<Self::Metadata>,
        id: SubscriptionId
    ) -> RpcResult<bool>;
fn subscribe_new_heads(
        &self,
        metadata: Self::Metadata,
        subscriber: Subscriber<Header>
    );
fn unsubscribe_new_heads(
        &self,
        metadata: Option<Self::Metadata>,
        id: SubscriptionId
    ) -> RpcResult<bool>;
fn subscribe_finalized_heads(
        &self,
        metadata: Self::Metadata,
        subscriber: Subscriber<Header>
    );
fn unsubscribe_finalized_heads(
        &self,
        metadata: Option<Self::Metadata>,
        id: SubscriptionId
    ) -> RpcResult<bool>; fn to_delegate(self) -> IoDelegate<Self, Self::Metadata>
    where
        Number: Send + Sync + 'static,
        Hash: Send + Sync + 'static + Serialize + DeserializeOwned,
        Header: Send + Sync + 'static + Serialize,
        SignedBlock: Send + Sync + 'static + Serialize
, { ... } }
Expand description

Substrate blockchain API

Associated Types

RPC metadata

Required methods

Get header of a relay chain block.

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

Unsubscribe from all head subscription.

New head subscription

Unsubscribe from new head subscription.

Finalized head subscription

Unsubscribe from finalized head subscription.

Provided methods

Create an IoDelegate, wiring rpc calls to the trait methods.

Implementors