Expose Rpc methods to rpc_request (#3988)

* Add new rpc methods to rpc-request

* A-Z
This commit is contained in:
Tyera Eulberg 2019-04-25 08:52:53 -06:00 committed by GitHub
parent c4d9dff590
commit d59c1cd412
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 20 deletions

View File

@ -4,21 +4,23 @@ use std::{error, fmt};
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq)]
pub enum RpcRequest { pub enum RpcRequest {
ConfirmTransaction, ConfirmTransaction,
DeregisterNode,
FullnodeExit,
GetAccountInfo, GetAccountInfo,
GetBalance, GetBalance,
GetClusterNodes,
GetNumBlocksSinceSignatureConfirmation,
GetRecentBlockhash, GetRecentBlockhash,
GetSignatureStatus, GetSignatureStatus,
GetTransactionCount, GetSlotLeader,
RequestAirdrop,
SendTransaction,
RegisterNode,
SignVote,
DeregisterNode,
GetStorageBlockhash, GetStorageBlockhash,
GetStorageEntryHeight, GetStorageEntryHeight,
GetStoragePubkeysForEntryHeight, GetStoragePubkeysForEntryHeight,
FullnodeExit, GetTransactionCount,
GetNumBlocksSinceSignatureConfirmation, RegisterNode,
RequestAirdrop,
SendTransaction,
SignVote,
} }
impl RpcRequest { impl RpcRequest {
@ -26,23 +28,25 @@ impl RpcRequest {
let jsonrpc = "2.0"; let jsonrpc = "2.0";
let method = match self { let method = match self {
RpcRequest::ConfirmTransaction => "confirmTransaction", RpcRequest::ConfirmTransaction => "confirmTransaction",
RpcRequest::DeregisterNode => "deregisterNode",
RpcRequest::FullnodeExit => "fullnodeExit",
RpcRequest::GetAccountInfo => "getAccountInfo", RpcRequest::GetAccountInfo => "getAccountInfo",
RpcRequest::GetBalance => "getBalance", RpcRequest::GetBalance => "getBalance",
RpcRequest::GetRecentBlockhash => "getRecentBlockhash", RpcRequest::GetClusterNodes => "getClusterNodes",
RpcRequest::GetSignatureStatus => "getSignatureStatus",
RpcRequest::GetTransactionCount => "getTransactionCount",
RpcRequest::RequestAirdrop => "requestAirdrop",
RpcRequest::SendTransaction => "sendTransaction",
RpcRequest::RegisterNode => "registerNode",
RpcRequest::SignVote => "signVote",
RpcRequest::DeregisterNode => "deregisterNode",
RpcRequest::GetStorageBlockhash => "getStorageBlockhash",
RpcRequest::GetStorageEntryHeight => "getStorageEntryHeight",
RpcRequest::GetStoragePubkeysForEntryHeight => "getStoragePubkeysForEntryHeight",
RpcRequest::FullnodeExit => "fullnodeExit",
RpcRequest::GetNumBlocksSinceSignatureConfirmation => { RpcRequest::GetNumBlocksSinceSignatureConfirmation => {
"getNumBlocksSinceSignatureConfirmation" "getNumBlocksSinceSignatureConfirmation"
} }
RpcRequest::GetRecentBlockhash => "getRecentBlockhash",
RpcRequest::GetSignatureStatus => "getSignatureStatus",
RpcRequest::GetSlotLeader => "getSlotLeader",
RpcRequest::GetStorageBlockhash => "getStorageBlockhash",
RpcRequest::GetStorageEntryHeight => "getStorageEntryHeight",
RpcRequest::GetStoragePubkeysForEntryHeight => "getStoragePubkeysForEntryHeight",
RpcRequest::GetTransactionCount => "getTransactionCount",
RpcRequest::RegisterNode => "registerNode",
RpcRequest::RequestAirdrop => "requestAirdrop",
RpcRequest::SendTransaction => "sendTransaction",
RpcRequest::SignVote => "signVote",
}; };
let mut request = json!({ let mut request = json!({
"jsonrpc": jsonrpc, "jsonrpc": jsonrpc,