Skip to main content

Int64

o1js / Modules / Int64

Class: Int64

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

Hierarchy

Implements

  • BalanceChange

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new Int64(magnitude, sgn?)

Parameters

NameTypeDefault value
magnitudeUInt64undefined
sgnSignSign.one

Overrides

CircuitValue.constructor

Defined in

lib/int.ts:788

Properties

magnitude

magnitude: UInt64

Implementation of

BalanceChange.magnitude

Defined in

lib/int.ts:765


sgn

sgn: Sign

Implementation of

BalanceChange.sgn

Defined in

lib/int.ts:766

Accessors

minusOne

Static get minusOne(): Int64

Static method to create a Int64 with value -1.

Returns

Int64

Defined in

lib/int.ts:863


one

Static get one(): Int64

Static method to create a Int64 with value 1.

Returns

Int64

Defined in

lib/int.ts:857


zero

Static get zero(): Int64

Static method to create a Int64 with value 0.

Returns

Int64

Defined in

lib/int.ts:851

Methods

add

add(y): Int64

Addition with overflow checking.

Parameters

NameType
ystring | number | bigint | UInt64 | UInt32 | Int64

Returns

Int64

Defined in

lib/int.ts:897


assertEquals

assertEquals(y, message?): void

Asserts that two values are equal.

Parameters

NameType
ystring | number | bigint | UInt64 | UInt32 | Int64
message?string

Returns

void

Overrides

CircuitValue.assertEquals

Defined in

lib/int.ts:951


div

div(y): Int64

Integer division.

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

Parameters

NameType
ystring | number | bigint | UInt64 | UInt32 | Int64

Returns

Int64

Defined in

lib/int.ts:922


equals

equals(y): Bool

Checks if two values are equal.

Parameters

NameType
ystring | number | bigint | UInt64 | UInt32 | Int64

Returns

Bool

Overrides

CircuitValue.equals

Defined in

lib/int.ts:944


isConstant

isConstant(): boolean

Returns

boolean

Overrides

CircuitValue.isConstant

Defined in

lib/int.ts:840


isPositive

isPositive(): Bool

Checks if the value is postive.

Returns

Bool

Defined in

lib/int.ts:961


mod

mod(y): Int64

Integer remainder.

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

Parameters

NameType
ystring | number | bigint | UInt64 | UInt32

Returns

Int64

Defined in

lib/int.ts:934


mul

mul(y): Int64

Multiplication with overflow checking.

Parameters

NameType
ystring | number | bigint | UInt64 | UInt32 | Int64

Returns

Int64

Defined in

lib/int.ts:911


neg

neg(): Int64

Negates the value.

Int64.from(5).neg() will turn into Int64.from(-5)

Returns

Int64

Defined in

lib/int.ts:890


sub

sub(y): Int64

Subtraction with underflow checking.

Parameters

NameType
ystring | number | bigint | UInt64 | UInt32 | Int64

Returns

Int64

Defined in

lib/int.ts:904


toConstant

toConstant(): Int64

Returns

Int64

Inherited from

CircuitValue.toConstant

Defined in

lib/circuit_value.ts:152


toField

toField(): Field

Returns the Field value.

Returns

Field

Defined in

lib/int.ts:870


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 Int64 into a string.

Returns

string

Defined in

lib/int.ts:835


check

Static check<T>(this, v): void

Type parameters

NameType
Textends AnyConstructor

Parameters

NameType
thisT
vInstanceType<T>

Returns

void

Inherited from

CircuitValue.check

Defined in

lib/circuit_value.ts:193


from

Static from(x): Int64

Creates a new Int64.

Check the range if the argument is a constant.

Parameters

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

Returns

Int64

Defined in

lib/int.ts:825


fromField

Static fromField(x): Int64

Static method to create a Int64 from a Field.

Parameters

NameType
xField

Returns

Int64

Defined in

lib/int.ts:876


fromFieldUnchecked

Static Private fromFieldUnchecked(x): Int64

Creates a new Int64 from a Field.

Does check if the Field is within range.

Parameters

NameType
xField

Returns

Int64

Defined in

lib/int.ts:797


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>(this, value): InstanceType<T>

Type parameters

NameType
Textends AnyConstructor

Parameters

NameType
thisT
valueany

Returns

InstanceType<T>

Inherited from

CircuitValue.fromJSON

Defined in

lib/circuit_value.ts:226


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


fromUnsigned

Static fromUnsigned(x): Int64

Creates a new Int64 from a Field.

Does not check if the Field is within range.

Parameters

NameType
xUInt64 | UInt32

Returns

Int64

Defined in

lib/int.ts:815


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<T>(this, v): HashInput

Type parameters

NameType
Textends AnyConstructor

Parameters

NameType
thisT
vInstanceType<T>

Returns

HashInput

Inherited from

CircuitValue.toInput

Defined in

lib/circuit_value.ts:122


toJSON

Static toJSON<T>(this, v): any

Type parameters

NameType
Textends AnyConstructor

Parameters

NameType
thisT
vInstanceType<T>

Returns

any

Inherited from

CircuitValue.toJSON

Defined in

lib/circuit_value.ts:215