diff --git a/pkg/cicnet/cicnet.go b/pkg/cicnet/cicnet.go index c91d37a..0161c64 100644 --- a/pkg/cicnet/cicnet.go +++ b/pkg/cicnet/cicnet.go @@ -10,13 +10,16 @@ type CicNet struct { tokenIndex common.Address } -func NewCicNet(rpcEndpoint string, tokenIndex common.Address) *CicNet { - ethClient := w3.MustDial(rpcEndpoint) +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 { diff --git a/pkg/cicnet/token_index.go b/pkg/cicnet/token_index.go index 7d139cb..c598b42 100644 --- a/pkg/cicnet/token_index.go +++ b/pkg/cicnet/token_index.go @@ -6,7 +6,6 @@ import ( "github.com/lmittmann/w3" "github.com/lmittmann/w3/module/eth" "math/big" - "strings" ) func (c *CicNet) EntryCount(ctx context.Context) (big.Int, error) { @@ -34,6 +33,5 @@ func (c *CicNet) AddressAtIndex(ctx context.Context, index *big.Int) (string, er return "", err } - // strip 0x at pkg level - return strings.Trim(address.String(), "0x"), nil + return address.String(), nil }