testutil

package
v0.4.13 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2021 License: Apache-2.0 Imports: 27 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 RandomSeed added in v0.3.3

func RandomSeed() uint64

RandomSeed will generate a random seed

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

	RpcRelayer *relayer.RpcRelayer // helper to track RpcRelayer client
	// 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) DeploySequenceWallet added in v0.4.4

func (c *TestChain) DeploySequenceWallet(wallet *sequence.Wallet) error

func (*TestChain) DummySequenceWallet

func (c *TestChain) DummySequenceWallet(seed uint64, optSkipDeploy ...bool) (*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, error)

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) MustFundAddress added in v0.4.0

func (c *TestChain) MustFundAddress(addr common.Address) error

func (*TestChain) MustWallet

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

func (*TestChain) RandomNonce added in v0.4.0

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

func (*TestChain) SequenceContext added in v0.3.3

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

func (*TestChain) SetRpcRelayer added in v0.3.3

func (c *TestChain) SetRpcRelayer(relayerURL string) error

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