diff --git a/src/cli.ts b/src/cli.ts index b9c1b64f..6eb5d8e6 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -35,10 +35,13 @@ program .addCommand(entropyTransferCommand()) .addCommand(entropySignCommand()) .addCommand(entropyProgramCommand()) - .action(async (options: EntropyTuiOptions) => { - const { account, endpoint } = options - const entropy = await loadEntropy(account, endpoint) - launchTui(entropy, options) + .action(async (opts: EntropyTuiOptions) => { + const { account, endpoint } = opts + const entropy = account + ? await loadEntropy(account, endpoint) + : undefined + // NOTE: on initial startup you have no account + launchTui(entropy, opts) }) program.parseAsync().then(() => {}) diff --git a/src/common/utils.ts b/src/common/utils.ts index 419340ef..b4dbc7ea 100644 --- a/src/common/utils.ts +++ b/src/common/utils.ts @@ -66,7 +66,7 @@ export function accountChoicesWithOther (accounts: EntropyAccountConfig[]) { } export function findAccountByAddressOrName (accounts: EntropyAccountConfig[], aliasOrAddress: string) { - if (!aliasOrAddress || !aliasOrAddress.length) throw Error('aliasOrAddress required') + if (!aliasOrAddress || !aliasOrAddress.length) throw Error('account name or address required') return ( accounts.find(account => account.address === aliasOrAddress) || diff --git a/src/config/index.ts b/src/config/index.ts index 2afa3287..4a6b7a23 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -67,9 +67,11 @@ export function getSync (configPath = CONFIG_PATH): EntropyConfig { const configBuffer = readFileSync(configPath, 'utf8') return deserialize(configBuffer) } catch (err) { + console.log('CODE', err.code) if (err.code !== 'ENOENT') throw err const newConfig = migrateData(allMigrations, {}) + mkdirp.sync(dirname(configPath)) writeFileSync(configPath, serialize(newConfig)) return newConfig } diff --git a/src/program/main.ts b/src/program/main.ts index 65f0443e..95e8a903 100644 --- a/src/program/main.ts +++ b/src/program/main.ts @@ -53,7 +53,7 @@ export class EntropyProgram extends EntropyBase { ) } - async get (programPointer: string) { + async get (programPointer: string): Promise { this.logger.debug(`program pointer: ${programPointer}`, `${FLOW_CONTEXT}::PROGRAM_PRESENCE_CHECK`); return this.entropy.programs.dev.getProgramInfo(programPointer) }