github.com/kotalco/kotal@v0.3.0/clients/ethereum/client.go (about)

     1  package ethereum
     2  
     3  import (
     4  	"fmt"
     5  
     6  	ethereumv1alpha1 "github.com/kotalco/kotal/apis/ethereum/v1alpha1"
     7  	"github.com/kotalco/kotal/clients"
     8  )
     9  
    10  // EthereumClient is Ethereum client
    11  type EthereumClient interface {
    12  	clients.Interface
    13  	Genesis() (string, error)
    14  	EncodeStaticNodes() string
    15  }
    16  
    17  // NewClient returns an Ethereum client instance
    18  func NewClient(node *ethereumv1alpha1.Node) (EthereumClient, error) {
    19  	switch node.Spec.Client {
    20  	case ethereumv1alpha1.BesuClient:
    21  		return &BesuClient{node}, nil
    22  	case ethereumv1alpha1.GethClient:
    23  		return &GethClient{node}, nil
    24  	case ethereumv1alpha1.NethermindClient:
    25  		return &NethermindClient{&ParityGenesis{}, node}, nil
    26  	default:
    27  		return nil, fmt.Errorf("client %s is not supported", node.Spec.Client)
    28  	}
    29  }