TokenSymbol
Extends
- {
"field"
:Field
;"symbol"
:string
; }
Constructors
new TokenSymbol()
new TokenSymbol(value: {
"field": Field;
"symbol": string;
}): TokenSymbol
Parameters
• value
• value.field: Field
• value.symbol: string
Returns
Inherited from
Struct(TokenSymbolPure).constructor
Source
lib/provable/types/struct.ts:148
Properties
field
field: Field;
Inherited from
Struct(TokenSymbolPure).field
Source
lib/provable/crypto/poseidon.ts:212
symbol
symbol: string;
Inherited from
Struct(TokenSymbolPure).symbol
Source
lib/provable/crypto/poseidon.ts:212
_isStruct
static _isStruct: true;
Inherited from
Struct(TokenSymbolPure)._isStruct
Source
lib/provable/types/struct.ts:148
check()
static check: (value: {
"field": Field;
"symbol": string;
}) => 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
• value
the element of type T
to put assertions on.
• value.field: Field
• value.symbol: string
Returns
void
Inherited from
Struct(TokenSymbolPure).check
Source
lib/provable/types/provable-intf.ts:76
empty()
static empty: () => {
"field": Field;
"symbol": string;
};
Returns
{
"field": Field;
"symbol": string;
}
field
field: Field;
symbol
symbol: string;
Inherited from
Struct(TokenSymbolPure).empty
Source
lib/provable/types/struct.ts:158
fromFields()
static fromFields: (fields: Field[], aux: any[]) => {
"field": Field;
"symbol": string;
};
A function that returns an element of type T
from the given provable and "auxiliary" data.
This function is the reverse operation of calling toFields and toAuxilary methods on an element of type T
.
Parameters
• 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
{
"field": Field;
"symbol": string;
}
field
field: Field;
symbol
symbol: string;
Inherited from
Struct(TokenSymbolPure).fromFields
Source
lib/provable/types/provable-intf.ts:59
fromJSON()
static fromJSON: (x: string) => {
"field": Field;
"symbol": string;
};
Parameters
• x: string
Returns
{
"field": Field;
"symbol": string;
}
field
field: Field;
symbol
symbol: string;
Inherited from
Struct(TokenSymbolPure).fromJSON
Source
lib/provable/types/struct.ts:157
fromValue
static fromValue: (x: string | {
"field": Field;
"symbol": string;
}) => {
"field": Field;
"symbol": string;
} & (value: string | {
"field": Field;
"symbol": string;
}) => {
"field": Field;
"symbol": string;
};
Convert provable type from a normal JS type.
Inherited from
Struct(TokenSymbolPure).fromValue
Source
lib/provable/types/provable-intf.ts:86
toAuxiliary()
static toAuxiliary: (value?: {
"field": Field;
"symbol": string;
}) => 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
• value?
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
[]
Inherited from
Struct(TokenSymbolPure).toAuxiliary
Source
lib/provable/types/provable-intf.ts:47
toCanonical()?
static optional toCanonical: (x: {
"field": Field;
"symbol": string;
}) => {
"field": Field;
"symbol": string;
};
Optional method which transforms a provable type into its canonical representation.
This is needed for types that have multiple representations of the same underlying value, and might even not have perfect completeness for some of those representations.
An example is the ForeignField
class, which allows non-native field elements to exist in unreduced form.
The unreduced form is not perfectly complete, for example, addition of two unreduced field elements can cause a prover error.
Specific protocols need to be able to protect themselves against incomplete operations at all costs.
For example, when using actions and reducer, the reducer must be able to produce a proof regardless of the input action.
toCanonical()
converts any input into a safe form and enables us to handle cases like this generically.
Note: For most types, this method is the identity function.
The identity function will also be used when the toCanonical()
is not present on a type.
Parameters
• x
• x.field: Field
• x.symbol: string
Returns
{
"field": Field;
"symbol": string;
}
field
field: Field;
symbol
symbol: string;
Inherited from
Struct(TokenSymbolPure).toCanonical
Source
lib/provable/types/provable-intf.ts:104
toFields()
static toFields: (value: {
"field": Field;
"symbol": string;
}) => 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
• value
the element of type T
to generate the Field array from.
• value.field: Field
• value.symbol: string
Returns
Field
[]
Inherited from
Struct(TokenSymbolPure).toFields
Source
lib/provable/types/provable-intf.ts:36
toInput()
static toInput: (x: {
"field": Field;
"symbol": string;
}) => {
"fields": Field[];
"packed": [Field, number][];
};
Parameters
• x
• x.field: Field
• x.symbol: string
Returns
{
"fields": Field[];
"packed": [Field, number][];
}
fields?
optional fields: Field[];
packed?
optional packed: [Field, number][];
Inherited from
Struct(TokenSymbolPure).toInput
Source
lib/provable/types/struct.ts:152
toJSON()
static toJSON: (x: {
"field": Field;
"symbol": string;
}) => string;
Parameters
• x
• x.field: Field
• x.symbol: string
Returns
string
Inherited from
Struct(TokenSymbolPure).toJSON
Source
lib/provable/types/struct.ts:156
toValue()
static toValue: (x: {
"field": Field;
"symbol": string;
}) => string;
Convert provable type to a normal JS type.
Parameters
• x
• x.field: Field
• x.symbol: string
Returns
string
Inherited from
Struct(TokenSymbolPure).toValue
Source
lib/provable/types/provable-intf.ts:81
Methods
from()
static from(value: string | TokenSymbol): TokenSymbol
Parameters
• value: string
| TokenSymbol
Returns
Source
lib/provable/crypto/poseidon.ts:259
sizeInFields()
static sizeInFields(): number
Return the size of the T
type in terms of Field type, as Field is the primitive type.
Returns
number
A number
representing the size of the T
type in terms of Field type.
Inherited from
Struct(TokenSymbolPure).sizeInFields