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.

checkCash.js 1.2KB

123456789101112131415161718192021222324252627
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.validateCheckCash = void 0;
  4. const errors_1 = require("../../errors");
  5. const common_1 = require("./common");
  6. function validateCheckCash(tx) {
  7. (0, common_1.validateBaseTransaction)(tx);
  8. if (tx.Amount == null && tx.DeliverMin == null) {
  9. throw new errors_1.ValidationError('CheckCash: must have either Amount or DeliverMin');
  10. }
  11. if (tx.Amount != null && tx.DeliverMin != null) {
  12. throw new errors_1.ValidationError('CheckCash: cannot have both Amount and DeliverMin');
  13. }
  14. if (tx.Amount != null && tx.Amount !== undefined && !(0, common_1.isAmount)(tx.Amount)) {
  15. throw new errors_1.ValidationError('CheckCash: invalid Amount');
  16. }
  17. if (tx.DeliverMin != null &&
  18. tx.DeliverMin !== undefined &&
  19. !(0, common_1.isAmount)(tx.DeliverMin)) {
  20. throw new errors_1.ValidationError('CheckCash: invalid DeliverMin');
  21. }
  22. if (tx.CheckID !== undefined && typeof tx.CheckID !== 'string') {
  23. throw new errors_1.ValidationError('CheckCash: invalid CheckID');
  24. }
  25. }
  26. exports.validateCheckCash = validateCheckCash;
  27. //# sourceMappingURL=checkCash.js.map