Documentation
¶
Index ¶
- Constants
- Variables
- func ABCIInfo(ctx *rpctypes.Context) (*ctypes.ResultABCIInfo, error)
- func ABCIQuery(ctx *rpctypes.Context, path string, data bytes.HexBytes, height int64, ...) (*ctypes.ResultABCIQuery, error)
- func Block(ctx *rpctypes.Context, heightPtr *int64) (*ctypes.ResultBlock, error)
- func BlockByHash(ctx *rpctypes.Context, hash []byte) (*ctypes.ResultBlock, error)
- func BlockResults(ctx *rpctypes.Context, heightPtr *int64) (*ctypes.ResultBlockResults, error)
- func BlockSearch(ctx *rpctypes.Context, query string, pagePtr, perPagePtr *int, orderBy string) (*ctypes.ResultBlockSearch, error)
- func BlockchainInfo(ctx *rpctypes.Context, minHeight, maxHeight int64) (*ctypes.ResultBlockchainInfo, error)
- func BroadcastEvidence(ctx *rpctypes.Context, ev cmttypes.Evidence) (*ctypes.ResultBroadcastEvidence, error)
- func BroadcastTxAsync(ctx *rpctypes.Context, tx cmttypes.Tx) (*ctypes.ResultBroadcastTx, error)
- func BroadcastTxCommit(ctx *rpctypes.Context, tx cmttypes.Tx) (*ctypes.ResultBroadcastTxCommit, error)
- func BroadcastTxSync(ctx *rpctypes.Context, tx cmttypes.Tx) (*ctypes.ResultBroadcastTx, error)
- func CheckTx(ctx *rpctypes.Context, tx cmttypes.Tx) (*ctypes.ResultCheckTx, error)
- func Commit(ctx *rpctypes.Context, heightPtr *int64) (*ctypes.ResultCommit, error)
- func ConsensusParams(ctx *rpctypes.Context, heightPtr *int64) (*coretypes.ResultConsensusParams, error)
- func ConsensusState(ctx *rpctypes.Context) (*coretypes.ResultConsensusState, error)
- func DumpConsensusState(ctx *rpctypes.Context) (*coretypes.ResultDumpConsensusState, error)
- func Genesis(ctx *rpctypes.Context) (*coretypes.ResultGenesis, error)
- func GenesisChunked(_ *rpctypes.Context, chunk uint) (*coretypes.ResultGenesisChunk, error)
- func Header(ctx *rpctypes.Context, heightPtr *int64) (*ctypes.ResultHeader, error)
- func HeaderByHash(ctx *rpctypes.Context, hash cmbytes.HexBytes) (*ctypes.ResultHeader, error)
- func Health(ctx *rpctypes.Context) (*ctypes.ResultHealth, error)
- func NetInfo(ctx *rpctypes.Context) (*coretypes.ResultNetInfo, error)
- func NumUnconfirmedTxs(ctx *rpctypes.Context) (*ctypes.ResultUnconfirmedTxs, error)
- func SetEnvironment(e *Environment)
- func Status(ctx *rpctypes.Context) (*ctypes.ResultStatus, error)
- func Subscribe(ctx *rpctypes.Context, query string) (*ctypes.ResultSubscribe, error)
- func TruncateNodeID(idStr string) (string, error)
- func Tx(ctx *rpctypes.Context, hash []byte, prove bool) (*ctypes.ResultTx, error)
- func TxSearch(ctx *rpctypes.Context, query string, prove bool, pagePtr, perPagePtr *int, ...) (*ctypes.ResultTxSearch, error)
- func UnconfirmedTxs(ctx *rpctypes.Context, limitPtr *int) (*ctypes.ResultUnconfirmedTxs, error)
- func Unsubscribe(ctx *rpctypes.Context, query string) (*ctypes.ResultUnsubscribe, error)
- func UnsubscribeAll(ctx *rpctypes.Context) (*ctypes.ResultUnsubscribe, error)
- func Validators(ctx *rpctypes.Context, heightPtr *int64, pagePtr, perPagePtr *int) (*coretypes.ResultValidators, error)
- type Environment
Constants ¶
const NodeIDByteLength = 20
const ( // SubscribeTimeout is the maximum time we wait to subscribe for an event. // must be less than the server's write timeout (see rpcserver.DefaultConfig) SubscribeTimeout = 5 * time.Second )
Variables ¶
var ErrConsensusStateNotAvailable = errors.New("consensus state not available in ev-node")
ErrConsensusStateNotAvailable is returned because ev-node doesn't use CometBFT consensus.
var Routes = map[string]*server.RPCFunc{ "subscribe": server.NewWSRPCFunc(Subscribe, "query"), "unsubscribe": server.NewWSRPCFunc(Unsubscribe, "query"), "unsubscribe_all": server.NewWSRPCFunc(UnsubscribeAll, ""), "health": server.NewRPCFunc(Health, ""), "status": server.NewRPCFunc(Status, ""), "net_info": server.NewRPCFunc(NetInfo, ""), "blockchain": server.NewRPCFunc(BlockchainInfo, "minHeight,maxHeight", server.Cacheable()), "genesis": server.NewRPCFunc(Genesis, "", server.Cacheable()), "genesis_chunked": server.NewRPCFunc(GenesisChunked, "chunk", server.Cacheable()), "block": server.NewRPCFunc(Block, "height", server.Cacheable("height")), "block_by_hash": server.NewRPCFunc(BlockByHash, "hash", server.Cacheable()), "block_results": server.NewRPCFunc(BlockResults, "height", server.Cacheable("height")), "commit": server.NewRPCFunc(Commit, "height", server.Cacheable("height")), "header": server.NewRPCFunc(Header, "height", server.Cacheable("height")), "header_by_hash": server.NewRPCFunc(HeaderByHash, "hash", server.Cacheable()), "check_tx": server.NewRPCFunc(CheckTx, "tx"), "tx": server.NewRPCFunc(Tx, "hash,prove", server.Cacheable()), "tx_search": server.NewRPCFunc(TxSearch, "query,prove,page,per_page,order_by"), "block_search": server.NewRPCFunc(BlockSearch, "query,page,per_page,order_by"), "validators": server.NewRPCFunc(Validators, "height,page,per_page", server.Cacheable("height")), "dump_consensus_state": server.NewRPCFunc(DumpConsensusState, ""), "consensus_state": server.NewRPCFunc(ConsensusState, ""), "consensus_params": server.NewRPCFunc(ConsensusParams, "height", server.Cacheable("height")), "unconfirmed_txs": server.NewRPCFunc(UnconfirmedTxs, "limit"), "num_unconfirmed_txs": server.NewRPCFunc(NumUnconfirmedTxs, ""), "broadcast_tx_commit": server.NewRPCFunc(BroadcastTxCommit, "tx"), "broadcast_tx_sync": server.NewRPCFunc(BroadcastTxSync, "tx"), "broadcast_tx_async": server.NewRPCFunc(BroadcastTxAsync, "tx"), "abci_query": server.NewRPCFunc(ABCIQuery, "path,data,height,prove"), "abci_info": server.NewRPCFunc(ABCIInfo, "", server.Cacheable()), "broadcast_evidence": server.NewRPCFunc(BroadcastEvidence, "evidence"), }
Functions ¶
func ABCIInfo ¶
func ABCIInfo(ctx *rpctypes.Context) (*ctypes.ResultABCIInfo, error)
ABCIInfo gets some info about the application. More: https://docs.cometbft.com/v0.37/rpc/#/ABCI/abci_info
func ABCIQuery ¶
func ABCIQuery( ctx *rpctypes.Context, path string, data bytes.HexBytes, height int64, prove bool, ) (*ctypes.ResultABCIQuery, error)
ABCIQuery queries the application for some information. More: https://docs.cometbft.com/v0.37/rpc/#/ABCI/abci_query
func Block ¶
Block gets block at a given height. If no height is provided, it will fetch the latest block. More: https://docs.cometbft.com/v0.37/rpc/#/Info/block
func BlockByHash ¶
BlockByHash gets block by hash. More: https://docs.cometbft.com/v0.37/rpc/#/Info/block_by_hash
func BlockResults ¶
BlockResults gets block results at a given height. If no height is provided, it will fetch the results for the latest block.
func BlockSearch ¶
func BlockSearch( ctx *rpctypes.Context, query string, pagePtr, perPagePtr *int, orderBy string, ) (*ctypes.ResultBlockSearch, error)
BlockSearch searches for a paginated set of blocks matching BeginBlock and EndBlock event search criteria.
func BlockchainInfo ¶
func BlockchainInfo(ctx *rpctypes.Context, minHeight, maxHeight int64) (*ctypes.ResultBlockchainInfo, error)
BlockchainInfo gets block headers for minHeight <= height <= maxHeight. Block headers are returned in descending order (highest first). More: https://docs.cometbft.com/v0.37/rpc/#/Info/blockchain
func BroadcastEvidence ¶
func BroadcastEvidence(ctx *rpctypes.Context, ev cmttypes.Evidence) (*ctypes.ResultBroadcastEvidence, error)
BroadcastEvidence implements client.Client but is essentially a no-op in this context, as Evolve doesn't handle evidence in the same way as CometBFT. It returns a successful response with the evidence hash, mimicking CometBFT's behaviour without actually processing or storing the evidence.
func BroadcastTxAsync ¶
BroadcastTxAsync returns right away, with no response. Does not wait for CheckTx nor DeliverTx results. More: https://docs.cometbft.com/v0.37/rpc/#/Tx/broadcast_tx_async
func BroadcastTxCommit ¶
func BroadcastTxCommit(ctx *rpctypes.Context, tx cmttypes.Tx) (*ctypes.ResultBroadcastTxCommit, error)
BroadcastTxCommit returns with the responses from CheckTx and DeliverTx. More: https://docs.cometbft.com/v0.37/rpc/#/Tx/broadcast_tx_commit
func BroadcastTxSync ¶
BroadcastTxSync returns with the response from CheckTx. Does not wait for DeliverTx result. More: https://docs.cometbft.com/v0.37/rpc/#/Tx/broadcast_tx_sync
func CheckTx ¶
CheckTx checks the transaction without executing it. The transaction won't be added to the mempool either. More: https://docs.cometbft.com/v0.37/rpc/#/Tx/check_tx
func Commit ¶
Commit gets block commit at a given height. If no height is provided, it will fetch the commit for the latest block. More: https://docs.cometbft.com/main/rpc/#/Info/commit
func ConsensusParams ¶
func ConsensusParams(ctx *rpctypes.Context, heightPtr *int64) (*coretypes.ResultConsensusParams, error)
ConsensusParams gets the consensus parameters at the given block height. If no height is provided, it will fetch the latest consensus params. More: https://docs.cometbft.com/v0.37/rpc/#/Info/consensus_params
func ConsensusState ¶
func ConsensusState(ctx *rpctypes.Context) (*coretypes.ResultConsensusState, error)
ConsensusState returns a concise summary of the consensus state. UNSTABLE More: https://docs.cometbft.com/v0.37/rpc/#/Info/consensus_state
func DumpConsensusState ¶
func DumpConsensusState(ctx *rpctypes.Context) (*coretypes.ResultDumpConsensusState, error)
DumpConsensusState dumps consensus state. UNSTABLE More: https://docs.cometbft.com/v0.37/rpc/#/Info/dump_consensus_state
func GenesisChunked ¶
func Header ¶
Header gets block header at a given height. If no height is provided, it will fetch the latest header. More: https://docs.cometbft.com/v0.37/rpc/#/Info/header
func HeaderByHash ¶
HeaderByHash gets header by hash. More: https://docs.cometbft.com/v0.37/rpc/#/Info/header_by_hash
func Health ¶
func Health(ctx *rpctypes.Context) (*ctypes.ResultHealth, error)
Health gets node health. Returns empty result (200 OK) on success, no response - in case of an error. More: https://docs.cometbft.com/v0.37/rpc/#/Info/health
func NumUnconfirmedTxs ¶
func NumUnconfirmedTxs(ctx *rpctypes.Context) (*ctypes.ResultUnconfirmedTxs, error)
NumUnconfirmedTxs gets number of unconfirmed transactions. More: https://docs.cometbft.com/v0.37/rpc/#/Info/num_unconfirmed_txs
func SetEnvironment ¶
func SetEnvironment(e *Environment)
SetEnvironment sets up the given Environment. It will race if multiple Node call SetEnvironment.
func Status ¶
func Status(ctx *rpctypes.Context) (*ctypes.ResultStatus, error)
Status returns CometBFT status including node info, pubkey, latest block hash, app hash, block height and time. More: https://docs.cometbft.com/v0.37/rpc/#/Info/status
func Subscribe ¶
Subscribe for events via WebSocket. More: https://docs.cometbft.com/v0.37/rpc/#/Websocket/subscribe
func TruncateNodeID ¶
TruncateNodeID from Evolve we receive a 32 bytes node id, but we only need the first 20 bytes to be compatible with the ABCI node info
func Tx ¶
Tx allows you to query the transaction results. `nil` could mean the transaction is in the mempool, invalidated, or was not sent in the first place. More: https://docs.cometbft.com/v0.37/rpc/#/Info/tx
func TxSearch ¶
func TxSearch( ctx *rpctypes.Context, query string, prove bool, pagePtr, perPagePtr *int, orderBy string, ) (*ctypes.ResultTxSearch, error)
TxSearch allows you to query for multiple transactions results. It returns a list of transactions (maximum ?per_page entries) and the total count. More: https://docs.cometbft.com/v0.37/rpc/#/Info/tx_search
func UnconfirmedTxs ¶
UnconfirmedTxs gets unconfirmed transactions (maximum ?limit entries) including their number. More: https://docs.cometbft.com/v0.37/rpc/#/Info/unconfirmed_txs
func Unsubscribe ¶
Unsubscribe from events via WebSocket. More: https://docs.cometbft.com/v0.37/rpc/#/Websocket/unsubscribe
func UnsubscribeAll ¶
func UnsubscribeAll(ctx *rpctypes.Context) (*ctypes.ResultUnsubscribe, error)
func Validators ¶
func Validators(ctx *rpctypes.Context, heightPtr *int64, pagePtr, perPagePtr *int) (*coretypes.ResultValidators, error)
Validators gets the validator set at the given block height.
If no height is provided, it will fetch the latest validator set. Note the validators are sorted by their voting power - this is the canonical order for the validators in the set as used in computing their Merkle root.
Types ¶
type Environment ¶
type Environment struct {
Adapter *adapter.Adapter
Signer signer.Signer
TxIndexer txindex.TxIndexer
BlockIndexer indexer.BlockIndexer
Logger cmtlog.Logger
RPCConfig cmtcfg.RPCConfig
EVNodeConfig config.Config
}
Environment contains objects and interfaces used by the RPC. It is expected to be setup once during startup.