Skip to main content

UInt64

o1js / Modules / UInt64

Class: UInt64

A 64 bit unsigned integer with values ranging from 0 to 18,446,744,073,709,551,615.

Hierarchy

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new UInt64(...props)

Parameters

NameType
...propsany[]

Inherited from

CircuitValue.constructor

Defined in

lib/circuit_value.ts:72

Properties

value

value: Field

Defined in

lib/int.ts:14


NUM_BITS

Static NUM_BITS: number = 64

Defined in

lib/int.ts:15

Accessors

one

Static get one(): UInt64

Static method to create a UInt64 with value 1.

Returns

UInt64

Defined in

lib/int.ts:26


zero

Static get zero(): UInt64

Static method to create a UInt64 with value 0.

Returns

UInt64

Defined in

lib/int.ts:20

Methods

add

add(y): UInt64

Addition with overflow checking.

Parameters

NameType
ynumber | UInt64

Returns

UInt64

Defined in

lib/int.ts:190


assertEquals

assertEquals(x): void

Parameters

NameType
xUInt64

Returns

void

Inherited from

CircuitValue.assertEquals

Defined in

lib/circuit_value.ts:160


assertGreaterThan

assertGreaterThan(y, message?): void

Asserts that a UInt64 is greater than another one.

Parameters

NameType
yUInt64
message?string

Returns

void

Defined in

lib/int.ts:337


assertGreaterThanOrEqual

assertGreaterThanOrEqual(y, message?): void

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

Parameters

NameType
yUInt64
message?string

Returns

void

Defined in

lib/int.ts:369


assertGt

assertGt(y, message?): void

Deprecated

Use assertGreaterThan instead.

Asserts that a UInt64 is greater than another one.

Parameters

NameType
yUInt64
message?string

Returns

void

Defined in

lib/int.ts:330


assertGte

assertGte(y, message?): void

Deprecated

Use assertGreaterThanOrEqual instead.

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

Parameters

NameType
yUInt64
message?string

Returns

void

Defined in

lib/int.ts:362


assertLessThan

assertLessThan(y, message?): void

Asserts that a UInt64 is less than another one.

Parameters

NameType
yUInt64
message?string

Returns

void

Defined in

lib/int.ts:305


assertLessThanOrEqual

assertLessThanOrEqual(y, message?): void

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

Parameters

NameType
yUInt64
message?string

Returns

void

Defined in

lib/int.ts:261


assertLt

assertLt(y, message?): void

Deprecated

Use assertLessThan instead.

Asserts that a UInt64 is less than another one.

Parameters

NameType
yUInt64
message?string

Returns

void

Defined in

lib/int.ts:298


assertLte

assertLte(y, message?): void

Deprecated

Use assertLessThanOrEqual instead.

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

Parameters

NameType
yUInt64
message?string

Returns

void

Defined in

lib/int.ts:254


div

div(y): UInt64

Integer division.

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

Parameters

NameType
ynumber | UInt64

Returns

UInt64

Defined in

lib/int.ts:164


divMod

divMod(y): Object

Integer division with remainder.

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

Parameters

NameType
ystring | number | UInt64

Returns

Object

NameType
quotientUInt64
restUInt64

Defined in

lib/int.ts:121


equals

equals(x): Bool

Parameters

NameType
xUInt64

Returns

Bool

Inherited from

CircuitValue.equals

Defined in

lib/circuit_value.ts:156


greaterThan

greaterThan(y): Bool

Checks if a UInt64 is greater than another one.

Parameters

NameType
yUInt64

Returns

Bool

Defined in

lib/int.ts:321


greaterThanOrEqual

greaterThanOrEqual(y): Bool

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

Parameters

NameType
yUInt64

Returns

Bool

Defined in

lib/int.ts:353


gt

gt(y): Bool

Deprecated

Use greaterThan instead.

Checks if a UInt64 is greater than another one.

Parameters

NameType
yUInt64

Returns

Bool

Defined in

lib/int.ts:314


gte

gte(y): Bool

Deprecated

Use greaterThanOrEqual instead.

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

Parameters

