Maybe
Maybe
combinator is used to represent optional values. In this case, the first bit indicates a value.
If the bit is 0
, the value is not serialized and skipped. If the bit is 1
, the value follows and is serialized.
Either
Either
type is used when one of two possible result types may be present.
The choice of type depends on the prefix bit. If the prefix bit is 0
, then the left type is serialized. If it is 1
, the right type is serialized.
This construct is used, for example, when serializing messages: where the body is either included directly
in the main cell or stored in a separate referenced cell.
Both
Both
type variation is used exclusively with regular pairs, where both types are serialized sequentially without any conditions.
VarUInteger n
n
, represented in curly brackets. For a given n
, VarUInteger n
describes the serialization of a natural number m
, which in its binary representation contains no more than n * 8
bits.
First, the number of bytes required for writing m
, that is called len
, is serialized into bits as an unsigned
big-endian integer. Then m
itself is serialized as a uint
on len*8
bits. Thus, the size of the serialization of a particular m
through the
combinator VarUInteger n
depends on m
.
This type is used as the representation of an amount of toncoins stored on the account.