"use strict";
/**
 * @module validators
 */
exports.__esModule = true;
var errors = require("../../errors");
exports.errors = errors;
/* Address related guards & validators */
var checksum_1 = require("@iota/checksum");
/**
 * This method takes an address with a checksum and validates that the checksum is correct.
 *
 * ## Related methods
 *
 * To generate a new address with a checksum, use the [`getNewAddress()`]{@link #module_core.getNewAddress} method.
 *
 * @method isAddress
 *
 * @summary Validates the checksum of the given address.
 *
 * @memberof module:validators
 *
 * @param {string} address - Address with a checksum
 *
 * @example
 * ```js
 * let valid = Validator.isAddress('9FNJWLMBECSQDKHQAGDHDPXBMZFMQIMAFAUIQTDECJVGKJBKHLEBVU9TWCTPRJGYORFDSYENIQKBVSYKW9NSLGS9UW');
 * ```
 *
 * @return {boolean} valid - Whether the checksum is valid
 *
 */
exports.isAddress = function (address) {
    var isValid = false;
    try {
        isValid = checksum_1.isValidChecksum(address);
    }
    catch (err) {
        return false;
    }
    return isValid;
};
exports.addressValidator = function (address) { return [address, exports.isAddress]; };
/* Misc */
var guards_1 = require("../../guards");
exports.arrayValidator = guards_1.arrayValidator;
exports.depthValidator = guards_1.depthValidator;
exports.hashValidator = guards_1.hashValidator;
exports.inputValidator = guards_1.inputValidator;
exports.isHash = guards_1.isHash;
exports.isInput = guards_1.isInput;
exports.isNinesTrytes = guards_1.isNinesTrytes;
exports.isEmpty = guards_1.isEmpty;
exports.isSecurityLevel = guards_1.isSecurityLevel;
exports.isStartEndOptions = guards_1.isStartEndOptions;
exports.isTag = guards_1.isTag;
exports.isTransfer = guards_1.isTransfer;
exports.isTrytes = guards_1.isTrytes;
exports.isTrytesOfExactLength = guards_1.isTrytesOfExactLength;
exports.isTrytesOfMaxLength = guards_1.isTrytesOfMaxLength;
exports.isUri = guards_1.isUri;
exports.minWeightMagnitudeValidator = guards_1.minWeightMagnitudeValidator;
exports.securityLevelValidator = guards_1.securityLevelValidator;
exports.seedValidator = guards_1.seedValidator;
exports.tagValidator = guards_1.tagValidator;
exports.transferValidator = guards_1.transferValidator;
exports.trytesValidator = guards_1.trytesValidator;
exports.uriValidator = guards_1.uriValidator;
exports.validate = guards_1.validate;
var guards_2 = require("../../guards");
exports.isAddressArray = guards_2.isArray(exports.isAddress);
exports.isHashArray = guards_2.isArray(guards_2.isHash);
exports.isInputArray = guards_2.isArray(guards_2.isInput);
exports.isTagArray = guards_2.isArray(guards_2.isTag);
exports.isTransferArray = guards_2.isArray(guards_2.isTransfer);
exports.isTransfersArray = exports.isTransferArray;
exports.isTrytesArray = guards_2.isArray(function (x) { return guards_2.isTrytes(x); });
exports.isUriArray = guards_2.isArray(guards_2.isUri);
/* Transaction guards & validators */
var transaction_1 = require("@iota/transaction");
exports.isAttached = transaction_1.isAttached;
exports.isTail = transaction_1.isTail;
exports.isHead = transaction_1.isHead;
exports.isTransaction = transaction_1.isTransaction;
//# sourceMappingURL=index.js.map