backends

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2022 License: MIT Imports: 11 Imported by: 11

Documentation

Overview

Package backends provides different kinds of backends you can test against that conform to a common interface thesse allow you to test eth functionality against a variety of backends

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthType

type AuthType struct {
	// transaction options
	*bind.TransactOpts
	// PrivateKey used for the tx
	PrivateKey *ecdsa.PrivateKey
}

AuthType is the type used for authentication.

type ContractVerifier

type ContractVerifier interface {
	VerifyContract(contractType contracts.ContractType, contract contracts.DeployedContract) error
}

ContractVerifier is a hook used to verify contracts with a test provider.

type SimulatedTestBackend

type SimulatedTestBackend interface {
	// EnableTenderly attempts to enable tenderly for the TestBackend. Returns false if it cannot be done
	EnableTenderly() (enabled bool)
	// BackendName gets the name of the backend
	BackendName() string
	// TestingSuite allows access to T() and SetT() methods for testing
	suite.TestingSuite
	// Manager is used for concurrent signing while generating nonce
	nonce.Manager
	// ContractVerifier are contract verification hooks
	ContractVerifier
	// WaitForConfirmation waits for a tx confirmation
	WaitForConfirmation(ctx context.Context, transaction *types.Transaction)
	// FundAccount funds an account address with an amount amount
	FundAccount(ctx context.Context, address common.Address, amount big.Int)
	// GetTxContext gets a signed transaction. If the address is `nil`, will fund a new account.
	GetTxContext(ctx context.Context, address *common.Address) (auth AuthType)
	// GetFundedAccount gets a funded account with requestBalance
	GetFundedAccount(ctx context.Context, requestBalance *big.Int) *keystore.Key
	// Chain is the Chain
	//nolint:staticcheck
	chain.Chain
	// Signer is the signer for the chain
	Signer() types.Signer
}

SimulatedTestBackend is a strict subset of TestBackend that all backends must comply with. TODO: we need one of these for testnets so we can run e2e tests. This should source addresses from a single address.

type TestBackend

type TestBackend interface {
	// SimulatedTestBackend is the base of a test backend
	SimulatedTestBackend
}

TestBackend provides a backend for testing. Deprecated: use simulated test backend.

Directories

Path Synopsis
Package base contains a common interface to be used by multiple backends.
Package base contains a common interface to be used by multiple backends.
Package ganache provides a ganache backend
Package ganache provides a ganache backend
Package geth handles creating mock geth clients and simulated backends
Package geth handles creating mock geth clients and simulated backends
Package preset defines preset backends that can be used to create backends of different types
Package preset defines preset backends that can be used to create backends of different types
Package simulated represents a simulated backend.
Package simulated represents a simulated backend.
multibackend
Package multibackend contains a copy of https://github.com/ethereum/go-ethereum/blob/master/accounts/abi/bind/backends/simulated.go that allows use with multiple chains by exporting new methods.
Package multibackend contains a copy of https://github.com/ethereum/go-ethereum/blob/master/accounts/abi/bind/backends/simulated.go that allows use with multiple chains by exporting new methods.

Jump to

Keyboard shortcuts

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