reth_primitives_traits::transaction::signed

Trait SignedTransaction

Source
pub trait SignedTransaction:
    Send
    + Sync
    + Unpin
    + Clone
    + Default
    + Debug
    + PartialEq
    + Eq
    + Hash
    + Serialize
    + for<'a> Deserialize<'a>
    + Encodable
    + Decodable
    + Encodable2718
    + Decodable2718
    + TransactionExt
    + MaybeArbitrary {
    type Transaction: Transaction;

    // Required methods
    fn tx_hash(&self) -> &TxHash;
    fn transaction(&self) -> &Self::Transaction;
    fn signature(&self) -> &PrimitiveSignature;
    fn recover_signer(&self) -> Option<Address>;
    fn recover_signer_unchecked(&self) -> Option<Address>;
    fn from_transaction_and_signature(
        transaction: Self::Transaction,
        signature: PrimitiveSignature,
    ) -> Self;
    fn fill_tx_env(&self, tx_env: &mut TxEnv, sender: Address);

    // Provided method
    fn recalculate_hash(&self) -> B256 { ... }
}
Expand description

A signed transaction.

Required Associated Types§

Source

type Transaction: Transaction

Transaction type that is signed.

Required Methods§

Source

fn tx_hash(&self) -> &TxHash

Returns reference to transaction hash.

Source

fn transaction(&self) -> &Self::Transaction

Returns reference to transaction.

Source

fn signature(&self) -> &PrimitiveSignature

Returns reference to signature.

Source

fn recover_signer(&self) -> Option<Address>

Recover signer from signature and hash.

Returns None if the transaction’s signature is invalid following EIP-2, see also reth_primitives::transaction::recover_signer.

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.

Source

fn recover_signer_unchecked(&self) -> Option<Address>

Recover signer from signature and hash without ensuring that the signature has a low s value.

Returns None if the transaction’s signature is invalid, see also reth_primitives::transaction::recover_signer_unchecked.

Source

fn from_transaction_and_signature( transaction: Self::Transaction, signature: PrimitiveSignature, ) -> Self

Create a new signed transaction from a transaction and its signature.

This will also calculate the transaction hash using its encoding.

Source

fn fill_tx_env(&self, tx_env: &mut TxEnv, sender: Address)

Fills [TxEnv] with an [Address] and transaction.

Provided Methods§

Source

fn recalculate_hash(&self) -> B256

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

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.

Implementors§