diff --git a/docs/examples/promise/07_transfer_dots/index.js b/docs/examples/promise/07_transfer_dots/index.js index e8c83c5c6a..1d5572e938 100755 --- a/docs/examples/promise/07_transfer_dots/index.js +++ b/docs/examples/promise/07_transfer_dots/index.js @@ -1,6 +1,6 @@ // Import the API, Keyring and some utility functions const { ApiPromise } = require('@polkadot/api'); -const Keyring = require('@polkadot/keyring').default; +const { Keyring } = require('@polkadot/keyring'); const u8aFromUtf8 = require('@polkadot/util/u8a/fromUtf8').default; const ALICE_SEED = 'Alice'.padEnd(32, ' '); diff --git a/packages/api-observable/src/Combined.ts b/packages/api-observable/src/Combined.ts index 81965fd1f3..bd9c5543ee 100644 --- a/packages/api-observable/src/Combined.ts +++ b/packages/api-observable/src/Combined.ts @@ -7,7 +7,7 @@ import { RxBalance, RxBalanceMap, RxReferendumVote } from './types'; import BN from 'bn.js'; import { EMPTY, Observable, from } from 'rxjs'; import { switchMap, defaultIfEmpty, map } from 'rxjs/operators'; -import decodeAddress from '@polkadot/keyring/address/decode'; +import { decodeAddress } from '@polkadot/keyring'; import { AccountId, AccountIndex, Balance, bool as Bool, BlockNumber, Moment, ReferendumIndex } from '@polkadot/types/index'; import { ENUMSET_SIZE } from '@polkadot/types/AccountIndex'; import assert from '@polkadot/util/assert'; diff --git a/packages/rpc-core/package.json b/packages/rpc-core/package.json index e20b5d08b8..bbe74257f7 100644 --- a/packages/rpc-core/package.json +++ b/packages/rpc-core/package.json @@ -32,6 +32,6 @@ "@babel/runtime": "^7.0.0", "@polkadot/jsonrpc": "^0.31.59", "@polkadot/rpc-provider": "^0.31.59", - "@polkadot/util": "^0.31.6" + "@polkadot/util": "^0.32.1" } } diff --git a/packages/rpc-provider/package.json b/packages/rpc-provider/package.json index a552e25fab..e6401248e4 100644 --- a/packages/rpc-provider/package.json +++ b/packages/rpc-provider/package.json @@ -30,10 +30,10 @@ "homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme", "dependencies": { "@babel/runtime": "^7.0.0", - "@polkadot/keyring": "^0.31.6", + "@polkadot/keyring": "^0.32.1", "@polkadot/storage": "^0.31.59", - "@polkadot/util": "^0.31.6", - "@polkadot/util-crypto": "^0.31.6", + "@polkadot/util": "^0.32.1", + "@polkadot/util-crypto": "^0.32.1", "@types/nock": "^9.1.3", "eventemitter3": "^3.1.0", "isomorphic-fetch": "^2.2.1", diff --git a/packages/rpc-provider/src/mock/mocks.ts b/packages/rpc-provider/src/mock/mocks.ts index d1543eaf7e..a80c9c0cd3 100644 --- a/packages/rpc-provider/src/mock/mocks.ts +++ b/packages/rpc-provider/src/mock/mocks.ts @@ -14,7 +14,7 @@ import storage from '@polkadot/storage/static'; import Header from '@polkadot/types/Header'; import bnToU8a from '@polkadot/util/bn/toU8a'; import u8aToHex from '@polkadot/util/u8a/toHex'; -import randomAsU8a from '@polkadot/util-crypto/random/asU8a'; +import { randomAsU8a } from '@polkadot/util-crypto'; import testKeyring from '@polkadot/keyring/testing'; const keyring = testKeyring(); diff --git a/packages/type-extrinsics/package.json b/packages/type-extrinsics/package.json index d02ee56ada..dfb1b6fc56 100644 --- a/packages/type-extrinsics/package.json +++ b/packages/type-extrinsics/package.json @@ -11,6 +11,6 @@ "license": "ISC", "dependencies": { "@babel/runtime": "^7.0.0", - "@polkadot/util": "^0.31.6" + "@polkadot/util": "^0.32.1" } } diff --git a/packages/type-storage/package.json b/packages/type-storage/package.json index ce2b60e4ad..8e22fbbdcb 100644 --- a/packages/type-storage/package.json +++ b/packages/type-storage/package.json @@ -30,9 +30,9 @@ "homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-storage#readme", "dependencies": { "@babel/runtime": "^7.0.0", - "@polkadot/keyring": "^0.31.6", + "@polkadot/keyring": "^0.32.1", "@polkadot/types": "^0.31.59", - "@polkadot/util": "^0.31.6", - "@polkadot/util-crypto": "^0.31.6" + "@polkadot/util": "^0.32.1", + "@polkadot/util-crypto": "^0.32.1" } } diff --git a/packages/type-storage/src/utils/createFunction.ts b/packages/type-storage/src/utils/createFunction.ts index cc7416ad98..e6eb261580 100644 --- a/packages/type-storage/src/utils/createFunction.ts +++ b/packages/type-storage/src/utils/createFunction.ts @@ -9,8 +9,8 @@ import { StorageFunction } from '@polkadot/types/StorageKey'; import { Text } from '@polkadot/types/index'; import { stringLowerFirst } from '@polkadot/util/string'; import u8aConcat from '@polkadot/util/u8a/concat'; -import u8aFromUtf8 from '@polkadot/util/u8a/fromUtf8'; -import xxhash from '@polkadot/util-crypto/xxhash/asU8a'; +import stringToU8a from '@polkadot/util/string/toU8a'; +import { xxhashAsU8a } from '@polkadot/util-crypto'; export interface CreateItemOptions { isUnhashed?: boolean; @@ -40,7 +40,7 @@ export default function createFunction ( // assumption, but will break if the base substrate keys employ hashing as well if (options.isUnhashed) { storageFn = (): Uint8Array => - Compact.addLengthPrefix(u8aFromUtf8(method.toString())); + Compact.addLengthPrefix(stringToU8a(method.toString())); } else { // TODO Find better type than any // Can only have zero or one argument: @@ -49,8 +49,8 @@ export default function createFunction ( storageFn = (arg?: any): Uint8Array => { if (!meta.type.isMap) { return Compact.addLengthPrefix( - xxhash( - u8aFromUtf8(`${section.toString()} ${method.toString()}`), + xxhashAsU8a( + stringToU8a(`${section.toString()} ${method.toString()}`), 128 ) ); @@ -64,9 +64,9 @@ export default function createFunction ( // StorageKey is a Bytes, so is length-prefixed return Compact.addLengthPrefix( - xxhash( + xxhashAsU8a( u8aConcat( - u8aFromUtf8(`${section.toString()} ${method.toString()}`), + stringToU8a(`${section.toString()} ${method.toString()}`), createType(type, arg).toU8a(true) ), 128 diff --git a/packages/types/package.json b/packages/types/package.json index 51fd67457c..bb77810d85 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -30,7 +30,7 @@ "homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme", "dependencies": { "@babel/runtime": "^7.0.0", - "@polkadot/keyring": "^0.31.6", - "@polkadot/util": "^0.31.6" + "@polkadot/keyring": "^0.32.1", + "@polkadot/util": "^0.32.1" } } diff --git a/packages/types/src/AccountId.ts b/packages/types/src/AccountId.ts index 6e17048989..fa3ba51947 100644 --- a/packages/types/src/AccountId.ts +++ b/packages/types/src/AccountId.ts @@ -4,12 +4,8 @@ import { AnyU8a } from './types'; -import encodeAddress from '@polkadot/keyring/address/encode'; -import decodeAddress from '@polkadot/keyring/address/decode'; -import hexToU8a from '@polkadot/util/hex/toU8a'; -import isHex from '@polkadot/util/is/hex'; -import isU8a from '@polkadot/util/is/u8a'; -import u8aToU8a from '@polkadot/util/u8a/toU8a'; +import { decodeAddress, encodeAddress } from '@polkadot/keyring'; +import { hexToU8a, isHex, isU8a, u8aToU8a } from '@polkadot/util'; import U8a from './codec/U8a'; import U8aFixed from './codec/U8aFixed'; diff --git a/packages/types/src/AccountIndex.ts b/packages/types/src/AccountIndex.ts index ec6055a217..6a25ed96ef 100644 --- a/packages/types/src/AccountIndex.ts +++ b/packages/types/src/AccountIndex.ts @@ -3,20 +3,11 @@ // of the ISC license. See the LICENSE file for details. import BN from 'bn.js'; -import decodeAddress from '@polkadot/keyring/address/decode'; -import encodeAddress from '@polkadot/keyring/address/encode'; -import hexToU8a from '@polkadot/util/hex/toU8a'; -import isU8a from '@polkadot/util/is/u8a'; -import isHex from '@polkadot/util/is/hex'; -import u8aConcat from '@polkadot/util/u8a/concat'; +import { decodeAddress, encodeAddress } from '@polkadot/keyring'; +import { bnToBn, bnToU8a, hexToU8a, isBn, isNumber, isU8a, isHex, u8aConcat, u8aToBn } from '@polkadot/util'; import { AnyU8a } from './types'; import U8a from './codec/U8a'; -import u8aToBn from '@polkadot/util/u8a/toBn'; -import bnToU8a from '@polkadot/util/bn/toU8a'; -import isNumber from '@polkadot/util/is/number'; -import isBn from '@polkadot/util/is/bn'; -import bnToBn from '@polkadot/util/bn/toBn'; export const ENUMSET_SIZE = new BN(64); diff --git a/packages/types/src/Address.ts b/packages/types/src/Address.ts index fa36c8a4a1..92a808d967 100644 --- a/packages/types/src/Address.ts +++ b/packages/types/src/Address.ts @@ -2,12 +2,8 @@ // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. -import decodeAddress from '@polkadot/keyring/address/decode'; -import isHex from '@polkadot/util/is/hex'; -import isU8a from '@polkadot/util/is/u8a'; -import u8aConcat from '@polkadot/util/u8a/concat'; -import u8aToHex from '@polkadot/util/u8a/toHex'; -import u8aToU8a from '@polkadot/util/u8a/toU8a'; +import { decodeAddress } from '@polkadot/keyring'; +import { isHex, isU8a, u8aConcat, u8aToHex, u8aToU8a } from '@polkadot/util'; import AccountId from './AccountId'; import AccountIndex from './AccountIndex'; diff --git a/packages/types/src/Block.ts b/packages/types/src/Block.ts index 1ab5fec7c0..99a30f680b 100644 --- a/packages/types/src/Block.ts +++ b/packages/types/src/Block.ts @@ -4,7 +4,7 @@ import { AnyU8a } from './types'; -import blake2Asu8a from '@polkadot/util-crypto/blake2/asU8a'; +import { blake2AsU8a } from '@polkadot/util-crypto'; import Struct from './codec/Struct'; import Extrinsics from './Extrinsics'; @@ -32,7 +32,7 @@ export default class Block extends Struct { // convenience, encodes the header and returns the actual hash get hash (): Hash { return new Hash( - blake2Asu8a(this.toU8a(), 256) + blake2AsU8a(this.toU8a(), 256) ); } diff --git a/packages/types/src/Bool.ts b/packages/types/src/Bool.ts index 96c4dde549..f2491e9986 100644 --- a/packages/types/src/Bool.ts +++ b/packages/types/src/Bool.ts @@ -2,7 +2,7 @@ // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. -import isU8a from '@polkadot/util/is/u8a'; +import { isU8a } from '@polkadot/util'; import Base from './codec/Base'; diff --git a/packages/types/src/Bytes.ts b/packages/types/src/Bytes.ts index eef258a3c0..0412786a5e 100644 --- a/packages/types/src/Bytes.ts +++ b/packages/types/src/Bytes.ts @@ -2,11 +2,7 @@ // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. -import hexToU8a from '@polkadot/util/hex/toU8a'; -import isHex from '@polkadot/util/is/hex'; -import isU8a from '@polkadot/util/is/u8a'; -import toU8a from '@polkadot/util/u8a/toU8a'; -import u8aConcat from '@polkadot/util/u8a/concat'; +import { hexToU8a, isHex, isU8a, u8aConcat, u8aToU8a } from '@polkadot/util'; import { AnyU8a } from './types'; import Compact, { DEFAULT_LENGTH_BITS } from './codec/Compact'; @@ -29,6 +25,7 @@ export default class Bytes extends U8a { // Instead of the block below, it should simply be: // return Bytes.decodeBytes(hexToU8a(value as string)); const u8a = hexToU8a(value as string); + return Bytes.decodeBytes( u8aConcat( Compact.encodeU8a(u8a.length, DEFAULT_LENGTH_BITS), @@ -37,9 +34,11 @@ export default class Bytes extends U8a { ); } else if (isU8a(value)) { const [offset, length] = Compact.decodeU8a(value, DEFAULT_LENGTH_BITS); + return value.subarray(offset, offset + length.toNumber()); } - return Bytes.decodeBytes(toU8a(value)); + + return Bytes.decodeBytes(u8aToU8a(value)); } get length (): number { diff --git a/packages/types/src/Extrinsic.ts b/packages/types/src/Extrinsic.ts index 48c09d2faf..b8656cd5e9 100644 --- a/packages/types/src/Extrinsic.ts +++ b/packages/types/src/Extrinsic.ts @@ -5,11 +5,8 @@ import { KeyringPair } from '@polkadot/keyring/types'; import { AnyNumber, AnyU8a } from './types'; -import blake2Asu8a from '@polkadot/util-crypto/blake2/asU8a'; -import hexToU8a from '@polkadot/util/hex/toU8a'; -import isU8a from '@polkadot/util/is/u8a'; -import u8aConcat from '@polkadot/util/u8a/concat'; -import u8aToHex from '@polkadot/util/u8a/toHex'; +import { hexToU8a, isHex, isU8a, u8aConcat, u8aToHex } from '@polkadot/util'; +import { blake2AsU8a } from '@polkadot/util-crypto'; import Compact, { DEFAULT_LENGTH_BITS } from './codec/Compact'; import Struct from './codec/Struct'; @@ -17,7 +14,6 @@ import ExtrinsicSignature from './ExtrinsicSignature'; import Hash from './Hash'; import { FunctionMetadata } from './Metadata'; import Method from './Method'; -import isHex from '@polkadot/util/is/hex'; type ExtrinsicValue = { method?: Method @@ -81,7 +77,7 @@ export default class Extrinsic extends Struct { // convernience, encodes the extrinsic and returns the actual hash get hash (): Hash { return new Hash( - blake2Asu8a(this.toU8a(), 256) + blake2AsU8a(this.toU8a(), 256) ); } diff --git a/packages/types/src/ExtrinsicEra.ts b/packages/types/src/ExtrinsicEra.ts index 8c147c0153..830c0fd28d 100644 --- a/packages/types/src/ExtrinsicEra.ts +++ b/packages/types/src/ExtrinsicEra.ts @@ -4,7 +4,7 @@ import { AnyU8a } from './types'; -import toU8a from '@polkadot/util/u8a/toU8a'; +import { u8aToU8a } from '@polkadot/util'; import U8a from './codec/U8a'; @@ -19,7 +19,7 @@ export default class ExtrinsicEra extends U8a { if (value instanceof U8a) { return value.raw; } else if (value) { - const u8a = toU8a(value); + const u8a = u8aToU8a(value); // If we have a zero byte, it is immortal (1 byte in length), otherwise we have // the era details following as another byte diff --git a/packages/types/src/ExtrinsicSignature.ts b/packages/types/src/ExtrinsicSignature.ts index 17b87b43a8..92d91c491f 100644 --- a/packages/types/src/ExtrinsicSignature.ts +++ b/packages/types/src/ExtrinsicSignature.ts @@ -5,8 +5,7 @@ import { KeyringPair } from '@polkadot/keyring/types'; import { AnyNumber, AnyU8a } from './types'; -import isU8a from '@polkadot/util/is/u8a'; -import u8aConcat from '@polkadot/util/u8a/concat'; +import { isU8a, u8aConcat } from '@polkadot/util'; import Struct from './codec/Struct'; import Address from './Address'; diff --git a/packages/types/src/Header.ts b/packages/types/src/Header.ts index bf3fc4e303..13f30d0da1 100644 --- a/packages/types/src/Header.ts +++ b/packages/types/src/Header.ts @@ -4,7 +4,7 @@ import { AnyNumber, AnyU8a } from './types'; -import blake2Asu8a from '@polkadot/util-crypto/blake2/asU8a'; +import { blake2AsU8a } from '@polkadot/util-crypto'; import Struct from './codec/Struct'; import Vector from './codec/Vector'; @@ -65,7 +65,7 @@ export default class Header extends Struct { // convenience, encodes the header and returns the actual hash get hash (): Hash { return new Hash( - blake2Asu8a(this.toU8a(), 256) + blake2AsU8a(this.toU8a(), 256) ); } diff --git a/packages/types/src/Metadata.ts b/packages/types/src/Metadata.ts index fa79cff6d2..845b1a14f8 100644 --- a/packages/types/src/Metadata.ts +++ b/packages/types/src/Metadata.ts @@ -4,9 +4,7 @@ import { AnyNumber } from './types'; -import hexToU8a from '@polkadot/util/hex/toU8a'; -import isHex from '@polkadot/util/is/hex'; -import isU8a from '@polkadot/util/is/u8a'; +import { hexToU8a, isHex, isU8a } from '@polkadot/util'; import Base from './codec/Base'; import Compact, { DEFAULT_LENGTH_BITS } from './codec/Compact'; diff --git a/packages/types/src/Method.ts b/packages/types/src/Method.ts index c395756d2f..30c0395ca4 100644 --- a/packages/types/src/Method.ts +++ b/packages/types/src/Method.ts @@ -4,8 +4,7 @@ import assert from '@polkadot/util/assert'; import { ExtrinsicFunction, Extrinsics } from '@polkadot/extrinsics/types'; -import isObject from '@polkadot/util/is/object'; -import isU8a from '@polkadot/util/is/u8a'; +import { isHex, isObject, isU8a } from '@polkadot/util'; import Base from './codec/Base'; import { Constructor } from './types'; @@ -13,7 +12,6 @@ import { FunctionMetadata, FunctionArgumentMetadata } from './Metadata'; import { getTypeDef, getTypeClass } from './codec/createType'; import MethodIndex from './MethodIndex'; import Struct from './codec/Struct'; -import isHex from '@polkadot/util/is/hex'; const FN_UNKNOWN = { method: 'unknown', diff --git a/packages/types/src/Moment.ts b/packages/types/src/Moment.ts index e5d23584f3..69ae678f5e 100644 --- a/packages/types/src/Moment.ts +++ b/packages/types/src/Moment.ts @@ -3,11 +3,7 @@ // of the ISC license. See the LICENSE file for details. import BN from 'bn.js'; -import bnToBn from '@polkadot/util/bn/toBn'; -import bnToU8a from '@polkadot/util/bn/toU8a'; -import isString from '@polkadot/util/is/string'; -import isU8a from '@polkadot/util/is/u8a'; -import u8aToBn from '@polkadot/util/u8a/toBn'; +import { bnToBn, bnToU8a, isString, isU8a, u8aToBn } from '@polkadot/util'; import { AnyNumber } from './types'; import Base from './codec/Base'; diff --git a/packages/types/src/StorageKey.ts b/packages/types/src/StorageKey.ts index 310d1fe439..1515d66898 100644 --- a/packages/types/src/StorageKey.ts +++ b/packages/types/src/StorageKey.ts @@ -4,7 +4,7 @@ import { AnyU8a } from './types'; -import isFunction from '@polkadot/util/is/function'; +import { isFunction } from '@polkadot/util'; import Bytes from './Bytes'; import { StorageFunctionMetadata } from './Metadata'; diff --git a/packages/types/src/Text.ts b/packages/types/src/Text.ts index eb09c22097..b8335ed57c 100644 --- a/packages/types/src/Text.ts +++ b/packages/types/src/Text.ts @@ -2,11 +2,7 @@ // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. -import isFunction from '@polkadot/util/is/function'; -import isString from '@polkadot/util/is/string'; -import u8aFromUtf8 from '@polkadot/util/u8a/fromUtf8'; -import u8aToUtf8 from '@polkadot/util/u8a/toUtf8'; -import u8aConcat from '@polkadot/util/u8a/concat'; +import { isFunction, isString, stringToU8a, u8aToString, u8aConcat } from '@polkadot/util'; import { AnyU8a } from '@polkadot/types/types'; import Base from './codec/Base'; @@ -35,7 +31,7 @@ export default class Text extends Base { return input.raw; } else if (input instanceof Uint8Array) { const [offset, length] = Compact.decodeU8a(input, DEFAULT_LENGTH_BITS); - return u8aToUtf8(input.subarray(offset, offset + length.toNumber())); + return u8aToString(input.subarray(offset, offset + length.toNumber())); } else if (input instanceof U8a) { return Text.decodeText(input.raw); } else if (isFunction(input.toString)) { @@ -62,7 +58,7 @@ export default class Text extends Base { } toU8a (isBare?: boolean): Uint8Array { - const encoded = u8aFromUtf8(this.raw); + const encoded = stringToU8a(this.raw); return isBare ? encoded diff --git a/packages/types/src/codec/Base.ts b/packages/types/src/codec/Base.ts index 0a2de7363f..1cd0d51651 100644 --- a/packages/types/src/codec/Base.ts +++ b/packages/types/src/codec/Base.ts @@ -2,7 +2,7 @@ // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. -import logger from '@polkadot/util/logger'; +import { logger } from '@polkadot/util'; export const l = logger('codec'); diff --git a/packages/types/src/codec/Compact.ts b/packages/types/src/codec/Compact.ts index 7d592b01dd..c001a9f790 100644 --- a/packages/types/src/codec/Compact.ts +++ b/packages/types/src/codec/Compact.ts @@ -3,12 +3,7 @@ // of the ISC license. See the LICENSE file for details. import BN from 'bn.js'; -import bnToBn from '@polkadot/util/bn/toBn'; -import bnToU8a from '@polkadot/util/bn/toU8a'; -import isU8a from '@polkadot/util/is/u8a'; -import u8aConcat from '@polkadot/util/u8a/concat'; -import u8aToBn from '@polkadot/util/u8a/toBn'; -import toU8a from '@polkadot/util/u8a/toU8a'; +import { bnToBn, bnToU8a, isU8a, u8aToBn, u8aConcat, u8aToU8a } from '@polkadot/util'; import { AnyNumber, AnyU8a } from '../types'; import UInt, { UIntBitLength } from './UInt'; @@ -61,7 +56,7 @@ export default class Compact extends UInt { } static decodeU8a (_input: Uint8Array | string, bitLength: UIntBitLength): [number, BN] { - const input = toU8a(_input); + const input = u8aToU8a(_input); const flag = input[0] & 0b11; if (flag === 0b00) { diff --git a/packages/types/src/codec/Enum.ts b/packages/types/src/codec/Enum.ts index b28b7cd65b..edcf622fb4 100644 --- a/packages/types/src/codec/Enum.ts +++ b/packages/types/src/codec/Enum.ts @@ -2,7 +2,7 @@ // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. -import isU8a from '@polkadot/util/is/u8a'; +import { isU8a } from '@polkadot/util'; import Base from './Base'; diff --git a/packages/types/src/codec/EnumType.ts b/packages/types/src/codec/EnumType.ts index 9a25f4cbfa..42a97138e3 100644 --- a/packages/types/src/codec/EnumType.ts +++ b/packages/types/src/codec/EnumType.ts @@ -2,10 +2,7 @@ // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. -import isNumber from '@polkadot/util/is/number'; -import isObject from '@polkadot/util/is/object'; -import isU8a from '@polkadot/util/is/u8a'; -import isUndefined from '@polkadot/util/is/undefined'; +import { isNumber, isObject, isU8a, isUndefined } from '@polkadot/util'; import Base from './Base'; import { Constructor } from '../types'; diff --git a/packages/types/src/codec/Option.ts b/packages/types/src/codec/Option.ts index 2578139611..51ae6d02e8 100644 --- a/packages/types/src/codec/Option.ts +++ b/packages/types/src/codec/Option.ts @@ -2,9 +2,7 @@ // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. -import isNull from '@polkadot/util/is/null'; -import isU8a from '@polkadot/util/is/u8a'; -import isUndefined from '@polkadot/util/is/undefined'; +import { isNull, isU8a, isUndefined } from '@polkadot/util'; import Base from './Base'; import { Constructor } from '../types'; diff --git a/packages/types/src/codec/Struct.ts b/packages/types/src/codec/Struct.ts index d4d966e6a9..2e6c8f1464 100644 --- a/packages/types/src/codec/Struct.ts +++ b/packages/types/src/codec/Struct.ts @@ -2,11 +2,7 @@ // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. -import hexToU8a from '@polkadot/util/hex/toU8a'; -import isHex from '@polkadot/util/is/hex'; -import isObject from '@polkadot/util/is/object'; -import isU8a from '@polkadot/util/is/u8a'; -import u8aConcat from '@polkadot/util/u8a/concat'; +import { hexToU8a, isHex, isObject, isU8a, u8aConcat } from '@polkadot/util'; import Base from './Base'; import { Constructor } from '../types'; diff --git a/packages/types/src/codec/U8a.ts b/packages/types/src/codec/U8a.ts index c3fcbd8d76..deefac328b 100644 --- a/packages/types/src/codec/U8a.ts +++ b/packages/types/src/codec/U8a.ts @@ -2,9 +2,7 @@ // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. -import isU8a from '@polkadot/util/is/u8a'; -import u8aToHex from '@polkadot/util/u8a/toHex'; -import toU8a from '@polkadot/util/u8a/toU8a'; +import { isU8a, u8aToHex, u8aToU8a } from '@polkadot/util'; import { AnyU8a } from '../types'; import Base from './Base'; @@ -26,7 +24,7 @@ export default class U8a extends Base { } else if (value instanceof U8a) { return value.raw; } else { - return toU8a(value); + return u8aToU8a(value); } } diff --git a/packages/types/src/codec/UInt.ts b/packages/types/src/codec/UInt.ts index 6d1ceb2cfe..551c60971d 100644 --- a/packages/types/src/codec/UInt.ts +++ b/packages/types/src/codec/UInt.ts @@ -5,14 +5,7 @@ import { AnyNumber } from '../types'; import BN from 'bn.js'; -import isHex from '@polkadot/util/is/hex'; -import isString from '@polkadot/util/is/string'; -import isU8a from '@polkadot/util/is/u8a'; -import bnToBn from '@polkadot/util/bn/toBn'; -import bnToHex from '@polkadot/util/bn/toHex'; -import bnToU8a from '@polkadot/util/bn/toU8a'; -import hexToBn from '@polkadot/util/hex/toBn'; -import u8aToBn from '@polkadot/util/u8a/toBn'; +import { bnToBn, bnToHex, bnToU8a, hexToBn, isHex, isString, isU8a, u8aToBn } from '@polkadot/util'; import Base from './Base'; diff --git a/packages/types/src/codec/Vector.ts b/packages/types/src/codec/Vector.ts index 04eebbc6b5..0fccca3ddf 100644 --- a/packages/types/src/codec/Vector.ts +++ b/packages/types/src/codec/Vector.ts @@ -2,8 +2,7 @@ // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. -import u8aConcat from '@polkadot/util/u8a/concat'; -import toU8a from '@polkadot/util/u8a/toU8a'; +import { u8aConcat, u8aToU8a } from '@polkadot/util'; import Base from './Base'; import Compact, { DEFAULT_LENGTH_BITS } from './Compact'; @@ -36,7 +35,7 @@ export default class Vector< ); } - const u8a = toU8a(value); + const u8a = u8aToU8a(value); let [offset, _length] = Compact.decodeU8a(value, DEFAULT_LENGTH_BITS); const length = _length.toNumber(); diff --git a/packages/types/src/codec/createType.ts b/packages/types/src/codec/createType.ts index 4121131efe..2e1c52458c 100644 --- a/packages/types/src/codec/createType.ts +++ b/packages/types/src/codec/createType.ts @@ -2,7 +2,7 @@ // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. -import assert from '@polkadot/util/assert'; +import { assert } from '@polkadot/util'; import Text from '../Text'; import Base from './Base'; diff --git a/yarn.lock b/yarn.lock index d3b2418f67..4cdcc2ce21 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1219,13 +1219,13 @@ typedoc-plugin-markdown "^1.1.15" typescript "^3.0.1" -"@polkadot/keyring@^0.31.6": - version "0.31.6" - resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-0.31.6.tgz#1152dd5f7044e5cb9436cd99f002b1eb055a7398" +"@polkadot/keyring@^0.32.1": + version "0.32.1" + resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-0.32.1.tgz#5e545984d085024f7f51ffeae382745f9446736d" dependencies: "@babel/runtime" "^7.0.0" - "@polkadot/util" "^0.31.6" - "@polkadot/util-crypto" "^0.31.6" + "@polkadot/util" "^0.32.1" + "@polkadot/util-crypto" "^0.32.1" "@types/bs58" "^3.0.30" bs58 "^4.0.1" @@ -1233,12 +1233,12 @@ version "0.1.30" resolved "https://registry.yarnpkg.com/@polkadot/ts/-/ts-0.1.30.tgz#d6d1498a5597e09de88f6117663bcf842040c801" -"@polkadot/util-crypto@^0.31.6": - version "0.31.6" - resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-0.31.6.tgz#1f5dc22b1358023b57e96f8caceba952654a3a88" +"@polkadot/util-crypto@^0.32.1": + version "0.32.1" + resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-0.32.1.tgz#3f20951299229d13c4d6f160ee427b2cdc633f42" dependencies: "@babel/runtime" "^7.0.0" - "@polkadot/util" "^0.31.6" + "@polkadot/util" "^0.32.1" "@types/bip39" "^2.4.0" bip39 "^2.5.0" blakejs "^1.1.0" @@ -1246,9 +1246,9 @@ tweetnacl "^1.0.0" xxhashjs "^0.2.2" -"@polkadot/util@^0.31.6": - version "0.31.6" - resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-0.31.6.tgz#d22fd6729a4c14e624083404ce75335f7cbdfddd" +"@polkadot/util@^0.32.1": + version "0.32.1" + resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-0.32.1.tgz#9695e8ce0630db44200ad15c4b6e3df1a574c381" dependencies: "@babel/runtime" "^7.0.0" "@types/bn.js" "^4.11.1"