2016-01-27 17:08:59 +01:00
|
|
|
//! Web3 rpc implementation.
|
2016-02-03 17:30:02 +01:00
|
|
|
use target_info::Target;
|
2016-01-26 13:14:22 +01:00
|
|
|
use jsonrpc_core::*;
|
2016-01-27 17:14:41 +01:00
|
|
|
use v1::traits::Web3;
|
2016-01-21 01:19:29 +01:00
|
|
|
|
2016-01-27 17:08:59 +01:00
|
|
|
/// Web3 rpc implementation.
|
2016-01-21 01:19:29 +01:00
|
|
|
pub struct Web3Client;
|
|
|
|
|
|
|
|
impl Web3Client {
|
2016-01-27 17:08:59 +01:00
|
|
|
/// Creates new Web3Client.
|
2016-01-21 01:19:29 +01:00
|
|
|
pub fn new() -> Self { Web3Client }
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Web3 for Web3Client {
|
|
|
|
fn client_version(&self, params: Params) -> Result<Value, Error> {
|
|
|
|
match params {
|
2016-02-03 17:35:25 +01:00
|
|
|
Params::None => Ok(Value::String(format!("parity/{}/{}/rust1.8-nightly", env!("CARGO_PKG_VERSION"), Target::os()).to_owned())),
|
2016-01-21 01:19:29 +01:00
|
|
|
_ => Err(Error::invalid_params())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|