Use @polkadot/dev for common tasks (#6)

* Use @polkadot/dev for common tasks

* Use scripts from @polkadot/dev

* js code hints

* Cleanup scripts
This commit is contained in:
Jaco Greeff
2017-11-21 00:20:22 +01:00
committed by GitHub
parent 8bff3d927d
commit 6f80b51d3c
12 changed files with 2287 additions and 256 deletions
+3 -3
View File
@@ -7,8 +7,8 @@ import type { ApiInterface } from './types';
const { formatInputs, formatOutput } = require('@polkadot/api-format');
const interfaces = require('@polkadot/jsonrpc');
const { callSignature } = require('@polkadot/jsonrpc/util');
const { isFunction } = require('@polkadot/util/is');
const isFunction = require('@polkadot/util/is/function');
const jsonrpcSignature = require('@polkadot/util/jsonrpc/signature');
module.exports = class Api implements ApiInterface {
_provider: ProviderInterface;
@@ -58,7 +58,7 @@ module.exports = class Api implements ApiInterface {
return formatOutput(output, result);
} catch (error) {
throw new Error(`${callSignature(rpcName, inputs, output)}:: ${error.message}`);
throw new Error(`${jsonrpcSignature(rpcName, inputs, output)}:: ${error.message}`);
}
};
+2 -2
View File
@@ -4,7 +4,7 @@
const sinon = require('sinon');
const { isFunction } = require('@polkadot/util/is');
const isFunction = require('@polkadot/util/is/function');
const Api = require('./api');
@@ -86,7 +86,7 @@ describe('Api', () => {
return container
.blah()
.catch((error) => {
expect(error).to.match(/test_blah\(foo: Address\) => Address/);
expect(error).to.match(/test_blah \(foo: Address\): Address/);
});
});
+2
View File
@@ -1,7 +1,9 @@
// ISC, Copyright 2017 Jaco Greeff
// @flow
/*::
export interface ApiInterface {
+chain: any;
+state: any;
}
*/