UNPKG

1.16 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const crypto_1 = require("@arkecosystem/crypto");
4const command_1 = require("@oclif/command");
5const utils_1 = require("../utils");
6const command_2 = require("./command");
7class DeserializeCommand extends command_2.BaseCommand {
8 async run() {
9 // tslint:disable-next-line:no-shadowed-variable
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}
15DeserializeCommand.description = "Deserialize the given HEX";
16DeserializeCommand.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 }) });
24exports.DeserializeCommand = DeserializeCommand;
25//# sourceMappingURL=deserialize.js.map
\No newline at end of file