func newClient(cfg *Config, logger log.Logger) (*client, error) {
	logger2 := logger.Add("method", "newClient", "config", cfg)

	u, err := url.Parse(cfg.GethURL)
	if err != nil {
		return nil, err
	}

	ctx, cancel := context.WithCancel(context.Background())

	c := &client{cancel: cancel, cfg: cfg, logger: logger}

	var rpcClient *rpc.Client

	switch u.Scheme {
	case httpProtocol, https:
		httpTransport := transport(cfg.HTTPClient)

		rpcClient, err = rpc.DialHTTPWithClient(cfg.GethURL,
			httpClient(cfg.HTTPClient, httpTransport))

		c.httpTransport = httpTransport
	case ws, wss:
		rpcClient, err = rpc.DialWebsocket(ctx, cfg.GethURL, "")
	case stdIO:
		rpcClient, err = rpc.DialStdIO(ctx)
	case ipc:
		rpcClient, err = rpc.DialIPC(ctx, cfg.GethURL)
	default:
		logger2.Add("scheme", u.Scheme).Error(err.Error())
		return nil, ErrURLScheme
	}
	if err != nil {
		logger2.Error(err.Error())
		return nil, ErrCreateClient
	}

	c.client = ethclient.NewClient(rpcClient)
	return c, nil
}
func newClient(cfg *Config, logger log.Logger) (*client, error) {
	logger2 := logger.Add("method", "newClient", "config", cfg)

	u, err := url.Parse(cfg.GethURL)
	if err != nil {
		return nil, err
	}

	ctx, cancel := context.WithCancel(context.Background())

	c := &client{cancel: cancel, cfg: cfg, logger: logger}

	var rpcClient *rpc.Client

	switch u.Scheme {
	case httpProtocol, https:
		httpTransport := transport(cfg.HTTPClient)

		rpcClient, err = rpc.DialHTTPWithClient(cfg.GethURL,
			httpClient(cfg.HTTPClient, httpTransport))

		c.httpTransport = httpTransport
	case ws, wss:
		rpcClient, err = rpc.DialWebsocket(ctx, cfg.GethURL, "")
	case stdIO:
		rpcClient, err = rpc.DialStdIO(ctx)
	case ipc:
		rpcClient, err = rpc.DialIPC(ctx, cfg.GethURL)
	default:
		logger2.Add("scheme", u.Scheme).Error(err.Error())
		return nil, ErrURLScheme
	}
	if err != nil {
		logger2.Error(err.Error())
		return nil, ErrCreateClient
	}

	c.client = ethclient.NewClient(rpcClient)
	return c, nil
}
// newClient creates client for connection to the Ethereum.