rpc and bin moved to its own crates

This commit is contained in:
debris 2016-01-26 13:14:22 +01:00
parent d27c7f3902
commit 3ac40b68f8
15 changed files with 61 additions and 27 deletions

View File

@ -21,18 +21,8 @@ evmjit = { path = "rust-evmjit", optional = true }
ethash = { path = "ethash" }
num_cpus = "0.2"
clippy = "0.0.37"
docopt = "0.6"
docopt_macros = "0.6"
ctrlc = "1.0"
jsonrpc-core = { version = "1.0", optional = true }
jsonrpc-http-server = { version = "1.0", optional = true }
[features]
jit = ["evmjit"]
evm_debug = []
test-heavy = []
rpc = ["jsonrpc-core", "jsonrpc-http-server"]
[[bin]]
name = "client"
path = "src/bin/client/main.rs"

20
bin/Cargo.toml Normal file
View File

@ -0,0 +1,20 @@
[package]
description = "Ethcore client."
name = "ethcore-client"
version = "0.1.0"
license = "GPL-3.0"
authors = ["Ethcore <admin@ethcore.io>"]
[dependencies]
log = "0.3"
env_logger = "0.3"
rustc-serialize = "0.3"
docopt = "0.6"
docopt_macros = "0.6"
ctrlc = "1.0"
ethcore-util = { path = "../util" }
ethcore-rpc = { path = "../rpc", optional = true }
ethcore = { path = ".." }
[features]
rpc = ["ethcore-rpc"]

View File

@ -1,7 +1,6 @@
#![feature(plugin)]
#![plugin(docopt_macros)]
// required for serde, move it to a separate library
#![feature(custom_derive, custom_attribute)]
extern crate docopt;
extern crate rustc_serialize;
extern crate ethcore_util as util;
@ -11,7 +10,7 @@ extern crate env_logger;
extern crate ctrlc;
#[cfg(feature = "rpc")]
mod rpc;
extern crate ethcore_rpc as rpc;
use std::env;
use log::{LogLevelFilter};
@ -52,7 +51,7 @@ fn setup_log(init: &String) {
#[cfg(feature = "rpc")]
fn setup_rpc_server(client: Arc<Client>) {
use self::rpc::*;
use rpc::*;
let mut server = HttpServer::new(1);
server.add_delegate(Web3Client::new().to_delegate());

19
rpc/Cargo.toml Normal file
View File

@ -0,0 +1,19 @@
[package]
description = "Ethcore jsonrpc"
name = "ethcore-rpc"
version = "0.1.0"
license = "GPL-3.0"
authors = ["Marek Kotewicz <marek.kotewicz@gmail.com"]
[lib]
[dependencies]
rustc-serialize = "0.3"
serde = "0.6.7"
serde_macros = "0.6.10"
serde_json = "0.6.0"
jsonrpc-core = "1.0"
jsonrpc-http-server = "1.0"
ethcore-util = { path = "../util" }
ethcore = { path = ".." }

View File

@ -2,8 +2,8 @@ use std::sync::Arc;
use rustc_serialize::hex::ToHex;
use util::hash::*;
use ethcore::client::*;
use rpc::jsonrpc_core::*;
use rpc::{Eth, EthFilter};
use jsonrpc_core::*;
use traits::{Eth, EthFilter};
pub struct EthClient {
client: Arc<Client>,

View File

@ -1,6 +1,6 @@
//! Net rpc implementation.
use rpc::jsonrpc_core::*;
use rpc::Net;
use jsonrpc_core::*;
use traits::Net;
pub struct NetClient;

View File

@ -1,5 +1,5 @@
use rpc::jsonrpc_core::*;
use rpc::Web3;
use jsonrpc_core::*;
use traits::Web3;
pub struct Web3Client;

View File

@ -1,5 +1,12 @@
#![feature(custom_derive, custom_attribute, plugin)]
#![plugin(serde_macros)]
extern crate rustc_serialize;
extern crate serde;
extern crate jsonrpc_core;
extern crate jsonrpc_http_server;
extern crate ethcore_util as util;
extern crate ethcore;
use self::jsonrpc_core::{IoHandler, IoDelegate};
@ -14,7 +21,6 @@ mod types;
pub use self::traits::{Web3, Eth, EthFilter, Net};
pub use self::impls::*;
pub struct HttpServer {
handler: IoHandler,
threads: usize

View File

@ -1,6 +1,6 @@
//! Eth rpc interface.
use std::sync::Arc;
use rpc::jsonrpc_core::*;
use jsonrpc_core::*;
/// Eth rpc interface.
pub trait Eth: Sized + Send + Sync + 'static {

View File

@ -1,6 +1,6 @@
//! Net rpc interface.
use std::sync::Arc;
use rpc::jsonrpc_core::*;
use jsonrpc_core::*;
/// Net rpc interface.
pub trait Net: Sized + Send + Sync + 'static {

View File

@ -1,6 +1,6 @@
//! Web3 rpc interface.
use std::sync::Arc;
use rpc::jsonrpc_core::*;
use jsonrpc_core::*;
/// Web3 rpc interface.
pub trait Web3: Sized + Send + Sync + 'static {

View File

@ -1,7 +1,7 @@
use util::hash::*;
use util::uint::*;
#[derive(Default, Serialize)]
#[derive(Default)]
pub struct Block {
hash: H256,
#[serde(rename="parentHash")]
@ -35,7 +35,7 @@ fn test_block_serialize() {
use serde_json;
let block = Block::default();
let serialized = serde_json::to_string(&block).unwrap();
println!("s: {:?}", serialized);
assert!(false);
//let serialized = serde_json::to_string(&block).unwrap();
//println!("s: {:?}", serialized);
//assert!(false);
}