From 7306a3c3608108b3566f9dbbbbe3d40d618e25ed Mon Sep 17 00:00:00 2001 From: moh-eulith <101080211+moh-eulith@users.noreply.github.com> Date: Sat, 30 Jul 2022 19:01:02 -0400 Subject: [PATCH] Add a simple constructor for Wallet (#1530) * Add a simple constructor for Wallet * Update ethers-signers/src/wallet/mod.rs Co-authored-by: Georgios Konstantopoulos --- ethers-signers/src/wallet/mod.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ethers-signers/src/wallet/mod.rs b/ethers-signers/src/wallet/mod.rs index c9300601..d60231a5 100644 --- a/ethers-signers/src/wallet/mod.rs +++ b/ethers-signers/src/wallet/mod.rs @@ -67,6 +67,14 @@ pub struct Wallet> { pub(crate) chain_id: u64, } +impl> Wallet { + + /// Construct a new wallet with an external Signer + pub fn new_with_signer(signer: D, address: Address, chain_id: u64) -> Self { + Wallet { signer, address, chain_id } + } +} + #[cfg_attr(target_arch = "wasm32", async_trait(?Send))] #[cfg_attr(not(target_arch = "wasm32"), async_trait)] impl> Signer for Wallet {