Trait sc_rpc::chain::ChainApi[][src]

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

Substrate blockchain API

Associated Types

type Metadata: PubSubMetadata[src]

RPC metadata

Loading content...

Required methods

pub fn header(
    &self,
    hash: Option<Hash>
) -> Box<dyn Future<Error = Error, Item = Option<Header>> + 'static + Send, Global>
[src]

Get header of a relay chain block.

pub fn block(
    &self,
    hash: Option<Hash>
) -> Box<dyn Future<Error = Error, Item = Option<SignedBlock>> + 'static + Send, Global>
[src]

Get header and body of a relay chain block.

pub fn block_hash(
    &self,
    hash: Option<ListOrValue<NumberOrHex>>
) -> Result<ListOrValue<Option<Hash>>, Error>
[src]

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

By default returns latest block hash.

pub fn finalized_head(&self) -> Result<Hash, Error>[src]

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

pub fn subscribe_all_heads(
    &self,
    metadata: Self::Metadata,
    subscriber: Subscriber<Header, Error>
)
[src]

All head subscription

pub fn unsubscribe_all_heads(
    &self,
    metadata: Option<Self::Metadata>,
    id: SubscriptionId
) -> Result<bool, Error>
[src]

Unsubscribe from all head subscription.

pub fn subscribe_new_heads(
    &self,
    metadata: Self::Metadata,
    subscriber: Subscriber<Header, Error>
)
[src]

New head subscription

pub fn unsubscribe_new_heads(
    &self,
    metadata: Option<Self::Metadata>,
    id: SubscriptionId
) -> Result<bool, Error>
[src]

Unsubscribe from new head subscription.

pub fn subscribe_finalized_heads(
    &self,
    metadata: Self::Metadata,
    subscriber: Subscriber<Header, Error>
)
[src]

Finalized head subscription

pub fn unsubscribe_finalized_heads(
    &self,
    metadata: Option<Self::Metadata>,
    id: SubscriptionId
) -> Result<bool, Error>
[src]

Unsubscribe from finalized head subscription.

Loading content...

Provided methods

pub fn to_delegate(self) -> IoDelegate<Self, Self::Metadata> where
    Hash: Send + Sync + 'static + Serialize + DeserializeOwned,
    SignedBlock: Send + Sync + 'static + Serialize,
    Header: Send + Sync + 'static + Serialize,
    Number: Send + Sync + 'static, 
[src]

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

Loading content...

Implementors

impl<Block, Client> ChainApi<<<Block as Block>::Header as Header>::Number, <Block as Block>::Hash, <Block as Block>::Header, SignedBlock<Block>> for Chain<Block, Client> where
    Block: BlockT + 'static,
    Client: HeaderBackend<Block> + BlockchainEvents<Block> + 'static, 
[src]

type Metadata = Metadata

Loading content...