rpc

package
v0.0.0-...-94cfcc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

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

func GetChainHeight(ctx context.Context, rpcClient CometRPC) (int64, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL