From 836a17de65c2fb707f90b02683a1762870a57536 Mon Sep 17 00:00:00 2001 From: Louis Brown <48462338+louisbrown0212@users.noreply.github.com> Date: Wed, 14 May 2025 11:14:19 -0300 Subject: [PATCH] feat: Introduce with_signer_ref helper (#16235) --- crates/primitives-traits/src/transaction/signed.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/primitives-traits/src/transaction/signed.rs b/crates/primitives-traits/src/transaction/signed.rs index ff1f8f1418..610775b68e 100644 --- a/crates/primitives-traits/src/transaction/signed.rs +++ b/crates/primitives-traits/src/transaction/signed.rs @@ -116,6 +116,14 @@ pub trait SignedTransaction: fn with_signer(self, signer: Address) -> Recovered { Recovered::new_unchecked(self, signer) } + + /// Returns the [`Recovered`] transaction with the given signer, using a reference to self. + /// + /// Note: assumes the given signer is the signer of this transaction. + #[auto_impl(keep_default_for(&, Arc))] + fn with_signer_ref(&self, signer: Address) -> Recovered<&Self> { + Recovered::new_unchecked(self, signer) + } } impl SignedTransaction for EthereumTxEnvelope