func NewClient(s string) (*Client, error) {
	// Parse URL
	u, err := url.Parse(s)
	if err != nil {
		return nil, err
	}

	// Initializing Transport
	var call transports.CallCloser
	switch u.Scheme {
	case "wss", "ws":
		call, err = websocket.NewTransport(s)
		if err != nil {
			return nil, err
		}
	case "https", "http":
		call, err = http.NewTransport(s)
		if err != nil {
			return nil, err
		}
	default:
		return nil, ErrInitializeTransport
	}
	client := &Client{cc: call}

	client.AsyncProtocol = false

	client.API = api.NewAPI(client.cc)

	chainID, err := client.API.GetConfig()
	if err != nil {
		return nil, err
	}
	client.chainID = chainID.ChainID

	return client, nil
}
// NewClient creates a new RPC client that use the given CallCloser internally.
// Initialize only server present API. Absent API initialized as nil value.
NewClient creates a new RPC client that use the given CallCloser internally.
Initialize only server present API. Absent API initialized as nil value.
// NewClient creates a new RPC client that use the given CallCloser internally . // Initialize only server present API . Absent API initialized as nil value .
func NewClient(s string) (*Client, error) {
	u, err := url.Parse(s)
	if err != nil {
		return nil, err
	}
	var call transports.CallCloser
	switch u.Scheme {
	case "wss", "ws":
		call, err = websocket.NewTransport(s)
		if err != nil {
			return nil, err
		}
	case "https", "http":
		call, err = http.NewTransport(s)
		if err != nil {
			return nil, err
		}
	default:
		return nil, ErrInitializeTransport
	}
	client := &Client{cc: call}
	client.AsyncProtocol = false
	client.API = api.NewAPI(client.cc)
	chainID, err := client.API.GetConfig()
	if err != nil {
		return nil, err
	}
	client.chainID = chainID.ChainID
	return client, nil
}
func NewClient ( s string ) ( * Client , error ) { u , err := url . Parse ( s ) if err != nil { return nil , err } var call transports . CallCloser switch u . Scheme { case " " , " " : call , err = websocket . NewTransport ( s ) if err != nil { return nil , err } case " " , " " : call , err = http . NewTransport ( s ) if err != nil { return nil , err } default : return nil , ErrInitializeTransport } client := & Client { cc : call } client . AsyncProtocol = false client . API = api . NewAPI ( client . cc ) chainID , err := client . API . GetConfig ( ) if err != nil { return nil , err } client . chainID = chainID . ChainID return client , nil }
NewClient creates a new RPC client that use the given CallCloser internally.
NewClient creates a new RPC client that use the given CallCloser internally .
// Parse URL // Initializing Transport