Skip to content
On this page

Scale JS / @scale-codec/definition-runtime

Module: @scale-codec/definition-runtime

Runtime for the output of @scale-codec/definition-compiler

Remarks

Reexports the whole core library and defines codecs for STD types.

Table of contents

Namespaces

Classes

Interfaces

Type Aliases

Variables

Functions

Type Aliases

BigIntTypes

Ƭ BigIntTypes: IntTypes | `${"i" | "u"}${64 | 128 | 256 | 512}`

Set of integer types that are supported by codec for bigint

Defined in

packages/core/src/codecs/int.ts:13


Bool

Ƭ Bool: boolean

Defined in

packages/definition-runtime/src/codecs.ts:72

packages/definition-runtime/src/codecs.ts:73


CodecAny

Ƭ CodecAny: Codec<any, any>

Defined in

packages/definition-runtime/src/core.ts:15


CodecArray

Ƭ CodecArray<T>: Codec<T> & DefineOpaque<T[number][], T>

Type parameters

NameType
Textends any[]

Defined in

packages/definition-runtime/src/create.ts:49


CodecEnum

Ƭ CodecEnum<E>: Codec<E> & EnumBoxToFactory<E>

Type parameters

NameType
Eextends EnumBox<any>

Defined in

packages/definition-runtime/src/create.ts:136


CodecMap

Ƭ CodecMap<T>: Codec<T> & DefineOpaque<T extends Map<infer K, infer V> ? Map<K, V> : never, T>

Type parameters

NameType
Textends Map<any, any>

Defined in

packages/definition-runtime/src/create.ts:220


CodecSet

Ƭ CodecSet<T>: Codec<T> & DefineOpaque<T extends Set<infer U> ? Set<U> : never, T>

Type parameters

NameType
Textends Set<any>

Defined in

packages/definition-runtime/src/create.ts:243


CodecStruct

Ƭ CodecStruct<T>: Codec<T> & DefineOpaque<FilterStringKeys<T>, T>

Type parameters

Name
T

Defined in

packages/definition-runtime/src/create.ts:199


CodecValueDecoded

Ƭ CodecValueDecoded<T>: T extends Codec<any, infer D> ? D : never

Type parameters

NameType
Textends Codec<any>

Defined in

packages/definition-runtime/src/core.ts:62


CodecValueEncodable

Ƭ CodecValueEncodable<T>: T extends Codec<infer E, any> ? E : never

Type parameters

NameType
Textends Codec<any>

Defined in

packages/definition-runtime/src/core.ts:60


Compact

Ƭ Compact: bigint

Defined in

packages/definition-runtime/src/codecs.ts:81

packages/definition-runtime/src/codecs.ts:82


Decode

Ƭ Decode<T>: (walker: Walker) => T

Type parameters

Name
T

Type declaration

▸ (walker): T

Parameters
NameType
walkerWalker
Returns

T

Defined in

packages/core/src/types.ts:1


DefineOpaque

Ƭ DefineOpaque<T, U>: (actual: T) => U

Type parameters

Name
T
U

Type declaration

▸ (actual): U

U should be the opaque version of T

Parameters
NameType
actualT
Returns

U

Defined in

packages/definition-runtime/src/create.ts:37


Encode

Ƭ Encode<T>: Object

Type parameters

Name
T

Call signature

▸ (value, walker): void

Parameters
NameType
valueT
walkerWalker
Returns

void

Type declaration

NameType
sizeHint(value: T) => number

Defined in

packages/core/src/types.ts:3


EnumBoxToFactory

Ƭ EnumBoxToFactory<E>: E extends EnumBox<infer V> ? (...args: VariantToFactoryArgs<V>) => E : never

Type parameters

NameType
Eextends EnumBox<any>

Defined in

packages/definition-runtime/src/create.ts:132


EnumCodecSchema

Ƭ EnumCodecSchema: [discriminant: number, tag: string, codec?: Codec<any>][]

Defined in

packages/definition-runtime/src/create.ts:119


EnumDecoders

Ƭ EnumDecoders<E>: { [D in number]: { [tag in keyof E]: E[tag] extends [infer C] ? DecodeTuple<tag & string, C> : tag & string }[keyof E] }

Type parameters

NameType
Eextends EnumRecord

Defined in

packages/core/src/codecs/enum.ts:13


EnumEncoders

Ƭ EnumEncoders<E>: { [tag in keyof E]: E[tag] extends [infer C] ? EncodeTuple<C> : number }

Type parameters

NameType
Eextends EnumRecord

Defined in

packages/core/src/codecs/enum.ts:9


EnumOf

Ƭ EnumOf<V>: V extends Variant<infer E, any, any> ? E : never

Type parameters

NameType
Vextends VariantAny

Defined in

packages/enum/src/lib.ts:25


EnumRecord

Ƭ EnumRecord: Record<string, [] | [any]>

Defined in

packages/enum/src/lib.ts:9


Enumerate

Ƭ Enumerate<E>: { [Tag in keyof E]: E[Tag] extends infer Content extends [] | [any] ? Variant<E, Tag & string, Content> : never }[keyof E]

Type parameters

NameType
Eextends EnumRecord

Defined in

packages/enum/src/lib.ts:21


