Trait sc_rpc::chain::ChainApi [−][src]
pub trait ChainApi<Number, Hash, Header, SignedBlock>: 'static + Send + Sync { type Metadata: PubSubMetadata; fn header(
&self,
hash: Option<Hash>
) -> Box<dyn Future<Item = Option<Header>, Error = Error> + Send + 'static, Global>; fn block(
&self,
hash: Option<Hash>
) -> Box<dyn Future<Item = Option<SignedBlock>, Error = Error> + Send + 'static, Global>; 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,
metadata: Self::Metadata,
subscriber: Subscriber<Header, Error>
); fn unsubscribe_all_heads(
&self,
metadata: Option<Self::Metadata>,
id: SubscriptionId
) -> Result<bool, Error>; fn subscribe_new_heads(
&self,
metadata: Self::Metadata,
subscriber: Subscriber<Header, Error>
); fn unsubscribe_new_heads(
&self,
metadata: Option<Self::Metadata>,
id: SubscriptionId
) -> Result<bool, Error>; fn subscribe_finalized_heads(
&self,
metadata: Self::Metadata,
subscriber: Subscriber<Header, Error>
); fn unsubscribe_finalized_heads(
&self,
metadata: Option<Self::Metadata>,
id: SubscriptionId
) -> Result<bool, Error>; 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, { ... } }
Expand description
Substrate blockchain API
Associated Types
Required methods
Get header of a relay chain block.
Get header and body of a relay chain block.
fn block_hash(
&self,
hash: Option<ListOrValue<NumberOrHex>>
) -> Result<ListOrValue<Option<Hash>>, Error>
fn block_hash(
&self,
hash: Option<ListOrValue<NumberOrHex>>
) -> Result<ListOrValue<Option<Hash>>, Error>
Get hash of the n-th block in the canon chain.
By default returns latest block hash.
fn finalized_head(&self) -> Result<Hash, Error>
fn finalized_head(&self) -> Result<Hash, Error>
Get hash of the last finalized block in the canon chain.
fn subscribe_all_heads(
&self,
metadata: Self::Metadata,
subscriber: Subscriber<Header, Error>
)
fn subscribe_all_heads(
&self,
metadata: Self::Metadata,
subscriber: Subscriber<Header, Error>
)
All head subscription
Unsubscribe from all head subscription.
fn subscribe_new_heads(
&self,
metadata: Self::Metadata,
subscriber: Subscriber<Header, Error>
)
fn subscribe_new_heads(
&self,
metadata: Self::Metadata,
subscriber: Subscriber<Header, Error>
)
New head subscription
Unsubscribe from new head subscription.
fn subscribe_finalized_heads(
&self,
metadata: Self::Metadata,
subscriber: Subscriber<Header, Error>
)
fn subscribe_finalized_heads(
&self,
metadata: Self::Metadata,
subscriber: Subscriber<Header, Error>
)
Finalized head subscription
Provided methods
Create an IoDelegate
, wiring rpc calls to the trait methods.
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,