remote

package
v4.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2023 License: CC0-1.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HTTPProtocols = regexp.MustCompile("https?://")
)

Functions

func CreateGrpcConnection

func CreateGrpcConnection(cfg *GRPCConfig) (*grpc.ClientConn, error)

CreateGrpcConnection creates a new gRPC client connection from the given configuration

func GetHeightRequestContext

func GetHeightRequestContext(context context.Context, height int64) context.Context

GetHeightRequestContext adds the height to the context for querying the state at a given height

func MustCreateGrpcConnection

func MustCreateGrpcConnection(cfg *GRPCConfig) *grpc.ClientConn

MustCreateGrpcConnection creates a new gRPC connection using the provided configuration and panics on error

Types

type Details

type Details struct {
	RPC  *RPCConfig  `yaml:"rpc"`
	GRPC *GRPCConfig `yaml:"grpc"`
	REST *RESTConfig `yaml:"rest"`
}

Details represents a node details for a remote node

func DefaultDetails

func DefaultDetails() *Details

func NewDetails

func NewDetails(rpc *RPCConfig, grpc *GRPCConfig, rest *RESTConfig) *Details

func (*Details) Validate

func (d *Details) Validate() error

Validate implements node.Details

type GRPCConfig

type GRPCConfig struct {
	Address  string `yaml:"address"`
	Insecure bool   `yaml:"insecure"`
}

GRPCConfig contains the configuration for the RPC endpoint

func DefaultGrpcConfig

func DefaultGrpcConfig() *GRPCConfig

DefaultGrpcConfig returns the default instance of a GrpcConfig

func NewGrpcConfig

func NewGrpcConfig(address string, insecure bool) *GRPCConfig

NewGrpcConfig allows to build a new GrpcConfig instance

type Node

type Node struct {
	// contains filtered or unexported fields
}

Node implements a wrapper around both a Tendermint RPCConfig client and a chain SDK REST client that allows for essential data queries.

func NewNode

func NewNode(cfg *Details, codec codec.Codec) (*Node, error)

NewNode allows to build a new Node instance

func (*Node) Block

func (cp *Node) Block(height int64) (*tmctypes.ResultBlock, error)

Block implements node.Node

func (*Node) BlockResults

func (cp *Node) BlockResults(height int64) (*tmctypes.ResultBlockResults, error)

BlockResults implements node.Node

func (*Node) ChainID

func (cp *Node) ChainID() (string, error)

ChainID implements node.Node

func (*Node) ConsensusState

func (cp *Node) ConsensusState() (*constypes.RoundStateSimple, error)

ConsensusState implements node.Node

func (*Node) Genesis

func (cp *Node) Genesis() (*tmctypes.ResultGenesis, error)

Genesis implements node.Node

func (*Node) LatestHeight

func (cp *Node) LatestHeight() (int64, error)

LatestHeight implements node.Node

func (*Node) Stop

func (cp *Node) Stop()

Stop implements node.Node

func (*Node) SubscribeEvents

func (cp *Node) SubscribeEvents(subscriber, query string) (<-chan tmctypes.ResultEvent, context.CancelFunc, error)

SubscribeEvents implements node.Node

func (*Node) SubscribeNewBlocks

func (cp *Node) SubscribeNewBlocks(subscriber string) (<-chan tmctypes.ResultEvent, context.CancelFunc, error)

SubscribeNewBlocks implements node.Node

func (*Node) Tx

func (cp *Node) Tx(hash string) (*types.Tx, error)

Tx implements node.Node

func (*Node) TxSearch

func (cp *Node) TxSearch(query string, page *int, perPage *int, orderBy string) (*tmctypes.ResultTxSearch, error)

TxSearch implements node.Node

func (*Node) Txs

func (cp *Node) Txs(block *tmctypes.ResultBlock) ([]*types.Tx, error)

Txs implements node.Node

func (*Node) Validators

func (cp *Node) Validators(height int64) (*tmctypes.ResultValidators, error)

Validators implements node.Node

type RESTConfig

type RESTConfig struct {
	Address string `yaml:"address"`
}

RPCConfig contains the configuration for the RPC endpoint

func DefaultRestConfig

func DefaultRestConfig() *RESTConfig

DefaultRestConfig returns the default instance of a GrpcConfig

func NewRestConfig

func NewRestConfig(address string) *RESTConfig

NewRestConfig allows to build a new GrpcConfig instance

type RPCConfig

type RPCConfig struct {
	ClientName     string `yaml:"client_name"`
	Address        string `yaml:"address"`
	MaxConnections int    `yaml:"max_connections"`
}

RPCConfig contains the configuration for the RPC endpoint

func DefaultRPCConfig

func DefaultRPCConfig() *RPCConfig

DefaultRPCConfig returns the default instance of RPCConfig

func NewRPCConfig

func NewRPCConfig(clientName, address string, maxConnections int) *RPCConfig

NewRPCConfig allows to build a new RPCConfig instance

type Source

type Source struct {
	Ctx          context.Context
	GrpcConn     *grpc.ClientConn
	Restendpoint string
}

Source implements the keeper.Source interface relying on a GRPC connection

func NewSource

func NewSource(config *GRPCConfig, restEndpoint string) (*Source, error)

NewSource returns a new Source instance

func (Source) Type

func (k Source) Type() string

Type implements keeper.Type

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL