Character
Extends
- {
"value"
:Field
; }
Constructors
new Character()
new Character(value: number | Field): Character
Parameters
• value: number
| Field
Returns
Overrides
Struct({ value: Field }).constructor
Source
Properties
value
value: Field = Field;
Inherited from
Struct({ value: Field }).value
Source
_isStruct
static _isStruct: true;
Inherited from
Struct({ value: Field })._isStruct
Source
lib/provable/types/struct.ts:148
empty()
static empty: () => {
"value": Field;
};
Returns
{
"value": Field;
}
value
value: Field = Field;
Inherited from
Struct({ value: Field }).empty
Source
lib/provable/types/struct.ts:158
fromFields()
static fromFields: (fields: Field[]) => {
"value": Field;
};
Parameters
• fields: Field
[]
Returns
{
"value": Field;
}
value
value: Field = Field;
Inherited from
Struct({ value: Field }).fromFields
Source
lib/provable/types/provable-intf.ts:115
fromJSON()
static fromJSON: (x: {
"value": Field;
}) => {
"value": Field;
};
Parameters
• x
• x.value: string
= Field
Returns
{
"value": Field;
}
value
value: Field = Field;
Inherited from
Struct({ value: Field }).fromJSON
Source
lib/provable/types/struct.ts:157
fromValue
static fromValue: (x: {
"value": Field;
} | {
"value": Field;
}) => {
"value": Field;
} & (value: {
"value": Field;
}) => {
"value": Field;
};
Convert provable type from a normal JS type.
Inherited from
Struct({ value: Field }).fromValue
Source
lib/provable/types/provable-intf.ts:86
toAuxiliary()
static toAuxiliary: (value?: {
"value": Field;
}) => 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.value?: Field
= Field
Returns
any
[]
Inherited from
Struct({ value: Field }).toAuxiliary
Source
lib/provable/types/provable-intf.ts:47
toCanonical()?
static optional toCanonical: (x: {
"value": Field;
}) => {
"value": Field;
};
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.value: Field
= Field
Returns
{
"value": Field;
}
value
value: Field = Field;
Inherited from
Struct({ value: Field }).toCanonical
Source
lib/provable/types/provable-intf.ts:104
toFields()
static toFields: (value: {
"value": Field;
}) => 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.value: Field
= Field
Returns
Field
[]
Inherited from
Struct({ value: Field }).toFields
Source
lib/provable/types/provable-intf.ts:36
toJSON()
static toJSON: (x: {
"value": Field;
}) => {
"value": Field;
};
Parameters
• x
• x.value: Field
= Field
Returns
{
"value": Field;
}
value
value: string = Field;
Inherited from
Struct({ value: Field }).toJSON
Source
lib/provable/types/struct.ts:156
toValue()
static toValue: (x: {
"value": Field;
}) => {
"value": Field;
};
Convert provable type to a normal JS type.
Parameters
• x
• x.value: Field
= Field
Returns
{
"value": Field;
}
value
value: bigint = Field;
Inherited from
Struct({ value: Field }).toValue
Source
lib/provable/types/provable-intf.ts:81
Methods
isNull()
isNull(): Bool
Returns
Source
toField()
toField(): Field
Returns
Source
toString()
toString(): string
Returns
string
Source
check()
static check(c: {
"value": Field;
}): void
Parameters
• c
• c.value: Field
Returns
void
Overrides
Struct({ value: Field }).check
Source
fromString()
static fromString(str: string): Character
Parameters
• str: string
Returns
Source
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({ value: Field }).sizeInFields
Source
lib/provable/types/provable-intf.ts:66
toInput()
static toInput(c: {
"value": Field;
}): HashInput
Parameters
• c
• c.value: Field
Returns
HashInput
Overrides
Struct({ value: Field }).toInput