Skip to main content

UInt32

SnarkyJS / Modules / UInt32

Class: UInt32

A 32 bit unsigned integer with values ranging from 0 to 4,294,967,295.

Hierarchy

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new UInt32(...props)

Parameters

NameType
...propsany[]

Inherited from

CircuitValue.constructor

Defined in

lib/circuit_value.ts:70

Properties

value

value: Field

Defined in

lib/int.ts:377


NUM_BITS

Static NUM_BITS: number = 32

Defined in

lib/int.ts:378

Accessors

one

Static get one(): UInt32

Static method to create a UInt32 with value 0.

Returns

UInt32

Defined in

lib/int.ts:390


zero

Static get zero(): UInt32

Static method to create a UInt32 with value 0.

Returns

UInt32

Defined in

lib/int.ts:383

Methods

add

add(y): UInt32

Addition with overflow checking.

Parameters

NameType
ynumber | UInt32

Returns

UInt32

Defined in

lib/int.ts:529


assertEquals

assertEquals(x): void

Parameters

NameType
xUInt32

Returns

void

Inherited from

CircuitValue.assertEquals

Defined in

lib/circuit_value.ts:158


assertGreaterThan

assertGreaterThan(y, message?): void

Asserts that a UInt32 is greater than another one.

Parameters

NameType
yUInt32
message?string

Returns

void

Defined in

lib/int.ts:672


assertGreaterThanOrEqual

assertGreaterThanOrEqual(y, message?): void

Asserts that a UInt32 is greater than or equal to another one.

Parameters

NameType
yUInt32
message?string

Returns

void

Defined in

lib/int.ts:705


assertGt

assertGt(y, message?): void

Deprecated

Use assertGreaterThan instead.

Asserts that a UInt32 is greater than another one.

Parameters

NameType
yUInt32
message?string

Returns

void

Defined in

lib/int.ts:665


assertGte

assertGte(y, message?): void

Deprecated

Use assertGreaterThanOrEqual instead.

Asserts that a UInt32 is greater than or equal to another one.

Parameters

NameType
yUInt32
message?string

Returns

void

Defined in

lib/int.ts:698


assertLessThan

assertLessThan(y, message?): void

Asserts that a UInt32 is less than another one.

Parameters

NameType
yUInt32
message?string

Returns

void

Defined in

lib/int.ts:640


assertLessThanOrEqual

assertLessThanOrEqual(y, message?): void

Asserts that a UInt32 is less than or equal to another one.

Parameters

NameType
yUInt32
message?string

Returns

void

Defined in

lib/int.ts:598


assertLt

assertLt(y, message?): void

Deprecated

Use assertLessThan instead.

Asserts that a UInt32 is less than another one.

Parameters

NameType
yUInt32
message?string

Returns

void

Defined in

lib/int.ts:633


assertLte

assertLte(y, message?): void

Deprecated

Use assertLessThanOrEqual instead.

Asserts that a UInt32 is less than or equal to another one.

Parameters

NameType
yUInt32
message?string

Returns

void

Defined in

lib/int.ts:591


div

div(y): UInt32

Integer division.

x.div(y) returns the floor of x / y, that is, the greatest z such that x * y <= x.

Parameters

NameType
ynumber | UInt32

Returns

UInt32

Defined in

lib/int.ts:506


divMod

divMod(y): Object

Integer division with remainder.

x.divMod(y) returns the quotient and the remainder.

Parameters

NameType
ystring | number | UInt32

Returns

Object

NameType
quotientUInt32
restUInt32

Defined in

lib/int.ts:464


equals

equals(x): Bool

Parameters

NameType
xUInt32

Returns

Bool

Inherited from

CircuitValue.equals

Defined in

lib/circuit_value.ts:154


greaterThan

greaterThan(y): Bool

Checks if a UInt32 is greater than another one.

Parameters

NameType
yUInt32

Returns

Bool

Defined in

lib/int.ts:656


greaterThanOrEqual

greaterThanOrEqual(y): Bool

Checks if a UInt32 is greater than or equal to another one.

Parameters

NameType
yUInt32

Returns

Bool

Defined in

lib/int.ts:688


gt

gt(y): Bool

Deprecated

Use greaterThan instead.

Checks if a UInt32 is greater than another one.

Parameters

NameType
yUInt32

Returns

Bool

Defined in

lib/int.ts:649


gte

gte(y): Bool

Deprecated

Use greaterThanOrEqual instead.

Checks if a UInt32 is greater than or equal to another one.

Parameters

NameType
yUInt32

Returns

Bool

Defined in

lib/int.ts:681


isConstant

isConstant(): boolean

Returns

boolean

Inherited from

CircuitValue.isConstant

Defined in

lib/circuit_value.ts:162


lessThan

lessThan(y): Bool

Checks if a UInt32 is less than another one.

Parameters

NameType
yUInt32

Returns

Bool

Defined in

lib/int.ts:624


lessThanOrEqual

