UNPKG

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