Documentation

Index

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!). merkle.DefaultProofRuntime is used to verify values returned by ABCIQuery.

    func NewClient

    func NewClient(next rpcclient.Client, lc LightClient, opts ...Option) *Client

      NewClient returns a new client.

      func (*Client) ABCIInfo

      func (c *Client) ABCIInfo(ctx context.Context) (*ctypes.ResultABCIInfo, error)

      func (*Client) ABCIQuery

      func (c *Client) ABCIQuery(ctx context.Context, path string, data tmbytes.HexBytes) (*ctypes.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) (*ctypes.ResultABCIQuery, error)

          ABCIQueryWithOptions returns an error if opts.Prove is false.

          func (*Client) Block

          func (c *Client) Block(ctx context.Context, height *int64) (*ctypes.ResultBlock, error)

            Block calls rpcclient#Block and then verifies the result.

            func (*Client) BlockByHash

            func (c *Client) BlockByHash(ctx context.Context, hash []byte) (*ctypes.ResultBlock, error)

              BlockByHash calls rpcclient#BlockByHash and then verifies the result.

              func (*Client) BlockResults

              func (c *Client) BlockResults(ctx context.Context, height *int64) (*ctypes.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) BlockchainInfo

                func (c *Client) BlockchainInfo(ctx context.Context, minHeight, maxHeight int64) (*ctypes.ResultBlockchainInfo, error)

                  BlockchainInfo calls rpcclient#BlockchainInfo and then verifies every header returned.

                  func (*Client) BroadcastEvidence

                  func (c *Client) BroadcastEvidence(ctx context.Context, ev types.Evidence) (*ctypes.ResultBroadcastEvidence, error)

                  func (*Client) BroadcastTxAsync

                  func (c *Client) BroadcastTxAsync(ctx context.Context, tx types.Tx) (*ctypes.ResultBroadcastTx, error)

                  func (*Client) BroadcastTxCommit

                  func (c *Client) BroadcastTxCommit(ctx context.Context, tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error)

                  func (*Client) BroadcastTxSync

                  func (c *Client) BroadcastTxSync(ctx context.Context, tx types.Tx) (*ctypes.ResultBroadcastTx, error)

                  func (*Client) CheckTx

                  func (c *Client) CheckTx(ctx context.Context, tx types.Tx) (*ctypes.ResultCheckTx, error)

                  func (*Client) Commit

                  func (c *Client) Commit(ctx context.Context, height *int64) (*ctypes.ResultCommit, error)

                  func (*Client) ConsensusParams

                  func (c *Client) ConsensusParams(ctx context.Context, height *int64) (*ctypes.ResultConsensusParams, error)

                  func (*Client) ConsensusState

                  func (c *Client) ConsensusState(ctx context.Context) (*ctypes.ResultConsensusState, error)

                  func (*Client) DumpConsensusState

                  func (c *Client) DumpConsensusState(ctx context.Context) (*ctypes.ResultDumpConsensusState, error)

                  func (*Client) Genesis

                  func (c *Client) Genesis(ctx context.Context) (*ctypes.ResultGenesis, error)

                  func (*Client) Health

                  func (c *Client) Health(ctx context.Context) (*ctypes.ResultHealth, error)

                  func (*Client) NetInfo

                  func (c *Client) NetInfo(ctx context.Context) (*ctypes.ResultNetInfo, error)

                  func (*Client) NumUnconfirmedTxs

                  func (c *Client) NumUnconfirmedTxs(ctx context.Context) (*ctypes.ResultUnconfirmedTxs, error)

                  func (*Client) OnStart

                  func (c *Client) OnStart() error

                  func (*Client) OnStop

                  func (c *Client) OnStop()

                  func (*Client) RegisterOpDecoder

                  func (c *Client) RegisterOpDecoder(typ string, dec merkle.OpDecoder)

                  func (*Client) Status

                  func (c *Client) Status(ctx context.Context) (*ctypes.ResultStatus, error)

                  func (*Client) Subscribe

                  func (c *Client) Subscribe(ctx context.Context, subscriber, query string,
                  	outCapacity ...int) (out <-chan ctypes.ResultEvent, err error)

                  func (*Client) SubscribeWS

                  func (c *Client) SubscribeWS(ctx *rpctypes.Context, query string) (*ctypes.ResultSubscribe, error)

                    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 []byte, prove bool) (*ctypes.ResultTx, error)

                      Tx calls rpcclient#Tx method and then verifies the proof if such was requested.

                      func (*Client) TxSearch

                      func (c *Client) TxSearch(ctx context.Context, query string, prove bool, page, perPage *int, orderBy string) (
                      	*ctypes.ResultTxSearch, error)

                      func (*Client) UnconfirmedTxs

                      func (c *Client) UnconfirmedTxs(ctx context.Context, limit *int) (*ctypes.ResultUnconfirmedTxs, error)

                      func (*Client) Unsubscribe

                      func (c *Client) Unsubscribe(ctx context.Context, subscriber, query string) error

                      func (*Client) UnsubscribeAll

                      func (c *Client) UnsubscribeAll(ctx context.Context, subscriber string) error

                      func (*Client) UnsubscribeAllWS

                      func (c *Client) UnsubscribeAllWS(ctx *rpctypes.Context) (*ctypes.ResultUnsubscribe, error)

                        UnsubscribeAllWS calls original client's UnsubscribeAll using remote address as a subscriber.

                        func (*Client) UnsubscribeWS

                        func (c *Client) UnsubscribeWS(ctx *rpctypes.Context, query string) (*ctypes.ResultUnsubscribe, error)

                          UnsubscribeWS calls original client's Unsubscribe using remote address as a subscriber.

                          func (*Client) Validators

                          func (c *Client) Validators(ctx context.Context, height *int64, pagePtr, perPagePtr *int) (*ctypes.ResultValidators,
                          	error)

                            Validators fetches and verifies validators.

                            type KeyPathFunc

                            type KeyPathFunc func(path string, key []byte) (merkle.KeyPath, error)

                              KeyPathFunc builds a merkle path out of the given path and key.

                              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)
                              }

                                LightClient is an interface that contains functionality needed by Client from the light client. go:generate mockery --case underscore --name LightClient

                                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.

                                    Source Files

                                    Directories

                                    Path Synopsis