api block struct
This commit is contained in:
parent
a514236c62
commit
b1282fe1f4
@ -1,5 +1,7 @@
|
|||||||
#![feature(plugin)]
|
#![feature(plugin)]
|
||||||
#![plugin(docopt_macros)]
|
#![plugin(docopt_macros)]
|
||||||
|
// required for serde, move it to a separate library
|
||||||
|
#![feature(custom_derive, custom_attribute)]
|
||||||
extern crate docopt;
|
extern crate docopt;
|
||||||
extern crate rustc_serialize;
|
extern crate rustc_serialize;
|
||||||
extern crate ethcore_util as util;
|
extern crate ethcore_util as util;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use std::sync::{Arc, RwLock};
|
use std::sync::Arc;
|
||||||
use rustc_serialize::hex::ToHex;
|
use rustc_serialize::hex::ToHex;
|
||||||
use util::hash::*;
|
use util::hash::*;
|
||||||
use ethcore::client::*;
|
use ethcore::client::*;
|
||||||
@ -63,6 +63,10 @@ impl Eth for EthClient {
|
|||||||
fn block_transaction_count(&self, _: Params) -> Result<Value, Error> {
|
fn block_transaction_count(&self, _: Params) -> Result<Value, Error> {
|
||||||
Ok(Value::U64(0))
|
Ok(Value::U64(0))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn block(&self, _: Params) -> Result<Value, Error> {
|
||||||
|
Ok(Value::Null)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct EthFilterClient {
|
pub struct EthFilterClient {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//! Ethereum rpc interface implementation.
|
//! Ethereum rpc interface implementation.
|
||||||
pub mod web3;
|
mod web3;
|
||||||
pub mod eth;
|
mod eth;
|
||||||
pub mod net;
|
mod net;
|
||||||
|
|
||||||
pub use self::web3::Web3Client;
|
pub use self::web3::Web3Client;
|
||||||
pub use self::eth::{EthClient, EthFilterClient};
|
pub use self::eth::{EthClient, EthFilterClient};
|
||||||
|
@ -8,7 +8,8 @@ macro_rules! rpcerr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub mod traits;
|
pub mod traits;
|
||||||
pub mod impls;
|
mod impls;
|
||||||
|
mod types;
|
||||||
|
|
||||||
pub use self::traits::{Web3, Eth, EthFilter, Net};
|
pub use self::traits::{Web3, Eth, EthFilter, Net};
|
||||||
pub use self::impls::*;
|
pub use self::impls::*;
|
||||||
|
32
src/bin/client/rpc/types/block.rs
Normal file
32
src/bin/client/rpc/types/block.rs
Normal 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
|
||||||
|
}
|
||||||
|
|
1
src/bin/client/rpc/types/mod.rs
Normal file
1
src/bin/client/rpc/types/mod.rs
Normal file
@ -0,0 +1 @@
|
|||||||
|
mod block;
|
Loading…
Reference in New Issue
Block a user