xud
Version:
Exchange Union Daemon
28 lines • 1.8 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.handler = exports.describe = exports.command = void 0;
const xudrpc_pb_1 = require("../../proto/xudrpc_pb");
const command_1 = require("../command");
const ethers_1 = require("ethers");
const formatOutput = (response) => {
const { seedMnemonic } = response;
console.log(`Your Ethereum account mnemonic seed is: "${seedMnemonic}"`);
const wallet = ethers_1.ethers.Wallet.fromMnemonic(seedMnemonic);
console.log(`\nAlternatively, you can also use the following private key to import account with MetaMask: "${wallet.privateKey}"`);
console.log('\nHow to import an account: https://metamask.zendesk.com/hc/en-us/articles/360015489331-How-to-import-an-Account');
};
exports.command = 'getethmnemonic';
exports.describe = 'show the Ethereum seed mnemonic';
exports.handler = (argv) => __awaiter(void 0, void 0, void 0, function* () {
(yield command_1.loadXudClient(argv)).getETHMnemonic(new xudrpc_pb_1.GetMnemonicRequest(), command_1.callback(argv, formatOutput));
});
//# sourceMappingURL=getethmnemonic.js.map