Trait polkadot_service::ExecuteWithClient
source · pub trait ExecuteWithClient {
type Output;
fn execute_with_client<Client, Api, Backend>(
self,
client: Arc<Client>
) -> Self::Output
where
<Api as ApiExt<Block<Header<u32, BlakeTwo256>, OpaqueExtrinsic>>>::StateBackend: Backend<BlakeTwo256>,
Backend: 'static + Backend<Block<Header<u32, BlakeTwo256>, OpaqueExtrinsic>>,
<Backend as Backend<Block<Header<u32, BlakeTwo256>, OpaqueExtrinsic>>>::State: Backend<BlakeTwo256>,
Api: RuntimeApiCollection<StateBackend = <Backend as Backend<Block<Header<u32, BlakeTwo256>, OpaqueExtrinsic>>>::State>,
Client: 'static + AbstractClient<Block<Header<u32, BlakeTwo256>, OpaqueExtrinsic>, Backend, Api = Api>;
}
Expand description
Execute something with the client instance.
As there exist multiple chains inside Polkadot, like Polkadot itself, Kusama, Westend etc,
there can exist different kinds of client types. As these client types differ in the generics
that are being used, we can not easily return them from a function. For returning them from a
function there exists Client
. However, the problem on how to use this client instance still
exists. This trait “solves” it in a dirty way. It requires a type to implement this trait and
than the execute_with_client
function can be called
with any possible client instance.
In a perfect world, we could make a closure work in this way.
Required Associated Types§
Required Methods§
sourcefn execute_with_client<Client, Api, Backend>(
self,
client: Arc<Client>
) -> Self::Outputwhere
<Api as ApiExt<Block<Header<u32, BlakeTwo256>, OpaqueExtrinsic>>>::StateBackend: Backend<BlakeTwo256>,
Backend: 'static + Backend<Block<Header<u32, BlakeTwo256>, OpaqueExtrinsic>>,
<Backend as Backend<Block<Header<u32, BlakeTwo256>, OpaqueExtrinsic>>>::State: Backend<BlakeTwo256>,
Api: RuntimeApiCollection<StateBackend = <Backend as Backend<Block<Header<u32, BlakeTwo256>, OpaqueExtrinsic>>>::State>,
Client: 'static + AbstractClient<Block<Header<u32, BlakeTwo256>, OpaqueExtrinsic>, Backend, Api = Api>,
fn execute_with_client<Client, Api, Backend>(
self,
client: Arc<Client>
) -> Self::Outputwhere
<Api as ApiExt<Block<Header<u32, BlakeTwo256>, OpaqueExtrinsic>>>::StateBackend: Backend<BlakeTwo256>,
Backend: 'static + Backend<Block<Header<u32, BlakeTwo256>, OpaqueExtrinsic>>,
<Backend as Backend<Block<Header<u32, BlakeTwo256>, OpaqueExtrinsic>>>::State: Backend<BlakeTwo256>,
Api: RuntimeApiCollection<StateBackend = <Backend as Backend<Block<Header<u32, BlakeTwo256>, OpaqueExtrinsic>>>::State>,
Client: 'static + AbstractClient<Block<Header<u32, BlakeTwo256>, OpaqueExtrinsic>, Backend, Api = Api>,
Execute whatever should be executed with the given client instance.