Character
Defined in: lib/provable/string.ts:12
Extends
- {
value
:Field
; }
Constructors
new Character()
new Character(value: number | Field): Character
Defined in: lib/provable/string.ts:13
Parameters
value
number
| Field
Returns
Overrides
Struct({ value: Field }).constructor
Properties
value
value: Field = Field;
Defined in: lib/provable/string.ts:12
Inherited from
Struct({ value: Field }).value
_isStruct
static _isStruct: true;
Defined in: lib/provable/types/struct.ts:133
Inherited from
Struct({ value: Field })._isStruct
empty()
static empty: () => {
value: Field;
};
Defined in: lib/provable/types/struct.ts:143
Returns
{
value: Field;
}
value
value: Field = Field;
Inherited from
Struct({ value: Field }).empty
fromFields()
static fromFields: (fields: Field[]) => {
value: Field;
};
Defined in: lib/provable/types/provable-intf.ts:115
Parameters
fields
Field
[]
Returns
{
value: Field;
}
value
value: Field = Field;
Inherited from
Struct({ value: Field }).fromFields
fromJSON()
static fromJSON: (x: {
value: string;
}) => {
value: Field;
};
Defined in: lib/provable/types/struct.ts:142
Parameters
x
value
string
= Field
Returns
{
value: Field;
}
value
value: Field = Field;
Inherited from
Struct({ value: Field }).fromJSON
fromValue
static fromValue: (x:
| {
value: Field;
}
| {
value: bigint;
}) => {
value: Field;
} & (value: {
value: string | number | bigint | Field;
}) => {
value: Field;
};
Defined in: lib/provable/types/provable-intf.ts:86
Convert provable type from a normal JS type.
Inherited from
Struct({ value: Field }).fromValue
toAuxiliary()
static toAuxiliary: (value?: {
value: Field;
}) => any[];
Defined in: lib/provable/types/provable-intf.ts:47
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
Returns
any
[]
An array of any type describing how this T
element is made up of "auxiliary" (non-provable) data.
Inherited from
Struct({ value: Field }).toAuxiliary
toCanonical()?
static optional toCanonical: (x: {
value: Field;
}) => {
value: Field;
};
Defined in: lib/provable/types/provable-intf.ts:104
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
value
Field
= Field
Returns
{
value: Field;
}
value
value: Field = Field;
Inherited from
Struct({ value: Field }).toCanonical
toFields()
static toFields: (value: {
value: Field;
}) => Field[];
Defined in: lib/provable/types/provable-intf.ts:36
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
Returns
Field
[]
A Field array describing how this T
element is made up of Field elements.
Inherited from
Struct({ value: Field }).toFields
toJSON()
static toJSON: (x: {
value: Field;
}) => {
value: string;
};
Defined in: lib/provable/types/struct.ts:141
Parameters
x
value
Field
= Field
Returns
{
value: string;
}
value
value: string = Field;
Inherited from
Struct({ value: Field }).toJSON
toValue()
static toValue: (x: {
value: Field;
}) => {
value: bigint;
};
Defined in: lib/provable/types/provable-intf.ts:81
Convert provable type to a normal JS type.
Parameters
x
value
Field
= Field
Returns
{
value: bigint;
}
value
value: bigint = Field;
Inherited from
Struct({ value: Field }).toValue
Methods
isNull()
isNull(): Bool
Defined in: lib/provable/string.ts:17
Returns
toField()
toField(): Field
Defined in: lib/provable/string.ts:21
Returns
toString()
toString(): string
Defined in: lib/provable/string.ts:25
Returns a string representation of an object.
Returns
string
check()
static check(c: {
value: Field;
}): void
Defined in: lib/provable/string.ts:36
Parameters
c
value
Returns
void
Overrides
Struct({ value: Field }).check
fromString()
static fromString(str: string): Character
Defined in: lib/provable/string.ts:30
Parameters
str
string
Returns
sizeInFields()
static sizeInFields(): number
Defined in: lib/provable/types/provable-intf.ts:66
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
toInput()
static toInput(c: {
value: Field;
}): HashInput
Defined in: lib/provable/string.ts:40
Parameters
c
value
Returns
HashInput
Overrides
Struct({ value: Field }).toInput