utils

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: GPL-3.0 Imports: 35 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 DecodeENR added in v1.11.2

func DecodeENR(raw string) (*enr.Record, error)

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 FormatEthAddress

func FormatEthAddress(address []byte) template.HTML
func FormatEthAddressLink(address []byte) template.HTML
func FormatEthBlockHashLink(blockHash []byte) template.HTML
func FormatEthBlockLink(blockNum uint64) template.HTML
func FormatEthTransactionLink(hash []byte, width 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 FormatWithdawalCredentials

func FormatWithdawalCredentials(hash []byte) template.HTML

func GetExplorerVersion

func GetExplorerVersion() string

func GetKeyValuesFromENR added in v1.11.2

func GetKeyValuesFromENR(r *enr.Record) map[string]interface{}

func GetNodeIDFromENR added in v1.11.2

func GetNodeIDFromENR(r *enr.Record) string

func GetRedactedUrl

func GetRedactedUrl(requrl string) string

func GetTemplateFuncs

func GetTemplateFuncs() template.FuncMap

GetTemplateFuncs will get the template functions

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 SyncCommitteeParticipation

func SyncCommitteeParticipation(bits []byte, syncCommitteeSize uint64) float64

func WaitForCtrlC

func WaitForCtrlC()

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

Types

type LogWriter

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

func InitLogger

func InitLogger() (*LogWriter, logrus.FieldLogger)

func (*LogWriter) Dispose

func (logWriter *LogWriter) Dispose()

type LogWriterHook

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

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

func (*LogWriterHook) Fire

func (hook *LogWriterHook) Fire(entry *logrus.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() []logrus.Level

Jump to

Keyboard shortcuts

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