Struct sc_service::client::Client [−][src]
pub struct Client<B, E, Block, RA> where
Block: BlockT, { /* fields omitted */ }
Expand description
Substrate Client
Implementations
pub fn new(
backend: Arc<B>,
executor: E,
build_genesis_storage: &dyn BuildStorage,
fork_blocks: ForkBlocks<Block>,
bad_blocks: BadBlocks<Block>,
execution_extensions: ExecutionExtensions<Block>,
prometheus_registry: Option<Registry>,
telemetry: Option<TelemetryHandle>,
config: ClientConfig<Block>
) -> Result<Self>
pub fn new(
backend: Arc<B>,
executor: E,
build_genesis_storage: &dyn BuildStorage,
fork_blocks: ForkBlocks<Block>,
bad_blocks: BadBlocks<Block>,
execution_extensions: ExecutionExtensions<Block>,
prometheus_registry: Option<Registry>,
telemetry: Option<TelemetryHandle>,
config: ClientConfig<Block>
) -> Result<Self>
Creates new Substrate Client with given blockchain and code executor.
pub fn import_notification_sinks(
&self
) -> &Mutex<Vec<TracingUnboundedSender<BlockImportNotification<Block>>>>
pub fn import_notification_sinks(
&self
) -> &Mutex<Vec<TracingUnboundedSender<BlockImportNotification<Block>>>>
returns a reference to the block import notification sinks useful for test environments.
pub fn finality_notification_sinks(
&self
) -> &Mutex<Vec<TracingUnboundedSender<FinalityNotification<Block>>>>
pub fn finality_notification_sinks(
&self
) -> &Mutex<Vec<TracingUnboundedSender<FinalityNotification<Block>>>>
returns a reference to the finality notification sinks useful for test environments.
Get a reference to the state at a given block.
Get the RuntimeVersion at a given block.
pub fn header_proof_with_cht_size(
&self,
id: &BlockId<Block>,
cht_size: NumberFor<Block>
) -> Result<(Block::Header, StorageProof)>
pub fn header_proof_with_cht_size(
&self,
id: &BlockId<Block>,
cht_size: NumberFor<Block>
) -> Result<(Block::Header, StorageProof)>
Reads given header and generates CHT-based header proof for CHT of given size.
pub fn key_changes_proof_with_cht_size(
&self,
first: Block::Hash,
last: Block::Hash,
min: Block::Hash,
max: Block::Hash,
storage_key: Option<&PrefixedStorageKey>,
key: &StorageKey,
cht_size: NumberFor<Block>
) -> Result<ChangesProof<Block::Header>>
pub fn key_changes_proof_with_cht_size(
&self,
first: Block::Hash,
last: Block::Hash,
min: Block::Hash,
max: Block::Hash,
storage_key: Option<&PrefixedStorageKey>,
key: &StorageKey,
cht_size: NumberFor<Block>
) -> Result<ChangesProof<Block::Header>>
Does the same work as key_changes_proof
, but assumes that CHTs are of passed size.
Attempts to revert the chain by n
blocks guaranteeing that no block is
reverted past the last finalized block. Returns the number of blocks
that were successfully reverted.
Attempts to revert the chain by n
blocks disregarding finality. This method will revert
any finalized blocks as requested and can potentially leave the node in an inconsistent
state. Other modules in the system that persist data and that rely on finality
(e.g. consensus parts) will be unaffected by the revert. Use this method with caution and
making sure that no other data needs to be reverted for consistency aside from the block
data. If blacklist
is set to true, will also blacklist reverted blocks from finalizing
again. The blacklist is reset upon client restart.
Returns the number of blocks that were successfully reverted.
Get blockchain info.
Get block status.
Get block header by id.
Get block body by id.
Trait Implementations
impl<B, E, Block, RA> AuxStore for Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block>,
Block: BlockT,
Self: ProvideRuntimeApi<Block>,
<Self as ProvideRuntimeApi<Block>>::Api: CoreApi<Block>,
impl<B, E, Block, RA> AuxStore for Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block>,
Block: BlockT,
Self: ProvideRuntimeApi<Block>,
<Self as ProvideRuntimeApi<Block>>::Api: CoreApi<Block>,
Insert auxiliary data into key-value store.
impl<B, E, Block, RA> AuxStore for &Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block>,
Block: BlockT,
Client<B, E, Block, RA>: ProvideRuntimeApi<Block>,
<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api: CoreApi<Block>,
impl<B, E, Block, RA> AuxStore for &Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block>,
Block: BlockT,
Client<B, E, Block, RA>: ProvideRuntimeApi<Block>,
<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api: CoreApi<Block>,
Insert auxiliary data into key-value store. Read more
impl<B, E, Block, RA> BlockBackend<Block> for Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block>,
Block: BlockT,
impl<B, E, Block, RA> BlockBackend<Block> for Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block>,
Block: BlockT,
Get block body by ID. Returns None
if the body is not stored.
Get full block by id.
Get block status.
Get block justifications for the block with the given id.
Get block hash by number.
Get single indexed transaction by content hash. Read more
Check if transaction index exists.
impl<B, E, Block, RA> BlockBuilderProvider<B, Block, Client<B, E, Block, RA>> for Client<B, E, Block, RA> where
B: Backend<Block> + Send + Sync + 'static,
E: CallExecutor<Block> + Send + Sync + 'static,
Block: BlockT,
Self: ChainHeaderBackend<Block> + ProvideRuntimeApi<Block>,
<Self as ProvideRuntimeApi<Block>>::Api: ApiExt<Block, StateBackend = StateBackendFor<B, Block>> + BlockBuilderApi<Block>,
impl<B, E, Block, RA> BlockBuilderProvider<B, Block, Client<B, E, Block, RA>> for Client<B, E, Block, RA> where
B: Backend<Block> + Send + Sync + 'static,
E: CallExecutor<Block> + Send + Sync + 'static,
Block: BlockT,
Self: ChainHeaderBackend<Block> + ProvideRuntimeApi<Block>,
<Self as ProvideRuntimeApi<Block>>::Api: ApiExt<Block, StateBackend = StateBackendFor<B, Block>> + BlockBuilderApi<Block>,
fn new_block_at<R: Into<RecordProof>>(
&self,
parent: &BlockId<Block>,
inherent_digests: DigestFor<Block>,
record_proof: R
) -> Result<BlockBuilder<'_, Block, Self, B>>
fn new_block_at<R: Into<RecordProof>>(
&self,
parent: &BlockId<Block>,
inherent_digests: DigestFor<Block>,
record_proof: R
) -> Result<BlockBuilder<'_, Block, Self, B>>
Create a new block, built on top of parent
. Read more
fn new_block(
&self,
inherent_digests: DigestFor<Block>
) -> Result<BlockBuilder<'_, Block, Self, B>>
fn new_block(
&self,
inherent_digests: DigestFor<Block>
) -> Result<BlockBuilder<'_, Block, Self, B>>
Create a new block, built on the head of the chain.
Convert the given block_id
to the corresponding block hash.
impl<'impl0, B, E, Block, RA> BlockImport<Block> for &'impl0 Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block> + Send + Sync,
Block: BlockT,
Client<B, E, Block, RA>: ProvideRuntimeApi<Block>,
<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api: CoreApi<Block> + ApiExt<Block, StateBackend = B::State>,
RA: Sync + Send,
TransactionFor<B, Block>: Send + 'static,
impl<'impl0, B, E, Block, RA> BlockImport<Block> for &'impl0 Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block> + Send + Sync,
Block: BlockT,
Client<B, E, Block, RA>: ProvideRuntimeApi<Block>,
<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api: CoreApi<Block> + ApiExt<Block, StateBackend = B::State>,
RA: Sync + Send,
TransactionFor<B, Block>: Send + 'static,
NOTE: only use this implementation when you are sure there are NO consensus-level BlockImport objects. Otherwise, importing blocks directly into the client would be bypassing important verification work.
fn import_block<'life0, 'async_trait>(
&'life0 mut self,
import_block: BlockImportParams<Block, TransactionFor<B, Block>>,
new_cache: HashMap<CacheKeyId, Vec<u8>>
) -> Pin<Box<dyn Future<Output = Result<ImportResult, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn import_block<'life0, 'async_trait>(
&'life0 mut self,
import_block: BlockImportParams<Block, TransactionFor<B, Block>>,
new_cache: HashMap<CacheKeyId, Vec<u8>>
) -> Pin<Box<dyn Future<Output = Result<ImportResult, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Import a checked and validated block. If a justification is provided in
BlockImportParams
then finalized
must be true.
NOTE: only use this implementation when there are NO consensus-level BlockImport objects. Otherwise, importing blocks directly into the client would be bypassing important verification work.
If you are not sure that there are no BlockImport objects provided by the consensus algorithm, don’t use this function.
fn check_block<'life0, 'async_trait>(
&'life0 mut self,
block: BlockCheckParams<Block>
) -> Pin<Box<dyn Future<Output = Result<ImportResult, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn check_block<'life0, 'async_trait>(
&'life0 mut self,
block: BlockCheckParams<Block>
) -> Pin<Box<dyn Future<Output = Result<ImportResult, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Check block preconditions.
type Error = ConsensusError
type Error = ConsensusError
The error type.
type Transaction = TransactionFor<B, Block>
type Transaction = TransactionFor<B, Block>
The transaction type used by the backend.
impl<B, E, Block, RA> BlockImport<Block> for Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block> + Send + Sync,
Block: BlockT,
Self: ProvideRuntimeApi<Block>,
<Self as ProvideRuntimeApi<Block>>::Api: CoreApi<Block> + ApiExt<Block, StateBackend = B::State>,
RA: Sync + Send,
TransactionFor<B, Block>: Send + 'static,
impl<B, E, Block, RA> BlockImport<Block> for Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block> + Send + Sync,
Block: BlockT,
Self: ProvideRuntimeApi<Block>,
<Self as ProvideRuntimeApi<Block>>::Api: CoreApi<Block> + ApiExt<Block, StateBackend = B::State>,
RA: Sync + Send,
TransactionFor<B, Block>: Send + 'static,
type Error = ConsensusError
type Error = ConsensusError
The error type.
type Transaction = TransactionFor<B, Block>
type Transaction = TransactionFor<B, Block>
The transaction type used by the backend.
fn import_block<'life0, 'async_trait>(
&'life0 mut self,
import_block: BlockImportParams<Block, Self::Transaction>,
new_cache: HashMap<CacheKeyId, Vec<u8>>
) -> Pin<Box<dyn Future<Output = Result<ImportResult, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn import_block<'life0, 'async_trait>(
&'life0 mut self,
import_block: BlockImportParams<Block, Self::Transaction>,
new_cache: HashMap<CacheKeyId, Vec<u8>>
) -> Pin<Box<dyn Future<Output = Result<ImportResult, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Import a block. Read more
fn check_block<'life0, 'async_trait>(
&'life0 mut self,
block: BlockCheckParams<Block>
) -> Pin<Box<dyn Future<Output = Result<ImportResult, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn check_block<'life0, 'async_trait>(
&'life0 mut self,
block: BlockCheckParams<Block>
) -> Pin<Box<dyn Future<Output = Result<ImportResult, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Check block preconditions.
type Type = Block
type Type = Block
The type of the block.
impl<B, E, Block, RA> BlockchainEvents<Block> for Client<B, E, Block, RA> where
E: CallExecutor<Block>,
Block: BlockT,
impl<B, E, Block, RA> BlockchainEvents<Block> for Client<B, E, Block, RA> where
E: CallExecutor<Block>,
Block: BlockT,
Get block import event stream.
fn storage_changes_notification_stream(
&self,
filter_keys: Option<&[StorageKey]>,
child_filter_keys: Option<&[(StorageKey, Option<Vec<StorageKey>>)]>
) -> Result<StorageEventStream<Block::Hash>>
fn storage_changes_notification_stream(
&self,
filter_keys: Option<&[StorageKey]>,
child_filter_keys: Option<&[(StorageKey, Option<Vec<StorageKey>>)]>
) -> Result<StorageEventStream<Block::Hash>>
Get storage changes event stream.
Get a stream of finality notifications. Not guaranteed to be fired for every finalized block. Read more
type StateBackend = B::State
type StateBackend = B::State
The state backend that is used to store the block states.
fn call_api_at<'a, R: Encode + Decode + PartialEq, NC: FnOnce() -> Result<R, ApiError> + UnwindSafe>(
&self,
params: CallApiAtParams<'a, Block, NC, B::State>
) -> Result<NativeOrEncoded<R>, ApiError>
fn call_api_at<'a, R: Encode + Decode + PartialEq, NC: FnOnce() -> Result<R, ApiError> + UnwindSafe>(
&self,
params: CallApiAtParams<'a, Block, NC, B::State>
) -> Result<NativeOrEncoded<R>, ApiError>
Calls the given api function with the given encoded arguments at the given block and returns the encoded result. Read more
Returns the runtime version at the given block.
Retrieve the status of the block denoted by the given BlockId
.
impl<B, E, Block, RA> ExecutorProvider<Block> for Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block>,
Block: BlockT,
impl<B, E, Block, RA> ExecutorProvider<Block> for Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block>,
Block: BlockT,
type Executor = E
type Executor = E
executor instance
Get a reference to the execution extensions.
fn apply_finality(
&self,
operation: &mut ClientImportOperation<Block, B>,
id: BlockId<Block>,
justification: Option<Justification>,
notify: bool
) -> Result<()>
fn apply_finality(
&self,
operation: &mut ClientImportOperation<Block, B>,
id: BlockId<Block>,
justification: Option<Justification>,
notify: bool
) -> Result<()>
Mark all blocks up to given as finalized in operation. Read more
fn finalize_block(
&self,
id: BlockId<Block>,
justification: Option<Justification>,
notify: bool
) -> Result<()>
fn finalize_block(
&self,
id: BlockId<Block>,
justification: Option<Justification>,
notify: bool
) -> Result<()>
Finalize a block. Read more
fn apply_finality(
&self,
operation: &mut ClientImportOperation<Block, B>,
id: BlockId<Block>,
justification: Option<Justification>,
notify: bool
) -> Result<()>
fn apply_finality(
&self,
operation: &mut ClientImportOperation<Block, B>,
id: BlockId<Block>,
justification: Option<Justification>,
notify: bool
) -> Result<()>
Mark all blocks up to given as finalized in operation. Read more
fn finalize_block(
&self,
id: BlockId<Block>,
justification: Option<Justification>,
notify: bool
) -> Result<()>
fn finalize_block(
&self,
id: BlockId<Block>,
justification: Option<Justification>,
notify: bool
) -> Result<()>
Finalize a block. Read more
impl<B, E, Block, RA> HeaderBackend<Block> for Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block> + Send + Sync,
Block: BlockT,
RA: Send + Sync,
impl<B, E, Block, RA> HeaderBackend<Block> for Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block> + Send + Sync,
Block: BlockT,
RA: Send + Sync,
Get block header. Returns None
if block is not found.
Get block status.
Get block number by hash. Returns None
if the header is not in the chain.
Get block hash by number. Returns None
if the header is not in the chain.
Convert an arbitrary block ID into a block hash.
Convert an arbitrary block ID into a block hash.
Get block header. Returns UnknownBlock
error if block is not found.
Convert an arbitrary block ID into a block number. Returns UnknownBlock
error if block is
not found. Read more
impl<B, E, Block, RA> HeaderBackend<Block> for &Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block> + Send + Sync,
Block: BlockT,
RA: Send + Sync,
impl<B, E, Block, RA> HeaderBackend<Block> for &Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block> + Send + Sync,
Block: BlockT,
RA: Send + Sync,
Get block header. Returns None
if block is not found.
Get block status.
Get block number by hash. Returns None
if the header is not in the chain.
Get block hash by number. Returns None
if the header is not in the chain.
Convert an arbitrary block ID into a block hash.
Convert an arbitrary block ID into a block hash.
Get block header. Returns UnknownBlock
error if block is not found.
Convert an arbitrary block ID into a block number. Returns UnknownBlock
error if block is
not found. Read more
impl<B, E, Block, RA> HeaderMetadata<Block> for Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block>,
Block: BlockT,
impl<B, E, Block, RA> HeaderMetadata<Block> for Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block>,
Block: BlockT,
fn header_metadata(
&self,
hash: Block::Hash
) -> Result<CachedHeaderMetadata<Block>, Self::Error>
impl<BE, E, B, RA> IndexedBody<B> for Client<BE, E, B, RA> where
BE: Backend<B>,
E: CallExecutor<B>,
B: BlockT,
impl<BE, E, B, RA> IndexedBody<B> for Client<BE, E, B, RA> where
BE: Backend<B>,
E: CallExecutor<B>,
B: BlockT,
impl<B, E, Block, RA> LockImportRun<Block, B> for Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block>,
Block: BlockT,
impl<B, E, Block, RA> LockImportRun<Block, B> for Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block>,
Block: BlockT,
fn lock_import_and_run<R, Err, F>(&self, f: F) -> Result<R, Err> where
F: FnOnce(&mut ClientImportOperation<Block, B>) -> Result<R, Err>,
Err: From<Error>,
fn lock_import_and_run<R, Err, F>(&self, f: F) -> Result<R, Err> where
F: FnOnce(&mut ClientImportOperation<Block, B>) -> Result<R, Err>,
Err: From<Error>,
Lock the import lock, and run operations inside.
impl<B, E, Block, RA> LockImportRun<Block, B> for &Client<B, E, Block, RA> where
Block: BlockT,
B: Backend<Block>,
E: CallExecutor<Block>,
impl<B, E, Block, RA> LockImportRun<Block, B> for &Client<B, E, Block, RA> where
Block: BlockT,
B: Backend<Block>,
E: CallExecutor<Block>,
fn lock_import_and_run<R, Err, F>(&self, f: F) -> Result<R, Err> where
F: FnOnce(&mut ClientImportOperation<Block, B>) -> Result<R, Err>,
Err: From<Error>,
fn lock_import_and_run<R, Err, F>(&self, f: F) -> Result<R, Err> where
F: FnOnce(&mut ClientImportOperation<Block, B>) -> Result<R, Err>,
Err: From<Error>,
Lock the import lock, and run operations inside.
impl<B, E, Block, RA> ProofProvider<Block> for Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block>,
Block: BlockT,
impl<B, E, Block, RA> ProofProvider<Block> for Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block>,
Block: BlockT,
fn read_proof(
&self,
id: &BlockId<Block>,
keys: &mut dyn Iterator<Item = &[u8]>
) -> Result<StorageProof>
fn read_proof(
&self,
id: &BlockId<Block>,
keys: &mut dyn Iterator<Item = &[u8]>
) -> Result<StorageProof>
Reads storage value at a given block + key, returning read proof.
fn read_child_proof(
&self,
id: &BlockId<Block>,
child_info: &ChildInfo,
keys: &mut dyn Iterator<Item = &[u8]>
) -> Result<StorageProof>
fn read_child_proof(
&self,
id: &BlockId<Block>,
child_info: &ChildInfo,
keys: &mut dyn Iterator<Item = &[u8]>
) -> Result<StorageProof>
Reads child storage value at a given block + storage_key + key, returning read proof. Read more
Execute a call to a contract on top of state in a block of given hash AND returning execution proof. Read more
Reads given header and generates CHT-based header proof.
fn key_changes_proof(
&self,
first: Block::Hash,
last: Block::Hash,
min: Block::Hash,
max: Block::Hash,
storage_key: Option<&PrefixedStorageKey>,
key: &StorageKey
) -> Result<ChangesProof<Block::Header>>
fn key_changes_proof(
&self,
first: Block::Hash,
last: Block::Hash,
min: Block::Hash,
max: Block::Hash,
storage_key: Option<&PrefixedStorageKey>,
key: &StorageKey
) -> Result<ChangesProof<Block::Header>>
Get proof for computation of (block, extrinsic) pairs where key has been changed at given
blocks range. min
is the hash of the first block, which changes trie root is known to the
requester - when we’re using changes tries from ascendants of this block, we should provide
proofs for changes tries roots max
is the hash of the last block known to the requester -
we can’t use changes tries from descendants of this block.
Works only for runtimes that are supporting changes tries. Read more
Given a BlockId
iterate over all storage values starting at start_key
exclusively,
building proofs until size limit is reached. Returns combined proof and the number of
collected keys. Read more
Given a BlockId
iterate over all storage values starting at start_key
.
Returns collected keys and values. Read more
impl<B, E, Block, RA> ProvideCache<Block> for Client<B, E, Block, RA> where
B: Backend<Block>,
Block: BlockT,
impl<B, E, Block, RA> ProvideCache<Block> for Client<B, E, Block, RA> where
B: Backend<Block>,
Block: BlockT,
impl<B, E, Block, RA> ProvideRuntimeApi<Block> for Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block, Backend = B> + Send + Sync,
Block: BlockT,
RA: ConstructRuntimeApi<Block, Self>,
impl<B, E, Block, RA> ProvideRuntimeApi<Block> for Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block, Backend = B> + Send + Sync,
Block: BlockT,
RA: ConstructRuntimeApi<Block, Self>,
type Api = <RA as ConstructRuntimeApi<Block, Self>>::RuntimeApi
type Api = <RA as ConstructRuntimeApi<Block, Self>>::RuntimeApi
The concrete type that provides the api.
Returns the runtime api.
The returned instance will keep track of modifications to the storage. Any successful
call to an api function, will commit
its changes to an internal buffer. Otherwise,
the modifications will be discarded
. The modifications will not be applied to the
storage, even on a commit
. Read more
impl<B, E, Block, RA> ProvideUncles<Block> for Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block>,
Block: BlockT,
impl<B, E, Block, RA> ProvideUncles<Block> for Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block>,
Block: BlockT,
impl<B, E, Block, RA> StorageProvider<Block, B> for Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block>,
Block: BlockT,
impl<B, E, Block, RA> StorageProvider<Block, B> for Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block>,
Block: BlockT,
fn storage_keys(
&self,
id: &BlockId<Block>,
key_prefix: &StorageKey
) -> Result<Vec<StorageKey>>
fn storage_keys(
&self,
id: &BlockId<Block>,
key_prefix: &StorageKey
) -> Result<Vec<StorageKey>>
Given a BlockId
and a key prefix, return the matching storage keys in that block.
fn storage_pairs(
&self,
id: &BlockId<Block>,
key_prefix: &StorageKey
) -> Result<Vec<(StorageKey, StorageData)>>
fn storage_pairs(
&self,
id: &BlockId<Block>,
key_prefix: &StorageKey
) -> Result<Vec<(StorageKey, StorageData)>>
Given a BlockId
and a key prefix, return the matching child storage keys and values in
that block. Read more
fn storage_keys_iter<'a>(
&self,
id: &BlockId<Block>,
prefix: Option<&'a StorageKey>,
start_key: Option<&StorageKey>
) -> Result<KeyIterator<'a, B::State, Block>>
fn storage_keys_iter<'a>(
&self,
id: &BlockId<Block>,
prefix: Option<&'a StorageKey>,
start_key: Option<&StorageKey>
) -> Result<KeyIterator<'a, B::State, Block>>
Given a BlockId
and a key prefix, return a KeyIterator
iterates matching storage keys in
that block. Read more
fn child_storage_keys_iter<'a>(
&self,
id: &BlockId<Block>,
child_info: ChildInfo,
prefix: Option<&'a StorageKey>,
start_key: Option<&StorageKey>
) -> Result<KeyIterator<'a, B::State, Block>>
fn child_storage_keys_iter<'a>(
&self,
id: &BlockId<Block>,
child_info: ChildInfo,
prefix: Option<&'a StorageKey>,
start_key: Option<&StorageKey>
) -> Result<KeyIterator<'a, B::State, Block>>
Given a BlockId
and a key prefix
and a child storage key,
return a KeyIterator
that iterates matching storage keys in that block. Read more
Given a BlockId
and a key, return the value under the key in that block.
Given a BlockId
and a key, return the value under the hash in that block.
fn child_storage_keys(
&self,
id: &BlockId<Block>,
child_info: &ChildInfo,
key_prefix: &StorageKey
) -> Result<Vec<StorageKey>>
fn child_storage_keys(
&self,
id: &BlockId<Block>,
child_info: &ChildInfo,
key_prefix: &StorageKey
) -> Result<Vec<StorageKey>>
Given a BlockId
, a key prefix, and a child storage key, return the matching child storage
keys. Read more
fn child_storage(
&self,
id: &BlockId<Block>,
child_info: &ChildInfo,
key: &StorageKey
) -> Result<Option<StorageData>>
fn child_storage(
&self,
id: &BlockId<Block>,
child_info: &ChildInfo,
key: &StorageKey
) -> Result<Option<StorageData>>
Given a BlockId
, a key and a child storage key, return the value under the key in that
block. Read more
fn child_storage_hash(
&self,
id: &BlockId<Block>,
child_info: &ChildInfo,
key: &StorageKey
) -> Result<Option<Block::Hash>>
fn child_storage_hash(
&self,
id: &BlockId<Block>,
child_info: &ChildInfo,
key: &StorageKey
) -> Result<Option<Block::Hash>>
Given a BlockId
, a key and a child storage key, return the hash under the key in that
block. Read more
Get longest range within [first; last] that is possible to use in key_changes
and key_changes_proof
calls.
Range could be shortened from the beginning if some changes tries have been pruned.
Returns Ok(None) if changes tries are not supported. Read more
fn key_changes(
&self,
first: NumberFor<Block>,
last: BlockId<Block>,
storage_key: Option<&PrefixedStorageKey>,
key: &StorageKey
) -> Result<Vec<(NumberFor<Block>, u32)>>
fn key_changes(
&self,
first: NumberFor<Block>,
last: BlockId<Block>,
storage_key: Option<&PrefixedStorageKey>,
key: &StorageKey
) -> Result<Vec<(NumberFor<Block>, u32)>>
Get pairs of (block, extrinsic) where key has been changed at given blocks range. Works only for runtimes that are supporting changes tries. Read more
impl<B, E, Block, RA> UsageProvider<Block> for Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block>,
Block: BlockT,
impl<B, E, Block, RA> UsageProvider<Block> for Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block>,
Block: BlockT,
Get usage info about current client.
Auto Trait Implementations
impl<B, E, Block, RA> !RefUnwindSafe for Client<B, E, Block, RA>
impl<B, E, Block, RA> Unpin for Client<B, E, Block, RA> where
E: Unpin,
RA: Unpin,
<Block as Block>::Hash: Unpin,
<<Block as Block>::Header as Header>::Number: Unpin,
impl<B, E, Block, RA> !UnwindSafe for Client<B, E, Block, RA>
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
type Output = T
type Output = T
Should always be Self
The counterpart to unchecked_from
.
Consume self to return an equivalent value of T
.
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
impl<Block, T> Client<Block> for T where
Block: Block,
T: HeaderBackend<Block> + ProofProvider<Block> + BlockIdTo<Block, Error = Error> + BlockBackend<Block> + HeaderMetadata<Block, Error = Error> + Send + Sync,