@@ -326,7 +326,8 @@ impl<C: Client> EthJsonRcpClient<C> {
326326#[ derive( Debug , Clone , Serialize , Deserialize ) ]
327327pub struct EthGetLogsParams {
328328 /// Addresses of contracts to filter logs for.
329- pub address : Vec < H160 > ,
329+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
330+ pub address : Option < Vec < H160 > > ,
330331
331332 /// Start search logs from this block number.
332333 #[ serde( rename = "fromBlock" ) ]
@@ -337,7 +338,8 @@ pub struct EthGetLogsParams {
337338 pub to_block : BlockNumber ,
338339
339340 /// Filter logs by topics.
340- pub topics : Vec < H256 > ,
341+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
342+ pub topics : Option < Vec < H256 > > ,
341343}
342344
343345pub trait Client : Clone + Send + Sync {
@@ -356,12 +358,12 @@ mod tests {
356358 #[ test]
357359 fn test_eth_get_logs_params_serialization ( ) {
358360 let get_logs_params = EthGetLogsParams {
359- address : vec ! [ "0xb59f67a8bff5d8cd03f6ac17265c550ed8f33907"
361+ address : Some ( vec ! [ "0xb59f67a8bff5d8cd03f6ac17265c550ed8f33907"
360362 . parse( )
361- . unwrap( ) ] ,
363+ . unwrap( ) ] ) ,
362364 from_block : BlockNumber :: Number ( 42u64 . into ( ) ) ,
363365 to_block : BlockNumber :: Latest ,
364- topics : vec ! [
366+ topics : Some ( vec ! [
365367 "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
366368 . parse( )
367369 . unwrap( ) ,
@@ -371,7 +373,7 @@ mod tests {
371373 "0x00000000000000000000000054a2d42a40f51259dedd1978f6c118a0f0eff078"
372374 . parse( )
373375 . unwrap( ) ,
374- ] ,
376+ ] ) ,
375377 } ;
376378
377379 let json = serde_json:: to_string ( & get_logs_params) . unwrap ( ) ;
0 commit comments