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.

paymentChannelClaim.js 1.7KB

123456789101112131415161718192021222324252627282930313233
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.validatePaymentChannelClaim = exports.PaymentChannelClaimFlags = void 0;
  4. const errors_1 = require("../../errors");
  5. const common_1 = require("./common");
  6. var PaymentChannelClaimFlags;
  7. (function (PaymentChannelClaimFlags) {
  8. PaymentChannelClaimFlags[PaymentChannelClaimFlags["tfRenew"] = 65536] = "tfRenew";
  9. PaymentChannelClaimFlags[PaymentChannelClaimFlags["tfClose"] = 131072] = "tfClose";
  10. })(PaymentChannelClaimFlags = exports.PaymentChannelClaimFlags || (exports.PaymentChannelClaimFlags = {}));
  11. function validatePaymentChannelClaim(tx) {
  12. (0, common_1.validateBaseTransaction)(tx);
  13. if (tx.Channel === undefined) {
  14. throw new errors_1.ValidationError('PaymentChannelClaim: missing Channel');
  15. }
  16. if (typeof tx.Channel !== 'string') {
  17. throw new errors_1.ValidationError('PaymentChannelClaim: Channel must be a string');
  18. }
  19. if (tx.Balance !== undefined && typeof tx.Balance !== 'string') {
  20. throw new errors_1.ValidationError('PaymentChannelClaim: Balance must be a string');
  21. }
  22. if (tx.Amount !== undefined && typeof tx.Amount !== 'string') {
  23. throw new errors_1.ValidationError('PaymentChannelClaim: Amount must be a string');
  24. }
  25. if (tx.Signature !== undefined && typeof tx.Signature !== 'string') {
  26. throw new errors_1.ValidationError('PaymentChannelClaim: Signature must be a string');
  27. }
  28. if (tx.PublicKey !== undefined && typeof tx.PublicKey !== 'string') {
  29. throw new errors_1.ValidationError('PaymentChannelClaim: PublicKey must be a string');
  30. }
  31. }
  32. exports.validatePaymentChannelClaim = validatePaymentChannelClaim;
  33. //# sourceMappingURL=paymentChannelClaim.js.map