github.com/franono/tendermint@v0.32.2-0.20200527150959-749313264ce9/rpc/core/routes.go (about)

     1  package core
     2  
     3  import (
     4  	rpc "github.com/franono/tendermint/rpc/jsonrpc/server"
     5  )
     6  
     7  // TODO: better system than "unsafe" prefix
     8  // NOTE: Amino is registered in rpc/core/types/codec.go.
     9  
    10  var Routes = map[string]*rpc.RPCFunc{
    11  	// subscribe/unsubscribe are reserved for websocket events.
    12  	"subscribe":       rpc.NewWSRPCFunc(Subscribe, "query"),
    13  	"unsubscribe":     rpc.NewWSRPCFunc(Unsubscribe, "query"),
    14  	"unsubscribe_all": rpc.NewWSRPCFunc(UnsubscribeAll, ""),
    15  
    16  	// info API
    17  	"health":               rpc.NewRPCFunc(Health, ""),
    18  	"status":               rpc.NewRPCFunc(Status, ""),
    19  	"net_info":             rpc.NewRPCFunc(NetInfo, ""),
    20  	"blockchain":           rpc.NewRPCFunc(BlockchainInfo, "minHeight,maxHeight"),
    21  	"genesis":              rpc.NewRPCFunc(Genesis, ""),
    22  	"block":                rpc.NewRPCFunc(Block, "height"),
    23  	"block_by_hash":        rpc.NewRPCFunc(BlockByHash, "hash"),
    24  	"block_results":        rpc.NewRPCFunc(BlockResults, "height"),
    25  	"commit":               rpc.NewRPCFunc(Commit, "height"),
    26  	"tx":                   rpc.NewRPCFunc(Tx, "hash,prove"),
    27  	"tx_search":            rpc.NewRPCFunc(TxSearch, "query,prove,page,per_page,order_by"),
    28  	"validators":           rpc.NewRPCFunc(Validators, "height,page,per_page"),
    29  	"dump_consensus_state": rpc.NewRPCFunc(DumpConsensusState, ""),
    30  	"consensus_state":      rpc.NewRPCFunc(ConsensusState, ""),
    31  	"consensus_params":     rpc.NewRPCFunc(ConsensusParams, "height"),
    32  	"unconfirmed_txs":      rpc.NewRPCFunc(UnconfirmedTxs, "limit"),
    33  	"num_unconfirmed_txs":  rpc.NewRPCFunc(NumUnconfirmedTxs, ""),
    34  
    35  	// tx broadcast API
    36  	"broadcast_tx_commit": rpc.NewRPCFunc(BroadcastTxCommit, "tx"),
    37  	"broadcast_tx_sync":   rpc.NewRPCFunc(BroadcastTxSync, "tx"),
    38  	"broadcast_tx_async":  rpc.NewRPCFunc(BroadcastTxAsync, "tx"),
    39  
    40  	// abci API
    41  	"abci_query": rpc.NewRPCFunc(ABCIQuery, "path,data,height,prove"),
    42  	"abci_info":  rpc.NewRPCFunc(ABCIInfo, ""),
    43  
    44  	// evidence API
    45  	"broadcast_evidence": rpc.NewRPCFunc(BroadcastEvidence, "evidence"),
    46  }
    47  
    48  func AddUnsafeRoutes() {
    49  	// control API
    50  	Routes["dial_seeds"] = rpc.NewRPCFunc(UnsafeDialSeeds, "seeds")
    51  	Routes["dial_peers"] = rpc.NewRPCFunc(UnsafeDialPeers, "peers,persistent")
    52  	Routes["unsafe_flush_mempool"] = rpc.NewRPCFunc(UnsafeFlushMempool, "")
    53  
    54  	// profiler API
    55  	Routes["unsafe_start_cpu_profiler"] = rpc.NewRPCFunc(UnsafeStartCPUProfiler, "filename")
    56  	Routes["unsafe_stop_cpu_profiler"] = rpc.NewRPCFunc(UnsafeStopCPUProfiler, "")
    57  	Routes["unsafe_write_heap_profile"] = rpc.NewRPCFunc(UnsafeWriteHeapProfile, "filename")
    58  }