rpc: Add config options limiting getConfirmedBlock response data (#15970)
* Add new confirmed block struct * Add RpcConfirmedBlockConfig options * Configure block response based on new options * Add client api, use in cli fetch_epoch_rewards * Update docs * Apply review suggestions
This commit is contained in:
@ -460,6 +460,8 @@ Returns identity and transaction information about a confirmed block in the ledg
|
||||
- `<object>` - (optional) Configuration object containing the following optional fields:
|
||||
- (optional) `encoding: <string>` - encoding for each returned Transaction, either "json", "jsonParsed", "base58" (*slow*), "base64". If parameter not provided, the default encoding is "json".
|
||||
"jsonParsed" encoding attempts to use program-specific instruction parsers to return more human-readable and explicit data in the `transaction.message.instructions` list. If "jsonParsed" is requested but a parser cannot be found, the instruction falls back to regular JSON encoding (`accounts`, `data`, and `programIdIndex` fields).
|
||||
- (optional) `transactionDetails: <string>` - level of transaction detail to return, either "full", "signatures", or "none". If parameter not provided, the default detail level is "full".
|
||||
- (optional) `rewards: bool` - whether to populate the `rewards` array. If parameter not provided, the default includes rewards.
|
||||
|
||||
#### Results:
|
||||
|
||||
@ -470,7 +472,7 @@ The result field will be an object with the following fields:
|
||||
- `blockhash: <string>` - the blockhash of this block, as base-58 encoded string
|
||||
- `previousBlockhash: <string>` - the blockhash of this block's parent, as base-58 encoded string; if the parent block is not available due to ledger cleanup, this field will return "11111111111111111111111111111111"
|
||||
- `parentSlot: <u64>` - the slot index of this block's parent
|
||||
- `transactions: <array>` - an array of JSON objects containing:
|
||||
- `transactions: <array>` - present if "full" transaction details are requested; an array of JSON objects containing:
|
||||
- `transaction: <object|[string,encoding]>` - [Transaction](#transaction-structure) object, either in JSON format or encoded binary data, depending on encoding parameter
|
||||
- `meta: <object>` - transaction status metadata object, containing `null` or:
|
||||
- `err: <object | null>` - Error if transaction failed, null if transaction succeeded. [TransactionError definitions](https://github.com/solana-labs/solana/blob/master/sdk/src/transaction.rs#L24)
|
||||
@ -484,7 +486,8 @@ The result field will be an object with the following fields:
|
||||
- DEPRECATED: `status: <object>` - Transaction status
|
||||
- `"Ok": <null>` - Transaction was successful
|
||||
- `"Err": <ERR>` - Transaction failed with TransactionError
|
||||
- `rewards: <array>` - an array of JSON objects containing:
|
||||
- `signatures: <array>` - present if "signatures" are requested for transaction details; an array of signatures strings, corresponding to the transaction order in the block
|
||||
- `rewards: <array>` - present if rewards are requested; an array of JSON objects containing:
|
||||
- `pubkey: <string>` - The public key, as base-58 encoded string, of the account that received the reward
|
||||
- `lamports: <i64>`- number of reward lamports credited or debited by the account, as a i64
|
||||
- `postBalance: <u64>` - account balance in lamports after the reward was applied
|
||||
@ -496,7 +499,7 @@ The result field will be an object with the following fields:
|
||||
Request:
|
||||
```bash
|
||||
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
|
||||
{"jsonrpc": "2.0","id":1,"method":"getConfirmedBlock","params":[430, {"encoding": "json"}]}
|
||||
{"jsonrpc": "2.0","id":1,"method":"getConfirmedBlock","params":[430, {"encoding": "json","transactionDetails":"full","rewards":false}]}
|
||||
'
|
||||
```
|
||||
|
||||
@ -509,7 +512,6 @@ Result:
|
||||
"blockhash": "3Eq21vXNB5s86c62bVuUfTeaMif1N2kUqRPBmGRJhyTA",
|
||||
"parentSlot": 429,
|
||||
"previousBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B",
|
||||
"rewards": [],
|
||||
"transactions": [
|
||||
{
|
||||
"meta": {
|
||||
|
Reference in New Issue
Block a user