From 5174be5fe7af9f53071e0666841e59bdb61b051d Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Thu, 20 Sep 2018 14:51:17 -0700 Subject: [PATCH] Rename getAccount to getAccountInfo --- doc/json-rpc.md | 6 +++--- src/rpc.rs | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/json-rpc.md b/doc/json-rpc.md index 4ccc1f0439..afae18c4ee 100644 --- a/doc/json-rpc.md +++ b/doc/json-rpc.md @@ -17,7 +17,7 @@ Methods * [confirmTransaction](#confirmtransaction) * [getAddress](#getaddress) * [getBalance](#getbalance) -* [getAccount](#getaccount) +* [getAccountInfo](#getaccountinfo) * [getLastId](#getlastid) * [getTransactionCount](#gettransactioncount) * [requestAirdrop](#requestairdrop) @@ -97,7 +97,7 @@ curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0", "id":1, " --- -### getAccount +### getAccountInfo Returns all information associated with the account of provided Pubkey ##### Parameters: @@ -113,7 +113,7 @@ The result field will be a JSON object with the following sub fields: ##### Example: ```bash // Request -curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0", "id":1, "method":"getAccount", "params":["FVxxngPx368XvMCoeskdd6U8cZJFsfa1BEtGWqyAxRj4"]}' http://localhost:8899 +curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0", "id":1, "method":"getAccountInfo", "params":["FVxxngPx368XvMCoeskdd6U8cZJFsfa1BEtGWqyAxRj4"]}' http://localhost:8899 // Result {"jsonrpc":"2.0","result":{"contract_id":[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"tokens":1,"userdata":[3,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,20,0,0,0,0,0,0,0,50,48,53,48,45,48,49,45,48,49,84,48,48,58,48,48,58,48,48,90,252,10,7,28,246,140,88,177,98,82,10,227,89,81,18,30,194,101,199,16,11,73,133,20,246,62,114,39,20,113,189,32,50,0,0,0,0,0,0,0,247,15,36,102,167,83,225,42,133,127,82,34,36,224,207,130,109,230,224,188,163,33,213,13,5,117,211,251,65,159,197,51,0,0,0,0,0,0]},"id":1} diff --git a/src/rpc.rs b/src/rpc.rs index 1c0c2b8067..3f8dd8ef59 100644 --- a/src/rpc.rs +++ b/src/rpc.rs @@ -102,8 +102,8 @@ build_rpc_trait! { #[rpc(meta, name = "getTransactionCount")] fn get_transaction_count(&self, Self::Metadata) -> Result; - #[rpc(meta, name = "getAccount")] - fn get_account(&self, Self::Metadata, String) -> Result; + #[rpc(meta, name = "getAccountInfo")] + fn get_account_info(&self, Self::Metadata, String) -> Result; #[rpc(meta, name= "requestAirdrop")] fn request_airdrop(&self, Self::Metadata, String, u64) -> Result; @@ -146,7 +146,7 @@ impl RpcSol for RpcSolImpl { fn get_transaction_count(&self, meta: Self::Metadata) -> Result { meta.request_processor.get_transaction_count() } - fn get_account(&self, meta: Self::Metadata, id: String) -> Result { + fn get_account_info(&self, meta: Self::Metadata, id: String) -> Result { let pubkey_vec = bs58::decode(id) .into_vec() .map_err(|_| Error::invalid_request())?; @@ -154,7 +154,7 @@ impl RpcSol for RpcSolImpl { return Err(Error::invalid_request()); } let pubkey = Pubkey::new(&pubkey_vec); - meta.request_processor.get_account(pubkey) + meta.request_processor.get_account_info(pubkey) } fn request_airdrop(&self, meta: Self::Metadata, id: String, tokens: u64) -> Result { let pubkey_vec = bs58::decode(id) @@ -225,7 +225,7 @@ impl JsonRpcRequestProcessor { fn get_transaction_count(&self) -> Result { Ok(self.bank.transaction_count() as u64) } - fn get_account(&self, pubkey: Pubkey) -> Result { + fn get_account_info(&self, pubkey: Pubkey) -> Result { self.bank .get_account(&pubkey) .ok_or(Error::invalid_request()) @@ -290,7 +290,7 @@ mod tests { assert_eq!(expected, result); let req = format!( - r#"{{"jsonrpc":"2.0","id":1,"method":"getAccount","params":["{}"]}}"#, + r#"{{"jsonrpc":"2.0","id":1,"method":"getAccountInfo","params":["{}"]}}"#, bob_pubkey );