"use strict";
// Copyright 2017-2020 @polkadot/rpc-core authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
Object.defineProperty(exports, "__esModule", { value: true });
const types_1 = require("../types/types");
const types_2 = require("../types");
const codec_1 = require("../types/codec");
function formatData(registry, data, { info, type }) {
    if (info === types_1.TypeDefInfo.Option) {
        return new types_2.Option(registry, types_2.createClass(registry, type), codec_1.createTypeUnsafe(registry, type, [data], true));
    }
    return codec_1.createTypeUnsafe(registry, type, [data], true);
}
exports.formatData = formatData;
