Remove /index imports (swap to bare) (#362)

This commit is contained in:
Jaco Greeff
2019-03-14 08:41:00 +01:00
committed by GitHub
parent a7ef2dcd86
commit de67a88f45
162 changed files with 198 additions and 189 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import FileFlatDb from './index';
import FileFlatDb from '.';
describe.skip('FileFlatDb (compacting)', () => {
const combined = new FileFlatDb(process.cwd());
+1 -1
View File
@@ -6,7 +6,7 @@ import { ProgressCb } from '../types';
import { Slot } from './types';
import fs from 'fs';
import { assert, logger } from '@polkadot/util/index';
import { assert, logger } from '@polkadot/util';
import defaults from './defaults';
+1 -1
View File
@@ -7,7 +7,7 @@ import { BaseDbOptions } from '../types';
import fs from 'fs';
import mkdirp from 'mkdirp';
import path from 'path';
import { assert, isUndefined } from '@polkadot/util/index';
import { assert, isUndefined } from '@polkadot/util';
import Serialize from './Serialize';
import defaults from './defaults';
+1 -1
View File
@@ -5,7 +5,7 @@
import { Key, NibbleBuffer, Slot, Value } from './types';
import fs from 'fs';
import { logger } from '@polkadot/util/index';
import { logger } from '@polkadot/util';
import Cache from './Cache';
import defaults from './defaults';
+1 -1
View File
@@ -6,7 +6,7 @@ import { NibbleBuffer } from './types';
import snappy from 'snappy';
import { toNibbles } from '@polkadot/trie-codec/util';
import { assert, bufferToU8a, u8aToBuffer, u8aToHex } from '@polkadot/util/index';
import { assert, bufferToU8a, u8aToBuffer, u8aToHex } from '@polkadot/util';
import defaults from './defaults';
+1 -1
View File
@@ -6,7 +6,7 @@ import mkdirp from 'mkdirp';
import path from 'path';
import rimraf from 'rimraf';
import FileFlatDb from './index';
import FileFlatDb from '.';
const KEY_A = new Uint8Array([
0x10, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+1 -1
View File
@@ -7,7 +7,7 @@ import { Key, NibbleBuffer, Value } from './types';
import fs from 'fs';
import path from 'path';
import { logger } from '@polkadot/util/index';
import { logger } from '@polkadot/util';
import defaults from './defaults';
import Compact from './Compact';
+1 -1
View File
@@ -6,7 +6,7 @@ import { BaseDb, ProgressCb } from '../types';
import fs from 'fs';
import mkdirp from 'mkdirp';
import { bufferToU8a, logger, u8aToBuffer, u8aToHex } from '@polkadot/util/index';
import { bufferToU8a, logger, u8aToBuffer, u8aToHex } from '@polkadot/util';
type FilePath = {
directory: string,
+1 -1
View File
@@ -8,7 +8,7 @@ import fs from 'fs';
import mkdirp from 'mkdirp';
import lmdb from 'node-lmdb';
import path from 'path';
import { bufferToU8a, logger, u8aToBuffer } from '@polkadot/util/index';
import { bufferToU8a, logger, u8aToBuffer } from '@polkadot/util';
const GB = 1 * 1024 * 1024 * 1024;
+1 -1
View File
@@ -5,7 +5,7 @@
import { BaseDb, ProgressCb } from '../types';
import { LRUMap } from 'lru_map';
import { logger } from '@polkadot/util/index';
import { logger } from '@polkadot/util';
type CachedValue = {
value: Uint8Array | null
+1 -1
View File
@@ -4,7 +4,7 @@
import { BaseDb, BaseDbOptions, ProgressCb } from '../types';
import { logger } from '@polkadot/util/index';
import { logger } from '@polkadot/util';
type Storage = {
[index: string]: Uint8Array
+1 -1
View File
@@ -4,7 +4,7 @@
import { BaseDb, TxDb, ProgressCb } from '../types';
import { assert, isNull, logger } from '@polkadot/util/index';
import { assert, isNull, logger } from '@polkadot/util';
type Overlay = {
[index: string]: {
@@ -5,7 +5,7 @@
import os from 'os';
import path from 'path';
import rimraf from 'rimraf';
import { stringToU8a } from '@polkadot/util/index';
import { stringToU8a } from '@polkadot/util';
import RocksDb from '../RocksDb';
@@ -14,7 +14,7 @@ import rocksdb, { RocksDb } from 'rocksdb-node';
import mkdirp from 'mkdirp';
import path from 'path';
// import snappy from 'snappy';
import { bufferToU8a, logger, u8aToBuffer, u8aToHex } from '@polkadot/util/index';
import { bufferToU8a, logger, u8aToBuffer, u8aToHex } from '@polkadot/util';
const l = logger('db/rocksdb');
+2 -2
View File
@@ -7,8 +7,8 @@ import { Prefix } from './types';
// Original implementation: https://github.com/paritytech/polka-ui/blob/4858c094684769080f5811f32b081dd7780b0880/src/polkadot.js#L6
import bs58 from 'bs58';
import { assert, bufferToU8a, isHex, isU8a, u8aToU8a } from '@polkadot/util/index';
import { blake2AsU8a } from '@polkadot/util-crypto/index';
import { assert, bufferToU8a, isHex, isU8a, u8aToU8a } from '@polkadot/util';
import { blake2AsU8a } from '@polkadot/util-crypto';
import defaults from './defaults';
+2 -2
View File
@@ -7,8 +7,8 @@ import { Prefix } from './types';
// Original implementation: https://github.com/paritytech/polka-ui/blob/4858c094684769080f5811f32b081dd7780b0880/src/polkadot.js#L34
import bs58 from 'bs58';
import { assert, u8aConcat, u8aToBuffer, u8aToU8a } from '@polkadot/util/index';
import { blake2AsU8a } from '@polkadot/util-crypto/index';
import { assert, u8aConcat, u8aToBuffer, u8aToU8a } from '@polkadot/util';
import { blake2AsU8a } from '@polkadot/util-crypto';
import defaults from './defaults';
+3 -3
View File
@@ -4,10 +4,10 @@
import '@polkadot/util-crypto/schnorrkel/test-polyfill';
import { hexToU8a, stringToU8a } from '@polkadot/util/index';
import { cryptoWaitReady } from '@polkadot/util-crypto/index';
import { hexToU8a, stringToU8a } from '@polkadot/util';
import { cryptoWaitReady } from '@polkadot/util-crypto';
import Keyring from './index';
import Keyring from '.';
import setPrefix from './address/setPrefix';
describe('keypair', () => {
+2 -2
View File
@@ -5,8 +5,8 @@
import { KeypairType } from '@polkadot/util-crypto/types';
import { KeyringInstance, KeyringPair, KeyringPair$Json, KeyringPair$Meta, KeyringOptions } from './types';
import { assert, hexToU8a, isNumber, isHex, stringToU8a } from '@polkadot/util/index';
import { keyExtract, mnemonicToSeed , naclKeypairFromSeed as naclFromSeed, schnorrkelKeypairFromSeed as schnorrkelFromSeed, mnemonicToMiniSecret, keyFromPath } from '@polkadot/util-crypto/index';
import { assert, hexToU8a, isNumber, isHex, stringToU8a } from '@polkadot/util';
import { keyExtract, mnemonicToSeed , naclKeypairFromSeed as naclFromSeed, schnorrkelKeypairFromSeed as schnorrkelFromSeed, mnemonicToMiniSecret, keyFromPath } from '@polkadot/util-crypto';
import { decodeAddress, encodeAddress, setAddressPrefix } from './address';
import createPair from './pair';
+2 -2
View File
@@ -2,8 +2,8 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { assert, stringToU8a, u8aFixLength } from '@polkadot/util/index';
import { naclDecrypt } from '@polkadot/util-crypto/index';
import { assert, stringToU8a, u8aFixLength } from '@polkadot/util';
import { naclDecrypt } from '@polkadot/util-crypto';
import { PairInfo } from './types';
import { KEY_LENGTH, NONCE_LENGTH, PKCS8_DIVIDER, PKCS8_HEADER } from './defaults';
+2 -2
View File
@@ -4,8 +4,8 @@
import { PairInfo } from './types';
import { stringToU8a, u8aConcat, u8aFixLength, assert } from '@polkadot/util/index';
import { naclEncrypt } from '@polkadot/util-crypto/index';
import { stringToU8a, u8aConcat, u8aFixLength, assert } from '@polkadot/util';
import { naclEncrypt } from '@polkadot/util-crypto';
import { PKCS8_DIVIDER, PKCS8_HEADER } from './defaults';
+1 -1
View File
@@ -6,7 +6,7 @@ import { Keypair, KeypairType } from '@polkadot/util-crypto/types';
import { KeyringPair, KeyringPair$Json, KeyringPair$Meta } from '../types';
import { PairInfo } from './types';
import { naclKeypairFromSeed as naclFromSeed, naclSign, naclVerify, schnorrkelKeypairFromSeed as schnorrkelFromSeed, schnorrkelSign, schnorrkelVerify } from '@polkadot/util-crypto/index';
import { naclKeypairFromSeed as naclFromSeed, naclSign, naclVerify, schnorrkelKeypairFromSeed as schnorrkelFromSeed, schnorrkelSign, schnorrkelVerify } from '@polkadot/util-crypto';
import { encodeAddress } from '../address';
import decode from './decode';
+1 -1
View File
@@ -5,7 +5,7 @@
import { KeypairType } from '@polkadot/util-crypto/types';
import { KeyringPair$Json, KeyringPair$Meta } from '../types';
import { u8aToHex } from '@polkadot/util/index';
import { u8aToHex } from '@polkadot/util';
import { encodeAddress } from '../address';
+1 -1
View File
@@ -4,7 +4,7 @@
import { KeyringPairs, KeyringPair } from './types';
import { assert, isHex, isU8a, u8aToHex, u8aToU8a } from '@polkadot/util/index';
import { assert, isHex, isU8a, u8aToHex, u8aToU8a } from '@polkadot/util';
import addressDecode from './address/decode';
+3 -3
View File
@@ -4,10 +4,10 @@
// From https://github.com/paritytech/substrate/wiki/Secret-URI-Test-Vectors
import { u8aToHex } from '@polkadot/util/index';
import { cryptoWaitReady } from '@polkadot/util-crypto/index';
import { u8aToHex } from '@polkadot/util';
import { cryptoWaitReady } from '@polkadot/util-crypto';
import Keyring from './index';
import Keyring from '.';
const PHRASE = 'bottom drive obey lake curtain smoke basket hold race lonely fit walk';
+1 -1
View File
@@ -4,7 +4,7 @@
import { KeyringInstance, KeyringOptions } from './types';
import Keyring from './index';
import Keyring from '.';
const DEV_PHRASE = 'bottom drive obey lake curtain smoke basket hold race lonely fit walk';
const SEEDS = ['Alice', 'Bob', 'Charlie', 'Dave', 'Eve', 'Ferdie'];
+1 -1
View File
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { hexToU8a } from '@polkadot/util/index';
import { hexToU8a } from '@polkadot/util';
import decode from './decode';
+1 -1
View File
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { compactStripLength, logger } from '@polkadot/util/index';
import { compactStripLength, logger } from '@polkadot/util';
import NodeHeader, { BranchHeader, NibbleHeader } from './NodeHeader';
import { NODE_TYPE_NULL, NODE_TYPE_BRANCH, NODE_TYPE_EXT, NODE_TYPE_LEAF } from './constants';
+1 -1
View File
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { hexToU8a } from '@polkadot/util/index';
import { hexToU8a } from '@polkadot/util';
import encode from './encode';
+1 -1
View File
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { compactAddLength, u8aConcat, isU8a, logger } from '@polkadot/util/index';
import { compactAddLength, u8aConcat, isU8a, logger } from '@polkadot/util';
import NodeHeader from './NodeHeader';
import { NODE_TYPE_BRANCH, NODE_TYPE_EXT, NODE_TYPE_LEAF, NODE_TYPE_NULL } from './constants';
+1 -1
View File
@@ -2,6 +2,6 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { blake2AsU8a as hashing } from '@polkadot/util-crypto/index';
import { blake2AsU8a as hashing } from '@polkadot/util-crypto';
export default hashing;
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { u8aConcat } from '@polkadot/util/index';
import { u8aConcat } from '@polkadot/util';
import { BRANCH_NODE_NO_VALUE, BRANCH_NODE_WITH_VALUE } from '../constants';
import createValue from './createValue';
+1 -1
View File
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { u8aConcat } from '@polkadot/util/index';
import { u8aConcat } from '@polkadot/util';
import { fuseNibbles } from '../util';
import createValue from './createValue';
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { compactAddLength } from '@polkadot/util/index';
import { compactAddLength } from '@polkadot/util';
const NO_VALUE = new Uint8Array();
+1 -1
View File
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { assert, u8aConcat } from '@polkadot/util/index';
import { assert, u8aConcat } from '@polkadot/util';
import { EXTENSION_NODE_BIG, EXTENSION_NODE_OFFSET, LEAF_NODE_BIG, LEAF_NODE_OFFSET } from '../constants';
import fromNibbles from './fromNibbles';
+2 -2
View File
@@ -6,9 +6,9 @@ import { TxDb, ProgressCb } from '@polkadot/db/types';
import { Codec } from '@polkadot/trie-codec/types';
import { EncodedPath, TrieDb, Node, NodeBranch, NodeEncodedOrEmpty, NodeKv, NodeNotEmpty, NodeType } from './types';
import substrateCodec from '@polkadot/trie-codec/index';
import substrateCodec from '@polkadot/trie-codec';
import { decodeNibbles, encodeNibbles, extractNodeKey } from '@polkadot/trie-codec/nibbles';
import { isNull, logger , u8aConcat, u8aToHex } from '@polkadot/util/index';
import { isNull, logger , u8aConcat, u8aToHex } from '@polkadot/util';
import { isBranchNode, isEmptyNode, isExtensionNode, isKvNode, isLeafNode } from './util/is';
import { keyEquals, keyStartsWith, computeExtensionKey, computeLeafKey, consumeCommonPrefix } from './util/key';
+1 -1
View File
@@ -4,7 +4,7 @@
import { Codec } from '@polkadot/trie-codec/types';
import { trieRoot } from '@polkadot/trie-hash/index';
import { trieRoot } from '@polkadot/trie-hash';
export type Constants = {
EMPTY_NODE: Uint8Array,
+1 -1
View File
@@ -6,7 +6,7 @@ import toU8a from '@polkadot/util/u8a/toU8a';
import u8aToHex from '@polkadot/util/u8a/toHex';
import ethereumCodec from './ethereumCodec';
import Trie from './index';
import Trie from '.';
import getTests from '../../util-rlp/test/getTests';
// const trietest = getTests('TrieTests/trietest.json');
+2 -2
View File
@@ -4,8 +4,8 @@
import { Codec } from '@polkadot/trie-codec/types';
import { blake2AsU8a } from '@polkadot/util-crypto/index';
import { decode, encode } from '@polkadot/util-rlp/index';
import { blake2AsU8a } from '@polkadot/util-crypto';
import { decode, encode } from '@polkadot/util-rlp';
const codec: Codec = {
decode,
+3 -3
View File
@@ -2,10 +2,10 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { alexander, driedDanta } from '@polkadot/chainspec/index';
import { hexToU8a, u8aToHex } from '@polkadot/util/index';
import { alexander, driedDanta } from '@polkadot/chainspec';
import { hexToU8a, u8aToHex } from '@polkadot/util';
import Trie from './index';
import Trie from '.';
describe('genesis roots', () => {
[alexander, driedDanta].forEach(({ genesis: { raw }, genesisRoot, name }) => {
+1 -1
View File
@@ -7,7 +7,7 @@ import u8aToHex from '@polkadot/util/u8a/toHex';
import toU8a from '@polkadot/util/u8a/toU8a';
import ethereumCodec from './ethereumCodec';
import Trie from './index';
import Trie from '.';
// FIXME These are not working, the trie-hash implementation is now substrate-specific
describe.skip('Ethereum', () => {
+1 -1
View File
@@ -8,7 +8,7 @@ import { TrieDb, Node } from './types';
import MemoryDb from '@polkadot/db/Memory';
import { toNibbles } from '@polkadot/trie-codec/util';
import { isNull, logger, u8aToHex } from '@polkadot/util/index';
import { isNull, logger, u8aToHex } from '@polkadot/util';
import Impl from './Impl';
import constants from './constants';
+3 -3
View File
@@ -2,10 +2,10 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { trieRoot } from '@polkadot/trie-hash/index';
import { u8aToHex, u8aToU8a as toU8a } from '@polkadot/util/index';
import { trieRoot } from '@polkadot/trie-hash';
import { u8aToHex, u8aToU8a as toU8a } from '@polkadot/util';
import Trie from './index';
import Trie from '.';
describe('snapshots', () => {
let trie: Trie;
+2 -2
View File
@@ -2,10 +2,10 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { u8aToHex } from '@polkadot/util/index';
import { u8aToHex } from '@polkadot/util';
import testdata, { TestData } from '../../trie-hash/test/data';
import Trie from './index';
import Trie from '.';
describe('substrate tests', () => {
let trie: Trie;
+1 -1
View File
@@ -4,7 +4,7 @@
import { Node, NodeBranch, NodeKv, NodeEmpty, NodeType } from '../types';
import { isNull } from '@polkadot/util/index';
import { isNull } from '@polkadot/util';
import { getNodeType } from './node';
+1 -1
View File
@@ -3,7 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import { addNibblesTerminator, encodeNibbles } from '@polkadot/trie-codec/nibbles';
import { isNull } from '@polkadot/util/index';
import { isNull } from '@polkadot/util';
import { EncodedPath } from '../types';
+1 -1
View File
@@ -6,7 +6,7 @@ import { Codec } from '@polkadot/trie-codec/types';
import { Node, NodeType, NodeNotEmpty } from '../types';
import { decodeNibbles, isNibblesTerminated } from '@polkadot/trie-codec/nibbles';
import { isNull } from '@polkadot/util/index';
import { isNull } from '@polkadot/util';
import { isBranchNode, isEmptyNode, isKvNode } from './is';
+1 -1
View File
@@ -5,7 +5,7 @@
import { Codec } from '@polkadot/trie-codec/types';
import { sharedPrefixLength } from '@polkadot/trie-codec/util';
import { u8aConcat } from '@polkadot/util/index';
import { u8aConcat } from '@polkadot/util';
import { DEFAULT_CODEC, DEFAULT_STREAM } from './defaults';
+1 -1
View File
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import DEFAULT_CODEC, { stream as DEFAULT_STREAM } from '@polkadot/trie-codec/index';
import DEFAULT_CODEC, { stream as DEFAULT_STREAM } from '@polkadot/trie-codec';
export {
DEFAULT_CODEC,
+2 -2
View File
@@ -2,8 +2,8 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { alexander, driedDanta } from '@polkadot/chainspec/index';
import { hexToU8a, u8aToHex } from '@polkadot/util/index';
import { alexander, driedDanta } from '@polkadot/chainspec';
import { hexToU8a, u8aToHex } from '@polkadot/util';
import trieRoot from './trieRoot';
+1 -1
View File
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { u8aToHex } from '@polkadot/util/index';
import { u8aToHex } from '@polkadot/util';
import trieRoot from './trieRoot';
import testdata from '../test/data';
@@ -2,9 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { stringToU8a, u8aToHex } from '@polkadot/util/index';
import { stringToU8a, u8aToHex } from '@polkadot/util';
import { trieRootOrdered } from './index';
import { trieRootOrdered } from '.';
describe('trieRootOrdered', () => {
it('encodes values', () => {
+1 -1
View File
@@ -4,7 +4,7 @@
import { Codec } from '@polkadot/trie-codec/types';
import { compactToU8a } from '@polkadot/util/index';
import { compactToU8a } from '@polkadot/util';
import { DEFAULT_CODEC } from './defaults';
import trieRoot from './trieRoot';
+1 -1
View File
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { u8aToHex } from '@polkadot/util/index';
import { u8aToHex } from '@polkadot/util';
import unhashedTrie from './unhashedTrie';
import testdata from '../test/data';
+1 -1
View File
@@ -6,7 +6,7 @@ import { Codec } from '@polkadot/trie-codec/types';
import { TriePair } from './types';
import { toNibbles } from '@polkadot/trie-codec/util';
import { u8aToHex } from '@polkadot/util/index';
import { u8aToHex } from '@polkadot/util';
import buildTrie from './buildTrie';
import { DEFAULT_CODEC } from './defaults';
+1 -1
View File
@@ -4,7 +4,7 @@
import { TriePair } from '../src/types';
import { hexToU8a, stringToU8a } from '@polkadot/util/index';
import { hexToU8a, stringToU8a } from '@polkadot/util';
export type TestData = {
desc: string,
@@ -4,7 +4,7 @@
import hexToU8a from '@polkadot/util/hex/toU8a';
import { blake2AsHex } from './index';
import { blake2AsHex } from '.';
describe('blake2AsHex', () => {
it('returns a 64-bit value (specified)', () => {
@@ -4,7 +4,7 @@
import hexToU8a from '@polkadot/util/hex/toU8a';
import { blake2AsU8a } from './index';
import { blake2AsU8a } from '.';
describe('blake2AsU8a', () => {
it('returns a 64-bit value by default', () => {
@@ -4,7 +4,7 @@
import hexToU8a from '@polkadot/util/hex/toU8a';
import { blake2bAsHex } from './index';
import { blake2bAsHex } from '.';
describe('blake2bAsHex', () => {
it('creates the correct hash', () => {
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { u8aToHex } from '@polkadot/util/index';
import { u8aToHex } from '@polkadot/util';
import blake2bAsU8a from './asU8a';
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { blake2bAsU8a } from './index';
import { blake2bAsU8a } from '.';
describe('blake2bAsU8a', () => {
it('creates the correct hash (default length)', () => {
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { keccakAsHex } from './index';
import { keccakAsHex } from '.';
const value = 'test value';
const result = '2d07364b5c231c56ce63d49430e085ea3033c750688ba532b24029124c26ca5e';
+1 -1
View File
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { u8aToHex } from '@polkadot/util/index';
import { u8aToHex } from '@polkadot/util';
import keccakAsU8a from './asU8a';
@@ -2,9 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { hexToU8a, stringToU8a } from '@polkadot/util/index';
import { hexToU8a, stringToU8a } from '@polkadot/util';
import { keccakAsU8a } from './index';
import { keccakAsU8a } from '.';
describe('keccakAsU8a', () => {
const input = 'test value';
@@ -3,7 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import BN from 'bn.js';
import { bnToHex, compactAddLength, hexToU8a, isBn, isHex, isNumber, isString, stringToU8a } from '@polkadot/util/index';
import { bnToHex, compactAddLength, hexToU8a, isBn, isHex, isNumber, isString, stringToU8a } from '@polkadot/util';
import blake2AsU8a from '../blake2/asU8a';
+1 -1
View File
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { assert, isNull } from '@polkadot/util/index';
import { assert, isNull } from '@polkadot/util';
import DeriveJunction from './DeriveJunction';
+1 -1
View File
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { assert, compactAddLength, stringToU8a, u8aConcat } from '@polkadot/util/index';
import { assert, compactAddLength, stringToU8a, u8aConcat } from '@polkadot/util';
import blake2AsU8a from '../blake2/asU8a';
import DeriveJunction from './DeriveJunction';
+1 -1
View File
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { stringToU8a, u8aConcat } from '@polkadot/util/index';
import { stringToU8a, u8aConcat } from '@polkadot/util';
import blake2AsU8a from '../blake2/asU8a';
import DeriveJunction from './DeriveJunction';
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { u8aToHex } from '@polkadot/util/index';
import { u8aToHex } from '@polkadot/util';
import toEntropy from './toEntropy';
import tests from '../schnorrkel/keypair/testing';
@@ -3,7 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import { mnemonicToEntropy } from 'bip39';
import { hexAddPrefix, hexToU8a } from '@polkadot/util/index';
import { hexAddPrefix, hexToU8a } from '@polkadot/util';
export default function toEntropy (mnemonic: string): Uint8Array {
return hexToU8a(
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { u8aToHex } from '@polkadot/util/index';
import { u8aToHex } from '@polkadot/util';
import mnemonicToMiniSecret from './toMiniSecret';
import tests from '../schnorrkel/keypair/testing';
@@ -3,7 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import { pbkdf2Sync } from 'pbkdf2';
import { bufferToU8a, stringToU8a, u8aToBuffer } from '@polkadot/util/index';
import { bufferToU8a, stringToU8a, u8aToBuffer } from '@polkadot/util';
import toEntropy from './toEntropy';
@@ -3,7 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import { mnemonicToSeed } from 'bip39';
import { bufferToU8a } from '@polkadot/util/index';
import { bufferToU8a } from '@polkadot/util';
export default function toSecret (mnemonic: string): Uint8Array {
return bufferToU8a(
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { naclDecrypt, naclEncrypt } from './index';
import { naclDecrypt, naclEncrypt } from '.';
describe('naclDecrypt', () => {
it('decrypts a encrypted message', () => {
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { naclEncrypt } from './index';
import { naclEncrypt } from '.';
describe('naclEncrypt', () => {
it('encrypts a message', () => {
@@ -4,7 +4,7 @@
import { Keypair } from '../../types';
import { naclKeypairFromRandom } from '../index';
import { naclKeypairFromRandom } from '..';
describe('naclKeypairFromRandom', () => {
let keypair: Keypair;
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { naclKeypairFromSecret } from '../index';
import { naclKeypairFromSecret } from '..';
describe('naclKeypairFromSecret', () => {
const secretKey = new Uint8Array([
@@ -2,9 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { stringToU8a } from '@polkadot/util/index';
import { stringToU8a } from '@polkadot/util';
import { naclKeypairFromSeed } from '../index';
import { naclKeypairFromSeed } from '..';
describe('naclKeypairFromSeed', () => {
// NOTE: Aligned with Rust test, b"12345678901234567890123456789012"
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { naclKeypairFromString } from '../index';
import { naclKeypairFromString } from '..';
describe('naclKeypairFromSeed', () => {
it('generates a valid publicKey/secretKey pair', () => {
@@ -4,7 +4,7 @@
import { Keypair } from '../../types';
import { stringToU8a } from '@polkadot/util/index';
import { stringToU8a } from '@polkadot/util';
import blake2AsU8a from '../../blake2/asU8a';
import fromSeed from './fromSeed';
+2 -2
View File
@@ -2,9 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { stringToU8a } from '@polkadot/util/index';
import { stringToU8a } from '@polkadot/util';
import { naclSign, naclKeypairFromSeed } from './index';
import { naclSign, naclKeypairFromSeed } from '.';
describe('naclSign', () => {
let secretKey: Uint8Array;
+1 -1
View File
@@ -5,7 +5,7 @@
import { Keypair } from '../types';
import nacl from 'tweetnacl';
import { assert } from '@polkadot/util/index';
import { assert } from '@polkadot/util';
/**
* @name naclSign
+2 -2
View File
@@ -2,9 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { stringToU8a } from '@polkadot/util/index';
import { stringToU8a } from '@polkadot/util';
import { naclVerify, naclKeypairFromSeed } from './index';
import { naclVerify, naclKeypairFromSeed } from '.';
describe('naclSign', () => {
let publicKey: Uint8Array;
@@ -2,9 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { isHex } from '@polkadot/util/index';
import { isHex } from '@polkadot/util';
import { randomAsHex } from './index';
import { randomAsHex } from '.';
describe('randomAsBuffer', () => {
it('generated results does not match', () => {
+1 -1
View File
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { u8aToHex } from '@polkadot/util/index';
import { u8aToHex } from '@polkadot/util';
import randomAsU8a from './asU8a';
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { randomAsNumber } from './index';
import { randomAsNumber } from '.';
describe('randomAsNumber', () => {
it('generates subsequent non-matching numbers', () => {
+1 -1
View File
@@ -3,7 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import BN from 'bn.js';
import { hexToBn } from '@polkadot/util/index';
import { hexToBn } from '@polkadot/util';
import randomAsHex from './asHex';
@@ -2,9 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { isU8a } from '@polkadot/util/index';
import { isU8a } from '@polkadot/util';
import { randomAsU8a } from './index';
import { randomAsU8a } from '.';
describe('randomAsU8a', () => {
it('generates a Uint8Array', () => {
@@ -4,10 +4,10 @@
import '../test-polyfill';
import { stringToU8a, u8aToHex } from '@polkadot/util/index';
import { stringToU8a, u8aToHex } from '@polkadot/util';
import { mnemonicToMiniSecret } from '../../mnemonic';
import { schnorrkelKeypairFromSeed, schnorrkelWaitReady } from '../index';
import { schnorrkelKeypairFromSeed, schnorrkelWaitReady } from '..';
import tests from './testing';
describe('schnorrkelKeypairFromSeed', () => {
+1 -1
View File
@@ -4,7 +4,7 @@
import { Keypair } from '../types';
import { assert } from '@polkadot/util/index';
import { assert } from '@polkadot/util';
import schnorrkel from '@polkadot/schnorrkel-js';
@@ -4,7 +4,7 @@
import './test-polyfill';
import { stringToU8a } from '@polkadot/util/index';
import { stringToU8a } from '@polkadot/util';
import randomAsU8a from '../random/asU8a';
import pairFromSeed from './keypair/fromSeed';
@@ -3,7 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import secp256k1 from 'secp256k1';
import { bufferToU8a, u8aToBuffer } from '@polkadot/util/index';
import { bufferToU8a, u8aToBuffer } from '@polkadot/util';
/**
* @name secp256k1Recover
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { sha512AsU8a } from './index';
import { sha512AsU8a } from '.';
describe('sha512AsU8a', () => {
it('creates a sha-512 hash', () => {
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { xxhashAsHex } from './index';
import { xxhashAsHex } from '.';
describe('xxhashAsHex', () => {
it('returns a 64-bit value by default', () => {
+1 -1
View File
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { u8aToHex } from '@polkadot/util/index';
import { u8aToHex } from '@polkadot/util';
import xxhashAsU8a from './asU8a';
@@ -2,9 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { hexToU8a } from '@polkadot/util/index';
import { hexToU8a } from '@polkadot/util';
import { xxhashAsU8a } from './index';
import { xxhashAsU8a } from '.';
describe('xxhashAsU8a', () => {
it('returns a 64-bit value by default', () => {
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { xxhash64AsBn } from './index';
import { xxhash64AsBn } from '.';
describe('xxhash64AsBn', () => {
it('creates the correct BN output', () => {
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { xxhash64AsHex } from './index';
import { xxhash64AsHex } from '.';
describe('xxhash64AsHex', () => {
it('creates the correct hex output', () => {
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { hexAddPrefix } from '@polkadot/util/index';
import { hexAddPrefix } from '@polkadot/util';
import xxhash64AsRaw from './asRaw';
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { xxhash64AsRaw } from './index';
import { xxhash64AsRaw } from '.';
describe('xxhash64AsRaw', () => {
it('creates the correct non-prefixed hex output', () => {
@@ -3,7 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import xxhashjs from 'xxhashjs';
import { isBuffer, isString, u8aToBuffer } from '@polkadot/util/index';
import { isBuffer, isString, u8aToBuffer } from '@polkadot/util';
/**
* @name xxhash64AsValue

Some files were not shown because too many files have changed in this diff Show More