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
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-format",
"version": "0.12.15",
"version": "0.13.0",
"description": "Input/Output formatters for JsonRPC exchange",
"main": "index.js",
"keywords": [
@@ -31,8 +31,8 @@
},
"dependencies": {
"@babel/runtime": "^7.0.0-beta.47",
"@polkadot/jsonrpc": "^0.16.15",
"@polkadot/primitives-json": "^0.16.15",
"@polkadot/jsonrpc": "^0.17.2",
"@polkadot/primitives-json": "^0.17.2",
"@polkadot/util": "^0.22.2",
"@polkadot/util-keyring": "^0.22.2"
}
+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])