author_submitExtrinsic (#61)
* Package updates * Add author_submitExtrinsic * Fix types
This commit is contained in:
@@ -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> {
|
||||
|
||||
@@ -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])]
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user