name: EnumType

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.

Type parameters

T

Hierarchy

Base<Codec>

↳ EnumType

↳ StorageFunctionType

↳ DigestItem

↳ Phase

↳ ExtrinsicStatus

↳ MisbehaviorKind

Implements

Constructors

constructor

⊕ new EnumType(def: TypesDef, value?: any, index?: number | EnumType<T>): EnumType

Overrides Base.constructor

Defined in codec/EnumType.ts:28

Parameters:

Name Type
def TypesDef
Optional value any
Optional index number | EnumType<T>

Returns: EnumType


Accessors

encodedLength

getencodedLength(): number

Defined in codec/EnumType.ts:87

description: The length of the value when encoded as a Uint8Array

Returns: number


isNone

getisNone(): boolean

Defined in codec/EnumType.ts:94

description: Checks if the Enum points to a Null type

Returns: boolean


isNull

getisNull(): boolean

Defined in codec/EnumType.ts:101

description: Checks if the Enum points to a Null type (deprecated, use isNone)

Returns: boolean


type

gettype(): string

Defined in codec/EnumType.ts:108

description: The name of the type this enum value represents

Returns: string


value

getvalue(): Codec

Defined in codec/EnumType.ts:115

description: The value of the enum

Returns: Codec


Methods

toHex

▸ toHex(): string

Implementation of Codec.toHex

Defined in codec/EnumType.ts:122

description: Returns a hex string representation of the value

Returns: string


toJSON

▸ toJSON(): any

Implementation of Codec.toJSON

Defined in codec/EnumType.ts:129

description: Converts the Object to JSON, typically used for RPC transfers

Returns: any


toNumber

▸ toNumber(): number

Defined in codec/EnumType.ts:136

description: Returns the number representation for the value

Returns: number


toString

▸ toString(): string

Implementation of Codec.toString

Defined in codec/EnumType.ts:143

description: Returns the string representation of the value

Returns: string


toU8a

▸ toU8a(isBare?: undefined | false | true): Uint8Array

Implementation of Codec.toU8a

Defined in codec/EnumType.ts:151

description: Encodes the value as a Uint8Array as per the parity-codec specifications

Parameters:

Name Type Description
Optional isBare undefined | false | true true when the value has none of the type-specific prefixes (internal)

Returns: Uint8Array


<Static> decodeEnumType

▸ decodeEnumType<T>(def: TypesDef, value?: any, index?: number | EnumType<T>): object

Defined in codec/EnumType.ts:47

Type parameters:

T

Parameters:

Name Type
def TypesDef
Optional value any
Optional index number | EnumType<T>

Returns: object


results matching ""

    No results matching ""