Add missing doc and route for Node API (#3059)

* Add missing doc and route for Node API
This commit is contained in:
Quentin Le Sceller 2019-09-26 11:44:44 -04:00 committed by GitHub
parent fc4e2985d5
commit 213daf72ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 62 additions and 0 deletions

View file

@ -103,6 +103,7 @@ pub fn build_router(
"get chain".to_string(),
"post chain/compact".to_string(),
"get chain/validate".to_string(),
"get chain/kernels/xxx?min_height=yyy&max_height=zzz".to_string(),
"get chain/outputs/byids?id=xxx,yyy,zzz".to_string(),
"get chain/outputs/byheight?start_height=101&end_height=200".to_string(),
"get status".to_string(),

View file

@ -10,6 +10,7 @@
1. [GET Chain](#get-chain)
1. [POST Chain Compact](#post-chain-compact)
1. [GET Chain Validate](#get-chain-validate)
1. [GET Chain Kernel by Commitment](#get-chain-kernel-by-commitment)
1. [GET Chain Outputs by IDs](#get-chain-outputs-by-ids)
1. [GET Chain Outputs by Height](#get-chain-outputs-by-height)
1. [Status Endpoint](#status-endpoint)
@ -324,6 +325,64 @@ Trigger a validation of the chain state.
});
```
### GET Chain Kernel By Commitment
Look up an on-chain kernel and the height of the block it is included in. By default `min_height` is 0.
* **URL**
* /v1/chain/kernels/xxx?min_height=yyy&max_height=zzz
* **Method:**
`GET`
* **URL Params**
**Required:**
`commitment=[string]`
**Optional:**
`min_height=[number]`
`max_height=[number]`
* **Data Params**
None
* **Success Response:**
* **Code:** 200
* **Content:**
| Field | Type | Description |
|:-------------|:-------|:--------------------------------------------------------------------------------|
| tx_kernel | object | Transaction Kernel |
| - features | object | The type of output Coinbase|Transaction |
| - features | object | The kernel features. Can either be `Plain`, `Coinbase` or `HeightLocked`. |
| - excess | string | The kernel excess also called commitment |
| - excess_sig | string | The excess signature |
| height | string | THe height of the block this kernel is included in |
| mmr_height | string | Position in the MMR |
* **Error Response:**
* **Code:** 404 or 500
* **Content:** `[]`
* **Sample Call:**
```javascript
$.ajax({
url: "/v1/chain/kernels/0939fe3dc6a35350da91c6288138b7a257e0c0322eae30bda3938229d649e2e642?max_height=324300",
dataType: "json",
type : "GET",
success : function(r) {
console.log(r);
}
});
```
### GET Chain Outputs By IDs
Retrieves details about specifics outputs. Supports retrieval of multiple outputs in a single request.
@ -478,6 +537,8 @@ Returns various information about the node and the network
| last_block_pushed | string | Last block pushed to the fork |
| prev_block_to_last | string | Block previous to last |
| total_difficulty | number | Total difficulty accumulated on that fork since genesis block |
| sync_status | string | The current sync status |
| sync_info | object | Additional sync information. This field is optional. |
* **Error Response:**