Documentation ¶
Index ¶
- type Client
- func (c *Client) ABCIInfo(ctx context.Context) (*coretypes.ResultABCIInfo, error)
- func (c *Client) ABCIQuery(ctx context.Context, path string, data tmbytes.HexBytes) (*coretypes.ResultABCIQuery, error)
- func (c *Client) ABCIQueryWithOptions(ctx context.Context, path string, data tmbytes.HexBytes, ...) (*coretypes.ResultABCIQuery, error)
- func (c *Client) Block(ctx context.Context, height *int64) (*coretypes.ResultBlock, error)
- func (c *Client) BlockByHash(ctx context.Context, hash tmbytes.HexBytes) (*coretypes.ResultBlock, error)
- func (c *Client) BlockResults(ctx context.Context, height *int64) (*coretypes.ResultBlockResults, error)
- func (c *Client) BlockSearch(ctx context.Context, query string, page, perPage *int, orderBy string) (*coretypes.ResultBlockSearch, error)
- func (c *Client) BlockchainInfo(ctx context.Context, minHeight, maxHeight int64) (*coretypes.ResultBlockchainInfo, error)
- func (c *Client) BroadcastEvidence(ctx context.Context, ev types.Evidence) (*coretypes.ResultBroadcastEvidence, error)
- func (c *Client) BroadcastTx(ctx context.Context, tx types.Tx) (*coretypes.ResultBroadcastTx, error)
- func (c *Client) BroadcastTxAsync(ctx context.Context, tx types.Tx) (*coretypes.ResultBroadcastTx, error)
- func (c *Client) BroadcastTxCommit(ctx context.Context, tx types.Tx) (*coretypes.ResultBroadcastTxCommit, error)
- func (c *Client) BroadcastTxSync(ctx context.Context, tx types.Tx) (*coretypes.ResultBroadcastTx, error)
- func (c *Client) CheckTx(ctx context.Context, tx types.Tx) (*coretypes.ResultCheckTx, error)
- func (c *Client) Commit(ctx context.Context, height *int64) (*coretypes.ResultCommit, error)
- func (c *Client) ConsensusParams(ctx context.Context, height *int64) (*coretypes.ResultConsensusParams, error)
- func (c *Client) ConsensusState(ctx context.Context) (*coretypes.ResultConsensusState, error)
- func (c *Client) DumpConsensusState(ctx context.Context) (*coretypes.ResultDumpConsensusState, error)
- func (c *Client) Events(ctx context.Context, req *coretypes.RequestEvents) (*coretypes.ResultEvents, error)
- func (c *Client) Genesis(ctx context.Context) (*coretypes.ResultGenesis, error)
- func (c *Client) GenesisChunked(ctx context.Context, id uint) (*coretypes.ResultGenesisChunk, error)
- func (c *Client) Header(ctx context.Context, height *int64) (*coretypes.ResultHeader, error)
- func (c *Client) HeaderByHash(ctx context.Context, hash tmbytes.HexBytes) (*coretypes.ResultHeader, error)
- func (c *Client) Health(ctx context.Context) (*coretypes.ResultHealth, error)
- func (c *Client) NetInfo(ctx context.Context) (*coretypes.ResultNetInfo, error)
- func (c *Client) NumUnconfirmedTxs(ctx context.Context) (*coretypes.ResultUnconfirmedTxs, error)
- func (c *Client) OnStart(ctx context.Context) error
- func (c *Client) OnStop()
- func (c *Client) RegisterOpDecoder(typ string, dec merkle.OpDecoder)
- func (c *Client) RemoveTx(ctx context.Context, txKey types.TxKey) error
- func (c *Client) Status(ctx context.Context) (*coretypes.ResultStatus, error)
- func (c *Client) Subscribe(ctx context.Context, subscriber, query string, outCapacity ...int) (out <-chan coretypes.ResultEvent, err error)
- func (c *Client) SubscribeWS(ctx context.Context, query string) (*coretypes.ResultSubscribe, error)
- func (c *Client) Tx(ctx context.Context, hash tmbytes.HexBytes, prove bool) (*coretypes.ResultTx, error)
- func (c *Client) TxSearch(ctx context.Context, query string, prove bool, page, perPage *int, ...) (*coretypes.ResultTxSearch, error)
- func (c *Client) UnconfirmedTxs(ctx context.Context, page, perPage *int) (*coretypes.ResultUnconfirmedTxs, error)
- func (c *Client) Unsubscribe(ctx context.Context, subscriber, query string) error
- func (c *Client) UnsubscribeAll(ctx context.Context, subscriber string) error
- func (c *Client) UnsubscribeAllWS(ctx context.Context) (*coretypes.ResultUnsubscribe, error)
- func (c *Client) UnsubscribeWS(ctx context.Context, query string) (*coretypes.ResultUnsubscribe, error)
- func (c *Client) Validators(ctx context.Context, height *int64, pagePtr, perPagePtr *int, ...) (*coretypes.ResultValidators, error)
- type KeyPathFunc
- type LightClient
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { service.BaseService // contains filtered or unexported fields }
Client is an RPC client, which uses light#Client to verify data (if it can be proved). Note, merkle.DefaultProofRuntime is used to verify values returned by ABCI#Query.
func (*Client) ABCIQuery ¶
func (c *Client) ABCIQuery(ctx context.Context, path string, data tmbytes.HexBytes) (*coretypes.ResultABCIQuery, error)
ABCIQuery requests proof by default.
func (*Client) ABCIQueryWithOptions ¶
func (c *Client) ABCIQueryWithOptions(ctx context.Context, path string, data tmbytes.HexBytes, opts rpcclient.ABCIQueryOptions) (*coretypes.ResultABCIQuery, error)
ABCIQueryWithOptions returns an error if opts.Prove is false. ABCIQueryWithOptions returns the result for the given height (opts.Height). If no height is provided, the results of the block preceding the latest are returned.
func (*Client) BlockByHash ¶
func (c *Client) BlockByHash(ctx context.Context, hash tmbytes.HexBytes) (*coretypes.ResultBlock, error)
BlockByHash calls rpcclient#BlockByHash and then verifies the result.
func (*Client) BlockResults ¶
func (c *Client) BlockResults(ctx context.Context, height *int64) (*coretypes.ResultBlockResults, error)
BlockResults returns the block results for the given height. If no height is provided, the results of the block preceding the latest are returned.
func (*Client) BlockSearch ¶
func (*Client) BlockchainInfo ¶
func (c *Client) BlockchainInfo(ctx context.Context, minHeight, maxHeight int64) (*coretypes.ResultBlockchainInfo, error)
BlockchainInfo calls rpcclient#BlockchainInfo and then verifies every header returned.
func (*Client) BroadcastEvidence ¶
func (*Client) BroadcastTx ¶
func (*Client) BroadcastTxAsync ¶
func (*Client) BroadcastTxCommit ¶
func (*Client) BroadcastTxSync ¶
func (*Client) ConsensusParams ¶
func (*Client) ConsensusState ¶
func (*Client) DumpConsensusState ¶
func (*Client) Events ¶
func (c *Client) Events(ctx context.Context, req *coretypes.RequestEvents) (*coretypes.ResultEvents, error)
func (*Client) GenesisChunked ¶
func (*Client) HeaderByHash ¶
func (c *Client) HeaderByHash(ctx context.Context, hash tmbytes.HexBytes) (*coretypes.ResultHeader, error)
HeaderByHash calls rpcclient#HeaderByHash and updates the client if it's falling behind.
func (*Client) NumUnconfirmedTxs ¶
func (*Client) RegisterOpDecoder ¶
func (*Client) Status ¶
Returns the status of the light client. Previously this was querying the primary connected to the client As a consequence of this change, running /status on the light client will return nil for SyncInfo, NodeInfo and ValdiatorInfo.
func (*Client) SubscribeWS ¶
SubscribeWS subscribes for events using the given query and remote address as a subscriber, but does not verify responses (UNSAFE)! TODO: verify data
func (*Client) Tx ¶
func (c *Client) Tx(ctx context.Context, hash tmbytes.HexBytes, prove bool) (*coretypes.ResultTx, error)
Tx calls rpcclient#Tx method and then verifies the proof if such was requested.
func (*Client) UnconfirmedTxs ¶
func (*Client) Unsubscribe ¶
func (*Client) UnsubscribeAll ¶
func (*Client) UnsubscribeAllWS ¶
UnsubscribeAllWS calls original client's UnsubscribeAll using remote address as a subscriber.
func (*Client) UnsubscribeWS ¶
func (c *Client) UnsubscribeWS(ctx context.Context, query string) (*coretypes.ResultUnsubscribe, error)
UnsubscribeWS calls original client's Unsubscribe using remote address as a subscriber.
type KeyPathFunc ¶
KeyPathFunc builds a merkle path out of the given path and key.
func DefaultMerkleKeyPathFn ¶
func DefaultMerkleKeyPathFn() KeyPathFunc
DefaultMerkleKeyPathFn creates a function used to generate merkle key paths from a path string and a key. This is the default used by the cosmos SDK. This merkle key paths are required when verifying /abci_query calls
type LightClient ¶
type LightClient interface { ChainID() string Update(ctx context.Context, now time.Time) (*types.LightBlock, error) VerifyLightBlockAtHeight(ctx context.Context, height int64, now time.Time) (*types.LightBlock, error) TrustedLightBlock(height int64) (*types.LightBlock, error) Status(ctx context.Context) *types.LightClientInfo }
LightClient is an interface that contains functionality needed by Client from the light client.
type Option ¶
type Option func(*Client)
Option allow you to tweak Client.
func KeyPathFn ¶
func KeyPathFn(fn KeyPathFunc) Option
KeyPathFn option can be used to set a function, which parses a given path and builds the merkle path for the prover. It must be provided if you want to call ABCIQuery or ABCIQueryWithOptions.