lessThanOrEqual(y): Bool

Checks if a UInt32 is less than or equal to another one.

Parameters

NameType
yUInt32

Returns

Bool

Defined in

lib/int.ts:568


lt

lt(y): Bool

Deprecated

Use lessThan instead.

Checks if a UInt32 is less than another one.

Parameters

NameType
yUInt32

Returns

Bool

Defined in

lib/int.ts:617


lte

lte(y): Bool

Deprecated

Use lessThanOrEqual instead.

Checks if a UInt32 is less than or equal to another one.

Parameters

NameType
yUInt32

Returns

Bool

Defined in

lib/int.ts:547


mod

mod(y): UInt32

Integer remainder.

x.mod(y) returns the value z such that 0 <= z < y and x - z is divisble by y.

Parameters

NameType
ynumber | UInt32

Returns

UInt32

Defined in

lib/int.ts:515


mul

mul(y): UInt32

Multiplication with overflow checking.

Parameters

NameType
ynumber | UInt32

Returns

UInt32

Defined in

lib/int.ts:521


sub

sub(y): UInt32

Subtraction with underflow checking.

Parameters

NameType
ynumber | UInt32

Returns

UInt32

Defined in

lib/int.ts:537


toBigint

toBigint(): bigint

Turns the UInt32 into a BigInt.

Returns

bigint

Defined in

lib/int.ts:402


toConstant

toConstant(): UInt32

Returns

UInt32

Inherited from

CircuitValue.toConstant

Defined in

lib/circuit_value.ts:150


toFields

toFields(): Field[]

Returns

Field[]

Inherited from

CircuitValue.toFields

Defined in

lib/circuit_value.ts:142


toJSON

toJSON(): any

Returns

any

Inherited from

CircuitValue.toJSON

Defined in

lib/circuit_value.ts:146


toString

toString(): string

Turns the UInt32 into a string.

Returns

string

Defined in

lib/int.ts:396


toUInt64

toUInt64(): UInt64

Turns the UInt32 into a UInt64.

Returns

UInt64

Defined in

lib/int.ts:408


MAXINT

Static MAXINT(): UInt32

Creates a UInt32 with a value of 4,294,967,295.

Returns

UInt32

Defined in

lib/int.ts:456


check

Static check(x): void

Parameters

NameType
xUInt32

Returns

void

Overrides

CircuitValue.check

Defined in

lib/int.ts:413


checkConstant

Static Private checkConstant(x): Field

Parameters

NameType
xField

Returns

Field

Defined in

lib/int.ts:434


from

Static from(x): UInt32

Creates a new UInt32.

Parameters

NameType
xstring | number | bigint | Field | UInt32

Returns

UInt32

Defined in

lib/int.ts:449


fromFields

Static fromFields<T>(this, xs): InstanceType<T>

Type parameters

NameType
Textends AnyConstructor

Parameters

NameType
thisT
xsField[]

Returns

InstanceType<T>

Inherited from

CircuitValue.fromFields

Defined in

lib/circuit_value.ts:166


fromJSON

Static fromJSON<T>(x): InstanceType<T>

Decodes a JSON-like object into this structure.

Type parameters

NameType
Textends AnyConstructor

Parameters

NameType
xstring

Returns

InstanceType<T>

Overrides

CircuitValue.fromJSON

Defined in

lib/int.ts:430


fromObject

Static fromObject<T>(this, value): InstanceType<T>

Type parameters

NameType
Textends AnyConstructor

Parameters

NameType
thisT
valueNonMethods<InstanceType<T>>

Returns

InstanceType<T>

Inherited from

CircuitValue.fromObject

Defined in

lib/circuit_value.ts:87


sizeInFields

Static sizeInFields(): number

Returns

number

Inherited from

CircuitValue.sizeInFields

Defined in

lib/circuit_value.ts:94


toAuxiliary

Static toAuxiliary(): []

Returns

[]

Inherited from

CircuitValue.toAuxiliary

Defined in

lib/circuit_value.ts:116


toConstant

Static toConstant<T>(this, t): InstanceType<T>

Type parameters

NameType
Textends AnyConstructor

Parameters

NameType
thisT
tInstanceType<T>

Returns

InstanceType<T>

Inherited from

CircuitValue.toConstant

Defined in

lib/circuit_value.ts:205


toFields

Static toFields<T>(this, v): Field[]

Type parameters

NameType
Textends AnyConstructor

Parameters

NameType
thisT
vInstanceType<T>

Returns

Field[]

Inherited from

CircuitValue.toFields

Defined in

lib/circuit_value.ts:99


toInput

Static toInput(x): HashInput

Parameters

NameType
xUInt32

Returns

HashInput

Overrides

CircuitValue.toInput

Defined in

lib/int.ts:417


toJSON

Static toJSON(x): string

Encodes this structure into a JSON-like object.

Parameters

NameType
xUInt32

Returns

string

Overrides

CircuitValue.toJSON

Defined in

lib/int.ts:423