testutil

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2021 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultTestChainOptions = TestChainOptions{
	NodeURL: "http://localhost:8545",
}

Functions

func BatchSignAndSend added in v0.2.0

func BatchSignAndSend(t *testing.T, wallet *sequence.Wallet, to common.Address, data [][]byte) error

func ContractCall

func ContractCall(provider *ethrpc.Provider, contractAddress common.Address, contractABI abi.ABI, result interface{}, method string, args ...interface{}) ([]byte, error)

func ContractQuery

func ContractQuery(provider *ethrpc.Provider, contractAddress common.Address, inputExpr, outputExpr string, args []string) ([]string, error)

func ContractTransact

func ContractTransact(signer *ethwallet.Wallet, contractAddress common.Address, contractABI abi.ABI, method string, args ...interface{}) (*types.Receipt, error)

func DummyAddr

func DummyAddr() common.Address

DummyAddr returns a dummy address

func DummyPrivateKey

func DummyPrivateKey(seed uint64) string

DummyPrivateKey returns random private key in hex used with ethwallet

func SequenceContext

func SequenceContext() sequence.WalletContext

func SignAndSend added in v0.2.0

func SignAndSend(t *testing.T, wallet *sequence.Wallet, to common.Address, data []byte) error

func SignAndSendRawTransaction added in v0.2.0

func SignAndSendRawTransaction(t *testing.T, wallet *sequence.Wallet, stx *sequence.Transaction) error

Types

type TestChain

type TestChain struct {
	Provider *ethrpc.Provider // provider rpc to the test chain
	// contains filtered or unexported fields
}

func NewTestChain

func NewTestChain(opts ...TestChainOptions) (*TestChain, error)

func (*TestChain) ChainID

func (c *TestChain) ChainID() *big.Int

func (*TestChain) Deploy

func (c *TestChain) Deploy(t *testing.T, contractName string, contractConstructorArgs ...interface{}) (*ethcontract.Contract, *types.Receipt)

Deploy will deploy a contract registered in `Contracts` registry using the standard deployment method. Each Deploy call will instanitate a new contract on the test chain.

func (*TestChain) DeploySequenceContext

func (c *TestChain) DeploySequenceContext() (sequence.WalletContext, error)

func (*TestChain) DummySequenceWallet

func (c *TestChain) DummySequenceWallet(seed uint64) (*sequence.Wallet, error)

func (*TestChain) DummySequenceWallets

func (c *TestChain) DummySequenceWallets(nWallets uint64, startingSeed uint64) ([]*sequence.Wallet, error)

func (*TestChain) GetDeployTransactor

func (c *TestChain) GetDeployTransactor() *bind.TransactOpts

GetDeployTransactor returns a account transactor typically used for deploying contracts

func (*TestChain) GetDeployWallet

func (c *TestChain) GetDeployWallet() *ethwallet.Wallet

func (*TestChain) GetRelayerWallet

func (c *TestChain) GetRelayerWallet() *ethwallet.Wallet

GetRelayerWallet is the wallet dedicated EOA wallet to relaying transactions

func (*TestChain) MustDeploySequenceContext

func (c *TestChain) MustDeploySequenceContext() sequence.WalletContext

func (*TestChain) MustWallet

func (c *TestChain) MustWallet(optAccountIndex ...uint32) *ethwallet.Wallet

func (*TestChain) UniDeploy

func (c *TestChain) UniDeploy(t *testing.T, contractName string, contractInstanceNum uint, contractConstructorArgs ...interface{}) *ethcontract.Contract

UniDeploy will deploy a contract registered in `Contracts` registry using the universal deployer. Multiple calls to UniDeploy will instantiate just a single instance for the same contract with the same `contractInstanceNum`.

func (*TestChain) WaitMined

func (c *TestChain) WaitMined(txn common.Hash) error

func (*TestChain) Wallet

func (c *TestChain) Wallet() (*ethwallet.Wallet, error)

type TestChainOptions

type TestChainOptions struct {
	NodeURL string
}

Jump to

Keyboard shortcuts

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