import BLAKE2b from 'blake2b';
import '../generic/typed-enum.js';
import TypedBytes from '../generic/typed-bytes.js';
import '../generic/typed-string.js';
import '../generic/typed-array.js';
import '../generic/typed-tuple.js';
import '../generic/typed-null.js';
import '../../utils/types/array.js';
import { normalizeToU8a } from '../../utils/types/bytes.js';
import 'bs58';
import 'multiformats/bases/base58';
import 'varint';
import '../../utils/encoding/ss-58.js';
import sized from '../generic/sized.js';
import '../generic/typed-number.js';
import '../generic/typed-set.js';
import '../generic/typed-map.js';
import '../generic/typed-struct.js';
import 'uuid';
import 'js-sha256';
import '../../utils/types/iterable.js';
import '../../utils/types/object.js';
import 'crypto';
import '../../utils/interfaces.js';
import '../../utils/assert.js';
import '../../utils/error.js';
import '../../utils/inheritance.js';
import '../../utils/types/set.js';
import '../generic/with-base.js';
import '../generic/with-catch-null.js';
import '../generic/with-eq.js';
import '../generic/any-of.js';
import '../generic/with-from.js';
import '../../utils/types/string.js';
import '../generic/with-from-json-bytes.js';
import '../generic/create-placeholder.js';
import '../../utils/types/number.js';

class AnchorHash extends sized(TypedBytes) {
  static Size = 32;
}

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

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

export { Anchor, AnchorHash };
//# sourceMappingURL=index.js.map
