You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.1 KiB

  1. package eth
  2. import (
  3. "fmt"
  4. "github.com/ethereum/go-ethereum/accounts"
  5. ethKeystore "github.com/ethereum/go-ethereum/accounts/keystore"
  6. "github.com/ethereum/go-ethereum/ethclient"
  7. )
  8. var errTODO = fmt.Errorf("TODO: Not implemented yet")
  9. // ClientInterface is the eth Client interface used by hermez-node modules to
  10. // interact with Ethereum Blockchain and smart contracts.
  11. type ClientInterface interface {
  12. EthereumInterface
  13. RollupInterface
  14. AuctionInterface
  15. }
  16. //
  17. // Implementation
  18. //
  19. // Client is used to interact with Ethereum and the Hermez smart contracts.
  20. type Client struct {
  21. EthereumClient
  22. AuctionClient
  23. RollupClient
  24. }
  25. // NewClient creates a new Client to interact with Ethereum and the Hermez smart contracts.
  26. func NewClient(client *ethclient.Client, account *accounts.Account, ks *ethKeystore.KeyStore, config *EthereumConfig) *Client {
  27. ethereumClient := NewEthereumClient(client, account, ks, config)
  28. auctionClient := &AuctionClient{}
  29. rollupCient := &RollupClient{}
  30. return &Client{
  31. EthereumClient: *ethereumClient,
  32. AuctionClient: *auctionClient,
  33. RollupClient: *rollupCient,
  34. }
  35. }