mock

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Parameter

type Parameter interface {
	// contains filtered or unexported methods
}

Parameter is the interface for service parameters.

func WithLogLevel

func WithLogLevel(logLevel zerolog.Level) Parameter

WithLogLevel sets the log level for the module.

func WithTimeout

func WithTimeout(timeout time.Duration) Parameter

WithTimeout sets the maximum duration for all requests to the endpoint.

type Service

type Service struct {

	// Values that can be altered if required.
	HeadSlot     phase0.Slot
	SyncDistance phase0.Slot
	// contains filtered or unexported fields
}

Service is a mock Ethereum 2 client service, providing data locally.

func New

func New(ctx context.Context, params ...Parameter) (*Service, error)

New creates a new Ethereum 2 client service, mocking connections

func (*Service) Address added in v0.6.24

func (s *Service) Address() string

Address provides the address of the service.

func (*Service) BeaconBlockProposal

func (s *Service) BeaconBlockProposal(ctx context.Context, slot phase0.Slot, randaoReveal phase0.BLSSignature, graffiti []byte) (*phase0.BeaconBlock, error)

BeaconBlockProposal fetches a proposed beacon block for signing.

func (*Service) BeaconBlockRoot added in v0.7.0

func (s *Service) BeaconBlockRoot(ctx context.Context, blockID string) (*phase0.Root, error)

BeaconBlockRoot fetches a block's root given a block ID.

func (*Service) Genesis

func (s *Service) Genesis(ctx context.Context) (*api.Genesis, error)

Genesis provides the genesis information of the chain.

func (*Service) Name

func (s *Service) Name() string

Name provides the name of the service.

func (*Service) NodeSyncing added in v0.6.25

func (s *Service) NodeSyncing(ctx context.Context) (*api.SyncState, error)

NodeSyncing provides the state of the node's synchronization with the chain.

func (*Service) SyncCommitteeContribution added in v0.7.0

func (s *Service) SyncCommitteeContribution(ctx context.Context, slot phase0.Slot, subcommitteeIndex uint64, beaconBlockRoot phase0.Root) (*altair.SyncCommitteeContribution, error)

SyncCommitteeContribution provides a sync committee contribution.

func (*Service) Validators added in v0.8.1

func (s *Service) Validators(ctx context.Context, stateID string, validatorIndices []phase0.ValidatorIndex) (map[phase0.ValidatorIndex]*api.Validator, error)

Validators provides the validators, with their balance and status, for a given state. stateID can be a slot number or state root, or one of the special values "genesis", "head", "justified" or "finalized". validatorIndices is a list of validator indices to restrict the returned values. If no validators IDs are supplied no filter will be applied.

func (*Service) ValidatorsByPubKey added in v0.8.1

func (s *Service) ValidatorsByPubKey(ctx context.Context, stateID string, validatorPubKeys []phase0.BLSPubKey) (map[phase0.ValidatorIndex]*api.Validator, error)

ValidatorsByPubKey provides the validators, with their balance and status, for a given state. stateID can be a slot number or state root, or one of the special values "genesis", "head", "justified" or "finalized". validatorPubKeys is a list of validator public keys to restrict the returned values. If no validators public keys are supplied no filter will be applied.

Jump to

Keyboard shortcuts

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