1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const crypto_1 = require("@arkecosystem/crypto");
|
4 | const command_1 = require("@oclif/command");
|
5 | const utils_1 = require("../utils");
|
6 | const command_2 = require("./command");
|
7 | class DeserializeCommand extends command_2.BaseCommand {
|
8 | async run() {
|
9 |
|
10 | const { flags } = this.parse(DeserializeCommand);
|
11 | const deserialized = flags.type === "transaction" ? new crypto_1.models.Transaction(flags.data) : new crypto_1.models.Block(flags.data);
|
12 | return utils_1.handleOutput(flags, JSON.stringify(deserialized, null, 4));
|
13 | }
|
14 | }
|
15 | DeserializeCommand.description = "Deserialize the given HEX";
|
16 | DeserializeCommand.flags = Object.assign({}, command_2.BaseCommand.flags, { data: command_1.flags.string({
|
17 | description: "the HEX blob to deserialize",
|
18 | required: true,
|
19 | default: "transaction",
|
20 | }), type: command_1.flags.string({
|
21 | description: "transaction or block",
|
22 | required: true,
|
23 | }) });
|
24 | exports.DeserializeCommand = DeserializeCommand;
|
25 |
|
\ | No newline at end of file |