@@ -669,6 +669,8 @@ class Transaction(
669669
670670 authorization_list : List [AuthorizationTuple ] | None = None
671671
672+ initcodes : List [Bytes ] | None = None
673+
672674 secret_key : Hash | None = None
673675 error : List [TransactionException ] | TransactionException | None = Field (None , exclude = True )
674676
@@ -710,7 +712,9 @@ def model_post_init(self, __context):
710712
711713 if "ty" not in self .model_fields_set :
712714 # Try to deduce transaction type from included fields
713- if self .authorization_list is not None :
715+ if self .initcodes is not None :
716+ self .ty = 6
717+ elif self .authorization_list is not None :
714718 self .ty = 4
715719 elif self .max_fee_per_blob_gas is not None or self .blob_versioned_hashes is not None :
716720 self .ty = 3
@@ -758,6 +762,11 @@ def model_post_init(self, __context):
758762 if self .ty != 4 :
759763 assert self .authorization_list is None , "authorization_list must be None"
760764
765+ if self .ty == 6 and self .initcodes is None :
766+ self .initcodes = []
767+ if self .ty != 6 :
768+ assert self .initcodes is None , "initcodes must be None"
769+
761770 if "nonce" not in self .model_fields_set and self .sender is not None :
762771 self .nonce = HexNumber (self .sender .get_nonce ())
763772
@@ -911,7 +920,21 @@ def get_rlp_signing_fields(self) -> List[str]:
911920 the transaction type.
912921 """
913922 field_list : List [str ]
914- if self .ty == 4 :
923+ if self .ty == 6 :
924+ # EIP-7873: https://eips.ethereum.org/EIPS/eip-7873
925+ field_list = [
926+ "chain_id" ,
927+ "nonce" ,
928+ "max_priority_fee_per_gas" ,
929+ "max_fee_per_gas" ,
930+ "gas_limit" ,
931+ "to" ,
932+ "value" ,
933+ "data" ,
934+ "access_list" ,
935+ "initcodes" ,
936+ ]
937+ elif self .ty == 4 :
915938 # EIP-7702: https://eips.ethereum.org/EIPS/eip-7702
916939 field_list = [
917940 "chain_id" ,
0 commit comments