Documentation ¶
Index ¶
- func CreateGrpcConnection(cfg types.Config) (*grpc.ClientConn, error)
- func GetHeightRequestHeader(height int64) grpc.CallOption
- func MustCreateGrpcConnection(cfg types.Config) *grpc.ClientConn
- type Proxy
- func (cp *Proxy) Block(height int64) (*tmctypes.ResultBlock, error)
- func (cp *Proxy) ConsensusState() (*constypes.RoundStateSimple, error)
- func (cp *Proxy) Genesis() (*tmctypes.ResultGenesis, error)
- func (cp *Proxy) LatestHeight() (int64, error)
- func (cp *Proxy) Stop()
- 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, *tx.Tx, error)
- func (cp *Proxy) Txs(block *tmctypes.ResultBlock) ([]*types.Tx, error)
- func (cp *Proxy) Validators(height int64) (*tmctypes.ResultValidators, error)
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 ¶
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 ¶
LatestHeight returns the latest block height on the active chain. An error is returned if the query fails.
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 ¶
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 ¶
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.