+ // console.error because console.debug goes to stdout, not stderr
+ debug(``);
+ debug(`Staking keys: (in ${keysDirRel}/)`);
+ debug(``);
+
+ await wifnames.reduce(async function (promise, wifname) {
+ await promise;
+
+ let wifpath = Path.join(keysDir, wifname);
+ let addr = await maybeReadKeyFile(wifpath, { wif: false }).catch(function (
+ err,
+ ) {
+ warns.push({ node: wifname, error: err });
+ return "";
+ });
+ if (!addr) {
+ return;
+ }
+
+ console.info(`${addr}`);
+ }, Promise.resolve());
+ debug(``);
+
+ if (warns.length) {
+ console.warn(`Warnings:`);
+ warns.forEach(function (warn) {
+ console.warn(`${warn.node}: ${warn.error.message}`);
+ });
+ console.warn(``);
+ }
+}
+
+/**
+ * @param {Object} opts
+ * @param {any} opts.dashApi - TODO
+ * @param {String} opts.defaultAddr
+ * @param {Array<String>} args
+ */
+async function getAllBalances({ dashApi, defaultAddr }, args) {
+ let wifnames = await listManagedKeynames();
+ let totals = {
+ key: 0,
+ stake: 0,
+ dividend: 0,
+ keyDash: "",
+ stakeDash: "",
+ dividendDash: "",
+ };
+
+ if (wifnames.length) {
+ // to print 'default staking key' message
+ await mustGetAddr({ defaultAddr }, args);
+ }
+
+ /**
+ * @type Array<{ node: String, error: Error }>
+ */
+ let warns = [];
+ // console.error because console.debug goes to stdout, not stderr
+ debug(``);
+ debug(`Staking keys: (in ${keysDirRel}/)`);
+ debug(``);
+ console.info(
+ `| | 🔑 Holdings | 🪧 Stakings | 💸 Earnings |`,
+ );
+ console.info(
+ `| ---------------------------------: | ------------: | ------------: | ------------: |`,
+ );