diff --git a/rpc/src/v1/impls/ethcore.rs b/rpc/src/v1/impls/ethcore.rs index 492f5810c..7b02c7f78 100644 --- a/rpc/src/v1/impls/ethcore.rs +++ b/rpc/src/v1/impls/ethcore.rs @@ -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 Ethcore for EthcoreClient 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 { + let version = version_data(); + to_value(&version) + } } diff --git a/rpc/src/v1/traits/ethcore.rs b/rpc/src/v1/traits/ethcore.rs index 9aab17b4c..2a2159bd9 100644 --- a/rpc/src/v1/traits/ethcore.rs +++ b/rpc/src/v1/traits/ethcore.rs @@ -69,6 +69,10 @@ pub trait Ethcore: Sized + Send + Sync + 'static { /// Returns node name fn node_name(&self, _: Params) -> Result { rpc_unimplemented!() } + /// Returns default extra data + fn default_extra_data(&self, _: Params) -> Result { rpc_unimplemented!() } + + /// Should be used to convert object to io delegate. fn to_delegate(self) -> IoDelegate { 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 }