UNPKG

1.26 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.HashPrefix = void 0;
4const utils_1 = require("./utils");
5/**
6 * Write a 32 bit integer to a Uint8Array
7 *
8 * @param uint32 32 bit integer to write to Uint8Array
9 * @returns a Uint8Array with the bytes representation of uint32
10 */
11function bytes(uint32) {
12 const result = new Uint8Array(4);
13 (0, utils_1.writeUInt32BE)(result, uint32, 0);
14 return result;
15}
16/**
17 * Maps HashPrefix names to their byte representation
18 */
19const HashPrefix = {
20 transactionID: bytes(0x54584e00),
21 // transaction plus metadata
22 transaction: bytes(0x534e4400),
23 // account state
24 accountStateEntry: bytes(0x4d4c4e00),
25 // inner node in tree
26 innerNode: bytes(0x4d494e00),
27 // ledger master data for signing
28 ledgerHeader: bytes(0x4c575200),
29 // inner transaction to sign
30 transactionSig: bytes(0x53545800),
31 // inner transaction to sign
32 transactionMultiSig: bytes(0x534d5400),
33 // validation for signing
34 validation: bytes(0x56414c00),
35 // proposal for signing
36 proposal: bytes(0x50525000),
37 // payment channel claim
38 paymentChannelClaim: bytes(0x434c4d00),
39};
40exports.HashPrefix = HashPrefix;
41//# sourceMappingURL=hash-prefixes.js.map
\No newline at end of file