bb3a2fd27c
* release(core): 0.6.0 * release(providers): 0.6.0 * release(contract-abigen): 0.6.0 * release(contract-derive): 0.6.0 * release(derive-eip712): 0.2.0 * release(ethers-solc): 0.1.0 * release(contract): 0.6.0 * release(etherscan): 0.2.0 * release(signers): 0.6.0 * release(middleware): 0.6.0 * chore: update dev deps * refactor(core): move docs to readme * refactor(contract): move docs to readme * refactor(providers): move docs to readme * chore: bump ethers cargo toml * refactor(signers): move docs to readme * refactor(middleware): move docs to readme * fix(ethers): adjust re-exports to allow searching internal packages * docs: fix broken links we cannot use relative crate imports because the readmes are also imported by the parent crate * alias readmes to be accessible to ethers crate |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
README.md |
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(())
# }