Update from new @polkadot/params (#95)

This commit is contained in:
Jaco Greeff
2018-05-29 12:26:19 +02:00
committed by GitHub
parent 7873a6dc0c
commit c68bf8a689
15 changed files with 94 additions and 109 deletions
+2 -2
View File
@@ -3,7 +3,7 @@
// of the ISC license. See the LICENSE file for details.
// @flow
import type { Params, Param$Types } from '@polkadot/params/types';
import type { Params } from '@polkadot/params/types';
const addressDecode = require('@polkadot/util-keyring/address/decode');
const bytesEncode = require('@polkadot/primitives-json/bytes/encode');
@@ -20,7 +20,7 @@ const formatters = {
// flowlint-next-line unclear-type:off
module.exports = function formatInputs (params: Params, values: Array<any>): Array<any> {
const types: Array<Param$Types> = Object.keys(params).map((name) => params[name].type);
const types = params.map(({ type }) => type);
return format(formatters, types, values);
};
+4 -4
View File
@@ -8,10 +8,10 @@ describe('formatInputs', () => {
it('formats each value in an array', () => {
expect(
formatInputs(
{
foo: { type: 'Bytes' },
bar: { type: 'Hash' }
},
[
{ name: 'foo', type: 'Bytes' },
{ name: 'bar', type: 'Hash' }
],
[
new Uint8Array([0x12, 0x34]),
new Uint8Array([0xab, 0xcd])