diff --git a/tools/parity_scale_decoder/README.md b/tools/parity_scale_decoder/README.md index a1e2d2cfeb2..a8390a6ef67 100644 --- a/tools/parity_scale_decoder/README.md +++ b/tools/parity_scale_decoder/README.md @@ -1,72 +1,86 @@ # Parity Scale Decoder Tool -## Description +This tool helps you decode **Iroha 2** data types from binaries using [Parity Scale Codec](https://github.com/paritytech/parity-scale-codec). -This tool will help you to decode **Iroha 2** types from binaries using [Parity Scale Codec](https://github.com/paritytech/parity-scale-codec) +## Build -## Usage - -Building: +To build the tool, run: ```bash cargo build --bin parity_scale_decoder ``` -If your terminal does not support colors: +If your terminal does not support colours, run: ```bash cargo build --features no-color --bin parity_scale_decoder ``` -From the main project directory: +## Usage -* List all supported types: +Run Parity Scale Decoder Tool: - ```bash - ./target/debug/parity_scale_decoder list-type - ``` +```bash +parity_scale_decoder +``` -* Decode type from binary: +### Subcommands - ```bash - ./target/debug/parity_scale_decoder decode --type - ``` +| Command | Description | +| ------------------------- | --------------------------------------------------- | +| [`list-type`](#list-type) | List all available data types | +| [`decode`](#decode) | Decode the data type from binary | +| `help` | Print the help message for the tool or a subcommand | - As an example you can use provided samples: +## `list-type` - ```bash - ./target/debug/parity_scale_decoder decode tools/parity_scale_decoder/samples/account.bin --type Account - ``` +To list all supported data types, run from the project main directory: -* Decode any type from binary: +```bash +./target/debug/parity_scale_decoder list-type +``` - If you are not sure about type you can simply omit `--type` option: - - ```bash - ./target/debug/parity_scale_decoder decode - ``` +
Expand to see possible outputs + +``` +No type is supported +1 type is supported +3 types are supported +``` + +
+ +## `decode` + +Decode the data type from a given binary. + +| Option | Description | Type | +| ---------- | ----------------------------------------------------------------------------------------------------------------------------- | ---------------------- | +| `--binary` | The path to the binary file with an encoded Iroha structure for the tool to decode. | An owned, mutable path | +| `--type` | The data type that is expected to be encoded in the provided binary.
If not specified, the tool tries to guess the type. | String | -* To see all available options run: +* Decode the specified data type from a binary: ```bash - ./target/debug/parity_scale_decoder --help + ./target/debug/parity_scale_decoder decode --type ``` -## Contributing +* If you are not sure which data type is encoded in the binary, run the tool without the `--type` option: + + ```bash + ./target/debug/parity_scale_decoder decode + ``` -Check out [this document](https://github.com/hyperledger/iroha/blob/iroha2-dev/CONTRIBUTING.md) +### `decode` usage examples -## [Need help?](https://github.com/hyperledger/iroha/blob/iroha2-dev/CONTRIBUTING.md#contact) +* Decode the `Account` data type from the `samples/account.bin` binary: -## License + ```bash + ./target/debug/parity_scale_decoder decode tools/parity_scale_decoder/samples/account.bin --type Account + ``` -Iroha codebase is 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 +* Decode the `Domain` data type from the `samples/domain.bin` binary: -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. + ```bash + ./target/debug/parity_scale_decoder decode tools/parity_scale_decoder/samples/domain.bin --type Domain + ```