diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index f16ae4300..170b94cae 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -17,6 +17,9 @@ sp-runtime = { path = "../vendor/substrate/primitives/runtime" } sp-api = { path = "../vendor/substrate/primitives/api" } sp-consensus = { path = "../vendor/substrate/primitives/consensus/common" } sp-transaction-pool = { path = "../vendor/substrate/primitives/transaction-pool" } +sp-storage = { path = "../vendor/substrate/primitives/storage" } +sc-service = { path = "../vendor/substrate/client/service" } +sc-client-api = { path = "../vendor/substrate/client/api" } ethereum = { version = "0.2", features = ["codec"] } codec = { package = "parity-scale-codec", version = "1.0.0" } rlp = "0.4" diff --git a/rpc/src/lib.rs b/rpc/src/lib.rs index 7bac0bbd8..fbfe6fe3b 100644 --- a/rpc/src/lib.rs +++ b/rpc/src/lib.rs @@ -23,7 +23,9 @@ use sp_runtime::transaction_validity::TransactionSource; use sp_api::{ProvideRuntimeApi, BlockId}; use sp_consensus::SelectChain; use sp_transaction_pool::TransactionPool; +use sc_client_api::backend::{StorageProvider, Backend, StateBackend}; use sha3::{Keccak256, Digest}; +use sp_runtime::traits::BlakeTwo256; use frontier_rpc_core::EthApi as EthApiT; use frontier_rpc_core::types::{ @@ -42,15 +44,15 @@ fn internal_err(message: &str) -> Error { } } -pub struct EthApi { +pub struct EthApi { pool: Arc

, client: Arc, select_chain: SC, convert_transaction: CT, - _marker: PhantomData, + _marker: PhantomData<(B,BE)>, } -impl EthApi { +impl EthApi { pub fn new( client: Arc, select_chain: SC, @@ -61,10 +63,12 @@ impl EthApi { } } -impl EthApiT for EthApi where - C: ProvideRuntimeApi, +impl EthApiT for EthApi where + C: ProvideRuntimeApi + StorageProvider, C::Api: EthereumRuntimeApi, - B: BlockT + Send + Sync + 'static, + BE: Backend + 'static, + BE::State: StateBackend, + B: BlockT + Send + Sync + 'static, C: Send + Sync + 'static, SC: SelectChain + Clone + 'static, P: TransactionPool + Send + Sync + 'static, diff --git a/template/node/src/rpc.rs b/template/node/src/rpc.rs index 3ca45ee28..11ffc96f9 100644 --- a/template/node/src/rpc.rs +++ b/template/node/src/rpc.rs @@ -25,6 +25,8 @@ use sp_transaction_pool::TransactionPool; use sp_blockchain::{Error as BlockChainError, HeaderMetadata, HeaderBackend}; use sp_consensus::SelectChain; use sc_rpc_api::DenyUnsafe; +use sc_client_api::backend::{StorageProvider, Backend, StateBackend}; +use sp_runtime::traits::BlakeTwo256; /// Light client extra dependencies. pub struct LightDeps { @@ -51,10 +53,12 @@ pub struct FullDeps { } /// Instantiate all Full RPC extensions. -pub fn create_full( +pub fn create_full( deps: FullDeps, ) -> jsonrpc_core::IoHandler where - C: ProvideRuntimeApi, + BE: Backend + 'static, + BE::State: StateBackend, + C: ProvideRuntimeApi + StorageProvider, C: HeaderBackend + HeaderMetadata + 'static, C: Send + Sync + 'static, C::Api: substrate_frame_rpc_system::AccountNonceApi,