pub trait ChainApi<Number, Hash, Header, SignedBlock>: 'static + Send + Sync {
type Metadata: PubSubMetadata;
fn header(
&self,
hash: Option<Hash>
) -> Box<dyn Future<Error = Error, Item = Option<Header>> + Send + 'static, Global>ⓘNotable traits for Box<R, Global>impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
;
fn block(
&self,
hash: Option<Hash>
) -> Box<dyn Future<Error = Error, Item = Option<SignedBlock>> + Send + 'static, Global>ⓘNotable traits for Box<R, Global>impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
;
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
Number: 'static + Send + Sync,
Hash: 'static + Send + Sync + Serialize + DeserializeOwned,
Header: 'static + Send + Sync + Serialize,
SignedBlock: 'static + Send + Sync + Serialize,
{ ... }
}
Expand description
Substrate blockchain API
Associated Types
type Metadata: PubSubMetadata
type Metadata: PubSubMetadata
RPC metadata
Required methods
fn header(
&self,
hash: Option<Hash>
) -> Box<dyn Future<Error = Error, Item = Option<Header>> + Send + 'static, Global>ⓘNotable traits for Box<R, Global>impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
fn header(
&self,
hash: Option<Hash>
) -> Box<dyn Future<Error = Error, Item = Option<Header>> + Send + 'static, Global>ⓘNotable traits for Box<R, Global>impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
Get header of a relay chain block.
fn block(
&self,
hash: Option<Hash>
) -> Box<dyn Future<Error = Error, Item = Option<SignedBlock>> + Send + 'static, Global>ⓘNotable traits for Box<R, Global>impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
fn block(
&self,
hash: Option<Hash>
) -> Box<dyn Future<Error = Error, Item = Option<SignedBlock>> + Send + 'static, Global>ⓘNotable traits for Box<R, Global>impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
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
fn unsubscribe_all_heads(
&self,
metadata: Option<Self::Metadata>,
id: SubscriptionId
) -> Result<bool, Error>
fn unsubscribe_all_heads(
&self,
metadata: Option<Self::Metadata>,
id: SubscriptionId
) -> Result<bool, Error>
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
fn unsubscribe_new_heads(
&self,
metadata: Option<Self::Metadata>,
id: SubscriptionId
) -> Result<bool, Error>
fn unsubscribe_new_heads(
&self,
metadata: Option<Self::Metadata>,
id: SubscriptionId
) -> Result<bool, Error>
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
fn unsubscribe_finalized_heads(
&self,
metadata: Option<Self::Metadata>,
id: SubscriptionId
) -> Result<bool, Error>
fn unsubscribe_finalized_heads(
&self,
metadata: Option<Self::Metadata>,
id: SubscriptionId
) -> Result<bool, Error>
Unsubscribe from finalized head subscription.
Provided methods
Create an IoDelegate
, wiring rpc calls to the trait methods.