chore(deps): bump and use workspace dependencies (#2222)
* chore: update all deps * chore: update dependabot * chore: separate ethers package from workspace * chore: package metadata * chore: use package.*.workspace = true * fix: docs.rs build * chore: update examples manifests * chore: use workspace dependencies for ethers-* crates * fix: test * chore: use workspace dependencies for all dependencies * chore: pin rust-crypto * chore: add license field to example crates * fixes * more fixes * fix: test * last fixes * fix: wasm * fix: docs.rs build * fix * fix: wasm-pack error see also https://github.com/rustwasm/wasm-pack/issues/1238 * fix: wasm deps and example * ci: update * fix: wasm tests * fix: eip712 tests * fix: windows ci * fix * chore: update docsrs metadata * chore: bump version to match crates.io * chore: rm bad release.toml config * chore: rm release.toml bad configuration * chore: add exclude to workspace * fix: middleware * fix: solc feature flags * chore: run cargo upgrade * chore: update deps * chore: update remaining deps * undo fix * update lock * bump yubi * fix: update coins-* and fix spki breaking changes
This commit is contained in:
parent
4e6dfe2414
commit
439a0c7de0
|
@ -6,44 +6,3 @@ updates:
|
|||
interval: daily
|
||||
time: "03:00"
|
||||
open-pull-requests-limit: 10
|
||||
ignore:
|
||||
- dependency-name: async-trait
|
||||
versions:
|
||||
- 0.1.48
|
||||
- 0.1.49
|
||||
- dependency-name: futures-core
|
||||
versions:
|
||||
- 0.3.13
|
||||
- 0.3.14
|
||||
- dependency-name: futures-channel
|
||||
versions:
|
||||
- 0.3.14
|
||||
- dependency-name: anyhow
|
||||
versions:
|
||||
- 1.0.40
|
||||
- dependency-name: elliptic-curve
|
||||
versions:
|
||||
- 0.9.0
|
||||
- 0.9.2
|
||||
- 0.9.6
|
||||
- dependency-name: pin-project
|
||||
versions:
|
||||
- 1.0.6
|
||||
- dependency-name: arrayvec
|
||||
versions:
|
||||
- 0.6.0
|
||||
- dependency-name: serde
|
||||
versions:
|
||||
- 1.0.125
|
||||
- dependency-name: tokio
|
||||
versions:
|
||||
- 1.3.0
|
||||
- dependency-name: serde_json
|
||||
versions:
|
||||
- 1.0.63
|
||||
- dependency-name: ethereum-types
|
||||
versions:
|
||||
- 0.11.0
|
||||
- dependency-name: yubihsm
|
||||
versions:
|
||||
- 0.38.0
|
||||
|
|
|
@ -17,22 +17,40 @@ env:
|
|||
|
||||
jobs:
|
||||
test:
|
||||
name: test ${{ matrix.os }} ${{ matrix.flags }}
|
||||
name: test ${{ matrix.os }} (${{ matrix.flags.name }})
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
|
||||
flags: ["--workspace", "--workspace --all-features"]
|
||||
exclude:
|
||||
# sha2-asm
|
||||
- os: windows-latest
|
||||
os: ["ubuntu-latest", "macos-latest"]
|
||||
flags:
|
||||
- name: no default features
|
||||
flags: --workspace --no-default-features
|
||||
- name: default features
|
||||
flags: --workspace
|
||||
- name: all features
|
||||
flags: --workspace --all-features
|
||||
include:
|
||||
# not workspace because compiling examples fails for no reason in CI,
|
||||
- os: windows-latest
|
||||
flags:
|
||||
name: no default features
|
||||
flags: -p ethers --no-default-features
|
||||
- os: windows-latest
|
||||
flags:
|
||||
name: default features
|
||||
flags: -p ethers
|
||||
- os: windows-latest
|
||||
flags:
|
||||
name: all features
|
||||
flags: -p ethers --all-features
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: ${{ matrix.os == 'windows-latest' && 'stable-x86_64-pc-windows-gnu' || 'stable' }}
|
||||
toolchain:
|
||||
${{ matrix.os == 'windows-latest' && 'stable-x86_64-pc-windows-gnu' ||
|
||||
'stable' }}
|
||||
- name: Install Anvil
|
||||
uses: foundry-rs/foundry-toolchain@v1
|
||||
with:
|
||||
|
@ -43,12 +61,12 @@ jobs:
|
|||
- name: Install nextest
|
||||
uses: taiki-e/install-action@nextest
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- name: test
|
||||
- name: test ${{ matrix.flags.flags }}
|
||||
shell: bash
|
||||
# skip `ethers_etherscan::it` and `ethers::live`
|
||||
run: |
|
||||
cargo nextest run \
|
||||
${{ matrix.flags }} \
|
||||
${{ matrix.flags.flags }} \
|
||||
-E "!binary(~live) & !(deps(ethers-etherscan) & kind(test))"
|
||||
|
||||
etherscan-tests:
|
||||
|
@ -147,9 +165,6 @@ jobs:
|
|||
- uses: Swatinem/rust-cache@v2
|
||||
- name: Check
|
||||
run: cargo check --workspace --target wasm32-unknown-unknown
|
||||
# TODO: [#2191](https://github.com/gakonst/ethers-rs/issues/2191)
|
||||
# - name: Check all features
|
||||
# run: cargo check --workspace --target wasm32-unknown-unknown --all-features
|
||||
|
||||
- name: Install wasm-pack
|
||||
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
||||
|
|
File diff suppressed because it is too large
Load Diff
220
Cargo.toml
220
Cargo.toml
|
@ -1,128 +1,134 @@
|
|||
[package]
|
||||
name = "ethers"
|
||||
[workspace.package]
|
||||
version = "2.0.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.64" # must also be changed in **/Cargo.toml and .clippy.toml
|
||||
authors = ["Georgios Konstantopoulos <me@gakonst.com>"]
|
||||
rust-version = "1.64"
|
||||
license = "MIT OR Apache-2.0"
|
||||
readme = "README.md"
|
||||
documentation = "https://docs.rs/ethers"
|
||||
repository = "https://github.com/gakonst/ethers-rs"
|
||||
homepage = "https://docs.rs/ethers"
|
||||
description = "A complete Ethereum and Celo Rust library"
|
||||
|
||||
[workspace]
|
||||
members = [
|
||||
"ethers-addressbook",
|
||||
"ethers-contract",
|
||||
"ethers-providers",
|
||||
"ethers-signers",
|
||||
"ethers-core",
|
||||
"ethers-middleware",
|
||||
"ethers-etherscan",
|
||||
"ethers-solc",
|
||||
# Example crates
|
||||
"examples/*",
|
||||
homepage = "https://github.com/gakonst/ethers-rs"
|
||||
categories = ["cryptography::cryptocurrencies"]
|
||||
keywords = ["crypto", "ethers", "ethereum", "web3", "celo"]
|
||||
exclude = [
|
||||
".github/",
|
||||
"bin/",
|
||||
"book/",
|
||||
"**/tests/",
|
||||
"**/test-data/",
|
||||
"**/testdata/",
|
||||
"examples",
|
||||
"scripts/",
|
||||
]
|
||||
|
||||
default-members = [
|
||||
"ethers-addressbook",
|
||||
"ethers-contract",
|
||||
"ethers-providers",
|
||||
"ethers-signers",
|
||||
"ethers-core",
|
||||
"ethers-middleware",
|
||||
"ethers-etherscan",
|
||||
"ethers-solc",
|
||||
]
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
# https://docs.rs/about/metadata
|
||||
[workspace.metadata.docs.rs]
|
||||
all-features = true
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[package.metadata.playground]
|
||||
features = ["full"]
|
||||
# https://github.com/integer32llc/rust-playground/blob/c6165a36923db5d99313e6056b5b610a2ede5bb0/top-crates/src/lib.rs#L175-L184
|
||||
[workspace.metadata.playground]
|
||||
all-features = true
|
||||
|
||||
[features]
|
||||
default = ["abigen"]
|
||||
[workspace]
|
||||
members = [
|
||||
"ethers",
|
||||
"ethers-addressbook",
|
||||
"ethers-contract",
|
||||
"ethers-core",
|
||||
"ethers-etherscan",
|
||||
"ethers-middleware",
|
||||
"ethers-providers",
|
||||
"ethers-signers",
|
||||
"ethers-solc",
|
||||
|
||||
celo = [
|
||||
"ethers-core/celo",
|
||||
"ethers-providers/celo",
|
||||
"ethers-signers/celo",
|
||||
"ethers-contract/celo",
|
||||
"ethers-middleware/celo",
|
||||
"legacy",
|
||||
# Example crates
|
||||
"examples/*",
|
||||
]
|
||||
|
||||
legacy = ["ethers-core/legacy", "ethers-contract/legacy"]
|
||||
|
||||
# individual features per sub-crate
|
||||
## core
|
||||
eip712 = ["ethers-contract/eip712", "ethers-core/eip712"]
|
||||
## providers
|
||||
ws = ["ethers-providers/ws"]
|
||||
ipc = ["ethers-providers/ipc"]
|
||||
rustls = [
|
||||
"ethers-middleware/rustls",
|
||||
"ethers-providers/rustls",
|
||||
"ethers-etherscan/rustls",
|
||||
"ethers-contract/rustls",
|
||||
"ethers-solc/rustls",
|
||||
# Do not include example crates in default members
|
||||
default-members = [
|
||||
"ethers",
|
||||
"ethers-addressbook",
|
||||
"ethers-contract",
|
||||
"ethers-core",
|
||||
"ethers-etherscan",
|
||||
"ethers-middleware",
|
||||
"ethers-providers",
|
||||
"ethers-signers",
|
||||
"ethers-solc",
|
||||
]
|
||||
openssl = [
|
||||
"ethers-middleware/openssl",
|
||||
"ethers-providers/openssl",
|
||||
"ethers-etherscan/openssl",
|
||||
"ethers-contract/openssl",
|
||||
"ethers-solc/openssl",
|
||||
]
|
||||
dev-rpc = ["ethers-providers/dev-rpc"]
|
||||
## signers
|
||||
ledger = ["ethers-signers/ledger"]
|
||||
trezor = ["ethers-signers/trezor"]
|
||||
yubi = ["ethers-signers/yubi"]
|
||||
## contracts
|
||||
abigen = ["ethers-contract/abigen"]
|
||||
### abigen without reqwest
|
||||
abigen-offline = ["ethers-contract/abigen-offline"]
|
||||
## solc
|
||||
ethers-solc = ["dep:ethers-solc", "ethers-etherscan/ethers-solc"]
|
||||
solc-full = ["ethers-solc", "ethers-solc/full"]
|
||||
solc-tests = ["ethers-solc", "ethers-solc/tests"]
|
||||
solc-sha2-asm = ["ethers-solc", "ethers-solc/asm"]
|
||||
|
||||
[dependencies]
|
||||
ethers-addressbook = { version = "^2.0.0", default-features = false, path = "./ethers-addressbook" }
|
||||
ethers-contract = { version = "^2.0.0", default-features = false, path = "./ethers-contract" }
|
||||
ethers-core = { version = "^2.0.0", default-features = false, path = "./ethers-core" }
|
||||
ethers-providers = { version = "^2.0.0", default-features = false, path = "./ethers-providers" }
|
||||
ethers-signers = { version = "^2.0.0", default-features = false, path = "./ethers-signers" }
|
||||
ethers-middleware = { version = "^2.0.0", default-features = false, path = "./ethers-middleware" }
|
||||
ethers-solc = { version = "^2.0.0", default-features = false, path = "./ethers-solc", optional = true }
|
||||
ethers-etherscan = { version = "^2.0.0", default-features = false, path = "./ethers-etherscan" }
|
||||
[workspace.dependencies]
|
||||
# workspace crates
|
||||
ethers = { version = "2.0.0", path = "ethers", default-features = false }
|
||||
ethers-addressbook = { version = "2.0.0", path = "ethers-addressbook", default-features = false }
|
||||
ethers-contract = { version = "2.0.0", path = "ethers-contract", default-features = false }
|
||||
ethers-core = { version = "2.0.0", path = "ethers-core", default-features = false }
|
||||
ethers-etherscan = { version = "2.0.0", path = "ethers-etherscan", default-features = false }
|
||||
ethers-middleware = { version = "2.0.0", path = "ethers-middleware", default-features = false }
|
||||
ethers-providers = { version = "2.0.0", path = "ethers-providers", default-features = false }
|
||||
ethers-signers = { version = "2.0.0", path = "ethers-signers", default-features = false }
|
||||
ethers-solc = { version = "2.0.0", path = "ethers-solc", default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
ethers-contract = { version = "^2.0.0", default-features = false, path = "./ethers-contract", features = [
|
||||
"abigen",
|
||||
"eip712",
|
||||
] }
|
||||
ethers-providers = { version = "^2.0.0", default-features = false, path = "./ethers-providers", features = [
|
||||
"ws",
|
||||
"ipc",
|
||||
] }
|
||||
ethers-contract-abigen = { version = "2.0.0", path = "ethers-contract/ethers-contract-abigen", default-features = false }
|
||||
ethers-contract-derive = { version = "2.0.0", path = "ethers-contract/ethers-contract-derive", default-features = false }
|
||||
ethers-derive-eip712 = { version = "2.0.0", path = "ethers-core/ethers-derive-eip712", default-features = false }
|
||||
|
||||
bytes = "1.4.0"
|
||||
# async / async utils
|
||||
tokio = "1.26"
|
||||
tokio-tungstenite = { version = "0.18.0", default-features = false }
|
||||
futures = { version = "0.3.27", default-features = false }
|
||||
futures-core = { version = "0.3.27", default-features = false }
|
||||
futures-util = { version = "0.3.27", default-features = false }
|
||||
futures-executor = { version = "0.3.27", default-features = false }
|
||||
futures-channel = { version = "0.3.27", default-features = false }
|
||||
futures-locks = { version = "0.7.1", default-features = false }
|
||||
futures-timer = { version = "3.0.2", default-features = false, features = ["wasm-bindgen"] }
|
||||
pin-project = "1.0"
|
||||
reqwest = { version = "0.11.14", default-features = false }
|
||||
url = { version = "2.3", default-features = false }
|
||||
|
||||
# crypto
|
||||
elliptic-curve = { version = "0.13.2", default-features = false }
|
||||
generic-array = { version = "0.14.6", default-features = false }
|
||||
k256 = { version = "0.13.0", default-features = false, features = ["ecdsa", "std"] }
|
||||
sha2 = { version = "0.10.6", default-features = false }
|
||||
tiny-keccak = { version = "2.0.2", default-features = false }
|
||||
spki = { version = "0.7.0", default-features = false }
|
||||
|
||||
# serde
|
||||
serde = "1.0"
|
||||
serde_json = "1.0"
|
||||
|
||||
# macros
|
||||
proc-macro2 = "1.0"
|
||||
quote = "1.0"
|
||||
syn = "1.0"
|
||||
async-trait = "0.1.66"
|
||||
auto_impl = "1.0"
|
||||
|
||||
# misc
|
||||
thiserror = "1.0"
|
||||
once_cell = "1.17"
|
||||
hex = "0.4"
|
||||
eyre = "0.6"
|
||||
hex = "0.4.3"
|
||||
rand = "0.8.5"
|
||||
serde = { version = "1.0.124", features = ["derive"] }
|
||||
serde_json = "1.0.64"
|
||||
tempfile = "3.3.0"
|
||||
tokio = { version = "1.18", features = ["macros", "rt-multi-thread"] }
|
||||
tempfile = "3.4"
|
||||
dunce = "1.0"
|
||||
walkdir = "2.3"
|
||||
regex = "1.7"
|
||||
toml = "0.7"
|
||||
hex-literal = "0.3"
|
||||
rand = "0.8"
|
||||
bytes = "1.4"
|
||||
semver = "1.0"
|
||||
criterion = "0.4"
|
||||
rayon = "1.7"
|
||||
|
||||
# profile for the wasm example
|
||||
[profile.release.package.ethers-wasm]
|
||||
# Tell `rustc` to optimize for small code size.
|
||||
opt-level = "s"
|
||||
# tracing
|
||||
tracing = "0.1.37"
|
||||
tracing-subscriber = { version = "0.3.16", default-features = false }
|
||||
tracing-futures = "0.2.5"
|
||||
|
||||
# wasm
|
||||
getrandom = { version = "0.2", features = ["js"] }
|
||||
instant = "0.1.12"
|
||||
|
|
|
@ -1,18 +1,31 @@
|
|||
[package]
|
||||
name = "ethers-addressbook"
|
||||
version = "2.0.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.64"
|
||||
authors = ["Georgios Konstantopoulos <me@gakonst.com>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
authors = ["Rohit Narurkar <rohit.narurkar@protonmail.com>"]
|
||||
readme = "README.md"
|
||||
description = "Common Ethereum name to address mappings"
|
||||
homepage = "https://docs.rs/ethers"
|
||||
repository = "https://github.com/gakonst/ethers-rs"
|
||||
keywords = ["ethereum", "web3", "celo", "ethers"]
|
||||
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
license.workspace = true
|
||||
documentation.workspace = true
|
||||
repository.workspace = true
|
||||
homepage.workspace = true
|
||||
categories.workspace = true
|
||||
keywords.workspace = true
|
||||
exclude.workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[package.metadata.playground]
|
||||
all-features = true
|
||||
|
||||
[dependencies]
|
||||
ethers-core = { version = "^2.0.0", path = "../ethers-core", default-features = false }
|
||||
ethers-core.workspace = true
|
||||
|
||||
once_cell = "1.17.1"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
once_cell.workspace = true
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
|
|
|
@ -1,45 +1,53 @@
|
|||
[package]
|
||||
name = "ethers-contract"
|
||||
version = "2.0.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.64"
|
||||
authors = ["Georgios Konstantopoulos <me@gakonst.com>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
description = "Smart contract bindings for the ethers-rs crate"
|
||||
homepage = "https://docs.rs/ethers"
|
||||
repository = "https://github.com/gakonst/ethers-rs"
|
||||
keywords = ["ethereum", "web3", "celo", "ethers"]
|
||||
readme = "README.md"
|
||||
description = "Type-safe abstractions for interacting with Ethereum smart contracts"
|
||||
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
license.workspace = true
|
||||
documentation.workspace = true
|
||||
repository.workspace = true
|
||||
homepage.workspace = true
|
||||
categories.workspace = true
|
||||
keywords.workspace = true
|
||||
exclude.workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[package.metadata.playground]
|
||||
all-features = true
|
||||
|
||||
[dependencies]
|
||||
ethers-providers = { version = "^2.0.0", path = "../ethers-providers", default-features = false }
|
||||
ethers-core = { version = "^2.0.0", path = "../ethers-core", default-features = false }
|
||||
ethers-contract-abigen = { version = "^2.0.0", path = "ethers-contract-abigen", default-features = false, optional = true }
|
||||
ethers-contract-derive = { version = "^2.0.0", path = "ethers-contract-derive", optional = true }
|
||||
ethers-derive-eip712 = { version = "^2.0.0", path = "../ethers-core/ethers-derive-eip712", optional = true }
|
||||
ethers-providers.workspace = true
|
||||
ethers-core.workspace = true
|
||||
|
||||
serde = { version = "1.0.124", default-features = false }
|
||||
serde_json = { version = "1.0.64", default-features = false }
|
||||
thiserror = { version = "1.0", default-features = false }
|
||||
once_cell = { version = "1.17.1" }
|
||||
pin-project = { version = "1.0.11", default-features = false }
|
||||
futures-util = { version = "^0.3" }
|
||||
hex = { version = "0.4.3", default-features = false, features = ["std"] }
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
futures-util.workspace = true
|
||||
pin-project.workspace = true
|
||||
thiserror.workspace = true
|
||||
once_cell.workspace = true
|
||||
hex.workspace = true
|
||||
|
||||
# abigen
|
||||
ethers-contract-abigen = { workspace = true, optional = true }
|
||||
ethers-contract-derive = { workspace = true, optional = true }
|
||||
|
||||
# eip712
|
||||
ethers-derive-eip712 = { workspace = true, optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
ethers-providers = { version = "^2.0.0", path = "../ethers-providers", default-features = false, features = [
|
||||
"ws",
|
||||
] }
|
||||
ethers-signers = { version = "^2.0.0", path = "../ethers-signers" }
|
||||
ethers-contract-abigen = { version = "^2.0.0", path = "ethers-contract-abigen" }
|
||||
ethers-contract-derive = { version = "^2.0.0", path = "ethers-contract-derive" }
|
||||
ethers-core = { version = "^2.0.0", path = "../ethers-core", default-features = false, features = [
|
||||
"eip712",
|
||||
] }
|
||||
ethers-derive-eip712 = { version = "^2.0.0", path = "../ethers-core/ethers-derive-eip712" }
|
||||
ethers-solc = { version = "^2.0.0", path = "../ethers-solc", default-features = false }
|
||||
ethers-signers.workspace = true
|
||||
ethers-solc.workspace = true
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
|
||||
tokio = { version = "1.18", default-features = false, features = ["macros"] }
|
||||
tokio = { workspace = true, features = ["macros"] }
|
||||
|
||||
[features]
|
||||
default = ["abigen"]
|
||||
|
@ -54,8 +62,3 @@ legacy = []
|
|||
|
||||
rustls = ["ethers-contract-abigen/rustls"]
|
||||
openssl = ["ethers-contract-abigen/openssl"]
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
|
|
@ -1,59 +1,64 @@
|
|||
[package]
|
||||
name = "ethers-contract-abigen"
|
||||
version = "2.0.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.64"
|
||||
authors = [
|
||||
"Nicholas Rodrigues Lordello <nlordell@gmail.com>",
|
||||
"Georgios Konstantopoulos <me@gakonst.com>",
|
||||
]
|
||||
license = "MIT OR Apache-2.0"
|
||||
readme = "README.md"
|
||||
description = "Code generation for type-safe bindings to Ethereum smart contracts"
|
||||
homepage = "https://docs.rs/ethers"
|
||||
repository = "https://github.com/gakonst/ethers-rs"
|
||||
keywords = ["ethereum", "web3", "celo", "ethers"]
|
||||
|
||||
[dependencies]
|
||||
ethers-core = { version = "^2.0.0", path = "../../ethers-core", features = ["macros"] }
|
||||
ethers-etherscan = { version = "^2.0.0", path = "../../ethers-etherscan", default-features = false, optional = true }
|
||||
|
||||
proc-macro2 = "1.0"
|
||||
quote = "1.0"
|
||||
syn = { version = "1.0.12", default-features = false, features = ["full", "extra-traits"] }
|
||||
prettyplease = "0.1.23"
|
||||
|
||||
Inflector = "0.11"
|
||||
serde_json = "1.0.61"
|
||||
serde = { version = "1.0.124", features = ["derive"] }
|
||||
hex = { version = "0.4.2", default-features = false, features = ["std"] }
|
||||
cfg-if = "1.0.0"
|
||||
dunce = "1.0.2"
|
||||
walkdir = "2.3.2"
|
||||
eyre = "0.6"
|
||||
regex = "1.6.0"
|
||||
toml = "0.5.9"
|
||||
|
||||
reqwest = { version = "0.11.3", default-features = false, features = ["blocking"], optional = true }
|
||||
tokio = { version = "1.0", default-features = false, features = ["sync"], optional = true }
|
||||
url = { version = "2.3.1", default-features = false, optional = true }
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
# NOTE: this enables wasm compatibility for getrandom indirectly
|
||||
getrandom = { version = "0.2", features = ["js"] }
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
license.workspace = true
|
||||
documentation.workspace = true
|
||||
repository.workspace = true
|
||||
homepage.workspace = true
|
||||
categories.workspace = true
|
||||
keywords.workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[package.metadata.playground]
|
||||
all-features = true
|
||||
|
||||
[dependencies]
|
||||
ethers-core = { workspace = true, features = ["macros"] }
|
||||
|
||||
proc-macro2.workspace = true
|
||||
quote.workspace = true
|
||||
syn = { workspace = true, features = ["full"] }
|
||||
prettyplease = "0.1.25"
|
||||
|
||||
Inflector = "0.11"
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
hex.workspace = true
|
||||
dunce.workspace = true
|
||||
walkdir.workspace = true
|
||||
eyre.workspace = true
|
||||
regex.workspace = true
|
||||
toml.workspace = true
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
# online
|
||||
ethers-etherscan = { workspace = true, optional = true }
|
||||
reqwest = { workspace = true, features = ["blocking"], optional = true }
|
||||
tokio = { workspace = true, optional = true }
|
||||
url = { workspace = true, optional = true }
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
# NOTE: this enables wasm compatibility for getrandom indirectly
|
||||
getrandom.workspace = true
|
||||
|
||||
[features]
|
||||
online = ["reqwest", "ethers-etherscan", "url", "tokio"]
|
||||
openssl = ["online", "reqwest/native-tls", "ethers-etherscan/openssl"]
|
||||
rustls = ["online", "reqwest/rustls-tls", "ethers-etherscan/rustls"]
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile = "3.2.0"
|
||||
ethers-solc = { version = "^2.0.0", path = "../../ethers-solc", default-features = false, features = [
|
||||
"project-util",
|
||||
"svm-solc",
|
||||
] }
|
||||
tempfile.workspace = true
|
||||
ethers-solc = { workspace = true, features = ["project-util", "svm-solc"] }
|
||||
|
|
|
@ -1 +1,7 @@
|
|||
# ethers-contract-abigen
|
||||
|
||||
Code generation for type-safe bindings to Ethereum smart contracts.
|
||||
|
||||
This code generator was adapted from the original [ethcontract-rs repository by Gnosis](https://github.com/gnosis/ethcontract-rs/tree/master/generate).
|
||||
|
||||
For more information, please refer to the [book](https://gakonst.com/ethers-rs).
|
||||
|
|
|
@ -1,32 +1,31 @@
|
|||
[package]
|
||||
name = "ethers-contract-derive"
|
||||
version = "2.0.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.64"
|
||||
authors = [
|
||||
"Nicholas Rodrigues Lordello <nlordell@gmail.com>",
|
||||
"Georgios Konstantopoulos <me@gakonst.com>",
|
||||
]
|
||||
license = "MIT OR Apache-2.0"
|
||||
description = "Proc macro for type-safe bindings generation to Ethereum and Celo smart contracts"
|
||||
homepage = "https://docs.rs/ethers"
|
||||
repository = "https://github.com/gakonst/ethers-rs"
|
||||
keywords = ["ethereum", "web3", "celo", "ethers"]
|
||||
readme = "README.md"
|
||||
description = "Proc macros for type-safe bindings generation to Ethereum smart contracts"
|
||||
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
license.workspace = true
|
||||
documentation.workspace = true
|
||||
repository.workspace = true
|
||||
homepage.workspace = true
|
||||
categories.workspace = true
|
||||
keywords.workspace = true
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
|
||||
[dependencies]
|
||||
ethers-core = { version = "^2.0.0", path = "../../ethers-core" }
|
||||
ethers-contract-abigen = { version = "^2.0.0", path = "../ethers-contract-abigen", default-features = false }
|
||||
ethers-core.workspace = true
|
||||
ethers-contract-abigen.workspace = true
|
||||
|
||||
proc-macro2 = "1.0"
|
||||
quote = "1.0"
|
||||
syn = "1.0.12"
|
||||
proc-macro2.workspace = true
|
||||
quote.workspace = true
|
||||
syn.workspace = true
|
||||
|
||||
hex = { version = "0.4.3", default-features = false, features = ["std"] }
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
hex.workspace = true
|
||||
|
|
|
@ -1 +1,7 @@
|
|||
This proc-macro was adapted from the original [ethcontract-rs repository by Gnosis](https://github.com/gnosis/ethcontract-rs/tree/master/derive).
|
||||
# ethers-contract-derive
|
||||
|
||||
Proc macros for type-safe bindings generation to Ethereum smart contracts.
|
||||
|
||||
Adapted from the original [ethcontract-rs repository by Gnosis](https://github.com/gnosis/ethcontract-rs/tree/master/derive).
|
||||
|
||||
For more information, please refer to the [book](https://gakonst.com/ethers-rs).
|
||||
|
|
|
@ -275,7 +275,7 @@ where
|
|||
/// Broadcasts the contract deployment transaction and after waiting for it to
|
||||
/// be sufficiently confirmed (default: 1), it returns a tuple with
|
||||
/// the [`Contract`](crate::Contract) struct at the deployed contract's address
|
||||
/// and the corresponding [`TransactionReceipt`](ethers_core::types::TransactionReceipt).
|
||||
/// and the corresponding [`TransactionReceipt`].
|
||||
pub async fn send_with_receipt(
|
||||
self,
|
||||
) -> Result<(ContractInstance<B, M>, TransactionReceipt), ContractError<M>> {
|
||||
|
@ -290,11 +290,12 @@ where
|
|||
let receipt = pending_tx
|
||||
.confirmations(self.confs)
|
||||
.await
|
||||
.map_err(|_| ContractError::ContractNotDeployed)?
|
||||
.ok()
|
||||
.flatten()
|
||||
.ok_or(ContractError::ContractNotDeployed)?;
|
||||
let address = receipt.contract_address.ok_or(ContractError::ContractNotDeployed)?;
|
||||
|
||||
let contract = ContractInstance::new(address, self.abi.clone(), self.client.clone());
|
||||
let contract = ContractInstance::new(address, self.abi, self.client);
|
||||
Ok((contract, receipt))
|
||||
}
|
||||
|
||||
|
|
|
@ -11,10 +11,9 @@ use ethers_core::{
|
|||
},
|
||||
utils::{keccak256, Anvil},
|
||||
};
|
||||
use ethers_derive_eip712::*;
|
||||
use ethers_providers::{Http, Middleware, MiddlewareError, Provider, StreamExt};
|
||||
use ethers_signers::{LocalWallet, Signer};
|
||||
use std::{convert::TryFrom, iter::FromIterator, sync::Arc, time::Duration};
|
||||
use std::{sync::Arc, time::Duration};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct NonClone<M> {
|
||||
|
@ -787,7 +786,10 @@ async fn multicall_aggregate() {
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "eip712")]
|
||||
async fn test_derive_eip712() {
|
||||
use ethers_derive_eip712::*;
|
||||
|
||||
// Generate Contract ABI Bindings
|
||||
abigen!(
|
||||
DeriveEip712Test,
|
||||
|
|
|
@ -1,70 +1,77 @@
|
|||
[package]
|
||||
name = "ethers-core"
|
||||
version = "2.0.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.64"
|
||||
authors = ["Georgios Konstantopoulos <me@gakonst.com>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
description = "Core structures for the ethers-rs crate"
|
||||
homepage = "https://docs.rs/ethers"
|
||||
repository = "https://github.com/gakonst/ethers-rs"
|
||||
keywords = ["ethereum", "web3", "celo", "ethers"]
|
||||
readme = "README.md"
|
||||
description = "Ethereum data types, cryptography and utilities"
|
||||
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
license.workspace = true
|
||||
documentation.workspace = true
|
||||
repository.workspace = true
|
||||
homepage.workspace = true
|
||||
categories.workspace = true
|
||||
keywords.workspace = true
|
||||
exclude.workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[package.metadata.playground]
|
||||
all-features = true
|
||||
|
||||
[dependencies]
|
||||
# abi
|
||||
open-fastrlp = { version = "0.1.4", features = ["std", "derive", "ethereum-types"] }
|
||||
rlp = { version = "0.5.2", default-features = false, features = ["std"] }
|
||||
rlp = { version = "0.5", features = ["derive"] }
|
||||
ethabi = { version = "18.0.0", default-features = false, features = ["full-serde", "rlp"] }
|
||||
arrayvec = { version = "0.7.2", default-features = false }
|
||||
rlp-derive = { version = "0.1.0", default-features = false }
|
||||
arrayvec = { version = "0.7", default-features = false }
|
||||
|
||||
# crypto
|
||||
elliptic-curve = { version = "0.13.2", default-features = false }
|
||||
generic-array = { version = "0.14.6", default-features = false }
|
||||
k256 = { version = "0.13.0", default-features = false, features = ["ecdsa", "std"] }
|
||||
rand = { version = "0.8.5", default-features = false }
|
||||
tiny-keccak = { version = "2.0.2", default-features = false }
|
||||
elliptic-curve.workspace = true
|
||||
generic-array.workspace = true
|
||||
k256 = { workspace = true, features = ["ecdsa", "std"] }
|
||||
tiny-keccak.workspace = true
|
||||
rand.workspace = true
|
||||
|
||||
# misc
|
||||
chrono = { version = "0.4", default-features = false }
|
||||
serde = { version = "1.0.124", default-features = false, features = ["derive"] }
|
||||
serde_json = { version = "1.0.64", default-features = false, features = ["arbitrary_precision"] }
|
||||
thiserror = { version = "1.0", default-features = false }
|
||||
bytes = { version = "1.4.0", features = ["serde"] }
|
||||
hex = { version = "0.4.3", default-features = false, features = ["std"] }
|
||||
once_cell = { version = "1.17.1", optional = true }
|
||||
unicode-xid = "0.2.4"
|
||||
serde.workspace = true
|
||||
serde_json = { workspace = true, features = ["arbitrary_precision"] }
|
||||
thiserror.workspace = true
|
||||
bytes = { workspace = true, features = ["serde"] }
|
||||
hex.workspace = true
|
||||
once_cell = { workspace = true, optional = true }
|
||||
unicode-xid = "0.2"
|
||||
strum = { version = "0.24", features = ["derive"] }
|
||||
num_enum = "0.5"
|
||||
|
||||
# macros feature enabled dependencies
|
||||
cargo_metadata = { version = "0.15.3", optional = true }
|
||||
|
||||
# eip712 feature enabled dependencies
|
||||
convert_case = { version = "0.6.0", optional = true }
|
||||
syn = { version = "1.0.109", optional = true }
|
||||
proc-macro2 = { version = "1.0.52", optional = true }
|
||||
num_enum = "0.5.11"
|
||||
syn = { workspace = true, optional = true }
|
||||
proc-macro2 = { workspace = true, optional = true }
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
tempfile = { version = "3.4.0", default-features = false }
|
||||
tempfile.workspace = true
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
# NOTE: this enables wasm compatibility for getrandom indirectly
|
||||
getrandom = { version = "0.2", features = ["js"] }
|
||||
getrandom.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
serde_json = { version = "1.0.64", default-features = false }
|
||||
bincode = { version = "1.3.3", default-features = false }
|
||||
once_cell = { version = "1.17.1" }
|
||||
hex-literal = "0.3.4"
|
||||
rand = "0.8.5"
|
||||
once_cell.workspace = true
|
||||
hex-literal.workspace = true
|
||||
rand.workspace = true
|
||||
|
||||
[features]
|
||||
celo = ["legacy"] # celo support extends the transaction format with extra fields
|
||||
legacy = []
|
||||
eip712 = ["convert_case", "syn", "proc-macro2"]
|
||||
macros = ["syn", "cargo_metadata", "once_cell"]
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
|
|
@ -1,23 +1,29 @@
|
|||
[package]
|
||||
name = "ethers-derive-eip712"
|
||||
version = "2.0.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.64"
|
||||
description = "Custom derive macro for EIP-712 typed data"
|
||||
license = "MIT OR Apache-2.0"
|
||||
authors = ["Ryan Tate <ryan.michael.tate@gmail.com>"]
|
||||
description = "Derive procedural macro for EIP-712 typed data"
|
||||
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
license.workspace = true
|
||||
documentation.workspace = true
|
||||
repository.workspace = true
|
||||
homepage.workspace = true
|
||||
categories.workspace = true
|
||||
keywords.workspace = true
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
|
||||
[dependencies]
|
||||
quote = "1.0.9"
|
||||
syn = "1.0.77"
|
||||
ethers-core = { version = "^2.0.0", path = "../", default-features = false, features = [
|
||||
"eip712",
|
||||
"macros",
|
||||
] }
|
||||
hex = "0.4.3"
|
||||
serde_json = "1.0.68"
|
||||
ethers-core = { workspace = true, features = ["eip712", "macros"] }
|
||||
|
||||
quote.workspace = true
|
||||
syn.workspace = true
|
||||
|
||||
hex.workspace = true
|
||||
serde_json.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
ethers-contract-derive = { version = "^2.0.0", path = "../../ethers-contract/ethers-contract-derive" }
|
||||
ethers-contract-derive.workspace = true
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
//! # EIP-712 Derive Macro
|
||||
//!
|
||||
//! This crate provides a derive macro `Eip712` that is used to encode a rust struct
|
||||
//! into a payload hash, according to [https://eips.ethereum.org/EIPS/eip-712](https://eips.ethereum.org/EIPS/eip-712)
|
||||
//!
|
||||
|
|
|
@ -564,13 +564,14 @@ mod tests {
|
|||
String::with_capacity(150 * (ethers as usize + dependencies.len()));
|
||||
|
||||
if ethers {
|
||||
let ethers = format!("ethers = {{ path = {ethers_root:?} }}\n");
|
||||
let path = ethers_root.join("ethers");
|
||||
let ethers = format!("ethers = {{ path = \"{}\" }}\n", path.display());
|
||||
dependencies_toml.push_str(ðers);
|
||||
}
|
||||
|
||||
for dep in dependencies.iter() {
|
||||
let path = ethers_root.join(dep.fs_path());
|
||||
let dep = format!("{dep} = {{ path = {path:?} }}\n");
|
||||
let dep = format!("{dep} = {{ path = \"{}\" }}\n", path.display());
|
||||
dependencies_toml.push_str(&dep);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,8 +6,9 @@ use open_fastrlp::{
|
|||
RlpDecodable as FastRlpDecodable, RlpDecodableWrapper as FastRlpDecodableWrapper,
|
||||
RlpEncodable as FastRlpEncodable, RlpEncodableWrapper as FastRlpEncodableWrapper,
|
||||
};
|
||||
use rlp::{Decodable, RlpStream};
|
||||
use rlp_derive::{RlpDecodable, RlpDecodableWrapper, RlpEncodable, RlpEncodableWrapper};
|
||||
use rlp::{
|
||||
Decodable, RlpDecodable, RlpDecodableWrapper, RlpEncodable, RlpEncodableWrapper, RlpStream,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use thiserror::Error;
|
||||
|
||||
|
|
|
@ -1,50 +1,55 @@
|
|||
[package]
|
||||
name = "ethers-etherscan"
|
||||
version = "2.0.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.64"
|
||||
authors = [
|
||||
"Matthias Seitz <matthias.seitz@outlook.de>",
|
||||
"Georgios Konstantopoulos <me@gakonst.com>",
|
||||
]
|
||||
license = "MIT OR Apache-2.0"
|
||||
readme = "../README.md"
|
||||
documentation = "https://docs.rs/ethers"
|
||||
repository = "https://github.com/gakonst/ethers-rs"
|
||||
homepage = "https://docs.rs/ethers"
|
||||
description = """
|
||||
Rust API bindings for the etherscan.io web API
|
||||
"""
|
||||
keywords = ["ethereum", "web3", "etherscan", "ethers"]
|
||||
readme = "README.md"
|
||||
description = "Bindings for the etherscan.io web API"
|
||||
keywords = ["crypto", "ethers", "ethereum", "web3", "etherscan"]
|
||||
|
||||
[dependencies]
|
||||
ethers-core = { version = "^2.0.0", path = "../ethers-core", default-features = false }
|
||||
ethers-solc = { version = "^2.0.0", path = "../ethers-solc", default-features = false, optional = true }
|
||||
reqwest = { version = "0.11.14", default-features = false, features = ["json"] }
|
||||
serde = { version = "1.0.124", default-features = false, features = ["derive"] }
|
||||
serde_json = { version = "1.0.64", default-features = false }
|
||||
serde-aux = { version = "4.1.2", default-features = false }
|
||||
thiserror = "1.0"
|
||||
tracing = "0.1.37"
|
||||
semver = "1.0.17"
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
# NOTE: this enables wasm compatibility for getrandom indirectly
|
||||
getrandom = { version = "0.2", features = ["js"] }
|
||||
|
||||
[dev-dependencies]
|
||||
ethers-solc = { version = "^2.0.0", path = "../ethers-solc", default-features = false }
|
||||
|
||||
tempfile = "3.4.0"
|
||||
tokio = { version = "1.18", features = ["macros", "rt-multi-thread", "time"] }
|
||||
serial_test = "1.0.0"
|
||||
tracing-subscriber = { version = "0.3", default-features = false, features = ["env-filter", "fmt"] }
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
license.workspace = true
|
||||
documentation.workspace = true
|
||||
repository.workspace = true
|
||||
homepage.workspace = true
|
||||
categories.workspace = true
|
||||
exclude.workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[package.metadata.playground]
|
||||
all-features = true
|
||||
|
||||
[dependencies]
|
||||
ethers-core.workspace = true
|
||||
|
||||
ethers-solc = { workspace = true, optional = true }
|
||||
|
||||
reqwest = { workspace = true, features = ["json"] }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
serde_json.workspace = true
|
||||
thiserror.workspace = true
|
||||
tracing.workspace = true
|
||||
semver.workspace = true
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
# NOTE: this enables wasm compatibility for getrandom indirectly
|
||||
getrandom.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
ethers-solc.workspace = true
|
||||
|
||||
tempfile.workspace = true
|
||||
tokio = { workspace = true, features = ["macros", "rt-multi-thread", "time"] }
|
||||
serial_test = "1.0.0"
|
||||
tracing-subscriber = { workspace = true, features = ["env-filter", "fmt"] }
|
||||
|
||||
[features]
|
||||
default = ["rustls"]
|
||||
openssl = ["reqwest/native-tls"]
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
use std::{collections::HashMap, str::FromStr};
|
||||
|
||||
use serde::{de, Deserialize};
|
||||
use serde_aux::prelude::*;
|
||||
|
||||
use ethers_core::types::U256;
|
||||
|
||||
use crate::{Client, EtherscanError, Response, Result};
|
||||
use ethers_core::types::U256;
|
||||
use serde::{de, Deserialize, Deserializer};
|
||||
use std::{collections::HashMap, str::FromStr};
|
||||
|
||||
#[derive(Deserialize, Clone, Debug)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
|
@ -26,6 +22,25 @@ pub struct GasOracle {
|
|||
pub gas_used_ratio: Vec<f64>,
|
||||
}
|
||||
|
||||
fn deserialize_number_from_string<'de, T, D>(deserializer: D) -> Result<T, D::Error>
|
||||
where
|
||||
D: Deserializer<'de>,
|
||||
T: FromStr + serde::Deserialize<'de>,
|
||||
<T as FromStr>::Err: std::fmt::Display,
|
||||
{
|
||||
#[derive(Deserialize)]
|
||||
#[serde(untagged)]
|
||||
enum StringOrInt<T> {
|
||||
String(String),
|
||||
Number(T),
|
||||
}
|
||||
|
||||
match StringOrInt::<T>::deserialize(deserializer)? {
|
||||
StringOrInt::String(s) => s.parse::<T>().map_err(serde::de::Error::custom),
|
||||
StringOrInt::Number(i) => Ok(i),
|
||||
}
|
||||
}
|
||||
|
||||
fn deserialize_f64_vec<'de, D>(deserializer: D) -> core::result::Result<Vec<f64>, D::Error>
|
||||
where
|
||||
D: de::Deserializer<'de>,
|
||||
|
|
|
@ -27,7 +27,7 @@ pub mod transaction;
|
|||
pub mod utils;
|
||||
pub mod verify;
|
||||
|
||||
pub(crate) type Result<T> = std::result::Result<T, EtherscanError>;
|
||||
pub(crate) type Result<T, E = EtherscanError> = std::result::Result<T, E>;
|
||||
|
||||
/// The Etherscan.io API client.
|
||||
#[derive(Clone, Debug)]
|
||||
|
|
|
@ -4,7 +4,7 @@ use ethers_etherscan::contract::SourceCodeMetadata;
|
|||
use serial_test::serial;
|
||||
|
||||
/// Abi of [0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413](https://api.etherscan.io/api?module=contract&action=getsourcecode&address=0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413).
|
||||
const DAO_ABI: &str = include!("../../../tests/testdata/the_dao_abi.expr");
|
||||
const DAO_ABI: &str = include!("../../../testdata/the_dao_abi.expr");
|
||||
|
||||
#[tokio::test]
|
||||
#[serial]
|
||||
|
|
|
@ -1,62 +1,65 @@
|
|||
[package]
|
||||
name = "ethers-middleware"
|
||||
version = "2.0.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.64"
|
||||
authors = ["Georgios Konstantopoulos <me@gakonst.com>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
readme = "README.md"
|
||||
description = "Middleware implementations for the ethers-rs crate"
|
||||
homepage = "https://docs.rs/ethers"
|
||||
repository = "https://github.com/gakonst/ethers-rs"
|
||||
keywords = ["ethereum", "web3", "celo", "ethers"]
|
||||
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
license.workspace = true
|
||||
documentation.workspace = true
|
||||
repository.workspace = true
|
||||
homepage.workspace = true
|
||||
categories.workspace = true
|
||||
keywords.workspace = true
|
||||
exclude.workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[dependencies]
|
||||
ethers-contract = { version = "^2.0.0", path = "../ethers-contract", default-features = false, features = [
|
||||
"abigen",
|
||||
] }
|
||||
ethers-core = { version = "^2.0.0", path = "../ethers-core", default-features = false }
|
||||
ethers-etherscan = { version = "^2.0.0", path = "../ethers-etherscan", default-features = false }
|
||||
ethers-providers = { version = "^2.0.0", path = "../ethers-providers", default-features = false }
|
||||
ethers-signers = { version = "^2.0.0", path = "../ethers-signers", default-features = false }
|
||||
[package.metadata.playground]
|
||||
all-features = true
|
||||
|
||||
async-trait = { version = "0.1.50", default-features = false }
|
||||
auto_impl = { version = "1.0.1", default-features = false }
|
||||
serde = { version = "1.0.124", default-features = false, features = ["derive"] }
|
||||
thiserror = { version = "1.0", default-features = false }
|
||||
futures-util = { version = "^0.3" }
|
||||
futures-locks = { version = "0.7", default-features = false }
|
||||
tracing = { version = "0.1.37", default-features = false }
|
||||
tracing-futures = { version = "0.2.5", default-features = false }
|
||||
[dependencies]
|
||||
ethers-contract = { workspace = true, features = ["abigen"] }
|
||||
ethers-core.workspace = true
|
||||
ethers-etherscan.workspace = true
|
||||
ethers-providers.workspace = true
|
||||
ethers-signers.workspace = true
|
||||
|
||||
async-trait.workspace = true
|
||||
auto_impl.workspace = true
|
||||
serde.workspace = true
|
||||
thiserror.workspace = true
|
||||
futures-util.workspace = true
|
||||
futures-locks.workspace = true
|
||||
tracing.workspace = true
|
||||
tracing-futures.workspace = true
|
||||
instant.workspace = true
|
||||
|
||||
# for gas oracles
|
||||
reqwest = { version = "0.11.14", default-features = false, features = ["json", "rustls-tls"] }
|
||||
url = { version = "2.3.1", default-features = false }
|
||||
reqwest.workspace = true
|
||||
url.workspace = true
|
||||
|
||||
serde_json = { version = "1.0.64", default-features = false }
|
||||
instant = { version = "0.1.12", features = ["now"] }
|
||||
serde_json.workspace = true
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
tokio = { version = "1.18" }
|
||||
tokio.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
ethers-providers = { version = "^2.0.0", path = "../ethers-providers", default-features = false, features = [
|
||||
"ws",
|
||||
"rustls",
|
||||
] }
|
||||
ethers-solc = { version = "^2.0.0", path = "../ethers-solc" }
|
||||
ethers-providers = { workspace = true, features = ["ws", "rustls"] }
|
||||
ethers-solc.workspace = true
|
||||
|
||||
hex = { version = "0.4.3", default-features = false, features = ["std"] }
|
||||
rand = { version = "0.8.5", default-features = false }
|
||||
once_cell = "1.17.1"
|
||||
reqwest = { version = "0.11.14", default-features = false, features = ["json", "rustls"] }
|
||||
hex.workspace = true
|
||||
rand.workspace = true
|
||||
once_cell.workspace = true
|
||||
reqwest = { workspace = true, features = ["json", "rustls"] }
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
|
||||
tokio = { version = "1.18", default-features = false, features = ["rt", "macros", "time"] }
|
||||
tokio = { workspace = true, features = ["rt", "macros", "time"] }
|
||||
|
||||
[features]
|
||||
default = ["rustls"]
|
||||
|
|
|
@ -2,11 +2,8 @@ use super::{GasOracle, Result};
|
|||
use async_trait::async_trait;
|
||||
use ethers_core::types::U256;
|
||||
use futures_locks::RwLock;
|
||||
use std::{
|
||||
fmt::Debug,
|
||||
future::Future,
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
use instant::{Duration, Instant};
|
||||
use std::{fmt::Debug, future::Future};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Cache<T: GasOracle> {
|
||||
|
|
|
@ -12,7 +12,7 @@ use std::sync::Arc;
|
|||
|
||||
type HttpWallet = SignerMiddleware<Provider<Http>, LocalWallet>;
|
||||
|
||||
abigen!(SimpleStorage, "../tests/testdata/SimpleStorage.json");
|
||||
abigen!(SimpleStorage, "../testdata/SimpleStorage.json");
|
||||
|
||||
#[tokio::test]
|
||||
#[ignore]
|
||||
|
|
|
@ -1,75 +1,80 @@
|
|||
[package]
|
||||
name = "ethers-providers"
|
||||
version = "2.0.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.64"
|
||||
authors = ["Georgios Konstantopoulos <me@gakonst.com>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
description = "Provider implementations for the ethers-rs crate"
|
||||
homepage = "https://docs.rs/ethers"
|
||||
repository = "https://github.com/gakonst/ethers-rs"
|
||||
keywords = ["ethereum", "web3", "celo", "ethers"]
|
||||
readme = "README.md"
|
||||
description = "Clients for interacting with Ethereum nodes"
|
||||
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
license.workspace = true
|
||||
documentation.workspace = true
|
||||
repository.workspace = true
|
||||
homepage.workspace = true
|
||||
categories.workspace = true
|
||||
keywords.workspace = true
|
||||
exclude.workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[dependencies]
|
||||
ethers-core = { version = "^2.0.0", path = "../ethers-core", default-features = false }
|
||||
[package.metadata.playground]
|
||||
all-features = true
|
||||
|
||||
async-trait = { version = "0.1.50", default-features = false }
|
||||
hex = { version = "0.4.3", default-features = false, features = ["std"] }
|
||||
reqwest = { version = "0.11.14", default-features = false, features = ["json"] }
|
||||
serde = { version = "1.0.124", default-features = false, features = ["derive"] }
|
||||
serde_json = { version = "1.0.64", default-features = false, features = ["raw_value"] }
|
||||
thiserror = { version = "1.0", default-features = false }
|
||||
url = { version = "2.3.1", default-features = false }
|
||||
auto_impl = { version = "1.0.1", default-features = false }
|
||||
http = { version = "0.2" }
|
||||
[dependencies]
|
||||
ethers-core.workspace = true
|
||||
|
||||
serde.workspace = true
|
||||
serde_json = { workspace = true, features = ["raw_value"] }
|
||||
|
||||
http = "0.2"
|
||||
reqwest = { workspace = true, features = ["json"] }
|
||||
url.workspace = true
|
||||
base64 = "0.21"
|
||||
|
||||
async-trait.workspace = true
|
||||
hex.workspace = true
|
||||
thiserror.workspace = true
|
||||
auto_impl.workspace = true
|
||||
once_cell.workspace = true
|
||||
bytes.workspace = true
|
||||
instant.workspace = true
|
||||
hashers = "1.0"
|
||||
|
||||
# required for implementing stream on the filters
|
||||
futures-core = { version = "0.3.16", default-features = false }
|
||||
futures-util = { version = "^0.3" }
|
||||
futures-timer = { version = "3.0.2", default-features = false }
|
||||
futures-channel = { version = "0.3.16", default-features = false, optional = true }
|
||||
pin-project = { version = "1.0.11", default-features = false }
|
||||
futures-core.workspace = true
|
||||
futures-util.workspace = true
|
||||
futures-timer.workspace = true
|
||||
futures-channel = { workspace = true, optional = true }
|
||||
pin-project.workspace = true
|
||||
|
||||
# peer-related admin namespace
|
||||
enr = { version = "0.8.0", default-features = false, features = ["k256", "serde"] }
|
||||
|
||||
# tracing
|
||||
tracing = { version = "0.1.37", default-features = false, features = ["attributes"] }
|
||||
tracing-futures = { version = "0.2.5", default-features = false, features = ["std-future"] }
|
||||
|
||||
bytes = { version = "1.4.0", default-features = false, optional = true }
|
||||
once_cell = "1.17.1"
|
||||
hashers = "1.0.1"
|
||||
tracing = { workspace = true, features = ["attributes"] }
|
||||
tracing-futures = { workspace = true, features = ["std-future"] }
|
||||
|
||||
[target.'cfg(target_family = "windows")'.dependencies]
|
||||
winapi = { version = "0.3", optional = true }
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
# tokio
|
||||
tokio = { version = "1.18", default-features = false, features = ["time"] }
|
||||
tokio-tungstenite = { version = "0.18.0", default-features = false, features = [
|
||||
"connect",
|
||||
], optional = true }
|
||||
tokio = { workspace = true, features = ["time"] }
|
||||
tokio-tungstenite = { workspace = true, features = ["connect"], optional = true }
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
ws_stream_wasm = "0.7"
|
||||
wasm-bindgen = "0.2"
|
||||
wasm-bindgen-futures = "0.4"
|
||||
web-sys = { version = "0.3", features = ["console"] }
|
||||
wasm-timer = "0.2"
|
||||
# this is currently necessary for `wasm-timer::Delay` to work
|
||||
parking_lot = { version = "0.11", features = ["wasm-bindgen"] }
|
||||
# NOTE: this enables wasm compatibility for getrandom indirectly
|
||||
getrandom = { version = "0.2", features = ["js"] }
|
||||
getrandom.workspace = true
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
|
||||
tokio = { version = "1.18", default-features = false, features = ["rt", "macros", "time"] }
|
||||
tokio = { workspace = true, features = ["rt", "macros", "time"] }
|
||||
tempfile = "3.4.0"
|
||||
|
||||
[features]
|
||||
|
@ -78,7 +83,7 @@ celo = ["ethers-core/celo"]
|
|||
|
||||
ws = ["tokio-tungstenite", "futures-channel"]
|
||||
legacy-ws = ["ws"]
|
||||
ipc = ["tokio/io-util", "bytes", "futures-channel", "winapi"]
|
||||
ipc = ["tokio/io-util", "futures-channel", "winapi"]
|
||||
|
||||
openssl = ["tokio-tungstenite/native-tls", "reqwest/native-tls"]
|
||||
# we use the webpki roots so we can build static binaries w/o any root cert dependencies
|
||||
|
|
|
@ -210,8 +210,6 @@ pub enum RetryClientError {
|
|||
/// (De)Serialization error
|
||||
#[error(transparent)]
|
||||
SerdeJson(serde_json::Error),
|
||||
/// TimerError (wasm only)
|
||||
TimerError,
|
||||
}
|
||||
|
||||
impl crate::RpcError for RetryClientError {
|
||||
|
@ -244,7 +242,6 @@ impl From<RetryClientError> for ProviderError {
|
|||
RetryClientError::ProviderError(err) => err,
|
||||
RetryClientError::TimeoutError => ProviderError::JsonRpcClientError(Box::new(src)),
|
||||
RetryClientError::SerdeJson(err) => err.into(),
|
||||
RetryClientError::TimerError => ProviderError::JsonRpcClientError(Box::new(src)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -338,9 +335,7 @@ where
|
|||
trace!("retrying and backing off for {:?}", next_backoff);
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
wasm_timer::Delay::new(next_backoff)
|
||||
.await
|
||||
.map_err(|_| RetryClientError::TimerError)?;
|
||||
futures_timer::Delay::new(next_backoff).await;
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
tokio::time::sleep(next_backoff).await;
|
||||
|
|
|
@ -178,7 +178,7 @@ mod tests {
|
|||
utils::Anvil,
|
||||
};
|
||||
use futures_util::{FutureExt, StreamExt};
|
||||
use std::{collections::HashSet, convert::TryFrom, time::Duration};
|
||||
use std::{collections::HashSet, time::Duration};
|
||||
|
||||
#[tokio::test]
|
||||
async fn can_stream_pending_transactions() {
|
||||
|
|
|
@ -1,19 +1,11 @@
|
|||
#![allow(clippy::return_self_not_must_use)]
|
||||
|
||||
use ethers_core::types::{Bytes, TransactionReceipt, H256};
|
||||
use futures_util::{stream::FuturesUnordered, StreamExt};
|
||||
use pin_project::pin_project;
|
||||
use std::{
|
||||
future::Future,
|
||||
pin::Pin,
|
||||
task::Poll,
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use futures_timer::Delay;
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
use wasm_timer::Delay;
|
||||
use futures_util::{stream::FuturesUnordered, StreamExt};
|
||||
use instant::{Duration, Instant};
|
||||
use pin_project::pin_project;
|
||||
use std::{future::Future, pin::Pin, task::Poll};
|
||||
|
||||
use crate::{
|
||||
utils::PinBoxFut, JsonRpcClient, Middleware, PendingTransaction, Provider, ProviderError,
|
||||
|
|
|
@ -4,7 +4,9 @@ use crate::{
|
|||
};
|
||||
use ethers_core::types::{Transaction, TransactionReceipt, TxHash, U64};
|
||||
use futures_core::stream::Stream;
|
||||
use futures_timer::Delay;
|
||||
use futures_util::stream::StreamExt;
|
||||
use instant::Duration;
|
||||
use pin_project::pin_project;
|
||||
use std::{
|
||||
fmt,
|
||||
|
@ -12,14 +14,8 @@ use std::{
|
|||
ops::Deref,
|
||||
pin::Pin,
|
||||
task::{Context, Poll},
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use futures_timer::Delay;
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
use wasm_timer::Delay;
|
||||
|
||||
/// A pending transaction is a transaction which has been submitted but is not yet mined.
|
||||
/// `await`'ing on a pending transaction will resolve to a transaction receipt
|
||||
/// once the transaction has enough `confirmations`. The default number of confirmations
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
use crate::ProviderError;
|
||||
use ethers_core::types::U256;
|
||||
use futures_timer::Delay;
|
||||
use futures_util::{stream, FutureExt, StreamExt};
|
||||
use std::{future::Future, pin::Pin};
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use futures_timer::Delay;
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
use wasm_timer::Delay;
|
||||
|
||||
use crate::ProviderError;
|
||||
|
||||
/// A simple gas escalation policy
|
||||
pub type EscalationPolicy = Box<dyn Fn(U256, usize) -> U256 + Send + Sync>;
|
||||
|
||||
|
@ -34,7 +29,7 @@ where
|
|||
// https://github.com/tomusdrw/rust-web3/blob/befcb2fb8f3ca0a43e3081f68886fa327e64c8e6/src/api/eth_filter.rs#L20
|
||||
/// Create a stream that emits items at a fixed interval. Used for rate control
|
||||
pub fn interval(
|
||||
duration: std::time::Duration,
|
||||
duration: instant::Duration,
|
||||
) -> impl futures_core::stream::Stream<Item = ()> + Send + Unpin {
|
||||
stream::unfold((), move |_| Delay::new(duration).map(|_| Some(((), ())))).map(drop)
|
||||
}
|
||||
|
|
|
@ -1,63 +1,87 @@
|
|||
[package]
|
||||
name = "ethers-signers"
|
||||
version = "2.0.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.64"
|
||||
authors = ["Georgios Konstantopoulos <me@gakonst.com>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
description = "Signer implementations for the ethers-rs crate"
|
||||
homepage = "https://docs.rs/ethers"
|
||||
repository = "https://github.com/gakonst/ethers-rs"
|
||||
keywords = ["ethereum", "web3", "celo", "ethers"]
|
||||
readme = "README.md"
|
||||
description = "A unified interface for locally signing Ethereum transactions"
|
||||
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
license.workspace = true
|
||||
documentation.workspace = true
|
||||
repository.workspace = true
|
||||
homepage.workspace = true
|
||||
categories.workspace = true
|
||||
keywords.workspace = true
|
||||
exclude.workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[package.metadata.playground]
|
||||
all-features = true
|
||||
|
||||
[dependencies]
|
||||
ethers-core = { version = "^2.0.0", path = "../ethers-core", features = ["eip712"] }
|
||||
thiserror = { version = "1.0.39", default-features = false }
|
||||
coins-bip32 = "0.8.0"
|
||||
coins-bip39 = "0.8.1"
|
||||
coins-ledger = { version = "0.7.1", default-features = false, optional = true }
|
||||
hex = { version = "0.4.3", default-features = false, features = ["std"] }
|
||||
async-trait = { version = "0.1.50", default-features = false }
|
||||
elliptic-curve = { version = "0.13.2", default-features = false }
|
||||
sha2 = { version = "0.10.6", default-features = false }
|
||||
rand = { version = "0.8.5", default-features = false }
|
||||
yubihsm = { version = "0.42.0-pre.0", features = ["secp256k1", "http", "usb"], optional = true }
|
||||
futures-util = { version = "^0.3", optional = true }
|
||||
futures-executor = { version = "^0.3", optional = true }
|
||||
semver = { version = "1.0.17", optional = true }
|
||||
tracing = { version = "0.1.37" }
|
||||
trezor-client = { version = "0.0.7", optional = true, default-features = false, features = [
|
||||
"f_ethereum",
|
||||
] }
|
||||
ethers-core = { workspace = true, features = ["eip712"] }
|
||||
|
||||
# crypto
|
||||
coins-bip32 = "0.8.3"
|
||||
coins-bip39 = "0.8.3"
|
||||
elliptic-curve.workspace = true
|
||||
sha2.workspace = true
|
||||
rand.workspace = true
|
||||
|
||||
# misc
|
||||
thiserror.workspace = true
|
||||
tracing.workspace = true
|
||||
async-trait.workspace = true
|
||||
hex.workspace = true
|
||||
|
||||
# futures
|
||||
futures-util = { workspace = true, optional = true }
|
||||
futures-executor = { workspace = true, optional = true }
|
||||
|
||||
# aws
|
||||
rusoto_core = { version = "0.48.0", default-features = false, optional = true }
|
||||
rusoto_kms = { version = "0.48.0", default-features = false, optional = true }
|
||||
spki = { version = "0.6.0", optional = true }
|
||||
spki = { workspace = true, optional = true }
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
eth-keystore = { version = "0.5.0" }
|
||||
eth-keystore = "0.5.0"
|
||||
home = { version = "0.5.4", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
ethers-contract-derive = { version = "^2.0.0", path = "../ethers-contract/ethers-contract-derive" }
|
||||
ethers-derive-eip712 = { version = "^2.0.0", path = "../ethers-core/ethers-derive-eip712" }
|
||||
# ledger
|
||||
coins-ledger = { version = "0.8.3", default-features = false, optional = true }
|
||||
semver = { workspace = true, optional = true }
|
||||
|
||||
serde_json = { version = "1.0.64" }
|
||||
# trezor
|
||||
trezor-client = { version = "0.0.7", default-features = false, features = [
|
||||
"f_ethereum",
|
||||
], optional = true }
|
||||
|
||||
# yubi
|
||||
yubihsm = { version = "0.42.0-pre.0", features = ["secp256k1", "http", "usb"], optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
ethers-contract-derive.workspace = true
|
||||
ethers-derive-eip712.workspace = true
|
||||
|
||||
serde_json.workspace = true
|
||||
tempfile.workspace = true
|
||||
tracing-subscriber.workspace = true
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
|
||||
yubihsm = { version = "0.42.0-pre.0", features = ["secp256k1", "usb", "mockhsm"] }
|
||||
tokio = { version = "1.18", default-features = false, features = ["macros", "rt"] }
|
||||
tempfile = "3.4.0"
|
||||
tracing-subscriber = "0.3.16"
|
||||
tokio = { workspace = true, features = ["macros", "rt"] }
|
||||
|
||||
[features]
|
||||
futures = ["futures-util", "futures-executor"]
|
||||
|
||||
celo = ["ethers-core/celo"]
|
||||
|
||||
ledger = ["coins-ledger", "futures", "semver"]
|
||||
yubi = ["yubihsm"]
|
||||
aws = ["rusoto_core/rustls", "rusoto_kms/rustls", "spki"]
|
||||
trezor = ["trezor-client", "futures", "semver", "home"]
|
||||
aws = ["rusoto_core/rustls", "rusoto_kms/rustls", "spki"]
|
||||
yubi = ["yubihsm"]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# ethers-signers
|
||||
|
||||
A unified interface for locally signing transactions.
|
||||
A unified interface for locally signing Ethereum transactions.
|
||||
|
||||
You can implement the `Signer` trait to extend functionality to other signers
|
||||
such as Hardware Security Modules, KMS etc.
|
||||
|
|
|
@ -71,8 +71,8 @@ pub(super) fn decode_pubkey(resp: GetPublicKeyResponse) -> Result<VerifyingKey,
|
|||
.public_key
|
||||
.ok_or_else(|| AwsSignerError::from("Pubkey not found in response".to_owned()))?;
|
||||
|
||||
let spk = spki::SubjectPublicKeyInfo::try_from(raw.as_ref())?;
|
||||
let key = VerifyingKey::from_sec1_bytes(spk.subject_public_key)?;
|
||||
let spki = spki::SubjectPublicKeyInfoRef::try_from(raw.as_ref())?;
|
||||
let key = VerifyingKey::from_sec1_bytes(spki.subject_public_key.raw_bytes())?;
|
||||
|
||||
Ok(key)
|
||||
}
|
||||
|
|
|
@ -10,32 +10,31 @@ pub use coins_bip39;
|
|||
/// A wallet instantiated with a locally stored private key
|
||||
pub type LocalWallet = Wallet<ethers_core::k256::ecdsa::SigningKey>;
|
||||
|
||||
#[cfg(feature = "yubi")]
|
||||
#[cfg(all(feature = "yubihsm", not(target_arch = "wasm32")))]
|
||||
/// A wallet instantiated with a YubiHSM
|
||||
pub type YubiWallet = Wallet<yubihsm::ecdsa::Signer<ethers_core::k256::Secp256k1>>;
|
||||
|
||||
#[cfg(feature = "ledger")]
|
||||
#[cfg(all(feature = "ledger", not(target_arch = "wasm32")))]
|
||||
mod ledger;
|
||||
#[cfg(feature = "ledger")]
|
||||
#[cfg(all(feature = "ledger", not(target_arch = "wasm32")))]
|
||||
pub use ledger::{
|
||||
app::LedgerEthereum as Ledger,
|
||||
types::{DerivationType as HDPath, LedgerError},
|
||||
};
|
||||
|
||||
#[cfg(feature = "trezor")]
|
||||
#[cfg(all(feature = "trezor", not(target_arch = "wasm32")))]
|
||||
mod trezor;
|
||||
#[cfg(feature = "trezor")]
|
||||
#[cfg(all(feature = "trezor", not(target_arch = "wasm32")))]
|
||||
pub use trezor::{
|
||||
app::TrezorEthereum as Trezor,
|
||||
types::{DerivationType as TrezorHDPath, TrezorError},
|
||||
};
|
||||
|
||||
#[cfg(feature = "yubi")]
|
||||
#[cfg(all(feature = "yubihsm", not(target_arch = "wasm32")))]
|
||||
pub use yubihsm;
|
||||
|
||||
#[cfg(feature = "aws")]
|
||||
mod aws;
|
||||
|
||||
#[cfg(feature = "aws")]
|
||||
pub use aws::{AwsSigner, AwsSignerError};
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ pub use mnemonic::{MnemonicBuilder, MnemonicBuilderError};
|
|||
mod private_key;
|
||||
pub use private_key::WalletError;
|
||||
|
||||
#[cfg(feature = "yubihsm")]
|
||||
#[cfg(all(feature = "yubihsm", not(target_arch = "wasm32")))]
|
||||
mod yubi;
|
||||
|
||||
use crate::{to_eip155_v, Signer};
|
||||
|
|
|
@ -1,67 +1,82 @@
|
|||
[package]
|
||||
name = "ethers-solc"
|
||||
version = "2.0.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.64"
|
||||
authors = [
|
||||
"Matthias Seitz <matthias.seitz@outlook.de>",
|
||||
"Georgios Konstantopoulos <me@gakonst.com>",
|
||||
]
|
||||
license = "MIT OR Apache-2.0"
|
||||
readme = "../README.md"
|
||||
documentation = "https://docs.rs/ethers"
|
||||
repository = "https://github.com/gakonst/ethers-rs"
|
||||
homepage = "https://docs.rs/ethers"
|
||||
readme = "README.md"
|
||||
description = "Utilites for working with solc"
|
||||
keywords = ["ethereum", "web3", "solc", "solidity", "ethers"]
|
||||
keywords = ["ethers", "ethereum", "web3", "solc", "solidity"]
|
||||
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
license.workspace = true
|
||||
documentation.workspace = true
|
||||
repository.workspace = true
|
||||
homepage.workspace = true
|
||||
categories.workspace = true
|
||||
exclude.workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[package.metadata.playground]
|
||||
all-features = true
|
||||
|
||||
[dependencies]
|
||||
ethers-core = { version = "^2.0.0", path = "../ethers-core", default-features = false }
|
||||
serde_json = "1.0.68"
|
||||
serde = { version = "1.0.130", features = ["derive", "rc"] }
|
||||
semver = { version = "1.0.17", features = ["serde"] }
|
||||
walkdir = "2.3.2"
|
||||
tokio = { version = "1.18", default-features = false, features = ["rt"] }
|
||||
futures-util = { version = "^0.3", optional = true }
|
||||
once_cell = "1.17.1"
|
||||
regex = "1.7.1"
|
||||
ethers-core.workspace = true
|
||||
|
||||
solang-parser = { version = "=0.2.3", default-features = false }
|
||||
|
||||
serde = { workspace = true, features = ["derive", "rc"] }
|
||||
serde_json.workspace = true
|
||||
|
||||
tiny-keccak = { version = "2.0.2", default-features = false }
|
||||
sha2 = { workspace = true, optional = true }
|
||||
md-5 = "0.10.5"
|
||||
thiserror = "1.0"
|
||||
hex = "0.4.3"
|
||||
|
||||
semver = { workspace = true, features = ["serde"] }
|
||||
walkdir.workspace = true
|
||||
once_cell.workspace = true
|
||||
regex.workspace = true
|
||||
thiserror.workspace = true
|
||||
hex.workspace = true
|
||||
yansi = "0.5.1"
|
||||
glob = "0.3.1"
|
||||
tracing = "0.1.37"
|
||||
tracing.workspace = true
|
||||
num_cpus = "1.15.0"
|
||||
tiny-keccak = { version = "2.0.2", default-features = false }
|
||||
tempfile = { version = "3.4.0", optional = true }
|
||||
fs_extra = { version = "1.3.0", optional = true }
|
||||
sha2 = { version = "0.10.6", default-features = false, optional = true }
|
||||
dunce = "1.0.3"
|
||||
solang-parser = { default-features = false, version = "=0.2.3" }
|
||||
rayon = "1.7.0"
|
||||
rand = { version = "0.8.5", optional = true }
|
||||
dunce.workspace = true
|
||||
rayon.workspace = true
|
||||
path-slash = "0.2.1"
|
||||
cfg-if = "1.0.0"
|
||||
|
||||
tempfile = { version = "3.4.0", optional = true }
|
||||
fs_extra = { version = "1.3.0", optional = true }
|
||||
rand = { workspace = true, optional = true }
|
||||
futures-util = { workspace = true, optional = true }
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
home = "0.5.4"
|
||||
svm = { package = "svm-rs", version = "0.2", default-features = false, optional = true, features = [
|
||||
svm = { package = "svm-rs", version = "0.2", default-features = false, features = [
|
||||
"blocking",
|
||||
] }
|
||||
], optional = true }
|
||||
svm-builds = { package = "svm-rs-builds", version = "0.1", optional = true }
|
||||
tokio = { workspace = true, features = ["rt"] }
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
# NOTE: this enables wasm compatibility for getrandom indirectly
|
||||
getrandom = { version = "0.2", features = ["js"] }
|
||||
getrandom.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
criterion = { version = "0.4", features = ["async_tokio"] }
|
||||
criterion.workspace = true
|
||||
env_logger = "0.10.0"
|
||||
tracing-subscriber = { version = "0.3", default-features = false, features = ["env-filter", "fmt"] }
|
||||
rand = "0.8.5"
|
||||
tracing-subscriber = { workspace = true, features = ["env-filter", "fmt"] }
|
||||
rand.workspace = true
|
||||
pretty_assertions = "1.3.0"
|
||||
tempfile = "3.4.0"
|
||||
tokio = { version = "1.18", features = ["full"] }
|
||||
tempfile.workspace = true
|
||||
serde_path_to_error = "0.1.10"
|
||||
|
||||
[[bench]]
|
||||
|
@ -85,12 +100,25 @@ required-features = ["full", "project-util"]
|
|||
|
||||
[features]
|
||||
default = ["rustls"]
|
||||
async = ["tokio/process", "tokio/io-util", "tokio/fs", "tokio/time", "futures-util"]
|
||||
|
||||
full = ["async", "svm-solc"]
|
||||
svm-solc = ["svm/blocking", "svm-builds", "sha2"]
|
||||
|
||||
async = [
|
||||
"tokio/process",
|
||||
"tokio/io-util",
|
||||
"tokio/fs",
|
||||
"tokio/time",
|
||||
"futures-util",
|
||||
"criterion/async_tokio",
|
||||
]
|
||||
svm-solc = ["svm-builds", "sha2"]
|
||||
|
||||
# Utilities for creating and testing project workspaces
|
||||
project-util = ["tempfile", "fs_extra", "rand"]
|
||||
|
||||
tests = []
|
||||
openssl = ["svm/openssl"]
|
||||
rustls = ["svm/rustls"]
|
||||
asm = ["sha2/asm", "svm/sha2-asm"]
|
||||
|
||||
# Deprecated
|
||||
asm = []
|
||||
|
|
|
@ -70,7 +70,7 @@ pub(crate) fn take_solc_installer_lock() -> std::sync::MutexGuard<'static, ()> {
|
|||
/// A list of upstream Solc releases, used to check which version
|
||||
/// we should download.
|
||||
/// The boolean value marks whether there was an error accessing the release list
|
||||
#[cfg(all(feature = "svm-solc"))]
|
||||
#[cfg(all(feature = "svm-solc", not(target_arch = "wasm32")))]
|
||||
pub static RELEASES: once_cell::sync::Lazy<(svm::Releases, Vec<Version>, bool)> =
|
||||
once_cell::sync::Lazy::new(|| {
|
||||
match serde_json::from_str::<svm::Releases>(svm_builds::RELEASE_LIST_JSON) {
|
||||
|
@ -240,7 +240,7 @@ impl Solc {
|
|||
|
||||
/// Returns the list of all versions that are available to download and marking those which are
|
||||
/// already installed.
|
||||
#[cfg(all(feature = "svm-solc"))]
|
||||
#[cfg(all(feature = "svm-solc", not(target_arch = "wasm32")))]
|
||||
pub fn all_versions() -> Vec<SolcVersion> {
|
||||
let mut all_versions = Self::installed_versions();
|
||||
let mut uniques = all_versions
|
||||
|
@ -324,7 +324,7 @@ impl Solc {
|
|||
/// to build it, and returns it.
|
||||
///
|
||||
/// If the required compiler version is not installed, it also proceeds to install it.
|
||||
#[cfg(all(feature = "svm-solc"))]
|
||||
#[cfg(all(feature = "svm-solc", not(target_arch = "wasm32")))]
|
||||
pub fn detect_version(source: &Source) -> Result<Version> {
|
||||
// detects the required solc version
|
||||
let sol_version = Self::source_version_req(source)?;
|
||||
|
@ -335,7 +335,7 @@ impl Solc {
|
|||
/// used to build it, and returns it.
|
||||
///
|
||||
/// If the required compiler version is not installed, it also proceeds to install it.
|
||||
#[cfg(all(feature = "svm-solc"))]
|
||||
#[cfg(all(feature = "svm-solc", not(target_arch = "wasm32")))]
|
||||
pub fn ensure_installed(sol_version: &VersionReq) -> Result<Version> {
|
||||
#[cfg(any(test, feature = "tests"))]
|
||||
let _lock = take_solc_installer_lock();
|
||||
|
@ -400,7 +400,7 @@ impl Solc {
|
|||
/// # Ok(())
|
||||
/// # }
|
||||
/// ```
|
||||
#[cfg(feature = "svm-solc")]
|
||||
#[cfg(all(feature = "svm-solc", not(target_arch = "wasm32")))]
|
||||
pub async fn install(version: &Version) -> std::result::Result<Self, svm::SolcVmError> {
|
||||
tracing::trace!("installing solc version \"{}\"", version);
|
||||
crate::report::solc_installation_start(version);
|
||||
|
@ -410,7 +410,7 @@ impl Solc {
|
|||
}
|
||||
|
||||
/// Blocking version of `Self::install`
|
||||
#[cfg(all(feature = "svm-solc"))]
|
||||
#[cfg(all(feature = "svm-solc", not(target_arch = "wasm32")))]
|
||||
pub fn blocking_install(version: &Version) -> std::result::Result<Self, svm::SolcVmError> {
|
||||
use crate::utils::RuntimeOrHandle;
|
||||
|
||||
|
@ -440,7 +440,7 @@ impl Solc {
|
|||
|
||||
/// Verify that the checksum for this version of solc is correct. We check against the SHA256
|
||||
/// checksum from the build information published by [binaries.soliditylang.org](https://binaries.soliditylang.org/)
|
||||
#[cfg(all(feature = "svm-solc"))]
|
||||
#[cfg(all(feature = "svm-solc", not(target_arch = "wasm32")))]
|
||||
pub fn verify_checksum(&self) -> Result<()> {
|
||||
let version = self.version_short()?;
|
||||
let mut version_path = svm::version_path(version.to_string().as_str());
|
||||
|
@ -817,7 +817,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
// This test might be a bit hard to maintain
|
||||
#[cfg(all(feature = "svm-solc"))]
|
||||
#[cfg(all(feature = "svm-solc", not(target_arch = "wasm32")))]
|
||||
fn test_detect_version() {
|
||||
for (pragma, expected) in [
|
||||
// pinned
|
||||
|
@ -862,7 +862,7 @@ mod tests {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "svm-solc")]
|
||||
#[cfg(all(feature = "svm-solc", not(target_arch = "wasm32")))]
|
||||
fn can_install_solc_in_tokio_rt() {
|
||||
let version = Version::from_str("0.8.6").unwrap();
|
||||
let rt = tokio::runtime::Runtime::new().unwrap();
|
||||
|
|
|
@ -140,7 +140,7 @@ impl<'a, T: ArtifactOutput> ProjectCompiler<'a, T> {
|
|||
/// let project = Project::builder().build().unwrap();
|
||||
/// let output = project.compile().unwrap();
|
||||
/// ```
|
||||
#[cfg(all(feature = "svm-solc"))]
|
||||
#[cfg(all(feature = "svm-solc", not(target_arch = "wasm32")))]
|
||||
pub fn new(project: &'a Project<T>) -> Result<Self> {
|
||||
Self::with_sources(project, project.paths.read_input_files()?)
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ impl<'a, T: ArtifactOutput> ProjectCompiler<'a, T> {
|
|||
///
|
||||
/// Multiple (`Solc` -> `Sources`) pairs can be compiled in parallel if the `Project` allows
|
||||
/// multiple `jobs`, see [`crate::Project::set_solc_jobs()`].
|
||||
#[cfg(all(feature = "svm-solc"))]
|
||||
#[cfg(all(feature = "svm-solc", not(target_arch = "wasm32")))]
|
||||
pub fn with_sources(project: &'a Project<T>, sources: Sources) -> Result<Self> {
|
||||
let graph = Graph::resolve_sources(&project.paths, sources)?;
|
||||
let (versions, edges) = graph.into_sources_by_version(project.offline)?;
|
||||
|
|
|
@ -40,7 +40,7 @@ pub enum SolcError {
|
|||
{2:?}"#
|
||||
)]
|
||||
FailedResolveImport(Box<SolcError>, PathBuf, PathBuf),
|
||||
#[cfg(feature = "svm-solc")]
|
||||
#[cfg(all(feature = "svm-solc", not(target_arch = "wasm32")))]
|
||||
#[error(transparent)]
|
||||
SvmError(#[from] svm::SolcVmError),
|
||||
#[error("No contracts found at \"{0}\"")]
|
||||
|
|
|
@ -267,7 +267,7 @@ impl<T: ArtifactOutput> Project<T> {
|
|||
let sources = self.paths.read_input_files()?;
|
||||
tracing::trace!("found {} sources to compile: {:?}", sources.len(), sources.keys());
|
||||
|
||||
#[cfg(all(feature = "svm-solc"))]
|
||||
#[cfg(all(feature = "svm-solc", not(target_arch = "wasm32")))]
|
||||
if self.auto_detect {
|
||||
tracing::trace!("using solc auto detection to compile sources");
|
||||
return self.svm_compile(sources)
|
||||
|
@ -299,7 +299,7 @@ impl<T: ArtifactOutput> Project<T> {
|
|||
/// let output = project.svm_compile(sources).unwrap();
|
||||
/// # }
|
||||
/// ```
|
||||
#[cfg(all(feature = "svm-solc"))]
|
||||
#[cfg(all(feature = "svm-solc", not(target_arch = "wasm32")))]
|
||||
pub fn svm_compile(&self, sources: Sources) -> Result<ProjectCompileOutput<T>> {
|
||||
project::ProjectCompiler::with_sources(self, sources)?.compile()
|
||||
}
|
||||
|
@ -316,7 +316,7 @@ impl<T: ArtifactOutput> Project<T> {
|
|||
/// let output = project.compile_file("example/Greeter.sol").unwrap();
|
||||
/// # }
|
||||
/// ```
|
||||
#[cfg(all(feature = "svm-solc"))]
|
||||
#[cfg(all(feature = "svm-solc", not(target_arch = "wasm32")))]
|
||||
pub fn compile_file(&self, file: impl Into<PathBuf>) -> Result<ProjectCompileOutput<T>> {
|
||||
let file = file.into();
|
||||
let source = Source::read(&file)?;
|
||||
|
@ -345,7 +345,7 @@ impl<T: ArtifactOutput> Project<T> {
|
|||
{
|
||||
let sources = Source::read_all(files)?;
|
||||
|
||||
#[cfg(all(feature = "svm-solc"))]
|
||||
#[cfg(all(feature = "svm-solc", not(target_arch = "wasm32")))]
|
||||
if self.auto_detect {
|
||||
return project::ProjectCompiler::with_sources(self, sources)?.compile()
|
||||
}
|
||||
|
@ -392,7 +392,7 @@ impl<T: ArtifactOutput> Project<T> {
|
|||
Source::read_all(self.paths.input_files().into_iter().filter(|p| filter.is_match(p)))?;
|
||||
let filter: Box<dyn FileFilter> = Box::new(filter);
|
||||
|
||||
#[cfg(all(feature = "svm-solc"))]
|
||||
#[cfg(all(feature = "svm-solc", not(target_arch = "wasm32")))]
|
||||
if self.auto_detect {
|
||||
return project::ProjectCompiler::with_sources(self, sources)?
|
||||
.with_sparse_output(filter)
|
||||
|
@ -963,7 +963,7 @@ impl<T: ArtifactOutput> ArtifactOutput for Project<T> {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[cfg(all(feature = "svm-solc"))]
|
||||
#[cfg(all(feature = "svm-solc", not(target_arch = "wasm32")))]
|
||||
mod tests {
|
||||
use crate::remappings::Remapping;
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ use crate::{
|
|||
utils,
|
||||
utils::tempdir,
|
||||
Artifact, ArtifactOutput, Artifacts, ConfigurableArtifacts, ConfigurableContractArtifact,
|
||||
FileFilter, PathStyle, Project, ProjectCompileOutput, ProjectPathsConfig, SolFilesCache, Solc,
|
||||
FileFilter, PathStyle, Project, ProjectCompileOutput, ProjectPathsConfig, SolFilesCache,
|
||||
SolcIoError,
|
||||
};
|
||||
use fs_extra::{dir, file};
|
||||
|
@ -69,8 +69,9 @@ impl<T: ArtifactOutput> TempProject<T> {
|
|||
}
|
||||
|
||||
/// Explicitly sets the solc version for the project
|
||||
#[cfg(all(feature = "svm-solc", not(target_arch = "wasm32")))]
|
||||
pub fn set_solc(&mut self, solc: impl AsRef<str>) -> &mut Self {
|
||||
self.inner.solc = Solc::find_or_install_svm_version(solc).unwrap();
|
||||
self.inner.solc = crate::Solc::find_or_install_svm_version(solc).unwrap();
|
||||
self.inner.auto_detect = false;
|
||||
self
|
||||
}
|
||||
|
|
|
@ -437,7 +437,7 @@ impl Graph {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "svm-solc"))]
|
||||
#[cfg(all(feature = "svm-solc", not(target_arch = "wasm32")))]
|
||||
impl Graph {
|
||||
/// Consumes the nodes of the graph and returns all input files together with their appropriate
|
||||
/// version and the edges of the graph
|
||||
|
@ -759,7 +759,7 @@ impl<'a> Iterator for NodesIter<'a> {
|
|||
}
|
||||
|
||||
/// Container type for solc versions and their compatible sources
|
||||
#[cfg(all(feature = "svm-solc"))]
|
||||
#[cfg(all(feature = "svm-solc", not(target_arch = "wasm32")))]
|
||||
#[derive(Debug)]
|
||||
pub struct VersionedSources {
|
||||
resolved_solc_include_paths: IncludePaths,
|
||||
|
@ -767,7 +767,7 @@ pub struct VersionedSources {
|
|||
offline: bool,
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "svm-solc"))]
|
||||
#[cfg(all(feature = "svm-solc", not(target_arch = "wasm32")))]
|
||||
impl VersionedSources {
|
||||
/// Resolves or installs the corresponding `Solc` installation.
|
||||
///
|
||||
|
|
|
@ -0,0 +1,89 @@
|
|||
[package]
|
||||
name = "ethers"
|
||||
authors = ["Georgios Konstantopoulos <me@gakonst.com>"]
|
||||
readme = "../README.md"
|
||||
description = "A complete Ethereum and Celo Rust library"
|
||||
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
license.workspace = true
|
||||
documentation.workspace = true
|
||||
repository.workspace = true
|
||||
homepage.workspace = true
|
||||
categories.workspace = true
|
||||
keywords.workspace = true
|
||||
exclude.workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[package.metadata.playground]
|
||||
all-features = true
|
||||
|
||||
[features]
|
||||
default = ["abigen", "rustls"]
|
||||
|
||||
celo = [
|
||||
"ethers-core/celo",
|
||||
"ethers-providers/celo",
|
||||
"ethers-signers/celo",
|
||||
"ethers-contract/celo",
|
||||
"ethers-middleware/celo",
|
||||
"legacy",
|
||||
]
|
||||
|
||||
legacy = ["ethers-core/legacy", "ethers-contract/legacy"]
|
||||
|
||||
# individual features per sub-crate
|
||||
## core
|
||||
eip712 = ["ethers-contract/eip712", "ethers-core/eip712"]
|
||||
## providers
|
||||
ws = ["ethers-providers/ws"]
|
||||
ipc = ["ethers-providers/ipc"]
|
||||
rustls = [
|
||||
"ethers-middleware/rustls",
|
||||
"ethers-providers/rustls",
|
||||
"ethers-etherscan/rustls",
|
||||
"ethers-contract/rustls",
|
||||
"ethers-solc/rustls",
|
||||
]
|
||||
openssl = [
|
||||
"ethers-middleware/openssl",
|
||||
"ethers-providers/openssl",
|
||||
"ethers-etherscan/openssl",
|
||||
"ethers-contract/openssl",
|
||||
"ethers-solc/openssl",
|
||||
]
|
||||
dev-rpc = ["ethers-providers/dev-rpc"]
|
||||
## signers
|
||||
ledger = ["ethers-signers/ledger"]
|
||||
trezor = ["ethers-signers/trezor"]
|
||||
yubi = ["ethers-signers/yubi"]
|
||||
## contracts
|
||||
abigen = ["ethers-contract/abigen"]
|
||||
### abigen without reqwest
|
||||
abigen-offline = ["ethers-contract/abigen-offline"]
|
||||
## solc
|
||||
ethers-solc = ["dep:ethers-solc", "ethers-etherscan/ethers-solc"]
|
||||
solc-full = ["ethers-solc?/full"]
|
||||
solc-tests = ["ethers-solc?/tests"]
|
||||
|
||||
# Deprecated
|
||||
solc-sha2-asm = []
|
||||
|
||||
[dependencies]
|
||||
ethers-addressbook.workspace = true
|
||||
ethers-contract.workspace = true
|
||||
ethers-core.workspace = true
|
||||
ethers-etherscan.workspace = true
|
||||
ethers-middleware.workspace = true
|
||||
ethers-providers.workspace = true
|
||||
ethers-signers.workspace = true
|
||||
|
||||
ethers-solc = { workspace = true, optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
tokio = { workspace = true, features = ["macros", "rt"] }
|
|
@ -9,5 +9,5 @@
|
|||
mod celo;
|
||||
|
||||
pub(crate) mod simple_storage {
|
||||
ethers::contract::abigen!(SimpleStorage, "./tests/testdata/SimpleStorage.json");
|
||||
ethers::contract::abigen!(SimpleStorage, "../testdata/SimpleStorage.json");
|
||||
}
|
|
@ -1,10 +1,14 @@
|
|||
[package]
|
||||
name = "examples-anvil"
|
||||
version = "2.0.0"
|
||||
publish = false
|
||||
authors = ["Andrea Simeoni <andreasimeoni84@gmail.com>"]
|
||||
edition = "2021"
|
||||
|
||||
license.workspace = true
|
||||
rust-version.workspace = true
|
||||
edition.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
ethers = { path = "../..", version = "2.0.0" }
|
||||
eyre = "0.6"
|
||||
tokio = { version = "1.18", features = ["full"] }
|
||||
ethers.workspace = true
|
||||
tokio = { workspace = true, features = ["macros"] }
|
||||
eyre.workspace = true
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
[package]
|
||||
name = "examples-big-numbers"
|
||||
version = "2.0.0"
|
||||
publish = false
|
||||
authors = ["Andrea Simeoni <andreasimeoni84@gmail.com>"]
|
||||
edition = "2021"
|
||||
|
||||
license.workspace = true
|
||||
rust-version.workspace = true
|
||||
edition.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
#ethers-core = { version = "^1.0.0", path = "../../ethers-core" }
|
||||
ethers = { path = "../..", version = "2.0.0" }
|
||||
|
||||
ethers.workspace = true
|
||||
|
|
|
@ -1,19 +1,23 @@
|
|||
[package]
|
||||
name = "examples-contracts"
|
||||
version = "2.0.0"
|
||||
publish = false
|
||||
authors = ["Andrea Simeoni <andreasimeoni84@gmail.com>"]
|
||||
edition = "2021"
|
||||
|
||||
license.workspace = true
|
||||
rust-version.workspace = true
|
||||
edition.workspace = true
|
||||
|
||||
[features]
|
||||
default = ["legacy"]
|
||||
legacy = []
|
||||
legacy = ["ethers/legacy"]
|
||||
|
||||
[dev-dependencies]
|
||||
ethers = { path = "../..", version = "2.0.0", features = ["abigen", "ethers-solc", "legacy", "rustls", "ws"] }
|
||||
ethers = { workspace = true, features = ["abigen", "ethers-solc", "rustls", "ws"] }
|
||||
|
||||
eyre = "0.6"
|
||||
serde = { version = "1.0.144", features = ["derive"] }
|
||||
serde_json = "1.0.64"
|
||||
tokio = { version = "1.18", features = ["macros"] }
|
||||
tokio = { workspace = true, features = ["macros"] }
|
||||
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
|
||||
eyre.workspace = true
|
||||
|
|
|
@ -1,15 +1,11 @@
|
|||
[package]
|
||||
name = "ethers-wasm"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.64"
|
||||
version = "2.0.0"
|
||||
authors = ["Matthias Seitz <matthias.seitz@outlook.de>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
readme = "README.md"
|
||||
documentation = "https://docs.rs/ethers"
|
||||
repository = "https://github.com/gakonst/ethers-rs"
|
||||
homepage = "https://docs.rs/ethers"
|
||||
description = "How to use ethers in the browser with WASM."
|
||||
|
||||
rust-version.workspace = true
|
||||
edition.workspace = true
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
|
@ -18,31 +14,23 @@ crate-type = ["cdylib", "rlib"]
|
|||
default = ["console_error_panic_hook"]
|
||||
|
||||
[dependencies]
|
||||
ethers = { path = "../..", version = "2.0.0", features = ["abigen", "legacy", "ws"] }
|
||||
ethers = { workspace = true, features = ["abigen", "ws"] }
|
||||
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
serde-wasm-bindgen = "0.5.0"
|
||||
hex.workspace = true
|
||||
|
||||
wasm-bindgen-futures = "0.4.34"
|
||||
wasm-bindgen = { version = "0.2.83", features = ["serde-serialize"] }
|
||||
|
||||
serde = { version = "1.0.144", features = ["derive"] }
|
||||
serde_json = "1.0.85"
|
||||
serde-wasm-bindgen = "0.4.5"
|
||||
wasm-bindgen = { version = "0.2.84", features = ["serde-serialize"] }
|
||||
|
||||
# The `console_error_panic_hook` crate provides better debugging of panics by
|
||||
# logging them with `console.error`. This is great for development, but requires
|
||||
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
|
||||
# code size when deploying.
|
||||
console_error_panic_hook = { version = "0.1.6", optional = true }
|
||||
|
||||
# `wee_alloc` is a tiny allocator for wasm that is only ~1K in code size
|
||||
# compared to the default allocator's ~10K. It is slower than the default
|
||||
# allocator, however.
|
||||
#
|
||||
# Unfortunately, `wee_alloc` requires nightly Rust when targeting wasm for now.
|
||||
wee_alloc = { version = "0.4.5", optional = true }
|
||||
console_error_panic_hook = { version = "0.1.7", optional = true }
|
||||
|
||||
web-sys = { version = "0.3.61", features = ["console"] }
|
||||
|
||||
hex = "0.4.3"
|
||||
|
||||
[dev-dependencies]
|
||||
wasm-bindgen-test = "0.3.34"
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
{"abi":[{"inputs":[{"internalType":"string","name":"value","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"author","type":"address"},{"indexed":false,"internalType":"string","name":"oldValue","type":"string"},{"indexed":false,"internalType":"string","name":"newValue","type":"string"}],"name":"ValueChanged","type":"event"},{"inputs":[],"name":"getValue","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"value","type":"string"}],"name":"setValue","outputs":[],"stateMutability":"nonpayable","type":"function"}],"bytecode":"608060405234801561001057600080fd5b5060405161073b38038061073b8339818101604052602081101561003357600080fd5b810190808051604051939291908464010000000082111561005357600080fd5b8382019150602082018581111561006957600080fd5b825186600182028301116401000000008211171561008657600080fd5b8083526020830192505050908051906020019080838360005b838110156100ba57808201518184015260208101905061009f565b50505050905090810190601f1680156100e75780820380516001836020036101000a031916815260200191505b506040525050503373ffffffffffffffffffffffffffffffffffffffff167fe826f71647b8486f2bae59832124c70792fba044036720a54ec8dacdd5df4fcb6000836040518080602001806020018381038352858181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156101b65780601f1061018b576101008083540402835291602001916101b6565b820191906000526020600020905b81548152906001019060200180831161019957829003601f168201915b5050838103825284818151815260200191508051906020019080838360005b838110156101f05780820151818401526020810190506101d5565b50505050905090810190601f16801561021d5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a28060009080519060200190610242929190610249565b50506102e6565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061028a57805160ff19168380011785556102b8565b828001600101855582156102b8579182015b828111156102b757825182559160200191906001019061029c565b5b5090506102c591906102c9565b5090565b5b808211156102e25760008160009055506001016102ca565b5090565b610446806102f56000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063209652551461003b57806393a09352146100be575b600080fd5b610043610179565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610083578082015181840152602081019050610068565b50505050905090810190601f1680156100b05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610177600480360360208110156100d457600080fd5b81019080803590602001906401000000008111156100f157600080fd5b82018360208201111561010357600080fd5b8035906020019184600183028401116401000000008311171561012557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929050505061021b565b005b606060008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156102115780601f106101e657610100808354040283529160200191610211565b820191906000526020600020905b8154815290600101906020018083116101f457829003601f168201915b5050505050905090565b3373ffffffffffffffffffffffffffffffffffffffff167fe826f71647b8486f2bae59832124c70792fba044036720a54ec8dacdd5df4fcb6000836040518080602001806020018381038352858181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156102e35780601f106102b8576101008083540402835291602001916102e3565b820191906000526020600020905b8154815290600101906020018083116102c657829003601f168201915b5050838103825284818151815260200191508051906020019080838360005b8381101561031d578082015181840152602081019050610302565b50505050905090810190601f16801561034a5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a2806000908051906020019061036f929190610373565b5050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106103b457805160ff19168380011785556103e2565b828001600101855582156103e2579182015b828111156103e15782518255916020019190600101906103c6565b5b5090506103ef91906103f3565b5090565b5b8082111561040c5760008160009055506001016103f4565b509056fea26469706673582212202d397d3d0e6cf9afdeed7d5192e3abff386699395df0409eb5c3ec494832c57a64736f6c63430007000033"}
|
|
@ -1 +0,0 @@
|
|||
[{"inputs":[{"internalType":"string","name":"value","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"author","type":"address"},{"indexed":false,"internalType":"string","name":"oldValue","type":"string"},{"indexed":false,"internalType":"string","name":"newValue","type":"string"}],"name":"ValueChanged","type":"event"},{"inputs":[],"name":"getValue","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"value","type":"string"}],"name":"setValue","outputs":[],"stateMutability":"nonpayable","type":"function"}]
|
|
@ -1,4 +1,4 @@
|
|||
const ethers = import('./pkg');
|
||||
const ethers = import("./pkg");
|
||||
|
||||
ethers
|
||||
.then(m => {
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
"@wasm-tool/wasm-pack-plugin": "^1.6",
|
||||
"html-webpack-plugin": "^5.5",
|
||||
"text-encoding": "^0.7",
|
||||
"webpack": "^5.74",
|
||||
"webpack-cli": "^4.10",
|
||||
"webpack": "^5.75",
|
||||
"webpack-cli": "^5.0",
|
||||
"webpack-dev-server": "^4.11",
|
||||
"ganache-cli": "^6.12"
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use crate::utils::SIMPLECONTRACT_BIN;
|
||||
use ethers::{
|
||||
contract::abigen,
|
||||
prelude::{ContractFactory, Provider, SignerMiddleware},
|
||||
providers::Ws,
|
||||
prelude::{Provider, SignerMiddleware},
|
||||
providers::{Middleware, Ws},
|
||||
signers::Signer,
|
||||
};
|
||||
use std::sync::Arc;
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
@ -10,23 +10,13 @@ use web_sys::console;
|
|||
|
||||
pub mod utils;
|
||||
|
||||
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
|
||||
// allocator.
|
||||
#[cfg(feature = "wee_alloc")]
|
||||
#[global_allocator]
|
||||
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
|
||||
|
||||
macro_rules! log {
|
||||
( $( $t:tt )* ) => {
|
||||
web_sys::console::log_1(&format!( $( $t )* ).into());
|
||||
}
|
||||
}
|
||||
|
||||
abigen!(
|
||||
SimpleContract,
|
||||
"./abi/contract_abi.json",
|
||||
event_derives(serde::Deserialize, serde::Serialize)
|
||||
);
|
||||
abigen!(SimpleContract, "./abi/contract.json", derives(serde::Deserialize, serde::Serialize));
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub async fn deploy() {
|
||||
|
@ -37,24 +27,21 @@ pub async fn deploy() {
|
|||
&serde_wasm_bindgen::to_value(&*SIMPLECONTRACT_ABI).unwrap(),
|
||||
);
|
||||
|
||||
let wallet = utils::key(0);
|
||||
log!("Wallet: {:?}", wallet);
|
||||
|
||||
let endpoint = "ws://127.0.0.1:8545";
|
||||
let provider = Provider::<Ws>::connect(endpoint).await.unwrap();
|
||||
let client = Arc::new(SignerMiddleware::new(provider, wallet));
|
||||
log!("Connected to: `{}`", endpoint);
|
||||
log!("Connected to: `{endpoint}`");
|
||||
|
||||
let bytecode = hex::decode(SIMPLECONTRACT_BIN).unwrap();
|
||||
let factory = ContractFactory::new(SIMPLECONTRACT_ABI.clone(), bytecode.into(), client.clone());
|
||||
let chain_id = provider.get_chainid().await.unwrap();
|
||||
let wallet = utils::key(0).with_chain_id(chain_id.as_u64());
|
||||
log!("Wallet: {wallet:?}");
|
||||
let client = Arc::new(SignerMiddleware::new(provider, wallet));
|
||||
|
||||
log!("Deploying contract...");
|
||||
let contract = factory.deploy("hello WASM!".to_string()).unwrap().send().await.unwrap();
|
||||
let deploy_tx = SimpleContract::deploy(client.clone(), "hello WASM!".to_string()).unwrap();
|
||||
let contract: SimpleContract<_> = deploy_tx.send().await.unwrap();
|
||||
let addr = contract.address();
|
||||
log!("Deployed contract with address: {:?}", addr);
|
||||
|
||||
let contract = SimpleContract::new(addr, client.clone());
|
||||
|
||||
let value = "bye from WASM!";
|
||||
log!("Setting value... `{}`", value);
|
||||
let receipt = contract.set_value(value.to_owned()).send().await.unwrap().await.unwrap();
|
||||
|
|
|
@ -21,6 +21,3 @@ pub const PHRASE: &str =
|
|||
pub fn key(index: u32) -> LocalWallet {
|
||||
MnemonicBuilder::<English>::default().phrase(PHRASE).index(index).unwrap().build().unwrap()
|
||||
}
|
||||
|
||||
/// Bytecode of the `SimpleContract`
|
||||
pub const SIMPLECONTRACT_BIN: &str = "608060405234801561001057600080fd5b5060405161073b38038061073b8339818101604052602081101561003357600080fd5b810190808051604051939291908464010000000082111561005357600080fd5b8382019150602082018581111561006957600080fd5b825186600182028301116401000000008211171561008657600080fd5b8083526020830192505050908051906020019080838360005b838110156100ba57808201518184015260208101905061009f565b50505050905090810190601f1680156100e75780820380516001836020036101000a031916815260200191505b506040525050503373ffffffffffffffffffffffffffffffffffffffff167fe826f71647b8486f2bae59832124c70792fba044036720a54ec8dacdd5df4fcb6000836040518080602001806020018381038352858181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156101b65780601f1061018b576101008083540402835291602001916101b6565b820191906000526020600020905b81548152906001019060200180831161019957829003601f168201915b5050838103825284818151815260200191508051906020019080838360005b838110156101f05780820151818401526020810190506101d5565b50505050905090810190601f16801561021d5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a28060009080519060200190610242929190610249565b50506102e6565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061028a57805160ff19168380011785556102b8565b828001600101855582156102b8579182015b828111156102b757825182559160200191906001019061029c565b5b5090506102c591906102c9565b5090565b5b808211156102e25760008160009055506001016102ca565b5090565b610446806102f56000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063209652551461003b57806393a09352146100be575b600080fd5b610043610179565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610083578082015181840152602081019050610068565b50505050905090810190601f1680156100b05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610177600480360360208110156100d457600080fd5b81019080803590602001906401000000008111156100f157600080fd5b82018360208201111561010357600080fd5b8035906020019184600183028401116401000000008311171561012557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929050505061021b565b005b606060008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156102115780601f106101e657610100808354040283529160200191610211565b820191906000526020600020905b8154815290600101906020018083116101f457829003601f168201915b5050505050905090565b3373ffffffffffffffffffffffffffffffffffffffff167fe826f71647b8486f2bae59832124c70792fba044036720a54ec8dacdd5df4fcb6000836040518080602001806020018381038352858181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156102e35780601f106102b8576101008083540402835291602001916102e3565b820191906000526020600020905b8154815290600101906020018083116102c657829003601f168201915b5050838103825284818151815260200191508051906020019080838360005b8381101561031d578082015181840152602081019050610302565b50505050905090810190601f16801561034a5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a2806000908051906020019061036f929190610373565b5050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106103b457805160ff19168380011785556103e2565b828001600101855582156103e2579182015b828111156103e15782518255916020019190600101906103c6565b5b5090506103ef91906103f3565b5090565b5b8082111561040c5760008160009055506001016103f4565b509056fea26469706673582212202d397d3d0e6cf9afdeed7d5192e3abff386699395df0409eb5c3ec494832c57a64736f6c63430007000033";
|
||||
|
|
|
@ -1,51 +1,42 @@
|
|||
#![cfg(target_arch = "wasm32")]
|
||||
|
||||
use ethers::{
|
||||
prelude::{
|
||||
abigen, ContractFactory, Http, JsonRpcClient, LocalWallet, Provider, SignerMiddleware, Ws,
|
||||
},
|
||||
prelude::{Http, JsonRpcClient, LocalWallet, Provider, SignerMiddleware, Ws},
|
||||
signers::Signer,
|
||||
types::Chain,
|
||||
};
|
||||
use std::{convert::TryFrom, sync::Arc};
|
||||
use ethers_wasm::{utils, SimpleContract};
|
||||
use std::sync::Arc;
|
||||
use wasm_bindgen_test::*;
|
||||
|
||||
wasm_bindgen_test_configure!(run_in_browser);
|
||||
|
||||
// Generate the type-safe contract bindings by providing the ABI
|
||||
// definition in human readable format
|
||||
abigen!(
|
||||
SimpleContract,
|
||||
"./abi/contract_abi.json",
|
||||
event_derives(serde::Deserialize, serde::Serialize)
|
||||
);
|
||||
|
||||
#[wasm_bindgen_test]
|
||||
async fn http_connect_and_deploy() {
|
||||
console_log!("connecting http...");
|
||||
let provider = Provider::<Http>::try_from("http://localhost:8545").unwrap();
|
||||
deploy(provider, ethers_wasm::utils::key(0).with_chain_id(Chain::AnvilHardhat)).await;
|
||||
deploy(provider, utils::key(0).with_chain_id(Chain::AnvilHardhat)).await;
|
||||
}
|
||||
|
||||
#[wasm_bindgen_test]
|
||||
async fn ws_connect_and_deploy() {
|
||||
console_log!("connecting ws...");
|
||||
let provider = Provider::new(Ws::connect("ws://localhost:8545").await.unwrap());
|
||||
deploy(provider, ethers_wasm::utils::key(1).with_chain_id(Chain::AnvilHardhat)).await;
|
||||
deploy(provider, utils::key(1).with_chain_id(Chain::AnvilHardhat)).await;
|
||||
}
|
||||
|
||||
async fn deploy<T: JsonRpcClient>(provider: Provider<T>, wallet: LocalWallet) {
|
||||
let client = Arc::new(SignerMiddleware::new(provider, wallet));
|
||||
|
||||
let bytecode = hex::decode(ethers_wasm::utils::SIMPLECONTRACT_BIN).unwrap();
|
||||
let factory = ContractFactory::new(SIMPLECONTRACT_ABI.clone(), bytecode.into(), client.clone());
|
||||
let contract =
|
||||
factory.deploy("Hello from Contract!".to_string()).unwrap().send().await.unwrap();
|
||||
let expected = "Hello from Contract!";
|
||||
let deploy_tx = SimpleContract::deploy(client, expected.to_string()).unwrap();
|
||||
let contract: SimpleContract<_> = deploy_tx.send().await.unwrap();
|
||||
let addr = contract.address();
|
||||
console_log!("deployed to {}", addr);
|
||||
console_log!("deployed to {addr}");
|
||||
|
||||
let contract = SimpleContract::new(addr, client.clone());
|
||||
let value = contract.get_value().call().await.unwrap();
|
||||
|
||||
console_log!("value: {:?}", value);
|
||||
console_log!("value: {value:?}");
|
||||
|
||||
assert_eq!(value, expected);
|
||||
}
|
||||
|
|
|
@ -350,22 +350,20 @@
|
|||
"@webassemblyjs/ast" "1.11.1"
|
||||
"@xtuc/long" "4.2.2"
|
||||
|
||||
"@webpack-cli/configtest@^1.2.0":
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/@webpack-cli/configtest/-/configtest-1.2.0.tgz#7b20ce1c12533912c3b217ea68262365fa29a6f5"
|
||||
integrity sha512-4FB8Tj6xyVkyqjj1OaTqCjXYULB9FMkqQ8yGrZjRDrYh0nOE+7Lhs45WioWQQMV+ceFlE368Ukhe6xdvJM9Egg==
|
||||
"@webpack-cli/configtest@^2.0.1":
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@webpack-cli/configtest/-/configtest-2.0.1.tgz#a69720f6c9bad6aef54a8fa6ba9c3533e7ef4c7f"
|
||||
integrity sha512-njsdJXJSiS2iNbQVS0eT8A/KPnmyH4pv1APj2K0d1wrZcBLw+yppxOy4CGqa0OxDJkzfL/XELDhD8rocnIwB5A==
|
||||
|
||||
"@webpack-cli/info@^1.5.0":
|
||||
version "1.5.0"
|
||||
resolved "https://registry.yarnpkg.com/@webpack-cli/info/-/info-1.5.0.tgz#6c78c13c5874852d6e2dd17f08a41f3fe4c261b1"
|
||||
integrity sha512-e8tSXZpw2hPl2uMJY6fsMswaok5FdlGNRTktvFk2sD8RjH0hE2+XistawJx1vmKteh4NmGmNUrp+Tb2w+udPcQ==
|
||||
dependencies:
|
||||
envinfo "^7.7.3"
|
||||
"@webpack-cli/info@^2.0.1":
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@webpack-cli/info/-/info-2.0.1.tgz#eed745799c910d20081e06e5177c2b2569f166c0"
|
||||
integrity sha512-fE1UEWTwsAxRhrJNikE7v4EotYflkEhBL7EbajfkPlf6E37/2QshOy/D48Mw8G5XMFlQtS6YV42vtbG9zBpIQA==
|
||||
|
||||
"@webpack-cli/serve@^1.7.0":
|
||||
version "1.7.0"
|
||||
resolved "https://registry.yarnpkg.com/@webpack-cli/serve/-/serve-1.7.0.tgz#e1993689ac42d2b16e9194376cfb6753f6254db1"
|
||||
integrity sha512-oxnCNGj88fL+xzV+dacXs44HcDwf1ovs3AuEzvP7mqXw7fQntqIhQ1BRmynh4qEKQSSSRSWVyXRjmTbZIX9V2Q==
|
||||
"@webpack-cli/serve@^2.0.1":
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@webpack-cli/serve/-/serve-2.0.1.tgz#34bdc31727a1889198855913db2f270ace6d7bf8"
|
||||
integrity sha512-0G7tNyS+yW8TdgHwZKlDWYXFA6OJQnoLCQvYKkQP0Q2X205PSQ6RNUj0M+1OB/9gRQaUZ/ccYfaxd0nhaWKfjw==
|
||||
|
||||
"@xtuc/ieee754@^1.2.0":
|
||||
version "1.2.0"
|
||||
|
@ -740,16 +738,16 @@ commander@^2.20.0:
|
|||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
|
||||
integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==
|
||||
|
||||
commander@^7.0.0:
|
||||
version "7.2.0"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-7.2.0.tgz#a36cb57d0b501ce108e4d20559a150a391d97ab7"
|
||||
integrity sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==
|
||||
|
||||
commander@^8.3.0:
|
||||
version "8.3.0"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66"
|
||||
integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==
|
||||
|
||||
commander@^9.4.1:
|
||||
version "9.5.0"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-9.5.0.tgz#bc08d1eb5cedf7ccb797a96199d41c7bc3e60d30"
|
||||
integrity sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==
|
||||
|
||||
compressible@~2.0.16:
|
||||
version "2.0.18"
|
||||
resolved "https://registry.yarnpkg.com/compressible/-/compressible-2.0.18.tgz#af53cca6b070d4c3c0750fbd77286a6d7cc46fba"
|
||||
|
@ -1564,10 +1562,10 @@ inherits@2.0.3:
|
|||
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
|
||||
integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=
|
||||
|
||||
interpret@^2.2.0:
|
||||
version "2.2.0"
|
||||
resolved "https://registry.yarnpkg.com/interpret/-/interpret-2.2.0.tgz#1a78a0b5965c40a5416d007ad6f50ad27c417df9"
|
||||
integrity sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==
|
||||
interpret@^3.1.1:
|
||||
version "3.1.1"
|
||||
resolved "https://registry.yarnpkg.com/interpret/-/interpret-3.1.1.tgz#5be0ceed67ca79c6c4bc5cf0d7ee843dcea110c4"
|
||||
integrity sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==
|
||||
|
||||
invert-kv@^2.0.0:
|
||||
version "2.0.0"
|
||||
|
@ -2243,12 +2241,12 @@ readdirp@~3.6.0:
|
|||
dependencies:
|
||||
picomatch "^2.2.1"
|
||||
|
||||
rechoir@^0.7.0:
|
||||
version "0.7.1"
|
||||
resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.7.1.tgz#9478a96a1ca135b5e88fc027f03ee92d6c645686"
|
||||
integrity sha512-/njmZ8s1wVeR6pjTZ+0nCnv8SpZNRMT2D1RLOJQESlYFDBvwpTA4KWJpZ+sBJ4+vhjILRcK7JIFdGCdxEAAitg==
|
||||
rechoir@^0.8.0:
|
||||
version "0.8.0"
|
||||
resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.8.0.tgz#49f866e0d32146142da3ad8f0eff352b3215ff22"
|
||||
integrity sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==
|
||||
dependencies:
|
||||
resolve "^1.9.0"
|
||||
resolve "^1.20.0"
|
||||
|
||||
relateurl@^0.2.7:
|
||||
version "0.2.7"
|
||||
|
@ -2298,7 +2296,7 @@ resolve-from@^5.0.0:
|
|||
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69"
|
||||
integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==
|
||||
|
||||
resolve@^1.9.0:
|
||||
resolve@^1.20.0:
|
||||
version "1.22.1"
|
||||
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.1.tgz#27cb2ebb53f91abb49470a928bba7558066ac177"
|
||||
integrity sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==
|
||||
|
@ -2783,22 +2781,23 @@ wbuf@^1.1.0, wbuf@^1.7.3:
|
|||
dependencies:
|
||||
minimalistic-assert "^1.0.0"
|
||||
|
||||
webpack-cli@^4.10:
|
||||
version "4.10.0"
|
||||
resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-4.10.0.tgz#37c1d69c8d85214c5a65e589378f53aec64dab31"
|
||||
integrity sha512-NLhDfH/h4O6UOy+0LSso42xvYypClINuMNBVVzX4vX98TmTaTUxwRbXdhucbFMd2qLaCTcLq/PdYrvi8onw90w==
|
||||
webpack-cli@^5.0:
|
||||
version "5.0.1"
|
||||
resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-5.0.1.tgz#95fc0495ac4065e9423a722dec9175560b6f2d9a"
|
||||
integrity sha512-S3KVAyfwUqr0Mo/ur3NzIp6jnerNpo7GUO6so51mxLi1spqsA17YcMXy0WOIJtBSnj748lthxC6XLbNKh/ZC+A==
|
||||
dependencies:
|
||||
"@discoveryjs/json-ext" "^0.5.0"
|
||||
"@webpack-cli/configtest" "^1.2.0"
|
||||
"@webpack-cli/info" "^1.5.0"
|
||||
"@webpack-cli/serve" "^1.7.0"
|
||||
"@webpack-cli/configtest" "^2.0.1"
|
||||
"@webpack-cli/info" "^2.0.1"
|
||||
"@webpack-cli/serve" "^2.0.1"
|
||||
colorette "^2.0.14"
|
||||
commander "^7.0.0"
|
||||
commander "^9.4.1"
|
||||
cross-spawn "^7.0.3"
|
||||
envinfo "^7.7.3"
|
||||
fastest-levenshtein "^1.0.12"
|
||||
import-local "^3.0.2"
|
||||
interpret "^2.2.0"
|
||||
rechoir "^0.7.0"
|
||||
interpret "^3.1.1"
|
||||
rechoir "^0.8.0"
|
||||
webpack-merge "^5.7.3"
|
||||
|
||||
webpack-dev-middleware@^5.3.1:
|
||||
|
@ -2860,10 +2859,10 @@ webpack-sources@^3.2.3:
|
|||
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.3.tgz#2d4daab8451fd4b240cc27055ff6a0c2ccea0cde"
|
||||
integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==
|
||||
|
||||
webpack@^5.74:
|
||||
version "5.74.0"
|
||||
resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.74.0.tgz#02a5dac19a17e0bb47093f2be67c695102a55980"
|
||||
integrity sha512-A2InDwnhhGN4LYctJj6M1JEaGL7Luj6LOmyBHjcI8529cm5p6VXiTIW2sn6ffvEAKmveLzvu4jrihwXtPojlAA==
|
||||
webpack@^5.75:
|
||||
version "5.75.0"
|
||||
resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.75.0.tgz#1e440468647b2505860e94c9ff3e44d5b582c152"
|
||||
integrity sha512-piaIaoVJlqMsPtX/+3KTTO6jfvrSYgauFVdt8cr9LTHKmcq/AMd4mhzsiP7ZF/PGRNPGA8336jldh9l2Kt2ogQ==
|
||||
dependencies:
|
||||
"@types/eslint-scope" "^3.7.3"
|
||||
"@types/estree" "^0.0.51"
|
||||
|
|
|
@ -1,13 +1,19 @@
|
|||
[package]
|
||||
name = "examples-events"
|
||||
version = "2.0.0"
|
||||
publish = false
|
||||
authors = ["Andrea Simeoni <andreasimeoni84@gmail.com>"]
|
||||
edition = "2021"
|
||||
|
||||
license.workspace = true
|
||||
rust-version.workspace = true
|
||||
edition.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
ethers = { path = "../..", version = "2.0.0" }
|
||||
ethers = { workspace = true, features = ["rustls"] }
|
||||
|
||||
eyre = "0.6"
|
||||
serde = { version = "1.0.144", features = ["derive"] }
|
||||
serde_json = "1.0.64"
|
||||
tokio = { version = "1.18", features = ["macros"] }
|
||||
tokio = { workspace = true, features = ["macros"] }
|
||||
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
|
||||
eyre.workspace = true
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
[package]
|
||||
name = "examples-geth"
|
||||
version = "0.0.0"
|
||||
publish = false
|
||||
authors = ["Andrea Simeoni <andreasimeoni84@gmail.com>"]
|
||||
|
||||
license.workspace = true
|
||||
rust-version.workspace = true
|
||||
edition.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
ethers.workspace = true
|
||||
|
||||
tokio = { workspace = true, features = ["macros"] }
|
||||
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
|
||||
eyre.workspace = true
|
||||
tempfile.workspace = true
|
|
@ -1,15 +1,18 @@
|
|||
[package]
|
||||
name = "examples-middleware"
|
||||
version = "2.0.0"
|
||||
publish = false
|
||||
authors = ["Andrea Simeoni <andreasimeoni84@gmail.com>"]
|
||||
edition = "2021"
|
||||
|
||||
license.workspace = true
|
||||
rust-version.workspace = true
|
||||
edition.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
ethers = { path = "../..", version = "2.0.0", features = ["rustls", "ws"] }
|
||||
|
||||
async-trait = { version = "0.1.50", default-features = false }
|
||||
eyre = "0.6"
|
||||
serde_json = "1.0.61"
|
||||
thiserror = { version = "1.0", default-features = false }
|
||||
tokio = { version = "1.18", features = ["macros", "rt", "rt-multi-thread"] }
|
||||
|
||||
ethers = { workspace = true, features = ["rustls"] }
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
tokio = { workspace = true, features = ["macros"] }
|
||||
async-trait.workspace = true
|
||||
thiserror.workspace = true
|
||||
eyre.workspace = true
|
||||
|
|
|
@ -1,18 +1,23 @@
|
|||
[package]
|
||||
name = "examples-providers"
|
||||
version = "2.0.0"
|
||||
publish = false
|
||||
authors = ["Andrea Simeoni <andreasimeoni84@gmail.com>"]
|
||||
edition = "2021"
|
||||
|
||||
license.workspace = true
|
||||
rust-version.workspace = true
|
||||
edition.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
ethers = { path = "../..", version = "2.0.0", features = ["abigen", "ipc", "rustls", "ws"] }
|
||||
ethers = { workspace = true, features = ["abigen", "ipc", "rustls", "ws"] }
|
||||
|
||||
eyre = "0.6"
|
||||
reqwest = { version = "0.11.14", default-features = false }
|
||||
serde = { version = "1.0.144", features = ["derive"] }
|
||||
serde_json = "1.0.64"
|
||||
tokio = { version = "1.18", features = ["macros"] }
|
||||
tokio = { workspace = true, features = ["macros"] }
|
||||
async-trait.workspace = true
|
||||
reqwest.workspace = true
|
||||
url.workspace = true
|
||||
|
||||
async-trait = "0.1"
|
||||
url = "2.3"
|
||||
thiserror = "1.0"
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
|
||||
thiserror.workspace = true
|
||||
eyre.workspace = true
|
||||
|
|
|
@ -1,13 +1,19 @@
|
|||
[package]
|
||||
name = "examples-queries"
|
||||
version = "2.0.0"
|
||||
publish = false
|
||||
authors = ["Andrea Simeoni <andreasimeoni84@gmail.com>"]
|
||||
edition = "2021"
|
||||
|
||||
license.workspace = true
|
||||
rust-version.workspace = true
|
||||
edition.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
ethers = { path = "../..", version = "2.0.0", features = ["abigen", "rustls", "ws"] }
|
||||
ethers = { workspace = true, features = ["abigen", "ws", "rustls"] }
|
||||
|
||||
eyre = "0.6"
|
||||
serde = { version = "1.0.144", features = ["derive"] }
|
||||
serde_json = "1.0.64"
|
||||
tokio = { version = "1.18", features = ["macros"] }
|
||||
tokio = { workspace = true, features = ["macros"] }
|
||||
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
|
||||
eyre.workspace = true
|
||||
|
|
|
@ -1,13 +1,19 @@
|
|||
[package]
|
||||
name = "examples-subscriptions"
|
||||
version = "2.0.0"
|
||||
publish = false
|
||||
authors = ["Andrea Simeoni <andreasimeoni84@gmail.com>"]
|
||||
edition = "2021"
|
||||
|
||||
license.workspace = true
|
||||
rust-version.workspace = true
|
||||
edition.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
ethers = { path = "../..", version = "2.0.0", features = ["abigen", "rustls", "ws"] }
|
||||
ethers = { workspace = true, features = ["abigen", "ws", "rustls"] }
|
||||
|
||||
eyre = "0.6"
|
||||
serde = { version = "1.0.144", features = ["derive"] }
|
||||
serde_json = "1.0.64"
|
||||
tokio = { version = "1.18", features = ["macros"] }
|
||||
tokio = { workspace = true, features = ["macros"] }
|
||||
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
|
||||
eyre.workspace = true
|
||||
|
|
|
@ -1,13 +1,19 @@
|
|||
[package]
|
||||
name = "examples-transactions"
|
||||
version = "2.0.0"
|
||||
publish = false
|
||||
authors = ["Andrea Simeoni <andreasimeoni84@gmail.com>"]
|
||||
edition = "2021"
|
||||
|
||||
license.workspace = true
|
||||
rust-version.workspace = true
|
||||
edition.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
ethers = { path = "../..", version = "2.0.0", features = ["abigen", "rustls", "ws"] }
|
||||
ethers = { workspace = true, features = ["abigen", "ws", "rustls"] }
|
||||
|
||||
eyre = "0.6"
|
||||
serde = { version = "1.0.144", features = ["derive"] }
|
||||
serde_json = "1.0.64"
|
||||
tokio = { version = "1.18", features = ["macros"] }
|
||||
tokio = { workspace = true, features = ["macros"] }
|
||||
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
|
||||
eyre.workspace = true
|
||||
|
|
|
@ -1,20 +1,25 @@
|
|||
[package]
|
||||
name = "examples-wallets"
|
||||
version = "2.0.0"
|
||||
publish = false
|
||||
authors = ["Andrea Simeoni <andreasimeoni84@gmail.com>"]
|
||||
edition = "2021"
|
||||
|
||||
license.workspace = true
|
||||
rust-version.workspace = true
|
||||
edition.workspace = true
|
||||
|
||||
[features]
|
||||
default = ["ledger", "trezor", "yubi"]
|
||||
ledger = []
|
||||
trezor = []
|
||||
yubi = []
|
||||
ledger = ["ethers/ledger"]
|
||||
trezor = ["ethers/trezor"]
|
||||
yubi = ["ethers/yubi"]
|
||||
|
||||
[dev-dependencies]
|
||||
ethers = { path = "../..", version = "2.0.0", features = ["abigen", "eip712", "ledger", "rustls", "trezor", "ws", "yubi"] }
|
||||
ethers = { workspace = true, features = ["abigen", "eip712", "ws", "rustls"] }
|
||||
|
||||
eyre = "0.6"
|
||||
serde = { version = "1.0.144", features = ["derive"] }
|
||||
serde_json = "1.0.64"
|
||||
tokio = { version = "1.18", features = ["macros"] }
|
||||
tokio = { workspace = true, features = ["macros"] }
|
||||
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
|
||||
eyre.workspace = true
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
consolidate-commits = false
|
||||
consolidate-pushes = true
|
Loading…
Reference in New Issue