@@ -14,7 +14,7 @@ use alloy_network::{AnyReceiptEnvelope, AnyRpcTransaction, AnyTransactionReceipt
1414use alloy_primitives:: { Address , B256 , Bloom , Bytes , TxHash , TxKind , U64 , U256 } ;
1515use alloy_rlp:: { Decodable , Encodable , Header } ;
1616use alloy_rpc_types:: {
17- AccessList , ConversionError , Transaction as RpcTransaction , TransactionReceipt ,
17+ ConversionError , Transaction as RpcTransaction , TransactionReceipt ,
1818 request:: TransactionRequest , trace:: otterscan:: OtsReceipt ,
1919} ;
2020use alloy_serde:: { OtherFields , WithOtherFields } ;
@@ -466,93 +466,10 @@ impl TypedTransaction {
466466 }
467467 }
468468
469- /// Returns a helper type that contains commonly used values as fields
470- pub fn essentials ( & self ) -> TransactionEssentials {
469+ pub fn as_legacy ( & self ) -> Option < & Signed < TxLegacy > > {
471470 match self {
472- Self :: Legacy ( t) => TransactionEssentials {
473- kind : t. tx ( ) . to ,
474- input : t. tx ( ) . input . clone ( ) ,
475- nonce : t. tx ( ) . nonce ,
476- gas_limit : t. tx ( ) . gas_limit ,
477- gas_price : Some ( t. tx ( ) . gas_price ) ,
478- max_fee_per_gas : None ,
479- max_priority_fee_per_gas : None ,
480- max_fee_per_blob_gas : None ,
481- blob_versioned_hashes : None ,
482- value : t. tx ( ) . value ,
483- chain_id : t. tx ( ) . chain_id ,
484- access_list : Default :: default ( ) ,
485- } ,
486- Self :: EIP2930 ( t) => TransactionEssentials {
487- kind : t. tx ( ) . to ,
488- input : t. tx ( ) . input . clone ( ) ,
489- nonce : t. tx ( ) . nonce ,
490- gas_limit : t. tx ( ) . gas_limit ,
491- gas_price : Some ( t. tx ( ) . gas_price ) ,
492- max_fee_per_gas : None ,
493- max_priority_fee_per_gas : None ,
494- max_fee_per_blob_gas : None ,
495- blob_versioned_hashes : None ,
496- value : t. tx ( ) . value ,
497- chain_id : Some ( t. tx ( ) . chain_id ) ,
498- access_list : t. tx ( ) . access_list . clone ( ) ,
499- } ,
500- Self :: EIP1559 ( t) => TransactionEssentials {
501- kind : t. tx ( ) . to ,
502- input : t. tx ( ) . input . clone ( ) ,
503- nonce : t. tx ( ) . nonce ,
504- gas_limit : t. tx ( ) . gas_limit ,
505- gas_price : None ,
506- max_fee_per_gas : Some ( t. tx ( ) . max_fee_per_gas ) ,
507- max_priority_fee_per_gas : Some ( t. tx ( ) . max_priority_fee_per_gas ) ,
508- max_fee_per_blob_gas : None ,
509- blob_versioned_hashes : None ,
510- value : t. tx ( ) . value ,
511- chain_id : Some ( t. tx ( ) . chain_id ) ,
512- access_list : t. tx ( ) . access_list . clone ( ) ,
513- } ,
514- Self :: EIP4844 ( t) => TransactionEssentials {
515- kind : TxKind :: Call ( t. tx ( ) . tx ( ) . to ) ,
516- input : t. tx ( ) . tx ( ) . input . clone ( ) ,
517- nonce : t. tx ( ) . tx ( ) . nonce ,
518- gas_limit : t. tx ( ) . tx ( ) . gas_limit ,
519- gas_price : None ,
520- max_fee_per_gas : Some ( t. tx ( ) . tx ( ) . max_fee_per_gas ) ,
521- max_priority_fee_per_gas : Some ( t. tx ( ) . tx ( ) . max_priority_fee_per_gas ) ,
522- max_fee_per_blob_gas : Some ( t. tx ( ) . tx ( ) . max_fee_per_blob_gas ) ,
523- blob_versioned_hashes : Some ( t. tx ( ) . tx ( ) . blob_versioned_hashes . clone ( ) ) ,
524- value : t. tx ( ) . tx ( ) . value ,
525- chain_id : Some ( t. tx ( ) . tx ( ) . chain_id ) ,
526- access_list : t. tx ( ) . tx ( ) . access_list . clone ( ) ,
527- } ,
528- Self :: EIP7702 ( t) => TransactionEssentials {
529- kind : TxKind :: Call ( t. tx ( ) . to ) ,
530- input : t. tx ( ) . input . clone ( ) ,
531- nonce : t. tx ( ) . nonce ,
532- gas_limit : t. tx ( ) . gas_limit ,
533- gas_price : None ,
534- max_fee_per_gas : Some ( t. tx ( ) . max_fee_per_gas ) ,
535- max_priority_fee_per_gas : Some ( t. tx ( ) . max_priority_fee_per_gas ) ,
536- max_fee_per_blob_gas : None ,
537- blob_versioned_hashes : None ,
538- value : t. tx ( ) . value ,
539- chain_id : Some ( t. tx ( ) . chain_id ) ,
540- access_list : t. tx ( ) . access_list . clone ( ) ,
541- } ,
542- Self :: Deposit ( t) => TransactionEssentials {
543- kind : t. to ,
544- input : t. input . clone ( ) ,
545- nonce : 0 ,
546- gas_limit : t. gas_limit ,
547- gas_price : Some ( 0 ) ,
548- max_fee_per_gas : None ,
549- max_priority_fee_per_gas : None ,
550- max_fee_per_blob_gas : None ,
551- blob_versioned_hashes : None ,
552- value : t. value ,
553- chain_id : t. chain_id ( ) ,
554- access_list : Default :: default ( ) ,
555- } ,
471+ Self :: Legacy ( tx) => Some ( tx) ,
472+ _ => None ,
556473 }
557474 }
558475
@@ -594,22 +511,6 @@ impl TypedTransaction {
594511 }
595512}
596513
597- #[ derive( Clone , Debug , PartialEq , Eq ) ]
598- pub struct TransactionEssentials {
599- pub kind : TxKind ,
600- pub input : Bytes ,
601- pub nonce : u64 ,
602- pub gas_limit : u64 ,
603- pub gas_price : Option < u128 > ,
604- pub max_fee_per_gas : Option < u128 > ,
605- pub max_priority_fee_per_gas : Option < u128 > ,
606- pub max_fee_per_blob_gas : Option < u128 > ,
607- pub blob_versioned_hashes : Option < Vec < B256 > > ,
608- pub value : U256 ,
609- pub chain_id : Option < u64 > ,
610- pub access_list : AccessList ,
611- }
612-
613514/// Represents all relevant information of an executed transaction
614515#[ derive( Clone , Debug , Serialize , Deserialize , PartialEq , Eq ) ]
615516pub struct TransactionInfo {
0 commit comments