Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
Apply review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyera Eulberg committed Mar 18, 2021
1 parent f3d474f commit 3b10f62
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion client/src/rpc_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ pub trait EncodingConfig {
pub struct RpcConfirmedBlockConfig {
pub encoding: Option<UiTransactionEncoding>,
pub transaction_details: Option<TransactionDetails>,
pub no_rewards: Option<bool>,
pub rewards: Option<bool>,
}

impl EncodingConfig for RpcConfirmedBlockConfig {
Expand Down
6 changes: 3 additions & 3 deletions core/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ impl JsonRpcRequestProcessor {
.unwrap_or_default();
let encoding = config.encoding.unwrap_or(UiTransactionEncoding::Json);
let transaction_details = config.transaction_details.unwrap_or_default();
let show_rewards = !config.no_rewards.unwrap_or_default();
let show_rewards = config.rewards.unwrap_or(true);
if self.config.enable_rpc_transaction_history
&& slot
<= self
Expand Down Expand Up @@ -5176,7 +5176,7 @@ pub mod tests {
json!(RpcConfirmedBlockConfig {
encoding: None,
transaction_details: Some(TransactionDetails::Signatures),
no_rewards: Some(true),
rewards: Some(false),
})
);
let res = io.handle_request_sync(&req, meta.clone());
Expand All @@ -5196,7 +5196,7 @@ pub mod tests {
json!(RpcConfirmedBlockConfig {
encoding: None,
transaction_details: Some(TransactionDetails::None),
no_rewards: Some(false),
rewards: Some(true),
})
);
let res = io.handle_request_sync(&req, meta);
Expand Down
10 changes: 5 additions & 5 deletions docs/src/developing/clients/jsonrpc-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +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 "all", "signatures", or "none". If parameter not provided, the default detail level is "all".
- (optional) `noRewards: bool` - whether to skip returning rewards for epoch-boundary blocks. If parameter not provided, the default returns rewards.
- (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:

Expand All @@ -472,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>` - present if "all" transaction details are requested; 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)
Expand All @@ -487,7 +487,7 @@ The result field will be an object with the following fields:
- `"Ok": <null>` - Transaction was successful
- `"Err": <ERR>` - Transaction failed with TransactionError
- `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 not suppressed; an array of JSON objects containing:
- `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
Expand All @@ -499,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","transactionDetails":"all","noRewards":true}]}
{"jsonrpc": "2.0","id":1,"method":"getConfirmedBlock","params":[430, {"encoding": "json","transactionDetails":"full","rewards":false}]}
'
```

Expand Down
6 changes: 3 additions & 3 deletions transaction-status/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ impl ConfirmedBlock {
show_rewards: bool,
) -> UiConfirmedBlock {
let (transactions, signatures) = match transaction_details {
TransactionDetails::All => (
TransactionDetails::Full => (
Some(
self.transactions
.into_iter()
Expand Down Expand Up @@ -449,14 +449,14 @@ impl From<EncodedConfirmedBlock> for UiConfirmedBlock {
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum TransactionDetails {
All,
Full,
Signatures,
None,
}

impl Default for TransactionDetails {
fn default() -> Self {
Self::All
Self::Full
}
}

Expand Down

0 comments on commit 3b10f62

Please sign in to comment.