You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

xrpl-definitions-base.d.ts 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import { SerializedType } from '../types/serialized-type';
  2. import { Bytes, BytesLookup } from './bytes';
  3. import { FieldInfo, FieldLookup, FieldInstance } from './field';
  4. interface DefinitionsData {
  5. TYPES: Record<string, number>;
  6. LEDGER_ENTRY_TYPES: Record<string, number>;
  7. FIELDS: (string | FieldInfo)[][];
  8. TRANSACTION_RESULTS: Record<string, number>;
  9. TRANSACTION_TYPES: Record<string, number>;
  10. }
  11. /**
  12. * Stores the various types and fields for rippled to be used to encode/decode information later on.
  13. * XrplDefinitions should be instantiated instead of this class.
  14. */
  15. declare class XrplDefinitionsBase {
  16. field: FieldLookup;
  17. ledgerEntryType: BytesLookup;
  18. type: BytesLookup;
  19. transactionResult: BytesLookup;
  20. transactionType: BytesLookup;
  21. transactionNames: string[];
  22. dataTypes: Record<string, typeof SerializedType>;
  23. /**
  24. * Present rippled types in a typed and updatable format.
  25. * For an example of the input format see `definitions.json`
  26. * To generate a new definitions file from rippled source code, use this tool: https://github.com/RichardAH/xrpl-codec-gen
  27. *
  28. * See the definitions.test.js file for examples of how to create your own updated definitions.json.
  29. *
  30. * @param enums - A json encoding of the core types, transaction types, transaction results, transaction names, and fields.
  31. * @param types - A list of type objects with the same name as the fields defined.
  32. * You can use the coreTypes object if you are not adding new types.
  33. */
  34. constructor(enums: DefinitionsData, types: Record<string, typeof SerializedType>);
  35. /**
  36. * Associates each Field to a corresponding class that TypeScript can recognize.
  37. *
  38. * @param types a list of type objects with the same name as the fields defined.
  39. * Defaults to xrpl.js's core type definitions.
  40. */
  41. associateTypes(types: Record<string, typeof SerializedType>): void;
  42. getAssociatedTypes(): Record<string, typeof SerializedType>;
  43. }
  44. export { DefinitionsData, XrplDefinitionsBase, FieldLookup, FieldInfo, FieldInstance, Bytes, BytesLookup, };