5 require("dotenv").config({ path: ".env" });
6 require("dotenv").config({ path: ".env.secret" });
8 let request = require("./lib/request.js");
10 let baseUrl = `https://insight.dash.org/insight-api`;
14 console.info(`Usage:`);
15 console.info(` get-utxos <address>`);
17 console.info(`Example:`);
18 console.info(` get-utxos XkY4rkHb7BzaG9qMUwD7REgAJgSZVysw6C`);
22 async function main() {
23 let addr = process.argv[2];
25 if (["help", "--help", "-h"].includes(addr)) {
31 // TODO check validity
38 let url = `${baseUrl}/addr/${addr}/utxo`;
39 let resp = await request({ url, json: true });
40 let out = JSON.stringify(resp.body, null, 2);
44 main().catch(function (err) {
45 console.error("Fail:");
46 console.error(err.stack || err);