Class: ChiaDaemon

ChiaDaemon(connection, service_name)

This guy encapsulates asynchronous communication with the chia daemon which in turn proxies communication to the other chia services.

Constructor

new ChiaDaemon(connection, service_name)

Create a ChiaDaemon.
Parameters:
Name Type Description
connection Object Details of the connection.
Properties
Name Type Description
host string The host name or IP address.
port number The damon's listening port.
key_path string File path to the certificate key file used to secure the connection.
cert_path string File path to the certificate crt file used to secure the connection.
timeout_seconds number Timeout, in seconds, for each call to the deamon.
service_name string the name of the client application or service talking to the daemon.
Source:

Extends

  • EventEmitter

Members

services

Property with each of the rpc services exposed by the chia node. https://dkackman.github.io/chia-api/redoc/
Source:

Methods

(async) connect() → {boolean}

Opens the websocket connection and calls register_service on the daemon
Source:
Fires:
Returns:
True if the socket is opened and service registered successfully. Otherwise false.
Type
boolean

disconnect()

Closes the websocket and clears all state
Source:

(async) sendCommand(destination, command, data) → {*}

Sends a command to the daemon. For the most part not needed in favor of the 'ChiaDaemon.services' endpoints.
Parameters:
Name Type Description
destination string The destination service for the command. One of the known services like wallet or full_node
command string The command to send, i.e. the rpc endpoint such as get_blockchain_state.
data Object Any input arguments for the command. Omit if no rpc arguments are needed.
Source:
Returns:
Any response payload from the endpoint.
Type
*

Events

connected

connected event. Fires after the socket is opened and register_service returns
Type:
  • object
Source:

connecting

connecting event. Fires just before the WebSocket is created
Type:
  • object
Properties:
Name Type Description
address string the full address of the daemon websocket wss://host:port
Source:

disconnected

disconnected event. Fires after the WebSocket is closed.
Type:
  • object
Source:

event-message

event-message event. Fires when the daemon sends an event.
Type:
  • object
Properties:
Name Type Description
msg object The event message object.
Source:

socket-error

socket-error event. Fires when the WebSocket reaises an error event.
Properties:
Name Type Description
e Error The Error object rasied from the WebSocket.
Source: