util

package
v0.1.43 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlockUntilSuccessful added in v0.1.39

func BlockUntilSuccessful(ctx context.Context, c *ethclient.Client, retryable func() error) error

func Ecrecover added in v0.1.40

func Ecrecover(block *types.Block) ([]byte, error)

func EthToWei added in v0.1.39

func EthToWei(ethAmount float64) *big.Int

EthToWei converts a given amount of Ether to Wei.

func GetBlockRange

func GetBlockRange(ctx context.Context, from, to uint64, c *ethrpc.Client) ([]*json.RawMessage, error)

func GetBlockRangeInPages added in v0.1.35

func GetBlockRangeInPages(ctx context.Context, from, to, pageSize uint64, c *ethrpc.Client) ([]*json.RawMessage, error)

func GetReceipts

func GetReceipts(ctx context.Context, rawBlocks []*json.RawMessage, c *ethrpc.Client, batchSize uint64) ([]*json.RawMessage, error)

func GetTxPoolStatus added in v0.1.40

func GetTxPoolStatus(rpc *ethrpc.Client) (uint64, uint64, error)

func HexToBigInt added in v0.1.39

func HexToBigInt(hexString string) (*big.Int, error)

HexToBigInt converts a hexadecimal string to a big integer.

func SendTx added in v0.1.39

func SendTx(ctx context.Context, c *ethclient.Client, privateKey *ecdsa.PrivateKey, to *common.Address, amount *big.Int, data []byte, gasLimit uint64) error

SendTx is a simple wrapper to send a transaction from one Ethereum address to another.

func SetLogLevel added in v0.1.37

func SetLogLevel(verbosity int)

SetLogLevel sets the log level based on the flags. https://logging.apache.org/log4j/2.x/manual/customloglevels.html

func SetLogMode added in v0.1.37

func SetLogMode(mode LogMode) error

SetLogMode updates the log format.

func ValidateUrl added in v0.1.35

func ValidateUrl(input string) error

ValidateUrl checks if a string URL can be parsed and if it has a valid scheme.

Types

type BlockUntilSuccessfulFn added in v0.1.39

type BlockUntilSuccessfulFn func(ctx context.Context, c *ethclient.Client, f func() error) error

BlockUntilSuccessfulFn is designed to wait until a specified number of Ethereum blocks have been mined, periodically checking for the completion of a given function within each block interval.

type LogMode added in v0.1.37

type LogMode string

LogMode represents the logger mode.

const (
	Console LogMode = "console"
	JSON    LogMode = "json"
)

type VerbosityLevel added in v0.1.37

type VerbosityLevel int

VerbosityLevel represents the verbosity levels. https://pkg.go.dev/github.com/rs/zerolog#readme-leveled-logging

const (
	Silent VerbosityLevel = 0
	Panic  VerbosityLevel = 100
	Fatal  VerbosityLevel = 200
	Error  VerbosityLevel = 300
	Warn   VerbosityLevel = 400
	Info   VerbosityLevel = 500
	Debug  VerbosityLevel = 600
	Trace  VerbosityLevel = 700
)

Jump to

Keyboard shortcuts

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