node

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

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:"ready_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