FilterStringKeys

Ƭ FilterStringKeys<T>: { [K in keyof T & string]: T[K] }

Type parameters

Name
T

Defined in

packages/definition-runtime/src/create.ts:195


I128

Ƭ I128: bigint

Defined in

packages/definition-runtime/src/codecs.ts:64

packages/definition-runtime/src/codecs.ts:65


I16

Ƭ I16: number

Defined in

packages/definition-runtime/src/codecs.ts:46

packages/definition-runtime/src/codecs.ts:47


I32

Ƭ I32: number

Defined in

packages/definition-runtime/src/codecs.ts:52

packages/definition-runtime/src/codecs.ts:53


I64

Ƭ I64: bigint

Defined in

packages/definition-runtime/src/codecs.ts:58

packages/definition-runtime/src/codecs.ts:59


I8

Ƭ I8: number

Defined in

packages/definition-runtime/src/codecs.ts:40

packages/definition-runtime/src/codecs.ts:41


IntTypes

Ƭ IntTypes: `${"i" | "u"}${8 | 16 | 32}`

Set of integer types that are supported by codec for number

Defined in

packages/core/src/codecs/int.ts:8


RefineDecodeLocFn

Ƭ RefineDecodeLocFn: <T>(loc: string, headlessDecode: () => T) => T

Type declaration

▸ <T>(loc, headlessDecode): T

Type parameters
Name
T
Parameters
NameType
locstring
headlessDecode() => T
Returns

T

Defined in

packages/definition-runtime/src/tracking/types.ts:17


RustOption

Ƭ RustOption<T>: Enumerate<{ None: [] ; Some: [T] }>

Rust's Option<T> analog

Example

ts
const maybeString: RustOption<string> = variant('None')

Type parameters

Name
T

Defined in

packages/enum/src/lib.ts:83


RustResult

Ƭ RustResult<Ok, Err>: Enumerate<{ Err: [Err] ; Ok: [Ok] }>

Rust's Result<Ok, Err> analog

Example

ts
const file: RustResult<string, Error> = variant('Ok', 'file contents')

Type parameters

Name
Ok
Err

Defined in

packages/enum/src/lib.ts:94


Str

Ƭ Str: string

Defined in

packages/definition-runtime/src/codecs.ts:69

packages/definition-runtime/src/codecs.ts:70


StructCodecsSchema

Ƭ StructCodecsSchema<T>: { [K in keyof T]: [K, Codec<T[K]>] }[keyof T][]

Type parameters

Name
T

Defined in

packages/definition-runtime/src/create.ts:191


StructDecoders

Ƭ StructDecoders<T>: { [K in keyof T]: [K, Decode<T[K]>] }[keyof T][]

Type parameters

Name
T

Defined in

packages/core/src/codecs/struct.ts:6


StructEncoders

Ƭ StructEncoders<T>: { [K in keyof T]: [K, Encode<T[K]>] }[keyof T][]

Type parameters

Name
T

Defined in

packages/core/src/codecs/struct.ts:4


TrackDecodeFn

Ƭ TrackDecodeFn: <T>(loc: string, walker: Walker, decode: Decode<T>) => T

Type declaration

▸ <T>(loc, walker, decode): T

Type parameters
Name
T
Parameters
NameType
locstring
walkerWalker
decodeDecode<T>
Returns

T

Defined in

packages/definition-runtime/src/tracking/types.ts:15


TupleCodecs

Ƭ TupleCodecs<T>: T extends [infer Head, ...(infer Tail)] ? [Codec<Head>, ...TupleCodecs<Tail>] : []

Type parameters

NameType
Textends any[]

Defined in

packages/definition-runtime/src/create.ts:86


TupleDecoders

Ƭ TupleDecoders<Tuple>: Tuple extends [infer Head, ...(infer Tail)] ? [Decode<Head>, ...TupleDecoders<Tail>] : []

Type parameters

NameType
Tupleextends any[]

Defined in

packages/core/src/codecs/tuple.ts:8


TupleEncoders

Ƭ TupleEncoders<Tuple>: Tuple extends [infer Head, ...(infer Tail)] ? [Encode<Head>, ...TupleEncoders<Tail>] : []

Type parameters

NameType
Tupleextends any[]

Defined in

packages/core/src/codecs/tuple.ts:4


U128

Ƭ U128: bigint

Defined in

packages/definition-runtime/src/codecs.ts:61

packages/definition-runtime/src/codecs.ts:62


U16

Ƭ U16: number

Defined in

packages/definition-runtime/src/codecs.ts:43

packages/definition-runtime/src/codecs.ts:44


U32

Ƭ U32: number

Defined in

packages/definition-runtime/src/codecs.ts:49

packages/definition-runtime/src/codecs.ts:50


U64

Ƭ U64: bigint

Defined in

packages/definition-runtime/src/codecs.ts:55

packages/definition-runtime/src/codecs.ts:56


U8

Ƭ U8: number

Defined in

packages/definition-runtime/src/codecs.ts:37

packages/definition-runtime/src/codecs.ts:38


Unit

Ƭ Unit: null

Defined in

packages/definition-runtime/src/codecs.ts:75

packages/definition-runtime/src/codecs.ts:76


