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
Name | Type |
---|---|
value | Object |
value.field | Field |
value.symbol | string |
Inherited from
Struct(TokenSymbolPure).constructor
Defined in
Properties
field
• field: Field
Inherited from
Struct(TokenSymbolPure).field
Defined in
symbol
• symbol: string
Inherited from
Struct(TokenSymbolPure).symbol
Defined in
_isStruct
▪ Static
_isStruct: true
Inherited from
Struct(TokenSymbolPure)._isStruct
Defined in
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
Name | Type | Description |
---|---|---|
value | Object | the element of type T to put assertions on. |
value.field | Field | - |
value.symbol | string | - |
Returns
void
Inherited from
Struct(TokenSymbolPure).check
Defined in
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
Name | Type | Description |
---|---|---|
fields | Field [] | an array of Field elements describing the provable data of the new T element. |
aux | any [] | 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.
Name | Type |
---|---|
field | Field |
symbol | string |
Inherited from
Struct(TokenSymbolPure).fromFields
Defined in
fromJSON
▪ Static
fromJSON: (x
: string
) => { field
: Field
; symbol
: string
}
Type declaration
▸ (x
): Object
Parameters
Name | Type |
---|---|
x | string |
Returns
Object
Name | Type |
---|---|
field | Field |
symbol | string |
Inherited from
Struct(TokenSymbolPure).fromJSON
Defined in
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
Name | Type | Description |
---|---|---|
value? | Object | the element of type T to generate the auxiliary data array from, optional. If not provided, a default value for auxiliary data is returned. |
value.field | Field | - |
value.symbol | string | - |
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
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
Name | Type | Description |
---|---|---|
value | Object | the element of type T to generate the Field array from. |
value.field | Field | - |
value.symbol | string | - |
Returns
Field
[]
A Field array describing how this T
element is made up of Field elements.
Inherited from
Struct(TokenSymbolPure).toFields
Defined in
toInput
▪ Static
toInput: (x
: { field
: Field
; symbol
: string
}) => { fields?
: Field
[] ; packed?
: [Field
, number
][] }
Type declaration
▸ (x
): Object
Parameters
Name | Type |
---|---|
x | Object |
x.field | Field |
x.symbol | string |
Returns
Object
Name | Type |
---|---|
fields? | Field [] |
packed? | [Field , number ][] |
Inherited from
Struct(TokenSymbolPure).toInput
Defined in
toJSON
▪ Static
toJSON: (x
: { field
: Field
; symbol
: string
}) => string
Type declaration
▸ (x
): string
Parameters
Name | Type |
---|---|
x | Object |
x.field | Field |
x.symbol | string |
Returns
string
Inherited from
Struct(TokenSymbolPure).toJSON
Defined in
Accessors
empty
• Static
get
empty(): Object
Returns
Object
Name | Type |
---|---|
field | Field |
symbol | string |
Defined in
Methods
from
▸ Static
from(symbol
): TokenSymbol
Parameters
Name | Type |
---|---|
symbol | string |
Returns
Defined in
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