Upgrade dependencies (#23)
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||

|
||||
[](https://www.npmjs.com/package/@polkadot/api)
|
||||
[](https://travis-ci.org/polkadot-js/api)
|
||||
[](https://codeclimate.com/github/polkadot-js/api/maintainability)
|
||||
[](https://coveralls.io/github/polkadot-js/api?branch=master)
|
||||
[](https://greenkeeper.io/)
|
||||
|
||||
# @polkadot/client
|
||||
|
||||
This library provides a clean wrapper around all the methods exposed by a Polkadot network client.
|
||||
This library provides a clean wrapper around all the methods exposed by a Polkadot network client. As part of the JsonRpc defintions, the [exposed methods are documented][packages/api-jsonrpc/docs/].
|
||||
|
||||
It is split up into a number of internal packages -
|
||||
The API is split up into a number of internal packages -
|
||||
|
||||
- [@polkadot/api](packages/api/) The API library
|
||||
- [@polkadot/api-format](packages/api-format/) Input and output formatters
|
||||
|
||||
+2
-19
@@ -1,22 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/api-wrapper",
|
||||
"version": "0.5.5",
|
||||
"description": "Non-published, see packages/",
|
||||
"keywords": [],
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"license": "ISC",
|
||||
"private": true,
|
||||
"engines": {
|
||||
"node": ">=8.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/polkadot-js/api.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/polkadot-js/api/issues"
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/api#readme",
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
],
|
||||
@@ -26,8 +10,7 @@
|
||||
"test": "jest --coverage packages"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/dev": "^0.9.9",
|
||||
"@polkadot/dev": "^0.10.1",
|
||||
"lerna": "^2.5.1"
|
||||
},
|
||||
"dependencies": {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
"@polkadot/api-jsonrpc": "^0.5.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@polkadot/util": "^0.5.19",
|
||||
"@polkadot/util": "^0.6.1",
|
||||
"babel-runtime": "^6.26.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,11 +8,8 @@ const formatNoop = require('./noop');
|
||||
|
||||
const arrayTypeRegex = /\[\]$/;
|
||||
|
||||
function format (formatters: { [any]: FormatterFunction }, type: string, value: any): any {
|
||||
const isArrayType: boolean = arrayTypeRegex.test(type);
|
||||
const formatter: FormatterFunction = isArrayType
|
||||
? formatters[type.replace(arrayTypeRegex, '')]
|
||||
: formatters[type];
|
||||
function formatSingleType (formatters: { [any]: FormatterFunction }, type: string, value: any): any {
|
||||
const formatter: FormatterFunction = formatters[type];
|
||||
|
||||
if (isUndefined(formatter)) {
|
||||
console.warn(`Unable to find default formatter for '${type}', falling back to noop`);
|
||||
@@ -20,19 +17,31 @@ function format (formatters: { [any]: FormatterFunction }, type: string, value:
|
||||
return formatNoop(value);
|
||||
}
|
||||
|
||||
if (isArrayType && !Array.isArray(value)) {
|
||||
try {
|
||||
return formatter(value);
|
||||
} catch (error) {
|
||||
throw new Error(`Error formatting '${value}' as '${type}': ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
function formatArrayType (formatters: { [any]: FormatterFunction }, type: string, value: any): any {
|
||||
if (!Array.isArray(value)) {
|
||||
throw new Error(`Unable to format non-array '${value}' as '${type}'`);
|
||||
}
|
||||
|
||||
try {
|
||||
if (isArrayType) {
|
||||
return (value: Array<any>).map((value) => formatter(value));
|
||||
} else {
|
||||
return formatter(value);
|
||||
}
|
||||
} catch (error) {
|
||||
throw new Error(`Error formatting '${value}' as '${type}'': ${error.message}`);
|
||||
type = type.replace(arrayTypeRegex, '');
|
||||
|
||||
return (value: Array<any>).map((value) => {
|
||||
return formatSingleType(formatters, type, value);
|
||||
});
|
||||
}
|
||||
|
||||
function format (formatters: { [any]: FormatterFunction }, type: string, value: any): any {
|
||||
if (arrayTypeRegex.test(type)) {
|
||||
return formatArrayType(formatters, type, value);
|
||||
}
|
||||
|
||||
return formatSingleType(formatters, type, value);
|
||||
}
|
||||
|
||||
function formatArray (formatters: { [any]: FormatterFunction }, types: Array<string>, values: Array<any>): Array<any> {
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
"nock": "^9.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@polkadot/util": "^0.5.19",
|
||||
"@polkadot/util": "^0.6.1",
|
||||
"babel-runtime": "^6.26.0",
|
||||
"isomorphic-fetch": "^2.2.1"
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
"@polkadot/api-format": "^0.5.5",
|
||||
"@polkadot/api-jsonrpc": "^0.5.5",
|
||||
"@polkadot/api-provider": "^0.5.5",
|
||||
"@polkadot/util": "^0.5.19",
|
||||
"@polkadot/util": "^0.6.1",
|
||||
"babel-runtime": "^6.26.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,9 +54,9 @@
|
||||
lodash "^4.2.0"
|
||||
to-fast-properties "^2.0.0"
|
||||
|
||||
"@polkadot/dev@^0.9.9":
|
||||
version "0.9.9"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/dev/-/dev-0.9.9.tgz#b302ba6728a5068c7bffe069fd64290c227d317c"
|
||||
"@polkadot/dev@^0.10.1":
|
||||
version "0.10.1"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/dev/-/dev-0.10.1.tgz#4c57180413320f0194c340177725f8b8c0ecbffa"
|
||||
dependencies:
|
||||
babel-cli "^6.26.0"
|
||||
babel-core "^6.26.0"
|
||||
@@ -73,6 +73,7 @@
|
||||
eslint "^4.11.0"
|
||||
eslint-config-semistandard "^11.0.0"
|
||||
eslint-config-standard "^10.2.1"
|
||||
eslint-config-standard-jsx "^4.0.2"
|
||||
eslint-config-standard-react "^5.0.0"
|
||||
eslint-plugin-flowtype "^2.39.1"
|
||||
eslint-plugin-import "^2.8.0"
|
||||
@@ -89,9 +90,9 @@
|
||||
stylelint "^8.2.0"
|
||||
stylelint-config-standard "^18.0.0"
|
||||
|
||||
"@polkadot/util@^0.5.19":
|
||||
version "0.5.19"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-0.5.19.tgz#e34d917f3fd52b98c6a7633e534f26d182e7cb6f"
|
||||
"@polkadot/util@^0.6.1":
|
||||
version "0.6.1"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-0.6.1.tgz#d08fca12cbef5559f27bb0f51f72e71a3f11c824"
|
||||
dependencies:
|
||||
babel-runtime "^6.26.0"
|
||||
bn.js "^4.11.8"
|
||||
@@ -1882,7 +1883,7 @@ eslint-config-semistandard@^11.0.0:
|
||||
version "11.0.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint-config-semistandard/-/eslint-config-semistandard-11.0.0.tgz#44eef7cfdfd47219e3a7b81b91b540e880bb2615"
|
||||
|
||||
eslint-config-standard-jsx@^4.0.0:
|
||||
eslint-config-standard-jsx@^4.0.0, eslint-config-standard-jsx@^4.0.2:
|
||||
version "4.0.2"
|
||||
resolved "https://registry.yarnpkg.com/eslint-config-standard-jsx/-/eslint-config-standard-jsx-4.0.2.tgz#009e53c4ddb1e9ee70b4650ffe63a7f39f8836e1"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user