Compare commits

...
14 Commits
Author SHA1 Message Date
Github Actions 4a5659a579 [CI Skip] release/stable 7.2.1
skip-checks: true
2021-08-15 08:46:10 +00:00
Jaco c4a8aa2dd7 7.2.1 (#1085)
* 7.2.1

* Update CHANGELOG.md

* u8aEmpty
2021-08-15 10:38:48 +02:00
Github Actions 2ad042e44d [CI Skip] release/beta 7.1.3-4
skip-checks: true
2021-08-13 11:56:50 +00:00
Jaco Greeff 4615fcfbde bump berry 2021-08-13 14:48:47 +03:00
Github Actions f90d84500d [CI Skip] release/beta 7.1.3-3
skip-checks: true
2021-08-13 11:02:19 +00:00
Jaco e919446341 Bump dev (#1084)
* Bump dev

* Cleanup circular dep

* CHANGELOG

* typo
2021-08-13 12:54:03 +02:00
Github Actions 8f942dcabe [CI Skip] release/beta 7.1.3-2
skip-checks: true
2021-08-12 08:09:40 +00:00
Nantian 2e4de2093c fix bigint type (#1079) 2021-08-12 10:00:58 +02:00
Github Actions 0202a1f1d4 [CI Skip] release/beta 7.1.3-1
skip-checks: true
2021-08-12 05:24:15 +00:00
Jaco Greeff 1e256fedaa pre 2021-08-12 08:16:52 +03:00
Github Actions 56a3d19083 [CI Skip] release/stable 7.1.2
skip-checks: true
2021-08-11 15:21:50 +00:00
Jaco caf76a7511 Ensure packageInfo from networks doesn't clobber crypto (#1076)
* Ensure packageInfo from networks doesn't clobber crypto

* 7.1.2

* Update CHANGELOG.md

* Extract network sorting

* ... revert, CC still not happy, maybe another day...
2021-08-11 17:14:28 +02:00
Github Actions 834a1e6a52 [CI Skip] release/beta 7.1.2-0
skip-checks: true
2021-08-10 09:23:32 +00:00
Jaco 7a5b1207b0 Minor x-bundle style cleanups (#1074) 2021-08-10 11:15:10 +02:00
59 changed files with 1144 additions and 1053 deletions
+2 -1
View File
@@ -16,4 +16,5 @@
6.0.5
7.0.2
7.0.3
7.0.3
7.1.2
File diff suppressed because one or more lines are too long
+631
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -10,4 +10,4 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: "@yarnpkg/plugin-version"
yarnPath: .yarn/releases/yarn-3.0.0-rc.2.cjs
yarnPath: .yarn/releases/yarn-3.0.1.cjs
+20
View File
@@ -1,5 +1,25 @@
# CHANGELOG
## 7.2.1 Aug 15, 2021
Contributed:
- Always use `bigint` type to indicate instance (Thanks to https://github.com/ntduan)
Changes:
- Added `u8aEmpty` helper check, all 0 or no length
- Cleanup additional circular dependencies detected by rollup
## 7.1.2 Aug 11, 2021
Changes:
- Ensure `@polkadot/util-crypto` doesn't re-export `packageInfo` from `@polkadot/networks`
- Minor TS style cleanups in `@polkadot/x-bundle`
## 7.1.1 Aug 2, 2021
Contributed:
+4 -3
View File
@@ -23,11 +23,12 @@
"test:one": "polkadot-dev-run-test --runInBand"
},
"devDependencies": {
"@babel/core": "^7.14.8",
"@polkadot/dev": "^0.62.57",
"@babel/core": "^7.15.0",
"@polkadot/dev": "^0.62.59",
"@polkadot/ts": "^0.4.4",
"@types/ed2curve": "^0.2.2",
"@types/jest": "^26.0.24"
},
"version": "7.1.1"
"version": "7.2.1",
"packageManager": "yarn@3.0.1"
}
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/hw-ledger-transports",
"version": "7.1.1",
"version": "7.2.1",
"type": "module",
"repository": "github:polkadot-js/common",
"author": "Jaco Greeff <jacogr@gmail.com>",
@@ -15,9 +15,9 @@
"node": ">=14.0.0"
},
"dependencies": {
"@babel/runtime": "^7.14.8",
"@babel/runtime": "^7.15.3",
"@ledgerhq/hw-transport": "^6.3.0",
"@ledgerhq/hw-transport-webhid": "^6.3.0",
"@ledgerhq/hw-transport-webhid": "^6.4.1",
"@ledgerhq/hw-transport-webusb": "^6.3.0"
},
"optionalDependencies": {
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/hw-ledger-transports', version: '7.1.1' };
export const packageInfo = { name: '@polkadot/hw-ledger-transports', version: '7.2.1' };
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/hw-ledger",
"version": "7.1.1",
"version": "7.2.1",
"type": "module",
"repository": "github:polkadot-js/common",
"author": "Jaco Greeff <jacogr@gmail.com>",
@@ -16,9 +16,9 @@
"node": ">=14.0.0"
},
"dependencies": {
"@babel/runtime": "^7.14.8",
"@polkadot/hw-ledger-transports": "7.1.1",
"@polkadot/util": "^7.1.1",
"@babel/runtime": "^7.15.3",
"@polkadot/hw-ledger-transports": "7.2.1",
"@polkadot/util": "7.2.1",
"@zondax/ledger-substrate": "^0.17.3"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/hw-ledger', version: '7.1.1' };
export const packageInfo = { name: '@polkadot/hw-ledger', version: '7.2.1' };
+6 -6
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/keyring",
"version": "7.1.1",
"version": "7.2.1",
"type": "module",
"description": "Keyring management",
"author": "Jaco Greeff <jacogr@gmail.com>",
@@ -19,12 +19,12 @@
"bugs": "https://github.com/polkadot-js/common/issues",
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/keyring#readme",
"dependencies": {
"@babel/runtime": "^7.14.8",
"@polkadot/util": "7.1.1",
"@polkadot/util-crypto": "7.1.1"
"@babel/runtime": "^7.15.3",
"@polkadot/util": "7.2.1",
"@polkadot/util-crypto": "7.2.1"
},
"peerDependencies": {
"@polkadot/util": "7.1.1",
"@polkadot/util-crypto": "7.1.1"
"@polkadot/util": "7.2.1",
"@polkadot/util-crypto": "7.2.1"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/keyring', version: '7.1.1' };
export const packageInfo = { name: '@polkadot/keyring', version: '7.2.1' };
+1 -1
View File
@@ -6,8 +6,8 @@ import type { KeyringInstance, KeyringOptions } from './types';
import { hexToU8a } from '@polkadot/util';
import { KeypairType } from '@polkadot/util-crypto/types';
import { Keyring } from './keyring';
import { createPair } from './pair';
import Keyring from '.';
interface PairDef {
name?: string;
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/networks",
"version": "7.1.1",
"version": "7.2.1",
"type": "module",
"description": "A list of all available Substrate networks and their applicable prefixes",
"main": "index.js",
@@ -16,10 +16,10 @@
"bugs": "https://github.com/polkadot-js/common/issues",
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/networks#readme",
"dependencies": {
"@babel/runtime": "^7.14.8"
"@babel/runtime": "^7.15.3"
},
"devDependencies": {
"@polkadot/util": "7.1.1",
"@polkadot/x-fetch": "7.1.1"
"@polkadot/util": "7.2.1",
"@polkadot/x-fetch": "7.2.1"
}
}
+1 -42
View File
@@ -1,46 +1,5 @@
// Copyright 2017-2021 @polkadot/networks authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Network, SubstrateNetwork } from './types';
import { knownGenesis, knownIcon, knownLedger, knownTestnet } from './defaults';
import { knownSubstrate } from './substrate';
export * from './interfaces';
export { packageInfo } from './packageInfo';
// These are known prefixes that are not sorted
const UNSORTED = [0, 2, 42];
export const allNetworks = knownSubstrate.map((o): SubstrateNetwork => {
const network = o.network || '';
const n = o as SubstrateNetwork;
n.slip44 = knownLedger[network];
n.hasLedgerSupport = !!n.slip44;
n.genesisHash = knownGenesis[network] || [];
n.icon = knownIcon[network] || 'substrate';
n.isIgnored = !network || !!knownTestnet[network] || network.startsWith('reserved');
return n;
});
// The list of available/claimed prefixes
// - no testnets
// - we only include those where we have a standardAccount
// - when no icon has been specified, default to substrate
// - sort by name, however we keep 0, 2, 42 first in the list
export const availableNetworks = allNetworks
.filter((n): n is Network => !n.isIgnored && !!n.network)
.sort((a, b) =>
UNSORTED.includes(a.prefix) === UNSORTED.includes(b.prefix)
? 0
: UNSORTED.includes(a.prefix)
? -1
: UNSORTED.includes(b.prefix)
? 1
: a.displayName.localeCompare(b.displayName)
);
// A filtered list of those chains we have details about (genesisHashes)
export const selectableNetworks = availableNetworks.filter((n) => n.genesisHash.length || n.prefix === 42);
+43
View File
@@ -0,0 +1,43 @@
// Copyright 2017-2021 @polkadot/networks authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Network, SubstrateNetwork } from './types';
import { knownGenesis, knownIcon, knownLedger, knownTestnet } from './defaults';
import { knownSubstrate } from './substrate';
// These are known prefixes that are not sorted
const UNSORTED = [0, 2, 42];
export const allNetworks = knownSubstrate.map((o): SubstrateNetwork => {
const network = o.network || '';
const n = o as SubstrateNetwork;
n.slip44 = knownLedger[network];
n.hasLedgerSupport = !!n.slip44;
n.genesisHash = knownGenesis[network] || [];
n.icon = knownIcon[network] || 'substrate';
n.isIgnored = !network || !!knownTestnet[network] || network.startsWith('reserved');
return n;
});
// The list of available/claimed prefixes
// - no testnets
// - we only include those where we have a standardAccount
// - sort by name, however we keep 0, 2, 42 first in the list
export const availableNetworks = allNetworks
.filter((n): n is Network => !n.isIgnored && !!n.network)
.sort((a, b) =>
UNSORTED.includes(a.prefix) === UNSORTED.includes(b.prefix)
? 0
: UNSORTED.includes(a.prefix)
? -1
: UNSORTED.includes(b.prefix)
? 1
: a.displayName.localeCompare(b.displayName)
);
// A filtered list of those chains we have details about (genesisHashes)
export const selectableNetworks = availableNetworks.filter((n) => n.genesisHash.length || n.prefix === 42);
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/networks', version: '7.1.1' };
export const packageInfo = { name: '@polkadot/networks', version: '7.2.1' };
+6 -6
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/util-crypto",
"version": "7.1.1",
"version": "7.2.1",
"type": "module",
"description": "A collection of useful crypto utilities for @polkadot",
"main": "index.js",
@@ -21,11 +21,11 @@
"bugs": "https://github.com/polkadot-js/common/issues",
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/util-crypto#readme",
"dependencies": {
"@babel/runtime": "^7.14.8",
"@polkadot/networks": "7.1.1",
"@polkadot/util": "7.1.1",
"@babel/runtime": "^7.15.3",
"@polkadot/networks": "7.2.1",
"@polkadot/util": "7.2.1",
"@polkadot/wasm-crypto": "^4.1.2",
"@polkadot/x-randomvalues": "7.1.1",
"@polkadot/x-randomvalues": "7.2.1",
"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.1"
"@polkadot/util": "7.2.1"
}
}
@@ -14,6 +14,6 @@ import { createKeyDerived } from './keyDerived';
* @description
* Creates a Substrate derived address based on the input address/publicKey and the index supplied.
*/
export function encodeDerivedAddress (who: Uint8Array | string, index: BigInt | BN | number, ss58Format?: Prefix): string {
export function encodeDerivedAddress (who: Uint8Array | string, index: bigint | BN | number, ss58Format?: Prefix): string {
return encodeAddress(createKeyDerived(decodeAddress(who), index), ss58Format);
}
@@ -13,6 +13,6 @@ import { createKeyMulti } from './keyMulti';
* @description
* Creates a Substrate multisig address based on the input address and the required threshold.
*/
export function encodeMultiAddress (who: (Uint8Array | string)[], threshold: BigInt | BN | number, ss58Format?: Prefix): string {
export function encodeMultiAddress (who: (Uint8Array | string)[], threshold: bigint | BN | number, ss58Format?: Prefix): string {
return encodeAddress(createKeyMulti(who, threshold), ss58Format);
}
@@ -10,7 +10,7 @@ import { decodeAddress } from './decode';
const PREFIX = stringToU8a('modlpy/utilisuba');
export function createKeyDerived (who: Uint8Array | string, index: BigInt | BN | number): Uint8Array {
export function createKeyDerived (who: Uint8Array | string, index: bigint | BN | number): Uint8Array {
return blake2AsU8a(
u8aConcat(
PREFIX,
+1 -1
View File
@@ -10,7 +10,7 @@ import { decodeAddress } from './decode';
const PREFIX = stringToU8a('modlpy/utilisuba');
export function createKeyMulti (who: (Uint8Array | string)[], threshold: BigInt | BN | number): Uint8Array {
export function createKeyMulti (who: (Uint8Array | string)[], threshold: bigint | BN | number): Uint8Array {
return blake2AsU8a(
u8aConcat(
PREFIX,
@@ -47,7 +47,7 @@ export class DeriveJunction {
return !this.#isHard;
}
public hard (value: number | string | BigInt | BN | Uint8Array): DeriveJunction {
public hard (value: number | string | bigint | BN | Uint8Array): DeriveJunction {
return this.soft(value).harden();
}
@@ -57,7 +57,7 @@ export class DeriveJunction {
return this;
}
public soft (value: number | string | BigInt | BN | Uint8Array): DeriveJunction {
public soft (value: number | string | bigint | BN | Uint8Array): DeriveJunction {
if (isNumber(value) || isBn(value) || isBigInt(value)) {
return this.soft(bnToHex(value, BN_OPTIONS));
} else if (isHex(value)) {
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2021 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from '@polkadot/networks';
export * from '@polkadot/networks/interfaces';
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/util-crypto', version: '7.1.1' };
export const packageInfo = { name: '@polkadot/util-crypto', version: '7.2.1' };
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/util",
"version": "7.1.1",
"version": "7.2.1",
"type": "module",
"description": "A collection of useful utilities for @polkadot",
"main": "index.js",
@@ -19,9 +19,9 @@
"bugs": "https://github.com/polkadot-js/common/issues",
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/util#readme",
"dependencies": {
"@babel/runtime": "^7.14.8",
"@polkadot/x-textdecoder": "7.1.1",
"@polkadot/x-textencoder": "7.1.1",
"@babel/runtime": "^7.15.3",
"@polkadot/x-textdecoder": "7.2.1",
"@polkadot/x-textencoder": "7.2.1",
"@types/bn.js": "^4.11.6",
"bn.js": "^4.11.9",
"camelcase": "^5.3.1",
+1 -1
View File
@@ -3,7 +3,7 @@
import { BN, bnSqrt } from '.';
const TESTS: [string | number | BN | BigInt, string | number][] = [
const TESTS: [string | number | BN | bigint, string | number][] = [
[0, 0],
[1, 1],
[4, 2],
+1 -1
View File
@@ -23,7 +23,7 @@ const SQRT_MAX_SAFE_INTEGER = new BN(94906265);
* bnSqrt(new BN(16)).toString(); // => '4'
* ```
*/
export function bnSqrt <ExtToBn extends ToBn> (value: ExtToBn | BN | BigInt | string | number | null): BN {
export function bnSqrt <ExtToBn extends ToBn> (value: ExtToBn | BN | bigint | string | number | null): BN {
const n = bnToBn(value);
assert(n.gte(BN_ZERO), 'square root of negative numbers is not supported');
+2 -2
View File
@@ -11,7 +11,7 @@ import { BN } from './bn';
/**
* @name bnToBn
* @summary Creates a BN value from a BN, BigInt, string (base 10 or hex) or number input.
* @summary Creates a BN value from a BN, bigint, string (base 10 or hex) or number input.
* @description
* `null` inputs returns a `0x0` result, BN values returns the value, numbers returns a BN representation.
* @example
@@ -25,7 +25,7 @@ import { BN } from './bn';
* bnToBn(new BN(0x1234)); // => BN(0x1234)
* ```
*/
export function bnToBn <ExtToBn extends ToBn> (value?: ExtToBn | BN | BigInt | string | number | null): BN {
export function bnToBn <ExtToBn extends ToBn> (value?: ExtToBn | BN | bigint | string | number | null): BN {
if (!value) {
return new BN(0);
} else if (isHex(value)) {
+3 -3
View File
@@ -29,9 +29,9 @@ interface Options extends ToBnOptions {
* bnToHex(new BN(0x123456)); // => '0x123456'
* ```
*/
function bnToHex <ExtToBn extends ToBn> (value?: ExtToBn | BN | BigInt | number | null, options?: Options): string;
function bnToHex <ExtToBn extends ToBn> (value?: ExtToBn | BN | BigInt | number | null, bitLength?: number, isLe?: boolean): string;
function bnToHex <ExtToBn extends ToBn> (value?: ExtToBn | BN | BigInt | number | null, arg1: number | Options = { bitLength: -1, isLe: false, isNegative: false }, arg2?: boolean): string {
function bnToHex <ExtToBn extends ToBn> (value?: ExtToBn | BN | bigint | number | null, options?: Options): string;
function bnToHex <ExtToBn extends ToBn> (value?: ExtToBn | BN | bigint | number | null, bitLength?: number, isLe?: boolean): string;
function bnToHex <ExtToBn extends ToBn> (value?: ExtToBn | BN | bigint | number | null, arg1: number | Options = { bitLength: -1, isLe: false, isNegative: false }, arg2?: boolean): string {
if (!value) {
return ZERO_STR;
}
+3 -3
View File
@@ -40,9 +40,9 @@ function createValue (valueBn: BN, byteLength: number, { isLe, isNegative }: Opt
* bnToU8a(new BN(0x1234)); // => [0x12, 0x34]
* ```
*/
function bnToU8a <ExtToBn extends ToBn> (value?: ExtToBn | BN | BigInt | number | null, options?: Options): Uint8Array;
function bnToU8a <ExtToBn extends ToBn> (value?: ExtToBn | BN | BigInt | number | null, bitLength?: number, isLe?: boolean): Uint8Array;
function bnToU8a <ExtToBn extends ToBn> (value?: ExtToBn | BN | BigInt | number | null, arg1: number | Options = { bitLength: -1, isLe: true, isNegative: false }, arg2?: boolean): Uint8Array {
function bnToU8a <ExtToBn extends ToBn> (value?: ExtToBn | BN | bigint | number | null, options?: Options): Uint8Array;
function bnToU8a <ExtToBn extends ToBn> (value?: ExtToBn | BN | bigint | number | null, bitLength?: number, isLe?: boolean): Uint8Array;
function bnToU8a <ExtToBn extends ToBn> (value?: ExtToBn | BN | bigint | number | null, arg1: number | Options = { bitLength: -1, isLe: true, isNegative: false }, arg2?: boolean): Uint8Array {
const options: Options = {
bitLength: -1,
isLe: true,
+1 -1
View File
@@ -21,7 +21,7 @@ const MAX_U32 = new BN(2).pow(new BN(32 - 2)).subn(1);
* console.log(compactToU8a(511, 32)); // Uint8Array([0b11111101, 0b00000111])
* ```
*/
export function compactToU8a (_value: BN | BigInt | number): Uint8Array {
export function compactToU8a (_value: BN | bigint | number): Uint8Array {
const value = bnToBn(_value);
if (value.lte(MAX_U8)) {
+2 -2
View File
@@ -29,7 +29,7 @@ interface Options {
}
interface BalanceFormatter {
<ExtToBn extends ToBn> (input?: number | string | BN | BigInt | ExtToBn, options?: Options, decimals?: number): string;
<ExtToBn extends ToBn> (input?: number | string | BN | bigint | ExtToBn, options?: Options, decimals?: number): string;
calcSi (text: string, decimals?: number): SiDef;
findSi (type: string): SiDef;
getDefaults (): Defaults;
@@ -44,7 +44,7 @@ let defaultDecimals = DEFAULT_DECIMALS;
let defaultUnit = DEFAULT_UNIT;
// Formats a string/number with <prefix>.<postfix><type> notation
function _formatBalance <ExtToBn extends ToBn> (input?: number | string | BN | BigInt | ExtToBn, options: Options | boolean = true, optDecimals: number = defaultDecimals): string {
function _formatBalance <ExtToBn extends ToBn> (input?: number | string | BN | bigint | ExtToBn, options: Options | boolean = true, optDecimals: number = defaultDecimals): string {
let text = bnToBn(input).toString();
if (text.length === 0 || text === '0') {
+1 -1
View File
@@ -18,7 +18,7 @@ function formatValue (elapsed: number): string {
return `${elapsed / 3600 | 0}h`;
}
export function formatElapsed <ExtToBn extends ToBn> (now?: Date | null, value?: BigInt | BN | ExtToBn | Date | number | null): string {
export function formatElapsed <ExtToBn extends ToBn> (now?: Date | null, value?: bigint | BN | ExtToBn | Date | number | null): string {
const tsNow = (now && now.getTime()) || 0;
const tsValue = value instanceof Date
? value.getTime()
+1 -1
View File
@@ -7,6 +7,6 @@ import type { ToBn } from '../types';
import { bnToBn } from '../bn/toBn';
import { formatDecimal } from './formatDecimal';
export function formatNumber <ExtToBn extends ToBn> (value?: ExtToBn | BN | BigInt | number | null): string {
export function formatNumber <ExtToBn extends ToBn> (value?: ExtToBn | BN | bigint | number | null): string {
return formatDecimal(bnToBn(value).toString());
}
+1 -1
View File
@@ -15,6 +15,6 @@
* console.log('isBigInt', isBigInt(123_456n)); // => true
* ```
*/
export function isBigInt (value: unknown): value is BigInt {
export function isBigInt (value: unknown): value is bigint {
return typeof value === 'bigint';
}
+1 -1
View File
@@ -3,7 +3,7 @@
import { isU8a } from '.';
describe('isUint8Array', (): void => {
describe('isU8a', (): void => {
it('returns false on undefined values', (): void => {
expect(
isU8a()
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/util', version: '7.1.1' };
export const packageInfo = { name: '@polkadot/util', version: '7.2.1' };
+24
View File
@@ -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);
});
});
+12
View File
@@ -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);
}
+1
View File
@@ -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';
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/x-bundle",
"version": "7.1.1",
"version": "7.2.1",
"type": "module",
"description": "A bundler helper",
"main": "index.js",
@@ -16,8 +16,8 @@
"bugs": "https://github.com/polkadot-js/common/issues",
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/x-bundle#readme",
"dependencies": {
"@babel/runtime": "^7.14.8",
"@polkadot/util": "^7.1.1",
"@babel/runtime": "^7.15.3",
"@polkadot/util": "7.2.1",
"buffer-es6": "^4.9.3"
}
}
+1 -3
View File
@@ -1,6 +1,4 @@
// Copyright 2017-2021 @polkadot/x-bundle authors & contributors
// SPDX-License-Identifier: Apache-2.0
const crypto = {};
export default crypto;
export default {};
+1 -3
View File
@@ -1,6 +1,4 @@
// Copyright 2017-2021 @polkadot/x-bundle authors & contributors
// SPDX-License-Identifier: Apache-2.0
const empty = {};
export default empty;
export default {};
+2 -8
View File
@@ -5,22 +5,16 @@
// The ISC License
// Copyright (c) Isaac Z. Schlueter
// eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/explicit-module-boundary-types
function inherits (ctor: any, superCtor: any): any {
export default function inherits (ctor: Record<string, unknown>, superCtor: Record<string, unknown>): void {
if (superCtor) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
ctor.super_ = superCtor;
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
ctor.prototype = Object.create(superCtor.prototype, {
ctor.prototype = Object.create(superCtor.prototype as null, {
constructor: {
configurable: true,
enumerable: false,
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
value: ctor,
writable: true
}
});
}
}
export default inherits;
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/x-bundle', version: '7.1.1' };
export const packageInfo = { name: '@polkadot/x-bundle', version: '7.2.1' };
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/x-fetch",
"version": "7.1.1",
"version": "7.2.1",
"type": "module",
"description": "A cross-environment fetch replacement",
"browser": "browser.js",
@@ -18,8 +18,8 @@
"bugs": "https://github.com/polkadot-js/common/issues",
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/x-fetch#readme",
"dependencies": {
"@babel/runtime": "^7.14.8",
"@polkadot/x-global": "7.1.1",
"@babel/runtime": "^7.15.3",
"@polkadot/x-global": "7.2.1",
"@types/node-fetch": "^2.5.12",
"node-fetch": "^2.6.1"
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/x-fetch', version: '7.1.1' };
export const packageInfo = { name: '@polkadot/x-fetch', version: '7.2.1' };
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/x-global",
"version": "7.1.1",
"version": "7.2.1",
"type": "module",
"description": "A cross-environment global replacement",
"main": "index.js",
@@ -16,6 +16,6 @@
"bugs": "https://github.com/polkadot-js/common/issues",
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/x-global#readme",
"dependencies": {
"@babel/runtime": "^7.14.8"
"@babel/runtime": "^7.15.3"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/x-global', version: '7.1.1' };
export const packageInfo = { name: '@polkadot/x-global', version: '7.2.1' };
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/x-randomvalues",
"version": "7.1.1",
"version": "7.2.1",
"type": "module",
"description": "A cross-environment window.crypto.getRandomValues replacement",
"browser": "browser.js",
@@ -18,10 +18,10 @@
"bugs": "https://github.com/polkadot-js/common/issues",
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/x-randomvalues#readme",
"dependencies": {
"@babel/runtime": "^7.14.8",
"@polkadot/x-global": "7.1.1"
"@babel/runtime": "^7.15.3",
"@polkadot/x-global": "7.2.1"
},
"devDependencies": {
"@types/react-native": "^0.64.12"
"@types/react-native": "^0.64.13"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/x-randomvalues', version: '7.1.1' };
export const packageInfo = { name: '@polkadot/x-randomvalues', version: '7.2.1' };
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/x-textdecoder",
"version": "7.1.1",
"version": "7.2.1",
"type": "module",
"description": "A TextDecoder replacement",
"browser": "browser.js",
@@ -18,7 +18,7 @@
"bugs": "https://github.com/polkadot-js/common/issues",
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/x-textdecoder#readme",
"dependencies": {
"@babel/runtime": "^7.14.8",
"@polkadot/x-global": "7.1.1"
"@babel/runtime": "^7.15.3",
"@polkadot/x-global": "7.2.1"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/x-textdecoder', version: '7.1.1' };
export const packageInfo = { name: '@polkadot/x-textdecoder', version: '7.2.1' };
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/x-textencoder",
"version": "7.1.1",
"version": "7.2.1",
"type": "module",
"description": "A TextDecoder replacement",
"browser": "browser.js",
@@ -18,7 +18,7 @@
"bugs": "https://github.com/polkadot-js/common/issues",
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/x-textencoder#readme",
"dependencies": {
"@babel/runtime": "^7.14.8",
"@polkadot/x-global": "7.1.1"
"@babel/runtime": "^7.15.3",
"@polkadot/x-global": "7.2.1"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/x-textencoder', version: '7.1.1' };
export const packageInfo = { name: '@polkadot/x-textencoder', version: '7.2.1' };
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/x-ws",
"version": "7.1.1",
"version": "7.2.1",
"type": "module",
"description": "A cross-environment WebSocket replacement",
"browser": "browser.js",
@@ -18,8 +18,8 @@
"bugs": "https://github.com/polkadot-js/common/issues",
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/x-ws#readme",
"dependencies": {
"@babel/runtime": "^7.14.8",
"@polkadot/x-global": "7.1.1",
"@babel/runtime": "^7.15.3",
"@polkadot/x-global": "7.2.1",
"@types/websocket": "^1.0.4",
"websocket": "^1.0.34"
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/x-ws', version: '7.1.1' };
export const packageInfo = { name: '@polkadot/x-ws', version: '7.2.1' };
+315 -315
View File
File diff suppressed because it is too large Load Diff