VariantAny

Ƭ VariantAny: Variant<any, any, any>

Defined in

packages/enum/src/lib.ts:19


VariantToFactoryArgs

Ƭ VariantToFactoryArgs<V>: V extends Variant<any, infer Tag, infer Content> ? Content extends [infer C] ? [tag: Tag, content: C] : [tag: Tag] : never

Type parameters

NameType
Vextends VariantAny

Defined in

packages/enum/src/lib.ts:32


VecU8

Ƭ VecU8: Uint8Array

Defined in

packages/definition-runtime/src/codecs.ts:78

packages/definition-runtime/src/codecs.ts:79

Variables

Bool

Bool: Codec<boolean, boolean>

Defined in

packages/definition-runtime/src/codecs.ts:72

packages/definition-runtime/src/codecs.ts:73


Compact

Compact: Codec<bigint, bigint>

Defined in

packages/definition-runtime/src/codecs.ts:81

packages/definition-runtime/src/codecs.ts:82


I128

I128: Codec<bigint, bigint>

Defined in

packages/definition-runtime/src/codecs.ts:64

packages/definition-runtime/src/codecs.ts:65


I16

I16: Codec<number, number>

Defined in

packages/definition-runtime/src/codecs.ts:46

packages/definition-runtime/src/codecs.ts:47


I32

I32: Codec<number, number>

Defined in

packages/definition-runtime/src/codecs.ts:52

packages/definition-runtime/src/codecs.ts:53


I64

I64: Codec<bigint, bigint>

Defined in

packages/definition-runtime/src/codecs.ts:58

packages/definition-runtime/src/codecs.ts:59


I8

I8: Codec<number, number>

Defined in

packages/definition-runtime/src/codecs.ts:40

packages/definition-runtime/src/codecs.ts:41


Str

Str: Codec<string, string>

Defined in

packages/definition-runtime/src/codecs.ts:69

packages/definition-runtime/src/codecs.ts:70


TrackValueInspect

Const TrackValueInspect: typeof TrackValueInspect

This symbol could be used by tracker to inspect value

Defined in

packages/definition-runtime/src/tracking/types.ts:6


U128

U128: Codec<bigint, bigint>

Defined in

packages/definition-runtime/src/codecs.ts:61

packages/definition-runtime/src/codecs.ts:62


U16

U16: Codec<number, number>

Defined in

packages/definition-runtime/src/codecs.ts:43

packages/definition-runtime/src/codecs.ts:44


U32

U32: Codec<number, number>

Defined in

packages/definition-runtime/src/codecs.ts:49

packages/definition-runtime/src/codecs.ts:50


U64

U64: Codec<bigint, bigint>

Defined in

packages/definition-runtime/src/codecs.ts:55

packages/definition-runtime/src/codecs.ts:56


U8

U8: Codec<number, number>

Defined in

packages/definition-runtime/src/codecs.ts:37

packages/definition-runtime/src/codecs.ts:38


Unit

Unit: Codec<null, null>

Defined in

packages/definition-runtime/src/codecs.ts:75

packages/definition-runtime/src/codecs.ts:76


VecU8

VecU8: Codec<Uint8Array, Uint8Array>

Defined in

packages/definition-runtime/src/codecs.ts:78

packages/definition-runtime/src/codecs.ts:79

Functions

buildDecodeTraceStepsFmt

buildDecodeTraceStepsFmt(trace, walker): Fmt

Remarks

This function shouldn't be in the DecodeTrace class itself due to provide a tree-shaking possibility. This is not the main part of this class, but the side tool, used for pretty-print in the console.

Parameters

NameType
traceDecodeTrace
walkerWalker

Returns

Fmt

Defined in

packages/definition-runtime/src/tracking/decode-trace.ts:160


countPositiveBigIntEffectiveBytes

countPositiveBigIntEffectiveBytes(positiveNum): number

Parameters

NameType
positiveNumbigint

Returns

number

Defined in

packages/core/src/codecs/int.ts:172


createArrayCodec

createArrayCodec<T>(name, itemCodec, len): CodecArray<T>

Type parameters

NameType
Textends any[]

Parameters

NameType
namestring
itemCodecCodec<T extends I[] ? I : never, T extends I[] ? I : never>
lennumber

Returns

CodecArray<T>

Defined in

packages/definition-runtime/src/create.ts:51


createArrayDecoder

createArrayDecoder<T>(decodeItem, len): Decode<T[]>

Type parameters

Name
T

Parameters

NameType
decodeItemDecode<T>
lennumber

Returns

Decode<T[]>

Defined in

packages/core/src/codecs/array.ts:40


createArrayEncoder

createArrayEncoder<T>(encodeItem, len): Encode<T[]>

Type parameters

Name
T

Parameters

NameType
encodeItemEncode<T>
lennumber

Returns

Encode<T[]>

Defined in

packages/core/src/codecs/array.ts:25


createArrayU8Codec

createArrayU8Codec(name, len): Codec<Uint8Array>

Parameters

NameType
namestring
lennumber

Returns

Codec<Uint8Array>

Defined in

packages/definition-runtime/src/create.ts:67


createBigIntDecoder

createBigIntDecoder(ty): Decode<bigint>

