release: 0.6.0 (#611)

* release(core): 0.6.0

* release(providers): 0.6.0

* release(contract-abigen): 0.6.0

* release(contract-derive): 0.6.0

* release(derive-eip712): 0.2.0

* release(ethers-solc): 0.1.0

* release(contract): 0.6.0

* release(etherscan): 0.2.0

* release(signers): 0.6.0

* release(middleware): 0.6.0

* chore: update dev deps

* refactor(core): move docs to readme

* refactor(contract): move docs to readme

* refactor(providers): move docs to readme

* chore: bump ethers cargo toml

* refactor(signers): move docs to readme

* refactor(middleware): move docs to readme

* fix(ethers): adjust re-exports to allow searching internal packages

* docs: fix broken links

we cannot use relative crate imports because the readmes
are also imported by the parent crate

* alias readmes to be accessible to ethers crate
This commit is contained in:
Georgios Konstantopoulos 2021-11-23 21:23:12 +02:00 committed by GitHub
parent fb42f043a2
commit bb3a2fd27c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 348 additions and 294 deletions

24
Cargo.lock generated
View File

@ -946,12 +946,13 @@ dependencies = [
[[package]] [[package]]
name = "ethers" name = "ethers"
version = "0.5.4" version = "0.6.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",
"ethers-contract", "ethers-contract",
"ethers-core", "ethers-core",
"ethers-etherscan",
"ethers-middleware", "ethers-middleware",
"ethers-providers", "ethers-providers",
"ethers-signers", "ethers-signers",
@ -965,7 +966,7 @@ dependencies = [
[[package]] [[package]]
name = "ethers-contract" name = "ethers-contract"
version = "0.5.3" version = "0.6.0"
dependencies = [ dependencies = [
"ethers-contract-abigen", "ethers-contract-abigen",
"ethers-contract-derive", "ethers-contract-derive",
@ -987,7 +988,7 @@ dependencies = [
[[package]] [[package]]
name = "ethers-contract-abigen" name = "ethers-contract-abigen"
version = "0.5.3" version = "0.6.0"
dependencies = [ dependencies = [
"Inflector", "Inflector",
"anyhow", "anyhow",
@ -1007,7 +1008,7 @@ dependencies = [
[[package]] [[package]]
name = "ethers-contract-derive" name = "ethers-contract-derive"
version = "0.5.3" version = "0.6.0"
dependencies = [ dependencies = [
"ethers-contract-abigen", "ethers-contract-abigen",
"ethers-core", "ethers-core",
@ -1020,7 +1021,7 @@ dependencies = [
[[package]] [[package]]
name = "ethers-core" name = "ethers-core"
version = "0.5.5" version = "0.6.0"
dependencies = [ dependencies = [
"arrayvec 0.7.2", "arrayvec 0.7.2",
"bincode", "bincode",
@ -1051,7 +1052,7 @@ dependencies = [
[[package]] [[package]]
name = "ethers-derive-eip712" name = "ethers-derive-eip712"
version = "0.1.0" version = "0.2.0"
dependencies = [ dependencies = [
"ethers-contract", "ethers-contract",
"ethers-contract-derive", "ethers-contract-derive",
@ -1067,7 +1068,7 @@ dependencies = [
[[package]] [[package]]
name = "ethers-etherscan" name = "ethers-etherscan"
version = "0.1.1" version = "0.2.0"
dependencies = [ dependencies = [
"ethers-core", "ethers-core",
"reqwest", "reqwest",
@ -1079,7 +1080,7 @@ dependencies = [
[[package]] [[package]]
name = "ethers-middleware" name = "ethers-middleware"
version = "0.5.3" version = "0.6.0"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"ethers-contract", "ethers-contract",
@ -1105,7 +1106,7 @@ dependencies = [
[[package]] [[package]]
name = "ethers-providers" name = "ethers-providers"
version = "0.5.4" version = "0.6.0"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"auto_impl", "auto_impl",
@ -1138,7 +1139,7 @@ dependencies = [
[[package]] [[package]]
name = "ethers-signers" name = "ethers-signers"
version = "0.5.3" version = "0.6.0"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"coins-bip32", "coins-bip32",
@ -2965,7 +2966,8 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
[[package]] [[package]]
name = "svm-rs" name = "svm-rs"
version = "0.1.2" version = "0.1.2"
source = "git+https://github.com/roynalnaruto/svm-rs#5d353ec236a596dbfd2b37878ee5aee53ab6eadf" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "389ff0db3eea702209e1127ec16e007552f3ccbae84610db6d2f66c7bda0650f"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"cfg-if 1.0.0", "cfg-if 1.0.0",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "ethers" name = "ethers"
version = "0.5.4" version = "0.6.0"
authors = ["Georgios Konstantopoulos <me@gakonst.com>"] authors = ["Georgios Konstantopoulos <me@gakonst.com>"]
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
edition = "2021" edition = "2021"
@ -82,16 +82,17 @@ solc-tests = ["ethers-solc/tests"]
[dependencies] [dependencies]
ethers-contract = { version = "^0.5.0", default-features = false, path = "./ethers-contract" } ethers-contract = { version = "^0.6.0", default-features = false, path = "./ethers-contract" }
ethers-core = { version = "^0.5.0", default-features = false, path = "./ethers-core" } ethers-core = { version = "^0.6.0", default-features = false, path = "./ethers-core" }
ethers-providers = { version = "^0.5.0", default-features = false, path = "./ethers-providers" } ethers-providers = { version = "^0.6.0", default-features = false, path = "./ethers-providers" }
ethers-signers = { version = "^0.5.0", default-features = false, path = "./ethers-signers" } ethers-signers = { version = "^0.6.0", default-features = false, path = "./ethers-signers" }
ethers-middleware = { version = "^0.5.0", default-features = false, path = "./ethers-middleware" } ethers-middleware = { version = "^0.6.0", default-features = false, path = "./ethers-middleware" }
ethers-solc = { version = "^0.1.0", default-features = false, path = "./ethers-solc" } ethers-solc = { version = "^0.1.0", default-features = false, path = "./ethers-solc" }
ethers-etherscan = { version = "^0.2.0", default-features = false, path = "./ethers-etherscan" }
[dev-dependencies] [dev-dependencies]
ethers-contract = { version = "^0.5.0", default-features = false, path = "./ethers-contract", features = ["abigen", "eip712"] } ethers-contract = { version = "^0.6.0", default-features = false, path = "./ethers-contract", features = ["abigen", "eip712"] }
ethers-providers = { version = "^0.5.0", default-features = false, path = "./ethers-providers", features = ["ws", "ipc"] } ethers-providers = { version = "^0.6.0", default-features = false, path = "./ethers-providers", features = ["ws", "ipc"] }
anyhow = "1.0.39" anyhow = "1.0.39"
rand = "0.8.4" rand = "0.8.4"

1
assets/CONTRACT_README.md Symbolic link
View File

@ -0,0 +1 @@
../ethers-contract/README.md

1
assets/CORE_README.md Symbolic link
View File

@ -0,0 +1 @@
../ethers-core/README.md

1
assets/MIDDLEWARE_README.md Symbolic link
View File

@ -0,0 +1 @@
../ethers-middleware/README.md

1
assets/PROVIDERS_README.md Symbolic link
View File

@ -0,0 +1 @@
../ethers-providers/README.md

1
assets/SIGNERS_README.md Symbolic link
View File

@ -0,0 +1 @@
../ethers-signers/README.md

1
assets/SOLC_README.md Symbolic link
View File

@ -0,0 +1 @@
../ethers-solc/README.md

View File

@ -1,7 +1,7 @@
[package] [package]
name = "ethers-contract" name = "ethers-contract"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
version = "0.5.3" version = "0.6.0"
authors = ["Georgios Konstantopoulos <me@gakonst.com>"] authors = ["Georgios Konstantopoulos <me@gakonst.com>"]
edition = "2018" edition = "2018"
description = "Smart contract bindings for the ethers-rs crate" description = "Smart contract bindings for the ethers-rs crate"
@ -10,11 +10,11 @@ repository = "https://github.com/gakonst/ethers-rs"
keywords = ["ethereum", "web3", "celo", "ethers"] keywords = ["ethereum", "web3", "celo", "ethers"]
[dependencies] [dependencies]
ethers-providers = { version = "^0.5.0", path = "../ethers-providers", default-features = false } ethers-providers = { version = "^0.6.0", path = "../ethers-providers", default-features = false }
ethers-core = { version = "^0.5.0", path = "../ethers-core", default-features = false } ethers-core = { version = "^0.6.0", path = "../ethers-core", default-features = false }
ethers-contract-abigen = { version = "^0.5.0", path = "ethers-contract-abigen", default-features = false, optional = true } ethers-contract-abigen = { version = "^0.6.0", path = "ethers-contract-abigen", default-features = false, optional = true }
ethers-contract-derive = { version = "^0.5.0", path = "ethers-contract-derive", optional = true } ethers-contract-derive = { version = "^0.6.0", path = "ethers-contract-derive", optional = true }
ethers-derive-eip712 = { version = "0.1.0", path = "../ethers-core/ethers-derive-eip712", optional = true } ethers-derive-eip712 = { version = "^0.2.0", path = "../ethers-core/ethers-derive-eip712", optional = true }
serde = { version = "1.0.124", default-features = false } serde = { version = "1.0.124", default-features = false }
serde_json = { version = "1.0.64", default-features = false } serde_json = { version = "1.0.64", default-features = false }
@ -25,13 +25,13 @@ futures-util = { version = "0.3.18" }
hex = { version = "0.4.3", default-features = false, features = ["std"] } hex = { version = "0.4.3", default-features = false, features = ["std"] }
[dev-dependencies] [dev-dependencies]
ethers-middleware = { version = "^0.5.0", path = "../ethers-middleware" } ethers-middleware = { version = "^0.6.0", path = "../ethers-middleware" }
ethers-providers = { version = "^0.5.0", path = "../ethers-providers", default-features = false, features = ["ws"] } ethers-providers = { version = "^0.6.0", path = "../ethers-providers", default-features = false, features = ["ws"] }
ethers-signers = { version = "^0.5.0", path = "../ethers-signers" } ethers-signers = { version = "^0.6.0", path = "../ethers-signers" }
ethers-contract-abigen = { version = "^0.5.0", path = "ethers-contract-abigen" } ethers-contract-abigen = { version = "^0.6.0", path = "ethers-contract-abigen" }
ethers-contract-derive = { version = "^0.5.0", path = "ethers-contract-derive" } ethers-contract-derive = { version = "^0.6.0", path = "ethers-contract-derive" }
ethers-core = { version = "^0.5.0", path = "../ethers-core", default-features = false, features = ["eip712"]} ethers-core = { version = "^0.6.0", path = "../ethers-core", default-features = false, features = ["eip712"]}
ethers-derive-eip712 = { version = "0.1.0", path = "../ethers-core/ethers-derive-eip712"} ethers-derive-eip712 = { version = "^0.2.0", path = "../ethers-core/ethers-derive-eip712"}
ethers-solc = { version = "^0.1.0", path = "../ethers-solc", default-features = false } ethers-solc = { version = "^0.1.0", path = "../ethers-solc", default-features = false }
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] [target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]

16
ethers-contract/README.md Normal file
View File

@ -0,0 +1,16 @@
Type-safe abstractions for interacting with Ethereum smart contracts
Interacting with a smart contract requires broadcasting carefully crafted
[transactions](ethers_core::types::TransactionRequest) where the `data` field
contains the
[function's selector](https://ethereum.stackexchange.com/questions/72363/what-is-a-function-selector)
along with the arguments of the called function.
This module provides the [`Contract`] and [`ContractFactory`] abstractions so
that you do not have to worry about that. It also provides typesafe bindings via
the [`abigen`] macro and the [`Abigen` builder].
[`contractfactory`]: ./struct.ContractFactory.html
[`contract`]: ./struct.Contract.html
[`abigen`]: ./macro.abigen.html
[`abigen` builder]: ./struct.Abigen.html

View File

@ -1,6 +1,6 @@
[package] [package]
name = "ethers-contract-abigen" name = "ethers-contract-abigen"
version = "0.5.3" version = "0.6.0"
authors = ["Nicholas Rodrigues Lordello <nlordell@gmail.com>", "Georgios Konstantopoulos <me@gakonst.com>"] authors = ["Nicholas Rodrigues Lordello <nlordell@gmail.com>", "Georgios Konstantopoulos <me@gakonst.com>"]
edition = "2018" edition = "2018"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
@ -10,7 +10,7 @@ repository = "https://github.com/gakonst/ethers-rs"
keywords = ["ethereum", "web3", "celo", "ethers"] keywords = ["ethereum", "web3", "celo", "ethers"]
[dependencies] [dependencies]
ethers-core = { version = "^0.5.0", path = "../../ethers-core", features = ["macros"] } ethers-core = { version = "^0.6.0", path = "../../ethers-core", features = ["macros"] }
anyhow = "1.0.37" anyhow = "1.0.37"
Inflector = "0.11" Inflector = "0.11"

View File

@ -1,6 +1,6 @@
[package] [package]
name = "ethers-contract-derive" name = "ethers-contract-derive"
version = "0.5.3" version = "0.6.0"
authors = ["Nicholas Rodrigues Lordello <nlordell@gmail.com>", "Georgios Konstantopoulos <me@gakonst.com>"] authors = ["Nicholas Rodrigues Lordello <nlordell@gmail.com>", "Georgios Konstantopoulos <me@gakonst.com>"]
edition = "2018" edition = "2018"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
@ -13,8 +13,8 @@ keywords = ["ethereum", "web3", "celo", "ethers"]
proc-macro = true proc-macro = true
[dependencies] [dependencies]
ethers-core = { version = "^0.5.0", path = "../../ethers-core" } ethers-core = { version = "^0.6.0", path = "../../ethers-core" }
ethers-contract-abigen = { version = "^0.5.0", path = "../ethers-contract-abigen" } ethers-contract-abigen = { version = "^0.6.0", path = "../ethers-contract-abigen" }
serde_json = "1.0.53" serde_json = "1.0.53"
hex = { version = "0.4.3", default-features = false, features = ["std"] } hex = { version = "0.4.3", default-features = false, features = ["std"] }

View File

@ -1,18 +1,5 @@
#![cfg_attr(docsrs, feature(doc_cfg))] #![cfg_attr(docsrs, feature(doc_cfg))]
//! Type-safe abstractions for interacting with Ethereum smart contracts #![doc = include_str!("../README.md")]
//!
//! Interacting with a smart contract requires broadcasting carefully crafted
//! [transactions](ethers_core::types::TransactionRequest) where the `data` field contains
//! the [function's
//! selector](https://ethereum.stackexchange.com/questions/72363/what-is-a-function-selector)
//! along with the arguments of the called function. This module provides the
//! [`Contract`] and [`ContractFactory`] abstractions so that you do not have to worry about that.
//! It also provides typesafe bindings via the [`abigen`] macro and the [`Abigen` builder].
//!
//! [`ContractFactory`]: crate::ContractFactory
//! [`Contract`]: crate::Contract
//! [`abigen`]: ./macro.abigen.html
//! [`Abigen` builder]: crate::Abigen
mod contract; mod contract;
pub use contract::Contract; pub use contract::Contract;

View File

@ -1,7 +1,7 @@
[package] [package]
name = "ethers-core" name = "ethers-core"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
version = "0.5.5" version = "0.6.0"
authors = ["Georgios Konstantopoulos <me@gakonst.com>"] authors = ["Georgios Konstantopoulos <me@gakonst.com>"]
edition = "2018" edition = "2018"
description = "Core structures for the ethers-rs crate" description = "Core structures for the ethers-rs crate"

48
ethers-core/README.md Normal file
View File

@ -0,0 +1,48 @@
# Ethereum types, cryptography and utilities.
It is recommended to use the `utils`, `types` and `abi` re-exports instead of
the `core` module to simplify your imports.\_
This library provides type definitions for Ethereum's main datatypes along with
other utilities for interacting with the Ethereum ecosystem
## Signing an ethereum-prefixed message
Signing in Ethereum is done by first prefixing the message with
`"\x19Ethereum Signed Message:\n" + message.length`, and then signing the hash
of the result.
```rust,ignore
# async fn foo() -> Result<(), Box<dyn std::error::Error>> {
use ethers::signers::{Signer, LocalWallet};
let message = "Some data";
let wallet = LocalWallet::new(&mut rand::thread_rng());
// Sign the message
let signature = wallet.sign_message(message).await?;
// Recover the signer from the message
let recovered = signature.recover(message)?;
assert_eq!(recovered, wallet.address());
# Ok(())
# }
```
## Utilities
The crate provides utilities for launching local Ethereum testnets by using
`ganache-cli` via the `GanacheBuilder` struct.
# Features
- - ["eip712"] | Provides Eip712 trait for EIP-712 encoding of typed data for
derived structs
# ABI Encoding and Decoding
This crate re-exports the [`ethabi`](https://docs.rs/ethabi) crate's functions
under the `abi` module, as well as the
[`secp256k1`](https://docs.rs/libsecp256k1) and [`rand`](https://docs.rs/rand)
crates for convenience.

View File

@ -1,8 +1,9 @@
[package] [package]
name = "ethers-derive-eip712" name = "ethers-derive-eip712"
version = "0.1.0" version = "0.2.0"
edition = "2018" edition = "2018"
description = "Custom derive macro for EIP-712 typed data" description = "Custom derive macro for EIP-712 typed data"
license = "MIT OR Apache-2.0"
[lib] [lib]
proc-macro = true proc-macro = true
@ -10,13 +11,13 @@ proc-macro = true
[dependencies] [dependencies]
quote = "1.0.9" quote = "1.0.9"
syn = "1.0.77" syn = "1.0.77"
ethers-core = { version = "^0.5.0", path = "../", default-features = false, features = ["eip712", "macros"] } ethers-core = { version = "^0.6.0", path = "../", default-features = false, features = ["eip712", "macros"] }
hex = "0.4.3" hex = "0.4.3"
serde = "1.0.130" serde = "1.0.130"
serde_json = "1.0.68" serde_json = "1.0.68"
proc-macro2 = "1.0.29" proc-macro2 = "1.0.29"
[dev-dependencies] [dev-dependencies]
ethers-contract = { version = "^0.5.0", path = "../../ethers-contract"} ethers-contract = { version = "^0.6.0", path = "../../ethers-contract"}
ethers-contract-derive = { version = "^0.5.0", path = "../../ethers-contract/ethers-contract-derive" } ethers-contract-derive = { version = "^0.6.0", path = "../../ethers-contract/ethers-contract-derive" }
ethers-signers = { version = "^0.5.0", path = "../../ethers-signers" } ethers-signers = { version = "^0.6.0", path = "../../ethers-signers" }

View File

@ -1,49 +1,5 @@
#![cfg_attr(docsrs, feature(doc_cfg))] #![cfg_attr(docsrs, feature(doc_cfg))]
//! Ethereum types, cryptography and utilities. #![doc = include_str!("../README.md")]
//! _It is recommended to use the `utils`, `types` and `abi` re-exports instead of
//! the `core` module to simplify your imports._
//!
//! This library provides type definitions for Ethereum's main datatypes along
//! with other utilities for interacting with the Ethereum ecosystem
//!
//! ## Signing an ethereum-prefixed message
//!
//! Signing in Ethereum is done by first prefixing the message with
//! `"\x19Ethereum Signed Message:\n" + message.length`, and then
//! signing the hash of the result.
//!
//! ```rust,ignore
//! # async fn foo() -> Result<(), Box<dyn std::error::Error>> {
//! use ethers::signers::{Signer, LocalWallet};
//!
//! let message = "Some data";
//! let wallet = LocalWallet::new(&mut rand::thread_rng());
//!
//! // Sign the message
//! let signature = wallet.sign_message(message).await?;
//!
//! // Recover the signer from the message
//! let recovered = signature.recover(message)?;
//!
//! assert_eq!(recovered, wallet.address());
//! # Ok(())
//! # }
//! ```
//!
//! ## Utilities
//!
//! The crate provides utilities for launching local Ethereum testnets by using `ganache-cli`
//! via the `GanacheBuilder` struct.
//!
//! # Features
//!
//! * - ["eip712"] | Provides Eip712 trait for EIP-712 encoding of typed data for derived structs
//!
//! # ABI Encoding and Decoding
//!
//! This crate re-exports the [`ethabi`](ethabi) crate's functions
//! under the `abi` module, as well as the [`secp256k1`](https://docs.rs/libsecp256k1)
//! and [`rand`](https://docs.rs/rand) crates for convenience.
pub mod types; pub mod types;
pub mod abi; pub mod abi;

View File

@ -1,6 +1,6 @@
[package] [package]
name = "ethers-etherscan" name = "ethers-etherscan"
version = "0.1.1" version = "0.2.0"
authors = ["Matthias Seitz <matthias.seitz@outlook.de>", "Georgios Konstantopoulos <me@gakonst.com>"] authors = ["Matthias Seitz <matthias.seitz@outlook.de>", "Georgios Konstantopoulos <me@gakonst.com>"]
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
edition = "2018" edition = "2018"
@ -14,7 +14,7 @@ Rust API bindings for the etherscan.io web API
keywords = ["ethereum", "web3", "etherscan", "ethers"] keywords = ["ethereum", "web3", "etherscan", "ethers"]
[dependencies] [dependencies]
ethers-core = { version = "^0.5.0", path = "../ethers-core", default-features = false } ethers-core = { version = "^0.6.0", path = "../ethers-core", default-features = false }
reqwest = { version = "0.11.6", features = ["json"] } reqwest = { version = "0.11.6", features = ["json"] }
serde = { version = "1.0.124", default-features = false, features = ["derive"] } serde = { version = "1.0.124", default-features = false, features = ["derive"] }
serde_json = { version = "1.0.64", default-features = false } serde_json = { version = "1.0.64", default-features = false }

View File

@ -1,7 +1,7 @@
[package] [package]
name = "ethers-middleware" name = "ethers-middleware"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
version = "0.5.3" version = "0.6.0"
authors = ["Georgios Konstantopoulos <me@gakonst.com>"] authors = ["Georgios Konstantopoulos <me@gakonst.com>"]
edition = "2018" edition = "2018"
description = "Middleware implementations for the ethers-rs crate" description = "Middleware implementations for the ethers-rs crate"
@ -14,10 +14,10 @@ all-features = true
rustdoc-args = ["--cfg", "docsrs"] rustdoc-args = ["--cfg", "docsrs"]
[dependencies] [dependencies]
ethers-contract = { version = "^0.5.0", path = "../ethers-contract", default-features = false, features = ["abigen"] } ethers-contract = { version = "^0.6.0", path = "../ethers-contract", default-features = false, features = ["abigen"] }
ethers-core = { version = "^0.5.0", path = "../ethers-core", default-features = false } ethers-core = { version = "^0.6.0", path = "../ethers-core", default-features = false }
ethers-providers = { version = "^0.5.0", path = "../ethers-providers", default-features = false } ethers-providers = { version = "^0.6.0", path = "../ethers-providers", default-features = false }
ethers-signers = { version = "^0.5.0", path = "../ethers-signers", default-features = false } ethers-signers = { version = "^0.6.0", path = "../ethers-signers", default-features = false }
async-trait = { version = "0.1.50", default-features = false } async-trait = { version = "0.1.50", default-features = false }
serde = { version = "1.0.124", default-features = false, features = ["derive"] } serde = { version = "1.0.124", default-features = false, features = ["derive"] }
@ -40,7 +40,7 @@ tokio = { version = "1.5" }
[dev-dependencies] [dev-dependencies]
hex = { version = "0.4.3", default-features = false, features = ["std"] } hex = { version = "0.4.3", default-features = false, features = ["std"] }
rand = { version = "0.8.4", default-features = false } rand = { version = "0.8.4", default-features = false }
ethers-providers = { version = "^0.5.0", path = "../ethers-providers", default-features = false, features = ["ws", "rustls"] } ethers-providers = { version = "^0.6.0", path = "../ethers-providers", default-features = false, features = ["ws", "rustls"] }
once_cell = "1.8.0" once_cell = "1.8.0"
ethers-solc = { version = "^0.1.0", path = "../ethers-solc", default-features = false } ethers-solc = { version = "^0.1.0", path = "../ethers-solc", default-features = false }

View File

@ -0,0 +1,55 @@
Ethers uses a middleware-based architecture. You start the middleware stack with
a [`Provider`](ethers_providers::Provider), and wrap it with additional
middleware functionalities that you need.
## Available Middleware
- [`Signer`](./signer/struct.SignerMiddleware.html): Signs transactions locally,
with a private key or a hardware wallet
- [`Nonce Manager`](./nonce_manager/struct.NonceManagerMiddleware.html): Manages
nonces locally, allowing the rapid broadcast of transactions without having to
wait for them to be submitted
- [`Gas Escalator`](./gas_escalator/struct.GasEscalatorMiddleware.html): Bumps
transaction gas prices in the background
- [`Gas Oracle`](./gas_oracle/struct.GasOracleMiddleware.html): Allows getting
your gas price estimates from places other than `eth_gasPrice`.
- [`Transformer`](./transformer/trait.Transformer.html): Allows intercepting and
transforming a transaction to be broadcasted via a proxy wallet, e.g.
[`DSProxy`](./transformer/struct.DsProxy.html).
## Example of a middleware stack
```no_run
use ethers_providers::{Provider, Http};
use ethers_signers::{LocalWallet, Signer};
use ethers_middleware::{
gas_escalator::{GasEscalatorMiddleware, GeometricGasPrice, Frequency},
gas_oracle::{GasOracleMiddleware, EthGasStation, GasCategory},
signer::SignerMiddleware,
nonce_manager::NonceManagerMiddleware,
};
use ethers_core::rand;
use std::convert::TryFrom;
// Start the stack
let provider = Provider::<Http>::try_from("http://localhost:8545").unwrap();
// Escalate gas prices
let escalator = GeometricGasPrice::new(1.125, 60u64, None::<u64>);
let provider =
GasEscalatorMiddleware::new(provider, escalator, Frequency::PerBlock);
// Sign transactions with a private key
let signer = LocalWallet::new(&mut rand::thread_rng());
let address = signer.address();
let provider = SignerMiddleware::new(provider, signer);
// Use EthGasStation as the gas oracle
let gas_oracle = EthGasStation::new(None);
let provider = GasOracleMiddleware::new(provider, gas_oracle);
// Manage nonces locally
let provider = NonceManagerMiddleware::new(provider, address);
// ... do something with the provider
```

View File

@ -1,57 +1,4 @@
//! # Ethers Middleware #![doc = include_str!("../README.md")]
//!
//! Ethers uses a middleware-based architecture. You start the middleware stack with
//! a [`Provider`](ethers_providers::Provider), and wrap it with additional
//! middleware functionalities that you need.
//!
//! ## Available Middleware
//! - [`Signer`](crate::SignerMiddleware): Signs transactions locally, with a private
//! key or a hardware wallet
//! - [`Nonce Manager`](crate::NonceManagerMiddleware): Manages nonces locally, allowing
//! the rapid broadcast of transactions without having to wait for them to be submitted
//! - [`Gas Escalator`](crate::gas_escalator::GasEscalatorMiddleware): Bumps transaction
//! gas prices in the background
//! - [`Gas Oracle`](crate::gas_oracle): Allows getting your gas price estimates from
//! places other than `eth_gasPrice`.
//! - [`Transformer`](crate::transformer): Allows intercepting and transforming a transaction to
//! be broadcasted via a proxy wallet, e.g. [`DSProxy`](crate::transformer::DsProxy).
//!
//! ## Example of a middleware stack
//!
//! ```no_run
//! use ethers_providers::{Provider, Http};
//! use ethers_signers::{LocalWallet, Signer};
//! use ethers_middleware::{
//! gas_escalator::{GasEscalatorMiddleware, GeometricGasPrice, Frequency},
//! gas_oracle::{GasOracleMiddleware, EthGasStation, GasCategory},
//! signer::SignerMiddleware,
//! nonce_manager::NonceManagerMiddleware,
//! };
//! use ethers_core::rand;
//! use std::convert::TryFrom;
//!
//! // Start the stack
//! let provider = Provider::<Http>::try_from("http://localhost:8545").unwrap();
//!
//! // Escalate gas prices
//! let escalator = GeometricGasPrice::new(1.125, 60u64, None::<u64>);
//! let provider =
//! GasEscalatorMiddleware::new(provider, escalator, Frequency::PerBlock);
//!
//! // Sign transactions with a private key
//! let signer = LocalWallet::new(&mut rand::thread_rng());
//! let address = signer.address();
//! let provider = SignerMiddleware::new(provider, signer);
//!
//! // Use EthGasStation as the gas oracle
//! let gas_oracle = EthGasStation::new(None);
//! let provider = GasOracleMiddleware::new(provider, gas_oracle);
//!
//! // Manage nonces locally
//! let provider = NonceManagerMiddleware::new(provider, address);
//!
//! // ... do something with the provider
//! ```
/// The [Gas Escalator middleware](crate::gas_escalator::GasEscalatorMiddleware) /// The [Gas Escalator middleware](crate::gas_escalator::GasEscalatorMiddleware)
/// is used to re-broadcast transactions with an increasing gas price to guarantee /// is used to re-broadcast transactions with an increasing gas price to guarantee

View File

@ -1,7 +1,7 @@
[package] [package]
name = "ethers-providers" name = "ethers-providers"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
version = "0.5.4" version = "0.6.0"
authors = ["Georgios Konstantopoulos <me@gakonst.com>"] authors = ["Georgios Konstantopoulos <me@gakonst.com>"]
edition = "2018" edition = "2018"
description = "Provider implementations for the ethers-rs crate" description = "Provider implementations for the ethers-rs crate"
@ -14,7 +14,7 @@ all-features = true
rustdoc-args = ["--cfg", "docsrs"] rustdoc-args = ["--cfg", "docsrs"]
[dependencies] [dependencies]
ethers-core = { version = "^0.5.0", path = "../ethers-core", default-features = false } ethers-core = { version = "^0.6.0", path = "../ethers-core", default-features = false }
async-trait = { version = "0.1.50", default-features = false } async-trait = { version = "0.1.50", default-features = false }
hex = { version = "0.4.3", default-features = false, features = ["std"] } hex = { version = "0.4.3", default-features = false, features = ["std"] }

View File

@ -0,0 +1,67 @@
# Clients for interacting with Ethereum nodes
This crate provides asynchronous
[Ethereum JSON-RPC](https://github.com/ethereum/wiki/wiki/JSON-RPC) compliant
clients.
For more documentation on the available calls, refer to the
[`Provider`](./struct.Provider.html) struct.
# Examples
```no_run
use ethers_providers::{Provider, Http, Middleware};
use std::convert::TryFrom;
# async fn foo() -> Result<(), Box<dyn std::error::Error>> {
let provider = Provider::<Http>::try_from(
"https://mainnet.infura.io/v3/c60b0bb42f8a4c6481ecd229eddaca27"
)?;
let block = provider.get_block(100u64).await?;
println!("Got block: {}", serde_json::to_string(&block)?);
let code = provider.get_code("0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359", None).await?;
println!("Got code: {}", serde_json::to_string(&code)?);
# Ok(())
# }
```
# Websockets
The crate has support for WebSockets via Tokio.
```
# async fn foo() -> Result<(), Box<dyn std::error::Error>> {
# use ethers_providers::Ws;
let ws = Ws::connect("ws://localhost:8545").await?;
# Ok(())
# }
```
# Ethereum Name Service
The provider may also be used to resolve
[Ethereum Name Service](https://ens.domains) (ENS) names to addresses (and vice
versa). The default ENS address is
[mainnet](https://etherscan.io/address/0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e)
and can be overriden by calling the [`ens`](./struct.Provider.html#method.ens)
method on the provider.
```no_run
# use ethers_providers::{Provider, Http, Middleware};
# use std::convert::TryFrom;
# async fn foo() -> Result<(), Box<dyn std::error::Error>> {
# let provider = Provider::<Http>::try_from(
# "https://mainnet.infura.io/v3/c60b0bb42f8a4c6481ecd229eddaca27"
# )?;
// Resolve ENS name to Address
let name = "vitalik.eth";
let address = provider.resolve_name(name).await?;
// Lookup ENS name given Address
let resolved_name = provider.lookup_address(address).await?;
assert_eq!(name, resolved_name);
# Ok(())
# }
```

View File

@ -1,68 +1,7 @@
#![cfg_attr(docsrs, feature(doc_cfg))] #![cfg_attr(docsrs, feature(doc_cfg))]
#![deny(broken_intra_doc_links)] #![deny(broken_intra_doc_links)]
#![allow(clippy::type_complexity)] #![allow(clippy::type_complexity)]
//! # Clients for interacting with Ethereum nodes #![doc = include_str!("../README.md")]
//!
//! This crate provides asynchronous [Ethereum JSON-RPC](https://github.com/ethereum/wiki/wiki/JSON-RPC)
//! compliant clients.
//!
//! For more documentation on the available calls, refer to the [`Provider`](crate::Provider)
//! struct.
//!
//! # Examples
//!
//! ```no_run
//! use ethers_providers::{Provider, Http, Middleware};
//! use std::convert::TryFrom;
//!
//! # async fn foo() -> Result<(), Box<dyn std::error::Error>> {
//! let provider = Provider::<Http>::try_from(
//! "https://mainnet.infura.io/v3/c60b0bb42f8a4c6481ecd229eddaca27"
//! )?;
//!
//! let block = provider.get_block(100u64).await?;
//! println!("Got block: {}", serde_json::to_string(&block)?);
//!
//! let code = provider.get_code("0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359", None).await?;
//! println!("Got code: {}", serde_json::to_string(&code)?);
//! # Ok(())
//! # }
//! ```
//!
//! # Websockets
//!
//! The crate has support for WebSockets via Tokio.
//!
//! ```
//! # async fn foo() -> Result<(), Box<dyn std::error::Error>> {
//! # use ethers_providers::Ws;
//! let ws = Ws::connect("ws://localhost:8545").await?;
//! # Ok(())
//! # }
//! ```
//!
//! # Ethereum Name Service
//!
//! The provider may also be used to resolve [Ethereum Name Service](https://ens.domains) (ENS) names
//! to addresses (and vice versa). The default ENS address is [mainnet](https://etherscan.io/address/0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e) and can be overriden by calling the [`ens`](method@crate::Provider::ens) method on the provider.
//!
//! ```no_run
//! # use ethers_providers::{Provider, Http, Middleware};
//! # use std::convert::TryFrom;
//! # async fn foo() -> Result<(), Box<dyn std::error::Error>> {
//! # let provider = Provider::<Http>::try_from(
//! # "https://mainnet.infura.io/v3/c60b0bb42f8a4c6481ecd229eddaca27"
//! # )?;
//! // Resolve ENS name to Address
//! let name = "vitalik.eth";
//! let address = provider.resolve_name(name).await?;
//!
//! // Lookup ENS name given Address
//! let resolved_name = provider.lookup_address(address).await?;
//! assert_eq!(name, resolved_name);
//! # Ok(())
//! # }
//! ```
mod transports; mod transports;
use futures_util::future::join_all; use futures_util::future::join_all;
pub use transports::*; pub use transports::*;

View File

@ -1,7 +1,7 @@
[package] [package]
name = "ethers-signers" name = "ethers-signers"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
version = "0.5.3" version = "0.6.0"
authors = ["Georgios Konstantopoulos <me@gakonst.com>"] authors = ["Georgios Konstantopoulos <me@gakonst.com>"]
edition = "2018" edition = "2018"
description = "Signer implementations for the ethers-rs crate" description = "Signer implementations for the ethers-rs crate"
@ -14,7 +14,7 @@ all-features = true
rustdoc-args = ["--cfg", "docsrs"] rustdoc-args = ["--cfg", "docsrs"]
[dependencies] [dependencies]
ethers-core = { version = "^0.5.0", path = "../ethers-core", features = ["eip712"]} ethers-core = { version = "^0.6.0", path = "../ethers-core", features = ["eip712"]}
thiserror = { version = "1.0.30", default-features = false } thiserror = { version = "1.0.30", default-features = false }
coins-bip32 = "0.3.0" coins-bip32 = "0.3.0"
coins-bip39 = "0.3.0" coins-bip39 = "0.3.0"
@ -40,8 +40,8 @@ spki = { version = "0.4.1", optional = true }
eth-keystore = { version = "0.3.0" } eth-keystore = { version = "0.3.0" }
[dev-dependencies] [dev-dependencies]
ethers-contract = { version = "^0.5.0", path = "../ethers-contract", features = ["eip712", "abigen"]} ethers-contract = { version = "^0.6.0", path = "../ethers-contract", features = ["eip712", "abigen"]}
ethers-derive-eip712 = { version = "0.1.0", path = "../ethers-core/ethers-derive-eip712" } ethers-derive-eip712 = { version = "0.2.0", path = "../ethers-core/ethers-derive-eip712" }
serde_json = { version = "1.0.64" } serde_json = { version = "1.0.64" }
tracing-subscriber = "0.3.2" tracing-subscriber = "0.3.2"
yubihsm = { version = "0.39.0", features = ["secp256k1", "usb", "mockhsm"] } yubihsm = { version = "0.39.0", features = ["secp256k1", "usb", "mockhsm"] }

40
ethers-signers/README.md Normal file
View File

@ -0,0 +1,40 @@
You can implement the `Signer` trait to extend functionality to other signers
such as Hardware Security Modules, KMS etc.
The exposed interfaces return a recoverable signature. In order to convert the
signature and the [`TransactionRequest`] to a [`Transaction`], look at the
signing middleware.
Supported signers:
- [Private key](./type.LocalWallet.html)
- [Ledger](./struct.Ledger.html)
- [YubiHSM2](./struct.Yubi.html)
- [AWS KMS](./struct.AwsSigner.html)
```no_run
# use ethers_signers::{LocalWallet, Signer};
# use ethers_core::{k256::ecdsa::SigningKey, types::TransactionRequest};
# async fn foo() -> Result<(), Box<dyn std::error::Error>> {
// instantiate the wallet
let wallet = "dcf2cbdd171a21c480aa7f53d77f31bb102282b3ff099c78e3118b37348c72f7"
.parse::<LocalWallet>()?;
// create a transaction
let tx = TransactionRequest::new()
.to("vitalik.eth") // this will use ENS
.value(10000).into();
// sign it
let signature = wallet.sign_transaction(&tx).await?;
// can also sign a message
let signature = wallet.sign_message("hello world").await?;
signature.verify("hello world", wallet.address()).unwrap();
# Ok(())
# }
```
[`transaction`]: ethers_core::types::Transaction
[`transactionrequest`]: ethers_core::types::TransactionRequest

View File

@ -1,43 +1,4 @@
//! Provides a unified interface for locally signing transactions. //! Provides a unified interface for locally signing transactions.
//!
//! You can implement the `Signer` trait to extend functionality to other signers
//! such as Hardware Security Modules, KMS etc.
//!
//! The exposed interfaces return a recoverable signature. In order to convert the signature
//! and the [`TransactionRequest`] to a [`Transaction`], look at the signing middleware.
//!
//! Supported signers:
//! - [Private key](crate::LocalWallet)
//! - [Ledger](crate::Ledger)
//! - [YubiHSM2](crate::YubiWallet)
//! - [AWS KMS](crate::AwsSigner)
//!
//! ```no_run
//! # use ethers_signers::{LocalWallet, Signer};
//! # use ethers_core::{k256::ecdsa::SigningKey, types::TransactionRequest};
//!
//! # async fn foo() -> Result<(), Box<dyn std::error::Error>> {
//! // instantiate the wallet
//! let wallet = "dcf2cbdd171a21c480aa7f53d77f31bb102282b3ff099c78e3118b37348c72f7"
//! .parse::<LocalWallet>()?;
//!
//! // create a transaction
//! let tx = TransactionRequest::new()
//! .to("vitalik.eth") // this will use ENS
//! .value(10000).into();
//!
//! // sign it
//! let signature = wallet.sign_transaction(&tx).await?;
//!
//! // can also sign a message
//! let signature = wallet.sign_message("hello world").await?;
//! signature.verify("hello world", wallet.address()).unwrap();
//! # Ok(())
//! # }
//! ```
//!
//! [`Transaction`]: ethers_core::types::Transaction
//! [`TransactionRequest`]: ethers_core::types::TransactionRequest
mod wallet; mod wallet;
pub use wallet::{MnemonicBuilder, Wallet, WalletError}; pub use wallet::{MnemonicBuilder, Wallet, WalletError};

View File

@ -14,7 +14,7 @@ Utilites for working with solc
keywords = ["ethereum", "web3", "solc", "solidity", "ethers"] keywords = ["ethereum", "web3", "solc", "solidity", "ethers"]
[dependencies] [dependencies]
ethers-core = { version = "^0.5.0", path = "../ethers-core", default-features = false } ethers-core = { version = "^0.6.0", path = "../ethers-core", default-features = false }
serde_json = "1.0.68" serde_json = "1.0.68"
serde = { version = "1.0.130", features = ["derive"] } serde = { version = "1.0.130", features = ["derive"] }
semver = "1.0.4" semver = "1.0.4"
@ -27,7 +27,7 @@ md-5 = "0.9.1"
thiserror = "1.0.30" thiserror = "1.0.30"
hex = "0.4.3" hex = "0.4.3"
colored = "2.0.0" colored = "2.0.0"
svm = { package = "svm-rs", git = "https://github.com/roynalnaruto/svm-rs", optional = true } svm = { package = "svm-rs", version = "0.1.2", optional = true }
glob = "0.3.0" glob = "0.3.0"
[target.'cfg(not(target_arch = "wasm32"))'.dependencies] [target.'cfg(not(target_arch = "wasm32"))'.dependencies]

View File

@ -83,30 +83,58 @@
//! [`utils`]: core::utils //! [`utils`]: core::utils
//! [`abi`]: core::abi //! [`abi`]: core::abi
//! [`types`]: core::types //! [`types`]: core::types
pub use ethers_contract as contract;
pub use ethers_core as core;
pub use ethers_middleware as middleware;
pub use ethers_providers as providers;
pub use ethers_signers as signers;
pub use ethers_solc as solc;
// Re-export ethers_core::utils/types/abi #[doc = include_str!("../assets/CONTRACT_README.md")]
// We hide these docs so that the rustdoc links send the visitor pub mod contract {
// to the corresponding crate, instead of the re-export pub use ethers_contract::*;
#[doc(hidden)] }
pub use ethers_core::abi;
#[doc(hidden)] #[doc = include_str!("../assets/CORE_README.md")]
pub use ethers_core::types; pub mod core {
#[doc(hidden)] pub use ethers_core::*;
pub use ethers_core::utils; }
#[doc = include_str!("../assets/PROVIDERS_README.md")]
pub mod providers {
pub use ethers_providers::*;
}
#[doc = include_str!("../assets/MIDDLEWARE_README.md")]
pub mod middleware {
pub use ethers_middleware::*;
}
#[doc = include_str!("../assets/SIGNERS_README.md")]
pub mod signers {
pub use ethers_signers::*;
}
#[doc = include_str!("../assets/SOLC_README.md")]
pub mod solc {
pub use ethers_solc::*;
}
/// Etherscan bindings
pub mod etherscan {
pub use ethers_etherscan::*;
}
pub use crate::core::{abi, types, utils};
/// Easy imports of frequently used type definitions and traits /// Easy imports of frequently used type definitions and traits
#[doc(hidden)] #[doc(hidden)]
pub mod prelude { pub mod prelude {
pub use ethers_contract::*; pub use super::contract::*;
pub use ethers_core::types::*;
pub use ethers_middleware::*; pub use super::core::{types::*, *};
pub use ethers_providers::*;
pub use ethers_signers::*; pub use super::middleware::*;
pub use ethers_solc::*;
pub use super::providers::*;
pub use super::signers::*;
pub use super::solc::*;
pub use super::etherscan::*;
} }