diff --git a/packages/api/src/Base.ts b/packages/api/src/Base.ts index 237cdbc038..032d6f98f3 100644 --- a/packages/api/src/Base.ts +++ b/packages/api/src/Base.ts @@ -11,9 +11,7 @@ import extrinsicsFromMeta from '@polkadot/extrinsics/fromMetadata'; import { Storage } from '@polkadot/storage/types'; import storageFromMeta from '@polkadot/storage/fromMetadata'; import registry from '@polkadot/types/codec/typeRegistry'; -import { Hash, Method, RuntimeVersion } from '@polkadot/types/index'; -import Event from '@polkadot/types/Event'; -import RuntimeMetadata from '@polkadot/types/Metadata'; +import { Event, Hash, Metadata, Method, RuntimeVersion } from '@polkadot/types/index'; import { Extrinsics } from '@polkadot/types/Method'; import { assert, isFunction, isObject, isUndefined, logger } from '@polkadot/util'; @@ -36,7 +34,7 @@ export default abstract class ApiBase implements ApiBaseInterface implements ApiBaseInterface implements Codec { ); } else if (isNumber(value) || isBn(value)) { return new Type(bnToBn(value)); - } else if (isU8a(value)) { - const [, _value] = Compact.decodeU8a(value, new Type(0).bitLength()); - - return new Type(_value); } - return new Type(value.toBn()); + const [, _value] = Compact.decodeU8a(value, new Type(0).bitLength()); + + return new Type(_value); } /** diff --git a/packages/types/src/types.ts b/packages/types/src/types.ts index 03b11e478e..9a46279306 100644 --- a/packages/types/src/types.ts +++ b/packages/types/src/types.ts @@ -3,11 +3,8 @@ // of the Apache-2.0 license. See the LICENSE file for details. import BN from 'bn.js'; -import * as Classes from './index'; -import { UInt } from './codec'; - -export type AnyNumber = UInt | BN | Uint8Array | number | string; +export type AnyNumber = BN | Uint8Array | number | string; export type AnyString = string | String; @@ -51,8 +48,6 @@ export interface Codec { export type CodecTo = 'toHex' | 'toJSON' | 'toString' | 'toU8a'; -export type CodecTypes = keyof typeof Classes; - export type Constructor = { new(value?: any): T }; export type ConstructorDef = { [index: string]: Constructor };