Parameters

NameType
tyBigIntTypes

Returns

Decode<bigint>

Defined in

packages/core/src/codecs/int.ts:265


createBigIntEncoder

createBigIntEncoder(ty): Encode<bigint>

Parameters

NameType
tyBigIntTypes

Returns

Encode<bigint>

Defined in

packages/core/src/codecs/int.ts:261


createEnumCodec

createEnumCodec<E>(name, schema): CodecEnum<E>

Type parameters

NameType
Eextends EnumBox<any, E>

Parameters

NameType
namestring
schemaEnumCodecSchema

Returns

CodecEnum<E>

Defined in

packages/definition-runtime/src/create.ts:140


createEnumDecoder

createEnumDecoder<V>(decoders): Decode<V>

Type parameters

NameType
Vextends Variant<any, any, any, V>

Parameters

NameType
decodersEnumDecoders<EnumOf<V>>

Returns

Decode<V>

Defined in

packages/core/src/codecs/enum.ts:111


createEnumEncoder

createEnumEncoder<V>(encoders): Encode<V>

Type parameters

NameType
Vextends Variant<any, any, any, V>

Parameters

NameType
encodersEnumEncoders<EnumOf<V>>

Returns

Encode<V>

Defined in

packages/core/src/codecs/enum.ts:77


createIntDecoder

createIntDecoder(ty): Decode<number>

Parameters

NameType
ty"i16" | "i8" | "i32" | "u16" | "u8" | "u32"

Returns

Decode<number>

Defined in

packages/core/src/codecs/int.ts:257


createIntEncoder

createIntEncoder(ty): Encode<number>

Parameters

NameType
ty"i16" | "i8" | "i32" | "u16" | "u8" | "u32"

Returns

Encode<number>

Defined in

packages/core/src/codecs/int.ts:253


createMapCodec

createMapCodec<T>(name, keyCodec, valueCodec): CodecMap<T>

Type parameters

NameType
Textends Map<any, any, T>

Parameters

NameType
namestring
keyCodecCodec<T extends Map<K, any> ? K : never, T extends Map<K, any> ? K : never>
valueCodecCodec<T extends Map<any, V> ? V : never, T extends Map<any, V> ? V : never>

Returns

CodecMap<T>

Defined in

packages/definition-runtime/src/create.ts:223


createMapDecoder

createMapDecoder<K, V>(decodeKey, decodeValue): Decode<Map<K, V>>

Type parameters

Name
K
V

Parameters

NameType
decodeKeyDecode<K>
decodeValueDecode<V>

Returns

Decode<Map<K, V>>

Defined in

packages/core/src/codecs/map.ts:45


createMapEncoder

createMapEncoder<K, V>(encodeKey, encodeValue): Encode<Map<K, V>>

Type parameters

Name
K
V

Parameters

NameType
encodeKeyEncode<K>
encodeValueEncode<V>

Returns

Encode<Map<K, V>>

Defined in

packages/core/src/codecs/map.ts:38


createOptionCodec

createOptionCodec<T>(name, someCodec): CodecEnum<EnumBox<RustOption<T>>>

Type parameters

Name
T

Parameters

NameType
namestring
someCodecCodec<T, T>

Returns

CodecEnum<EnumBox<RustOption<T>>>

Defined in

packages/definition-runtime/src/create.ts:171


createOptionDecoder

createOptionDecoder<T>(decodeSome): Decode<RustOption<T>>

Type parameters

Name
T

Parameters

NameType
decodeSomeDecode<T>

Returns

Decode<RustOption<T>>

Defined in

packages/core/src/codecs/enum.ts:122


createOptionEncoder

createOptionEncoder<T>(encodeSome): Encode<RustOption<T>>

Type parameters

Name
T

Parameters

NameType
encodeSomeEncode<T>

Returns

Encode<RustOption<T>>

Defined in

packages/core/src/codecs/enum.ts:115


createResultCodec

createResultCodec<Ok, Err>(name, okCodec, errCodec): CodecEnum<EnumBox<RustResult<Ok, Err>>>

Type parameters

Name
Ok
Err

Parameters

NameType
namestring
okCodecCodec<Ok, Ok>
errCodecCodec<Err, Err>

Returns

CodecEnum<EnumBox<RustResult<Ok, Err>>>

Defined in

packages/definition-runtime/src/create.ts:178


createResultDecoder

createResultDecoder<Ok, Err>(decodeOk, decodeErr): Decode<RustResult<Ok, Err>>

Type parameters

Name
Ok
Err

Parameters

NameType
decodeOkDecode<Ok>
decodeErrDecode<Err>

Returns

Decode<RustResult<Ok, Err>>

Defined in

packages/core/src/codecs/enum.ts:139


createResultEncoder

createResultEncoder<Ok, Err>(encodeOk, encodeErr): Encode<RustResult<Ok, Err>>

Type parameters

Name
Ok
Err

Parameters

NameType
encodeOkEncode<Ok>
encodeErrEncode<Err>

Returns

Encode<RustResult<Ok, Err>>

Defined in

packages/core/src/codecs/enum.ts:129


createSetCodec

createSetCodec<T>(name, itemCodec): CodecSet<T>

