UNPKG

@ethersphere/swarm-cli

Version:
50 lines (49 loc) 1.99 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.List = void 0; const identity_1 = require("../../service/identity"); const text_1 = require("../../utils/text"); const identity_command_1 = require("./identity-command"); class List extends identity_command_1.IdentityCommand { constructor() { super(...arguments); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: 'list' }); Object.defineProperty(this, "alias", { enumerable: true, configurable: true, writable: true, value: 'ls' }); Object.defineProperty(this, "description", { enumerable: true, configurable: true, writable: true, value: 'List keypairs which can be used to sign chunks' }); } run() { super.init(); this.throwIfNoIdentities(); for (const [identityName, identity] of Object.entries(this.commandConfig.config.identities)) { const { wallet, identityType } = identity; let address = ''; if ((0, identity_1.isV3Wallet)(wallet, identityType)) { address = `0x${wallet.address}`; } else if ((0, identity_1.isSimpleWallet)(wallet, identityType)) { address = (0, identity_1.getSimpleWallet)(wallet).getAddressString(); } this.console.log((0, text_1.createKeyValue)('Name', identityName)); this.console.log((0, text_1.createKeyValue)('Type', (0, identity_1.getPrintableIdentityType)(identity.identityType))); this.console.log((0, text_1.createKeyValue)('Address', address)); this.console.quiet(identityName, (0, identity_1.getPrintableIdentityType)(identity.identityType), address); this.console.divider(); } } } exports.List = List;