Skip to main content

BcsStruct

@iota/bcs


@iota/bcs / BcsStruct

Class: BcsStruct<T, Name>

Defined in: bcs-type.ts:318

Extends

  • BcsType<{ [K in keyof T]: T[K] extends BcsType<infer U, any> ? U : never }, { [K in keyof T]: T[K] extends BcsType<any, infer U> ? U : never }, Name>

Type Parameters

T

T extends Record<string, BcsType<any>>

Name

Name extends string = string

Constructors

Constructor

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

Defined in: bcs-type.ts:330

Parameters

__namedParameters

BcsStructOptions<T, Name>

Returns

BcsStruct<T, Name>

Overrides

BcsType.constructor

Properties

$inferInput

$inferInput: { [K in string | number | symbol]: T[K] extends BcsType<any, U, string> ? U : never }

Defined in: bcs-type.ts:21

Inherited from

BcsType.$inferInput


$inferType

$inferType: { [K in string | number | symbol]: T[K] extends BcsType<U, any, string> ? U : never }

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) => { [K in string | number | symbol]: T[K] extends BcsType<U, any, string> ? U : never }

Defined in: bcs-type.ts:23

Parameters

reader

BcsReader

Returns

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

Inherited from

BcsType.read


serializedSize

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

Defined in: bcs-type.ts:24

Parameters

value

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

options?

BcsWriterOptions

Returns

number | null

Inherited from

BcsType.serializedSize


validate

validate: (value) => void

Defined in: bcs-type.ts:25

Parameters

value

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

Returns

void

Inherited from

BcsType.validate

Methods

fromBase58()

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

Defined in: bcs-type.ts:76

Parameters

b64

string

Returns

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

Inherited from

BcsType.fromBase58


fromBase64()

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

Defined in: bcs-type.ts:80

Parameters

b64

string

Returns

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

Inherited from

BcsType.fromBase64


fromHex()

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

Defined in: bcs-type.ts:72

Parameters

hex

string

Returns

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

Inherited from

BcsType.fromHex


parse()

parse(bytes): { [K in string | number | symbol]: T[K] extends BcsType<U, any, string> ? U : never }

Defined in: bcs-type.ts:67

Parameters

bytes

Uint8Array

Returns

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

Inherited from

BcsType.parse


serialize()

serialize(value, options?): SerializedBcs<{ [K in string | number | symbol]: T[K] extends BcsType<U, any, string> ? U : never }, { [K in string | number | symbol]: T[K] extends BcsType<any, U, string> ? U : never }>

Defined in: bcs-type.ts:62

Parameters

value

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

options?

BcsWriterOptions

Returns

SerializedBcs<{ [K in string | number | symbol]: T[K] extends BcsType<U, any, string> ? U : never }, { [K in string | number | symbol]: T[K] extends BcsType<any, U, string> ? U : never }>

Inherited from

BcsType.serialize


transform()

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

Defined in: bcs-type.ts:84

Type Parameters

T2

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

Input2

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

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

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

writer

BcsWriter

Returns

void

Inherited from

BcsType.write