github.com/vipernet-xyz/tm@v0.34.24/rpc/core/routes.go (about)

     1  package core
     2  
     3  import (
     4  	rpc "github.com/vipernet-xyz/tm/rpc/jsonrpc/server"
     5  )
     6  
     7  // TODO: better system than "unsafe" prefix
     8  
     9  // Routes is a map of available routes.
    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", rpc.Cacheable()),
    21  	"genesis":              rpc.NewRPCFunc(Genesis, "", rpc.Cacheable()),
    22  	"genesis_chunked":      rpc.NewRPCFunc(GenesisChunked, "chunk", rpc.Cacheable()),
    23  	"block":                rpc.NewRPCFunc(Block, "height", rpc.Cacheable("height")),
    24  	"block_by_hash":        rpc.NewRPCFunc(BlockByHash, "hash", rpc.Cacheable()),
    25  	"block_results":        rpc.NewRPCFunc(BlockResults, "height", rpc.Cacheable("height")),
    26  	"commit":               rpc.NewRPCFunc(Commit, "height", rpc.Cacheable("height")),
    27  	"check_tx":             rpc.NewRPCFunc(CheckTx, "tx"),
    28  	"tx":                   rpc.NewRPCFunc(Tx, "hash,prove", rpc.Cacheable()),
    29  	"tx_search":            rpc.NewRPCFunc(TxSearch, "query,prove,page,per_page,order_by"),
    30  	"block_search":         rpc.NewRPCFunc(BlockSearch, "query,page,per_page,order_by"),
    31  	"validators":           rpc.NewRPCFunc(Validators, "height,page,per_page", rpc.Cacheable("height")),
    32  	"dump_consensus_state": rpc.NewRPCFunc(DumpConsensusState, ""),
    33  	"consensus_state":      rpc.NewRPCFunc(ConsensusState, ""),
    34  	"consensus_params":     rpc.NewRPCFunc(ConsensusParams, "height", rpc.Cacheable("height")),
    35  	"unconfirmed_txs":      rpc.NewRPCFunc(UnconfirmedTxs, "limit"),
    36  	"num_unconfirmed_txs":  rpc.NewRPCFunc(NumUnconfirmedTxs, ""),
    37  
    38  	// tx broadcast API
    39  	"broadcast_tx_commit": rpc.NewRPCFunc(BroadcastTxCommit, "tx"),
    40  	"broadcast_tx_sync":   rpc.NewRPCFunc(BroadcastTxSync, "tx"),
    41  	"broadcast_tx_async":  rpc.NewRPCFunc(BroadcastTxAsync, "tx"),
    42  
    43  	// abci API
    44  	"abci_query": rpc.NewRPCFunc(ABCIQuery, "path,data,height,prove"),
    45  	"abci_info":  rpc.NewRPCFunc(ABCIInfo, "", rpc.Cacheable()),
    46  
    47  	// evidence API
    48  	"broadcast_evidence": rpc.NewRPCFunc(BroadcastEvidence, "evidence"),
    49  }
    50  
    51  // AddUnsafeRoutes adds unsafe routes.
    52  func AddUnsafeRoutes() {
    53  	// control API
    54  	Routes["dial_seeds"] = rpc.NewRPCFunc(UnsafeDialSeeds, "seeds")
    55  	Routes["dial_peers"] = rpc.NewRPCFunc(UnsafeDialPeers, "peers,persistent,unconditional,private")
    56  	Routes["unsafe_flush_mempool"] = rpc.NewRPCFunc(UnsafeFlushMempool, "")
    57  }