ledger-hashes.d.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { Hash256 } from './types/hash-256';
  2. import { JsonObject } from './types/serialized-type';
  3. import * as bigInt from 'big-integer';
  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. */
  10. declare 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. */
  17. declare function accountStateHash(param: Array<JsonObject>): Hash256;
  18. /**
  19. * Interface describing a ledger header
  20. */
  21. interface ledgerObject {
  22. ledger_index: number;
  23. total_coins: string | number | bigInt.BigInteger;
  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. */
  38. declare function ledgerHash(header: ledgerObject): Hash256;
  39. /**
  40. * Decodes a serialized ledger header
  41. *
  42. * @param binary A serialized ledger header
  43. * @returns A JSON object describing a ledger header
  44. */
  45. declare function decodeLedgerData(binary: string): object;
  46. export { accountStateHash, transactionTreeHash, ledgerHash, decodeLedgerData };