Update from new @polkadot/params (#95)
This commit is contained in:
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
@@ -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])
|
||||
|
||||
Reference in New Issue
Block a user