Add api.extra.* (test) methods (#55)

This commit is contained in:
Jaco Greeff
2018-03-15 16:33:21 +01:00
committed by GitHub
parent 56ec979655
commit 74f14160bd
10 changed files with 101 additions and 29 deletions
@@ -0,0 +1,18 @@
// Copyright 2017-2018 Jaco Greeff
// This software may be modified and distributed under the terms
// of the ISC license. See the LICENSE file for details.
// @flow
import type { InterfaceMethodDefinition } from '../types';
/**
@name getBlockNumber
@signature extra_getBlockNumber (): BlockNumber
@summary Retrieves the best blockNumber
@description
Returns the best blockNumber available on the client
*/
module.exports = ({
inputs: [],
output: { type: 'BlockNumber' }
}: InterfaceMethodDefinition);
@@ -0,0 +1,18 @@
// Copyright 2017-2018 Jaco Greeff
// This software may be modified and distributed under the terms
// of the ISC license. See the LICENSE file for details.
// @flow
import type { InterfaceMethodDefinition } from '../types';
/**
@name getClientTime
@signature extra_getClientTime (): U64
@summary Retrieves the current time
@description
Returns the current time on the running node
*/
module.exports = ({
inputs: [],
output: { type: 'U64' }
}: InterfaceMethodDefinition);
+19
View File
@@ -0,0 +1,19 @@
// Copyright 2017-2018 Jaco Greeff
// This software may be modified and distributed under the terms
// of the ISC license. See the LICENSE file for details.
// @flow
import type { InterfaceDefinition } from '../types';
const getBlockNumber = require('./getBlockNumber');
const getClientTime = require('./getClientTime');
/**
@summary Extended methods not available in all clients.
*/
module.exports = ({
methods: {
getBlockNumber,
getClientTime
}
}: InterfaceDefinition);
+2
View File
@@ -6,6 +6,7 @@
import type { InterfaceDefinitions } from './types';
const chain = require('./chain');
const extra = require('./extra');
const state = require('./state');
/**
@@ -13,5 +14,6 @@ const state = require('./state');
*/
module.exports = ({
chain,
extra,
state
}: InterfaceDefinitions);
+2 -2
View File
@@ -5,7 +5,7 @@
export type FormatInputType = 'Address' | 'CallData' | 'H256' | 'HeaderHash' | 'String';
export type FormatOutputType = 'Header' | 'OutData' | 'StorageData';
export type FormatOutputType = 'BlockNumber' | 'Header' | 'OutData' | 'StorageData' | 'U64';
export type InterfaceInputType = {
name: string,
@@ -22,7 +22,7 @@ export type InterfaceMethodDefinition = {
output: InterfaceOutputType
};
export type InterfaceTypes = 'chain' | 'state';
export type InterfaceTypes = 'chain' | 'extra' | 'state';
export type InterfaceDefinition$Methods = {
[string]: InterfaceMethodDefinition