Struct substrate_test_client::client::Client [−][src]
pub struct Client<B, E, Block, RA> where
Block: Block, { /* fields omitted */ }
Expand description
Substrate Client
Implementations
pub fn new(
backend: Arc<B>,
executor: E,
build_genesis_storage: &dyn BuildStorage,
fork_blocks: Option<Vec<(<<Block as Block>::Header as Header>::Number, <Block as Block>::Hash), Global>>,
bad_blocks: Option<HashSet<<Block as Block>::Hash, RandomState>>,
execution_extensions: ExecutionExtensions<Block>,
prometheus_registry: Option<Registry>,
telemetry: Option<TelemetryHandle>,
config: ClientConfig<Block>
) -> Result<Client<B, E, Block, RA>, Error>
pub fn new(
backend: Arc<B>,
executor: E,
build_genesis_storage: &dyn BuildStorage,
fork_blocks: Option<Vec<(<<Block as Block>::Header as Header>::Number, <Block as Block>::Hash), Global>>,
bad_blocks: Option<HashSet<<Block as Block>::Hash, RandomState>>,
execution_extensions: ExecutionExtensions<Block>,
prometheus_registry: Option<Registry>,
telemetry: Option<TelemetryHandle>,
config: ClientConfig<Block>
) -> Result<Client<B, E, Block, RA>, Error>
Creates new Substrate Client with given blockchain and code executor.
pub fn import_notification_sinks(
&self
) -> &Mutex<RawMutex, Vec<TracingUnboundedSender<BlockImportNotification<Block>>, Global>>
pub fn import_notification_sinks(
&self
) -> &Mutex<RawMutex, Vec<TracingUnboundedSender<BlockImportNotification<Block>>, Global>>
returns a reference to the block import notification sinks useful for test environments.
pub fn finality_notification_sinks(
&self
) -> &Mutex<RawMutex, Vec<TracingUnboundedSender<FinalityNotification<Block>>, Global>>
pub fn finality_notification_sinks(
&self
) -> &Mutex<RawMutex, Vec<TracingUnboundedSender<FinalityNotification<Block>>, Global>>
returns a reference to the finality notification sinks useful for test environments.
Get a reference to the state at a given block.
Get the code at a given block.
Get the RuntimeVersion at a given block.
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 as Block>::Hash,
last: <Block as Block>::Hash,
min: <Block as Block>::Hash,
max: <Block as Block>::Hash,
storage_key: Option<&PrefixedStorageKey>,
key: &StorageKey,
cht_size: <<Block as Block>::Header as Header>::Number
) -> Result<ChangesProof<<Block as Block>::Header>, Error>
pub fn key_changes_proof_with_cht_size(
&self,
first: <Block as Block>::Hash,
last: <Block as Block>::Hash,
min: <Block as Block>::Hash,
max: <Block as Block>::Hash,
storage_key: Option<&PrefixedStorageKey>,
key: &StorageKey,
cht_size: <<Block as Block>::Header as Header>::Number
) -> Result<ChangesProof<<Block as Block>::Header>, Error>
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
Block: Block,
E: CallExecutor<Block>,
B: Backend<Block>,
Client<B, E, Block, RA>: ProvideRuntimeApi<Block>,
<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api: Core<Block>,
impl<'_, B, E, Block, RA> AuxStore for &'_ Client<B, E, Block, RA> where
Block: Block,
E: CallExecutor<Block>,
B: Backend<Block>,
Client<B, E, Block, RA>: ProvideRuntimeApi<Block>,
<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api: Core<Block>,
Insert auxiliary data into key-value store. Read more
impl<B, E, Block, RA> AuxStore for Client<B, E, Block, RA> where
Block: Block,
E: CallExecutor<Block>,
B: Backend<Block>,
Client<B, E, Block, RA>: ProvideRuntimeApi<Block>,
<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api: Core<Block>,
impl<B, E, Block, RA> AuxStore for Client<B, E, Block, RA> where
Block: Block,
E: CallExecutor<Block>,
B: Backend<Block>,
Client<B, E, Block, RA>: ProvideRuntimeApi<Block>,
<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api: Core<Block>,
Insert auxiliary data into key-value store.
impl<B, E, Block, RA> BlockBackend<Block> for Client<B, E, Block, RA> where
Block: Block,
E: CallExecutor<Block>,
B: Backend<Block>,
impl<B, E, Block, RA> BlockBackend<Block> for Client<B, E, Block, RA> where
Block: Block,
E: CallExecutor<Block>,
B: Backend<Block>,
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
Block: Block,
E: CallExecutor<Block> + Send + Sync + 'static,
B: Backend<Block> + Send + Sync + 'static,
Client<B, E, Block, RA>: HeaderBackend<Block>,
Client<B, E, Block, RA>: ProvideRuntimeApi<Block>,
<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api: ApiExt<Block>,
<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api: BlockBuilder<Block>,
<<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api as ApiExt<Block>>::StateBackend == <B as Backend<Block>>::State,
impl<B, E, Block, RA> BlockBuilderProvider<B, Block, Client<B, E, Block, RA>> for Client<B, E, Block, RA> where
Block: Block,
E: CallExecutor<Block> + Send + Sync + 'static,
B: Backend<Block> + Send + Sync + 'static,
Client<B, E, Block, RA>: HeaderBackend<Block>,
Client<B, E, Block, RA>: ProvideRuntimeApi<Block>,
<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api: ApiExt<Block>,
<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api: BlockBuilder<Block>,
<<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api as ApiExt<Block>>::StateBackend == <B as Backend<Block>>::State,
pub fn new_block_at<R>(
&self,
parent: &BlockId<Block>,
inherent_digests: Digest<<<Block as Block>::Header as Header>::Hash>,
record_proof: R
) -> Result<BlockBuilder<'_, Block, Client<B, E, Block, RA>, B>, Error> where
R: Into<RecordProof>,
pub fn new_block_at<R>(
&self,
parent: &BlockId<Block>,
inherent_digests: Digest<<<Block as Block>::Header as Header>::Hash>,
record_proof: R
) -> Result<BlockBuilder<'_, Block, Client<B, E, Block, RA>, B>, Error> where
R: Into<RecordProof>,
Create a new block, built on top of parent
. Read more
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
Block: Block,
E: CallExecutor<Block> + Send + Sync,
B: Backend<Block>,
RA: Sync + Send,
Client<B, E, Block, RA>: ProvideRuntimeApi<Block>,
<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api: Core<Block>,
<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api: ApiExt<Block>,
<<B as Backend<Block>>::State as Backend<<<Block as Block>::Header as Header>::Hashing>>::Transaction: Send,
<<B as Backend<Block>>::State as Backend<<<Block as Block>::Header as Header>::Hashing>>::Transaction: 'static,
<<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api as ApiExt<Block>>::StateBackend == <B as Backend<Block>>::State,
impl<'impl0, B, E, Block, RA> BlockImport<Block> for &'impl0 Client<B, E, Block, RA> where
Block: Block,
E: CallExecutor<Block> + Send + Sync,
B: Backend<Block>,
RA: Sync + Send,
Client<B, E, Block, RA>: ProvideRuntimeApi<Block>,
<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api: Core<Block>,
<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api: ApiExt<Block>,
<<B as Backend<Block>>::State as Backend<<<Block as Block>::Header as Header>::Hashing>>::Transaction: Send,
<<B as Backend<Block>>::State as Backend<<<Block as Block>::Header as Header>::Hashing>>::Transaction: 'static,
<<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api as ApiExt<Block>>::StateBackend == <B as Backend<Block>>::State,
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.
pub fn import_block<'life0, 'async_trait>(
&'life0 mut self,
import_block: BlockImportParams<Block, <<B as Backend<Block>>::State as Backend<<<Block as Block>::Header as Header>::Hashing>>::Transaction>,
new_cache: HashMap<[u8; 4], Vec<u8, Global>, RandomState>
) -> Pin<Box<dyn Future<Output = Result<ImportResult, <&'impl0 Client<B, E, Block, RA> as BlockImport<Block>>::Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
&'impl0 Client<B, E, Block, RA>: 'async_trait,
pub fn import_block<'life0, 'async_trait>(
&'life0 mut self,
import_block: BlockImportParams<Block, <<B as Backend<Block>>::State as Backend<<<Block as Block>::Header as Header>::Hashing>>::Transaction>,
new_cache: HashMap<[u8; 4], Vec<u8, Global>, RandomState>
) -> Pin<Box<dyn Future<Output = Result<ImportResult, <&'impl0 Client<B, E, Block, RA> as BlockImport<Block>>::Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
&'impl0 Client<B, E, Block, RA>: '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.
pub fn check_block<'life0, 'async_trait>(
&'life0 mut self,
block: BlockCheckParams<Block>
) -> Pin<Box<dyn Future<Output = Result<ImportResult, <&'impl0 Client<B, E, Block, RA> as BlockImport<Block>>::Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
&'impl0 Client<B, E, Block, RA>: 'async_trait,
pub fn check_block<'life0, 'async_trait>(
&'life0 mut self,
block: BlockCheckParams<Block>
) -> Pin<Box<dyn Future<Output = Result<ImportResult, <&'impl0 Client<B, E, Block, RA> as BlockImport<Block>>::Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
&'impl0 Client<B, E, Block, RA>: 'async_trait,
Check block preconditions.
type Transaction = <<B as Backend<Block>>::State as Backend<<<Block as Block>::Header as Header>::Hashing>>::Transaction
type Transaction = <<B as Backend<Block>>::State as Backend<<<Block as Block>::Header as Header>::Hashing>>::Transaction
The transaction type used by the backend.
impl<B, E, Block, RA> BlockImport<Block> for Client<B, E, Block, RA> where
Block: Block,
E: CallExecutor<Block> + Send + Sync,
B: Backend<Block>,
RA: Sync + Send,
Client<B, E, Block, RA>: ProvideRuntimeApi<Block>,
<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api: Core<Block>,
<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api: ApiExt<Block>,
<<B as Backend<Block>>::State as Backend<<<Block as Block>::Header as Header>::Hashing>>::Transaction: Send,
<<B as Backend<Block>>::State as Backend<<<Block as Block>::Header as Header>::Hashing>>::Transaction: 'static,
<<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api as ApiExt<Block>>::StateBackend == <B as Backend<Block>>::State,
impl<B, E, Block, RA> BlockImport<Block> for Client<B, E, Block, RA> where
Block: Block,
E: CallExecutor<Block> + Send + Sync,
B: Backend<Block>,
RA: Sync + Send,
Client<B, E, Block, RA>: ProvideRuntimeApi<Block>,
<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api: Core<Block>,
<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api: ApiExt<Block>,
<<B as Backend<Block>>::State as Backend<<<Block as Block>::Header as Header>::Hashing>>::Transaction: Send,
<<B as Backend<Block>>::State as Backend<<<Block as Block>::Header as Header>::Hashing>>::Transaction: 'static,
<<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api as ApiExt<Block>>::StateBackend == <B as Backend<Block>>::State,
type Transaction = <<B as Backend<Block>>::State as Backend<<<Block as Block>::Header as Header>::Hashing>>::Transaction
type Transaction = <<B as Backend<Block>>::State as Backend<<<Block as Block>::Header as Header>::Hashing>>::Transaction
The transaction type used by the backend.
pub fn import_block<'life0, 'async_trait>(
&'life0 mut self,
import_block: BlockImportParams<Block, <Client<B, E, Block, RA> as BlockImport<Block>>::Transaction>,
new_cache: HashMap<[u8; 4], Vec<u8, Global>, RandomState>
) -> Pin<Box<dyn Future<Output = Result<ImportResult, <Client<B, E, Block, RA> as BlockImport<Block>>::Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Client<B, E, Block, RA>: 'async_trait,
pub fn import_block<'life0, 'async_trait>(
&'life0 mut self,
import_block: BlockImportParams<Block, <Client<B, E, Block, RA> as BlockImport<Block>>::Transaction>,
new_cache: HashMap<[u8; 4], Vec<u8, Global>, RandomState>
) -> Pin<Box<dyn Future<Output = Result<ImportResult, <Client<B, E, Block, RA> as BlockImport<Block>>::Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Client<B, E, Block, RA>: 'async_trait,
Import a block. Read more
pub fn check_block<'life0, 'async_trait>(
&'life0 mut self,
block: BlockCheckParams<Block>
) -> Pin<Box<dyn Future<Output = Result<ImportResult, <Client<B, E, Block, RA> as BlockImport<Block>>::Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Client<B, E, Block, RA>: 'async_trait,
pub fn check_block<'life0, 'async_trait>(
&'life0 mut self,
block: BlockCheckParams<Block>
) -> Pin<Box<dyn Future<Output = Result<ImportResult, <Client<B, E, Block, RA> as BlockImport<Block>>::Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Client<B, E, Block, RA>: '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
Block: Block,
E: CallExecutor<Block>,
impl<B, E, Block, RA> BlockchainEvents<Block> for Client<B, E, Block, RA> where
Block: Block,
E: CallExecutor<Block>,
pub fn import_notification_stream(
&self
) -> TracingUnboundedReceiver<BlockImportNotification<Block>>
pub fn import_notification_stream(
&self
) -> TracingUnboundedReceiver<BlockImportNotification<Block>>
Get block import event stream.
pub fn storage_changes_notification_stream(
&self,
filter_keys: Option<&[StorageKey]>,
child_filter_keys: Option<&[(StorageKey, Option<Vec<StorageKey, Global>>)]>
) -> Result<TracingUnboundedReceiver<(<Block as Block>::Hash, StorageChangeSet)>, Error>
pub fn storage_changes_notification_stream(
&self,
filter_keys: Option<&[StorageKey]>,
child_filter_keys: Option<&[(StorageKey, Option<Vec<StorageKey, Global>>)]>
) -> Result<TracingUnboundedReceiver<(<Block as Block>::Hash, StorageChangeSet)>, Error>
Get storage changes event stream.
pub fn finality_notification_stream(
&self
) -> TracingUnboundedReceiver<FinalityNotification<Block>>
pub fn finality_notification_stream(
&self
) -> TracingUnboundedReceiver<FinalityNotification<Block>>
Get a stream of finality notifications. Not guaranteed to be fired for every finalized block. Read more
type StateBackend = <B as Backend<Block>>::State
type StateBackend = <B as Backend<Block>>::State
The state backend that is used to store the block states.
pub fn call_api_at<R, NC>(
&self,
params: CallApiAtParams<'a, Block, NC, <B as Backend<Block>>::State>
) -> Result<NativeOrEncoded<R>, ApiError> where
R: Encode + Decode + PartialEq<R>,
NC: FnOnce() -> Result<R, ApiError> + UnwindSafe,
pub fn call_api_at<R, NC>(
&self,
params: CallApiAtParams<'a, Block, NC, <B as Backend<Block>>::State>
) -> Result<NativeOrEncoded<R>, ApiError> where
R: Encode + Decode + PartialEq<R>,
NC: FnOnce() -> Result<R, ApiError> + UnwindSafe,
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.
pub fn block_status(
&self,
id: &BlockId<B>
) -> Result<BlockStatus, Box<dyn Error + Send + 'static, Global>>
pub fn block_status(
&self,
id: &BlockId<B>
) -> Result<BlockStatus, Box<dyn Error + Send + 'static, Global>>
Retrieve the status of the block denoted by the given BlockId
.
impl<B, E, RA, Block: BlockT> ClientBlockImportExt<Block> for Client<B, E, Block, RA> where
Self: BlockImport<Block, Error = ConsensusError>,
RA: Send,
B: Send + Sync,
E: Send,
<Self as BlockImport<Block>>::Transaction: Send,
impl<B, E, RA, Block: BlockT> ClientBlockImportExt<Block> for Client<B, E, Block, RA> where
Self: BlockImport<Block, Error = ConsensusError>,
RA: Send,
B: Send + Sync,
E: Send,
<Self as BlockImport<Block>>::Transaction: Send,
fn import<'life0, 'async_trait>(
&'life0 mut self,
origin: BlockOrigin,
block: Block
) -> Pin<Box<dyn Future<Output = Result<(), ConsensusError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn import<'life0, 'async_trait>(
&'life0 mut self,
origin: BlockOrigin,
block: Block
) -> Pin<Box<dyn Future<Output = Result<(), ConsensusError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Import block to the chain. No finality.
fn import_as_best<'life0, 'async_trait>(
&'life0 mut self,
origin: BlockOrigin,
block: Block
) -> Pin<Box<dyn Future<Output = Result<(), ConsensusError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn import_as_best<'life0, 'async_trait>(
&'life0 mut self,
origin: BlockOrigin,
block: Block
) -> Pin<Box<dyn Future<Output = Result<(), ConsensusError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Import a block and make it our best block if possible.
fn import_as_final<'life0, 'async_trait>(
&'life0 mut self,
origin: BlockOrigin,
block: Block
) -> Pin<Box<dyn Future<Output = Result<(), ConsensusError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn import_as_final<'life0, 'async_trait>(
&'life0 mut self,
origin: BlockOrigin,
block: Block
) -> Pin<Box<dyn Future<Output = Result<(), ConsensusError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Import a block and finalize it.
fn import_justified<'life0, 'async_trait>(
&'life0 mut self,
origin: BlockOrigin,
block: Block,
justifications: Justifications
) -> Pin<Box<dyn Future<Output = Result<(), ConsensusError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn import_justified<'life0, 'async_trait>(
&'life0 mut self,
origin: BlockOrigin,
block: Block,
justifications: Justifications
) -> Pin<Box<dyn Future<Output = Result<(), ConsensusError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Import block with justification(s), finalizes block.
impl<B, E, RA, Block> ClientExt<Block> for Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block> + 'static,
Self: BlockImport<Block, Error = ConsensusError>,
Block: BlockT,
impl<B, E, RA, Block> ClientExt<Block> for Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block> + 'static,
Self: BlockImport<Block, Error = ConsensusError>,
Block: BlockT,
fn finalize_block(
&self,
id: BlockId<Block>,
justification: Option<Justification>
) -> Result<()>
fn finalize_block(
&self,
id: BlockId<Block>,
justification: Option<Justification>
) -> Result<()>
Finalize a block.
Returns hash of the genesis block.
impl<B, E, Block, RA> ExecutorProvider<Block> for Client<B, E, Block, RA> where
Block: Block,
E: CallExecutor<Block>,
B: Backend<Block>,
impl<B, E, Block, RA> ExecutorProvider<Block> for Client<B, E, Block, RA> where
Block: Block,
E: CallExecutor<Block>,
B: Backend<Block>,
type Executor = E
type Executor = E
executor instance
Get call executor reference.
Get a reference to the execution extensions.
Mark all blocks up to given as finalized in operation. Read more
Mark all blocks up to given as finalized in operation. Read more
impl<B, E, Block, RA> HeaderBackend<Block> for Client<B, E, Block, RA> where
Block: Block,
E: CallExecutor<Block> + Send + Sync,
B: Backend<Block>,
RA: Send + Sync,
impl<B, E, Block, RA> HeaderBackend<Block> for Client<B, E, Block, RA> where
Block: Block,
E: CallExecutor<Block> + Send + Sync,
B: Backend<Block>,
RA: Send + Sync,
Get block header. Returns None
if block is not found.
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
Block: Block,
E: CallExecutor<Block> + Send + Sync,
B: Backend<Block>,
RA: Send + Sync,
impl<'_, B, E, Block, RA> HeaderBackend<Block> for &'_ Client<B, E, Block, RA> where
Block: Block,
E: CallExecutor<Block> + Send + Sync,
B: Backend<Block>,
RA: Send + Sync,
Get block header. Returns None
if block is not found.
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
Block: Block,
E: CallExecutor<Block>,
B: Backend<Block>,
impl<B, E, Block, RA> HeaderMetadata<Block> for Client<B, E, Block, RA> where
Block: Block,
E: CallExecutor<Block>,
B: Backend<Block>,
pub fn header_metadata(
&self,
hash: <Block as Block>::Hash
) -> Result<CachedHeaderMetadata<Block>, <Client<B, E, Block, RA> as HeaderMetadata<Block>>::Error>
pub fn insert_header_metadata(
&self,
hash: <Block as Block>::Hash,
metadata: CachedHeaderMetadata<Block>
)
impl<BE, E, B, RA> IndexedBody<B> for Client<BE, E, B, RA> where
E: CallExecutor<B>,
B: Block,
BE: Backend<B>,
impl<BE, E, B, RA> IndexedBody<B> for Client<BE, E, B, RA> where
E: CallExecutor<B>,
B: Block,
BE: Backend<B>,
Get all indexed transactions for a block, including renewed transactions. Read more
impl<B, E, Block, RA> LockImportRun<Block, B> for Client<B, E, Block, RA> where
Block: Block,
E: CallExecutor<Block>,
B: Backend<Block>,
impl<B, E, Block, RA> LockImportRun<Block, B> for Client<B, E, Block, RA> where
Block: Block,
E: CallExecutor<Block>,
B: Backend<Block>,
pub fn lock_import_and_run<R, Err, F>(&self, f: F) -> Result<R, Err> where
Err: From<Error>,
F: FnOnce(&mut ClientImportOperation<Block, B>) -> Result<R, Err>,
pub fn lock_import_and_run<R, Err, F>(&self, f: F) -> Result<R, Err> where
Err: From<Error>,
F: FnOnce(&mut ClientImportOperation<Block, B>) -> Result<R, Err>,
Lock the import lock, and run operations inside.
impl<'_, B, E, Block, RA> LockImportRun<Block, B> for &'_ Client<B, E, Block, RA> where
Block: Block,
E: CallExecutor<Block>,
B: Backend<Block>,
impl<'_, B, E, Block, RA> LockImportRun<Block, B> for &'_ Client<B, E, Block, RA> where
Block: Block,
E: CallExecutor<Block>,
B: Backend<Block>,
pub fn lock_import_and_run<R, Err, F>(&self, f: F) -> Result<R, Err> where
Err: From<Error>,
F: FnOnce(&mut ClientImportOperation<Block, B>) -> Result<R, Err>,
pub fn lock_import_and_run<R, Err, F>(&self, f: F) -> Result<R, Err> where
Err: From<Error>,
F: FnOnce(&mut ClientImportOperation<Block, B>) -> Result<R, Err>,
Lock the import lock, and run operations inside.
impl<B, E, Block, RA> ProofProvider<Block> for Client<B, E, Block, RA> where
Block: Block,
E: CallExecutor<Block>,
B: Backend<Block>,
impl<B, E, Block, RA> ProofProvider<Block> for Client<B, E, Block, RA> where
Block: Block,
E: CallExecutor<Block>,
B: Backend<Block>,
pub fn read_proof(
&self,
id: &BlockId<Block>,
keys: &mut dyn Iterator<Item = &[u8]>
) -> Result<StorageProof, Error>
pub fn read_proof(
&self,
id: &BlockId<Block>,
keys: &mut dyn Iterator<Item = &[u8]>
) -> Result<StorageProof, Error>
Reads storage value at a given block + key, returning read proof.
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
pub fn header_proof(
&self,
id: &BlockId<Block>
) -> Result<(<Block as Block>::Header, StorageProof), Error>
pub fn header_proof(
&self,
id: &BlockId<Block>
) -> Result<(<Block as Block>::Header, StorageProof), Error>
Reads given header and generates CHT-based header proof.
pub fn key_changes_proof(
&self,
first: <Block as Block>::Hash,
last: <Block as Block>::Hash,
min: <Block as Block>::Hash,
max: <Block as Block>::Hash,
storage_key: Option<&PrefixedStorageKey>,
key: &StorageKey
) -> Result<ChangesProof<<Block as Block>::Header>, Error>
pub fn key_changes_proof(
&self,
first: <Block as Block>::Hash,
last: <Block as Block>::Hash,
min: <Block as Block>::Hash,
max: <Block as Block>::Hash,
storage_key: Option<&PrefixedStorageKey>,
key: &StorageKey
) -> Result<ChangesProof<<Block as Block>::Header>, Error>
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
Verify read storage proof for a set of keys. Returns collected key-value pairs and a flag indicating if iteration is complete. Read more
impl<B, E, Block, RA> ProvideCache<Block> for Client<B, E, Block, RA> where
Block: Block,
B: Backend<Block>,
impl<B, E, Block, RA> ProvideCache<Block> for Client<B, E, Block, RA> where
Block: Block,
B: Backend<Block>,
impl<B, E, Block, RA> ProvideRuntimeApi<Block> for Client<B, E, Block, RA> where
Block: Block,
E: CallExecutor<Block, Backend = B> + Send + Sync,
B: Backend<Block>,
RA: ConstructRuntimeApi<Block, Client<B, E, Block, RA>>,
impl<B, E, Block, RA> ProvideRuntimeApi<Block> for Client<B, E, Block, RA> where
Block: Block,
E: CallExecutor<Block, Backend = B> + Send + Sync,
B: Backend<Block>,
RA: ConstructRuntimeApi<Block, Client<B, E, Block, RA>>,
type Api = <RA as ConstructRuntimeApi<Block, Client<B, E, Block, RA>>>::RuntimeApi
type Api = <RA as ConstructRuntimeApi<Block, Client<B, E, Block, RA>>>::RuntimeApi
The concrete type that provides the api.
pub fn runtime_api(
&'a self
) -> ApiRef<'a, <Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api>
pub fn runtime_api(
&'a self
) -> ApiRef<'a, <Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::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
Block: Block,
E: CallExecutor<Block>,
B: Backend<Block>,
impl<B, E, Block, RA> ProvideUncles<Block> for Client<B, E, Block, RA> where
Block: Block,
E: CallExecutor<Block>,
B: Backend<Block>,
impl<B, E, Block, RA> StorageProvider<Block, B> for Client<B, E, Block, RA> where
Block: Block,
E: CallExecutor<Block>,
B: Backend<Block>,
impl<B, E, Block, RA> StorageProvider<Block, B> for Client<B, E, Block, RA> where
Block: Block,
E: CallExecutor<Block>,
B: Backend<Block>,
pub fn storage_keys(
&self,
id: &BlockId<Block>,
key_prefix: &StorageKey
) -> Result<Vec<StorageKey, Global>, Error>
pub fn storage_keys(
&self,
id: &BlockId<Block>,
key_prefix: &StorageKey
) -> Result<Vec<StorageKey, Global>, Error>
Given a BlockId
and a key prefix, return the matching storage keys in that block.
pub fn storage_pairs(
&self,
id: &BlockId<Block>,
key_prefix: &StorageKey
) -> Result<Vec<(StorageKey, StorageData), Global>, Error>
pub fn storage_pairs(
&self,
id: &BlockId<Block>,
key_prefix: &StorageKey
) -> Result<Vec<(StorageKey, StorageData), Global>, Error>
Given a BlockId
and a key prefix, return the matching child storage keys and values in
that block. Read more
pub fn storage_keys_iter(
&self,
id: &BlockId<Block>,
prefix: Option<&'a StorageKey>,
start_key: Option<&StorageKey>
) -> Result<KeyIterator<'a, <B as Backend<Block>>::State, Block>, Error>
pub fn storage_keys_iter(
&self,
id: &BlockId<Block>,
prefix: Option<&'a StorageKey>,
start_key: Option<&StorageKey>
) -> Result<KeyIterator<'a, <B as Backend<Block>>::State, Block>, Error>
Given a BlockId
and a key prefix, return a KeyIterator
iterates matching storage keys in
that block. Read more
pub fn child_storage_keys_iter(
&self,
id: &BlockId<Block>,
child_info: ChildInfo,
prefix: Option<&'a StorageKey>,
start_key: Option<&StorageKey>
) -> Result<KeyIterator<'a, <B as Backend<Block>>::State, Block>, Error>
pub fn child_storage_keys_iter(
&self,
id: &BlockId<Block>,
child_info: ChildInfo,
prefix: Option<&'a StorageKey>,
start_key: Option<&StorageKey>
) -> Result<KeyIterator<'a, <B as Backend<Block>>::State, Block>, Error>
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
pub fn storage(
&self,
id: &BlockId<Block>,
key: &StorageKey
) -> Result<Option<StorageData>, Error>
pub fn storage(
&self,
id: &BlockId<Block>,
key: &StorageKey
) -> Result<Option<StorageData>, Error>
Given a BlockId
and a key, return the value under the key in that block.
pub fn storage_hash(
&self,
id: &BlockId<Block>,
key: &StorageKey
) -> Result<Option<<Block as Block>::Hash>, Error>
pub fn storage_hash(
&self,
id: &BlockId<Block>,
key: &StorageKey
) -> Result<Option<<Block as Block>::Hash>, Error>
Given a BlockId
and a key, return the value under the hash in that block.
pub fn child_storage_keys(
&self,
id: &BlockId<Block>,
child_info: &ChildInfo,
key_prefix: &StorageKey
) -> Result<Vec<StorageKey, Global>, Error>
pub fn child_storage_keys(
&self,
id: &BlockId<Block>,
child_info: &ChildInfo,
key_prefix: &StorageKey
) -> Result<Vec<StorageKey, Global>, Error>
Given a BlockId
, a key prefix, and a child storage key, return the matching child storage
keys. Read more
pub fn child_storage(
&self,
id: &BlockId<Block>,
child_info: &ChildInfo,
key: &StorageKey
) -> Result<Option<StorageData>, Error>
pub fn child_storage(
&self,
id: &BlockId<Block>,
child_info: &ChildInfo,
key: &StorageKey
) -> Result<Option<StorageData>, Error>
Given a BlockId
, a key and a child storage key, return the value under the key in that
block. Read more
pub fn child_storage_hash(
&self,
id: &BlockId<Block>,
child_info: &ChildInfo,
key: &StorageKey
) -> Result<Option<<Block as Block>::Hash>, Error>
pub fn child_storage_hash(
&self,
id: &BlockId<Block>,
child_info: &ChildInfo,
key: &StorageKey
) -> Result<Option<<Block as Block>::Hash>, Error>
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
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
Block: Block,
E: CallExecutor<Block>,
B: Backend<Block>,
impl<B, E, Block, RA> UsageProvider<Block> for Client<B, E, Block, RA> where
Block: Block,
E: CallExecutor<Block>,
B: Backend<Block>,
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
Wait for count
blocks to be imported in the node and then exit. This function will not
return if no blocks are ever created, thus you should restrict the maximum amount of time of
the test execution. Read more
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,