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:
+3
-3
@@ -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
@@ -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/);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
// ISC, Copyright 2017 Jaco Greeff
|
||||
// @flow
|
||||
|
||||
/*::
|
||||
export interface ApiInterface {
|
||||
+chain: any;
|
||||
+state: any;
|
||||
}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user