prysmgrpc

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: Apache-2.0 Imports: 22 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 WithAddress

func WithAddress(address string) Parameter

WithAddress provides the address for the endpoint.

func WithCACert added in v0.7.2

func WithCACert(cert []byte) Parameter

WithCACert sets the bytes of the certificate authority TLS certificate.

func WithClientCert added in v0.7.2

func WithClientCert(cert []byte) Parameter

WithClientCert sets the bytes of the client TLS certificate.

func WithClientKey added in v0.7.2

func WithClientKey(key []byte) Parameter

WithClientKey sets the bytes of the client TLS key.

func WithLogLevel

func WithLogLevel(logLevel zerolog.Level) Parameter

WithLogLevel sets the log level for the module.

func WithTLS added in v0.7.2

func WithTLS(tls bool) Parameter

WithTLS toggles the transport requirement for TLS.

func WithTimeout

func WithTimeout(timeout time.Duration) Parameter

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

type Service

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

Service is an Ethereum 2 client service.

func New

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

New creates a new Ethereum 2 client service, connecting with Prysm GRPC.

func (*Service) AddOnBeaconChainHeadUpdatedHandler

func (s *Service) AddOnBeaconChainHeadUpdatedHandler(ctx context.Context, handler client.BeaconChainHeadUpdatedHandler) error

AddOnBeaconChainHeadUpdatedHandler adds a handler provided with beacon chain head updates.

func (*Service) Address added in v0.6.8

func (s *Service) Address() string

Address provides the address for the connection.

func (*Service) AttestationData

func (s *Service) AttestationData(ctx context.Context, slot spec.Slot, committeeIndex spec.CommitteeIndex) (*spec.AttestationData, error)

AttestationData obtains attestation data for a slot.

func (*Service) AttesterDuties

func (s *Service) AttesterDuties(ctx context.Context, epoch spec.Epoch, indices []spec.ValidatorIndex) ([]*api.AttesterDuty, error)

AttesterDuties obtains attester duties.

func (*Service) BeaconBlockProposal

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

BeaconBlockProposal fetches a proposed beacon block for signing.

func (*Service) BeaconBlockRootBySlot

func (s *Service) BeaconBlockRootBySlot(ctx context.Context, slot uint64) ([]byte, error)

BeaconBlockRootBySlot fetches a block's root given its slot.

func (*Service) CurrentEpoch

func (s *Service) CurrentEpoch(ctx context.Context) (uint64, error)

CurrentEpoch is a helper that calculates the current epoch.

func (*Service) CurrentSlot

func (s *Service) CurrentSlot(ctx context.Context) (uint64, error)

CurrentSlot is a helper that calculates the current slot.

func (*Service) Domain added in v0.6.9

func (s *Service) Domain(ctx context.Context, domainType spec.DomainType, epoch spec.Epoch) (spec.Domain, error)

Domain provides a domain for a given domain type at a given epoch.

func (*Service) EpochFromStateID added in v0.6.3

func (s *Service) EpochFromStateID(ctx context.Context, stateID string) (spec.Epoch, error)

EpochFromStateID obtains the epoch given the state ID.

func (*Service) Events added in v0.6.9

func (s *Service) Events(ctx context.Context, topics []string, handler client.EventHandlerFunc) error

Events feeds requested events with the given topics to the supplied handler.

func (*Service) FarFutureEpoch

func (s *Service) FarFutureEpoch(ctx context.Context) (spec.Epoch, error)

FarFutureEpoch provides the value of the far future epoch of the chain.

func (*Service) Fork

func (s *Service) Fork(ctx context.Context, stateID string) (*spec.Fork, error)

Fork provides the fork at a given epoch. Prysm does not provide a method to obtain the current fork version, so provide the genesis fork version.

func (*Service) Genesis

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

Genesis provides the genesis information of the chain.

func (*Service) GenesisTime

func (s *Service) GenesisTime(ctx context.Context) (time.Time, error)

GenesisTime provides the genesis time of the chain.

func (*Service) GenesisValidatorsRoot

func (s *Service) GenesisValidatorsRoot(ctx context.Context) ([]byte, error)

GenesisValidatorsRoot provides the genesis validators root 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) NodeVersion

func (s *Service) NodeVersion(ctx context.Context) (string, error)

NodeVersion returns a free-text string with the node version.

func (*Service) ProposerDuties

func (s *Service) ProposerDuties(ctx context.Context, epoch spec.Epoch, indices []spec.ValidatorIndex) ([]*api.ProposerDuty, error)

