github.com/badrootd/nibiru-cometbft@v0.37.5-0.20240307173500-2a75559eee9b/rpc/core/routes.go (about) 1 package core 2 3 import ( 4 rpc "github.com/badrootd/nibiru-cometbft/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 "header": rpc.NewRPCFunc(Header, "height", rpc.Cacheable("height")), 28 "header_by_hash": rpc.NewRPCFunc(HeaderByHash, "hash", rpc.Cacheable()), 29 "check_tx": rpc.NewRPCFunc(CheckTx, "tx"), 30 "tx": rpc.NewRPCFunc(Tx, "hash,prove", rpc.Cacheable()), 31 "tx_search": rpc.NewRPCFunc(TxSearch, "query,prove,page,per_page,order_by"), 32 "block_search": rpc.NewRPCFunc(BlockSearch, "query,page,per_page,order_by"), 33 "validators": rpc.NewRPCFunc(Validators, "height,page,per_page", rpc.Cacheable("height")), 34 "dump_consensus_state": rpc.NewRPCFunc(DumpConsensusState, ""), 35 "consensus_state": rpc.NewRPCFunc(ConsensusState, ""), 36 "consensus_params": rpc.NewRPCFunc(ConsensusParams, "height", rpc.Cacheable("height")), 37 "unconfirmed_txs": rpc.NewRPCFunc(UnconfirmedTxs, "limit"), 38 "num_unconfirmed_txs": rpc.NewRPCFunc(NumUnconfirmedTxs, ""), 39 40 // tx broadcast API 41 "broadcast_tx_commit": rpc.NewRPCFunc(BroadcastTxCommit, "tx"), 42 "broadcast_tx_sync": rpc.NewRPCFunc(BroadcastTxSync, "tx"), 43 "broadcast_tx_async": rpc.NewRPCFunc(BroadcastTxAsync, "tx"), 44 45 // abci API 46 "abci_query": rpc.NewRPCFunc(ABCIQuery, "path,data,height,prove"), 47 "abci_info": rpc.NewRPCFunc(ABCIInfo, "", rpc.Cacheable()), 48 49 // evidence API 50 "broadcast_evidence": rpc.NewRPCFunc(BroadcastEvidence, "evidence"), 51 } 52 53 // AddUnsafeRoutes adds unsafe routes. 54 func AddUnsafeRoutes() { 55 // control API 56 Routes["dial_seeds"] = rpc.NewRPCFunc(UnsafeDialSeeds, "seeds") 57 Routes["dial_peers"] = rpc.NewRPCFunc(UnsafeDialPeers, "peers,persistent,unconditional,private") 58 Routes["unsafe_flush_mempool"] = rpc.NewRPCFunc(UnsafeFlushMempool, "") 59 }