@plugnet/jsonrpc
Version:
Method definitions for the Plugnet RPC layer
132 lines (126 loc) • 4.77 kB
JavaScript
"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 here is the same as in the Rust code
const call = {
description: 'Perform a call to a builtin on the chain',
params: [(0, _param.default)('method', 'Text'), (0, _param.default)('data', 'Bytes'), (0, _param.default)('block', 'Hash', {
isOptional: true
})],
type: 'Bytes'
};
const KEY_QUERY_PARAMS = [(0, _param.default)('key', 'StorageKey'), (0, _param.default)('block', 'Hash', {
isOptional: true
})];
const getKeys = {
description: 'Retrieves the keys with a certain prefix',
params: KEY_QUERY_PARAMS,
type: 'Vec<StorageKey>'
};
const getStorage = {
description: 'Retrieves the storage for a key',
params: KEY_QUERY_PARAMS,
type: 'StorageData'
};
const getStorageHash = {
description: 'Retrieves the storage hash',
params: KEY_QUERY_PARAMS,
type: 'Hash'
};
const getStorageSize = {
description: 'Retrieves the storage size',
params: KEY_QUERY_PARAMS,
type: 'u64'
};
const CHILD_QUERY_PARAMS = [(0, _param.default)('childStorageKey', 'StorageKey'), (0, _param.default)('key', 'StorageKey'), (0, _param.default)('block', 'Hash', {
isOptional: true
})];
const getChildKeys = {
description: 'Retrieves the keys with prefix of a specific child storage',
params: CHILD_QUERY_PARAMS,
type: 'Vec<StorageKey>'
};
const getChildStorage = {
description: 'Retrieves the child storage for a key',
params: CHILD_QUERY_PARAMS,
type: 'StorageData'
};
const getChildStorageHash = {
description: 'Retrieves the child storage hash',
params: CHILD_QUERY_PARAMS,
type: 'Hash'
};
const getChildStorageSize = {
description: 'Retrieves the child storage size',
params: CHILD_QUERY_PARAMS,
type: 'u64'
};
const getMetadata = {
description: 'Returns the runtime metadata',
params: [(0, _param.default)('block', 'Hash', {
isOptional: true
})],
// This is not part of InterfaceTypes
type: 'Metadata'
};
const getRuntimeVersion = {
description: 'Get the runtime version',
params: [(0, _param.default)('hash', 'Hash', {
isOptional: true
})],
type: 'RuntimeVersion'
};
const queryStorage = {
description: 'Query historical storage entries (by key) starting from a start block',
params: [(0, _param.default)('keys', 'Vec<StorageKey>'), (0, _param.default)('startBlock', 'Hash'), (0, _param.default)('block', 'Hash', {
isOptional: true
})],
type: 'Vec<StorageChangeSet>'
};
const subscribeRuntimeVersion = {
description: 'Retrieves the runtime version via subscription',
params: [],
pubsub: ['runtimeVersion', 'subscribeRuntimeVersion', 'unsubscribeRuntimeVersion'],
type: 'RuntimeVersion'
};
const subscribeStorage = {
description: 'Subscribes to storage changes for the provided keys',
params: [(0, _param.default)('keys', 'Vec<StorageKey>')],
pubsub: ['storage', 'subscribeStorage', 'unsubscribeStorage'],
type: 'StorageChangeSet'
};
const section = 'state';
/**
* @summary Query the state and state storage.
*/
var _default = {
isDeprecated: false,
isHidden: false,
description: 'Query of state',
section,
methods: {
call: (0, _method.default)(section, 'call', call),
getChildKeys: (0, _method.default)(section, 'getChildKeys', getChildKeys),
getChildStorage: (0, _method.default)(section, 'getChildStorage', getChildStorage),
getChildStorageHash: (0, _method.default)(section, 'getChildStorageHash', getChildStorageHash),
getChildStorageSize: (0, _method.default)(section, 'getChildStorageSize', getChildStorageSize),
getKeys: (0, _method.default)(section, 'getKeys', getKeys),
getMetadata: (0, _method.default)(section, 'getMetadata', getMetadata),
getRuntimeVersion: (0, _method.default)(section, 'getRuntimeVersion', getRuntimeVersion),
getStorage: (0, _method.default)(section, 'getStorage', getStorage),
getStorageHash: (0, _method.default)(section, 'getStorageHash', getStorageHash),
getStorageSize: (0, _method.default)(section, 'getStorageSize', getStorageSize),
queryStorage: (0, _method.default)(section, 'queryStorage', queryStorage),
subscribeRuntimeVersion: (0, _method.default)(section, 'subscribeRuntimeVersion', subscribeRuntimeVersion),
subscribeStorage: (0, _method.default)(section, 'subscribeStorage', subscribeStorage)
}
};
exports.default = _default;