forked from ten-protocol/go-ten
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eth_deployer.go
35 lines (27 loc) · 931 Bytes
/
eth_deployer.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package contractdeployer
import (
"time"
gethlog "github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/obscuronet/go-obscuro/go/ethadapter"
)
func prepareEthDeployer(cfg *Config, logger gethlog.Logger) (contractDeployerClient, error) {
client, err := ethadapter.NewEthClient(cfg.NodeHost, cfg.NodePort, 30*time.Second, common.HexToAddress("0x0"), logger)
if err != nil {
return nil, err
}
return &EthDeployer{client: client}, nil
}
type EthDeployer struct {
client ethadapter.EthClient
}
func (e *EthDeployer) Nonce(address common.Address) (uint64, error) {
return e.client.Nonce(address)
}
func (e *EthDeployer) SendTransaction(tx *types.Transaction) error {
return e.client.SendTransaction(tx)
}
func (e *EthDeployer) TransactionReceipt(hash common.Hash) (*types.Receipt, error) {
return e.client.TransactionReceipt(hash)
}