Skip to main content

BcsEnum

@iota/bcs


@iota/bcs / BcsEnum

Class: BcsEnum<T, Name>

Defined in: bcs-type.ts:393

Extends

  • BcsType<EnumOutputShape<{ [K in keyof T]: T[K] extends BcsType<infer U, any> ? U : true }>, EnumInputShape<{ [K in keyof T]: T[K] extends BcsType<any, infer U, any> ? U : boolean | object | null }>, Name>

Type Parameters

T

T extends Record<string, BcsType<any> | null>

Name

Name extends string = string

Constructors

Constructor

new BcsEnum<T, Name>(__namedParameters): BcsEnum<T, Name>

Defined in: bcs-type.ts:405

Parameters

__namedParameters

BcsEnumOptions<T, Name>

Returns

BcsEnum<T, Name>

Overrides

BcsType.constructor

Properties

$inferInput

$inferInput: EnumInputShape

Defined in: bcs-type.ts:21

Inherited from

BcsType.$inferInput


$inferType

$inferType: EnumOutputShape

Defined in: bcs-type.ts:20

Inherited from

BcsType.$inferType


name

name: Name

Defined in: bcs-type.ts:22

Inherited from

BcsType.name


read

read: (reader) => EnumOutputShape

Defined in: bcs-type.ts:23

Parameters

reader

BcsReader

Returns

EnumOutputShape

Inherited from

BcsType.read


serializedSize

serializedSize: (value, options?) => number | null

Defined in: bcs-type.ts:24

Parameters

value

EnumInputShape

options?

BcsWriterOptions

Returns

number | null

Inherited from

BcsType.serializedSize


validate

validate: (value) => void

Defined in: bcs-type.ts:25

Parameters

value

EnumInputShape

Returns

void

Inherited from

BcsType.validate

Methods

fromBase58()

fromBase58(b64): EnumOutputShape<{ [K in string | number | symbol]: T[K] extends BcsType<U, any, string> ? U : true }, Extract<keyof T, string>, { [K in string | number | symbol]: T[K] extends BcsType<U, any, string> ? U : true }[keyof T] extends Type ? Type extends BcsType<U, U, string> ? U : never : never>

Defined in: bcs-type.ts:76

Parameters

b64

string

Returns

EnumOutputShape<{ [K in string | number | symbol]: T[K] extends BcsType<U, any, string> ? U : true }, Extract<keyof T, string>, { [K in string | number | symbol]: T[K] extends BcsType<U, any, string> ? U : true }[keyof T] extends Type ? Type extends BcsType<U, U, string> ? U : never : never>

Inherited from

BcsType.fromBase58


fromBase64()

fromBase64(b64): EnumOutputShape<{ [K in string | number | symbol]: T[K] extends BcsType<U, any, string> ? U : true }, Extract<keyof T, string>, { [K in string | number | symbol]: T[K] extends BcsType<U, any, string> ? U : true }[keyof T] extends Type ? Type extends BcsType<U, U, string> ? U : never : never>

Defined in: bcs-type.ts:80

Parameters

b64

string

Returns

EnumOutputShape<{ [K in string | number | symbol]: T[K] extends BcsType<U, any, string> ? U : true }, Extract<keyof T, string>, { [K in string | number | symbol]: T[K] extends BcsType<U, any, string> ? U : true }[keyof T] extends Type ? Type extends BcsType<U, U, string> ? U : never : never>

Inherited from

BcsType.fromBase64


fromHex()

fromHex(hex): EnumOutputShape<{ [K in string | number | symbol]: T[K] extends BcsType<U, any, string> ? U : true }, Extract<keyof T, string>, { [K in string | number | symbol]: T[K] extends BcsType<U, any, string> ? U : true }[keyof T] extends Type ? Type extends BcsType<U, U, string> ? U : never : never>

Defined in: bcs-type.ts:72

Parameters

hex

string

Returns

EnumOutputShape<{ [K in string | number | symbol]: T[K] extends BcsType<U, any, string> ? U : true }, Extract<keyof T, string>, { [K in string | number | symbol]: T[K] extends BcsType<U, any, string> ? U : true }[keyof T] extends Type ? Type extends BcsType<U, U, string> ? U : never : never>

Inherited from

BcsType.fromHex


parse()

parse(bytes): EnumOutputShape

Defined in: bcs-type.ts:67

Parameters

bytes

Uint8Array

Returns

EnumOutputShape

Inherited from

BcsType.parse


serialize()

serialize(value, options?): SerializedBcs<EnumOutputShape<{ [K in string | number | symbol]: T[K] extends BcsType<U, any, string> ? U : true }, Extract<keyof T, string>, { [K in string | number | symbol]: T[K] extends BcsType<U, any, string> ? U : true }[keyof T] extends Type ? Type extends BcsType<U, U, string> ? U : never : never>, EnumInputShape<{ [K in string | number | symbol]: T[K] extends BcsType<any, U, any> ? U : boolean | object | null }>>

Defined in: bcs-type.ts:62

Parameters

value

EnumInputShape

options?

BcsWriterOptions

Returns

SerializedBcs<EnumOutputShape<{ [K in string | number | symbol]: T[K] extends BcsType<U, any, string> ? U : true }, Extract<keyof T, string>, { [K in string | number | symbol]: T[K] extends BcsType<U, any, string> ? U : true }[keyof T] extends Type ? Type extends BcsType<U, U, string> ? U : never : never>, EnumInputShape<{ [K in string | number | symbol]: T[K] extends BcsType<any, U, any> ? U : boolean | object | null }>>

Inherited from

BcsType.serialize


transform()

transform<T2, Input2, NewName>(__namedParameters): BcsType<T2, Input2, NewName>

Defined in: bcs-type.ts:84

Type Parameters

T2

T2 = EnumOutputShape<{ [K in string | number | symbol]: T[K] extends BcsType<U, any, string> ? U : true }, Extract<keyof T, string>, { [K in string | number | symbol]: T[K] extends BcsType<U, any, string> ? U : true }[keyof T] extends Type ? Type extends BcsType<U, U, string> ? U : never : never>

Input2

Input2 = EnumInputShape<{ [K in string | number | symbol]: T[K] extends BcsType<any, U, any> ? U : boolean | object | null }>

NewName

NewName extends string = Name

Parameters

__namedParameters

object & BcsTypeOptions<T2, Input2, NewName>

Returns

BcsType<T2, Input2, NewName>

Inherited from

BcsType.transform


write()

write(value, writer): void

Defined in: bcs-type.ts:57

Parameters

value

EnumInputShape

writer

BcsWriter

Returns

void

Inherited from

BcsType.write