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

Commit

Permalink
Merge pull request #323 from UsingBlockchain/release
Browse files Browse the repository at this point in the history
v0.22.0: Public testnet v0.10.x network compatibility
  • Loading branch information
gimer authored Oct 6, 2020
2 parents 983a47c + d42f315 commit 3af0585
Show file tree
Hide file tree
Showing 35 changed files with 1,372 additions and 1,493 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ deploy:
skip_cleanup: true
script: /bin/sh travis/githubPages.sh
on:
branch: master
branch: main
- provider: script
skip_cleanup: true
script: /bin/sh travis/uploadArchives.sh
on:
branch: master
branch: main
- provider: script
skip_cleanup: true
script: /bin/sh travis/release.sh
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@ All notable changes to this project will be documented in this file.

The changelog format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [0.22.0] - 06-Oct-2020

**Milestone**: 0.10.x

### Added

- Added ``fromHeight`` and ``toHeight`` criteria to ``transaction search`` command.
- Added totalTransactionsCount in ``block info`` which contains embedded transactions.
- Added ``finalizedBlock`` WebSockets endpoint listener with ``monitor finalizedblock``.
- Added ``chain info`` command to cope with lately added /chain/info endpoint.

### Changed

- ``metadata account|mosaic|namespace`` now use latest REST search endpoints.
- ``monitor block`` command now uses a Table to display information.

## [0.21.1] - 13-Jul-2020

**Milestone**: 0.9.6.3
Expand Down
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Symbol CLI

