client

package
v0.0.6-0...-1b1e2dd Latest Latest
Warning

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

Go to latest
Published: May 14, 2020 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientProxy

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

ClientProxy implements a wrapper around both a Tendermint RPC client and a Cosmos SDK REST client that allows for essential data queries.

func New

func New(rpcNode, clientNode string) (ClientProxy, error)

func (ClientProxy) Block

func (cp ClientProxy) Block(height int64) (*tmctypes.ResultBlock, error)

Block queries for a block by height. An error is returned if the query fails.

func (ClientProxy) LatestHeight

func (cp ClientProxy) LatestHeight() (int64, error)

LatestHeight returns the latest block height on the active chain. An error is returned if the query fails.

func (ClientProxy) Stop

func (cp ClientProxy) Stop() error

Stop defers the node stop execution to the RPC client.

func (ClientProxy) SubscribeNewBlocks

func (cp ClientProxy) SubscribeNewBlocks(subscriber string) (<-chan tmctypes.ResultEvent, context.CancelFunc, error)

SubscribeNewBlocks subscribes to the new block event handler through the RPC client with the given subscriber name. An receiving only channel, context cancel function and an error is returned. It is up to the caller to cancel the context and handle any errors appropriately.

func (ClientProxy) TendermintTx

func (cp ClientProxy) TendermintTx(hash string) (*tmctypes.ResultTx, error)

TendermintTx queries for a transaction by hash. An error is returned if the query fails.

func (ClientProxy) Tx

func (cp ClientProxy) Tx(hash string) (sdk.TxResponse, error)

Tx queries for a transaction from the REST client and decodes it into a sdk.Tx if the transaction exists. An error is returned if the tx doesn't exist or decoding fails.

func (ClientProxy) Txs

func (cp ClientProxy) Txs(block *tmctypes.ResultBlock) ([]sdk.TxResponse, error)

Txs queries for all the transactions in a block. Transactions are returned in the sdk.TxResponse format which internally contains an sdk.Tx. An error is returned if any query fails.

func (ClientProxy) Validators

func (cp ClientProxy) Validators(height int64) (*tmctypes.ResultValidators, error)

Validators returns all the known Tendermint validators for a given block height. An error is returned if the query fails.

Jump to

Keyboard shortcuts

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