Skip to content

Commit

Permalink
Merge pull request #4 from AleoHQ/feat/docs-rpc
Browse files Browse the repository at this point in the history
Fix get_blocks endpoint + add documentation
  • Loading branch information
howardwu authored Oct 29, 2021
2 parents a1fabdb + 55130e4 commit d5a4bea
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/network/rpc/documentation/public_endpoints/getblock.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Returns the block given the block height.
### Arguments

| Parameter | Type | Required | Description |
|:-------------- |:------:|:--------:|:---------------------------------------:|
|:--------------:|:------:|:--------:|:---------------------------------------:|
| `block_height` | number | Yes | The block height of the requested block |

### Response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Returns the block hash for the given block height, if it exists in the canonical
### Arguments

| Parameter | Type | Required | Description |
|:-------------- |:------:|:--------:|:--------------------------------------------:|
|:--------------:|:------:|:--------:|:--------------------------------------------:|
| `block_height` | number | Yes | The block height of the requested block hash |

### Response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Returns the block height for the given the block hash.
### Arguments

| Parameter | Type | Required | Description |
|:------------ |:------:|:--------:|:--------------------------------------------:|
|:------------:|:------:|:--------:|:--------------------------------------------:|
| `block_hash` | number | Yes | The block hash of the requested block height |

### Response
Expand Down
31 changes: 31 additions & 0 deletions src/network/rpc/documentation/public_endpoints/getblocks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Returns up to `MAX_RESPONSE_BLOCKS` blocks from the given `start_block_height` to `end_block_height`.

### Arguments

| Parameter | Type | Required | Description |
|:--------------------:|:------:|:--------:|:-----------------------------------------------------------:|
| `start_block_height` | number | Yes | The block height of the first requested block in the array. |
| `end_block_height` | number | Yes | The block height of the last requested block in the array. |

### Response

| Parameter | Type | Description |
|:---------------------:|:------:|:----------------------------------------:|
| `None` | array | The array of requested blocks |


#### JSON Block object
Each block in the array will contain the following:

| Parameter | Type | Description |
|:---------------------------:|:------:|:-----------------------------------------------------------------:|
| `block_hash` | string | The hash of the block |
| `previous_block_hash` | string | The hash of the previous block |
| `header` | number | The block header containing the state of the ledger at this block |
| `transactions` | number | The list of transactions included in the block |


### Example
```ignore
curl --data-binary '{"jsonrpc": "2.0", "id":"documentation", "method": "getblocks", "params": [1, 50] }' -H 'content-type: application/json' http://127.0.0.1:3030/
```
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Returns a ciphertext given the ciphertext ID.
### Arguments

| Parameter | Type | Required | Description |
|:--------------- |:------:|:--------:|:--------------------------------------------------:|
|:---------------:|:------:|:--------:|:--------------------------------------------------:|
| `ciphertext_id` | string | Yes | The ciphertext id of the requested ciphertext info |

### Response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Returns a transaction given the transaction ID.
### Arguments

| Parameter | Type | Required | Description |
|:---------------- |:------:|:--------:|:-----------------------------------------------:|
|:----------------:|:------:|:--------:|:-----------------------------------------------:|
| `transaction_id` | string | Yes | The transaction id of the requested transaction |

### Response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Returns a transition given the transition ID.
### Arguments

| Parameter | Type | Required | Description |
|:--------------- |:------:|:--------:|:--------------------------------------------------:|
|:---------------:|:------:|:--------:|:--------------------------------------------------:|
| `transition_id` | string | Yes | The transition id of the requested transition info |

### Response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ If the given transaction is valid, it is added to the memory pool and propagated
### Arguments

| Parameter | Type | Required | Description |
|:----------------- |:------:|:--------:|:------------------------------------:|
|:-----------------:|:------:|:--------:|:------------------------------------:|
| `transaction_hex` | string | Yes | The raw transaction hex to broadcast |

### Response
Expand Down

0 comments on commit d5a4bea

Please sign in to comment.