client

package
v0.0.0-...-3b09c4e Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2021 License: CC0-1.0 Imports: 21 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateGrpcConnection

func CreateGrpcConnection(cfg types.Config) (*grpc.ClientConn, error)

CreateGrpcConnection creates a new gRPC client connection from the given configuration

func GetHeightRequestHeader

func GetHeightRequestHeader(height int64) grpc.CallOption

GetHeightRequestHeader returns the grpc.CallOption to query the state at a given height

func MustCreateGrpcConnection

func MustCreateGrpcConnection(cfg types.Config) *grpc.ClientConn

MustCreateGrpcConnection creates a new gRPC connection using the provided configuration and panics on error

Types

type Proxy

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

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

func NewClientProxy

func NewClientProxy(cfg types.Config, encodingConfig *params.EncodingConfig) (*Proxy, error)

NewClientProxy allows to build a new Proxy instance

func (*Proxy) Block

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

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

func (*Proxy) ConsensusState

func (cp *Proxy) ConsensusState() (*constypes.RoundStateSimple, error)

ConsensusState returns the consensus state of the chain

func (*Proxy) Genesis

func (cp *Proxy) Genesis() (*tmctypes.ResultGenesis, error)

Genesis returns the genesis state

func (*Proxy) LatestHeight

func (cp *Proxy) LatestHeight() (int64, error)

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

func (*Proxy) Stop

func (cp *Proxy) Stop()

Stop defers the node stop execution to the RPC client.

func (*Proxy) SubscribeEvents

func (cp *Proxy) SubscribeEvents(subscriber, query string) (<-chan tmctypes.ResultEvent, context.CancelFunc, error)

SubscribeEvents subscribes to new events with the given query through the RPC client with the given subscriber name. A 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 (*Proxy) SubscribeNewBlocks

func (cp *Proxy) 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 (*Proxy) TendermintTx

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

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

func (*Proxy) Tx

func (cp *Proxy) Tx(hash string) (*sdk.TxResponse, *tx.Tx, 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 (*Proxy) Txs

func (cp *Proxy) Txs(block *tmctypes.ResultBlock) ([]*types.Tx, 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 (*Proxy) Validators

func (cp *Proxy) 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