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.

ticketCreate.js 918B

1234567891011121314151617181920212223
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.validateTicketCreate = void 0;
  4. const errors_1 = require("../../errors");
  5. const common_1 = require("./common");
  6. const MAX_TICKETS = 250;
  7. function validateTicketCreate(tx) {
  8. (0, common_1.validateBaseTransaction)(tx);
  9. const { TicketCount } = tx;
  10. if (TicketCount === undefined) {
  11. throw new errors_1.ValidationError('TicketCreate: missing field TicketCount');
  12. }
  13. if (typeof TicketCount !== 'number') {
  14. throw new errors_1.ValidationError('TicketCreate: TicketCount must be a number');
  15. }
  16. if (!Number.isInteger(TicketCount) ||
  17. TicketCount < 1 ||
  18. TicketCount > MAX_TICKETS) {
  19. throw new errors_1.ValidationError('TicketCreate: TicketCount must be an integer from 1 to 250');
  20. }
  21. }
  22. exports.validateTicketCreate = validateTicketCreate;
  23. //# sourceMappingURL=ticketCreate.js.map