util

package
v0.1.63 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlockUntilSuccessful

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

func Ecrecover

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

func EthToWei

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

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

func GetForkID added in v0.1.63

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

func GetReceipts

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

func GetRollupAddress added in v0.1.63

func GetRollupAddress(rpc *ethrpc.Client) (string, error)

func GetRollupManagerAddress added in v0.1.63

func GetRollupManagerAddress(rpc *ethrpc.Client) (string, error)

func GetTxPoolStatus

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

func GetZkEVMBatches

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

func HexToBigInt

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

HexToBigInt converts a hexadecimal string to a big integer.

func SendTx

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

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

func SetLogMode(mode LogMode) error

SetLogMode updates the log format.

func ValidateUrl

func ValidateUrl(input string) error

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

Types

type BlockUntilSuccessfulFn

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

type LogMode string

LogMode represents the logger mode.

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

type VerbosityLevel

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