89bc6420bb
* ci: install anvil * test: use anvil instead of ganache * ci: fix anvil ver * ci: re-enable example tests * test: remove unnecessary assertions * test: enable anvil launch test * docs: typo * test: fix anvil chain id * ci: install ganache Ganache is needed for the Ganache tests * chore: remove legacy feature from some examples * ci: correctly build examples * test: use correct account balance for anvil * chore: remove sub_id == 1 check this was only possible in ganache because it gives serial sub ids, but in every other reasonable client the ids are generated randomly, so we cannot test for its value * test: ensure txs are different There is a bug in Ganache's mempool which accepts duplicate transactions (here with the same nonce), whereas here we pre-set all the nonces so that they end up having a different transaction hash. * test: ignore ganache tests * fix: terzor api changes * ci(examples): install Anvil, remove geth/ganache * test(provider): Anvil instead of Geth some tests start to fail now * fix: revert usage of Anvil in ipc tests Anvil does not support IPC yet * fix: update examples script * ci: use anvil for wasm example * replace last ganache usage Co-authored-by: Oliver Nordbjerg <hi@notbjerg.me> Co-authored-by: Georgios Konstantopoulos <me@gakonst.com> |
||
---|---|---|
.. | ||
ethers-derive-eip712 | ||
src | ||
testdata | ||
Cargo.toml | ||
README.md |
README.md
Ethereum types, cryptography and utilities.
It is recommended to use the utils
, types
and abi
re-exports instead of
the core
module to simplify your imports._
This library provides type definitions for Ethereum's main datatypes along with other utilities for interacting with the Ethereum ecosystem
Signing an ethereum-prefixed message
Signing in Ethereum is done by first prefixing the message with
"\x19Ethereum Signed Message:\n" + message.length
, and then signing the hash
of the result.
# async fn foo() -> Result<(), Box<dyn std::error::Error>> {
use ethers::signers::{Signer, LocalWallet};
let message = "Some data";
let wallet = LocalWallet::new(&mut rand::thread_rng());
// Sign the message
let signature = wallet.sign_message(message).await?;
// Recover the signer from the message
let recovered = signature.recover(message)?;
assert_eq!(recovered, wallet.address());
# Ok(())
# }
Utilities
The crate provides utilities for launching local Ethereum testnets by using
ganache-cli
via the GanacheBuilder
struct.
Features
-
- ["eip712"] | Provides Eip712 trait for EIP-712 encoding of typed data for derived structs
ABI Encoding and Decoding
This crate re-exports the ethabi
crate's functions
under the abi
module, as well as the
secp256k1
and rand
crates for convenience.