rpc

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*jsonrpcclient.WSClient
	*cometbftHttp.WSEvents

	RPCClient *cometbftHttp.HTTP
	// contains filtered or unexported fields
}

func New

func New(cfg Config) *Client

func (*Client) Genesis

func (c *Client) Genesis(ctx context.Context) (*cometbfttypes.GenesisDoc, error)

func (*Client) GetBlockEvents

func (c *Client) GetBlockEvents(ctx context.Context, height int64) (begin, end types.BlockerEvents, err error)

GetBlockEvents returns begin block and end block events.

func (*Client) GetBlockResults

func (c *Client) GetBlockResults(ctx context.Context, height int64) (*coretypes.ResultBlockResults, error)

func (*Client) GetLastBlockHeight

func (c *Client) GetLastBlockHeight(ctx context.Context) (int64, error)

func (*Client) GetTxResults

func (c *Client) GetTxResults(ctx context.Context, height int64) ([]*abci.ResponseDeliverTx, error)

func (*Client) Start

func (c *Client) Start(_ context.Context) error

func (*Client) Stop

func (c *Client) Stop(_ context.Context) error

func (*Client) SubscribeNewBlocks

func (c *Client) SubscribeNewBlocks(ctx context.Context) (<-chan cometbftcoretypes.ResultEvent, error)

type Config

type Config struct {
	Host           string        `env:"RPC_URL" envDefault:"http://localhost:26657"`
	MetricsEnabled bool          `env:"METRICS_ENABLED" envDefault:"false"`
	Timeout        time.Duration `env:"RPC_TIMEOUT" envDefault:"15s"`
}

Jump to

Keyboard shortcuts

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