From 621882053c8cb1c1d98074e9921bf6e997bbd58a Mon Sep 17 00:00:00 2001 From: Marc Enriquez Date: Wed, 18 Aug 2021 15:02:57 +0200 Subject: [PATCH] sign_transaction_sync (#388) --- ethers-signers/src/wallet/mod.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ethers-signers/src/wallet/mod.rs b/ethers-signers/src/wallet/mod.rs index bf4d0876..fa19b2db 100644 --- a/ethers-signers/src/wallet/mod.rs +++ b/ethers-signers/src/wallet/mod.rs @@ -79,8 +79,7 @@ impl> Signer fo } async fn sign_transaction(&self, tx: &TypedTransaction) -> Result { - let sighash = tx.sighash(self.chain_id); - Ok(self.sign_hash(sighash, true)) + Ok(self.sign_transaction_sync(tx)) } fn address(&self) -> Address { @@ -104,6 +103,12 @@ impl> Signer fo } impl> Wallet { + pub fn sign_transaction_sync(&self, tx: &TypedTransaction) -> Signature { + let sighash = tx.sighash(self.chain_id); + + self.sign_hash(sighash, true) + } + fn sign_hash(&self, hash: H256, eip155: bool) -> Signature { let recoverable_sig: RecoverableSignature = self.signer.sign_digest(Sha256Proxy::from(hash));