Documentation ¶
Index ¶
- func GetBlockByHash(ctx context.Context, rpcClient CometRPC, hashHexString string) (*cmttypes.Block, error)
- func GetBlockByHeight(ctx context.Context, rpcClient CometRPC, height *int64) (*cmttypes.Block, error)
- func GetChainHeight(ctx context.Context, rpcClient CometRPC) (int64, error)
- func QueryBlocks(ctx context.Context, rpcClient CometRPC, page, limit int, ...) (*sdk.SearchBlocksResult, error)
- type CometRPC
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBlockByHash ¶
func GetBlockByHash(ctx context.Context, rpcClient CometRPC, hashHexString string) (*cmttypes.Block, error)
GetBlockByHash gets block by hash
func GetBlockByHeight ¶
func GetBlockByHeight(ctx context.Context, rpcClient CometRPC, height *int64) (*cmttypes.Block, error)
GetBlockByHeight gets block by height
func GetChainHeight ¶
GetChainHeight returns the current blockchain height.
func QueryBlocks ¶
func QueryBlocks(ctx context.Context, rpcClient CometRPC, page, limit int, query, orderBy string) (*sdk.SearchBlocksResult, error)
Examples: tm.event = 'NewBlock' # new blocks tm.event = 'CompleteProposal' # node got a complete proposal tm.event = 'Tx' AND tx.hash = 'XYZ' # single transaction tm.event = 'Tx' AND tx.height = 5 # all txs of the fifth block tx.height = 5 # all txs of the fifth block
For more information, see the /subscribe CometBFT RPC endpoint documentation
Types ¶
type CometRPC ¶
type CometRPC interface { rpcclient.ABCIClient Validators(ctx context.Context, height *int64, page, perPage *int) (*coretypes.ResultValidators, error) Status(context.Context) (*coretypes.ResultStatus, error) Block(ctx context.Context, height *int64) (*coretypes.ResultBlock, error) BlockByHash(ctx context.Context, hash []byte) (*coretypes.ResultBlock, error) BlockResults(ctx context.Context, height *int64) (*coretypes.ResultBlockResults, error) BlockchainInfo(ctx context.Context, minHeight, maxHeight int64) (*coretypes.ResultBlockchainInfo, error) Commit(ctx context.Context, height *int64) (*coretypes.ResultCommit, error) Tx(ctx context.Context, hash []byte, prove bool) (*coretypes.ResultTx, error) TxSearch( ctx context.Context, query string, prove bool, page, perPage *int, orderBy string, ) (*coretypes.ResultTxSearch, error) BlockSearch( ctx context.Context, query string, page, perPage *int, orderBy string, ) (*coretypes.ResultBlockSearch, error) }
CometRPC defines the interface of a CometBFT RPC client needed for queries and transaction handling.
Click to show internal directories.
Click to hide internal directories.