Skip to content

Commit

Permalink
refactor(account)!: remove unnecessary account generate command
Browse files Browse the repository at this point in the history
BREAKING CHANGE: `account generate` command removed
Use `account create` in a cycle instead.
  • Loading branch information
davidyuk committed Apr 24, 2023
1 parent bb39f07 commit 1c6abd8
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 31 deletions.
16 changes: 0 additions & 16 deletions src/actions/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import fs from 'fs-extra';
import {
generateKeyPair, encode, Encoding, verifyMessage as _verifyMessage,
} from '@aeternity/aepp-sdk';
import CliError from '../utils/CliError';
import { writeWallet } from '../utils/account';
import { initSdkByWalletFile, getAccountByWalletFile } from '../utils/cli';
import { print, printTransaction, printUnderscored } from '../utils/print';
Expand Down Expand Up @@ -148,18 +147,3 @@ export async function createSecureWalletByPrivKey(
printUnderscored('Path', path);
}
}

export async function generateKeyPairs(count, { json }) {
if (!Number.isInteger(+count)) {
throw new CliError(`Count must be a number, got ${count} instead`);
}
const accounts = new Array(+count).fill().map(() => generateKeyPair());
if (json) print(accounts);
else {
accounts.forEach((acc, i) => {
if (i) print('');
printUnderscored(`Account #${i + 1} address`, acc.publicKey);
printUnderscored(`Account #${i + 1} secret key`, acc.secretKey);
});
}
}
10 changes: 0 additions & 10 deletions src/commands/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,4 @@ addCommonOptions(program
.description('Save a private keys string to a password protected file wallet')
.action(Account.createSecureWalletByPrivKey));

// ## Initialize `generateKeyPairs` command
//
// You can use this command to generate KeyPair's.
//
// Example: `aecli account generate 10 --force
addCommonOptions(program
.command('generate <count>')
.description('Generate account key pairs')
.action(Account.generateKeyPairs));

export default program;
5 changes: 0 additions & 5 deletions test/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,6 @@ Version _________________________________ 1
expect(+await sdk.getBalance(publicKey)).to.be.equal(balanceBefore * 0.42);
});

it('Generate accounts', async () => {
const accounts = await executeAccount(['generate', 2, '--json']);
accounts.length.should.be.equal(2);
});

it('Sign message', async () => {
const data = 'Hello world';
const signedMessage = await executeAccount(['sign-message', WALLET_NAME, data, '--json', '--password', 'test']);
Expand Down

0 comments on commit 1c6abd8

Please sign in to comment.