testutil

package
v0.30.1 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 33 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[C core.WalletConfig](t *testing.T, wallet *sequence.Wallet[C], 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 SequenceContexts added in v0.22.0

func SequenceContexts() map[uint8]sequence.WalletContext

func SignAndSend added in v0.2.0

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

func SignAndSendRawTransaction added in v0.2.0

func SignAndSendRawTransaction[C core.WalletConfig](t *testing.T, wallet *sequence.Wallet[C], stx *sequence.Transaction) error

func V1SequenceContext added in v0.22.0

func V1SequenceContext() sequence.WalletContext

func V2SequenceContext added in v0.22.0

func V2SequenceContext() sequence.WalletContext

Types

type TestChain

type TestChain struct {
	Provider *ethrpc.Provider // provider rpc to the test chain

	Monitor          *ethmonitor.Monitor
	ReceiptsListener *ethreceipts.ReceiptsListener

	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) Connect added in v0.17.0

func (c *TestChain) Connect() error

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) DeploySequenceWallet added in v0.4.4

func (c *TestChain) DeploySequenceWallet(wallet *sequence.Wallet[core.WalletConfig]) error

func (*TestChain) Disconnect added in v0.17.0

func (c *TestChain) Disconnect()

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) MustDeploySequenceContexts added in v0.22.0

func (c *TestChain) MustDeploySequenceContexts() map[uint8]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) V1DeploySequenceContext added in v0.22.0

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

func (*TestChain) V1DummySequenceWallet added in v0.22.0

func (c *TestChain) V1DummySequenceWallet(seed uint64, optSkipDeploy ...bool) (*sequence.Wallet[core.WalletConfig], error)

func (*TestChain) V1DummySequenceWallets added in v0.22.0

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

func (*TestChain) V1SequenceContext added in v0.22.0

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

func (*TestChain) V2DeploySequenceContext added in v0.22.0

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

func (*TestChain) V2DummySequenceWallet added in v0.22.0

func (c *TestChain) V2DummySequenceWallet(seed uint64, optSkipDeploy ...bool) (*sequence.Wallet[core.WalletConfig], error)

func (*TestChain) V2DummySequenceWallets added in v0.22.0

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

func (*TestChain) V2SequenceContext added in v0.22.0

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

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