Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for https://github.com/near/near-cli/issues/786 #913

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion commands/generate-key.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ module.exports = {
.option('yolo', {
description: 'Do not ask for extra confirmation when using Ledger',
type: 'boolean',
})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This option is already available on the top level. We should not add it here again.

.option('seedPhrase', {
description: 'Seed phrase mnemonic',
type: 'string',
}),
handler: exitOnError(async (argv) => {
let near = await require('../utils/connect')(argv);
Expand Down Expand Up @@ -36,7 +40,7 @@ module.exports = {

const { deps: { keyStore } } = near.config;
const existingKey = await keyStore.getKey(argv.networkId, argv.accountId);
if (existingKey) {
if (existingKey && !argv.seedPhrase) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will fix just 1 out of ~5 problems we have with generation keys. This is a critical please of code, so I would prefer to fix them all at once.

console.log(`Account has existing key pair with ${existingKey.publicKey} public key`);
return;
}
Expand Down