From b76860fd2b700091c85d18bb9a5a68339fe0440c Mon Sep 17 00:00:00 2001 From: Robert Habermeier Date: Thu, 23 Mar 2017 19:42:11 +0100 Subject: [PATCH] add signing RPC methods in light cli --- parity/rpc_apis.rs | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/parity/rpc_apis.rs b/parity/rpc_apis.rs index 76e54ff81..c53e2c4a1 100644 --- a/parity/rpc_apis.rs +++ b/parity/rpc_apis.rs @@ -313,6 +313,20 @@ impl Dependencies for LightDependencies { self.transaction_queue.clone(), ); + macro_rules! add_signing_methods { + ($namespace:ident, $handler:expr, $deps:expr) => { + { + let deps = &$deps; + let dispatcher = dispatcher.clone(); + if deps.signer_service.is_enabled() { + $handler.extend_with($namespace::to_delegate(SigningQueueClient::new(&deps.signer_service, dispatcher, &deps.secret_store))) + } else { + $handler.extend_with($namespace::to_delegate(SigningUnsafeClient::new(&deps.secret_store, dispatcher))) + } + } + } + } + for api in apis { match *api { Api::Web3 => { @@ -332,7 +346,9 @@ impl Dependencies for LightDependencies { ); handler.extend_with(client.to_delegate()); - // TODO: filters and signing methods. + // TODO: filters. + add_signing_methods!(EthSigning, handler, self); + }, Api::Personal => { handler.extend_with(PersonalClient::new(&self.secret_store, dispatcher.clone(), self.geth_compatibility).to_delegate()); @@ -355,9 +371,8 @@ impl Dependencies for LightDependencies { self.dapps_port, ).to_delegate()); - // TODO - //add_signing_methods!(EthSigning, handler, self); - //add_signing_methods!(ParitySigning, handler, self); + add_signing_methods!(EthSigning, handler, self); + add_signing_methods!(ParitySigning, handler, self); }, Api::ParityAccounts => { handler.extend_with(ParityAccountsClient::new(&self.secret_store).to_delegate());