comet

package
v2.10.0-beta.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// BroadcastSync defines a tx broadcasting mode where the client waits for
	// a CheckTx execution response only.
	BroadcastSync = "sync"
	// BroadcastAsync defines a tx broadcasting mode where the client returns
	// immediately.
	BroadcastAsync = "async"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CometBFTBroadcaster

type CometBFTBroadcaster struct {
	// contains filtered or unexported fields
}

CometBFTBroadcaster implements the Broadcaster interface for CometBFT consensus engine.

func NewCometBFTBroadcaster

func NewCometBFTBroadcaster(rpcURL, mode string, cdc codec.Codec) (*CometBFTBroadcaster, error)

NewCometBFTBroadcaster creates a new CometBFTBroadcaster.

func (*CometBFTBroadcaster) Broadcast

func (c *CometBFTBroadcaster) Broadcast(ctx context.Context, txBytes []byte) ([]byte, error)

Broadcast sends a transaction to the network and returns the result. returns a byte slice containing the JSON-encoded result and an error if the broadcast failed.

func (*CometBFTBroadcaster) Consensus

func (c *CometBFTBroadcaster) Consensus() string

Consensus returns the consensus engine name used by the broadcaster. It always returns "comet" for CometBFTBroadcaster.

func (*CometBFTBroadcaster) Invoke

func (c *CometBFTBroadcaster) Invoke(ctx context.Context, method string, req, reply interface{}, opts ...grpc.CallOption) (err error)

Invoke implements the gRPC ClientConn interface by forwarding the RPC call to CometBFT's ABCI Query. It marshals the request, sends it as an ABCI query, and unmarshals the response.

func (*CometBFTBroadcaster) NewStream

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.

Directories

Path Synopsis
Package testutil is a generated GoMock package.
Package testutil is a generated GoMock package.

Jump to

Keyboard shortcuts

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