From 1664c868dfaf4c8cf1a4edb05e8d44c040ff79eb Mon Sep 17 00:00:00 2001 From: Jaco Date: Thu, 30 Jun 2022 13:23:01 +0200 Subject: [PATCH] Adjust runtime decoration & typegen (#4996) --- packages/api-base/src/types/calls.ts | 11 +---------- packages/api/src/base/Decorate.ts | 4 ++-- packages/typegen/package.json | 1 - packages/typegen/src/generate/runtime.ts | 3 +-- packages/typegen/tsconfig.build.json | 1 - packages/types/src/types/definitions.ts | 10 ++++++++++ yarn.lock | 1 - 7 files changed, 14 insertions(+), 17 deletions(-) diff --git a/packages/api-base/src/types/calls.ts b/packages/api-base/src/types/calls.ts index cd379a54a1..57736f5f86 100644 --- a/packages/api-base/src/types/calls.ts +++ b/packages/api-base/src/types/calls.ts @@ -2,8 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import type { Observable } from 'rxjs'; -import type { AnyFunction, Codec, DefinitionCall } from '@polkadot/types/types'; -import type { HexString } from '@polkadot/util/types'; +import type { AnyFunction, Codec, DefinitionCallNamed } from '@polkadot/types/types'; import type { ApiTypes, ReturnCodec } from './base'; // eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/no-empty-interface @@ -28,11 +27,3 @@ export type DecoratedCallBase Observable> = DecoratedCallBase & { meta: DefinitionCallNamed }; - -export interface DefinitionCallNamed extends DefinitionCall { - method: string; - name: string; - section: string; - sectionHash: HexString; - version: number; -} diff --git a/packages/api/src/base/Decorate.ts b/packages/api/src/base/Decorate.ts index b94cc3b06e..53d1c68d3c 100644 --- a/packages/api/src/base/Decorate.ts +++ b/packages/api/src/base/Decorate.ts @@ -2,13 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 import type { Observable } from 'rxjs'; -import type { AugmentedCall, DefinitionCallNamed, DeriveCustom, QueryableCalls } from '@polkadot/api-base/types'; +import type { AugmentedCall, DeriveCustom, QueryableCalls } from '@polkadot/api-base/types'; import type { RpcInterface } from '@polkadot/rpc-core/types'; import type { Option, Raw, StorageKey, Text, u64 } from '@polkadot/types'; import type { Call, Hash, RuntimeVersion } from '@polkadot/types/interfaces'; import type { DecoratedMeta } from '@polkadot/types/metadata/decorate/types'; import type { StorageEntry } from '@polkadot/types/primitive/types'; -import type { AnyFunction, AnyTuple, CallFunction, Codec, DefinitionRpc, DefinitionRpcSub, Definitions, DefinitionsCall, DetectCodec, IMethod, IStorageKey, Registry, RegistryError, RegistryTypes } from '@polkadot/types/types'; +import type { AnyFunction, AnyTuple, CallFunction, Codec, DefinitionCallNamed, DefinitionRpc, DefinitionRpcSub, Definitions, DefinitionsCall, DetectCodec, IMethod, IStorageKey, Registry, RegistryError, RegistryTypes } from '@polkadot/types/types'; import type { HexString } from '@polkadot/util/types'; import type { SubmittableExtrinsic } from '../submittable/types'; import type { ApiDecoration, ApiInterfaceRx, ApiOptions, ApiTypes, AugmentedQuery, DecoratedErrors, DecoratedEvents, DecoratedRpc, DecorateMethod, GenericStorageEntryFunction, PaginationOptions, QueryableConsts, QueryableStorage, QueryableStorageEntry, QueryableStorageEntryAt, QueryableStorageMulti, QueryableStorageMultiArg, SubmittableExtrinsicFunction, SubmittableExtrinsics } from '../types'; diff --git a/packages/typegen/package.json b/packages/typegen/package.json index 0b036b85a5..7575b612fa 100644 --- a/packages/typegen/package.json +++ b/packages/typegen/package.json @@ -35,7 +35,6 @@ "@babel/runtime": "^7.18.3", "@polkadot/api": "8.10.2-4-x", "@polkadot/api-augment": "8.10.2-4-x", - "@polkadot/api-base": "8.10.2-4-x", "@polkadot/rpc-augment": "8.10.2-4-x", "@polkadot/rpc-provider": "8.10.2-4-x", "@polkadot/types": "8.10.2-4-x", diff --git a/packages/typegen/src/generate/runtime.ts b/packages/typegen/src/generate/runtime.ts index 3def3c359f..ab8c746ded 100644 --- a/packages/typegen/src/generate/runtime.ts +++ b/packages/typegen/src/generate/runtime.ts @@ -1,9 +1,8 @@ // Copyright 2017-2022 @polkadot/typegen authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { DefinitionCallNamed } from '@polkadot/api-base/types'; import type { TypeRegistry } from '@polkadot/types/create'; -import type { Definitions } from '@polkadot/types/types'; +import type { DefinitionCallNamed, Definitions } from '@polkadot/types/types'; import type { HexString } from '@polkadot/util/types'; import type { ExtraTypes } from './types'; diff --git a/packages/typegen/tsconfig.build.json b/packages/typegen/tsconfig.build.json index ab8eb5b5ff..490403db50 100644 --- a/packages/typegen/tsconfig.build.json +++ b/packages/typegen/tsconfig.build.json @@ -8,7 +8,6 @@ "references": [ { "path": "../api/tsconfig.build.json" }, { "path": "../api-augment/tsconfig.build.json" }, - { "path": "../api-base/tsconfig.build.json" }, { "path": "../rpc-augment/tsconfig.build.json" }, { "path": "../rpc-provider/tsconfig.build.json" }, { "path": "../types/tsconfig.build.json" }, diff --git a/packages/types/src/types/definitions.ts b/packages/types/src/types/definitions.ts index c1f43b6c72..670dc0d7d1 100644 --- a/packages/types/src/types/definitions.ts +++ b/packages/types/src/types/definitions.ts @@ -1,6 +1,8 @@ // Copyright 2017-2022 @polkadot/types authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { HexString } from '@polkadot/util/types'; + export type DefinitionTypeType = string; export type DefinitionTypeEnum = { _fallback?: DefinitionTypeType } & ({ _enum: DefinitionTypeType[] } | { _enum: Record }); @@ -64,6 +66,14 @@ export type DefinitionsCall = Record; +export interface DefinitionCallNamed extends DefinitionCall { + method: string; + name: string; + section: string; + sectionHash: HexString; + version: number; +} + export type DefinitionsTypes = Record; export interface Definitions { diff --git a/yarn.lock b/yarn.lock index c5e4452b26..6ef56ffe67 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2213,7 +2213,6 @@ __metadata: "@babel/runtime": ^7.18.3 "@polkadot/api": 8.10.2-4-x "@polkadot/api-augment": 8.10.2-4-x - "@polkadot/api-base": 8.10.2-4-x "@polkadot/rpc-augment": 8.10.2-4-x "@polkadot/rpc-provider": 8.10.2-4-x "@polkadot/types": 8.10.2-4-x