client

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2022 License: CC0-1.0 Imports: 13 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 New

func New(cfg *config.Config, codec *codec.Codec) (*Proxy, error)

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) BlockResults

func (cp Proxy) BlockResults(height int64) (*tmctypes.ResultBlockResults, error)

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) QueryLCD

func (cp Proxy) QueryLCD(endpoint string, ptr interface{}) error

QueryLCD queries the LCD at the given endpoint, and deserializes the result into the given pointer. If an error is raised, returns the error.

func (Proxy) QueryLCDWithHeight

func (cp Proxy) QueryLCDWithHeight(endpoint string, ptr interface{}) (int64, error)

QueryLCDWithHeight should be used when the endpoint of the LCD returns the height of the request inside the result. It queries such endpoint, deserializes the result and further the result data into the given pointer. It returns the retrieved height as well as any error that might have been raised.

func (Proxy) Stop

func (cp Proxy) Stop() error

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, 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) ([]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 (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