referrerpolicy=no-referrer-when-downgrade

Trait relay_substrate_client::Client

source ·
pub trait Client<C: Chain>: 'static + Send + Sync + Clone + Debug {
Show 34 methods // Required methods fn ensure_synced<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn reconnect<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn genesis_hash(&self) -> HashOf<C>; fn header_hash_by_number<'life0, 'async_trait>( &'life0 self, number: BlockNumberOf<C>, ) -> Pin<Box<dyn Future<Output = Result<HashOf<C>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn header_by_hash<'life0, 'async_trait>( &'life0 self, hash: HashOf<C>, ) -> Pin<Box<dyn Future<Output = Result<HeaderOf<C>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn block_by_hash<'life0, 'async_trait>( &'life0 self, hash: HashOf<C>, ) -> Pin<Box<dyn Future<Output = Result<SignedBlockOf<C>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn best_finalized_header_hash<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<HashOf<C>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn best_header<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<HeaderOf<C>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn subscribe_best_headers<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Subscription<HeaderOf<C>>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn subscribe_finalized_headers<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Subscription<HeaderOf<C>>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn subscribe_grandpa_finality_justifications<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Subscription<Bytes>>> + Send + 'async_trait>> where C: ChainWithGrandpa, Self: 'async_trait, 'life0: 'async_trait; fn generate_grandpa_key_ownership_proof<'life0, 'async_trait>( &'life0 self, at: HashOf<C>, set_id: SetId, authority_id: AuthorityId, ) -> Pin<Box<dyn Future<Output = Result<Option<OpaqueKeyOwnershipProof>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn subscribe_beefy_finality_justifications<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Subscription<Bytes>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn token_decimals<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<u64>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn runtime_version<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<RuntimeVersion>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn simple_runtime_version<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<SimpleRuntimeVersion>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn can_start_version_guard(&self) -> bool; fn raw_storage_value<'life0, 'async_trait>( &'life0 self, at: HashOf<C>, storage_key: StorageKey, ) -> Pin<Box<dyn Future<Output = Result<Option<StorageData>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn pending_extrinsics<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Bytes>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn submit_unsigned_extrinsic<'life0, 'async_trait>( &'life0 self, transaction: Bytes, ) -> Pin<Box<dyn Future<Output = Result<HashOf<C>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn submit_signed_extrinsic<'life0, 'life1, 'async_trait>( &'life0 self, signer: &'life1 AccountKeyPairOf<C>, prepare_extrinsic: impl 'async_trait + FnOnce(HeaderIdOf<C>, NonceOf<C>) -> Result<UnsignedTransaction<C>> + Send + 'static, ) -> Pin<Box<dyn Future<Output = Result<HashOf<C>>> + Send + 'async_trait>> where C: ChainWithTransactions, AccountIdOf<C>: From<<AccountKeyPairOf<C> as Pair>::Public>, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn submit_and_watch_signed_extrinsic<'life0, 'life1, 'async_trait>( &'life0 self, signer: &'life1 AccountKeyPairOf<C>, prepare_extrinsic: impl 'async_trait + FnOnce(HeaderIdOf<C>, NonceOf<C>) -> Result<UnsignedTransaction<C>> + Send + 'static, ) -> Pin<Box<dyn Future<Output = Result<TransactionTracker<C, Self>>> + Send + 'async_trait>> where C: ChainWithTransactions, AccountIdOf<C>: From<<AccountKeyPairOf<C> as Pair>::Public>, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn validate_transaction<'life0, 'async_trait, SignedTransaction>( &'life0 self, at: HashOf<C>, transaction: SignedTransaction, ) -> Pin<Box<dyn Future<Output = Result<TransactionValidity>> + Send + 'async_trait>> where SignedTransaction: 'async_trait + Encode + Send + 'static, Self: 'async_trait, 'life0: 'async_trait; fn estimate_extrinsic_weight<'life0, 'async_trait, SignedTransaction>( &'life0 self, at: HashOf<C>, transaction: SignedTransaction, ) -> Pin<Box<dyn Future<Output = Result<Weight>> + Send + 'async_trait>> where SignedTransaction: 'async_trait + Encode + Send + 'static, Self: 'async_trait, 'life0: 'async_trait; fn raw_state_call<'life0, 'async_trait, Args>( &'life0 self, at: HashOf<C>, method: String, arguments: Args, ) -> Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'async_trait>> where Args: 'async_trait + Encode + Send, Self: 'async_trait, 'life0: 'async_trait; fn prove_storage<'life0, 'async_trait>( &'life0 self, at: HashOf<C>, keys: Vec<StorageKey>, ) -> Pin<Box<dyn Future<Output = Result<(StorageProof, HashOf<C>)>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; // Provided methods fn header_by_number<'life0, 'async_trait>( &'life0 self, number: BlockNumberOf<C>, ) -> Pin<Box<dyn Future<Output = Result<HeaderOf<C>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn best_finalized_header_number<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<BlockNumberOf<C>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn best_finalized_header<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<HeaderOf<C>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn best_header_hash<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<HashOf<C>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn storage_value<'life0, 'async_trait, T>( &'life0 self, at: HashOf<C>, storage_key: StorageKey, ) -> Pin<Box<dyn Future<Output = Result<Option<T>>> + Send + 'async_trait>> where T: 'async_trait + Decode + 'static, Self: 'async_trait, 'life0: 'async_trait { ... } fn storage_map_value<'life0, 'life1, 'life2, 'async_trait, T>( &'life0 self, at: HashOf<C>, pallet_prefix: &'life1 str, storage_key: &'life2 T::Key, ) -> Pin<Box<dyn Future<Output = Result<Option<T::Value>>> + Send + 'async_trait>> where T: 'async_trait + StorageMapKeyProvider, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn storage_double_map_value<'life0, 'life1, 'life2, 'life3, 'async_trait, T>( &'life0 self, at: HashOf<C>, pallet_prefix: &'life1 str, key1: &'life2 T::Key1, key2: &'life3 T::Key2, ) -> Pin<Box<dyn Future<Output = Result<Option<T::Value>>> + Send + 'async_trait>> where T: 'async_trait + StorageDoubleMapKeyProvider, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait { ... } fn state_call<'life0, 'async_trait, Args, Ret>( &'life0 self, at: HashOf<C>, method: String, arguments: Args, ) -> Pin<Box<dyn Future<Output = Result<Ret>> + Send + 'async_trait>> where Args: 'async_trait + Encode + Send, Ret: 'async_trait + Decode, Self: 'async_trait, 'life0: 'async_trait { ... }
}
Expand description

