Skip to main content

Boolean

Overview

Boolean element class for performing logical operations in Aleo. This class provides methods for creating boolean values, converting between different formats, and performing logical operations like AND, OR, XOR, NAND, NOR, and NOT.

Constructors

Boolean

Creates a Boolean from a native JS bool

Boolean(value)
ParamType
valueboolean

Methods

fromString

Creates a boolean object from a string representation ("true"/"false")

fromString(boolean)Boolean
ParamType
booleanstring
returnBoolean

toString

Returns the string representation of the boolean element

toString() ► string
ParamType
returnstring

fromBytesLe

Create a boolean element from a Uint8Array of left endian bytes

fromBytesLe(bytes)Boolean
ParamType
bytesUint8Array
returnBoolean

toBytesLe

Encode the boolean element as a Uint8Array of left endian bytes

toBytesLe()Uint8Array
ParamType
returnUint8Array

fromBitsLe

Reconstruct a boolean element from a boolean array representation

fromBitsLe(bits)Boolean
ParamType
bitsArray.<any>
returnBoolean

toBitsLe

Get the left endian boolean array representation of the boolean element

toBitsLe()Array.<any>
ParamType
returnArray.<any>

toPlaintext

Create a plaintext from the boolean element

toPlaintext()Plaintext
ParamType
returnPlaintext

clone

Clone the boolean element

clone()Boolean
ParamType
returnBoolean

random

Generate a random boolean element

random()Boolean
ParamType
returnBoolean

not

Logical NOT

not()Boolean
ParamType
returnBoolean

and

Logical AND

and(other)Boolean
ParamType
otherBoolean
returnBoolean

or

Logical OR

or(other)Boolean
ParamType
otherBoolean
returnBoolean

xor

Logical XOR

xor(other)Boolean
ParamType
otherBoolean
returnBoolean

nand

Logical NAND

nand(other)Boolean
ParamType
otherBoolean
returnBoolean

nor

Logical NOR

nor(other)Boolean
ParamType
otherBoolean
returnBoolean

equals

Check if one boolean element equals another

equals(other) ► boolean
ParamType
otherBoolean
returnboolean