'use strict';

var BLAKE2b = require('blake2b');
require('../generic/typed-enum.cjs');
var types_generic_typedBytes = require('../generic/typed-bytes.cjs');
require('../generic/typed-string.cjs');
require('../generic/typed-array.cjs');
require('../generic/typed-tuple.cjs');
require('../generic/typed-null.cjs');
require('../../utils/types/array.cjs');
var utils_types_bytes = require('../../utils/types/bytes.cjs');
require('bs58');
require('multiformats/bases/base58');
require('varint');
require('../../utils/encoding/ss-58.cjs');
var types_generic_sized = require('../generic/sized.cjs');
require('../generic/typed-number.cjs');
require('../generic/typed-set.cjs');
require('../generic/typed-map.cjs');
require('../generic/typed-struct.cjs');
require('uuid');
require('js-sha256');
require('../../utils/types/iterable.cjs');
require('../../utils/types/object.cjs');
require('crypto');
require('../../utils/interfaces.cjs');
require('../../utils/assert.cjs');
require('../../utils/error.cjs');
require('../../utils/inheritance.cjs');
require('../../utils/types/set.cjs');
require('../generic/with-base.cjs');
require('../generic/with-catch-null.cjs');
require('../generic/with-eq.cjs');
require('../generic/any-of.cjs');
require('../generic/with-from.cjs');
require('../../utils/types/string.cjs');
require('../generic/with-from-json-bytes.cjs');
require('../generic/create-placeholder.cjs');
require('../../utils/types/number.cjs');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var BLAKE2b__default = /*#__PURE__*/_interopDefault(BLAKE2b);

class AnchorHash extends types_generic_sized(types_generic_typedBytes) {
  static Size = 32;
}

class Anchor extends types_generic_typedBytes {
  /**
   * Returns new anchor produced by hashing given data using Blake2b.
   * @param anchor
   * @returns {AnchorHash}
   */
  static hash(bytes) {
    const hash = BLAKE2b__default.default(32);
    hash.update(utils_types_bytes.normalizeToU8a(bytes));

    return new AnchorHash(hash.digest());
  }
}

exports.Anchor = Anchor;
exports.AnchorHash = AnchorHash;
//# sourceMappingURL=index.cjs.map
