cic-dw/pkg/cicnet/cicnet.go

33 lines
525 B
Go
Raw Normal View History

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 &CicNet{}, err
}
return &CicNet{
ethClient: ethClient,
tokenIndex: tokenIndex,
}, nil
}
2022-04-29 10:12:47 +02:00
func (c *CicNet) Close() error {
err := c.ethClient.Close()
if err != nil {
return err
}
return nil
}