Rename getAccount to getAccountInfo
This commit is contained in:
@ -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}
|
||||
|
12
src/rpc.rs
12
src/rpc.rs
@ -102,8 +102,8 @@ build_rpc_trait! {
|
||||
#[rpc(meta, name = "getTransactionCount")]
|
||||
fn get_transaction_count(&self, Self::Metadata) -> Result<u64>;
|
||||
|
||||
#[rpc(meta, name = "getAccount")]
|
||||
fn get_account(&self, Self::Metadata, String) -> Result<Account>;
|
||||
#[rpc(meta, name = "getAccountInfo")]
|
||||
fn get_account_info(&self, Self::Metadata, String) -> Result<Account>;
|
||||
|
||||
#[rpc(meta, name= "requestAirdrop")]
|
||||
fn request_airdrop(&self, Self::Metadata, String, u64) -> Result<String>;
|
||||
@ -146,7 +146,7 @@ impl RpcSol for RpcSolImpl {
|
||||
fn get_transaction_count(&self, meta: Self::Metadata) -> Result<u64> {
|
||||
meta.request_processor.get_transaction_count()
|
||||
}
|
||||
fn get_account(&self, meta: Self::Metadata, id: String) -> Result<Account> {
|
||||
fn get_account_info(&self, meta: Self::Metadata, id: String) -> Result<Account> {
|
||||
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<String> {
|
||||
let pubkey_vec = bs58::decode(id)
|
||||
@ -225,7 +225,7 @@ impl JsonRpcRequestProcessor {
|
||||
fn get_transaction_count(&self) -> Result<u64> {
|
||||
Ok(self.bank.transaction_count() as u64)
|
||||
}
|
||||
fn get_account(&self, pubkey: Pubkey) -> Result<Account> {
|
||||
fn get_account_info(&self, pubkey: Pubkey) -> Result<Account> {
|
||||
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
|
||||
);
|
||||
|
||||
|
Reference in New Issue
Block a user