rpc

package
v1.10.3 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2024 License: LGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// APIVersion used for DApp's, bumped after RPC refactor (7/2020)
	APIVersion = "1.0"
	// LogTag is the tag found in the log for all RPC logs
	LogTag = "[BOOT_RPC]"
	// HTTPPortOffset ..
	HTTPPortOffset = 500
	// WSPortOffset ..
	WSPortOffset = 800
)

Variables

View Source
var (
	// ErrInvalidLogLevel when invalid log level is provided
	ErrInvalidLogLevel = errors.New("invalid log level")
	// ErrIncorrectChainID when ChainID does not match running node
	ErrIncorrectChainID = errors.New("incorrect chain id")
	// ErrInvalidChainID when ChainID of signer does not match that of running node
	ErrInvalidChainID = errors.New("invalid chain id for signer")
	// ErrNotBeaconShard when rpc is called on not beacon chain node
	ErrNotBeaconShard = errors.New("cannot call this rpc on non beaconchain node")
	// ErrUnknownRPCVersion when rpc method has an unknown or unhandled version
	ErrUnknownRPCVersion = errors.New("API service has an unknown version")
)
View Source
var (
	// HTTPModules ..
	HTTPModules = []string{"itcboot", "itcbootv2", "eth", "debug", "trace"}
	// WSModules ..
	WSModules = []string{"itcboot", "itcbootv2", "eth", "debug", "trace"}
)

Functions

func NewPublicBootAPI

func NewPublicBootAPI(itcboot *itcboot.BootService, version Version) rpc.API

NewPublicBootAPI creates a new API for the RPC interface

func StartServers

func StartServers(itcboot *itcboot.BootService, apis []rpc.API, config bootnodeConfigs.RPCServerConfig, rpcOpt intelchain.RpcOptConfig) error

StartServers starts the http & ws servers

func StopServers

func StopServers() error

StopServers stops the http & ws servers

Types

type PublicBootService

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

PublicBootService provides an API to access Intelchain related information. It offers only methods that operate on public data that is freely available to anyone.

func (*PublicBootService) GetNodeMetadata

func (s *PublicBootService) GetNodeMetadata(
	ctx context.Context,
) (StructuredResponse, error)

GetNodeMetadata produces a NodeMetadata record, data is from the answering RPC node

func (*PublicBootService) GetPeerInfo

func (s *PublicBootService) GetPeerInfo(
	ctx context.Context,
) (StructuredResponse, error)

GetPeerInfo produces a NodePeerInfo record

func (*PublicBootService) ProtocolVersion

func (s *PublicBootService) ProtocolVersion(
	ctx context.Context,
) (interface{}, error)

ProtocolVersion returns the current Intelchain protocol version this node supports Note that the return type is an interface to account for the different versions

type StructuredResponse

type StructuredResponse = map[string]interface{}

StructuredResponse type of RPCs

func NewStructuredResponse

func NewStructuredResponse(input interface{}) (StructuredResponse, error)

NewStructuredResponse creates a structured response from the given input

type Version

type Version int

Version of the RPC

const (
	V1 Version = iota
	V2
	Eth
	Debug
	Trace
)

Version enum

func (Version) Namespace

func (n Version) Namespace() string

Namespace of the RPC version

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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