@titan-suite/cli
Version:
The complete smart contract development tool
53 lines (52 loc) • 1.73 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const command_1 = require("@oclif/command");
const inquirer_1 = require("inquirer");
const index_1 = require("../utils/index");
class Unlock extends command_1.Command {
constructor() {
super(...arguments);
this.questions = [
{
type: 'input',
name: 'account'
},
{
type: 'password',
name: 'password'
}
];
}
run() {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const { flags } = this.parse(Unlock);
if (flags.address && flags.password) {
yield index_1.unlock(flags.address, flags.password);
}
else if (flags.address && !flags.password) {
const answers = yield inquirer_1.prompt(this.questions[1]);
yield index_1.unlock(String(flags.address), answers.password);
}
else {
const answers = yield inquirer_1.prompt(this.questions);
yield index_1.unlock(answers.account, answers.password);
}
});
}
}
Unlock.description = 'Unlock an AION account';
Unlock.examples = [
'$ titan unlock',
'$ titan unlock -a 0xbeef...',
'$ titan unlock -a 0xc0de... -p the_password'
];
Unlock.flags = {
help: command_1.flags.help({ char: 'h' }),
address: command_1.flags.string({ char: 'a', description: 'the address to unlock' }),
password: command_1.flags.string({
char: 'p',
description: 'the password of the account'
})
};
exports.default = Unlock;