diff --git a/lerna.json b/lerna.json index d2a09faff..7fc530bb6 100644 --- a/lerna.json +++ b/lerna.json @@ -10,5 +10,5 @@ "packages": [ "packages/*" ], - "version": "0.20.5" + "version": "0.21.0" } diff --git a/package.json b/package.json index 9764f530a..d53cb23c0 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,6 @@ "test": "jest --coverage" }, "devDependencies": { - "@polkadot/dev": "^0.19.9" + "@polkadot/dev": "^0.19.10" } } diff --git a/packages/util-crypto/package.json b/packages/util-crypto/package.json index 1c80d3e20..ce87275ae 100644 --- a/packages/util-crypto/package.json +++ b/packages/util-crypto/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/util-crypto", - "version": "0.20.5", + "version": "0.21.0", "description": "A collection of useful crypto utilities for @polkadot", "main": "index.js", "keywords": [ @@ -30,7 +30,7 @@ }, "dependencies": { "@babel/runtime": "^7.0.0-beta.47", - "@polkadot/util": "^0.20.5", + "@polkadot/util": "^0.21.0", "blakejs": "^1.1.0", "js-sha3": "^0.7.0", "tweetnacl": "^1.0.0", diff --git a/packages/util-keyring/package.json b/packages/util-keyring/package.json index c051cb73c..a159a1450 100644 --- a/packages/util-keyring/package.json +++ b/packages/util-keyring/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/util-keyring", - "version": "0.20.5", + "version": "0.21.0", "description": "Keyring management", "main": "index.js", "engines": { @@ -32,8 +32,8 @@ }, "dependencies": { "@babel/runtime": "^7.0.0-beta.47", - "@polkadot/util": "^0.20.5", - "@polkadot/util-crypto": "^0.20.5", + "@polkadot/util": "^0.21.0", + "@polkadot/util-crypto": "^0.21.0", "bs58": "^4.0.1" } } diff --git a/packages/util-rlp/package.json b/packages/util-rlp/package.json index 91ae1013b..92e2afa2d 100644 --- a/packages/util-rlp/package.json +++ b/packages/util-rlp/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/util-rlp", - "version": "0.20.5", + "version": "0.21.0", "description": "RLP encoding and decoding", "main": "index.js", "keywords": [ @@ -30,7 +30,7 @@ }, "dependencies": { "@babel/runtime": "^7.0.0-beta.47", - "@polkadot/util": "^0.20.5" + "@polkadot/util": "^0.21.0" }, "devDependencies": { "ethereumjs-testing": "^1.0.4" diff --git a/packages/util-triehash/package.json b/packages/util-triehash/package.json index 0a69fa43d..6eff9f8b0 100644 --- a/packages/util-triehash/package.json +++ b/packages/util-triehash/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/util-triehash", - "version": "0.20.5", + "version": "0.21.0", "description": "Creation of triehash values", "main": "index.js", "keywords": [ @@ -30,8 +30,8 @@ }, "dependencies": { "@babel/runtime": "^7.0.0-beta.47", - "@polkadot/util": "^0.20.5", - "@polkadot/util-crypto": "^0.20.5", - "@polkadot/util-rlp": "^0.20.5" + "@polkadot/util": "^0.21.0", + "@polkadot/util-crypto": "^0.21.0", + "@polkadot/util-rlp": "^0.21.0" } } diff --git a/packages/util/docs/README.md b/packages/util/docs/README.md index 46a8f14ae..3d5171a8f 100644 --- a/packages/util/docs/README.md +++ b/packages/util/docs/README.md @@ -8,7 +8,6 @@ Utility methods for this package are split into groups - [ext](ext.md) Extensions to basic classes - [hex](hex.md) Internal utilities to create and test for hex values - [is](is.md) Type checking utilities -- [jsonrpc](jsonrpc.md) Convenience functions for values from @polkadot/api-jsonrpc - [number](number.md) Utility methods to convert to and from `number` values - [string](string.md) Utility methods to convert to work with `string` values - [u8a](u8a.md) Utility methods to convert to and from `Uint8Array` objects diff --git a/packages/util/docs/jsonrpc.md b/packages/util/docs/jsonrpc.md deleted file mode 100644 index 2ce49ec01..000000000 --- a/packages/util/docs/jsonrpc.md +++ /dev/null @@ -1,42 +0,0 @@ -# jsonrpc - -Convenience functions for values from @polkadot/api-jsonrpc - -- [jsonrpcParam](#jsonrpcparam) Returns a string representation of the parameter name (optional) & type. -- [jsonrpcSignature](#jsonrpcsignature) Returns a string representation of the method with inputs and outputs. - -## jsonrpcParam - -Returns a string representation of the parameter name (optional) & type. - -```js -jsonrpcParam (param: { name?: string, type: string }): string -``` - - -Formats the name and type into a human-readable string. - -```js -import { jsonrpcParam } from '@polkadot/util'; - -console.log(jsonrpcParam({ name: 'dest', type: 'Address' }); // => dest: Address -``` - -## jsonrpcSignature - -Returns a string representation of the method with inputs and outputs. - -```js -jsonrpcSignature (name: string, _inputs: Array, _output: InterfaceOutputType): string -``` - - -Formats the name, inputs and outputs into a human-readable string. This contains the input parameter names, input types and output type. - -```js -import { jsonrpcSignature } from '@polkadot/util'; - -console.log(jsonrpcSignature( -'test_method', [{ name: 'dest', type: 'Address' }], { type: 'Address' } -)); // => test_method (dest: Address): Address -``` \ No newline at end of file diff --git a/packages/util/package.json b/packages/util/package.json index dec14be8d..83c7830ea 100644 --- a/packages/util/package.json +++ b/packages/util/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/util", - "version": "0.20.5", + "version": "0.21.0", "description": "A collection of useful utilities for @polkadot", "main": "index.js", "keywords": [ @@ -28,9 +28,6 @@ "check": "eslint src && flow check", "test": "echo \"Tests only available from root wrapper\"" }, - "devDependencies": { - "@polkadot/api-jsonrpc": "^0.11.2" - }, "dependencies": { "@babel/runtime": "^7.0.0-beta.47", "bn.js": "^4.11.8", diff --git a/packages/util/src/index.js b/packages/util/src/index.js index 660e13665..f03ee3c27 100644 --- a/packages/util/src/index.js +++ b/packages/util/src/index.js @@ -10,7 +10,6 @@ const buffer = require('./buffer'); const ext = require('./ext'); const hex = require('./hex'); const is = require('./is'); -const jsonrpc = require('./jsonrpc'); const logger = require('./logger'); const number = require('./number'); const promisify = require('./promisify'); @@ -21,5 +20,5 @@ const u8a = require('./u8a'); @summary Utility methods for this package are split into groups */ module.exports = Object.assign( - {}, array, { assert }, bn, buffer, ext, hex, is, jsonrpc, { logger }, number, { promisify }, string, u8a + {}, array, { assert }, bn, buffer, ext, hex, is, { logger }, number, { promisify }, string, u8a ); diff --git a/packages/util/src/jsonrpc/index.js b/packages/util/src/jsonrpc/index.js deleted file mode 100644 index 2fc2e6db5..000000000 --- a/packages/util/src/jsonrpc/index.js +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2017-2018 Jaco Greeff -// This software may be modified and distributed under the terms -// of the ISC license. See the LICENSE file for details. -// @flow - -const jsonrpcParam = require('./param'); -const jsonrpcSignature = require('./signature'); - -/** - @summary Convenience functions for values from @polkadot/api-jsonrpc -*/ -module.exports = { - jsonrpcParam, - jsonrpcSignature -}; diff --git a/packages/util/src/jsonrpc/param.js b/packages/util/src/jsonrpc/param.js deleted file mode 100644 index 20a093ab7..000000000 --- a/packages/util/src/jsonrpc/param.js +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2017-2018 Jaco Greeff -// This software may be modified and distributed under the terms -// of the ISC license. See the LICENSE file for details. -// @flow - -import type { InterfaceInputType, InterfaceOutputType } from '@polkadot/api-jsonrpc/types'; - -/** - @name jsonrpcParam - @signature jsonrpcParam (param: { name?: string, type: string }): string - @summary Returns a string representation of the parameter name (optional) & type. - @description - Formats the name and type into a human-readable string. - @example - import { jsonrpcParam } from '@polkadot/util'; - - console.log(jsonrpcParam({ name: 'dest', type: 'Address' }); // => dest: Address -*/ -module.exports = function jsonrpcParam (param: InterfaceInputType | InterfaceOutputType): string { - // flowlint-next-line sketchy-null-mixed:off,sketchy-null-string:off - return param.name - // $FlowFixMe InterfaceInputType found, has name - ? `${param.name}: ${param.type}` - : param.type; -}; diff --git a/packages/util/src/jsonrpc/param.spec.js b/packages/util/src/jsonrpc/param.spec.js deleted file mode 100644 index c745cc70c..000000000 --- a/packages/util/src/jsonrpc/param.spec.js +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2017-2018 Jaco Greeff -// This software may be modified and distributed under the terms -// of the ISC license. See the LICENSE file for details. - -const { jsonrpcParam } = require('./index'); - -describe('jsonrpcParam', () => { - it('formats input parameters (name & type)', () => { - expect( - jsonrpcParam( - { name: 'b', type: 'A' } - ) - ).toEqual('b: A'); - }); - - it('formats output paramaters (type-only)', () => { - expect( - jsonrpcParam( - { type: 'A' } - ) - ).toEqual('A'); - }); -}); diff --git a/packages/util/src/jsonrpc/signature.js b/packages/util/src/jsonrpc/signature.js deleted file mode 100644 index a8b18e993..000000000 --- a/packages/util/src/jsonrpc/signature.js +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2017-2018 Jaco Greeff -// This software may be modified and distributed under the terms -// of the ISC license. See the LICENSE file for details. -// @flow - -import type { InterfaceInputType, InterfaceOutputType } from '@polkadot/api-jsonrpc/types'; - -const formatParam = require('./param'); - -/** - @name jsonrpcSignature - @signature jsonrpcSignature (name: string, _inputs: Array, _output: InterfaceOutputType): string - @summary Returns a string representation of the method with inputs and outputs. - @description - Formats the name, inputs and outputs into a human-readable string. This contains the input parameter names, input types and output type. - @example - import { jsonrpcSignature } from '@polkadot/util'; - - console.log(jsonrpcSignature( - 'test_method', [{ name: 'dest', type: 'Address' }], { type: 'Address' } - )); // => test_method (dest: Address): Address -*/ -module.exports = function jsonrpcSignature (name: string, _inputs: Array, _output: InterfaceOutputType): string { - const inputs = _inputs.map(formatParam).join(', '); - const output = formatParam(_output); - - return `${name} (${inputs}): ${output}`; -}; diff --git a/packages/util/src/jsonrpc/signature.spec.js b/packages/util/src/jsonrpc/signature.spec.js deleted file mode 100644 index 9b80c988f..000000000 --- a/packages/util/src/jsonrpc/signature.spec.js +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2017-2018 Jaco Greeff -// This software may be modified and distributed under the terms -// of the ISC license. See the LICENSE file for details. - -const { jsonrpcSignature } = require('./index'); - -describe('jsonrpcSignature', () => { - it('formats the signature according to the specification', () => { - expect( - jsonrpcSignature( - 'test_method', - [ - { name: 'b', type: 'A' }, - { name: 'a', type: 'B' }, - { type: 'C' }, - { type: 'D' } - ], - { type: 'A' } - ) - ).toEqual('test_method (b: A, a: B, C, D): A'); - }); - - it('empty inputs format correctly', () => { - expect( - jsonrpcSignature( - 'test_method', - [], - { type: 'A' } - ) - ).toEqual('test_method (): A'); - }); -}); diff --git a/yarn.lock b/yarn.lock index 771d2649b..c92de1f72 100644 --- a/yarn.lock +++ b/yarn.lock @@ -664,15 +664,9 @@ lodash "^4.17.5" to-fast-properties "^2.0.0" -"@polkadot/api-jsonrpc@^0.11.2": - version "0.11.2" - resolved "https://registry.yarnpkg.com/@polkadot/api-jsonrpc/-/api-jsonrpc-0.11.2.tgz#f2ddaab686a2da5a63a1a519d76a26d433486927" - dependencies: - "@babel/runtime" "^7.0.0-beta.47" - -"@polkadot/dev@^0.19.9": - version "0.19.9" - resolved "https://registry.yarnpkg.com/@polkadot/dev/-/dev-0.19.9.tgz#cc37c7364e010d96f45132d0069eda32f52e8462" +"@polkadot/dev@^0.19.10": + version "0.19.10" + resolved "https://registry.yarnpkg.com/@polkadot/dev/-/dev-0.19.10.tgz#ccfbfb8632371876456a8e3e89ff26f10b27ba26" dependencies: "@babel/cli" "^7.0.0-beta.47" "@babel/core" "^7.0.0-beta.47"