[![npm version](https://badge.fury.io/js/symbol-cli.svg)](https://badge.fury.io/js/symbol-cli)
[![Build Status](https://api.travis-ci.com/nemtech/symbol-cli.svg?branch=master)](https://travis-ci.com/nemtech/symbol-cli)
[![Coverage Status](https://coveralls.io/repos/github/nemtech/symbol-cli/badge.svg?branch=master)](https://coveralls.io/github/nemtech/symbol-cli?branch=master)
[![Build Status](https://api.travis-ci.com/nemtech/symbol-cli.svg?branch=main)](https://travis-ci.com/nemtech/symbol-cli)
[![Coverage Status](https://coveralls.io/repos/github/nemtech/symbol-cli/badge.svg?branch=main)](https://coveralls.io/github/nemtech/symbol-cli?branch=main)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

Command Line Interface (CLI) to interact with Symbol.
Expand All @@ -11,6 +11,7 @@ Command Line Interface (CLI) to interact with Symbol.

## Important Notes

- [0.22.x](CHANGELOG.md#0220-06-Oct-2020) - **0.10.0.x Milestone**
- [0.21.x](CHANGELOG.md#0211-31-Jul-2020) - **0.9.6.3 Milestone**
- [0.20.x](CHANGELOG.md#0201-27-May-2020) - **0.9.5.1 Milestone**

Expand Down Expand Up @@ -48,8 +49,6 @@ To get the full list of available commands, check the [CLI reference][ref].

## Contributing

This project is developed and maintained by NEM Foundation.

Contributions are welcome and appreciated.
Check [CONTRIBUTING](CONTRIBUTING.md) for information on how to contribute.

Expand All @@ -63,4 +62,4 @@ Licensed under the [Apache License 2.0](LICENSE)
[docs]: http://nemtech.github.io/getting-started/setup-workstation.html
[ref]: https://nemtech.github.io/cli.html
[issues]: https://github.com/nemtech/symbol-cli/issues
[slack]: https://join.slack.com/t/nem2/shared_invite/enQtMzY4MDc2NTg0ODgyLWZmZWRiMjViYTVhZjEzOTA0MzUyMTA1NTA5OWQ0MWUzNTA4NjM5OTJhOGViOTBhNjkxYWVhMWRiZDRkOTE0YmU
[slack]: https://join.slack.com/t/nem2/shared_invite/zt-hwsoo1s5-G8XO50LaY0m7ZKTRXAczcA
2,368 changes: 988 additions & 1,380 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "symbol-cli",
"version": "0.21.1",
"version": "0.22.0",
"description": "Command Line Interface (CLI) to interact with Symbol",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -42,9 +42,9 @@
"path": "^0.12.7",
"prompts": "^2.1.0",
"rxjs": "^6.5.3",
"symbol-hd-wallets": "^0.12.0",
"symbol-sdk": "^0.20.6",
"symbol-uri-scheme": "^0.4.7",
"symbol-hd-wallets": "^0.13.0",
"symbol-sdk": "^0.21.0",
"symbol-uri-scheme": "^0.5.1",
"update-notifier": "^4.1.0"
},
"devDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion src/commands/block/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ export class BlockHeaderTable {
['Hash:', blockInfo.hash],
['Generation Hash:', blockInfo.generationHash],
['Total Fee:', blockInfo.totalFee.toString()],
['Number of Transactions:', blockInfo.numTransactions],
['Number of Transactions:', blockInfo.transactionsCount],
['Number of Transactions (with embedded):', blockInfo.totalTransactionsCount],
['Signature:', blockInfo.signature.slice(0, 64) + '\n' + blockInfo.signature.slice(64, 128)],
['Signer:', blockInfo.signer.publicKey],
['Network Type:', NetworkType[blockInfo.networkType]],
Expand Down
4 changes: 2 additions & 2 deletions src/commands/block/receipts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ export default class extends ProfileCommand {

this.spinner.start();
const receiptHttp = profile.repositoryFactory.createReceiptRepository();
receiptHttp.getBlockReceipts(height).subscribe(
receiptHttp.searchReceipts({ height }).subscribe(
(statement: any) => {
this.spinner.stop();
new StatementsView(statement).print();
},
(err) => {
(err: any) => {
this.spinner.stop();
console.log(FormatterService.error(err));
},
Expand Down
9 changes: 5 additions & 4 deletions src/commands/chain/height.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*
*/
import { command, metadata } from 'clime';
import { ChainInfo } from 'symbol-sdk';

import { ProfileCommand } from '../../interfaces/profile.command';
import { ProfileOptions } from '../../interfaces/profile.options';
Expand All @@ -35,12 +36,12 @@ export default class extends ProfileCommand {

this.spinner.start();
const chainHttp = profile.repositoryFactory.createChainRepository();
chainHttp.getBlockchainHeight().subscribe(
(height) => {
chainHttp.getChainInfo().subscribe(
(info: ChainInfo) => {
this.spinner.stop();
console.log(height.toString());
console.log(info.height.toString());
},
(err) => {
(err: any) => {
this.spinner.stop();
console.log(FormatterService.error(err));
},
Expand Down
97 changes: 97 additions & 0 deletions src/commands/chain/info.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/*
*
* Copyright 2020-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 * as Table from 'cli-table3';
import { HorizontalTable } from 'cli-table3';
import { command, metadata } from 'clime';
import { ChainInfo } from 'symbol-sdk';

import { ProfileCommand } from '../../interfaces/profile.command';
import { ProfileOptions } from '../../interfaces/profile.options';
import { FormatterService } from '../../services/formatter.service';

export class ChainInfoTable {
private readonly table: HorizontalTable;
constructor(public readonly chainInfo: ChainInfo) {
this.table = new Table({
style: { head: ['cyan'] },
head: ['Property', 'Value'],
}) as HorizontalTable;
this.table.push(
['Height', chainInfo.height.toString()],
['Score Low', chainInfo.scoreLow.toString()],
['Score High', chainInfo.scoreHigh.toString()],
);
}

toString(): string {
let text = '';
text += FormatterService.title('Chain Information');
text += '\n' + this.table.toString();
return text;
}
}

export class FinalizationInfoTable {
private readonly table: HorizontalTable;
constructor(public readonly chainInfo: ChainInfo) {
this.table = new Table({
style: { head: ['cyan'] },
head: ['Property', 'Value'],
}) as HorizontalTable;
this.table.push(
['Finalized Height', chainInfo.latestFinalizedBlock.height.toString()],
['Finalized Hash', chainInfo.latestFinalizedBlock.hash],
['Finalization Point', chainInfo.latestFinalizedBlock.finalizationPoint.toString()],
['Finalization Epoch', chainInfo.latestFinalizedBlock.finalizationEpoch.toString()],
);
}

toString(): string {
let text = '';
text += FormatterService.title('Latest Finalized Block');
text += '\n' + this.table.toString();
return text;
}
}

@command({
description: 'Get the current information of the chain',
})
export default class extends ProfileCommand {
constructor() {
super();
}

@metadata
execute(options: ProfileOptions) {
const profile = this.getProfile(options);

this.spinner.start();
const chainHttp = profile.repositoryFactory.createChainRepository();
chainHttp.getChainInfo().subscribe(
(info: ChainInfo) => {
this.spinner.stop();
console.log(new ChainInfoTable(info).toString(), new FinalizationInfoTable(info).toString());
},
(err: any) => {
this.spinner.stop();
console.log(FormatterService.error(err));
},
);
}
}
12 changes: 6 additions & 6 deletions src/commands/chain/score.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
import * as Table from 'cli-table3';
import { HorizontalTable } from 'cli-table3';
import { command, metadata } from 'clime';
import { BlockchainScore } from 'symbol-sdk';
import { ChainInfo } from 'symbol-sdk';

import { ProfileCommand } from '../../interfaces/profile.command';
import { ProfileOptions } from '../../interfaces/profile.options';
import { FormatterService } from '../../services/formatter.service';

export class ChainScoreTable {
private readonly table: HorizontalTable;
constructor(public readonly score: BlockchainScore) {
constructor(public readonly score: ChainInfo) {
this.table = new Table({
style: { head: ['cyan'] },
head: ['Property', 'Value'],
Expand Down Expand Up @@ -56,12 +56,12 @@ export default class extends ProfileCommand {

this.spinner.start();
const chainHttp = profile.repositoryFactory.createChainRepository();
chainHttp.getChainScore().subscribe(
(score) => {
chainHttp.getChainInfo().subscribe(
(info: ChainInfo) => {
this.spinner.stop();
console.log(new ChainScoreTable(score).toString());
console.log(new ChainScoreTable(info).toString());
},
(err) => {
(err: any) => {
this.spinner.stop();
console.log(FormatterService.error(err));
},
Expand Down
12 changes: 6 additions & 6 deletions src/commands/metadata/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import * as Table from 'cli-table3';
import { HorizontalTable } from 'cli-table3';
import { command, metadata, option } from 'clime';
import { Metadata, MetadataEntry } from 'symbol-sdk';
import { Metadata, MetadataEntry, Page } from 'symbol-sdk';

import { ProfileCommand } from '../../interfaces/profile.command';
import { ProfileOptions } from '../../interfaces/profile.options';
Expand Down Expand Up @@ -75,18 +75,18 @@ export default class extends ProfileCommand {

this.spinner.start();
const metadataHttp = profile.repositoryFactory.createMetadataRepository();
metadataHttp.getAccountMetadata(address).subscribe(
(metadataEntries) => {
metadataHttp.search({ targetAddress: address }).subscribe(
(metadataEntries: Page<Metadata>) => {
this.spinner.stop();
if (metadataEntries.length > 0) {
metadataEntries.map((entry: Metadata) => {
if (metadataEntries.pageSize > 0) {
metadataEntries.data.map((entry: Metadata) => {
console.log(new MetadataEntryTable(entry.metadataEntry).toString());
});
} else {
console.log(FormatterService.error('The address does not have metadata entries assigned'));
}
},
(err) => {
(err: any) => {
this.spinner.stop();
console.log(FormatterService.error(err));
},
Expand Down
12 changes: 6 additions & 6 deletions src/commands/metadata/mosaic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
*/
import { command, metadata, option } from 'clime';
import { Metadata } from 'symbol-sdk';
import { Metadata, Page } from 'symbol-sdk';

import { ProfileCommand } from '../../interfaces/profile.command';
import { ProfileOptions } from '../../interfaces/profile.options';
Expand Down Expand Up @@ -47,18 +47,18 @@ export default class extends ProfileCommand {

this.spinner.start();
const metadataHttp = profile.repositoryFactory.createMetadataRepository();
metadataHttp.getMosaicMetadata(mosaicId).subscribe(
(metadataEntries) => {
metadataHttp.search({ targetId: mosaicId }).subscribe(
(metadataEntries: Page<Metadata>) => {
this.spinner.stop();
if (metadataEntries.length > 0) {
metadataEntries.map((entry: Metadata) => {
if (metadataEntries.pageSize > 0) {
metadataEntries.data.map((entry: Metadata) => {
console.log(new MetadataEntryTable(entry.metadataEntry).toString());
});
} else {
console.log(FormatterService.error('The mosaic does not have metadata entries assigned'));
}
},
(err) => {
(err: any) => {
this.spinner.stop();
console.log(FormatterService.error(err));
},
Expand Down
12 changes: 6 additions & 6 deletions src/commands/metadata/namespace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
*/
import { command, metadata, option } from 'clime';
import { Metadata } from 'symbol-sdk';
import { Metadata, Page } from 'symbol-sdk';

import { ProfileCommand } from '../../interfaces/profile.command';
import { ProfileOptions } from '../../interfaces/profile.options';
Expand Down Expand Up @@ -47,18 +47,18 @@ export default class extends ProfileCommand {

this.spinner.start();
const metadataHttp = profile.repositoryFactory.createMetadataRepository();
metadataHttp.getNamespaceMetadata(namespaceId).subscribe(
(metadataEntries) => {
metadataHttp.search({ targetId: namespaceId }).subscribe(
(metadataEntries: Page<Metadata>) => {
this.spinner.stop();
if (metadataEntries.length > 0) {
metadataEntries.map((entry: Metadata) => {
if (metadataEntries.pageSize > 0) {
metadataEntries.data.map((entry: Metadata) => {
console.log(new MetadataEntryTable(entry.metadataEntry).toString());
});
} else {
console.log(FormatterService.error('The namespace does not have metadata entries assigned'));
}
},
(err) => {
(err: any) => {
this.spinner.stop();
console.log(FormatterService.error(err));
},
Expand Down
Loading

0 comments on commit 3af0585

Please sign in to comment.