2015-04-07 11:44:25 -07:00
|
|
|
package core
|
|
|
|
|
|
|
|
import (
|
2017-04-28 05:41:08 -07:00
|
|
|
rpc "github.com/tendermint/tendermint/rpc/lib/server"
|
2015-04-07 11:44:25 -07:00
|
|
|
)
|
|
|
|
|
2016-12-12 11:12:13 -08:00
|
|
|
// TODO: better system than "unsafe" prefix
|
2015-04-07 11:44:25 -07:00
|
|
|
var Routes = map[string]*rpc.RPCFunc{
|
2016-03-02 22:18:11 -08:00
|
|
|
// subscribe/unsubscribe are reserved for websocket events.
|
2017-04-28 19:26:17 -07:00
|
|
|
"subscribe": rpc.NewWSRPCFunc(Subscribe, "event"),
|
|
|
|
"unsubscribe": rpc.NewWSRPCFunc(Unsubscribe, "event"),
|
2016-03-02 22:18:11 -08:00
|
|
|
|
2016-12-12 11:12:13 -08:00
|
|
|
// info API
|
2017-04-28 19:26:17 -07:00
|
|
|
"status": rpc.NewRPCFunc(Status, ""),
|
|
|
|
"net_info": rpc.NewRPCFunc(NetInfo, ""),
|
|
|
|
"blockchain": rpc.NewRPCFunc(BlockchainInfo, "minHeight,maxHeight"),
|
|
|
|
"genesis": rpc.NewRPCFunc(Genesis, ""),
|
|
|
|
"block": rpc.NewRPCFunc(Block, "height"),
|
|
|
|
"commit": rpc.NewRPCFunc(Commit, "height"),
|
|
|
|
"tx": rpc.NewRPCFunc(Tx, "hash,prove"),
|
|
|
|
"validators": rpc.NewRPCFunc(Validators, ""),
|
|
|
|
"dump_consensus_state": rpc.NewRPCFunc(DumpConsensusState, ""),
|
|
|
|
"unconfirmed_txs": rpc.NewRPCFunc(UnconfirmedTxs, ""),
|
|
|
|
"num_unconfirmed_txs": rpc.NewRPCFunc(NumUnconfirmedTxs, ""),
|
2016-03-02 22:18:11 -08:00
|
|
|
|
2016-12-12 11:12:13 -08:00
|
|
|
// broadcast API
|
2017-04-28 19:26:17 -07:00
|
|
|
"broadcast_tx_commit": rpc.NewRPCFunc(BroadcastTxCommit, "tx"),
|
|
|
|
"broadcast_tx_sync": rpc.NewRPCFunc(BroadcastTxSync, "tx"),
|
|
|
|
"broadcast_tx_async": rpc.NewRPCFunc(BroadcastTxAsync, "tx"),
|
2016-12-12 11:12:13 -08:00
|
|
|
|
2017-01-12 17:48:10 -08:00
|
|
|
// abci API
|
2017-04-28 19:26:17 -07:00
|
|
|
"abci_query": rpc.NewRPCFunc(ABCIQuery, "path,data,prove"),
|
|
|
|
"abci_info": rpc.NewRPCFunc(ABCIInfo, ""),
|
2017-05-22 04:51:14 -07:00
|
|
|
}
|
2016-08-22 13:00:48 -07:00
|
|
|
|
2017-05-22 04:51:14 -07:00
|
|
|
func AddUnsafeRoutes() {
|
2016-12-12 11:12:13 -08:00
|
|
|
// control API
|
2017-05-22 04:51:14 -07:00
|
|
|
Routes["dial_seeds"] = rpc.NewRPCFunc(UnsafeDialSeeds, "seeds")
|
|
|
|
Routes["unsafe_flush_mempool"] = rpc.NewRPCFunc(UnsafeFlushMempool, "")
|
2017-04-25 14:58:26 -07:00
|
|
|
|
2016-12-12 11:12:13 -08:00
|
|
|
// profiler API
|
2017-05-22 04:51:14 -07:00
|
|
|
Routes["unsafe_start_cpu_profiler"] = rpc.NewRPCFunc(UnsafeStartCPUProfiler, "filename")
|
|
|
|
Routes["unsafe_stop_cpu_profiler"] = rpc.NewRPCFunc(UnsafeStopCPUProfiler, "")
|
|
|
|
Routes["unsafe_write_heap_profile"] = rpc.NewRPCFunc(UnsafeWriteHeapProfile, "filename")
|
2016-03-11 18:45:19 -08:00
|
|
|
}
|