diff --git a/chain/jsonrpc/client/src/lib.rs b/chain/jsonrpc/client/src/lib.rs index b3724c25dcd..6de6b721dc1 100644 --- a/chain/jsonrpc/client/src/lib.rs +++ b/chain/jsonrpc/client/src/lib.rs @@ -187,7 +187,6 @@ jsonrpc_client!(pub struct JsonRpcClient { pub fn EXPERIMENTAL_tx_status(&self, tx: String) -> RpcRequest; pub fn health(&self) -> RpcRequest<()>; pub fn chunk(&self, id: ChunkId) -> RpcRequest; - pub fn validators(&self, epoch_id_or_block_id: Option) -> RpcRequest; pub fn gas_price(&self, block_id: MaybeBlockId) -> RpcRequest; }); @@ -261,6 +260,17 @@ impl JsonRpcClient { { call_method(&self.client, &self.server_addr, "EXPERIMENTAL_split_storage_info", request) } + + pub fn validators( + &self, + epoch_id_or_block_id: Option, + ) -> RpcRequest { + let epoch_reference = match epoch_id_or_block_id { + Some(epoch_reference) => epoch_reference, + _ => EpochReference::Latest, + }; + call_method(&self.client, &self.server_addr, "validators", epoch_reference) + } } fn create_client() -> Client { diff --git a/chain/jsonrpc/src/api/validator.rs b/chain/jsonrpc/src/api/validator.rs index f23384de361..e33fbeee2a5 100644 --- a/chain/jsonrpc/src/api/validator.rs +++ b/chain/jsonrpc/src/api/validator.rs @@ -88,14 +88,12 @@ mod tests { let block_height: u64 = 12345; let params = serde_json::json!({"block_id": block_height}); let result = RpcValidatorRequest::parse(params); - assert!(result.is_ok()); - let result_unwrap = result.unwrap(); - let res_serialized = format!("{result_unwrap:?}"); - let expected = RpcValidatorRequest { - epoch_reference: EpochReference::BlockId(BlockId::Height(block_height)), - }; - let expected_serialized = format!("{expected:?}"); - assert_eq!(res_serialized, expected_serialized); + assert_eq!( + result.unwrap(), + RpcValidatorRequest { + epoch_reference: EpochReference::BlockId(BlockId::Height(block_height)), + } + ); } #[test]