api block struct

This commit is contained in:
debris 2016-01-26 11:37:24 +01:00
parent a514236c62
commit b1282fe1f4
6 changed files with 45 additions and 5 deletions

View File

@ -1,5 +1,7 @@
#![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;

View File

@ -1,4 +1,4 @@
use std::sync::{Arc, RwLock};
use std::sync::Arc;
use rustc_serialize::hex::ToHex;
use util::hash::*;
use ethcore::client::*;
@ -63,6 +63,10 @@ impl Eth for EthClient {
fn block_transaction_count(&self, _: Params) -> Result<Value, Error> {
Ok(Value::U64(0))
}
fn block(&self, _: Params) -> Result<Value, Error> {
Ok(Value::Null)
}
}
pub struct EthFilterClient {

View File

@ -1,7 +1,7 @@
//! Ethereum rpc interface implementation.
pub mod web3;
pub mod eth;
pub mod net;
mod web3;
mod eth;
mod net;
pub use self::web3::Web3Client;
pub use self::eth::{EthClient, EthFilterClient};

View File

@ -8,7 +8,8 @@ macro_rules! rpcerr {
}
pub mod traits;
pub mod impls;
mod impls;
mod types;
pub use self::traits::{Web3, Eth, EthFilter, Net};
pub use self::impls::*;

View File

@ -0,0 +1,32 @@
use util::hash::*;
use util::uint::*;
#[derive(Serialize)]
pub struct Block {
hash: H256,
#[serde(rename="parentHash")]
parent_hash: H256,
#[serde(rename="sha3Uncles")]
uncles_hash: H256,
author: Address,
// TODO: get rid of this one
miner: Address,
#[serde(rename="stateRoot")]
state_root: H256,
#[serde(rename="transactionsRoot")]
transactions_root: H256,
#[serde(rename="receiptsRoot")]
receipts_root: H256,
number: u64,
#[serde(rename="gasUsed")]
gas_used: U256,
#[serde(rename="gasLimit")]
gas_limit: U256,
// TODO: figure out how to properly serialize bytes
//#[serde(rename="extraData")]
//extra_data: Vec<u8>,
#[serde(rename="logsBloom")]
logs_bloom: H2048,
timestamp: u64
}

View File

@ -0,0 +1 @@
mod block;