Cleanup util-crypto & keyring imports (#314)
* Cleanup util-crypto & keyring imports * Adjust util imports for types * Bump deps
This commit is contained in:
@@ -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, ' ');
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -11,6 +11,6 @@
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.0.0",
|
||||
"@polkadot/util": "^0.31.6"
|
||||
"@polkadot/util": "^0.32.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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<string> {
|
||||
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<string> {
|
||||
}
|
||||
|
||||
toU8a (isBare?: boolean): Uint8Array {
|
||||
const encoded = u8aFromUtf8(this.raw);
|
||||
const encoded = stringToU8a(this.raw);
|
||||
|
||||
return isBare
|
||||
? encoded
|
||||
|
||||
@@ -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');
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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<Uint8Array> {
|
||||
} else if (value instanceof U8a) {
|
||||
return value.raw;
|
||||
} else {
|
||||
return toU8a(value);
|
||||
return u8aToU8a(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user