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
}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;
}builder.endCellSpecial
@pure
fun builder.endCellSpecial(self, isExotic: bool = true): cellCreates an exotic or ordinary cell from a builder.
Source codecell.hashOfLevel
@pure
fun cell.hashOfLevel(self, level: int): uint256Returns i-th hash of the cell.
Source codecell.depthOfLevel
@pure
fun cell.depthOfLevel(self, level: int): intReturns i-th depth of the cell.
Source codecell.loadSpecial
@pure
fun cell.loadSpecial(self): cellLoads an exotic cell and returns an ordinary cell. If the cell is already ordinary, does nothing. Throws an exception if cannot be loaded.
Source codecell.toLibraryReference
@pure
fun cell.toLibraryReference(self): cellTransforms an ordinary or exotic cell into a library reference (into an exotic cell with contents "8 bits cell type" + "256 bits lib hash").
Source codeLast updated on