Skip to main content

Class: Bool

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Bool(x)

Parameters

NameType
xboolean | Bool

Defined in

snarky.d.ts:431

Properties

Unsafe

Static Unsafe: Object

Type declaration

NameType
ofField(x: string | number | boolean | Field) => Bool

Defined in

snarky.d.ts:521

Methods

and

and(y): Bool

Parameters

NameTypeDescription
yboolean | BoolA Bool to AND with this Bool.

Returns

Bool

a new Bool that is set to true only if this Bool and y are also true.

Defined in

snarky.d.ts:448


assertEquals

assertEquals(y, message?): void

Proves that this Bool is equal to y.

Parameters

NameTypeDescription
yboolean | Boola Bool.
message?string-

Returns

void

Defined in

snarky.d.ts:461


assertFalse

assertFalse(message?): void

Proves that this Bool is false.

Parameters

NameType
message?string

Returns

void

Defined in

snarky.d.ts:471


assertTrue

assertTrue(message?): void

Proves that this Bool is true.

Parameters

NameType
message?string

Returns

void

Defined in

snarky.d.ts:466


equals

equals(y): Bool

Returns true if this Bool is equal to y.

Parameters

NameTypeDescription
yboolean | Boola Bool.

Returns

Bool

Defined in

snarky.d.ts:477


not

not(): Bool

Returns

Bool

a new Bool that is the negation of this Bool.

Defined in

snarky.d.ts:441


or

or(y): Bool

Parameters

NameTypeDescription
yboolean | Boola Bool to OR with this Bool.

Returns

Bool

a new Bool that is set to true if either this Bool or y is true.

Defined in

snarky.d.ts:455


sizeInFields

sizeInFields(): number

Returns the size of this type.

Returns

number

Defined in

snarky.d.ts:482


toBoolean

toBoolean(): boolean

This converts the Bool to a javascript boolean. This can only be called on non-witness values.

Returns

boolean

Defined in

snarky.d.ts:504


toField

toField(): Field

Converts a Bool to a Field. false becomes 0 and true becomes 1.

Returns

Field

Defined in

snarky.d.ts:436


toFields

toFields(): Field[]

Serializes this Bool into Field elements.

Returns

Field[]

Defined in

snarky.d.ts:487


toJSON

toJSON(): boolean

Serialize the Bool to a JSON string. This operation does NOT affect the circuit and can't be used to prove anything about the string representation of the Field.

Returns

boolean

Defined in

snarky.d.ts:498


toString

toString(): string

Serialize the Bool to a string, e.g. for printing. This operation does NOT affect the circuit and can't be used to prove anything about the string representation of the Field.

Returns

string

Defined in

snarky.d.ts:493


and

Static and(x, y): Bool

Boolean AND operation.

Parameters

NameType
xboolean | Bool
yboolean | Bool

Returns

Bool

Defined in

snarky.d.ts:539


assertEqual

Static assertEqual(x, y): void

Asserts if both Bool are equal.

Parameters

NameType
xboolean | Bool
yboolean | Bool

Returns

void

Defined in

snarky.d.ts:549


check

Static check(x): void

Parameters

NameType
xBool

Returns

void

Defined in

snarky.d.ts:591


count

Static count(x): Field

Counts all elements of type Bool.

Parameters

NameType
xboolean[] | Bool

Returns

Field

Defined in

snarky.d.ts:559


equal

Static equal(x, y): Bool

Checks two Bool for equality.

Parameters

NameType
xboolean | Bool
yboolean | Bool

Returns

Bool

Defined in

snarky.d.ts:554


fromBytes

Static fromBytes(bytes): Bool

Parameters

NameType
bytesnumber[]

Returns

Bool

Defined in

snarky.d.ts:596


fromFields

Static fromFields(fields): Bool

Creates a data structure from an array of serialized Field elements.

Parameters

NameType
fieldsField[]

Returns

Bool

Defined in

snarky.d.ts:578


fromJSON

Static fromJSON(x): Bool

Deserialize a JSON structure into a Bool. This operation does NOT affect the circuit and can't be used to prove anything about the string representation of the Field.

Parameters

NameType
xboolean

Returns

Bool

Defined in

snarky.d.ts:589


not

Static not(x): Bool

Boolean negation.

Parameters

NameType
xboolean | Bool

Returns

Bool

Defined in

snarky.d.ts:534


or

Static or(x, y): Bool

Boolean OR operation.

Parameters

NameType
xboolean | Bool
yboolean | Bool

Returns

Bool

Defined in

snarky.d.ts:544


sizeInBytes

Static sizeInBytes(): number

Returns

number

Defined in

snarky.d.ts:597


sizeInFields

Static sizeInFields(): number

Returns the size of this type.

Returns

number

Defined in

snarky.d.ts:564


toAuxiliary

Static toAuxiliary(x?): []

Static method to serialize a Bool into its auxiliary data.

Parameters

NameType
x?Bool

Returns

[]

Defined in

snarky.d.ts:574


toBytes

Static toBytes(x): number[]

Parameters

NameType
xBool

Returns

number[]

Defined in

snarky.d.ts:595


toField

Static toField(x): Field

Serializes a Bool into an array of Field elements.

Parameters

NameType
xboolean | Bool

Returns

Field

Defined in

snarky.d.ts:519


toFields

Static toFields(x): Field[]

Static method to serialize a Bool into an array of Field elements.

Parameters

NameType
xBool

Returns

Field[]

Defined in

snarky.d.ts:569


toInput

Static toInput(x): Object

Parameters

NameType
xBool

Returns

Object

NameType
packed[Field, number][]

Defined in

snarky.d.ts:594


toJSON

Static toJSON(x): boolean

Serialize a Bool to a JSON string. This operation does NOT affect the circuit and can't be used to prove anything about the string representation of the Field.

Parameters

NameType
xBool

Returns

boolean

Defined in

snarky.d.ts:584