utils

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2021 License: MIT Imports: 9 Imported by: 4

Documentation

Index

Constants

View Source
const (
	InfoColor    = "\033[1;34m%s\033[0m"
	NoticeColor  = "\033[1;36m%s\033[0m"
	WarningColor = "\033[1;33m%s\033[0m"
	ErrorColor   = "\033[1;31m%s\033[0m"
	DebugColor   = "\033[0;36m%s\033[0m"
)

Variables

This section is empty.

Functions

func Abs

func Abs(x int64) int64

func BigFloatToHumanNumberString

func BigFloatToHumanNumberString(f *big.Float, decimals int) string

func BigIntToHumanNumberString

func BigIntToHumanNumberString(i *big.Int, decimals int) string

func ColorPrintf

func ColorPrintf(color string, format string, a ...interface{})

func DateToTime

func DateToTime(dayString string, hour int, min int, sec int) (time.Time, error)

func EstimateTargetBlocknumber

func EstimateTargetBlocknumber(utcTimestamp int64) int64

Roughly estimate a block number by target timestamp (might be off by a lot)

func GetFirstBlockHeaderAtOrAfterTime

func GetFirstBlockHeaderAtOrAfterTime(client *ethclient.Client, targetTime time.Time) (header *types.Header, err error)

GetBlockHeaderAtTimestamp returns the header of the first block at or after the timestamp. If timestamp is after latest block, then return latest block.

func GetTxSender

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

func IsBigIntZero

func IsBigIntZero(n *big.Int) bool

func NumberToHumanReadableString

func NumberToHumanReadableString(value interface{}, decimals int) string

func Perror

func Perror(err error)

func PrintBlock

func PrintBlock(block *types.Block)

Types

This section is empty.

Jump to

Keyboard shortcuts

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