pub trait ChainApiBackend: Send + Sync {
// Required methods
fn header<'life0, 'async_trait>(
&'life0 self,
hash: H256,
) -> Pin<Box<dyn Future<Output = Result<Option<Header<u32, BlakeTwo256>>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Info<Block<Header<u32, BlakeTwo256>, OpaqueExtrinsic>>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn number<'life0, 'async_trait>(
&'life0 self,
hash: H256,
) -> Pin<Box<dyn Future<Output = Result<Option<<Header<u32, BlakeTwo256> as Header>::Number>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn hash<'life0, 'async_trait>(
&'life0 self,
number: <<Block<Header<u32, BlakeTwo256>, OpaqueExtrinsic> as Block>::Header as Header>::Number,
) -> Pin<Box<dyn Future<Output = Result<Option<H256>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
}
Expand description
Offers header utilities.
This is a async wrapper trait for [‘HeaderBackend’] to be used with the
ChainApiSubsystem
.
Required Methods§
sourcefn header<'life0, 'async_trait>(
&'life0 self,
hash: H256,
) -> Pin<Box<dyn Future<Output = Result<Option<Header<u32, BlakeTwo256>>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn header<'life0, 'async_trait>(
&'life0 self,
hash: H256,
) -> Pin<Box<dyn Future<Output = Result<Option<Header<u32, BlakeTwo256>>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Get block header. Returns None
if block is not found.
sourcefn info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Info<Block<Header<u32, BlakeTwo256>, OpaqueExtrinsic>>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Info<Block<Header<u32, BlakeTwo256>, OpaqueExtrinsic>>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Get blockchain info.
sourcefn number<'life0, 'async_trait>(
&'life0 self,
hash: H256,
) -> Pin<Box<dyn Future<Output = Result<Option<<Header<u32, BlakeTwo256> as Header>::Number>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn number<'life0, 'async_trait>(
&'life0 self,
hash: H256,
) -> Pin<Box<dyn Future<Output = Result<Option<<Header<u32, BlakeTwo256> as Header>::Number>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Get block number by hash. Returns None
if the header is not in the chain.
sourcefn hash<'life0, 'async_trait>(
&'life0 self,
number: <<Block<Header<u32, BlakeTwo256>, OpaqueExtrinsic> as Block>::Header as Header>::Number,
) -> Pin<Box<dyn Future<Output = Result<Option<H256>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn hash<'life0, 'async_trait>(
&'life0 self,
number: <<Block<Header<u32, BlakeTwo256>, OpaqueExtrinsic> as Block>::Header as Header>::Number,
) -> Pin<Box<dyn Future<Output = Result<Option<H256>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Get block hash by number. Returns None
if the header is not in the chain.