client

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2021 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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 NewProxy

func NewProxy(rpcNode string, encodingConfig stargazeparams.EncodingConfig) (*Proxy, error)

NewProxy returns a new Proxy instance

func (*Proxy) Block

func (p *Proxy) Block(ctx context.Context, height int64) (*tmctypes.ResultBlock, error)

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

func (*Proxy) BlockResults

func (p *Proxy) BlockResults(ctx context.Context, height int64) (*tmctypes.ResultBlockResults, error)

BlockResults queries for block results by height. An error is returned if the query fails.

func (*Proxy) Genesis

func (p *Proxy) Genesis(ctx context.Context) (*tmctypes.ResultGenesis, error)

Genesis retrieves the genesis from tendermint

func (*Proxy) LatestHeight

func (p *Proxy) LatestHeight(ctx context.Context) (int64, error)

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

func (*Proxy) Status

func (p *Proxy) Status(ctx context.Context) (*tmctypes.ResultStatus, error)

Status returns status of the rpc client

func (*Proxy) Stop

func (p *Proxy) Stop() error

Stop defers the node stop execution to the RPC client.

func (*Proxy) SubscribeNewBlocks

func (p *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) Tx

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

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

func (p *Proxy) Validators(ctx context.Context, 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