Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

Commit

Permalink
doc: updated API doc
Browse files Browse the repository at this point in the history
  • Loading branch information
itzmeanjan committed Apr 12, 2021
1 parent d484e5c commit 1c7c7f8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ make run

## Usage

Given block number ( as decimal number/ string ) returns confidence obtained by light client for this block
1. Given block number ( as decimal number/ string ) returns confidence obtained by light client for this block

```bash
curl -s -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","method":"get_blockConfidence","params": {"number": 223}, "id": 1}' http://localhost:7000/v1/json-rpc | jq
Expand All @@ -65,6 +65,7 @@ curl -s -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","method":"get_b
}
}
```
---

For malformed block numbers, following will be responded with

Expand All @@ -86,7 +87,9 @@ curl -s -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","method":"get_b

> Note : You'll receive `0 %` in response, when no verification is yet done for requested block.
Get progress of syncing using
---

2. Get progress using

```bash
curl -s -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","method":"get_progress", "id": 1}' http://localhost:7000/v1/json-rpc | jq
Expand All @@ -97,8 +100,11 @@ Get progress of syncing using
"jsonrpc": "2.0",
"id": 1,
"result": {
"done": "6",
"target": "13341"
"done": "4",
"target": "13542",
"rate": "0.57 block(s) /second",
"eta": "6 hours, 36 minutes, 26.266 seconds",
"uptime": "7.028 seconds"
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion src/rpc.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ server.addMethod('get_progress', _ => {
return {
done: state.done().toString(),
target: state.latest.toString(),
rate: `${state.rate().toFixed(2)} block(s) /second`,
rate: `${state.rate().toFixed(2)} block(s)/ second`,
eta: state.eta(),
uptime: state.uptime()
}
Expand Down

0 comments on commit 1c7c7f8

Please sign in to comment.