From 122f8c10cd3c8a8956943701aec1c72ca89421ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Thu, 22 Mar 2018 17:31:52 +0100 Subject: [PATCH] Bump ethereum types. (#108) --- Cargo.toml | 4 ++-- src/contract/mod.rs | 4 ++-- src/types/mod.rs | 2 +- src/types/transaction.rs | 4 ++-- src/types/uint.rs | 26 +++++++++++++------------- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 23f749c0..83b0ecf4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" @@ -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" diff --git a/src/contract/mod.rs b/src/contract/mod.rs index 4d4b6140..92c58289 100644 --- a/src/contract/mod.rs +++ b/src/contract/mod.rs @@ -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); @@ -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); diff --git a/src/types/mod.rs b/src/types/mod.rs index d8b1e2c0..638f0602 100644 --- a/src/types/mod.rs +++ b/src/types/mod.rs @@ -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 diff --git a/src/types/transaction.rs b/src/types/transaction.rs index 9df576c2..9e44cf3d 100644 --- a/src/types/transaction.rs +++ b/src/types/transaction.rs @@ -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)] @@ -58,7 +58,7 @@ pub struct Receipt { /// Logs generated within this transaction. pub logs: Vec, /// Status: either 1 (success) or 0 (failure). - pub status: Option, + pub status: Option, } #[cfg(test)] diff --git a/src/types/uint.rs b/src/types/uint.rs index 0e5567d9..e55fad92 100644 --- a/src/types/uint.rs +++ b/src/types/uint.rs @@ -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 { @@ -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"); @@ -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");