@@ -120,6 +120,7 @@ pub struct RpcBlockInfo {
120120 pub block_timestamp : BlockTimestamp ,
121121 /// The sequencer address of this block.
122122 pub sequencer_address : ContractAddress ,
123+ pub transactions : Vec < Transaction > ,
123124}
124125
125126type RpcResponse = ureq:: Response ;
@@ -314,7 +315,7 @@ impl RpcState {
314315 pub fn get_block_info ( & self ) -> RpcBlockInfo {
315316 let get_block_info_params = ureq:: json!( {
316317 "jsonrpc" : "2.0" ,
317- "method" : "starknet_getBlockWithTxHashes " ,
318+ "method" : "starknet_getBlockWithTxs " ,
318319 "params" : [ self . block. to_value( ) ] ,
319320 "id" : 1
320321 } ) ;
@@ -323,6 +324,24 @@ impl RpcState {
323324 let sequencer_address: StarkFelt =
324325 serde_json:: from_value ( block_info[ "result" ] [ "sequencer_address" ] . clone ( ) ) . unwrap ( ) ;
325326
327+ let transactions: Vec < _ > = block_info[ "result" ] [ "transactions" ]
328+ . as_array ( )
329+ . unwrap ( )
330+ . iter ( )
331+ . filter_map ( |result| match dbg ! ( & result) [ "type" ] . as_str ( ) . unwrap ( ) {
332+ "INVOKE" => match result[ "version" ] . as_str ( ) . unwrap ( ) {
333+ "0x0" => Some ( Transaction :: Invoke ( InvokeTransaction :: V0 (
334+ serde_json:: from_value ( result. clone ( ) ) . unwrap ( ) ,
335+ ) ) ) ,
336+ "0x1" => Some ( Transaction :: Invoke ( InvokeTransaction :: V1 (
337+ serde_json:: from_value ( result. clone ( ) ) . unwrap ( ) ,
338+ ) ) ) ,
339+ _ => None ,
340+ } ,
341+ _ => None ,
342+ } )
343+ . collect ( ) ;
344+
326345 RpcBlockInfo {
327346 block_number : BlockNumber (
328347 block_info[ "result" ] [ "block_number" ]
@@ -337,6 +356,7 @@ impl RpcState {
337356 . unwrap ( ) ,
338357 ) ,
339358 sequencer_address : ContractAddress ( sequencer_address. try_into ( ) . unwrap ( ) ) ,
359+ transactions,
340360 }
341361 }
342362
@@ -859,6 +879,7 @@ mod blockifier_transaction_tests {
859879 block_number,
860880 block_timestamp,
861881 sequencer_address,
882+ ..
862883 } = rpc_reader. 0 . get_block_info ( ) ;
863884
864885 // Get transaction before giving ownership of the reader
0 commit comments