Documentation ¶
Index ¶
- Variables
- func DefaultWaitStrategy(delta int64) (abort error)
- func WaitForHeight(c StatusClient, h int64, waiter Waiter) error
- func WaitForOneEvent(c EventsClient, evtTyp string, timeout time.Duration) (types.TMEventData, error)
- type ABCIClient
- type ABCIQueryOptions
- type Client
- type EventsClient
- type HTTP
- func (c *HTTP) ABCIInfo() (*ctypes.ResultABCIInfo, error)
- func (c *HTTP) ABCIQuery(path string, data cmn.HexBytes) (*ctypes.ResultABCIQuery, error)
- func (c *HTTP) ABCIQueryWithOptions(path string, data cmn.HexBytes, opts ABCIQueryOptions) (*ctypes.ResultABCIQuery, error)
- func (c *HTTP) Block(height *int64) (*ctypes.ResultBlock, error)
- func (c *HTTP) BlockResults(height *int64) (*ctypes.ResultBlockResults, error)
- func (c *HTTP) BlockchainInfo(minHeight, maxHeight int64) (*ctypes.ResultBlockchainInfo, error)
- func (c *HTTP) BroadcastTxAsync(tx types.Tx) (*ctypes.ResultBroadcastTx, error)
- func (c *HTTP) BroadcastTxCommit(tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error)
- func (c *HTTP) BroadcastTxSync(tx types.Tx) (*ctypes.ResultBroadcastTx, error)
- func (c *HTTP) Commit(height *int64) (*ctypes.ResultCommit, error)
- func (c *HTTP) ConsensusState() (*ctypes.ResultConsensusState, error)
- func (c *HTTP) DumpConsensusState() (*ctypes.ResultDumpConsensusState, error)
- func (c *HTTP) Genesis() (*ctypes.ResultGenesis, error)
- func (c *HTTP) Health() (*ctypes.ResultHealth, error)
- func (c *HTTP) NetInfo() (*ctypes.ResultNetInfo, error)
- func (c *HTTP) NumUnconfirmedTxs() (*ctypes.ResultUnconfirmedTxs, error)
- func (c *HTTP) Status() (*ctypes.ResultStatus, error)
- func (c *HTTP) Tx(hash []byte, prove bool) (*ctypes.ResultTx, error)
- func (c *HTTP) TxSearch(query string, prove bool, page, perPage int) (*ctypes.ResultTxSearch, error)
- func (c *HTTP) UnconfirmedTxs(limit int) (*ctypes.ResultUnconfirmedTxs, error)
- func (c *HTTP) Validators(height *int64) (*ctypes.ResultValidators, error)
- type HistoryClient
- type Local
- func (Local) ABCIInfo() (*ctypes.ResultABCIInfo, error)
- func (c *Local) ABCIQuery(path string, data cmn.HexBytes) (*ctypes.ResultABCIQuery, error)
- func (Local) ABCIQueryWithOptions(path string, data cmn.HexBytes, opts ABCIQueryOptions) (*ctypes.ResultABCIQuery, error)
- func (Local) Block(height *int64) (*ctypes.ResultBlock, error)
- func (Local) BlockResults(height *int64) (*ctypes.ResultBlockResults, error)
- func (Local) BlockchainInfo(minHeight, maxHeight int64) (*ctypes.ResultBlockchainInfo, error)
- func (Local) BroadcastTxAsync(tx types.Tx) (*ctypes.ResultBroadcastTx, error)
- func (Local) BroadcastTxCommit(tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error)
- func (Local) BroadcastTxSync(tx types.Tx) (*ctypes.ResultBroadcastTx, error)
- func (Local) Commit(height *int64) (*ctypes.ResultCommit, error)
- func (Local) ConsensusState() (*ctypes.ResultConsensusState, error)
- func (Local) DialPeers(peers []string, persistent bool) (*ctypes.ResultDialPeers, error)
- func (Local) DialSeeds(seeds []string) (*ctypes.ResultDialSeeds, error)
- func (Local) DumpConsensusState() (*ctypes.ResultDumpConsensusState, error)
- func (Local) Genesis() (*ctypes.ResultGenesis, error)
- func (Local) Health() (*ctypes.ResultHealth, error)
- func (Local) NetInfo() (*ctypes.ResultNetInfo, error)
- func (Local) NumUnconfirmedTxs() (*ctypes.ResultUnconfirmedTxs, error)
- func (Local) Status() (*ctypes.ResultStatus, error)
- func (c *Local) Subscribe(ctx context.Context, subscriber string, query tmpubsub.Query, ...) error
- func (Local) Tx(hash []byte, prove bool) (*ctypes.ResultTx, error)
- func (Local) TxSearch(query string, prove bool, page, perPage int) (*ctypes.ResultTxSearch, error)
- func (Local) UnconfirmedTxs(limit int) (*ctypes.ResultUnconfirmedTxs, error)
- func (c *Local) Unsubscribe(ctx context.Context, subscriber string, query tmpubsub.Query) error
- func (c *Local) UnsubscribeAll(ctx context.Context, subscriber string) error
- func (Local) Validators(height *int64) (*ctypes.ResultValidators, error)
- type MempoolClient
- type NetworkClient
- type SignClient
- type StatusClient
- type WSEvents
- func (w *WSEvents) OnStart() error
- func (w *WSEvents) OnStop()
- func (w *WSEvents) Subscribe(ctx context.Context, subscriber string, query tmpubsub.Query, ...) error
- func (w *WSEvents) Unsubscribe(ctx context.Context, subscriber string, query tmpubsub.Query) error
- func (w *WSEvents) UnsubscribeAll(ctx context.Context, subscriber string) error
- type Waiter
Constants ¶
This section is empty.
Variables ¶
var DefaultABCIQueryOptions = ABCIQueryOptions{Height: 0, Prove: false}
DefaultABCIQueryOptions are latest height (0) and prove false.
Functions ¶
func DefaultWaitStrategy ¶
DefaultWaitStrategy is the standard backoff algorithm, but you can plug in another one
func WaitForHeight ¶
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 ¶
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
Types ¶
type ABCIClient ¶
type ABCIClient interface { // Reading from abci app ABCIInfo() (*ctypes.ResultABCIInfo, error) ABCIQuery(path string, data cmn.HexBytes) (*ctypes.ResultABCIQuery, error) ABCIQueryWithOptions(path string, data cmn.HexBytes, opts ABCIQueryOptions) (*ctypes.ResultABCIQuery, error) // Writing to abci app BroadcastTxCommit(tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error) BroadcastTxAsync(tx types.Tx) (*ctypes.ResultBroadcastTx, error) BroadcastTxSync(tx 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 ¶ added in v0.12.0
ABCIQueryOptions can be used to provide options for ABCIQuery call other than the DefaultABCIQueryOptions.
type Client ¶
type Client interface { cmn.Service ABCIClient SignClient HistoryClient StatusClient EventsClient }
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 ¶ added in v0.13.0
type EventsClient interface { types.EventBusSubscriber }
EventsClient is reactive, you can subscribe to any message, given the proper string. see tendermint/types/events.go
type HTTP ¶
type HTTP struct { *WSEvents // contains filtered or unexported fields }
HTTP is a Client implementation that communicates with a tendermint node over json rpc and websockets.
This is the main implementation you probably want to use in production code. There are other implementations when calling the tendermint node in-process (local), or when you want to mock out the server for test code (mock).
func NewHTTP ¶
NewHTTP takes a remote endpoint in the form tcp://<host>:<port> and the websocket path (which always seems to be "/websocket")
func (*HTTP) ABCIQueryWithOptions ¶ added in v0.12.0
func (c *HTTP) ABCIQueryWithOptions(path string, data cmn.HexBytes, opts ABCIQueryOptions) (*ctypes.ResultABCIQuery, error)
func (*HTTP) BlockResults ¶ added in v0.15.0
func (c *HTTP) BlockResults(height *int64) (*ctypes.ResultBlockResults, error)
func (*HTTP) BlockchainInfo ¶
func (c *HTTP) BlockchainInfo(minHeight, maxHeight int64) (*ctypes.ResultBlockchainInfo, error)
func (*HTTP) BroadcastTxAsync ¶
func (*HTTP) BroadcastTxCommit ¶
func (*HTTP) BroadcastTxSync ¶
func (*HTTP) ConsensusState ¶ added in v0.19.3
func (c *HTTP) ConsensusState() (*ctypes.ResultConsensusState, error)
func (*HTTP) DumpConsensusState ¶
func (c *HTTP) DumpConsensusState() (*ctypes.ResultDumpConsensusState, error)
func (*HTTP) NumUnconfirmedTxs ¶ added in v0.27.1
func (c *HTTP) NumUnconfirmedTxs() (*ctypes.ResultUnconfirmedTxs, error)
func (*HTTP) UnconfirmedTxs ¶ added in v0.27.1
func (c *HTTP) UnconfirmedTxs(limit int) (*ctypes.ResultUnconfirmedTxs, error)
func (*HTTP) Validators ¶
func (c *HTTP) Validators(height *int64) (*ctypes.ResultValidators, error)
type HistoryClient ¶
type HistoryClient interface { Genesis() (*ctypes.ResultGenesis, error) BlockchainInfo(minHeight, maxHeight int64) (*ctypes.ResultBlockchainInfo, error) }
HistoryClient shows us data from genesis to now in large chunks.
type Local ¶
Local is a Client implementation that directly executes the rpc functions on a given node, without going through HTTP or GRPC.
This implementation is useful for:
* Running tests against a node in-process without the overhead of going through an http server * Communication between an ABCI app and Tendermint core when they are compiled in process.
For real clients, you probably want to use client.HTTP. For more powerful control during testing, you probably want the "client/mock" package.
func NewLocal ¶
NewLocal configures a client that calls the Node directly.
Note that given how rpc/core works with package singletons, that you can only have one node per process. So make sure test cases don't run in parallel, or try to simulate an entire network in one process...
func (Local) ABCIQueryWithOptions ¶ added in v0.12.0
func (Local) ABCIQueryWithOptions(path string, data cmn.HexBytes, opts ABCIQueryOptions) (*ctypes.ResultABCIQuery, error)
func (Local) BlockResults ¶ added in v0.15.0
func (Local) BlockResults(height *int64) (*ctypes.ResultBlockResults, error)
func (Local) BlockchainInfo ¶
func (Local) BlockchainInfo(minHeight, maxHeight int64) (*ctypes.ResultBlockchainInfo, error)
func (Local) BroadcastTxAsync ¶
func (Local) BroadcastTxCommit ¶
func (Local) BroadcastTxSync ¶
func (Local) ConsensusState ¶ added in v0.19.3
func (Local) ConsensusState() (*ctypes.ResultConsensusState, error)
func (Local) DumpConsensusState ¶
func (Local) DumpConsensusState() (*ctypes.ResultDumpConsensusState, error)
func (Local) NumUnconfirmedTxs ¶ added in v0.27.1
func (Local) NumUnconfirmedTxs() (*ctypes.ResultUnconfirmedTxs, error)
func (Local) UnconfirmedTxs ¶ added in v0.27.1
func (Local) UnconfirmedTxs(limit int) (*ctypes.ResultUnconfirmedTxs, error)
func (*Local) Unsubscribe ¶ added in v0.13.0
func (*Local) UnsubscribeAll ¶ added in v0.13.0
func (Local) Validators ¶
func (Local) Validators(height *int64) (*ctypes.ResultValidators, error)
type MempoolClient ¶ added in v0.27.1
type MempoolClient interface { UnconfirmedTxs(limit int) (*ctypes.ResultUnconfirmedTxs, error) NumUnconfirmedTxs() (*ctypes.ResultUnconfirmedTxs, error) }
MempoolClient shows us data about current mempool state.
type NetworkClient ¶
type NetworkClient interface { NetInfo() (*ctypes.ResultNetInfo, error) DumpConsensusState() (*ctypes.ResultDumpConsensusState, error) ConsensusState() (*ctypes.ResultConsensusState, error) Health() (*ctypes.ResultHealth, error) }
NetworkClient is general info about the network state. May not be needed usually.
Not included in the Client interface, but generally implemented by concrete implementations.
type SignClient ¶
type SignClient interface { Block(height *int64) (*ctypes.ResultBlock, error) BlockResults(height *int64) (*ctypes.ResultBlockResults, error) Commit(height *int64) (*ctypes.ResultCommit, error) Validators(height *int64) (*ctypes.ResultValidators, error) Tx(hash []byte, prove bool) (*ctypes.ResultTx, error) TxSearch(query string, prove bool, page, perPage int) (*ctypes.ResultTxSearch, error) }
SignClient groups together the interfaces need to get valid signatures and prove anything about the chain
type StatusClient ¶
type StatusClient interface { // General chain info Status() (*ctypes.ResultStatus, error) }
type WSEvents ¶
type WSEvents struct { cmn.BaseService // contains filtered or unexported fields }
func (*WSEvents) OnStop ¶ added in v0.14.0
func (w *WSEvents) OnStop()
Stop wraps the BaseService/eventSwitch actions as Start does