author_submitExtrinsic (#61)

* Package updates

* Add author_submitExtrinsic

* Fix types
This commit is contained in:
Jaco Greeff
2018-04-11 14:23:16 +02:00
committed by GitHub
parent 6bcffb1232
commit 17cbec7d81
17 changed files with 95 additions and 54 deletions
+4 -8
View File
@@ -4,20 +4,16 @@
// @flow
import type { InterfaceInputType } from '@polkadot/api-jsonrpc/types';
import type { Hash } from '@polkadot/primitives/base';
const accountIdEncode = require('@polkadot/primitives-json/accountId/encode');
const bytesEncode = require('@polkadot/primitives-json/bytes/encode');
const hashEncode = require('@polkadot/primitives-json/hash/encode');
const echo = require('./echo');
const util = require('./util');
const formatters = {
'Address': accountIdEncode,
'CallData': hashEncode,
'H256': (value: Hash) => hashEncode(value, 256),
'HeaderHash': hashEncode,
'String': echo
'Bytes': bytesEncode,
'H256': hashEncode,
'HeaderHash': hashEncode
};
module.exports = function formatInputs (inputs: Array<InterfaceInputType>, values: Array<mixed>): Array<mixed> {
+1 -1
View File
@@ -9,7 +9,7 @@ describe('formatInputs', () => {
expect(
formatInputs(
[
{ name: 'foo', type: 'Address' },
{ name: 'foo', type: 'Bytes' },
{ name: 'bar', type: 'H256' }
],
[new Uint8Array([0x12, 0x34]), new Uint8Array([0xab, 0xcd])]
+2 -3
View File
@@ -6,16 +6,15 @@
import type { InterfaceOutputType } from '@polkadot/api-jsonrpc/types';
const bnDecode = require('@polkadot/primitives-json/bn/decode');
const bytesDecode = require('@polkadot/primitives-json/bytes/decode');
const headerDecode = require('@polkadot/primitives-json/header/decode');
const echo = require('./echo');
const util = require('./util');
const formatters = {
'BlockNumber': bnDecode,
'Bytes': bytesDecode,
'Header': headerDecode,
'OutData': echo,
'StorageData': echo,
'U64': bnDecode
};