File tree 2 files changed +21
-0
lines changed
2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -227,6 +227,15 @@ impl<T: SignableTransaction<Signature>> Signed<T, Signature> {
227
227
let signer = self . recover_signer ( ) ?;
228
228
Ok ( crate :: transaction:: Recovered :: new_unchecked ( self . tx , signer) )
229
229
}
230
+
231
+ /// Attempts to recover signer and constructs a [`crate::transaction::Recovered`] with a
232
+ /// reference to the transaction `Recovered<&T>`
233
+ pub fn try_to_recovered_ref (
234
+ & self ,
235
+ ) -> Result < crate :: transaction:: Recovered < & T > , alloy_primitives:: SignatureError > {
236
+ let signer = self . recover_signer ( ) ?;
237
+ Ok ( crate :: transaction:: Recovered :: new_unchecked ( & self . tx , signer) )
238
+ }
230
239
}
231
240
232
241
#[ cfg( all( any( test, feature = "arbitrary" ) , feature = "k256" ) ) ]
Original file line number Diff line number Diff line change @@ -511,6 +511,18 @@ impl<Eip4844: RlpEcdsaEncodableTx> EthereumTxEnvelope<Eip4844> {
511
511
Ok ( crate :: transaction:: Recovered :: new_unchecked ( self , signer) )
512
512
}
513
513
514
+ /// Recover the signer of the transaction and returns a `Recovered<&Self>`
515
+ #[ cfg( feature = "k256" ) ]
516
+ pub fn try_to_recovered_ref (
517
+ & self ,
518
+ ) -> Result < crate :: transaction:: Recovered < & Self > , alloy_primitives:: SignatureError >
519
+ where
520
+ Eip4844 : SignableTransaction < Signature > ,
521
+ {
522
+ let signer = self . recover_signer ( ) ?;
523
+ Ok ( crate :: transaction:: Recovered :: new_unchecked ( self , signer) )
524
+ }
525
+
514
526
/// Calculate the signing hash for the transaction.
515
527
pub fn signature_hash ( & self ) -> B256
516
528
where
You can’t perform that action at this time.
0 commit comments