@nexex/cli
Version:
39 lines • 1.47 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const cli_table3_1 = __importDefault(require("cli-table3"));
const MarketBase_1 = __importDefault(require("../../MarketBase"));
const Token_1 = require("../../model/Token");
class MarketList extends MarketBase_1.default {
async run() {
const { flags } = this.parse(MarketList);
const obClient = this.initObClient(flags);
const markets = await obClient.markets();
const { showAddr } = flags;
const table = new cli_table3_1.default({
head: ['Market']
// colWidths: [10, 100, 100]
});
markets.forEach(({ base, quote }) => {
const baseToken = new Token_1.Token(base.symbol, base.addr);
const quoteToken = new Token_1.Token(quote.symbol, quote.addr);
table.push([`${baseToken.toString(showAddr)}-${quoteToken.toString(showAddr)}`]);
});
console.log(table.toString());
// console.log(JSON.stringify(markets, null, 4));
process.exit(0);
}
}
MarketList.description = 'describe the command here';
MarketList.examples = [
`$ nexex-cli hello
hello world from ./src/hello.ts!
`
];
MarketList.flags = {
...MarketBase_1.default.flags
};
exports.default = MarketList;
//# sourceMappingURL=list.js.map