Skip to main content

TokenSymbol

SnarkyJS / Modules / TokenSymbol

Class: TokenSymbol

Hierarchy

  • { field: Field ; symbol: string }

    TokenSymbol

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new TokenSymbol(value)

Parameters

NameType
valueObject
value.fieldField
value.symbolstring

Inherited from

Struct(TokenSymbolPure).constructor

Defined in

lib/circuit_value.ts:365

Properties

field

field: Field

Inherited from

Struct(TokenSymbolPure).field

Defined in

lib/hash.ts:146


symbol

symbol: string

Inherited from

Struct(TokenSymbolPure).symbol

Defined in

lib/hash.ts:146


_isStruct

Static _isStruct: true

Inherited from

Struct(TokenSymbolPure)._isStruct

Defined in

lib/circuit_value.ts:365


check

Static check: (value: { field: Field ; symbol: string }) => void

Type declaration

▸ (value): void

Add assertions to the proof to check if value is a valid member of type T. This function does not return anything, instead it creates any number of assertions to prove that value is a valid member of the type T.

For instance, calling check function on the type Bool asserts that the value of the element is either 1 or 0.

Parameters
NameTypeDescription
valueObjectthe element of type T to put assertions on.
value.fieldField-
value.symbolstring-
Returns

void

Inherited from

Struct(TokenSymbolPure).check

Defined in

snarky.d.ts:75


fromFields

Static fromFields: (fields: Field[], aux: any[]) => { field: Field ; symbol: string }

Type declaration

▸ (fields, aux): Object

A function that returns an element of type T from the given provable and "auxiliary" data.

Important: For any element of type T, this function is the reverse operation of calling toFields and toAuxilary methods on an element of type T.

Parameters
NameTypeDescription
fieldsField[]an array of Field elements describing the provable data of the new T element.
auxany[]an array of any type describing the "auxiliary" data of the new T element, optional.
Returns

Object

An element of type T generated from the given provable and "auxiliary" data.

NameType
fieldField
symbolstring

Inherited from

Struct(TokenSymbolPure).fromFields

Defined in

snarky.d.ts:56


fromJSON

Static fromJSON: (x: string) => { field: Field ; symbol: string }

Type declaration

▸ (x): Object

Parameters
NameType
xstring
Returns

Object

NameType
fieldField
symbolstring

Inherited from

Struct(TokenSymbolPure).fromJSON

Defined in

lib/circuit_value.ts:373


toAuxiliary

Static toAuxiliary: (value?: { field: Field ; symbol: string }) => any[]

Type declaration

▸ (value?): any[]

A function that takes value (optional), an element of type T, as argument and returns an array of any type that make up the "auxiliary" (non-provable) data of value.

Parameters
NameTypeDescription
value?Objectthe element of type T to generate the auxiliary data array from, optional. If not provided, a default value for auxiliary data is returned.
value.fieldField-
value.symbolstring-
Returns

any[]

An array of any type describing how this T element is made up of "auxiliary" (non-provable) data.

Inherited from

Struct(TokenSymbolPure).toAuxiliary

Defined in

snarky.d.ts:44


toFields

Static toFields: (value: { field: Field ; symbol: string }) => Field[]

Type declaration

▸ (value): Field[]

A function that takes value, an element of type T, as argument and returns an array of Field elements that make up the provable data of value.

Parameters
NameTypeDescription
valueObjectthe element of type T to generate the Field array from.
value.fieldField-
value.symbolstring-
Returns

Field[]

A Field array describing how this T element is made up of Field elements.

Inherited from

Struct(TokenSymbolPure).toFields

Defined in

snarky.d.ts:35


toInput

Static toInput: (x: { field: Field ; symbol: string }) => { fields?: Field[] ; packed?: [Field, number][] }

Type declaration

▸ (x): Object

Parameters
NameType
xObject
x.fieldField
x.symbolstring
Returns

Object

NameType
fields?Field[]
packed?[Field, number][]

Inherited from

Struct(TokenSymbolPure).toInput

Defined in

lib/circuit_value.ts:368


toJSON

Static toJSON: (x: { field: Field ; symbol: string }) => string

Type declaration

▸ (x): string

Parameters
NameType
xObject
x.fieldField
x.symbolstring
Returns

string

Inherited from

Struct(TokenSymbolPure).toJSON

Defined in

lib/circuit_value.ts:372

Accessors

empty

Static get empty(): Object

Returns

Object

NameType
fieldField
symbolstring

Defined in

lib/hash.ts:177

Methods

from

Static from(symbol): TokenSymbol

Parameters

NameType
symbolstring

Returns

TokenSymbol

Defined in

lib/hash.ts:181


sizeInFields

Static sizeInFields(): number

Return the size of the T type in terms of Field type, as Field is the primitive type.

Warning: This function returns a number, so you cannot use it to prove something on chain. You can use it during debugging or to understand the memory complexity of some type.

Returns

number

A number representing the size of the T type in terms of Field type.

Inherited from

Struct(TokenSymbolPure).sizeInFields

Defined in

snarky.d.ts:65