utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByteArrayToArray

func ByteArrayToArray(arr [][]byte) []string

func ByteArrayToStringArray

func ByteArrayToStringArray(arr [][]byte) string

func DecodeTx

func DecodeTx(rawTx []byte) (*types.Transaction, error)

func DecryptKey

func DecryptKey(cfg *config.CliConfig) (*keystore.Key, error)

func DeepCopy

func DeepCopy(a, b interface{})

Not the most efficient way of deep coping, if performance matters, dont use this.

func Equals

func Equals(a string, b string) bool

func GetActivationSlotOfLatestProcessedValidator

func GetActivationSlotOfLatestProcessedValidator(
	validators map[phase0.ValidatorIndex]*v1.Validator) uint64

func GetEth1Address

func GetEth1Address(withdrawalCred string) (string, error)

See: https://github.com/ethereum/eth2.0-specs/blob/dev/specs/phase0/validator.md#withdrawal-credentials Input example: 01000000000000000000000059b0d71688da01057c08e4c1baa8faa629819c2a Output example: 0x59b0d71688da01057c08e4c1baa8faa629819c2a

func GetEth1AddressByte

func GetEth1AddressByte(withdrawalCredByte []byte) (string, error)

func GetTxSender

func GetTxSender(tx *types.Transaction) (common.Address, error)

func GetUniqueElements

func GetUniqueElements(arr []string) []string

func IsBlsType

func IsBlsType(withdrawalCred string) bool

See: https://github.com/ethereum/eth2.0-specs/blob/dev/specs/phase0/validator.md#withdrawal-credentials Input example: 00fccee96b30754af30208261e38df169a95aa3c722662a9df8fc057cc7d3a69 (true)

func IsEth1Type

func IsEth1Type(withdrawalCred string) bool

See: https://github.com/ethereum/eth2.0-specs/blob/dev/specs/phase0/validator.md#withdrawal-credentials Input example: 010000000000000000000000dc62f9e8c34be08501cdef4ebde0a280f576d762 (true)

func NumInSlice

func NumInSlice(a uint64, list []uint64) bool

func SlotsToTime

func SlotsToTime(slots uint64, secondsInSlot uint64) string

Converts from slots to readable time (eg 1 day 9 hours 20 minutes)

func StringToBlsKey

func StringToBlsKey(str string) phase0.BLSPubKey

func SumAndSaturate

func SumAndSaturate(a *big.Int, b *big.Int, saturate *big.Int) *big.Int

Sum two numbers, and if the sum is bigger than saturate, return saturate

func ToBytes20

func ToBytes20(x []byte) [20]byte

func WeiToEther

func WeiToEther(wei *big.Int) *big.Float

Types

This section is empty.

Jump to

Keyboard shortcuts

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