// NewClient creates a new RPC client
NewClient creates a new RPC client
// NewClient creates a new RPC client
func NewClient(url string) (*Client, error) {
	transport, err := websocket.NewTransport(url)
	if err != nil {
		return nil, err
	}
	client := &Client{cc: transport}
	loginAPI := login.NewAPI(transport)
	client.Login = loginAPI
	databaseAPIID, err := loginAPI.Database()
	if err != nil {
		return nil, err
	}
	client.Database = database.NewAPI(databaseAPIID, client.cc)
	chainID, err := client.Database.GetChainID()
	if err != nil {
		return nil, errors.Wrap(err, "failed to get chain ID")
	}
	client.chainID = *chainID
	historyAPIID, err := loginAPI.History()
	if err != nil {
		return nil, err
	}
	client.History = history.NewAPI(historyAPIID, client.cc)
	networkBroadcastAPIID, err := loginAPI.NetworkBroadcast()
	if err != nil {
		return nil, err
	}
	client.NetworkBroadcast = networkbroadcast.NewAPI(networkBroadcastAPIID, client.cc)
	return client, nil
}
func NewClient ( url string ) ( * Client , error ) { transport , err := websocket . NewTransport ( url ) if err != nil { return nil , err } client := & Client { cc : transport } loginAPI := login . NewAPI ( transport ) client . Login = loginAPI databaseAPIID , err := loginAPI . Database ( ) if err != nil { return nil , err } client . Database = database . NewAPI ( databaseAPIID , client . cc ) chainID , err := client . Database . GetChainID ( ) if err != nil { return nil , errors . Wrap ( err , " " ) } client . chainID = * chainID historyAPIID , err := loginAPI . History ( ) if err != nil { return nil , err } client . History = history . NewAPI ( historyAPIID , client . cc ) networkBroadcastAPIID , err := loginAPI . NetworkBroadcast ( ) if err != nil { return nil , err } client . NetworkBroadcast = networkbroadcast . NewAPI ( networkBroadcastAPIID , client . cc ) return client , nil }
NewClient creates a new RPC client
NewClient creates a new RPC client
// transport // login // database // chain ID // history // network broadcast