Remove tuples from JSON RPC responses (#7806)

* Remove RpcConfirmedBlock tuple

* Remove getRecentBlockhash tuple

* Remove getProgramAccounts tuple

* Remove tuple from get_signature_confirmation_status

* Collect Rpc response types

* Camel-case epoch schedule for rpc response

* Remove getBlockCommitment tuple

* Remove getStorageTurn tuple

* Update json-rpc docs
This commit is contained in:
Tyera Eulberg
2020-01-15 00:25:45 -07:00
committed by GitHub
parent 50c1c08235
commit 6d3b8b6d7d
21 changed files with 446 additions and 348 deletions

View File

@@ -1,12 +1,12 @@
use crate::rpc_request::{Response, RpcResponse};
use crate::{
client_error::ClientError,
generic_rpc_client_request::GenericRpcClientRequest,
mock_rpc_client_request::{MockRpcClientRequest, Mocks},
rpc_client_request::RpcClientRequest,
rpc_request::{
RpcConfirmedBlock, RpcContactInfo, RpcEpochInfo, RpcLeaderSchedule, RpcRequest,
RpcVersionInfo, RpcVoteAccountStatus,
rpc_request::RpcRequest,
rpc_response::{
Response, RpcBlockhashFeeCalculator, RpcConfirmedBlock, RpcContactInfo, RpcEpochInfo,
RpcLeaderSchedule, RpcResponse, RpcVersionInfo, RpcVoteAccountStatus,
},
};
use bincode::serialize;
@@ -753,8 +753,12 @@ impl RpcClient {
let Response {
context,
value: (blockhash_str, fee_calculator),
} = serde_json::from_value::<Response<(String, FeeCalculator)>>(response).map_err(
value:
RpcBlockhashFeeCalculator {
blockhash,
fee_calculator,
},
} = serde_json::from_value::<Response<RpcBlockhashFeeCalculator>>(response).map_err(
|err| {
io::Error::new(
io::ErrorKind::Other,
@@ -762,7 +766,7 @@ impl RpcClient {
)
},
)?;
let blockhash = blockhash_str.parse().map_err(|err| {
let blockhash = blockhash.parse().map_err(|err| {
io::Error::new(
io::ErrorKind::Other,
format!("GetRecentBlockhash hash parse failure: {:?}", err),