utils

package
v1.8.4 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2024 License: GPL-3.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BuildRelease string
View Source
var BuildVersion string
View Source
var Buildtime string
View Source
var Config *types.Config

Config is the globally accessible configuration

View Source
var ETH *big.Int = big.NewInt(0).Mul(GWEI, GWEI)
View Source
var GWEI *big.Int = big.NewInt(1000000000)

Functions

func BitAtVector

func BitAtVector(b []byte, i int) bool

func BitAtVectorReversed

func BitAtVectorReversed(b []byte, i int) bool

func DayOfSlot

func DayOfSlot(slot uint64) uint64

DayOfSlot returns the corresponding day of a slot

func DayToTime

func DayToTime(day int64) time.Time

func EpochOfSlot

func EpochOfSlot(slot uint64) uint64

EpochOfSlot returns the corresponding epoch of a slot

func EpochToTime

func EpochToTime(epoch uint64) time.Time

EpochToTime will return a time.Time for an epoch

func FormatAddCommas

func FormatAddCommas(n uint64) template.HTML

func FormatAddCommasFormated

func FormatAddCommasFormated(num float64, precision uint) template.HTML

func FormatAmount

func FormatAmount(amount *big.Int, unit string, digits int) template.HTML

func FormatAmountFormatted

func FormatAmountFormatted(amount *big.Int, unit string, digits int, maxPreCommaDigitsBeforeTrim int, fullAmountTooltip bool, smallUnit bool, newLineForUnit bool) template.HTML

func FormatBigAmount

func FormatBigAmount(amount *hexutil.Big, unit string, digits int) template.HTML

func FormatBigNumberAddCommasFormated

func FormatBigNumberAddCommasFormated(val hexutil.Big, precision uint) template.HTML

func FormatBitlist

func FormatBitlist(b []byte, v []types.NamedValidator) template.HTML

func FormatBytesAmount

func FormatBytesAmount(amount []byte, unit string, digits int) template.HTML

func FormatETH

func FormatETH(num string) string

func FormatETHAddCommasFromGwei

func FormatETHAddCommasFromGwei(gwei uint64) template.HTML

func FormatETHFromGwei

func FormatETHFromGwei(gwei uint64) string

func FormatETHFromGweiShort

func FormatETHFromGweiShort(gwei uint64) string
func FormatEthAddressLink(address []byte) template.HTML
func FormatEthBlockHashLink(blockHash []byte) template.HTML
func FormatEthBlockLink(blockNum uint64) template.HTML

func FormatFloat

func FormatFloat(num float64, precision int) string

func FormatFullETHFromGwei

func FormatFullETHFromGwei(gwei uint64) string

func FormatGraffiti

func FormatGraffiti(graffiti []byte) template.HTML

func FormatGraffitiString

func FormatGraffitiString(graffiti string) string

FormatGraffitiString formats (and escapes) the graffiti

func FormatParticipation

func FormatParticipation(v float64) template.HTML

func FormatRecentTimeShort

func FormatRecentTimeShort(ts time.Time) template.HTML

func FormatSlashedValidator

func FormatSlashedValidator(index uint64, name string) template.HTML

func FormatValidator

func FormatValidator(index uint64, name string) template.HTML

func FormatValidatorWithIndex

func FormatValidatorWithIndex(index uint64, name string) template.HTML

func GWeiBytesToEther

func GWeiBytesToEther(gwei []byte) decimal.Decimal

func GWeiToEther

func GWeiToEther(gwei *big.Int) decimal.Decimal

func GetExplorerVersion

func GetExplorerVersion() string

func GetRedactedUrl

func GetRedactedUrl(requrl string) string

func GetTemplateFuncs

func GetTemplateFuncs() template.FuncMap

GetTemplateFuncs will get the template functions

func GetValidatorChurnLimit

func GetValidatorChurnLimit(validatorCount uint64) uint64

func Goid

func Goid() int

This is terrible, slow, and should never be used.

func GraffitiToString

func GraffitiToString(graffiti []byte) string

func HandleSubroutinePanic

func HandleSubroutinePanic(identifier string)

func IncludeHTML

func IncludeHTML(path string) template.HTML

IncludeHTML adds html to the page

func LogError

func LogError(err error, errorMsg interface{}, callerSkip int, additionalInfos ...map[string]interface{})

LogError logs an error with callstack info that skips callerSkip many levels with arbitrarily many additional infos. callerSkip equal to 0 gives you info directly where LogError is called.

func LogFatal

func LogFatal(err error, errorMsg interface{}, callerSkip int, additionalInfos ...map[string]interface{})

LogFatal logs a fatal error with callstack info that skips callerSkip many levels with arbitrarily many additional infos. callerSkip equal to 0 gives you info directly where LogFatal is called.

func MustParseHex

func MustParseHex(hexString string) []byte

MustParseHex will parse a string into hex

func ReadConfig

func ReadConfig(cfg *types.Config, path string) error

ReadConfig will process a configuration

func SliceContains

func SliceContains(list []string, target string) bool

sliceContains reports whether the provided string is present in the given slice of strings.

func SlotToTime

func SlotToTime(slot uint64) time.Time

SlotToTime returns a time.Time to slot

func SyncCommitteeParticipation

func SyncCommitteeParticipation(bits []byte) float64

func TimeToDay

func TimeToDay(timestamp uint64) uint64

TimeToDay will return a days since genesis for an timestamp

func TimeToEpoch

func TimeToEpoch(ts time.Time) int64

TimeToEpoch will return an epoch for a given time

func TimeToFirstSlotOfEpoch

func TimeToFirstSlotOfEpoch(timestamp uint64) uint64

func TimeToSlot

func TimeToSlot(timestamp uint64) uint64

TimeToSlot returns time to slot in seconds

func WaitForCtrlC

func WaitForCtrlC()

WaitForCtrlC will block/wait until a control-c is pressed

func WeekOfSlot

func WeekOfSlot(slot uint64) uint64

WeekOfSlot returns the corresponding week of a slot

func WeiBytesToEther

func WeiBytesToEther(wei []byte) decimal.Decimal

func WeiToEther

func WeiToEther(wei *big.Int) decimal.Decimal

Types

type LogWriter

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

func InitLogger

func InitLogger() *LogWriter

func (*LogWriter) Dispose

func (logWriter *LogWriter) Dispose()

type LogWriterHook

type LogWriterHook struct {
	Writer    io.Writer
	LogLevels []logger.Level
}

WriterHook is a hook that writes logs of specified LogLevels to specified Writer

func (*LogWriterHook) Fire

func (hook *LogWriterHook) Fire(entry *logger.Entry) error

Fire will be called when some logging function is called with current hook It will format log entry to string and write it to appropriate writer

func (*LogWriterHook) Levels

func (hook *LogWriterHook) Levels() []logger.Level

Jump to

Keyboard shortcuts

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