Relay uses the Client to communicate with the node, connected to Substrate chain C.

Required Methods§

source

fn ensure_synced<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns error if client has no connected peers or it believes it is far behind the chain tip.

source

fn reconnect<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Reconnects the client.

source

fn genesis_hash(&self) -> HashOf<C>

Return hash of the genesis block.

source

fn header_hash_by_number<'life0, 'async_trait>( &'life0 self, number: BlockNumberOf<C>, ) -> Pin<Box<dyn Future<Output = Result<HashOf<C>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get header hash by number.

source

fn header_by_hash<'life0, 'async_trait>( &'life0 self, hash: HashOf<C>, ) -> Pin<Box<dyn Future<Output = Result<HeaderOf<C>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get header by hash.

source

fn block_by_hash<'life0, 'async_trait>( &'life0 self, hash: HashOf<C>, ) -> Pin<Box<dyn Future<Output = Result<SignedBlockOf<C>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get block by hash.

source

fn best_finalized_header_hash<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<HashOf<C>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get best finalized header hash.

source

fn best_header<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<HeaderOf<C>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get best header.

source

fn subscribe_best_headers<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Subscription<HeaderOf<C>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Subscribe to new best headers.

source

fn subscribe_finalized_headers<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Subscription<HeaderOf<C>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Subscribe to new finalized headers.

source

fn subscribe_grandpa_finality_justifications<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Subscription<Bytes>>> + Send + 'async_trait>>
where C: ChainWithGrandpa, Self: 'async_trait, 'life0: 'async_trait,

Subscribe to GRANDPA finality justifications.

source

fn generate_grandpa_key_ownership_proof<'life0, 'async_trait>( &'life0 self, at: HashOf<C>, set_id: SetId, authority_id: AuthorityId, ) -> Pin<Box<dyn Future<Output = Result<Option<OpaqueKeyOwnershipProof>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Generates a proof of key ownership for the given authority in the given set.

source

fn subscribe_beefy_finality_justifications<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Subscription<Bytes>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Subscribe to BEEFY finality justifications.

source

fn token_decimals<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<u64>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return tokenDecimals property from the set of chain properties.

source

fn runtime_version<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<RuntimeVersion>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get runtime version of the connected chain.

source

fn simple_runtime_version<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<SimpleRuntimeVersion>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get partial runtime version, to use when signing transactions.

source

fn can_start_version_guard(&self) -> bool

Returns true if version guard can be started.

There’s no reason to run version guard when version mode is set to Auto. It can lead to relay shutdown when chain is upgraded, even though we have explicitly said that we don’t want to shutdown.

source

fn raw_storage_value<'life0, 'async_trait>( &'life0 self, at: HashOf<C>, storage_key: StorageKey, ) -> Pin<Box<dyn Future<Output = Result<Option<StorageData>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Read raw value from runtime storage.

source

fn pending_extrinsics<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Bytes>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns pending extrinsics from transaction pool.

source

fn submit_unsigned_extrinsic<'life0, 'async_trait>( &'life0 self, transaction: Bytes, ) -> Pin<Box<dyn Future<Output = Result<HashOf<C>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Submit unsigned extrinsic for inclusion in a block.

Note: The given transaction needs to be SCALE encoded beforehand.

source

fn submit_signed_extrinsic<'life0, 'life1, 'async_trait>( &'life0 self, signer: &'life1 AccountKeyPairOf<C>, prepare_extrinsic: impl 'async_trait + FnOnce(HeaderIdOf<C>, NonceOf<C>) -> Result<UnsignedTransaction<C>> + Send + 'static, ) -> Pin<Box<dyn Future<Output = Result<HashOf<C>>> + Send + 'async_trait>>
where C: ChainWithTransactions, AccountIdOf<C>: From<<AccountKeyPairOf<C> as Pair>::Public>, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Submit an extrinsic signed by given account.

All calls of this method are synchronized, so there can’t be more than one active submit_signed_extrinsic() call. This guarantees that no nonces collision may happen if all client instances are clones of the same initial Client.

Note: The given transaction needs to be SCALE encoded beforehand.

source

fn submit_and_watch_signed_extrinsic<'life0, 'life1, 'async_trait>( &'life0 self, signer: &'life1 AccountKeyPairOf<C>, prepare_extrinsic: impl 'async_trait + FnOnce(HeaderIdOf<C>, NonceOf<C>) -> Result<UnsignedTransaction<C>> + Send + 'static, ) -> Pin<Box<dyn Future<Output = Result<TransactionTracker<C, Self>>> + Send + 'async_trait>>
where C: ChainWithTransactions, AccountIdOf<C>: From<<AccountKeyPairOf<C> as Pair>::Public>, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Does exactly the same as submit_signed_extrinsic, but keeps watching for extrinsic status after submission.

source

fn validate_transaction<'life0, 'async_trait, SignedTransaction>( &'life0 self, at: HashOf<C>, transaction: SignedTransaction, ) -> Pin<Box<dyn Future<Output = Result<TransactionValidity>> + Send + 'async_trait>>
where SignedTransaction: 'async_trait + Encode + Send + 'static, Self: 'async_trait, 'life0: 'async_trait,

Validate transaction at given block.

source

fn estimate_extrinsic_weight<'life0, 'async_trait, SignedTransaction>( &'life0 self, at: HashOf<C>, transaction: SignedTransaction, ) -> Pin<Box<dyn Future<Output = Result<Weight>> + Send + 'async_trait>>
where SignedTransaction: 'async_trait + Encode + Send + 'static, Self: 'async_trait, 'life0: 'async_trait,

Returns weight of the given transaction.

source

fn raw_state_call<'life0, 'async_trait, Args>( &'life0 self, at: HashOf<C>, method: String, arguments: Args, ) -> Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'async_trait>>
where Args: 'async_trait + Encode + Send, Self: 'async_trait, 'life0: 'async_trait,

Execute runtime call at given block.

source

fn prove_storage<'life0, 'async_trait>( &'life0 self, at: HashOf<C>, keys: Vec<StorageKey>, ) -> Pin<Box<dyn Future<Output = Result<(StorageProof, HashOf<C>)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns storage proof of given storage keys and state root.

Provided Methods§

source

fn header_by_number<'life0, 'async_trait>( &'life0 self, number: BlockNumberOf<C>, ) -> Pin<Box<dyn Future<Output = Result<HeaderOf<C>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get header by number.

source

fn best_finalized_header_number<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<BlockNumberOf<C>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get best finalized header number.

source

fn best_finalized_header<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<HeaderOf<C>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get best finalized header.

source

fn best_header_hash<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<HashOf<C>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get best header hash.

source

fn storage_value<'life0, 'async_trait, T>( &'life0 self, at: HashOf<C>, storage_key: StorageKey, ) -> Pin<Box<dyn Future<Output = Result<Option<T>>> + Send + 'async_trait>>
where T: 'async_trait + Decode + 'static, Self: 'async_trait, 'life0: 'async_trait,

Read and decode value from runtime storage.

source

fn storage_map_value<'life0, 'life1, 'life2, 'async_trait, T>( &'life0 self, at: HashOf<C>, pallet_prefix: &'life1 str, storage_key: &'life2 T::Key, ) -> Pin<Box<dyn Future<Output = Result<Option<T::Value>>> + Send + 'async_trait>>
where T: 'async_trait + StorageMapKeyProvider, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Read and decode value from runtime storage map.

pallet_prefix is the name of the pallet (used in construct_runtime), which “contains” the storage map.

source

fn storage_double_map_value<'life0, 'life1, 'life2, 'life3, 'async_trait, T>( &'life0 self, at: HashOf<C>, pallet_prefix: &'life1 str, key1: &'life2 T::Key1, key2: &'life3 T::Key2, ) -> Pin<Box<dyn Future<Output = Result<Option<T::Value>>> + Send + 'async_trait>>
where T: 'async_trait + StorageDoubleMapKeyProvider, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Read and decode value from runtime storage double map.

pallet_prefix is the name of the pallet (used in construct_runtime), which “contains” the storage double map.

source

fn state_call<'life0, 'async_trait, Args, Ret>( &'life0 self, at: HashOf<C>, method: String, arguments: Args, ) -> Pin<Box<dyn Future<Output = Result<Ret>> + Send + 'async_trait>>
where Args: 'async_trait + Encode + Send, Ret: 'async_trait + Decode, Self: 'async_trait, 'life0: 'async_trait,

Execute runtime call at given block, provided the input and output types. It also performs the input encode and output decode.

Object Safety§

This trait is not object safe.

Implementors§