Expand with all currently known RPC methods
This commit is contained in:
@@ -33,8 +33,8 @@ const getBlockHash: RpcMethodOpt = {
|
||||
type: 'Hash'
|
||||
};
|
||||
|
||||
const getHead: RpcMethodOpt = {
|
||||
description: 'Retrieves the best headerHash',
|
||||
const getFinalisedHead: RpcMethodOpt = {
|
||||
description: 'Get hash of the last finalised block in the canon chain',
|
||||
params: [],
|
||||
type: 'Hash'
|
||||
};
|
||||
@@ -58,6 +58,28 @@ const subscribeNewHead: RpcMethodOpt = {
|
||||
type: 'Header'
|
||||
};
|
||||
|
||||
const subscribeFinalisedHeads: RpcMethodOpt = {
|
||||
description: 'Retrieves the best finalised header via subscription',
|
||||
params: [],
|
||||
pubsub: [
|
||||
'finalisedHead',
|
||||
'subscribeFinalisedHeads',
|
||||
'unsubscribeFinalisedHeads'
|
||||
],
|
||||
type: 'Header'
|
||||
};
|
||||
|
||||
const subscribeRuntimeVersion: RpcMethodOpt = {
|
||||
description: 'Retrieves the runtime version via subscription',
|
||||
params: [],
|
||||
pubsub: [
|
||||
'runtimeVersion',
|
||||
'subscribeRuntimeVersion',
|
||||
'unsubscribeRuntimeVersion'
|
||||
],
|
||||
type: 'RuntimeVersion'
|
||||
};
|
||||
|
||||
const section = 'chain';
|
||||
|
||||
/**
|
||||
@@ -71,9 +93,11 @@ export default {
|
||||
methods: {
|
||||
getBlock: createMethod(section, 'getBlock', getBlock),
|
||||
getBlockHash: createMethod(section, 'getBlockHash', getBlockHash),
|
||||
getHead: createMethod(section, 'getHead', getHead),
|
||||
getFinalisedHead: createMethod(section, 'getFinalisedHead', getFinalisedHead),
|
||||
getHeader: createMethod(section, 'getHeader', getHeader),
|
||||
getRuntimeVersion: createMethod(section, 'getRuntimeVersion', getRuntimeVersion),
|
||||
subscribeFinalisedHeads: createMethod(section, 'subscribeFinalisedHeads', subscribeFinalisedHeads),
|
||||
subscribeRuntimeVersion: createMethod(section, 'subscribeRuntimeVersion', subscribeRuntimeVersion),
|
||||
subscribeNewHead: createMethod(section, 'subscribeNewHead', subscribeNewHead)
|
||||
}
|
||||
} as RpcSection;
|
||||
|
||||
@@ -11,19 +11,10 @@ import createParam from './create/param';
|
||||
|
||||
const call: RpcMethodOpt = {
|
||||
description: 'Perform a call to a builtin on the chain',
|
||||
params: [
|
||||
createParam('method', 'Text'),
|
||||
createParam('data', 'Bytes')
|
||||
],
|
||||
type: 'Bytes'
|
||||
};
|
||||
|
||||
const callAt: RpcMethodOpt = {
|
||||
description: 'Perform a call to a builtin on the chain (At block)',
|
||||
params: [
|
||||
createParam('method', 'Text'),
|
||||
createParam('data', 'Bytes'),
|
||||
createParam('block', 'Hash')
|
||||
createParam('block', 'Hash', { isOptional: true })
|
||||
],
|
||||
type: 'Bytes'
|
||||
};
|
||||
@@ -31,33 +22,17 @@ const callAt: RpcMethodOpt = {
|
||||
const getStorage: RpcMethodOpt = {
|
||||
description: 'Retrieves the storage for a key',
|
||||
params: [
|
||||
createParam('key', 'StorageKey')
|
||||
createParam('key', 'StorageKey'),
|
||||
createParam('block', 'Hash', { isOptional: true })
|
||||
],
|
||||
type: 'StorageData'
|
||||
};
|
||||
|
||||
const getStorageAt: RpcMethodOpt = {
|
||||
description: 'Retrieves the storage for a key at a specific block',
|
||||
params: [
|
||||
createParam('key', 'Bytes'),
|
||||
createParam('block', 'Hash')
|
||||
],
|
||||
type: 'Bytes'
|
||||
};
|
||||
|
||||
const getStorageHash: RpcMethodOpt = {
|
||||
description: 'Retrieves the storage hash',
|
||||
params: [
|
||||
createParam('key', 'Bytes')
|
||||
],
|
||||
type: 'Hash'
|
||||
};
|
||||
|
||||
const getStorageHashAt: RpcMethodOpt = {
|
||||
description: 'Retrieves the storage hash at a specific block',
|
||||
params: [
|
||||
createParam('key', 'Bytes'),
|
||||
createParam('block', 'Hash')
|
||||
createParam('key', 'StorageKey'),
|
||||
createParam('block', 'Hash', { isOptional: true })
|
||||
],
|
||||
type: 'Hash'
|
||||
};
|
||||
@@ -65,16 +40,8 @@ const getStorageHashAt: RpcMethodOpt = {
|
||||
const getStorageSize: RpcMethodOpt = {
|
||||
description: 'Retrieves the storage size',
|
||||
params: [
|
||||
createParam('key', 'Bytes')
|
||||
],
|
||||
type: 'u64'
|
||||
};
|
||||
|
||||
const getStorageSizeAt: RpcMethodOpt = {
|
||||
description: 'Retrieves the storage size at a specific block',
|
||||
params: [
|
||||
createParam('key', 'Bytes'),
|
||||
createParam('block', 'Hash')
|
||||
createParam('key', 'StorageKey'),
|
||||
createParam('block', 'Hash', { isOptional: true })
|
||||
],
|
||||
type: 'u64'
|
||||
};
|
||||
@@ -125,14 +92,10 @@ export default {
|
||||
section,
|
||||
methods: {
|
||||
call: createMethod(section, 'call', call),
|
||||
callAt: createMethod(section, 'callAt', callAt),
|
||||
getMetadata: createMethod(section, 'getMetadata', getMetadata),
|
||||
getStorage: createMethod(section, 'getStorage', getStorage),
|
||||
getStorageAt: createMethod(section, 'getStorageAt', getStorageAt),
|
||||
getStorageHash: createMethod(section, 'getStorageHash', getStorageHash),
|
||||
getStorageHashAt: createMethod(section, 'getStorageHashAt', getStorageHashAt),
|
||||
getStorageSize: createMethod(section, 'getStorageSize', getStorageSize),
|
||||
getStorageSizeAt: createMethod(section, 'getStorageSizeAt', getStorageSizeAt),
|
||||
queryStorage: createMethod(section, 'queryStorage', queryStorage),
|
||||
subscribeStorage: createMethod(section, 'subscribeStorage', subscribeStorage)
|
||||
}
|
||||
|
||||
@@ -26,6 +26,12 @@ const chain: RpcMethodOpt = {
|
||||
type: 'Text'
|
||||
};
|
||||
|
||||
const properties: RpcMethodOpt = {
|
||||
description: 'Get a custom set of properties as a JSON object, defined in the chain spec',
|
||||
params: [],
|
||||
type: 'ChainProperties'
|
||||
};
|
||||
|
||||
const section = 'system';
|
||||
|
||||
/**
|
||||
@@ -39,6 +45,7 @@ export default {
|
||||
methods: {
|
||||
chain: createMethod(section, 'chain', chain),
|
||||
name: createMethod(section, 'name', name),
|
||||
properties: createMethod(section, 'properties', properties),
|
||||
version: createMethod(section, 'version', version)
|
||||
}
|
||||
} as RpcSection;
|
||||
|
||||
Reference in New Issue
Block a user