ethers-rs/ethers-signers
Gyuho Lee 04e3021dc0
ethers-signers/aws: sighash on the inner/updated tx object (#1977)
Signed-off-by: Gyuho Lee <gyuho.lee@avalabs.org>

Signed-off-by: Gyuho Lee <gyuho.lee@avalabs.org>
2023-01-03 16:09:08 +02:00
..
src ethers-signers/aws: sighash on the inner/updated tx object (#1977) 2023-01-03 16:09:08 +02:00
Cargo.toml chore: update all rust editions to 2021 (#1979) 2022-12-30 14:48:29 +02:00
README.md fmt: all (#1751) 2022-09-28 11:58:26 -07: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(())
# }