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.

ordercancellation.js 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. "use strict";
  2. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  3. if (k2 === undefined) k2 = k;
  4. Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
  5. }) : (function(o, m, k, k2) {
  6. if (k2 === undefined) k2 = k;
  7. o[k2] = m[k];
  8. }));
  9. var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
  10. Object.defineProperty(o, "default", { enumerable: true, value: v });
  11. }) : function(o, v) {
  12. o["default"] = v;
  13. });
  14. var __importStar = (this && this.__importStar) || function (mod) {
  15. if (mod && mod.__esModule) return mod;
  16. var result = {};
  17. if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  18. __setModuleDefault(result, mod);
  19. return result;
  20. };
  21. Object.defineProperty(exports, "__esModule", { value: true });
  22. const utils = __importStar(require("./utils"));
  23. const validate = utils.common.validate;
  24. function createOrderCancellationTransaction(account, orderCancellation) {
  25. const txJSON = {
  26. TransactionType: 'OfferCancel',
  27. Account: account,
  28. OfferSequence: orderCancellation.orderSequence
  29. };
  30. if (orderCancellation.memos != null) {
  31. txJSON.Memos = orderCancellation.memos.map(utils.convertMemo);
  32. }
  33. return txJSON;
  34. }
  35. function prepareOrderCancellation(address, orderCancellation, instructions = {}) {
  36. try {
  37. validate.prepareOrderCancellation({
  38. address,
  39. orderCancellation,
  40. instructions
  41. });
  42. const txJSON = createOrderCancellationTransaction(address, orderCancellation);
  43. return utils.prepareTransaction(txJSON, this, instructions);
  44. }
  45. catch (e) {
  46. return Promise.reject(e);
  47. }
  48. }
  49. exports.default = prepareOrderCancellation;
  50. //# sourceMappingURL=ordercancellation.js.map