github.com/okex/exchain@v1.8.0/libs/tendermint/rpc/core/routes.go (about)

     1  package core
     2  
     3  import (
     4  	rpc "github.com/okex/exchain/libs/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(CM40Block, "height"),
    23  	"cm39_block":               rpc.NewRPCFunc(Block, "height"),
    24  	"block_by_hash":            rpc.NewRPCFunc(BlockByHash, "hash"),
    25  	"block_info":               rpc.NewRPCFunc(BlockInfo, "height"),
    26  	"block_results":            rpc.NewRPCFunc(BlockResults, "height"),
    27  	"commit":                   rpc.NewRPCFunc(CommitIBC, "height"),
    28  	"tx":                       rpc.NewRPCFunc(Tx, "hash,prove"),
    29  	"tx_search":                rpc.NewRPCFunc(TxSearch, "query,prove,page,per_page,order_by"),
    30  	"validators":               rpc.NewRPCFunc(Validators, "height,page,per_page"),
    31  	"dump_consensus_state":     rpc.NewRPCFunc(DumpConsensusState, ""),
    32  	"consensus_state":          rpc.NewRPCFunc(ConsensusState, ""),
    33  	"consensus_params":         rpc.NewRPCFunc(ConsensusParams, "height"),
    34  	"unconfirmed_txs":          rpc.NewRPCFunc(UnconfirmedTxs, "limit"),
    35  	"num_unconfirmed_txs":      rpc.NewRPCFunc(NumUnconfirmedTxs, ""),
    36  	"user_unconfirmed_txs":     rpc.NewRPCFunc(TmUserUnconfirmedTxs, "address,limit"),
    37  	"user_num_unconfirmed_txs": rpc.NewRPCFunc(TmUserNumUnconfirmedTxs, "address"),
    38  	"get_address_list":         rpc.NewRPCFunc(TmGetAddressList, ""),
    39  	"block_search":             rpc.NewRPCFunc(BlockSearch, "query,page,per_page,order_by"),
    40  
    41  	// tx broadcast API
    42  	"broadcast_tx_commit": rpc.NewRPCFunc(BroadcastTxCommit, "tx"),
    43  	"broadcast_tx_sync":   rpc.NewRPCFunc(BroadcastTxSync, "tx"),
    44  	"broadcast_tx_async":  rpc.NewRPCFunc(BroadcastTxAsync, "tx"),
    45  
    46  	// abci API
    47  	"abci_query": rpc.NewRPCFunc(ABCIQuery, "path,data,height,prove"),
    48  	"abci_info":  rpc.NewRPCFunc(ABCIInfo, ""),
    49  
    50  	// evidence API
    51  	"broadcast_evidence": rpc.NewRPCFunc(BroadcastEvidence, "evidence"),
    52  
    53  	"tx_simulate_gas": rpc.NewRPCFunc(TxSimulateGasCost, "hash"),
    54  
    55  	"get_enable_delete_min_gp_tx": rpc.NewRPCFunc(GetEnableDeleteMinGPTx, ""),
    56  
    57  	"pending_txs": rpc.NewRPCFunc(GetPendingTxs, ""),
    58  }
    59  
    60  func AddUnsafeRoutes() {
    61  	// control API
    62  	Routes["dial_seeds"] = rpc.NewRPCFunc(UnsafeDialSeeds, "seeds")
    63  	Routes["dial_peers"] = rpc.NewRPCFunc(UnsafeDialPeers, "peers,persistent")
    64  	Routes["unsafe_flush_mempool"] = rpc.NewRPCFunc(UnsafeFlushMempool, "")
    65  
    66  	// profiler API
    67  	Routes["unsafe_start_cpu_profiler"] = rpc.NewRPCFunc(UnsafeStartCPUProfiler, "filename")
    68  	Routes["unsafe_stop_cpu_profiler"] = rpc.NewRPCFunc(UnsafeStopCPUProfiler, "")
    69  	Routes["unsafe_write_heap_profile"] = rpc.NewRPCFunc(UnsafeWriteHeapProfile, "filename")
    70  }