Adjust with tsconfig references (#1317)
* Adjust with tsconfig references * tabs -> spaces * Adjust * Cleanup spacing * Adjust * eslint-specific config * Bump deps * Bumps * Adjust * Update tests
This commit is contained in:
+2
-8
@@ -6,18 +6,12 @@ const base = require('@polkadot/dev/config/eslint.cjs');
|
||||
module.exports = {
|
||||
...base,
|
||||
ignorePatterns: [
|
||||
'.eslintrc.js',
|
||||
'.github/**',
|
||||
'.vscode/**',
|
||||
'.yarn/**',
|
||||
'**/build/*',
|
||||
'**/coverage/*',
|
||||
'**/node_modules/*'
|
||||
...base.ignorePatterns
|
||||
],
|
||||
parserOptions: {
|
||||
...base.parserOptions,
|
||||
project: [
|
||||
'./tsconfig.json'
|
||||
'./tsconfig.eslint.json'
|
||||
]
|
||||
},
|
||||
rules: {
|
||||
|
||||
+3
-3
@@ -28,9 +28,9 @@
|
||||
"test:one": "polkadot-dev-run-test --runInBand"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.16.0",
|
||||
"@polkadot/dev": "^0.63.41",
|
||||
"@polkadot/ts": "^0.4.19",
|
||||
"@babel/core": "^7.16.5",
|
||||
"@polkadot/dev": "^0.64.3",
|
||||
"@polkadot/ts": "^0.4.20",
|
||||
"@types/jest": "^27.0.3"
|
||||
},
|
||||
"resolutions": {
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
"main": "node.js",
|
||||
"react-native": "react-native.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.3",
|
||||
"@babel/runtime": "^7.16.5",
|
||||
"@ledgerhq/hw-transport": "^6.19.0",
|
||||
"@ledgerhq/hw-transport-webhid": "^6.19.0",
|
||||
"@ledgerhq/hw-transport-webusb": "^6.19.0"
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "..",
|
||||
"outDir": "./build",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"references": []
|
||||
}
|
||||
@@ -22,9 +22,9 @@
|
||||
"version": "8.1.3-26",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.3",
|
||||
"@babel/runtime": "^7.16.5",
|
||||
"@polkadot/hw-ledger-transports": "8.1.3-26",
|
||||
"@polkadot/util": "8.1.3-26",
|
||||
"@zondax/ledger-substrate": "^0.20.0"
|
||||
"@zondax/ledger-substrate": "^0.22.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
// Copyright 2017-2021 @polkadot/hw-ledger authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { knownLedger } from '@polkadot/networks/defaults';
|
||||
|
||||
import { ledgerApps } from './defaults';
|
||||
|
||||
describe('defaults', (): void => {
|
||||
it('has entries for each of the apps (hwledger -> networks)', (): void => {
|
||||
expect(
|
||||
Object.keys(knownLedger).filter((network) =>
|
||||
!ledgerApps[network]
|
||||
)
|
||||
).toEqual([]);
|
||||
});
|
||||
|
||||
it('has entries for each of the apps (networks -> hwledger)', (): void => {
|
||||
expect(
|
||||
Object.keys(ledgerApps).filter((network) =>
|
||||
!knownLedger[network]
|
||||
)
|
||||
).toEqual([]);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "..",
|
||||
"outDir": "./build",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"references": [
|
||||
{ "path": "../hw-ledger-transports" },
|
||||
{ "path": "../util" }
|
||||
]
|
||||
}
|
||||
@@ -23,7 +23,7 @@
|
||||
"version": "8.1.3-26",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.3",
|
||||
"@babel/runtime": "^7.16.5",
|
||||
"@polkadot/util": "8.1.3-26",
|
||||
"@polkadot/util-crypto": "8.1.3-26"
|
||||
},
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "..",
|
||||
"outDir": "./build",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"references": [
|
||||
{ "path": "../util" },
|
||||
{ "path": "../util-crypto" }
|
||||
]
|
||||
}
|
||||
@@ -20,9 +20,10 @@
|
||||
"version": "8.1.3-26",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.3"
|
||||
"@babel/runtime": "^7.16.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/hw-ledger": "8.1.3-26",
|
||||
"@polkadot/util": "8.1.3-26",
|
||||
"@polkadot/x-fetch": "8.1.3-26"
|
||||
}
|
||||
|
||||
@@ -1,25 +1,46 @@
|
||||
// Copyright 2017-2021 @polkadot/networks authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { ledgerApps } from '@polkadot/hw-ledger/defaults';
|
||||
import { isHex } from '@polkadot/util';
|
||||
|
||||
import { knownGenesis, knownLedger } from './defaults';
|
||||
|
||||
describe('defaults', (): void => {
|
||||
it('has hex values for all genesis chains', (): void => {
|
||||
expect(
|
||||
Object.keys(knownGenesis).filter((network) =>
|
||||
!knownGenesis[network].length ||
|
||||
knownGenesis[network].some((g) => !isHex(g, 256))
|
||||
)
|
||||
).toEqual([]);
|
||||
describe('genesis', (): void => {
|
||||
it('has hex values for all genesis chains', (): void => {
|
||||
expect(
|
||||
Object.keys(knownGenesis).filter((network) =>
|
||||
!knownGenesis[network].length ||
|
||||
knownGenesis[network].some((g) => !isHex(g, 256))
|
||||
)
|
||||
).toEqual([]);
|
||||
});
|
||||
|
||||
it('has genesis for all Ledger chains', (): void => {
|
||||
expect(
|
||||
Object.keys(knownLedger).filter((network) =>
|
||||
!knownGenesis[network]
|
||||
)
|
||||
).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
it('has genesis for all Ledger chains', (): void => {
|
||||
expect(
|
||||
Object.keys(knownLedger).filter((network) =>
|
||||
!knownGenesis[network]
|
||||
)
|
||||
).toEqual([]);
|
||||
describe('Ledger', (): void => {
|
||||
it('has entries for each of the apps (hwledger -> networks)', (): void => {
|
||||
expect(
|
||||
Object.keys(knownLedger).filter((network) =>
|
||||
!ledgerApps[network]
|
||||
)
|
||||
).toEqual([]);
|
||||
});
|
||||
|
||||
it('has entries for each of the apps (networks -> hwledger)', (): void => {
|
||||
expect(
|
||||
Object.keys(ledgerApps).filter((network) =>
|
||||
!knownLedger[network]
|
||||
)
|
||||
).toEqual([]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "..",
|
||||
"outDir": "./build",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"references": [
|
||||
{ "path": "../hw-ledger" },
|
||||
{ "path": "../util" },
|
||||
{ "path": "../x-fetch" }
|
||||
]
|
||||
}
|
||||
@@ -29,15 +29,13 @@
|
||||
},
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.3",
|
||||
"@babel/runtime": "^7.16.5",
|
||||
"@noble/hashes": "^0.4.4",
|
||||
"@noble/secp256k1": "^1.3.3",
|
||||
"@polkadot/networks": "8.1.3-26",
|
||||
"@polkadot/util": "8.1.3-26",
|
||||
"@polkadot/wasm-crypto": "^4.5.1",
|
||||
"@polkadot/x-bigint": "8.1.3-26",
|
||||
"@polkadot/x-noble-hashes": "8.1.3-26",
|
||||
"@polkadot/x-noble-secp256k1": "8.1.3-26",
|
||||
"@polkadot/x-randomvalues": "8.1.3-26",
|
||||
"ed2curve": "^0.3.0",
|
||||
"micro-base": "^0.10.0",
|
||||
|
||||
@@ -3,21 +3,15 @@
|
||||
|
||||
import { hexToU8a, stringToU8a, u8aToHex } from '@polkadot/util';
|
||||
|
||||
import { createTestPairs, TestKeyringMap } from '../../../keyring/src/testingPairs';
|
||||
import { ALICE_PUBLIC_SR } from './encode.spec';
|
||||
import { decodeAddress } from '.';
|
||||
|
||||
describe('decodeAddress', (): void => {
|
||||
let keyring: TestKeyringMap;
|
||||
|
||||
beforeAll((): void => {
|
||||
keyring = createTestPairs({ type: 'sr25519' });
|
||||
});
|
||||
|
||||
it('decodes an address', (): void => {
|
||||
expect(
|
||||
decodeAddress('5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY')
|
||||
).toEqual(
|
||||
keyring.alice.publicKey
|
||||
ALICE_PUBLIC_SR
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// Copyright 2017-2021 @polkadot/util-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { createTestPairs } from '@polkadot/keyring/testingPairs';
|
||||
|
||||
import { encodeAddress } from '.';
|
||||
|
||||
const keyring = createTestPairs({ type: 'ed25519' }, false);
|
||||
export const ALICE_PUBLIC_SR = new Uint8Array([212, 53, 147, 199, 21, 253, 211, 28, 97, 20, 26, 189, 4, 169, 159, 214, 130, 44, 133, 88, 133, 76, 205, 227, 154, 86, 132, 231, 165, 109, 162, 125]);
|
||||
|
||||
export const ALICE_PUBLIC_ED = new Uint8Array([209, 114, 167, 76, 218, 76, 134, 89, 18, 195, 43, 160, 168, 10, 87, 174, 105, 171, 174, 65, 14, 92, 203, 89, 222, 232, 78, 47, 68, 50, 219, 79]);
|
||||
|
||||
const SUBKEY = [
|
||||
{
|
||||
@@ -69,7 +69,7 @@ const SUBKEY = [
|
||||
describe('encode', (): void => {
|
||||
it('encodes an address to a valid value', (): void => {
|
||||
expect(
|
||||
keyring.alice.address
|
||||
encodeAddress(ALICE_PUBLIC_ED)
|
||||
).toEqual('5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaQua');
|
||||
});
|
||||
|
||||
@@ -88,7 +88,7 @@ describe('encode', (): void => {
|
||||
it('fails when non-valid publicKey provided', (): void => {
|
||||
expect(
|
||||
(): string => encodeAddress(
|
||||
keyring.alice.publicKey.slice(0, 30)
|
||||
ALICE_PUBLIC_ED.slice(0, 30)
|
||||
)
|
||||
).toThrow(/Expected a valid key/);
|
||||
});
|
||||
@@ -141,7 +141,7 @@ describe('encode', (): void => {
|
||||
|
||||
it('encodes with 2 byte prefix', (): void => {
|
||||
expect(
|
||||
encodeAddress(keyring.alice.publicKey, 255)
|
||||
encodeAddress(ALICE_PUBLIC_ED, 255)
|
||||
).toEqual('yGHU8YKprxHbHdEv7oUK4rzMZXtsdhcXVG2CAMyC9WhzhjH2k');
|
||||
});
|
||||
|
||||
@@ -155,19 +155,19 @@ describe('encode', (): void => {
|
||||
|
||||
it('does not encode for > 16,383, < 0', (): void => {
|
||||
expect(
|
||||
() => encodeAddress(keyring.alice.publicKey, -1)
|
||||
() => encodeAddress(ALICE_PUBLIC_ED, -1)
|
||||
).toThrow(/range ss58Format specified/);
|
||||
expect(
|
||||
() => encodeAddress(keyring.alice.publicKey, 16384)
|
||||
() => encodeAddress(ALICE_PUBLIC_ED, 16384)
|
||||
).toThrow(/range ss58Format specified/);
|
||||
});
|
||||
|
||||
it('does not encode reserved', (): void => {
|
||||
expect(
|
||||
() => encodeAddress(keyring.alice.publicKey, 46)
|
||||
() => encodeAddress(ALICE_PUBLIC_ED, 46)
|
||||
).toThrow(/range ss58Format specified/);
|
||||
expect(
|
||||
() => encodeAddress(keyring.alice.publicKey, 47)
|
||||
() => encodeAddress(ALICE_PUBLIC_ED, 47)
|
||||
).toThrow(/range ss58Format specified/);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/util-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { createTestPairs } from '@polkadot/keyring/testingPairs';
|
||||
|
||||
import { ALICE_PUBLIC_SR } from './encode.spec';
|
||||
import { addressEq } from '.';
|
||||
|
||||
describe('addressEq', (): void => {
|
||||
@@ -34,12 +33,10 @@ describe('addressEq', (): void => {
|
||||
});
|
||||
|
||||
it('returns true for equal, address vs publicKey', (): void => {
|
||||
const keyring = createTestPairs({ type: 'sr25519' });
|
||||
|
||||
expect(
|
||||
addressEq(
|
||||
'5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY',
|
||||
keyring.alice.publicKey
|
||||
ALICE_PUBLIC_SR
|
||||
)
|
||||
).toEqual(true);
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import { hexToU8a } from '@polkadot/util';
|
||||
import { waitReady } from '@polkadot/wasm-crypto';
|
||||
|
||||
import { performanceWasm } from '../../test/performance';
|
||||
import { performanceWasm } from '../test/performance';
|
||||
import { blake2AsU8a } from '.';
|
||||
|
||||
describe('blake2AsU8a', (): void => {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import { stringToU8a } from '@polkadot/util';
|
||||
import { waitReady } from '@polkadot/wasm-crypto';
|
||||
|
||||
import { performanceWasm } from '../../test/performance';
|
||||
import { performanceWasm } from '../test/performance';
|
||||
import { ed25519PairFromSeed, ed25519Sign } from '.';
|
||||
|
||||
const PAIR = ed25519PairFromSeed(
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import { hexToU8a, stringToU8a } from '@polkadot/util';
|
||||
import { waitReady } from '@polkadot/wasm-crypto';
|
||||
|
||||
import { performanceWasm } from '../../test/performance';
|
||||
import { performanceWasm } from '../test/performance';
|
||||
import { hmacShaAsU8a } from '.';
|
||||
|
||||
describe('hmacShaAsU8a', (): void => {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import { hexToU8a, stringToU8a } from '@polkadot/util';
|
||||
import { waitReady } from '@polkadot/wasm-crypto';
|
||||
|
||||
import { performanceWasm } from '../../test/performance';
|
||||
import { performanceWasm } from '../test/performance';
|
||||
import { keccakAsU8a } from '.';
|
||||
|
||||
describe('keccakAsU8a', (): void => {
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
import { u8aEq, u8aToHex } from '@polkadot/util';
|
||||
import { waitReady } from '@polkadot/wasm-crypto';
|
||||
|
||||
import { performanceWasm } from '../../test/performance';
|
||||
import { randomAsU8a } from '../random/asU8a';
|
||||
import { performanceWasm } from '../test/performance';
|
||||
import { pbkdf2Encode } from '.';
|
||||
|
||||
const KNOWN_SALT = new Uint8Array([
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import { waitReady } from '@polkadot/wasm-crypto';
|
||||
|
||||
import { performanceWasm } from '../../test/performance';
|
||||
import { performanceWasm } from '../test/performance';
|
||||
import { DEFAULT_PARAMS } from './defaults';
|
||||
import { scryptEncode } from '.';
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import { hexToU8a } from '@polkadot/util';
|
||||
import { waitReady } from '@polkadot/wasm-crypto';
|
||||
|
||||
import { performanceWasm } from '../../test/performance';
|
||||
import { performanceWasm } from '../test/performance';
|
||||
import { secp256k1Compress } from '.';
|
||||
|
||||
describe('secp256k1Compress', (): void => {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import { hexToU8a } from '@polkadot/util';
|
||||
import { waitReady } from '@polkadot/wasm-crypto';
|
||||
|
||||
import { performanceWasm } from '../../test/performance';
|
||||
import { performanceWasm } from '../test/performance';
|
||||
import { secp256k1Expand } from '.';
|
||||
|
||||
describe('secp256k1Expand', (): void => {
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
import { hexToU8a, u8aToHex } from '@polkadot/util';
|
||||
import { waitReady } from '@polkadot/wasm-crypto';
|
||||
|
||||
import { performanceWasm } from '../../../test/performance';
|
||||
import { mnemonicToMiniSecret } from '../../mnemonic';
|
||||
import { performanceWasm } from '../../test/performance';
|
||||
import { secp256k1PairFromSeed } from '..';
|
||||
|
||||
// mnemonic, secret, public, account_id
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
import { u8aToHex, u8aToU8a } from '@polkadot/util';
|
||||
import { waitReady } from '@polkadot/wasm-crypto';
|
||||
|
||||
import { performanceWasm } from '../../test/performance';
|
||||
import { keccakAsU8a } from '../keccak';
|
||||
import { performanceWasm } from '../test/performance';
|
||||
import { secp256k1Recover } from '.';
|
||||
|
||||
const sig = u8aToU8a('0x7505f2880114da51b3f5d535f8687953c0ab9af4ab81e592eaebebf53b728d2b6dfd9b5bcd70fee412b1f31360e7c2774009305cb84fc50c1d0ff8034dfa5fff');
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import { hexToU8a } from '@polkadot/util';
|
||||
import { waitReady } from '@polkadot/wasm-crypto';
|
||||
|
||||
import { performanceWasm } from '../../test/performance';
|
||||
import { performanceWasm } from '../test/performance';
|
||||
import { secp256k1PairFromSeed, secp256k1Sign } from '.';
|
||||
|
||||
const pair = secp256k1PairFromSeed(hexToU8a('0x4380de832af797688026ce24f85204d508243f201650c1a134929e5458b7fbae'));
|
||||
|
||||
@@ -6,7 +6,7 @@ import '../cryptoInit';
|
||||
import { hexToU8a } from '@polkadot/util';
|
||||
import { waitReady } from '@polkadot/wasm-crypto';
|
||||
|
||||
import { performanceWasm } from '../../test/performance';
|
||||
import { performanceWasm } from '../test/performance';
|
||||
import { hasher } from './hasher';
|
||||
import { secp256k1PairFromSeed, secp256k1Verify } from '.';
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import { hexToU8a } from '@polkadot/util';
|
||||
import { waitReady } from '@polkadot/wasm-crypto';
|
||||
|
||||
import { performanceWasm } from '../../test/performance';
|
||||
import { performanceWasm } from '../test/performance';
|
||||
import { sha256AsU8a } from '.';
|
||||
|
||||
const TESTS = [
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import { waitReady } from '@polkadot/wasm-crypto';
|
||||
|
||||
import { performanceWasm } from '../../test/performance';
|
||||
import { performanceWasm } from '../test/performance';
|
||||
import { sha512AsU8a } from '.';
|
||||
|
||||
describe('sha512AsU8a', (): void => {
|
||||
|
||||
+2
-2
@@ -2,9 +2,9 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { arrayRange } from '@polkadot/util';
|
||||
import { randomAsU8a } from '@polkadot/util-crypto';
|
||||
import { performance, performanceCmp } from '@polkadot/util/test/performance';
|
||||
|
||||
import { performance, performanceCmp } from '../../util/test/performance';
|
||||
import { randomAsU8a } from '..';
|
||||
|
||||
type ExecFn = (input: Uint8Array, onlyJs: boolean) => unknown;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import { hexToU8a } from '@polkadot/util';
|
||||
import { waitReady } from '@polkadot/wasm-crypto';
|
||||
|
||||
import { performanceWasm } from '../../test/performance';
|
||||
import { performanceWasm } from '../test/performance';
|
||||
import { xxhashAsU8a } from '.';
|
||||
|
||||
describe('xxhashAsU8a', (): void => {
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "..",
|
||||
"outDir": "./build",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"references": [
|
||||
{ "path": "../networks" },
|
||||
{ "path": "../util" },
|
||||
{ "path": "../x-bigint" },
|
||||
{ "path": "../x-randomvalues" }
|
||||
]
|
||||
}
|
||||
@@ -37,7 +37,7 @@
|
||||
"version": "8.1.3-26",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.3",
|
||||
"@babel/runtime": "^7.16.5",
|
||||
"@polkadot/x-bigint": "8.1.3-26",
|
||||
"@polkadot/x-global": "8.1.3-26",
|
||||
"@polkadot/x-textdecoder": "8.1.3-26",
|
||||
@@ -45,5 +45,8 @@
|
||||
"@types/bn.js": "^4.11.6",
|
||||
"bn.js": "^4.12.0",
|
||||
"ip-regex": "^4.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/x-randomvalues": "8.1.3-26"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright 2017-2021 @polkadot/util authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { performance } from '../../test/performance';
|
||||
import { arrayRange } from '../array';
|
||||
import { performance } from '../test/performance';
|
||||
import { nToU8a } from '.';
|
||||
|
||||
const ptest = arrayRange(65536).map((v) => [v]);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright 2017-2021 @polkadot/util authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { performance } from '../../test/performance';
|
||||
import { arrayRange } from '../array';
|
||||
import { performance } from '../test/performance';
|
||||
import { BN, bnToU8a } from '.';
|
||||
|
||||
const ptest = arrayRange(65536).map((v) => [v]);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/util authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { performanceCmp } from '../../test/performance';
|
||||
import { performanceCmp } from '../test/performance';
|
||||
import { U16_TO_HEX } from './alphabet';
|
||||
import { hexToU8a as hexToU8aBuffer } from './toU8aBuffer';
|
||||
import { hexToU8a } from '.';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/util authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { performance } from '../../test/performance';
|
||||
import { performance } from '../test/performance';
|
||||
import { isHex } from '.';
|
||||
|
||||
describe('isHex', (): void => {
|
||||
|
||||
@@ -1,14 +1,20 @@
|
||||
// Copyright 2017-2021 @polkadot/util authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { randomAsNumber } from '@polkadot/util-crypto';
|
||||
import words from '@polkadot/util-crypto/mnemonic/bip39-en';
|
||||
import { getRandomValues } from '@polkadot/x-randomvalues';
|
||||
|
||||
import { performance } from '../../test/performance';
|
||||
import { arrayRange } from '../array';
|
||||
import { performance } from '../test/performance';
|
||||
import { stringCamelCase, stringUpperFirst } from '.';
|
||||
|
||||
const SEPS = [' ', '_', '-', '.', ','];
|
||||
const words = 'bring|brisk|broccoli|broken|bronze|broom|brother|brown|brush|bubble|buddy|budget|buffalo|build|bulb|bulk|bullet|bundle|bunker|burden'.split('|');
|
||||
|
||||
function randomAsNumber (): number {
|
||||
const rand = getRandomValues(new Uint8Array(4));
|
||||
|
||||
return rand.reduce((v, t) => (v * t) + v, 0);
|
||||
}
|
||||
|
||||
const randomWords = arrayRange(256).map((): [string] => {
|
||||
let result = '';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/util-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { formatDecimal, formatNumber } from '@polkadot/util';
|
||||
import { formatDecimal, formatNumber } from '..';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
type ExecFn = (...params: any[]) => unknown;
|
||||
@@ -1,13 +1,13 @@
|
||||
// Copyright 2017-2021 @polkadot/util authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { randomAsU8a } from '@polkadot/util-crypto';
|
||||
import { getRandomValues } from '@polkadot/x-randomvalues';
|
||||
|
||||
import { performance } from '../../test/performance';
|
||||
import { arrayRange } from '../array';
|
||||
import { performance } from '../test/performance';
|
||||
import { u8aConcat } from '.';
|
||||
|
||||
const ptest = arrayRange(10).map(() => randomAsU8a());
|
||||
const ptest = arrayRange(10).map(() => getRandomValues(new Uint8Array(32)));
|
||||
|
||||
describe('u8aConcat', (): void => {
|
||||
it('concatenates arrays', (): void => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/util authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { performance } from '../../test/performance';
|
||||
import { performance } from '../test/performance';
|
||||
import { u8aEq } from '.';
|
||||
|
||||
const ptest = new Uint8Array(32768);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/util authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { performanceCmp } from '../../test/performance';
|
||||
import { performanceCmp } from '../test/performance';
|
||||
import { u8aToHex as u8aToHexBuffer } from './toHexBuffer';
|
||||
import { u8aToHex } from '.';
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "..",
|
||||
"outDir": "./build",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"references": [
|
||||
{ "path": "../x-bigint" },
|
||||
{ "path": "../x-global" },
|
||||
{ "path": "../x-randomvalues" },
|
||||
{ "path": "../x-textdecoder" },
|
||||
{ "path": "../x-textencoder" }
|
||||
]
|
||||
}
|
||||
@@ -22,7 +22,7 @@
|
||||
"type": "module",
|
||||
"version": "8.1.3-26",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.3",
|
||||
"@babel/runtime": "^7.16.5",
|
||||
"@polkadot/x-global": "8.1.3-26"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "..",
|
||||
"outDir": "./build",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"references": [
|
||||
{ "path": "../x-global" }
|
||||
]
|
||||
}
|
||||
@@ -20,7 +20,7 @@
|
||||
"version": "8.1.3-26",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.3",
|
||||
"@babel/runtime": "^7.16.5",
|
||||
"@polkadot/util": "8.1.3-26",
|
||||
"buffer-es6": "^4.9.3"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "..",
|
||||
"outDir": "./build",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"references": [
|
||||
{ "path": "../util" }
|
||||
]
|
||||
}
|
||||
@@ -22,7 +22,7 @@
|
||||
"main": "node.js",
|
||||
"react-native": "react-native.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.3",
|
||||
"@babel/runtime": "^7.16.5",
|
||||
"@polkadot/x-global": "8.1.3-26",
|
||||
"@types/node-fetch": "^2.5.12",
|
||||
"node-fetch": "^2.6.6"
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "..",
|
||||
"outDir": "./build",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"references": [
|
||||
{ "path": "../x-global" }
|
||||
]
|
||||
}
|
||||
@@ -20,6 +20,6 @@
|
||||
"version": "8.1.3-26",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.3"
|
||||
"@babel/runtime": "^7.16.5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "..",
|
||||
"outDir": "./build",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"references": []
|
||||
}
|
||||
@@ -22,6 +22,6 @@
|
||||
"crypto": false
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.3"
|
||||
"@babel/runtime": "^7.16.5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "..",
|
||||
"outDir": "./build",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"references": []
|
||||
}
|
||||
@@ -22,6 +22,6 @@
|
||||
"crypto": false
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.3"
|
||||
"@babel/runtime": "^7.16.5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "..",
|
||||
"outDir": "./build",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"references": []
|
||||
}
|
||||
@@ -22,7 +22,7 @@
|
||||
"main": "node.js",
|
||||
"react-native": "react-native.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.3",
|
||||
"@babel/runtime": "^7.16.5",
|
||||
"@polkadot/x-global": "8.1.3-26"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "..",
|
||||
"outDir": "./build",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"references": [
|
||||
{ "path": "../x-global" }
|
||||
]
|
||||
}
|
||||
@@ -22,7 +22,7 @@
|
||||
"main": "node.js",
|
||||
"react-native": "react-native.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.3",
|
||||
"@babel/runtime": "^7.16.5",
|
||||
"@polkadot/x-global": "8.1.3-26"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "..",
|
||||
"outDir": "./build",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"references": [
|
||||
{ "path": "../x-global" }
|
||||
]
|
||||
}
|
||||
@@ -22,7 +22,7 @@
|
||||
"main": "node.js",
|
||||
"react-native": "react-native.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.3",
|
||||
"@babel/runtime": "^7.16.5",
|
||||
"@polkadot/x-global": "8.1.3-26"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "..",
|
||||
"outDir": "./build",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"references": [
|
||||
{ "path": "../x-global" }
|
||||
]
|
||||
}
|
||||
@@ -22,7 +22,7 @@
|
||||
"main": "node.js",
|
||||
"react-native": "react-native.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.3",
|
||||
"@babel/runtime": "^7.16.5",
|
||||
"@polkadot/x-global": "8.1.3-26",
|
||||
"@types/websocket": "^1.0.4",
|
||||
"websocket": "^1.0.34"
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "..",
|
||||
"outDir": "./build",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"references": [
|
||||
{ "path": "../x-global" }
|
||||
]
|
||||
}
|
||||
+26
-26
@@ -1,35 +1,35 @@
|
||||
{
|
||||
"extends": "@polkadot/dev/config/tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"paths": {
|
||||
"@polkadot/hw-ledger": [ "ledger/src" ],
|
||||
"@polkadot/hw-ledger/*": [ "ledger/src/*" ],
|
||||
"@polkadot/hw-ledger-transports": [ "hw-ledger-transports/src/browser" ],
|
||||
"@polkadot/hw-ledger-transports/*": [ "hw-ledger-transports/src/browser" ],
|
||||
"@polkadot/keyring": [ "keyring/src" ],
|
||||
"@polkadot/keyring/*": [ "keyring/src/*" ],
|
||||
"@polkadot/networks": [ "networks/src" ],
|
||||
"@polkadot/networks/*": [ "networks/src/*" ],
|
||||
"@polkadot/util-crypto": [ "util-crypto/src" ],
|
||||
"@polkadot/util-crypto/*": [ "util-crypto/src/*" ],
|
||||
"@polkadot/util": [ "util/src" ],
|
||||
"@polkadot/util/*": [ "util/src/*" ],
|
||||
"@polkadot/x-bundle/*": [ "x-bundle/src/*" ],
|
||||
"@polkadot/x-bigint": [ "x-bigint/src" ],
|
||||
"@polkadot/x-fetch": [ "x-fetch/src/browser" ],
|
||||
"@polkadot/x-global": [ "x-global/src" ],
|
||||
"@polkadot/x-noble-hashes/*": [ "x-noble-hashes/src/*" ],
|
||||
"@polkadot/x-noble-secp256k1": [ "x-noble-secp256k1/src" ],
|
||||
"@polkadot/x-randomvalues": [ "x-randomvalues/src/browser" ],
|
||||
"@polkadot/x-textdecoder": [ "x-textdecoder/src/browser" ],
|
||||
"@polkadot/x-textencoder": [ "x-textencoder/src/browser" ],
|
||||
"@polkadot/x-ws": [ "x-ws/src/browser" ]
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"paths": {
|
||||
"@polkadot/hw-ledger": ["hw-ledger/src"],
|
||||
"@polkadot/hw-ledger/*": ["hw-ledger/src/*"],
|
||||
"@polkadot/hw-ledger-transports": ["hw-ledger-transports/src/browser"],
|
||||
"@polkadot/hw-ledger-transports/*": ["hw-ledger-transports/src/browser"],
|
||||
"@polkadot/keyring": ["keyring/src"],
|
||||
"@polkadot/keyring/*": ["keyring/src/*"],
|
||||
"@polkadot/networks": ["networks/src"],
|
||||
"@polkadot/networks/*": ["networks/src/*"],
|
||||
"@polkadot/util-crypto": ["util-crypto/src"],
|
||||
"@polkadot/util-crypto/*": ["util-crypto/src/*"],
|
||||
"@polkadot/util": ["util/src"],
|
||||
"@polkadot/util/*": ["util/src/*"],
|
||||
"@polkadot/x-bundle/*": ["x-bundle/src/*"],
|
||||
"@polkadot/x-bigint": ["x-bigint/src"],
|
||||
"@polkadot/x-fetch": ["x-fetch/src/browser"],
|
||||
"@polkadot/x-global": ["x-global/src"],
|
||||
"@polkadot/x-noble-hashes/*": ["x-noble-hashes/src/*"],
|
||||
"@polkadot/x-noble-secp256k1": ["x-noble-secp256k1/src"],
|
||||
"@polkadot/x-randomvalues": ["x-randomvalues/src/browser"],
|
||||
"@polkadot/x-textdecoder": ["x-textdecoder/src/browser"],
|
||||
"@polkadot/x-textencoder": ["x-textencoder/src/browser"],
|
||||
"@polkadot/x-ws": ["x-ws/src/browser"]
|
||||
},
|
||||
"skipLibCheck": true,
|
||||
"typeRoots": [
|
||||
"./node_modules/@polkadot/ts",
|
||||
"./node_modules/@types"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./packages"
|
||||
},
|
||||
"include": ["packages/**/src/**/*", "packages/**/scripts/**/*"],
|
||||
"exclue": ["**/node_modules/**/*"]
|
||||
}
|
||||
+21
-7
@@ -1,10 +1,24 @@
|
||||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"exclude": [
|
||||
"build/**/*",
|
||||
"**/build/**/*"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./packages"
|
||||
}
|
||||
"composite": true
|
||||
},
|
||||
"files": [],
|
||||
"references": [
|
||||
{ "path": "./packages/hw-ledger" },
|
||||
{ "path": "./packages/hw-ledger-transports" },
|
||||
{ "path": "./packages/keyring" },
|
||||
{ "path": "./packages/networks" },
|
||||
{ "path": "./packages/util" },
|
||||
{ "path": "./packages/util-crypto" },
|
||||
{ "path": "./packages/x-bigint" },
|
||||
{ "path": "./packages/x-bundle" },
|
||||
{ "path": "./packages/x-fetch" },
|
||||
{ "path": "./packages/x-global" },
|
||||
{ "path": "./packages/x-noble-hashes" },
|
||||
{ "path": "./packages/x-noble-secp256k1" },
|
||||
{ "path": "./packages/x-randomvalues" },
|
||||
{ "path": "./packages/x-textdecoder" },
|
||||
{ "path": "./packages/x-textencoder" },
|
||||
{ "path": "./packages/x-ws" },
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user