UNPKG

1.58 kBTypeScriptView Raw
1import { Hash256 } from './types/hash-256';
2import { JsonObject } from './types/serialized-type';
3import bigInt = require('big-integer');
4import { XrplDefinitionsBase } from './enums';
5/**
6 * Function computing the hash of a transaction tree
7 *
8 * @param param An array of transaction objects to hash
9 * @returns A Hash256 object
10 */
11declare function transactionTreeHash(param: Array<JsonObject>): Hash256;
12/**
13 * Function computing the hash of accountState
14 *
15 * @param param A list of accountStates hash
16 * @returns A Hash256 object
17 */
18declare function accountStateHash(param: Array<JsonObject>): Hash256;
19/**
20 * Interface describing a ledger header
21 */
22interface ledgerObject {
23 ledger_index: number;
24 total_coins: string | number | bigInt.BigInteger;
25 parent_hash: string;
26 transaction_hash: string;
27 account_hash: string;
28 parent_close_time: number;
29 close_time: number;
30 close_time_resolution: number;
31 close_flags: number;
32}
33/**
34 * Serialize and hash a ledger header
35 *
36 * @param header a ledger header
37 * @returns the hash of header
38 */
39declare function ledgerHash(header: ledgerObject): Hash256;
40/**
41 * Decodes a serialized ledger header
42 *
43 * @param binary A serialized ledger header
44 * @param definitions Type definitions to parse the ledger objects.
45 * Used if there are non-default ledger objects to decode.
46 * @returns A JSON object describing a ledger header
47 */
48declare function decodeLedgerData(binary: string, definitions?: XrplDefinitionsBase): object;
49export { accountStateHash, transactionTreeHash, ledgerHash, decodeLedgerData };