Skip to content
This repository has been archived by the owner on Jun 10, 2022. It is now read-only.

Gets blockchain storage info. #37

Merged
merged 3 commits into from Jul 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions LICENSE
Expand Up @@ -187,7 +187,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2018 NEM
Copyright 2018-present NEM

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -252,4 +252,4 @@ See license/LICENSE-readline-sync.txt
For rxjs:
========================================================================

See license/LICENSE-rxjs.txt
See license/LICENSE-rxjs.txt
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -54,7 +54,8 @@ Please, use the following available resources to get help:

## License

Copyright (c) 2018 NEM
Copyright 2018-present NEM

Licensed under the [Apache License 2.0](LICENSE)

[self]: https://github.com/nemtech/nem2-cli
Expand Down
6 changes: 4 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/account.transactions.command.ts
@@ -1,6 +1,6 @@
/*
*
* Copyright 2018 NEM
* Copyright 2018-present NEM
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -64,4 +64,4 @@ export class AccountTransactionsOptions extends ProfileOptions {
}
return new QueryParams(this.numtransactions, this.id);
}
}
}
2 changes: 1 addition & 1 deletion src/address.validator.ts
@@ -1,6 +1,6 @@
/*
*
* Copyright 2018 NEM
* Copyright 2018-present NEM
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/cli.ts
@@ -1,6 +1,6 @@
/*
*
* Copyright 2018 NEM
* Copyright 2018-present NEM
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/commands/account/aggregatebonded.ts
@@ -1,6 +1,6 @@
/*
*
* Copyright 2018 NEM
* Copyright 2018-present NEM
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/commands/account/generate.ts
@@ -1,6 +1,6 @@
/*
*
* Copyright 2018 NEM
* Copyright 2018-present NEM
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/commands/account/incoming.ts
@@ -1,6 +1,6 @@
/*
*
* Copyright 2018 NEM
* Copyright 2018-present NEM
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/commands/account/info.ts
@@ -1,6 +1,6 @@
/*
*
* Copyright 2018 NEM
* Copyright 2018-present NEM
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/commands/account/outgoing.ts
@@ -1,6 +1,6 @@
/*
*
* Copyright 2018 NEM
* Copyright 2018-present NEM
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/commands/account/transactions.ts
@@ -1,6 +1,6 @@
/*
*
* Copyright 2018 NEM
* Copyright 2018-present NEM
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/commands/account/unconfirmed.ts
@@ -1,6 +1,6 @@
/*
*
* Copyright 2018 NEM
* Copyright 2018-present NEM
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
28 changes: 14 additions & 14 deletions src/commands/blockchain/height.ts → src/commands/chain/height.ts
@@ -1,27 +1,27 @@
/*
*
* Copyright 2019 NEM
* Copyright 2018-present NEM
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import chalk from 'chalk';
import {command, metadata} from 'clime';
import {ChainHttp} from 'nem2-sdk';
import {ProfileCommand, ProfileOptions} from '../../profile.command';

@command({
description: 'Blockchain height',
description: 'Get the current height of the chain',
})
export default class extends ProfileCommand {

Expand Down
@@ -1,6 +1,6 @@
/*
*
* Copyright 2018 NEM
* Copyright 2018-present NEM
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,7 +21,7 @@ import {ChainHttp} from 'nem2-sdk';
import {ProfileCommand, ProfileOptions} from '../../profile.command';

@command({
description: 'Blockchain score',
description: 'Gets the current score of the chain',
})
export default class extends ProfileCommand {

Expand Down
20 changes: 12 additions & 8 deletions src/commands/default.ts
@@ -1,6 +1,6 @@
/*
*
* Copyright 2018 NEM
* Copyright 2018-present NEM
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -30,30 +30,34 @@ export const description = `
export const subcommands = [
{
name: 'account',
brief: 'Fetch account information',
brief: 'Get account related information',
},
{
name: 'blockchain',
brief: 'Fetch blockchain information',
name: 'chain',
brief: 'Get chain related information',
},
{
name: 'diagnostic',
brief: 'Get node diagnostics reports',
},
{
name: 'mosaic',
brief: 'Fetch mosaic information',
brief: 'Get mosaic related information',
},
{
name: 'namespace',
brief: 'Fetch namespace information',
brief: 'Get namespace related information',
},
{
name: 'transaction',
brief: 'Send transactions',
brief: 'Announce transactions',
},
{
name: 'monitor',
brief: 'Monitor blocks, transactions and errors',
},
{
name: 'profile',
brief: 'Profile management',
brief: 'Manage profiles',
},
];
52 changes: 52 additions & 0 deletions src/commands/diagnostic/serverinfo.ts
@@ -0,0 +1,52 @@
/*
*
* Copyright 2018-present NEM
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import chalk from 'chalk';
import {command, metadata} from 'clime';
import {DiagnosticHttp} from 'nem2-sdk';
import {ProfileCommand, ProfileOptions} from '../../profile.command';

@command({
description: 'Returns the version of the running rest component',
})
export default class extends ProfileCommand {
evias marked this conversation as resolved.
Show resolved Hide resolved

constructor() {
super();
}

@metadata
execute(options: ProfileOptions) {
this.spinner.start();

const profile = this.getProfile(options);

const diagnosticHttp = new DiagnosticHttp(profile.url);

diagnosticHttp.getServerInfo()
.subscribe((serverInfo) => {
this.spinner.stop(true);
console.log('restVersion: ' + serverInfo.restVersion);
console.log('sdkVersion: ' + serverInfo.sdkVersion);
}, (err) => {
this.spinner.stop(true);
let text = '';
text += chalk.red('Error');
console.log(text, err.response !== undefined ? err.response.text : err);
});
}
}
53 changes: 53 additions & 0 deletions src/commands/diagnostic/storage.ts
@@ -0,0 +1,53 @@
/*
*
* Copyright 2018-present NEM
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import chalk from 'chalk';
import {command, metadata} from 'clime';
import {DiagnosticHttp} from 'nem2-sdk';
import {ProfileCommand, ProfileOptions} from '../../profile.command';

@command({
description: 'Returns diagnostic information about the node storage',
})
export default class extends ProfileCommand {
evias marked this conversation as resolved.
Show resolved Hide resolved

constructor() {
super();
}

@metadata
execute(options: ProfileOptions) {
this.spinner.start();

const profile = this.getProfile(options);

const diagnosticHttp = new DiagnosticHttp(profile.url);

diagnosticHttp.getDiagnosticStorage()
.subscribe((storage) => {
this.spinner.stop(true);
console.log('numBlocks: ' + storage.numBlocks);
console.log('numTransactions: ' + storage.numTransactions);
console.log('numAccounts: ' + storage.numAccounts);
}, (err) => {
this.spinner.stop(true);
let text = '';
text += chalk.red('Error');
console.log(text, err.response !== undefined ? err.response.text : err);
});
}
}
2 changes: 1 addition & 1 deletion src/commands/monitor/aggregatebonded.ts
@@ -1,6 +1,6 @@
/*
*
* Copyright 2018 NEM
* Copyright 2018-present NEM
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/commands/monitor/block.ts
@@ -1,6 +1,6 @@
/*
*
* Copyright 2018 NEM
* Copyright 2018-present NEM
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/commands/monitor/confirmed.ts
@@ -1,6 +1,6 @@
/*
*
* Copyright 2018 NEM
* Copyright 2018-present NEM
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/commands/monitor/cosignature.ts
@@ -1,6 +1,6 @@
/*
*
* Copyright 2018 NEM
* Copyright 2018-present NEM
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/commands/monitor/status.ts
@@ -1,6 +1,6 @@
/*
*
* Copyright 2018 NEM
* Copyright 2018-present NEM
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down