index.d.ts 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import { decodeLedgerData } from './ledger-hashes';
  2. import { JsonObject } from './types/serialized-type';
  3. /**
  4. * Decode a transaction
  5. *
  6. * @param binary hex-string of the encoded transaction
  7. * @returns the JSON representation of the transaction
  8. */
  9. declare function decode(binary: string): JsonObject;
  10. /**
  11. * Encode a transaction
  12. *
  13. * @param json The JSON representation of a transaction
  14. * @returns A hex-string of the encoded transaction
  15. */
  16. declare function encode(json: object): string;
  17. /**
  18. * Encode a transaction and prepare for signing
  19. *
  20. * @param json JSON object representing the transaction
  21. * @param signer string representing the account to sign the transaction with
  22. * @returns a hex string of the encoded transaction
  23. */
  24. declare function encodeForSigning(json: object): string;
  25. /**
  26. * Encode a transaction and prepare for signing with a claim
  27. *
  28. * @param json JSON object representing the transaction
  29. * @param signer string representing the account to sign the transaction with
  30. * @returns a hex string of the encoded transaction
  31. */
  32. declare function encodeForSigningClaim(json: object): string;
  33. /**
  34. * Encode a transaction and prepare for multi-signing
  35. *
  36. * @param json JSON object representing the transaction
  37. * @param signer string representing the account to sign the transaction with
  38. * @returns a hex string of the encoded transaction
  39. */
  40. declare function encodeForMultisigning(json: object, signer: string): string;
  41. /**
  42. * Encode a quality value
  43. *
  44. * @param value string representation of a number
  45. * @returns a hex-string representing the quality
  46. */
  47. declare function encodeQuality(value: string): string;
  48. /**
  49. * Decode a quality value
  50. *
  51. * @param value hex-string of a quality
  52. * @returns a string representing the quality
  53. */
  54. declare function decodeQuality(value: string): string;
  55. declare const _default: {
  56. decode: typeof decode;
  57. encode: typeof encode;
  58. encodeForSigning: typeof encodeForSigning;
  59. encodeForSigningClaim: typeof encodeForSigningClaim;
  60. encodeForMultisigning: typeof encodeForMultisigning;
  61. encodeQuality: typeof encodeQuality;
  62. decodeQuality: typeof decodeQuality;
  63. decodeLedgerData: typeof decodeLedgerData;
  64. TRANSACTION_TYPES: string[];
  65. };
  66. export = _default;