From c4a8aa2dd7ea5de524528aa01dcffad526da8c82 Mon Sep 17 00:00:00 2001 From: Jaco Date: Sun, 15 Aug 2021 11:38:48 +0300 Subject: [PATCH] 7.2.1 (#1085) * 7.2.1 * Update CHANGELOG.md * u8aEmpty --- CHANGELOG.md | 5 +- package.json | 2 +- packages/hw-ledger-transports/package.json | 2 +- packages/hw-ledger/package.json | 6 +-- packages/keyring/package.json | 10 ++-- packages/networks/package.json | 6 +-- packages/util-crypto/package.json | 10 ++-- packages/util/package.json | 6 +-- packages/util/src/is/u8a.spec.ts | 2 +- packages/util/src/u8a/empty.spec.ts | 24 +++++++++ packages/util/src/u8a/empty.ts | 12 +++++ packages/util/src/u8a/index.ts | 1 + packages/x-bundle/package.json | 4 +- packages/x-fetch/package.json | 4 +- packages/x-global/package.json | 2 +- packages/x-randomvalues/package.json | 4 +- packages/x-textdecoder/package.json | 4 +- packages/x-textencoder/package.json | 4 +- packages/x-ws/package.json | 4 +- yarn.lock | 58 +++++++++++----------- 20 files changed, 104 insertions(+), 66 deletions(-) create mode 100644 packages/util/src/u8a/empty.spec.ts create mode 100644 packages/util/src/u8a/empty.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index d61477c31..dc938142e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # CHANGELOG -## master +## 7.2.1 Aug 15, 2021 Contributed: @@ -8,7 +8,8 @@ Contributed: Changes: -- Cleanup additional circular dependency detected by rollup +- Added `u8aEmpty` helper check, all 0 or no length +- Cleanup additional circular dependencies detected by rollup ## 7.1.2 Aug 11, 2021 diff --git a/package.json b/package.json index 5950c129a..f344a1a48 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,6 @@ "@types/ed2curve": "^0.2.2", "@types/jest": "^26.0.24" }, - "version": "7.1.3-4", + "version": "7.2.0", "packageManager": "yarn@3.0.1" } diff --git a/packages/hw-ledger-transports/package.json b/packages/hw-ledger-transports/package.json index 4a1c374dd..9035c0cd8 100644 --- a/packages/hw-ledger-transports/package.json +++ b/packages/hw-ledger-transports/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/hw-ledger-transports", - "version": "7.1.3-4", + "version": "7.2.0", "type": "module", "repository": "github:polkadot-js/common", "author": "Jaco Greeff ", diff --git a/packages/hw-ledger/package.json b/packages/hw-ledger/package.json index 97003b281..a3eec8689 100644 --- a/packages/hw-ledger/package.json +++ b/packages/hw-ledger/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/hw-ledger", - "version": "7.1.3-4", + "version": "7.2.0", "type": "module", "repository": "github:polkadot-js/common", "author": "Jaco Greeff ", @@ -17,8 +17,8 @@ }, "dependencies": { "@babel/runtime": "^7.15.3", - "@polkadot/hw-ledger-transports": "7.1.3-4", - "@polkadot/util": "7.1.3-4", + "@polkadot/hw-ledger-transports": "7.2.0", + "@polkadot/util": "7.2.0", "@zondax/ledger-substrate": "^0.17.3" } } diff --git a/packages/keyring/package.json b/packages/keyring/package.json index 40dcead07..3ed7ec39d 100644 --- a/packages/keyring/package.json +++ b/packages/keyring/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/keyring", - "version": "7.1.3-4", + "version": "7.2.0", "type": "module", "description": "Keyring management", "author": "Jaco Greeff ", @@ -20,11 +20,11 @@ "homepage": "https://github.com/polkadot-js/common/tree/master/packages/keyring#readme", "dependencies": { "@babel/runtime": "^7.15.3", - "@polkadot/util": "7.1.3-4", - "@polkadot/util-crypto": "7.1.3-4" + "@polkadot/util": "7.2.0", + "@polkadot/util-crypto": "7.2.0" }, "peerDependencies": { - "@polkadot/util": "7.1.3-4", - "@polkadot/util-crypto": "7.1.3-4" + "@polkadot/util": "7.2.0", + "@polkadot/util-crypto": "7.2.0" } } diff --git a/packages/networks/package.json b/packages/networks/package.json index 372dcd71b..ae39b339a 100644 --- a/packages/networks/package.json +++ b/packages/networks/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/networks", - "version": "7.1.3-4", + "version": "7.2.0", "type": "module", "description": "A list of all available Substrate networks and their applicable prefixes", "main": "index.js", @@ -19,7 +19,7 @@ "@babel/runtime": "^7.15.3" }, "devDependencies": { - "@polkadot/util": "7.1.3-4", - "@polkadot/x-fetch": "7.1.3-4" + "@polkadot/util": "7.2.0", + "@polkadot/x-fetch": "7.2.0" } } diff --git a/packages/util-crypto/package.json b/packages/util-crypto/package.json index 2e94b9f22..fa8929aae 100644 --- a/packages/util-crypto/package.json +++ b/packages/util-crypto/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/util-crypto", - "version": "7.1.3-4", + "version": "7.2.0", "type": "module", "description": "A collection of useful crypto utilities for @polkadot", "main": "index.js", @@ -22,10 +22,10 @@ "homepage": "https://github.com/polkadot-js/common/tree/master/packages/util-crypto#readme", "dependencies": { "@babel/runtime": "^7.15.3", - "@polkadot/networks": "7.1.3-4", - "@polkadot/util": "7.1.3-4", + "@polkadot/networks": "7.2.0", + "@polkadot/util": "7.2.0", "@polkadot/wasm-crypto": "^4.1.2", - "@polkadot/x-randomvalues": "7.1.3-4", + "@polkadot/x-randomvalues": "7.2.0", "base-x": "^3.0.8", "base64-js": "^1.5.1", "blakejs": "^1.1.1", @@ -47,6 +47,6 @@ "@types/xxhashjs": "^0.2.2" }, "peerDependencies": { - "@polkadot/util": "7.1.3-4" + "@polkadot/util": "7.2.0" } } diff --git a/packages/util/package.json b/packages/util/package.json index 7920e22b8..0913a4b15 100644 --- a/packages/util/package.json +++ b/packages/util/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/util", - "version": "7.1.3-4", + "version": "7.2.0", "type": "module", "description": "A collection of useful utilities for @polkadot", "main": "index.js", @@ -20,8 +20,8 @@ "homepage": "https://github.com/polkadot-js/common/tree/master/packages/util#readme", "dependencies": { "@babel/runtime": "^7.15.3", - "@polkadot/x-textdecoder": "7.1.3-4", - "@polkadot/x-textencoder": "7.1.3-4", + "@polkadot/x-textdecoder": "7.2.0", + "@polkadot/x-textencoder": "7.2.0", "@types/bn.js": "^4.11.6", "bn.js": "^4.11.9", "camelcase": "^5.3.1", diff --git a/packages/util/src/is/u8a.spec.ts b/packages/util/src/is/u8a.spec.ts index 09f2cd599..46ce60d73 100644 --- a/packages/util/src/is/u8a.spec.ts +++ b/packages/util/src/is/u8a.spec.ts @@ -3,7 +3,7 @@ import { isU8a } from '.'; -describe('isUint8Array', (): void => { +describe('isU8a', (): void => { it('returns false on undefined values', (): void => { expect( isU8a() diff --git a/packages/util/src/u8a/empty.spec.ts b/packages/util/src/u8a/empty.spec.ts new file mode 100644 index 000000000..10ef48623 --- /dev/null +++ b/packages/util/src/u8a/empty.spec.ts @@ -0,0 +1,24 @@ +// Copyright 2017-2021 @polkadot/util authors & contributors +// SPDX-License-Identifier: Apache-2.0 + +import { u8aEmpty } from '.'; + +describe('u8aEmpty', (): void => { + it('returns true on zero length', (): void => { + expect( + u8aEmpty(new Uint8Array()) + ).toEqual(true); + }); + + it('returns true on all zero values', (): void => { + expect( + u8aEmpty(new Uint8Array([0, 0, 0, 0, 0, 0])) + ).toEqual(true); + }); + + it('returns false when value is found', (): void => { + expect( + u8aEmpty(new Uint8Array([0, 0, 0, 0, 0, 1])) + ).toEqual(false); + }); +}); diff --git a/packages/util/src/u8a/empty.ts b/packages/util/src/u8a/empty.ts new file mode 100644 index 000000000..37d94bb73 --- /dev/null +++ b/packages/util/src/u8a/empty.ts @@ -0,0 +1,12 @@ +// Copyright 2017-2021 @polkadot/util authors & contributors +// SPDX-License-Identifier: Apache-2.0 + +/** + * @name u8aEmpty + * @summary Tests for a `Uint8Array` for emptyness + * @description + * Checks to see if the input `Uint8Array` has zero length or contains all 0 values. + */ +export function u8aEmpty (value: Uint8Array): boolean { + return value.length === 0 || value.every((v) => !v); +} diff --git a/packages/util/src/u8a/index.ts b/packages/util/src/u8a/index.ts index 4f815a7e9..35a672fa7 100644 --- a/packages/util/src/u8a/index.ts +++ b/packages/util/src/u8a/index.ts @@ -7,6 +7,7 @@ export { u8aCmp } from './cmp'; export { u8aConcat } from './concat'; +export { u8aEmpty } from './empty'; export { u8aEq } from './eq'; export { u8aFixLength } from './fixLength'; export { u8aSorted } from './sorted'; diff --git a/packages/x-bundle/package.json b/packages/x-bundle/package.json index 4d6ab1712..018d15a2a 100644 --- a/packages/x-bundle/package.json +++ b/packages/x-bundle/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/x-bundle", - "version": "7.1.3-4", + "version": "7.2.0", "type": "module", "description": "A bundler helper", "main": "index.js", @@ -17,7 +17,7 @@ "homepage": "https://github.com/polkadot-js/common/tree/master/packages/x-bundle#readme", "dependencies": { "@babel/runtime": "^7.15.3", - "@polkadot/util": "7.1.3-4", + "@polkadot/util": "7.2.0", "buffer-es6": "^4.9.3" } } diff --git a/packages/x-fetch/package.json b/packages/x-fetch/package.json index a2edd7e39..9c4ada67f 100644 --- a/packages/x-fetch/package.json +++ b/packages/x-fetch/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/x-fetch", - "version": "7.1.3-4", + "version": "7.2.0", "type": "module", "description": "A cross-environment fetch replacement", "browser": "browser.js", @@ -19,7 +19,7 @@ "homepage": "https://github.com/polkadot-js/common/tree/master/packages/x-fetch#readme", "dependencies": { "@babel/runtime": "^7.15.3", - "@polkadot/x-global": "7.1.3-4", + "@polkadot/x-global": "7.2.0", "@types/node-fetch": "^2.5.12", "node-fetch": "^2.6.1" } diff --git a/packages/x-global/package.json b/packages/x-global/package.json index 3ad1b5c94..0e94bd86f 100644 --- a/packages/x-global/package.json +++ b/packages/x-global/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/x-global", - "version": "7.1.3-4", + "version": "7.2.0", "type": "module", "description": "A cross-environment global replacement", "main": "index.js", diff --git a/packages/x-randomvalues/package.json b/packages/x-randomvalues/package.json index 5e705706b..2e1df7038 100644 --- a/packages/x-randomvalues/package.json +++ b/packages/x-randomvalues/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/x-randomvalues", - "version": "7.1.3-4", + "version": "7.2.0", "type": "module", "description": "A cross-environment window.crypto.getRandomValues replacement", "browser": "browser.js", @@ -19,7 +19,7 @@ "homepage": "https://github.com/polkadot-js/common/tree/master/packages/x-randomvalues#readme", "dependencies": { "@babel/runtime": "^7.15.3", - "@polkadot/x-global": "7.1.3-4" + "@polkadot/x-global": "7.2.0" }, "devDependencies": { "@types/react-native": "^0.64.13" diff --git a/packages/x-textdecoder/package.json b/packages/x-textdecoder/package.json index 0d2227a34..ca8ef8b06 100644 --- a/packages/x-textdecoder/package.json +++ b/packages/x-textdecoder/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/x-textdecoder", - "version": "7.1.3-4", + "version": "7.2.0", "type": "module", "description": "A TextDecoder replacement", "browser": "browser.js", @@ -19,6 +19,6 @@ "homepage": "https://github.com/polkadot-js/common/tree/master/packages/x-textdecoder#readme", "dependencies": { "@babel/runtime": "^7.15.3", - "@polkadot/x-global": "7.1.3-4" + "@polkadot/x-global": "7.2.0" } } diff --git a/packages/x-textencoder/package.json b/packages/x-textencoder/package.json index 87a23238f..5cda25764 100644 --- a/packages/x-textencoder/package.json +++ b/packages/x-textencoder/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/x-textencoder", - "version": "7.1.3-4", + "version": "7.2.0", "type": "module", "description": "A TextDecoder replacement", "browser": "browser.js", @@ -19,6 +19,6 @@ "homepage": "https://github.com/polkadot-js/common/tree/master/packages/x-textencoder#readme", "dependencies": { "@babel/runtime": "^7.15.3", - "@polkadot/x-global": "7.1.3-4" + "@polkadot/x-global": "7.2.0" } } diff --git a/packages/x-ws/package.json b/packages/x-ws/package.json index e2af75e57..f52d57739 100644 --- a/packages/x-ws/package.json +++ b/packages/x-ws/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/x-ws", - "version": "7.1.3-4", + "version": "7.2.0", "type": "module", "description": "A cross-environment WebSocket replacement", "browser": "browser.js", @@ -19,7 +19,7 @@ "homepage": "https://github.com/polkadot-js/common/tree/master/packages/x-ws#readme", "dependencies": { "@babel/runtime": "^7.15.3", - "@polkadot/x-global": "7.1.3-4", + "@polkadot/x-global": "7.2.0", "@types/websocket": "^1.0.4", "websocket": "^1.0.34" } diff --git a/yarn.lock b/yarn.lock index 5fa1654be..15f9f4fb1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2045,7 +2045,7 @@ __metadata: languageName: node linkType: hard -"@polkadot/hw-ledger-transports@7.1.3-4, @polkadot/hw-ledger-transports@workspace:packages/hw-ledger-transports": +"@polkadot/hw-ledger-transports@7.2.0, @polkadot/hw-ledger-transports@workspace:packages/hw-ledger-transports": version: 0.0.0-use.local resolution: "@polkadot/hw-ledger-transports@workspace:packages/hw-ledger-transports" dependencies: @@ -2065,8 +2065,8 @@ __metadata: resolution: "@polkadot/hw-ledger@workspace:packages/hw-ledger" dependencies: "@babel/runtime": ^7.15.3 - "@polkadot/hw-ledger-transports": 7.1.3-4 - "@polkadot/util": 7.1.3-4 + "@polkadot/hw-ledger-transports": 7.2.0 + "@polkadot/util": 7.2.0 "@zondax/ledger-substrate": ^0.17.3 languageName: unknown linkType: soft @@ -2076,21 +2076,21 @@ __metadata: resolution: "@polkadot/keyring@workspace:packages/keyring" dependencies: "@babel/runtime": ^7.15.3 - "@polkadot/util": 7.1.3-4 - "@polkadot/util-crypto": 7.1.3-4 + "@polkadot/util": 7.2.0 + "@polkadot/util-crypto": 7.2.0 peerDependencies: - "@polkadot/util": 7.1.3-4 - "@polkadot/util-crypto": 7.1.3-4 + "@polkadot/util": 7.2.0 + "@polkadot/util-crypto": 7.2.0 languageName: unknown linkType: soft -"@polkadot/networks@7.1.3-4, @polkadot/networks@workspace:packages/networks": +"@polkadot/networks@7.2.0, @polkadot/networks@workspace:packages/networks": version: 0.0.0-use.local resolution: "@polkadot/networks@workspace:packages/networks" dependencies: "@babel/runtime": ^7.15.3 - "@polkadot/util": 7.1.3-4 - "@polkadot/x-fetch": 7.1.3-4 + "@polkadot/util": 7.2.0 + "@polkadot/x-fetch": 7.2.0 languageName: unknown linkType: soft @@ -2103,15 +2103,15 @@ __metadata: languageName: node linkType: hard -"@polkadot/util-crypto@7.1.3-4, @polkadot/util-crypto@workspace:packages/util-crypto": +"@polkadot/util-crypto@7.2.0, @polkadot/util-crypto@workspace:packages/util-crypto": version: 0.0.0-use.local resolution: "@polkadot/util-crypto@workspace:packages/util-crypto" dependencies: "@babel/runtime": ^7.15.3 - "@polkadot/networks": 7.1.3-4 - "@polkadot/util": 7.1.3-4 + "@polkadot/networks": 7.2.0 + "@polkadot/util": 7.2.0 "@polkadot/wasm-crypto": ^4.1.2 - "@polkadot/x-randomvalues": 7.1.3-4 + "@polkadot/x-randomvalues": 7.2.0 "@types/bn.js": ^4.11.6 "@types/create-hash": ^1.2.2 "@types/elliptic": ^6.4.13 @@ -2130,17 +2130,17 @@ __metadata: tweetnacl: ^1.0.3 xxhashjs: ^0.2.2 peerDependencies: - "@polkadot/util": 7.1.3-4 + "@polkadot/util": 7.2.0 languageName: unknown linkType: soft -"@polkadot/util@7.1.3-4, @polkadot/util@workspace:packages/util": +"@polkadot/util@7.2.0, @polkadot/util@workspace:packages/util": version: 0.0.0-use.local resolution: "@polkadot/util@workspace:packages/util" dependencies: "@babel/runtime": ^7.15.3 - "@polkadot/x-textdecoder": 7.1.3-4 - "@polkadot/x-textencoder": 7.1.3-4 + "@polkadot/x-textdecoder": 7.2.0 + "@polkadot/x-textencoder": 7.2.0 "@types/bn.js": ^4.11.6 bn.js: ^4.11.9 camelcase: ^5.3.1 @@ -2185,23 +2185,23 @@ __metadata: resolution: "@polkadot/x-bundle@workspace:packages/x-bundle" dependencies: "@babel/runtime": ^7.15.3 - "@polkadot/util": 7.1.3-4 + "@polkadot/util": 7.2.0 buffer-es6: ^4.9.3 languageName: unknown linkType: soft -"@polkadot/x-fetch@7.1.3-4, @polkadot/x-fetch@workspace:packages/x-fetch": +"@polkadot/x-fetch@7.2.0, @polkadot/x-fetch@workspace:packages/x-fetch": version: 0.0.0-use.local resolution: "@polkadot/x-fetch@workspace:packages/x-fetch" dependencies: "@babel/runtime": ^7.15.3 - "@polkadot/x-global": 7.1.3-4 + "@polkadot/x-global": 7.2.0 "@types/node-fetch": ^2.5.12 node-fetch: ^2.6.1 languageName: unknown linkType: soft -"@polkadot/x-global@7.1.3-4, @polkadot/x-global@workspace:packages/x-global": +"@polkadot/x-global@7.2.0, @polkadot/x-global@workspace:packages/x-global": version: 0.0.0-use.local resolution: "@polkadot/x-global@workspace:packages/x-global" dependencies: @@ -2209,31 +2209,31 @@ __metadata: languageName: unknown linkType: soft -"@polkadot/x-randomvalues@7.1.3-4, @polkadot/x-randomvalues@workspace:packages/x-randomvalues": +"@polkadot/x-randomvalues@7.2.0, @polkadot/x-randomvalues@workspace:packages/x-randomvalues": version: 0.0.0-use.local resolution: "@polkadot/x-randomvalues@workspace:packages/x-randomvalues" dependencies: "@babel/runtime": ^7.15.3 - "@polkadot/x-global": 7.1.3-4 + "@polkadot/x-global": 7.2.0 "@types/react-native": ^0.64.13 languageName: unknown linkType: soft -"@polkadot/x-textdecoder@7.1.3-4, @polkadot/x-textdecoder@workspace:packages/x-textdecoder": +"@polkadot/x-textdecoder@7.2.0, @polkadot/x-textdecoder@workspace:packages/x-textdecoder": version: 0.0.0-use.local resolution: "@polkadot/x-textdecoder@workspace:packages/x-textdecoder" dependencies: "@babel/runtime": ^7.15.3 - "@polkadot/x-global": 7.1.3-4 + "@polkadot/x-global": 7.2.0 languageName: unknown linkType: soft -"@polkadot/x-textencoder@7.1.3-4, @polkadot/x-textencoder@workspace:packages/x-textencoder": +"@polkadot/x-textencoder@7.2.0, @polkadot/x-textencoder@workspace:packages/x-textencoder": version: 0.0.0-use.local resolution: "@polkadot/x-textencoder@workspace:packages/x-textencoder" dependencies: "@babel/runtime": ^7.15.3 - "@polkadot/x-global": 7.1.3-4 + "@polkadot/x-global": 7.2.0 languageName: unknown linkType: soft @@ -2242,7 +2242,7 @@ __metadata: resolution: "@polkadot/x-ws@workspace:packages/x-ws" dependencies: "@babel/runtime": ^7.15.3 - "@polkadot/x-global": 7.1.3-4 + "@polkadot/x-global": 7.2.0 "@types/websocket": ^1.0.4 websocket: ^1.0.34 languageName: unknown