cic-dw/pkg/cicnet/cicnet.go
Mohammed Sohail 4f868d8d94
fix: (pkg) revert to untrimmed address, panic on failed dial
- TODO: cicnet should be initialized at job handler level
2022-05-05 14:58:47 +03:00

33 lines
519 B
Go

package cicnet
import (
"github.com/ethereum/go-ethereum/common"
"github.com/lmittmann/w3"
)
type CicNet struct {
ethClient *w3.Client
tokenIndex common.Address
}
func NewCicNet(rpcEndpoint string, tokenIndex common.Address) (*CicNet, error) {
ethClient, err := w3.Dial(rpcEndpoint)
if err != nil {
return nil, err
}
return &CicNet{
ethClient: ethClient,
tokenIndex: tokenIndex,
}, nil
}
func (c *CicNet) Close() error {
err := c.ethClient.Close()
if err != nil {
return err
}
return nil
}