ProposerDuties obtains proposer duties.

func (*Service) PrysmAggregateAttestation added in v0.6.9

func (s *Service) PrysmAggregateAttestation(ctx context.Context, attestation *spec.Attestation, validatorPubKey spec.BLSPubKey, slotSignature spec.BLSSignature) (*spec.Attestation, error)

PrysmAggregateAttestation fetches the aggregate attestation given an attestation.

func (*Service) PrysmValidatorBalances added in v0.6.9

func (s *Service) PrysmValidatorBalances(ctx context.Context, stateID string, validatorPubKeys []spec.BLSPubKey) (map[spec.ValidatorIndex]spec.Gwei, error)

PrysmValidatorBalances provides the validator balances for a given state. stateID can be a slot number or state root, or one of the special values "genesis", "head", "justified" or "finalized". validators is a list of validators to restrict the returned values. If no validators are supplied no filter will be applied.

func (*Service) SignedBeaconBlock added in v0.6.9

func (s *Service) SignedBeaconBlock(ctx context.Context, blockID string) (*spec.SignedBeaconBlock, error)

SignedBeaconBlock fetches a signed beacon block given a block ID.

func (*Service) SlotDuration

func (s *Service) SlotDuration(ctx context.Context) (time.Duration, error)

SlotDuration provides the duration of a slot of the chain.

func (*Service) SlotFromStateID added in v0.6.3

func (s *Service) SlotFromStateID(ctx context.Context, stateID string) (spec.Slot, error)

SlotFromStateID obtains the slot given the state ID.

func (*Service) SlotsPerEpoch

func (s *Service) SlotsPerEpoch(ctx context.Context) (uint64, error)

SlotsPerEpoch provides the number of slots per epoch of the chain.

func (*Service) Spec added in v0.6.10

func (s *Service) Spec(ctx context.Context) (map[string]interface{}, error)

Spec provides the spec information of the chain.

func (*Service) SubmitAggregateAttestations

func (s *Service) SubmitAggregateAttestations(ctx context.Context, aggregateAndProofs []*spec.SignedAggregateAndProof) error

SubmitAggregateAttestations submits aggregate attestations.

func (*Service) SubmitAttestations added in v0.6.15

func (s *Service) SubmitAttestations(ctx context.Context, attestations []*spec.Attestation) error

SubmitAttestations submits attestations. Prysm does not provide the ability to submit attestations natively, so send individually.

func (*Service) SubmitBeaconBlock

func (s *Service) SubmitBeaconBlock(ctx context.Context, block *spec.SignedBeaconBlock) error

SubmitBeaconBlock submits a beacon block.

func (*Service) SubmitBeaconCommitteeSubscriptions

func (s *Service) SubmitBeaconCommitteeSubscriptions(ctx context.Context, subscriptions []*api.BeaconCommitteeSubscription) error

SubmitBeaconCommitteeSubscriptions subscribes to beacon committees.

func (*Service) SubmitVoluntaryExit added in v0.6.10

func (s *Service) SubmitVoluntaryExit(ctx context.Context, voluntaryExit *spec.SignedVoluntaryExit) error

SubmitVoluntaryExit submits a voluntary exit.

func (*Service) TargetAggregatorsPerCommittee

func (s *Service) TargetAggregatorsPerCommittee(ctx context.Context) (uint64, error)

TargetAggregatorsPerCommittee provides the target number of aggregators for each attestation committee.

func (*Service) Validators

func (s *Service) Validators(ctx context.Context, stateID string, validatorIndices []spec.ValidatorIndex) (map[spec.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.6.9

func (s *Service) ValidatorsByPubKey(ctx context.Context, stateID string, validatorPubKeys []spec.BLSPubKey) (map[spec.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.

func (*Service) ValidatorsWithoutBalance added in v0.6.7

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

ValidatorsWithoutBalance provides the validators, with their status, for a given state. Balances are set to 0. This is a non-standard call, only to be used if fetching balances results in the call being too slow. stateID can be a slot number or state root, or one of the special values "genesis", "head", "justified" or "finalized". validators is a list of validators to restrict the returned values. If no validators are supplied no filter will be applied.

func (*Service) ValidatorsWithoutBalanceByPubKey added in v0.6.13

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

ValidatorsWithoutBalanceByPubKey provides the validators, with their status, for a given state. This is a non-standard call, only to be used if fetching balances results in the call being too slow. stateID can be a slot number or state root, or one of the special values "genesis", "head", "justified" or "finalized". validators is a list of validators to restrict the returned values. If no validators 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