mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 03:16:45 +01:00
Add mock EthClient for testing
This commit is contained in:
14
eth/client_test.go
Normal file
14
eth/client_test.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package eth
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestClientInterface(t *testing.T) {
|
||||
var c ClientInterface
|
||||
client := NewClient(nil, nil, nil, nil)
|
||||
c = client
|
||||
require.NotNil(t, c)
|
||||
}
|
||||
18
eth/interface.go
Normal file
18
eth/interface.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package eth
|
||||
|
||||
import (
|
||||
"context"
|
||||
"math/big"
|
||||
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/hermeznetwork/hermez-node/common"
|
||||
)
|
||||
|
||||
// ClientInterface is the eth Client interface used by hermez-node modules to
|
||||
// interact with Ethereum Blockchain and smart contracts.
|
||||
type ClientInterface interface {
|
||||
CurrentBlock() (*big.Int, error)
|
||||
HeaderByNumber(context.Context, *big.Int) (*types.Header, error)
|
||||
BlockByNumber(context.Context, *big.Int) (*common.Block, error)
|
||||
ForgeCall(*common.CallDataForge) ([]byte, error)
|
||||
}
|
||||
Reference in New Issue
Block a user