@ledgerhq/coin-ton
Version:
20 lines • 784 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateMemo = void 0;
const constants_1 = require("../constants");
/**
* Validates a TON transaction comment (memo).
*
* Note: While this function is named `validateMemo` for consistency across
* coin modules, TON uses a "comment" instead.
* The validation checks multiple fields, not only text value.
*
* @param comment - TON comment object containing text and encryption flag
* @returns true if the comment is valid, false otherwise
*/
function validateMemo(comment) {
return (comment.isEncrypted ||
(comment.text.length <= constants_1.MAX_COMMENT_BYTES && /^[\x20-\x7F]*$/.test(comment.text)));
}
exports.validateMemo = validateMemo;
//# sourceMappingURL=validateMemo.js.map