Skip to content

Commit

Permalink
feat(chain): show protocol version in config
Browse files Browse the repository at this point in the history
  • Loading branch information
davidyuk committed Apr 9, 2024
1 parent ca0d0b2 commit 35496fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/commands/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import fs from 'fs-extra';
import { fileURLToPath } from 'url';
import { resolve } from 'path';
import updateNotifier from 'update-notifier';
import { Node } from '@aeternity/aepp-sdk';
import { Node, ConsensusProtocolVersion } from '@aeternity/aepp-sdk';
import { compilerOption, nodeOption } from '../arguments.js';
import { getCompilerByUrl } from '../utils/cli.js';
import { addToConfig } from '../utils/config.js';
Expand Down Expand Up @@ -44,7 +44,11 @@ EXECUTABLE_CMD.forEach(({ name, desc }) => program.command(name, desc));
async function getNodeDescription(url) {
const nodeInfo = await new Node(url).getNodeInfo().catch(() => {});
return nodeInfo
? `network id ${nodeInfo.nodeNetworkId}, version ${nodeInfo.version}`
? [
`network id ${nodeInfo.nodeNetworkId}`,
`version ${nodeInfo.version}`,
`protocol ${nodeInfo.consensusProtocolVersion} (${ConsensusProtocolVersion[nodeInfo.consensusProtocolVersion]})`,
].join(', ')
: 'can\'t get node info';
}

Expand Down
2 changes: 1 addition & 1 deletion test/other.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import mainProgram from '../src/commands/main.js';
describe('Other tests', () => {
it('Config', async () => {
expect(await executeProgram(mainProgram, ['config'])).to.equal(
'Node https://mainnet.aeternity.io network id ae_mainnet, version 6.13.0\n'
'Node https://mainnet.aeternity.io network id ae_mainnet, version 6.13.0, protocol 5 (Iris)\n'
+ 'Compiler https://v7.compiler.aepps.com version 7.4.0',
);
}).timeout(4000);
Expand Down

0 comments on commit 35496fb

Please sign in to comment.