ethers-rs/ethers-signers
Matthias Seitz 59cf991828
feat(abigen): use structs for outputs (#664)
* feat(abigen): use structs for outputs

* update CHANGELOG

* make clippy happy

* fix lints
2021-12-09 16:00:59 -07:00
..
src feat(abigen): use structs for outputs (#664) 2021-12-09 16:00:59 -07:00
Cargo.toml chore(deps): bump elliptic-curve from 0.11.1 to 0.11.5 (#653) 2021-12-06 14:47:27 +02:00
README.md release: 0.6.0 (#611) 2021-11-23 21:23:12 +02:00

README.md

You can implement the Signer trait to extend functionality to other signers such as Hardware Security Modules, KMS etc.

The exposed interfaces return a recoverable signature. In order to convert the signature and the TransactionRequest to a Transaction, look at the signing middleware.

Supported signers:

# use ethers_signers::{LocalWallet, Signer};
# use ethers_core::{k256::ecdsa::SigningKey, types::TransactionRequest};

# async fn foo() -> Result<(), Box<dyn std::error::Error>> {
// instantiate the wallet
let wallet = "dcf2cbdd171a21c480aa7f53d77f31bb102282b3ff099c78e3118b37348c72f7"
    .parse::<LocalWallet>()?;

// create a transaction
let tx = TransactionRequest::new()
    .to("vitalik.eth") // this will use ENS
    .value(10000).into();

// sign it
let signature = wallet.sign_transaction(&tx).await?;

// can also sign a message
let signature = wallet.sign_message("hello world").await?;
signature.verify("hello world", wallet.address()).unwrap();
# Ok(())
# }