tendermint: github.com/tendermint/tendermint/rpc/client Index | Files | Directories

package client

import "github.com/tendermint/tendermint/rpc/client"


Package Files

helpers.go interface.go types.go


var DefaultABCIQueryOptions = ABCIQueryOptions{Height: 0, Prove: false}

DefaultABCIQueryOptions are latest height (0) and prove false.

func DefaultWaitStrategy Uses

func DefaultWaitStrategy(delta int64) (abort error)

DefaultWaitStrategy is the standard backoff algorithm, but you can plug in another one

func WaitForHeight Uses

func WaitForHeight(c StatusClient, h int64, waiter Waiter) error

Wait for height will poll status at reasonable intervals until the block at the given height is available.

If waiter is nil, we use DefaultWaitStrategy, but you can also provide your own implementation

func WaitForOneEvent Uses

func WaitForOneEvent(c EventsClient, evtTyp string, timeout time.Duration) (types.TMEventData, error)

WaitForOneEvent subscribes to a websocket event for the given event time and returns upon receiving it one time, or when the timeout duration has expired.

This handles subscribing and unsubscribing under the hood

type ABCIClient Uses

type ABCIClient interface {
    // Reading from abci app
    ABCIInfo(context.Context) (*ctypes.ResultABCIInfo, error)
    ABCIQuery(ctx context.Context, path string, data bytes.HexBytes) (*ctypes.ResultABCIQuery, error)
    ABCIQueryWithOptions(ctx context.Context, path string, data bytes.HexBytes,
        opts ABCIQueryOptions) (*ctypes.ResultABCIQuery, error)

    // Writing to abci app
    BroadcastTxCommit(context.Context, types.Tx) (*ctypes.ResultBroadcastTxCommit, error)
    BroadcastTxAsync(context.Context, types.Tx) (*ctypes.ResultBroadcastTx, error)
    BroadcastTxSync(context.Context, types.Tx) (*ctypes.ResultBroadcastTx, error)

ABCIClient groups together the functionality that principally affects the ABCI app.

In many cases this will be all we want, so we can accept an interface which is easier to mock.

type ABCIQueryOptions Uses

type ABCIQueryOptions struct {
    Height int64
    Prove  bool

ABCIQueryOptions can be used to provide options for ABCIQuery call other than the DefaultABCIQueryOptions.

type Client Uses

type Client interface {

Client wraps most important rpc calls a client would make if you want to listen for events, test if it also implements events.EventSwitch.

type EventsClient Uses

type EventsClient interface {
    // Subscribe subscribes given subscriber to query. Returns a channel with
    // cap=1 onto which events are published. An error is returned if it fails to
    // subscribe. outCapacity can be used optionally to set capacity for the
    // channel. Channel is never closed to prevent accidental reads.
    // ctx cannot be used to unsubscribe. To unsubscribe, use either Unsubscribe
    // or UnsubscribeAll.
    Subscribe(ctx context.Context, subscriber, query string, outCapacity ...int) (out <-chan ctypes.ResultEvent, err error)
    // Unsubscribe unsubscribes given subscriber from query.
    Unsubscribe(ctx context.Context, subscriber, query string) error
    // UnsubscribeAll unsubscribes given subscriber from all the queries.
    UnsubscribeAll(ctx context.Context, subscriber string) error

EventsClient is reactive, you can subscribe to any message, given the proper string. see tendermint/types/events.go

type EvidenceClient Uses

type EvidenceClient interface {
    BroadcastEvidence(context.Context, types.Evidence) (*ctypes.ResultBroadcastEvidence, error)

EvidenceClient is used for submitting an evidence of the malicious behaviour.

type HistoryClient Uses

type HistoryClient interface {
    Genesis(context.Context) (*ctypes.ResultGenesis, error)
    BlockchainInfo(ctx context.Context, minHeight, maxHeight int64) (*ctypes.ResultBlockchainInfo, error)

HistoryClient provides access to data from genesis to now in large chunks.

type MempoolClient Uses

type MempoolClient interface {
    UnconfirmedTxs(ctx context.Context, limit *int) (*ctypes.ResultUnconfirmedTxs, error)
    NumUnconfirmedTxs(context.Context) (*ctypes.ResultUnconfirmedTxs, error)
    CheckTx(context.Context, types.Tx) (*ctypes.ResultCheckTx, error)

MempoolClient shows us data about current mempool state.

type NetworkClient Uses

type NetworkClient interface {
    NetInfo(context.Context) (*ctypes.ResultNetInfo, error)
    DumpConsensusState(context.Context) (*ctypes.ResultDumpConsensusState, error)
    ConsensusState(context.Context) (*ctypes.ResultConsensusState, error)
    ConsensusParams(ctx context.Context, height *int64) (*ctypes.ResultConsensusParams, error)
    Health(context.Context) (*ctypes.ResultHealth, error)

NetworkClient is general info about the network state. May not be needed usually.

type RemoteClient Uses

type RemoteClient interface {

    // Remote returns the remote network address in a string form.
    Remote() string

RemoteClient is a Client, which can also return the remote network address.

type SignClient Uses

type SignClient interface {
    Block(ctx context.Context, height *int64) (*ctypes.ResultBlock, error)
    BlockByHash(ctx context.Context, hash []byte) (*ctypes.ResultBlock, error)
    BlockResults(ctx context.Context, height *int64) (*ctypes.ResultBlockResults, error)
    Commit(ctx context.Context, height *int64) (*ctypes.ResultCommit, error)
    Validators(ctx context.Context, height *int64, page, perPage *int) (*ctypes.ResultValidators, error)
    Tx(ctx context.Context, hash []byte, prove bool) (*ctypes.ResultTx, error)
    TxSearch(ctx context.Context, query string, prove bool, page, perPage *int,
        orderBy string) (*ctypes.ResultTxSearch, error)

SignClient groups together the functionality needed to get valid signatures and prove anything about the chain.

type StatusClient Uses

type StatusClient interface {
    Status(context.Context) (*ctypes.ResultStatus, error)

StatusClient provides access to general chain info.

type Waiter Uses

type Waiter func(delta int64) (abort error)

Waiter is informed of current height, decided whether to quit early



Package client imports 8 packages (graph) and is imported by 155 packages. Updated 2020-09-23. Refresh now. Tools for package owners.