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.

createCrossChainPayment.js 898B

12345678910111213141516171819
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. const errors_1 = require("../errors");
  4. const stringConversion_1 = require("./stringConversion");
  5. function createCrossChainPayment(payment, destAccount) {
  6. var _a;
  7. const destAccountHex = (0, stringConversion_1.convertStringToHex)(destAccount);
  8. const destAccountMemo = { Memo: { MemoData: destAccountHex } };
  9. const memos = (_a = payment.Memos) !== null && _a !== void 0 ? _a : [];
  10. if (memos.length > 2) {
  11. throw new errors_1.XrplError('Cannot have more than 2 memos in a cross-chain transaction.');
  12. }
  13. const newMemos = [destAccountMemo, ...memos];
  14. const newPayment = Object.assign(Object.assign({}, payment), { Memos: newMemos });
  15. delete newPayment.TxnSignature;
  16. return newPayment;
  17. }
  18. exports.default = createCrossChainPayment;
  19. //# sourceMappingURL=createCrossChainPayment.js.map