beacon_api

package
v7.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 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

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

func (*BeaconApiRestHandler) Get

func (c *BeaconApiRestHandler) Get(ctx context.Context, endpoint string, resp any) 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

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

func (*BeaconApiRestHandler) Host

func (c *BeaconApiRestHandler) Host() string

Host returns the underlying HTTP host

func (*BeaconApiRestHandler) HttpClient

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

HttpClient returns the underlying HTTP client of the handler

func (*BeaconApiRestHandler) Post

func (c *BeaconApiRestHandler) Post(
	ctx context.Context,
	apiEndpoint string,
	headers map[string]string,
	data *bytes.Buffer,
	resp any,
) 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

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

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

type RestHandler interface {
	Get(ctx context.Context, endpoint string, resp any) 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 any) 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

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