"use strict";
// Copyright 2017-2020 @polkadot/metadata authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Metadata_1 = __importDefault(require("../Metadata"));
const fromMetadata_1 = __importDefault(require("./consts/fromMetadata"));
const fromMetadata_2 = __importDefault(require("./extrinsics/fromMetadata"));
const fromMetadata_3 = __importDefault(require("./storage/fromMetadata"));
/**
 * This class represents a decorated wrapper over the [[Metadata]]. The
 * [[Metadata]] type is a Codec type returned by the node, and `Decorated`
 * composes it and populates the `.query`, `.tx` and `.consts` sections.
 */
class Decorated {
    constructor(registry, value) {
        this.registry = registry;
        this.metadata = value instanceof Metadata_1.default ? value : new Metadata_1.default(registry, value);
        // decoration
        this.tx = fromMetadata_2.default(registry, this.metadata);
        this.query = fromMetadata_3.default(registry, this.metadata);
        this.consts = fromMetadata_1.default(registry, this.metadata);
    }
}
exports.default = Decorated;
