diff --git a/docs/src/apps/jsonrpc-api.md b/docs/src/apps/jsonrpc-api.md index 6afaeeefb5..1128d54613 100644 --- a/docs/src/apps/jsonrpc-api.md +++ b/docs/src/apps/jsonrpc-api.md @@ -137,7 +137,11 @@ Returns all information associated with the account of provided Pubkey #### Parameters: * `` - Pubkey of account to query, as base-58 encoded string -* `` - (optional) [Commitment](jsonrpc-api.md#configuring-state-commitment) +* `` - (optional) Configuration object containing the following optional fields: + * (optional) [Commitment](jsonrpc-api.md#configuring-state-commitment) + * (optional) `encoding: ` - encoding for Account data, either "binary" or json". + JSON encoding attempts to use program-specific state parsers to return more human-readable and explicit account state data. + If parameter not provided, the default encoding is binary. #### Results: @@ -147,7 +151,7 @@ The result will be an RpcResponse JSON object with `value` equal to: * `` - otherwise, a JSON object containing: * `lamports: `, number of lamports assigned to this account, as a u64 * `owner: `, base-58 encoded Pubkey of the program this account has been assigned to - * `data: `, base-58 encoded data associated with the account + * `data: `, data associated with the account, either as base-58 encoded binary data or JSON format `{: }`, depending on encoding parameter * `executable: `, boolean indicating if the account contains a program \(and is strictly read-only\) * `rentEpoch`: , the epoch at which this account will next owe rent, as u64 @@ -155,10 +159,16 @@ The result will be an RpcResponse JSON object with `value` equal to: ```bash // Request -curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0", "id":1, "method":"getAccountInfo", "params":["2gVkYWexTHR5Hb2aLeQN3tnngvWzisFKXDUPrgMHpdST"]}' http://localhost:8899 +curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0", "id":1, "method":"getAccountInfo", "params":["4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA"]}' http://localhost:8899 // Result -{"jsonrpc":"2.0","result":{"context":{"slot":1},"value":{"executable":false,"owner":"4uQeVj5tqViQh7yWWGStvkEG1Zmhx6uasJtWCJziofM","lamports":1,"data":"Joig2k8Ax4JPMpWhXRyc2jMa7Wejz4X1xqVi3i7QRkmVj1ChUgNc4VNpGUQePJGBAui3c6886peU9GEbjsyeANN8JGStprwLbLwcw5wpPjuQQb9mwrjVmoDQBjj3MzZKgeHn6wmnQ5k8DBFuoCYKWWsJfH2gv9FvCzrN6K1CRcQZzF","rentEpoch":2}},"id":1} +{"jsonrpc":"2.0","result":{"context":{"slot":1},"value":{"data":"11116bv5nS2h3y12kD1yUKeMZvGcKLSjQgX6BeV7u1FrjeJcKfsHRTPuR3oZ1EioKtYGiYxpxMG5vpbZLsbcBYBEmZZcMKaSoGx9JZeAuWf","executable":false,"lamports":1000000000,"owner":"11111111111111111111111111111111","rentEpoch":2}},"id":1} + +// Request +curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0", "id":1, "method":"getAccountInfo", "params":["4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA",{"encoding":"json"}]}' http://localhost:8899 + +// Result +{"jsonrpc":"2.0","result":{"context":{"slot":1},"value":{"data":{"nonce":{"initialized":{"authority":"Bbqg1M4YVVfbhEzwA9SpC9FhsaG83YMTYoR4a8oTDLX","blockhash":"3xLP3jK6dVJwpeGeTDYTwdDK3TKchUf1gYYGHa4sF3XJ","feeCalculator":{"lamportsPerSignature":5000}}}},"executable":false,"lamports":1000000000,"owner":"11111111111111111111111111111111","rentEpoch":2}},"id":1} ``` ### getBalance @@ -779,7 +789,11 @@ Returns all accounts owned by the provided program Pubkey #### Parameters: * `` - Pubkey of program, as base-58 encoded string -* `` - (optional) [Commitment](jsonrpc-api.md#configuring-state-commitment) +* `` - (optional) Configuration object containing the following optional fields: + * (optional) [Commitment](jsonrpc-api.md#configuring-state-commitment) + * (optional) `encoding: ` - encoding for Account data, either "binary" or json". + JSON encoding attempts to use program-specific state parsers to return more human-readable and explicit account state data. + If parameter not provided, the default encoding is binary. #### Results: @@ -789,7 +803,7 @@ The result field will be an array of JSON objects, which will contain: * `account: ` - a JSON object, with the following sub fields: * `lamports: `, number of lamports assigned to this account, as a u64 * `owner: `, base-58 encoded Pubkey of the program this account has been assigned to - * `data: `, base-58 encoded data associated with the account + `data: `, data associated with the account, either as base-58 encoded binary data or JSON format `{: }`, depending on encoding parameter * `executable: `, boolean indicating if the account contains a program \(and is strictly read-only\) * `rentEpoch`: , the epoch at which this account will next owe rent, as u64