Trait SignerRecoverable
pub trait SignerRecoverable {
// Required methods
fn recover_signer(&self) -> Result<Address, RecoveryError>;
fn recover_signer_unchecked(&self) -> Result<Address, RecoveryError>;
// Provided methods
fn recover_unchecked_with_buf(
&self,
buf: &mut Vec<u8>,
) -> Result<Address, RecoveryError> { ... }
fn try_into_recovered(self) -> Result<Recovered<Self>, RecoveryError>
where Self: Sized { ... }
fn try_into_recovered_unchecked(
self,
) -> Result<Recovered<Self>, RecoveryError>
where Self: Sized { ... }
fn try_to_recovered_ref(&self) -> Result<Recovered<&Self>, RecoveryError> { ... }
fn try_to_recovered_ref_unchecked(
&self,
) -> Result<Recovered<&Self>, RecoveryError> { ... }
}Expand description
A type that can recover the signer of a transaction.
This is a helper trait that only provides the ability to recover the signer (address) of a transaction.
Required Methods§
fn recover_signer(&self) -> Result<Address, RecoveryError>
fn recover_signer(&self) -> Result<Address, RecoveryError>
Recover signer from signature and hash.
Returns an error if the transaction’s signature is invalid following EIP-2.
Note:
This can fail for some early ethereum mainnet transactions pre EIP-2, use
Self::recover_signer_unchecked if you want to recover the signer without ensuring that
the signature has a low s value.
fn recover_signer_unchecked(&self) -> Result<Address, RecoveryError>
fn recover_signer_unchecked(&self) -> Result<Address, RecoveryError>
Recover signer from signature and hash without ensuring that the signature has a low s
value.
Returns an error if the transaction’s signature is invalid.
Provided Methods§
fn recover_unchecked_with_buf(
&self,
buf: &mut Vec<u8>,
) -> Result<Address, RecoveryError>
fn recover_unchecked_with_buf( &self, buf: &mut Vec<u8>, ) -> Result<Address, RecoveryError>
Same as SignerRecoverable::recover_signer_unchecked but receives a buffer to operate on
for encoding. This is useful during batch recovery of historical transactions to avoid
allocating a new buffer for each transaction.
Caution: it is expected that implementations clear this buffer.
fn try_into_recovered(self) -> Result<Recovered<Self>, RecoveryError>where
Self: Sized,
fn try_into_recovered(self) -> Result<Recovered<Self>, RecoveryError>where
Self: Sized,
Recover the signer via SignerRecoverable::recover_signer and returns a
Recovered<Self>
fn try_into_recovered_unchecked(self) -> Result<Recovered<Self>, RecoveryError>where
Self: Sized,
fn try_into_recovered_unchecked(self) -> Result<Recovered<Self>, RecoveryError>where
Self: Sized,
Recover the signer via SignerRecoverable::recover_signer_unchecked and returns a
Recovered<&Self>
fn try_to_recovered_ref(&self) -> Result<Recovered<&Self>, RecoveryError>
fn try_to_recovered_ref(&self) -> Result<Recovered<&Self>, RecoveryError>
Recover the signer via SignerRecoverable::recover_signer and returns a
Recovered<&Self>
fn try_to_recovered_ref_unchecked(
&self,
) -> Result<Recovered<&Self>, RecoveryError>
fn try_to_recovered_ref_unchecked( &self, ) -> Result<Recovered<&Self>, RecoveryError>
Recover the signer via SignerRecoverable::recover_signer_unchecked and returns a
Recovered<&Self>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
§impl SignerRecoverable for OpPooledTransaction
Available on crate feature k256 only.
impl SignerRecoverable for OpPooledTransaction
k256 only.fn recover_signer(&self) -> Result<Address, RecoveryError>
fn recover_signer_unchecked(&self) -> Result<Address, RecoveryError>
fn recover_unchecked_with_buf( &self, buf: &mut Vec<u8>, ) -> Result<Address, RecoveryError>
§impl SignerRecoverable for OpTxEnvelope
Available on crate feature k256 only.
impl SignerRecoverable for OpTxEnvelope
k256 only.fn recover_signer(&self) -> Result<Address, RecoveryError>
fn recover_signer_unchecked(&self) -> Result<Address, RecoveryError>
fn recover_unchecked_with_buf( &self, buf: &mut Vec<u8>, ) -> Result<Address, RecoveryError>
§impl<T> SignerRecoverable for Sealed<T>where
T: SignerRecoverable,
impl<T> SignerRecoverable for Sealed<T>where
T: SignerRecoverable,
fn recover_signer(&self) -> Result<Address, RecoveryError>
fn recover_signer_unchecked(&self) -> Result<Address, RecoveryError>
fn recover_unchecked_with_buf( &self, buf: &mut Vec<u8>, ) -> Result<Address, RecoveryError>
Implementors§
impl<B, T> SignerRecoverable for Extended<B, T>where
B: SignerRecoverable,
T: SignerRecoverable,
impl<Eip4844> SignerRecoverable for EthereumTxEnvelope<Eip4844>where
Eip4844: RlpEcdsaEncodableTx + SignableTransaction<Signature>,
secp256k1 or k256 only.impl<T> SignerRecoverable for WithEncoded<T>where
T: SignerRecoverable,
impl<T> SignerRecoverable for Signed<T>where
T: SignableTransaction<Signature>,
secp256k1 or k256 only.