use tp_runtime::BuildStorage;
use tc_service::client;
pub use tetcore_test_client::*;
pub type Executor = tc_executor::NativeExecutor<node_executor::Executor>;
pub type Backend = tc_client_db::Backend<node_primitives::Block>;
pub type Client = client::Client<
Backend,
client::LocalCallExecutor<Backend, Executor>,
node_primitives::Block,
node_runtime::RuntimeApi,
>;
pub type Transaction = tc_client_api::backend::TransactionFor<Backend, node_primitives::Block>;
#[derive(Default)]
pub struct GenesisParameters {
support_changes_trie: bool,
}
impl tetcore_test_client::GenesisInit for GenesisParameters {
fn genesis_storage(&self) -> Storage {
crate::genesis::config(self.support_changes_trie, None).build_storage().unwrap()
}
}
pub trait TestClientBuilderExt: Sized {
fn new() -> Self;
fn build(self) -> Client;
}
impl TestClientBuilderExt for tetcore_test_client::TestClientBuilder<
node_primitives::Block,
client::LocalCallExecutor<Backend, Executor>,
Backend,
GenesisParameters,
> {
fn new() -> Self{
Self::default()
}
fn build(self) -> Client {
self.build_with_native_executor(None).0
}
}