"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 codec_1 = require("../../../../types/codec");
const createFunction_1 = __importDefault(require("./createFunction"));
// Small helper function to factorize code on this page.
/** @internal */
function createRuntimeFunction(method, key, { documentation, type }) {
    return (registry, metaVersion) => createFunction_1.default(registry, {
        meta: {
            documentation: codec_1.createType(registry, 'Vec<Text>', [documentation]),
            modifier: codec_1.createType(registry, 'StorageEntryModifierLatest', 1),
            type: codec_1.createType(registry, 'StorageEntryTypeLatest', type, 0),
            toJSON: () => key
        },
        method,
        prefix: 'Substrate',
        section: 'substrate'
    }, { key, metaVersion, skipHashing: true });
}
exports.code = createRuntimeFunction('code', ':code', {
    documentation: 'Wasm code of the runtime.',
    type: 'Bytes'
});
exports.heapPages = createRuntimeFunction('heapPages', ':heappages', {
    documentation: 'Number of wasm linear memory pages required for execution of the runtime.',
    type: 'u64'
});
exports.extrinsicIndex = createRuntimeFunction('extrinsicIndex', ':extrinsic_index', {
    documentation: 'Current extrinsic index (u32) is stored under this key.',
    type: 'u32'
});
exports.changesTrieConfig = createRuntimeFunction('changesTrieConfig', ':changes_trie', {
    documentation: 'Changes trie configuration is stored under this key.',
    type: 'u32'
});
exports.childStorageKeyPrefix = createRuntimeFunction('childStorageKeyPrefix', ':child_storage:', {
    documentation: 'Prefix of child storage keys.',
    type: 'u32'
});
