3.7 (#738)
* 3.7 * Update new rules * RegExp * formatBalance cleanups * Revert * Formatting * fill * format test fix * cleanups * Cleanups * Expand bip39 tests * Cleanups * Cleanups
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
# CHANGELOG
|
||||
|
||||
## 3.6.2-x
|
||||
## 3.7.1 Nov 1, 2020
|
||||
|
||||
Changes:
|
||||
|
||||
|
||||
+2
-2
@@ -22,9 +22,9 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.12.3",
|
||||
"@polkadot/dev": "^0.59.10",
|
||||
"@polkadot/dev": "^0.59.12",
|
||||
"@polkadot/ts": "^0.3.53",
|
||||
"@types/jest": "^26.0.15"
|
||||
},
|
||||
"version": "3.6.2-12"
|
||||
"version": "3.7.0"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/keyring",
|
||||
"version": "3.6.2-12",
|
||||
"version": "3.7.0",
|
||||
"description": "Keyring management",
|
||||
"main": "index.js",
|
||||
"publishConfig": {
|
||||
@@ -28,7 +28,7 @@
|
||||
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/keyring#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.1",
|
||||
"@polkadot/util": "^3.6.2-12",
|
||||
"@polkadot/util-crypto": "^3.6.2-12"
|
||||
"@polkadot/util": "^3.7.0",
|
||||
"@polkadot/util-crypto": "^3.7.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/networks",
|
||||
"version": "3.6.2-12",
|
||||
"version": "3.7.0",
|
||||
"description": "A list of all available Substrate networks and their applicable prefixes",
|
||||
"main": "index.js",
|
||||
"publishConfig": {
|
||||
@@ -29,7 +29,7 @@
|
||||
"@babel/runtime": "^7.12.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/util": "^3.6.2-12",
|
||||
"@polkadot/x-fetch": "^3.6.2-12"
|
||||
"@polkadot/util": "^3.7.0",
|
||||
"@polkadot/x-fetch": "^3.7.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,16 @@ const UNSORTED = [0, 2, 42];
|
||||
// last. This make lookups for the current a simple genesisHash[0]
|
||||
// (See Kusama as an example)
|
||||
|
||||
const createReserved = (prefix: number, displayName = 'This prefix is reserved.'): NetworkFromSubstrate => ({
|
||||
decimals: null,
|
||||
displayName,
|
||||
network: `reserved${prefix}`,
|
||||
prefix,
|
||||
standardAccount: null,
|
||||
symbols: null,
|
||||
website: null
|
||||
});
|
||||
|
||||
const all: NetworkFromSubstrate[] = [
|
||||
{
|
||||
decimals: [10],
|
||||
@@ -23,15 +33,7 @@ const all: NetworkFromSubstrate[] = [
|
||||
symbols: ['DOT'],
|
||||
website: 'https://polkadot.network'
|
||||
},
|
||||
{
|
||||
decimals: null,
|
||||
displayName: 'This prefix is reserved.',
|
||||
network: 'reserved1',
|
||||
prefix: 1,
|
||||
standardAccount: null,
|
||||
symbols: null,
|
||||
website: null
|
||||
},
|
||||
createReserved(1),
|
||||
{
|
||||
decimals: [12],
|
||||
displayName: 'Kusama Relay Chain',
|
||||
@@ -47,15 +49,7 @@ const all: NetworkFromSubstrate[] = [
|
||||
symbols: ['KSM'],
|
||||
website: 'https://kusama.network'
|
||||
},
|
||||
{
|
||||
decimals: null,
|
||||
displayName: 'This prefix is reserved.',
|
||||
network: 'reserved3',
|
||||
prefix: 3,
|
||||
standardAccount: null,
|
||||
symbols: null,
|
||||
website: null
|
||||
},
|
||||
createReserved(3),
|
||||
{
|
||||
decimals: null,
|
||||
displayName: 'Katal Chain',
|
||||
@@ -195,14 +189,14 @@ const all: NetworkFromSubstrate[] = [
|
||||
website: 'https://geekcash.org'
|
||||
},
|
||||
{
|
||||
decimals: null,
|
||||
decimals: [12],
|
||||
displayName: 'Stafi',
|
||||
genesisHash: ['0x290a4149f09ea0e402c74c1c7e96ae4239588577fe78932f94f5404c68243d80'],
|
||||
network: 'stafi',
|
||||
prefix: 20,
|
||||
standardAccount: '*25519',
|
||||
symbols: null,
|
||||
website: null
|
||||
symbols: ['FIS'],
|
||||
website: 'https://stafi.io'
|
||||
},
|
||||
{
|
||||
decimals: [6],
|
||||
@@ -333,15 +327,7 @@ const all: NetworkFromSubstrate[] = [
|
||||
symbols: null,
|
||||
website: 'https://substrate.dev/'
|
||||
},
|
||||
{
|
||||
decimals: null,
|
||||
displayName: 'This prefix is reserved.',
|
||||
network: 'reserved43',
|
||||
prefix: 43,
|
||||
standardAccount: null,
|
||||
symbols: null,
|
||||
website: null
|
||||
},
|
||||
createReserved(43),
|
||||
{
|
||||
decimals: [8],
|
||||
displayName: 'ChainX',
|
||||
@@ -351,33 +337,9 @@ const all: NetworkFromSubstrate[] = [
|
||||
symbols: ['PCX'],
|
||||
website: 'https://chainx.org/'
|
||||
},
|
||||
{
|
||||
decimals: null,
|
||||
displayName: 'This prefix is reserved.',
|
||||
network: 'reserved46',
|
||||
prefix: 46,
|
||||
standardAccount: null,
|
||||
symbols: null,
|
||||
website: null
|
||||
},
|
||||
{
|
||||
decimals: null,
|
||||
displayName: 'This prefix is reserved.',
|
||||
network: 'reserved47',
|
||||
prefix: 47,
|
||||
standardAccount: null,
|
||||
symbols: null,
|
||||
website: null
|
||||
},
|
||||
{
|
||||
decimals: null,
|
||||
displayName: 'All prefixes 48 and higher are reserved and cannot be allocated.',
|
||||
network: 'reserved48',
|
||||
prefix: 48,
|
||||
standardAccount: null,
|
||||
symbols: null,
|
||||
website: null
|
||||
}
|
||||
createReserved(46),
|
||||
createReserved(47),
|
||||
createReserved(48, 'All prefixes 48 and higher are reserved and cannot be allocated.')
|
||||
];
|
||||
|
||||
// The list of available/claimed prefixes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/util-crypto",
|
||||
"version": "3.6.2-12",
|
||||
"version": "3.7.0",
|
||||
"description": "A collection of useful crypto utilities for @polkadot",
|
||||
"main": "index.js",
|
||||
"keywords": [
|
||||
@@ -26,8 +26,8 @@
|
||||
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/util-crypto#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.1",
|
||||
"@polkadot/networks": "^3.6.2-12",
|
||||
"@polkadot/util": "^3.6.2-12",
|
||||
"@polkadot/networks": "^3.7.0",
|
||||
"@polkadot/util": "^3.7.0",
|
||||
"@polkadot/wasm-crypto": "^1.4.1",
|
||||
"base-x": "^3.0.8",
|
||||
"blakejs": "^1.1.0",
|
||||
|
||||
@@ -17,6 +17,25 @@ const LOOKUP = BASE32_ALPHABET
|
||||
return lookup;
|
||||
}, {});
|
||||
|
||||
/** @internal */
|
||||
function decode (output: Uint8Array, input: string, offset: number): [Uint8Array, number, number] {
|
||||
let bits = 0;
|
||||
let buffer = 0;
|
||||
let written = 0;
|
||||
|
||||
for (let i = offset; i < input.length; i++) {
|
||||
buffer = (buffer << BITS_PER_CHAR) | LOOKUP[input[i]];
|
||||
bits += BITS_PER_CHAR;
|
||||
|
||||
if (bits >= 8) {
|
||||
bits -= 8;
|
||||
output[written++] = 0xff & (buffer >> bits);
|
||||
}
|
||||
}
|
||||
|
||||
return [output, bits, buffer];
|
||||
}
|
||||
|
||||
/**
|
||||
* @name base32Decode
|
||||
* @summary Delookup a base32 value.
|
||||
@@ -26,22 +45,14 @@ const LOOKUP = BASE32_ALPHABET
|
||||
export default function base32Decode (value: string, ipfsCompat = false): Uint8Array {
|
||||
validate(value, ipfsCompat);
|
||||
|
||||
const out = new Uint8Array(((value.length - (ipfsCompat ? 1 : 0)) * BITS_PER_CHAR / 8) | 0);
|
||||
let bits = 0;
|
||||
let buffer = 0;
|
||||
let written = 0;
|
||||
|
||||
for (let i = (ipfsCompat ? 1 : 0); i < value.length; ++i) {
|
||||
buffer = (buffer << BITS_PER_CHAR) | LOOKUP[value[i]];
|
||||
bits += BITS_PER_CHAR;
|
||||
|
||||
if (bits >= 8) {
|
||||
bits -= 8;
|
||||
out[written++] = 0xff & (buffer >> bits);
|
||||
}
|
||||
}
|
||||
const offset = (ipfsCompat ? 1 : 0);
|
||||
const [output, bits, buffer] = decode(
|
||||
new Uint8Array(((value.length - offset) * BITS_PER_CHAR / 8) | 0),
|
||||
value,
|
||||
offset
|
||||
);
|
||||
|
||||
assert(!(bits >= BITS_PER_CHAR || 0xff & (buffer << (8 - bits))), 'Unexpected end of data');
|
||||
|
||||
return out;
|
||||
return output;
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -15,6 +15,7 @@
|
||||
|
||||
import createHash from 'create-hash';
|
||||
import { pbkdf2Sync } from 'pbkdf2';
|
||||
import { assert, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
import randomAsU8a from '../random/asU8a';
|
||||
import DEFAULT_WORDLIST from './bip39-en';
|
||||
@@ -56,26 +57,20 @@ export function mnemonicToSeedSync (mnemonic: string, password?: string): Buffer
|
||||
return pbkdf2Sync(mnemonicBuffer, saltBuffer, 2048, 64, 'sha512');
|
||||
}
|
||||
|
||||
export function mnemonicToEntropy (mnemonic: string): string {
|
||||
export function mnemonicToEntropy (mnemonic: string): Uint8Array {
|
||||
const words = normalize(mnemonic).split(' ');
|
||||
|
||||
if (words.length % 3 !== 0) {
|
||||
throw new Error(INVALID_MNEMONIC);
|
||||
}
|
||||
assert(words.length % 3 === 0, INVALID_MNEMONIC);
|
||||
|
||||
// convert word indices to 11 bit binary strings
|
||||
const bits = words
|
||||
.map(
|
||||
(word: string): string => {
|
||||
const index = DEFAULT_WORDLIST.indexOf(word);
|
||||
.map((word): string => {
|
||||
const index = DEFAULT_WORDLIST.indexOf(word);
|
||||
|
||||
if (index === -1) {
|
||||
throw new Error(INVALID_MNEMONIC);
|
||||
}
|
||||
assert(index !== -1, INVALID_MNEMONIC);
|
||||
|
||||
return index.toString(2).padStart(11, '0');
|
||||
}
|
||||
)
|
||||
return index.toString(2).padStart(11, '0');
|
||||
})
|
||||
.join('');
|
||||
|
||||
// split the binary string into ENT/CS
|
||||
@@ -86,62 +81,34 @@ export function mnemonicToEntropy (mnemonic: string): string {
|
||||
// calculate the checksum and compare
|
||||
const entropyBytes = entropyBits.match(/(.{1,8})/g)?.map(binaryToByte);
|
||||
|
||||
if (!entropyBytes || entropyBytes.length < 16) {
|
||||
throw new Error(INVALID_ENTROPY);
|
||||
} else if (entropyBytes.length > 32) {
|
||||
throw new Error(INVALID_ENTROPY);
|
||||
} else if (entropyBytes.length % 4 !== 0) {
|
||||
throw new Error(INVALID_ENTROPY);
|
||||
}
|
||||
assert(entropyBytes && entropyBytes.length % 4 === 0 && entropyBytes.length >= 16 && entropyBytes.length <= 32, INVALID_ENTROPY);
|
||||
|
||||
const entropy = Buffer.from(entropyBytes);
|
||||
const entropy = u8aToU8a(entropyBytes);
|
||||
const newChecksum = deriveChecksumBits(entropy);
|
||||
|
||||
if (newChecksum !== checksumBits) {
|
||||
throw new Error(INVALID_CHECKSUM);
|
||||
}
|
||||
assert(newChecksum === checksumBits, INVALID_CHECKSUM);
|
||||
|
||||
return entropy.toString('hex');
|
||||
return entropy;
|
||||
}
|
||||
|
||||
export function entropyToMnemonic (entropy: Uint8Array): string {
|
||||
// 128 <= ENT <= 256
|
||||
if (entropy.length < 16) {
|
||||
throw new TypeError(INVALID_ENTROPY);
|
||||
}
|
||||
|
||||
if (entropy.length > 32) {
|
||||
throw new TypeError(INVALID_ENTROPY);
|
||||
} else if (entropy.length % 4 !== 0) {
|
||||
throw new TypeError(INVALID_ENTROPY);
|
||||
}
|
||||
assert(entropy.length % 4 === 0 && entropy.length >= 16 && entropy.length <= 32, INVALID_ENTROPY);
|
||||
|
||||
const entropyBits = bytesToBinary(Array.from(entropy));
|
||||
const checksumBits = deriveChecksumBits(entropy);
|
||||
|
||||
const bits = entropyBits + checksumBits;
|
||||
|
||||
// we just set it prior, so this is a safe check
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
const chunks = bits.match(/(.{1,11})/g)!;
|
||||
|
||||
const words = chunks.map(
|
||||
(binary: string): string => {
|
||||
const index = binaryToByte(binary);
|
||||
|
||||
return DEFAULT_WORDLIST[index];
|
||||
}
|
||||
);
|
||||
|
||||
return words.join(' ');
|
||||
return (entropyBits + checksumBits).match(/(.{1,11})/g)!
|
||||
.map((binary) => DEFAULT_WORDLIST[binaryToByte(binary)])
|
||||
.join(' ');
|
||||
}
|
||||
|
||||
export function generateMnemonic (strength?: number): string {
|
||||
strength = strength || 128;
|
||||
|
||||
if (strength % 32 !== 0) {
|
||||
throw new TypeError(INVALID_ENTROPY);
|
||||
}
|
||||
assert(strength % 32 === 0, INVALID_ENTROPY);
|
||||
|
||||
return entropyToMnemonic(randomAsU8a(strength / 8));
|
||||
}
|
||||
|
||||
@@ -11,24 +11,20 @@ describe('mnemonicGenerate', (): void => {
|
||||
});
|
||||
|
||||
it('generates a valid mnemonic (default strength)', (): void => {
|
||||
const mnemonic = generate();
|
||||
|
||||
console.error(mnemonic);
|
||||
|
||||
expect(
|
||||
validate(mnemonic)
|
||||
validate(generate())
|
||||
).toEqual(true);
|
||||
});
|
||||
|
||||
([12, 15, 18, 21, 24] as WordCount[]).forEach((num: WordCount): void => {
|
||||
it(`generates a valid mnemonic (${num} words)`, (): void => {
|
||||
const mnemonic = generate(num);
|
||||
const isValid = validate(mnemonic);
|
||||
[false, true].forEach((onlyJs): void => {
|
||||
const mnemonic = generate(num, onlyJs);
|
||||
const isValid = validate(mnemonic);
|
||||
|
||||
console.error(mnemonic);
|
||||
|
||||
expect(mnemonic.split(' ')).toHaveLength(num);
|
||||
expect(isValid).toEqual(true);
|
||||
expect(mnemonic.split(' ')).toHaveLength(num);
|
||||
expect(isValid).toEqual(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -30,8 +30,8 @@ const STRENGTH_MAP = {
|
||||
* const mnemonic = mnemonicGenerate(); // => string
|
||||
* ```
|
||||
*/
|
||||
export default function mnemonicGenerate (numWords: WordCount = 12): string {
|
||||
return isReady()
|
||||
export default function mnemonicGenerate (numWords: WordCount = 12, onlyJs = false): string {
|
||||
return isReady() && !onlyJs
|
||||
? bip39Generate(numWords)
|
||||
: generateMnemonic(STRENGTH_MAP[numWords]);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ describe('mnemonicToEntropy', (): void => {
|
||||
tests.forEach(([mnemonic, entropy], index): void => {
|
||||
it(`Created correct entropy for ${index}`, (): void => {
|
||||
expect(u8aToHex(toEntropy(mnemonic))).toEqual(entropy);
|
||||
expect(u8aToHex(toEntropy(mnemonic, true))).toEqual(entropy);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3,17 +3,12 @@
|
||||
|
||||
import '../polyfill';
|
||||
|
||||
import { hexAddPrefix, hexToU8a } from '@polkadot/util';
|
||||
import { bip39ToEntropy, isReady } from '@polkadot/wasm-crypto';
|
||||
|
||||
import { mnemonicToEntropy } from './bip39';
|
||||
|
||||
export default function toEntropy (mnemonic: string): Uint8Array {
|
||||
return isReady()
|
||||
export default function toEntropy (mnemonic: string, onlyJs = false): Uint8Array {
|
||||
return isReady() && !onlyJs
|
||||
? bip39ToEntropy(mnemonic)
|
||||
: hexToU8a(
|
||||
hexAddPrefix(
|
||||
mnemonicToEntropy(mnemonic)
|
||||
)
|
||||
);
|
||||
: mnemonicToEntropy(mnemonic);
|
||||
}
|
||||
|
||||
@@ -6,22 +6,20 @@ import { waitReady } from '@polkadot/wasm-crypto';
|
||||
|
||||
import { mnemonicToLegacySeed } from './';
|
||||
|
||||
const MENMONIC = 'seed sock milk update focus rotate barely fade car face mechanic mercy';
|
||||
const SEED = '0x3c121e20de068083b49c2315697fb59a2d9e8643c24e5ea7628132c58969a027';
|
||||
|
||||
describe('mnemonicToLegacySeed', (): void => {
|
||||
beforeEach(async (): Promise<void> => {
|
||||
await waitReady();
|
||||
});
|
||||
|
||||
it('generates a valid seed', (): void => {
|
||||
expect(
|
||||
u8aToHex(
|
||||
mnemonicToLegacySeed('seed sock milk update focus rotate barely fade car face mechanic mercy')
|
||||
)
|
||||
).toEqual('0x3c121e20de068083b49c2315697fb59a2d9e8643c24e5ea7628132c58969a027');
|
||||
});
|
||||
|
||||
it('generates the seed via WASM', async (): Promise<void> => {
|
||||
await waitReady();
|
||||
|
||||
u8aToHex(mnemonicToLegacySeed(MENMONIC))
|
||||
).toEqual(SEED);
|
||||
expect(
|
||||
u8aToHex(
|
||||
mnemonicToLegacySeed('seed sock milk update focus rotate barely fade car face mechanic mercy')
|
||||
)
|
||||
).toEqual('0x3c121e20de068083b49c2315697fb59a2d9e8643c24e5ea7628132c58969a027');
|
||||
u8aToHex(mnemonicToLegacySeed(MENMONIC, undefined, true))
|
||||
).toEqual(SEED);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -24,8 +24,8 @@ import { mnemonicToSeedSync } from './bip39';
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export default function toLegacy (mnemonic: string, password = ''): Uint8Array {
|
||||
return isReady()
|
||||
export default function toLegacy (mnemonic: string, password = '', onlyJs = false): Uint8Array {
|
||||
return isReady() && !onlyJs
|
||||
? bip39ToSeed(mnemonic, password)
|
||||
: bufferToU8a(mnemonicToSeedSync(mnemonic, password)).subarray(0, 32);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,9 @@ import mnemonicToMiniSecret from './toMiniSecret';
|
||||
import tests from '../schnorrkel/keypair/testing';
|
||||
import { cryptoWaitReady } from '..';
|
||||
|
||||
const MNEMONIC = 'seed sock milk update focus rotate barely fade car face mechanic mercy';
|
||||
const SEED = '0x4d1ab2a57929edfd018aaa974e62ed557e3f54b4104acabedf73c8f5a1dbb029';
|
||||
|
||||
describe('mnemonicToMiniSecret', (): void => {
|
||||
beforeEach(async (): Promise<void> => {
|
||||
await cryptoWaitReady();
|
||||
@@ -14,8 +17,11 @@ describe('mnemonicToMiniSecret', (): void => {
|
||||
|
||||
it('generates a valid seed', (): void => {
|
||||
expect(
|
||||
u8aToHex(mnemonicToMiniSecret('seed sock milk update focus rotate barely fade car face mechanic mercy'))
|
||||
).toEqual('0x4d1ab2a57929edfd018aaa974e62ed557e3f54b4104acabedf73c8f5a1dbb029');
|
||||
u8aToHex(mnemonicToMiniSecret(MNEMONIC))
|
||||
).toEqual(SEED);
|
||||
expect(
|
||||
u8aToHex(mnemonicToMiniSecret(MNEMONIC, undefined, true))
|
||||
).toEqual(SEED);
|
||||
});
|
||||
|
||||
tests.forEach(([mnemonic, , seed], index): void => {
|
||||
@@ -26,6 +32,12 @@ describe('mnemonicToMiniSecret', (): void => {
|
||||
// mini returned here, only check first 32-bytes (64 hex + 2 prefix)
|
||||
seed.substr(0, 66)
|
||||
);
|
||||
expect(
|
||||
u8aToHex(mnemonicToMiniSecret(mnemonic, 'Substrate', true))
|
||||
).toEqual(
|
||||
// mini returned here, only check first 32-bytes (64 hex + 2 prefix)
|
||||
seed.substr(0, 66)
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -9,8 +9,8 @@ import { bip39ToMiniSecret, isReady } from '@polkadot/wasm-crypto';
|
||||
|
||||
import toEntropy from './toEntropy';
|
||||
|
||||
export default function toMiniSecret (mnemonic: string, password = ''): Uint8Array {
|
||||
if (isReady()) {
|
||||
export default function toMiniSecret (mnemonic: string, password = '', onlyJs = false): Uint8Array {
|
||||
if (isReady() && !onlyJs) {
|
||||
return bip39ToMiniSecret(mnemonic, password);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,11 +13,17 @@ describe('mnemonicValidate', (): void => {
|
||||
expect(
|
||||
validate('seed sock milk update focus rotate barely fade car face mechanic mercy')
|
||||
).toEqual(true);
|
||||
expect(
|
||||
validate('seed sock milk update focus rotate barely fade car face mechanic mercy', true)
|
||||
).toEqual(true);
|
||||
});
|
||||
|
||||
it('returns false on invalid', (): void => {
|
||||
expect(
|
||||
validate('wine photo extra cushion basket dwarf humor cloud truck job boat submit')
|
||||
).toEqual(false);
|
||||
expect(
|
||||
validate('wine photo extra cushion basket dwarf humor cloud truck job boat submit', true)
|
||||
).toEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -20,8 +20,8 @@ import { validateMnemonic } from './bip39';
|
||||
* const isValidMnemonic = mnemonicValidate(mnemonic); // => boolean
|
||||
* ```
|
||||
*/
|
||||
export default function mnemonicValidate (mnemonic: string): boolean {
|
||||
return isReady()
|
||||
export default function mnemonicValidate (mnemonic: string, onlyJs = false): boolean {
|
||||
return isReady() && !onlyJs
|
||||
? bip39Validate(mnemonic)
|
||||
: validateMnemonic(mnemonic);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/util",
|
||||
"version": "3.6.2-12",
|
||||
"version": "3.7.0",
|
||||
"description": "A collection of useful utilities for @polkadot",
|
||||
"main": "index.js",
|
||||
"keywords": [
|
||||
@@ -26,8 +26,8 @@
|
||||
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/util#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.1",
|
||||
"@polkadot/x-textdecoder": "^3.6.2-12",
|
||||
"@polkadot/x-textencoder": "^3.6.2-12",
|
||||
"@polkadot/x-textdecoder": "^3.7.0",
|
||||
"@polkadot/x-textencoder": "^3.7.0",
|
||||
"@types/bn.js": "^4.11.6",
|
||||
"bn.js": "^5.1.3",
|
||||
"camelcase": "^5.3.1",
|
||||
|
||||
@@ -12,6 +12,15 @@ interface Options extends ToBnOptions {
|
||||
bitLength?: number;
|
||||
}
|
||||
|
||||
function setBn (valueBn: BN, byteLength: number, { isLe, isNegative }: Options): Uint8Array {
|
||||
const output = new Uint8Array(byteLength);
|
||||
const bn = isNegative ? valueBn.toTwos(byteLength * 8) : valueBn;
|
||||
|
||||
output.set(bn.toArray(isLe ? 'le' : 'be', byteLength), 0);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name bnToU8a
|
||||
* @summary Creates a Uint8Array object from a BN.
|
||||
@@ -29,7 +38,7 @@ interface Options extends ToBnOptions {
|
||||
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 = {
|
||||
const options: Options = {
|
||||
bitLength: -1,
|
||||
isLe: true,
|
||||
isNegative: false,
|
||||
@@ -37,25 +46,15 @@ function bnToU8a <ExtToBn extends ToBn> (value?: ExtToBn | BN | BigInt | number
|
||||
};
|
||||
|
||||
const valueBn = bnToBn(value);
|
||||
const byteLength = _options.bitLength === -1
|
||||
const byteLength = options.bitLength === -1
|
||||
? Math.ceil(valueBn.bitLength() / 8)
|
||||
: Math.ceil((_options.bitLength || 0) / 8);
|
||||
: Math.ceil((options.bitLength || 0) / 8);
|
||||
|
||||
if (!value) {
|
||||
return _options.bitLength === -1
|
||||
return value
|
||||
? setBn(valueBn, byteLength, options)
|
||||
: options.bitLength === -1
|
||||
? new Uint8Array()
|
||||
: new Uint8Array(byteLength);
|
||||
}
|
||||
|
||||
const output = new Uint8Array(byteLength);
|
||||
const bn = _options.isNegative ? valueBn.toTwos(byteLength * 8) : valueBn;
|
||||
|
||||
output.set(
|
||||
bn.toArray(_options.isLe ? 'le' : 'be', byteLength),
|
||||
0
|
||||
);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
export default bnToU8a;
|
||||
|
||||
@@ -20,6 +20,12 @@ describe('formatBalance', (): void => {
|
||||
).toEqual('123.4567 µUnit');
|
||||
});
|
||||
|
||||
it('formats 123,456 (decimals=0)', (): void => {
|
||||
expect(
|
||||
formatBalance(123456, { decimals: 0, withSi: true })
|
||||
).toEqual('123.4560 kUnit');
|
||||
});
|
||||
|
||||
it('formats BigInt numbers', (): void => {
|
||||
expect(
|
||||
formatBalance(123456789000n, { decimals: 15, withSi: true })
|
||||
|
||||
@@ -61,8 +61,8 @@ function _formatBalance <ExtToBn extends ToBn> (input?: number | string | BN | B
|
||||
: options;
|
||||
|
||||
// NOTE We start at midpoint (8) minus 1 - this means that values display as
|
||||
// 123.456 instead of 0.123k (so always 6 relevant). Additionally we us ceil
|
||||
// so there are at most 3 decimal before the decimal seperator
|
||||
// 123.456 instead of 0.123k (so always 6 relevant). Additionally we use ceil
|
||||
// so there are at most 3 decimal before the decimal separator
|
||||
const si = calcSi(text, decimals, forceUnit);
|
||||
const mid = text.length - (decimals + si.power);
|
||||
const prefix = text.substr(0, mid);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2017-2020 @polkadot/util authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// eslint-disable-next-line prefer-regex-literals
|
||||
const NUMBER_REGEX = new RegExp('(\\d+?)(?=(\\d{3})+(?!\\d)|$)', 'g');
|
||||
|
||||
export default function formatDecimal (value: string): string {
|
||||
|
||||
@@ -8,37 +8,38 @@ import BN from 'bn.js';
|
||||
import isToBn from '../is/toBn';
|
||||
|
||||
function getValue <ExtToBn extends ToBn> (value?: BN | ExtToBn | Date | number | null): number {
|
||||
if (value) {
|
||||
if (isToBn(value)) {
|
||||
return getValue(value.toBn());
|
||||
} else if (value instanceof Date) {
|
||||
return getValue(value.getTime());
|
||||
} else if (value instanceof BN) {
|
||||
return getValue(value.toNumber());
|
||||
}
|
||||
if (isToBn(value)) {
|
||||
return getValue(value.toBn());
|
||||
} else if (value instanceof Date) {
|
||||
return getValue(value.getTime());
|
||||
} else if (value instanceof BN) {
|
||||
return getValue(value.toNumber());
|
||||
}
|
||||
|
||||
return (value as number) || 0;
|
||||
return value || 0;
|
||||
}
|
||||
|
||||
function formatValue (elapsed: number): string {
|
||||
if (elapsed < 15) {
|
||||
return `${elapsed.toFixed(1)}s`;
|
||||
} else if (elapsed < 60) {
|
||||
return `${elapsed | 0}s`;
|
||||
} else if (elapsed < 3600) {
|
||||
return `${elapsed / 60 | 0}m`;
|
||||
}
|
||||
|
||||
return `${elapsed / 3600 | 0}h`;
|
||||
}
|
||||
|
||||
export default function formatElapsed <ExtToBn extends ToBn> (now?: Date | null, value?: BN | ExtToBn | Date | number | null): string {
|
||||
const tsNow = (now && now.getTime()) || 0;
|
||||
const tsValue = getValue(value);
|
||||
let display = '0.0s';
|
||||
|
||||
if (tsNow && tsValue) {
|
||||
const elapsed = Math.max(Math.abs(tsNow - tsValue), 0) / 1000;
|
||||
|
||||
if (elapsed < 15) {
|
||||
display = `${elapsed.toFixed(1)}s`;
|
||||
} else if (elapsed < 60) {
|
||||
display = `${elapsed | 0}s`;
|
||||
} else if (elapsed < 3600) {
|
||||
display = `${elapsed / 60 | 0}m`;
|
||||
} else {
|
||||
display = `${elapsed / 3600 | 0}h`;
|
||||
}
|
||||
return formatValue(elapsed);
|
||||
}
|
||||
|
||||
return display;
|
||||
return '0.0s';
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import hexStripPrefix from './stripPrefix';
|
||||
import { ToBnOptions } from '../types';
|
||||
|
||||
function reverse (value: string): string {
|
||||
return (value.match(new RegExp('.{1,2}', 'g')) || [])
|
||||
return (value.match(/.{1,2}/g) || [])
|
||||
.reverse()
|
||||
.join('');
|
||||
}
|
||||
|
||||
@@ -13,11 +13,7 @@ const FORMAT = [9, 10, 13];
|
||||
* Checks to see if the input string or Uint8Array is printable ASCII, 32-127 + formatters
|
||||
*/
|
||||
export default function isAscii (value?: number[] | Buffer | Uint8Array | string | null): boolean {
|
||||
if (!value) {
|
||||
return isString(value);
|
||||
}
|
||||
|
||||
const u8a = u8aToU8a(value);
|
||||
|
||||
return !u8a.some((byte) => (byte >= 127) || (byte < 32 && !FORMAT.includes(byte)));
|
||||
return value
|
||||
? !u8aToU8a(value).some((byte) => (byte >= 127) || (byte < 32 && !FORMAT.includes(byte)))
|
||||
: isString(value);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2020 @polkadot/util authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
const re = new RegExp('(Development|Local Testnet)$');
|
||||
const re = /(Development|Local Testnet)$/;
|
||||
|
||||
export default function isTestChain (chain?: string | null): boolean {
|
||||
if (!chain) {
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
import { Logger } from './types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
|
||||
import { logger } from '.';
|
||||
import { format } from './logger';
|
||||
|
||||
@@ -62,15 +64,17 @@ describe('logger', (): void => {
|
||||
);
|
||||
});
|
||||
|
||||
it('logs with mulptiple values', (): void => {
|
||||
l.log('test', 'a', 2);
|
||||
it('logs with multiple values', (): void => {
|
||||
l.log('test', 'a', 2, new BN('12345678900987654321'), Buffer.from([0, 1, 2, 3]));
|
||||
|
||||
expect(spy.log).toHaveBeenCalledWith(
|
||||
dateMatch,
|
||||
prefixMatch,
|
||||
expect.stringMatching('test'),
|
||||
expect.stringMatching('a'),
|
||||
2
|
||||
2,
|
||||
expect.stringMatching('12345678900987654321'),
|
||||
expect.stringMatching('0x00010203')
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -5,11 +5,12 @@ import { Logger, Logger$Data } from './types';
|
||||
|
||||
import formatDate from './format/formatDate';
|
||||
import isBn from './is/bn';
|
||||
import isBuffer from './is/buffer';
|
||||
import isFunction from './is/function';
|
||||
import isObject from './is/object';
|
||||
import isU8a from './is/u8a';
|
||||
import u8aToHex from './u8a/toHex';
|
||||
import u8aToU8a from './u8a/toU8a';
|
||||
import { isBuffer } from './is';
|
||||
|
||||
type ConsoleType = 'error' | 'log' | 'warn';
|
||||
type LogType = ConsoleType | 'debug';
|
||||
@@ -34,21 +35,11 @@ function formatObject (value: Record<string, unknown>): Record<string, unknown>
|
||||
export function format (value: unknown): unknown {
|
||||
if (Array.isArray(value)) {
|
||||
return value.map(format);
|
||||
}
|
||||
|
||||
if (isBn(value)) {
|
||||
} else if (isBn(value)) {
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
if (isBuffer(value)) {
|
||||
return `0x${value.toString('hex')}`;
|
||||
}
|
||||
|
||||
if (isU8a(value)) {
|
||||
return u8aToHex(value);
|
||||
}
|
||||
|
||||
if (value && isObject(value) && value.constructor === Object) {
|
||||
} else if (isU8a(value) || isBuffer(value)) {
|
||||
return u8aToHex(u8aToU8a(value));
|
||||
} else if (value && isObject(value) && value.constructor === Object) {
|
||||
return formatObject(value);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,50 +2,30 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* eslint-disable no-extend-native */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
|
||||
import assert from '../assert';
|
||||
|
||||
function getOffset (value: number, length: number): number {
|
||||
return value < 0
|
||||
? Math.max(length + value, 0)
|
||||
: Math.min(value, length);
|
||||
}
|
||||
|
||||
if (!Array.prototype.fill) {
|
||||
// eslint-disable-next-line no-extend-native,@typescript-eslint/no-explicit-any
|
||||
Array.prototype.fill = function fill (value: any, start = 0, end?: number): any[] {
|
||||
// Steps 1-2.
|
||||
if (!this) {
|
||||
throw new TypeError('this is null or not defined');
|
||||
}
|
||||
// eslint-disable-next-line no-extend-native
|
||||
Array.prototype.fill = function fill <T> (value: T, start = 0, end?: number): T[] {
|
||||
assert(this, 'this is null or not defined');
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
const A = Object(this);
|
||||
const A = Object(this) as T[];
|
||||
const relativeEnd = end ?? A.length;
|
||||
const final = getOffset(relativeEnd, A.length);
|
||||
let k = getOffset(start, A.length);
|
||||
|
||||
// Steps 3-5.
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
const len = A.length >>> 0;
|
||||
|
||||
// Steps 6-7.
|
||||
const relativeStart = start >> 0;
|
||||
|
||||
// Step 8.
|
||||
let k = relativeStart < 0
|
||||
? Math.max(len + relativeStart, 0)
|
||||
: Math.min(relativeStart, len);
|
||||
|
||||
// Steps 9-10.
|
||||
const relativeEnd = end === undefined
|
||||
? len
|
||||
: end >> 0;
|
||||
|
||||
// Step 11.
|
||||
const final = relativeEnd < 0
|
||||
? Math.max(len + relativeEnd, 0)
|
||||
: Math.min(relativeEnd, len);
|
||||
|
||||
// Step 12.
|
||||
while (k < final) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
|
||||
A[k] = value;
|
||||
k++;
|
||||
}
|
||||
|
||||
// Step 13.
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
return A;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7,6 +7,22 @@ for (let n = 0; n < 256; ++n) {
|
||||
ALPHABET[n] = n.toString(16).padStart(2, '0');
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
function extract (value: Uint8Array): string {
|
||||
const result = new Array(value.length) as string[];
|
||||
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
result[i] = ALPHABET[value[i]];
|
||||
}
|
||||
|
||||
return result.join('');
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
function trim (value: Uint8Array, halfLength: number): string {
|
||||
return `${u8aToHex(value.subarray(0, halfLength), -1, false)}…${u8aToHex(value.subarray(value.length - halfLength), -1, false)}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name u8aToHex
|
||||
* @summary Creates a hex string from a Uint8Array object.
|
||||
@@ -32,17 +48,8 @@ export default function u8aToHex (value?: Uint8Array | null, bitLength = -1, isP
|
||||
|
||||
const byteLength = Math.ceil(bitLength / 8);
|
||||
|
||||
if (byteLength > 0 && value.length > byteLength) {
|
||||
const halfLength = Math.ceil(byteLength / 2);
|
||||
|
||||
return `${u8aToHex(value.subarray(0, halfLength), -1, isPrefixed)}…${u8aToHex(value.subarray(value.length - halfLength), -1, false)}`;
|
||||
}
|
||||
|
||||
const result = new Array(value.length) as string[];
|
||||
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
result[i] = ALPHABET[value[i]];
|
||||
}
|
||||
|
||||
return prefix + result.join('');
|
||||
return prefix + ((byteLength > 0 && value.length > byteLength)
|
||||
? trim(value, Math.ceil(byteLength / 2))
|
||||
: extract(value)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/x-fetch",
|
||||
"version": "3.6.2-12",
|
||||
"version": "3.7.0",
|
||||
"description": "A cross-environment fetch replacement",
|
||||
"browser": "browser.js",
|
||||
"main": "node.js",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/x-textdecoder",
|
||||
"version": "3.6.2-12",
|
||||
"version": "3.7.0",
|
||||
"description": "A TextDecoder replacement",
|
||||
"browser": "browser.js",
|
||||
"main": "node.js",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/x-textencoder",
|
||||
"version": "3.6.2-12",
|
||||
"version": "3.7.0",
|
||||
"description": "A TextDecoder replacement",
|
||||
"browser": "browser.js",
|
||||
"main": "node.js",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/x-ws",
|
||||
"version": "3.6.2-12",
|
||||
"version": "3.7.0",
|
||||
"description": "A cross-environment WebSocket replacement",
|
||||
"browser": "browser.js",
|
||||
"main": "node.js",
|
||||
|
||||
@@ -1443,9 +1443,9 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@eslint/eslintrc@npm:^0.1.3":
|
||||
version: 0.1.3
|
||||
resolution: "@eslint/eslintrc@npm:0.1.3"
|
||||
"@eslint/eslintrc@npm:^0.2.1":
|
||||
version: 0.2.1
|
||||
resolution: "@eslint/eslintrc@npm:0.2.1"
|
||||
dependencies:
|
||||
ajv: ^6.12.4
|
||||
debug: ^4.1.1
|
||||
@@ -1457,7 +1457,7 @@ __metadata:
|
||||
lodash: ^4.17.19
|
||||
minimatch: ^3.0.4
|
||||
strip-json-comments: ^3.1.1
|
||||
checksum: e9c5eaa5e706bcedbba6e7e1a2bc85faa7e3a9edbe71375e07240d1b6540fbb88d907bd5e5841b42c2a7a9683dcf031ea052c447c3c9d81ba4d0b74f0dd67e5f
|
||||
checksum: 99310cddf0f1abb2de4b5278293db6e2639445aab4e525f3c5f5b3b8ad53a59d6003a306954fb7ad15edd2f8a02b658d43418fa8b52ae2d07e074b24d991de2a
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -1712,9 +1712,9 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@polkadot/dev@npm:^0.59.10":
|
||||
version: 0.59.10
|
||||
resolution: "@polkadot/dev@npm:0.59.10"
|
||||
"@polkadot/dev@npm:^0.59.12":
|
||||
version: 0.59.12
|
||||
resolution: "@polkadot/dev@npm:0.59.12"
|
||||
dependencies:
|
||||
"@babel/cli": ^7.12.1
|
||||
"@babel/core": ^7.12.3
|
||||
@@ -1736,7 +1736,7 @@ __metadata:
|
||||
"@babel/preset-typescript": ^7.12.1
|
||||
"@babel/register": ^7.12.1
|
||||
"@babel/runtime": ^7.12.1
|
||||
"@rushstack/eslint-patch": ^1.0.5
|
||||
"@rushstack/eslint-patch": ^1.0.6
|
||||
"@typescript-eslint/eslint-plugin": 4.6.0
|
||||
"@typescript-eslint/parser": 4.6.0
|
||||
"@vue/component-compiler-utils": ^3.2.0
|
||||
@@ -1747,8 +1747,8 @@ __metadata:
|
||||
browserslist: ^4.14.5
|
||||
chalk: ^4.1.0
|
||||
coveralls: ^3.1.0
|
||||
eslint: 7.11.0
|
||||
eslint-config-standard: ^15.0.1
|
||||
eslint: ^7.12.1
|
||||
eslint-config-standard: ^16.0.1
|
||||
eslint-import-resolver-node: ^0.3.4
|
||||
eslint-plugin-header: ^3.1.0
|
||||
eslint-plugin-import: ^2.22.1
|
||||
@@ -1801,7 +1801,7 @@ __metadata:
|
||||
polkadot-exec-typedoc: scripts/polkadot-exec-typedoc.js
|
||||
polkadot-exec-vuepress: scripts/polkadot-exec-vuepress.js
|
||||
polkadot-exec-webpack: scripts/polkadot-exec-webpack.js
|
||||
checksum: 6bca7dd879f80c49637015475492c979e092b2aa68c925337709d5a142c2ba7496ab984d1012b2c5a429d30d47e128651b8af6cb074a81acbd0d8275a3c8b646
|
||||
checksum: e683db199506c22492c1a41b838844453620cbf4356920772f785618eabd056a3a8bc47a2da2e3ad5be7b58f14e0bbad2fa28458a4eca72e5156b28682ff19d9
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -1810,18 +1810,18 @@ __metadata:
|
||||
resolution: "@polkadot/keyring@workspace:packages/keyring"
|
||||
dependencies:
|
||||
"@babel/runtime": ^7.12.1
|
||||
"@polkadot/util": ^3.6.2-12
|
||||
"@polkadot/util-crypto": ^3.6.2-12
|
||||
"@polkadot/util": ^3.7.0
|
||||
"@polkadot/util-crypto": ^3.7.0
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@polkadot/networks@^3.6.2-12, @polkadot/networks@workspace:packages/networks":
|
||||
"@polkadot/networks@^3.7.0, @polkadot/networks@workspace:packages/networks":
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@polkadot/networks@workspace:packages/networks"
|
||||
dependencies:
|
||||
"@babel/runtime": ^7.12.1
|
||||
"@polkadot/util": ^3.6.2-12
|
||||
"@polkadot/x-fetch": ^3.6.2-12
|
||||
"@polkadot/util": ^3.7.0
|
||||
"@polkadot/x-fetch": ^3.7.0
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
@@ -1834,13 +1834,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@polkadot/util-crypto@^3.6.2-12, @polkadot/util-crypto@workspace:packages/util-crypto":
|
||||
"@polkadot/util-crypto@^3.7.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.12.1
|
||||
"@polkadot/networks": ^3.6.2-12
|
||||
"@polkadot/util": ^3.6.2-12
|
||||
"@polkadot/networks": ^3.7.0
|
||||
"@polkadot/util": ^3.7.0
|
||||
"@polkadot/wasm-crypto": ^1.4.1
|
||||
"@types/bn.js": ^4.11.6
|
||||
"@types/create-hash": ^1.2.2
|
||||
@@ -1861,13 +1861,13 @@ __metadata:
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@polkadot/util@^3.6.2-12, @polkadot/util@workspace:packages/util":
|
||||
"@polkadot/util@^3.7.0, @polkadot/util@workspace:packages/util":
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@polkadot/util@workspace:packages/util"
|
||||
dependencies:
|
||||
"@babel/runtime": ^7.12.1
|
||||
"@polkadot/x-textdecoder": ^3.6.2-12
|
||||
"@polkadot/x-textencoder": ^3.6.2-12
|
||||
"@polkadot/x-textdecoder": ^3.7.0
|
||||
"@polkadot/x-textencoder": ^3.7.0
|
||||
"@types/bn.js": ^4.11.6
|
||||
bn.js: ^5.1.3
|
||||
camelcase: ^5.3.1
|
||||
@@ -1884,7 +1884,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@polkadot/x-fetch@^3.6.2-12, @polkadot/x-fetch@workspace:packages/x-fetch":
|
||||
"@polkadot/x-fetch@^3.7.0, @polkadot/x-fetch@workspace:packages/x-fetch":
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@polkadot/x-fetch@workspace:packages/x-fetch"
|
||||
dependencies:
|
||||
@@ -1894,7 +1894,7 @@ __metadata:
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@polkadot/x-textdecoder@^3.6.2-12, @polkadot/x-textdecoder@workspace:packages/x-textdecoder":
|
||||
"@polkadot/x-textdecoder@^3.7.0, @polkadot/x-textdecoder@workspace:packages/x-textdecoder":
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@polkadot/x-textdecoder@workspace:packages/x-textdecoder"
|
||||
dependencies:
|
||||
@@ -1902,7 +1902,7 @@ __metadata:
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@polkadot/x-textencoder@^3.6.2-12, @polkadot/x-textencoder@workspace:packages/x-textencoder":
|
||||
"@polkadot/x-textencoder@^3.7.0, @polkadot/x-textencoder@workspace:packages/x-textencoder":
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@polkadot/x-textencoder@workspace:packages/x-textencoder"
|
||||
dependencies:
|
||||
@@ -1920,10 +1920,10 @@ __metadata:
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@rushstack/eslint-patch@npm:^1.0.5":
|
||||
version: 1.0.5
|
||||
resolution: "@rushstack/eslint-patch@npm:1.0.5"
|
||||
checksum: 76891efcaee71feea5446110d7ea382e51c8d91bf3fd6627c042f3b6bccdbb78085935eaff005bbe0d64ac503f221f3cd33b8add7487464d11eb6d6addd37771
|
||||
"@rushstack/eslint-patch@npm:^1.0.6":
|
||||
version: 1.0.6
|
||||
resolution: "@rushstack/eslint-patch@npm:1.0.6"
|
||||
checksum: cc01301f09d881da550a2f3c6a3f10b72dfb4c422b7a00a4b2e8bfc90d998aee06f08a6e7c9d03db89d5b286318d533435dc6c8c500884fe6ab05cb1309dfcc7
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -1962,15 +1962,15 @@ __metadata:
|
||||
linkType: hard
|
||||
|
||||
"@types/babel__core@npm:^7.0.0, @types/babel__core@npm:^7.1.7":
|
||||
version: 7.1.10
|
||||
resolution: "@types/babel__core@npm:7.1.10"
|
||||
version: 7.1.11
|
||||
resolution: "@types/babel__core@npm:7.1.11"
|
||||
dependencies:
|
||||
"@babel/parser": ^7.1.0
|
||||
"@babel/types": ^7.0.0
|
||||
"@types/babel__generator": "*"
|
||||
"@types/babel__template": "*"
|
||||
"@types/babel__traverse": "*"
|
||||
checksum: fd013086d241527c708844ff379ec5204b31dfb4e50a427bc24e77172af74041f6eab650da16edf1a20f445595052505792ec7fa1978bb5f8f2c191bfc8c767d
|
||||
checksum: 081ea9a093ce22ebbc7fd07c07298d84d551f1517159631a69953634509e88324d26199b012a20cca5da116222f9f3468b1ee98eb78f6bb4efb909c0e856f272
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -2065,9 +2065,9 @@ __metadata:
|
||||
linkType: hard
|
||||
|
||||
"@types/har-format@npm:*":
|
||||
version: 1.2.4
|
||||
resolution: "@types/har-format@npm:1.2.4"
|
||||
checksum: 8d0c62f99ea579b6aa23219f9e97c8ef70dc0254a419b4c9a2c602860f7d3d6da7cb867da4b15087d7bf2588f8dd40b6f941350ba2c04168a67892b5f2661fad
|
||||
version: 1.2.5
|
||||
resolution: "@types/har-format@npm:1.2.5"
|
||||
checksum: 1dbaa1d7cddb2fa0ddf533e8ae7f20bca2116738274a1a1e9fe2863b6c26e668b59ac4dfdfb45450d5c374de689721647ca891aa342e239049f69d5de3604cd9
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -2736,9 +2736,9 @@ __metadata:
|
||||
linkType: hard
|
||||
|
||||
"aws4@npm:^1.8.0":
|
||||
version: 1.10.1
|
||||
resolution: "aws4@npm:1.10.1"
|
||||
checksum: 53f2897324997542e3cfeca0b24f5960e2470eb8527f0b6587432a4607dcb8ca817955aef4297a3b429f1ca5fa688ba1b6bc57d744add41292ffcb59466392bb
|
||||
version: 1.11.0
|
||||
resolution: "aws4@npm:1.11.0"
|
||||
checksum: d30dce2b73839974894d8283a06c53e8374b74d643d3b08340d84c364e01158be011fcfd1a88f8462be946d69055313a3038202f2eafd155b039aaab3549ba21
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -3059,12 +3059,12 @@ __metadata:
|
||||
linkType: hard
|
||||
|
||||
"bufferutil@npm:^4.0.1":
|
||||
version: 4.0.1
|
||||
resolution: "bufferutil@npm:4.0.1"
|
||||
version: 4.0.2
|
||||
resolution: "bufferutil@npm:4.0.2"
|
||||
dependencies:
|
||||
node-gyp: latest
|
||||
node-gyp-build: ~3.7.0
|
||||
checksum: f83b1ce112ffe60812573facf01a0c33e856a757a37d34afaafa73ff82bcd32ed816a0c22bfc31e108d9bbce6faa4886747e1f512899fb6235a3e3896bbe38c3
|
||||
node-gyp-build: ^4.2.0
|
||||
checksum: cb71bbdc609b6de49aaf2ff45fac5c64c55ff965f6bfe6f2bc357cc05afce69206a9ca1567011951b3f18b54dca24ef21be407d8ffce5a38a5f87bc2416140dd
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -3100,6 +3100,16 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"call-bind@npm:^1.0.0":
|
||||
version: 1.0.0
|
||||
resolution: "call-bind@npm:1.0.0"
|
||||
dependencies:
|
||||
function-bind: ^1.1.1
|
||||
get-intrinsic: ^1.0.0
|
||||
checksum: aeb82f8f5dfd56592c7dcef89367227daa60be4f8e7fdb7689d6c1f8712872911d7e31fddd3336534f45cea56d9a4e7d48889596ce6d2f1ada4507573306e6b1
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"callsites@npm:^3.0.0":
|
||||
version: 3.1.0
|
||||
resolution: "callsites@npm:3.1.0"
|
||||
@@ -3122,9 +3132,9 @@ __metadata:
|
||||
linkType: hard
|
||||
|
||||
"caniuse-lite@npm:^1.0.30001135":
|
||||
version: 1.0.30001153
|
||||
resolution: "caniuse-lite@npm:1.0.30001153"
|
||||
checksum: 070c4a2c7f04e1fd00cdb12393a5f09d414d681814e5860626a1769a40474e7251a3d3ad0b988df25d37d0036580b2578a151fe4cdff571714f55b0f0f1afe57
|
||||
version: 1.0.30001154
|
||||
resolution: "caniuse-lite@npm:1.0.30001154"
|
||||
checksum: 7e087e61d039da66d64595c64afc50032a7bb90d2a96859ad17272031d48806c59488aba04f2f69c98238c293167ec4b2e510a6f8ccf8d90705b340a77961aed
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -4055,9 +4065,9 @@ __metadata:
|
||||
linkType: hard
|
||||
|
||||
"electron-to-chromium@npm:^1.3.571":
|
||||
version: 1.3.584
|
||||
resolution: "electron-to-chromium@npm:1.3.584"
|
||||
checksum: 34064db714d728f4495557eba05f454f0adb0de73c0b9125eb5fb837eb05fc42790e2e1a4df22b978176f2b8d30da2396132ba4abdb3cd26fe248085cc82f212
|
||||
version: 1.3.585
|
||||
resolution: "electron-to-chromium@npm:1.3.585"
|
||||
checksum: a7cd8515631144a05e065d19ec6cc1ace5547f7bd81af5815f8dd4f2ff14cd1fd1aef95a6628b24e20d63b35fdaf5304efbb597231f0efa4670fde905e5a6b06
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -4289,16 +4299,15 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"eslint-config-standard@npm:^15.0.1":
|
||||
version: 15.0.1
|
||||
resolution: "eslint-config-standard@npm:15.0.1"
|
||||
"eslint-config-standard@npm:^16.0.1":
|
||||
version: 16.0.1
|
||||
resolution: "eslint-config-standard@npm:16.0.1"
|
||||
peerDependencies:
|
||||
eslint: ">=7.11.0"
|
||||
eslint-plugin-import: ">=2.22.1"
|
||||
eslint-plugin-node: ">=11.1.0"
|
||||
eslint-plugin-promise: ">=4.2.1"
|
||||
eslint-plugin-standard: ">=4.0.2"
|
||||
checksum: e5e234126d309b37d25bc00d436b4cb3460ca818ed87411e241c69ef69c87fae217fea832028998e41b378a677e02994256963fbfb31dcd2bc2a96d42858d0e3
|
||||
eslint: ^7.12.1
|
||||
eslint-plugin-import: ^2.22.1
|
||||
eslint-plugin-node: ^11.1.0
|
||||
eslint-plugin-promise: ^4.2.1
|
||||
checksum: 496bd25045dd8cfba1d34d9b1d1cdd34a3243eebf924b147e9cf51661342a77a0af03582dd1fd4968101700f61d55a5437b14a12a90ef9b4c5d759065cc39449
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -4472,12 +4481,12 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"eslint@npm:7.11.0":
|
||||
version: 7.11.0
|
||||
resolution: "eslint@npm:7.11.0"
|
||||
"eslint@npm:^7.12.1":
|
||||
version: 7.12.1
|
||||
resolution: "eslint@npm:7.12.1"
|
||||
dependencies:
|
||||
"@babel/code-frame": ^7.0.0
|
||||
"@eslint/eslintrc": ^0.1.3
|
||||
"@eslint/eslintrc": ^0.2.1
|
||||
ajv: ^6.10.0
|
||||
chalk: ^4.0.0
|
||||
cross-spawn: ^7.0.2
|
||||
@@ -4515,7 +4524,7 @@ __metadata:
|
||||
v8-compile-cache: ^2.0.3
|
||||
bin:
|
||||
eslint: bin/eslint.js
|
||||
checksum: 45ef6dc7b31684ca0f383ed9c6224e763197e1d49745542f4440e37286c947973388a6a7ebbf103eeee91ddb4af2652c5d22718f4130bfbbf4bd16a04103f82a
|
||||
checksum: b3d11ea516d2932db5854ea942a546b711e6ee8735306627042bb9e2539e96844cc62cdb5826039f5d0509202936045c2cd7b84b457004c891a326f8eccae333
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -5164,6 +5173,17 @@ fsevents@^1.2.7:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"get-intrinsic@npm:^1.0.0":
|
||||
version: 1.0.1
|
||||
resolution: "get-intrinsic@npm:1.0.1"
|
||||
dependencies:
|
||||
function-bind: ^1.1.1
|
||||
has: ^1.0.3
|
||||
has-symbols: ^1.0.1
|
||||
checksum: c38bc558f1eca73bde2d9e22c7798b06c4b93650f39b2053a875a23a6c00fbafb0919ad20fe0d3a3e16916a8a59450502f91e75a918d264456c8ded070fe93c4
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"get-own-enumerable-property-symbols@npm:^3.0.0":
|
||||
version: 3.0.2
|
||||
resolution: "get-own-enumerable-property-symbols@npm:3.0.2"
|
||||
@@ -6901,15 +6921,15 @@ fsevents@^1.2.7:
|
||||
linkType: hard
|
||||
|
||||
"jsonfile@npm:^6.0.1":
|
||||
version: 6.0.1
|
||||
resolution: "jsonfile@npm:6.0.1"
|
||||
version: 6.1.0
|
||||
resolution: "jsonfile@npm:6.1.0"
|
||||
dependencies:
|
||||
graceful-fs: ^4.1.6
|
||||
universalify: ^1.0.0
|
||||
universalify: ^2.0.0
|
||||
dependenciesMeta:
|
||||
graceful-fs:
|
||||
optional: true
|
||||
checksum: ebd6932424db468226b0b525b5b8acefd97e46f4fc5f36232c94e928b405716b47b2d7c2342025ecd7a0219f2146ae613d33878b917505698b7dc36ebe082c11
|
||||
checksum: 9419c886abc6f8a5088cbb222b7bc17c76e8ee9f6c0e5c38781a4e09488166084f25247bc0b58e025b08c43064c82ae860ad89a992e35fc8cfae639323b7edbc
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -7572,14 +7592,14 @@ fsevents@^1.2.7:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"node-gyp-build@npm:~3.7.0":
|
||||
version: 3.7.0
|
||||
resolution: "node-gyp-build@npm:3.7.0"
|
||||
"node-gyp-build@npm:^4.2.0":
|
||||
version: 4.2.3
|
||||
resolution: "node-gyp-build@npm:4.2.3"
|
||||
bin:
|
||||
node-gyp-build: ./bin.js
|
||||
node-gyp-build-optional: ./optional.js
|
||||
node-gyp-build-test: ./build-test.js
|
||||
checksum: 61c7f2a9e44c5b23a0dc830e98cb0de3364894091daae0da471797627acedd06fe108107f4c840c2b0ff8bcfbdac8ec0c1767a3e159941eadd4c8fbbdc29a586
|
||||
node-gyp-build: bin.js
|
||||
node-gyp-build-optional: optional.js
|
||||
node-gyp-build-test: build-test.js
|
||||
checksum: 8512c25498b1605dbe9d2605cac7f8996d18c35097b3079b232674b0f3b8f1559be6f531ec3a00a94f90a0a69ccc452edb62f8f6dfff8caa3abe4b729cc21b06
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -7632,9 +7652,9 @@ fsevents@^1.2.7:
|
||||
linkType: hard
|
||||
|
||||
"node-releases@npm:^1.1.61":
|
||||
version: 1.1.64
|
||||
resolution: "node-releases@npm:1.1.64"
|
||||
checksum: 09e85fd0eccee979c56c8582dac19a6f88fe4444f0ae0c2c55a7e70df10cf11530f76d3203150e9961fa59d0448cab406d450cef3bc4681f12c3edd070d68b36
|
||||
version: 1.1.65
|
||||
resolution: "node-releases@npm:1.1.65"
|
||||
checksum: 7b8b1c118e3596376841ad44d33c55b93a3d3b7f9827ca48048579e58a81110ed3df00942ca7bd6c59d52adfdfb6da5ee1d33514b57ef8c9ee65d36bd0a3a609
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -7798,14 +7818,14 @@ fsevents@^1.2.7:
|
||||
linkType: hard
|
||||
|
||||
"object.assign@npm:^4.1.0, object.assign@npm:^4.1.1":
|
||||
version: 4.1.1
|
||||
resolution: "object.assign@npm:4.1.1"
|
||||
version: 4.1.2
|
||||
resolution: "object.assign@npm:4.1.2"
|
||||
dependencies:
|
||||
call-bind: ^1.0.0
|
||||
define-properties: ^1.1.3
|
||||
es-abstract: ^1.18.0-next.0
|
||||
has-symbols: ^1.0.1
|
||||
object-keys: ^1.1.1
|
||||
checksum: 2038905bbf7c07313df831e83e40fc4eba783d2d680533ec47c546e562e939902db69c83fea9bd836204aa3e01e8db0faa412d4f649c9825235cc8e5c1166dd1
|
||||
checksum: a5855cc6db3f64606c41ceb97cb9847e667d8240889d771d65638244be1d35c2e2ccb5762f437bb76abf4e98ab4634a9d302380398121cee288a44dce5028f54
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -8643,9 +8663,9 @@ fsevents@^1.2.7:
|
||||
linkType: hard
|
||||
|
||||
"regenerate@npm:^1.4.0":
|
||||
version: 1.4.1
|
||||
resolution: "regenerate@npm:1.4.1"
|
||||
checksum: 67fe7ea33291997b20634105c7b6787bcc03e137da348c1cc0d617b3d97d9ed1e05ce4b6dabcb86be7ddf198000f78275bcabd67e66889ba7daa296926f8eada
|
||||
version: 1.4.2
|
||||
resolution: "regenerate@npm:1.4.2"
|
||||
checksum: 54275a99effd8a439bcdd88942b61f68a769133df841e90d94df9ae7c250cb6537c0a28dd913116539772b3415edbcb3c8d81c22275595d3755cf0353976dfa4
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -8991,7 +9011,7 @@ fsevents@^1.2.7:
|
||||
resolution: "root-workspace-0b6124@workspace:."
|
||||
dependencies:
|
||||
"@babel/core": ^7.12.3
|
||||
"@polkadot/dev": ^0.59.10
|
||||
"@polkadot/dev": ^0.59.12
|
||||
"@polkadot/ts": ^0.3.53
|
||||
"@types/jest": ^26.0.15
|
||||
languageName: unknown
|
||||
@@ -10257,6 +10277,13 @@ fsevents@^1.2.7:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"universalify@npm:^2.0.0":
|
||||
version: 2.0.0
|
||||
resolution: "universalify@npm:2.0.0"
|
||||
checksum: 36bfbdc97bd4b483596e66ea65e20663f5ab9ec3650157d99b075b7f97afcdefe46bbb23f89171dd75595d398cea3769a5b6d7130f5c66cae2a0f00904780f62
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"unset-value@npm:^1.0.0":
|
||||
version: 1.0.0
|
||||
resolution: "unset-value@npm:1.0.0"
|
||||
@@ -10329,12 +10356,12 @@ fsevents@^1.2.7:
|
||||
linkType: hard
|
||||
|
||||
"utf-8-validate@npm:^5.0.2":
|
||||
version: 5.0.2
|
||||
resolution: "utf-8-validate@npm:5.0.2"
|
||||
version: 5.0.3
|
||||
resolution: "utf-8-validate@npm:5.0.3"
|
||||
dependencies:
|
||||
node-gyp: latest
|
||||
node-gyp-build: ~3.7.0
|
||||
checksum: 1ca86a68ee4565141683cfdbf3c290cb746963be28040029717eb27b31ec305c0e0e99586af85eef060ed495617580fcc974250e15807a30a403d8df2a812984
|
||||
node-gyp-build: ^4.2.0
|
||||
checksum: 0204294d8584ffba171c6b0f97613a4a9c882152067672b45f533f2c640786042ee2b4aeb5f390d6a741eb93b0dc925404652a78c29f9348e6cd422cbdaa44ca
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
||||
Reference in New Issue
Block a user