diff --git a/babel.esnext-unused.js b/babel.esnext.js similarity index 100% rename from babel.esnext-unused.js rename to babel.esnext.js diff --git a/package.json b/package.json index f9ec894e9d..8377bbfa10 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "@babel/core": "^7.12.3", "@babel/register": "^7.12.1", "@babel/runtime": "^7.12.1", - "@polkadot/dev": "^0.59.21", + "@polkadot/dev": "^0.59.22", "@polkadot/ts": "^0.3.53", "@polkadot/typegen": "workspace:packages/typegen", "@types/jest": "^26.0.15", diff --git a/packages/api-contract/package.json b/packages/api-contract/package.json index 24f1eed83c..a8598edbf5 100644 --- a/packages/api-contract/package.json +++ b/packages/api-contract/package.json @@ -3,7 +3,7 @@ "version": "2.6.2-3", "description": "Interfaces for interacting with contracts and contract ABIs", "main": "index.js", - "module": "esnext/index.js", + "module": "index.mjs", "sideEffects": false, "keywords": [ "Polkadot", @@ -31,7 +31,7 @@ "@babel/runtime": "^7.12.1", "@polkadot/api": "2.6.2-3", "@polkadot/types": "2.6.2-3", - "@polkadot/util": "^4.0.2-7", + "@polkadot/util": "^4.0.2-8", "bn.js": "^5.1.3", "rxjs": "^6.6.3" } diff --git a/packages/api-derive/package.json b/packages/api-derive/package.json index ad130d1c66..18aaf8fcf6 100644 --- a/packages/api-derive/package.json +++ b/packages/api-derive/package.json @@ -3,7 +3,7 @@ "version": "2.6.2-3", "description": "Common functions used across Polkadot, derived from RPC calls and storage queries.", "main": "index.js", - "module": "esnext/index.js", + "module": "index.mjs", "sideEffects": false, "keywords": [ "Polkadot", @@ -33,14 +33,14 @@ "@polkadot/api": "2.6.2-3", "@polkadot/rpc-core": "2.6.2-3", "@polkadot/types": "2.6.2-3", - "@polkadot/util": "^4.0.2-7", - "@polkadot/util-crypto": "^4.0.2-7", + "@polkadot/util": "^4.0.2-8", + "@polkadot/util-crypto": "^4.0.2-8", "bn.js": "^5.1.3", "memoizee": "^0.4.14", "rxjs": "^6.6.3" }, "devDependencies": { - "@polkadot/keyring": "^4.0.2-7", + "@polkadot/keyring": "^4.0.2-8", "@polkadot/rpc-provider": "2.6.2-3" } } diff --git a/packages/api/package.json b/packages/api/package.json index 127d3ead6a..ef3dfc1ad8 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -3,7 +3,7 @@ "version": "2.6.2-3", "description": "Promise and RxJS wrappers around the Polkadot JS RPC", "main": "index.js", - "module": "esnext/index.js", + "module": "index.mjs", "sideEffects": false, "keywords": [ "Polkadot", @@ -30,14 +30,14 @@ "dependencies": { "@babel/runtime": "^7.12.1", "@polkadot/api-derive": "2.6.2-3", - "@polkadot/keyring": "^4.0.2-7", + "@polkadot/keyring": "^4.0.2-8", "@polkadot/metadata": "2.6.2-3", "@polkadot/rpc-core": "2.6.2-3", "@polkadot/rpc-provider": "2.6.2-3", "@polkadot/types": "2.6.2-3", "@polkadot/types-known": "2.6.2-3", - "@polkadot/util": "^4.0.2-7", - "@polkadot/util-crypto": "^4.0.2-7", + "@polkadot/util": "^4.0.2-8", + "@polkadot/util-crypto": "^4.0.2-8", "bn.js": "^5.1.3", "eventemitter3": "^4.0.7", "rxjs": "^6.6.3" diff --git a/packages/metadata/package.json b/packages/metadata/package.json index f6ffda19b8..088568e8cf 100644 --- a/packages/metadata/package.json +++ b/packages/metadata/package.json @@ -3,7 +3,7 @@ "version": "2.6.2-3", "description": "Helpers to extract information from runtime metadata", "main": "index.js", - "module": "esnext/index.js", + "module": "index.mjs", "sideEffects": false, "publishConfig": { "access": "public", @@ -31,11 +31,11 @@ "@babel/runtime": "^7.12.1", "@polkadot/types": "2.6.2-3", "@polkadot/types-known": "2.6.2-3", - "@polkadot/util": "^4.0.2-7", - "@polkadot/util-crypto": "^4.0.2-7", + "@polkadot/util": "^4.0.2-8", + "@polkadot/util-crypto": "^4.0.2-8", "bn.js": "^5.1.3" }, "devDependencies": { - "@polkadot/keyring": "^4.0.2-7" + "@polkadot/keyring": "^4.0.2-8" } } diff --git a/packages/metadata/src/decorate/extrinsics/fromMetadata.ts b/packages/metadata/src/decorate/extrinsics/fromMetadata.ts index cb6bf0448a..e9b9fadb01 100644 --- a/packages/metadata/src/decorate/extrinsics/fromMetadata.ts +++ b/packages/metadata/src/decorate/extrinsics/fromMetadata.ts @@ -5,8 +5,8 @@ import { Calls, ModulesWithCalls, Registry, RegistryMetadata, RegistryMetadataMo import { stringCamelCase } from '@polkadot/util'; -import extrinsics from './'; import createUnchecked from './createUnchecked'; +import extrinsics from '.'; /** @internal */ export function extrinsicsFromMeta (registry: Registry, metadata: RegistryMetadata): ModulesWithCalls { diff --git a/packages/rpc-core/package.json b/packages/rpc-core/package.json index ada572e4ba..ce4f5fc7f4 100644 --- a/packages/rpc-core/package.json +++ b/packages/rpc-core/package.json @@ -3,7 +3,7 @@ "version": "2.6.2-3", "description": "A JavaScript wrapper for the Polkadot JsonRPC interface", "main": "index.js", - "module": "esnext/index.js", + "module": "index.mjs", "sideEffects": false, "keywords": [ "Polkadot", @@ -32,11 +32,11 @@ "@polkadot/metadata": "2.6.2-3", "@polkadot/rpc-provider": "2.6.2-3", "@polkadot/types": "2.6.2-3", - "@polkadot/util": "^4.0.2-7", + "@polkadot/util": "^4.0.2-8", "memoizee": "^0.4.14", "rxjs": "^6.6.3" }, "devDependencies": { - "@polkadot/keyring": "^4.0.2-7" + "@polkadot/keyring": "^4.0.2-8" } } diff --git a/packages/rpc-provider/package.json b/packages/rpc-provider/package.json index 10899c27e1..8eeec71379 100644 --- a/packages/rpc-provider/package.json +++ b/packages/rpc-provider/package.json @@ -3,7 +3,7 @@ "version": "2.6.2-3", "description": "Transport providers for the API", "main": "index.js", - "module": "esnext/index.js", + "module": "index.mjs", "sideEffects": false, "keywords": [ "Polkadot", @@ -30,15 +30,15 @@ "dependencies": { "@babel/runtime": "^7.12.1", "@polkadot/types": "2.6.2-3", - "@polkadot/util": "^4.0.2-7", - "@polkadot/util-crypto": "^4.0.2-7", - "@polkadot/x-fetch": "^4.0.2-7", - "@polkadot/x-ws": "^4.0.2-7", + "@polkadot/util": "^4.0.2-8", + "@polkadot/util-crypto": "^4.0.2-8", + "@polkadot/x-fetch": "^4.0.2-8", + "@polkadot/x-ws": "^4.0.2-8", "bn.js": "^5.1.3", "eventemitter3": "^4.0.7" }, "devDependencies": { - "@polkadot/keyring": "^4.0.2-7", + "@polkadot/keyring": "^4.0.2-8", "@polkadot/metadata": "2.6.2-3", "mock-socket": "^9.0.3", "nock": "^13.0.4" diff --git a/packages/typegen/package.json b/packages/typegen/package.json index 48195c37ea..c415962ffb 100644 --- a/packages/typegen/package.json +++ b/packages/typegen/package.json @@ -3,7 +3,7 @@ "version": "2.6.2-3", "description": "Type generation scripts", "main": "index.js", - "module": "esnext/index.js", + "module": "index.mjs", "sideEffects": false, "bin": { "polkadot-types-chain-info": "./scripts/polkadot-types-chain-info.js", @@ -42,7 +42,7 @@ "@polkadot/metadata": "2.6.2-3", "@polkadot/rpc-provider": "2.6.2-3", "@polkadot/types": "2.6.2-3", - "@polkadot/util": "^4.0.2-7", + "@polkadot/util": "^4.0.2-8", "handlebars": "^4.7.6", "websocket": "^1.0.32", "yargs": "^16.1.0" diff --git a/packages/typegen/src/generate/interfaceRegistry.ts b/packages/typegen/src/generate/interfaceRegistry.ts index b0ea83badb..7bb1e301a0 100644 --- a/packages/typegen/src/generate/interfaceRegistry.ts +++ b/packages/typegen/src/generate/interfaceRegistry.ts @@ -3,8 +3,7 @@ import Handlebars from 'handlebars'; -import Json from '@polkadot/types/codec/Json'; -import Raw from '@polkadot/types/codec/Raw'; +import { Json, Raw } from '@polkadot/types/codec'; import { TypeRegistry } from '@polkadot/types/create'; import * as defaultDefinitions from '@polkadot/types/interfaces/definitions'; import * as defaultPrimitives from '@polkadot/types/primitive'; diff --git a/packages/typegen/src/util/class.ts b/packages/typegen/src/util/class.ts index c5c01894bf..4d239ceb0d 100644 --- a/packages/typegen/src/util/class.ts +++ b/packages/typegen/src/util/class.ts @@ -3,7 +3,7 @@ import { Constructor } from '@polkadot/types/types'; -import UInt from '@polkadot/types/codec/UInt'; +import { UInt } from '@polkadot/types/codec'; import { isChildClass } from '@polkadot/util'; /** @internal */ diff --git a/packages/typegen/src/util/derived.ts b/packages/typegen/src/util/derived.ts index 88bb5cfa89..71d23154cf 100644 --- a/packages/typegen/src/util/derived.ts +++ b/packages/typegen/src/util/derived.ts @@ -5,17 +5,10 @@ import { TypeDef, TypeDefInfo } from '@polkadot/types/create/types'; import { Constructor, Registry } from '@polkadot/types/types'; import { ClassOfUnsafe, getTypeDef } from '@polkadot/types/create'; -import AbstractInt from '@polkadot/types/codec/AbstractInt'; -import Compact from '@polkadot/types/codec/Compact'; -import Enum from '@polkadot/types/codec/Enum'; -import Option from '@polkadot/types/codec/Option'; -import Struct from '@polkadot/types/codec/Struct'; -import UInt from '@polkadot/types/codec/UInt'; -import Vec from '@polkadot/types/codec/Vec'; -import Tuple from '@polkadot/types/codec/Tuple'; +import { Compact, Enum, Option, Struct, UInt, Vec, Tuple } from '@polkadot/types/codec'; +import { AbstractInt } from '@polkadot/types/codec/AbstractInt'; import { AllConvictions } from '@polkadot/types/interfaces/democracy/definitions'; -import GenericAccountId from '@polkadot/types/generic/AccountId'; -import GenericLookupSource from '@polkadot/types/generic/LookupSource'; +import { GenericAccountId, GenericLookupSource } from '@polkadot/types/generic'; import Vote from '@polkadot/types/generic/Vote'; import Null from '@polkadot/types/primitive/Null'; import * as primitiveClasses from '@polkadot/types/primitive'; diff --git a/packages/types-known/package.json b/packages/types-known/package.json index 0e8f0444a2..45ab9346bf 100644 --- a/packages/types-known/package.json +++ b/packages/types-known/package.json @@ -3,7 +3,7 @@ "version": "2.6.2-3", "description": "A JavaScript wrapper for the Polkadot JsonRPC interface", "main": "index.js", - "module": "esnext/index.js", + "module": "index.mjs", "sideEffects": false, "keywords": [ "Polkadot", @@ -30,7 +30,7 @@ "dependencies": { "@babel/runtime": "^7.12.1", "@polkadot/types": "2.6.2-3", - "@polkadot/util": "^4.0.2-7", + "@polkadot/util": "^4.0.2-8", "bn.js": "^5.1.3" }, "devDependencies": { diff --git a/packages/types/package.json b/packages/types/package.json index 86ce6f1ffd..1d87948a04 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -3,7 +3,7 @@ "version": "2.6.2-3", "description": "Implementation of the Parity codec", "main": "index.js", - "module": "esnext/index.js", + "module": "index.mjs", "sideEffects": false, "keywords": [ "Polkadot", @@ -30,15 +30,15 @@ "dependencies": { "@babel/runtime": "^7.12.1", "@polkadot/metadata": "2.6.2-3", - "@polkadot/util": "^4.0.2-7", - "@polkadot/util-crypto": "^4.0.2-7", + "@polkadot/util": "^4.0.2-8", + "@polkadot/util-crypto": "^4.0.2-8", "@types/bn.js": "^4.11.6", "bn.js": "^5.1.3", "memoizee": "^0.4.14", "rxjs": "^6.6.3" }, "devDependencies": { - "@polkadot/keyring": "^4.0.2-7", + "@polkadot/keyring": "^4.0.2-8", "@types/memoizee": "^0.4.4" } } diff --git a/packages/types/src/codec/AbstractArray.ts b/packages/types/src/codec/AbstractArray.ts index 94f0c3da8c..32c0f92996 100644 --- a/packages/types/src/codec/AbstractArray.ts +++ b/packages/types/src/codec/AbstractArray.ts @@ -15,7 +15,7 @@ import { compareArray } from './utils'; * specific encoding/decoding on top of the base type. * @noInheritDoc */ -export default abstract class AbstractArray extends Array implements Codec { +export abstract class AbstractArray extends Array implements Codec { public readonly registry: Registry; protected constructor (registry: Registry, ...values: T[]) { diff --git a/packages/types/src/codec/AbstractInt.ts b/packages/types/src/codec/AbstractInt.ts index d9499e9195..d3eb59b975 100644 --- a/packages/types/src/codec/AbstractInt.ts +++ b/packages/types/src/codec/AbstractInt.ts @@ -61,7 +61,7 @@ function decodeAbstractInt (value: AnyNumber, bitLength: UIntBitLength, isNegati */ // TODO: // - Apart from encoding/decoding we don't actually keep check on the sizes, is this good enough? -export default abstract class AbstractInt extends BN implements Codec { +export abstract class AbstractInt extends BN implements Codec { public readonly registry: Registry; readonly #bitLength: UIntBitLength; diff --git a/packages/types/src/codec/BTreeMap.spec.ts b/packages/types/src/codec/BTreeMap.spec.ts index a72f779ed9..b6cf47f1b6 100644 --- a/packages/types/src/codec/BTreeMap.spec.ts +++ b/packages/types/src/codec/BTreeMap.spec.ts @@ -4,9 +4,7 @@ import { TypeRegistry } from '../create'; import Text from '../primitive/Text'; import U32 from '../primitive/U32'; -import Struct from './Struct'; - -import BTreeMap from './BTreeMap'; +import { BTreeMap, Struct } from '.'; const registry = new TypeRegistry(); diff --git a/packages/types/src/codec/BTreeMap.ts b/packages/types/src/codec/BTreeMap.ts index 4d259504da..dc651b04f9 100644 --- a/packages/types/src/codec/BTreeMap.ts +++ b/packages/types/src/codec/BTreeMap.ts @@ -3,9 +3,9 @@ import { Constructor, Codec, InterfaceTypes, Registry } from '../types'; -import CodecMap from './Map'; +import { CodecMap } from './Map'; -export default class BTreeMap extends CodecMap { +export class BTreeMap extends CodecMap { public static with (keyType: Constructor | keyof InterfaceTypes, valType: Constructor | keyof InterfaceTypes): Constructor> { return class extends BTreeMap { constructor (registry: Registry, value?: Uint8Array | string | Map) { diff --git a/packages/types/src/codec/BTreeSet.spec.ts b/packages/types/src/codec/BTreeSet.spec.ts index 99a7749bdb..61df3dcee3 100644 --- a/packages/types/src/codec/BTreeSet.spec.ts +++ b/packages/types/src/codec/BTreeSet.spec.ts @@ -1,13 +1,13 @@ // Copyright 2017-2020 @polkadot/types authors & contributors // SPDX-License-Identifier: Apache-2.0 +import { CodecTo } from '../types'; + import { TypeRegistry } from '../create'; import Text from '../primitive/Text'; import U32 from '../primitive/U32'; -import Struct from './Struct'; -import { CodecTo } from '../types'; -import BTreeSet from './BTreeSet'; +import { BTreeSet, Struct } from '.'; const registry = new TypeRegistry(); diff --git a/packages/types/src/codec/BTreeSet.ts b/packages/types/src/codec/BTreeSet.ts index b2deb136f4..2784cedd6c 100644 --- a/packages/types/src/codec/BTreeSet.ts +++ b/packages/types/src/codec/BTreeSet.ts @@ -78,7 +78,7 @@ function decodeSet (registry: Registry, valType: Constr throw new Error('BTreeSet: cannot decode type'); } -export default class BTreeSet extends Set implements Codec { +export class BTreeSet extends Set implements Codec { public readonly registry: Registry; readonly #ValClass: Constructor; diff --git a/packages/types/src/codec/Base.ts b/packages/types/src/codec/Base.ts index 5aff4379e0..d06ed16095 100644 --- a/packages/types/src/codec/Base.ts +++ b/packages/types/src/codec/Base.ts @@ -8,7 +8,7 @@ import { AnyJson, BareOpts, Codec, Registry } from '../types'; * @name Base * @description A type extends the Base class, when it holds a value */ -export default abstract class Base implements Codec { +export abstract class Base implements Codec { public readonly registry: Registry; protected readonly _raw: T; diff --git a/packages/types/src/codec/Compact.spec.ts b/packages/types/src/codec/Compact.spec.ts index 3021f4dabc..e0f4ab8520 100644 --- a/packages/types/src/codec/Compact.spec.ts +++ b/packages/types/src/codec/Compact.spec.ts @@ -4,9 +4,9 @@ import BN from 'bn.js'; import { TypeRegistry } from '../create'; -import Moment from './Date'; import U32 from '../primitive/U32'; -import Compact from './Compact'; +import { CodecDate } from './Date'; +import { Compact } from '.'; describe('Compact', (): void => { const registry = new TypeRegistry(); @@ -50,7 +50,7 @@ describe('Compact', (): void => { it('constructs properly via number as Moment', (): void => { expect( - new (Compact.with(Moment))(registry, 1537968546).toString().startsWith('Wed Sep 26 2018') // The time depends on the timezone this test is run in + new (Compact.with(CodecDate))(registry, 1537968546).toString().startsWith('Wed Sep 26 2018') // The time depends on the timezone this test is run in ).toBe(true); }); }); diff --git a/packages/types/src/codec/Compact.ts b/packages/types/src/codec/Compact.ts index 0462d9eb07..b81021958e 100644 --- a/packages/types/src/codec/Compact.ts +++ b/packages/types/src/codec/Compact.ts @@ -24,7 +24,7 @@ export interface CompactEncodable extends Codec { * used by other types to add length-prefixed encoding, or in the case of wrapped types, taking * a number and making the compact representation thereof */ -export default class Compact implements ICompact { +export class Compact implements ICompact { public readonly registry: Registry; readonly #Type: Constructor; diff --git a/packages/types/src/codec/Date.spec.ts b/packages/types/src/codec/Date.spec.ts index 4abe353c44..ff7e42afc0 100644 --- a/packages/types/src/codec/Date.spec.ts +++ b/packages/types/src/codec/Date.spec.ts @@ -7,7 +7,7 @@ import BN from 'bn.js'; import { TypeRegistry } from '../create'; import U64 from '../primitive/U64'; -import CodecDate from './Date'; +import { CodecDate } from './Date'; describe('Date', (): void => { const registry = new TypeRegistry(); diff --git a/packages/types/src/codec/Date.ts b/packages/types/src/codec/Date.ts index 1fe1a94164..375b9f2a20 100644 --- a/packages/types/src/codec/Date.ts +++ b/packages/types/src/codec/Date.ts @@ -21,7 +21,7 @@ const BITLENGTH: UIntBitLength = 64; * and has all the methods available that are applicable to any `Date` * @noInheritDoc */ -export default class CodecDate extends Date implements Codec { +export class CodecDate extends Date implements Codec { public readonly registry: Registry; constructor (registry: Registry, value: CodecDate | Date | AnyNumber = 0) { diff --git a/packages/types/src/codec/Enum.spec.ts b/packages/types/src/codec/Enum.spec.ts index c8f1e5bc4d..d117dd9bdd 100644 --- a/packages/types/src/codec/Enum.spec.ts +++ b/packages/types/src/codec/Enum.spec.ts @@ -9,7 +9,7 @@ import { TypeRegistry } from '../create'; import Null from '../primitive/Null'; import Text from '../primitive/Text'; import U32 from '../primitive/U32'; -import Enum from './Enum'; +import { Enum } from '.'; describe('Enum', (): void => { const registry = new TypeRegistry(); diff --git a/packages/types/src/codec/Enum.ts b/packages/types/src/codec/Enum.ts index 808db2331b..07204dad06 100644 --- a/packages/types/src/codec/Enum.ts +++ b/packages/types/src/codec/Enum.ts @@ -8,7 +8,7 @@ import { assert, hexToU8a, isHex, isNumber, isObject, isString, isU8a, isUndefin import Null from '../primitive/Null'; import { mapToTypeMap } from './utils'; -import Struct from './Struct'; +import { Struct } from './Struct'; // export interface, this is used in Enum.with, so required as public by TS export interface EnumConstructor { @@ -117,7 +117,7 @@ function decodeEnum (registry: Registry, def: TypesDef, value?: any, index?: num // TODO: // - As per Enum, actually use TS enum // - It should rather probably extend Enum instead of copying code -export default class Enum implements Codec { +export class Enum implements Codec { public readonly registry: Registry; readonly #def: TypesDef; diff --git a/packages/types/src/codec/HashMap.spec.ts b/packages/types/src/codec/HashMap.spec.ts index c133f70bb8..0a337d6d6a 100644 --- a/packages/types/src/codec/HashMap.spec.ts +++ b/packages/types/src/codec/HashMap.spec.ts @@ -4,9 +4,7 @@ import { TypeRegistry } from '../create'; import Text from '../primitive/Text'; import U32 from '../primitive/U32'; -import Struct from './Struct'; - -import HashMap from './HashMap'; +import { HashMap, Struct } from '.'; const registry = new TypeRegistry(); diff --git a/packages/types/src/codec/HashMap.ts b/packages/types/src/codec/HashMap.ts index dc0c672e9e..efa5efa44b 100644 --- a/packages/types/src/codec/HashMap.ts +++ b/packages/types/src/codec/HashMap.ts @@ -3,9 +3,9 @@ import { Constructor, Codec, InterfaceTypes, Registry } from '../types'; -import CodecMap from './Map'; +import { CodecMap } from './Map'; -export default class HashMap extends CodecMap { +export class HashMap extends CodecMap { public static with (keyType: Constructor | keyof InterfaceTypes, valType: Constructor | keyof InterfaceTypes): Constructor> { return class extends HashMap { constructor (registry: Registry, value?: Uint8Array | string | Map) { diff --git a/packages/types/src/codec/Int.spec.ts b/packages/types/src/codec/Int.spec.ts index bd1967faa4..d4a4e51191 100644 --- a/packages/types/src/codec/Int.spec.ts +++ b/packages/types/src/codec/Int.spec.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { TypeRegistry } from '../create'; -import Int from './Int'; +import { Int } from '.'; describe('Int', (): void => { const registry = new TypeRegistry(); diff --git a/packages/types/src/codec/Int.ts b/packages/types/src/codec/Int.ts index 0fbdeff1ea..bbf6db6a15 100644 --- a/packages/types/src/codec/Int.ts +++ b/packages/types/src/codec/Int.ts @@ -3,7 +3,7 @@ import { AnyNumber, Constructor, Registry } from '../types'; -import AbstractInt, { UIntBitLength } from './AbstractInt'; +import { AbstractInt, UIntBitLength } from './AbstractInt'; /** * @name Int @@ -15,7 +15,7 @@ import AbstractInt, { UIntBitLength } from './AbstractInt'; * is available here. * @noInheritDoc */ -export default class Int extends AbstractInt { +export class Int extends AbstractInt { constructor (registry: Registry, value: AnyNumber = 0, bitLength?: UIntBitLength) { super(registry, value, bitLength, true); } diff --git a/packages/types/src/codec/Json.ts b/packages/types/src/codec/Json.ts index 12efa24f3a..9aade533bc 100644 --- a/packages/types/src/codec/Json.ts +++ b/packages/types/src/codec/Json.ts @@ -21,7 +21,7 @@ function decodeJson (value?: Record | null): [string, any][] { * i.e. no hex decoding. Unlike a struct, this waps a JSON object with unknown keys * @noInheritDoc */ -export default class StructAny extends Map implements Codec { +export class Json extends Map implements Codec { public readonly registry: Registry; constructor (registry: Registry, value?: Record | null) { diff --git a/packages/types/src/codec/Linkage.spec.ts b/packages/types/src/codec/Linkage.spec.ts index a8de4ed759..f3328f1453 100644 --- a/packages/types/src/codec/Linkage.spec.ts +++ b/packages/types/src/codec/Linkage.spec.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { TypeRegistry } from '../create/registry'; -import Linkage from './Linkage'; +import { Linkage } from '.'; const registry = new TypeRegistry(); diff --git a/packages/types/src/codec/Linkage.ts b/packages/types/src/codec/Linkage.ts index fc6dada353..b17d5afce9 100644 --- a/packages/types/src/codec/Linkage.ts +++ b/packages/types/src/codec/Linkage.ts @@ -3,10 +3,10 @@ import { Constructor, Codec, InterfaceTypes, Registry } from '../types'; -import Option from './Option'; -import Struct from './Struct'; -import Tuple from './Tuple'; -import Vec from './Vec'; +import { Option } from './Option'; +import { Struct } from './Struct'; +import { Tuple } from './Tuple'; +import { Vec } from './Vec'; type TypeWithValues = [Constructor, any[]]; @@ -16,7 +16,7 @@ const EMPTY = new Uint8Array(); * @name Linkage * @description The wrapper for the result from a LinkedMap */ -export default class Linkage extends Struct { +export class Linkage extends Struct { constructor (registry: Registry, Type: Constructor | keyof InterfaceTypes, value?: unknown) { super(registry, { previous: Option.with(Type), diff --git a/packages/types/src/codec/Map.spec.ts b/packages/types/src/codec/Map.spec.ts index 9ae4afb98e..b5e40dbb85 100644 --- a/packages/types/src/codec/Map.spec.ts +++ b/packages/types/src/codec/Map.spec.ts @@ -1,12 +1,13 @@ // Copyright 2017-2020 @polkadot/types authors & contributors // SPDX-License-Identifier: Apache-2.0 +import { CodecTo } from '../types'; + import { TypeRegistry } from '../create'; import Text from '../primitive/Text'; import U32 from '../primitive/U32'; -import { CodecTo } from '../types'; -import CodecMap from './Map'; +import { CodecMap } from '.'; const registry = new TypeRegistry(); const mockU32TextMap = new Map(); diff --git a/packages/types/src/codec/Map.ts b/packages/types/src/codec/Map.ts index 5586c59e39..384f641176 100644 --- a/packages/types/src/codec/Map.ts +++ b/packages/types/src/codec/Map.ts @@ -87,7 +87,7 @@ function decodeMap (registry: throw new Error('Map: cannot decode type'); } -export default class CodecMap extends Map implements Codec { +export class CodecMap extends Map implements Codec { public readonly registry: Registry; readonly #KeyClass: Constructor; diff --git a/packages/types/src/codec/Option.spec.ts b/packages/types/src/codec/Option.spec.ts index 869e564444..502cbe8518 100644 --- a/packages/types/src/codec/Option.spec.ts +++ b/packages/types/src/codec/Option.spec.ts @@ -5,7 +5,7 @@ import { TypeRegistry } from '../create'; import Bytes from '../primitive/Bytes'; import U32 from '../primitive/U32'; import Text from '../primitive/Text'; -import Option from './Option'; +import { Option } from '.'; const registry = new TypeRegistry(); diff --git a/packages/types/src/codec/Option.ts b/packages/types/src/codec/Option.ts index bfac1e87eb..b5c8d3c852 100644 --- a/packages/types/src/codec/Option.ts +++ b/packages/types/src/codec/Option.ts @@ -47,7 +47,7 @@ function decodeOption (registry: Registry, typeName: Constructor | keyof Interfa * implements that - decodes, checks for optionality and wraps the required structure * with a value if/as required/found. */ -export default class Option implements Codec { +export class Option implements Codec { public readonly registry: Registry; readonly #Type: Constructor; diff --git a/packages/types/src/codec/Raw.spec.ts b/packages/types/src/codec/Raw.spec.ts index 292d5e6cd7..1cf174f663 100644 --- a/packages/types/src/codec/Raw.spec.ts +++ b/packages/types/src/codec/Raw.spec.ts @@ -4,7 +4,7 @@ import { CodecTo } from '../types'; import { TypeRegistry } from '../create'; -import Raw from './Raw'; +import { Raw } from '.'; const registry = new TypeRegistry(); diff --git a/packages/types/src/codec/Raw.ts b/packages/types/src/codec/Raw.ts index cbce6ba25f..68047e6dd5 100644 --- a/packages/types/src/codec/Raw.ts +++ b/packages/types/src/codec/Raw.ts @@ -24,7 +24,7 @@ function decodeU8a (value?: any): Uint8Array { * actual lengths instead of used directly. * @noInheritDoc */ -export default class Raw extends Uint8Array implements IU8a { +export class Raw extends Uint8Array implements IU8a { public readonly registry: Registry; constructor (registry: Registry, value?: AnyU8a) { diff --git a/packages/types/src/codec/Result.spec.ts b/packages/types/src/codec/Result.spec.ts index 3bde0d286c..f281b5380f 100644 --- a/packages/types/src/codec/Result.spec.ts +++ b/packages/types/src/codec/Result.spec.ts @@ -5,7 +5,7 @@ import { hexToString } from '@polkadot/util'; import { u32, Text } from '../primitive'; import { TypeRegistry } from '../create'; -import Result from './Result'; +import { Result } from '.'; describe('Result', (): void => { const registry = new TypeRegistry(); diff --git a/packages/types/src/codec/Result.ts b/packages/types/src/codec/Result.ts index bd91e1ec68..74d0af263c 100644 --- a/packages/types/src/codec/Result.ts +++ b/packages/types/src/codec/Result.ts @@ -5,14 +5,14 @@ import { Codec, Constructor, InterfaceTypes, Registry } from '../types'; import { assert } from '@polkadot/util'; -import Enum from './Enum'; +import { Enum } from './Enum'; /** * @name Result * @description * A Result maps to the Rust Result type, that can either wrap a success or error value */ -export default class Result extends Enum { +export class Result extends Enum { constructor (registry: Registry, Ok: Constructor | keyof InterfaceTypes, Error: Constructor | keyof InterfaceTypes, value?: unknown) { // NOTE This is order-dependent, Ok (with index 0) needs to be first // eslint-disable-next-line sort-keys diff --git a/packages/types/src/codec/Set.spec.ts b/packages/types/src/codec/Set.spec.ts index 12f3ea5498..71ede709a5 100644 --- a/packages/types/src/codec/Set.spec.ts +++ b/packages/types/src/codec/Set.spec.ts @@ -4,7 +4,7 @@ /* eslint-disable sort-keys */ import { TypeRegistry } from '../create'; -import Set from './Set'; +import { CodecSet } from '.'; // TODO actually import these from definitions, don't re-define here const SET_FIELDS = { @@ -31,7 +31,7 @@ describe('Set', (): void => { const registry = new TypeRegistry(); it('constructs via an string[]', (): void => { - const set = new Set(registry, SET_ROLES, ['full', 'authority']); + const set = new CodecSet(registry, SET_ROLES, ['full', 'authority']); expect(set.isEmpty).toEqual(false); expect(set.toString()).toEqual( @@ -41,36 +41,36 @@ describe('Set', (): void => { it('throws with invalid values', (): void => { expect( - (): Set => new Set(registry, SET_ROLES, ['full', 'authority', 'invalid']) + () => new CodecSet(registry, SET_ROLES, ['full', 'authority', 'invalid']) ).toThrow(/Invalid key 'invalid'/); }); it('throws with add on invalid', (): void => { expect( - (): Set => (new Set(registry, SET_ROLES, [])).add('invalid') + () => (new CodecSet(registry, SET_ROLES, [])).add('invalid') ).toThrow(/Invalid key 'invalid'/); }); it('allows construction via number', (): void => { expect( - (new Set(registry, SET_WITHDRAW, 15)).eq(['TransactionPayment', 'Transfer', 'Reserve', 'Fee']) + (new CodecSet(registry, SET_WITHDRAW, 15)).eq(['TransactionPayment', 'Transfer', 'Reserve', 'Fee']) ).toBe(true); }); it('does not allow invalid number', (): void => { expect( - (): Set => new Set(registry, SET_WITHDRAW, 31) + () => new CodecSet(registry, SET_WITHDRAW, 31) ).toThrow(/Mismatch decoding '31', computed as '15'/); }); it('hash a valid encoding', (): void => { - const set = new Set(registry, SET_FIELDS, ['header', 'body', 'justification']); + const set = new CodecSet(registry, SET_FIELDS, ['header', 'body', 'justification']); expect(set.toU8a()).toEqual(new Uint8Array([19])); }); describe('utils', (): void => { - const set = new Set(registry, SET_ROLES, ['full', 'authority']); + const set = new CodecSet(registry, SET_ROLES, ['full', 'authority']); it('compares against string array', (): void => { expect( @@ -86,7 +86,7 @@ describe('Set', (): void => { it('compares against other sets', (): void => { expect( - set.eq(new Set(registry, SET_ROLES, ['authority', 'full'])) + set.eq(new CodecSet(registry, SET_ROLES, ['authority', 'full'])) ).toBe(true); }); @@ -99,7 +99,7 @@ describe('Set', (): void => { it('has a sane toRawType representation', (): void => { expect( - new Set(registry, { a: 1, b: 2, c: 345 }).toRawType() + new CodecSet(registry, { a: 1, b: 2, c: 345 }).toRawType() ).toEqual(JSON.stringify({ _set: { a: 1, b: 2, c: 345 } })); diff --git a/packages/types/src/codec/Set.ts b/packages/types/src/codec/Set.ts index ec8dcd5f8f..5669d97c0f 100644 --- a/packages/types/src/codec/Set.ts +++ b/packages/types/src/codec/Set.ts @@ -76,7 +76,7 @@ function decodeSet (setValues: SetValues, value: string[] | Set | Uint8A * a bitwise representation of the values. */ // FIXME This is a prime candidate to extend the JavaScript built-in Set -export default class CodecSet extends Set implements Codec { +export class CodecSet extends Set implements Codec { public readonly registry: Registry; readonly #allowed: SetValues; diff --git a/packages/types/src/codec/Struct.spec.ts b/packages/types/src/codec/Struct.spec.ts index 9f09eaa67f..cb42d24240 100644 --- a/packages/types/src/codec/Struct.spec.ts +++ b/packages/types/src/codec/Struct.spec.ts @@ -3,12 +3,12 @@ /* eslint-disable sort-keys */ +import { CodecTo } from '../types'; + import { TypeRegistry } from '../create'; import Text from '../primitive/Text'; import U32 from '../primitive/U32'; -import { CodecTo } from '../types'; -import Struct from './Struct'; -import Vec from './Vec'; +import { Struct, Vec } from '.'; describe('Struct', (): void => { const registry = new TypeRegistry(); diff --git a/packages/types/src/codec/Struct.ts b/packages/types/src/codec/Struct.ts index 1ebb1e9a82..152d194913 100644 --- a/packages/types/src/codec/Struct.ts +++ b/packages/types/src/codec/Struct.ts @@ -126,7 +126,7 @@ function decodeStruct (registry: Registry, Types: ConstructorDef, value: unk * it needs to decoded in the specific defined order. * @noInheritDoc */ -export default class Struct< +export class Struct< // The actual Class structure, i.e. key -> Class S extends TypesDef = TypesDef, // input values, mapped by key can be anything (construction) diff --git a/packages/types/src/codec/Tuple.spec.ts b/packages/types/src/codec/Tuple.spec.ts index 509798533d..53a4b8d8d5 100644 --- a/packages/types/src/codec/Tuple.spec.ts +++ b/packages/types/src/codec/Tuple.spec.ts @@ -12,7 +12,7 @@ import { TypeRegistry } from '../create'; import Text from '../primitive/Text'; import U32 from '../primitive/U32'; import U128 from '../primitive/U128'; -import Tuple from './Tuple'; +import { Tuple } from '.'; describe('Tuple', (): void => { const registry = new TypeRegistry(); diff --git a/packages/types/src/codec/Tuple.ts b/packages/types/src/codec/Tuple.ts index 17652701a3..a9552b9807 100644 --- a/packages/types/src/codec/Tuple.ts +++ b/packages/types/src/codec/Tuple.ts @@ -6,7 +6,7 @@ import { AnyNumber, AnyU8a, AnyString, Codec, Constructor, InterfaceTypes, Regis import { isU8a, isHex, hexToU8a, u8aConcat } from '@polkadot/util'; import { decodeU8a, mapToTypeMap, typeToConstructor } from './utils'; -import AbstractArray from './AbstractArray'; +import { AbstractArray } from './AbstractArray'; type AnyTuple = AnyU8a | string | (Codec | AnyU8a | AnyNumber | AnyString | undefined | null)[]; @@ -51,7 +51,7 @@ function decodeTuple (registry: Registry, _Types: TupleConstructors, value?: Any * A Tuple defines an anonymous fixed-length array, where each element has its * own type. It extends the base JS `Array` object. */ -export default class Tuple extends AbstractArray { +export class Tuple extends AbstractArray { private _Types: TupleConstructors; constructor (registry: Registry, Types: TupleTypes, value?: AnyTuple) { diff --git a/packages/types/src/codec/U8aFixed.spec.ts b/packages/types/src/codec/U8aFixed.spec.ts index 709a0104fb..7b8ef0369c 100644 --- a/packages/types/src/codec/U8aFixed.spec.ts +++ b/packages/types/src/codec/U8aFixed.spec.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { TypeRegistry } from '../create'; -import U8aFixed from './U8aFixed'; +import { U8aFixed } from '.'; describe('U8aFixed', (): void => { const registry = new TypeRegistry(); diff --git a/packages/types/src/codec/U8aFixed.ts b/packages/types/src/codec/U8aFixed.ts index fc25cb2a6b..c6366c85bf 100644 --- a/packages/types/src/codec/U8aFixed.ts +++ b/packages/types/src/codec/U8aFixed.ts @@ -5,7 +5,7 @@ import { AnyU8a, Constructor, Registry } from '../types'; import { isString, u8aToU8a } from '@polkadot/util'; -import Raw from './Raw'; +import { Raw } from './Raw'; // The 520 here is a weird one - it is explicitly for a [u8; 65] as found as a EcdsaSignature, // and 264 here is explicity for a [u8; 33] as found as EcdsaPublic key. @@ -41,7 +41,7 @@ function decodeU8aFixed (value: AnyU8a, bitLength: BitLength): AnyU8a { * A U8a that manages a a sequence of bytes up to the specified bitLength. Not meant * to be used directly, rather is should be subclassed with the specific lengths. */ -export default class U8aFixed extends Raw { +export class U8aFixed extends Raw { constructor (registry: Registry, value: AnyU8a = new Uint8Array(), bitLength: BitLength = 256) { super(registry, decodeU8aFixed(value, bitLength)); } diff --git a/packages/types/src/codec/UInt.spec.ts b/packages/types/src/codec/UInt.spec.ts index d113b69cc2..a154c4d948 100644 --- a/packages/types/src/codec/UInt.spec.ts +++ b/packages/types/src/codec/UInt.spec.ts @@ -4,7 +4,7 @@ import BN from 'bn.js'; import { TypeRegistry } from '../create'; -import UInt from './UInt'; +import { UInt } from '.'; describe('UInt', (): void => { const registry = new TypeRegistry(); diff --git a/packages/types/src/codec/UInt.ts b/packages/types/src/codec/UInt.ts index 2092e32893..149c6692d0 100644 --- a/packages/types/src/codec/UInt.ts +++ b/packages/types/src/codec/UInt.ts @@ -3,7 +3,7 @@ import { AnyNumber, Constructor, Registry } from '../types'; -import AbstractInt, { UIntBitLength } from './AbstractInt'; +import { AbstractInt, UIntBitLength } from './AbstractInt'; /** * @name UInt @@ -15,7 +15,7 @@ import AbstractInt, { UIntBitLength } from './AbstractInt'; * is available here. * @noInheritDoc */ -export default class UInt extends AbstractInt { +export class UInt extends AbstractInt { public static with (bitLength: UIntBitLength, typeName?: string): Constructor { return class extends UInt { constructor (registry: Registry, value?: AnyNumber) { diff --git a/packages/types/src/codec/Vec.spec.ts b/packages/types/src/codec/Vec.spec.ts index 9c8d7df857..d566d7fcd5 100644 --- a/packages/types/src/codec/Vec.spec.ts +++ b/packages/types/src/codec/Vec.spec.ts @@ -10,8 +10,7 @@ import rpcMetadata from '@polkadot/metadata/static'; import { createTypeUnsafe, TypeRegistry } from '../create'; import AccountId from '../generic/AccountId'; import Text from '../primitive/Text'; -import Vec from './Vec'; -import Tuple from './Tuple'; +import { Tuple, Vec } from '.'; const registry = new TypeRegistry(); const metadata = new Metadata(registry, rpcMetadata); diff --git a/packages/types/src/codec/Vec.ts b/packages/types/src/codec/Vec.ts index 52e1e9fe97..b3bb099ae9 100644 --- a/packages/types/src/codec/Vec.ts +++ b/packages/types/src/codec/Vec.ts @@ -6,7 +6,7 @@ import { Codec, Constructor, InterfaceTypes, Registry } from '../types'; import { assert, compactFromU8a, logger, u8aToU8a } from '@polkadot/util'; import { decodeU8a, typeToConstructor } from './utils'; -import AbstractArray from './AbstractArray'; +import { AbstractArray } from './AbstractArray'; const MAX_LENGTH = 64 * 1024; @@ -19,7 +19,7 @@ const l = logger('Vec'); * construction with the passed `Type` in the constructor. It is an extension to Array, providing * specific encoding/decoding on top of the base type. */ -export default class Vec extends AbstractArray { +export class Vec extends AbstractArray { private _Type: Constructor; constructor (registry: Registry, Type: Constructor | keyof InterfaceTypes, value: Vec | Uint8Array | string | unknown[] = []) { diff --git a/packages/types/src/codec/VecAny.ts b/packages/types/src/codec/VecAny.ts index f8b6fb769e..6892e52777 100644 --- a/packages/types/src/codec/VecAny.ts +++ b/packages/types/src/codec/VecAny.ts @@ -3,7 +3,7 @@ import { Codec } from '../types'; -import AbstractArray from './AbstractArray'; +import { AbstractArray } from './AbstractArray'; /** * @name VecAny @@ -12,7 +12,7 @@ import AbstractArray from './AbstractArray'; * a vector, this can be used to manage array-like structures with variable arguments of * any types */ -export default class VecAny extends AbstractArray { +export class VecAny extends AbstractArray { /** * @description Returns the base runtime type name for this instance */ diff --git a/packages/types/src/codec/VecFixed.spec.ts b/packages/types/src/codec/VecFixed.spec.ts index f00a7d84a0..fb937cfe9d 100644 --- a/packages/types/src/codec/VecFixed.spec.ts +++ b/packages/types/src/codec/VecFixed.spec.ts @@ -3,7 +3,7 @@ import { TypeRegistry } from '../create'; import Text from '../primitive/Text'; -import VecFixed from './VecFixed'; +import { VecFixed } from './VecFixed'; describe('VecFixed', (): void => { const registry = new TypeRegistry(); diff --git a/packages/types/src/codec/VecFixed.ts b/packages/types/src/codec/VecFixed.ts index bf1f41de31..1a151ebad4 100644 --- a/packages/types/src/codec/VecFixed.ts +++ b/packages/types/src/codec/VecFixed.ts @@ -4,16 +4,16 @@ import { Codec, Constructor, InterfaceTypes, Registry } from '../types'; import { assert, isU8a, u8aConcat, compactToU8a } from '@polkadot/util'; -import AbstractArray from './AbstractArray'; +import { AbstractArray } from './AbstractArray'; +import { Vec } from './Vec'; import { typeToConstructor } from './utils'; -import Vec from './Vec'; /** * @name VecFixed * @description * This manages codec arrays of a fixed length */ -export default class VecFixed extends AbstractArray { +export class VecFixed extends AbstractArray { private _Type: Constructor; constructor (registry: Registry, Type: Constructor | keyof InterfaceTypes, length: number, value: VecFixed | Uint8Array | string | any[] = [] as any[]) { diff --git a/packages/types/src/codec/index.ts b/packages/types/src/codec/index.ts index ca5c116b29..3d8e4f2955 100644 --- a/packages/types/src/codec/index.ts +++ b/packages/types/src/codec/index.ts @@ -7,23 +7,24 @@ // others, so there _should_ not be need for direct use) // These are the base codec types, generally used for construction -export { default as BTreeMap } from './BTreeMap'; -export { default as BTreeSet } from './BTreeSet'; -export { default as Compact } from './Compact'; -// export { default as Date } from './Date'; -export { default as Enum } from './Enum'; -export { default as HashMap } from './HashMap'; -export { default as Json } from './Json'; -export { default as Linkage } from './Linkage'; -export { default as Option } from './Option'; -export { default as Result } from './Result'; -export { default as Set } from './Set'; -export { default as Struct } from './Struct'; -export { default as Tuple } from './Tuple'; -export { default as Vec } from './Vec'; - -// Convenience base classes, used as "anything of this type" bases -export { default as Int } from './Int'; -export { default as Raw } from './Raw'; -export { default as UInt } from './UInt'; -export { default as U8aFixed } from './U8aFixed'; +export { BTreeMap } from './BTreeMap'; +export { BTreeSet } from './BTreeSet'; +export { Compact } from './Compact'; +// export { CodecDate, CodecDate as Date } from './Date'; +export { Enum } from './Enum'; +export { HashMap } from './HashMap'; +export { Int } from './Int'; +export { Json } from './Json'; +export { Linkage } from './Linkage'; +export { CodecMap, CodecMap as Map } from './Map'; +export { Option } from './Option'; +export { Raw } from './Raw'; +export { Result } from './Result'; +export { CodecSet, CodecSet as Set } from './Set'; +export { Struct } from './Struct'; +export { Tuple } from './Tuple'; +export { UInt } from './UInt'; +export { U8aFixed } from './U8aFixed'; +export { Vec } from './Vec'; +// export { VecAny } from './VecAny'; +// export { VecFixed } from './VecFixed'; diff --git a/packages/types/src/create/createClass.ts b/packages/types/src/create/createClass.ts index 2286745d8c..5980d06a0c 100644 --- a/packages/types/src/create/createClass.ts +++ b/packages/types/src/create/createClass.ts @@ -7,21 +7,9 @@ import { FromReg, TypeDef, TypeDefInfo } from './types'; import { assert, isNumber, isUndefined } from '@polkadot/util'; import { UIntBitLength } from '../codec/AbstractInt'; -import BTreeMap from '../codec/BTreeMap'; -import BTreeSet from '../codec/BTreeSet'; -import Compact from '../codec/Compact'; -import Enum from '../codec/Enum'; -import HashMap from '../codec/HashMap'; -import Int from '../codec/Int'; -import Option from '../codec/Option'; -import Result from '../codec/Result'; -import CodecSet from '../codec/Set'; -import Struct from '../codec/Struct'; -import Tuple from '../codec/Tuple'; -import U8aFixed, { BitLength as U8aFixedBitLength } from '../codec/U8aFixed'; -import UInt from '../codec/UInt'; -import Vec from '../codec/Vec'; -import VecFixed from '../codec/VecFixed'; +import { BitLength as U8aFixedBitLength } from '../codec/U8aFixed'; +import { BTreeMap, BTreeSet, CodecSet, Compact, Enum, HashMap, Int, Option, Result, Struct, Tuple, U8aFixed, UInt, Vec } from '../codec'; +import { VecFixed } from '../codec/VecFixed'; import DoNotConstruct from '../primitive/DoNotConstruct'; import { getTypeDef } from './getTypeDef'; diff --git a/packages/types/src/create/createType.spec.ts b/packages/types/src/create/createType.spec.ts index 86af4a09f2..8e40cab7ba 100644 --- a/packages/types/src/create/createType.spec.ts +++ b/packages/types/src/create/createType.spec.ts @@ -1,8 +1,7 @@ // Copyright 2017-2020 @polkadot/types authors & contributors // SPDX-License-Identifier: Apache-2.0 -import Int from '../codec/Int'; -import CodecSet from '../codec/Set'; +import { CodecSet, Int } from '../codec'; import { createClass, createTypeUnsafe, TypeRegistry } from '.'; describe('createType', (): void => { diff --git a/packages/types/src/create/registry.spec.ts b/packages/types/src/create/registry.spec.ts index 188b263111..e87661a00d 100644 --- a/packages/types/src/create/registry.spec.ts +++ b/packages/types/src/create/registry.spec.ts @@ -8,11 +8,11 @@ import { Codec, Constructor } from '../types'; import { isChildClass, u8aToU8a } from '@polkadot/util'; import { keccakAsU8a } from '@polkadot/util-crypto'; -import Struct from '../codec/Struct'; +import { Struct } from '../codec/Struct'; import DoNotConstruct from '../primitive/DoNotConstruct'; import Text from '../primitive/Text'; import U32 from '../primitive/U32'; -import { TypeRegistry } from './registry'; +import { TypeRegistry } from '.'; describe('TypeRegistry', (): void => { const registry = new TypeRegistry(); diff --git a/packages/types/src/create/registry.ts b/packages/types/src/create/registry.ts index 0993de51fb..33ba0c5fd0 100644 --- a/packages/types/src/create/registry.ts +++ b/packages/types/src/create/registry.ts @@ -10,8 +10,8 @@ import { Metadata, extrinsicsFromMeta } from '@polkadot/metadata'; import { BN_ZERO, assert, assertReturn, formatBalance, isFunction, isString, isU8a, logger, stringCamelCase, u8aToHex } from '@polkadot/util'; import { blake2AsU8a } from '@polkadot/util-crypto'; -import Json from '../codec/Json'; -import Raw from '../codec/Raw'; +import { Json } from '../codec/Json'; +import { Raw } from '../codec/Raw'; import { defaultExtensions, expandExtensionTypes, findUnknownExtensions } from '../extrinsic/signedExtensions'; import { EventData } from '../generic/Event'; import DoNotConstruct from '../primitive/DoNotConstruct'; diff --git a/packages/types/src/ethereum/AccountId.spec.ts b/packages/types/src/ethereum/AccountId.spec.ts index 58bf6a1308..919e5d41f9 100644 --- a/packages/types/src/ethereum/AccountId.spec.ts +++ b/packages/types/src/ethereum/AccountId.spec.ts @@ -4,7 +4,7 @@ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ import { TypeRegistry } from '../create'; -import Raw from '../codec/Raw'; +import { Raw } from '../codec/Raw'; import { GenericEthereumAccountId as AccountId } from './AccountId'; describe('EthereumAccountId', (): void => { diff --git a/packages/types/src/ethereum/AccountId.ts b/packages/types/src/ethereum/AccountId.ts index b212753dd0..ee0aa4bb73 100644 --- a/packages/types/src/ethereum/AccountId.ts +++ b/packages/types/src/ethereum/AccountId.ts @@ -6,7 +6,7 @@ import { AnyString, AnyU8a, Registry } from '../types'; import { hexToU8a, isHex, isString, isU8a, u8aToU8a } from '@polkadot/util'; import { ethereumEncode, isEthereumAddress } from '@polkadot/util-crypto'; -import U8aFixed from '../codec/U8aFixed'; +import { U8aFixed } from '../codec/U8aFixed'; /** @internal */ function decodeAccountId (value: AnyU8a | AnyString): AnyU8a { diff --git a/packages/types/src/ethereum/LookupSource.ts b/packages/types/src/ethereum/LookupSource.ts index 7e946e7cf9..284b1d6a03 100644 --- a/packages/types/src/ethereum/LookupSource.ts +++ b/packages/types/src/ethereum/LookupSource.ts @@ -7,7 +7,7 @@ import BN from 'bn.js'; import { isBigInt, isBn, isHex, isNumber, isU8a, u8aConcat, u8aToHex, u8aToU8a, u8aToBn } from '@polkadot/util'; import { decodeAddress } from '@polkadot/util-crypto'; -import Base from '../codec/Base'; +import { Base } from '../codec/Base'; import AccountIndex from '../generic/AccountIndex'; import { GenericEthereumAccountId } from './AccountId'; diff --git a/packages/types/src/extrinsic/Extrinsic.ts b/packages/types/src/extrinsic/Extrinsic.ts index 65c9fe0355..331301430f 100644 --- a/packages/types/src/extrinsic/Extrinsic.ts +++ b/packages/types/src/extrinsic/Extrinsic.ts @@ -8,8 +8,8 @@ import { AnyJson, AnyU8a, ArgsDef, Codec, ExtrinsicPayloadValue, IExtrinsic, IKe import { assert, compactAddLength, compactFromU8a, isHex, isU8a, u8aConcat, u8aToHex, u8aToU8a } from '@polkadot/util'; -import Base from '../codec/Base'; -import Compact from '../codec/Compact'; +import { Base } from '../codec/Base'; +import { Compact } from '../codec/Compact'; import { ExtrinsicValueV4 } from './v4/Extrinsic'; import ExtrinsicEra from './ExtrinsicEra'; import { BIT_SIGNED, BIT_UNSIGNED, DEFAULT_VERSION, UNMASK_VERSION } from './constants'; diff --git a/packages/types/src/extrinsic/ExtrinsicEra.ts b/packages/types/src/extrinsic/ExtrinsicEra.ts index 199bb44ca1..d8dec4169f 100644 --- a/packages/types/src/extrinsic/ExtrinsicEra.ts +++ b/packages/types/src/extrinsic/ExtrinsicEra.ts @@ -6,9 +6,9 @@ import { AnyU8a, IExtrinsicEra, Registry } from '../types'; import BN from 'bn.js'; import { assert, bnToBn, formatNumber, hexToU8a, isHex, isU8a, isObject, u8aToBn, u8aToU8a } from '@polkadot/util'; -import Enum from '../codec/Enum'; -import Tuple from '../codec/Tuple'; -import Raw from '../codec/Raw'; +import { Enum } from '../codec/Enum'; +import { Tuple } from '../codec/Tuple'; +import { Raw } from '../codec/Raw'; import U64 from '../primitive/U64'; import { IMMORTAL_ERA } from './constants'; diff --git a/packages/types/src/extrinsic/ExtrinsicPayload.ts b/packages/types/src/extrinsic/ExtrinsicPayload.ts index 397dff8796..34bc1899ec 100644 --- a/packages/types/src/extrinsic/ExtrinsicPayload.ts +++ b/packages/types/src/extrinsic/ExtrinsicPayload.ts @@ -7,9 +7,9 @@ import { AnyJson, BareOpts, ExtrinsicPayloadValue, IKeyringPair, InterfaceTypes, import { u8aToHex } from '@polkadot/util'; -import Base from '../codec/Base'; -import Compact from '../codec/Compact'; -import Raw from '../codec/Raw'; +import { Base } from '../codec/Base'; +import { Compact } from '../codec/Compact'; +import { Raw } from '../codec/Raw'; import u32 from '../primitive/U32'; import ExtrinsicEra from './ExtrinsicEra'; import { DEFAULT_VERSION } from './constants'; diff --git a/packages/types/src/extrinsic/ExtrinsicPayloadUnknown.ts b/packages/types/src/extrinsic/ExtrinsicPayloadUnknown.ts index ed9780fdbf..43fde800ee 100644 --- a/packages/types/src/extrinsic/ExtrinsicPayloadUnknown.ts +++ b/packages/types/src/extrinsic/ExtrinsicPayloadUnknown.ts @@ -4,7 +4,7 @@ import { Registry } from '../types'; import { ExtrinsicPayloadOptions } from './types'; -import Struct from '../codec/Struct'; +import { Struct } from '../codec/Struct'; /** * @name GenericExtrinsicPayloadUnknown diff --git a/packages/types/src/extrinsic/ExtrinsicUnknown.ts b/packages/types/src/extrinsic/ExtrinsicUnknown.ts index e6f55dc059..6dc2a4ec6f 100644 --- a/packages/types/src/extrinsic/ExtrinsicUnknown.ts +++ b/packages/types/src/extrinsic/ExtrinsicUnknown.ts @@ -4,7 +4,7 @@ import { Registry } from '../types'; import { ExtrinsicOptions } from './types'; -import Struct from '../codec/Struct'; +import { Struct } from '../codec/Struct'; import { UNMASK_VERSION } from './constants'; /** diff --git a/packages/types/src/extrinsic/SignerPayload.ts b/packages/types/src/extrinsic/SignerPayload.ts index 693faf661e..5334819622 100644 --- a/packages/types/src/extrinsic/SignerPayload.ts +++ b/packages/types/src/extrinsic/SignerPayload.ts @@ -6,9 +6,9 @@ import { Codec, Constructor, ISignerPayload, SignerPayloadJSON, SignerPayloadRaw import { u8aToHex } from '@polkadot/util'; -import Compact from '../codec/Compact'; -import Struct from '../codec/Struct'; -import Vec from '../codec/Vec'; +import { Compact } from '../codec/Compact'; +import { Struct } from '../codec/Struct'; +import { Vec } from '../codec/Vec'; import Text from '../primitive/Text'; import u8 from '../primitive/U8'; diff --git a/packages/types/src/extrinsic/v4/Extrinsic.ts b/packages/types/src/extrinsic/v4/Extrinsic.ts index b820939835..2caf9b031c 100644 --- a/packages/types/src/extrinsic/v4/Extrinsic.ts +++ b/packages/types/src/extrinsic/v4/Extrinsic.ts @@ -8,7 +8,7 @@ import { ExtrinsicOptions } from '../types'; import { isU8a } from '@polkadot/util'; -import Struct from '../../codec/Struct'; +import { Struct } from '../../codec/Struct'; export const EXTRINSIC_VERSION = 4; diff --git a/packages/types/src/extrinsic/v4/ExtrinsicPayload.ts b/packages/types/src/extrinsic/v4/ExtrinsicPayload.ts index 79a33b238d..abbc2b6745 100644 --- a/packages/types/src/extrinsic/v4/ExtrinsicPayload.ts +++ b/packages/types/src/extrinsic/v4/ExtrinsicPayload.ts @@ -5,8 +5,8 @@ import { ExtrinsicEra } from '../../interfaces/extrinsics'; import { Balance, Hash, Index } from '../../interfaces/runtime'; import { ExtrinsicPayloadValue, IKeyringPair, Registry } from '../../types'; -import Compact from '../../codec/Compact'; -import Struct from '../../codec/Struct'; +import { Compact } from '../../codec/Compact'; +import { Struct } from '../../codec/Struct'; import Bytes from '../../primitive/Bytes'; import u32 from '../../primitive/U32'; import { sign } from '../util'; diff --git a/packages/types/src/extrinsic/v4/ExtrinsicSignature.ts b/packages/types/src/extrinsic/v4/ExtrinsicSignature.ts index 829c158dd2..216feac5b7 100644 --- a/packages/types/src/extrinsic/v4/ExtrinsicSignature.ts +++ b/packages/types/src/extrinsic/v4/ExtrinsicSignature.ts @@ -8,8 +8,8 @@ import { ExtrinsicSignatureOptions } from '../types'; import { u8aConcat } from '@polkadot/util'; -import Compact from '../../codec/Compact'; -import Struct from '../../codec/Struct'; +import { Compact } from '../../codec/Compact'; +import { Struct } from '../../codec/Struct'; import { EMPTY_U8A, IMMORTAL_ERA } from '../constants'; import ExtrinsicPayloadV4 from './ExtrinsicPayload'; diff --git a/packages/types/src/generic/AccountId.spec.ts b/packages/types/src/generic/AccountId.spec.ts index 427049bc7c..0369350b9d 100644 --- a/packages/types/src/generic/AccountId.spec.ts +++ b/packages/types/src/generic/AccountId.spec.ts @@ -4,7 +4,7 @@ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ import { TypeRegistry } from '../create'; -import Raw from '../codec/Raw'; +import { Raw } from '../codec/Raw'; import jsonVec from '../json/AccountIdVec.001.json'; import AccountId from './AccountId'; diff --git a/packages/types/src/generic/AccountId.ts b/packages/types/src/generic/AccountId.ts index 9f02308d90..b550d4f7ce 100644 --- a/packages/types/src/generic/AccountId.ts +++ b/packages/types/src/generic/AccountId.ts @@ -6,7 +6,7 @@ import { AnyString, AnyU8a, Registry } from '../types'; import { hexToU8a, isHex, isString, isU8a, u8aToU8a, assert } from '@polkadot/util'; import { decodeAddress, encodeAddress } from '@polkadot/util-crypto'; -import U8aFixed from '../codec/U8aFixed'; +import { U8aFixed } from '../codec/U8aFixed'; /** @internal */ function decodeAccountId (value?: AnyU8a | AnyString): Uint8Array { diff --git a/packages/types/src/generic/Block.ts b/packages/types/src/generic/Block.ts index 62fbe45d76..d45fa2a61a 100644 --- a/packages/types/src/generic/Block.ts +++ b/packages/types/src/generic/Block.ts @@ -5,8 +5,8 @@ import { Digest, DigestItem, H256, Header } from '../interfaces/runtime'; import { AnyNumber, AnyU8a, Registry } from '../types'; import Extrinsic from '../extrinsic/Extrinsic'; -import Struct from '../codec/Struct'; -import Vec from '../codec/Vec'; +import { Struct } from '../codec/Struct'; +import { Vec } from '../codec/Vec'; export interface HeaderValue { digest?: Digest | { logs: DigestItem[] }; diff --git a/packages/types/src/generic/Call.ts b/packages/types/src/generic/Call.ts index bf9c0cd22c..2159e4ea55 100644 --- a/packages/types/src/generic/Call.ts +++ b/packages/types/src/generic/Call.ts @@ -7,8 +7,8 @@ import { AnyJson, AnyU8a, ArgsDef, CallFunction, Codec, IMethod, Registry } from import { isHex, isObject, isU8a, u8aToU8a } from '@polkadot/util'; import { getTypeDef, getTypeClass } from '../create'; -import Struct from '../codec/Struct'; -import U8aFixed from '../codec/U8aFixed'; +import { Struct } from '../codec/Struct'; +import { U8aFixed } from '../codec/U8aFixed'; interface DecodeMethodInput { args: unknown; diff --git a/packages/types/src/generic/Event.ts b/packages/types/src/generic/Event.ts index a3ddf5c8a6..17e3480d4b 100644 --- a/packages/types/src/generic/Event.ts +++ b/packages/types/src/generic/Event.ts @@ -6,8 +6,8 @@ import { EventMetadataLatest } from '../interfaces/metadata'; import { EventId } from '../interfaces/system'; import { AnyJson, Constructor, Registry, RegistryMetadataEvent } from '../types'; -import Struct from '../codec/Struct'; -import Tuple from '../codec/Tuple'; +import { Struct } from '../codec/Struct'; +import { Tuple } from '../codec/Tuple'; import Null from '../primitive/Null'; /** diff --git a/packages/types/src/generic/LookupSource.ts b/packages/types/src/generic/LookupSource.ts index da44ae6f5b..183a8a8c7c 100644 --- a/packages/types/src/generic/LookupSource.ts +++ b/packages/types/src/generic/LookupSource.ts @@ -7,7 +7,7 @@ import BN from 'bn.js'; import { isBigInt, isBn, isHex, isNumber, isU8a, u8aConcat, u8aToHex, u8aToU8a, u8aToBn } from '@polkadot/util'; import { decodeAddress } from '@polkadot/util-crypto'; -import Base from '../codec/Base'; +import { Base } from '../codec/Base'; import AccountId from './AccountId'; import AccountIndex from './AccountIndex'; diff --git a/packages/types/src/generic/MultiAddress.ts b/packages/types/src/generic/MultiAddress.ts index a80d91dfd5..ee42e08a1d 100644 --- a/packages/types/src/generic/MultiAddress.ts +++ b/packages/types/src/generic/MultiAddress.ts @@ -6,7 +6,7 @@ import { Registry } from '../types'; import { isString, u8aConcat } from '@polkadot/util'; import { decodeAddress } from '@polkadot/util-crypto'; -import Enum from '../codec/Enum'; +import { Enum } from '../codec/Enum'; export default class MultiAddress extends Enum { constructor (registry: Registry, value?: unknown) { diff --git a/packages/types/src/generic/Vote.spec.ts b/packages/types/src/generic/Vote.spec.ts index 78bd518117..683a1e4ce8 100644 --- a/packages/types/src/generic/Vote.spec.ts +++ b/packages/types/src/generic/Vote.spec.ts @@ -2,64 +2,64 @@ // SPDX-License-Identifier: Apache-2.0 import { TypeRegistry } from '../create'; -import Vote from './Vote'; +import { GenericVote } from '.'; -describe('Vote', (): void => { +describe('GenericVote', (): void => { const registry = new TypeRegistry(); describe('construction', (): void => { it('constructs via boolean true', (): void => { - expect(new Vote(registry, true).toU8a()).toEqual(new Uint8Array([128])); - expect(new Vote(registry, true).isAye).toBe(true); - expect(new Vote(registry, true).isNay).toBe(false); + expect(new GenericVote(registry, true).toU8a()).toEqual(new Uint8Array([128])); + expect(new GenericVote(registry, true).isAye).toBe(true); + expect(new GenericVote(registry, true).isNay).toBe(false); }); it('constructs via boolean false', (): void => { - expect(new Vote(registry, false).toU8a()).toEqual(new Uint8Array([0])); - expect(new Vote(registry, false).isNay).toBe(true); - expect(new Vote(registry, false).isAye).toBe(false); + expect(new GenericVote(registry, false).toU8a()).toEqual(new Uint8Array([0])); + expect(new GenericVote(registry, false).isNay).toBe(true); + expect(new GenericVote(registry, false).isAye).toBe(false); }); it('constructs via undefined', (): void => { - expect(new Vote(registry).isNay).toBe(true); + expect(new GenericVote(registry).isNay).toBe(true); }); it('has isYay for positive', (): void => { // eslint-disable-next-line no-new-wrappers - expect(new Vote(registry, true).isAye).toBe(true); + expect(new GenericVote(registry, true).isAye).toBe(true); }); it('has isNay for negative', (): void => { // eslint-disable-next-line no-new-wrappers - expect(new Vote(registry, false).isNay).toBe(true); + expect(new GenericVote(registry, false).isNay).toBe(true); }); it('is Aye for negative numbers', (): void => { - expect(new Vote(registry, -128).isAye).toBe(true); + expect(new GenericVote(registry, -128).isAye).toBe(true); }); it('is Nay for positive numbers', (): void => { - expect(new Vote(registry, 127).isNay).toBe(true); + expect(new GenericVote(registry, 127).isNay).toBe(true); }); it('is Nay for 0', (): void => { - expect(new Vote(registry, 0).isNay).toBe(true); + expect(new GenericVote(registry, 0).isNay).toBe(true); }); it('constructs via empty', (): void => { - expect(new Vote(registry).isNay).toBe(true); + expect(new GenericVote(registry).isNay).toBe(true); }); it('constructs via Uint8Array (empty)', (): void => { - expect(new Vote(registry, new Uint8Array()).isNay).toBe(true); + expect(new GenericVote(registry, new Uint8Array()).isNay).toBe(true); }); it('constructs via Uint8Array (nay)', (): void => { - expect(new Vote(registry, new Uint8Array([1])).isNay).toBe(true); + expect(new GenericVote(registry, new Uint8Array([1])).isNay).toBe(true); }); it('constructs via Uint8Array (aye)', (): void => { - const test = new Vote(registry, new Uint8Array([0b10000010])); + const test = new GenericVote(registry, new Uint8Array([0b10000010])); expect(test.isNay).toBe(false); expect(test.conviction.toString()).toEqual('Locked2x'); @@ -69,7 +69,7 @@ describe('Vote', (): void => { describe('Vote with conviction', (): void => { it('constructs Vote with raw boolean', (): void => { expect( - new Vote(registry, { + new GenericVote(registry, { aye: true, conviction: 'Locked1x' }).toU8a() @@ -78,7 +78,7 @@ describe('Vote', (): void => { it('constructs with Vote aye is false, conviction is None', (): void => { expect( - new Vote(registry, { + new GenericVote(registry, { aye: false, conviction: 'None' }).toU8a() @@ -87,7 +87,7 @@ describe('Vote', (): void => { it('constructs with Vote aye is true, conviction is Locked4x', (): void => { expect( - new Vote(registry, { + new GenericVote(registry, { aye: true, conviction: 'Locked4x' }).toU8a() @@ -98,7 +98,7 @@ describe('Vote', (): void => { describe('getters', (): void => { it('Conviction getter works', (): void => { expect( - new Vote(registry, { + new GenericVote(registry, { aye: true, conviction: 'Locked2x' }).conviction.toString() @@ -107,7 +107,7 @@ describe('Vote', (): void => { it('Conviction getter works with raw boolean and string conviction', (): void => { expect( - new Vote(registry, { + new GenericVote(registry, { aye: true, conviction: 'Locked2x' }).conviction.toString() @@ -116,7 +116,7 @@ describe('Vote', (): void => { it('Conviction getter works with raw boolean and conviction index', (): void => { expect( - new Vote(registry, { + new GenericVote(registry, { aye: true, conviction: 2 }).conviction.toString() @@ -124,7 +124,7 @@ describe('Vote', (): void => { }); it('Conviction getter works with raw boolean and no conviction', (): void => { - const test = new Vote(registry, { aye: true }); + const test = new GenericVote(registry, { aye: true }); expect(test.isAye).toEqual(true); expect(test.conviction.toString()).toEqual('None'); @@ -132,7 +132,7 @@ describe('Vote', (): void => { it('isAye getter works', (): void => { expect( - new Vote(registry, { + new GenericVote(registry, { aye: true, conviction: 'None' }).isAye) @@ -141,7 +141,7 @@ describe('Vote', (): void => { it('isNay getter works', (): void => { expect( - new Vote(registry, { + new GenericVote(registry, { aye: true, conviction: 'None' }).isNay) @@ -151,7 +151,7 @@ describe('Vote', (): void => { describe('utils', (): void => { it('has a sane toRawType', (): void => { - expect(new Vote(registry).toRawType()).toEqual('Vote'); + expect(new GenericVote(registry).toRawType()).toEqual('Vote'); }); }); }); diff --git a/packages/types/src/generic/Vote.ts b/packages/types/src/generic/Vote.ts index 234246b028..4a3cb6eea1 100644 --- a/packages/types/src/generic/Vote.ts +++ b/packages/types/src/generic/Vote.ts @@ -7,7 +7,7 @@ import { Conviction } from '../interfaces/democracy'; import { isBoolean, isNumber, isU8a, isUndefined } from '@polkadot/util'; -import U8aFixed from '../codec/U8aFixed'; +import { U8aFixed } from '../codec/U8aFixed'; import Bool from '../primitive/Bool'; interface VoteType { diff --git a/packages/types/src/primitive/BitVec.ts b/packages/types/src/primitive/BitVec.ts index 28674d1b80..d75918655c 100644 --- a/packages/types/src/primitive/BitVec.ts +++ b/packages/types/src/primitive/BitVec.ts @@ -5,7 +5,7 @@ import { AnyU8a, Registry } from '../types'; import { assert, compactFromU8a, compactToU8a, isString, u8aConcat, u8aToU8a } from '@polkadot/util'; -import Raw from '../codec/Raw'; +import { Raw } from '../codec/Raw'; /** @internal */ function decodeBitVecU8a (value?: Uint8Array): Uint8Array { diff --git a/packages/types/src/primitive/Bytes.ts b/packages/types/src/primitive/Bytes.ts index f40634f905..928e200ef3 100644 --- a/packages/types/src/primitive/Bytes.ts +++ b/packages/types/src/primitive/Bytes.ts @@ -5,7 +5,7 @@ import { AnyU8a, Registry } from '../types'; import { assert, compactAddLength, compactFromU8a, compactToU8a, isString, isU8a, u8aToU8a } from '@polkadot/util'; -import Raw from '../codec/Raw'; +import { Raw } from '../codec/Raw'; // Bytes are used for things like on-chain code, so it has a healthy limit const MAX_LENGTH = 10 * 1024 * 1024; diff --git a/packages/types/src/primitive/Data.ts b/packages/types/src/primitive/Data.ts index 4c12798212..af2f6df0b1 100644 --- a/packages/types/src/primitive/Data.ts +++ b/packages/types/src/primitive/Data.ts @@ -6,7 +6,7 @@ import { Registry } from '../types'; import { isString, isU8a, u8aToU8a } from '@polkadot/util'; -import Enum from '../codec/Enum'; +import { Enum } from '../codec/Enum'; import Bytes from './Bytes'; /** @internal */ diff --git a/packages/types/src/primitive/I128.ts b/packages/types/src/primitive/I128.ts index 1b25cc981e..8802f3f366 100644 --- a/packages/types/src/primitive/I128.ts +++ b/packages/types/src/primitive/I128.ts @@ -1,7 +1,7 @@ // Copyright 2017-2020 @polkadot/types authors & contributors // SPDX-License-Identifier: Apache-2.0 -import Int from '../codec/Int'; +import { Int } from '../codec/Int'; /** * @name I128 diff --git a/packages/types/src/primitive/I16.ts b/packages/types/src/primitive/I16.ts index 99167a48c5..fe23dade18 100644 --- a/packages/types/src/primitive/I16.ts +++ b/packages/types/src/primitive/I16.ts @@ -1,7 +1,7 @@ // Copyright 2017-2020 @polkadot/types authors & contributors // SPDX-License-Identifier: Apache-2.0 -import Int from '../codec/Int'; +import { Int } from '../codec/Int'; /** * @name I16 diff --git a/packages/types/src/primitive/I256.ts b/packages/types/src/primitive/I256.ts index 7fc9aef9e2..3af942b622 100644 --- a/packages/types/src/primitive/I256.ts +++ b/packages/types/src/primitive/I256.ts @@ -1,7 +1,7 @@ // Copyright 2017-2020 @polkadot/types authors & contributors // SPDX-License-Identifier: Apache-2.0 -import Int from '../codec/Int'; +import { Int } from '../codec/Int'; /** * @name I256 diff --git a/packages/types/src/primitive/I32.ts b/packages/types/src/primitive/I32.ts index 5472c5bd22..38c222e5bf 100644 --- a/packages/types/src/primitive/I32.ts +++ b/packages/types/src/primitive/I32.ts @@ -1,7 +1,7 @@ // Copyright 2017-2020 @polkadot/types authors & contributors // SPDX-License-Identifier: Apache-2.0 -import Int from '../codec/Int'; +import { Int } from '../codec/Int'; /** * @name I32 diff --git a/packages/types/src/primitive/I64.ts b/packages/types/src/primitive/I64.ts index 916f30355a..6ba7a942f9 100644 --- a/packages/types/src/primitive/I64.ts +++ b/packages/types/src/primitive/I64.ts @@ -1,7 +1,7 @@ // Copyright 2017-2020 @polkadot/types authors & contributors // SPDX-License-Identifier: Apache-2.0 -import Int from '../codec/Int'; +import { Int } from '../codec/Int'; /** * @name I64 diff --git a/packages/types/src/primitive/I8.ts b/packages/types/src/primitive/I8.ts index 76e6fa9ae2..e11a6e599b 100644 --- a/packages/types/src/primitive/I8.ts +++ b/packages/types/src/primitive/I8.ts @@ -1,7 +1,7 @@ // Copyright 2017-2020 @polkadot/types authors & contributors // SPDX-License-Identifier: Apache-2.0 -import Int from '../codec/Int'; +import { Int } from '../codec/Int'; /** * @name I8 diff --git a/packages/types/src/primitive/Text.spec.ts b/packages/types/src/primitive/Text.spec.ts index 3f9768dd8d..c361588a3f 100644 --- a/packages/types/src/primitive/Text.spec.ts +++ b/packages/types/src/primitive/Text.spec.ts @@ -3,7 +3,7 @@ import { CodecTo } from '../types'; import { TypeRegistry } from '../create'; -import Raw from '../codec/Raw'; +import { Raw } from '../codec/Raw'; import Text from './Text'; describe('Text', (): void => { diff --git a/packages/types/src/primitive/Text.ts b/packages/types/src/primitive/Text.ts index 885b8924da..020e6324df 100644 --- a/packages/types/src/primitive/Text.ts +++ b/packages/types/src/primitive/Text.ts @@ -6,7 +6,7 @@ import { AnyU8a, Codec, Registry } from '../types'; import { assert, hexToU8a, isHex, isString, stringToU8a, u8aToString, u8aToHex, compactFromU8a, compactAddLength } from '@polkadot/util'; -import Raw from '../codec/Raw'; +import { Raw } from '../codec/Raw'; const MAX_LENGTH = 128 * 1024; diff --git a/packages/types/src/primitive/U128.ts b/packages/types/src/primitive/U128.ts index 6c0999fa19..a85e988cc4 100644 --- a/packages/types/src/primitive/U128.ts +++ b/packages/types/src/primitive/U128.ts @@ -1,7 +1,7 @@ // Copyright 2017-2020 @polkadot/types authors & contributors // SPDX-License-Identifier: Apache-2.0 -import UInt from '../codec/UInt'; +import { UInt } from '../codec/UInt'; /** * @name U128 diff --git a/packages/types/src/primitive/U16.ts b/packages/types/src/primitive/U16.ts index 31954f0688..4b87ba2650 100644 --- a/packages/types/src/primitive/U16.ts +++ b/packages/types/src/primitive/U16.ts @@ -1,7 +1,7 @@ // Copyright 2017-2020 @polkadot/types authors & contributors // SPDX-License-Identifier: Apache-2.0 -import UInt from '../codec/UInt'; +import { UInt } from '../codec/UInt'; /** * @name U16 diff --git a/packages/types/src/primitive/U256.ts b/packages/types/src/primitive/U256.ts index 7b7907e6fc..8fbc738a3a 100644 --- a/packages/types/src/primitive/U256.ts +++ b/packages/types/src/primitive/U256.ts @@ -1,7 +1,7 @@ // Copyright 2017-2020 @polkadot/types authors & contributors // SPDX-License-Identifier: Apache-2.0 -import UInt from '../codec/UInt'; +import { UInt } from '../codec/UInt'; /** * @name U256 diff --git a/packages/types/src/primitive/U32.ts b/packages/types/src/primitive/U32.ts index 0b0ee4c455..87701c7269 100644 --- a/packages/types/src/primitive/U32.ts +++ b/packages/types/src/primitive/U32.ts @@ -1,7 +1,7 @@ // Copyright 2017-2020 @polkadot/types authors & contributors // SPDX-License-Identifier: Apache-2.0 -import UInt from '../codec/UInt'; +import { UInt } from '../codec/UInt'; /** * @name U32 diff --git a/packages/types/src/primitive/U64.ts b/packages/types/src/primitive/U64.ts index 238985b8a0..c54cc36bc9 100644 --- a/packages/types/src/primitive/U64.ts +++ b/packages/types/src/primitive/U64.ts @@ -1,7 +1,7 @@ // Copyright 2017-2020 @polkadot/types authors & contributors // SPDX-License-Identifier: Apache-2.0 -import UInt from '../codec/UInt'; +import { UInt } from '../codec/UInt'; /** * @name U64 diff --git a/packages/types/src/primitive/U8.ts b/packages/types/src/primitive/U8.ts index 71dd3f97c9..db324577e6 100644 --- a/packages/types/src/primitive/U8.ts +++ b/packages/types/src/primitive/U8.ts @@ -1,7 +1,7 @@ // Copyright 2017-2020 @polkadot/types authors & contributors // SPDX-License-Identifier: Apache-2.0 -import UInt from '../codec/UInt'; +import { UInt } from '../codec/UInt'; /** * @name U8 diff --git a/yarn.lock b/yarn.lock index 62b93e6460..5a29e49e27 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1753,7 +1753,7 @@ __metadata: "@babel/runtime": ^7.12.1 "@polkadot/api": 2.6.2-3 "@polkadot/types": 2.6.2-3 - "@polkadot/util": ^4.0.2-7 + "@polkadot/util": ^4.0.2-8 bn.js: ^5.1.3 rxjs: ^6.6.3 languageName: unknown @@ -1765,12 +1765,12 @@ __metadata: dependencies: "@babel/runtime": ^7.12.1 "@polkadot/api": 2.6.2-3 - "@polkadot/keyring": ^4.0.2-7 + "@polkadot/keyring": ^4.0.2-8 "@polkadot/rpc-core": 2.6.2-3 "@polkadot/rpc-provider": 2.6.2-3 "@polkadot/types": 2.6.2-3 - "@polkadot/util": ^4.0.2-7 - "@polkadot/util-crypto": ^4.0.2-7 + "@polkadot/util": ^4.0.2-8 + "@polkadot/util-crypto": ^4.0.2-8 bn.js: ^5.1.3 memoizee: ^0.4.14 rxjs: ^6.6.3 @@ -1783,23 +1783,23 @@ __metadata: dependencies: "@babel/runtime": ^7.12.1 "@polkadot/api-derive": 2.6.2-3 - "@polkadot/keyring": ^4.0.2-7 + "@polkadot/keyring": ^4.0.2-8 "@polkadot/metadata": 2.6.2-3 "@polkadot/rpc-core": 2.6.2-3 "@polkadot/rpc-provider": 2.6.2-3 "@polkadot/types": 2.6.2-3 "@polkadot/types-known": 2.6.2-3 - "@polkadot/util": ^4.0.2-7 - "@polkadot/util-crypto": ^4.0.2-7 + "@polkadot/util": ^4.0.2-8 + "@polkadot/util-crypto": ^4.0.2-8 bn.js: ^5.1.3 eventemitter3: ^4.0.7 rxjs: ^6.6.3 languageName: unknown linkType: soft -"@polkadot/dev@npm:^0.59.21": - version: 0.59.21 - resolution: "@polkadot/dev@npm:0.59.21" +"@polkadot/dev@npm:^0.59.22": + version: 0.59.22 + resolution: "@polkadot/dev@npm:0.59.22" dependencies: "@babel/cli": ^7.12.1 "@babel/core": ^7.12.3 @@ -1826,6 +1826,7 @@ __metadata: "@typescript-eslint/parser": 4.6.1 "@vue/component-compiler-utils": ^3.2.0 babel-jest: ^26.6.3 + babel-plugin-module-extension-resolver: ^0.3.0 babel-plugin-module-resolver: ^4.0.0 babel-plugin-styled-components: ^1.11.1 browserslist: ^4.14.6 @@ -1885,21 +1886,21 @@ __metadata: polkadot-exec-typedoc: scripts/polkadot-exec-typedoc.js polkadot-exec-vuepress: scripts/polkadot-exec-vuepress.js polkadot-exec-webpack: scripts/polkadot-exec-webpack.js - checksum: c853d9077c256e68074fc2c08ff8e7e140f01e547e71a8021c71373c3b0fedf7a0e013e9e91eef463f3be60031ca5a1e5c7b490740d5eba5cc5e96b337369a2f + checksum: cdd11d3f5c5a3bb525be7a954b1d9679771e627719b703fd799fcc4e32694b519260607dc0df7c2ec98450cf61f711f61bed6f9801a6792be84547ff6cf75c43 languageName: node linkType: hard -"@polkadot/keyring@npm:^4.0.2-7": - version: 4.0.2-7 - resolution: "@polkadot/keyring@npm:4.0.2-7" +"@polkadot/keyring@npm:^4.0.2-8": + version: 4.0.2-8 + resolution: "@polkadot/keyring@npm:4.0.2-8" dependencies: "@babel/runtime": ^7.12.1 - "@polkadot/util": 4.0.2-7 - "@polkadot/util-crypto": 4.0.2-7 + "@polkadot/util": 4.0.2-8 + "@polkadot/util-crypto": 4.0.2-8 peerDependencies: - "@polkadot/util": 4.0.2-7 - "@polkadot/util-crypto": 4.0.2-7 - checksum: 21e0be9ccc5a5adac9ccfaa949c0ff80f1fbc4e171583de631c8a6055f3d91faaccd2dedcd07ee5fce93a4916528deb34dec557bfb2302129f4c09460851e1b6 + "@polkadot/util": 4.0.2-8 + "@polkadot/util-crypto": 4.0.2-8 + checksum: 7703a93a2a6e9f836bae5522c42a81f30b1e4372b2e30562a91d50256124070c0017391f0d0110814e5908e52641aec0b6f606eeb84c0650c6f78c4b882acc45 languageName: node linkType: hard @@ -1908,21 +1909,21 @@ __metadata: resolution: "@polkadot/metadata@workspace:packages/metadata" dependencies: "@babel/runtime": ^7.12.1 - "@polkadot/keyring": ^4.0.2-7 + "@polkadot/keyring": ^4.0.2-8 "@polkadot/types": 2.6.2-3 "@polkadot/types-known": 2.6.2-3 - "@polkadot/util": ^4.0.2-7 - "@polkadot/util-crypto": ^4.0.2-7 + "@polkadot/util": ^4.0.2-8 + "@polkadot/util-crypto": ^4.0.2-8 bn.js: ^5.1.3 languageName: unknown linkType: soft -"@polkadot/networks@npm:4.0.2-7": - version: 4.0.2-7 - resolution: "@polkadot/networks@npm:4.0.2-7" +"@polkadot/networks@npm:4.0.2-8": + version: 4.0.2-8 + resolution: "@polkadot/networks@npm:4.0.2-8" dependencies: "@babel/runtime": ^7.12.1 - checksum: 2502c6db7cb7f5a69b54b8eca7f26479b819cf85065df901ec9aea2979a2932521d5c1bb907ea07c68119adefd92bc91817c6d011e7c4098d3ba193d0fedc7b4 + checksum: 252915eb0f0ab0e852bc3276b0b7f2f507ef2b8527229edaa8b77231b511145e1bcbe5593bde1d1c21a1cb054b70865c0ac91ab163a88056864a27dcc9680e92 languageName: node linkType: hard @@ -1931,11 +1932,11 @@ __metadata: resolution: "@polkadot/rpc-core@workspace:packages/rpc-core" dependencies: "@babel/runtime": ^7.12.1 - "@polkadot/keyring": ^4.0.2-7 + "@polkadot/keyring": ^4.0.2-8 "@polkadot/metadata": 2.6.2-3 "@polkadot/rpc-provider": 2.6.2-3 "@polkadot/types": 2.6.2-3 - "@polkadot/util": ^4.0.2-7 + "@polkadot/util": ^4.0.2-8 memoizee: ^0.4.14 rxjs: ^6.6.3 languageName: unknown @@ -1946,13 +1947,13 @@ __metadata: resolution: "@polkadot/rpc-provider@workspace:packages/rpc-provider" dependencies: "@babel/runtime": ^7.12.1 - "@polkadot/keyring": ^4.0.2-7 + "@polkadot/keyring": ^4.0.2-8 "@polkadot/metadata": 2.6.2-3 "@polkadot/types": 2.6.2-3 - "@polkadot/util": ^4.0.2-7 - "@polkadot/util-crypto": ^4.0.2-7 - "@polkadot/x-fetch": ^4.0.2-7 - "@polkadot/x-ws": ^4.0.2-7 + "@polkadot/util": ^4.0.2-8 + "@polkadot/util-crypto": ^4.0.2-8 + "@polkadot/x-fetch": ^4.0.2-8 + "@polkadot/x-ws": ^4.0.2-8 bn.js: ^5.1.3 eventemitter3: ^4.0.7 mock-socket: ^9.0.3 @@ -1980,7 +1981,7 @@ __metadata: "@polkadot/metadata": 2.6.2-3 "@polkadot/rpc-provider": 2.6.2-3 "@polkadot/types": 2.6.2-3 - "@polkadot/util": ^4.0.2-7 + "@polkadot/util": ^4.0.2-8 "@types/websocket": ^1.0.1 "@types/yargs": ^15.0.9 handlebars: ^4.7.6 @@ -2001,7 +2002,7 @@ __metadata: dependencies: "@babel/runtime": ^7.12.1 "@polkadot/types": 2.6.2-3 - "@polkadot/util": ^4.0.2-7 + "@polkadot/util": ^4.0.2-8 "@types/bn.js": ^4.11.6 bn.js: ^5.1.3 languageName: unknown @@ -2012,10 +2013,10 @@ __metadata: resolution: "@polkadot/types@workspace:packages/types" dependencies: "@babel/runtime": ^7.12.1 - "@polkadot/keyring": ^4.0.2-7 + "@polkadot/keyring": ^4.0.2-8 "@polkadot/metadata": 2.6.2-3 - "@polkadot/util": ^4.0.2-7 - "@polkadot/util-crypto": ^4.0.2-7 + "@polkadot/util": ^4.0.2-8 + "@polkadot/util-crypto": ^4.0.2-8 "@types/bn.js": ^4.11.6 "@types/memoizee": ^0.4.4 bn.js: ^5.1.3 @@ -2024,15 +2025,15 @@ __metadata: languageName: unknown linkType: soft -"@polkadot/util-crypto@npm:4.0.2-7, @polkadot/util-crypto@npm:^4.0.2-7": - version: 4.0.2-7 - resolution: "@polkadot/util-crypto@npm:4.0.2-7" +"@polkadot/util-crypto@npm:4.0.2-8, @polkadot/util-crypto@npm:^4.0.2-8": + version: 4.0.2-8 + resolution: "@polkadot/util-crypto@npm:4.0.2-8" dependencies: "@babel/runtime": ^7.12.1 - "@polkadot/networks": 4.0.2-7 - "@polkadot/util": 4.0.2-7 + "@polkadot/networks": 4.0.2-8 + "@polkadot/util": 4.0.2-8 "@polkadot/wasm-crypto": ^2.0.1 - "@polkadot/x-randomvalues": 4.0.2-7 + "@polkadot/x-randomvalues": 4.0.2-8 base-x: ^3.0.8 blakejs: ^1.1.0 bn.js: ^5.1.3 @@ -2045,23 +2046,23 @@ __metadata: tweetnacl: ^1.0.3 xxhashjs: ^0.2.2 peerDependencies: - "@polkadot/util": 4.0.2-7 - checksum: 74096cd049d7dea7c7ef609f9f9f68bf9374f09f7fa1f6b16132d81c4bcb94f196375fafe84656f4cfdbd471e1112a1895d20ac16e1b08a322aed8f410ffe9ae + "@polkadot/util": 4.0.2-8 + checksum: e9d52d0bd90cba615501a6e62eaa2aa39e51a393aa84afaced20dea2a4fd5a7d7e51f2212cbcd5826486fc89722eac50cee63fc3bd1ee20254a601f76b6b58bf languageName: node linkType: hard -"@polkadot/util@npm:4.0.2-7, @polkadot/util@npm:^4.0.2-7": - version: 4.0.2-7 - resolution: "@polkadot/util@npm:4.0.2-7" +"@polkadot/util@npm:4.0.2-8, @polkadot/util@npm:^4.0.2-8": + version: 4.0.2-8 + resolution: "@polkadot/util@npm:4.0.2-8" dependencies: "@babel/runtime": ^7.12.1 - "@polkadot/x-textdecoder": 4.0.2-7 - "@polkadot/x-textencoder": 4.0.2-7 + "@polkadot/x-textdecoder": 4.0.2-8 + "@polkadot/x-textencoder": 4.0.2-8 "@types/bn.js": ^4.11.6 bn.js: ^5.1.3 camelcase: ^5.3.1 ip-regex: ^4.2.0 - checksum: c475919fe9fcf8792eda92f6a89eff82ad593099bf64c562281fee2b71db3767fd7d06c8055138bd63afcacf9c36279b0cb60ff0260db664ba7c9c17eeafef22 + checksum: 752492f18b4158cb68f24ce7a5d2fd5fe71e3175f42ae3f73c7ff3501960a7115e0a5eab278d143607336b8d85cb7e40533ed46a4c5598115b42f7c3258bd8f1 languageName: node linkType: hard @@ -2075,52 +2076,52 @@ __metadata: languageName: node linkType: hard -"@polkadot/x-fetch@npm:^4.0.2-7": - version: 4.0.2-7 - resolution: "@polkadot/x-fetch@npm:4.0.2-7" +"@polkadot/x-fetch@npm:^4.0.2-8": + version: 4.0.2-8 + resolution: "@polkadot/x-fetch@npm:4.0.2-8" dependencies: "@babel/runtime": ^7.12.1 "@types/node-fetch": ^2.5.7 node-fetch: ^2.6.1 - checksum: d722d22428324f2c8f5fda43617ea791288ca3ffbbe73ddb0b3babb754073fa64e45c9ea6248cedf124ab7a121f16477915fb59c97770929e7656d64ab31aadd + checksum: 1ba3bc161b0312a14fb3b4e43597367e0c9e93b475400d58c1ed48b43018241f91dace6c0e085800084d7eb245e66d7206a5c16e85bb1c2671f86cb7d72bc1d6 languageName: node linkType: hard -"@polkadot/x-randomvalues@npm:4.0.2-7": - version: 4.0.2-7 - resolution: "@polkadot/x-randomvalues@npm:4.0.2-7" +"@polkadot/x-randomvalues@npm:4.0.2-8": + version: 4.0.2-8 + resolution: "@polkadot/x-randomvalues@npm:4.0.2-8" dependencies: "@babel/runtime": ^7.12.1 - checksum: afc00c24e876ecacbbc8a2f531e8fc98dcb08a8b02558cc46728c24627913a15bcd69bdd90f660d4ad5e2b50cdff58bbb230de9cf9105939429470b936f26a74 + checksum: f368fe43a6b35136a8e9121e6f0224536fc7827483f526486d1624eaaae9da186f10459c61dc8256f78507e4588d8fbd64344a1211ecfb1856d376d1d05f088a languageName: node linkType: hard -"@polkadot/x-textdecoder@npm:4.0.2-7": - version: 4.0.2-7 - resolution: "@polkadot/x-textdecoder@npm:4.0.2-7" +"@polkadot/x-textdecoder@npm:4.0.2-8": + version: 4.0.2-8 + resolution: "@polkadot/x-textdecoder@npm:4.0.2-8" dependencies: "@babel/runtime": ^7.12.1 - checksum: bcf46de6c280fce2499a623996ef519abefc06bb9a54d42e35fe827495f30e7424dd53ce570627039349e04b6ba942a30e44fcdc163412d04d0c6eafc6cd3bef + checksum: 925836f1f275034aab5d493002e443b0e9076fe2b4fe7e6ef3b3d66b66f8dde78da9450c7bc63e3c105161e9f03040addf2e8664dd3cdaf7f7b36b1bd89aa1b1 languageName: node linkType: hard -"@polkadot/x-textencoder@npm:4.0.2-7": - version: 4.0.2-7 - resolution: "@polkadot/x-textencoder@npm:4.0.2-7" +"@polkadot/x-textencoder@npm:4.0.2-8": + version: 4.0.2-8 + resolution: "@polkadot/x-textencoder@npm:4.0.2-8" dependencies: "@babel/runtime": ^7.12.1 - checksum: 535f96fca8c1c206ccb1f7ed4db9b837d9ff766d2481fdab52e9a1dff5bd4488484a17ff2bc0b668a6177dcebc349d9fdcc6804414d880d466a1c759622cb7a7 + checksum: 50b0552bcc9b6c909cfd8e966b92ad3f5d80639df0ee91d4a00037f056f3fb86bf9c6ca9e7e0988568cebcb4982d956936b79cb54a0cba5685b1b8ca7ffe9ed2 languageName: node linkType: hard -"@polkadot/x-ws@npm:^4.0.2-7": - version: 4.0.2-7 - resolution: "@polkadot/x-ws@npm:4.0.2-7" +"@polkadot/x-ws@npm:^4.0.2-8": + version: 4.0.2-8 + resolution: "@polkadot/x-ws@npm:4.0.2-8" dependencies: "@babel/runtime": ^7.12.1 "@types/websocket": ^1.0.1 websocket: ^1.0.32 - checksum: 1d566c09f9931053a851cb51fd1eb1c59341f196b88ab8d6e458c1184c5d495bb5fdf57976ce03e71245d818af1c440cb7792d69da0c6668bc034bc409110e10 + checksum: a64c2435e070dc0b72d14addf6bb1abd88885bea58e69f82b7eb2d2b302ece733c07a6a35b6e252f0761b62fa80a06bbff082ecc3d0ab80f206e619d4b7eb6dc languageName: node linkType: hard @@ -2960,6 +2961,13 @@ __metadata: languageName: node linkType: hard +"babel-plugin-module-extension-resolver@npm:^0.3.0": + version: 0.3.0 + resolution: "babel-plugin-module-extension-resolver@npm:0.3.0" + checksum: d7522f7f17f27747aee35ca0ac0e5af6286065c67210e0e038ff5065e8173d5bdaef8a4f5916dd169fda5abcc96c8fb8175dececc1758210675144c6d48c9f32 + languageName: node + linkType: hard + "babel-plugin-module-resolver@npm:^4.0.0": version: 4.0.0 resolution: "babel-plugin-module-resolver@npm:4.0.0" @@ -9398,7 +9406,7 @@ fsevents@^1.2.7: "@babel/core": ^7.12.3 "@babel/register": ^7.12.1 "@babel/runtime": ^7.12.1 - "@polkadot/dev": ^0.59.21 + "@polkadot/dev": ^0.59.22 "@polkadot/ts": ^0.3.53 "@polkadot/typegen": "workspace:packages/typegen" "@types/jest": ^26.0.15