chaintime

package
v0.0.0-...-76c5325 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseEpoch

func ParseEpoch(chainTime *ChainTime, epochStr string) (phase0.Epoch, error)

ParseEpoch parses input to calculate the desired epoch.

Types

type ChainTime

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

ChainTime provides chain time ChainTimes.

func NewChainTime

func NewChainTime(params ...Parameter) (*ChainTime, error)

New creates a new controller.

func (*ChainTime) CurrentEpoch

func (s *ChainTime) CurrentEpoch() phase0.Epoch

CurrentEpoch provides the current epoch.

func (*ChainTime) CurrentSlot

func (s *ChainTime) CurrentSlot() phase0.Slot

CurrentSlot provides the current slot.

func (*ChainTime) CurrentSyncCommitteePeriod

func (s *ChainTime) CurrentSyncCommitteePeriod() uint64

CurrentSyncCommitteePeriod provides the current sync committee period.

func (*ChainTime) FirstSlotOfEpoch

func (s *ChainTime) FirstSlotOfEpoch(epoch phase0.Epoch) phase0.Slot

FirstSlotOfEpoch provides the first slot of the given epoch.

func (*ChainTime) GenesisTime

func (s *ChainTime) GenesisTime() time.Time

GenesisTime provides the time of the chain's genesis.

func (*ChainTime) LastSlotOfEpoch

func (s *ChainTime) LastSlotOfEpoch(epoch phase0.Epoch) phase0.Slot

LastSlotOfEpoch provides the last slot of the given epoch.

func (*ChainTime) SlotDuration

func (s *ChainTime) SlotDuration() time.Duration

SlotDuration provides the duration of the chain's slot.

func (*ChainTime) SlotToEpoch

func (s *ChainTime) SlotToEpoch(slot phase0.Slot) phase0.Epoch

SlotToEpoch provides the epoch of a given slot.

func (*ChainTime) SlotToSyncCommitteePeriod

func (s *ChainTime) SlotToSyncCommitteePeriod(slot phase0.Slot) uint64

SlotToSyncCommitteePeriod provides the sync committee period of the given slot.

func (*ChainTime) SlotsPerEpoch

func (s *ChainTime) SlotsPerEpoch() uint64

SlotsPerEpoch provides the number of slots in the chain's epoch.

func (*ChainTime) StartOfEpoch

func (s *ChainTime) StartOfEpoch(epoch phase0.Epoch) time.Time

StartOfEpoch provides the time at which a given epoch starts.

func (*ChainTime) StartOfSlot

func (s *ChainTime) StartOfSlot(slot phase0.Slot) time.Time

StartOfSlot provides the time at which a given slot starts.

func (*ChainTime) TimestampToEpoch

func (s *ChainTime) TimestampToEpoch(timestamp time.Time) phase0.Epoch

TimestampToEpoch provides the epoch of the given timestamp.

func (*ChainTime) TimestampToSlot

func (s *ChainTime) TimestampToSlot(timestamp time.Time) phase0.Slot

TimestampToSlot provides the slot of the given timestamp.

type Parameter

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

Parameter is the interface for ChainTime parameters.

func WithGenesisProvider

func WithGenesisProvider(provider eth2client.GenesisProvider) Parameter

WithGenesisProvider sets the genesis time provider.

func WithLogLevel

func WithLogLevel(logLevel logging.LogLevel) Parameter

WithLogLevel sets the log level for the module.

func WithSpecProvider

func WithSpecProvider(provider eth2client.SpecProvider) Parameter

WithSpecProvider sets the spec provider.

Jump to

Keyboard shortcuts

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