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.

trustSet.js 1.5KB

12345678910111213141516171819202122232425262728293031
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.validateTrustSet = exports.TrustSetFlags = void 0;
  4. const errors_1 = require("../../errors");
  5. const common_1 = require("./common");
  6. var TrustSetFlags;
  7. (function (TrustSetFlags) {
  8. TrustSetFlags[TrustSetFlags["tfSetfAuth"] = 65536] = "tfSetfAuth";
  9. TrustSetFlags[TrustSetFlags["tfSetNoRipple"] = 131072] = "tfSetNoRipple";
  10. TrustSetFlags[TrustSetFlags["tfClearNoRipple"] = 262144] = "tfClearNoRipple";
  11. TrustSetFlags[TrustSetFlags["tfSetFreeze"] = 1048576] = "tfSetFreeze";
  12. TrustSetFlags[TrustSetFlags["tfClearFreeze"] = 2097152] = "tfClearFreeze";
  13. })(TrustSetFlags = exports.TrustSetFlags || (exports.TrustSetFlags = {}));
  14. function validateTrustSet(tx) {
  15. (0, common_1.validateBaseTransaction)(tx);
  16. const { LimitAmount, QualityIn, QualityOut } = tx;
  17. if (LimitAmount === undefined) {
  18. throw new errors_1.ValidationError('TrustSet: missing field LimitAmount');
  19. }
  20. if (!(0, common_1.isAmount)(LimitAmount)) {
  21. throw new errors_1.ValidationError('TrustSet: invalid LimitAmount');
  22. }
  23. if (QualityIn !== undefined && typeof QualityIn !== 'number') {
  24. throw new errors_1.ValidationError('TrustSet: QualityIn must be a number');
  25. }
  26. if (QualityOut !== undefined && typeof QualityOut !== 'number') {
  27. throw new errors_1.ValidationError('TrustSet: QualityOut must be a number');
  28. }
  29. }
  30. exports.validateTrustSet = validateTrustSet;
  31. //# sourceMappingURL=trustSet.js.map