import { AnyJson, Codec, Constructor, InterfaceTypes } from '../types'; import Base from './Base'; export interface EnumConstructor { new (value?: any, index?: number): T; } /** * @name Enum * @description * This implements an enum, that based on the value wraps a different type. It is effectively * an extension to enum where the value type is determined by the actual index. */ export default class Enum extends Base { private _def; private _index; private _indexes; private _isBasic; constructor(def: Record | string[], value?: any, index?: number); private static decodeEnum; private static decodeViaValue; private static decodeViaString; private static createViaJSON; private static createValue; static with(Types: Record | string[]): EnumConstructor; /** * @description The length of the value when encoded as a Uint8Array */ readonly encodedLength: number; /** * @description The index of the metadata value */ readonly index: number; /** * @description Checks if the Enum points to a [[Null]] type */ readonly isNone: boolean; /** * @description Checks if the Enum points to a [[Null]] type (deprecated, use isNone) */ readonly isNull: boolean; /** * @description The name of the type this enum value represents */ readonly type: string; /** * @description The value of the enum */ readonly value: Codec; /** * @description Compares the value of the input to see if there is a match */ eq(other?: any): boolean; /** * @description Returns a hex string representation of the value */ toHex(): string; /** * @description Converts the Object to JSON, typically used for RPC transfers */ toJSON(): AnyJson; /** * @description Returns the number representation for the value */ toNumber(): number; /** * @description Returns the base runtime type name for this instance */ toRawType(): string; /** * @description Returns the string representation of the value */ toString(): string; /** * @description Encodes the value as a Uint8Array as per the SCALE specifications * @param isBare true when the value has none of the type-specific prefixes (internal) */ toU8a(isBare?: boolean): Uint8Array; }