Private connectPrivate connectionPrivate forcePrivate initPrivate maxPrivate messagePrivate messageProtected Optional privatekeyPrivate Optional reconnectionPrivate Optional wspStatic BLOCKEmitted when a block is submitted, if subscribed to the blocks or
ownBlocks events. The whole KristWsBlockEvent message will be
passed to the callback.
Static EVENTEmitted when any event is received. The full KristWsEventMessage will be passed to the callback.
Static KEEPALIVEEmitted when the server sends a keepalive ping. The server's time as a Date will be passed to the callback.
Static MESSAGEEmitted when any message is received. The full raw KristWsS2CMessage will be passed to the callback.
Static NAMEEmitted when a name is purchased, if subscribed to the names or
ownNames events. The whole KristWsNameEvent message will be
passed to the callback.
Static READYEmitted when the client has connected to the server and is ready to receive
messages. The hello message from the server will be passed as an argument
to the event, containing full KristMotd information. This event
will happen each time the client connects to the server, so it may happen
more than once.
Static STATEEmitted when the connection state changes. The new and old states respectively will be passed as arguments to the callback.
Static TRANSACTIONEmitted when a transaction is made, if subscribed to the transactions or
ownTransactions events. The whole KristWsTransactionEvent
message will be passed to the callback.
Static defaultGets a single address.
The address.
The address to get.
Optional fetchNames: booleanWhen true, fetch the count of names owned by the
address. The address object returned will have the
names count field available.
Gets information about the user the websocket is currently authenticated as.
https://krist.dev/docs/#api-WebsocketGroup-WSMe
The whole KristWsS2CMe response from the server.
Sends a transaction to the given address.
The KristTransaction that was made.
The address to send the transaction to. May be a Krist address or a name.
The amount to send.
Optional options: KristWsMakeTransactionOptionsThe KristApiMakeTransactionOptions options for the request. If a password or private key are not supplied, the request will error.
Private _connectInitiate a connection to the Krist server. From this point onwards, the client will take over responsibility for auto-reconnecting. Event handlers should be registered before calling this method.
The promise will be resolved when the connection has been opened (but will not necessarily be ready yet).
Private handlePrivate handlePrivate handlePrivate handleOptional event: keyof KristWsClientEventsPrivate sendPrivate setSends a raw message to the Krist server and waits for a response. The methods for a specific API request should be used instead of this function.
The response from the server.
The full message to send to the server. The message ID will be generated automatically.
Generated using TypeDoc
A WebSocket client instance for the Krist API. Must be created with createWsClient.
After creating a KristWsClient, you can call connect to establish a new connection to the Krist server. After this, the client will automatically attempt to reconnect if the connection is lost.
KristWsClient is a standard event emitter. Events can be listened to with
ws.on(event, callback).When disconnecting from the Krist server, the client will automatically try to reconnect, starting with a 1 second delay, doubling with each attempt up to a maximum of 60 seconds (1 minute). The library will not stop attempting to reconnect - this is the responsibility of the caller.