openethereum/rpc/src/v1/impls/web3.rs

22 lines
527 B
Rust
Raw Normal View History

//! 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::*;
use v1::traits::Web3;
2016-01-21 01:19:29 +01:00
/// Web3 rpc implementation.
2016-01-21 01:19:29 +01:00
pub struct Web3Client;
impl Web3Client {
/// 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())
}
}
}