Skip to content

Commit

Permalink
Merge pull request aragon#112 from aragon/print-mnemonic-phrase
Browse files Browse the repository at this point in the history
Print mnemonic phrase when running the dev chain
  • Loading branch information
izqui authored and 0xGabi committed Jan 5, 2019
1 parent 67f23a9 commit a25a3fa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/aragon-cli/src/commands/devchain.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ exports.task = async function ({ port = 8545, reset = false, showAccounts = 2 })
const accounts = await ctx.web3.eth.getAccounts()

ctx.accounts = accounts.slice(0, parseInt(showAccounts))
ctx.mnemonic = MNEMONIC

const ganacheAccounts = server.provider.manager.state.accounts
ctx.privateKeys = ctx.accounts.map((address) => (
Expand All @@ -96,10 +97,14 @@ exports.printAccounts = (reporter, privateKeys) => {
\n${formattedAccounts.join('\n')}`)
}

exports.printMnemonic = (reporter, mnemonic) => {
reporter.info(`The accounts were generated from the following mnemonic phrase: ${mnemonic}\n.`)
}

exports.handler = async ({ reporter, port, reset, accounts }) => {
const task = await exports.task({ port, reset, showAccounts: accounts })
const { privateKeys } = await task.run()
exports.printAccounts(reporter, privateKeys)

reporter.info(`Devchain running: ${chalk.bold('http://localhost:'+port)}.`)
}
}
3 changes: 3 additions & 0 deletions packages/aragon-cli/src/commands/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,9 @@ exports.handler = function ({
if (ctx.privateKeys) {
devchain.printAccounts(reporter, ctx.privateKeys)
}
if (ctx.mnemonic) {
devchain.printMnemonic(reporter, ctx.mnemonic)
}

const registry = module.appName.split('.').slice(1).join('.')

Expand Down

0 comments on commit a25a3fa

Please sign in to comment.