Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating JSON-RPC API with info_get_reward method #1458

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions source/docs/casper/developers/json-rpc/json-rpc-informational.md
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,75 @@ If the `execution_results` field is empty, it means that the network processed t

</details>

## info_get_reward {#info-get-reward}

This method returns the reward for a given era and a validator or delegator.

|Parameter|Type|Description|
|---------|----|-----------|
|[validator](types_chain.md#publickey)|String|The public key of the validator.|
|[era_identifier](types_chain.md#eraientifier)|Object|The era identifier. If `None`, the last finalized era is used.|
|[delegator](types_chain.md#publickey)|String|The public key of the delegator. If `Some`, the rewards for the delegator are returned. If `None`, the rewards for the validator are returned.|

<details>

<summary>Example info_get_reward request</summary>

```bash

{
"id": 1,
"jsonrpc": "2.0",
"method": "info_get_reward",
"params": [
{
"name": "era_identifier",
"value": {
"Era": 1
}
},
{
"name": "validator",
"value": "01d9bf2148748a85c89da5aad8ee0b0fc2d105fd39d41a4c796536354f0ae2900c"
},
{
"name": "delegator",
"value": "01d9bf2148748a85c89da5aad8ee0b0fc2d105fd39d41a4c796536354f0ae2900c"
}
],
}

```

</details>

### `info_get_reward_result`

|Parameter|Type|Description|
|---------|----|-----------|
|api_version|String|The RPC API version.|
|[era_id](types_chain.md#eraid)|Integer|The era for which the reward was calculated.|
|[reward_amount](types_chain.md#U512)|Integer|The total reward amount in the requested era.|

<details>

<summary>Example info_get_reward result</summary>

```bash

{
"id": 1,
"jsonrpc": "2.0",
"value": {
"api_version": "2.0.0",
"reward_amount": "42",
"era_id": 1
}

```

</details>

## info_get_transaction {#info-get-transaction}

This method retrieves a transaction from a network. It requires a `transaction_hash` to query the Deploy.
Expand Down
10 changes: 10 additions & 0 deletions source/docs/casper/developers/json-rpc/types_chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,16 @@ Required Parameters:

Era ID newtype.

## EraIdentifier {#eraidentifier}

Identifier for an era.

One of:

* [`Era`](#eraid)

* [`Block`](#blockidentifier)

## EraInfo {#erainfo}

Auction metadata. Intended to be recorded at each era.
Expand Down
Loading