InterfaceTypes -> keyof InterfaceRegistry (#1928)
* InterfaceTypes -> keyof InterfaceRegistry * Renames
This commit is contained in:
@@ -2,4 +2,4 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import './interfaceRegistry';
|
||||
import './registry';
|
||||
|
||||
+2
-2
@@ -37,8 +37,8 @@ import { Multiplier } from '@polkadot/types/interfaces/txpayment';
|
||||
import { Multisig, Timepoint } from '@polkadot/types/interfaces/utility';
|
||||
import { VestingInfo } from '@polkadot/types/interfaces/vesting';
|
||||
|
||||
declare module '@polkadot/types/interfaceRegistry' {
|
||||
export interface InterfaceRegistry {
|
||||
declare module '@polkadot/types/types/registry' {
|
||||
export interface InterfaceTypes {
|
||||
BitVec: BitVec;
|
||||
'Option<BitVec>': Option<BitVec>;
|
||||
'Vec<BitVec>': Vec<BitVec>;
|
||||
@@ -19,7 +19,7 @@ export default class BTreeMap<K extends Codec = Codec, V extends Codec = Codec>
|
||||
|
||||
private readonly _ValClass: Constructor<V>;
|
||||
|
||||
constructor (registry: Registry, keyType: Constructor<K> | InterfaceTypes, valType: Constructor<V> | InterfaceTypes, rawValue: any) {
|
||||
constructor (registry: Registry, keyType: Constructor<K> | keyof InterfaceTypes, valType: Constructor<V> | keyof InterfaceTypes, rawValue: any) {
|
||||
const KeyClass = typeToConstructor(registry, keyType);
|
||||
const ValClass = typeToConstructor(registry, valType);
|
||||
|
||||
@@ -98,7 +98,7 @@ export default class BTreeMap<K extends Codec = Codec, V extends Codec = Codec>
|
||||
return output;
|
||||
}
|
||||
|
||||
public static with<K extends Codec, V extends Codec> (keyType: Constructor<K> | InterfaceTypes, valType: Constructor<V> | InterfaceTypes): Constructor<BTreeMap<K, V>> {
|
||||
public static with<K extends Codec, V extends Codec> (keyType: Constructor<K> | keyof InterfaceTypes, valType: Constructor<V> | keyof InterfaceTypes): Constructor<BTreeMap<K, V>> {
|
||||
return class extends BTreeMap<K, V> {
|
||||
constructor (registry: Registry, value?: any) {
|
||||
super(registry, keyType, valType, value);
|
||||
|
||||
@@ -17,7 +17,7 @@ export default class BTreeSet<V extends Codec = Codec> extends Set<V> implements
|
||||
|
||||
private readonly _ValClass: Constructor<V>;
|
||||
|
||||
constructor (registry: Registry, valType: Constructor<V> | InterfaceTypes, rawValue: any) {
|
||||
constructor (registry: Registry, valType: Constructor<V> | keyof InterfaceTypes, rawValue: any) {
|
||||
const ValClass = typeToConstructor(registry, valType);
|
||||
|
||||
super(BTreeSet.decodeBTreeSet(registry, ValClass, rawValue));
|
||||
@@ -92,7 +92,7 @@ export default class BTreeSet<V extends Codec = Codec> extends Set<V> implements
|
||||
return output;
|
||||
}
|
||||
|
||||
public static with<V extends Codec> (valType: Constructor<V> | InterfaceTypes): Constructor<BTreeSet<V>> {
|
||||
public static with<V extends Codec> (valType: Constructor<V> | keyof InterfaceTypes): Constructor<BTreeSet<V>> {
|
||||
return class extends BTreeSet<V> {
|
||||
constructor (registry: Registry, value?: any) {
|
||||
super(registry, valType, value);
|
||||
|
||||
@@ -27,11 +27,11 @@ export interface CompactEncodable extends Codec {
|
||||
* a number and making the compact representation thereof
|
||||
*/
|
||||
export default class Compact<T extends CompactEncodable> extends Base<T> implements ICompact<T> {
|
||||
constructor (registry: Registry, Type: Constructor<T> | InterfaceTypes, value: Compact<T> | AnyNumber = 0) {
|
||||
constructor (registry: Registry, Type: Constructor<T> | keyof InterfaceTypes, value: Compact<T> | AnyNumber = 0) {
|
||||
super(registry, Compact.decodeCompact<T>(registry, typeToConstructor(registry, Type), value));
|
||||
}
|
||||
|
||||
public static with<T extends CompactEncodable> (Type: Constructor<T> | InterfaceTypes): Constructor<Compact<T>> {
|
||||
public static with<T extends CompactEncodable> (Type: Constructor<T> | keyof InterfaceTypes): Constructor<Compact<T>> {
|
||||
return class extends Compact<T> {
|
||||
constructor (registry: Registry, value?: any) {
|
||||
super(registry, Type, value);
|
||||
|
||||
@@ -23,7 +23,7 @@ interface Decoded {
|
||||
value: Codec;
|
||||
}
|
||||
|
||||
function extractDef (registry: Registry, _def: Record<string, InterfaceTypes | Constructor> | string[]): { def: TypesDef; isBasic: boolean } {
|
||||
function extractDef (registry: Registry, _def: Record<string, keyof InterfaceTypes | Constructor> | string[]): { def: TypesDef; isBasic: boolean } {
|
||||
if (!Array.isArray(_def)) {
|
||||
const def = mapToTypeMap(registry, _def);
|
||||
const isBasic = !Object.values(def).some((type): boolean => type !== Null);
|
||||
@@ -123,7 +123,7 @@ export default class Enum extends Base<Codec> {
|
||||
|
||||
private _isBasic: boolean;
|
||||
|
||||
constructor (registry: Registry, def: Record<string, InterfaceTypes | Constructor> | string[], value?: any, index?: number) {
|
||||
constructor (registry: Registry, def: Record<string, keyof InterfaceTypes | Constructor> | string[], value?: any, index?: number) {
|
||||
const defInfo = extractDef(registry, def);
|
||||
const decoded = decodeEnum(registry, defInfo.def, value, index);
|
||||
|
||||
@@ -135,7 +135,7 @@ export default class Enum extends Base<Codec> {
|
||||
this._index = this._indexes.indexOf(decoded.index) || 0;
|
||||
}
|
||||
|
||||
public static with (Types: Record<string, InterfaceTypes | Constructor> | string[]): EnumConstructor<Enum> {
|
||||
public static with (Types: Record<string, keyof InterfaceTypes | Constructor> | string[]): EnumConstructor<Enum> {
|
||||
return class extends Enum {
|
||||
constructor (registry: Registry, value?: any, index?: number) {
|
||||
super(registry, Types, value, index);
|
||||
|
||||
@@ -18,14 +18,14 @@ const EMPTY = new Uint8Array();
|
||||
* @description The wrapper for the result from a LinkedMap
|
||||
*/
|
||||
export default class Linkage<T extends Codec> extends Struct {
|
||||
constructor (registry: Registry, Type: Constructor | InterfaceTypes, value?: any) {
|
||||
constructor (registry: Registry, Type: Constructor | keyof InterfaceTypes, value?: any) {
|
||||
super(registry, {
|
||||
previous: Option.with(Type),
|
||||
next: Option.with(Type)
|
||||
}, value);
|
||||
}
|
||||
|
||||
public static withKey<O extends Codec> (Type: Constructor | InterfaceTypes): Constructor<Linkage<O>> {
|
||||
public static withKey<O extends Codec> (Type: Constructor | keyof InterfaceTypes): Constructor<Linkage<O>> {
|
||||
return class extends Linkage<O> {
|
||||
constructor (registry: Registry, value?: any) {
|
||||
super(registry, Type, value);
|
||||
|
||||
@@ -21,7 +21,7 @@ import Base from './Base';
|
||||
export default class Option<T extends Codec> extends Base<T> {
|
||||
private _Type: Constructor;
|
||||
|
||||
constructor (registry: Registry, Type: Constructor | InterfaceTypes, value?: any) {
|
||||
constructor (registry: Registry, Type: Constructor | keyof InterfaceTypes, value?: any) {
|
||||
const Clazz = typeToConstructor(registry, Type);
|
||||
|
||||
super(registry, Option.decodeOption(registry, Clazz, value));
|
||||
@@ -54,7 +54,7 @@ export default class Option<T extends Codec> extends Base<T> {
|
||||
: new Type(registry, value.subarray(1));
|
||||
}
|
||||
|
||||
public static with<O extends Codec> (Type: Constructor | InterfaceTypes): Constructor<Option<O>> {
|
||||
public static with<O extends Codec> (Type: Constructor | keyof InterfaceTypes): Constructor<Option<O>> {
|
||||
return class extends Option<O> {
|
||||
constructor (registry: Registry, value?: any) {
|
||||
super(registry, Type, value);
|
||||
|
||||
@@ -14,12 +14,12 @@ import Enum from './Enum';
|
||||
* A Result maps to the Rust Result type, that can either wrap a success or error value
|
||||
*/
|
||||
export default class Result<O extends Codec, E extends Codec> extends Enum {
|
||||
constructor (registry: Registry, Ok: Constructor<O> | InterfaceTypes, Error: Constructor<E> | InterfaceTypes, value?: any) {
|
||||
constructor (registry: Registry, Ok: Constructor<O> | keyof InterfaceTypes, Error: Constructor<E> | keyof InterfaceTypes, value?: any) {
|
||||
// NOTE This is order-dependent, Ok (with index 0) needs to be first
|
||||
super(registry, { Ok, Error }, value);
|
||||
}
|
||||
|
||||
public static with<O extends Codec, E extends Codec> (Types: { Ok: Constructor<O> | InterfaceTypes; Error: Constructor<E> | InterfaceTypes }): Constructor<Result<O, E>> {
|
||||
public static with<O extends Codec, E extends Codec> (Types: { Ok: Constructor<O> | keyof InterfaceTypes; Error: Constructor<E> | keyof InterfaceTypes }): Constructor<Result<O, E>> {
|
||||
return class extends Result<O, E> {
|
||||
constructor (registry: Registry, value?: any) {
|
||||
super(registry, Types.Ok, Types.Error, value);
|
||||
|
||||
@@ -11,7 +11,7 @@ import { blake2AsU8a } from '@polkadot/util-crypto';
|
||||
import Raw from './Raw';
|
||||
import { compareMap, decodeU8a, mapToTypeMap } from './utils';
|
||||
|
||||
type TypesDef<T = Codec> = Record<string, InterfaceTypes | Constructor<T>>;
|
||||
type TypesDef<T = Codec> = Record<string, keyof InterfaceTypes | Constructor<T>>;
|
||||
|
||||
/** @internal */
|
||||
function decodeStructFromObject <T> (registry: Registry, Types: ConstructorDef, value: any, jsonMap: Map<any, string>): T {
|
||||
|
||||
@@ -13,8 +13,8 @@ type TupleConstructors = Constructor[] | {
|
||||
[index: string]: Constructor;
|
||||
};
|
||||
|
||||
type TupleTypes = (Constructor | InterfaceTypes)[] | {
|
||||
[index: string]: Constructor | InterfaceTypes;
|
||||
type TupleTypes = (Constructor | keyof InterfaceTypes)[] | {
|
||||
[index: string]: Constructor | keyof InterfaceTypes;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,7 +22,7 @@ const MAX_LENGTH = 32768;
|
||||
export default class Vec<T extends Codec> extends AbstractArray<T> {
|
||||
private _Type: Constructor<T>;
|
||||
|
||||
constructor (registry: Registry, Type: Constructor<T> | InterfaceTypes, value: Vec<any> | Uint8Array | string | any[] = [] as any[]) {
|
||||
constructor (registry: Registry, Type: Constructor<T> | keyof InterfaceTypes, value: Vec<any> | Uint8Array | string | any[] = [] as any[]) {
|
||||
const Clazz = typeToConstructor<T>(registry, Type);
|
||||
|
||||
super(registry, ...Vec.decodeVec(registry, Clazz, value));
|
||||
@@ -54,7 +54,7 @@ export default class Vec<T extends Codec> extends AbstractArray<T> {
|
||||
return decodeU8a(registry, u8a.subarray(offset), new Array(length.toNumber()).fill(Type)) as T[];
|
||||
}
|
||||
|
||||
public static with<O extends Codec> (Type: Constructor<O> | InterfaceTypes): Constructor<Vec<O>> {
|
||||
public static with<O extends Codec> (Type: Constructor<O> | keyof InterfaceTypes): Constructor<Vec<O>> {
|
||||
return class extends Vec<O> {
|
||||
constructor (registry: Registry, value?: any[]) {
|
||||
super(registry, Type, value);
|
||||
|
||||
@@ -17,7 +17,7 @@ import Vec from './Vec';
|
||||
export default class VecFixed<T extends Codec> extends AbstractArray<T> {
|
||||
private _Type: Constructor<T>;
|
||||
|
||||
constructor (registry: Registry, Type: Constructor<T> | InterfaceTypes, length: number, value: VecFixed<any> | Uint8Array | string | any[] = [] as any[]) {
|
||||
constructor (registry: Registry, Type: Constructor<T> | keyof InterfaceTypes, length: number, value: VecFixed<any> | Uint8Array | string | any[] = [] as any[]) {
|
||||
const Clazz = typeToConstructor<T>(registry, Type);
|
||||
|
||||
super(registry, ...VecFixed.decodeVecFixed(registry, Clazz, length, value));
|
||||
@@ -44,7 +44,7 @@ export default class VecFixed<T extends Codec> extends AbstractArray<T> {
|
||||
return values;
|
||||
}
|
||||
|
||||
public static with<O extends Codec> (Type: Constructor<O> | InterfaceTypes, length: number): Constructor<VecFixed<O>> {
|
||||
public static with<O extends Codec> (Type: Constructor<O> | keyof InterfaceTypes, length: number): Constructor<VecFixed<O>> {
|
||||
return class extends VecFixed<O> {
|
||||
constructor (registry: Registry, value?: any[]) {
|
||||
super(registry, Type, length, value);
|
||||
|
||||
@@ -8,7 +8,7 @@ import { isString } from '@polkadot/util';
|
||||
|
||||
import { ClassOf } from '../../create/createClass';
|
||||
|
||||
export function typeToConstructor <T = Codec> (registry: Registry, type: InterfaceTypes | Constructor<T>): Constructor<T> {
|
||||
export function typeToConstructor <T = Codec> (registry: Registry, type: keyof InterfaceTypes | Constructor<T>): Constructor<T> {
|
||||
return (
|
||||
isString(type)
|
||||
? ClassOf(registry, type)
|
||||
@@ -19,7 +19,7 @@ export function typeToConstructor <T = Codec> (registry: Registry, type: Interfa
|
||||
/**
|
||||
* @description takes an input map of the form `{ [string]: string | Constructor }` and returns a map of `{ [string]: Constructor }`
|
||||
*/
|
||||
export function mapToTypeMap (registry: Registry, input: Record<string, InterfaceTypes | Constructor>): Record<string, Constructor> {
|
||||
export function mapToTypeMap (registry: Registry, input: Record<string, keyof InterfaceTypes | Constructor>): Record<string, Constructor> {
|
||||
return Object
|
||||
.entries(input)
|
||||
.reduce((output: Record<string, Constructor>, [key, type]): Record<string, Constructor> => {
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { InterfaceRegistry } from '@polkadot/types/interfaceRegistry';
|
||||
import { Codec, Constructor, InterfaceTypes, Registry } from '../types';
|
||||
import { FromReg, TypeDef, TypeDefInfo } from './types';
|
||||
|
||||
@@ -38,9 +37,9 @@ export function ClassOfUnsafe<T extends Codec = Codec, K extends string = string
|
||||
}
|
||||
|
||||
// alias for createClass
|
||||
export function ClassOf<K extends InterfaceTypes> (registry: Registry, name: K): Constructor<InterfaceRegistry[K]> {
|
||||
export function ClassOf<K extends keyof InterfaceTypes> (registry: Registry, name: K): Constructor<InterfaceTypes[K]> {
|
||||
// TS2589: Type instantiation is excessively deep and possibly infinite.
|
||||
// The above happens with as Constructor<InterfaceRegistry[K]>;
|
||||
// The above happens with as Constructor<InterfaceTypes[K]>;
|
||||
return ClassOfUnsafe<Codec, K>(registry, name) as any;
|
||||
}
|
||||
|
||||
@@ -56,15 +55,15 @@ function getSubDef (value: TypeDef): TypeDef {
|
||||
return value.sub;
|
||||
}
|
||||
|
||||
function getSubType (value: TypeDef): InterfaceTypes {
|
||||
return getSubDef(value).type as InterfaceTypes;
|
||||
function getSubType (value: TypeDef): keyof InterfaceTypes {
|
||||
return getSubDef(value).type as keyof InterfaceTypes;
|
||||
}
|
||||
|
||||
// create a maps of type string constructors from the input
|
||||
function getTypeClassMap (value: TypeDef): Record<string, InterfaceTypes> {
|
||||
const result: Record<string, InterfaceTypes> = {};
|
||||
function getTypeClassMap (value: TypeDef): Record<string, keyof InterfaceTypes> {
|
||||
const result: Record<string, keyof InterfaceTypes> = {};
|
||||
|
||||
return getSubDefArray(value).reduce((result, sub): Record<string, InterfaceTypes> => {
|
||||
return getSubDefArray(value).reduce((result, sub): Record<string, keyof InterfaceTypes> => {
|
||||
result[sub.name as string] = sub.type as any;
|
||||
|
||||
return result;
|
||||
@@ -72,9 +71,9 @@ function getTypeClassMap (value: TypeDef): Record<string, InterfaceTypes> {
|
||||
}
|
||||
|
||||
// create an array of type string constructors from the input
|
||||
function getTypeClassArray (value: TypeDef): (InterfaceTypes)[] {
|
||||
return getSubDefArray(value).map(({ type }): InterfaceTypes =>
|
||||
type as InterfaceTypes
|
||||
function getTypeClassArray (value: TypeDef): (keyof InterfaceTypes)[] {
|
||||
return getSubDefArray(value).map(({ type }): keyof InterfaceTypes =>
|
||||
type as keyof InterfaceTypes
|
||||
);
|
||||
}
|
||||
|
||||
@@ -162,7 +161,7 @@ const infoMapping: Record<TypeDefInfo, (registry: Registry, value: TypeDef) => C
|
||||
return (
|
||||
(sub as TypeDef).type === 'u8'
|
||||
? U8aFixed.with((length * 8) as U8aFixedBitLength, displayName)
|
||||
: VecFixed.with((sub as TypeDef).type as InterfaceTypes, length)
|
||||
: VecFixed.with((sub as TypeDef).type as keyof InterfaceTypes, length)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { InterfaceRegistry } from '@polkadot/types/interfaceRegistry';
|
||||
import { Codec, Constructor, InterfaceTypes, Registry } from '../types';
|
||||
import { FromReg } from './types';
|
||||
|
||||
@@ -74,6 +73,6 @@ export function createTypeUnsafe<T extends Codec = Codec, K extends string = str
|
||||
* instance from
|
||||
* @param params - The value to instantiate the type with
|
||||
*/
|
||||
export function createType<K extends InterfaceTypes> (registry: Registry, type: K, ...params: any[]): InterfaceRegistry[K] {
|
||||
return createTypeUnsafe<InterfaceRegistry[K], K>(registry, type, params);
|
||||
export function createType<K extends keyof InterfaceTypes> (registry: Registry, type: K, ...params: any[]): InterfaceTypes[K] {
|
||||
return createTypeUnsafe<InterfaceTypes[K], K>(registry, type, params);
|
||||
}
|
||||
|
||||
@@ -213,11 +213,11 @@ export class TypeRegistry implements Registry {
|
||||
return this.get<T>(name, true) as Constructor<T>;
|
||||
}
|
||||
|
||||
public getSignedExtensionExtra (): Record<string, InterfaceTypes> {
|
||||
public getSignedExtensionExtra (): Record<string, keyof InterfaceTypes> {
|
||||
return expandExtensionTypes(this.#metadataExtensions, 'extra');
|
||||
}
|
||||
|
||||
public getSignedExtensionTypes (): Record<string, InterfaceTypes> {
|
||||
public getSignedExtensionTypes (): Record<string, keyof InterfaceTypes> {
|
||||
return expandExtensionTypes(this.#metadataExtensions, 'types');
|
||||
}
|
||||
|
||||
|
||||
@@ -2,12 +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 { InterfaceRegistry } from '@polkadot/types/interfaceRegistry';
|
||||
import { Codec, InterfaceTypes } from '../types';
|
||||
|
||||
// Type which says: if `K` is in the InterfaceRegistry, then return InterfaceRegistry[K], else fallback to T
|
||||
export type FromReg<T extends Codec, K extends string> = K extends InterfaceTypes
|
||||
? InterfaceRegistry[K]
|
||||
// Type which says: if `K` is in the InterfaceTypes, then return InterfaceTypes[K], else fallback to T
|
||||
export type FromReg<T extends Codec, K extends string> = K extends keyof InterfaceTypes
|
||||
? InterfaceTypes[K]
|
||||
: T;
|
||||
|
||||
export enum TypeDefInfo {
|
||||
|
||||
@@ -29,7 +29,7 @@ interface CreateOptions {
|
||||
type ExtrinsicVx = ExtrinsicV1 | ExtrinsicV2 | ExtrinsicV3 | ExtrinsicV4;
|
||||
type ExtrinsicValue = ExtrinsicValueV1 | ExtrinsicValueV2 | ExtrinsicValueV3 | ExtrinsicValueV4;
|
||||
|
||||
const VERSIONS: InterfaceTypes[] = [
|
||||
const VERSIONS: (keyof InterfaceTypes)[] = [
|
||||
'ExtrinsicUnknown', // v0 is unknown
|
||||
'ExtrinsicV1',
|
||||
'ExtrinsicV2',
|
||||
|
||||
@@ -23,7 +23,7 @@ interface ExtrinsicPayloadOptions {
|
||||
// all our known types that can be returned
|
||||
type ExtrinsicPayloadVx = ExtrinsicPayloadV1 | ExtrinsicPayloadV2 | ExtrinsicPayloadV3 | ExtrinsicPayloadV4;
|
||||
|
||||
const VERSIONS: InterfaceTypes[] = [
|
||||
const VERSIONS: (keyof InterfaceTypes)[] = [
|
||||
'ExtrinsicPayloadUnknown', // v0 is unknown
|
||||
'ExtrinsicPayloadV1',
|
||||
'ExtrinsicPayloadV2',
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import { InterfaceTypes } from '../../types';
|
||||
|
||||
export type ExtTypes = Record<string, InterfaceTypes>;
|
||||
export type ExtTypes = Record<string, keyof InterfaceTypes>;
|
||||
|
||||
export type ExtInfo = {
|
||||
extra: ExtTypes;
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
// Copyright 2017-2020 @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.
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface InterfaceRegistry { }
|
||||
@@ -2,12 +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 { InterfaceRegistry } from '@polkadot/types/interfaceRegistry';
|
||||
|
||||
import BN from 'bn.js';
|
||||
|
||||
export type InterfaceTypes = keyof InterfaceRegistry;
|
||||
|
||||
// We cannot inline this into CodecArg, TS thrws up when building docs
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export type AnyFunction = (...args: any[]) => any;
|
||||
|
||||
@@ -8,7 +8,10 @@ import BN from 'bn.js';
|
||||
|
||||
import { CallFunction } from './calls';
|
||||
import { Codec, Constructor } from './codec';
|
||||
import { AnyJson, InterfaceTypes } from './helpers';
|
||||
import { AnyJson } from './helpers';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface InterfaceTypes { }
|
||||
|
||||
export type RegistryTypes = Record<string, Constructor | string | Record<string, string> | { _enum: string[] | Record<string, string | null> } | { _set: Record<string, number> }>;
|
||||
|
||||
@@ -94,8 +97,8 @@ export interface Registry {
|
||||
getDefinition (name: string): string | undefined;
|
||||
getOrThrow <T extends Codec = Codec> (name: string, msg?: string): Constructor<T>;
|
||||
getOrUnknown <T extends Codec = Codec> (name: string): Constructor<T>;
|
||||
getSignedExtensionExtra (): Record<string, InterfaceTypes>;
|
||||
getSignedExtensionTypes (): Record<string, InterfaceTypes>;
|
||||
getSignedExtensionExtra (): Record<string, keyof InterfaceTypes>;
|
||||
getSignedExtensionTypes (): Record<string, keyof InterfaceTypes>;
|
||||
hasClass (name: string): boolean;
|
||||
hasDef (name: string): boolean;
|
||||
hasType (name: string): boolean;
|
||||
|
||||
Reference in New Issue
Block a user