UNPKG

2.01 kBTypeScriptView Raw
1import type { Option, Text, Vec } from '@polkadot/types-codec';
2import type { LookupString, Registry } from '@polkadot/types-codec/types';
3import type { ILookup, TypeDef } from '@polkadot/types-create/types';
4import type { PortableType } from '../../interfaces/metadata/index.js';
5import type { SiLookupTypeId, SiType, SiTypeParameter } from '../../interfaces/scaleInfo/index.js';
6import { Struct } from '@polkadot/types-codec';
7interface TypeInfoParams {
8 FrameSystemEventRecord: [event: SiTypeParameter, topic: SiTypeParameter];
9 SpRuntimeUncheckedExtrinsic: [address: SiTypeParameter, call: SiTypeParameter, signature: SiTypeParameter, extra: SiTypeParameter];
10 [key: string]: SiTypeParameter[];
11}
12export declare class PortableRegistry extends Struct implements ILookup {
13 #private;
14 constructor(registry: Registry, value?: Uint8Array, isContract?: boolean);
15 /**
16 * @description Returns all the available type names for this chain
17 **/
18 get names(): string[];
19 /**
20 * @description Returns all the available parameterized types for this chain
21 **/
22 get paramTypes(): TypeInfoParams;
23 /**
24 * @description The types of the registry
25 */
26 get types(): Vec<PortableType>;
27 /**
28 * @description Register all available types into the registry (generally for internal usage)
29 */
30 register(): void;
31 /**
32 * @description Returns the name for a specific lookup
33 */
34 getName(lookupId: SiLookupTypeId | LookupString | number): string | undefined;
35 /**
36 * @description Finds a specific type in the registry
37 */
38 getSiType(lookupId: SiLookupTypeId | LookupString | number): SiType;
39 /**
40 * @description Lookup the type definition for the index
41 */
42 getTypeDef(lookupId: SiLookupTypeId | LookupString | number): TypeDef;
43 /**
44 * @description For a specific field, perform adjustments to not have built-in conflicts
45 */
46 sanitizeField(name: Option<Text>): [string | null, string | null];
47}
48export {};