beacon_api

package
v6.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2025 License: GPL-3.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JsonifySignedVoluntaryExits

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

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

func NewBeaconApiChainClientWithFallback

func NewBeaconApiChainClientWithFallback(jsonRestHandler RestHandler, fallbackClient iface.ChainClient) iface.ChainClient

func NewBeaconApiValidatorClient

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

func NewNodeClientWithFallback

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

func NewPrysmChainClient

func NewPrysmChainClient(jsonRestHandler RestHandler, nodeClient iface.NodeClient) iface.PrysmChainClient

NewPrysmChainClient returns implementation of iface.PrysmChainClient.

Types

type BeaconApiRestHandler added in v6.1.0

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

func (*BeaconApiRestHandler) Get added in v6.1.0

func (c *BeaconApiRestHandler) 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 (*BeaconApiRestHandler) GetSSZ added in v6.1.0

func (c *BeaconApiRestHandler) GetSSZ(ctx context.Context, endpoint string) ([]byte, http.Header, error)

func (*BeaconApiRestHandler) Host added in v6.1.0

func (c *BeaconApiRestHandler) Host() string

Host returns the underlying HTTP host

func (*BeaconApiRestHandler) HttpClient added in v6.1.0

func (c *BeaconApiRestHandler) HttpClient() *http.Client

HttpClient returns the underlying HTTP client of the handler

func (*BeaconApiRestHandler) Post added in v6.1.0

func (c *BeaconApiRestHandler) 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.

func (*BeaconApiRestHandler) PostSSZ added in v6.1.0

func (c *BeaconApiRestHandler) PostSSZ(
	ctx context.Context,
	apiEndpoint string,
	headers map[string]string,
	data *bytes.Buffer,
) ([]byte, http.Header, error)

PostSSZ sends a POST request and prefers an SSZ (application/octet-stream) response body.

func (*BeaconApiRestHandler) SetHost added in v6.1.0

func (c *BeaconApiRestHandler) SetHost(host string)

type BeaconBlockConverter

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

type DoppelGangerInfo

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

type GenesisProvider

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

type IndexNotFoundError

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

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

func NewIndexNotFoundError

func NewIndexNotFoundError(pubkey string) IndexNotFoundError

NewIndexNotFoundError creates a new error instance.

func (*IndexNotFoundError) Error

func (e *IndexNotFoundError) Error() string

Error returns the underlying error message.

type RestHandler added in v6.1.0

type RestHandler interface {
	Get(ctx context.Context, endpoint string, resp interface{}) error
	GetSSZ(ctx context.Context, endpoint string) ([]byte, http.Header, error)
	Post(ctx context.Context, endpoint string, headers map[string]string, data *bytes.Buffer, resp interface{}) error
	PostSSZ(ctx context.Context, endpoint string, headers map[string]string, data *bytes.Buffer) ([]byte, http.Header, error)
	HttpClient() *http.Client
	Host() string
	SetHost(host string)
}

func NewBeaconApiRestHandler added in v6.1.0

func NewBeaconApiRestHandler(client http.Client, host string) RestHandler

NewBeaconApiRestHandler returns a RestHandler

type ValidatorClientOpt

type ValidatorClientOpt func(*beaconApiValidatorClient)

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