New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@electrum-cash/network

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@electrum-cash/network - npm Package Compare versions

Comparing version

to
4.0.0-development.6401415161

175

dist/index.d.ts

@@ -114,134 +114,2 @@ import { EventEmitter } from "events";

/**
* Wrapper around TLS/WSS sockets that gracefully separates a network stream into Electrum protocol messages.
*
* @ignore
*/
declare class ElectrumConnection extends EventEmitter {
application: string;
version: string;
host: string;
port: number;
scheme: TransportScheme;
timeout: number;
pingInterval: number;
reconnectInterval: number;
useBigInt: boolean;
status: ConnectionStatus;
lastReceivedTimestamp: number;
software: string;
/**
* Sets up network configuration for an Electrum client connection.
*
* @param {string} application your application name, used to identify to the electrum host.
* @param {string} version protocol version to use with the host.
* @param {string} host fully qualified domain name or IP number of the host.
* @param {number} port the network port of the host.
* @param {TransportScheme} scheme the transport scheme to use for connection
* @param {number} timeout how long network delays we will wait for before taking action, in milliseconds.
* @param {number} pingInterval the time between sending pings to the electrum host, in milliseconds.
* @param {number} reconnectInterval the time between reconnection attempts to the electrum host, in milliseconds.
* @param {boolean} useBigInt whether to use bigint for numbers in json response.
*
* @throws {Error} if `version` is not a valid version string.
*/
constructor(application: string, version: string, host: string, port?: number, scheme?: TransportScheme, timeout?: number, pingInterval?: number, reconnectInterval?: number, useBigInt?: boolean);
/**
* Returns a string for the host identifier for usage in debug messages.
*/
get hostIdentifier(): string;
/**
* Create and configures a fresh socket and attaches all relevant listeners.
*/
createSocket(): void;
/**
* Shuts down and destroys the current socket.
*/
destroySocket(): void;
/**
* Assembles incoming data into statements and hands them off to the message parser.
*
* @param {string} data data to append to the current message buffer, as a string.
*
* @throws {SyntaxError} if the passed statement parts are not valid JSON.
*/
parseMessageChunk(data: string): void;
/**
* Sends a keep-alive message to the host.
*
* @returns true if the ping message was fully flushed to the socket, false if
* part of the message is queued in the user memory
*/
ping(): boolean;
/**
* Initiates the network connection negotiates a protocol version. Also emits the 'connect' signal if successful.
*
* @throws {Error} if the socket connection fails.
* @returns a promise resolving when the connection is established
*/
connect(): Promise<void>;
/**
* Restores the network connection.
*/
reconnect(): Promise<void>;
/**
* Removes the current reconnect timer.
*/
clearReconnectTimer(): void;
/**
* Removes the current keep-alive timer.
*/
clearKeepAliveTimer(): void;
/**
* Initializes the keep alive timer loop.
*/
setupKeepAliveTimer(): void;
/**
* Tears down the current connection and removes all event listeners on disconnect.
*
* @param {boolean} force disconnect even if the connection has not been fully established yet.
* @param {boolean} intentional update connection state if disconnect is intentional.
*
* @returns true if successfully disconnected, or false if there was no connection.
*/
disconnect(force?: boolean, intentional?: boolean): Promise<boolean>;
/**
* Updates connection state based on application visibility.
*
* Some browsers will disconnect network connections when the browser is out of focus,
* which would normally cause our reconnect-on-timeout routines to trigger, but that
* results in a poor user experience since the events are not handled consistently
* and sometimes it can take some time after restoring focus to the browser.
*
* By manually disconnecting when this happens we prevent the default reconnection routines
* and make the behavior consistent across browsers.
*/
handleVisibilityChange(): Promise<void>;
/**
* Sends an arbitrary message to the server.
*
* @param {string} message json encoded request object to send to the server, as a string.
*
* @returns true if the message was fully flushed to the socket, false if part of the message
* is queued in the user memory
*/
send(message: string): boolean;
/**
* Marks the connection as timed out and schedules reconnection if we have not
* received data within the expected time frame.
*/
verifySend(sentTimestamp: number): void;
/**
* Updates the connection status when a connection is confirmed.
*/
onSocketConnect(): void;
/**
* Updates the connection status when a connection is ended.
*/
onSocketDisconnect(): void;
/**
* Notify administrator of any unexpected errors.
*/
onSocketError(error: any | undefined): void;
}
/**
* Triggers when the underlying connection is established.

@@ -274,4 +142,21 @@ *

useBigInt: boolean;
connection: ElectrumConnection;
/**
* The name and version of the server software indexing the blockchain.
*/
software: string;
/**
* The genesis hash of the blockchain indexed by the server.
* @note This is only available after a 'server.features' call.
*/
genesisHash: string;
/**
* The chain height of the blockchain indexed by the server.
* @note This is only available after a 'blockchain.headers.subscribe' call.
*/
chainHeight: number;
/**
* Timestamp of when we last received data from the server indexing the blockchain.
*/
lastReceivedTimestamp: number;
/**
* Initializes an Electrum client.

@@ -358,4 +243,28 @@ *

onConnectionDisconnect(): void;
/**
* Stores the server provider software version field on successful version negotiation.
*/
storeSoftwareVersion(versionStatement: any): Promise<void>;
/**
* Updates the last received timestamp.
*
* @ignore
*/
updateLastReceivedTimestamp(): Promise<void>;
/**
* Checks if the provided message is a response to a headers subscription,
* and if so updates the locally stored chain height value for this client.
*
* @ignore
*/
updateChainHeightFromHeadersNotifications(message: any): Promise<void>;
/**
* Checks if the provided message is a response to a server.features request,
* and if so stores the genesis hash for this client locally.
*
* @ignore
*/
storeGenesisHashFromFeaturesResponse(message: any): Promise<void>;
}
//# sourceMappingURL=index.d.ts.map
{
"name": "@electrum-cash/network",
"version": "4.0.0-development.6393041663",
"version": "4.0.0-development.6401415161",
"description": "@electrum-cash/network is a lightweight JavaScript library that lets you connect with one or more Electrum servers.",

@@ -5,0 +5,0 @@ "homepage": "https://gitlab.com/electrum-cash/network#readme",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet