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.

checkCreate.js 1.4KB

123456789101112131415161718192021222324252627282930313233
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.validateCheckCreate = void 0;
  4. const errors_1 = require("../../errors");
  5. const common_1 = require("./common");
  6. function validateCheckCreate(tx) {
  7. (0, common_1.validateBaseTransaction)(tx);
  8. if (tx.SendMax === undefined) {
  9. throw new errors_1.ValidationError('CheckCreate: missing field SendMax');
  10. }
  11. if (tx.Destination === undefined) {
  12. throw new errors_1.ValidationError('CheckCreate: missing field Destination');
  13. }
  14. if (typeof tx.SendMax !== 'string' &&
  15. !(0, common_1.isIssuedCurrency)(tx.SendMax)) {
  16. throw new errors_1.ValidationError('CheckCreate: invalid SendMax');
  17. }
  18. if (typeof tx.Destination !== 'string') {
  19. throw new errors_1.ValidationError('CheckCreate: invalid Destination');
  20. }
  21. if (tx.DestinationTag !== undefined &&
  22. typeof tx.DestinationTag !== 'number') {
  23. throw new errors_1.ValidationError('CheckCreate: invalid DestinationTag');
  24. }
  25. if (tx.Expiration !== undefined && typeof tx.Expiration !== 'number') {
  26. throw new errors_1.ValidationError('CheckCreate: invalid Expiration');
  27. }
  28. if (tx.InvoiceID !== undefined && typeof tx.InvoiceID !== 'string') {
  29. throw new errors_1.ValidationError('CheckCreate: invalid InvoiceID');
  30. }
  31. }
  32. exports.validateCheckCreate = validateCheckCreate;
  33. //# sourceMappingURL=checkCreate.js.map