UNPKG

2.21 kBTypeScriptView Raw
1import type { AnyJson, AnyTuple } from '@polkadot/types-codec/types';
2import type { StorageEntryMetadataLatest, StorageEntryTypeLatest } from '../interfaces/metadata';
3import type { SiLookupTypeId } from '../interfaces/scaleInfo';
4import type { InterfaceTypes, IStorageKey, Registry } from '../types';
5import type { StorageEntry } from './types';
6import { Bytes } from '@polkadot/types-codec';
7interface StorageKeyExtra {
8 method: string;
9 section: string;
10}
11export declare function unwrapStorageSi(type: StorageEntryTypeLatest): SiLookupTypeId;
12/** @internal */
13export declare function unwrapStorageType(registry: Registry, type: StorageEntryTypeLatest, isOptional?: boolean): keyof InterfaceTypes;
14/**
15 * @name StorageKey
16 * @description
17 * A representation of a storage key (typically hashed) in the system. It can be
18 * constructed by passing in a raw key or a StorageEntry with (optional) arguments.
19 */
20export declare class StorageKey<A extends AnyTuple = AnyTuple> extends Bytes implements IStorageKey<A> {
21 #private;
22 constructor(registry: Registry, value?: string | Uint8Array | StorageKey | StorageEntry | [StorageEntry, unknown[]?], override?: Partial<StorageKeyExtra>);
23 /**
24 * @description Return the decoded arguments (applicable to map with decodable values)
25 */
26 get args(): A;
27 /**
28 * @description The metadata or `undefined` when not available
29 */
30 get meta(): StorageEntryMetadataLatest | undefined;
31 /**
32 * @description The key method or `undefined` when not specified
33 */
34 get method(): string | undefined;
35 /**
36 * @description The output type
37 */
38 get outputType(): string;
39 /**
40 * @description The key section or `undefined` when not specified
41 */
42 get section(): string | undefined;
43 is(key: IStorageKey<AnyTuple>): key is IStorageKey<A>;
44 /**
45 * @description Sets the meta for this key
46 */
47 setMeta(meta?: StorageEntryMetadataLatest, section?: string, method?: string): this;
48 /**
49 * @description Returns the Human representation for this type
50 */
51 toHuman(): AnyJson;
52 /**
53 * @description Returns the raw type for this
54 */
55 toRawType(): string;
56}
57export {};