@@ -890,6 +890,11 @@ impl TypedTransaction {
890
890
matches ! ( self , Self :: EIP4844 ( _) )
891
891
}
892
892
893
+ /// Returns true whether this tx is a EIP7702 transaction
894
+ pub fn is_eip7702 ( & self ) -> bool {
895
+ matches ! ( self , Self :: EIP7702 ( _) )
896
+ }
897
+
893
898
/// Returns the hash of the transaction.
894
899
///
895
900
/// Note: If this transaction has the Impersonated signature then this returns a modified unique
@@ -1053,7 +1058,7 @@ impl From<TxEnvelope> for TypedTransaction {
1053
1058
TxEnvelope :: Eip2930 ( tx) => Self :: EIP2930 ( tx) ,
1054
1059
TxEnvelope :: Eip1559 ( tx) => Self :: EIP1559 ( tx) ,
1055
1060
TxEnvelope :: Eip4844 ( tx) => Self :: EIP4844 ( tx) ,
1056
- _ => unreachable ! ( ) ,
1061
+ TxEnvelope :: Eip7702 ( tx ) => Self :: EIP7702 ( tx ) ,
1057
1062
}
1058
1063
}
1059
1064
}
@@ -1271,7 +1276,7 @@ impl From<ReceiptEnvelope<alloy_rpc_types::Log>> for TypedReceipt<Receipt<alloy_
1271
1276
ReceiptEnvelope :: Eip2930 ( r) => Self :: EIP2930 ( r) ,
1272
1277
ReceiptEnvelope :: Eip1559 ( r) => Self :: EIP1559 ( r) ,
1273
1278
ReceiptEnvelope :: Eip4844 ( r) => Self :: EIP4844 ( r) ,
1274
- _ => unreachable ! ( ) ,
1279
+ ReceiptEnvelope :: Eip7702 ( r ) => Self :: EIP7702 ( r ) ,
1275
1280
}
1276
1281
}
1277
1282
}
@@ -1285,6 +1290,7 @@ impl Encodable for TypedReceipt {
1285
1290
Self :: EIP2930 ( r) => r. length ( ) + 1 ,
1286
1291
Self :: EIP1559 ( r) => r. length ( ) + 1 ,
1287
1292
Self :: EIP4844 ( r) => r. length ( ) + 1 ,
1293
+ Self :: EIP7702 ( r) => r. length ( ) + 1 ,
1288
1294
Self :: Deposit ( r) => r. length ( ) + 1 ,
1289
1295
_ => unreachable ! ( "receipt already matched" ) ,
1290
1296
} ;
@@ -1305,6 +1311,11 @@ impl Encodable for TypedReceipt {
1305
1311
3u8 . encode ( out) ;
1306
1312
r. encode ( out) ;
1307
1313
}
1314
+ Self :: EIP7702 ( r) => {
1315
+ Header { list : true , payload_length : payload_len } . encode ( out) ;
1316
+ 4u8 . encode ( out) ;
1317
+ r. encode ( out) ;
1318
+ }
1308
1319
Self :: Deposit ( r) => {
1309
1320
Header { list : true , payload_length : payload_len } . encode ( out) ;
1310
1321
0x7Eu8 . encode ( out) ;
@@ -1345,6 +1356,9 @@ impl Decodable for TypedReceipt {
1345
1356
} else if receipt_type == 0x03 {
1346
1357
buf. advance ( 1 ) ;
1347
1358
<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 )
1348
1362
} else if receipt_type == 0x7E {
1349
1363
buf. advance ( 1 ) ;
1350
1364
<DepositReceipt as Decodable >:: decode ( buf) . map ( TypedReceipt :: Deposit )
@@ -1411,6 +1425,7 @@ impl Decodable2718 for TypedReceipt {
1411
1425
ReceiptEnvelope :: Eip2930 ( tx) => Ok ( Self :: EIP2930 ( tx) ) ,
1412
1426
ReceiptEnvelope :: Eip1559 ( tx) => Ok ( Self :: EIP1559 ( tx) ) ,
1413
1427
ReceiptEnvelope :: Eip4844 ( tx) => Ok ( Self :: EIP4844 ( tx) ) ,
1428
+ ReceiptEnvelope :: Eip7702 ( tx) => Ok ( Self :: EIP7702 ( tx) ) ,
1414
1429
_ => Err ( Eip2718Error :: RlpError ( alloy_rlp:: Error :: Custom ( "unexpected tx type" ) ) ) ,
1415
1430
}
1416
1431
}
0 commit comments