index.d.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import { SerializedType } from '../types/serialized-type';
  2. import { Buffer } from 'buffer/';
  3. import { BytesList } from '../binary';
  4. export declare const TRANSACTION_TYPES: string[];
  5. export declare class Bytes {
  6. readonly name: string;
  7. readonly ordinal: number;
  8. readonly ordinalWidth: number;
  9. readonly bytes: Buffer;
  10. constructor(name: string, ordinal: number, ordinalWidth: number);
  11. toJSON(): string;
  12. toBytesSink(sink: BytesList): void;
  13. toBytes(): Uint8Array;
  14. }
  15. declare class BytesLookup {
  16. readonly ordinalWidth: number;
  17. constructor(types: Record<string, number>, ordinalWidth: number);
  18. from(value: Bytes | string): Bytes;
  19. fromParser(parser: any): Bytes;
  20. }
  21. interface FieldInfo {
  22. nth: number;
  23. isVLEncoded: boolean;
  24. isSerialized: boolean;
  25. isSigningField: boolean;
  26. type: string;
  27. }
  28. interface FieldInstance {
  29. readonly nth: number;
  30. readonly isVariableLengthEncoded: boolean;
  31. readonly isSerialized: boolean;
  32. readonly isSigningField: boolean;
  33. readonly type: Bytes;
  34. readonly ordinal: number;
  35. readonly name: string;
  36. readonly header: Buffer;
  37. readonly associatedType: typeof SerializedType;
  38. }
  39. declare class FieldLookup {
  40. constructor(fields: Array<[string, FieldInfo]>);
  41. fromString(value: string): FieldInstance;
  42. }
  43. declare const Type: BytesLookup;
  44. declare const LedgerEntryType: BytesLookup;
  45. declare const TransactionType: BytesLookup;
  46. declare const TransactionResult: BytesLookup;
  47. declare const Field: FieldLookup;
  48. export { Field, FieldInstance, Type, LedgerEntryType, TransactionResult, TransactionType, };