"use strict";

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

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

var _method = _interopRequireDefault(require("./create/method"));

var _param = _interopRequireDefault(require("./create/param"));

// Copyright 2017-2019 @polkadot/jsonrpc authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// NOTE Order is the same as in Rust
const getHeader = {
  description: 'Retrieves the header for a specific block',
  params: [(0, _param.default)('hash', 'Hash', {
    isOptional: true
  })],
  type: 'Header'
};
const getBlock = {
  description: 'Get header and body of a relay chain block',
  params: [(0, _param.default)('hash', 'Hash', {
    isOptional: true
  })],
  type: 'SignedBlock'
};
const getBlockHash = {
  description: 'Get the block hash for a specific block',
  params: [(0, _param.default)('blockNumber', 'BlockNumber', {
    isOptional: true
  })],
  type: 'Hash'
};
const getFinalizedHead = {
  description: 'Get hash of the last finalized block in the canon chain',
  params: [],
  type: 'Hash'
};
const subscribeNewHeads = {
  description: 'Retrieves the best header via subscription',
  params: [],
  // NOTE These still has the aliassed version, compatible with 1.x
  pubsub: ['newHead', 'subscribeNewHead', 'unsubscribeNewHead'],
  type: 'Header'
};
const subscribeFinalizedHeads = {
  description: 'Retrieves the best finalized header via subscription',
  params: [],
  pubsub: ['finalizedHead', 'subscribeFinalizedHeads', 'unsubscribeFinalizedHeads'],
  type: 'Header'
};
const section = 'chain';
/**
 * @summary Calls to retrieve chain data.
 */

var _default = {
  isDeprecated: false,
  isHidden: false,
  description: 'Retrieval of chain data',
  section,
  methods: {
    getBlock: (0, _method.default)(section, 'getBlock', getBlock),
    getBlockHash: (0, _method.default)(section, 'getBlockHash', getBlockHash),
    getFinalizedHead: (0, _method.default)(section, 'getFinalizedHead', getFinalizedHead),
    getHeader: (0, _method.default)(section, 'getHeader', getHeader),
    subscribeFinalizedHeads: (0, _method.default)(section, 'subscribeFinalizedHeads', subscribeFinalizedHeads),
    subscribeNewHeads: (0, _method.default)(section, 'subscribeNewHeads', subscribeNewHeads)
  }
};
exports.default = _default;