Expand description
Queries active validators on the network.
Returns details and the state of validation on the blockchain.
§Examples
-
Get the validators for a specified epoch.
use unc_jsonrpc_client::{methods, JsonRpcClient}; use unc_primitives::types::{EpochReference, EpochId, BlockReference, Finality}; let client = JsonRpcClient::connect("https://archival-rpc.mainnet.unc.org"); let request = methods::validators::RpcValidatorRequest { epoch_reference: EpochReference::EpochId( "9xrjdZmgjoVkjVE3ui7tY37x9Mkw5wH385qNXE6cho7T".parse()?, ) }; let response = client.call(request).await?; assert!(matches!( response, methods::validators::RpcValidatorResponse { .. } ));
-
Get the validators for the latest block.
use unc_jsonrpc_client::{methods, JsonRpcClient}; use unc_primitives::types::{EpochReference, EpochId, BlockId}; let client = JsonRpcClient::connect("https://archival-rpc.mainnet.unc.org"); let request = methods::validators::RpcValidatorRequest { epoch_reference: EpochReference::Latest }; let response = client.call(request).await?; assert!(matches!( response, methods::validators::RpcValidatorResponse { .. } ));