diff --git a/Cargo.lock b/Cargo.lock index 83deaed8..c9c7f975 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -229,7 +229,6 @@ name = "ethers" version = "0.1.0" dependencies = [ "anyhow 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", - "ethers-abi 0.1.0", "ethers-contract 0.1.0", "ethers-providers 0.1.0", "ethers-signers 0.1.0", @@ -241,23 +240,10 @@ dependencies = [ "tokio 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "ethers-abi" -version = "0.1.0" -dependencies = [ - "arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "ethabi 12.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ethers-types 0.1.0", - "ethers-utils 0.1.0", - "serde_json 1.0.53 (registry+https://github.com/rust-lang/crates.io-index)", - "thiserror 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "ethers-contract" version = "0.1.0" dependencies = [ - "ethers-abi 0.1.0", "ethers-contract-abigen 0.1.0", "ethers-contract-derive 0.1.0", "ethers-providers 0.1.0", @@ -276,7 +262,6 @@ dependencies = [ "Inflector 0.11.4 (registry+https://github.com/rust-lang/crates.io-index)", "anyhow 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", "curl 0.4.29 (registry+https://github.com/rust-lang/crates.io-index)", - "ethers-abi 0.1.0", "ethers-types 0.1.0", "once_cell 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", @@ -291,8 +276,8 @@ dependencies = [ name = "ethers-contract-derive" version = "0.1.0" dependencies = [ - "ethers-abi 0.1.0", "ethers-contract-abigen 0.1.0", + "ethers-types 0.1.0", "proc-macro2 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.53 (registry+https://github.com/rust-lang/crates.io-index)", @@ -304,7 +289,6 @@ name = "ethers-providers" version = "0.1.0" dependencies = [ "async-trait 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", - "ethers-abi 0.1.0", "ethers-types 0.1.0", "ethers-utils 0.1.0", "reqwest 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -329,7 +313,9 @@ dependencies = [ name = "ethers-types" version = "0.1.0" dependencies = [ + "arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "bincode 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ethabi 12.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethereum-types 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", "ethers-utils 0.1.0", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index abd2dbb9..d8f202d7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,6 @@ members = [ "./crates/ethers", - "./crates/ethers-abi", "./crates/ethers-contract", "./crates/ethers-providers", "./crates/ethers-signers", diff --git a/crates/ethers-abi/Cargo.toml b/crates/ethers-abi/Cargo.toml deleted file mode 100644 index fe43f241..00000000 --- a/crates/ethers-abi/Cargo.toml +++ /dev/null @@ -1,16 +0,0 @@ -[package] -name = "ethers-abi" -version = "0.1.0" -authors = ["Georgios Konstantopoulos "] -edition = "2018" - -[dependencies] -ethers-types = { version = "0.1.0", path = "../ethers-types" } -ethers-utils = { version = "0.1.0", path = "../ethers-utils" } - -ethabi = "12.0.0" -arrayvec = "0.5.1" -thiserror = { version = "1.0.19", default-features = false } - -[dev-dependencies] -serde_json = { version = "1.0.53", default-features = false } diff --git a/crates/ethers-contract/Cargo.toml b/crates/ethers-contract/Cargo.toml index 05525f5a..c631f657 100644 --- a/crates/ethers-contract/Cargo.toml +++ b/crates/ethers-contract/Cargo.toml @@ -8,7 +8,6 @@ edition = "2018" ethers-contract-abigen = { version = "0.1.0", path = "ethers-contract-abigen", optional = true } ethers-contract-derive = { version = "0.1.0", path = "ethers-contract-derive", optional = true } -ethers-abi = { version = "0.1.0", path = "../ethers-abi" } ethers-providers = { version = "0.1.0", path = "../ethers-providers" } ethers-signers = { version = "0.1.0", path = "../ethers-signers" } ethers-types = { version = "0.1.0", path = "../ethers-types" } diff --git a/crates/ethers-contract/ethers-contract-abigen/Cargo.toml b/crates/ethers-contract/ethers-contract-abigen/Cargo.toml index 34e9e18e..df49456b 100644 --- a/crates/ethers-contract/ethers-contract-abigen/Cargo.toml +++ b/crates/ethers-contract/ethers-contract-abigen/Cargo.toml @@ -7,7 +7,6 @@ license = "MIT OR Apache-2.0" description = "Code generation for type-safe bindings to Ethereum smart contracts" [dependencies] -ethers-abi = { path = "../../ethers-abi" } ethers-types = { path = "../../ethers-types" } anyhow = "1.0" diff --git a/crates/ethers-contract/ethers-contract-abigen/src/contract.rs b/crates/ethers-contract/ethers-contract-abigen/src/contract.rs index aed7edd2..80091439 100644 --- a/crates/ethers-contract/ethers-contract-abigen/src/contract.rs +++ b/crates/ethers-contract/ethers-contract-abigen/src/contract.rs @@ -12,8 +12,7 @@ mod types; use super::util; use super::Args; use anyhow::{anyhow, Context as _, Result}; -use ethers_abi::Abi; -use ethers_types::Address; +use ethers_types::{abi::Abi, Address}; use inflector::Inflector; use proc_macro2::{Ident, Literal, TokenStream}; use quote::quote; diff --git a/crates/ethers-contract/ethers-contract-abigen/src/contract/events.rs b/crates/ethers-contract/ethers-contract-abigen/src/contract/events.rs index fe46656a..a067ac9b 100644 --- a/crates/ethers-contract/ethers-contract-abigen/src/contract/events.rs +++ b/crates/ethers-contract/ethers-contract-abigen/src/contract/events.rs @@ -1,5 +1,5 @@ use super::{types, util, Context}; -use ethers_abi::{Event, EventExt, EventParam, Hash, ParamType}; +use ethers_types::abi::{Event, EventExt, EventParam, Hash, ParamType}; use anyhow::Result; use inflector::Inflector; @@ -286,7 +286,7 @@ fn expand_hash(hash: Hash) -> TokenStream { #[cfg(test)] mod tests { use super::*; - use ethers_abi::{EventParam, ParamType}; + use ethers_types::abi::{EventParam, ParamType}; #[test] fn expand_transfer_filter() { diff --git a/crates/ethers-contract/ethers-contract-abigen/src/contract/methods.rs b/crates/ethers-contract/ethers-contract-abigen/src/contract/methods.rs index af1e5388..2743a137 100644 --- a/crates/ethers-contract/ethers-contract-abigen/src/contract/methods.rs +++ b/crates/ethers-contract/ethers-contract-abigen/src/contract/methods.rs @@ -1,7 +1,8 @@ use super::{types, util, Context}; - -use ethers_abi::{Function, FunctionExt, Param}; -use ethers_types::Selector; +use ethers_types::{ + abi::{Function, FunctionExt, Param}, + Selector, +}; use anyhow::{anyhow, Context as _, Result}; use inflector::Inflector; @@ -106,7 +107,7 @@ fn expand_selector(selector: Selector) -> TokenStream { #[cfg(test)] mod tests { use super::*; - use ethers_abi::ParamType; + use ethers_types::abi::ParamType; #[test] fn expand_inputs_empty() { diff --git a/crates/ethers-contract/ethers-contract-abigen/src/contract/types.rs b/crates/ethers-contract/ethers-contract-abigen/src/contract/types.rs index eba64c02..ac8c0307 100644 --- a/crates/ethers-contract/ethers-contract-abigen/src/contract/types.rs +++ b/crates/ethers-contract/ethers-contract-abigen/src/contract/types.rs @@ -1,5 +1,5 @@ use anyhow::{anyhow, Result}; -use ethers_abi::ParamType; +use ethers_types::abi::ParamType; use proc_macro2::{Literal, TokenStream}; use quote::quote; diff --git a/crates/ethers-contract/ethers-contract-derive/Cargo.toml b/crates/ethers-contract/ethers-contract-derive/Cargo.toml index 31d8540e..9fbec896 100644 --- a/crates/ethers-contract/ethers-contract-derive/Cargo.toml +++ b/crates/ethers-contract/ethers-contract-derive/Cargo.toml @@ -10,7 +10,7 @@ description = "Proc macro for type-safe bindings generation to Ethereum smart co proc-macro = true [dependencies] -ethers-abi = { path = "../../ethers-abi" } +ethers-types = { path = "../../ethers-types" } ethers-contract-abigen = { path = "../ethers-contract-abigen" } serde_json = "1.0.53" diff --git a/crates/ethers-contract/ethers-contract-derive/src/abigen.rs b/crates/ethers-contract/ethers-contract-derive/src/abigen.rs index afac30f6..99727931 100644 --- a/crates/ethers-contract/ethers-contract-derive/src/abigen.rs +++ b/crates/ethers-contract/ethers-contract-derive/src/abigen.rs @@ -2,8 +2,8 @@ //! ethereum smart contract. use crate::spanned::{ParseInner, Spanned}; -use ethers_abi::{Function, FunctionExt, Param}; use ethers_contract_abigen::Builder; +use ethers_types::abi::{Function, FunctionExt, Param}; use proc_macro2::{Span, TokenStream as TokenStream2}; use quote::{quote, ToTokens as _}; diff --git a/crates/ethers-contract/src/call.rs b/crates/ethers-contract/src/call.rs index 9565761c..87476dda 100644 --- a/crates/ethers-contract/src/call.rs +++ b/crates/ethers-contract/src/call.rs @@ -1,7 +1,9 @@ -use ethers_abi::{Detokenize, Function}; use ethers_providers::{networks::Network, JsonRpcClient}; use ethers_signers::{Client, Signer}; -use ethers_types::{Address, BlockNumber, TransactionRequest, H256, U256}; +use ethers_types::{ + abi::{Detokenize, Error as AbiError, Function, InvalidOutputType}, + Address, BlockNumber, TransactionRequest, H256, U256, +}; use std::{fmt::Debug, marker::PhantomData}; @@ -48,9 +50,9 @@ where P::Error: 'static, { #[error(transparent)] - DecodingError(#[from] ethers_abi::Error), + DecodingError(#[from] AbiError), #[error(transparent)] - DetokenizationError(#[from] ethers_abi::InvalidOutputType), + DetokenizationError(#[from] InvalidOutputType), #[error(transparent)] CallError(P::Error), } diff --git a/crates/ethers-contract/src/contract.rs b/crates/ethers-contract/src/contract.rs index 72edf1e0..8d7bfe1e 100644 --- a/crates/ethers-contract/src/contract.rs +++ b/crates/ethers-contract/src/contract.rs @@ -1,9 +1,11 @@ use crate::{ContractCall, Event}; -use ethers_abi::{Abi, Detokenize, Error, EventExt, Function, FunctionExt, Tokenize}; use ethers_providers::{networks::Network, JsonRpcClient}; use ethers_signers::{Client, Signer}; -use ethers_types::{Address, Filter, NameOrAddress, Selector, TransactionRequest}; +use ethers_types::{ + abi::{Abi, Detokenize, Error, EventExt, Function, FunctionExt, Tokenize}, + Address, Filter, NameOrAddress, Selector, TransactionRequest, +}; use rustc_hex::ToHex; use std::{collections::HashMap, fmt::Debug, hash::Hash, marker::PhantomData}; diff --git a/crates/ethers-contract/src/event.rs b/crates/ethers-contract/src/event.rs index ec18c692..691c5668 100644 --- a/crates/ethers-contract/src/event.rs +++ b/crates/ethers-contract/src/event.rs @@ -1,9 +1,11 @@ use crate::ContractError; -use ethers_abi::{Detokenize, Event as AbiEvent, RawLog}; use ethers_providers::{networks::Network, JsonRpcClient, Provider}; -use ethers_types::{BlockNumber, Filter, ValueOrArray, H256}; +use ethers_types::{ + abi::{Detokenize, Event as AbiEvent, RawLog}, + BlockNumber, Filter, ValueOrArray, H256, +}; use std::marker::PhantomData; diff --git a/crates/ethers-contract/src/lib.rs b/crates/ethers-contract/src/lib.rs index c76e08a7..99352d49 100644 --- a/crates/ethers-contract/src/lib.rs +++ b/crates/ethers-contract/src/lib.rs @@ -14,8 +14,8 @@ pub use ethers_contract_abigen::Builder; pub use ethers_contract_derive::abigen; // re-export for convenience -pub use ethers_abi as abi; pub use ethers_providers as providers; pub use ethers_signers as signers; pub use ethers_types as types; +pub use ethers_types::abi; pub use once_cell::sync::Lazy; diff --git a/crates/ethers-providers/Cargo.toml b/crates/ethers-providers/Cargo.toml index e3ecb248..fd090ccb 100644 --- a/crates/ethers-providers/Cargo.toml +++ b/crates/ethers-providers/Cargo.toml @@ -7,7 +7,6 @@ edition = "2018" [dependencies] ethers-types = { version = "0.1.0", path = "../ethers-types" } ethers-utils = { version = "0.1.0", path = "../ethers-utils" } -ethers-abi = { version = "0.1.0", path = "../ethers-abi" } async-trait = { version = "0.1.31", default-features = false } reqwest = { version = "0.10.4", default-features = false, features = ["json", "rustls-tls"] } diff --git a/crates/ethers-providers/src/provider.rs b/crates/ethers-providers/src/provider.rs index 2aa6639e..b12ffaf0 100644 --- a/crates/ethers-providers/src/provider.rs +++ b/crates/ethers-providers/src/provider.rs @@ -1,7 +1,7 @@ use crate::{ens, http::Provider as HttpProvider, networks::Network, JsonRpcClient}; -use ethers_abi::{Detokenize, ParamType}; use ethers_types::{ + abi::{self, Detokenize, ParamType}, Address, Block, BlockId, BlockNumber, Bytes, Filter, Log, NameOrAddress, Selector, Transaction, TransactionReceipt, TransactionRequest, TxHash, U256, }; @@ -256,8 +256,8 @@ impl Provider { /// /// If the provided bytes were not an interpretation of an address fn decode_bytes(param: ParamType, bytes: Bytes) -> T { - let tokens = ethers_abi::decode(&[param], &bytes.0) - .expect("could not abi-decode bytes to address tokens"); + let tokens = + abi::decode(&[param], &bytes.0).expect("could not abi-decode bytes to address tokens"); T::from_tokens(tokens).expect("could not parse tokens as address") } diff --git a/crates/ethers-types/Cargo.toml b/crates/ethers-types/Cargo.toml index 6edfdd4d..59ceb197 100644 --- a/crates/ethers-types/Cargo.toml +++ b/crates/ethers-types/Cargo.toml @@ -7,18 +7,27 @@ edition = "2018" [dependencies] ethers-utils = { version = "0.1.0", path = "../ethers-utils" } +# ethereum related ethereum-types = { version = "0.9.2", default-features = false, features = ["serialize"] } -serde = { version = "1.0.110", default-features = false, features = ["derive"] } rlp = { version = "0.4.5", default-features = false } -rustc-hex = { version = "2.1.0", default-features = false } -thiserror = { version = "1.0.19", default-features = false } +ethabi = { version = "12.0.0", default-features = false, optional = true } # crypto secp256k1 = { version = "0.17.2", default-features = false, features = ["std", "recovery", "rand"] } rand = { version = "0.5.1", default-features = false } # this should be the same rand crate version as the one in secp zeroize = { version = "1.1.0", default-features = false } +# misc +serde = { version = "1.0.110", default-features = false, features = ["derive"] } +rustc-hex = { version = "2.1.0", default-features = false } +thiserror = { version = "1.0.19", default-features = false } +arrayvec = { version = "0.5.1", default-features = false, optional = true } + [dev-dependencies] serde_json = { version = "1.0.53", default-features = false } rand = { version = "0.5.1" } bincode = "1.2.1" + +[features] +default = ["abi"] +abi = ["ethabi", "arrayvec"] diff --git a/crates/ethers-abi/src/lib.rs b/crates/ethers-types/src/abi/mod.rs similarity index 99% rename from crates/ethers-abi/src/lib.rs rename to crates/ethers-types/src/abi/mod.rs index b372e3f2..eae95c54 100644 --- a/crates/ethers-abi/src/lib.rs +++ b/crates/ethers-types/src/abi/mod.rs @@ -1,6 +1,6 @@ //! This module implements extensions to the `ethabi` API. //! Taken from: https://github.com/gnosis/ethcontract-rs/blob/master/common/src/abiext.rs -use ethers_types::Selector; +use crate::Selector; use ethers_utils::id; pub use ethabi::Contract as Abi; diff --git a/crates/ethers-abi/src/tokens.rs b/crates/ethers-types/src/abi/tokens.rs similarity index 99% rename from crates/ethers-abi/src/tokens.rs rename to crates/ethers-types/src/abi/tokens.rs index 16fb42fa..35861522 100644 --- a/crates/ethers-abi/src/tokens.rs +++ b/crates/ethers-types/src/abi/tokens.rs @@ -1,10 +1,9 @@ //! Contract Functions Output types. //! Adapted from: https://github.com/tomusdrw/rust-web3/blob/master/src/contract/tokens.rs #![allow(clippy::all)] -use crate::Token; +use crate::{abi::Token, Address, Bytes, H256, U128, U256}; use arrayvec::ArrayVec; -use ethers_types::{Address, Bytes, H256, U128, U256}; use thiserror::Error; #[derive(Clone, Debug, Error)] @@ -470,8 +469,8 @@ impl_fixed_types!(1024); #[cfg(test)] mod tests { use super::{Detokenize, Tokenizable}; + use crate::{Address, U256}; use ethabi::Token; - use ethers_types::{Address, U256}; fn output() -> R { unimplemented!() diff --git a/crates/ethers-types/src/block.rs b/crates/ethers-types/src/chainstate/block.rs similarity index 95% rename from crates/ethers-types/src/block.rs rename to crates/ethers-types/src/chainstate/block.rs index 40dd2750..54c9d922 100644 --- a/crates/ethers-types/src/block.rs +++ b/crates/ethers-types/src/chainstate/block.rs @@ -1,3 +1,4 @@ +// Taken from https://github.com/tomusdrw/rust-web3/blob/master/src/types/block.rs use crate::{Address, Bloom, Bytes, H256, U256, U64}; use serde::{ser::SerializeStruct, Deserialize, Serialize, Serializer}; @@ -63,8 +64,13 @@ pub struct Block { } #[derive(Copy, Clone, Debug, PartialEq)] +/// A Block Hash or Block Number pub enum BlockId { + // TODO: May want to expand this to include the requireCanonical field + // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1898.md + /// A block hash Hash(H256), + /// A block number Number(BlockNumber), } @@ -102,7 +108,7 @@ impl Serialize for BlockId { } } -/// Block Number +/// A block Number (or tag - "latest", "earliest", "pending") #[derive(Copy, Clone, Debug, PartialEq)] pub enum BlockNumber { /// Latest block diff --git a/crates/ethers-types/src/bytes.rs b/crates/ethers-types/src/chainstate/bytes.rs similarity index 100% rename from crates/ethers-types/src/bytes.rs rename to crates/ethers-types/src/chainstate/bytes.rs diff --git a/crates/ethers-types/src/ens.rs b/crates/ethers-types/src/chainstate/ens.rs similarity index 100% rename from crates/ethers-types/src/ens.rs rename to crates/ethers-types/src/chainstate/ens.rs diff --git a/crates/ethers-types/src/log.rs b/crates/ethers-types/src/chainstate/log.rs similarity index 100% rename from crates/ethers-types/src/log.rs rename to crates/ethers-types/src/chainstate/log.rs diff --git a/crates/ethers-types/src/chainstate/mod.rs b/crates/ethers-types/src/chainstate/mod.rs new file mode 100644 index 00000000..2933bdf4 --- /dev/null +++ b/crates/ethers-types/src/chainstate/mod.rs @@ -0,0 +1,27 @@ +pub type Selector = [u8; 4]; + +// Re-export common ethereum datatypes with more specific names +pub use ethereum_types::H256 as TxHash; +pub use ethereum_types::{Address, Bloom, H160, H256, U128, U256, U64}; + +mod transaction; +pub use transaction::{Overrides, Transaction, TransactionReceipt, TransactionRequest}; + +mod bytes; +pub use bytes::Bytes; + +mod block; +pub use block::{Block, BlockId, BlockNumber}; + +mod log; +pub use log::{Filter, Log, ValueOrArray}; + +mod ens; +pub use ens::NameOrAddress; + +// re-export the non-standard rand version so that other crates don't use the +// wrong one by accident +pub use rand; + +// re-export libsecp +pub use secp256k1; diff --git a/crates/ethers-types/src/transaction.rs b/crates/ethers-types/src/chainstate/transaction.rs similarity index 100% rename from crates/ethers-types/src/transaction.rs rename to crates/ethers-types/src/chainstate/transaction.rs diff --git a/crates/ethers-types/src/keys.rs b/crates/ethers-types/src/crypto/keys.rs similarity index 95% rename from crates/ethers-types/src/keys.rs rename to crates/ethers-types/src/crypto/keys.rs index c17f9ce4..8398bc48 100644 --- a/crates/ethers-types/src/keys.rs +++ b/crates/ethers-types/src/crypto/keys.rs @@ -74,20 +74,21 @@ impl PrivateKey { tx: TransactionRequest, chain_id: Option, ) -> Result { - // Calling ` + // The nonce, gas and gasprice fields must already be populated let nonce = tx.nonce.ok_or(TxError::NonceMissing)?; - let gas_price = tx.gas_price.ok_or(TxError::NonceMissing)?; - let gas = tx.gas.ok_or(TxError::NonceMissing)?; + let gas_price = tx.gas_price.ok_or(TxError::GasPriceMissing)?; + let gas = tx.gas.ok_or(TxError::GasMissing)?; // Hash the transaction's RLP encoding let hash = tx.hash(chain_id); let message = Message::from_slice(hash.as_bytes()).expect("hash is non-zero 32-bytes; qed"); + // Sign it (with replay protection if applicable) let signature = self.sign_with_eip155(&message, chain_id); - let rlp = tx.rlp_signed(&signature); let hash = keccak256(&rlp.0); + // This function should not be called with ENS names let to = tx.to.map(|to| match to { NameOrAddress::Address(inner) => inner, NameOrAddress::Name(_) => { @@ -129,6 +130,7 @@ impl PrivateKey { } } +/// Applies [EIP155](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md) fn to_eip155_v(recovery_id: RecoveryId, chain_id: Option) -> u64 { let standard_v = recovery_id.to_i32() as u64; if let Some(chain_id) = chain_id { @@ -156,7 +158,7 @@ impl Deref for PrivateKey { impl DefaultIsZeroes for PrivateKey {} -/// A public key +/// A secp256k1 Public Key #[derive(Clone, Debug, PartialEq, Eq)] pub struct PublicKey(pub(super) PubKey); diff --git a/crates/ethers-types/src/crypto/mod.rs b/crates/ethers-types/src/crypto/mod.rs new file mode 100644 index 00000000..95d5a113 --- /dev/null +++ b/crates/ethers-types/src/crypto/mod.rs @@ -0,0 +1,5 @@ +mod keys; +pub use keys::{PrivateKey, PublicKey, TxError}; + +mod signature; +pub use signature::Signature; diff --git a/crates/ethers-types/src/signature.rs b/crates/ethers-types/src/crypto/signature.rs similarity index 100% rename from crates/ethers-types/src/signature.rs rename to crates/ethers-types/src/crypto/signature.rs diff --git a/crates/ethers-types/src/lib.rs b/crates/ethers-types/src/lib.rs index c133bd57..864931c4 100644 --- a/crates/ethers-types/src/lib.rs +++ b/crates/ethers-types/src/lib.rs @@ -1,35 +1,10 @@ //! Various Ethereum Related Datatypes -pub type Selector = [u8; 4]; +mod crypto; +pub use crypto::*; -// Re-export common ethereum datatypes with more specific names -pub use ethereum_types::H256 as TxHash; -pub use ethereum_types::{Address, Bloom, H160, H256, U128, U256, U64}; +mod chainstate; +pub use chainstate::*; -mod transaction; -pub use transaction::{Overrides, Transaction, TransactionReceipt, TransactionRequest}; - -mod keys; -pub use keys::{PrivateKey, PublicKey, TxError}; - -mod signature; -pub use signature::Signature; - -mod bytes; -pub use bytes::Bytes; - -mod block; -pub use block::{Block, BlockId, BlockNumber}; - -mod log; -pub use log::{Filter, Log, ValueOrArray}; - -mod ens; -pub use ens::NameOrAddress; - -// re-export the non-standard rand version so that other crates don't use the -// wrong one by accident -pub use rand; - -// re-export libsecp -pub use secp256k1; +#[cfg(feature = "abi")] +pub mod abi; diff --git a/crates/ethers/Cargo.toml b/crates/ethers/Cargo.toml index 0b711bf4..29e443f5 100644 --- a/crates/ethers/Cargo.toml +++ b/crates/ethers/Cargo.toml @@ -7,7 +7,6 @@ edition = "2018" [features] default = ["full"] full = [ - "abi", "contract", "providers", "signers", @@ -15,7 +14,6 @@ full = [ "utils", ] -abi = ["ethers-abi"] contract = ["ethers-contract"] providers = ["ethers-providers"] signers = ["ethers-signers"] @@ -23,7 +21,6 @@ types = ["ethers-types"] utils = ["ethers-utils"] [dependencies] -ethers-abi = { version = "0.1.0", path = "../ethers-abi", optional = true } ethers-contract = { version = "0.1.0", path = "../ethers-contract", features = ["abigen"], optional = true } ethers-providers = { version = "0.1.0", path = "../ethers-providers", optional = true } ethers-signers = { version = "0.1.0", path = "../ethers-signers", optional = true } diff --git a/crates/ethers/src/lib.rs b/crates/ethers/src/lib.rs index 7450f8d3..a4324b58 100644 --- a/crates/ethers/src/lib.rs +++ b/crates/ethers/src/lib.rs @@ -15,11 +15,6 @@ //! More examples can be found in the [`examples` directory of the //! repositry](https://github.com/gakonst/ethers-rs) -#[cfg(feature = "abi")] -pub mod abi { - pub use ethers_abi::*; -} - #[cfg(feature = "contract")] pub mod contract { pub use ethers_contract::*;