Skip to main content

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.

Extends

  • CircuitValue

Implements

  • BalanceChange

Constructors

new Int64(magnitude, sgn)

new Int64(magnitude: UInt64, sgn: Sign): Int64

Parameters

magnitude: UInt64

sgn: Sign= Sign.one

Returns

Int64

Overrides

CircuitValue.constructor

Source

lib/provable/int.ts:1047

Properties

magnitude

magnitude: UInt64;

Implementation of

BalanceChange.magnitude

Source

lib/provable/int.ts:1024


sgn

sgn: Sign;

Implementation of

BalanceChange.sgn

Source

lib/provable/int.ts:1025

Accessors

minusOne

get static minusOne(): Int64

Static method to create a Int64 with value -1.

Returns

Int64

Source

lib/provable/int.ts:1122


one

get static one(): Int64

Static method to create a Int64 with value 1.

Returns

Int64

Source

lib/provable/int.ts:1116


zero

get static zero(): Int64

Static method to create a Int64 with value 0.

Returns

Int64

Source

lib/provable/int.ts:1110

Methods

add()

add(y: 
| string
| number
| bigint
| UInt64
| UInt32
| Int64): Int64

Addition with overflow checking.

Parameters

y: | string | number | bigint | UInt64 | UInt32 | Int64

Returns

Int64

Source

lib/provable/int.ts:1156


assertEquals()

assertEquals(y: 
| string
| number
| bigint
| UInt64
| UInt32
| Int64, message?: string): void

Asserts that two values are equal.

Parameters

y: | string | number | bigint | UInt64 | UInt32 | Int64

message?: string

Returns

void

Overrides

CircuitValue.assertEquals

Source

lib/provable/int.ts:1210


div()

div(y: 
| string
| number
| bigint
| UInt64
| UInt32
| Int64): Int64

Integer division.

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

Parameters

y: | string | number | bigint | UInt64 | UInt32 | Int64

Returns

Int64

Source

lib/provable/int.ts:1181


equals()

equals(y: 
| string
| number
| bigint
| UInt64
| UInt32
| Int64): Bool

Checks if two values are equal.

Parameters

y: | string | number | bigint | UInt64 | UInt32 | Int64

Returns

Bool

Overrides

CircuitValue.equals

Source

lib/provable/int.ts:1203


isConstant()

isConstant(): boolean

Returns

boolean

Overrides

CircuitValue.isConstant

Source

lib/provable/int.ts:1099


isPositive()

isPositive(): Bool

Checks if the value is positive.

Returns

Bool

Source

lib/provable/int.ts:1220


mod()

mod(y: 
| string
| number
| bigint
| UInt64
| UInt32): Int64

Integer remainder.

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

Parameters

y: | string | number | bigint | UInt64 | UInt32

Returns

Int64

Source

lib/provable/int.ts:1193


mul()

mul(y: 
| string
| number
| bigint
| UInt64
| UInt32
| Int64): Int64

Multiplication with overflow checking.

Parameters

y: | string | number | bigint | UInt64 | UInt32 | Int64

Returns

Int64

Source

lib/provable/int.ts:1170


neg()

neg(): Int64

Negates the value.

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

Returns

Int64

Source

lib/provable/int.ts:1149


sub()

sub(y: 
| string
| number
| bigint
| UInt64
| UInt32
| Int64): Int64

Subtraction with underflow checking.

Parameters

y: | string | number | bigint | UInt64 | UInt32 | Int64

Returns

Int64

Source

lib/provable/int.ts:1163


toConstant()

toConstant(): this

Returns

this

Inherited from

CircuitValue.toConstant

Source

lib/provable/types/circuit-value.ts:122


toField()

toField(): Field

Returns the Field value.

Returns

Field

Source

lib/provable/int.ts:1129


toFields()

toFields(): Field[]

Returns

Field[]

Inherited from

CircuitValue.toFields

Source

lib/provable/types/circuit-value.ts:85


toJSON()

toJSON(): any

Returns

any

Inherited from

CircuitValue.toJSON

Source

lib/provable/types/circuit-value.ts:118


toString()

toString(): string

Turns the Int64 into a string.

Returns

string

Source

lib/provable/int.ts:1094


check()

static check<T>(this: T, v: InstanceType<T>): void

Type parameters

T extends AnyConstructor

Parameters

this: T

v: InstanceType\<T>

Returns

void

Inherited from

CircuitValue.check

Source

lib/provable/types/circuit-value.ts:163


empty()

static empty<T>(): InstanceType<T>

Type parameters

T extends AnyConstructor

Returns

InstanceType\<T>

Inherited from

CircuitValue.empty

Source

lib/provable/types/circuit-value.ts:218


from()

static from(x: 
| string
| number
| bigint
| Field
| UInt64
| UInt32
| Int64): Int64

Creates a new Int64.

Check the range if the argument is a constant.

Parameters

x: | string | number | bigint | Field | UInt64 | UInt32 | Int64

Returns

Int64

Source

lib/provable/int.ts:1084


fromField()

static fromField(x: Field): Int64

Static method to create a Int64 from a Field.

Parameters

x: Field

Returns

Int64

Source

lib/provable/int.ts:1135


fromFields()

static fromFields<T>(this: T, xs: Field[]): InstanceType<T>

Type parameters

T extends AnyConstructor

Parameters

this: T

xs: Field[]

Returns

InstanceType\<T>

Inherited from

CircuitValue.fromFields

Source

lib/provable/types/circuit-value.ts:138


fromJSON()

static fromJSON<T>(this: T, value: any): InstanceType<T>

Type parameters

T extends AnyConstructor

Parameters

this: T

value: any

Returns

InstanceType\<T>

Inherited from

CircuitValue.fromJSON

Source

lib/provable/types/circuit-value.ts:196


fromObject()

static fromObject<T>(this: T, value: NonMethods<InstanceType<T>>): InstanceType<T>

Type parameters

T extends AnyConstructor

Parameters

this: T

value: NonMethods\<InstanceType\<T>>

Returns

InstanceType\<T>

Inherited from

CircuitValue.fromObject

Source

lib/provable/types/circuit-value.ts:30


fromUnsigned()

static fromUnsigned(x: UInt64 | UInt32): Int64

Creates a new Int64 from a Field.

Does not check if the Field is within range.

Parameters

x: UInt64 | UInt32

Returns

Int64

Source

lib/provable/int.ts:1074


fromValue()

static fromValue<T>(this: T, value: any): InstanceType<T>

Type parameters

T extends AnyConstructor

Parameters

this: T

value: any

Returns

InstanceType\<T>

Inherited from

CircuitValue.fromValue

Source

lib/provable/types/circuit-value.ts:98


sizeInFields()

static sizeInFields(): number

Returns

number

Inherited from

CircuitValue.sizeInFields

Source

lib/provable/types/circuit-value.ts:37


toAuxiliary()

static toAuxiliary(): []

Returns

[]

Inherited from

CircuitValue.toAuxiliary

Source

lib/provable/types/circuit-value.ts:59


toConstant()

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

Type parameters

T extends AnyConstructor

Parameters

this: T

t: InstanceType\<T>

Returns

InstanceType\<T>

Inherited from

CircuitValue.toConstant

Source

lib/provable/types/circuit-value.ts:177


toFields()

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

Type parameters

T extends AnyConstructor

Parameters

this: T

v: InstanceType\<T>

Returns

Field[]

Inherited from

CircuitValue.toFields

Source

lib/provable/types/circuit-value.ts:42


toInput()

static toInput<T>(this: T, v: InstanceType<T>): HashInput

Type parameters

T extends AnyConstructor

Parameters

this: T

v: InstanceType\<T>

Returns

HashInput

Inherited from

CircuitValue.toInput

Source

lib/provable/types/circuit-value.ts:63


toJSON()

static toJSON<T>(this: T, v: InstanceType<T>): any

Type parameters

T extends AnyConstructor

Parameters

this: T

v: InstanceType\<T>

Returns

any

Inherited from

CircuitValue.toJSON

Source

lib/provable/types/circuit-value.ts:185


toValue()

static toValue<T>(this: T, v: InstanceType<T>): any

Type parameters

T extends AnyConstructor

Parameters

this: T

v: InstanceType\<T>

Returns

any

Inherited from

CircuitValue.toValue

Source

lib/provable/types/circuit-value.ts:89