UNPKG

@node-lightning/graph

Version:
43 lines 1.11 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Node = void 0; /** * Reperesents a node in the p2p network. */ class Node { constructor() { this.addresses = []; /** * Channels that the node belongs to */ this.channels = new Map(); } /** * Gets the alias as human readable string */ get aliasString() { return this.alias ? this.alias.toString("utf8").replace(/\0/g, "") : ""; } /** * Gets the color as a an RGB color string */ get rgbColorString() { return this.rgbColor ? "#" + this.rgbColor.toString("hex") : "#000000"; } /** * Adds a channel to the node's channel list */ linkChannel(channel) { const key = channel.shortChannelId.toNumber(); this.channels.set(key, channel); } /** * Remove a channel from the node's channel list */ unlinkChannel(channel) { const key = channel.shortChannelId.toNumber(); this.channels.delete(key); } } exports.Node = Node; //# sourceMappingURL=node.js.map