diff --git a/packages/api/src/base/index.ts b/packages/api/src/base/index.ts index 2198e3b307..a34b3d74fe 100644 --- a/packages/api/src/base/index.ts +++ b/packages/api/src/base/index.ts @@ -4,11 +4,12 @@ import { RpcInterface } from '@polkadot/rpc-core/jsonrpc.types'; import { Hash, RuntimeVersion } from '@polkadot/types/interfaces'; -import { CallFunction, RegistryTypes, SignerPayloadRawBase } from '@polkadot/types/types'; +import { InterfaceRegistry } from '@polkadot/types/interfaceRegistry'; +import { CallFunction, InterfaceTypes, RegistryTypes, SignerPayloadRawBase } from '@polkadot/types/types'; import { ApiOptions, ApiTypes, DecoratedRpc, DecorateMethod, QueryableStorage, QueryableStorageMulti, SubmittableExtrinsics, Signer } from '../types'; import { Constants } from '@polkadot/api-metadata/consts/types'; -import { GenericCall, Metadata, getTypeRegistry } from '@polkadot/types'; +import { GenericCall, Metadata, createType, getTypeRegistry } from '@polkadot/types'; import { assert, isString, isUndefined, u8aToHex, u8aToU8a } from '@polkadot/util'; import Init from './Init'; @@ -216,6 +217,13 @@ export default abstract class ApiBase extends Init { return assertResult(this._extrinsics); } + /** + * @description Creates an instance of a type as registered + */ + public createType (type: K, ...params: any[]): InterfaceRegistry[K] { + return createType(type, ...params); + } + /** * @description Disconnect from the underlying provider, halting all comms */