"use strict";

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

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.childStorageKeyPrefix = exports.changesTrieConfig = exports.extrinsicIndex = exports.heapPages = exports.code = exports.authorityPrefix = exports.authorityCount = void 0;

var _Storage = require("@polkadot/types/Metadata/v8/Storage");

var _codec = require("@polkadot/types/codec");

var _createFunction = _interopRequireDefault(require("./createFunction"));

// Copyright 2017-2019 @polkadot/api-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.
// Small helper function to factorize code on this page.
const createRuntimeFunction = (method, key, _ref) => {
  let {
    documentation,
    type
  } = _ref;
  return (0, _createFunction.default)({
    meta: {
      documentation: (0, _codec.createType)('Vec<Text>', [documentation]),
      modifier: (0, _codec.createType)('StorageEntryModifierLatest', 1),
      // required
      type: new _Storage.StorageEntryType(type, 0),
      toJSON: () => key
    },
    method,
    prefix: 'Substrate',
    section: 'substrate'
  }, {
    key,
    skipHashing: true
  });
}; // @deprecated: The ':auth:' (authorityPrefix) and ':auth:len' (authorityCount) storage keys
// have been removed in https://github.com/paritytech/substrate/pull/2802


const authorityCount = createRuntimeFunction('authorityCount', ':auth:len', {
  documentation: 'Number of authorities.',
  type: 'u32'
});
exports.authorityCount = authorityCount;
const authorityPrefix = createRuntimeFunction('authorityPrefix', ':auth:', {
  documentation: 'Prefix under which authorities are stored.',
  type: 'u32'
});
exports.authorityPrefix = authorityPrefix;
const code = createRuntimeFunction('code', ':code', {
  documentation: 'Wasm code of the runtime.',
  type: 'Bytes'
});
exports.code = code;
const heapPages = createRuntimeFunction('heapPages', ':heappages', {
  documentation: 'Number of wasm linear memory pages required for execution of the runtime.',
  type: 'u64'
});
exports.heapPages = heapPages;
const extrinsicIndex = createRuntimeFunction('extrinsicIndex', ':extrinsic_index', {
  documentation: 'Current extrinsic index (u32) is stored under this key.',
  type: 'u32'
});
exports.extrinsicIndex = extrinsicIndex;
const changesTrieConfig = createRuntimeFunction('changesTrieConfig', ':changes_trie', {
  documentation: 'Changes trie configuration is stored under this key.',
  type: 'u32'
});
exports.changesTrieConfig = changesTrieConfig;
const childStorageKeyPrefix = createRuntimeFunction('childStorageKeyPrefix', ':child_storage:', {
  documentation: 'Prefix of child storage keys.',
  type: 'u32'
});
exports.childStorageKeyPrefix = childStorageKeyPrefix;