You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.8 KiB

  1. package core
  2. import (
  3. rpc "github.com/tendermint/tendermint/rpc/lib/server"
  4. )
  5. // TODO: better system than "unsafe" prefix
  6. var Routes = map[string]*rpc.RPCFunc{
  7. // subscribe/unsubscribe are reserved for websocket events.
  8. "subscribe": rpc.NewWSRPCFunc(Subscribe, "event"),
  9. "unsubscribe": rpc.NewWSRPCFunc(Unsubscribe, "event"),
  10. // info API
  11. "status": rpc.NewRPCFunc(Status, ""),
  12. "net_info": rpc.NewRPCFunc(NetInfo, ""),
  13. "blockchain": rpc.NewRPCFunc(BlockchainInfo, "minHeight,maxHeight"),
  14. "genesis": rpc.NewRPCFunc(Genesis, ""),
  15. "block": rpc.NewRPCFunc(Block, "height"),
  16. "commit": rpc.NewRPCFunc(Commit, "height"),
  17. "tx": rpc.NewRPCFunc(Tx, "hash,prove"),
  18. "validators": rpc.NewRPCFunc(Validators, "height"),
  19. "dump_consensus_state": rpc.NewRPCFunc(DumpConsensusState, ""),
  20. "unconfirmed_txs": rpc.NewRPCFunc(UnconfirmedTxs, ""),
  21. "num_unconfirmed_txs": rpc.NewRPCFunc(NumUnconfirmedTxs, ""),
  22. // broadcast API
  23. "broadcast_tx_commit": rpc.NewRPCFunc(BroadcastTxCommit, "tx"),
  24. "broadcast_tx_sync": rpc.NewRPCFunc(BroadcastTxSync, "tx"),
  25. "broadcast_tx_async": rpc.NewRPCFunc(BroadcastTxAsync, "tx"),
  26. // abci API
  27. "abci_query": rpc.NewRPCFunc(ABCIQuery, "path,data,prove"),
  28. "abci_info": rpc.NewRPCFunc(ABCIInfo, ""),
  29. }
  30. func AddUnsafeRoutes() {
  31. // control API
  32. Routes["dial_seeds"] = rpc.NewRPCFunc(UnsafeDialSeeds, "seeds")
  33. Routes["unsafe_flush_mempool"] = rpc.NewRPCFunc(UnsafeFlushMempool, "")
  34. // profiler API
  35. Routes["unsafe_start_cpu_profiler"] = rpc.NewRPCFunc(UnsafeStartCPUProfiler, "filename")
  36. Routes["unsafe_stop_cpu_profiler"] = rpc.NewRPCFunc(UnsafeStopCPUProfiler, "")
  37. Routes["unsafe_write_heap_profile"] = rpc.NewRPCFunc(UnsafeWriteHeapProfile, "filename")
  38. }