Skip to content

Commit

Permalink
Add missing doc and route for Node API (#3059)
Browse files Browse the repository at this point in the history
* Add missing doc and route for Node API
  • Loading branch information
quentinlesceller authored Sep 26, 2019
1 parent fc4e298 commit 213daf7
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
1 change: 1 addition & 0 deletions api/src/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
61 changes: 61 additions & 0 deletions doc/api/node_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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:**

Expand Down

0 comments on commit 213daf7

Please sign in to comment.