tests

package
v0.7.3-beta3 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 License: Apache-2.0 Imports: 20 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTimeout = errors.New("timeout")
)

Functions

func AssertErrorMessageContains added in v0.6.0

func AssertErrorMessageContains(t *testing.T, expected, target error)

AssertErrorMessageContains is a helper function to make sure an error message matches with the expected error which is not exported if expected error is nil, it checks the target error is nil

func GenerateAddTxnReq added in v0.4.0

func GenerateAddTxnReq(params GenerateTxReqParams) (*txpoolOp.AddTxnReq, error)

func GenerateKeyAndAddr

func GenerateKeyAndAddr(t *testing.T) (*ecdsa.PrivateKey, types.Address)

func GenerateTestMultiAddr

func GenerateTestMultiAddr(t *testing.T) multiaddr.Multiaddr

func GetFreePort

func GetFreePort() (port int, err error)

GetFreePort asks the kernel for a free open port that is ready to use

func RetryUntilTimeout

func RetryUntilTimeout(ctx context.Context, f func() (interface{}, bool)) (interface{}, error)

func WaitForNonce added in v0.3.0

func WaitForNonce(
	ctx context.Context,
	ethClient *jsonrpc.Eth,
	addr ethgo.Address,
	expectedNonce uint64,
) (
	interface{},
	error,
)

func WaitForReceipt

func WaitForReceipt(ctx context.Context, client *jsonrpc.Eth, hash ethgo.Hash) (*ethgo.Receipt, error)

WaitForReceipt waits transaction receipt

func WaitUntilTxPoolEmpty

func WaitUntilTxPoolEmpty(
	ctx context.Context,
	client txpoolOp.TxnPoolOperatorClient,
) (
	*txpoolOp.TxnPoolStatusResp,
	error,
)

WaitUntilTxPoolEmpty waits until node has 0 transactions in txpool, otherwise returns timeout

Types

type GenerateTxReqParams added in v0.4.0

type GenerateTxReqParams struct {
	Nonce         uint64
	ReferenceAddr types.Address
	ReferenceKey  *ecdsa.PrivateKey
	ToAddress     types.Address
	GasPrice      *big.Int
	Value         *big.Int
	Input         []byte
}

Jump to

Keyboard shortcuts

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