node

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2020 License: Apache-2.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	GetMetrics() (*Metrics, error)
	GetConfigHash() (hash.Hash32, error)
	GetRPCURL() string
	GetMetricsURL() string
}

Client is used to interact with polkadot node

func NewClient

func NewClient(rpcURL *url.URL, metricsURL *url.URL) Client

NewClient creates node client instance

type MethodsResult

type MethodsResult struct {
	Version int      `json:"version"`
	Methods []string `json:"methods"`
}

MethodsResult contains all available rpc methods of node

type Metrics

type Metrics struct {
	PeerCount             *float64 `json:"peer_count"`
	BestBlockHeight       *float64 `json:"best_block_height"`
	FinalizedBlockHeight  *float64 `json:"finalized_block_height"`
	ReadyTransactionCount *float64 `json:"read_transaction_count"`
}

Metrics required to be sent to load balancer

type Properties

type Properties struct {
	SS58Format    int    `json:"ss58Format"`
	TokenDecimals int    `json:"tokenDecimals"`
	TokenSymbol   string `json:"tokenSymbol"`
}

Properties are node properties

type RPCError

type RPCError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

RPCError is error returned if rpc request fails

type RPCRequest

type RPCRequest struct {
	ID      int      `json:"id"`
	JSONRPC string   `json:"jsonrpc"`
	Method  string   `json:"method"`
	Params  []string `json:"params"`
}

RPCRequest is used for retrieving data from node

type RPCResponse

type RPCResponse struct {
	JSONRPC string      `json:"jsonrpc"`
	Error   RPCError    `json:"error"`
	ID      int         `json:"id"`
	Result  interface{} `json:"result"`
}

RPCResponse is response from rpc request

Jump to

Keyboard shortcuts

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