rpc

package
v0.2.3-rc3 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: MIT Imports: 7 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
	HTTPClient *http.Client
	// 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) GetLastBlockHeight

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

func (*Client) Start

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

func (*Client) Stop

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

func (*Client) SubscribeNewBlocks

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

func (*Client) WsEnabled

func (c *Client) WsEnabled() bool

type Config

type Config struct {
	Host      string `env:"RPC_URL" envDefault:"http://localhost:26657"`
	WSEnabled bool   `env:"WS_ENABLED" envDefault:"true"`
}

Jump to

Keyboard shortcuts

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