@electrum-cash/network
Advanced tools
Comparing version
import { EventEmitter } from "eventemitter3"; | ||
import { ElectrumSocket } from "@electrum-cash/sockets"; | ||
type RPCParameter = string | number | boolean | null; | ||
@@ -39,4 +38,71 @@ interface RPCBase { | ||
/** | ||
* List of events emitted by the ElectrumSocket. | ||
* @event | ||
* @ignore | ||
*/ | ||
export interface ElectrumSocketEvents { | ||
/** | ||
* Emitted when data has been received over the socket. | ||
* @eventProperty | ||
*/ | ||
'data': [string]; | ||
/** | ||
* Emitted when a socket connects. | ||
* @eventProperty | ||
*/ | ||
'connected': []; | ||
/** | ||
* Emitted when a socket disconnects. | ||
* @eventProperty | ||
*/ | ||
'disconnected': []; | ||
/** | ||
* Emitted when the socket has failed in some way. | ||
* @eventProperty | ||
*/ | ||
'error': [Error]; | ||
} | ||
/** | ||
* Abstract socket used when communicating with Electrum servers. | ||
*/ | ||
export interface ElectrumSocket extends EventEmitter<ElectrumSocketEvents>, ElectrumSocketEvents { | ||
/** | ||
* Utility function to provide a human accessible host identifier. | ||
*/ | ||
get hostIdentifier(): string; | ||
/** | ||
* Fully qualified domain name or IP address of the host | ||
*/ | ||
host: string; | ||
/** | ||
* Network port for the host to connect to, defaults to the standard TLS port | ||
*/ | ||
port: number; | ||
/** | ||
* If false, uses an unencrypted connection instead of the default on TLS | ||
*/ | ||
encrypted: boolean; | ||
/** | ||
* If no connection is established after `timeout` ms, the connection is terminated | ||
*/ | ||
timeout: number; | ||
/** | ||
* Connects to an Electrum server using the socket. | ||
*/ | ||
connect(): void; | ||
/** | ||
* Disconnects from the Electrum server from the socket. | ||
*/ | ||
disconnect(): void; | ||
/** | ||
* Write data to the Electrum server on the socket. | ||
* | ||
* @param data - Data to be written to the socket | ||
* @param callback - Callback function to be called when the write has completed | ||
*/ | ||
write(data: Uint8Array | string, callback?: (err?: Error) => void): boolean; | ||
} | ||
/** | ||
* @ignore | ||
*/ | ||
export interface VersionRejected { | ||
@@ -43,0 +109,0 @@ error: RPCError; |
{ | ||
"name": "@electrum-cash/network", | ||
"version": "4.0.1", | ||
"version": "4.0.2-development.8063220996", | ||
"description": "@electrum-cash/network is a lightweight JavaScript library that lets you connect with one or more Electrum servers.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
141826
3.02%1262
5.52%1
Infinity%