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:553

Properties

Unsafe

Static Unsafe: Object

Type declaration

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

Defined in

snarky.d.ts:643

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:570


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:583


assertFalse

assertFalse(message?): void

Proves that this Bool is false.

Parameters

NameType
message?string

Returns

void

Defined in

snarky.d.ts:593


assertTrue

assertTrue(message?): void

Proves that this Bool is true.

Parameters

NameType
message?string

Returns

void

Defined in

snarky.d.ts:588


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:599


not

not(): Bool

Returns

Bool

a new Bool that is the negation of this Bool.

Defined in

snarky.d.ts:563


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:577


sizeInFields

sizeInFields(): number

Returns the size of this type.

Returns

number

Defined in

snarky.d.ts:604


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:626


toField

toField(): Field

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

Returns

Field

Defined in

snarky.d.ts:558


toFields

toFields(): Field[]

Serializes this Bool into Field elements.

Returns

Field[]

Defined in

snarky.d.ts:609


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:620


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:615


and

Static and(x, y): Bool

Boolean AND operation.

Parameters

NameType
xboolean | Bool
yboolean | Bool

Returns

Bool

Defined in

snarky.d.ts:661


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:671


check

Static check(x): void

Parameters

NameType
xBool

Returns

void

Defined in

snarky.d.ts:713


count

Static count(x): Field

Counts all elements of type Bool.

Parameters

NameType
xboolean[] | Bool

Returns

Field

Defined in

snarky.d.ts:681


equal

Static equal(x, y): Bool

Checks two Bool for equality.

Parameters

NameType
xboolean | Bool
yboolean | Bool

Returns

Bool

Defined in

snarky.d.ts:676


fromBytes

Static fromBytes(bytes): Bool

Parameters

NameType
bytesnumber[]

Returns

Bool

Defined in

snarky.d.ts:718


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:700


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:711


not

Static not(x): Bool

Boolean negation.

Parameters

NameType
xboolean | Bool

Returns

Bool

Defined in

snarky.d.ts:656


or

Static or(x, y): Bool

Boolean OR operation.

Parameters

NameType
xboolean | Bool
yboolean | Bool

Returns

Bool

Defined in

snarky.d.ts:666


readBytes

Static readBytes(bytes, offset): [value: Bool, offset: number]

Parameters

NameType
bytesnumber[]
offsetnumber

Returns

[value: Bool, offset: number]

Defined in

snarky.d.ts:719


sizeInBytes

Static sizeInBytes(): number

Returns

number

Defined in

snarky.d.ts:723


sizeInFields

Static sizeInFields(): number

Returns the size of this type.

Returns

number

Defined in

snarky.d.ts:686


toAuxiliary

Static toAuxiliary(x?): []

Static method to serialize a Bool into its auxiliary data.

Parameters

NameType
x?Bool

Returns

[]

Defined in

snarky.d.ts:696


toBytes

Static toBytes(x): number[]

Parameters

NameType
xBool

Returns

number[]

Defined in

snarky.d.ts:717


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:641


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:691


toInput

Static toInput(x): Object

Parameters

NameType
xBool

Returns

Object

NameType
packed[Field, number][]

Defined in

snarky.d.ts:716


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:706