Helios API/ API Reference/ Namespaces/
Cbor
Helper methods for (de)serializing data to/from Cbor.
Note: Each decoding method mutates the input bytes
by shifting it to the following CBOR element.
Index
Functions
- decodeBool
- decodeBytes
- decodeConstr
- decodeConstrTag
- decodeHead
- decodeIndefHead
- decodeInteger
- decodeList
- decodeMap
- decodeNull
- decodeObject
- decodeTag
- decodeTuple
- decodeUtf8
- decodeUtf8Internal
- encodeBool
- encodeBytes
- encodeConstr
- encodeConstrTag
- encodeDefList
- encodeDefListStart
- encodeHead
- encodeIndefHead
- encodeIndefList
- encodeIndefListEnd
- encodeIndefListStart
- encodeInteger
- encodeList
- encodeListInternal
- encodeMap
- encodeMapInternal
- encodeNull
- encodeObject
- encodeTag
- encodeTuple
- encodeUtf8
- isBytes
- isConstr
- isDefBytes
- isDefList
- isIndefBytes
- isIndefList
- isList
- isMap
- isNull
- isObject
- isTuple
- isUtf8
Functions
decodeBool
▸ decodeBool(bytes
): boolean
Parameters
Name | Type |
---|---|
bytes | number [] |
Returns
boolean
decodeBytes
▸ decodeBytes(bytes
): number
[]
Parameters
Name | Type |
---|---|
bytes | number [] |
Returns
number
[]
decodeConstr
▸ decodeConstr(bytes
, fieldDecoder
): number
Parameters
Name | Type |
---|---|
bytes | number [] |
fieldDecoder | Decoder |
Returns
number
decodeConstrTag
▸ decodeConstrTag(bytes
): number
Parameters
Name | Type |
---|---|
bytes | number [] |
Returns
number
decodeHead
▸ decodeHead(bytes
): [number
, bigint
]
Parameters
Name | Type |
---|---|
bytes | number [] |
Returns
[number
, bigint
]
decodeIndefHead
▸ decodeIndefHead(bytes
): number
Parameters
Name | Type |
---|---|
bytes | number [] |
Returns
number
decodeInteger
▸ decodeInteger(bytes
): bigint
Parameters
Name | Type |
---|---|
bytes | number [] |
Returns
bigint
decodeList
▸ decodeList(bytes
, itemDecoder
): void
Parameters
Name | Type |
---|---|
bytes | number [] |
itemDecoder | Decoder |
Returns
void
decodeMap
▸ decodeMap(bytes
, pairDecoder
): void
Parameters
Name | Type |
---|---|
bytes | number [] |
pairDecoder | Decoder |
Returns
void
decodeNull
▸ decodeNull(bytes
): void
Parameters
Name | Type |
---|---|
bytes | number [] |
Returns
void
decodeObject
▸ decodeObject(bytes
, fieldDecoder
): Set
<number
>
Parameters
Name | Type |
---|---|
bytes | number [] |
fieldDecoder | Decoder |
Returns
Set
<number
>
decodeTag
▸ decodeTag(bytes
): bigint
Parameters
Name | Type |
---|---|
bytes | number [] |
Returns
bigint
decodeTuple
▸ decodeTuple(bytes
, tupleDecoder
): number
Parameters
Name | Type |
---|---|
bytes | number [] |
tupleDecoder | Decoder |
Returns
number
decodeUtf8
▸ decodeUtf8(bytes
): string
Parameters
Name | Type |
---|---|
bytes | number [] |
Returns
string
decodeUtf8Internal
▸ decodeUtf8Internal(bytes
): string
Parameters
Name | Type |
---|---|
bytes | number [] |
Returns
string
encodeBool
▸ encodeBool(b
): number
[]
Parameters
Name | Type |
---|---|
b | boolean |
Returns
number
[]
encodeBytes
▸ encodeBytes(bytes
, splitIntoChunks?
): number
[]
Parameters
Name | Type |
---|---|
bytes | number [] |
splitIntoChunks? | boolean |
Returns
number
[]
encodeConstr
▸ encodeConstr(tag
, fields
): number
[]
Parameters
Name | Type |
---|---|
tag | number |
fields | CborData [] | number [][] |
Returns
number
[]
encodeConstrTag
▸ encodeConstrTag(tag
): number
[]
Parameters
Name | Type |
---|---|
tag | number |
Returns
number
[]
encodeDefList
▸ encodeDefList(list
): number
[]
Parameters
Name | Type |
---|---|
list | CborData [] | number [][] |
Returns
number
[]
encodeDefListStart
▸ encodeDefListStart(n
): number
[]
Parameters
Name | Type |
---|---|
n | bigint |
Returns
number
[]
encodeHead
▸ encodeHead(m
, n
): number
[]
Parameters
Name | Type |
---|---|
m | number |
n | bigint |
Returns
number
[]
encodeIndefHead
▸ encodeIndefHead(m
): number
[]
Parameters
Name | Type |
---|---|
m | number |
Returns
number
[]
encodeIndefList
▸ encodeIndefList(list
): number
[]
Parameters
Name | Type |
---|---|
list | CborData [] | number [][] |
Returns
number
[]
encodeIndefListEnd
▸ encodeIndefListEnd(): number
[]
Returns
number
[]
encodeIndefListStart
▸ encodeIndefListStart(): number
[]
Returns
number
[]
encodeInteger
▸ encodeInteger(n
): number
[]
Parameters
Name | Type |
---|---|
n | bigint |
Returns
number
[]
encodeList
▸ encodeList(list
): number
[]
Parameters
Name | Type |
---|---|
list | CborData [] | number [][] |
Returns
number
[]
encodeListInternal
▸ encodeListInternal(list
): number
[]
Parameters
Name | Type |
---|---|
list | CborData [] | number [][] |
Returns
number
[]
encodeMap
▸ encodeMap(pairList
): number
[]
Parameters
Returns
number
[]
encodeMapInternal
▸ encodeMapInternal(pairList
): number
[]
Parameters
Returns
number
[]
encodeNull
▸ encodeNull(): number
[]
Returns
number
[]
encodeObject
▸ encodeObject(object
): number
[]
Parameters
Name | Type |
---|---|
object | Map <number , number [] | CborData > |
Returns
number
[]
encodeTag
▸ encodeTag(tag
): number
[]
Parameters
Name | Type |
---|---|
tag | bigint |
Returns
number
[]
encodeTuple
▸ encodeTuple(tuple
): number
[]
Parameters
Name | Type |
---|---|
tuple | number [][] |
Returns
number
[]
encodeUtf8
▸ encodeUtf8(str
, split?
): number
[]
Parameters
Name | Type |
---|---|
str | string |
split? | boolean |
Returns
number
[]
isBytes
▸ isBytes(bytes
): boolean
Parameters
Name | Type |
---|---|
bytes | number [] |
Returns
boolean
isConstr
▸ isConstr(bytes
): boolean
Parameters
Name | Type |
---|---|
bytes | number [] |
Returns
boolean
isDefBytes
▸ isDefBytes(bytes
): boolean
Parameters
Name | Type |
---|---|
bytes | number [] |
Returns
boolean
isDefList
▸ isDefList(bytes
): boolean
Parameters
Name | Type |
---|---|
bytes | number [] |
Returns
boolean
isIndefBytes
▸ isIndefBytes(bytes
): boolean
Parameters
Name | Type |
---|---|
bytes | number [] |
Returns
boolean
isIndefList
▸ isIndefList(bytes
): boolean
Parameters
Name | Type |
---|---|
bytes | number [] |
Returns
boolean
isList
▸ isList(bytes
): boolean
Parameters
Name | Type |
---|---|
bytes | number [] |
Returns
boolean
isMap
▸ isMap(bytes
): boolean
Parameters
Name | Type |
---|---|
bytes | number [] |
Returns
boolean
isNull
▸ isNull(bytes
): boolean
Parameters
Name | Type |
---|---|
bytes | number [] |
Returns
boolean
isObject
▸ isObject(bytes
): boolean
Parameters
Name | Type |
---|---|
bytes | number [] |
Returns
boolean
isTuple
▸ isTuple(bytes
): boolean
Parameters
Name | Type |
---|---|
bytes | number [] |
Returns
boolean
isUtf8
▸ isUtf8(bytes
): boolean
Parameters
Name | Type |
---|---|
bytes | number [] |
Returns
boolean