@@ -890,6 +890,11 @@ impl TypedTransaction {
890890 matches ! ( self , Self :: EIP4844 ( _) )
891891 }
892892
893+ /// Returns true whether this tx is a EIP7702 transaction
894+ pub fn is_eip7702 ( & self ) -> bool {
895+ matches ! ( self , Self :: EIP7702 ( _) )
896+ }
897+
893898 /// Returns the hash of the transaction.
894899 ///
895900 /// Note: If this transaction has the Impersonated signature then this returns a modified unique
@@ -1053,7 +1058,7 @@ impl From<TxEnvelope> for TypedTransaction {
10531058 TxEnvelope :: Eip2930 ( tx) => Self :: EIP2930 ( tx) ,
10541059 TxEnvelope :: Eip1559 ( tx) => Self :: EIP1559 ( tx) ,
10551060 TxEnvelope :: Eip4844 ( tx) => Self :: EIP4844 ( tx) ,
1056- _ => unreachable ! ( ) ,
1061+ TxEnvelope :: Eip7702 ( tx ) => Self :: EIP7702 ( tx ) ,
10571062 }
10581063 }
10591064}
@@ -1271,7 +1276,7 @@ impl From<ReceiptEnvelope<alloy_rpc_types::Log>> for TypedReceipt<Receipt<alloy_
12711276 ReceiptEnvelope :: Eip2930 ( r) => Self :: EIP2930 ( r) ,
12721277 ReceiptEnvelope :: Eip1559 ( r) => Self :: EIP1559 ( r) ,
12731278 ReceiptEnvelope :: Eip4844 ( r) => Self :: EIP4844 ( r) ,
1274- _ => unreachable ! ( ) ,
1279+ ReceiptEnvelope :: Eip7702 ( r ) => Self :: EIP7702 ( r ) ,
12751280 }
12761281 }
12771282}
@@ -1285,6 +1290,7 @@ impl Encodable for TypedReceipt {
12851290 Self :: EIP2930 ( r) => r. length ( ) + 1 ,
12861291 Self :: EIP1559 ( r) => r. length ( ) + 1 ,
12871292 Self :: EIP4844 ( r) => r. length ( ) + 1 ,
1293+ Self :: EIP7702 ( r) => r. length ( ) + 1 ,
12881294 Self :: Deposit ( r) => r. length ( ) + 1 ,
12891295 _ => unreachable ! ( "receipt already matched" ) ,
12901296 } ;
@@ -1305,6 +1311,11 @@ impl Encodable for TypedReceipt {
13051311 3u8 . encode ( out) ;
13061312 r. encode ( out) ;
13071313 }
1314+ Self :: EIP7702 ( r) => {
1315+ Header { list : true , payload_length : payload_len } . encode ( out) ;
1316+ 4u8 . encode ( out) ;
1317+ r. encode ( out) ;
1318+ }
13081319 Self :: Deposit ( r) => {
13091320 Header { list : true , payload_length : payload_len } . encode ( out) ;
13101321 0x7Eu8 . encode ( out) ;
@@ -1345,6 +1356,9 @@ impl Decodable for TypedReceipt {
13451356 } else if receipt_type == 0x03 {
13461357 buf. advance ( 1 ) ;
13471358 <ReceiptWithBloom as Decodable >:: decode ( buf) . map ( TypedReceipt :: EIP4844 )
1359+ } else if receipt_type == 0x04 {
1360+ buf. advance ( 1 ) ;
1361+ <ReceiptWithBloom as Decodable >:: decode ( buf) . map ( TypedReceipt :: EIP7702 )
13481362 } else if receipt_type == 0x7E {
13491363 buf. advance ( 1 ) ;
13501364 <DepositReceipt as Decodable >:: decode ( buf) . map ( TypedReceipt :: Deposit )
@@ -1411,6 +1425,7 @@ impl Decodable2718 for TypedReceipt {
14111425 ReceiptEnvelope :: Eip2930 ( tx) => Ok ( Self :: EIP2930 ( tx) ) ,
14121426 ReceiptEnvelope :: Eip1559 ( tx) => Ok ( Self :: EIP1559 ( tx) ) ,
14131427 ReceiptEnvelope :: Eip4844 ( tx) => Ok ( Self :: EIP4844 ( tx) ) ,
1428+ ReceiptEnvelope :: Eip7702 ( tx) => Ok ( Self :: EIP7702 ( tx) ) ,
14141429 _ => Err ( Eip2718Error :: RlpError ( alloy_rlp:: Error :: Custom ( "unexpected tx type" ) ) ) ,
14151430 }
14161431 }
0 commit comments