1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const crypto_1 = require("../crypto");
|
4 | const managers_1 = require("../managers");
|
5 | const serializer_1 = require("./serializer");
|
6 | const factory_1 = require("./types/factory");
|
7 | class Utils {
|
8 | static toBytes(data) {
|
9 | return serializer_1.Serializer.serialize(factory_1.TransactionTypeFactory.create(data));
|
10 | }
|
11 | static toHash(transaction, options) {
|
12 | return crypto_1.HashAlgorithms.sha256(serializer_1.Serializer.getBytes(transaction, options));
|
13 | }
|
14 | static getId(transaction) {
|
15 | const id = Utils.toHash(transaction).toString("hex");
|
16 |
|
17 |
|
18 | const { transactionIdFixTable } = managers_1.configManager.get("exceptions");
|
19 | if (transactionIdFixTable && transactionIdFixTable[id]) {
|
20 | return transactionIdFixTable[id];
|
21 | }
|
22 | return id;
|
23 | }
|
24 | }
|
25 | exports.Utils = Utils;
|
26 |
|
\ | No newline at end of file |