@@ -206,6 +206,12 @@ pub struct MaybeImpersonatedTransaction {
206206 pub impersonated_sender : Option < Address > ,
207207}
208208
209+ impl Typed2718 for MaybeImpersonatedTransaction {
210+ fn ty ( & self ) -> u8 {
211+ self . transaction . ty ( )
212+ }
213+ }
214+
209215impl MaybeImpersonatedTransaction {
210216 /// Creates a new wrapper for the given transaction
211217 pub fn new ( transaction : TypedTransaction ) -> Self {
@@ -279,6 +285,16 @@ impl MaybeImpersonatedTransaction {
279285 }
280286}
281287
288+ impl Encodable2718 for MaybeImpersonatedTransaction {
289+ fn encode_2718_len ( & self ) -> usize {
290+ self . transaction . encode_2718_len ( )
291+ }
292+
293+ fn encode_2718 ( & self , out : & mut dyn BufMut ) {
294+ self . transaction . encode_2718 ( out)
295+ }
296+ }
297+
282298impl Encodable for MaybeImpersonatedTransaction {
283299 fn encode ( & self , out : & mut dyn bytes:: BufMut ) {
284300 self . transaction . encode ( out)
@@ -1171,30 +1187,16 @@ impl TypedReceipt {
11711187fn convert_receipt_to_rpc (
11721188 receipt : ReceiptWithBloom < Receipt < alloy_primitives:: Log > > ,
11731189) -> ReceiptWithBloom < Receipt < alloy_rpc_types:: Log > > {
1174- let rpc_logs: Vec < alloy_rpc_types:: Log > = receipt
1175- . receipt
1176- . logs
1177- . into_iter ( )
1178- . map ( |log| alloy_rpc_types:: Log {
1179- inner : log,
1180- block_hash : None ,
1181- block_number : None ,
1182- block_timestamp : None ,
1183- transaction_hash : None ,
1184- transaction_index : None ,
1185- log_index : None ,
1186- removed : false ,
1187- } )
1188- . collect ( ) ;
1189-
1190- ReceiptWithBloom {
1191- receipt : Receipt {
1192- status : receipt. receipt . status ,
1193- cumulative_gas_used : receipt. receipt . cumulative_gas_used ,
1194- logs : rpc_logs,
1195- } ,
1196- logs_bloom : receipt. logs_bloom ,
1197- }
1190+ receipt. map_logs ( |log| alloy_rpc_types:: Log {
1191+ inner : log,
1192+ block_hash : None ,
1193+ block_number : None ,
1194+ block_timestamp : None ,
1195+ transaction_hash : None ,
1196+ transaction_index : None ,
1197+ log_index : None ,
1198+ removed : false ,
1199+ } )
11981200}
11991201
12001202impl TypedReceiptRpc {
@@ -1462,7 +1464,7 @@ impl Decodable2718 for TypedReceipt {
14621464 }
14631465}
14641466
1465- pub type ReceiptResponse = TransactionReceipt < TypedReceiptRpc > ;
1467+ pub type ReceiptResponse = WithOtherFields < TransactionReceipt < TypedReceiptRpc > > ;
14661468
14671469pub fn convert_to_anvil_receipt ( receipt : AnyTransactionReceipt ) -> Option < ReceiptResponse > {
14681470 let WithOtherFields {
@@ -1484,51 +1486,56 @@ pub fn convert_to_anvil_receipt(receipt: AnyTransactionReceipt) -> Option<Receip
14841486 other,
14851487 } = receipt;
14861488
1487- Some ( TransactionReceipt {
1488- transaction_hash,
1489- transaction_index,
1490- block_hash,
1491- block_number,
1492- gas_used,
1493- contract_address,
1494- effective_gas_price,
1495- from,
1496- to,
1497- blob_gas_price,
1498- blob_gas_used,
1499- inner : match r#type {
1500- 0x00 => TypedReceiptRpc :: Legacy ( receipt_with_bloom) ,
1501- 0x01 => TypedReceiptRpc :: EIP2930 ( receipt_with_bloom) ,
1502- 0x02 => TypedReceiptRpc :: EIP1559 ( receipt_with_bloom) ,
1503- 0x03 => TypedReceiptRpc :: EIP4844 ( receipt_with_bloom) ,
1504- 0x04 => TypedReceiptRpc :: EIP7702 ( receipt_with_bloom) ,
1505- 0x7E => TypedReceiptRpc :: Deposit ( OpDepositReceiptWithBloom {
1506- receipt : OpDepositReceipt {
1507- inner : Receipt {
1508- status : alloy_consensus:: Eip658Value :: Eip658 ( receipt_with_bloom. status ( ) ) ,
1509- cumulative_gas_used : receipt_with_bloom. cumulative_gas_used ( ) ,
1510- logs : receipt_with_bloom
1511- . receipt
1512- . logs
1513- . into_iter ( )
1514- . map ( |l| l. inner )
1515- . collect ( ) ,
1489+ Some ( WithOtherFields {
1490+ inner : TransactionReceipt {
1491+ transaction_hash,
1492+ transaction_index,
1493+ block_hash,
1494+ block_number,
1495+ gas_used,
1496+ contract_address,
1497+ effective_gas_price,
1498+ from,
1499+ to,
1500+ blob_gas_price,
1501+ blob_gas_used,
1502+ inner : match r#type {
1503+ 0x00 => TypedReceiptRpc :: Legacy ( receipt_with_bloom) ,
1504+ 0x01 => TypedReceiptRpc :: EIP2930 ( receipt_with_bloom) ,
1505+ 0x02 => TypedReceiptRpc :: EIP1559 ( receipt_with_bloom) ,
1506+ 0x03 => TypedReceiptRpc :: EIP4844 ( receipt_with_bloom) ,
1507+ 0x04 => TypedReceiptRpc :: EIP7702 ( receipt_with_bloom) ,
1508+ 0x7E => TypedReceiptRpc :: Deposit ( OpDepositReceiptWithBloom {
1509+ receipt : OpDepositReceipt {
1510+ inner : Receipt {
1511+ status : alloy_consensus:: Eip658Value :: Eip658 (
1512+ receipt_with_bloom. status ( ) ,
1513+ ) ,
1514+ cumulative_gas_used : receipt_with_bloom. cumulative_gas_used ( ) ,
1515+ logs : receipt_with_bloom
1516+ . receipt
1517+ . logs
1518+ . into_iter ( )
1519+ . map ( |l| l. inner )
1520+ . collect ( ) ,
1521+ } ,
1522+ deposit_nonce : other
1523+ . get_deserialized :: < U64 > ( "depositNonce" )
1524+ . transpose ( )
1525+ . ok ( ) ?
1526+ . map ( |v| v. to ( ) ) ,
1527+ deposit_receipt_version : other
1528+ . get_deserialized :: < U64 > ( "depositReceiptVersion" )
1529+ . transpose ( )
1530+ . ok ( ) ?
1531+ . map ( |v| v. to ( ) ) ,
15161532 } ,
1517- deposit_nonce : other
1518- . get_deserialized :: < U64 > ( "depositNonce" )
1519- . transpose ( )
1520- . ok ( ) ?
1521- . map ( |v| v. to ( ) ) ,
1522- deposit_receipt_version : other
1523- . get_deserialized :: < U64 > ( "depositReceiptVersion" )
1524- . transpose ( )
1525- . ok ( ) ?
1526- . map ( |v| v. to ( ) ) ,
1527- } ,
1528- logs_bloom : receipt_with_bloom. logs_bloom ,
1529- } ) ,
1530- _ => return None ,
1533+ logs_bloom : receipt_with_bloom. logs_bloom ,
1534+ } ) ,
1535+ _ => return None ,
1536+ } ,
15311537 } ,
1538+ other,
15321539 } )
15331540}
15341541
0 commit comments