Skip to content

Commit

Permalink
chore: added keys and account creation to wharfkit command
Browse files Browse the repository at this point in the history
  • Loading branch information
dafuga committed Oct 18, 2023
1 parent 3250f20 commit caa4a03
Showing 1 changed file with 34 additions and 8 deletions.
42 changes: 34 additions & 8 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,40 @@
import {Command} from 'commander'
import { Command } from 'commander';

import {version} from '../package.json'
import {generateContractFromCommand} from './commands/contract'
import { version } from '../package.json';
import { generateContractFromCommand } from './commands/contract';

const program = new Command()
const program = new Command();

program.version(version).name('wharfkit').description('Wharf Command Line Utilities')
program
.version(version)
.name('wharfkit')
.description('Wharf Command Line Utilities');

// 1. Command to generate keys
program
.command('generate keys')
.description('Generate a new set of public and private keys')
.action(() => {
// Logic for generating keys goes here
});

// 2. Command to create an account
program
.command('create account')
.description('Create a new account with an optional public key')
.option('--public-key <publicKey>', 'Public key for the new account. If not provided, keys are generated.')
.action((options) => {
const publicKey = options.publicKey;
if (publicKey) {
// Logic to create account with provided public key
} else {
// Logic to generate keys and then create account
}
});

// 3. Existing command to generate a contract
program
.command('generate')
.command('generate <contract-name>')
.description('Generate Contract Kit code for the named smart contract')
.argument('<account>', 'The account name of the contract (e.g. "eosio.token")')
.option('-f, --file [filename]', 'The path where the generated file will be saved')
Expand All @@ -18,6 +44,6 @@ program
'The URL of the API to connect with (e.g. "https://jungle4.greymass.com")',
process.env.WHARFKIT_URL
)
.action(generateContractFromCommand)
.action(generateContractFromCommand);

program.parse()
program.parse(process.argv);

0 comments on commit caa4a03

Please sign in to comment.