Acton
Tolk standard library

exotic-cells

exotic-cells.tolk Tolk standard library file

Definitions

ExoticCellType

enum ExoticCellType: int8 {
    Ordinary = -1
    PrunedBranch = 1
    LibraryReference = 2
    MerkleProof = 3
    MerkleUpdate = 4
}
Source code

cell.beginParseSpecial

@pure
fun cell.beginParseSpecial(self): (slice, bool)

Transforms an ordinary or exotic cell into a slice, as if it were an ordinary cell. A flag is returned indicating whether c is exotic. If so, ExoticCellType can later be deserialized from the first eight bits of s.

var (s, isExotic) = c.beginParseSpecial();
if (isExotic) {
    // use unsafe cast because the first 8 bits hold a correct value, no need for validation
    val cellType = s.loadInt(8) as ExoticCellType;
}
Source code

builder.endCellSpecial

@pure
fun builder.endCellSpecial(self, isExotic: bool = true): cell

Creates an exotic or ordinary cell from a builder.

Source code

cell.hashOfLevel

@pure
fun cell.hashOfLevel(self, level: int): uint256

Returns i-th hash of the cell.

Source code

cell.depthOfLevel

@pure
fun cell.depthOfLevel(self, level: int): int

Returns i-th depth of the cell.

Source code

cell.loadSpecial

@pure
fun cell.loadSpecial(self): cell

Loads an exotic cell and returns an ordinary cell. If the cell is already ordinary, does nothing. Throws an exception if cannot be loaded.

Source code

cell.toLibraryReference

@pure
fun cell.toLibraryReference(self): cell

Transforms an ordinary or exotic cell into a library reference (into an exotic cell with contents "8 bits cell type" + "256 bits lib hash").

Source code

Last updated on

On this page