Class: Bool
Table of contents
Constructors
Properties
Methods
- and
- assertEquals
- assertFalse
- assertTrue
- equals
- not
- or
- sizeInFields
- toBoolean
- toField
- toFields
- toJSON
- toString
- and
- assertEqual
- check
- count
- equal
- fromBytes
- fromFields
- fromJSON
- not
- or
- readBytes
- sizeInBytes
- sizeInFields
- toAuxiliary
- toBytes
- toField
- toFields
- toInput
- toJSON
Constructors
constructor
• new Bool(x
)
Parameters
Name | Type |
---|---|
x | boolean | Bool |
Defined in
Properties
Unsafe
▪ Static
Unsafe: Object
Type declaration
Name | Type |
---|---|
ofField | (x : string | number | boolean | Field ) => Bool |
Defined in
Methods
and
▸ and(y
): Bool
Parameters
Name | Type | Description |
---|---|---|
y | boolean | Bool | A Bool to AND with this Bool. |
Returns
a new Bool that is set to true only if
this Bool and y
are also true.
Defined in
assertEquals
▸ assertEquals(y
, message?
): void
Proves that this Bool is equal to y
.
Parameters
Name | Type | Description |
---|---|---|
y | boolean | Bool | a Bool. |
message? | string | - |
Returns
void
Defined in
assertFalse
▸ assertFalse(message?
): void
Proves that this Bool is false
.
Parameters
Name | Type |
---|---|
message? | string |
Returns
void
Defined in
assertTrue
▸ assertTrue(message?
): void
Proves that this Bool is true
.
Parameters
Name | Type |
---|---|
message? | string |
Returns
void
Defined in
equals
▸ equals(y
): Bool
Returns true if this Bool is equal to y
.
Parameters
Name | Type | Description |
---|---|---|
y | boolean | Bool | a Bool. |
Returns
Defined in
not
▸ not(): Bool
Returns
a new Bool that is the negation of this Bool.
Defined in
or
▸ or(y
): Bool
Parameters
Name | Type | Description |
---|---|---|
y | boolean | Bool | a Bool to OR with this Bool. |
Returns
a new Bool that is set to true if either
this Bool or y
is true.
Defined in
sizeInFields
▸ sizeInFields(): number
Returns the size of this type.
Returns
number
Defined in
toBoolean
▸ toBoolean(): boolean
This converts the Bool to a javascript [[boolean]]. This can only be called on non-witness values.
Returns
boolean
Defined in
toField
▸ toField(): Field
Converts a Bool to a Field. false
becomes 0 and true
becomes 1.
Returns
Defined in
toFields
▸ toFields(): Field
[]
Serializes this Bool into Field elements.
Returns
Field
[]
Defined in
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
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
and
▸ Static
and(x
, y
): Bool
Boolean AND operation.
Parameters
Name | Type |
---|---|
x | boolean | Bool |
y | boolean | Bool |
Returns
Defined in
assertEqual
▸ Static
assertEqual(x
, y
): void
Asserts if both Bool are equal.
Parameters
Name | Type |
---|---|
x | boolean | Bool |
y | boolean | Bool |
Returns
void
Defined in
check
▸ Static
check(x
): void
Parameters
Name | Type |
---|---|
x | Bool |
Returns
void
Defined in
count
▸ Static
count(x
): Field
Counts all elements of type Bool.
Parameters
Name | Type |
---|---|
x | boolean [] | Bool |
Returns
Defined in
equal
▸ Static
equal(x
, y
): Bool
Checks two Bool for equality.
Parameters
Name | Type |
---|---|
x | boolean | Bool |
y | boolean | Bool |
Returns
Defined in
fromBytes
▸ Static
fromBytes(bytes
): Bool
Parameters
Name | Type |
---|---|
bytes | number [] |
Returns
Defined in
fromFields
▸ Static
fromFields(fields
): Bool
Creates a data structure from an array of serialized Field elements.
Parameters
Name | Type |
---|---|
fields | Field [] |
Returns
Defined in
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
Name | Type |
---|---|
x | boolean |
Returns
Defined in
not
▸ Static
not(x
): Bool
Boolean negation.
Parameters
Name | Type |
---|---|
x | boolean | Bool |
Returns
Defined in
or
▸ Static
or(x
, y
): Bool
Boolean OR operation.
Parameters
Name | Type |
---|---|
x | boolean | Bool |
y | boolean | Bool |
Returns
Defined in
readBytes
▸ Static
readBytes(bytes
, offset
): [value: Bool, offset: number]
Parameters
Name | Type |
---|---|
bytes | number [] |
offset | number |
Returns
[value: Bool, offset: number]
Defined in
sizeInBytes
▸ Static
sizeInBytes(): number
Returns
number
Defined in
sizeInFields
▸ Static
sizeInFields(): number
Returns the size of this type.
Returns
number
Defined in
toAuxiliary
▸ Static
toAuxiliary(x?
): []
Static method to serialize a Bool into its auxiliary data.
Parameters
Name | Type |
---|---|
x? | Bool |
Returns
[]
Defined in
toBytes
▸ Static
toBytes(x
): number
[]
Parameters
Name | Type |
---|---|
x | Bool |
Returns
number
[]
Defined in
toField
▸ Static
toField(x
): Field
Serializes a Bool into an array of Field elements.
Parameters
Name | Type |
---|---|
x | boolean | Bool |
Returns
Defined in
toFields
▸ Static
toFields(x
): Field
[]
Static method to serialize a Bool into an array of Field elements.
Parameters
Name | Type |
---|---|
x | Bool |
Returns
Field
[]
Defined in
toInput
▸ Static
toInput(x
): Object
Parameters
Name | Type |
---|---|
x | Bool |
Returns
Object
Name | Type |
---|---|
packed | [Field , number ][] |
Defined in
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
Name | Type |
---|---|
x | Bool |
Returns
boolean