Type parameters

NameType
Textends Set<any, T>

Parameters

NameType
namestring
itemCodecCodec<T extends Set<V> ? V : never, T extends Set<V> ? V : never>

Returns

CodecSet<T>

Defined in

packages/definition-runtime/src/create.ts:245


createSetDecoder

createSetDecoder<T>(decodeItem): Decode<Set<T>>

Type parameters

Name
T

Parameters

NameType
decodeItemDecode<T>

Returns

Decode<Set<T>>

Defined in

packages/core/src/codecs/set.ts:36


createSetEncoder

createSetEncoder<T>(encodeItem): Encode<Set<T>>

Type parameters

Name
T

Parameters

NameType
encodeItemEncode<T>

Returns

Encode<Set<T>>

Defined in

packages/core/src/codecs/set.ts:29


createStructCodec

createStructCodec<T>(name, orderedCodecs): CodecStruct<T>

Type parameters

Name
T

Parameters

NameType
namestring
orderedCodecsStructCodecsSchema<FilterStringKeys<T>>

Returns

CodecStruct<T>

Defined in

packages/definition-runtime/src/create.ts:201


createStructDecoder

createStructDecoder<T>(decoders): Decode<T>

Type parameters

NameType
Textends Object

Parameters

NameType
decodersStructDecoders<T>

Returns

Decode<T>

Defined in

packages/core/src/codecs/struct.ts:40


createStructEncoder

createStructEncoder<T>(encoders): Encode<T>

Type parameters

NameType
Textends Object

Parameters

NameType
encodersStructEncoders<T>

Returns

Encode<T>

Defined in

packages/core/src/codecs/struct.ts:24


createTupleCodec

createTupleCodec<T, U>(name, codecs): Codec<U> & DefineOpaque<T, U>

Type parameters

NameType
Textends any[]
UU

Parameters

NameType
namestring
codecsTupleCodecs<T>

Returns

Codec<U> & DefineOpaque<T, U>

Defined in

packages/definition-runtime/src/create.ts:90


createTupleDecoder

createTupleDecoder<T>(decoders): Decode<T>

Type parameters

NameType
Textends any[]

Parameters

NameType
decodersTupleDecoders<T>

Returns

Decode<T>

Defined in

packages/core/src/codecs/tuple.ts:44


createTupleEncoder

createTupleEncoder<T>(encoders): Encode<T>

Type parameters

NameType
Textends any[]

Parameters

NameType
encodersTupleEncoders<T>

Returns

Encode<T>

Defined in

packages/core/src/codecs/tuple.ts:37


createUint8ArrayDecoder

createUint8ArrayDecoder(len): Decode<Uint8Array>

Parameters

NameType
lennumber

Returns

Decode<Uint8Array>

Defined in

packages/core/src/codecs/array.ts:79


createUint8ArrayEncoder

createUint8ArrayEncoder(len): Encode<Uint8Array>

Parameters

NameType
lennumber

Returns

Encode<Uint8Array>

Defined in

packages/core/src/codecs/array.ts:53


createVecCodec

createVecCodec<T>(name, itemCodec): CodecArray<T>

Type parameters

NameType
Textends any[]

Parameters

NameType
namestring
itemCodecCodec<T extends V[] ? V : never, T extends V[] ? V : never>

Returns

CodecArray<T>

Defined in

packages/definition-runtime/src/create.ts:71


createVecDecoder

createVecDecoder<T>(decodeItem): Decode<T[]>

Type parameters

Name
T

Parameters

NameType
decodeItemDecode<T>

Returns

Decode<T[]>

Defined in

packages/core/src/codecs/vec.ts:33


createVecEncoder

createVecEncoder<T>(encodeItem): Encode<T[]>

Type parameters

Name
T

Parameters

NameType
encodeItemEncode<T>

Returns

Encode<T[]>

Defined in

packages/core/src/codecs/vec.ts:21


decodeArray

decodeArray<T>(walker, decodeItem, len): T[]

Type parameters

Name
T

Parameters

NameType
walkerWalker
decodeItemDecode<T>
lennumber

Returns

T[]

Defined in

packages/core/src/codecs/array.ts:32


decodeBigInt

decodeBigInt(walker, ty): bigint

Decodes bigint in Little-Endian

Parameters

NameType
walkerWalker
tyBigIntTypes

Returns

bigint

Defined in

packages/core/src/codecs/int.ts:238


decodeBigIntVarious

decodeBigIntVarious(walker, bytes, signed): bigint

Decodes bigint in Little-Endian. It is like decodeBigInt but is not binded to strict bytes count (1, 2, 4, 8, 16 etc)

Remarks

Does not mutate walker's offset!

Parameters

NameType
walkerWalker
bytesnumber
signedboolean

Returns

bigint

Defined in

packages/core/src/codecs/int.ts:216


decodeBool

decodeBool(walker): boolean

Parameters

NameType
walkerWalker

Returns

boolean

Defined in

packages/core/src/types.ts:1


decodeCompact

decodeCompact(walker): bigint

Decodes compact-encoded integer

Parameters

NameType
walkerWalker

Returns

bigint

Defined in

packages/core/src/codecs/compact.ts:17


decodeEnum

