"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = toV8;

var _v = _interopRequireDefault(require("../v8"));

var _Metadata = require("../v8/Metadata");

// Copyright 2017-2019 @polkadot/types authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.

/**
 * Convert from MetadataV7 to MetadataV8
 */
function toV8(_ref) {
  let {
    modules
  } = _ref;
  return new _v.default({
    modules: modules.map((_ref2) => {
      let {
        calls,
        constants,
        events,
        name,
        storage
      } = _ref2;
      return new _Metadata.ModuleMetadataV8({
        calls,
        constants,
        errors: [],
        events,
        name,
        storage
      });
    })
  });
}