Skip to content

Commit

Permalink
Bump ethereum types. (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomusdrw committed Mar 22, 2018
1 parent b55f59b commit 122f8c1
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "web3"
version = "0.2.0"
version = "0.3.0"
description = "Ethereum JSON-RPC client."
homepage = "https://github.com/tomusdrw/rust-web3"
repository = "https://github.com/tomusdrw/rust-web3"
Expand All @@ -14,7 +14,7 @@ readme = "README.md"
arrayvec = "0.4"
error-chain = "0.11"
ethabi = "5.1"
ethereum-types = "0.2"
ethereum-types = "0.3"
futures = "0.1"
jsonrpc-core = "8.0.1"
log = "0.4"
Expand Down
4 changes: 2 additions & 2 deletions src/contract/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ mod tests {
fn should_call_a_contract_function() {
// given
let mut transport = TestTransport::default();
transport.set_response(rpc::Value::String(format!("0x{:?}", H256::from(5))));
transport.set_response(rpc::Value::String(format!("{:?}", H256::from(5))));

let result = {
let token = contract(&transport);
Expand All @@ -269,7 +269,7 @@ mod tests {
fn should_estimate_gas_usage() {
// given
let mut transport = TestTransport::default();
transport.set_response(rpc::Value::String(format!("0x{:?}", U256::from(5))));
transport.set_response(rpc::Value::String(format!("{:?}", U256::from(5))));

let result = {
let token = contract(&transport);
Expand Down
2 changes: 1 addition & 1 deletion src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub use self::sync_state::{SyncState,SyncInfo};
pub use self::transaction::{Transaction, Receipt as TransactionReceipt};
pub use self::transaction_id::TransactionId;
pub use self::transaction_request::{TransactionRequest, CallRequest, TransactionCondition};
pub use self::uint::{H64, H128, H160, H256, H512, H520, H2048, U128, U256};
pub use self::uint::{H64, H128, H160, H256, H512, H520, H2048, U64, U128, U256};
pub use self::work::Work;

/// Address
Expand Down
4 changes: 2 additions & 2 deletions src/types/transaction.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use types::{H160, H256, U128, U256, Index, Log, Bytes};
use types::{H160, H256, U64, U256, Index, Log, Bytes};

/// Description of a Transaction, pending or in the chain.
#[derive(Debug, Default, Clone, PartialEq, Deserialize)]
Expand Down Expand Up @@ -58,7 +58,7 @@ pub struct Receipt {
/// Logs generated within this transaction.
pub logs: Vec<Log>,
/// Status: either 1 (success) or 0 (failure).
pub status: Option<U128>,
pub status: Option<U64>,
}

#[cfg(test)]
Expand Down
26 changes: 13 additions & 13 deletions src/types/uint.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub use ethereum_types::{U128, U256, H64, H128, H160, H256, H512, H520, H1024, Bloom as H2048};
pub use ethereum_types::{U64, U128, U256, H64, H128, H160, H256, H512, H520, H1024, Bloom as H2048};

#[cfg(test)]
mod tests {
Expand Down Expand Up @@ -43,10 +43,10 @@ mod tests {
let d = U256::from(10000);

// Debug
assert_eq!(&format!("{:?}", a), "42949742336");
assert_eq!(&format!("{:?}", b), "1023");
assert_eq!(&format!("{:?}", c), "0");
assert_eq!(&format!("{:?}", d), "10000");
assert_eq!(&format!("{:?}", a), "0xa00010f00");
assert_eq!(&format!("{:?}", b), "0x3ff");
assert_eq!(&format!("{:?}", c), "0x0");
assert_eq!(&format!("{:?}", d), "0x2710");

// Display
assert_eq!(&format!("{}", a), "42949742336");
Expand Down Expand Up @@ -75,16 +75,16 @@ mod tests {
let d = H128::from(10000);

// Debug
assert_eq!(&format!("0x{:?}", a), "0x00000000000000000000000a00010f00");
assert_eq!(&format!("0x{:?}", b), "0x000000000000000000000000000003ff");
assert_eq!(&format!("0x{:?}", c), "0x00000000000000000000000000000000");
assert_eq!(&format!("0x{:?}", d), "0x00000000000000000000000000002710");
assert_eq!(&format!("{:?}", a), "0x00000000000000000000000a00010f00");
assert_eq!(&format!("{:?}", b), "0x000000000000000000000000000003ff");
assert_eq!(&format!("{:?}", c), "0x00000000000000000000000000000000");
assert_eq!(&format!("{:?}", d), "0x00000000000000000000000000002710");

// Display
assert_eq!(&format!("0x{}", a), "0x0000…0f00");
assert_eq!(&format!("0x{}", b), "0x0000…03ff");
assert_eq!(&format!("0x{}", c), "0x0000…0000");
assert_eq!(&format!("0x{}", d), "0x0000…2710");
assert_eq!(&format!("{}", a), "0x0000…0f00");
assert_eq!(&format!("{}", b), "0x0000…03ff");
assert_eq!(&format!("{}", c), "0x0000…0000");
assert_eq!(&format!("{}", d), "0x0000…2710");

// Lowerhex
assert_eq!(&format!("{:x}", a), "00000000000000000000000a00010f00");
Expand Down

0 comments on commit 122f8c1

Please sign in to comment.