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

Properties

magnitude

magnitude: UInt64

Implementation of

BalanceChange.magnitude

Defined in

lib/int.ts:1099


sgn

sgn: Sign

Implementation of

BalanceChange.sgn

Defined in

lib/int.ts:1100

Accessors

minusOne

Static get minusOne(): Int64

Static method to create a Int64 with value -1.

Returns

Int64

Defined in

lib/int.ts:1197


one

Static get one(): Int64

Static method to create a Int64 with value 1.

Returns

Int64

Defined in

lib/int.ts:1191


zero

Static get zero(): Int64

Static method to create a Int64 with value 0.

Returns

Int64

Defined in

lib/int.ts:1185

Methods

add

add(y): Int64

Addition with overflow checking.

Parameters

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

Returns

Int64

Defined in

lib/int.ts:1231


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


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


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


isConstant

isConstant(): boolean

Returns

boolean

Overrides

CircuitValue.isConstant

Defined in

lib/int.ts:1174


isPositive

isPositive(): Bool

Checks if the value is positive.

Returns

Bool

Defined in

lib/int.ts:1295


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


mul

mul(y): Int64

Multiplication with overflow checking.

Parameters

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

Returns

Int64

Defined in

lib/int.ts:1245


neg

neg(): Int64

Negates the value.

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

Returns

Int64

Defined in

lib/int.ts:1224


sub

sub(y): Int64

Subtraction with underflow checking.

Parameters

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

Returns

Int64

Defined in

lib/int.ts:1238


toConstant

toConstant(): Int64

Returns

Int64

Inherited from

CircuitValue.toConstant

Defined in

lib/circuit_value.ts:158


toField

toField(): Field

Returns the Field value.

Returns

Field

Defined in

lib/int.ts:1204


toFields

toFields(): Field[]

Returns

Field[]

Inherited from

CircuitValue.toFields

Defined in

lib/circuit_value.ts:150


toJSON

toJSON(): any

Returns

any

Inherited from

CircuitValue.toJSON

Defined in

lib/circuit_value.ts:154


toString

toString(): string

Turns the Int64 into a string.

Returns

string

Defined in

lib/int.ts:1169


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


empty

Static empty\<T>(): InstanceType\<T>

Type parameters

NameType
Textends AnyConstructor

Returns

InstanceType\<T>

Inherited from

CircuitValue.empty

Defined in

lib/circuit_value.ts:254


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


fromField

Static fromField(x): Int64

Static method to create a Int64 from a Field.

Parameters

NameType
xField

Returns

Int64

Defined in

lib/int.ts:1210


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


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


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


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


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


sizeInFields

Static sizeInFields(): number

Returns

number

Inherited from

CircuitValue.sizeInFields

Defined in

lib/circuit_value.ts:102


toAuxiliary

Static toAuxiliary(): []

Returns

[]

Inherited from

CircuitValue.toAuxiliary

Defined in

lib/circuit_value.ts:124


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


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


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


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