tests

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: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMakerTestKey

func GetMakerTestKey(t *testing.T) *ecdsa.PrivateKey

GetMakerTestKey returns the first ganache test key allocated to a package

func GetTakerTestKey

func GetTakerTestKey(t *testing.T) *ecdsa.PrivateKey

GetTakerTestKey returns the second ganache test key allocated to a package

func GetTestKeyByIndex

func GetTestKeyByIndex(t *testing.T, index int) *ecdsa.PrivateKey

GetTestKeyByIndex returns the ganache test key allocated to a package by index

func MineTransaction

func MineTransaction(t *testing.T, ec bind.DeployBackend, tx *ethtypes.Transaction) *ethtypes.Receipt

MineTransaction is a test helper that blocks until the transaction is included in a block and returns the receipt. Errors are checked including the status.

func NewEthClient

func NewEthClient(t *testing.T) (*ethclient.Client, *big.Int)

NewEthClient returns a connection to the local ganache instance for unit tests along with its chain ID. The connection is automatically closed when the test completes.

func NewEthMainnetClient added in v0.2.0

func NewEthMainnetClient(t *testing.T) *ethclient.Client

NewEthMainnetClient returns a connection to a mainnet endpoint, set by an ETH_MAINNET_ENDPOINT environment variable, for testing. If the environment variable is empty, the test falls back to the `fallbackMainnetEndpoint` constant.

func NewEthSepoliaClient added in v0.2.0

func NewEthSepoliaClient(t *testing.T) *ethclient.Client

NewEthSepoliaClient returns a connection to a Sepolia endpoint, set by an ETH_SEPOLIA_ENDPOINT environment variable, for testing. If the environment variable is empty, the test falls back to the `fallbackSepoliaEndpoint` constant.

func TxOpts added in v0.2.1

func TxOpts(t *testing.T, pk *ecdsa.PrivateKey) *bind.TransactOpts

TxOpts returns a fresh TransactOpts for use in tests

func TxOptsWithValue added in v0.2.1

func TxOptsWithValue(t *testing.T, pk *ecdsa.PrivateKey, value *big.Int) *bind.TransactOpts

TxOptsWithValue returns a fresh TransactOpts with a set value for use in tests

Types

This section is empty.

Jump to

Keyboard shortcuts

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