Skip to content

Commit

Permalink
feat(client version): add config, network and account propert…
Browse files Browse the repository at this point in the history
…ies`
  • Loading branch information
martiliones committed Apr 22, 2024
1 parent 238e8f9 commit d08bd2e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bin/adamant.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ client.command('version').action(() => {
log({
success: true,
version: packageInfo.version,
config: config.configPath,
network: config.network,
account: config.accountAddress,
});
});

Expand Down
10 changes: 10 additions & 0 deletions utils/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ import Joi from 'joi';
import jsonminify from 'jsonminify';
import chalk from 'chalk';

import {
createKeypairFromPassphrase,
createAddressFromPublicKey,
} from 'adamant-api';

import * as log from './log.js';

const homeDir = os.homedir();
Expand Down Expand Up @@ -68,9 +73,14 @@ for (const configPath of configPaths) {
if (existingConfigPath) {
const loadedConfig = loadConfig(existingConfigPath);

const keypair = createKeypairFromPassphrase(loadedConfig.passphrase);
const address = createAddressFromPublicKey(keypair.publicKey);

config = {
...config,
...loadedConfig,
configPath: existingConfigPath,
accountAddress: address,
};

break;
Expand Down

0 comments on commit d08bd2e

Please sign in to comment.