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.

paymentChannelCreate.js 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.validatePaymentChannelCreate = void 0;
  4. const errors_1 = require("../../errors");
  5. const common_1 = require("./common");
  6. function validatePaymentChannelCreate(tx) {
  7. (0, common_1.validateBaseTransaction)(tx);
  8. if (tx.Amount === undefined) {
  9. throw new errors_1.ValidationError('PaymentChannelCreate: missing Amount');
  10. }
  11. if (typeof tx.Amount !== 'string') {
  12. throw new errors_1.ValidationError('PaymentChannelCreate: Amount must be a string');
  13. }
  14. if (tx.Destination === undefined) {
  15. throw new errors_1.ValidationError('PaymentChannelCreate: missing Destination');
  16. }
  17. if (typeof tx.Destination !== 'string') {
  18. throw new errors_1.ValidationError('PaymentChannelCreate: Destination must be a string');
  19. }
  20. if (tx.SettleDelay === undefined) {
  21. throw new errors_1.ValidationError('PaymentChannelCreate: missing SettleDelay');
  22. }
  23. if (typeof tx.SettleDelay !== 'number') {
  24. throw new errors_1.ValidationError('PaymentChannelCreate: SettleDelay must be a number');
  25. }
  26. if (tx.PublicKey === undefined) {
  27. throw new errors_1.ValidationError('PaymentChannelCreate: missing PublicKey');
  28. }
  29. if (typeof tx.PublicKey !== 'string') {
  30. throw new errors_1.ValidationError('PaymentChannelCreate: PublicKey must be a string');
  31. }
  32. if (tx.CancelAfter !== undefined && typeof tx.CancelAfter !== 'number') {
  33. throw new errors_1.ValidationError('PaymentChannelCreate: CancelAfter must be a number');
  34. }
  35. if (tx.DestinationTag !== undefined &&
  36. typeof tx.DestinationTag !== 'number') {
  37. throw new errors_1.ValidationError('PaymentChannelCreate: DestinationTag must be a number');
  38. }
  39. }
  40. exports.validatePaymentChannelCreate = validatePaymentChannelCreate;
  41. //# sourceMappingURL=paymentChannelCreate.js.map