Properly type RpcClient::get_version() (#6919)

This commit is contained in:
Michael Vines
2019-11-12 22:01:04 -07:00
committed by GitHub
parent 81acd94153
commit 86faa3f995
6 changed files with 33 additions and 42 deletions

View File

@@ -13,7 +13,8 @@ use bincode::serialize;
use jsonrpc_core::{Error, Metadata, Result};
use jsonrpc_derive::rpc;
use solana_client::rpc_request::{
Response, RpcEpochInfo, RpcResponseContext, RpcVoteAccountInfo, RpcVoteAccountStatus,
Response, RpcContactInfo, RpcEpochInfo, RpcResponseContext, RpcVersionInfo, RpcVoteAccountInfo,
RpcVoteAccountStatus,
};
use solana_drone::drone::request_airdrop_transaction;
use solana_ledger::{
@@ -342,25 +343,6 @@ pub struct Meta {
}
impl Metadata for Meta {}
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct RpcContactInfo {
/// Pubkey of the node as a base-58 string
pub pubkey: String,
/// Gossip port
pub gossip: Option<SocketAddr>,
/// Tpu port
pub tpu: Option<SocketAddr>,
/// JSON RPC port
pub rpc: Option<SocketAddr>,
}
#[derive(Serialize, Deserialize, Clone, Debug)]
#[serde(rename_all = "kebab-case")]
pub struct RpcVersionInfo {
/// The current version of solana-core
pub solana_core: String,
}
#[rpc(server)]
pub trait RpcSol {
type Metadata;

View File

@@ -18,8 +18,8 @@ fn test_rpc_client() {
let client = RpcClient::new_socket(leader_data.rpc);
assert_eq!(
client.get_version().unwrap(),
format!("{{\"solana-core\":\"{}\"}}", solana_core::version!())
client.get_version().unwrap().solana_core,
solana_core::version!()
);
assert_eq!(client.get_balance(&bob_pubkey).unwrap(), 0);