SignedTransaction

Trait SignedTransaction 

Source
pub trait SignedTransaction:
    Send
    + Sync
    + Unpin
    + Clone
    + Debug
    + PartialEq
    + Eq
    + Hash
    + Encodable
    + Decodable
    + Encodable2718
    + Decodable2718
    + Transaction
    + MaybeSerde
    + InMemorySize
    + SignerRecoverable {
    // Required method
    fn tx_hash(&self) -> &TxHash;

    // Provided methods
    fn is_broadcastable_in_full(&self) -> bool { ... }
    fn try_recover(&self) -> Result<Address, RecoveryError> { ... }
    fn try_recover_unchecked(&self) -> Result<Address, RecoveryError> { ... }
    fn recalculate_hash(&self) -> B256 { ... }
    fn try_clone_into_recovered(&self) -> Result<Recovered<Self>, RecoveryError> { ... }
    fn try_clone_into_recovered_unchecked(
        &self,
    ) -> Result<Recovered<Self>, RecoveryError> { ... }
    fn try_into_recovered(self) -> Result<Recovered<Self>, Self> { ... }
    fn into_recovered_unchecked(self) -> Result<Recovered<Self>, RecoveryError> { ... }
    fn with_signer(self, signer: Address) -> Recovered<Self> { ... }
    fn with_signer_ref(&self, signer: Address) -> Recovered<&Self> { ... }
}
Expand description

A signed transaction.

§Recovery Methods

This trait provides two types of recovery methods:

  • Standard methods (e.g., try_recover) - enforce EIP-2 low-s signature requirement
  • Unchecked methods (e.g., try_recover_unchecked) - skip EIP-2 validation for pre-EIP-2 transactions

Use unchecked methods only when dealing with historical pre-EIP-2 transactions.

Required Methods§

Source

fn tx_hash(&self) -> &TxHash

Returns reference to transaction hash.

Provided Methods§

Source

fn is_broadcastable_in_full(&self) -> bool

Returns whether this transaction type can be broadcasted as full transaction over the network.

Some transactions are not broadcastable as objects and only allowed to be broadcasted as hashes, e.g. because they missing context (e.g. blob sidecar).

Source

fn try_recover(&self) -> Result<Address, RecoveryError>

Recover signer from signature and hash.

Returns an error if the transaction’s signature is invalid.

Source

fn try_recover_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.

Source

fn recalculate_hash(&self) -> B256

Calculate transaction hash, eip2728 transaction does not contain rlp header and start with tx type.

Source

fn try_clone_into_recovered(&self) -> Result<Recovered<Self>, RecoveryError>

Tries to recover signer and return Recovered by cloning the type.

Source

fn try_clone_into_recovered_unchecked( &self, ) -> Result<Recovered<Self>, RecoveryError>

Tries to recover signer and return Recovered by cloning the type.

Source

fn try_into_recovered(self) -> Result<Recovered<Self>, Self>

Tries to recover signer and return Recovered.

Returns Err(Self) if the transaction’s signature is invalid, see also SignerRecoverable::recover_signer.

Source

fn into_recovered_unchecked(self) -> Result<Recovered<Self>, RecoveryError>

👎Deprecated: Use try_into_recovered_unchecked instead

Consumes the type, recover signer and return Recovered without ensuring that the signature has a low s value (EIP-2).

Returns RecoveryError if the transaction’s signature is invalid.

Source

fn with_signer(self, signer: Address) -> Recovered<Self>

Returns the Recovered transaction with the given sender.

Note: assumes the given signer is the signer of this transaction.

Source

fn with_signer_ref(&self, signer: Address) -> Recovered<&Self>

Returns the Recovered transaction with the given signer, using a reference to self.

Note: assumes the given signer is the signer of this transaction.

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§

Source§

impl SignedTransaction for OpPooledTransaction

Available on crate feature op only.
Source§

fn tx_hash(&self) -> &TxHash

Source§

impl SignedTransaction for OpTxEnvelope

Available on crate feature op only.
Source§

fn tx_hash(&self) -> &TxHash

Source§

impl<'a, T: 'a + SignedTransaction + ?Sized> SignedTransaction for &'a T
where &'a T: Send + Sync + Unpin + Clone + Debug + PartialEq + Eq + Hash + Encodable + Decodable + Encodable2718 + Decodable2718 + Transaction + MaybeSerde + InMemorySize + SignerRecoverable,

Source§

impl<T> SignedTransaction for EthereumTxEnvelope<T>
where T: RlpEcdsaEncodableTx + SignableTransaction<Signature> + Unpin, Self: Clone + PartialEq + Eq + Decodable + Decodable2718 + MaybeSerde + InMemorySize,

Source§

fn tx_hash(&self) -> &TxHash

Source§

impl<T: SignedTransaction + ?Sized> SignedTransaction for Arc<T>
where Arc<T>: Send + Sync + Unpin + Clone + Debug + PartialEq + Eq + Hash + Encodable + Decodable + Encodable2718 + Decodable2718 + Transaction + MaybeSerde + InMemorySize + SignerRecoverable,

Implementors§

Source§

impl<B, T> SignedTransaction for Extended<B, T>
where B: SignedTransaction + IsTyped2718, T: SignedTransaction,