Documentation
¶
Index ¶
- type Proxy
- func (cp Proxy) Block(height int64) (*tmctypes.ResultBlock, error)
- func (cp Proxy) BlockResults(height int64) (*tmctypes.ResultBlockResults, error)
- func (cp Proxy) Genesis() (*tmctypes.ResultGenesis, error)
- func (cp Proxy) LatestHeight() (int64, error)
- func (cp Proxy) QueryLCD(endpoint string, ptr interface{}) error
- func (cp Proxy) QueryLCDWithHeight(endpoint string, ptr interface{}) (int64, error)
- func (cp Proxy) Stop() error
- func (cp Proxy) SubscribeEvents(subscriber, query string) (<-chan tmctypes.ResultEvent, context.CancelFunc, error)
- func (cp Proxy) SubscribeNewBlocks(subscriber string) (<-chan tmctypes.ResultEvent, context.CancelFunc, error)
- func (cp Proxy) TendermintTx(hash string) (*tmctypes.ResultTx, error)
- func (cp Proxy) Tx(hash string) (sdk.TxResponse, error)
- func (cp Proxy) Txs(block *tmctypes.ResultBlock) ([]sdk.TxResponse, error)
- func (cp Proxy) Validators(height int64) (*tmctypes.ResultValidators, error)
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 (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 ¶
LatestHeight returns the latest block height on the active chain. An error is returned if the query fails.
func (Proxy) QueryLCD ¶
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 ¶
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) 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 ¶
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.