beacon_api

package
v4.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: GPL-3.0 Imports: 42 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JsonifySignedVoluntaryExits added in v4.0.3

func JsonifySignedVoluntaryExits(voluntaryExits []*ethpb.SignedVoluntaryExit) []*shared.SignedVoluntaryExit

JsonifySignedVoluntaryExits converts an array of voluntary exit structs to a JSON hex string compatible format.

func NewBeaconApiBeaconChainClientWithFallback

func NewBeaconApiBeaconChainClientWithFallback(jsonRestHandler JsonRestHandler, fallbackClient iface.BeaconChainClient) iface.BeaconChainClient

func NewBeaconApiValidatorClient

func NewBeaconApiValidatorClient(jsonRestHandler JsonRestHandler, opts ...ValidatorClientOpt) iface.ValidatorClient

func NewNodeClientWithFallback

func NewNodeClientWithFallback(jsonRestHandler JsonRestHandler, fallbackClient iface.NodeClient) iface.NodeClient

func NewPrysmBeaconChainClient added in v4.2.0

func NewPrysmBeaconChainClient(jsonRestHandler JsonRestHandler, nodeClient iface.NodeClient) iface.PrysmBeaconChainClient

NewPrysmBeaconChainClient returns implementation of iface.PrysmBeaconChainClient.

Types

type BeaconApiJsonRestHandler added in v4.2.1

type BeaconApiJsonRestHandler struct {
	HttpClient http.Client
	Host       string
}

func (BeaconApiJsonRestHandler) Get added in v4.2.1

func (c BeaconApiJsonRestHandler) Get(ctx context.Context, endpoint string, resp interface{}) error

Get sends a GET request and decodes the response body as a JSON object into the passed in object. If an HTTP error is returned, the body is decoded as a DefaultJsonError JSON object and returned as the first return value.

func (BeaconApiJsonRestHandler) Post added in v4.2.1

func (c BeaconApiJsonRestHandler) Post(
	ctx context.Context,
	apiEndpoint string,
	headers map[string]string,
	data *bytes.Buffer,
	resp interface{},
) error

Post sends a POST request and decodes the response body as a JSON object into the passed in object. If an HTTP error is returned, the body is decoded as a DefaultJsonError JSON object and returned as the first return value.

type BeaconBlockConverter added in v4.2.0

type BeaconBlockConverter interface {
	ConvertRESTPhase0BlockToProto(block *shared.BeaconBlock) (*ethpb.BeaconBlock, error)
	ConvertRESTAltairBlockToProto(block *shared.BeaconBlockAltair) (*ethpb.BeaconBlockAltair, error)
	ConvertRESTBellatrixBlockToProto(block *shared.BeaconBlockBellatrix) (*ethpb.BeaconBlockBellatrix, error)
	ConvertRESTCapellaBlockToProto(block *shared.BeaconBlockCapella) (*ethpb.BeaconBlockCapella, error)
}

type DoppelGangerInfo

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

type EventHandler added in v4.2.1

type EventHandler struct {
	sync.Mutex
	// contains filtered or unexported fields
}

EventHandler is responsible for subscribing to the Beacon API events endpoint and dispatching received events to subscribers.

func NewEventHandler added in v4.2.1

func NewEventHandler(httpClient *http.Client, host string) *EventHandler

NewEventHandler returns a new handler.

type GenesisProvider added in v4.2.0

type GenesisProvider interface {
	GetGenesis(ctx context.Context) (*beacon.Genesis, error)
}

type IndexNotFoundError added in v4.2.0

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

IndexNotFoundError represents an error scenario where no validator index matches a pubkey.

func NewIndexNotFoundError added in v4.2.0

func NewIndexNotFoundError(pubkey string) IndexNotFoundError

NewIndexNotFoundError creates a new error instance.

func (*IndexNotFoundError) Error added in v4.2.0

func (e *IndexNotFoundError) Error() string

Error returns the underlying error message.

type JsonRestHandler added in v4.2.0

type JsonRestHandler interface {
	Get(ctx context.Context, endpoint string, resp interface{}) error
	Post(ctx context.Context, endpoint string, headers map[string]string, data *bytes.Buffer, resp interface{}) error
}

type StateValidatorsProvider added in v4.2.0

type StateValidatorsProvider interface {
	GetStateValidators(context.Context, []string, []primitives.ValidatorIndex, []string) (*beacon.GetValidatorsResponse, error)
	GetStateValidatorsForSlot(context.Context, primitives.Slot, []string, []primitives.ValidatorIndex, []string) (*beacon.GetValidatorsResponse, error)
	GetStateValidatorsForHead(context.Context, []string, []primitives.ValidatorIndex, []string) (*beacon.GetValidatorsResponse, error)
}

type ValidatorClientOpt added in v4.2.1

type ValidatorClientOpt func(*beaconApiValidatorClient)

func WithEventHandler added in v4.2.1

func WithEventHandler(h *EventHandler) ValidatorClientOpt

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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