Documentation ¶
Overview ¶
Package client simplifies communication with the blockchain application
Index ¶
- Variables
- type Client
- func (c *Client) BlockResults(height *int64) (*ctypes.ResultBlockResults, error)
- func (c *Client) BlockchainInfo(minHeight, maxHeight int64) (*ctypes.ResultBlockchainInfo, error)
- func (c *Client) Broadcast(tx []byte) (*ctypes.ResultBroadcastTxCommit, error)
- func (c *Client) ForceReconnect() error
- func (c *Client) Query(path string, data cmn.HexBytes) (*ctypes.ResultABCIQuery, error)
- func (c *Client) SendAsync(tx []byte) (*ctypes.ResultBroadcastTx, error)
- func (c *Client) SendSync(tx []byte) (*ctypes.ResultBroadcastTx, error)
- func (c *Client) Stop()
- func (c *Client) Subscribe(ctx context.Context, subscriber, query string, outCapacity ...int) (out <-chan ctypes.ResultEvent, err error)
- func (c *Client) TxByHash(hash cmn.HexBytes) (*ctypes.ResultTx, error)
- func (c *Client) Unsubscribe(ctx context.Context, subscriber, query string) error
- func (c *Client) UnsubscribeAll(ctx context.Context, subscriber string) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrReconnectFailure indicates error due to inability to reconnect to any specified node. ErrReconnectFailure = errors.New("could not reconnect to any node") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client encapsulates all necessary data for communicating with the blockchain application by possibly multiple clients simultaneously.
func (*Client) BlockResults ¶
func (c *Client) BlockResults(height *int64) (*ctypes.ResultBlockResults, error)
BlockResults results from a block at given height. If no height is provided, most recent block is queried
func (*Client) BlockchainInfo ¶
func (c *Client) BlockchainInfo(minHeight, maxHeight int64) (*ctypes.ResultBlockchainInfo, error)
BlockchainInfo return block headers from the specified range. Note: according to the docs it can only return up to 20 results.
func (*Client) Broadcast ¶
func (c *Client) Broadcast(tx []byte) (*ctypes.ResultBroadcastTxCommit, error)
Broadcast sends a transaction to specified blockchain nodes and waits until it is included on the chain.
func (*Client) ForceReconnect ¶
ForceReconnect tries to force the client to reconnect to one of the blockchain nodes.
func (*Client) Query ¶
Query sends a query to specified blockchain node at given path. Note that it just returns state information (that might be stale) and is NOT included in transactions.
func (*Client) SendAsync ¶
func (c *Client) SendAsync(tx []byte) (*ctypes.ResultBroadcastTx, error)
SendAsync sends an async transaction to specified blockchain node. Note that there is no guarantee the transaction was included on the chain (it might not have been even added to the mempool because it could have failed CheckTx)
func (*Client) SendSync ¶
func (c *Client) SendSync(tx []byte) (*ctypes.ResultBroadcastTx, error)
SendSync sends an sync transaction to specified blockchain node. Note that there is no guarantee the transaction succeeded, but it definitely passed CheckTx and was included in the mempool. However, it still might return an error at DeliverTx.
func (*Client) Subscribe ¶
func (c *Client) Subscribe(ctx context.Context, subscriber, query string, outCapacity ...int) (out <-chan ctypes.ResultEvent, err error)
Subscribe is a wrapper for the websocket subscribe method.
func (*Client) Unsubscribe ¶
Unsubscribe is a wrapper for the websocket unsubscribe method.