UNPKG

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