decodeEnum<V>(walker, decoders): V

Type parameters

NameType
Vextends Variant<any, any, any, V>

Parameters

NameType
walkerWalker
decodersEnumDecoders<EnumOf<V>>

Returns

V

Defined in

packages/core/src/codecs/enum.ts:97


decodeI128

decodeI128(walker): bigint

Parameters

NameType
walkerWalker

Returns

bigint

Defined in

packages/core/src/types.ts:1


decodeI16

decodeI16(walker): number

Parameters

NameType
walkerWalker

Returns

number

Defined in

packages/core/src/types.ts:1


decodeI32

decodeI32(walker): number

Parameters

NameType
walkerWalker

Returns

number

Defined in

packages/core/src/types.ts:1


decodeI64

decodeI64(walker): bigint

Parameters

NameType
walkerWalker

Returns

bigint

Defined in

packages/core/src/types.ts:1


decodeI8

decodeI8(walker): number

Parameters

NameType
walkerWalker

Returns

number

Defined in

packages/core/src/types.ts:1


decodeInt

decodeInt(walker, ty): number

Decodes signed/unsigned 8/16/32 bits integers in Little-Endian

Parameters

NameType
walkerWalker
ty"i16" | "i8" | "i32" | "u16" | "u8" | "u32"

Returns

number

Defined in

packages/core/src/codecs/int.ts:89


decodeMap

decodeMap<K, V>(walker, decodeKey, decodeValue): Map<K, V>

Type parameters

Name
K
V

Parameters

NameType
walkerWalker
decodeKeyDecode<K>
decodeValueDecode<V>

Returns

Map<K, V>

Defined in

packages/core/src/codecs/map.ts:29


decodeOptionBool

decodeOptionBool(walker): RustOption<boolean>

Special decoder for OptionBool type from Rust's parity_scale_codec

Parameters

NameType
walkerWalker

Returns

RustOption<boolean>

Defined in

packages/core/src/types.ts:1


decodeSet

decodeSet<T>(walker, decodeItem): Set<T>

Type parameters

Name
T

Parameters

NameType
walkerWalker
decodeItemDecode<T>

Returns

Set<T>

Defined in

packages/core/src/codecs/set.ts:20


decodeStr

decodeStr(walker): string

Parameters

NameType
walkerWalker

Returns

string

Defined in

packages/core/src/codecs/str.ts:12


decodeStruct

decodeStruct<T>(walker, decoders): T

Type parameters

NameType
Textends Object

Parameters

NameType
walkerWalker
decodersStructDecoders<T>

Returns

T

Defined in

packages/core/src/codecs/struct.ts:31


decodeTuple

decodeTuple<T>(walker, decoders): T

Type parameters

NameType
Textends any[]

Parameters

NameType
walkerWalker
decodersTupleDecoders<T>

Returns

T

Defined in

packages/core/src/codecs/tuple.ts:27


decodeU128

decodeU128(walker): bigint

Parameters

NameType
walkerWalker

Returns

bigint

Defined in

packages/core/src/types.ts:1


decodeU16

decodeU16(walker): number

Parameters

NameType
walkerWalker

Returns

number

Defined in

packages/core/src/types.ts:1


decodeU32

decodeU32(walker): number

Parameters

NameType
walkerWalker

Returns

number

Defined in

packages/core/src/types.ts:1


decodeU64

decodeU64(walker): bigint

Parameters

NameType
walkerWalker

Returns

bigint

Defined in

packages/core/src/types.ts:1


decodeU8

decodeU8(walker): number

Parameters

NameType
walkerWalker

Returns

number

Defined in

packages/core/src/types.ts:1


decodeUint8Array

decodeUint8Array(walker, len): Uint8Array

decode [u8; x] array directly into the native Uint8Array

Parameters

NameType
walkerWalker
lennumber

Returns

Uint8Array

Defined in

packages/core/src/codecs/array.ts:66


decodeUint8Vec

decodeUint8Vec(walker): Uint8Array

Parameters

NameType
walkerWalker

Returns

Uint8Array

Defined in

packages/core/src/types.ts:1


decodeUnit

decodeUnit(walker): null

Decoder to handle unit type (i.e. ())

Parameters

NameType
walkerWalker

Returns

null

Defined in

packages/core/src/types.ts:1


decodeVec

decodeVec<T>(walker, decodeItem): T[]

Type parameters

Name
T

Parameters

NameType
walkerWalker
decodeItemDecode<T>

Returns

T[]

Defined in

packages/core/src/codecs/vec.ts:28


dynCodec

dynCodec<C>(getter): Codec<CodecValueEncodable<C>, CodecValueDecoded<C>>

Type parameters

NameType
Cextends Codec<any, any, C>

Parameters

NameType
getter() => C

Returns

Codec<CodecValueEncodable<C>, CodecValueDecoded<C>>

Defined in

packages/definition-runtime/src/core.ts:110


encodeArray

encodeArray<T>(arr, encodeItem, len, walker): void

Type parameters

Name
T

Parameters

NameType
arrT[]
encodeItemEncode<T>
lennumber
walkerWalker

Returns

void

Defined in

packages/core/src/codecs/array.ts:5


encodeArraySizeHint

