client

package
v0.4.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrHTTPErrorResponse = errors.New("got an HTTP error response")
	ErrNodesUnavailable  = errors.New("beacon nodes are unavailable")
)
View Source
var (
	ErrBeaconNodeSyncing      = errors.New("beacon node is syncing")
	ErrWithdrawalsUnsupported = errors.New("withdrawals are not supported")
)

Functions

func NewBeaconClient

func NewBeaconClient(l log.Logger, endpoint string) (*beaconClient, error)

Types

type AllValidatorsResponse

type AllValidatorsResponse struct {
	Data []ValidatorResponseEntry
}

AllValidatorsResponse is the response for querying active validators

type BeaconMetrics

type BeaconMetrics struct {
	Timing *prometheus.HistogramVec
}

type BeaconNode

type BeaconNode interface {
	SubscribeToHeadEvents(ctx context.Context, slotC chan HeadEvent)
	GetProposerDuties(structs.Epoch) (*RegisteredProposersResponse, error)
	SyncStatus() (*SyncStatusPayloadData, error)
	KnownValidators(structs.Slot) (AllValidatorsResponse, error)
	Genesis() (structs.GenesisInfo, error)
	GetForkSchedule() (*GetForkScheduleResponse, error)
	PublishBlock(block structs.SignedBeaconBlock) error
	Randao(structs.Slot) (string, error)
	Endpoint() string
	GetWithdrawals(structs.Slot) (*GetWithdrawalsResponse, error)
}

type GenesisResponse

type GenesisResponse struct {
	Data structs.GenesisInfo
}

type GetForkScheduleResponse

type GetForkScheduleResponse struct {
	Data []struct {
		PreviousVersion string `json:"previous_version"`
		CurrentVersion  string `json:"current_version"`
		Epoch           uint64 `json:"epoch,string"`
	}
}

type GetRandaoResponse

type GetRandaoResponse struct {
	Data struct {
		Randao string `json:"randao"`
	}
}

GetRandaoResponse is the response for querying randao from beacon

type GetWithdrawalsResponse

type GetWithdrawalsResponse struct {
	Data struct {
		Withdrawals structs.Withdrawals `json:"withdrawals"`
	}
}

type HeadEvent

type HeadEvent struct {
	Slot  uint64 `json:"slot,string"`
	Block string `json:"block"`
	State string `json:"state"`
}

HeadEvent is emitted when subscribing to head events

func (HeadEvent) Loggable

func (h HeadEvent) Loggable() map[string]any

type MultiBeaconClient

type MultiBeaconClient struct {
	Log     log.Logger
	Clients []BeaconNode
	// contains filtered or unexported fields
}

func NewMultiBeaconClient

func NewMultiBeaconClient(l log.Logger, clients []BeaconNode) *MultiBeaconClient

func (*MultiBeaconClient) Endpoint

func (b *MultiBeaconClient) Endpoint() string

func (*MultiBeaconClient) Genesis

func (b *MultiBeaconClient) Genesis() (genesisInfo structs.GenesisInfo, err error)

func (*MultiBeaconClient) GetForkSchedule

func (b *MultiBeaconClient) GetForkSchedule() (spec *GetForkScheduleResponse, err error)

func (*MultiBeaconClient) GetProposerDuties

func (b *MultiBeaconClient) GetProposerDuties(epoch structs.Epoch) (*RegisteredProposersResponse, error)

func (*MultiBeaconClient) GetWithdrawals

func (b *MultiBeaconClient) GetWithdrawals(slot structs.Slot) (withdrawalsResp *GetWithdrawalsResponse, err error)

func (*MultiBeaconClient) KnownValidators

func (b *MultiBeaconClient) KnownValidators(headSlot structs.Slot) (AllValidatorsResponse, error)

func (*MultiBeaconClient) PublishBlock

func (b *MultiBeaconClient) PublishBlock(block structs.SignedBeaconBlock) (err error)

func (*MultiBeaconClient) Randao

func (b *MultiBeaconClient) Randao(slot structs.Slot) (randao string, err error)

func (*MultiBeaconClient) SubscribeToHeadEvents

func (b *MultiBeaconClient) SubscribeToHeadEvents(ctx context.Context, slotC chan HeadEvent)

func (*MultiBeaconClient) SyncStatus

func (b *MultiBeaconClient) SyncStatus() (*SyncStatusPayloadData, error)

type RegisteredProposersResponse

type RegisteredProposersResponse struct {
	Data []RegisteredProposersResponseData
}

RegisteredProposersResponse is the response for querying proposer duties

type RegisteredProposersResponseData

type RegisteredProposersResponseData struct {
	PubKey structs.PubKey `json:"pubkey"`
	Slot   uint64         `json:"slot,string"`
}

type SyncStatusPayload

type SyncStatusPayload struct {
	Data SyncStatusPayloadData
}

SyncStatusPayload is the response payload for /eth/v1/node/syncing

type SyncStatusPayloadData

type SyncStatusPayloadData struct {
	HeadSlot  uint64 `json:"head_slot,string"`
	IsSyncing bool   `json:"is_syncing"`
}

type ValidatorResponseEntry

type ValidatorResponseEntry struct {
	Index     uint64                         `json:"index,string"` // Index of validator in validator registry.
	Balance   string                         `json:"balance"`      // Current validator balance in gwei.
	Status    string                         `json:"status"`
	Validator ValidatorResponseValidatorData `json:"validator"`
}

type ValidatorResponseValidatorData

type ValidatorResponseValidatorData struct {
	Pubkey string `json:"pubkey"`
}

Notes

Bugs

  • do something with unsupported

Directories

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

Jump to

Keyboard shortcuts

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