Skip to main content

CircuitString

Extends

Constructors

new CircuitString()

new CircuitString(value: {
"values": Character[];
}): CircuitString

Parameters

value

value.values: Character[]

Returns

CircuitString

Inherited from

Struct(RawCircuitString).constructor

Source

lib/provable/types/struct.ts:145

Properties

values

values: Character[];

Inherited from

Struct(RawCircuitString).values

Source

lib/provable/string.ts:61


_isStruct

static _isStruct: true;

Inherited from

Struct(RawCircuitString)._isStruct

Source

lib/provable/types/struct.ts:145


check()

static check: (value: {
"values": Character[];
}) => 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.values: Character[]

Returns

void

Inherited from

Struct(RawCircuitString).check

Source

lib/provable/types/provable-intf.ts:66


empty()

static empty: () => {
"values": Character[];
};

Returns

{
"values": Character[];
}
values
values: Character[];

Inherited from

Struct(RawCircuitString).empty

Source

lib/provable/types/struct.ts:155


fromFields()

static fromFields: (fields: Field[]) => {
"values": Character[];
};

Parameters

fields: Field[]

Returns

{
"values": Character[];
}
values
values: Character[];

Inherited from

Struct(RawCircuitString).fromFields

Source

lib/provable/types/provable-intf.ts:87


fromJSON()

static fromJSON: (x: {
"values": {
"value": Field;
}[];
}) => {
"values": Character[];
};

Parameters

x

x.values: { "value": Field; }[]= undefined

Returns

{
"values": Character[];
}
values
values: Character[];

Inherited from

Struct(RawCircuitString).fromJSON

Source

lib/provable/types/struct.ts:154


fromValue

static fromValue: (x: string | {
"values": Character[];
}) => {
"values": Character[];
} & (value: string | {
"values": Character[];
}) => {
"values": Character[];
};

Convert provable type from a normal JS type.

Inherited from

Struct(RawCircuitString).fromValue

Source

lib/provable/types/provable-intf.ts:76


maxLength

static maxLength: number = DEFAULT_STRING_LENGTH;

Source

lib/provable/string.ts:68


toAuxiliary()

static toAuxiliary: (value?: {
"values": Character[];
}) => 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.values?: Character[]

Returns

any[]

Inherited from

Struct(RawCircuitString).toAuxiliary

Source

lib/provable/types/provable-intf.ts:37


toFields()

static toFields: (value: {
"values": Character[];
}) => 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.values: Character[]

Returns

Field[]

Inherited from

Struct(RawCircuitString).toFields

Source

lib/provable/types/provable-intf.ts:26


toInput()

static toInput: (x: {
"values": Character[];
}) => {
"fields": Field[];
"packed": [Field, number][];
};

Parameters

x

x.values: Character[]

Returns

{
"fields": Field[];
"packed": [Field, number][];
}
fields?
optional fields: Field[];
packed?
optional packed: [Field, number][];

Inherited from

Struct(RawCircuitString).toInput

Source

lib/provable/types/struct.ts:149


toJSON()

static toJSON: (x: {
"values": Character[];
}) => {
"values": {
"value": Field;
}[];
};

Parameters

x

x.values: Character[]

Returns

{
"values": {
"value": Field;
}[];
}
values
values: {
"value": Field;
}[];

Inherited from

Struct(RawCircuitString).toJSON

Source

lib/provable/types/struct.ts:153


toValue()

static toValue: (x: {
"values": Character[];
}) => string;

Convert provable type to a normal JS type.

Parameters

x

x.values: Character[]

Returns

string

Inherited from

Struct(RawCircuitString).toValue

Source

lib/provable/types/provable-intf.ts:71

Methods

append()

append(str: CircuitString): CircuitString

appends another string to this one, returns the result and proves that it fits within the maxLength of this string (the other string can have a different maxLength)

Parameters

str: CircuitString

Returns

CircuitString

Source

lib/provable/string.ts:117


computeLengthAndMask()

computeLengthAndMask(): {
"length": Field;
"mask": Bool[];
}

Returns

{
"length": Field;
"mask": Bool[];
}
length
length: Field;
mask
mask: Bool[];

Source

lib/provable/string.ts:80


equals()

equals(other: CircuitString): Bool

returns true if this has the same value as other

Parameters

other: CircuitString

Returns

Bool

Source

lib/provable/string.ts:109


hash()

hash(): Field

Returns

Field

Source

lib/provable/string.ts:143


length()

length(): Field

Returns

Field

Source

lib/provable/string.ts:102


lengthMask()

lengthMask(): Bool[]

Returns

Bool[]

Source

lib/provable/string.ts:99


maxLength()

maxLength(): number

Returns

number

Source

lib/provable/string.ts:75


substring()

substring(start: number, end: number): CircuitString

Parameters

start: number

end: number

Returns

CircuitString

Source

lib/provable/string.ts:147


toString()

toString(): string

Returns

string

Source

lib/provable/string.ts:151


fromCharacters()

static fromCharacters(chars: Character[]): CircuitString

Parameters

chars: Character[]

Returns

CircuitString

Source

lib/provable/string.ts:71


fromString()

static fromString(str: string): CircuitString

Parameters

str: string

Returns

CircuitString

Source

lib/provable/string.ts:155


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(RawCircuitString).sizeInFields

Source

lib/provable/types/provable-intf.ts:56