github.com/lazyledger/lazyledger-core@v0.35.0-dev.0.20210613111200-4c651f053571/rpc/core/routes.go (about)

     1  package core
     2  
     3  import (
     4  	rpc "github.com/lazyledger/lazyledger-core/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"),
    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  	"check_tx":                 rpc.NewRPCFunc(CheckTx, "tx"),
    27  	"data_availability_header": rpc.NewRPCFunc(DataAvailabilityHeader, "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  
    37  	// tx broadcast API
    38  	"broadcast_tx_commit": rpc.NewRPCFunc(BroadcastTxCommit, "tx"),
    39  	"broadcast_tx_sync":   rpc.NewRPCFunc(BroadcastTxSync, "tx"),
    40  	"broadcast_tx_async":  rpc.NewRPCFunc(BroadcastTxAsync, "tx"),
    41  
    42  	// abci API
    43  	"abci_query": rpc.NewRPCFunc(ABCIQuery, "path,data,height,prove"),
    44  	"abci_info":  rpc.NewRPCFunc(ABCIInfo, ""),
    45  
    46  	// evidence API
    47  	"broadcast_evidence": rpc.NewRPCFunc(BroadcastEvidence, "evidence"),
    48  }
    49  
    50  // AddUnsafeRoutes adds unsafe routes.
    51  func AddUnsafeRoutes() {
    52  	// control API
    53  	Routes["dial_seeds"] = rpc.NewRPCFunc(UnsafeDialSeeds, "seeds")
    54  	Routes["dial_peers"] = rpc.NewRPCFunc(UnsafeDialPeers, "peers,persistent,unconditional,private")
    55  	Routes["unsafe_flush_mempool"] = rpc.NewRPCFunc(UnsafeFlushMempool, "")
    56  }