github.com/fiagdao/tendermint@v0.32.11-0.20220824195748-2087fcc480c1/rpc/core/routes.go (about)

     1  package core
     2  
     3  import (
     4  	rpc "github.com/tendermint/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  	"consensus_reactor_status": rpc.NewRPCFunc(ConsensusReactorStatus, ""),
    18  	"health":                   rpc.NewRPCFunc(Health, ""),
    19  	"status":                   rpc.NewRPCFunc(Status, ""),
    20  	"net_info":                 rpc.NewRPCFunc(NetInfo, ""),
    21  	"blockchain":               rpc.NewRPCFunc(BlockchainInfo, "minHeight,maxHeight"),
    22  	"genesis":                  rpc.NewRPCFunc(Genesis, ""),
    23  	"block":                    rpc.NewRPCFunc(Block, "height"),
    24  	"block_by_hash":            rpc.NewRPCFunc(BlockByHash, "hash"),
    25  	"block_results":            rpc.NewRPCFunc(BlockResults, "height"),
    26  	"commit":                   rpc.NewRPCFunc(Commit, "height"),
    27  	"tx":                       rpc.NewRPCFunc(Tx, "hash,prove"),
    28  	"tx_search":                rpc.NewRPCFunc(TxSearch, "query,prove,page,per_page,order_by"),
    29  	"validators":               rpc.NewRPCFunc(Validators, "height,page,per_page"),
    30  	"dump_consensus_state":     rpc.NewRPCFunc(DumpConsensusState, ""),
    31  	"consensus_state":          rpc.NewRPCFunc(ConsensusState, ""),
    32  	"consensus_params":         rpc.NewRPCFunc(ConsensusParams, "height"),
    33  	"unconfirmed_txs":          rpc.NewRPCFunc(UnconfirmedTxs, "limit"),
    34  	"num_unconfirmed_txs":      rpc.NewRPCFunc(NumUnconfirmedTxs, ""),
    35  
    36  	// tx broadcast API
    37  	"broadcast_tx_commit": rpc.NewRPCFunc(BroadcastTxCommit, "tx"),
    38  	"broadcast_tx_sync":   rpc.NewRPCFunc(BroadcastTxSync, "tx"),
    39  	"broadcast_tx_async":  rpc.NewRPCFunc(BroadcastTxAsync, "tx"),
    40  
    41  	// abci API
    42  	"abci_query": rpc.NewRPCFunc(ABCIQuery, "path,data,height,prove"),
    43  	"abci_info":  rpc.NewRPCFunc(ABCIInfo, ""),
    44  
    45  	// evidence API
    46  	"broadcast_evidence": rpc.NewRPCFunc(BroadcastEvidence, "evidence"),
    47  }
    48  
    49  func AddUnsafeRoutes() {
    50  	// control API
    51  	Routes["dial_seeds"] = rpc.NewRPCFunc(UnsafeDialSeeds, "seeds")
    52  	Routes["dial_peers"] = rpc.NewRPCFunc(UnsafeDialPeers, "peers,persistent")
    53  	Routes["unsafe_flush_mempool"] = rpc.NewRPCFunc(UnsafeFlushMempool, "")
    54  
    55  	// profiler API
    56  	Routes["unsafe_start_cpu_profiler"] = rpc.NewRPCFunc(UnsafeStartCPUProfiler, "filename")
    57  	Routes["unsafe_stop_cpu_profiler"] = rpc.NewRPCFunc(UnsafeStopCPUProfiler, "")
    58  	Routes["unsafe_write_heap_profile"] = rpc.NewRPCFunc(UnsafeWriteHeapProfile, "filename")
    59  }