evmtest

package
v1.11.1-beta2 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2023 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustGetDefaultChain

func MustGetDefaultChain(t testing.TB, cc evm.ChainSet) evm.Chain

func NewChainSet

func NewChainSet(t testing.TB, testopts TestChainOpts) (cc evm.ChainSet)

NewChainSet returns a simple chain collection with one chain and allows to mock client/config on that chain

func NewChainSetOpts added in v1.10.0

func NewChainSetOpts(t testing.TB, testopts TestChainOpts) (evm.ChainSetOpts, []evmtypes.DBChain, map[string][]evmtypes.Node)

func NewEthClientMock added in v1.4.0

func NewEthClientMock(t *testing.T) *evmMocks.Client

func NewEthClientMockWithDefaultChain added in v1.4.0

func NewEthClientMockWithDefaultChain(t *testing.T) *evmMocks.Client

func NewMockChainSetWithChain added in v1.11.0

func NewMockChainSetWithChain(t testing.TB, ch evm.Chain) *evmmocks.ChainSet

NewMockChainSetWithChain returns a mock chainset with one chain

Types

type MockEth added in v1.4.0

type MockEth struct {
	EthClient       *evmMocks.Client
	CheckFilterLogs func(int64, int64)
	// contains filtered or unexported fields
}

func (*MockEth) NewSub added in v1.4.0

func (m *MockEth) NewSub(t *testing.T) ethereum.Subscription

func (*MockEth) SubsErr added in v1.4.0

func (m *MockEth) SubsErr(err error)

func (*MockEth) SubscribeCallCount added in v1.4.0

func (m *MockEth) SubscribeCallCount() int32

func (*MockEth) UnsubscribeCallCount added in v1.4.0

func (m *MockEth) UnsubscribeCallCount() int32

type MockORM

type MockORM struct {
	// contains filtered or unexported fields
}

func NewMockORM

func NewMockORM(chains []evmtypes.DBChain, nodes []evmtypes.Node) *MockORM

func (*MockORM) AddNodes added in v1.4.0

func (mo *MockORM) AddNodes(ns ...evmtypes.Node)

func (*MockORM) Chain

func (mo *MockORM) Chain(id utils.Big, qopts ...pg.QOpt) (evmtypes.DBChain, error)

func (*MockORM) Chains

func (mo *MockORM) Chains(offset int, limit int, qopts ...pg.QOpt) (chains []evmtypes.DBChain, count int, err error)

func (*MockORM) Clear

func (mo *MockORM) Clear(chainID utils.Big, key string) error

func (*MockORM) CreateChain

func (mo *MockORM) CreateChain(id utils.Big, config *evmtypes.ChainCfg, qopts ...pg.QOpt) (evmtypes.DBChain, error)

func (*MockORM) CreateNode

func (mo *MockORM) CreateNode(data evmtypes.Node, qopts ...pg.QOpt) (n evmtypes.Node, err error)

func (*MockORM) DeleteChain

func (mo *MockORM) DeleteChain(id utils.Big, qopts ...pg.QOpt) error

func (*MockORM) DeleteNode

func (mo *MockORM) DeleteNode(id int32, qopts ...pg.QOpt) error

func (*MockORM) EnabledChains added in v1.4.0

func (mo *MockORM) EnabledChains(qopts ...pg.QOpt) ([]evmtypes.DBChain, error)

func (*MockORM) EnsureChains added in v1.10.0

func (mo *MockORM) EnsureChains([]utils.Big, ...pg.QOpt) error

func (*MockORM) GetChainsByIDs

func (mo *MockORM) GetChainsByIDs(ids []utils.Big) (chains []evmtypes.DBChain, err error)

func (*MockORM) GetNodesByChainIDs

func (mo *MockORM) GetNodesByChainIDs(chainIDs []utils.Big, qopts ...pg.QOpt) (nodes []evmtypes.Node, err error)

GetNodesByChainIDs implements evmtypes.ORM

func (*MockORM) NodeNamed added in v1.10.0

func (mo *MockORM) NodeNamed(name string, opt ...pg.QOpt) (evmtypes.Node, error)

func (*MockORM) Nodes

func (mo *MockORM) Nodes(offset int, limit int, qopts ...pg.QOpt) (nodes []evmtypes.Node, cnt int, err error)

Nodes implements evmtypes.ORM

func (*MockORM) NodesForChain

func (mo *MockORM) NodesForChain(chainID utils.Big, offset int, limit int, qopts ...pg.QOpt) ([]evmtypes.Node, int, error)

NodesForChain implements evmtypes.ORM

func (*MockORM) PutChains added in v1.4.0

func (mo *MockORM) PutChains(cs ...evmtypes.DBChain)

func (*MockORM) SetupNodes added in v1.4.0

func (mo *MockORM) SetupNodes([]evmtypes.Node, []utils.Big) error

NodesForChain implements evmtypes.ORM

func (*MockORM) StoreString

func (mo *MockORM) StoreString(chainID utils.Big, key, val string) error

func (*MockORM) UpdateChain

func (mo *MockORM) UpdateChain(id utils.Big, enabled bool, config *evmtypes.ChainCfg, qopts ...pg.QOpt) (evmtypes.DBChain, error)

type RawSub added in v1.4.0

type RawSub[T any] struct {
	// contains filtered or unexported fields
}

func NewRawSub added in v1.4.0

func NewRawSub[T any](ch chan<- T, err <-chan error) RawSub[T]

func (*RawSub[T]) CloseCh added in v1.4.0

func (r *RawSub[T]) CloseCh()

func (*RawSub[T]) TrySend added in v1.4.0

func (r *RawSub[T]) TrySend(t T)

type TestChainOpts

type TestChainOpts struct {
	Client         evmclient.Client
	LogBroadcaster log.Broadcaster
	GeneralConfig  config.GeneralConfig
	ChainCfg       evmtypes.ChainCfg // Deprecated
	HeadTracker    httypes.HeadTracker
	DB             *sqlx.DB
	TxManager      txmgr.TxManager
	KeyStore       keystore.Eth
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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