client_test.go 863 Bytes
Newer Older
1 2 3 4 5 6 7
package node

import (
	"math/big"

	"github.com/stretchr/testify/mock"

8
	"github.com/ethereum/go-ethereum/common"
9 10 11 12
	"github.com/ethereum/go-ethereum/core/types"
	"github.com/ethereum/go-ethereum/rpc"
)

13 14
var _ EthClient = &MockEthClient{}

15 16 17 18 19 20 21 22 23 24 25 26 27 28
type MockEthClient struct {
	mock.Mock
}

func (m *MockEthClient) FinalizedBlockHeight() (*big.Int, error) {
	args := m.Called()
	return args.Get(0).(*big.Int), args.Error(1)
}

func (m *MockEthClient) BlockHeadersByRange(from, to *big.Int) ([]*types.Header, error) {
	args := m.Called(from, to)
	return args.Get(0).([]*types.Header), args.Error(1)
}

29 30 31 32 33
func (m *MockEthClient) BlockHeaderByHash(hash common.Hash) (*types.Header, error) {
	args := m.Called(hash)
	return args.Get(0).(*types.Header), args.Error(1)
}

34 35 36 37
func (m *MockEthClient) RawRpcClient() *rpc.Client {
	args := m.Called()
	return args.Get(0).(*rpc.Client)
}