NameType
yUInt64

Returns

Bool

Defined in

lib/int.ts:346


isConstant

isConstant(): boolean

Returns

boolean

Inherited from

CircuitValue.isConstant

Defined in

lib/circuit_value.ts:164


lessThan

lessThan(y): Bool

Checks if a UInt64 is less than another one.

Parameters

NameType
yUInt64

Returns

Bool

Defined in

lib/int.ts:288


lessThanOrEqual

lessThanOrEqual(y): Bool

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

Parameters

NameType
yUInt64

Returns

Bool

Defined in

lib/int.ts:231


lt

lt(y): Bool

Deprecated

Use lessThan instead.

Checks if a UInt64 is less than another one.

Parameters

NameType
yUInt64

Returns

Bool

Defined in

lib/int.ts:280


lte

lte(y): Bool

Deprecated

Use lessThanOrEqual instead.

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

Parameters

NameType
yUInt64

Returns

Bool

Defined in

lib/int.ts:210


mod

mod(y): UInt64

Integer remainder.

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

Parameters

NameType
ynumber | UInt64

Returns

UInt64

Defined in

lib/int.ts:174


mul

mul(y): UInt64

Multiplication with overflow checking.

Parameters

NameType
ynumber | UInt64

Returns

UInt64

Defined in

lib/int.ts:181


sub

sub(y): UInt64

Subtraction with underflow checking.

Parameters

NameType
ynumber | UInt64

Returns

UInt64

Defined in

lib/int.ts:199


toBigInt

toBigInt(): bigint

Turns the UInt64 into a BigInt.

Returns

bigint

Defined in

lib/int.ts:40


toConstant

toConstant(): UInt64

Returns

UInt64

Inherited from

CircuitValue.toConstant

Defined in

lib/circuit_value.ts:152


toFields

toFields(): Field[]

Returns

Field[]

Inherited from

CircuitValue.toFields

Defined in

lib/circuit_value.ts:144


toJSON

toJSON(): any

Returns

any

Inherited from

CircuitValue.toJSON

Defined in

lib/circuit_value.ts:148


toString

toString(): string

Turns the UInt64 into a string.

Returns

string

Defined in

lib/int.ts:33


toUInt32

toUInt32(): UInt32

Turns the UInt64 into a UInt32, asserting that it fits in 32 bits.

Returns

UInt32

Defined in

lib/int.ts:47


toUInt32Clamped

toUInt32Clamped(): UInt32

Turns the UInt64 into a UInt32, clamping to the 32 bits range if it's too large.

UInt64.from(4294967296).toUInt32Clamped().toString(); // "4294967295"

Returns

UInt32

Defined in

lib/int.ts:59


MAXINT

Static MAXINT(): UInt64

Creates a UInt64 with a value of 18,446,744,073,709,551,615.

Returns

UInt64

Defined in

lib/int.ts:112


check

Static check(x): void

Parameters

NameType
xUInt64

Returns

void

Overrides

CircuitValue.check

Defined in

lib/int.ts:68


checkConstant

Static Private checkConstant(x): Field

Parameters

NameType
xField

Returns

Field

Defined in

lib/int.ts:89


from

Static from(x): UInt64

Creates a new UInt64.

Parameters

NameType
xstring | number | bigint | Field | UInt64 | UInt32

Returns

UInt64

Defined in

lib/int.ts:104


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


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


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


sizeInFields

Static sizeInFields(): number

Returns

number

Inherited from

CircuitValue.sizeInFields

Defined in

lib/circuit_value.ts:96


toAuxiliary

Static toAuxiliary(): []

Returns

[]

Inherited from

CircuitValue.toAuxiliary

Defined in

lib/circuit_value.ts:118


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


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


toInput

Static toInput(x): HashInput

Parameters

NameType
xUInt64

Returns

HashInput

Overrides

CircuitValue.toInput

Defined in

lib/int.ts:72


toJSON

Static toJSON(x): string

Encodes this structure into a JSON-like object.

Parameters

NameType
xUInt64

Returns

string

Overrides

CircuitValue.toJSON

Defined in

lib/int.ts:78