block

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: LGPL-3.0 Imports: 11 Imported by: 1

Documentation

Overview

Package block contains ethereum helper methods that center around blocks, like waiting for a certain block timestamp, waiting for a transaction to be mined in a block, and extracting an error for a transaction from the block that mined it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorFromBlock

func ErrorFromBlock(ctx context.Context, ec *ethclient.Client, receipt *ethtypes.Receipt) error

ErrorFromBlock returns the error for why a transaction was reverted when mined. Normally these errors are detected when creating the transaction, as the contract call is simulated to estimate gas, but the state is different in the mined block and the transaction can fail (losing gas) after it already went out to the network. In this case, we simulate the call using the mined block to extract the error.

func WaitForEthBlockAfterTimestamp

func WaitForEthBlockAfterTimestamp(ctx context.Context, ec *ethclient.Client, ts time.Time) (*ethtypes.Header, error)

WaitForEthBlockAfterTimestamp returns the header of the first block whose timestamp is >= ts.

func WaitForReceipt

func WaitForReceipt(ctx context.Context, ec *ethclient.Client, txHash ethcommon.Hash) (*ethtypes.Receipt, error)

WaitForReceipt waits for the transaction to be mined into a block. If the transaction was reverted when mined, we return an error describing why.

Types

This section is empty.

Jump to

Keyboard shortcuts

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