encodeArraySizeHint<T>(arr, encodeItem, len): number

Type parameters

Name
T

Parameters

NameType
arrT[]
encodeItemEncode<T>
lennumber

Returns

number

Defined in

packages/core/src/codecs/array.ts:14


encodeBigInt

encodeBigInt(bi, ty, walker): void

Encodes bigint in Little-Endian

Parameters

NameType
bibigint
tyBigIntTypes
walkerWalker

Returns

void

Defined in

packages/core/src/codecs/int.ts:185


encodeBool

encodeBool(value, walker): void

Parameters

NameType
valueboolean
walkerWalker

Returns

void

Defined in

packages/core/src/types.ts:4


encodeCompact

encodeCompact(value, walker): void

Parameters

NameType
valuenumber | bigint
walkerWalker

Returns

void

Defined in

packages/core/src/types.ts:4


encodeEnum

encodeEnum<V>(value, encoders, walker): void

Type parameters

NameType
Vextends Variant<any, any, any, V>

Parameters

NameType
valueV
encodersEnumEncoders<EnumOf<V>>
walkerWalker

Returns

void

Defined in

packages/core/src/codecs/enum.ts:48


encodeEnumSizeHint

encodeEnumSizeHint<V>(value, encoders): number

Type parameters

NameType
Vextends Variant<any, any, any, V>

Parameters

NameType
valueV
encodersEnumEncoders<EnumOf<V>>

Returns

number

Defined in

packages/core/src/codecs/enum.ts:59


encodeFactory

encodeFactory<T>(fn, sizeHint): Encode<T>

Type parameters

Name
T

Parameters

NameType
fn(value: T, walker: Walker) => void
sizeHint(value: T) => number

Returns

Encode<T>

Defined in

packages/core/src/util.ts:44


encodeI128

encodeI128(value, walker): void

Parameters

NameType
valuebigint
walkerWalker

Returns

void

Defined in

packages/core/src/types.ts:4


encodeI16

encodeI16(value, walker): void

Parameters

NameType
valuenumber
walkerWalker

Returns

void

Defined in

packages/core/src/types.ts:4


encodeI32

encodeI32(value, walker): void

Parameters

NameType
valuenumber
walkerWalker

Returns

void

Defined in

packages/core/src/types.ts:4


encodeI64

encodeI64(value, walker): void

Parameters

NameType
valuebigint
walkerWalker

Returns

void

Defined in

packages/core/src/types.ts:4


encodeI8

encodeI8(value, walker): void

Parameters

NameType
valuenumber
walkerWalker

Returns

void

Defined in

packages/core/src/types.ts:4


encodeInt

encodeInt(value, ty, walker): void

Encodes signed/unsigned 8/16/32 bits integers in Little-Endian

Parameters

NameType
valuenumber
ty"i16" | "i8" | "i32" | "u16" | "u8" | "u32"
walkerWalker

Returns

void

Defined in

packages/core/src/codecs/int.ts:56


encodeMap

encodeMap<K, V>(map, encodeKey, encodeValue, walker): void

Type parameters

Name
K
V

Parameters

NameType
mapMap<K, V>
encodeKeyEncode<K>
encodeValueEncode<V>
walkerWalker

Returns

void

Defined in

packages/core/src/codecs/map.ts:6


encodeMapSizeHint

encodeMapSizeHint<K, V>(map, encodeKey, encodeValue): number

Type parameters

Name
K
V

Parameters

NameType
mapMap<K, V>
encodeKeyEncode<K>
encodeValueEncode<V>

Returns

number

Defined in

packages/core/src/codecs/map.ts:14


encodeOptionBool

encodeOptionBool(value, walker): void

Special encoder for OptionBool type from Rust's parity_scale_codec

Parameters

NameType
valueRustOption<boolean>
walkerWalker

Returns

void

Defined in

packages/core/src/types.ts:4


encodePositiveBigIntInto

encodePositiveBigIntInto(positiveNum, mutSlice, offset, bytesLimit): number

Parameters

NameType
positiveNumbigint
mutSliceUint8Array
offsetnumber
bytesLimitnumber

Returns

number

Defined in

packages/core/src/codecs/int.ts:152


encodeSet

encodeSet<T>(set, encodeItem, walker): void

Type parameters

Name
T

Parameters

NameType
setSet<T>
encodeItemEncode<T>
walkerWalker

Returns

void

Defined in

packages/core/src/codecs/set.ts:5


encodeSetSizeHint

encodeSetSizeHint<T>(set, encodeItem): number

Type parameters

Name
T

Parameters

NameType
setSet<T>
encodeItemEncode<T>

Returns

number

Defined in

packages/core/src/codecs/set.ts:12


encodeStr

encodeStr(value, walker): void

Parameters

NameType
valuestring
walkerWalker

Returns

void

Defined in

packages/core/src/types.ts:4


encodeStruct

encodeStruct<T>(struct, encoders, walker): void

Type parameters

NameType
Textends Object

Parameters

NameType
structT
encodersStructEncoders<T>
walkerWalker

Returns

void

Defined in

packages/core/src/codecs/struct.ts:8


encodeStructSizeHint

encodeStructSizeHint<T>(struct, encoders): number

