wrote docs for rpc methods [ci skip]

for all of them except unsafe
This commit is contained in:
Anton Kaliaev
2017-06-01 16:09:30 +03:00
committed by Zach Ramsay
parent e9b7221292
commit 83ec9f773a
8 changed files with 715 additions and 19 deletions

View File

@ -6,8 +6,33 @@ import (
ctypes "github.com/tendermint/tendermint/rpc/core/types"
)
//-----------------------------------------------------------------------------
// Get network info.
//
// ```shell
// curl 'localhost:46657/net_info'
// ```
//
// ```go
// client := client.NewHTTP("tcp://0.0.0.0:46657", "/websocket")
// info, err := client.NetInfo()
// ```
//
// > The above command returns JSON structured like this:
//
// ```json
// {
// "error": "",
// "result": {
// "peers": [],
// "listeners": [
// "Listener(@10.0.2.15:46656)"
// ],
// "listening": true
// },
// "id": "",
// "jsonrpc": "2.0"
// }
// ```
func NetInfo() (*ctypes.ResultNetInfo, error) {
listening := p2pSwitch.IsListening()
listeners := []string{}
@ -29,9 +54,6 @@ func NetInfo() (*ctypes.ResultNetInfo, error) {
}, nil
}
//-----------------------------------------------------------------------------
// Dial given list of seeds
func UnsafeDialSeeds(seeds []string) (*ctypes.ResultDialSeeds, error) {
if len(seeds) == 0 {
@ -46,8 +68,43 @@ func UnsafeDialSeeds(seeds []string) (*ctypes.ResultDialSeeds, error) {
return &ctypes.ResultDialSeeds{"Dialing seeds in progress. See /net_info for details"}, nil
}
//-----------------------------------------------------------------------------
// Get genesis file.
//
// ```shell
// curl 'localhost:46657/genesis'
// ```
//
// ```go
// client := client.NewHTTP("tcp://0.0.0.0:46657", "/websocket")
// genesis, err := client.Genesis()
// ```
//
// > The above command returns JSON structured like this:
//
// ```json
// {
// "error": "",
// "result": {
// "genesis": {
// "app_hash": "",
// "validators": [
// {
// "name": "",
// "amount": 10,
// "pub_key": {
// "data": "68DFDA7E50F82946E7E8546BED37944A422CD1B831E70DF66BA3B8430593944D",
// "type": "ed25519"
// }
// }
// ],
// "chain_id": "test-chain-6UTNIN",
// "genesis_time": "2017-05-29T15:05:41.671Z"
// }
// },
// "id": "",
// "jsonrpc": "2.0"
// }
// ```
func Genesis() (*ctypes.ResultGenesis, error) {
return &ctypes.ResultGenesis{genDoc}, nil
}