Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

binary.d.ts 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import { BinaryParser } from './serdes/binary-parser';
  2. import { AccountID } from './types/account-id';
  3. import { BinarySerializer, BytesList } from './serdes/binary-serializer';
  4. import { sha512Half, transactionID } from './hashes';
  5. import { JsonObject } from './types/serialized-type';
  6. import { Buffer } from 'buffer/';
  7. /**
  8. * Construct a BinaryParser
  9. *
  10. * @param bytes hex-string to construct BinaryParser from
  11. * @returns A BinaryParser
  12. */
  13. declare const makeParser: (bytes: string) => BinaryParser;
  14. /**
  15. * Parse BinaryParser into JSON
  16. *
  17. * @param parser BinaryParser object
  18. * @returns JSON for the bytes in the BinaryParser
  19. */
  20. declare const readJSON: (parser: BinaryParser) => JsonObject;
  21. /**
  22. * Parse a hex-string into its JSON interpretation
  23. *
  24. * @param bytes hex-string to parse into JSON
  25. * @returns JSON
  26. */
  27. declare const binaryToJSON: (bytes: string) => JsonObject;
  28. /**
  29. * Interface for passing parameters to SerializeObject
  30. *
  31. * @field set signingFieldOnly to true if you want to serialize only signing fields
  32. */
  33. interface OptionObject {
  34. prefix?: Buffer;
  35. suffix?: Buffer;
  36. signingFieldsOnly?: boolean;
  37. }
  38. /**
  39. * Function to serialize JSON object representing a transaction
  40. *
  41. * @param object JSON object to serialize
  42. * @param opts options for serializing, including optional prefix, suffix, and signingFieldOnly
  43. * @returns A Buffer containing the serialized object
  44. */
  45. declare function serializeObject(object: JsonObject, opts?: OptionObject): Buffer;
  46. /**
  47. * Serialize an object for signing
  48. *
  49. * @param transaction Transaction to serialize
  50. * @param prefix Prefix bytes to put before the serialized object
  51. * @returns A Buffer with the serialized object
  52. */
  53. declare function signingData(transaction: JsonObject, prefix?: Buffer): Buffer;
  54. /**
  55. * Interface describing fields required for a Claim
  56. */
  57. interface ClaimObject extends JsonObject {
  58. channel: string;
  59. amount: string | number;
  60. }
  61. /**
  62. * Serialize a signingClaim
  63. *
  64. * @param claim A claim object to serialize
  65. * @returns the serialized object with appropriate prefix
  66. */
  67. declare function signingClaimData(claim: ClaimObject): Buffer;
  68. /**
  69. * Serialize a transaction object for multiSigning
  70. *
  71. * @param transaction transaction to serialize
  72. * @param signingAccount Account to sign the transaction with
  73. * @returns serialized transaction with appropriate prefix and suffix
  74. */
  75. declare function multiSigningData(transaction: JsonObject, signingAccount: string | AccountID): Buffer;
  76. export { BinaryParser, BinarySerializer, BytesList, ClaimObject, makeParser, serializeObject, readJSON, multiSigningData, signingData, signingClaimData, binaryToJSON, sha512Half, transactionID, };