Type parameters

NameType
Textends Object

Parameters

NameType
structT
encodersStructEncoders<T>

Returns

number

Defined in

packages/core/src/codecs/struct.ts:15


encodeTuple

encodeTuple<T>(tuple, encoders, walker): void

Type parameters

NameType
Textends any[]

Parameters

NameType
tupleT
encodersTupleEncoders<T>
walkerWalker

Returns

void

Defined in

packages/core/src/codecs/tuple.ts:12


encodeTupleSizeHint

encodeTupleSizeHint<T>(tuple, encoders): number

Type parameters

NameType
Textends any[]

Parameters

NameType
tupleT
encodersTupleEncoders<T>

Returns

number

Defined in

packages/core/src/codecs/tuple.ts:17


encodeU128

encodeU128(value, walker): void

Parameters

NameType
valuebigint
walkerWalker

Returns

void

Defined in

packages/core/src/types.ts:4


encodeU16

encodeU16(value, walker): void

Parameters

NameType
valuenumber
walkerWalker

Returns

void

Defined in

packages/core/src/types.ts:4


encodeU32

encodeU32(value, walker): void

Parameters

NameType
valuenumber
walkerWalker

Returns

void

Defined in

packages/core/src/types.ts:4


encodeU64

encodeU64(value, walker): void

Parameters

NameType
valuebigint
walkerWalker

Returns

void

Defined in

packages/core/src/types.ts:4


encodeU8

encodeU8(value, walker): void

Parameters

NameType
valuenumber
walkerWalker

Returns

void

Defined in

packages/core/src/types.ts:4


encodeUint8Array

encodeUint8Array(value, len, walker): void

Encode to [u8; x] Rust's array directly from the native Uint8Array

Parameters

NameType
valueUint8Array
lennumber
walkerWalker

Returns

void

Defined in

packages/core/src/codecs/array.ts:47


encodeUint8Vec

encodeUint8Vec(value, walker): void

Parameters

NameType
valueUint8Array
walkerWalker

Returns

void

Defined in

packages/core/src/types.ts:4


encodeUnit

encodeUnit(value, walker): void

Encoder to handle unit type (i.e. ())

Parameters

NameType
valuenull
walkerWalker

Returns

void

Defined in

packages/core/src/types.ts:4


encodeVec

encodeVec<T>(vec, encodeItem, walker): void

Type parameters

Name
T

Parameters

NameType
vecT[]
encodeItemEncode<T>
walkerWalker

Returns

void

Defined in

packages/core/src/codecs/vec.ts:6


encodeVecSizeHint

encodeVecSizeHint<T>(vec, encodeItem): number

Type parameters

Name
T

Parameters

NameType
vecT[]
encodeItemEncode<T>

Returns

number

Defined in

packages/core/src/codecs/vec.ts:13


formatWalkerStep

formatWalkerStep(params): string

Parameters

NameType
paramsFormatWalkerStepParams

Returns

string

Defined in

packages/definition-runtime/src/tracking/util.ts:36


getCurrentTracker

getCurrentTracker(): null | CodecTracker

Caution: uses global state

Returns

null | CodecTracker

Defined in

packages/definition-runtime/src/tracking/current.ts:9


isTrackValueInspectable

isTrackValueInspectable(value): value is TrackValueInspectable

Parameters

NameType
valueunknown

Returns

value is TrackValueInspectable

Defined in

packages/definition-runtime/src/tracking/util.ts:44


setCurrentTracker

setCurrentTracker(tracker): void

Caution: uses global state

Parameters

NameType
trackernull | CodecTracker

Returns

void

Defined in

packages/definition-runtime/src/tracking/current.ts:16


trackDecode

trackDecode<T>(loc, walker, decode): T

Caution: uses global state

Type parameters

Name
T

Parameters

NameType
locstring
walkerWalker
decodeDecode<T>

Returns

T

Defined in

packages/definition-runtime/src/tracking/types.ts:15


trackRefineDecodeLoc

trackRefineDecodeLoc<T>(loc, headlessDecode): T

Caution: uses global state

Type parameters

Name
T

Parameters

NameType
locstring
headlessDecode() => T

Returns

T

Defined in

packages/definition-runtime/src/tracking/types.ts:17


trackableCodec

trackableCodec<E, D>(name, encode, decode): Codec<E, D>

Type parameters

NameType
EE
DE

Parameters

NameType
namestring
encodeEncode<E>
decodeDecode<D>

Returns

Codec<E, D>

Defined in

packages/definition-runtime/src/core.ts:48


tryInspectValue

tryInspectValue(value): any

Parameters

NameType
valueany

Returns

any

Defined in

packages/definition-runtime/src/tracking/util.ts:48


variant

variant<V>(...args): V

Type parameters

NameType
Vextends Variant<any, any, any, V>

Parameters

NameType
...argsVariantToFactoryArgs<V>

Returns

V

Defined in

packages/enum/src/lib.ts:28

variant<E>(...args): Enumerate<E>

Type parameters

NameType
Eextends EnumRecord

Parameters

NameType
...argsVariantToFactoryArgs<Enumerate<E>>

Returns

Enumerate<E>

Defined in

packages/enum/src/lib.ts:29