opendb_test_rpc
Version:
general purpose library for OpenDB blockchain
37 lines (33 loc) ⢠972 B
text/typescript
import { prompt, Question } from 'inquirer'
import { OpenDBiOptions, underlineChalk } from './utils'
export async function inquireKeystore(): Promise<OpenDBiOptions> {
enum KeystoreActions {
create = 'create',
recover = 'recover',
}
const keystoreActionQuestion: Question = {
// tslint:disable-next-line:readonly-array
choices: [
{ name: 'create a new keystore', value: KeystoreActions.create },
{
name: 'recover from an existing keystore',
value: KeystoreActions.recover,
},
],
message: `${underlineChalk(
'Keyvenant'
)}\nš What do you need with the keystore tool?`,
name: 'keystoreAction',
type: 'list',
}
return prompt([keystoreActionQuestion]).then((answers) => {
const { projectName, keystoreAction } = answers as {
readonly projectName: string
readonly keystoreAction: KeystoreActions
}
return {
projectName,
keystoreAction,
}
})
}