Adding all APIs to webapp rpc server

This commit is contained in:
Tomasz Drwięga 2016-04-07 12:12:02 +02:00
parent ad37b7fd2a
commit da05aa51fe

View File

@ -303,12 +303,20 @@ fn setup_rpc_server(
} }
#[cfg(feature = "webapp")] #[cfg(feature = "webapp")]
fn setup_webapp_server( fn setup_webapp_server(
client: Arc<Client>,
sync: Arc<EthSync>,
secret_store: Arc<AccountService>,
miner: Arc<Miner>,
url: &str url: &str
) -> Option<Arc<PanicHandler>> { ) -> Option<Arc<PanicHandler>> {
use rpc::v1::*; use rpc::v1::*;
let server = webapp::WebappServer::new(); let server = webapp::WebappServer::new();
server.add_delegate(Web3Client::new().to_delegate()); server.add_delegate(Web3Client::new().to_delegate());
server.add_delegate(NetClient::new(&sync).to_delegate());
server.add_delegate(EthClient::new(&client, &sync, &secret_store, &miner).to_delegate());
server.add_delegate(EthFilterClient::new(&client, &miner).to_delegate());
server.add_delegate(PersonalClient::new(&secret_store).to_delegate());
Some(server.start_http(url, ::num_cpus::get())) Some(server.start_http(url, ::num_cpus::get()))
} }
@ -327,6 +335,10 @@ fn setup_rpc_server(
#[cfg(not(feature = "webapp"))] #[cfg(not(feature = "webapp"))]
fn setup_webapp_server( fn setup_webapp_server(
_client: Arc<Client>,
_sync: Arc<EthSync>,
_secret_store: Arc<AccountService>,
_miner: Arc<Miner>,
_url: &str _url: &str
) -> Option<Arc<PanicHandler>> { ) -> Option<Arc<PanicHandler>> {
None None
@ -637,6 +649,10 @@ impl Configuration {
if self.args.flag_webapp { if self.args.flag_webapp {
let url = format!("0.0.0.0:{}", self.args.flag_webapp_port); let url = format!("0.0.0.0:{}", self.args.flag_webapp_port);
setup_webapp_server( setup_webapp_server(
service.client(),
sync.clone(),
account_service.clone(),
miner.clone(),
&url, &url,
).map(|handler| { ).map(|handler| {
panic_handler.forward_from(handler.deref()); panic_handler.forward_from(handler.deref());