Documentation
¶
Index ¶
- Constants
- func BlockUntilSuccessful(ctx context.Context, c *ethclient.Client, retryable func() error) error
- func CompareFloatsWithTolerance(a, b, tolerance float64) bool
- func Ecrecover(header *types.Header) (signer []byte, err error)
- func EcrecoverTx(tx *types.Transaction) ([]byte, error)
- func GetAddress(ctx context.Context, privateKey *ecdsa.PrivateKey) common.Address
- func GetAddressAndPrivateKeyHex(ctx context.Context, privateKey *ecdsa.PrivateKey) (string, string)
- func GetBlockRange(ctx context.Context, from, to uint64, c *ethrpc.Client, onlyTxHashes bool) ([]*json.RawMessage, error)
- func GetBlockRangeInPages(ctx context.Context, from, to, pageSize uint64, c *ethrpc.Client, ...) ([]*json.RawMessage, error)
- func GetChainID(ctx context.Context, ec *ethrpc.Client) (*big.Int, error)
- func GetForkID(rpc *ethrpc.Client) (uint64, error)
- func GetHexString(data any) string
- func GetPrivateKeyHex(privateKey *ecdsa.PrivateKey) string
- func GetReceipts(ctx context.Context, rawBlocks []*json.RawMessage, c *ethrpc.Client, ...) ([]*json.RawMessage, error)
- func GetRollupAddress(rpc *ethrpc.Client) (string, error)
- func GetRollupManagerAddress(rpc *ethrpc.Client) (string, error)
- func GetSenderFromTx(ctx context.Context, tx rpctypes.PolyTransaction) (common.Address, error)
- func GetTxPoolStatus(rpc *ethrpc.Client) (uint64, uint64, error)
- func GetZkEVMBatches(rpc *ethrpc.Client) (uint64, uint64, uint64, error)
- func HeaderByBlockNumber(ctx context.Context, ec *ethrpc.Client, blockNum *ethrpc.BlockNumber) (*types.Header, error)
- func HexToBigInt(hexString string) (*big.Int, error)
- func IsMulticall3Supported(ctx context.Context, c *ethclient.Client, tryDeployIfNotExist bool, ...) (*common.Address, bool)
- func Multicall3DeterministicDeploy(c *ethclient.Client, sender *bind.TransactOpts) (common.Address, *types.Transaction, *multicall3.Multicall3, error)
- func Multicall3Exists(ctx context.Context, c *ethclient.Client, customAddr *common.Address) (common.Address, bool, error)
- func Multicall3FundAccountsWithERC20Token(ctx context.Context, c *ethclient.Client, tops *bind.TransactOpts, ...) (approveTx, transfersTx *types.Transaction, err error)
- func Multicall3FundAccountsWithNativeToken(c *ethclient.Client, tops *bind.TransactOpts, accounts []common.Address, ...) (*types.Transaction, error)
- func Multicall3IndeterministicDeploy(c *ethclient.Client, sender *bind.TransactOpts) (common.Address, *types.Transaction, *multicall3.Multicall3, error)
- func Multicall3MaxAccountsToFundPerTx(ctx context.Context, c *ethclient.Client) (uint64, error)
- func Multicall3New(c *ethclient.Client, customAddr *common.Address) (common.Address, *multicall3.Multicall3, error)
- func ParseVerbosity(v string) (int, error)
- func ReadPrivateKeysFromFile(sendingAddressesFile string) ([]*ecdsa.PrivateKey, error)
- func SendTx(ctx context.Context, c *ethclient.Client, privateKey *ecdsa.PrivateKey, ...) error
- func SetLogLevel(verbosity int)
- func SetLogMode(mode LogMode) error
- func ValidateURL(input string) error
- func WaitPreconf(ctx context.Context, client *ethclient.Client, txHash common.Hash, ...) (bool, error)
- func WaitReceipt(ctx context.Context, client *ethclient.Client, txHash common.Hash) (*types.Receipt, error)
- func WaitReceiptWithRetries(ctx context.Context, client *ethclient.Client, txHash common.Hash, ...) (*types.Receipt, error)
- func WaitReceiptWithTimeout(ctx context.Context, client *ethclient.Client, txHash common.Hash, ...) (*types.Receipt, error)
- func WrapDeployedCode(deployedBytecode string, storageBytecode string) string
- type BlockUntilSuccessfulFn
- type LogMode
Constants ¶
const ( Silent = 0 Panic = 100 Fatal = 200 Error = 300 Warn = 400 Info = 500 Debug = 600 Trace = 700 )
Verbosity levels. https://pkg.go.dev/github.com/rs/zerolog#readme-leveled-logging
const ( Multicall3SCAddr = "0xcA11bde05977b3631167028862bE2a173976CA11" Multicall3DeployerAddress = "0x05f32b3cc3888453ff71b01135b34ff8e41263f2" Multicall3SignedDeployTX = "" /* 7854-byte string literal not displayed */ )
Variables ¶
This section is empty.
Functions ¶
func BlockUntilSuccessful ¶
func CompareFloatsWithTolerance ¶ added in v0.1.103
func Ecrecover ¶
Ecrecover recovers the signer address from a block header's seal (the last SignatureLength bytes of Extra) using the clique seal hash.
The header may come straight off the p2p wire, so treat it as untrusted. clique's encodeSigHeader panics rather than errors on any post-Merge trailing field it does not expect -- WithdrawalsHash, ExcessBlobGas, BlobGasUsed, ParentBeaconRoot, and as of go-ethereum v1.17.4 SlotNumber. Every one is rlp:"optional", so a peer sets them at will, and a caller running on a peer goroutine takes the whole process down with it.
The panic is converted to an error rather than pre-checked field by field on purpose: that set grows with the geth releases that add one, and a hand-kept field list would silently stop covering it at the next dependency bump.
func EcrecoverTx ¶ added in v0.1.73
func EcrecoverTx(tx *types.Transaction) ([]byte, error)
func GetAddress ¶ added in v0.1.88
func GetAddressAndPrivateKeyHex ¶ added in v0.1.88
Returns the address and private key of the given private key
func GetBlockRange ¶
func GetBlockRangeInPages ¶
func GetChainID ¶ added in v0.1.103
func GetHexString ¶ added in v0.1.65
func GetPrivateKeyHex ¶ added in v0.1.88
func GetPrivateKeyHex(privateKey *ecdsa.PrivateKey) string
func GetReceipts ¶
func GetReceipts(ctx context.Context, rawBlocks []*json.RawMessage, c *ethrpc.Client, batchSize uint64) ([]*json.RawMessage, error)
func GetRollupManagerAddress ¶ added in v0.1.63
func GetSenderFromTx ¶ added in v0.1.103
GetSenderFromTx recovers the sender address from a transaction without using types.Transaction
func HeaderByBlockNumber ¶ added in v0.1.103
func HeaderByBlockNumber(ctx context.Context, ec *ethrpc.Client, blockNum *ethrpc.BlockNumber) (*types.Header, error)
HeaderByBlockNumber retrieves a block header using rpc.BlockNumber. If blockNum is nil, it defaults to latest block. Examples:
- HeaderByBlockNumber(ctx, client, nil) // latest
- HeaderByBlockNumber(ctx, client, &rpc.LatestBlockNumber)
- HeaderByBlockNumber(ctx, client, &rpc.FinalizedBlockNumber)
- num := rpc.BlockNumber(12345); HeaderByBlockNumber(ctx, client, &num)
func HexToBigInt ¶
HexToBigInt converts a hexadecimal string to a big integer.
func IsMulticall3Supported ¶ added in v0.1.90
func Multicall3DeterministicDeploy ¶ added in v0.1.98
func Multicall3DeterministicDeploy(c *ethclient.Client, sender *bind.TransactOpts) (common.Address, *types.Transaction, *multicall3.Multicall3, error)
func Multicall3Exists ¶ added in v0.1.90
func Multicall3FundAccountsWithERC20Token ¶ added in v0.1.92
func Multicall3FundAccountsWithNativeToken ¶ added in v0.1.90
func Multicall3IndeterministicDeploy ¶ added in v0.1.98
func Multicall3IndeterministicDeploy(c *ethclient.Client, sender *bind.TransactOpts) (common.Address, *types.Transaction, *multicall3.Multicall3, error)
func Multicall3MaxAccountsToFundPerTx ¶ added in v0.1.90
func Multicall3New ¶ added in v0.1.90
func Multicall3New(c *ethclient.Client, customAddr *common.Address) (common.Address, *multicall3.Multicall3, error)
func ParseVerbosity ¶ added in v0.1.90
ParseVerbosity parses a verbosity string (e.g., "info", "debug") or integer and returns the corresponding verbosity level.
func ReadPrivateKeysFromFile ¶ added in v0.1.88
func ReadPrivateKeysFromFile(sendingAddressesFile string) ([]*ecdsa.PrivateKey, error)
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 ValidateURL ¶ added in v0.1.101
ValidateURL checks if a string URL can be parsed and if it has a valid scheme.
func WaitPreconf ¶ added in v0.1.104
func WaitPreconf(ctx context.Context, client *ethclient.Client, txHash common.Hash, timeout time.Duration) (bool, error)
WaitPreconf waits for a preconf status check with a specified timeout. Uses exponential backoff with jitter, similar to WaitReceiptWithTimeout.
func WaitReceipt ¶ added in v0.1.92
func WaitReceipt(ctx context.Context, client *ethclient.Client, txHash common.Hash) (*types.Receipt, error)
WaitReceipt waits for a transaction receipt with default parameters.
func WaitReceiptWithRetries ¶ added in v0.1.92
func WaitReceiptWithRetries(ctx context.Context, client *ethclient.Client, txHash common.Hash, maxRetries uint, initialDelayMs uint) (*types.Receipt, error)
WaitReceiptWithRetries waits for a transaction receipt with retries and exponential backoff.
func WaitReceiptWithTimeout ¶ added in v0.1.92
func WaitReceiptWithTimeout(ctx context.Context, client *ethclient.Client, txHash common.Hash, timeout time.Duration) (*types.Receipt, error)
WaitReceiptWithTimeout waits for a transaction receipt with a specified timeout.
func WrapDeployedCode ¶ added in v0.1.65
Types ¶
type BlockUntilSuccessfulFn ¶
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.