import type (#782)

This commit is contained in:
Jaco Greeff
2020-12-01 13:24:37 +01:00
committed by GitHub
parent 7f489e1a99
commit af71673c7b
64 changed files with 74 additions and 72 deletions
+2 -2
View File
@@ -1,8 +1,8 @@
// Copyright 2017-2020 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { KeypairType, Keypair } from '@polkadot/util-crypto/types';
import { KeyringInstance, KeyringPair, KeyringPair$Json, KeyringPair$JsonEncodingTypes, KeyringPair$Meta, KeyringOptions } from './types';
import type { KeypairType, Keypair } from '@polkadot/util-crypto/types';
import type { KeyringInstance, KeyringPair, KeyringPair$Json, KeyringPair$JsonEncodingTypes, KeyringPair$Meta, KeyringOptions } from './types';
import { assert, hexToU8a, isHex, isUndefined, stringToU8a } from '@polkadot/util';
import { base64Decode, decodeAddress, encodeAddress, keyExtractSuri, keyFromPath, naclKeypairFromSeed as naclFromSeed, schnorrkelKeypairFromSeed as schnorrkelFromSeed, secp256k1KeypairFromSeed as secp256k1FromSeed, mnemonicToLegacySeed, mnemonicToMiniSecret } from '@polkadot/util-crypto';
+2 -2
View File
@@ -1,8 +1,8 @@
// Copyright 2017-2020 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { KeyringPair$JsonEncodingTypes } from '../types';
import { PairInfo } from './types';
import type { KeyringPair$JsonEncodingTypes } from '../types';
import type { PairInfo } from './types';
import { assert, stringToU8a, u8aFixLength } from '@polkadot/util';
import { naclDecrypt, scryptEncode, scryptFromU8a } from '@polkadot/util-crypto';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { KeyringPair$JsonEncodingTypes } from '../types';
import type { KeyringPair$JsonEncodingTypes } from '../types';
const ENCODING: KeyringPair$JsonEncodingTypes[] = ['scrypt', 'xsalsa20-poly1305'];
const NONCE_LENGTH = 24;
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { PairInfo } from './types';
import type { PairInfo } from './types';
import { u8aConcat, assert } from '@polkadot/util';
import { naclEncrypt, scryptEncode, scryptToU8a } from '@polkadot/util-crypto';
+3 -3
View File
@@ -1,9 +1,9 @@
// Copyright 2017-2020 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Keypair, KeypairType } from '@polkadot/util-crypto/types';
import { KeyringPair, KeyringPair$Json, KeyringPair$JsonEncodingTypes, KeyringPair$Meta, SignOptions } from '../types';
import { PairInfo } from './types';
import type { Keypair, KeypairType } from '@polkadot/util-crypto/types';
import type { KeyringPair, KeyringPair$Json, KeyringPair$JsonEncodingTypes, KeyringPair$Meta, SignOptions } from '../types';
import type { PairInfo } from './types';
import { assert, u8aConcat, u8aToHex } from '@polkadot/util';
import { blake2AsU8a, ethereumEncode, keccakAsU8a, keyExtractPath, keyFromPath, naclKeypairFromSeed as naclFromSeed, naclSign, schnorrkelKeypairFromSeed as schnorrkelFromSeed, schnorrkelSign, secp256k1Expand, secp256k1KeypairFromSeed as secp256k1FromSeed, secp256k1Sign, secp256k1Compress, signatureVerify } from '@polkadot/util-crypto';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { KeyringPair, KeyringPair$Json, KeyringPair$Meta } from '../types';
import type { KeyringPair, KeyringPair$Json, KeyringPair$Meta } from '../types';
import { encodeAddress } from '@polkadot/util-crypto';
+2 -2
View File
@@ -1,8 +1,8 @@
// Copyright 2017-2020 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { KeypairType } from '@polkadot/util-crypto/types';
import { KeyringPair$Json, KeyringPair$JsonEncodingTypes, KeyringPair$Meta } from '../types';
import type { KeypairType } from '@polkadot/util-crypto/types';
import type { KeyringPair$Json, KeyringPair$JsonEncodingTypes, KeyringPair$Meta } from '../types';
import { base64Encode } from '@polkadot/util-crypto';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { KeyringPairs, KeyringPair } from './types';
import type { KeyringPairs, KeyringPair } from './types';
import { assert, isHex, isU8a, u8aToHex, u8aToU8a } from '@polkadot/util';
import { decodeAddress } from '@polkadot/util-crypto';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { KeyringInstance, KeyringOptions } from './types';
import type { KeyringInstance, KeyringOptions } from './types';
import { hexToU8a } from '@polkadot/util';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { KeyringPair, KeyringOptions } from './types';
import type { KeyringPair, KeyringOptions } from './types';
import { createTestKeyring } from './testing';
import { nobody } from './pair/nobody';
+2 -2
View File
@@ -1,8 +1,8 @@
// Copyright 2017-2020 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Prefix } from '@polkadot/util-crypto/address/types';
import { KeypairType } from '@polkadot/util-crypto/types';
import type { Prefix } from '@polkadot/util-crypto/address/types';
import type { KeypairType } from '@polkadot/util-crypto/types';
export interface KeyringOptions {
ss58Format?: Prefix;
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/networks authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Ss58Registry } from './types';
import type { Ss58Registry } from './types';
import fs from 'fs';
import fetch from '@polkadot/x-fetch';
+1 -1
View File
@@ -6,7 +6,7 @@
//
// Once the above is published as a package, the duplication here can be removed
import { Network, NetworkFromSubstrate } from './types';
import type { Network, NetworkFromSubstrate } from './types';
// These are known prefixes that are not sorted
const UNSORTED = [0, 2, 42];
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Prefix } from './types';
import type { Prefix } from './types';
import { base58Decode } from '../base58/decode';
import { checkAddressChecksum } from './checksum';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Prefix } from './types';
import type { Prefix } from './types';
// Original implementation: https://github.com/paritytech/polka-ui/blob/4858c094684769080f5811f32b081dd7780b0880/src/polkadot.js#L6
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Prefix } from './types';
import type { Prefix } from './types';
import { assert } from '@polkadot/util';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Prefix } from './types';
import type { Prefix } from './types';
// Original implementation: https://github.com/paritytech/polka-ui/blob/4858c094684769080f5811f32b081dd7780b0880/src/polkadot.js#L34
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Prefix } from './types';
import type { Prefix } from './types';
import BN from 'bn.js';
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Prefix } from './types';
import type { Prefix } from './types';
import BN from 'bn.js';
@@ -1,12 +1,12 @@
// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Prefix } from './types';
import type { HashType } from '../secp256k1/types';
import type { Prefix } from './types';
import { u8aConcat } from '@polkadot/util';
import { secp256k1Hasher } from '../secp256k1/hasher';
import { HashType } from '../secp256k1/types';
import { encodeAddress } from './encode';
/**
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Prefix } from './types';
import type { Prefix } from './types';
import { defaults } from './defaults';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Prefix } from './types';
import type { Prefix } from './types';
import { u8aSorted } from '@polkadot/util';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { KeypairType, Keypair } from '../types';
import type { KeypairType, Keypair } from '../types';
import { DeriveJunction } from './DeriveJunction';
import { keyHdkdEd25519 } from './hdkdEd25519';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Keypair } from '../types';
import type { Keypair } from '../types';
import { assert } from '@polkadot/util';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Keypair } from '../types';
import type { Keypair } from '../types';
import { assert } from '@polkadot/util';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Keypair } from '../types';
import type { Keypair } from '../types';
import { schnorrkelDeriveHard } from '../schnorrkel/deriveHard';
import { schnorrkelDeriveSoft } from '../schnorrkel/deriveSoft';
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Keypair } from '../../types';
import type { Keypair } from '../../types';
import * as nacl from 'tweetnacl';
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Keypair } from '../../types';
import type { Keypair } from '../../types';
import { naclKeypairFromRandom } from '..';
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Keypair } from '../../types';
import type { Keypair } from '../../types';
import * as nacl from 'tweetnacl';
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Keypair } from '../../types';
import type { Keypair } from '../../types';
import * as nacl from 'tweetnacl';
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Keypair } from '../../types';
import type { Keypair } from '../../types';
import * as nacl from 'tweetnacl';
import { isReady, ed25519KeypairFromSeed } from '@polkadot/wasm-crypto';
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Keypair } from '../../types';
import type { Keypair } from '../../types';
import { stringToU8a } from '@polkadot/util';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Keypair } from '../types';
import type { Keypair } from '../types';
import * as nacl from 'tweetnacl';
import { assert, u8aToU8a } from '@polkadot/util';
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Keypair } from '../types';
import type { Keypair } from '../types';
import { sr25519DeriveKeypairHard } from '@polkadot/wasm-crypto';
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Keypair } from '../types';
import type { Keypair } from '../types';
import { sr25519DeriveKeypairSoft } from '@polkadot/wasm-crypto';
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Keypair } from '../../types';
import type { Keypair } from '../../types';
import { sr25519KeypairFromSeed } from '@polkadot/wasm-crypto';
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Keypair } from '../../types';
import type { Keypair } from '../../types';
const SEC_LEN = 64;
const PUB_LEN = 32;
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Keypair } from '../../types';
import type { Keypair } from '../../types';
import { u8aConcat } from '@polkadot/util';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Keypair } from '../types';
import type { Keypair } from '../types';
import { assert, u8aToU8a } from '@polkadot/util';
import { sr25519Sign } from '@polkadot/wasm-crypto';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Params } from './types';
import type { Params } from './types';
import scryptsy from 'scryptsy';
import { bufferToU8a, u8aToBuffer, u8aToU8a } from '@polkadot/util';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Params } from './types';
import type { Params } from './types';
import { u8aToBn, assert } from '@polkadot/util';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Params } from './types';
import type { Params } from './types';
import { bnToU8a, u8aConcat } from '@polkadot/util';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { HashType } from './types';
import type { HashType } from './types';
import { blake2AsU8a } from '../blake2';
import { keccakAsU8a } from '../keccak';
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Keypair } from '../../types';
import type { Keypair } from '../../types';
import { assert, bnToU8a } from '@polkadot/util';
+2 -2
View File
@@ -1,8 +1,8 @@
// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Keypair } from '../types';
import { HashType } from './types';
import type { Keypair } from '../types';
import type { HashType } from './types';
import { assert, bnToU8a, u8aConcat } from '@polkadot/util';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { HashType } from './types';
import type { HashType } from './types';
import { assert, u8aEq, u8aToU8a } from '@polkadot/util';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { KeypairType, VerifyResult } from '../types';
import type { KeypairType, VerifyResult } from '../types';
import { assert, u8aToU8a } from '@polkadot/util';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ToBn } from '../types';
import type { ToBn } from '../types';
import BN from 'bn.js';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ToBn, ToBnOptions } from '../types';
import type { ToBn, ToBnOptions } from '../types';
import BN from 'bn.js';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ToBn, ToBnOptions } from '../types';
import type { ToBn, ToBnOptions } from '../types';
import BN from 'bn.js';
+1 -1
View File
@@ -1,6 +1,6 @@
// Copyright 2017-2020 @polkadot/util authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { BitLength } from './types';
import type { BitLength } from './types';
export const DEFAULT_BITLENGTH: BitLength = 32;
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { BitLength } from './types';
import type { BitLength } from './types';
import BN from 'bn.js';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { BitLength } from './types';
import type { BitLength } from './types';
import { DEFAULT_BITLENGTH } from './defaults';
import { compactFromU8a } from './fromU8a';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Time } from './types';
import type { Time } from './types';
const HRS = 60 * 60;
const DAY = HRS * 24;
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { SiDef, ToBn } from '../types';
import type { SiDef, ToBn } from '../types';
import BN from 'bn.js';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/ui-util authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ToBn } from '../types';
import type { ToBn } from '../types';
import BN from 'bn.js';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ToBn } from '../types';
import type { ToBn } from '../types';
import BN from 'bn.js';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { SiDef } from '../types';
import type { SiDef } from '../types';
export const SI_MID = 8;
+2 -1
View File
@@ -1,11 +1,12 @@
// Copyright 2017-2020 @polkadot/util authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ToBnOptions } from '../types';
import BN from 'bn.js';
import { isBoolean } from '../is/boolean';
import { hexStripPrefix } from './stripPrefix';
import { ToBnOptions } from '../types';
function reverse (value: string): string {
return (value.match(/.{1,2}/g) || [])
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Constructor } from '../types';
import type { Constructor } from '../types';
/**
* @name isChildClass
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ToBn } from '../types';
import type { ToBn } from '../types';
import { isFunction } from './function';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Logger } from './types';
import type { Logger } from './types';
import BN from 'bn.js';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Logger, Logger$Data } from './types';
import type { Logger, Logger$Data } from './types';
import { formatDate } from './format/formatDate';
import { isBn } from './is/bn';
+2 -1
View File
@@ -1,11 +1,12 @@
// Copyright 2017-2020 @polkadot/util authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ToBnOptions } from '../types';
import BN from 'bn.js';
import { hexToBn } from '../hex/toBn';
import { u8aToHex } from './toHex';
import { ToBnOptions } from '../types';
/**
* @name u8aToBn