"use strict";

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

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

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

var _Metadata = require("../v6/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 MetadataV5 to MetadataV6
 * See https://github.com/polkadot-js/api/issues/1043 for details
 */
function toV6(_ref) {
  let {
    modules
  } = _ref;
  return new _v.default({
    modules: modules.map((_ref2) => {
      let {
        calls,
        events,
        name,
        prefix,
        storage
      } = _ref2;
      return new _Metadata.ModuleMetadataV6({
        calls,
        constants: [],
        events,
        name,
        prefix,
        storage
      });
    })
  });
}