@ellcrys/spell
Version:
The official JavaScript library for Ellcrys
85 lines (84 loc) • 2.09 kB
TypeScript
import Namespace from "./namespace";
import RPCClient from "../rpcclient";
/**
* Manage the network related activities of a Node
*
* @export
* @class Net
* @extends {Namespace}
*/
export default class Net extends Namespace {
/**
* Creates an instance of Net.
*
* @param {RPCClient} client
* @memberof Net
*/
constructor(client: RPCClient);
/**
* getActivePeers get all the peers
* that are connected to the node
*
* @returns {Promise<Peer[]>}
* @memberof Net
*/
getActivePeers(): Promise<ActivePeer[]>;
/**
* Get all the peers that the peers
* that is known to the node.
*
* @returns {Promise<Peer[]>}
* @memberof Net
*/
getPeers(): Promise<Peer[]>;
/**
* Get the peers that the node will
* regularly broadcast messages to.
*
* @returns {Promise<any>}
* @memberof Net
*/
getBroadcasters(): Promise<any>;
/**
* Get the node's connection stats
*
* @returns {Promise<any>}
* @memberof Net
*/
getStats(): Promise<NetStat>;
/**
* Add a peer address to a node.
* The node will attempt to connect
* to this address when it needs more
* connections.
*
* @param {string} peerAddress
* @returns {Promise<boolean>}
* @memberof Net
*/
addPeer(peerAddress: string): Promise<boolean>;
/**
* Delete all peers in memory and on disk
*
* @param {string} peerAddress
* @returns {Promise<boolean>}
* @memberof Net
*/
dumpPeers(): Promise<boolean>;
/**
* Connect to one or more addresses
* immediately
*
* @param {Array<string>} peerAddress array of addresses to be connected to
* @returns {Promise<boolean>}
* @memberof Net
*/
join(peerAddress: Array<string>): Promise<boolean>;
/**
* Prevents inbound or outbound connections by
* shutting down the client's network function.
* @returns {Promise<boolean>}
* @memberof Net
*/
noNet(): Promise<boolean>;
}