refactor ethers-types -> ethers-core
This commit is contained in:
parent
0013edf0e1
commit
a9643fc9f6
File diff suppressed because it is too large
Load Diff
|
@ -5,5 +5,5 @@ members = [
|
||||||
"./crates/ethers-contract",
|
"./crates/ethers-contract",
|
||||||
"./crates/ethers-providers",
|
"./crates/ethers-providers",
|
||||||
"./crates/ethers-signers",
|
"./crates/ethers-signers",
|
||||||
"./crates/ethers-types",
|
"./crates/ethers-core",
|
||||||
]
|
]
|
||||||
|
|
|
@ -10,7 +10,7 @@ ethers-contract-derive = { version = "0.1.0", path = "ethers-contract-derive", o
|
||||||
|
|
||||||
ethers-providers = { version = "0.1.0", path = "../ethers-providers" }
|
ethers-providers = { version = "0.1.0", path = "../ethers-providers" }
|
||||||
ethers-signers = { version = "0.1.0", path = "../ethers-signers" }
|
ethers-signers = { version = "0.1.0", path = "../ethers-signers" }
|
||||||
ethers-types = { version = "0.1.0", path = "../ethers-types" }
|
ethers-core = { version = "0.1.0", path = "../ethers-core" }
|
||||||
|
|
||||||
serde = { version = "1.0.110", default-features = false }
|
serde = { version = "1.0.110", default-features = false }
|
||||||
rustc-hex = { version = "2.1.0", default-features = false }
|
rustc-hex = { version = "2.1.0", default-features = false }
|
||||||
|
|
|
@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0"
|
||||||
description = "Code generation for type-safe bindings to Ethereum smart contracts"
|
description = "Code generation for type-safe bindings to Ethereum smart contracts"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ethers-types = { path = "../../ethers-types" }
|
ethers-core = { path = "../../ethers-core" }
|
||||||
|
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
curl = "0.4"
|
curl = "0.4"
|
||||||
|
|
|
@ -12,7 +12,7 @@ mod types;
|
||||||
use super::util;
|
use super::util;
|
||||||
use super::Args;
|
use super::Args;
|
||||||
use anyhow::{anyhow, Context as _, Result};
|
use anyhow::{anyhow, Context as _, Result};
|
||||||
use ethers_types::{abi::Abi, Address};
|
use ethers_core::{abi::Abi, types::Address};
|
||||||
use inflector::Inflector;
|
use inflector::Inflector;
|
||||||
use proc_macro2::{Ident, Literal, TokenStream};
|
use proc_macro2::{Ident, Literal, TokenStream};
|
||||||
use quote::quote;
|
use quote::quote;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use super::Context;
|
use super::Context;
|
||||||
|
|
||||||
use ethers_types::Address;
|
use ethers_core::types::Address;
|
||||||
use proc_macro2::{Literal, TokenStream};
|
use proc_macro2::{Literal, TokenStream};
|
||||||
use quote::quote;
|
use quote::quote;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use super::{types, util, Context};
|
use super::{types, util, Context};
|
||||||
use ethers_types::abi::{Event, EventExt, EventParam, Hash, ParamType};
|
use ethers_core::abi::{Event, EventExt, EventParam, Hash, ParamType};
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use inflector::Inflector;
|
use inflector::Inflector;
|
||||||
|
@ -286,7 +286,7 @@ fn expand_hash(hash: Hash) -> TokenStream {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use ethers_types::abi::{EventParam, ParamType};
|
use ethers_core::abi::{EventParam, ParamType};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn expand_transfer_filter() {
|
fn expand_transfer_filter() {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use super::{types, util, Context};
|
use super::{types, util, Context};
|
||||||
use ethers_types::{
|
use ethers_core::{
|
||||||
abi::{Function, FunctionExt, Param},
|
abi::{Function, FunctionExt, Param},
|
||||||
Selector,
|
types::Selector,
|
||||||
};
|
};
|
||||||
|
|
||||||
use anyhow::{anyhow, Context as _, Result};
|
use anyhow::{anyhow, Context as _, Result};
|
||||||
|
@ -107,7 +107,7 @@ fn expand_selector(selector: Selector) -> TokenStream {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use ethers_types::abi::ParamType;
|
use ethers_core::abi::ParamType;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn expand_inputs_empty() {
|
fn expand_inputs_empty() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, Result};
|
||||||
use ethers_types::abi::ParamType;
|
use ethers_core::abi::ParamType;
|
||||||
use proc_macro2::{Literal, TokenStream};
|
use proc_macro2::{Literal, TokenStream};
|
||||||
use quote::quote;
|
use quote::quote;
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ mod rustfmt;
|
||||||
mod source;
|
mod source;
|
||||||
mod util;
|
mod util;
|
||||||
|
|
||||||
pub use ethers_types::Address;
|
pub use ethers_core::types::Address;
|
||||||
pub use source::Source;
|
pub use source::Source;
|
||||||
pub use util::parse_address;
|
pub use util::parse_address;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//! Module implements reading of contract artifacts from various sources.
|
//! Module implements reading of contract artifacts from various sources.
|
||||||
use super::util;
|
use super::util;
|
||||||
use ethers_types::Address;
|
use ethers_core::types::Address;
|
||||||
|
|
||||||
use anyhow::{anyhow, Context, Error, Result};
|
use anyhow::{anyhow, Context, Error, Result};
|
||||||
use std::{
|
use std::{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use ethers_types::Address;
|
use ethers_core::types::Address;
|
||||||
|
|
||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, Result};
|
||||||
use curl::easy::Easy;
|
use curl::easy::Easy;
|
||||||
|
|
|
@ -10,7 +10,7 @@ description = "Proc macro for type-safe bindings generation to Ethereum smart co
|
||||||
proc-macro = true
|
proc-macro = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ethers-types = { path = "../../ethers-types" }
|
ethers-core = { path = "../../ethers-core" }
|
||||||
ethers-contract-abigen = { path = "../ethers-contract-abigen" }
|
ethers-contract-abigen = { path = "../ethers-contract-abigen" }
|
||||||
|
|
||||||
serde_json = "1.0.53"
|
serde_json = "1.0.53"
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
use crate::spanned::{ParseInner, Spanned};
|
use crate::spanned::{ParseInner, Spanned};
|
||||||
|
|
||||||
use ethers_contract_abigen::Builder;
|
use ethers_contract_abigen::Builder;
|
||||||
use ethers_types::abi::{Function, FunctionExt, Param};
|
use ethers_core::abi::{Function, FunctionExt, Param};
|
||||||
|
|
||||||
use proc_macro2::{Span, TokenStream as TokenStream2};
|
use proc_macro2::{Span, TokenStream as TokenStream2};
|
||||||
use quote::{quote, ToTokens as _};
|
use quote::{quote, ToTokens as _};
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
|
use ethers_core::{
|
||||||
|
abi::{Detokenize, Error as AbiError, Function, InvalidOutputType},
|
||||||
|
types::{Address, BlockNumber, TransactionRequest, H256, U256},
|
||||||
|
};
|
||||||
use ethers_providers::{networks::Network, JsonRpcClient};
|
use ethers_providers::{networks::Network, JsonRpcClient};
|
||||||
use ethers_signers::{Client, Signer};
|
use ethers_signers::{Client, Signer};
|
||||||
use ethers_types::{
|
|
||||||
abi::{Detokenize, Error as AbiError, Function, InvalidOutputType},
|
|
||||||
Address, BlockNumber, TransactionRequest, H256, U256,
|
|
||||||
};
|
|
||||||
|
|
||||||
use std::{fmt::Debug, marker::PhantomData};
|
use std::{fmt::Debug, marker::PhantomData};
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
use crate::{ContractCall, Event};
|
use crate::{ContractCall, Event};
|
||||||
|
|
||||||
|
use ethers_core::{
|
||||||
|
abi::{Abi, Detokenize, Error, EventExt, Function, FunctionExt, Tokenize},
|
||||||
|
types::{Address, Filter, NameOrAddress, Selector, TransactionRequest},
|
||||||
|
};
|
||||||
use ethers_providers::{networks::Network, JsonRpcClient};
|
use ethers_providers::{networks::Network, JsonRpcClient};
|
||||||
use ethers_signers::{Client, Signer};
|
use ethers_signers::{Client, Signer};
|
||||||
use ethers_types::{
|
|
||||||
abi::{Abi, Detokenize, Error, EventExt, Function, FunctionExt, Tokenize},
|
|
||||||
Address, Filter, NameOrAddress, Selector, TransactionRequest,
|
|
||||||
};
|
|
||||||
|
|
||||||
use rustc_hex::ToHex;
|
use rustc_hex::ToHex;
|
||||||
use std::{collections::HashMap, fmt::Debug, hash::Hash, marker::PhantomData};
|
use std::{collections::HashMap, fmt::Debug, hash::Hash, marker::PhantomData};
|
||||||
|
|
|
@ -2,9 +2,9 @@ use crate::ContractError;
|
||||||
|
|
||||||
use ethers_providers::{networks::Network, JsonRpcClient, Provider};
|
use ethers_providers::{networks::Network, JsonRpcClient, Provider};
|
||||||
|
|
||||||
use ethers_types::{
|
use ethers_core::{
|
||||||
abi::{Detokenize, Event as AbiEvent, RawLog},
|
abi::{Detokenize, Event as AbiEvent, RawLog},
|
||||||
BlockNumber, Filter, ValueOrArray, H256,
|
types::{BlockNumber, Filter, ValueOrArray, H256},
|
||||||
};
|
};
|
||||||
|
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
use crate::{Contract, ContractError};
|
use crate::{Contract, ContractError};
|
||||||
|
|
||||||
|
use ethers_core::{
|
||||||
|
abi::{Abi, Tokenize},
|
||||||
|
types::{Bytes, TransactionRequest},
|
||||||
|
};
|
||||||
use ethers_providers::{networks::Network, JsonRpcClient};
|
use ethers_providers::{networks::Network, JsonRpcClient};
|
||||||
use ethers_signers::{Client, Signer};
|
use ethers_signers::{Client, Signer};
|
||||||
use ethers_types::{
|
|
||||||
abi::{Abi, Tokenize},
|
|
||||||
Bytes, TransactionRequest,
|
|
||||||
};
|
|
||||||
|
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use tokio::time;
|
use tokio::time;
|
||||||
|
|
|
@ -17,8 +17,8 @@ pub use ethers_contract_abigen::Builder;
|
||||||
pub use ethers_contract_derive::abigen;
|
pub use ethers_contract_derive::abigen;
|
||||||
|
|
||||||
// re-export for convenience
|
// re-export for convenience
|
||||||
|
pub use ethers_core::abi;
|
||||||
|
pub use ethers_core::types;
|
||||||
pub use ethers_providers as providers;
|
pub use ethers_providers as providers;
|
||||||
pub use ethers_signers as signers;
|
pub use ethers_signers as signers;
|
||||||
pub use ethers_types as types;
|
|
||||||
pub use ethers_types::abi;
|
|
||||||
pub use once_cell::sync::Lazy;
|
pub use once_cell::sync::Lazy;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
name = "ethers-types"
|
name = "ethers-core"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Georgios Konstantopoulos <me@gakonst.com>"]
|
authors = ["Georgios Konstantopoulos <me@gakonst.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
|
@ -1,6 +1,6 @@
|
||||||
//! This module implements extensions to the `ethabi` API.
|
//! This module implements extensions to the `ethabi` API.
|
||||||
// Adapted from [Gnosis' ethcontract](https://github.com/gnosis/ethcontract-rs/blob/master/common/src/abiext.rs)
|
// Adapted from [Gnosis' ethcontract](https://github.com/gnosis/ethcontract-rs/blob/master/common/src/abiext.rs)
|
||||||
use crate::{utils::id, Selector};
|
use crate::{types::Selector, utils::id};
|
||||||
|
|
||||||
pub use ethabi::Contract as Abi;
|
pub use ethabi::Contract as Abi;
|
||||||
pub use ethabi::*;
|
pub use ethabi::*;
|
|
@ -1,7 +1,10 @@
|
||||||
//! Contract Functions Output types.
|
//! Contract Functions Output types.
|
||||||
// Adapted from: [rust-web3](https://github.com/tomusdrw/rust-web3/blob/master/src/contract/tokens.rs)
|
// Adapted from: [rust-web3](https://github.com/tomusdrw/rust-web3/blob/master/src/contract/tokens.rs)
|
||||||
#![allow(clippy::all)]
|
#![allow(clippy::all)]
|
||||||
use crate::{abi::Token, Address, Bytes, H256, U128, U256};
|
use crate::{
|
||||||
|
abi::Token,
|
||||||
|
types::{Address, Bytes, H256, U128, U256},
|
||||||
|
};
|
||||||
|
|
||||||
use arrayvec::ArrayVec;
|
use arrayvec::ArrayVec;
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
@ -469,7 +472,7 @@ impl_fixed_types!(1024);
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{Detokenize, Tokenizable};
|
use super::{Detokenize, Tokenizable};
|
||||||
use crate::{Address, U256};
|
use crate::types::{Address, U256};
|
||||||
use ethabi::Token;
|
use ethabi::Token;
|
||||||
|
|
||||||
fn output<R: Detokenize>() -> R {
|
fn output<R: Detokenize>() -> R {
|
|
@ -9,7 +9,7 @@
|
||||||
//! signing the hash of the result.
|
//! signing the hash of the result.
|
||||||
//!
|
//!
|
||||||
//! ```rust
|
//! ```rust
|
||||||
//! use ethers_types::{PrivateKey, Address};
|
//! use ethers_core::types::{PrivateKey, Address};
|
||||||
//!
|
//!
|
||||||
//! let message = "Some data";
|
//! let message = "Some data";
|
||||||
//! let key = PrivateKey::new(&mut rand::thread_rng());
|
//! let key = PrivateKey::new(&mut rand::thread_rng());
|
||||||
|
@ -24,6 +24,12 @@
|
||||||
//! assert_eq!(recovered, address);
|
//! assert_eq!(recovered, address);
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
|
//! # Utilities
|
||||||
|
//!
|
||||||
|
//! The crate provides utilities for launching local Ethereum testnets by using `ganache-cli`
|
||||||
|
//! via the `GanacheBuilder` struct. In addition, you're able to compile contracts on the
|
||||||
|
//! filesystem by providing a glob to their path, using the `Solc` struct.
|
||||||
|
//!
|
||||||
//! # ABI Encoding and Decoding
|
//! # ABI Encoding and Decoding
|
||||||
//!
|
//!
|
||||||
//! This crate re-exports the [`ethabi`](http://docs.rs/ethabi) crate's functions
|
//! This crate re-exports the [`ethabi`](http://docs.rs/ethabi) crate's functions
|
||||||
|
@ -34,14 +40,20 @@
|
||||||
//! The version of `rand` used in the `secp256k1` crate is not compatible with the
|
//! The version of `rand` used in the `secp256k1` crate is not compatible with the
|
||||||
//! latest one in crates at the time of writing (rand version 0.5.1, secp256k1 version 0.17.1)
|
//! latest one in crates at the time of writing (rand version 0.5.1, secp256k1 version 0.17.1)
|
||||||
//! As a result, the RNGs used for generating private keys must use a compatible rand crate
|
//! As a result, the RNGs used for generating private keys must use a compatible rand crate
|
||||||
//! version. For convenience, we re-export it so that consumers can use it as `ethers_types::rand`.
|
//! version. For convenience, we re-export it so that consumers can use it as `ethers_core::rand`.
|
||||||
mod crypto;
|
|
||||||
pub use crypto::*;
|
|
||||||
|
|
||||||
mod chainstate;
|
/// Ethereum related datatypes
|
||||||
pub use chainstate::*;
|
pub mod types;
|
||||||
|
|
||||||
#[cfg(feature = "abi")]
|
#[cfg(feature = "abi")]
|
||||||
pub mod abi;
|
pub mod abi;
|
||||||
|
|
||||||
|
/// Various utilities
|
||||||
pub mod utils;
|
pub mod utils;
|
||||||
|
|
||||||
|
// 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;
|
|
@ -1,5 +1,5 @@
|
||||||
// Taken from https://github.com/tomusdrw/rust-web3/blob/master/src/types/block.rs
|
// Taken from https://github.com/tomusdrw/rust-web3/blob/master/src/types/block.rs
|
||||||
use crate::{Address, Bloom, Bytes, H256, U256, U64};
|
use crate::types::{Address, Bloom, Bytes, H256, U256, U64};
|
||||||
use serde::{ser::SerializeStruct, Deserialize, Serialize, Serializer};
|
use serde::{ser::SerializeStruct, Deserialize, Serialize, Serializer};
|
||||||
|
|
||||||
/// The block type returned from RPC calls.
|
/// The block type returned from RPC calls.
|
||||||
|
@ -150,7 +150,7 @@ impl Serialize for BlockNumber {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::{Transaction, TxHash};
|
use crate::types::{Transaction, TxHash};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn deserialize_blk_no_txs() {
|
fn deserialize_blk_no_txs() {
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::Address;
|
use crate::types::Address;
|
||||||
use rlp::{Encodable, RlpStream};
|
use rlp::{Encodable, RlpStream};
|
||||||
use serde::{ser::Error as SerializationError, Deserialize, Deserializer, Serialize, Serializer};
|
use serde::{ser::Error as SerializationError, Deserialize, Deserializer, Serialize, Serializer};
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
// Adapted from https://github.com/tomusdrw/rust-web3/blob/master/src/types/log.rs
|
// Adapted from https://github.com/tomusdrw/rust-web3/blob/master/src/types/log.rs
|
||||||
use crate::{utils::keccak256, Address, BlockNumber, Bytes, H256, U256, U64};
|
use crate::{
|
||||||
|
types::{Address, BlockNumber, Bytes, H256, U256, U64},
|
||||||
|
utils::keccak256,
|
||||||
|
};
|
||||||
use serde::{ser::SerializeSeq, Deserialize, Serialize, Serializer};
|
use serde::{ser::SerializeSeq, Deserialize, Serialize, Serializer};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
|
@ -21,10 +21,3 @@ pub use log::{Filter, Log, ValueOrArray};
|
||||||
|
|
||||||
mod ens;
|
mod ens;
|
||||||
pub use ens::NameOrAddress;
|
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;
|
|
|
@ -1,6 +1,7 @@
|
||||||
//! Transaction types
|
//! Transaction types
|
||||||
use crate::{
|
use crate::{
|
||||||
utils::keccak256, Address, Bloom, Bytes, Log, NameOrAddress, Signature, H256, U256, U64,
|
types::{Address, Bloom, Bytes, Log, NameOrAddress, Signature, H256, U256, U64},
|
||||||
|
utils::keccak256,
|
||||||
};
|
};
|
||||||
|
|
||||||
use rlp::RlpStream;
|
use rlp::RlpStream;
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
|
types::{Address, NameOrAddress, Signature, Transaction, TransactionRequest, H256, U256, U64},
|
||||||
utils::{hash_message, keccak256},
|
utils::{hash_message, keccak256},
|
||||||
Address, NameOrAddress, Signature, Transaction, TransactionRequest, H256, U256, U64,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
|
@ -234,7 +234,7 @@ impl From<PrivateKey> for Address {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::Bytes;
|
use crate::types::Bytes;
|
||||||
use rustc_hex::FromHex;
|
use rustc_hex::FromHex;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
|
@ -1,5 +1,8 @@
|
||||||
// Code adapted from: https://github.com/tomusdrw/rust-web3/blob/master/src/api/accounts.rs
|
// Code adapted from: https://github.com/tomusdrw/rust-web3/blob/master/src/api/accounts.rs
|
||||||
use crate::{utils::hash_message, Address, PublicKey, H256};
|
use crate::{
|
||||||
|
types::{Address, PublicKey, H256},
|
||||||
|
utils::hash_message,
|
||||||
|
};
|
||||||
|
|
||||||
use rustc_hex::ToHex;
|
use rustc_hex::ToHex;
|
||||||
use secp256k1::{
|
use secp256k1::{
|
||||||
|
@ -191,7 +194,7 @@ impl From<H256> for RecoveryMessage {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::PrivateKey;
|
use crate::types::PrivateKey;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn recover_signature_from_message() {
|
fn recover_signature_from_message() {
|
|
@ -0,0 +1,5 @@
|
||||||
|
mod crypto;
|
||||||
|
pub use crypto::*;
|
||||||
|
|
||||||
|
mod chainstate;
|
||||||
|
pub use chainstate::*;
|
|
@ -12,7 +12,7 @@
|
||||||
//! .build();
|
//! .build();
|
||||||
//! let contract = contracts.get("SimpleStorage").unwrap();
|
//! let contract = contracts.get("SimpleStorage").unwrap();
|
||||||
//! ```
|
//! ```
|
||||||
use crate::{abi::Abi, Bytes};
|
use crate::{abi::Abi, types::Bytes};
|
||||||
use glob::glob;
|
use glob::glob;
|
||||||
use rustc_hex::FromHex;
|
use rustc_hex::FromHex;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
|
@ -5,7 +5,7 @@ authors = ["Georgios Konstantopoulos <me@gakonst.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ethers-types = { version = "0.1.0", path = "../ethers-types" }
|
ethers-core = { version = "0.1.0", path = "../ethers-core" }
|
||||||
|
|
||||||
async-trait = { version = "0.1.31", default-features = false }
|
async-trait = { version = "0.1.31", default-features = false }
|
||||||
reqwest = { version = "0.10.4", default-features = false, features = ["json", "rustls-tls"] }
|
reqwest = { version = "0.10.4", default-features = false, features = ["json", "rustls-tls"] }
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
/// [Ethereum Name Service](https://docs.ens.domains/) support
|
/// [Ethereum Name Service](https://docs.ens.domains/) support
|
||||||
// Adapted from https://github.com/hhatto/rust-ens/blob/master/src/lib.rs
|
// Adapted from https://github.com/hhatto/rust-ens/blob/master/src/lib.rs
|
||||||
use ethers_types::{utils::keccak256, Address, NameOrAddress, Selector, TransactionRequest, H256};
|
use ethers_core::{
|
||||||
|
types::{Address, NameOrAddress, Selector, TransactionRequest, H256},
|
||||||
|
utils::keccak256,
|
||||||
|
};
|
||||||
|
|
||||||
// Selectors
|
// Selectors
|
||||||
const ENS_REVERSE_REGISTRAR_DOMAIN: &str = "addr.reverse";
|
const ENS_REVERSE_REGISTRAR_DOMAIN: &str = "addr.reverse";
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//! Networks are used inside wallets and providers to ensure replay protection across networks,
|
//! Networks are used inside wallets and providers to ensure replay protection across networks,
|
||||||
//! as well as to allow functions to be called with ENS names instead of Addresses.
|
//! as well as to allow functions to be called with ENS names instead of Addresses.
|
||||||
use ethers_types::{Address, H160, U64};
|
use ethers_core::types::{Address, H160, U64};
|
||||||
|
|
||||||
/// Trait for specifying network specific metadata, such as the Chain Id or the ENS
|
/// Trait for specifying network specific metadata, such as the Chain Id or the ENS
|
||||||
/// address.
|
/// address.
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
use crate::{ens, http::Provider as HttpProvider, networks::Network, JsonRpcClient};
|
use crate::{ens, http::Provider as HttpProvider, networks::Network, JsonRpcClient};
|
||||||
|
|
||||||
use ethers_types::{
|
use ethers_core::{
|
||||||
abi::{self, Detokenize, ParamType},
|
abi::{self, Detokenize, ParamType},
|
||||||
utils, Address, Block, BlockId, BlockNumber, Bytes, Filter, Log, NameOrAddress, Selector,
|
types::{
|
||||||
|
Address, Block, BlockId, BlockNumber, Bytes, Filter, Log, NameOrAddress, Selector,
|
||||||
Transaction, TransactionReceipt, TransactionRequest, TxHash, U256,
|
Transaction, TransactionReceipt, TransactionRequest, TxHash, U256,
|
||||||
|
},
|
||||||
|
utils,
|
||||||
};
|
};
|
||||||
|
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|
|
@ -5,5 +5,5 @@ authors = ["Georgios Konstantopoulos <me@gakonst.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ethers-types = { version = "0.1.0", path = "../ethers-types" }
|
ethers-core = { version = "0.1.0", path = "../ethers-core" }
|
||||||
ethers-providers = { version = "0.1.0", path = "../ethers-providers" }
|
ethers-providers = { version = "0.1.0", path = "../ethers-providers" }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::Signer;
|
use crate::Signer;
|
||||||
|
|
||||||
|
use ethers_core::types::{Address, BlockNumber, NameOrAddress, TransactionRequest, TxHash};
|
||||||
use ethers_providers::{networks::Network, JsonRpcClient, Provider};
|
use ethers_providers::{networks::Network, JsonRpcClient, Provider};
|
||||||
use ethers_types::{Address, BlockNumber, NameOrAddress, TransactionRequest, TxHash};
|
|
||||||
|
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ pub use wallet::Wallet;
|
||||||
mod client;
|
mod client;
|
||||||
pub use client::Client;
|
pub use client::Client;
|
||||||
|
|
||||||
use ethers_types::{Address, Signature, Transaction, TransactionRequest};
|
use ethers_core::types::{Address, Signature, Transaction, TransactionRequest};
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
|
|
||||||
/// Trait for signing transactions and messages
|
/// Trait for signing transactions and messages
|
||||||
|
|
|
@ -2,9 +2,10 @@ use crate::{Client, Signer};
|
||||||
|
|
||||||
use ethers_providers::{networks::Network, JsonRpcClient, Provider};
|
use ethers_providers::{networks::Network, JsonRpcClient, Provider};
|
||||||
|
|
||||||
use ethers_types::{
|
use ethers_core::{
|
||||||
rand::Rng, secp256k1, Address, PrivateKey, PublicKey, Signature, Transaction,
|
rand::Rng,
|
||||||
TransactionRequest, TxError,
|
secp256k1,
|
||||||
|
types::{Address, PrivateKey, PublicKey, Signature, Transaction, TransactionRequest, TxError},
|
||||||
};
|
};
|
||||||
|
|
||||||
use std::{marker::PhantomData, str::FromStr};
|
use std::{marker::PhantomData, str::FromStr};
|
||||||
|
|
|
@ -10,19 +10,19 @@ full = [
|
||||||
"contract",
|
"contract",
|
||||||
"providers",
|
"providers",
|
||||||
"signers",
|
"signers",
|
||||||
"types",
|
"core",
|
||||||
]
|
]
|
||||||
|
|
||||||
contract = ["ethers-contract"]
|
contract = ["ethers-contract"]
|
||||||
providers = ["ethers-providers"]
|
providers = ["ethers-providers"]
|
||||||
signers = ["ethers-signers"]
|
signers = ["ethers-signers"]
|
||||||
types = ["ethers-types"]
|
core = ["ethers-core"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ethers-contract = { version = "0.1.0", path = "../ethers-contract", features = ["abigen"], 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-providers = { version = "0.1.0", path = "../ethers-providers", optional = true }
|
||||||
ethers-signers = { version = "0.1.0", path = "../ethers-signers", optional = true }
|
ethers-signers = { version = "0.1.0", path = "../ethers-signers", optional = true }
|
||||||
ethers-types = { version = "0.1.0", path = "../ethers-types", optional = true }
|
ethers-core = { version = "0.1.0", path = "../ethers-core", optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
anyhow = "1.0.31"
|
anyhow = "1.0.31"
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use ethers::{
|
use ethers::{
|
||||||
contract::{abigen, ContractFactory},
|
contract::{abigen, ContractFactory},
|
||||||
|
core::utils::{GanacheBuilder, Solc},
|
||||||
providers::HttpProvider,
|
providers::HttpProvider,
|
||||||
signers::MainnetWallet,
|
signers::MainnetWallet,
|
||||||
types::utils::{GanacheBuilder, Solc},
|
|
||||||
};
|
};
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use ethers::{providers::HttpProvider, signers::MainnetWallet, types::TransactionRequest};
|
use ethers::{core::types::TransactionRequest, providers::HttpProvider, signers::MainnetWallet};
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use ethers::{
|
use ethers::{
|
||||||
|
core::types::{Address, Filter},
|
||||||
providers::{networks::Any, HttpProvider},
|
providers::{networks::Any, HttpProvider},
|
||||||
types::{Address, Filter},
|
|
||||||
};
|
};
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use ethers::{
|
use ethers::{
|
||||||
|
core::{types::TransactionRequest, utils::GanacheBuilder},
|
||||||
providers::HttpProvider,
|
providers::HttpProvider,
|
||||||
signers::MainnetWallet,
|
signers::MainnetWallet,
|
||||||
types::{utils::GanacheBuilder, TransactionRequest},
|
|
||||||
};
|
};
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use ethers::{
|
use ethers::{
|
||||||
|
core::{
|
||||||
|
types::{BlockNumber, TransactionRequest},
|
||||||
|
utils::GanacheBuilder,
|
||||||
|
},
|
||||||
providers::{networks::Any, HttpProvider},
|
providers::{networks::Any, HttpProvider},
|
||||||
types::{utils::GanacheBuilder, BlockNumber, TransactionRequest},
|
|
||||||
};
|
};
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ pub mod signers {
|
||||||
pub use ethers_signers::*;
|
pub use ethers_signers::*;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "types")]
|
#[cfg(feature = "core")]
|
||||||
pub mod types {
|
pub mod core {
|
||||||
pub use ethers_types::*;
|
pub use ethers_core::*;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue