Documentation

English
  • English
  • Russian
Welcome

info

Please note that zkApp programmability is not yet available on Mina Mainnet, but zkApps can now be deployed to Berkeley QANet.

SnarkyJS API Reference

To write a zkApp, we recommend using the Mina zkApp CLI, which makes writing a zkApp easy by including SnarkyJS & providing project scaffolding, a test framework, and formatting.

Table of contents

Namespaces

Classes

Interfaces

Type Aliases

Variables

Functions

Classes

snarkyjs / Exports / Bool

Class: Bool

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Bool(x)

Parameters
NameType
xboolean | Bool
Defined in

snarky.d.ts:362

Properties

Unsafe

Static Unsafe: Object

Type declaration
NameType
ofField(x: string | number | boolean | Field) => Bool
Defined in

snarky.d.ts:442


false

Static false: Bool

The constant [[Bool]] that is false.

Defined in

snarky.d.ts:438


true

Static true: Bool

The constant [[Bool]] that is true.

Defined in

snarky.d.ts:434

Methods

and

and(y): Bool

Parameters
NameTypeDescription
yboolean | BoolA [[Bool]] to AND with this [[Bool]].
Returns

Bool

a new [[Bool]] that is set to true only if this [[Bool]] and y are also true.

Defined in

snarky.d.ts:379


assertEquals

assertEquals(y): void

Proves that this [[Bool]] is equal to y.

Parameters
NameTypeDescription
yboolean | Boola [[Bool]].
Returns

void

Defined in

snarky.d.ts:392


assertFalse

assertFalse(): void

Proves that this [[Bool]] is false.

Returns

void

Defined in

snarky.d.ts:402


assertTrue

assertTrue(): void

Proves that this [[Bool]] is true.

Returns

void

Defined in

snarky.d.ts:397


equals

equals(y): Bool

Returns true if this [[Bool]] is equal to y.

Parameters
NameTypeDescription
yboolean | Boola [[Bool]].
Returns

Bool

Defined in

snarky.d.ts:408


not

not(): Bool

Returns

Bool

a new [[Bool]] that is the negation of this [[Bool]].

Defined in

snarky.d.ts:372


or

or(y): Bool

Parameters
NameTypeDescription
yboolean | Boola [[Bool]] to OR with this [[Bool]].
Returns

Bool

a new [[Bool]] that is set to true if either this [[Bool]] or y is true.

Defined in

snarky.d.ts:386


sizeInFields

sizeInFields(): number

Returns

number

Defined in

snarky.d.ts:410


toBoolean

toBoolean(): boolean

This converts the [[Bool]] to a javascript [[boolean]]. This can only be called on non-witness values.

Returns

boolean

Defined in

snarky.d.ts:428


toField

toField(): Field

Converts a [[Bool]] to a [[Field]]. false becomes 0 and true becomes 1.

Returns

Field

Defined in

snarky.d.ts:367


toFields

toFields(): Field[]

Returns

Field[]

Defined in

snarky.d.ts:411


toJSON

toJSON(): JSONValue

Serialize the [[Bool]] to a JSON string. This operation does NOT affect the circuit and can't be used to prove anything about the string representation of the Field.

Returns

JSONValue

Defined in

snarky.d.ts:422


toString

toString(): string

Serialize the [[Bool]] to a string, e.g. for printing. This operation does NOT affect the circuit and can't be used to prove anything about the string representation of the Field.

Returns

string

Defined in

snarky.d.ts:417


and

Static and(x, y): Bool

Parameters
NameType
xboolean | Bool
yboolean | Bool
Returns

Bool

Defined in

snarky.d.ts:453


assertEqual

Static assertEqual(x, y): void

Parameters
NameType
xboolean | Bool
yboolean | Bool
Returns

void

Defined in

snarky.d.ts:456


count

Static count(x): Field

Parameters
NameType
xboolean[] | Bool
Returns

Field

Defined in

snarky.d.ts:460


equal

Static equal(x, y): Bool

Parameters
NameType
xboolean | Bool
yboolean | Bool
Returns

Bool

Defined in

snarky.d.ts:458


fromJSON

Static fromJSON(x): null | Bool

Parameters
NameType
xJSONValue
Returns

null | Bool

Defined in

snarky.d.ts:467


not

Static not(x): Bool

Parameters
NameType
xboolean | Bool
Returns

Bool

Defined in

snarky.d.ts:452


ofFields

Static ofFields(fields): Bool

Parameters
NameType
fieldsField[]
Returns

Bool

Defined in

snarky.d.ts:464


or

Static or(x, y): Bool

Parameters
NameType
xboolean | Bool
yboolean | Bool
Returns

Bool

Defined in

snarky.d.ts:454


sizeInFields

Static sizeInFields(): number

Returns

number

Defined in

snarky.d.ts:462


toField

Static toField(x): Field

Parameters
NameType
xboolean | Bool
Returns

Field

Defined in

snarky.d.ts:440


toFields

Static toFields(x): Field[]

Parameters
NameType
xboolean | Bool
Returns

Field[]

Defined in

snarky.d.ts:463


toJSON

Static toJSON(x): JSONValue

Parameters
NameType
xBool
Returns

JSONValue

Defined in

snarky.d.ts:466

snarkyjs / Exports / Character

Class: Character

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Character(value)

Parameters
NameType
valueField
Overrides

CircuitValue.constructor

Defined in

lib/string.ts:11

Properties

value

value: Field

Defined in

lib/string.ts:9

Methods

assertEquals

assertEquals(this, x): void

Parameters
NameType
thisCharacter
xCharacter
Returns

void

Inherited from

CircuitValue.assertEquals

Defined in

lib/circuit_value.ts:58


equals

equals(this, x): Bool

Parameters
NameType
thisCharacter
xCharacter
Returns

Bool

Inherited from

CircuitValue.equals

Defined in

lib/circuit_value.ts:54


isNull

isNull(): Bool

Returns

Bool

Defined in

lib/string.ts:16


toField

toField(): Field

Returns

Field

Defined in

lib/string.ts:20


toFields

toFields(): Field[]

Returns

Field[]

Inherited from

CircuitValue.toFields

Defined in

lib/circuit_value.ts:46


toJSON

toJSON(): JSONValue

Returns

JSONValue

Inherited from

CircuitValue.toJSON

Defined in

lib/circuit_value.ts:50


toString

toString(): string

Returns

string

Defined in

lib/string.ts:24


check

Static check(c): void

Parameters
NameType
cCharacter
Returns

void

Defined in

lib/string.ts:36


fromJSON

Static fromJSON<T>(this, value): null | T

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
valueJSONValue
Returns

null | T

Inherited from

CircuitValue.fromJSON

Defined in

lib/circuit_value.ts:92


fromString

Static fromString(str): Character

Parameters
NameType
strstring
Returns

Character

Defined in

lib/string.ts:29


ofFields

Static ofFields<T>(this, xs): T

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
xsField[]
Returns

T

Inherited from

CircuitValue.ofFields

Defined in

lib/circuit_value.ts:62


sizeInFields

Static sizeInFields(): number

Returns

number

Inherited from

CircuitValue.sizeInFields

Defined in

lib/circuit_value.ts:26


toConstant

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

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
tT
Returns

T

Inherited from

CircuitValue.toConstant

Defined in

lib/circuit_value.ts:76


toFields

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

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
vT
Returns

Field[]

Inherited from

CircuitValue.toFields

Defined in

lib/circuit_value.ts:31


toJSON

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

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
vT
Returns

JSONValue

Inherited from

CircuitValue.toJSON

Defined in

lib/circuit_value.ts:81

snarkyjs / Exports / Circuit

Class: Circuit

Table of contents

Constructors

Methods

Constructors

constructor

new Circuit()

Methods

addConstraint

Static addConstraint(this, kind, x, y, z): void

Parameters
NameType
thisCircuit
kind"multiply"
xField
yField
zField
Returns

void

Defined in

snarky.d.ts:484

Static addConstraint(this, kind, x, y, z): void

Parameters
NameType
thisCircuit
kind"add"
xField
yField
zField
Returns

void

Defined in

snarky.d.ts:491

Static addConstraint(this, kind, x, y, z): void

Parameters
NameType
thisCircuit
kind"equal"
xField
yField
zField
Returns

void

Defined in

snarky.d.ts:498

Static addConstraint(this, kind, x, y, z): void

Parameters
NameType
thisCircuit
kind"boolean"
xField
yField
zField
Returns

void

Defined in

snarky.d.ts:505


array

Static array<T>(ctor, length): AsFieldElements<T[]>

Type parameters
Name
T
Parameters
NameType
ctorAsFieldElements<T>
lengthnumber
Returns

AsFieldElements<T[]>

Defined in

snarky.d.ts:525


asProver

Static asProver(f): void

Parameters
NameType
f() => void
Returns

void

Defined in

snarky.d.ts:521


assertEqual

Static assertEqual<T>(ctor, x, y): void

Type parameters
Name
T
Parameters
NameType
ctorObject
ctor.toFields(x: T) => Field[]
xT
yT
Returns

void

Defined in

snarky.d.ts:530

Static assertEqual<T>(x, y): void

Type parameters
Name
T
Parameters
NameType
xT
yT
Returns

void

Defined in

snarky.d.ts:532


equal

Static equal<T>(ctor, x, y): Bool

Type parameters
Name
T
Parameters
NameType
ctorObject
ctor.toFields(x: T) => Field[]
xT
yT
Returns

Bool

Defined in

snarky.d.ts:534

Static equal<T>(x, y): Bool

Type parameters
Name
T
Parameters
NameType
xT
yT
Returns

Bool

Defined in

snarky.d.ts:536


generateKeypair

Static generateKeypair(): Keypair

Returns

Keypair

Defined in

snarky.d.ts:542


if

Static if<T>(b, ctor, x, y): T

Type parameters
Name
T
Parameters
NameType
bboolean | Bool
ctorAsFieldElements<T>
xT
yT
Returns

T

Defined in

snarky.d.ts:538

Static if<T>(b, x, y): T

Type parameters
Name
T
Parameters
NameType
bboolean | Bool
xT
yT
Returns

T

Defined in

snarky.d.ts:540


inCheckedComputation

Static inCheckedComputation(): boolean

Returns

boolean

Defined in

snarky.d.ts:552


inProver

Static inProver(): boolean

Returns

boolean

Defined in

snarky.d.ts:550


newVariable

Static newVariable(f): Field

Parameters
NameType
f() => string | number | boolean | Field
Returns

Field

Defined in

snarky.d.ts:513


prove

Static prove(privateInput, publicInput, kp): Proof

Parameters
NameType
privateInputany[]
publicInputany[]
kpKeypair
Returns

Proof

Defined in

snarky.d.ts:544


runAndCheck

Static runAndCheck<T>(f): T

Type parameters
Name
T
Parameters
NameType
f() => T
Returns

T

Defined in

snarky.d.ts:523


toFields

Static toFields<A>(a): Field[]

Type parameters
Name
A
Parameters
NameType
aA
Returns

Field[]

Defined in

snarky.d.ts:548


verify

Static verify(publicInput, vk, pi): boolean

Parameters
NameType
publicInputany[]
vkVerificationKey
piProof
Returns

boolean

Defined in

snarky.d.ts:546


witness

Static witness<T, S>(ctor, f): T

Type parameters
NameType
TT
Sextends AsFieldElements<T, S> = AsFieldElements<T>
Parameters
NameType
ctorS
f() => T
Returns

T

Defined in

snarky.d.ts:516

snarkyjs / Exports / CircuitString

Class: CircuitString

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new CircuitString(values)

Parameters
NameType
valuesCharacter[]
Overrides

CircuitValue.constructor

Defined in

lib/string.ts:45

Properties

values

values: Character[]

Defined in

lib/string.ts:43


maxLength

Static maxLength: number = DEFAULT_STRING_LENGTH

Defined in

lib/string.ts:42

Methods

append

append(str): CircuitString

appends another string to this one, returns the result and proves that it fits within the maxLength of this string (the other string can have a different maxLength)

Parameters
NameType
strCircuitString
Returns

CircuitString

Defined in

lib/string.ts:85


assertEquals

assertEquals(this, x): void

Parameters
NameType
thisCircuitString
xCircuitString
Returns

void

Inherited from

CircuitValue.assertEquals

Defined in

lib/circuit_value.ts:58


computeLengthAndMask

Private computeLengthAndMask(): Object

Returns

Object

NameType
lengthField
maskBool[]
Defined in

lib/string.ts:55


equals

equals(this, x): Bool

Parameters
NameType
thisCircuitString
xCircuitString
Returns

Bool

Inherited from

CircuitValue.equals

Defined in

lib/circuit_value.ts:54


hash

hash(): Field

returns true if str is found in this CircuitString

Returns

Field

Defined in

lib/string.ts:121


length

Private length(): Field

Returns

Field

Defined in

lib/string.ts:77


lengthMask

Private lengthMask(): Bool[]

Returns

Bool[]

Defined in

lib/string.ts:74


maxLength

Private maxLength(): number

Returns

number

Defined in

lib/string.ts:50


substring

substring(start, end): CircuitString

Parameters
NameType
startnumber
endnumber
Returns

CircuitString

Defined in

lib/string.ts:125


toFields

toFields(): Field[]

Returns

Field[]

Inherited from

CircuitValue.toFields

Defined in

lib/circuit_value.ts:46


toJSON

toJSON(): JSONValue

Returns

JSONValue

Inherited from

CircuitValue.toJSON

Defined in

lib/circuit_value.ts:50


toString

toString(): string

Returns

string

Defined in

lib/string.ts:129


fromJSON

Static fromJSON<T>(this, value): null | T

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
valueJSONValue
Returns

null | T

Inherited from

CircuitValue.fromJSON

Defined in

lib/circuit_value.ts:92


fromString

Static fromString(str): CircuitString

Parameters
NameType
strstring
Returns

CircuitString

Defined in

lib/string.ts:136


ofFields

Static ofFields<T>(this, xs): T

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
xsField[]
Returns

T

Inherited from

CircuitValue.ofFields

Defined in

lib/circuit_value.ts:62


sizeInFields

Static sizeInFields(): number

Returns

number

Inherited from

CircuitValue.sizeInFields

Defined in

lib/circuit_value.ts:26


toConstant

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

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
tT
Returns

T

Inherited from

CircuitValue.toConstant

Defined in

lib/circuit_value.ts:76


toFields

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

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
vT
Returns

Field[]

Inherited from

CircuitValue.toFields

Defined in

lib/circuit_value.ts:31


toJSON

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

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
vT
Returns

JSONValue

Inherited from

CircuitValue.toJSON

Defined in

lib/circuit_value.ts:81

snarkyjs / Exports / CircuitValue

Class: CircuitValue

Hierarchy

Table of contents

Constructors

Methods

Constructors

constructor

new CircuitValue()

Methods

assertEquals

assertEquals(this, x): void

Parameters
NameType
thisCircuitValue
xCircuitValue
Returns

void

Defined in

lib/circuit_value.ts:58


equals

equals(this, x): Bool

Parameters
NameType
thisCircuitValue
xCircuitValue
Returns

Bool

Defined in

lib/circuit_value.ts:54


toFields

toFields(): Field[]

Returns

Field[]

Defined in

lib/circuit_value.ts:46


toJSON

toJSON(): JSONValue

Returns

JSONValue

Defined in

lib/circuit_value.ts:50


fromJSON

Static fromJSON<T>(this, value): null | T

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
valueJSONValue
Returns

null | T

Defined in

lib/circuit_value.ts:92


ofFields

Static ofFields<T>(this, xs): T

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
xsField[]
Returns

T

Defined in

lib/circuit_value.ts:62


sizeInFields

Static sizeInFields(): number

Returns

number

Defined in

lib/circuit_value.ts:26


toConstant

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

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
tT
Returns

T

Defined in

lib/circuit_value.ts:76


toFields

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

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
vT
Returns

Field[]

Defined in

lib/circuit_value.ts:31


toJSON

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

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
vT
Returns

JSONValue

Defined in

lib/circuit_value.ts:81

snarkyjs / Exports / EndoScalar

Class: EndoScalar

Table of contents

Constructors

Methods

Constructors

constructor

new EndoScalar()

Methods

ofFields

Static ofFields(fields): Scalar

Parameters
NameType
fieldsField[]
Returns

Scalar

Defined in

snarky.d.ts:602


sizeInFields

Static sizeInFields(): number

Returns

number

Defined in

snarky.d.ts:603


toFields

Static toFields(x): Field[]

Parameters
NameType
xScalar
Returns

Field[]

Defined in

snarky.d.ts:601

snarkyjs / Exports / Field

Class: Field

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Field(x)

Coerces anything field-like to a [[Field]].

Parameters
NameType
xstring | number | bigint | boolean | Field
Defined in

snarky.d.ts:31

Properties

ORDER

Static ORDER: bigint

The field order as a bigint.

Defined in

snarky.d.ts:269


minusOne

Static minusOne: Field

The number -1 as a [[Field]].

Defined in

snarky.d.ts:265


one

Static one: Field

The number 1 as a [[Field]].

Defined in

snarky.d.ts:257


zero

Static zero: Field

The number 0 as a [[Field]].

Defined in

snarky.d.ts:261

Methods

add

add(y): Field

Adds this [[Field]] element to another coercible to a field.

Parameters
NameType
ystring | number | boolean | Field
Returns

Field

Defined in

snarky.d.ts:59


assertBoolean

assertBoolean(): void

Assert that this [[Field]] is either 0 or 1.

Field.zero.assertBoolean();

This function can only be called inside a checked computation, like a SmartContract method, and throws an error if the assertion fails.

Returns

void

Defined in

snarky.d.ts:219


assertEquals

assertEquals(y): void

Assert that this [[Field]] equals another Field-like value. Throws an error if the assertion fails.

Field.one.assertEquals(1);
Parameters
NameType
ystring | number | boolean | Field
Returns

void

Defined in

snarky.d.ts:208


assertGt

assertGt(y): void

Assert that this [[Field]] is greater than another Field-like value.

Field.one.assertGt(0);

This function can only be called inside a checked computation, like a SmartContract method, and causes it to fail if the assertion fails.

Parameters
NameType
ystring | number | boolean | Field
Returns

void

Defined in

snarky.d.ts:187


assertGte

assertGte(y): void

Assert that this [[Field]] is greater than or equal to another Field-like value.

Field.one.assertGte(0);

This function can only be called inside a checked computation, like a SmartContract method, and causes it to fail if the assertion fails.

Parameters
NameType
ystring | number | boolean | Field
Returns

void

Defined in

snarky.d.ts:198


assertLt

assertLt(y): void

Assert that this [[Field]] is lower than another Field-like value.

Field.one.assertLt(2);

This function can only be called inside a checked computation, like a SmartContract method, and causes it to fail if the assertion fails.

Parameters
NameType
ystring | number | boolean | Field
Returns

void

Defined in

snarky.d.ts:165


assertLte

assertLte(y): void

Assert that this [[Field]] is lower than or equal to another Field-like value.

Field.one.assertLte(2);

This function can only be called inside a checked computation, like a SmartContract method, and causes it to fail if the assertion fails.

Parameters
NameType
ystring | number | boolean | Field
Returns

void

Defined in

snarky.d.ts:176


div

div(y): Field

Divides this [[Field]] element through another coercible to a field.

Parameters
NameType
ystring | number | boolean | Field
Returns

Field

Defined in

snarky.d.ts:74


equals

equals(y): Bool

Check if this [[Field]] equals another [[Field]]-like value. Returns a [[Bool]].

Field(2).equals(2); // Bool(true)
Parameters
NameType
ystring | number | boolean | Field
Returns

Bool

Defined in

snarky.d.ts:241


gt

gt(y): Bool

Check if this [[Field]] is greater than another Field-like value. Returns a [[Bool]].

Field(2).gt(1); // Bool(true)
Parameters
NameType
ystring | number | boolean | Field
Returns

Bool

Defined in

snarky.d.ts:143


gte

gte(y): Bool

Check if this [[Field]] is greater than or equal to another Field-like value. Returns a [[Bool]].

Field(2).gte(1); // Bool(true)
Parameters
NameType
ystring | number | boolean | Field
Returns

Bool

Defined in

snarky.d.ts:152


inv

inv(): Field

Inverts this [[Field]] element.

const invX = x.inv();
invX.assertEquals(Field.one.div(x));
Returns

Field

A field element that is equivalent to one divided by this element.

Defined in

snarky.d.ts:54


isConstant

isConstant(): boolean

Returns

boolean

Defined in

snarky.d.ts:248


isZero

isZero(): Bool

Returns

Bool

Defined in

snarky.d.ts:220


lt

lt(y): Bool

Check if this [[Field]] is lower than another Field-like value. Returns a [[Bool]].

Field(2).lt(3); // Bool(true)
Parameters
NameType
ystring | number | boolean | Field
Returns

Bool

Defined in

snarky.d.ts:125


lte

lte(y): Bool

Check if this [[Field]] is lower than or equal to another Field-like value. Returns a [[Bool]].

Field(2).lte(3); // Bool(true)
Parameters
NameType
ystring | number | boolean | Field
Returns

Bool

Defined in

snarky.d.ts:134


mul

mul(y): Field

Multiplies this [[Field]] element with another coercible to a field.

Parameters
NameType
ystring | number | boolean | Field
Returns

Field

Defined in

snarky.d.ts:69


neg

neg(): Field

Negates this [[Field]]. This is equivalent to multiplying the [[Field]] by -1.

const negOne = Field.one.neg();
negOne.assertEquals(-1);
Returns

Field

Defined in

snarky.d.ts:42


ofFields

ofFields(fields): Field

Parameters
NameType
fieldsField[]
Returns

Field

Defined in

snarky.d.ts:304


rangeCheckHelper

rangeCheckHelper(numBits): Field

Parameters
NameType
numBitsnumber
Returns

Field

Defined in

snarky.d.ts:246


seal

seal(): Field

Returns

Field

Defined in

snarky.d.ts:244


sizeInFields

sizeInFields(): number

Returns

number

Defined in

snarky.d.ts:112


sqrt

sqrt(): Field

Square roots this [[Field]] element.

x.square().sqrt().assertEquals(x);
Returns

Field

Defined in

snarky.d.ts:93


square

square(): Field

Squares this [[Field]] element.

const x2 = x.square();
x2.assertEquals(x.mul(x));
Returns

Field

Defined in

snarky.d.ts:84


sub

sub(y): Field

Subtracts another [[Field]]-like element from this one.

Parameters
NameType
ystring | number | boolean | Field
Returns

Field

Defined in

snarky.d.ts:64


toBigInt

toBigInt(): bigint

Serialize the [[Field]] to a bigint. This operation does NOT affect the circuit and can't be used to prove anything about the bigint representation of the Field.

Returns

bigint

Defined in

snarky.d.ts:104


toBits

toBits(): Bool[]

Little endian binary representation of the field element.

Returns

Bool[]

Defined in

snarky.d.ts:225

toBits(length): Bool[]

Little endian binary representation of the field element. Fails if the field element cannot fit in length bits.

Parameters
NameType
lengthnumber
Returns

Bool[]

Defined in

snarky.d.ts:231


toConstant

toConstant(): Field

Returns

Field

Defined in

snarky.d.ts:249


toFields

toFields(): Field[]

Returns

Field[]

Defined in

snarky.d.ts:114


toJSON

toJSON(): JSONValue

Serialize the [[Field]] to a JSON string. This operation does NOT affect the circuit and can't be used to prove anything about the string representation of the Field.

Returns

JSONValue

Defined in

snarky.d.ts:109


toString

toString(): string

Serialize the [[Field]] to a string, e.g. for printing. This operation does NOT affect the circuit and can't be used to prove anything about the string representation of the Field.

Returns

string

Defined in

snarky.d.ts:99


fromBigInt

Static fromBigInt(x): Field

Parameters
NameType
xbigint
Returns

Field

Defined in

snarky.d.ts:346


fromJSON

Static fromJSON(x): null | Field

Parameters
NameType
xJSONValue
Returns

null | Field

Defined in

snarky.d.ts:342


fromNumber

Static fromNumber(x): Field

Parameters
NameType
xnumber
Returns

Field

Defined in

snarky.d.ts:345


fromString

Static fromString(x): Field

Parameters
NameType
xstring
Returns

Field

Defined in

snarky.d.ts:344


ofBits

Static ofBits(x): Field

Converts a bit array into a field element (little endian) Fails if the field element cannot fit given too many bits.

TODO: Rename to fromBits

Parameters
NameType
x(boolean | Bool)[]
Returns

Field

Defined in

snarky.d.ts:328


ofFields

Static ofFields(fields): Field

Parameters
NameType
fieldsField[]
Returns

Field

Defined in

snarky.d.ts:307


random

Static random(): Field

A random field element.

Returns

Field

Defined in

snarky.d.ts:274


sizeInFields

Static sizeInFields(): number

Returns

number

Defined in

snarky.d.ts:309


toFields

Static toFields(x): Field[]

Parameters
NameType
xField
Returns

Field[]

Defined in

snarky.d.ts:311

snarkyjs / Exports / Group

Class: Group

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Group(args)

Parameters
NameType
argsObject
args.xstring | number | boolean | Field
args.ystring | number | boolean | Field
Defined in

snarky.d.ts:621

new Group(x, y)

Parameters
NameType
xstring | number | boolean | Field
ystring | number | boolean | Field
Defined in

snarky.d.ts:625

Properties

x

x: Field

Defined in

snarky.d.ts:607


y

y: Field

Defined in

snarky.d.ts:608


generator

Static generator: Group

Defined in

snarky.d.ts:630

Methods

add

add(y): Group

Parameters
NameType
yGroup
Returns

Group

Defined in

snarky.d.ts:610


assertEquals

assertEquals(y): void

Parameters
NameType
yGroup
Returns

void

Defined in

snarky.d.ts:616


equals

equals(y): Bool

Parameters
NameType
yGroup
Returns

Bool

Defined in

snarky.d.ts:617


neg

neg(): Group

Returns

Group

Defined in

snarky.d.ts:612


scale

scale(y): Group

Parameters
NameType
yScalar
Returns

Group

Defined in

snarky.d.ts:613


sub

sub(y): Group

Parameters
NameType
yGroup
Returns

Group

Defined in

snarky.d.ts:611


toJSON

toJSON(): JSONValue

Returns

JSONValue

Defined in

snarky.d.ts:619


add

Static add(x, y): Group

Parameters
NameType
xGroup
yGroup
Returns

Group

Defined in

snarky.d.ts:631


assertEqual

Static assertEqual(x, y): void

Parameters
NameType
xGroup
yGroup
Returns

void

Defined in

snarky.d.ts:637


equal

Static equal(x, y): Bool

Parameters
NameType
xGroup
yGroup
Returns

Bool

Defined in

snarky.d.ts:638


fromJSON

Static fromJSON(__namedParameters): null | Group

Parameters
NameType
__namedParametersObject
__namedParameters.xstring | number
__namedParameters.ystring | number
Returns

null | Group

Defined in

snarky.d.ts:645


neg

Static neg(x): Group

Parameters
NameType
xGroup
Returns

Group

Defined in

snarky.d.ts:633


ofFields

Static ofFields(fields): Group

Parameters
NameType
fieldsField[]
Returns

Group

Defined in

snarky.d.ts:641


scale

Static scale(x, y): Group

Parameters
NameType
xGroup
yScalar
Returns

Group

Defined in

snarky.d.ts:634


sizeInFields

Static sizeInFields(): number

Returns

number

Defined in

snarky.d.ts:642


sub

Static sub(x, y): Group

Parameters
NameType
xGroup
yGroup
Returns

Group

Defined in

snarky.d.ts:632


toFields

Static toFields(x): Field[]

Parameters
NameType
xGroup
Returns

Field[]

Defined in

snarky.d.ts:640


toJSON

Static toJSON(x): JSONValue

Parameters
NameType
xGroup
Returns

JSONValue

Defined in

snarky.d.ts:644

snarkyjs / Exports / Int64

Class: Int64

Hierarchy

Implements

  • BalanceChange

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new Int64(magnitude, sgn?)

Parameters
NameTypeDefault value
magnitudeUInt64undefined
sgnFieldField.one
Overrides

CircuitValue.constructor

Defined in

lib/int.ts:366

Properties

magnitude

magnitude: UInt64

Implementation of

BalanceChange.magnitude

Defined in

lib/int.ts:343


sgn

sgn: Field

Implementation of

BalanceChange.sgn

Defined in

lib/int.ts:344

Accessors

minusOne

Static get minusOne(): Int64

Returns

Int64

Defined in

lib/int.ts:433


one

Static get one(): Int64

Returns

Int64

Defined in

lib/int.ts:430


zero

Static get zero(): Int64

Returns

Int64

Defined in

lib/int.ts:427

Methods

add

add(y): Int64

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

Int64

Defined in

lib/int.ts:455


assertEquals

assertEquals(y): void

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

void

Overrides

CircuitValue.assertEquals

Defined in

lib/int.ts:484


div

div(y): Int64

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

Int64

Defined in

lib/int.ts:467


equals

equals(y): Bool

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

Bool

Overrides

CircuitValue.equals

Defined in

lib/int.ts:480


isConstant

isConstant(): boolean

Returns

boolean

Defined in

lib/int.ts:413


isPositive

isPositive(): Bool

Returns

Bool

Defined in

lib/int.ts:488


mod

mod(y): Int64

Parameters
NameType
ystring | number | bigint | UInt32 | UInt64
Returns

Int64

Defined in

lib/int.ts:473


mul

mul(y): Int64

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

Int64

Defined in

lib/int.ts:463


neg

neg(): Int64

Returns

Int64

Defined in

lib/int.ts:450


sub

sub(y): Int64

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

Int64

Defined in

lib/int.ts:459


toField

toField(): Field

Returns

Field

Defined in

lib/int.ts:437


toFields

toFields(): Field[]

Returns

Field[]

Inherited from

CircuitValue.toFields

Defined in

lib/circuit_value.ts:46


toJSON

toJSON(): JSONValue

Returns

JSONValue

Inherited from

CircuitValue.toJSON

Defined in

lib/circuit_value.ts:50


toString

toString(): string

Returns

string

Defined in

lib/int.ts:407


check

Static check(x): void

Parameters
NameType
xInt64
Returns

void

Defined in

lib/int.ts:422


from

Static from(x): Int64

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

Int64

Defined in

lib/int.ts:390


fromBigInt

Static fromBigInt(x): Int64

Parameters
NameType
xbigint
Returns

Int64

Defined in

lib/int.ts:403


fromField

Static fromField(x): Int64

Parameters
NameType
xField
Returns

Int64

Defined in

lib/int.ts:441


fromFieldUnchecked

Static Private fromFieldUnchecked(x): Int64

Parameters
NameType
xField
Returns

Int64

Defined in

lib/int.ts:372


fromJSON

Static fromJSON<T>(this, value): null | T

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
valueJSONValue
Returns

null | T

Inherited from

CircuitValue.fromJSON

Defined in

lib/circuit_value.ts:92


fromNumber

Static fromNumber(x): Int64

Parameters
NameType
xnumber
Returns

Int64

Defined in

lib/int.ts:397


fromString

Static fromString(x): Int64

Parameters
NameType
xstring
Returns

Int64

Defined in

lib/int.ts:400


fromUnsigned

Static fromUnsigned(x): Int64

Parameters
NameType
xUInt32 | UInt64
Returns

Int64

Defined in

lib/int.ts:385


ofFields

Static ofFields<T>(this, xs): T

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
xsField[]
Returns

T

Inherited from

CircuitValue.ofFields

Defined in

lib/circuit_value.ts:62


sizeInFields

Static sizeInFields(): number

Returns

number

Inherited from

CircuitValue.sizeInFields

Defined in

lib/circuit_value.ts:26


toConstant

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

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
tT
Returns

T

Inherited from

CircuitValue.toConstant

Defined in

lib/circuit_value.ts:76


toFields

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

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
vT
Returns

Field[]

Inherited from

CircuitValue.toFields

Defined in

lib/circuit_value.ts:31


toJSON

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

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
vT
Returns

JSONValue

Inherited from

CircuitValue.toJSON

Defined in

lib/circuit_value.ts:81

snarkyjs / Exports / Keypair

Class: Keypair

Contains a proving key and [[VerificationKey]] which can be used to verify proofs.

Table of contents

Constructors

Methods

Constructors

constructor

new Keypair()

Methods

verificationKey

verificationKey(): VerificationKey

Returns

VerificationKey

Defined in

snarky.d.ts:676

snarkyjs / Exports / Ledger

Class: Ledger

Table of contents

Constructors

Methods

Constructors

constructor

new Ledger()

Methods

addAccount

addAccount(publicKey, balance): void

Parameters
NameType
publicKeyObject
publicKey.gGroup
balancestring
Returns

void

Defined in

snarky.d.ts:706


applyJsonTransaction

applyJsonTransaction(txJson, accountCreationFee): Account[]

Parameters
NameType
txJsonstring
accountCreationFeestring
Returns

Account[]

Defined in

snarky.d.ts:708


getAccount

getAccount(publicKey): undefined | Account

Parameters
NameType
publicKeyObject
publicKey.gGroup
Returns

undefined | Account

Defined in

snarky.d.ts:710


create

Static create(genesisAccounts): Ledger

Parameters
NameType
genesisAccounts{ balance: string ; publicKey: { g: Group } }[]
Returns

Ledger

Defined in

snarky.d.ts:702


fieldOfBase58

Static fieldOfBase58(fieldBase58): Field

Parameters
NameType
fieldBase58string
Returns

Field

Defined in

snarky.d.ts:741


fieldToBase58

Static fieldToBase58(field): string

Parameters
NameType
fieldField
Returns

string

Defined in

snarky.d.ts:740


fieldsOfJson

Static fieldsOfJson(json): Field[]

Parameters
NameType
jsonstring
Returns

Field[]

Defined in

snarky.d.ts:744


hashPartyFromFields

Static hashPartyFromFields(fields): Field

Parameters
NameType
fieldsField[]
Returns

Field

Defined in

snarky.d.ts:745


hashTransaction

Static hashTransaction(partyHash): Field

Parameters
NameType
partyHashField
Returns

Field

Defined in

snarky.d.ts:712


hashTransactionChecked

Static hashTransactionChecked(partyHash): Field

Parameters
NameType
partyHashField
Returns

Field

Defined in

snarky.d.ts:713


memoToBase58

Static memoToBase58(memoString): string

Parameters
NameType
memoStringstring
Returns

string

Defined in

snarky.d.ts:742


privateKeyOfString

Static privateKeyOfString(privateKeyBase58): Scalar

Parameters
NameType
privateKeyBase58string
Returns

Scalar

Defined in

snarky.d.ts:739


privateKeyToString

Static privateKeyToString(privateKey): string

Parameters
NameType
privateKeyObject
privateKey.sScalar
Returns

string

Defined in

snarky.d.ts:738


publicKeyOfString

Static publicKeyOfString(publicKeyBase58): Group

Parameters
NameType
publicKeyBase58string
Returns

Group

Defined in

snarky.d.ts:737


publicKeyToString

Static publicKeyToString(publicKey): string

Parameters
NameType
publicKeyObject
publicKey.gGroup
Returns

string

Defined in

snarky.d.ts:736


signFeePayer

Static signFeePayer(txJson, privateKey): string

Parameters
NameType
txJsonstring
privateKeyObject
privateKey.sScalar
Returns

string

Defined in

snarky.d.ts:724


signFieldElement

Static signFieldElement(messageHash, privateKey): string

Parameters
NameType
messageHashField
privateKeyObject
privateKey.sScalar
Returns

string

Defined in

snarky.d.ts:720


signOtherParty

Static signOtherParty(txJson, privateKey, i): string

Parameters
NameType
txJsonstring
privateKeyObject
privateKey.sScalar
inumber
Returns

string

Defined in

snarky.d.ts:725


transactionCommitments

Static transactionCommitments(txJson): Object

Parameters
NameType
txJsonstring
Returns

Object

NameType
commitmentField
fullCommitmentField
Defined in

snarky.d.ts:715


transactionStatement

Static transactionStatement(txJson, partyIndex): Statement

Parameters
NameType
txJsonstring
partyIndexnumber
Returns

Statement

Defined in

snarky.d.ts:719


verifyPartyProof

Static verifyPartyProof(statement, proof, verificationKey): Promise<boolean>

Parameters
NameType
statementStatement
proofstring
verificationKeystring
Returns

Promise<boolean>

Defined in

snarky.d.ts:730

snarkyjs / Exports / Party

Class: Party

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new Party(body, authorization?)

Parameters
NameType
bodyBody
authorization?LazyControl
Defined in

lib/party.ts:492

Properties

account

account: PreconditionClassType<AccountPrecondition>

Defined in

lib/party.ts:487


authorization

authorization: LazyControl

Defined in

lib/party.ts:486


body

body: Body

Defined in

lib/party.ts:485


isSelf

Private isSelf: boolean

Defined in

lib/party.ts:490


network

network: PreconditionClassType<{ blockchainLength: { lower: UInt32 ; upper: UInt32 } ; globalSlotSinceGenesis: { lower: UInt32 ; upper: UInt32 } ; globalSlotSinceHardFork: { lower: UInt32 ; upper: UInt32 } ; minWindowDensity: { lower: UInt32 ; upper: UInt32 } ; nextEpochData: { epochLength: { lower: UInt32 ; upper: UInt32 } ; ledger: { hash: { isSome: Bool ; value: Field } ; totalCurrency: { lower: UInt64 ; upper: UInt64 } } ; lockCheckpoint: { isSome: Bool ; value: Field } ; seed: { isSome: Bool ; value: Field } ; startCheckpoint: { isSome: Bool ; value: Field } } ; snarkedLedgerHash: { isSome: Bool ; value: Field } ; stakingEpochData: { epochLength: { lower: UInt32 ; upper: UInt32 } ; ledger: { hash: { isSome: Bool ; value: Field } ; totalCurrency: { lower: UInt64 ; upper: UInt64 } } ; lockCheckpoint: { isSome: Bool ; value: Field } ; seed: { isSome: Bool ; value: Field } ; startCheckpoint: { isSome: Bool ; value: Field } } ; timestamp: { lower: UInt64 ; upper: UInt64 } ; totalCurrency: { lower: UInt64 ; upper: UInt64 } }>

Defined in

lib/party.ts:488

Accessors

balance

get balance(): Object

Returns

Object

NameType
addInPlace(x: string | number | bigint | UInt32 | UInt64 | Int64) => void
subInPlace(x: string | number | bigint | UInt32 | UInt64 | Int64) => void
Defined in

lib/party.ts:508


publicKey

get publicKey(): PublicKey

Returns

PublicKey

Defined in

lib/party.ts:579


update

get update(): Object

Returns

Object

NameType
appState{ isSome: Bool ; value: Field }[]
delegate{ isSome: Bool ; value: PublicKey }
delegate.isSomeBool
delegate.valuePublicKey
permissions{ isSome: Bool ; value: { editSequenceState: AuthRequired ; editState: AuthRequired ; incrementNonce: AuthRequired ; receive: AuthRequired ; send: AuthRequired ; setDelegate: AuthRequired ; setPermissions: AuthRequired ; setTokenSymbol: AuthRequired ; setVerificationKey: AuthRequired ; setVotingFor: AuthRequired ; setZkappUri: AuthRequired } }
permissions.isSomeBool
permissions.value{ editSequenceState: AuthRequired ; editState: AuthRequired ; incrementNonce: AuthRequired ; receive: AuthRequired ; send: AuthRequired ; setDelegate: AuthRequired ; setPermissions: AuthRequired ; setTokenSymbol: AuthRequired ; setVerificationKey: AuthRequired ; setVotingFor: AuthRequired ; setZkappUri: AuthRequired }
permissions.value.editSequenceStateAuthRequired
permissions.value.editStateAuthRequired
permissions.value.incrementNonceAuthRequired
permissions.value.receiveAuthRequired
permissions.value.sendAuthRequired
permissions.value.setDelegateAuthRequired
permissions.value.setPermissionsAuthRequired
permissions.value.setTokenSymbolAuthRequired
permissions.value.setVerificationKeyAuthRequired
permissions.value.setVotingForAuthRequired
permissions.value.setZkappUriAuthRequired
timing{ isSome: Bool ; value: { cliffAmount: UInt64 ; cliffTime: UInt32 ; initialMinimumBalance: UInt64 ; vestingIncrement: UInt64 ; vestingPeriod: UInt32 } }
timing.isSomeBool
timing.value{ cliffAmount: UInt64 ; cliffTime: UInt32 ; initialMinimumBalance: UInt64 ; vestingIncrement: UInt64 ; vestingPeriod: UInt32 }
timing.value.cliffAmountUInt64
timing.value.cliffTimeUInt32
timing.value.initialMinimumBalanceUInt64
timing.value.vestingIncrementUInt64
timing.value.vestingPeriodUInt32
tokenSymbol{ isSome: Bool ; value: { data: string ; hash: Field } }
tokenSymbol.isSomeBool
tokenSymbol.value{ data: string ; hash: Field }
tokenSymbol.value.datastring
tokenSymbol.value.hashField
verificationKey{ isSome: Bool ; value: { data: string ; hash: Field } }
verificationKey.isSomeBool
verificationKey.value{ data: string ; hash: Field }
verificationKey.value.datastring
verificationKey.value.hashField
votingFor{ isSome: Bool ; value: Field }
votingFor.isSomeBool
votingFor.valueField
zkappUri{ isSome: Bool ; value: { data: string ; hash: Field } }
zkappUri.isSomeBool
zkappUri.value{ data: string ; hash: Field }
zkappUri.value.datastring
zkappUri.value.hashField
Defined in

lib/party.ts:520

Methods

hash

hash(): Field

Returns

Field

Defined in

lib/party.ts:637


setNoncePrecondition

setNoncePrecondition(fallbackToZero?): UInt32

Parameters
NameTypeDefault value
fallbackToZerobooleanfalse
Returns

UInt32

Defined in

lib/party.ts:626


sign

sign(privateKey?): any

Parameters
NameType
privateKey?PrivateKey
Returns

any

Defined in

lib/party.ts:589


signInPlace

signInPlace(privateKey?, fallbackToZeroNonce?): void

Parameters
NameTypeDefault value
privateKey?PrivateKeyundefined
fallbackToZeroNoncebooleanfalse
Returns

void

Defined in

lib/party.ts:583


toFields

toFields(): Field[]

Returns

Field[]

Defined in

lib/party.ts:633


assertBetween

Static assertBetween<T>(property, lower, upper): void

Constrain a property to lie between lower and upper bounds.

Type parameters
Name
T
Parameters
NameTypeDescription
propertyClosedInterval<T>The property to constrain
lowerTThe lower bound
upperTThe upper bound Example: To constrain the account balance of a SmartContract to lie between 0 and 20 MINA, you can use ts @method onlyRunsWhenBalanceIsLow() { let lower = UInt64.zero; let upper = UInt64.fromNumber(20e9); Party.assertBetween(this.self.body.accountPrecondition.balance, lower, upper); // ... }
Returns

void

Defined in

lib/party.ts:546


assertEquals

Static assertEquals<T>(property, value): void

Fix a property to a certain value.

Type parameters
Name
T
Parameters
NameTypeDescription
propertyClosedInterval<T> | OrIgnore<T>The property to constrain
valueTThe value it is fixed to Example: To fix the account nonce of a SmartContract to 0, you can use ts @method onlyRunsWhenNonceIsZero() { Party.assertEquals(this.self.body.accountPrecondition.nonce, UInt32.zero); // ... }
Returns

void

Defined in

lib/party.ts:567


clone

Static clone(party): any

Parameters
NameType
partyParty
Returns

any

Defined in

lib/party.ts:502


createSigned

Static createSigned(signer, options?): Party

Parameters
NameType
signerPrivateKey
options?Object
options.isSameAsFeePayer?boolean | Bool
options.nonce?UInt32
Returns

Party

Defined in

lib/party.ts:679


createUnsigned

Static createUnsigned(publicKey): Party

Parameters
NameType
publicKeyPublicKey
Returns

Party

Defined in

lib/party.ts:661


defaultFeePayer

Static defaultFeePayer(address, key, nonce): FeePayerUnsigned

Parameters
NameType
addressPublicKey
keyPrivateKey
nonceUInt32
Returns

FeePayerUnsigned

Defined in

lib/party.ts:647


defaultParty

Static defaultParty(address): Party

Parameters
NameType
addressPublicKey
Returns

Party

Defined in

lib/party.ts:642


dummyFeePayer

Static dummyFeePayer(): FeePayerUnsigned

Returns

FeePayerUnsigned

Defined in

lib/party.ts:656


fundNewAccount

Static fundNewAccount(feePayerKey, initialBalance?): void

Use this method to pay the account creation fee for another account. Beware that you don't need to pass in the new account! Instead, the protocol will automatically identify accounts in your transaction that need funding.

If you provide an optional initialBalance, this will be subtracted from the fee-paying account as well, but you have to separately ensure that it's added to the new account's balance.

Parameters
NameTypeDescription
feePayerKeyPrivateKeythe private key of the account that pays the fee
initialBalanceObjectthe initial balance of the new account (default: 0)
initialBalance.initialBalanceundefined | string | number | UInt64-
initialBalance.isSameAsFeePayerundefined | boolean | Bool-
Returns

void

Defined in

lib/party.ts:745


getNonce

Static getNonce(party, fallbackToZero?): UInt32

Parameters
NameTypeDefault value
partyParty | FeePayerUnsignedundefined
fallbackToZerobooleanfalse
Returns

UInt32

Defined in

lib/party.ts:605


setValue

Static setValue<T>(maybeValue, value): void

Type parameters
Name
T
Parameters
NameType
maybeValueSetOrKeep<T>
valueT
Returns

void

Defined in

lib/party.ts:524


signFeePayerInPlace

Static signFeePayerInPlace(feePayer, privateKey?, fallbackToZeroNonce?): void

Parameters
NameTypeDefault value
feePayerFeePayerUnsignedundefined
privateKey?PrivateKeyundefined
fallbackToZeroNoncebooleanfalse
Returns

void

Defined in

lib/party.ts:595

snarkyjs / Exports / PrivateKey

Class: PrivateKey

A signing key. You can generate one via random.

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new PrivateKey(s)

Parameters
NameType
sScalar
Overrides

CircuitValue.constructor

Defined in

lib/signature.ts:10

Properties

s

s: Scalar

Defined in

lib/signature.ts:8

Methods

assertEquals

assertEquals(this, x): void

Parameters
NameType
thisPrivateKey
xPrivateKey
Returns

void

Inherited from

CircuitValue.assertEquals

Defined in

lib/circuit_value.ts:58


equals

equals(this, x): Bool

Parameters
NameType
thisPrivateKey
xPrivateKey
Returns

Bool

Inherited from

CircuitValue.equals

Defined in

lib/circuit_value.ts:54


toBase58

toBase58(): string

Returns

string

Defined in

lib/signature.ts:49


toFields

toFields(): Field[]

Returns

Field[]

Inherited from

CircuitValue.toFields

Defined in

lib/circuit_value.ts:46


toJSON

toJSON(): JSONValue

Returns

JSONValue

Inherited from

CircuitValue.toJSON

Defined in

lib/circuit_value.ts:50


toPublicKey

toPublicKey(): PublicKey

Derives the associated public key.

Returns

PublicKey

a PublicKey.

Defined in

lib/signature.ts:41


fromBase58

Static fromBase58(privateKeyBase58): PrivateKey

Parameters
NameType
privateKeyBase58string
Returns

PrivateKey

Defined in

lib/signature.ts:45


fromJSON

Static fromJSON<T>(this, value): null | T

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
valueJSONValue
Returns

null | T

Inherited from

CircuitValue.fromJSON

Defined in

lib/circuit_value.ts:92


ofBits

Static ofBits(bs): PrivateKey

Deserializes a list of bits into a PrivateKey.

Parameters
NameTypeDescription
bsBool[]a list of Bools.
Returns

PrivateKey

a PrivateKey.

Defined in

lib/signature.ts:32


ofFields

Static ofFields<T>(this, xs): T

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
xsField[]
Returns

T

Inherited from

CircuitValue.ofFields

Defined in

lib/circuit_value.ts:62


random

Static random(): PrivateKey

You can use this method to generate a private key. You can then obtain the associated public key via toPublicKey. And generate signatures via Signature.create.

Returns

PrivateKey

a new PrivateKey.

Defined in

lib/signature.ts:22


sizeInFields

Static sizeInFields(): number

Returns

number

Inherited from

CircuitValue.sizeInFields

Defined in

lib/circuit_value.ts:26


toBase58

Static toBase58(privateKey): string

Parameters
NameType
privateKeyObject
privateKey.sScalar
Returns

string

Defined in

lib/signature.ts:53


toConstant

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

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
tT
Returns

T

Inherited from

CircuitValue.toConstant

Defined in

lib/circuit_value.ts:76


toFields

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

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
vT
Returns

Field[]

Inherited from

CircuitValue.toFields

Defined in

lib/circuit_value.ts:31


toJSON

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

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
vT
Returns

JSONValue

Inherited from

CircuitValue.toJSON

Defined in

lib/circuit_value.ts:81

snarkyjs / Exports / Proof

Class: Proof

Proofs can be verified using a [[VerificationKey]] and the public input.

Table of contents

Constructors

Methods

Constructors

constructor

new Proof()

Methods

verify

verify(verificationKey, publicInput): boolean

Parameters
NameType
verificationKeyVerificationKey
publicInputany[]
Returns

boolean

Defined in

snarky.d.ts:683

snarkyjs / Exports / PublicKey

Class: PublicKey

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new PublicKey(g)

Parameters
NameType
gGroup
Overrides

CircuitValue.constructor

Defined in

lib/signature.ts:61

Properties

g

g: Group

Defined in

lib/signature.ts:59

Methods

assertEquals

assertEquals(this, x): void

Parameters
NameType
thisPublicKey
xPublicKey
Returns

void

Inherited from

CircuitValue.assertEquals

Defined in

lib/circuit_value.ts:58


equals

equals(this, x): Bool

Parameters
NameType
thisPublicKey
xPublicKey
Returns

Bool

Inherited from

CircuitValue.equals

Defined in

lib/circuit_value.ts:54


isEmpty

isEmpty(): Bool

Returns

Bool

Defined in

lib/signature.ts:74


toBase58

toBase58(): string

Returns

string

Defined in

lib/signature.ts:83


toFields

toFields(): Field[]

Returns

Field[]

Inherited from

CircuitValue.toFields

Defined in

lib/circuit_value.ts:46


toJSON

toJSON(): JSONValue

Returns

JSONValue

Inherited from

CircuitValue.toJSON

Defined in

lib/circuit_value.ts:50


empty

Static empty(): PublicKey

Returns

PublicKey

Defined in

lib/signature.ts:70


fromBase58

Static fromBase58(publicKeyBase58): PublicKey

Parameters
NameType
publicKeyBase58string
Returns

PublicKey

Defined in

lib/signature.ts:79


fromJSON

Static fromJSON<T>(this, value): null | T

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
valueJSONValue
Returns

null | T

Inherited from

CircuitValue.fromJSON

Defined in

lib/circuit_value.ts:92


fromPrivateKey

Static fromPrivateKey(p): PublicKey

Parameters
NameType
pPrivateKey
Returns

PublicKey

Defined in

lib/signature.ts:66


ofFields

Static ofFields<T>(this, xs): T

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
xsField[]
Returns

T

Inherited from

CircuitValue.ofFields

Defined in

lib/circuit_value.ts:62


sizeInFields

Static sizeInFields(): number

Returns

number

Inherited from

CircuitValue.sizeInFields

Defined in

lib/circuit_value.ts:26


toBase58

Static toBase58(publicKey): string

Parameters
NameType
publicKeyPublicKey
Returns

string

Defined in

lib/signature.ts:87


toConstant

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

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
tT
Returns

T

Inherited from

CircuitValue.toConstant

Defined in

lib/circuit_value.ts:76


toFields

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

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
vT
Returns

Field[]

Inherited from

CircuitValue.toFields

Defined in

lib/circuit_value.ts:31


toJSON

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

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
vT
Returns

JSONValue

Inherited from

CircuitValue.toJSON

Defined in

lib/circuit_value.ts:81

snarkyjs / Exports / Scalar

Class: Scalar

Table of contents

Constructors

Methods

Constructors

constructor

new Scalar()

Methods

add

add(y): Scalar

Add scalar field elements. Can only be called outside of circuit execution

Parameters
NameType
yScalar
Returns

Scalar

Defined in

snarky.d.ts:568


div

div(y): Scalar

Divide scalar field elements. Can only be called outside of circuit execution

Parameters
NameType
yScalar
Returns

Scalar

Defined in

snarky.d.ts:586


mul

mul(y): Scalar

Multiply scalar field elements. Can only be called outside of circuit execution

Parameters
NameType
yScalar
Returns

Scalar

Defined in

snarky.d.ts:580


neg

neg(): Scalar

Negate a scalar field element. Can only be called outside of circuit execution

Returns

Scalar

Defined in

snarky.d.ts:562


sub

sub(y): Scalar

Subtract scalar field elements. Can only be called outside of circuit execution

Parameters
NameType
yScalar
Returns

Scalar

Defined in

snarky.d.ts:574


toFields

toFields(this): Field[]

Parameters
NameType
thisScalar
Returns

Field[]

Defined in

snarky.d.ts:556


toJSON

toJSON(): JSONValue

Returns

JSONValue

Defined in

snarky.d.ts:588


fromJSON

Static fromJSON(x): null | Scalar

Parameters
NameType
xJSONValue
Returns

null | Scalar

Defined in

snarky.d.ts:597


ofBits

Static ofBits(bits): Scalar

Parameters
NameType
bitsBool[]
Returns

Scalar

Defined in

snarky.d.ts:593


ofFields

Static ofFields(fields): Scalar

Parameters
NameType
fieldsField[]
Returns

Scalar

Defined in

snarky.d.ts:591


random

Static random(): Scalar

Returns

Scalar

Defined in

snarky.d.ts:594


sizeInFields

Static sizeInFields(): number

Returns

number

Defined in

snarky.d.ts:592


toFields

Static toFields(x): Field[]

Parameters
NameType
xScalar
Returns

Field[]

Defined in

snarky.d.ts:590


toJSON

Static toJSON(x): JSONValue

Parameters
NameType
xScalar
Returns

JSONValue

Defined in

snarky.d.ts:596

snarkyjs / Exports / Signature

Class: Signature

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Signature(r, s)

Parameters
NameType
rField
sScalar
Overrides

CircuitValue.constructor

Defined in

lib/signature.ts:96

Properties

r

r: Field

Defined in

lib/signature.ts:93


s

s: Scalar

Defined in

lib/signature.ts:94

Methods

assertEquals

assertEquals(this, x): void

Parameters
NameType
thisSignature
xSignature
Returns

void

Inherited from

CircuitValue.assertEquals

Defined in

lib/circuit_value.ts:58


equals

equals(this, x): Bool

Parameters
NameType
thisSignature
xSignature
Returns

Bool

Inherited from

CircuitValue.equals

Defined in

lib/circuit_value.ts:54


toFields

toFields(): Field[]

Returns

Field[]

Inherited from

CircuitValue.toFields

Defined in

lib/circuit_value.ts:46


toJSON

toJSON(): JSONValue

Returns

JSONValue

Inherited from

CircuitValue.toJSON

Defined in

lib/circuit_value.ts:50


verify

verify(publicKey, msg): Bool

Parameters
NameType
publicKeyPublicKey
msgField[]
Returns

Bool

Defined in

lib/signature.ts:115


create

Static create(privKey, msg): Signature

Parameters
NameType
privKeyPrivateKey
msgField[]
Returns

Signature

Defined in

lib/signature.ts:102


fromJSON

Static fromJSON<T>(this, value): null | T

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
valueJSONValue
Returns

null | T

Inherited from

CircuitValue.fromJSON

Defined in

lib/circuit_value.ts:92


ofFields

Static ofFields<T>(this, xs): T

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
xsField[]
Returns

T

Inherited from

CircuitValue.ofFields

Defined in

lib/circuit_value.ts:62


sizeInFields

Static sizeInFields(): number

Returns

number

Inherited from

CircuitValue.sizeInFields

Defined in

lib/circuit_value.ts:26


toConstant

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

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
tT
Returns

T

Inherited from

CircuitValue.toConstant

Defined in

lib/circuit_value.ts:76


toFields

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

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
vT
Returns

Field[]

Inherited from

CircuitValue.toFields

Defined in

lib/circuit_value.ts:31


toJSON

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

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
vT
Returns

JSONValue

Inherited from

CircuitValue.toJSON

Defined in

lib/circuit_value.ts:81

snarkyjs / Exports / SmartContract

Class: SmartContract

The main zkapp class. To write a zkapp, extend this class as such:

class YourSmartContract extends SmartContract {
  // your smart contract code here
}

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new SmartContract(address)

Parameters
NameType
addressPublicKey
Defined in

lib/zkapp.ts:213

Properties

_executionState

Private _executionState: undefined | ExecutionState

Defined in

lib/zkapp.ts:208


address

address: PublicKey

Defined in

lib/zkapp.ts:206


_methods

Static Optional _methods: methodEntry<SmartContract>[]

Defined in

lib/zkapp.ts:209


_provers

Static Optional _provers: Prover[]

Defined in

lib/zkapp.ts:210


_verificationKey

Static Optional _verificationKey: Object

Type declaration
NameType
datastring
hashField
Defined in

lib/zkapp.ts:211

Accessors

account

get account(): PreconditionClassType<AccountPrecondition>

Returns

PreconditionClassType<AccountPrecondition>

Defined in

lib/zkapp.ts:310


balance

get balance(): Object

Returns

Object

NameType
addInPlace(x: string | number | bigint | UInt32 | UInt64 | Int64) => void
subInPlace(x: string | number | bigint | UInt32 | UInt64 | Int64) => void
Defined in

lib/zkapp.ts:318


network

get network(): PreconditionClassType<{ blockchainLength: { lower: UInt32 ; upper: UInt32 } ; globalSlotSinceGenesis: { lower: UInt32 ; upper: UInt32 } ; globalSlotSinceHardFork: { lower: UInt32 ; upper: UInt32 } ; minWindowDensity: { lower: UInt32 ; upper: UInt32 } ; nextEpochData: { epochLength: { lower: UInt32 ; upper: UInt32 } ; ledger: { hash: { isSome: Bool ; value: Field } ; totalCurrency: { lower: UInt64 ; upper: UInt64 } } ; lockCheckpoint: { isSome: Bool ; value: Field } ; seed: { isSome: Bool ; value: Field } ; startCheckpoint: { isSome: Bool ; value: Field } } ; snarkedLedgerHash: { isSome: Bool ; value: Field } ; stakingEpochData: { epochLength: { lower: UInt32 ; upper: UInt32 } ; ledger: { hash: { isSome: Bool ; value: Field } ; totalCurrency: { lower: UInt64 ; upper: UInt64 } } ; lockCheckpoint: { isSome: Bool ; value: Field } ; seed: { isSome: Bool ; value: Field } ; startCheckpoint: { isSome: Bool ; value: Field } } ; timestamp: { lower: UInt64 ; upper: UInt64 } ; totalCurrency: { lower: UInt64 ; upper: UInt64 } }>

Returns

PreconditionClassType<{ blockchainLength: { lower: UInt32 ; upper: UInt32 } ; globalSlotSinceGenesis: { lower: UInt32 ; upper: UInt32 } ; globalSlotSinceHardFork: { lower: UInt32 ; upper: UInt32 } ; minWindowDensity: { lower: UInt32 ; upper: UInt32 } ; nextEpochData: { epochLength: { lower: UInt32 ; upper: UInt32 } ; ledger: { hash: { isSome: Bool ; value: Field } ; totalCurrency: { lower: UInt64 ; upper: UInt64 } } ; lockCheckpoint: { isSome: Bool ; value: Field } ; seed: { isSome: Bool ; value: Field } ; startCheckpoint: { isSome: Bool ; value: Field } } ; snarkedLedgerHash: { isSome: Bool ; value: Field } ; stakingEpochData: { epochLength: { lower: UInt32 ; upper: UInt32 } ; ledger: { hash: { isSome: Bool ; value: Field } ; totalCurrency: { lower: UInt64 ; upper: UInt64 } } ; lockCheckpoint: { isSome: Bool ; value: Field } ; seed: { isSome: Bool ; value: Field } ; startCheckpoint: { isSome: Bool ; value: Field } } ; timestamp: { lower: UInt64 ; upper: UInt64 } ; totalCurrency: { lower: UInt64 ; upper: UInt64 } }>

Defined in

lib/zkapp.ts:314


nonce

get nonce(): UInt32

Returns

UInt32

Defined in

lib/zkapp.ts:322


self

get self(): Party

Returns

Party

Defined in

lib/zkapp.ts:306

Methods

deploy

deploy(__namedParameters): void

Parameters
NameType
__namedParametersObject
__namedParameters.verificationKey?Object
__namedParameters.verificationKey.datastring
__namedParameters.verificationKey.hashstring | Field
__namedParameters.zkappKey?PrivateKey
Returns

void

Defined in

lib/zkapp.ts:246


executionState

Private executionState(): ExecutionState

Returns

ExecutionState

Defined in

lib/zkapp.ts:267


setPermissions

setPermissions(permissions): void

Parameters
NameType
permissionsPermissions
Returns

void

Defined in

lib/zkapp.ts:332


setValue

setValue<T>(maybeValue, value): void

Type parameters
Name
T
Parameters
NameType
maybeValueSetOrKeep<T>
valueT
Returns

void

Defined in

lib/zkapp.ts:326


sign

sign(zkappKey?, fallbackToZeroNonce?): void

Parameters
NameType
zkappKey?PrivateKey
fallbackToZeroNonce?boolean
Returns

void

Defined in

lib/zkapp.ts:263


compile

Static compile(address?): Promise<{ provers: (statement: Statement) => Promise<unknown>[] ; verificationKey: { data: string ; hash: string } ; verify: (statement: Statement, proof: unknown) => Promise<boolean> }>

Parameters
NameType
address?PublicKey
Returns

Promise<{ provers: (statement: Statement) => Promise<unknown>[] ; verificationKey: { data: string ; hash: string } ; verify: (statement: Statement, proof: unknown) => Promise<boolean> }>

Defined in

lib/zkapp.ts:217

snarkyjs / Exports / UInt32

Class: UInt32

Hierarchy

Implements

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new UInt32(value)

Parameters
NameType
valueField
Overrides

CircuitValue.constructor

Defined in

lib/int.ts:185

Properties

_type

Optional _type: "UInt32"

Implementation of

Types.UInt32._type

Defined in

lib/int.ts:183


value

value: Field

Implementation of

Types.UInt32.value

Defined in

lib/int.ts:181


NUM_BITS

Static NUM_BITS: number = 32

Defined in

lib/int.ts:182

Accessors

one

Static get one(): UInt32

Returns

UInt32

Defined in

lib/int.ts:194


zero

Static get zero(): UInt32

Returns

UInt32

Defined in

lib/int.ts:190

Methods

add

add(y): UInt32

Parameters
NameType
ynumber | UInt32
Returns

UInt32

Defined in

lib/int.ts:292


assertEquals

assertEquals(this, x): void

Parameters
NameType
thisUInt32
xUInt32
Returns

void

Inherited from

CircuitValue.assertEquals

Defined in

lib/circuit_value.ts:58


assertGt

assertGt(y): void

Parameters
NameType
yUInt32
Returns

void

Defined in

lib/int.ts:332


assertLt

assertLt(y): void

Parameters
NameType
yUInt32
Returns

void

Defined in

lib/int.ts:324


assertLte

assertLte(y): void

Parameters
NameType
yUInt32
Returns

void

Defined in

lib/int.ts:315


div

div(y): UInt32

Parameters
NameType
ynumber | UInt32
Returns

UInt32

Defined in

lib/int.ts:278


divMod

divMod(y): Object

Parameters
NameType
ystring | number | UInt32
Returns

Object

NameType
quotientUInt32
restUInt32
Defined in

lib/int.ts:242


equals

equals(this, x): Bool

Parameters
NameType
thisUInt32
xUInt32
Returns

Bool

Inherited from

CircuitValue.equals

Defined in

lib/circuit_value.ts:54


gt

gt(y): Bool

Parameters
NameType
yUInt32
Returns

Bool

Defined in

lib/int.ts:328


lt

lt(y): Bool

Parameters
NameType
yUInt32
Returns

Bool

Defined in

lib/int.ts:320


lte

lte(y): Bool

Parameters
NameType
yUInt32
Returns

Bool

Defined in

lib/int.ts:304


mod

mod(y): UInt32

Parameters
NameType
ynumber | UInt32
Returns

UInt32

Defined in

lib/int.ts:282


mul

mul(y): UInt32

Parameters
NameType
ynumber | UInt32
Returns

UInt32

Defined in

lib/int.ts:286


sub

sub(y): UInt32

Parameters
NameType
ynumber | UInt32
Returns

UInt32

Defined in

lib/int.ts:298


toFields

toFields(): Field[]

Returns

Field[]

Inherited from

CircuitValue.toFields

Defined in

lib/circuit_value.ts:46


toJSON

toJSON(): JSONValue

Returns

JSONValue

Inherited from

CircuitValue.toJSON

Defined in

lib/circuit_value.ts:50


toString

toString(): string

Returns

string

Defined in

lib/int.ts:198


toUInt64

toUInt64(): UInt64

Returns

UInt64

Defined in

lib/int.ts:202


MAXINT

Static MAXINT(): UInt32

Returns

UInt32

Defined in

lib/int.ts:238


check

Static check(x): void

Parameters
NameType
xUInt32
Returns

void

Defined in

lib/int.ts:207


checkConstant

Static Private checkConstant(x): Field

Parameters
NameType
xField
Returns

Field

Defined in

lib/int.ts:212


from

Static from(x): UInt32

Parameters
NameType
xstring | number | bigint | Field | UInt32
Returns

UInt32

Defined in

lib/int.ts:224


fromBigInt

Static fromBigInt(x): UInt32

Parameters
NameType
xbigint
Returns

UInt32

Defined in

lib/int.ts:234


fromJSON

Static fromJSON<T>(this, value): null | T

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
valueJSONValue
Returns

null | T

Inherited from

CircuitValue.fromJSON

Defined in

lib/circuit_value.ts:92


fromNumber

Static fromNumber(x): UInt32

Parameters
NameType
xnumber
Returns

UInt32

Defined in

lib/int.ts:228


fromString

Static fromString(x): UInt32

Parameters
NameType
xstring
Returns

UInt32

Defined in

lib/int.ts:231


ofFields

Static ofFields<T>(this, xs): T

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
xsField[]
Returns

T

Inherited from

CircuitValue.ofFields

Defined in

lib/circuit_value.ts:62


sizeInFields

Static sizeInFields(): number

Returns

number

Inherited from

CircuitValue.sizeInFields

Defined in

lib/circuit_value.ts:26


toConstant

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

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
tT
Returns

T

Inherited from

CircuitValue.toConstant

Defined in

lib/circuit_value.ts:76


toFields

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

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
vT
Returns

Field[]

Inherited from

CircuitValue.toFields

Defined in

lib/circuit_value.ts:31


toJSON

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

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
vT
Returns

JSONValue

Inherited from

CircuitValue.toJSON

Defined in

lib/circuit_value.ts:81

snarkyjs / Exports / UInt64

Class: UInt64

Hierarchy

Implements

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new UInt64(value)

Parameters
NameType
valueField
Overrides

CircuitValue.constructor

Defined in

lib/int.ts:11

Properties

_type

Optional _type: "UInt64"

Implementation of

Types.UInt64._type

Defined in

lib/int.ts:9


value

value: Field

Implementation of

Types.UInt64.value

Defined in

lib/int.ts:7


NUM_BITS

Static NUM_BITS: number = 64

Defined in

lib/int.ts:8

Accessors

one

Static get one(): UInt64

Returns

UInt64

Defined in

lib/int.ts:20


zero

Static get zero(): UInt64

Returns

UInt64

Defined in

lib/int.ts:16

Methods

add

add(y): UInt64

Addition with overflow checking.

Parameters
NameType
ynumber | UInt64
Returns

UInt64

Defined in

lib/int.ts:132


assertEquals

assertEquals(this, x): void

Parameters
NameType
thisUInt64
xUInt64
Returns

void

Inherited from

CircuitValue.assertEquals

Defined in

lib/circuit_value.ts:58


assertGt

assertGt(y): void

Parameters
NameType
yUInt64
Returns

void

Defined in

lib/int.ts:175


assertLt

assertLt(y): void

Parameters
NameType
yUInt64
Returns

void

Defined in

lib/int.ts:167


assertLte

assertLte(y): void

Parameters
NameType
yUInt64
Returns

void

Defined in

lib/int.ts:158


div

div(y): UInt64

Integer division.

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

Parameters
NameType
ynumber | UInt64
Returns

UInt64

Defined in

lib/int.ts:106


divMod

divMod(y): Object

Parameters
NameType
ystring | number | UInt64
Returns

Object

NameType
quotientUInt64
restUInt64
Defined in

lib/int.ts:63


equals

equals(this, x): Bool

Parameters
NameType
thisUInt64
xUInt64
Returns

Bool

Inherited from

CircuitValue.equals

Defined in

lib/circuit_value.ts:54


gt

gt(y): Bool

Parameters
NameType
yUInt64
Returns

Bool

Defined in

lib/int.ts:171


lt

lt(y): Bool

Parameters
NameType
yUInt64
Returns

Bool

Defined in

lib/int.ts:163


lte

lte(y): Bool

Parameters
NameType
yUInt64
Returns

Bool

Defined in

lib/int.ts:147


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


mul

mul(y): UInt64

Multiplication with overflow checking.

Parameters
NameType
ynumber | UInt64
Returns

UInt64

Defined in

lib/int.ts:123


sub

sub(y): UInt64

Subtraction with underflow checking.

Parameters
NameType
ynumber | UInt64
Returns

UInt64

Defined in

lib/int.ts:141


toFields

toFields(): Field[]

Returns

Field[]

Inherited from

CircuitValue.toFields

Defined in

lib/circuit_value.ts:46


toJSON

toJSON(): JSONValue

Returns

JSONValue

Inherited from

CircuitValue.toJSON

Defined in

lib/circuit_value.ts:50


toString

toString(): string

Returns

string

Defined in

lib/int.ts:24


MAXINT

Static MAXINT(): UInt64

Returns

UInt64

Defined in

lib/int.ts:59


check

Static check(x): void

Parameters
NameType
xUInt64
Returns

void

Defined in

lib/int.ts:28


checkConstant

Static Private checkConstant(x): Field

Parameters
NameType
xField
Returns

Field

Defined in

lib/int.ts:33


from

Static from(x): UInt64

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

UInt64

Defined in

lib/int.ts:45


fromBigInt

Static fromBigInt(x): UInt64

Parameters
NameType
xbigint
Returns

UInt64

Defined in

lib/int.ts:55


fromJSON

Static fromJSON<T>(this, value): null | T

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
valueJSONValue
Returns

null | T

Inherited from

CircuitValue.fromJSON

Defined in

lib/circuit_value.ts:92


fromNumber

Static fromNumber(x): UInt64

Parameters
NameType
xnumber
Returns

UInt64

Defined in

lib/int.ts:49


fromString

Static fromString(x): UInt64

Parameters
NameType
xstring
Returns

UInt64

Defined in

lib/int.ts:52


ofFields

Static ofFields<T>(this, xs): T

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
xsField[]
Returns

T

Inherited from

CircuitValue.ofFields

Defined in

lib/circuit_value.ts:62


sizeInFields

Static sizeInFields(): number

Returns

number

Inherited from

CircuitValue.sizeInFields

Defined in

lib/circuit_value.ts:26


toConstant

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

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
tT
Returns

T

Inherited from

CircuitValue.toConstant

Defined in

lib/circuit_value.ts:76


toFields

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

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
vT
Returns

Field[]

Inherited from

CircuitValue.toFields

Defined in

lib/circuit_value.ts:31


toJSON

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

Type parameters
Name
T
Parameters
NameType
thisConstructor<T>
vT
Returns

JSONValue

Inherited from

CircuitValue.toJSON

Defined in

lib/circuit_value.ts:81

snarkyjs / Exports / VerificationKey

Class: VerificationKey

Part of the circuit [[Keypair]]. A verification key can be used to verify a [[Proof]] when you provide the correct public input.

Table of contents

Constructors

Methods

Constructors

constructor

new VerificationKey()

Methods

verify

verify(publicInput, proof): boolean

Parameters
NameType
publicInputany[]
proofProof
Returns

boolean

Defined in

snarky.d.ts:669

Interfaces

snarkyjs / Exports / AsFieldElements

Interface: AsFieldElements<T>

Type parameters

Name
T

Table of contents

Methods

Methods

check

Optional check(x): void

Parameters
NameType
xT
Returns

void

Defined in

snarky.d.ts:474


ofFields

ofFields(x): T

Parameters
NameType
xField[]
Returns

T

Defined in

snarky.d.ts:472


sizeInFields

sizeInFields(): number

Returns

number

Defined in

snarky.d.ts:473


toFields

toFields(x): Field[]

Parameters
NameType
xT
Returns

Field[]

Defined in

snarky.d.ts:471

snarkyjs / Exports / Body

Interface: Body

The body of describing how some [[Party]] should change.

TODO: We need to rename this still.

Hierarchy

  • PartyBody

    Body

Table of contents

Properties

Properties

balanceChange

balanceChange: Int64

By what [[Int64]] should the balance of this account change. All balanceChanges must balance by the end of smart contract execution.

Overrides

PartyBody.balanceChange

Defined in

lib/party.ts:282


callData

callData: Field

Overrides

PartyBody.callData

Defined in

lib/party.ts:292


callDepth

callDepth: number

Overrides

PartyBody.callDepth

Defined in

lib/party.ts:293


caller

caller: Field

Overrides

PartyBody.caller

Defined in

lib/party.ts:291


events

events: Events

Recent events that have been emitted from this account.

TODO: Add a reference to general explanation of events.

Overrides

PartyBody.events

Defined in

lib/party.ts:289


incrementNonce

incrementNonce: Bool

Overrides

PartyBody.incrementNonce

Defined in

lib/party.ts:296


preconditions

preconditions: Object

Type declaration
NameType
account{ balance: { lower: UInt64 ; upper: UInt64 } ; delegate: { isSome: Bool ; value: PublicKey } ; nonce: { lower: UInt32 ; upper: UInt32 } ; provedState: { isSome: Bool ; value: Bool } ; receiptChainHash: { isSome: Bool ; value: Field } ; sequenceState: Field ; state: { isSome: Bool ; value: Field }[] }
account.balance{ lower: UInt64 ; upper: UInt64 }
account.balance.lowerUInt64
account.balance.upperUInt64
account.delegate{ isSome: Bool ; value: PublicKey }
account.delegate.isSomeBool
account.delegate.valuePublicKey
account.nonce{ lower: UInt32 ; upper: UInt32 }
account.nonce.lowerUInt32
account.nonce.upperUInt32
account.provedState{ isSome: Bool ; value: Bool }
account.provedState.isSomeBool
account.provedState.valueBool
account.receiptChainHash{ isSome: Bool ; value: Field }
account.receiptChainHash.isSomeBool
account.receiptChainHash.valueField
account.sequenceStateField
account.state{ isSome: Bool ; value: Field }[]
network{ blockchainLength: { lower: UInt32 ; upper: UInt32 } ; globalSlotSinceGenesis: { lower: UInt32 ; upper: UInt32 } ; globalSlotSinceHardFork: { lower: UInt32 ; upper: UInt32 } ; minWindowDensity: { lower: UInt32 ; upper: UInt32 } ; nextEpochData: { epochLength: { lower: UInt32 ; upper: UInt32 } ; ledger: { hash: { isSome: Bool ; value: Field } ; totalCurrency: { lower: UInt64 ; upper: UInt64 } } ; lockCheckpoint: { isSome: Bool ; value: Field } ; seed: { isSome: Bool ; value: Field } ; startCheckpoint: { isSome: Bool ; value: Field } } ; snarkedLedgerHash: { isSome: Bool ; value: Field } ; stakingEpochData: { epochLength: { lower: UInt32 ; upper: UInt32 } ; ledger: { hash: { isSome: Bool ; value: Field } ; totalCurrency: { lower: UInt64 ; upper: UInt64 } } ; lockCheckpoint: { isSome: Bool ; value: Field } ; seed: { isSome: Bool ; value: Field } ; startCheckpoint: { isSome: Bool ; value: Field } } ; timestamp: { lower: UInt64 ; upper: UInt64 } ; totalCurrency: { lower: UInt64 ; upper: UInt64 } }
network.blockchainLength{ lower: UInt32 ; upper: UInt32 }
network.blockchainLength.lowerUInt32
network.blockchainLength.upperUInt32
network.globalSlotSinceGenesis{ lower: UInt32 ; upper: UInt32 }
network.globalSlotSinceGenesis.lowerUInt32
network.globalSlotSinceGenesis.upperUInt32
network.globalSlotSinceHardFork{ lower: UInt32 ; upper: UInt32 }
network.globalSlotSinceHardFork.lowerUInt32
network.globalSlotSinceHardFork.upperUInt32
network.minWindowDensity{ lower: UInt32 ; upper: UInt32 }
network.minWindowDensity.lowerUInt32
network.minWindowDensity.upperUInt32
network.nextEpochData{ epochLength: { lower: UInt32 ; upper: UInt32 } ; ledger: { hash: { isSome: Bool ; value: Field } ; totalCurrency: { lower: UInt64 ; upper: UInt64 } } ; lockCheckpoint: { isSome: Bool ; value: Field } ; seed: { isSome: Bool ; value: Field } ; startCheckpoint: { isSome: Bool ; value: Field } }
network.nextEpochData.epochLength{ lower: UInt32 ; upper: UInt32 }
network.nextEpochData.epochLength.lowerUInt32
network.nextEpochData.epochLength.upperUInt32
network.nextEpochData.ledger{ hash: { isSome: Bool ; value: Field } ; totalCurrency: { lower: UInt64 ; upper: UInt64 } }
network.nextEpochData.ledger.hash{ isSome: Bool ; value: Field }
network.nextEpochData.ledger.hash.isSomeBool
network.nextEpochData.ledger.hash.valueField
network.nextEpochData.ledger.totalCurrency{ lower: UInt64 ; upper: UInt64 }
network.nextEpochData.ledger.totalCurrency.lowerUInt64
network.nextEpochData.ledger.totalCurrency.upperUInt64
network.nextEpochData.lockCheckpoint{ isSome: Bool ; value: Field }
network.nextEpochData.lockCheckpoint.isSomeBool
network.nextEpochData.lockCheckpoint.valueField
network.nextEpochData.seed{ isSome: Bool ; value: Field }
network.nextEpochData.seed.isSomeBool
network.nextEpochData.seed.valueField
network.nextEpochData.startCheckpoint{ isSome: Bool ; value: Field }
network.nextEpochData.startCheckpoint.isSomeBool
network.nextEpochData.startCheckpoint.valueField
network.snarkedLedgerHash{ isSome: Bool ; value: Field }
network.snarkedLedgerHash.isSomeBool
network.snarkedLedgerHash.valueField
network.stakingEpochData{ epochLength: { lower: UInt32 ; upper: UInt32 } ; ledger: { hash: { isSome: Bool ; value: Field } ; totalCurrency: { lower: UInt64 ; upper: UInt64 } } ; lockCheckpoint: { isSome: Bool ; value: Field } ; seed: { isSome: Bool ; value: Field } ; startCheckpoint: { isSome: Bool ; value: Field } }
network.stakingEpochData.epochLength{ lower: UInt32 ; upper: UInt32 }
network.stakingEpochData.epochLength.lowerUInt32
network.stakingEpochData.epochLength.upperUInt32
network.stakingEpochData.ledger{ hash: { isSome: Bool ; value: Field } ; totalCurrency: { lower: UInt64 ; upper: UInt64 } }
network.stakingEpochData.ledger.hash{ isSome: Bool ; value: Field }
network.stakingEpochData.ledger.hash.isSomeBool
network.stakingEpochData.ledger.hash.valueField
network.stakingEpochData.ledger.totalCurrency{ lower: UInt64 ; upper: UInt64 }
network.stakingEpochData.ledger.totalCurrency.lowerUInt64
network.stakingEpochData.ledger.totalCurrency.upperUInt64
network.stakingEpochData.lockCheckpoint{ isSome: Bool ; value: Field }
network.stakingEpochData.lockCheckpoint.isSomeBool
network.stakingEpochData.lockCheckpoint.valueField
network.stakingEpochData.seed{ isSome: Bool ; value: Field }
network.stakingEpochData.seed.isSomeBool
network.stakingEpochData.seed.valueField
network.stakingEpochData.startCheckpoint{ isSome: Bool ; value: Field }
network.stakingEpochData.startCheckpoint.isSomeBool
network.stakingEpochData.startCheckpoint.valueField
network.timestamp{ lower: UInt64 ; upper: UInt64 }
network.timestamp.lowerUInt64
network.timestamp.upperUInt64
network.totalCurrency{ lower: UInt64 ; upper: UInt64 }
network.totalCurrency.lowerUInt64
network.totalCurrency.upperUInt64
Overrides

PartyBody.preconditions

Defined in

lib/party.ts:294


publicKey

publicKey: PublicKey

The address for this body.

Overrides

PartyBody.publicKey

Defined in

lib/party.ts:265


sequenceEvents

sequenceEvents: Events

Overrides

PartyBody.sequenceEvents

Defined in

lib/party.ts:290


tokenId

tokenId: Field

The TokenId for this account.

Overrides

PartyBody.tokenId

Defined in

lib/party.ts:276


update

update: Object

Specify [[Update]]s to tweakable pieces of the account record backing this address in the ledger.

Type declaration
NameType
appState{ isSome: Bool ; value: Field }[]
delegate{ isSome: Bool ; value: PublicKey }
delegate.isSomeBool
delegate.valuePublicKey
permissions{ isSome: Bool ; value: { editSequenceState: AuthRequired ; editState: AuthRequired ; incrementNonce: AuthRequired ; receive: AuthRequired ; send: AuthRequired ; setDelegate: AuthRequired ; setPermissions: AuthRequired ; setTokenSymbol: AuthRequired ; setVerificationKey: AuthRequired ; setVotingFor: AuthRequired ; setZkappUri: AuthRequired } }
permissions.isSomeBool
permissions.value{ editSequenceState: AuthRequired ; editState: AuthRequired ; incrementNonce: AuthRequired ; receive: AuthRequired ; send: AuthRequired ; setDelegate: AuthRequired ; setPermissions: AuthRequired ; setTokenSymbol: AuthRequired ; setVerificationKey: AuthRequired ; setVotingFor: AuthRequired ; setZkappUri: AuthRequired }
permissions.value.editSequenceStateAuthRequired
permissions.value.editStateAuthRequired
permissions.value.incrementNonceAuthRequired
permissions.value.receiveAuthRequired
permissions.value.sendAuthRequired
permissions.value.setDelegateAuthRequired
permissions.value.setPermissionsAuthRequired
permissions.value.setTokenSymbolAuthRequired
permissions.value.setVerificationKeyAuthRequired
permissions.value.setVotingForAuthRequired
permissions.value.setZkappUriAuthRequired
timing{ isSome: Bool ; value: { cliffAmount: UInt64 ; cliffTime: UInt32 ; initialMinimumBalance: UInt64 ; vestingIncrement: UInt64 ; vestingPeriod: UInt32 } }
timing.isSomeBool
timing.value{ cliffAmount: UInt64 ; cliffTime: UInt32 ; initialMinimumBalance: UInt64 ; vestingIncrement: UInt64 ; vestingPeriod: UInt32 }
timing.value.cliffAmountUInt64
timing.value.cliffTimeUInt32
timing.value.initialMinimumBalanceUInt64
timing.value.vestingIncrementUInt64
timing.value.vestingPeriodUInt32
tokenSymbol{ isSome: Bool ; value: { data: string ; hash: Field } }
tokenSymbol.isSomeBool
tokenSymbol.value{ data: string ; hash: Field }
tokenSymbol.value.datastring
tokenSymbol.value.hashField
verificationKey{ isSome: Bool ; value: { data: string ; hash: Field } }
verificationKey.isSomeBool
verificationKey.value{ data: string ; hash: Field }
verificationKey.value.datastring
verificationKey.value.hashField
votingFor{ isSome: Bool ; value: Field }
votingFor.isSomeBool
votingFor.valueField
zkappUri{ isSome: Bool ; value: { data: string ; hash: Field } }
zkappUri.isSomeBool
zkappUri.value{ data: string ; hash: Field }
zkappUri.value.datastring
zkappUri.value.hashField
Overrides

PartyBody.update

Defined in

lib/party.ts:271


useFullCommitment

useFullCommitment: Bool

Overrides

PartyBody.useFullCommitment

Defined in

lib/party.ts:295

snarkyjs / Exports / CircuitMain

Interface: CircuitMain<W, P>

Type parameters

Name
W
P

Table of contents

Properties

Methods

Properties

snarkyPublicTyp

snarkyPublicTyp: AsFieldElements<P>

Defined in

snarky.d.ts:479


snarkyWitnessTyp

snarkyWitnessTyp: AsFieldElements<W>

Defined in

snarky.d.ts:478

Methods

snarkyMain

snarkyMain(w, p): void

Parameters
NameType
wW
pP
Returns

void

Defined in

snarky.d.ts:480

snarkyjs / Exports / Permissions

Interface: Permissions

Permissions specify how specific aspects of the zkapp account are allowed to be modified. All fields are denominated by a [[Permission]].

Hierarchy

  • Permissions_

    Permissions

Table of contents

Properties

Properties

editSequenceState

editSequenceState: AuthRequired

The [[Permission]] corresponding to the ability to change the sequence state associated with the account.

TODO: Define sequence state here as well.

Overrides

Permissions_.editSequenceState

Defined in

lib/party.ts:174


editState

editState: AuthRequired

The [[Permission]] corresponding to the 8 state fields associated with an account.

Overrides

Permissions_.editState

Defined in

lib/party.ts:127


incrementNonce

incrementNonce: AuthRequired

Overrides

Permissions_.incrementNonce

Defined in

lib/party.ts:183


receive

receive: AuthRequired

The [[Permission]] corresponding to the ability to receive transactions to this account.

Overrides

Permissions_.receive

Defined in

lib/party.ts:139


send

send: AuthRequired

The [[Permission]] corresponding to the ability to send transactions from this account.

Overrides

Permissions_.send

Defined in

lib/party.ts:133


setDelegate

setDelegate: AuthRequired

The [[Permission]] corresponding to the ability to set the delegate field of the account.

Overrides

Permissions_.setDelegate

Defined in

lib/party.ts:145


setPermissions

setPermissions: AuthRequired

The [[Permission]] corresponding to the ability to set the permissions field of the account.

Overrides

Permissions_.setPermissions

Defined in

lib/party.ts:151


setTokenSymbol

setTokenSymbol: AuthRequired

The [[Permission]] corresponding to the ability to set the token symbol for this account.

Overrides

Permissions_.setTokenSymbol

Defined in

lib/party.ts:180


setVerificationKey

setVerificationKey: AuthRequired

The [[Permission]] corresponding to the ability to set the verification key associated with the circuit tied to this account. Effectively "upgradability" of the smart contract.

Overrides

Permissions_.setVerificationKey

Defined in

lib/party.ts:158


setVotingFor

setVotingFor: AuthRequired

Overrides

Permissions_.setVotingFor

Defined in

lib/party.ts:184


setZkappUri

setZkappUri: AuthRequired

The [[Permission]] corresponding to the ability to set the zkapp uri typically pointing to the source code of the smart contract. Usually this should be changed whenever the [[Permissions.setVerificationKey]] is changed. Effectively "upgradability" of the smart contract.

Overrides

Permissions_.setZkappUri

Defined in

lib/party.ts:166

snarkyjs / Exports

Type Aliases

DeployArgs

Ƭ DeployArgs: Object

Type declaration

NameType
verificationKey?{ data: string ; hash: string | Field }
verificationKey.datastring
verificationKey.hashstring | Field
zkappKey?PrivateKey

Defined in

lib/zkapp.ts:349


FeePayerUnsigned

Ƭ FeePayerUnsigned: Object

Type declaration

NameType
authorizationUnfinishedSignature | string
bodyFeePayerBody

Defined in

lib/party.ts:371


JSONValue

Ƭ JSONValue: number | string | boolean | null | JSONValue[] | { [key: string]: JSONValue; }

Defined in

snarky.d.ts:787


LazyControl

Ƭ LazyControl: Control | LazySignature | LazyProof

Defined in

lib/party.ts:482


LazyProof

Ƭ LazyProof: Object

Type declaration

NameType
ZkappClasstypeof SmartContract
argsany[]
kind"lazy-proof"
methodFunction

Defined in

lib/party.ts:473


LazySignature

Ƭ LazySignature: Object

Type declaration

NameType
kind"lazy-signature"
privateKey?PrivateKey

Defined in

lib/party.ts:472


Parties

Ƭ Parties: Object

Type declaration

NameType
feePayerFeePayerUnsigned
memostring
otherPartiesParty[]

Defined in

lib/party.ts:761


Permission

Ƭ Permission: AuthRequired

One specific permission value.

A [[Permission]] tells one specific permission for our zkapp how it should behave when presented with requested modifications.

Use static factory methods on this class to use a specific behavior. See documentation on those methods to learn more.

Defined in

lib/party.ts:67


Preconditions

Ƭ Preconditions: PartyBody["preconditions"]

Preconditions for the network and accounts

Defined in

lib/party.ts:39


SetOrKeep

Ƭ SetOrKeep<T>: Object

Either set a value or keep it the same.

Type parameters

Name
T

Type declaration

NameType
isSomeBool
valueT

Defined in

lib/party.ts:49


State

Ƭ State<A>: Object

Gettable and settable state that can be checked for equality.

Type parameters

Name
A

Type declaration

NameType
assertEquals(a: A) => void
fetch() => Promise<undefined | A>
get() => A
set(a: A) => void

Defined in

lib/state.ts:14

Variables

Body

Body: Object

Type declaration

NameType
dummy() => Body
keepAll(publicKey: PublicKey) => Body
noUpdate() => { appState: { isSome: Bool ; value: Field }[] ; delegate: { isSome: Bool ; value: PublicKey } ; permissions: { isSome: Bool ; value: { editSequenceState: AuthRequired ; editState: AuthRequired ; incrementNonce: AuthRequired ; receive: AuthRequired ; send: AuthRequired ; setDelegate: AuthRequired ; setPermissions: AuthRequired ; setTokenSymbol: AuthRequired ; setVerificationKey: AuthRequired ; setVotingFor: AuthRequired ; setZkappUri: AuthRequired } } ; timing: { isSome: Bool ; value: { cliffAmount: UInt64 ; cliffTime: UInt32 ; initialMinimumBalance: UInt64 ; vestingIncrement: UInt64 ; vestingPeriod: UInt32 } } ; tokenSymbol: { isSome: Bool ; value: { data: string ; hash: Field } } ; verificationKey: { isSome: Bool ; value: { data: string ; hash: Field } } ; votingFor: { isSome: Bool ; value: Field } ; zkappUri: { isSome: Bool ; value: { data: string ; hash: Field } } }

Defined in

lib/party.ts:298


Permission

Permission: Object

Type declaration

NameType
impossible() => AuthRequired
none() => AuthRequired
proof() => AuthRequired
proofOrSignature() => AuthRequired
signature() => AuthRequired

Defined in

lib/party.ts:68


Permissions

Permissions: Object

Type declaration

NameType
default() => Permissions
impossible() => AuthRequired
initial() => Permissions
none() => AuthRequired
proof() => AuthRequired
proofOrSignature() => AuthRequired
signature() => AuthRequired

Defined in

lib/party.ts:186


Pickles

Const Pickles: Object

Type declaration

NameType
compile(rules: [0, string, (statement: Statement) => void][]) => { provers: (statement: Statement) => Promise<unknown>[] ; getVerificationKeyArtifact: () => { data: string ; hash: string } ; verify: (statement: Statement, proof: unknown) => Promise<boolean> }
proofToString(proof: unknown) => string

Defined in

snarky.d.ts:762


Poseidon

Const Poseidon: Object

Type declaration

NameType
Spongetypeof Sponge
hash(xs: Field[]) => Field

Defined in

snarky.d.ts:660


Preconditions

Preconditions: Object

Type declaration

NameType
ignoreAll() => { account: { balance: { lower: UInt64 ; upper: UInt64 } ; delegate: { isSome: Bool ; value: PublicKey } ; nonce: { lower: UInt32 ; upper: UInt32 } ; provedState: { isSome: Bool ; value: Bool } ; receiptChainHash: { isSome: Bool ; value: Field } ; sequenceState: Field ; state: { isSome: Bool ; value: Field }[] } ; network: { blockchainLength: { lower: UInt32 ; upper: UInt32 } ; globalSlotSinceGenesis: { lower: UInt32 ; upper: UInt32 } ; globalSlotSinceHardFork: { lower: UInt32 ; upper: UInt32 } ; minWindowDensity: { lower: UInt32 ; upper: UInt32 } ; nextEpochData: { epochLength: { lower: UInt32 ; upper: UInt32 } ; ledger: { hash: { isSome: Bool ; value: Field } ; totalCurrency: { lower: UInt64 ; upper: UInt64 } } ; lockCheckpoint: { isSome: Bool ; value: Field } ; seed: { isSome: Bool ; value: Field } ; startCheckpoint: { isSome: Bool ; value: Field } } ; snarkedLedgerHash: { isSome: Bool ; value: Field } ; stakingEpochData: { epochLength: { lower: UInt32 ; upper: UInt32 } ; ledger: { hash: { isSome: Bool ; value: Field } ; totalCurrency: { lower: UInt64 ; upper: UInt64 } } ; lockCheckpoint: { isSome: Bool ; value: Field } ; seed: { isSome: Bool ; value: Field } ; startCheckpoint: { isSome: Bool ; value: Field } } ; timestamp: { lower: UInt64 ; upper: UInt64 } ; totalCurrency: { lower: UInt64 ; upper: UInt64 } } }

Defined in

lib/party.ts:461


ZkappStateLength

Const ZkappStateLength: 8

Defined in

lib/party.ts:31


isReady

isReady: Promise<undefined>

A Promise that resolves when SnarkyJS is ready to be used

Defined in

snarky.d.ts:758


jsLayout

jsLayout: Object

Type declaration

NameType
Parties{ docs: null = null; layout: ({ docs: null = null; key: string = 'feePayer'; value: { docs: null = null; inner: undefined ; layout: ({ docs: null = null; key: string = 'body'; value: { docs: null = null; layout: ({ docs: null = null; key: string = 'publicKey'; value: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: undefined = null; inner: undefined ; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'PublicKey' } } | { docs: null = null; key: string = 'update'; value: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: null = null; inner: undefined ; layout: ({ docs: null = null; key: string = 'appState'; value: { inner: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: undefined = null; inner: { type: string = 'Field' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: string = 'flaggedOption'; type: string = 'option' } ; optionType: undefined = 'flaggedOption'; type: string = 'array' } } | { docs: null = null; key: string = 'delegate'; value: { inner: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: undefined = null; inner: undefined ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: undefined = 'flaggedOption'; type: string = 'PublicKey' } ; optionType: string = 'flaggedOption'; type: string = 'option' } } | { docs: null = null; key: string = 'verificationKey'; value: { inner: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: null = null; inner: undefined ; layout: { docs: null = null; key: string = 'data'; value: { type: string = 'string' } }[] ; name: string = 'VerificationKeyWithHash'; optionType: undefined = 'flaggedOption'; type: string = 'object' } ; optionType: string = 'flaggedOption'; type: string = 'option' } } | { docs: null = null; key: string = 'zkappUri'; value: { inner: { checkedType: { docs: null = null; layout: { docs: null = null; key: string = 'data'; value: { type: string = 'string' } }[] ; name: string = 'Events'; type: string = 'object' } ; checkedTypeName: string = 'StringWithHash'; docs: undefined = null; inner: undefined ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: undefined = 'flaggedOption'; type: string = 'string' } ; optionType: string = 'flaggedOption'; type: string = 'option' } })[] ; name: string = 'PartyUpdate'; type: string = 'object' } } | { docs: null = null; key: string = 'events'; value: { checkedType: { docs: null = null; layout: ({ docs: null = null; key: string = 'data'; value: { inner: { inner: { type: string = 'Field' } ; type: string = 'array' } ; type: string = 'array' } } | { docs: null = null; key: string = 'hash'; value: { inner: undefined ; type: string = 'Field' } })[] ; name: string = 'Events'; type: string = 'object' } ; checkedTypeName: string = 'Events'; docs: undefined = null; inner: { inner: { type: string = 'Field' } ; type: string = 'array' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'array' } } | { docs: null = null; key: string = 'networkPrecondition'; value: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: null = null; inner: undefined ; layout: ({ docs: null = null; key: string = 'snarkedLedgerHash'; value: { docs: undefined = null; inner: { docs: undefined = null; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'Field' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: string = 'flaggedOption'; type: string = 'option' } } | { docs: null = null; key: string = 'timestamp'; value: { docs: undefined = null; inner: { docs: null = null; layout: { docs: null = null; key: string = 'lower'; value: { type: string = 'UInt64' } }[] ; name: string = 'BlockTimeInterval'; type: string = 'object' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: string = 'implicit'; type: string = 'option' } } | { docs: null = null; key: string = 'stakingEpochData'; value: { docs: null = null; inner: undefined ; layout: ({ docs: null = null; key: string = 'ledger'; value: { docs: null = null; inner: undefined ; layout: ({ docs: null = null; key: string = 'hash'; value: { inner: { docs: undefined = null; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'Field' } ; optionType: string = 'flaggedOption'; type: string = 'option' } } | { docs: null = null; key: string = 'totalCurrency'; value: { inner: { docs: null = null; layout: { docs: null = null; key: string = 'lower'; value: { type: string = 'UInt64' } }[] ; name: string = 'CurrencyAmountInterval'; type: string = 'object' } ; optionType: string = 'implicit'; type: string = 'option' } })[] ; name: string = 'EpochLedgerPrecondition'; optionType: undefined = 'flaggedOption'; type: string = 'object' } } | { docs: null = null; key: string = 'seed'; value: { docs: undefined = null; inner: { docs: undefined = null; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'Field' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: string = 'flaggedOption'; type: string = 'option' } } | { docs: null = null; key: string = 'epochLength'; value: { docs: undefined = null; inner: { docs: null = null; layout: { docs: null = null; key: string = 'lower'; value: { type: string = 'UInt32' } }[] ; name: string = 'LengthInterval'; type: string = 'object' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: string = 'implicit'; type: string = 'option' } })[] ; name: string = 'EpochDataPrecondition'; optionType: undefined = 'flaggedOption'; type: string = 'object' } })[] ; name: string = 'NetworkPrecondition'; type: string = 'object' } })[] ; name: string = 'FeePayerPartyBody'; type: string = 'object' } } | { docs: null = null; key: string = 'authorization'; value: { docs: undefined = null; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'string' } })[] ; name: string = 'ZkappPartyFeePayer'; type: string = 'object' } } | { docs: null = null; key: string = 'otherParties'; value: { docs: undefined = null; inner: { docs: string = 'A party to a zkApp transaction'; layout: ({ docs: null = null; key: string = 'body'; value: { docs: null = null; layout: ({ docs: null = null; key: string = 'publicKey'; value: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: undefined = null; inner: undefined ; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'PublicKey' } } | { docs: null = null; key: string = 'update'; value: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: null = null; inner: undefined ; layout: ({ docs: null = null; key: string = 'appState'; value: { inner: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: undefined = null; inner: { type: string = 'Field' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: string = 'flaggedOption'; type: string = 'option' } ; optionType: undefined = 'flaggedOption'; type: string = 'array' } } | { docs: null = null; key: string = 'delegate'; value: { inner: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: undefined = null; inner: undefined ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: undefined = 'flaggedOption'; type: string = 'PublicKey' } ; optionType: string = 'flaggedOption'; type: string = 'option' } } | { docs: null = null; key: string = 'verificationKey'; value: { inner: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: null = null; inner: undefined ; layout: { docs: null = null; key: string = 'data'; value: { type: string = 'string' } }[] ; name: string = 'VerificationKeyWithHash'; optionType: undefined = 'flaggedOption'; type: string = 'object' } ; optionType: string = 'flaggedOption'; type: string = 'option' } } | { docs: null = null; key: string = 'zkappUri'; value: { inner: { checkedType: { docs: null = null; layout: { docs: null = null; key: string = 'data'; value: { type: string = 'string' } }[] ; name: string = 'Events'; type: string = 'object' } ; checkedTypeName: string = 'StringWithHash'; docs: undefined = null; inner: undefined ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: undefined = 'flaggedOption'; type: string = 'string' } ; optionType: string = 'flaggedOption'; type: string = 'option' } })[] ; name: string = 'PartyUpdate'; type: string = 'object' } } | { docs: null = null; key: string = 'balanceChange'; value: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: null = null; inner: undefined ; layout: { docs: null = null; key: string = 'magnitude'; value: { type: string = 'UInt64' } }[] ; name: string = 'BalanceChange'; type: string = 'object' } } | { docs: null = null; key: string = 'events'; value: { checkedType: { docs: null = null; layout: ({ docs: null = null; key: string = 'data'; value: { inner: { inner: { type: string = 'Field' } ; type: string = 'array' } ; type: string = 'array' } } | { docs: null = null; key: string = 'hash'; value: { inner: undefined ; type: string = 'Field' } })[] ; name: string = 'Events'; type: string = 'object' } ; checkedTypeName: string = 'Events'; docs: undefined = null; inner: { inner: { type: string = 'Field' } ; type: string = 'array' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'array' } } | { docs: null = null; key: string = 'preconditions'; value: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: null = null; inner: undefined ; layout: ({ docs: null = null; key: string = 'network'; value: { docs: null = null; layout: ({ docs: null = null; key: string = 'snarkedLedgerHash'; value: { docs: undefined = null; inner: { docs: undefined = null; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'Field' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: string = 'flaggedOption'; type: string = 'option' } } | { docs: null = null; key: string = 'timestamp'; value: { docs: undefined = null; inner: { docs: null = null; layout: { docs: null = null; key: string = 'lower'; value: { type: string = 'UInt64' } }[] ; name: string = 'BlockTimeInterval'; type: string = 'object' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: string = 'implicit'; type: string = 'option' } } | { docs: null = null; key: string = 'stakingEpochData'; value: { docs: null = null; inner: undefined ; layout: ({ docs: null = null; key: string = 'ledger'; value: { docs: null = null; inner: undefined ; layout: ({ docs: null = null; key: string = 'hash'; value: { inner: { docs: undefined = null; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'Field' } ; optionType: string = 'flaggedOption'; type: string = 'option' } } | { docs: null = null; key: string = 'totalCurrency'; value: { inner: { docs: null = null; layout: { docs: null = null; key: string = 'lower'; value: { type: string = 'UInt64' } }[] ; name: string = 'CurrencyAmountInterval'; type: string = 'object' } ; optionType: string = 'implicit'; type: string = 'option' } })[] ; name: string = 'EpochLedgerPrecondition'; optionType: undefined = 'flaggedOption'; type: string = 'object' } } | { docs: null = null; key: string = 'seed'; value: { docs: undefined = null; inner: { docs: undefined = null; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'Field' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: string = 'flaggedOption'; type: string = 'option' } } | { docs: null = null; key: string = 'epochLength'; value: { docs: undefined = null; inner: { docs: null = null; layout: { docs: null = null; key: string = 'lower'; value: { type: string = 'UInt32' } }[] ; name: string = 'LengthInterval'; type: string = 'object' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: string = 'implicit'; type: string = 'option' } })[] ; name: string = 'EpochDataPrecondition'; optionType: undefined = 'flaggedOption'; type: string = 'object' } })[] ; name: string = 'NetworkPrecondition'; type: string = 'object' } } | { docs: null = null; key: string = 'account'; value: { docs: null = null; layout: ({ docs: null = null; key: string = 'balance'; value: { inner: { docs: null = null; inner: undefined ; layout: { docs: null = null; key: string = 'lower'; value: { type: string = 'UInt64' } }[] ; name: string = 'BalanceInterval'; optionType: undefined = 'flaggedOption'; type: string = 'object' } ; optionType: string = 'implicit'; type: string = 'option' } } | { docs: null = null; key: string = 'receiptChainHash'; value: { inner: { docs: undefined = null; inner: undefined ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: undefined = 'flaggedOption'; type: string = 'Field' } ; optionType: string = 'flaggedOption'; type: string = 'option' } } | { docs: null = null; key: string = 'state'; value: { inner: { docs: undefined = null; inner: { type: string = 'Field' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: string = 'flaggedOption'; type: string = 'option' } ; optionType: undefined = 'flaggedOption'; type: string = 'array' } })[] ; name: string = 'AccountPrecondition'; type: string = 'object' } })[] ; name: string = 'Preconditions'; type: string = 'object' } })[] ; name: string = 'PartyBody'; type: string = 'object' } } | { docs: null = null; key: string = 'authorization'; value: { docs: null = null; layout: { docs: null = null; key: string = 'proof'; value: { inner: { type: string = 'string' } ; optionType: string = 'orUndefined'; type: string = 'option' } }[] ; name: string = 'Control'; type: string = 'object' } })[] ; name: string = 'ZkappParty'; type: string = 'object' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'array' } } | { docs: null = null; key: string = 'memo'; value: { docs: undefined = null; inner: undefined ; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'string' } })[] ; name: string = 'Parties'; type: string = 'object' }
Parties.docsnull
Parties.layout({ docs: null = null; key: string = 'feePayer'; value: { docs: null = null; inner: undefined ; layout: ({ docs: null = null; key: string = 'body'; value: { docs: null = null; layout: ({ docs: null = null; key: string = 'publicKey'; value: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: undefined = null; inner: undefined ; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'PublicKey' } } | { docs: null = null; key: string = 'update'; value: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: null = null; inner: undefined ; layout: ({ docs: null = null; key: string = 'appState'; value: { inner: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: undefined = null; inner: { type: string = 'Field' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: string = 'flaggedOption'; type: string = 'option' } ; optionType: undefined = 'flaggedOption'; type: string = 'array' } } | { docs: null = null; key: string = 'delegate'; value: { inner: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: undefined = null; inner: undefined ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: undefined = 'flaggedOption'; type: string = 'PublicKey' } ; optionType: string = 'flaggedOption'; type: string = 'option' } } | { docs: null = null; key: string = 'verificationKey'; value: { inner: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: null = null; inner: undefined ; layout: { docs: null = null; key: string = 'data'; value: { type: string = 'string' } }[] ; name: string = 'VerificationKeyWithHash'; optionType: undefined = 'flaggedOption'; type: string = 'object' } ; optionType: string = 'flaggedOption'; type: string = 'option' } } | { docs: null = null; key: string = 'zkappUri'; value: { inner: { checkedType: { docs: null = null; layout: { docs: null = null; key: string = 'data'; value: { type: string = 'string' } }[] ; name: string = 'Events'; type: string = 'object' } ; checkedTypeName: string = 'StringWithHash'; docs: undefined = null; inner: undefined ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: undefined = 'flaggedOption'; type: string = 'string' } ; optionType: string = 'flaggedOption'; type: string = 'option' } })[] ; name: string = 'PartyUpdate'; type: string = 'object' } } | { docs: null = null; key: string = 'events'; value: { checkedType: { docs: null = null; layout: ({ docs: null = null; key: string = 'data'; value: { inner: { inner: { type: string = 'Field' } ; type: string = 'array' } ; type: string = 'array' } } | { docs: null = null; key: string = 'hash'; value: { inner: undefined ; type: string = 'Field' } })[] ; name: string = 'Events'; type: string = 'object' } ; checkedTypeName: string = 'Events'; docs: undefined = null; inner: { inner: { type: string = 'Field' } ; type: string = 'array' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'array' } } | { docs: null = null; key: string = 'networkPrecondition'; value: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: null = null; inner: undefined ; layout: ({ docs: null = null; key: string = 'snarkedLedgerHash'; value: { docs: undefined = null; inner: { docs: undefined = null; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'Field' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: string = 'flaggedOption'; type: string = 'option' } } | { docs: null = null; key: string = 'timestamp'; value: { docs: undefined = null; inner: { docs: null = null; layout: { docs: null = null; key: string = 'lower'; value: { type: string = 'UInt64' } }[] ; name: string = 'BlockTimeInterval'; type: string = 'object' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: string = 'implicit'; type: string = 'option' } } | { docs: null = null; key: string = 'stakingEpochData'; value: { docs: null = null; inner: undefined ; layout: ({ docs: null = null; key: string = 'ledger'; value: { docs: null = null; inner: undefined ; layout: ({ docs: null = null; key: string = 'hash'; value: { inner: { docs: undefined = null; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'Field' } ; optionType: string = 'flaggedOption'; type: string = 'option' } } | { docs: null = null; key: string = 'totalCurrency'; value: { inner: { docs: null = null; layout: { docs: null = null; key: string = 'lower'; value: { type: string = 'UInt64' } }[] ; name: string = 'CurrencyAmountInterval'; type: string = 'object' } ; optionType: string = 'implicit'; type: string = 'option' } })[] ; name: string = 'EpochLedgerPrecondition'; optionType: undefined = 'flaggedOption'; type: string = 'object' } } | { docs: null = null; key: string = 'seed'; value: { docs: undefined = null; inner: { docs: undefined = null; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'Field' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: string = 'flaggedOption'; type: string = 'option' } } | { docs: null = null; key: string = 'epochLength'; value: { docs: undefined = null; inner: { docs: null = null; layout: { docs: null = null; key: string = 'lower'; value: { type: string = 'UInt32' } }[] ; name: string = 'LengthInterval'; type: string = 'object' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: string = 'implicit'; type: string = 'option' } })[] ; name: string = 'EpochDataPrecondition'; optionType: undefined = 'flaggedOption'; type: string = 'object' } })[] ; name: string = 'NetworkPrecondition'; type: string = 'object' } })[] ; name: string = 'FeePayerPartyBody'; type: string = 'object' } } | { docs: null = null; key: string = 'authorization'; value: { docs: undefined = null; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'string' } })[] ; name: string = 'ZkappPartyFeePayer'; type: string = 'object' } } | { docs: null = null; key: string = 'otherParties'; value: { docs: undefined = null; inner: { docs: string = 'A party to a zkApp transaction'; layout: ({ docs: null = null; key: string = 'body'; value: { docs: null = null; layout: ({ docs: null = null; key: string = 'publicKey'; value: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: undefined = null; inner: undefined ; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'PublicKey' } } | { docs: null = null; key: string = 'update'; value: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: null = null; inner: undefined ; layout: ({ docs: null = null; key: string = 'appState'; value: { inner: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: undefined = null; inner: { type: string = 'Field' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: string = 'flaggedOption'; type: string = 'option' } ; optionType: undefined = 'flaggedOption'; type: string = 'array' } } | { docs: null = null; key: string = 'delegate'; value: { inner: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: undefined = null; inner: undefined ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: undefined = 'flaggedOption'; type: string = 'PublicKey' } ; optionType: string = 'flaggedOption'; type: string = 'option' } } | { docs: null = null; key: string = 'verificationKey'; value: { inner: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: null = null; inner: undefined ; layout: { docs: null = null; key: string = 'data'; value: { type: string = 'string' } }[] ; name: string = 'VerificationKeyWithHash'; optionType: undefined = 'flaggedOption'; type: string = 'object' } ; optionType: string = 'flaggedOption'; type: string = 'option' } } | { docs: null = null; key: string = 'zkappUri'; value: { inner: { checkedType: { docs: null = null; layout: { docs: null = null; key: string = 'data'; value: { type: string = 'string' } }[] ; name: string = 'Events'; type: string = 'object' } ; checkedTypeName: string = 'StringWithHash'; docs: undefined = null; inner: undefined ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: undefined = 'flaggedOption'; type: string = 'string' } ; optionType: string = 'flaggedOption'; type: string = 'option' } })[] ; name: string = 'PartyUpdate'; type: string = 'object' } } | { docs: null = null; key: string = 'balanceChange'; value: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: null = null; inner: undefined ; layout: { docs: null = null; key: string = 'magnitude'; value: { type: string = 'UInt64' } }[] ; name: string = 'BalanceChange'; type: string = 'object' } } | { docs: null = null; key: string = 'events'; value: { checkedType: { docs: null = null; layout: ({ docs: null = null; key: string = 'data'; value: { inner: { inner: { type: string = 'Field' } ; type: string = 'array' } ; type: string = 'array' } } | { docs: null = null; key: string = 'hash'; value: { inner: undefined ; type: string = 'Field' } })[] ; name: string = 'Events'; type: string = 'object' } ; checkedTypeName: string = 'Events'; docs: undefined = null; inner: { inner: { type: string = 'Field' } ; type: string = 'array' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'array' } } | { docs: null = null; key: string = 'preconditions'; value: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: null = null; inner: undefined ; layout: ({ docs: null = null; key: string = 'network'; value: { docs: null = null; layout: ({ docs: null = null; key: string = 'snarkedLedgerHash'; value: { docs: undefined = null; inner: { docs: undefined = null; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'Field' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: string = 'flaggedOption'; type: string = 'option' } } | { docs: null = null; key: string = 'timestamp'; value: { docs: undefined = null; inner: { docs: null = null; layout: { docs: null = null; key: string = 'lower'; value: { type: string = 'UInt64' } }[] ; name: string = 'BlockTimeInterval'; type: string = 'object' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: string = 'implicit'; type: string = 'option' } } | { docs: null = null; key: string = 'stakingEpochData'; value: { docs: null = null; inner: undefined ; layout: ({ docs: null = null; key: string = 'ledger'; value: { docs: null = null; inner: undefined ; layout: ({ docs: null = null; key: string = 'hash'; value: { inner: { docs: undefined = null; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'Field' } ; optionType: string = 'flaggedOption'; type: string = 'option' } } | { docs: null = null; key: string = 'totalCurrency'; value: { inner: { docs: null = null; layout: { docs: null = null; key: string = 'lower'; value: { type: string = 'UInt64' } }[] ; name: string = 'CurrencyAmountInterval'; type: string = 'object' } ; optionType: string = 'implicit'; type: string = 'option' } })[] ; name: string = 'EpochLedgerPrecondition'; optionType: undefined = 'flaggedOption'; type: string = 'object' } } | { docs: null = null; key: string = 'seed'; value: { docs: undefined = null; inner: { docs: undefined = null; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'Field' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: string = 'flaggedOption'; type: string = 'option' } } | { docs: null = null; key: string = 'epochLength'; value: { docs: undefined = null; inner: { docs: null = null; layout: { docs: null = null; key: string = 'lower'; value: { type: string = 'UInt32' } }[] ; name: string = 'LengthInterval'; type: string = 'object' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: string = 'implicit'; type: string = 'option' } })[] ; name: string = 'EpochDataPrecondition'; optionType: undefined = 'flaggedOption'; type: string = 'object' } })[] ; name: string = 'NetworkPrecondition'; type: string = 'object' } } | { docs: null = null; key: string = 'account'; value: { docs: null = null; layout: ({ docs: null = null; key: string = 'balance'; value: { inner: { docs: null = null; inner: undefined ; layout: { docs: null = null; key: string = 'lower'; value: { type: string = 'UInt64' } }[] ; name: string = 'BalanceInterval'; optionType: undefined = 'flaggedOption'; type: string = 'object' } ; optionType: string = 'implicit'; type: string = 'option' } } | { docs: null = null; key: string = 'receiptChainHash'; value: { inner: { docs: undefined = null; inner: undefined ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: undefined = 'flaggedOption'; type: string = 'Field' } ; optionType: string = 'flaggedOption'; type: string = 'option' } } | { docs: null = null; key: string = 'state'; value: { inner: { docs: undefined = null; inner: { type: string = 'Field' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: string = 'flaggedOption'; type: string = 'option' } ; optionType: undefined = 'flaggedOption'; type: string = 'array' } })[] ; name: string = 'AccountPrecondition'; type: string = 'object' } })[] ; name: string = 'Preconditions'; type: string = 'object' } })[] ; name: string = 'PartyBody'; type: string = 'object' } } | { docs: null = null; key: string = 'authorization'; value: { docs: null = null; layout: { docs: null = null; key: string = 'proof'; value: { inner: { type: string = 'string' } ; optionType: string = 'orUndefined'; type: string = 'option' } }[] ; name: string = 'Control'; type: string = 'object' } })[] ; name: string = 'ZkappParty'; type: string = 'object' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'array' } } | { docs: null = null; key: string = 'memo'; value: { docs: undefined = null; inner: undefined ; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'string' } })[]
Parties.namestring
Parties.typestring
Party{ docs: string = 'A party to a zkApp transaction'; layout: ({ docs: null = null; key: string = 'body'; value: { docs: null = null; layout: ({ docs: null = null; key: string = 'publicKey'; value: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: undefined = null; inner: undefined ; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'PublicKey' } } | { docs: null = null; key: string = 'update'; value: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: null = null; inner: undefined ; layout: ({ docs: null = null; key: string = 'appState'; value: { inner: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: undefined = null; inner: { type: string = 'Field' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: string = 'flaggedOption'; type: string = 'option' } ; optionType: undefined = 'flaggedOption'; type: string = 'array' } } | { docs: null = null; key: string = 'delegate'; value: { inner: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: undefined = null; inner: undefined ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: undefined = 'flaggedOption'; type: string = 'PublicKey' } ; optionType: string = 'flaggedOption'; type: string = 'option' } } | { docs: null = null; key: string = 'verificationKey'; value: { inner: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: null = null; inner: undefined ; layout: { docs: null = null; key: string = 'data'; value: { type: string = 'string' } }[] ; name: string = 'VerificationKeyWithHash'; optionType: undefined = 'flaggedOption'; type: string = 'object' } ; optionType: string = 'flaggedOption'; type: string = 'option' } } | { docs: null = null; key: string = 'zkappUri'; value: { inner: { checkedType: { docs: null = null; layout: { docs: null = null; key: string = 'data'; value: { type: string = 'string' } }[] ; name: string = 'Events'; type: string = 'object' } ; checkedTypeName: string = 'StringWithHash'; docs: undefined = null; inner: undefined ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: undefined = 'flaggedOption'; type: string = 'string' } ; optionType: string = 'flaggedOption'; type: string = 'option' } })[] ; name: string = 'PartyUpdate'; type: string = 'object' } } | { docs: null = null; key: string = 'balanceChange'; value: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: null = null; inner: undefined ; layout: { docs: null = null; key: string = 'magnitude'; value: { type: string = 'UInt64' } }[] ; name: string = 'BalanceChange'; type: string = 'object' } } | { docs: null = null; key: string = 'events'; value: { checkedType: { docs: null = null; layout: ({ docs: null = null; key: string = 'data'; value: { inner: { inner: { type: string = 'Field' } ; type: string = 'array' } ; type: string = 'array' } } | { docs: null = null; key: string = 'hash'; value: { inner: undefined ; type: string = 'Field' } })[] ; name: string = 'Events'; type: string = 'object' } ; checkedTypeName: string = 'Events'; docs: undefined = null; inner: { inner: { type: string = 'Field' } ; type: string = 'array' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'array' } } | { docs: null = null; key: string = 'preconditions'; value: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: null = null; inner: undefined ; layout: ({ docs: null = null; key: string = 'network'; value: { docs: null = null; layout: ({ docs: null = null; key: string = 'snarkedLedgerHash'; value: { docs: undefined = null; inner: { docs: undefined = null; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'Field' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: string = 'flaggedOption'; type: string = 'option' } } | { docs: null = null; key: string = 'timestamp'; value: { docs: undefined = null; inner: { docs: null = null; layout: { docs: null = null; key: string = 'lower'; value: { type: string = 'UInt64' } }[] ; name: string = 'BlockTimeInterval'; type: string = 'object' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: string = 'implicit'; type: string = 'option' } } | { docs: null = null; key: string = 'stakingEpochData'; value: { docs: null = null; inner: undefined ; layout: ({ docs: null = null; key: string = 'ledger'; value: { docs: null = null; inner: undefined ; layout: ({ docs: null = null; key: string = 'hash'; value: { inner: { docs: undefined = null; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'Field' } ; optionType: string = 'flaggedOption'; type: string = 'option' } } | { docs: null = null; key: string = 'totalCurrency'; value: { inner: { docs: null = null; layout: { docs: null = null; key: string = 'lower'; value: { type: string = 'UInt64' } }[] ; name: string = 'CurrencyAmountInterval'; type: string = 'object' } ; optionType: string = 'implicit'; type: string = 'option' } })[] ; name: string = 'EpochLedgerPrecondition'; optionType: undefined = 'flaggedOption'; type: string = 'object' } } | { docs: null = null; key: string = 'seed'; value: { docs: undefined = null; inner: { docs: undefined = null; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'Field' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: string = 'flaggedOption'; type: string = 'option' } } | { docs: null = null; key: string = 'epochLength'; value: { docs: undefined = null; inner: { docs: null = null; layout: { docs: null = null; key: string = 'lower'; value: { type: string = 'UInt32' } }[] ; name: string = 'LengthInterval'; type: string = 'object' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: string = 'implicit'; type: string = 'option' } })[] ; name: string = 'EpochDataPrecondition'; optionType: undefined = 'flaggedOption'; type: string = 'object' } })[] ; name: string = 'NetworkPrecondition'; type: string = 'object' } } | { docs: null = null; key: string = 'account'; value: { docs: null = null; layout: ({ docs: null = null; key: string = 'balance'; value: { inner: { docs: null = null; inner: undefined ; layout: { docs: null = null; key: string = 'lower'; value: { type: string = 'UInt64' } }[] ; name: string = 'BalanceInterval'; optionType: undefined = 'flaggedOption'; type: string = 'object' } ; optionType: string = 'implicit'; type: string = 'option' } } | { docs: null = null; key: string = 'receiptChainHash'; value: { inner: { docs: undefined = null; inner: undefined ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: undefined = 'flaggedOption'; type: string = 'Field' } ; optionType: string = 'flaggedOption'; type: string = 'option' } } | { docs: null = null; key: string = 'state'; value: { inner: { docs: undefined = null; inner: { type: string = 'Field' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: string = 'flaggedOption'; type: string = 'option' } ; optionType: undefined = 'flaggedOption'; type: string = 'array' } })[] ; name: string = 'AccountPrecondition'; type: string = 'object' } })[] ; name: string = 'Preconditions'; type: string = 'object' } })[] ; name: string = 'PartyBody'; type: string = 'object' } } | { docs: null = null; key: string = 'authorization'; value: { docs: null = null; layout: { docs: null = null; key: string = 'proof'; value: { inner: { type: string = 'string' } ; optionType: string = 'orUndefined'; type: string = 'option' } }[] ; name: string = 'Control'; type: string = 'object' } })[] ; name: string = 'ZkappParty'; type: string = 'object' }
Party.docsstring
Party.layout({ docs: null = null; key: string = 'body'; value: { docs: null = null; layout: ({ docs: null = null; key: string = 'publicKey'; value: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: undefined = null; inner: undefined ; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'PublicKey' } } | { docs: null = null; key: string = 'update'; value: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: null = null; inner: undefined ; layout: ({ docs: null = null; key: string = 'appState'; value: { inner: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: undefined = null; inner: { type: string = 'Field' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: string = 'flaggedOption'; type: string = 'option' } ; optionType: undefined = 'flaggedOption'; type: string = 'array' } } | { docs: null = null; key: string = 'delegate'; value: { inner: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: undefined = null; inner: undefined ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: undefined = 'flaggedOption'; type: string = 'PublicKey' } ; optionType: string = 'flaggedOption'; type: string = 'option' } } | { docs: null = null; key: string = 'verificationKey'; value: { inner: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: null = null; inner: undefined ; layout: { docs: null = null; key: string = 'data'; value: { type: string = 'string' } }[] ; name: string = 'VerificationKeyWithHash'; optionType: undefined = 'flaggedOption'; type: string = 'object' } ; optionType: string = 'flaggedOption'; type: string = 'option' } } | { docs: null = null; key: string = 'zkappUri'; value: { inner: { checkedType: { docs: null = null; layout: { docs: null = null; key: string = 'data'; value: { type: string = 'string' } }[] ; name: string = 'Events'; type: string = 'object' } ; checkedTypeName: string = 'StringWithHash'; docs: undefined = null; inner: undefined ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: undefined = 'flaggedOption'; type: string = 'string' } ; optionType: string = 'flaggedOption'; type: string = 'option' } })[] ; name: string = 'PartyUpdate'; type: string = 'object' } } | { docs: null = null; key: string = 'balanceChange'; value: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: null = null; inner: undefined ; layout: { docs: null = null; key: string = 'magnitude'; value: { type: string = 'UInt64' } }[] ; name: string = 'BalanceChange'; type: string = 'object' } } | { docs: null = null; key: string = 'events'; value: { checkedType: { docs: null = null; layout: ({ docs: null = null; key: string = 'data'; value: { inner: { inner: { type: string = 'Field' } ; type: string = 'array' } ; type: string = 'array' } } | { docs: null = null; key: string = 'hash'; value: { inner: undefined ; type: string = 'Field' } })[] ; name: string = 'Events'; type: string = 'object' } ; checkedTypeName: string = 'Events'; docs: undefined = null; inner: { inner: { type: string = 'Field' } ; type: string = 'array' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'array' } } | { docs: null = null; key: string = 'preconditions'; value: { checkedType: undefined ; checkedTypeName: undefined = 'Events'; docs: null = null; inner: undefined ; layout: ({ docs: null = null; key: string = 'network'; value: { docs: null = null; layout: ({ docs: null = null; key: string = 'snarkedLedgerHash'; value: { docs: undefined = null; inner: { docs: undefined = null; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'Field' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: string = 'flaggedOption'; type: string = 'option' } } | { docs: null = null; key: string = 'timestamp'; value: { docs: undefined = null; inner: { docs: null = null; layout: { docs: null = null; key: string = 'lower'; value: { type: string = 'UInt64' } }[] ; name: string = 'BlockTimeInterval'; type: string = 'object' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: string = 'implicit'; type: string = 'option' } } | { docs: null = null; key: string = 'stakingEpochData'; value: { docs: null = null; inner: undefined ; layout: ({ docs: null = null; key: string = 'ledger'; value: { docs: null = null; inner: undefined ; layout: ({ docs: null = null; key: string = 'hash'; value: { inner: { docs: undefined = null; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'Field' } ; optionType: string = 'flaggedOption'; type: string = 'option' } } | { docs: null = null; key: string = 'totalCurrency'; value: { inner: { docs: null = null; layout: { docs: null = null; key: string = 'lower'; value: { type: string = 'UInt64' } }[] ; name: string = 'CurrencyAmountInterval'; type: string = 'object' } ; optionType: string = 'implicit'; type: string = 'option' } })[] ; name: string = 'EpochLedgerPrecondition'; optionType: undefined = 'flaggedOption'; type: string = 'object' } } | { docs: null = null; key: string = 'seed'; value: { docs: undefined = null; inner: { docs: undefined = null; layout: undefined ; name: undefined = 'NetworkPrecondition'; type: string = 'Field' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: string = 'flaggedOption'; type: string = 'option' } } | { docs: null = null; key: string = 'epochLength'; value: { docs: undefined = null; inner: { docs: null = null; layout: { docs: null = null; key: string = 'lower'; value: { type: string = 'UInt32' } }[] ; name: string = 'LengthInterval'; type: string = 'object' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: string = 'implicit'; type: string = 'option' } })[] ; name: string = 'EpochDataPrecondition'; optionType: undefined = 'flaggedOption'; type: string = 'object' } })[] ; name: string = 'NetworkPrecondition'; type: string = 'object' } } | { docs: null = null; key: string = 'account'; value: { docs: null = null; layout: ({ docs: null = null; key: string = 'balance'; value: { inner: { docs: null = null; inner: undefined ; layout: { docs: null = null; key: string = 'lower'; value: { type: string = 'UInt64' } }[] ; name: string = 'BalanceInterval'; optionType: undefined = 'flaggedOption'; type: string = 'object' } ; optionType: string = 'implicit'; type: string = 'option' } } | { docs: null = null; key: string = 'receiptChainHash'; value: { inner: { docs: undefined = null; inner: undefined ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: undefined = 'flaggedOption'; type: string = 'Field' } ; optionType: string = 'flaggedOption'; type: string = 'option' } } | { docs: null = null; key: string = 'state'; value: { inner: { docs: undefined = null; inner: { type: string = 'Field' } ; layout: undefined ; name: undefined = 'NetworkPrecondition'; optionType: string = 'flaggedOption'; type: string = 'option' } ; optionType: undefined = 'flaggedOption'; type: string = 'array' } })[] ; name: string = 'AccountPrecondition'; type: string = 'object' } })[] ; name: string = 'Preconditions'; type: string = 'object' } })[] ; name: string = 'PartyBody'; type: string = 'object' } } | { docs: null = null; key: string = 'authorization'; value: { docs: null = null; layout: { docs: null = null; key: string = 'proof'; value: { inner: { type: string = 'string' } ; optionType: string = 'orUndefined'; type: string = 'option' } }[] ; name: string = 'Control'; type: string = 'object' } })[]
Party.namestring
Party.typestring

Defined in

snarky/gen/js-layout.ts:4

Functions

State

State<A>(): State<A>

Type parameters

Name
A

Returns

State<A>

Defined in

lib/state.ts:20


addCachedAccount

addCachedAccount(account, graphqlEndpoint?): void

Parameters

NameTypeDefault value
accountObjectundefined
account.balance?string | number | UInt64undefined
account.noncestring | number | UInt32undefined
account.publicKeystring | PublicKeyundefined
account.zkapp?Objectundefined
account.zkapp.appState(string | number | Field)[]undefined
graphqlEndpointstringdefaultGraphqlEndpoint

Returns

void

Defined in

lib/fetch.ts:324


addMissingProofs

addMissingProofs(parties): Promise<PartiesProved>

Parameters

NameType
partiesParties

Returns

Promise<PartiesProved>

Defined in

lib/party.ts:879


addMissingSignatures

addMissingSignatures(parties, additionalKeys?): PartiesSigned

Parameters

NameType
partiesParties
additionalKeysPrivateKey[]

Returns

PartiesSigned

Defined in

lib/party.ts:810


arrayProp

arrayProp<T>(elementType, length): (target: any, key: string) => void

Type parameters

Name
T

Parameters

NameType
elementTypeAsFieldElements<T>
lengthnumber

Returns

fn

▸ (target, key): void

Parameters
NameType
targetany
keystring
Returns

void

Defined in

lib/circuit_value.ts:178


asFieldElementsToConstant

asFieldElementsToConstant<T>(typ, t): T

Type parameters

Name
T

Parameters

NameType
typAsFieldElements<T>
tT

Returns

T

Defined in

lib/circuit_value.ts:18


circuitMain

circuitMain(target, propertyName, _descriptor?): any

Parameters

NameType
targetany
propertyNamestring
_descriptor?PropertyDescriptor

Returns

any

Defined in

lib/circuit_value.ts:243


circuitValueEquals

circuitValueEquals<T>(a, b): boolean

Type parameters

Name
T

Parameters

NameType
aT
bT

Returns

boolean

Defined in

lib/circuit_value.ts:312


cloneCircuitValue

cloneCircuitValue<T>(obj): T

Type parameters

Name
T

Parameters

NameType
objT

Returns

T

Defined in

lib/circuit_value.ts:282


declareMethods

declareMethods<T>(SmartContract, methodArguments): void

declareMethods can be used in place of the @method decorator to declare SmartContract methods along with their list of arguments. It should be placed after the class declaration. Here is an example of declaring a method update, which takes a single argument of type Field:

class MyContract extends SmartContract {
  // ...
  update(x: Field) {
    // ...
  }
}
declareMethods(MyContract, { update: [Field] }); // `[Field]` is the list of arguments!

Note that a method of the same name must still be defined on the class, just without the decorator.

Type parameters

NameType
Textends typeof SmartContract

Parameters

NameType
SmartContractT
methodArgumentsRecord<string, AsFieldElements<unknown>[]>

Returns

void

Defined in

lib/zkapp.ts:500


declareState

declareState<T>(SmartContract, states): void

declareState can be used in place of the @state decorator to declare on-chain state on a SmartContract. It should be placed after the class declaration. Here is an example of declaring a state property x of type Field.

class MyContract extends SmartContract {
  x = State<Field>();
  // ...
}
declareState(MyContract, { x: Field });

If you're using pure JS, it's not possible to use the built-in class field syntax, i.e. the following will not work:

// THIS IS WRONG IN JS!
class MyContract extends SmartContract {
  x = State();
}
declareState(MyContract, { x: Field });

Instead, add a constructor where you assign the property:

class MyContract extends SmartContract {
  constructor(x) {
    super();
    this.x = State();
  }
}
declareState(MyContract, { x: Field });

Type parameters

NameType
Textends typeof SmartContract

Parameters

NameType
SmartContractT
statesRecord<string, AsFieldElements<unknown>>

Returns

void

Defined in

lib/state.ts:107


deploy

deploy<S>(SmartContract, __namedParameters): Promise<string>

Type parameters

NameType
Sextends typeof SmartContract

Parameters

NameType
SmartContractS
__namedParametersObject
__namedParameters.feePayerKey?PrivateKey
__namedParameters.feePayerNonce?string | number
__namedParameters.initialBalance?string | number
__namedParameters.memo?string
__namedParameters.shouldSignFeePayer?boolean
__namedParameters.transactionFee?string | number
__namedParameters.verificationKeyObject
__namedParameters.verificationKey.datastring
__namedParameters.verificationKey.hashstring | Field
__namedParameters.zkappKeyPrivateKey

Returns

Promise<string>

Defined in

lib/zkapp.ts:363


fetchAccount

fetchAccount(publicKey, graphqlEndpoint?, config?): Promise<{ account: Account ; error: undefined } | { account: undefined ; error: FetchError }>

Gets account information on the specified publicKey by performing a GraphQL query to the specified endpoint. This will call the 'GetAccountInfo' query which fetches zkapp related account information.

If an error is returned by the specified endpoint, an error is thrown. Otherwise, the data is returned.

Parameters

NameTypeDefault valueDescription
publicKeystring | PublicKeyundefinedThe specified account to get account information on
graphqlEndpointstringdefaultGraphqlEndpointThe graphql endpoint to fetch from
configObject{}An object that exposes an additional timeout option
config.timeoutundefined | numberundefined-

Returns

Promise<{ account: Account ; error: undefined } | { account: undefined ; error: FetchError }>

zkapp information on the specified account or an error is thrown

Defined in

lib/fetch.ts:43


fetchLastBlock

fetchLastBlock(graphqlEndpoint?): Promise<PreconditionBaseTypes<{ blockchainLength: { lower: UInt32 ; upper: UInt32 } ; globalSlotSinceGenesis: { lower: UInt32 ; upper: UInt32 } ; globalSlotSinceHardFork: { lower: UInt32 ; upper: UInt32 } ; minWindowDensity: { lower: UInt32 ; upper: UInt32 } ; nextEpochData: { epochLength: { lower: UInt32 ; upper: UInt32 } ; ledger: { hash: { isSome: Bool ; value: Field } ; totalCurrency: { lower: UInt64 ; upper: UInt64 } } ; lockCheckpoint: { isSome: Bool ; value: Field } ; seed: { isSome: Bool ; value: Field } ; startCheckpoint: { isSome: Bool ; value: Field } } ; snarkedLedgerHash: { isSome: Bool ; value: Field } ; stakingEpochData: { epochLength: { lower: UInt32 ; upper: UInt32 } ; ledger: { hash: { isSome: Bool ; value: Field } ; totalCurrency: { lower: UInt64 ; upper: UInt64 } } ; lockCheckpoint: { isSome: Bool ; value: Field } ; seed: { isSome: Bool ; value: Field } ; startCheckpoint: { isSome: Bool ; value: Field } } ; timestamp: { lower: UInt64 ; upper: UInt64 } ; totalCurrency: { lower: UInt64 ; upper: UInt64 } }>>

Parameters

NameTypeDefault value
graphqlEndpointstringdefaultGraphqlEndpoint

Returns

Promise<PreconditionBaseTypes<{ blockchainLength: { lower: UInt32 ; upper: UInt32 } ; globalSlotSinceGenesis: { lower: UInt32 ; upper: UInt32 } ; globalSlotSinceHardFork: { lower: UInt32 ; upper: UInt32 } ; minWindowDensity: { lower: UInt32 ; upper: UInt32 } ; nextEpochData: { epochLength: { lower: UInt32 ; upper: UInt32 } ; ledger: { hash: { isSome: Bool ; value: Field } ; totalCurrency: { lower: UInt64 ; upper: UInt64 } } ; lockCheckpoint: { isSome: Bool ; value: Field } ; seed: { isSome: Bool ; value: Field } ; startCheckpoint: { isSome: Bool ; value: Field } } ; snarkedLedgerHash: { isSome: Bool ; value: Field } ; stakingEpochData: { epochLength: { lower: UInt32 ; upper: UInt32 } ; ledger: { hash: { isSome: Bool ; value: Field } ; totalCurrency: { lower: UInt64 ; upper: UInt64 } } ; lockCheckpoint: { isSome: Bool ; value: Field } ; seed: { isSome: Bool ; value: Field } ; startCheckpoint: { isSome: Bool ; value: Field } } ; timestamp: { lower: UInt64 ; upper: UInt64 } ; totalCurrency: { lower: UInt64 ; upper: UInt64 } }>>

Defined in

lib/fetch.ts:349


getSrs

getSrs(keypair): typeof WasmFpSrs

Parameters

NameTypeDescription
keypairKeypairSNARK keypair, as returned by Circuit.generateKeypair

Returns

typeof WasmFpSrs

The SRS (structured reference string), needed to reconstruct the keypair later

Defined in

snarky/addons.js:18


matrixProp

matrixProp<T>(elementType, nRows, nColumns): (target: any, key: string) => void

Type parameters

Name
T

Parameters

NameType
elementTypeAsFieldElements<T>
nRowsnumber
nColumnsnumber

Returns

fn

▸ (target, key): void

Parameters
NameType
targetany
keystring
Returns

void

Defined in

lib/circuit_value.ts:187


method

method<T>(target, methodName, descriptor): void

A decorator to use in a zkapp to mark a method as callable by anyone. You can use inside your zkapp class as:

@method myMethod(someArg: Field) {
 // your code here
}

Type parameters

NameType
Textends SmartContract<T>

Parameters

NameType
targetT & { constructor: any }
methodNamekeyof T & string
descriptorPropertyDescriptor

Returns

void

Defined in

lib/zkapp.ts:46


parseFetchedAccount

parseFetchedAccount(account): Account

Parameters

NameType
accountFetchedAccount

Returns

Account

Defined in

lib/fetch.ts:196

parseFetchedAccount(account): Partial<Account>

Parameters

NameType
accountPartial<FetchedAccount>

Returns

Partial<Account>

Defined in

lib/fetch.ts:197


partiesToJson

partiesToJson(parties): Parties

Parameters

NameType
partiesParties

Returns

Parties

Defined in

lib/party.ts:806


prop

prop(this, target, key): void

Parameters

NameType
thisany
targetany
keystring

Returns

void

Defined in

lib/circuit_value.ts:136


public_

public_(target, _key, index): void

Parameters

NameType
targetany
_keystring | symbol
indexnumber

Returns

void

Defined in

lib/circuit_value.ts:203


recoverVerificationKey

recoverVerificationKey(srs, serializedVk): VerificationKey

Parameters

NameTypeDescription
srstypeof WasmFpSrsthe "structured reference string", a set of precomputed values needed for verifying proofs
serializedVkstringstring representation of a Circuit verification key

Returns

VerificationKey

the recovered verification key

Defined in

snarky/addons.js:49


sendZkapp

sendZkapp(json, graphqlEndpoint?, __namedParameters?): Promise<[FetchResponse, undefined] | [undefined, FetchError]>

Parameters

NameTypeDefault value
jsonstringundefined
graphqlEndpointstringdefaultGraphqlEndpoint
__namedParametersObject{}
__namedParameters.timeoutundefined | numberundefined

Returns

Promise<[FetchResponse, undefined] | [undefined, FetchError]>

Defined in

lib/fetch.ts:493


sendZkappQuery

sendZkappQuery(json): string

Parameters

NameType
jsonstring

Returns

string

Defined in

lib/fetch.ts:504


serializeVerificationKey

serializeVerificationKey(verificationKey): string

Parameters

NameTypeDescription
verificationKeyVerificationKeythe verification key of a Circuit

Returns

string

string representation of the verification key

Defined in

snarky/addons.js:27


setGraphqlEndpoint

setGraphqlEndpoint(graphqlEndpoint): void

Parameters

NameType
graphqlEndpointstring

Returns

void

Defined in

lib/fetch.ts:26


shutdown

shutdown(): Promise<undefined>

This function must be called at the end of a nodejs program, otherwise the worker threads will continue running and the program will never terminate. From web applications, this function is a no-op.

Returns

Promise<undefined>

Defined in

snarky.d.ts:753


signFeePayer

signFeePayer(transactionJson, feePayerKey, __namedParameters): string

Parameters

NameType
transactionJsonstring
feePayerKeystring | PrivateKey
__namedParametersObject

Returns

string

Defined in

lib/zkapp.ts:458


signJsonTransaction

signJsonTransaction(transactionJson, privateKey): string

Sign all parties of a transaction which belong to the account determined by [[privateKey]].

Parameters

NameType
transactionJsonstring
privateKeystring | PrivateKey

Returns

string

the modified transaction JSON

Defined in

lib/party.ts:930


state

state<A>(stateType): (target: SmartContract & { constructor: any }, key: string, _descriptor?: PropertyDescriptor) => void

A decorator to use within a zkapp to indicate what will be stored on-chain. For example, if you want to store a field element some_state in a zkapp, you can use the following in the declaration of your zkapp:

@state(Field) some_state = State<Field>();

Type parameters

Name
A

Parameters

NameType
stateTypeAsFieldElements<A>

Returns

fn

▸ (target, key, _descriptor?): void

Parameters
NameType
targetSmartContract & { constructor: any }
keystring
_descriptor?PropertyDescriptor
Returns

void

Defined in

lib/state.ts:34


toPartiesUnsafe

toPartiesUnsafe(__namedParameters): Parties

Parameters

NameType
__namedParametersObject
__namedParameters.feePayerFeePayerUnsigned
__namedParameters.memostring
__namedParameters.otherPartiesParty[]

Returns

Parties

Defined in

lib/party.ts:790


toPartyUnsafe

toPartyUnsafe(__namedParameters): Party

Parameters

NameType
__namedParametersParty

Returns

Party

Defined in

lib/party.ts:784

Modules

snarkyjs / Exports / Encoding

Namespace: Encoding

Table of contents

Variables

Functions

Variables

Bijective

Const Bijective: Object

Type declaration
NameType
Fp{ fromBytes: (bytes: Uint8Array) => Field[] ; toBytes: (fields: Field[]) => Uint8Array ; fromString: (message: string) => Field[] ; toString: (fields: Field[]) => string }
Fp.fromBytes(bytes: Uint8Array) => Field[]
Fp.toBytes(fields: Field[]) => Uint8Array
Fp.fromString[object Object]
Fp.toString[object Object]
Fq{ fromBytes: (bytes: Uint8Array) => Field[] ; toBytes: (fields: Field[]) => Uint8Array ; fromString: (message: string) => Field[] ; toString: (fields: Field[]) => string }
Fq.fromBytes(bytes: Uint8Array) => Field[]
Fq.toBytes(fields: Field[]) => Uint8Array
Fq.fromString[object Object]
Fq.toString[object Object]
Defined in

lib/encoding.ts:83

Functions

bytesFromFields

bytesFromFields(fields): Uint8Array

Parameters
NameType
fieldsField[]
Returns

Uint8Array

Defined in

lib/encoding.ts:52


bytesToFields

bytesToFields(bytes): Field[]

Parameters
NameType
bytesUint8Array
Returns

Field[]

Defined in

lib/encoding.ts:32


stringFromFields

stringFromFields(fields): string

Parameters
NameType
fieldsField[]
Returns

string

Defined in

lib/encoding.ts:25


stringToFields

stringToFields(message): Field[]

Parameters
NameType
messagestring
Returns

Field[]

Defined in

lib/encoding.ts:20

snarkyjs / Exports / Encryption

Namespace: Encryption

Table of contents

Functions

Functions

decrypt

decrypt(__namedParameters, privateKey): Field[]

Parameters
NameType
__namedParametersCipherText
privateKeyPrivateKey
Returns

Field[]

Defined in

lib/encryption.ts:58


encrypt

encrypt(message, otherPublicKey): Object

Parameters
NameType
messageField[]
otherPublicKeyPublicKey
Returns

Object

NameType
cipherTextField[]
publicKeyGroup
Defined in

lib/encryption.ts:30

snarkyjs / Exports / Mina

Namespace: Mina

Table of contents

Type Aliases

Variables

Functions

Type Aliases

CurrentTransaction

Ƭ CurrentTransaction: undefined | { fetchMode: FetchMode ; nextPartyIndex: number ; parties: Party[] ; sender?: PrivateKey }

Defined in

lib/mina.ts:55

Variables

currentTransaction

currentTransaction: CurrentTransaction = undefined

Defined in

lib/mina.ts:64


nextTransactionId

nextTransactionId: Object

Type declaration
NameType
valuenumber
Defined in

lib/mina.ts:52

Functions

BerkeleyQANet

BerkeleyQANet(graphqlEndpoint): Mina

Parameters
NameType
graphqlEndpointstring
Returns

Mina

Defined in

lib/mina.ts:340


LocalBlockchain

LocalBlockchain(__namedParameters?): MockMina

A mock Mina blockchain running locally and useful for testing.

Parameters
NameType
__namedParametersObject
__namedParameters.accountCreationFeeundefined | string | number
Returns

MockMina

Defined in

lib/mina.ts:195


accountCreationFee

accountCreationFee(): UInt64

Returns

UInt64

Defined in

lib/mina.ts:447


createTransaction

createTransaction(feePayer, f, __namedParameters?): Transaction

Parameters
NameType
feePayerSenderSpec
f() => unknown
__namedParametersObject
__namedParameters.fetchModeundefined | FetchMode
Returns

Transaction

Defined in

lib/mina.ts:81


createUnsignedTransaction

createUnsignedTransaction(f, __namedParameters?): Transaction

Parameters
NameType
f() => unknown
__namedParametersObject
__namedParameters.fetchModeundefined | FetchMode
Returns

Transaction

Defined in

lib/mina.ts:74


currentSlot

currentSlot(): UInt32

Returns

UInt32

The current slot number, according to the active Mina instance.

Defined in

lib/mina.ts:422


getAccount

getAccount(pubkey): Account

Parameters
NameType
pubkeyPublicKey
Returns

Account

The account data associated to the given public key.

Defined in

lib/mina.ts:429


getBalance

getBalance(pubkey): UInt64

Parameters
NameType
pubkeyPublicKey
Returns

UInt64

The balance associated to the given public key.

Defined in

lib/mina.ts:443


getNetworkState

getNetworkState(): PreconditionBaseTypes<{ blockchainLength: { lower: UInt32 ; upper: UInt32 } ; globalSlotSinceGenesis: { lower: UInt32 ; upper: UInt32 } ; globalSlotSinceHardFork: { lower: UInt32 ; upper: UInt32 } ; minWindowDensity: { lower: UInt32 ; upper: UInt32 } ; nextEpochData: { epochLength: { lower: UInt32 ; upper: UInt32 } ; ledger: { hash: { isSome: Bool ; value: Field } ; totalCurrency: { lower: UInt64 ; upper: UInt64 } } ; lockCheckpoint: { isSome: Bool ; value: Field } ; seed: { isSome: Bool ; value: Field } ; startCheckpoint: { isSome: Bool ; value: Field } } ; snarkedLedgerHash: { isSome: Bool ; value: Field } ; stakingEpochData: { epochLength: { lower: UInt32 ; upper: UInt32 } ; ledger: { hash: { isSome: Bool ; value: Field } ; totalCurrency: { lower: UInt64 ; upper: UInt64 } } ; lockCheckpoint: { isSome: Bool ; value: Field } ; seed: { isSome: Bool ; value: Field } ; startCheckpoint: { isSome: Bool ; value: Field } } ; timestamp: { lower: UInt64 ; upper: UInt64 } ; totalCurrency: { lower: UInt64 ; upper: UInt64 } }>

Returns

PreconditionBaseTypes<{ blockchainLength: { lower: UInt32 ; upper: UInt32 } ; globalSlotSinceGenesis: { lower: UInt32 ; upper: UInt32 } ; globalSlotSinceHardFork: { lower: UInt32 ; upper: UInt32 } ; minWindowDensity: { lower: UInt32 ; upper: UInt32 } ; nextEpochData: { epochLength: { lower: UInt32 ; upper: UInt32 } ; ledger: { hash: { isSome: Bool ; value: Field } ; totalCurrency: { lower: UInt64 ; upper: UInt64 } } ; lockCheckpoint: { isSome: Bool ; value: Field } ; seed: { isSome: Bool ; value: Field } ; startCheckpoint: { isSome: Bool ; value: Field } } ; snarkedLedgerHash: { isSome: Bool ; value: Field } ; stakingEpochData: { epochLength: { lower: UInt32 ; upper: UInt32 } ; ledger: { hash: { isSome: Bool ; value: Field } ; totalCurrency: { lower: UInt64 ; upper: UInt64 } } ; lockCheckpoint: { isSome: Bool ; value: Field } ; seed: { isSome: Bool ; value: Field } ; startCheckpoint: { isSome: Bool ; value: Field } } ; timestamp: { lower: UInt64 ; upper: UInt64 } ; totalCurrency: { lower: UInt64 ; upper: UInt64 } }>

Data associated with the current state of the Mina network.

Defined in

lib/mina.ts:436


sendTransaction

sendTransaction(txn): TransactionId

Parameters
NameType
txnTransaction
Returns

TransactionId

Defined in

lib/mina.ts:451


setActiveInstance

setActiveInstance(m): void

Set the currently used Mina instance.

Parameters
NameType
mMina
Returns

void

Defined in

lib/mina.ts:384


setCurrentTransaction

setCurrentTransaction(transaction): void

Parameters
NameType
transactionCurrentTransaction
Returns

void

Defined in

lib/mina.ts:65


transaction

transaction(f): Promise<Transaction>

Construct a smart contract transaction. Within the callback passed to this function, you can call into the methods of smart contracts.

transaction(() => {
  myZkapp.update();
  someOtherZkapp.someOtherMethod();
});
Parameters
NameType
f() => void
Returns

Promise<Transaction>

A transaction that can subsequently be submitted to the chain.

Defined in

lib/mina.ts:401

transaction(sender, f): Promise<Transaction>

Parameters
NameType
senderSenderSpec
f() => void
Returns

Promise<Transaction>

Defined in

lib/mina.ts:402

snarkyjs / Exports / Types / Json

Namespace: Json

Types.Json

Table of contents

Type Aliases

Type Aliases

AuthRequired

Ƭ AuthRequired: "Signature" | "Proof" | "Either" | "None" | "Impossible"

Defined in

snarky/parties-leaves-json.ts:11


Bool

Ƭ Bool: boolean

Defined in

snarky/parties-leaves-json.ts:6


Field

Ƭ Field: string

Defined in

snarky/parties-leaves-json.ts:5


Parties

Ƭ Parties: Object

Type declaration
NameType
feePayer{ authorization: string ; body: { events: Field[][] ; fee: UInt64 ; networkPrecondition: { blockchainLength: { lower: UInt32 ; upper: UInt32 } | null ; globalSlotSinceGenesis: { lower: UInt32 ; upper: UInt32 } | null ; globalSlotSinceHardFork: { lower: UInt32 ; upper: UInt32 } | null ; minWindowDensity: { lower: UInt32 ; upper: UInt32 } | null ; nextEpochData: { epochLength: { lower: UInt32 ; upper: UInt32 } | null ; ledger: { hash: Field | null ; totalCurrency: { lower: UInt64 ; upper: UInt64 } | null } ; lockCheckpoint: Field | null ; seed: Field | null ; startCheckpoint: Field | null } ; snarkedLedgerHash: Field | null ; stakingEpochData: { epochLength: { lower: UInt32 ; upper: UInt32 } | null ; ledger: { hash: Field | null ; totalCurrency: { lower: UInt64 ; upper: UInt64 } | null } ; lockCheckpoint: Field | null ; seed: Field | null ; startCheckpoint: Field | null } ; timestamp: { lower: UInt64 ; upper: UInt64 } | null ; totalCurrency: { lower: UInt64 ; upper: UInt64 } | null } ; nonce: UInt32 ; publicKey: PublicKey ; sequenceEvents: Field[][] ; update: { appState: (Field | null)[] ; delegate: PublicKey | null ; permissions: { editSequenceState: AuthRequired ; editState: AuthRequired ; incrementNonce: AuthRequired ; receive: AuthRequired ; send: AuthRequired ; setDelegate: AuthRequired ; setPermissions: AuthRequired ; setTokenSymbol: AuthRequired ; setVerificationKey: AuthRequired ; setVotingFor: AuthRequired ; setZkappUri: AuthRequired } | null ; timing: { cliffAmount: UInt64 ; cliffTime: UInt32 ; initialMinimumBalance: UInt64 ; vestingIncrement: UInt64 ; vestingPeriod: UInt32 } | null ; tokenSymbol: string | null ; verificationKey: { data: string ; hash: Field } | null ; votingFor: Field | null ; zkappUri: string | null } } }
feePayer.authorizationstring
feePayer.body{ events: Field[][] ; fee: UInt64 ; networkPrecondition: { blockchainLength: { lower: UInt32 ; upper: UInt32 } | null ; globalSlotSinceGenesis: { lower: UInt32 ; upper: UInt32 } | null ; globalSlotSinceHardFork: { lower: UInt32 ; upper: UInt32 } | null ; minWindowDensity: { lower: UInt32 ; upper: UInt32 } | null ; nextEpochData: { epochLength: { lower: UInt32 ; upper: UInt32 } | null ; ledger: { hash: Field | null ; totalCurrency: { lower: UInt64 ; upper: UInt64 } | null } ; lockCheckpoint: Field | null ; seed: Field | null ; startCheckpoint: Field | null } ; snarkedLedgerHash: Field | null ; stakingEpochData: { epochLength: { lower: UInt32 ; upper: UInt32 } | null ; ledger: { hash: Field | null ; totalCurrency: { lower: UInt64 ; upper: UInt64 } | null } ; lockCheckpoint: Field | null ; seed: Field | null ; startCheckpoint: Field | null } ; timestamp: { lower: UInt64 ; upper: UInt64 } | null ; totalCurrency: { lower: UInt64 ; upper: UInt64 } | null } ; nonce: UInt32 ; publicKey: PublicKey ; sequenceEvents: Field[][] ; update: { appState: (Field | null)[] ; delegate: PublicKey | null ; permissions: { editSequenceState: AuthRequired ; editState: AuthRequired ; incrementNonce: AuthRequired ; receive: AuthRequired ; send: AuthRequired ; setDelegate: AuthRequired ; setPermissions: AuthRequired ; setTokenSymbol: AuthRequired ; setVerificationKey: AuthRequired ; setVotingFor: AuthRequired ; setZkappUri: AuthRequired } | null ; timing: { cliffAmount: UInt64 ; cliffTime: UInt32 ; initialMinimumBalance: UInt64 ; vestingIncrement: UInt64 ; vestingPeriod: UInt32 } | null ; tokenSymbol: string | null ; verificationKey: { data: string ; hash: Field } | null ; votingFor: Field | null ; zkappUri: string | null } }
feePayer.body.eventsField[][]
feePayer.body.feeUInt64
feePayer.body.networkPrecondition{ blockchainLength: { lower: UInt32 ; upper: UInt32 } | null ; globalSlotSinceGenesis: { lower: UInt32 ; upper: UInt32 } | null ; globalSlotSinceHardFork: { lower: UInt32 ; upper: UInt32 } | null ; minWindowDensity: { lower: UInt32 ; upper: UInt32 } | null ; nextEpochData: { epochLength: { lower: UInt32 ; upper: UInt32 } | null ; ledger: { hash: Field | null ; totalCurrency: { lower: UInt64 ; upper: UInt64 } | null } ; lockCheckpoint: Field | null ; seed: Field | null ; startCheckpoint: Field | null } ; snarkedLedgerHash: Field | null ; stakingEpochData: { epochLength: { lower: UInt32 ; upper: UInt32 } | null ; ledger: { hash: Field | null ; totalCurrency: { lower: UInt64 ; upper: UInt64 } | null } ; lockCheckpoint: Field | null ; seed: Field | null ; startCheckpoint: Field | null } ; timestamp: { lower: UInt64 ; upper: UInt64 } | null ; totalCurrency: { lower: UInt64 ; upper: UInt64 } | null }
feePayer.body.networkPrecondition.blockchainLength{ lower: UInt32 ; upper: UInt32 } | null
feePayer.body.networkPrecondition.globalSlotSinceGenesis{ lower: UInt32 ; upper: UInt32 } | null
feePayer.body.networkPrecondition.globalSlotSinceHardFork{ lower: UInt32 ; upper: UInt32 } | null
feePayer.body.networkPrecondition.minWindowDensity{ lower: UInt32 ; upper: UInt32 } | null
feePayer.body.networkPrecondition.nextEpochData{ epochLength: { lower: UInt32 ; upper: UInt32 } | null ; ledger: { hash: Field | null ; totalCurrency: { lower: UInt64 ; upper: UInt64 } | null } ; lockCheckpoint: Field | null ; seed: Field | null ; startCheckpoint: Field | null }
feePayer.body.networkPrecondition.nextEpochData.epochLength{ lower: UInt32 ; upper: UInt32 } | null
feePayer.body.networkPrecondition.nextEpochData.ledger{ hash: Field | null ; totalCurrency: { lower: UInt64 ; upper: UInt64 } | null }
feePayer.body.networkPrecondition.nextEpochData.ledger.hashField | null
feePayer.body.networkPrecondition.nextEpochData.ledger.totalCurrency{ lower: UInt64 ; upper: UInt64 } | null
feePayer.body.networkPrecondition.nextEpochData.lockCheckpointField | null
feePayer.body.networkPrecondition.nextEpochData.seedField | null
feePayer.body.networkPrecondition.nextEpochData.startCheckpointField | null
feePayer.body.networkPrecondition.snarkedLedgerHashField | null
feePayer.body.networkPrecondition.stakingEpochData{ epochLength: { lower: UInt32 ; upper: UInt32 } | null ; ledger: { hash: Field | null ; totalCurrency: { lower: UInt64 ; upper: UInt64 } | null } ; lockCheckpoint: Field | null ; seed: Field | null ; startCheckpoint: Field | null }
feePayer.body.networkPrecondition.stakingEpochData.epochLength{ lower: UInt32 ; upper: UInt32 } | null
feePayer.body.networkPrecondition.stakingEpochData.ledger{ hash: Field | null ; totalCurrency: { lower: UInt64 ; upper: UInt64 } | null }
feePayer.body.networkPrecondition.stakingEpochData.ledger.hashField | null
feePayer.body.networkPrecondition.stakingEpochData.ledger.totalCurrency{ lower: UInt64 ; upper: UInt64 } | null
feePayer.body.networkPrecondition.stakingEpochData.lockCheckpointField | null
feePayer.body.networkPrecondition.stakingEpochData.seedField | null
feePayer.body.networkPrecondition.stakingEpochData.startCheckpointField | null
feePayer.body.networkPrecondition.timestamp{ lower: UInt64 ; upper: UInt64 } | null
feePayer.body.networkPrecondition.totalCurrency{ lower: UInt64 ; upper: UInt64 } | null
feePayer.body.nonceUInt32
feePayer.body.publicKeyPublicKey
feePayer.body.sequenceEventsField[][]
feePayer.body.update{ appState: (Field | null)[] ; delegate: PublicKey | null ; permissions: { editSequenceState: AuthRequired ; editState: AuthRequired ; incrementNonce: AuthRequired ; receive: AuthRequired ; send: AuthRequired ; setDelegate: AuthRequired ; setPermissions: AuthRequired ; setTokenSymbol: AuthRequired ; setVerificationKey: AuthRequired ; setVotingFor: AuthRequired ; setZkappUri: AuthRequired } | null ; timing: { cliffAmount: UInt64 ; cliffTime: UInt32 ; initialMinimumBalance: UInt64 ; vestingIncrement: UInt64 ; vestingPeriod: UInt32 } | null ; tokenSymbol: string | null ; verificationKey: { data: string ; hash: Field } | null ; votingFor: Field | null ; zkappUri: string | null }
feePayer.body.update.appState(Field | null)[]
feePayer.body.update.delegatePublicKey | null
feePayer.body.update.permissions{ editSequenceState: AuthRequired ; editState: AuthRequired ; incrementNonce: AuthRequired ; receive: AuthRequired ; send: AuthRequired ; setDelegate: AuthRequired ; setPermissions: AuthRequired ; setTokenSymbol: AuthRequired ; setVerificationKey: AuthRequired ; setVotingFor: AuthRequired ; setZkappUri: AuthRequired } | null
feePayer.body.update.timing{ cliffAmount: UInt64 ; cliffTime: UInt32 ; initialMinimumBalance: UInt64 ; vestingIncrement: UInt64 ; vestingPeriod: UInt32 } | null
feePayer.body.update.tokenSymbolstring | null
feePayer.body.update.verificationKey{ data: string ; hash: Field } | null
feePayer.body.update.votingForField | null
feePayer.body.update.zkappUristring | null
memostring
otherParties{ authorization: { proof: string | null ; signature: string | null } ; body: { balanceChange: { magnitude: UInt64 ; sgn: Sign } ; callData: Field ; callDepth: number ; caller: TokenId ; events: Field[][] ; incrementNonce: Bool ; preconditions: { account: { balance: { lower: UInt64 ; upper: UInt64 } | null ; delegate: PublicKey | null ; nonce: { lower: UInt32 ; upper: UInt32 } | null ; provedState: Bool | null ; receiptChainHash: Field | null ; sequenceState: Field | null ; state: (Field | null)[] } ; network: { blockchainLength: { lower: UInt32 ; upper: UInt32 } | null ; globalSlotSinceGenesis: { lower: UInt32 ; upper: UInt32 } | null ; globalSlotSinceHardFork: { lower: UInt32 ; upper: UInt32 } | null ; minWindowDensity: { lower: UInt32 ; upper: UInt32 } | null ; nextEpochData: { epochLength: { lower: UInt32 ; upper: UInt32 } | null ; ledger: { hash: Field | null ; totalCurrency: { lower: UInt64 ; upper: UInt64 } | null } ; lockCheckpoint: Field | null ; seed: Field | null ; startCheckpoint: Field | null } ; snarkedLedgerHash: Field | null ; stakingEpochData: { epochLength: { lower: UInt32 ; upper: UInt32 } | null ; ledger: { hash: Field | null ; totalCurrency: { lower: UInt64 ; upper: UInt64 } | null } ; lockCheckpoint: Field | null ; seed: Field | null ; startCheckpoint: Field | null } ; timestamp: { lower: UInt64 ; upper: UInt64 } | null ; totalCurrency: { lower: UInt64 ; upper: UInt64 } | null } } ; publicKey: PublicKey ; sequenceEvents: Field[][] ; tokenId: TokenId ; update: { appState: (Field | null)[] ; delegate: PublicKey | null ; permissions: { editSequenceState: AuthRequired ; editState: AuthRequired ; incrementNonce: AuthRequired ; receive: AuthRequired ; send: AuthRequired ; setDelegate: AuthRequired ; setPermissions: AuthRequired ; setTokenSymbol: AuthRequired ; setVerificationKey: AuthRequired ; setVotingFor: AuthRequired ; setZkappUri: AuthRequired } | null ; timing: { cliffAmount: UInt64 ; cliffTime: UInt32 ; initialMinimumBalance: UInt64 ; vestingIncrement: UInt64 ; vestingPeriod: UInt32 } | null ; tokenSymbol: string | null ; verificationKey: { data: string ; hash: Field } | null ; votingFor: Field | null ; zkappUri: string | null } ; useFullCommitment: Bool } }[]
Defined in

snarky/gen/parties-json.ts:17


Party

Ƭ Party: Object

Type declaration
NameType
authorization{ proof: string | null ; signature: string | null }
authorization.proofstring | null
authorization.signaturestring | null
body{ balanceChange: { magnitude: UInt64 ; sgn: Sign } ; callData: Field ; callDepth: number ; caller: TokenId ; events: Field[][] ; incrementNonce: Bool ; preconditions: { account: { balance: { lower: UInt64 ; upper: UInt64 } | null ; delegate: PublicKey | null ; nonce: { lower: UInt32 ; upper: UInt32 } | null ; provedState: Bool | null ; receiptChainHash: Field | null ; sequenceState: Field | null ; state: (Field | null)[] } ; network: { blockchainLength: { lower: UInt32 ; upper: UInt32 } | null ; globalSlotSinceGenesis: { lower: UInt32 ; upper: UInt32 } | null ; globalSlotSinceHardFork: { lower: UInt32 ; upper: UInt32 } | null ; minWindowDensity: { lower: UInt32 ; upper: UInt32 } | null ; nextEpochData: { epochLength: { lower: UInt32 ; upper: UInt32 } | null ; ledger: { hash: Field | null ; totalCurrency: { lower: UInt64 ; upper: UInt64 } | null } ; lockCheckpoint: Field | null ; seed: Field | null ; startCheckpoint: Field | null } ; snarkedLedgerHash: Field | null ; stakingEpochData: { epochLength: { lower: UInt32 ; upper: UInt32 } | null ; ledger: { hash: Field | null ; totalCurrency: { lower: UInt64 ; upper: UInt64 } | null } ; lockCheckpoint: Field | null ; seed: Field | null ; startCheckpoint: Field | null } ; timestamp: { lower: UInt64 ; upper: UInt64 } | null ; totalCurrency: { lower: UInt64 ; upper: UInt64 } | null } } ; publicKey: PublicKey ; sequenceEvents: Field[][] ; tokenId: TokenId ; update: { appState: (Field | null)[] ; delegate: PublicKey | null ; permissions: { editSequenceState: AuthRequired ; editState: AuthRequired ; incrementNonce: AuthRequired ; receive: AuthRequired ; send: AuthRequired ; setDelegate: AuthRequired ; setPermissions: AuthRequired ; setTokenSymbol: AuthRequired ; setVerificationKey: AuthRequired ; setVotingFor: AuthRequired ; setZkappUri: AuthRequired } | null ; timing: { cliffAmount: UInt64 ; cliffTime: UInt32 ; initialMinimumBalance: UInt64 ; vestingIncrement: UInt64 ; vestingPeriod: UInt32 } | null ; tokenSymbol: string | null ; verificationKey: { data: string ; hash: Field } | null ; votingFor: Field | null ; zkappUri: string | null } ; useFullCommitment: Bool }
body.balanceChange{ magnitude: UInt64 ; sgn: Sign }
body.balanceChange.magnitudeUInt64
body.balanceChange.sgnSign
body.callDataField
body.callDepthnumber
body.callerTokenId
body.eventsField[][]
body.incrementNonceBool
body.preconditions{ account: { balance: { lower: UInt64 ; upper: UInt64 } | null ; delegate: PublicKey | null ; nonce: { lower: UInt32 ; upper: UInt32 } | null ; provedState: Bool | null ; receiptChainHash: Field | null ; sequenceState: Field | null ; state: (Field | null)[] } ; network: { blockchainLength: { lower: UInt32 ; upper: UInt32 } | null ; globalSlotSinceGenesis: { lower: UInt32 ; upper: UInt32 } | null ; globalSlotSinceHardFork: { lower: UInt32 ; upper: UInt32 } | null ; minWindowDensity: { lower: UInt32 ; upper: UInt32 } | null ; nextEpochData: { epochLength: { lower: UInt32 ; upper: UInt32 } | null ; ledger: { hash: Field | null ; totalCurrency: { lower: UInt64 ; upper: UInt64 } | null } ; lockCheckpoint: Field | null ; seed: Field | null ; startCheckpoint: Field | null } ; snarkedLedgerHash: Field | null ; stakingEpochData: { epochLength: { lower: UInt32 ; upper: UInt32 } | null ; ledger: { hash: Field | null ; totalCurrency: { lower: UInt64 ; upper: UInt64 } | null } ; lockCheckpoint: Field | null ; seed: Field | null ; startCheckpoint: Field | null } ; timestamp: { lower: UInt64 ; upper: UInt64 } | null ; totalCurrency: { lower: UInt64 ; upper: UInt64 } | null } }
body.preconditions.account{ balance: { lower: UInt64 ; upper: UInt64 } | null ; delegate: PublicKey | null ; nonce: { lower: UInt32 ; upper: UInt32 } | null ; provedState: Bool | null ; receiptChainHash: Field | null ; sequenceState: Field | null ; state: (Field | null)[] }
body.preconditions.account.balance{ lower: UInt64 ; upper: UInt64 } | null
body.preconditions.account.delegatePublicKey | null
body.preconditions.account.nonce{ lower: UInt32 ; upper: UInt32 } | null
body.preconditions.account.provedStateBool | null
body.preconditions.account.receiptChainHashField | null
body.preconditions.account.sequenceStateField | null
body.preconditions.account.state(Field | null)[]
body.preconditions.network{ blockchainLength: { lower: UInt32 ; upper: UInt32 } | null ; globalSlotSinceGenesis: { lower: UInt32 ; upper: UInt32 } | null ; globalSlotSinceHardFork: { lower: UInt32 ; upper: UInt32 } | null ; minWindowDensity: { lower: UInt32 ; upper: UInt32 } | null ; nextEpochData: { epochLength: { lower: UInt32 ; upper: UInt32 } | null ; ledger: { hash: Field | null ; totalCurrency: { lower: UInt64 ; upper: UInt64 } | null } ; lockCheckpoint: Field | null ; seed: Field | null ; startCheckpoint: Field | null } ; snarkedLedgerHash: Field | null ; stakingEpochData: { epochLength: { lower: UInt32 ; upper: UInt32 } | null ; ledger: { hash: Field | null ; totalCurrency: { lower: UInt64 ; upper: UInt64 } | null } ; lockCheckpoint: Field | null ; seed: Field | null ; startCheckpoint: Field | null } ; timestamp: { lower: UInt64 ; upper: UInt64 } | null ; totalCurrency: { lower: UInt64 ; upper: UInt64 } | null }
body.preconditions.network.blockchainLength{ lower: UInt32 ; upper: UInt32 } | null
body.preconditions.network.globalSlotSinceGenesis{ lower: UInt32 ; upper: UInt32 } | null
body.preconditions.network.globalSlotSinceHardFork{ lower: UInt32 ; upper: UInt32 } | null
body.preconditions.network.minWindowDensity{ lower: UInt32 ; upper: UInt32 } | null
body.preconditions.network.nextEpochData{ epochLength: { lower: UInt32 ; upper: UInt32 } | null ; ledger: { hash: Field | null ; totalCurrency: { lower: UInt64 ; upper: UInt64 } | null } ; lockCheckpoint: Field | null ; seed: Field | null ; startCheckpoint: Field | null }
body.preconditions.network.nextEpochData.epochLength{ lower: UInt32 ; upper: UInt32 } | null
body.preconditions.network.nextEpochData.ledger{ hash: Field | null ; totalCurrency: { lower: UInt64 ; upper: UInt64 } | null }
body.preconditions.network.nextEpochData.ledger.hashField | null
body.preconditions.network.nextEpochData.ledger.totalCurrency{ lower: UInt64 ; upper: UInt64 } | null
body.preconditions.network.nextEpochData.lockCheckpointField | null
body.preconditions.network.nextEpochData.seedField | null
body.preconditions.network.nextEpochData.startCheckpointField | null
body.preconditions.network.snarkedLedgerHashField | null
body.preconditions.network.stakingEpochData{ epochLength: { lower: UInt32 ; upper: UInt32 } | null ; ledger: { hash: Field | null ; totalCurrency: { lower: UInt64 ; upper: UInt64 } | null } ; lockCheckpoint: Field | null ; seed: Field | null ; startCheckpoint: Field | null }
body.preconditions.network.stakingEpochData.epochLength{ lower: UInt32 ; upper: UInt32 } | null
body.preconditions.network.stakingEpochData.ledger{ hash: Field | null ; totalCurrency: { lower: UInt64 ; upper: UInt64 } | null }
body.preconditions.network.stakingEpochData.ledger.hashField | null
body.preconditions.network.stakingEpochData.ledger.totalCurrency{ lower: UInt64 ; upper: UInt64 } | null
body.preconditions.network.stakingEpochData.lockCheckpointField | null
body.preconditions.network.stakingEpochData.seedField | null
body.preconditions.network.stakingEpochData.startCheckpointField | null
body.preconditions.network.timestamp{ lower: UInt64 ; upper: UInt64 } | null
body.preconditions.network.totalCurrency{ lower: UInt64 ; upper: UInt64 } | null
body.publicKeyPublicKey
body.sequenceEventsField[][]
body.tokenIdTokenId
body.update{ appState: (Field | null)[] ; delegate: PublicKey | null ; permissions: { editSequenceState: AuthRequired ; editState: AuthRequired ; incrementNonce: AuthRequired ; receive: AuthRequired ; send: AuthRequired ; setDelegate: AuthRequired ; setPermissions: AuthRequired ; setTokenSymbol: AuthRequired ; setVerificationKey: AuthRequired ; setVotingFor: AuthRequired ; setZkappUri: AuthRequired } | null ; timing: { cliffAmount: UInt64 ; cliffTime: UInt32 ; initialMinimumBalance: UInt64 ; vestingIncrement: UInt64 ; vestingPeriod: UInt32 } | null ; tokenSymbol: string | null ; verificationKey: { data: string ; hash: Field } | null ; votingFor: Field | null ; zkappUri: string | null }
body.update.appState(Field | null)[]
body.update.delegatePublicKey | null
body.update.permissions{ editSequenceState: AuthRequired ; editState: AuthRequired ; incrementNonce: AuthRequired ; receive: AuthRequired ; send: AuthRequired ; setDelegate: AuthRequired ; setPermissions: AuthRequired ; setTokenSymbol: AuthRequired ; setVerificationKey: AuthRequired ; setVotingFor: AuthRequired ; setZkappUri: AuthRequired } | null
body.update.timing{ cliffAmount: UInt64 ; cliffTime: UInt32 ; initialMinimumBalance: UInt64 ; vestingIncrement: UInt64 ; vestingPeriod: UInt32 } | null
body.update.tokenSymbolstring | null
body.update.verificationKey{ data: string ; hash: Field } | null
body.update.votingForField | null
body.update.zkappUristring | null
body.useFullCommitmentBool
Defined in

snarky/gen/parties-json.ts:249


PublicKey

Ƭ PublicKey: string

Defined in

snarky/parties-leaves-json.ts:9


Sign

Ƭ Sign: "Positive" | "Negative"

Defined in

snarky/parties-leaves-json.ts:10


TokenId

Ƭ TokenId: Field

Defined in

snarky/parties-leaves-json.ts:12


TypeMap

Ƭ TypeMap: Object

Type declaration
NameType
AuthRequiredAuthRequired
BlockTimeIntervalnull
BoolBool
FieldField
PublicKeyPublicKey
SignSign
TokenIdTokenId
UInt32UInt32
UInt64UInt64
nullnull
numbernumber
stringstring
undefinednull
Defined in

snarky/parties-leaves-json.ts:15


UInt32

Ƭ UInt32: string

Defined in

snarky/parties-leaves-json.ts:8


UInt64

Ƭ UInt64: string

Defined in

snarky/parties-leaves-json.ts:7

snarkyjs / Exports / Types

Namespace: Types

Table of contents

References

Namespaces

Type Aliases

Variables

Functions

References

Bool

Re-exports Bool


Field

Re-exports Field

Type Aliases

AuthRequired

Ƭ AuthRequired: Object

Type declaration
NameType
constantBool
signatureNecessaryBool
signatureSufficientBool
Defined in

snarky/parties-leaves.ts:19


Parties

Ƭ Parties: Object

Type declaration
NameType
feePayer{ authorization: string ; body: { events: { data: Field[][] ; hash: Field } ; fee: UInt64 ; networkPrecondition: { blockchainLength: { lower: UInt32 ; upper: UInt32 } ; globalSlotSinceGenesis: { lower: UInt32 ; upper: UInt32 } ; globalSlotSinceHardFork: { lower: UInt32 ; upper: UInt32 } ; minWindowDensity: { lower: UInt32 ; upper: UInt32 } ; nextEpochData: { epochLength: { lower: UInt32 ; upper: UInt32 } ; ledger: { hash: { isSome: Bool ; value: Field } ; totalCurrency: { lower: UInt64 ; upper: UInt64 } } ; lockCheckpoint: { isSome: Bool ; value: Field } ; seed: { isSome: Bool ; value: Field } ; startCheckpoint: { isSome: Bool ; value: Field } } ; snarkedLedgerHash: { isSome: Bool ; value: Field } ; stakingEpochData: { epochLength: { lower: UInt32 ; upper: UInt32 } ; ledger: { hash: { isSome: Bool ; value: Field } ; totalCurrency: { lower: UInt64 ; upper: UInt64 } } ; lockCheckpoint: { isSome: Bool ; value: Field } ; seed: { isSome: Bool ; value: Field } ; startCheckpoint: { isSome: Bool ; value: Field } } ; timestamp: { lower: UInt64 ; upper: UInt64 } ; totalCurrency: { lower: UInt64 ; upper: UInt64 } } ; nonce: UInt32 ; publicKey: PublicKey ; sequenceEvents: { data: Field[][] ; hash: Field } ; update: { appState: { isSome: Bool ; value: Field }[] ; delegate: { isSome: Bool ; value: PublicKey } ; permissions: { isSome: Bool ; value: { editSequenceState: AuthRequired ; editState: AuthRequired ; incrementNonce: AuthRequired ; receive: AuthRequired ; send: AuthRequired ; setDelegate: AuthRequired ; setPermissions: AuthRequired ; setTokenSymbol: AuthRequired ; setVerificationKey: AuthRequired ; setVotingFor: AuthRequired ; setZkappUri: AuthRequired } } ; timing: { isSome: Bool ; value: { cliffAmount: UInt64 ; cliffTime: UInt32 ; initialMinimumBalance: UInt64 ; vestingIncrement: UInt64 ; vestingPeriod: UInt32 } } ; tokenSymbol: { isSome: Bool ; value: { data: string ; hash: Field } } ; verificationKey: { isSome: Bool ; value: { data: string ; hash: Field } } ; votingFor: { isSome: Bool ; value: Field } ; zkappUri: { isSome: Bool ; value: { data: string ; hash: Field } } } } }
feePayer.authorizationstring
feePayer.body{ events: { data: Field[][] ; hash: Field } ; fee: UInt64 ; networkPrecondition: { blockchainLe