Merge pull request #1032 from ethcore/default-extra-data
Exposing default extra data via ethcore RPC
This commit is contained in:
commit
9b13dd7216
@ -17,6 +17,7 @@
|
||||
//! Ethcore-specific rpc implementation.
|
||||
use util::{U256, Address, RotatingLogger};
|
||||
use util::network_settings::NetworkSettings;
|
||||
use util::misc::version_data;
|
||||
use std::sync::{Arc, Weak};
|
||||
use std::ops::Deref;
|
||||
use std::collections::BTreeMap;
|
||||
@ -129,4 +130,9 @@ impl<M> Ethcore for EthcoreClient<M> where M: MinerService + 'static {
|
||||
map.insert("port".to_owned(), Value::U64(self.settings.rpc_port as u64));
|
||||
Ok(Value::Object(map))
|
||||
}
|
||||
|
||||
fn default_extra_data(&self, _params: Params) -> Result<Value, Error> {
|
||||
let version = version_data();
|
||||
to_value(&version)
|
||||
}
|
||||
}
|
||||
|
@ -69,6 +69,10 @@ pub trait Ethcore: Sized + Send + Sync + 'static {
|
||||
/// Returns node name
|
||||
fn node_name(&self, _: Params) -> Result<Value, Error> { rpc_unimplemented!() }
|
||||
|
||||
/// Returns default extra data
|
||||
fn default_extra_data(&self, _: Params) -> Result<Value, Error> { rpc_unimplemented!() }
|
||||
|
||||
|
||||
/// Should be used to convert object to io delegate.
|
||||
fn to_delegate(self) -> IoDelegate<Self> {
|
||||
let mut delegate = IoDelegate::new(Arc::new(self));
|
||||
@ -89,6 +93,7 @@ pub trait Ethcore: Sized + Send + Sync + 'static {
|
||||
delegate.add_method("ethcore_netPort", Ethcore::net_port);
|
||||
delegate.add_method("ethcore_rpcSettings", Ethcore::rpc_settings);
|
||||
delegate.add_method("ethcore_nodeName", Ethcore::node_name);
|
||||
delegate.add_method("ethcore_defaultExtraData", Ethcore::default_extra_data);
|
||||
|
||||
delegate
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user