5 require("dotenv").config({ path: ".env" });
6 require("dotenv").config({ path: ".env.secret" });
8 //let Https = require("https");
10 // only needed for insight APIs hosted behind an AWS load balancer
11 let Cookies = require("../lib/cookies.js");
12 let Ws = require("../lib/ws.js");
14 let baseUrl = `https://insight.dash.org`;
18 console.info(`Usage:`);
19 //console.info(` insight-websocket [eventname1,eventname2,]`);
20 console.info(` insight-websocket # listens for 'inv' events`);
23 console.info(`Example:`);
24 console.info(` insight-websocket inv,addresstxid`);
28 // TODO Ws.waitForVout()
31 async function main() {
32 // ex: inv,dashd/addresstxid
33 let eventnames = (process.argv[2] || "inv").split(",");
35 if (["help", "--help", "-h"].includes(eventnames[0])) {
41 // TODO check validity
42 if (!eventnames.length) {
48 // TODO pass eventnames
58 main().catch(function (err) {
59 console.error("Fail:");
60 console.error(err.stack || err);