diff --git a/packages/api-derive/src/elections/approvalsOf.ts b/packages/api-derive/src/elections/approvalsOf.ts index 68081bc825..607aae2eb5 100644 --- a/packages/api-derive/src/elections/approvalsOf.ts +++ b/packages/api-derive/src/elections/approvalsOf.ts @@ -2,9 +2,11 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +import { SetIndex } from '@polkadot/types/srml/elections/types'; + import { ApiInterfaceRx } from '@polkadot/api/types'; import { Observable } from 'rxjs'; -import { AccountId, Vector, SetIndex, ApprovalFlag } from '@polkadot/types'; +import { AccountId, Vector, ApprovalFlag } from '@polkadot/types'; import { switchMap, map } from 'rxjs/operators'; import { approvalFlagsToBools } from '../util/approvalFlagsToBools'; import { drr } from '../util/drr'; diff --git a/packages/api-derive/src/elections/approvalsOfAt.ts b/packages/api-derive/src/elections/approvalsOfAt.ts index ba426e75c1..93245cacd3 100644 --- a/packages/api-derive/src/elections/approvalsOfAt.ts +++ b/packages/api-derive/src/elections/approvalsOfAt.ts @@ -2,9 +2,11 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +import { SetIndex } from '@polkadot/types/srml/elections/types'; + import { ApiInterfaceRx } from '@polkadot/api/types'; import { Observable } from 'rxjs'; -import { AccountId, Vector, SetIndex, ApprovalFlag } from '@polkadot/types'; +import { AccountId, Vector, ApprovalFlag } from '@polkadot/types'; import { map } from 'rxjs/operators'; import { approvalFlagsToBools } from '../util/approvalFlagsToBools'; import { drr } from '../util/drr'; diff --git a/packages/api-derive/src/elections/info.ts b/packages/api-derive/src/elections/info.ts index 72c917da25..3140a6c4eb 100644 --- a/packages/api-derive/src/elections/info.ts +++ b/packages/api-derive/src/elections/info.ts @@ -2,11 +2,13 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +import { SetIndex } from '@polkadot/types/srml/elections/types'; + import BN from 'bn.js'; import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; import { ApiInterfaceRx } from '@polkadot/api/types'; -import { AccountId, BlockNumber, SetIndex, VoteIndex } from '@polkadot/types'; +import { AccountId, BlockNumber, VoteIndex } from '@polkadot/types'; import { DerivedElectionsInfo } from '../types'; import { drr } from '../util/drr'; diff --git a/packages/api-derive/src/elections/voterSets.ts b/packages/api-derive/src/elections/voterSets.ts index 62ee5c8e2a..27d8a90efa 100644 --- a/packages/api-derive/src/elections/voterSets.ts +++ b/packages/api-derive/src/elections/voterSets.ts @@ -2,9 +2,11 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +import { SetIndex } from '@polkadot/types/srml/elections/types'; + import { ApiInterfaceRx } from '@polkadot/api/types'; import { Observable } from 'rxjs'; -import { AccountId, Vector, Option, SetIndex } from '@polkadot/types'; +import { AccountId, Vector, Option, createType } from '@polkadot/types'; import { switchMap, map } from 'rxjs/operators'; import { drr } from '../util/drr'; @@ -34,7 +36,7 @@ export function voterSets (api: ApiInterfaceRx): () => Observable('SetIndex', setIndex); } }); diff --git a/packages/api-derive/src/elections/voters.ts b/packages/api-derive/src/elections/voters.ts index bb5026ccf1..734777fa3b 100644 --- a/packages/api-derive/src/elections/voters.ts +++ b/packages/api-derive/src/elections/voters.ts @@ -2,9 +2,11 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +import { SetIndex } from '@polkadot/types/srml/elections/types'; + import { ApiInterfaceRx } from '@polkadot/api/types'; import { Observable } from 'rxjs'; -import { AccountId, Vector, SetIndex } from '@polkadot/types'; +import { AccountId, Vector } from '@polkadot/types'; import { map } from 'rxjs/operators'; import { drr } from '../util/drr'; import { voterSets } from './voterSets'; diff --git a/packages/api-derive/src/staking/info.ts b/packages/api-derive/src/staking/info.ts index 8c6f5c8289..ee6afcc893 100644 --- a/packages/api-derive/src/staking/info.ts +++ b/packages/api-derive/src/staking/info.ts @@ -2,13 +2,15 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +import { SessionKey, Keys } from '@polkadot/types/srml/session/types'; + import { ApiInterfaceRx } from '@polkadot/api/types'; import { DerivedStaking, DerivedUnlocking } from '../types'; import BN from 'bn.js'; import { combineLatest, Observable, of } from 'rxjs'; import { map, switchMap } from 'rxjs/operators'; -import { AccountId, BlockNumber, Exposure, Keys, Option, RewardDestination, SessionKey, StakingLedger, Tuple, ValidatorPrefs, Vector, UnlockChunk } from '@polkadot/types'; +import { AccountId, BlockNumber, Exposure, Option, RewardDestination, StakingLedger, Tuple, ValidatorPrefs, Vector, UnlockChunk } from '@polkadot/types'; import { isUndefined } from '@polkadot/util'; diff --git a/packages/api-derive/src/types.ts b/packages/api-derive/src/types.ts index 3f202fca31..5a121a5c4a 100644 --- a/packages/api-derive/src/types.ts +++ b/packages/api-derive/src/types.ts @@ -2,8 +2,10 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +import { SetIndex } from '@polkadot/types/srml/elections/types'; + import BN from 'bn.js'; -import { AccountId, Balance, BlockNumber, Exposure, Index, RewardDestination, SetIndex, StakingLedger, ValidatorPrefs, Vote, VoteIndex } from '@polkadot/types'; +import { AccountId, Balance, BlockNumber, Exposure, Index, RewardDestination, StakingLedger, ValidatorPrefs, Vote, VoteIndex } from '@polkadot/types'; export interface DerivedBalances { accountId: AccountId; diff --git a/packages/api-metadata/src/consts/fromMetadata/fromMetadata.spec.ts b/packages/api-metadata/src/consts/fromMetadata/fromMetadata.spec.ts index fbd90fc459..aa5d23e7df 100644 --- a/packages/api-metadata/src/consts/fromMetadata/fromMetadata.spec.ts +++ b/packages/api-metadata/src/consts/fromMetadata/fromMetadata.spec.ts @@ -4,7 +4,7 @@ import { Metadata, BlockNumber } from '@polkadot/types'; import json from '@polkadot/types/Metadata/v6/static'; -import { injectDefinitions } from '@polkadot/types/Metadata/util/testUtil'; +import { injectDefinitions } from '@polkadot/types/srml'; import fromMetadata from '../fromMetadata'; diff --git a/packages/api/test/e2e/api/promise-queries.spec.ts b/packages/api/test/e2e/api/promise-queries.spec.ts index 17162a95b3..79cbfa5b4c 100644 --- a/packages/api/test/e2e/api/promise-queries.spec.ts +++ b/packages/api/test/e2e/api/promise-queries.spec.ts @@ -2,10 +2,12 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +import { SessionIndex } from '@polkadot/types/srml/session/types'; + import { HeaderExtended } from '@polkadot/api-derive'; import WsProvider from '@polkadot/rpc-provider/ws'; import { LinkageResult } from '@polkadot/types/codec/Linkage'; -import { EventRecord, Hash, Header, Option, SessionIndex, Vector } from '@polkadot/types'; +import { EventRecord, Hash, Header, Option, Vector, createType } from '@polkadot/types'; import ApiPromise from '../../../src/promise'; import describeE2E from '../../util/describeE2E'; @@ -126,7 +128,7 @@ describeE2E()('Promise e2e queries', (wsUrl): void => { it('gets correct key', async (): Promise => { const key = api.query.session.currentIndex.key(); const sessionIndexData = await api.rpc.state.getStorage(key) as Option; - const sessionIndexRPC = new SessionIndex(sessionIndexData.unwrapOr(undefined)); + const sessionIndexRPC = createType('SessionIndex', sessionIndexData.unwrapOr(undefined)); expect(sessionIndexRPC.toNumber()).toBeGreaterThanOrEqual(0); }); diff --git a/packages/rpc-core/src/formatting.spec.ts b/packages/rpc-core/src/formatting.spec.ts index 424dc981a1..67c353eb05 100644 --- a/packages/rpc-core/src/formatting.spec.ts +++ b/packages/rpc-core/src/formatting.spec.ts @@ -8,7 +8,7 @@ import fromMetadata from '@polkadot/api-metadata/storage/fromMetadata'; import { Storage } from '@polkadot/api-metadata/storage/types'; import { Balance } from '@polkadot/types'; import Metadata from '@polkadot/types/Metadata'; -import { injectDefinitions } from '@polkadot/types/Metadata/util/testUtil'; +import { injectDefinitions } from '@polkadot/types/srml'; import rpcMetadataV3 from '@polkadot/types/Metadata/v3/static'; import rpcMetadataV4 from '@polkadot/types/Metadata/v4/static'; import rpcMetadataV5 from '@polkadot/types/Metadata/v5/static'; diff --git a/packages/types/src/Metadata/util/testUtil.ts b/packages/types/src/Metadata/util/testUtil.ts index d4bce81d51..6f1666c6b7 100644 --- a/packages/types/src/Metadata/util/testUtil.ts +++ b/packages/types/src/Metadata/util/testUtil.ts @@ -3,8 +3,7 @@ // of the Apache-2.0 license. See the LICENSE file for details. import extrinsicsFromMeta from '@polkadot/api-metadata/extrinsics/fromMetadata'; -import { getTypeRegistry } from '@polkadot/types'; -import * as srmlTypes from '@polkadot/types/srml/definitions'; +import { injectDefinitions } from '@polkadot/types/srml'; import createType from '../../codec/createType'; import Metadata from '../Metadata'; @@ -12,12 +11,6 @@ import Method from '../../primitive/Method'; import { MetadataInterface } from '../types'; import { Codec } from '../../types'; -export function injectDefinitions (): void { - Object.values(srmlTypes).forEach(({ types }): void => - getTypeRegistry().register(types) - ); -} - /** * Given the static `rpcData` and the `latestSubstrate` JSON file, Metadata * should decode `rpcData` and output `latestSubstrate`. diff --git a/packages/types/src/codec/createType.ts b/packages/types/src/codec/createType.ts index e4a18149ce..3ecc21bcd0 100644 --- a/packages/types/src/codec/createType.ts +++ b/packages/types/src/codec/createType.ts @@ -174,9 +174,9 @@ export function getTypeDef (_type: Text | string, name?: string): TypeDef { return value; } -export function createClass (type: Text | string): Constructor { +export function createClass (type: Text | string): Constructor { // eslint-disable-next-line @typescript-eslint/no-use-before-define - return getTypeClass( + return getTypeClass( getTypeDef(type) ); } @@ -192,8 +192,8 @@ export function getTypeClassMap (defs: TypeDef[]): { [index: string]: Constructo } // Returns the type Class for construction -export function getTypeClass (value: TypeDef, Fallback?: Constructor): Constructor { - const Type = getRegistry().get(value.type); +export function getTypeClass (value: TypeDef, Fallback?: Constructor): Constructor { + const Type = getRegistry().get(value.type); if (Type) { return Type; @@ -204,58 +204,60 @@ export function getTypeClass (value: TypeDef, Fallback?: Constructor): Construct assert(value.sub && !Array.isArray(value.sub), 'Expected subtype for Compact'); return Compact.with( - getTypeClass(value.sub as TypeDef) as Constructor - ); + getTypeClass(value.sub as TypeDef) + ) as unknown as Constructor; case TypeDefInfo.Enum: assert(value.sub && Array.isArray(value.sub), 'Expected subtype for Enum'); return Enum.with( getTypeClassMap(value.sub as TypeDef[]) - ); + ) as unknown as Constructor; case TypeDefInfo.Option: assert(value.sub && !Array.isArray(value.sub), 'Expected subtype for Option'); return Option.with( getTypeClass(value.sub as TypeDef) - ); + ) as unknown as Constructor; case TypeDefInfo.Struct: assert(Array.isArray(value.sub), 'Expected nested subtypes for Struct'); return Struct.with( getTypeClassMap(value.sub as TypeDef[]) - ); + ) as unknown as Constructor; case TypeDefInfo.Tuple: assert(Array.isArray(value.sub), 'Expected nested subtypes for Tuple'); return Tuple.with( (value.sub as TypeDef[]).map((Type): Constructor => getTypeClass(Type)) - ); + ) as unknown as Constructor; case TypeDefInfo.Vector: assert(value.sub && !Array.isArray(value.sub), 'Expected subtype for Vector'); return Vector.with( - getTypeClass(value.sub as TypeDef) - ); + getTypeClass(value.sub as TypeDef) + ) as unknown as Constructor; case TypeDefInfo.VectorFixed: assert(value.ext, 'Expected length & type information for fixed vector'); const ext = value.ext as TypeDefExtVecFixed; - return ext.type === 'u8' - ? U8aFixed.with((ext.length * 8) as U8aFixedBitLength) - : VectorFixed.with(createClass(ext.type), ext.length); + return ( + ext.type === 'u8' + ? U8aFixed.with((ext.length * 8) as U8aFixedBitLength) + : VectorFixed.with(createClass(ext.type), ext.length) + ) as unknown as Constructor; case TypeDefInfo.Linkage: assert(value.sub && !Array.isArray(value.sub), 'Expected subtype for Linkage'); return Linkage.withKey( - getTypeClass(value.sub as TypeDef) - ); + getTypeClass(value.sub as TypeDef) + )as unknown as Constructor; case TypeDefInfo.DoubleMap: assert(value.sub && !Array.isArray(value.sub), 'Expected subtype for DoubleMap'); return getTypeClass(value.sub as TypeDef); case TypeDefInfo.Null: - return Null; + return Null as unknown as Constructor; } if (Fallback) { @@ -266,11 +268,11 @@ export function getTypeClass (value: TypeDef, Fallback?: Constructor): Construct } // alias for createClass -export function ClassOf (name: string): Constructor { - return createClass(name); +export function ClassOf (name: string): Constructor { + return createClass(name); } -function initType (Type: Constructor, value?: any, isPedantic?: boolean): Codec { +function initType (Type: Constructor, value?: any, isPedantic?: boolean): T { try { const created = new Type(value); @@ -301,11 +303,11 @@ function initType (Type: Constructor, value?: any, isPedantic?: boolean): Codec } } -export default function createType (type: Text | string, value?: any, isPedantic?: boolean): Codec { +export default function createType (type: Text | string, value?: any, isPedantic?: boolean): T { // l.debug(() => ['createType', { type, value }]); try { - return initType(createClass(type), value, isPedantic); + return initType(createClass(type), value, isPedantic); } catch (error) { throw new Error(`createType(${type}):: ${error.message}`); } diff --git a/packages/types/src/codec/index.ts b/packages/types/src/codec/index.ts index b981a9d1a5..21a57ba6c9 100644 --- a/packages/types/src/codec/index.ts +++ b/packages/types/src/codec/index.ts @@ -24,5 +24,5 @@ export { default as U8a } from './U8a'; export { default as UInt } from './UInt'; // Type management helper functions -export { default as createType, createClass, getTypeClass, getTypeDef, TypeDef, TypeDefInfo } from './createType'; +export { default as createType, createClass, getTypeClass, getTypeDef, ClassOf, TypeDef, TypeDefInfo } from './createType'; export { default as getTypeRegistry } from './typeRegistry'; diff --git a/packages/types/src/codec/typeRegistry.ts b/packages/types/src/codec/typeRegistry.ts index 3fa4e04a40..a9ea91a5d9 100644 --- a/packages/types/src/codec/typeRegistry.ts +++ b/packages/types/src/codec/typeRegistry.ts @@ -4,7 +4,7 @@ import { isFunction, isString, isUndefined } from '@polkadot/util'; -import { Constructor, RegistryTypes } from '../types'; +import { Codec, Constructor, RegistryTypes } from '../types'; import { createClass } from './createType'; export class TypeRegistry { @@ -49,12 +49,12 @@ export class TypeRegistry { }); } - public get (name: string): Constructor | undefined { - return this._registry.get(name); + public get (name: string): Constructor | undefined { + return this._registry.get(name) as unknown as Constructor; } - public getOrThrow (name: string, msg?: string): Constructor { - const type = this.get(name); + public getOrThrow (name: string, msg?: string): Constructor { + const type = this.get(name); if (isUndefined(type)) { throw new Error(msg || `type ${name} not found`); diff --git a/packages/types/src/primitive/EventRecord.spec.ts b/packages/types/src/primitive/EventRecord.spec.ts index 5dca839366..7872aa2569 100644 --- a/packages/types/src/primitive/EventRecord.spec.ts +++ b/packages/types/src/primitive/EventRecord.spec.ts @@ -6,6 +6,7 @@ import createType from '../codec/createType'; import Vector from '../codec/Vector'; import json1 from '../json/EventRecord.001.json'; import json3 from '../json/EventRecord.003.json'; +import { injectDefinitions } from '../srml'; import Metadata from '../Metadata'; import metadataV0 from '../Metadata/v0/static'; import metadata from '../Metadata/static'; @@ -15,6 +16,8 @@ import EventRecord from './EventRecord'; describe('EventRecord', (): void => { describe('EventRecord_0_76', (): void => { beforeEach((): void => { + injectDefinitions(); + Event.injectMetadata( new Metadata(metadataV0) ); @@ -30,6 +33,8 @@ describe('EventRecord', (): void => { describe('EventRecord (current)', (): void => { beforeEach((): void => { + injectDefinitions(); + Event.injectMetadata( new Metadata(metadata) ); diff --git a/packages/types/src/srml/definitions.ts b/packages/types/src/srml/definitions.ts index ae2c54c523..eb6350af44 100644 --- a/packages/types/src/srml/definitions.ts +++ b/packages/types/src/srml/definitions.ts @@ -6,8 +6,15 @@ // layers can re-use types from higher layers as this is being injected. The // injection order is critical. -export { default as babe } from './babe/definitions'; +// session before grandpa, ImOnline +export { default as session } from './session/definitions'; + +// grandpa before parachains export { default as grandpa } from './grandpa/definitions'; + +// remaining, alphabetical odering +export { default as babe } from './babe/definitions'; export { default as contracts } from './contracts/definitions'; +export { default as elections } from './elections/definitions'; export { default as imOnline } from './imOnline/definitions'; export { default as parachains } from './parachains/definitions'; diff --git a/packages/types/src/type/Keys.ts b/packages/types/src/srml/elections/definitions.ts similarity index 55% rename from packages/types/src/type/Keys.ts rename to packages/types/src/srml/elections/definitions.ts index 2c750c8d5c..012052d447 100644 --- a/packages/types/src/type/Keys.ts +++ b/packages/types/src/srml/elections/definitions.ts @@ -2,13 +2,8 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import SessionKeys from './SessionKeys'; - -/** - * @name Keys - * @description - * The session keys - */ - -export default class Keys extends SessionKeys { -} +export default { + types: { + SetIndex: 'u32' + } +}; diff --git a/packages/types/src/srml/elections/types.ts b/packages/types/src/srml/elections/types.ts new file mode 100644 index 0000000000..2b9768f35f --- /dev/null +++ b/packages/types/src/srml/elections/types.ts @@ -0,0 +1,6 @@ +/* eslint-disable @typescript-eslint/no-empty-interface */ +// Auto-generated via `yarn build:srmlTs`, do not edit + +import { u32 } from '../../primitive'; + +export interface SetIndex extends u32 {} diff --git a/packages/types/src/srml/grandpa/types.ts b/packages/types/src/srml/grandpa/types.ts index 2542d71692..161437329d 100644 --- a/packages/types/src/srml/grandpa/types.ts +++ b/packages/types/src/srml/grandpa/types.ts @@ -4,7 +4,8 @@ import { Codec } from '../../types'; import { Enum, Struct, Vector } from '../../codec'; import { u64 } from '../../primitive'; -import { BlockNumber, SessionKey } from '../../type'; +import { BlockNumber } from '../../type'; +import { SessionKey } from '../session/types'; export interface AuthorityWeight extends u64 {} diff --git a/packages/types/src/srml/imOnline/types.ts b/packages/types/src/srml/imOnline/types.ts index 91968d8240..c1ee9094a2 100644 --- a/packages/types/src/srml/imOnline/types.ts +++ b/packages/types/src/srml/imOnline/types.ts @@ -3,7 +3,8 @@ import { Struct, Vector } from '../../codec'; import { Bytes } from '../../primitive'; -import { AuthorityId, BlockNumber, SessionIndex } from '../../type'; +import { AuthorityId, BlockNumber } from '../../type'; +import { SessionIndex } from '../session/types'; export interface Heartbeat extends Struct { readonly blockNumber: BlockNumber; diff --git a/packages/types/src/srml/index.ts b/packages/types/src/srml/index.ts new file mode 100644 index 0000000000..9e73fbd25e --- /dev/null +++ b/packages/types/src/srml/index.ts @@ -0,0 +1,17 @@ +// Copyright 2017-2019 @polkadot/types authors & contributors +// This software may be modified and distributed under the terms +// of the Apache-2.0 license. See the LICENSE file for details. + +import getTypeRegistry from '../codec/typeRegistry'; +import * as srmlTypes from './definitions'; + +/** + * @description A utility method that injects all the srml definitions into the type registry + */ +export function injectDefinitions (): void { + const registry = getTypeRegistry(); + + Object.values(srmlTypes).forEach(({ types }): void => + registry.register(types) + ); +} diff --git a/packages/types/src/srml/parachains/types.ts b/packages/types/src/srml/parachains/types.ts index 5e2aec2300..f362db3cb9 100644 --- a/packages/types/src/srml/parachains/types.ts +++ b/packages/types/src/srml/parachains/types.ts @@ -4,7 +4,8 @@ import { Codec } from '../../types'; import { Enum, Struct, Vector } from '../../codec'; import { AccountId, BalanceOf, Bytes, Hash, Signature, u32, u64 } from '../../primitive'; -import { BlockNumber, SessionKey } from '../../type'; +import { BlockNumber } from '../../type'; +import { SessionKey } from '../session/types'; export interface AttestedCandidate extends Struct { readonly candidate: CandidateReceipt; diff --git a/packages/types/src/type/SetIndex.ts b/packages/types/src/srml/session/definitions.ts similarity index 53% rename from packages/types/src/type/SetIndex.ts rename to packages/types/src/srml/session/definitions.ts index 9fc49364b3..c53ea1bc56 100644 --- a/packages/types/src/type/SetIndex.ts +++ b/packages/types/src/srml/session/definitions.ts @@ -2,12 +2,13 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import U32 from '../primitive/U32'; - -/** - * @name SetIndex - * @description - * Set index, implemented as a [[U32]] - */ -export default class SetIndex extends U32 { -} +export default { + types: { + SessionIndex: 'u32', + SessionKey: 'AuthorityId', + SessionKeys: { + ed25519: 'SessionKey' + }, + Keys: 'SessionKeys' + } +}; diff --git a/packages/types/src/srml/session/types.ts b/packages/types/src/srml/session/types.ts new file mode 100644 index 0000000000..31fd501f30 --- /dev/null +++ b/packages/types/src/srml/session/types.ts @@ -0,0 +1,16 @@ +/* eslint-disable @typescript-eslint/no-empty-interface */ +// Auto-generated via `yarn build:srmlTs`, do not edit + +import { Struct } from '../../codec'; +import { u32 } from '../../primitive'; +import { AuthorityId } from '../../type'; + +export interface Keys extends SessionKeys {} + +export interface SessionIndex extends u32 {} + +export interface SessionKey extends AuthorityId {} + +export interface SessionKeys extends Struct { + readonly ed25519: SessionKey; +} diff --git a/packages/types/src/srml/types.ts b/packages/types/src/srml/types.ts index faf8a6c768..81bca109e1 100644 --- a/packages/types/src/srml/types.ts +++ b/packages/types/src/srml/types.ts @@ -2,8 +2,12 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -export * from './babe/types'; +// keep ordering here exactly the same as definitions +export * from './session/types'; export * from './grandpa/types'; + +export * from './babe/types'; export * from './contracts/types'; +export * from './elections/types'; export * from './imOnline/types'; export * from './parachains/types'; diff --git a/packages/types/src/type/SessionIndex.ts b/packages/types/src/type/SessionIndex.ts deleted file mode 100644 index f55747519f..0000000000 --- a/packages/types/src/type/SessionIndex.ts +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2017-2019 @polkadot/types authors & contributors -// This software may be modified and distributed under the terms -// of the Apache-2.0 license. See the LICENSE file for details. - -import U32 from '../primitive/U32'; - -/** - * @name SessionIndex - * @description - * Simple index type with which we can count sessions - */ -export default class SessionIndex extends U32 { -} diff --git a/packages/types/src/type/index.ts b/packages/types/src/type/index.ts index 8de78403f8..d2a471877e 100644 --- a/packages/types/src/type/index.ts +++ b/packages/types/src/type/index.ts @@ -24,7 +24,6 @@ export { default as Exposure } from './Exposure'; export { default as IndividualExposure } from './IndividualExposure'; export { default as InherentOfflineReport } from './InherentOfflineReport'; export { default as Key } from './Key'; -export { default as Keys } from './Keys'; export { default as KeyValue } from './KeyValue'; export { default as LockIdentifier } from './LockIdentifier'; export { default as LockPeriods } from './LockPeriods'; @@ -45,10 +44,6 @@ export { default as ReferendumIndex } from './ReferendumIndex'; export { default as ReferendumInfo } from './ReferendumInfo'; export { default as RewardDestination } from './RewardDestination'; export { default as SeedOf } from './SeedOf'; -export { default as SessionIndex } from './SessionIndex'; -export { default as SessionKey } from './SessionKey'; -export { default as SessionKeys } from './SessionKeys'; -export { default as SetIndex } from './SetIndex'; export { default as StakingLedger } from './StakingLedger'; export { default as TreasuryProposal } from './TreasuryProposal'; export { default as UncleEntryItem } from './UncleEntryItem';