Custom RPC implementation for node. (#3109)

* Allow RPCs to be customized.

* Implement node-rpc extensions.

* Working on a test.

* Add node-testing crate.

* Fix genesis test config

* Fix nonce lookups.

* Clean up.

* Fix expected block type.

* Make the RPC extension function optional.

* Fix service doc test.

* Bump jsonrpc.

* Bump client version.

* Update Cargo.lock

* Update jsonrpc.

* Fix build.

* Remove unused imports.

* Fix signed extra.

* Post merge clean up.

* Fix tests.

* Patch hashmap-core.

* Fix build.

* Fix build.

* Remove hashmap_core patches.
This commit is contained in:
Tomasz Drwięga
2019-08-20 11:06:35 +02:00
committed by Gavin Wood
parent 95abffc8e4
commit 56296386ab
29 changed files with 838 additions and 278 deletions
+3
View File
@@ -11,6 +11,7 @@ log = "0.4"
tokio = "0.1.7"
futures = "0.1"
exit-future = "0.1"
jsonrpc-core = "13.0.0"
cli = { package = "substrate-cli", path = "../../core/cli" }
codec = { package = "parity-scale-codec", version = "1.0.0" }
sr-io = { path = "../../core/sr-io" }
@@ -18,8 +19,10 @@ client = { package = "substrate-client", path = "../../core/client" }
primitives = { package = "substrate-primitives", path = "../../core/primitives" }
inherents = { package = "substrate-inherents", path = "../../core/inherents" }
node-runtime = { path = "../runtime" }
node-rpc = { path = "../rpc" }
node-primitives = { path = "../primitives" }
hex-literal = "0.2"
substrate-rpc = { package = "substrate-rpc", path = "../../core/rpc" }
substrate-basic-authorship = { path = "../../core/basic-authorship" }
substrate-service = { path = "../../core/service" }
transaction_pool = { package = "substrate-transaction-pool", path = "../../core/transaction-pool" }
+11
View File
@@ -278,6 +278,17 @@ construct_service_factory! {
FinalityProofProvider = { |client: Arc<FullClient<Self>>| {
Ok(Some(Arc::new(GrandpaFinalityProofProvider::new(client.clone(), client)) as _))
}},
RpcExtensions = jsonrpc_core::IoHandler<substrate_rpc::Metadata>
{ |client, pool| {
use node_rpc::accounts::{Accounts, AccountsApi};
let mut io = jsonrpc_core::IoHandler::default();
io.extend_with(
AccountsApi::to_delegate(Accounts::new(client, pool))
);
io
}},
}
}