use sc_executor::{NativeElseWasmExecutor, NativeExecutionDispatch, NativeVersion};
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use frontier_template_runtime::{opaque::Block, AccountId, Balance, Nonce};
use crate::eth::EthCompatRuntimeApiCollection;
pub type FullBackend = sc_service::TFullBackend<Block>;
pub type FullClient<RuntimeApi, Executor> =
sc_service::TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>;
pub type Client = FullClient<frontier_template_runtime::RuntimeApi, TemplateRuntimeExecutor>;
#[cfg(feature = "runtime-benchmarks")]
pub type HostFunctions = frame_benchmarking::benchmarking::HostFunctions;
#[cfg(not(feature = "runtime-benchmarks"))]
pub type HostFunctions = ();
pub struct TemplateRuntimeExecutor;
impl NativeExecutionDispatch for TemplateRuntimeExecutor {
type ExtendHostFunctions = HostFunctions;
fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
frontier_template_runtime::api::dispatch(method, data)
}
fn native_version() -> NativeVersion {
frontier_template_runtime::native_version()
}
}
pub trait BaseRuntimeApiCollection:
sp_api::ApiExt<Block>
+ sp_api::Metadata<Block>
+ sp_block_builder::BlockBuilder<Block>
+ sp_offchain::OffchainWorkerApi<Block>
+ sp_session::SessionKeys<Block>
+ sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
{
}
impl<Api> BaseRuntimeApiCollection for Api where
Api: sp_api::ApiExt<Block>
+ sp_api::Metadata<Block>
+ sp_block_builder::BlockBuilder<Block>
+ sp_offchain::OffchainWorkerApi<Block>
+ sp_session::SessionKeys<Block>
+ sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
{
}
pub trait RuntimeApiCollection:
BaseRuntimeApiCollection
+ EthCompatRuntimeApiCollection
+ sp_consensus_aura::AuraApi<Block, AuraId>
+ sp_consensus_grandpa::GrandpaApi<Block>
+ frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce>
+ pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>
{
}
impl<Api> RuntimeApiCollection for Api where
Api: BaseRuntimeApiCollection
+ EthCompatRuntimeApiCollection
+ sp_consensus_aura::AuraApi<Block, AuraId>
+ sp_consensus_grandpa::GrandpaApi<Block>
+ frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce>
+ pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>
{
}